diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb-0.25.0.dist-info/INSTALLER b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb-0.25.0.dist-info/INSTALLER new file mode 100644 index 0000000000000000000000000000000000000000..a1b589e38a32041e49332e5e81c2d363dc418d68 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb-0.25.0.dist-info/INSTALLER @@ -0,0 +1 @@ +pip diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb-0.25.0.dist-info/METADATA b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb-0.25.0.dist-info/METADATA new file mode 100644 index 0000000000000000000000000000000000000000..3145279bb635813b4a12bdc5c3d7d2143307aa4b --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb-0.25.0.dist-info/METADATA @@ -0,0 +1,241 @@ +Metadata-Version: 2.4 +Name: wandb +Version: 0.25.0 +Summary: A CLI and library for interacting with the Weights & Biases API. +Project-URL: Source, https://github.com/wandb/wandb +Project-URL: Bug Reports, https://github.com/wandb/wandb/issues +Project-URL: Documentation, https://docs.wandb.ai/ +Author-email: Weights & Biases +License: MIT License + + Copyright (c) 2021 Weights and Biases, Inc. + + 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. +License-File: LICENSE +Classifier: Development Status :: 5 - Production/Stable +Classifier: Intended Audience :: Developers +Classifier: Intended Audience :: Science/Research +Classifier: License :: OSI Approved :: MIT License +Classifier: Natural Language :: English +Classifier: Programming Language :: Go +Classifier: Programming Language :: Python :: 3 +Classifier: Programming Language :: Python :: 3 :: Only +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 :: Python :: 3.13 +Classifier: Programming Language :: Python :: 3.14 +Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence +Classifier: Topic :: Software Development :: Libraries :: Python Modules +Classifier: Topic :: System :: Logging +Classifier: Topic :: System :: Monitoring +Requires-Python: >=3.9 +Requires-Dist: click>=8.0.1 +Requires-Dist: eval-type-backport; python_version < '3.10' +Requires-Dist: gitpython!=3.1.29,>=1.0.0 +Requires-Dist: packaging +Requires-Dist: platformdirs +Requires-Dist: protobuf!=4.21.0,!=5.28.0,<7,>=3.15.0; python_version == '3.9' and sys_platform == 'linux' +Requires-Dist: protobuf!=4.21.0,!=5.28.0,<7,>=3.19.0; python_version > '3.9' and sys_platform == 'linux' +Requires-Dist: protobuf!=4.21.0,!=5.28.0,<7,>=3.19.0; sys_platform != 'linux' +Requires-Dist: pydantic<3 +Requires-Dist: pyyaml +Requires-Dist: requests<3,>=2.0.0 +Requires-Dist: sentry-sdk>=2.0.0 +Requires-Dist: typing-extensions<5,>=4.8 +Provides-Extra: aws +Requires-Dist: boto3; extra == 'aws' +Requires-Dist: botocore>=1.5.76; extra == 'aws' +Provides-Extra: azure +Requires-Dist: azure-identity; extra == 'azure' +Requires-Dist: azure-storage-blob; extra == 'azure' +Provides-Extra: gcp +Requires-Dist: google-cloud-storage; extra == 'gcp' +Provides-Extra: importers +Requires-Dist: filelock; extra == 'importers' +Requires-Dist: mlflow; extra == 'importers' +Requires-Dist: polars<=1.2.1; extra == 'importers' +Requires-Dist: rich; extra == 'importers' +Requires-Dist: tenacity; extra == 'importers' +Provides-Extra: kubeflow +Requires-Dist: google-cloud-storage; extra == 'kubeflow' +Requires-Dist: kubernetes; extra == 'kubeflow' +Requires-Dist: minio; extra == 'kubeflow' +Requires-Dist: sh; extra == 'kubeflow' +Provides-Extra: launch +Requires-Dist: awscli; extra == 'launch' +Requires-Dist: azure-containerregistry; extra == 'launch' +Requires-Dist: azure-identity; extra == 'launch' +Requires-Dist: azure-storage-blob; extra == 'launch' +Requires-Dist: boto3; extra == 'launch' +Requires-Dist: botocore>=1.5.76; extra == 'launch' +Requires-Dist: chardet; extra == 'launch' +Requires-Dist: google-auth; extra == 'launch' +Requires-Dist: google-cloud-aiplatform; extra == 'launch' +Requires-Dist: google-cloud-artifact-registry; extra == 'launch' +Requires-Dist: google-cloud-compute; extra == 'launch' +Requires-Dist: google-cloud-storage; extra == 'launch' +Requires-Dist: iso8601; extra == 'launch' +Requires-Dist: jsonschema; extra == 'launch' +Requires-Dist: kubernetes; extra == 'launch' +Requires-Dist: kubernetes-asyncio; extra == 'launch' +Requires-Dist: nbconvert; extra == 'launch' +Requires-Dist: nbformat; extra == 'launch' +Requires-Dist: optuna; extra == 'launch' +Requires-Dist: pydantic; extra == 'launch' +Requires-Dist: pyyaml>=6.0.0; extra == 'launch' +Requires-Dist: tomli; extra == 'launch' +Requires-Dist: tornado>=6.5.0; (python_version >= '3.9') and extra == 'launch' +Requires-Dist: typing-extensions; extra == 'launch' +Provides-Extra: media +Requires-Dist: bokeh; extra == 'media' +Requires-Dist: imageio>=2.28.1; extra == 'media' +Requires-Dist: moviepy>=1.0.0; extra == 'media' +Requires-Dist: numpy; extra == 'media' +Requires-Dist: pillow; extra == 'media' +Requires-Dist: plotly>=5.18.0; extra == 'media' +Requires-Dist: rdkit; extra == 'media' +Requires-Dist: soundfile; extra == 'media' +Provides-Extra: models +Requires-Dist: cloudpickle; extra == 'models' +Provides-Extra: perf +Requires-Dist: orjson; extra == 'perf' +Provides-Extra: sweeps +Requires-Dist: sweeps>=0.2.0; extra == 'sweeps' +Provides-Extra: workspaces +Requires-Dist: wandb-workspaces; extra == 'workspaces' +Description-Content-Type: text/markdown + +
+

+
+ +

+ + + + + +

+

+ +

+ +Use W&B to build better models faster. Track and visualize all the pieces of your machine learning pipeline, from datasets to production machine learning models. Get started with W&B today, [sign up for a W&B account](https://wandb.com?utm_source=github&utm_medium=code&utm_campaign=wandb&utm_content=readme)! + +
+ +Building an LLM app? Track, debug, evaluate, and monitor LLM apps with [Weave](https://wandb.github.io/weave?utm_source=github&utm_medium=code&utm_campaign=wandb&utm_content=readme), our new suite of tools for GenAI. + +  + +# Documentation + +See the [W&B Developer Guide](https://docs.wandb.ai/?utm_source=github&utm_medium=code&utm_campaign=wandb&utm_content=documentation) and [API Reference Guide](https://docs.wandb.ai/training/api-reference#api-overview?utm_source=github&utm_medium=code&utm_campaign=wandb&utm_content=documentation) for a full technical description of the W&B platform. + +  + +# Quickstart + +Install W&B to track, visualize, and manage machine learning experiments of any size. + +## Install the wandb library + +```shell +pip install wandb +``` + +## Sign up and create an API key + +Sign up for a [W&B account](https://wandb.ai/login?utm_source=github&utm_medium=code&utm_campaign=wandb&utm_content=quickstart). Optionally, use the `wandb login` CLI to configure an API key on your machine. You can skip this step -- W&B will prompt you for an API key the first time you use it. + +## Create a machine learning training experiment + +In your Python script or notebook, initialize a W&B run with `wandb.init()`. +Specify hyperparameters and log metrics and other information to W&B. + +```python +import wandb + +# Project that the run is recorded to +project = "my-awesome-project" + +# Dictionary with hyperparameters +config = {"epochs" : 1337, "lr" : 3e-4} + +# The `with` syntax marks the run as finished upon exiting the `with` block, +# and it marks the run "failed" if there's an exception. +# +# In a notebook, it may be more convenient to write `run = wandb.init()` +# and manually call `run.finish()` instead of using a `with` block. +with wandb.init(project=project, config=config) as run: + # Training code here + + # Log values to W&B with run.log() + run.log({"accuracy": 0.9, "loss": 0.1}) +``` + +Visit [wandb.ai/home](https://wandb.ai/home) to view recorded metrics such as accuracy and loss and how they changed during each training step. Each run object appears in the Runs column with generated names. + +  + +# Integrations + +W&B [integrates](https://docs.wandb.ai/models/integrations) with popular ML frameworks and libraries making it fast and easy to set up experiment tracking and data versioning inside existing projects. + +For developers adding W&B to a new framework, follow the [W&B Developer Guide](https://docs.wandb.ai/models/integrations/add-wandb-to-any-library). + +  + +# W&B Hosting Options + +Weights & Biases is available in the cloud or installed on your private infrastructure. Set up a W&B Server in a production environment in one of three ways: + +1. [Multi-tenant Cloud](https://docs.wandb.ai/platform/hosting/hosting-options/multi_tenant_cloud?utm_source=github&utm_medium=code&utm_campaign=wandb&utm_content=hosting): Fully managed platform deployed in W&B’s Google Cloud Platform (GCP) account in GCP’s North America regions. +2. [Dedicated Cloud](https://docs.wandb.ai/platform/hosting/hosting-options/dedicated_cloud?utm_source=github&utm_medium=code&utm_campaign=wandb&utm_content=hosting): Single-tenant, fully managed platform deployed in W&B’s AWS, GCP, or Azure cloud accounts. Each Dedicated Cloud instance has its own isolated network, compute and storage from other W&B Dedicated Cloud instances. +3. [Self-Managed](https://docs.wandb.ai/platform/hosting/hosting-options/self-managed?utm_source=github&utm_medium=code&utm_campaign=wandb&utm_content=hosting): Deploy W&B Server on your AWS, GCP, or Azure cloud account or within your on-premises infrastructure. + +See the [Hosting documentation](https://docs.wandb.ai/guides/hosting?utm_source=github&utm_medium=code&utm_campaign=wandb&utm_content=hosting) in the W&B Developer Guide for more information. + +  + +# Python Version Support + +We are committed to supporting our minimum required Python version for _at least_ six months after its official end-of-life (EOL) date, as defined by the Python Software Foundation. You can find a list of Python EOL dates [here](https://devguide.python.org/versions/). + +When we discontinue support for a Python version, we will increment the library’s minor version number to reflect this change. + +  + +# Contribution guidelines + +Weights & Biases ❤️ open source, and we welcome contributions from the community! See the [Contribution guide](https://github.com/wandb/wandb/blob/main/CONTRIBUTING.md) for more information on the development workflow and the internals of the wandb library. For wandb bugs and feature requests, visit [GitHub Issues](https://github.com/wandb/wandb/issues) or contact support@wandb.com. + +  + +# W&B Community + +Be a part of the growing W&B Community and interact with the W&B team in our [Discord](https://wandb.me/discord). Stay connected with the latest ML updates and tutorials with [W&B Fully Connected](https://wandb.ai/fully-connected). + +  + +# License + +[MIT License](https://github.com/wandb/wandb/blob/main/LICENSE) diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb-0.25.0.dist-info/RECORD b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb-0.25.0.dist-info/RECORD new file mode 100644 index 0000000000000000000000000000000000000000..a95175962207bf27f7f9ee37aa5f951f0feeb6db --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb-0.25.0.dist-info/RECORD @@ -0,0 +1,1923 @@ +../../../bin/wandb,sha256=HjFgZuRUddXY7VCVIp8reGbwlEKx47S5WcsaHZOiI7Y,219 +../../../bin/wb,sha256=HjFgZuRUddXY7VCVIp8reGbwlEKx47S5WcsaHZOiI7Y,219 +package_readme.md,sha256=rz24ZSOu5-JdiXWmNveWA-1GlEtzKblBjDTI-VdII5s,6235 +wandb-0.25.0.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4 +wandb-0.25.0.dist-info/METADATA,sha256=2VPmf5tlyTC1IxeHtm8V7ZVNZVmnHO1bsoWZuilod0M,12077 +wandb-0.25.0.dist-info/RECORD,, +wandb-0.25.0.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +wandb-0.25.0.dist-info/WHEEL,sha256=L3312W2ru4sMbRjJjVEluO3lnnYAt3rp5K6g8_i3xMs,106 +wandb-0.25.0.dist-info/entry_points.txt,sha256=v4FCOZ9gW7Pc6KLsmgQqpCiKTrA1wh2XHmNf-NUP1-I,67 +wandb-0.25.0.dist-info/licenses/LICENSE,sha256=izOKRJpGOx1PrJiGOKR0HsNdlB5JdH2d0Z4P7a7ssTc,1081 +wandb/__init__.py,sha256=xX83PeslIFu8tLUqLdDu5RHbQuvbA3PBZQKslvnlOC0,5742 +wandb/__init__.pyi,sha256=X_S2qNTuKnzYCgLubR1e1ZpGfLCdurIcjKLJhSq6ovY,46785 +wandb/__main__.py,sha256=gripuDgB7J8wMMeJt4CIBRjn1BMSFr5zvsrt585Pnj4,64 +wandb/__pycache__/__init__.cpython-310.pyc,, +wandb/__pycache__/__main__.cpython-310.pyc,, +wandb/__pycache__/_analytics.cpython-310.pyc,, +wandb/__pycache__/_iterutils.cpython-310.pyc,, +wandb/__pycache__/_strutils.cpython-310.pyc,, +wandb/__pycache__/data_types.cpython-310.pyc,, +wandb/__pycache__/env.cpython-310.pyc,, +wandb/__pycache__/jupyter.cpython-310.pyc,, +wandb/__pycache__/sklearn.cpython-310.pyc,, +wandb/__pycache__/trigger.cpython-310.pyc,, +wandb/__pycache__/util.cpython-310.pyc,, +wandb/__pycache__/wandb_agent.cpython-310.pyc,, +wandb/__pycache__/wandb_controller.cpython-310.pyc,, +wandb/__pycache__/wandb_run.cpython-310.pyc,, +wandb/_analytics.py,sha256=XkUDTTo599nAU7HsnX2yzox6NdcJoPrlDLWcd7U4WfY,1986 +wandb/_iterutils.py,sha256=Kdm09qK89yr4TgKf3At6HVUp0fubv2GtB9Q6Mz53mNU,2739 +wandb/_pydantic/__init__.py,sha256=Asz-bVvdTM0arhGXWyY-xMkTgBnxy1jAJQc2QPHLCvA,978 +wandb/_pydantic/__pycache__/__init__.cpython-310.pyc,, +wandb/_pydantic/__pycache__/base.cpython-310.pyc,, +wandb/_pydantic/__pycache__/field_types.cpython-310.pyc,, +wandb/_pydantic/__pycache__/pagination.cpython-310.pyc,, +wandb/_pydantic/__pycache__/utils.cpython-310.pyc,, +wandb/_pydantic/__pycache__/v1_compat.cpython-310.pyc,, +wandb/_pydantic/base.py,sha256=fNJ0TZ9xNk8AHR5jFG5aMutlFqgcuOTlHiMEEjf0mn4,5707 +wandb/_pydantic/field_types.py,sha256=pNBQb1KNsAYiDc8nBR-MT2Pveg2i0tLE6rf3GL1p-14,1081 +wandb/_pydantic/pagination.py,sha256=KD-zmweg5sCkwibCNL-TjjHoXzP3SEdvZZCBezhiLY4,3136 +wandb/_pydantic/utils.py,sha256=2NYasVcZdZa-rlD9Z3v2yp1pxDpKey-5cCvBsS8TJNg,2836 +wandb/_pydantic/v1_compat.py,sha256=PptV3eCOlvFIDMywEsS1d2WXJmCxW1Mgd6YcNKII9Qk,14753 +wandb/_strutils.py,sha256=y_hAhgVnAmbY9qo7ZArOljeu9-wYlJxR1EKns9oqZyw,1227 +wandb/agents/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +wandb/agents/__pycache__/__init__.cpython-310.pyc,, +wandb/agents/__pycache__/pyagent.cpython-310.pyc,, +wandb/agents/pyagent.py,sha256=yjIRlqV2o40jJ-ODaizh7ZFXn_-uhz0y5Q67xENqwl0,14577 +wandb/analytics/__init__.py,sha256=M3d7nhVoRT8eZjP2vJIgLG8oWDG3swo3apTxHHNIJvo,58 +wandb/analytics/__pycache__/__init__.cpython-310.pyc,, +wandb/analytics/__pycache__/sentry.cpython-310.pyc,, +wandb/analytics/sentry.py,sha256=L6DvOj39QgPw2fG8hQuokDk_Wr4o7xyCb_Z0csYuII8,9203 +wandb/apis/__init__.py,sha256=q0-gOz6FP2uu9nZbS3bp67L3PJ8A8_9_L13lsUOmUVw,1382 +wandb/apis/__pycache__/__init__.cpython-310.pyc,, +wandb/apis/__pycache__/attrs.cpython-310.pyc,, +wandb/apis/__pycache__/internal.cpython-310.pyc,, +wandb/apis/__pycache__/normalize.cpython-310.pyc,, +wandb/apis/__pycache__/paginator.cpython-310.pyc,, +wandb/apis/_generated/__init__.py,sha256=3Y8vHlYlHGJDDM8AS6T4p1egmY7tynpfYjCKzwhzt2s,2585 +wandb/apis/_generated/__pycache__/__init__.cpython-310.pyc,, +wandb/apis/_generated/__pycache__/create_invite.cpython-310.pyc,, +wandb/apis/_generated/__pycache__/create_project.cpython-310.pyc,, +wandb/apis/_generated/__pycache__/create_service_account.cpython-310.pyc,, +wandb/apis/_generated/__pycache__/create_team.cpython-310.pyc,, +wandb/apis/_generated/__pycache__/create_user_from_admin.cpython-310.pyc,, +wandb/apis/_generated/__pycache__/delete_api_key.cpython-310.pyc,, +wandb/apis/_generated/__pycache__/delete_invite.cpython-310.pyc,, +wandb/apis/_generated/__pycache__/enums.cpython-310.pyc,, +wandb/apis/_generated/__pycache__/fragments.cpython-310.pyc,, +wandb/apis/_generated/__pycache__/generate_api_key.cpython-310.pyc,, +wandb/apis/_generated/__pycache__/get_default_entity.cpython-310.pyc,, +wandb/apis/_generated/__pycache__/get_project.cpython-310.pyc,, +wandb/apis/_generated/__pycache__/get_projects.cpython-310.pyc,, +wandb/apis/_generated/__pycache__/get_sweep.cpython-310.pyc,, +wandb/apis/_generated/__pycache__/get_sweep_legacy.cpython-310.pyc,, +wandb/apis/_generated/__pycache__/get_sweeps.cpython-310.pyc,, +wandb/apis/_generated/__pycache__/get_team_entity.cpython-310.pyc,, +wandb/apis/_generated/__pycache__/get_viewer.cpython-310.pyc,, +wandb/apis/_generated/__pycache__/input_types.cpython-310.pyc,, +wandb/apis/_generated/__pycache__/operations.cpython-310.pyc,, +wandb/apis/_generated/__pycache__/search_users.cpython-310.pyc,, +wandb/apis/_generated/create_invite.py,sha256=cZ3g98qcejHRmplwZIZqk5s2bf8qf6Kb-DUiSL7_BIw,772 +wandb/apis/_generated/create_project.py,sha256=xnScO2xHf798flnDqvqzlmhTEEsA5iSiIdSoS5Ic0tg,522 +wandb/apis/_generated/create_service_account.py,sha256=2ys_-XM3ZQFOH95C6qXFqzqrW4QlwGuiHaPskbusSbE,514 +wandb/apis/_generated/create_team.py,sha256=WDBM6zs-knt6GdW-Flhn9unSodTyiW7rD776JH3WlwU,603 +wandb/apis/_generated/create_user_from_admin.py,sha256=MqVkvidUnKmFgURMRrmOf7SdEU_SJxXBK5x_IFihT8U,464 +wandb/apis/_generated/delete_api_key.py,sha256=TFfFxEXOhXUaK08ccSGFjvxfAJYndpEJBENQF46FVwk,344 +wandb/apis/_generated/delete_invite.py,sha256=ofX_QrkkY2HVvV-xoHTU2OgWoR6HKi-ZbYM_8O2PFqQ,344 +wandb/apis/_generated/enums.py,sha256=vPRi0TPBkZS4D4to-WzhesolsPj3a2B1Okr1xmjRy5k,124 +wandb/apis/_generated/fragments.py,sha256=inTov1XNFAehnq6pIzyRMqjxEqIp4sQMvA3ST2Zq1LI,3186 +wandb/apis/_generated/generate_api_key.py,sha256=A_uRs-wXviuoDI3RRw4if-Dx50X493B9fH_aWIPuOC4,490 +wandb/apis/_generated/get_default_entity.py,sha256=5Ee9Tqp56rPyblMQiEA2-Fe6b0HuaodajQVCAt0xvvQ,379 +wandb/apis/_generated/get_project.py,sha256=4GIbApLSRpcYQYpPgeT6IeGxrMEg7cwwlaInloT3YHs,311 +wandb/apis/_generated/get_projects.py,sha256=atKBMgAj2xEjgmIT_NdXYNQuhdtuUhFSNg7AGcPrF2o,654 +wandb/apis/_generated/get_sweep.py,sha256=v2LdnoR8HtxWVYZiMeZUn_S5R5eSHkS6VZbevuDYao8,408 +wandb/apis/_generated/get_sweep_legacy.py,sha256=WXvI2d0-7AnfPkVKdfkbyXhv-ybmlbYaK3IlQa5XgFo,450 +wandb/apis/_generated/get_sweeps.py,sha256=QqSjF0h4MV05W2abZ7ec8_viQNTV8lxN1A6_vwWi5a0,827 +wandb/apis/_generated/get_team_entity.py,sha256=i3l5fmk588aBf75TZWBZyhxATBPCRAa4nKqIyPi0dvo,1345 +wandb/apis/_generated/get_viewer.py,sha256=0Ig4kJ4bjHitxdr7ZDZqDmX0mt56JpE-fHzTf8NcPBQ,302 +wandb/apis/_generated/input_types.py,sha256=2Nw4Kk4u0PrFwkFhgy3LF0lAbbBlr23q0ooNe6UNI3A,2542 +wandb/apis/_generated/operations.py,sha256=nu-gPLULGwjVyd8mrmLOIOswxFCvNdEpdRVF9uflTGo,6727 +wandb/apis/_generated/search_users.py,sha256=nEDV5gfKzZ1R4Nya-sZDXaFqRE5Vzq6py2qmk0-I7L8,537 +wandb/apis/attrs.py,sha256=8fc8oDTVoVP_RroJwwKV9BQ8s-NonDHljfqq5D9Bkw8,1477 +wandb/apis/importers/__init__.py,sha256=ewph-RBUC9FnxL6uWbuuW0Hmdv2cHsxfqnZi0546ds4,38 +wandb/apis/importers/__pycache__/__init__.cpython-310.pyc,, +wandb/apis/importers/__pycache__/mlflow.cpython-310.pyc,, +wandb/apis/importers/__pycache__/validation.cpython-310.pyc,, +wandb/apis/importers/__pycache__/wandb.cpython-310.pyc,, +wandb/apis/importers/internals/__pycache__/internal.cpython-310.pyc,, +wandb/apis/importers/internals/__pycache__/protocols.cpython-310.pyc,, +wandb/apis/importers/internals/__pycache__/util.cpython-310.pyc,, +wandb/apis/importers/internals/internal.py,sha256=1tXOFkYvfZPrdQB3L50dhOSBkmNhs6XdWjQIF67lAAw,12886 +wandb/apis/importers/internals/protocols.py,sha256=bANE3ANLd6671VuauT26Dfn0T6uuxJJ8hO9_eWiWK5E,2812 +wandb/apis/importers/internals/util.py,sha256=CaiCrqHmK10MzsGJMWjVFTudowkEkLfSnEruukp-SnY,2110 +wandb/apis/importers/mlflow.py,sha256=ZgCSapIyvGDNwrvbKv_gUQ5On6mGFQaHhu5YXSDQQB8,8197 +wandb/apis/importers/validation.py,sha256=XhNOQsVzEJnek3l7eRjWipKtylm7s0KrXUVqLjuu494,3102 +wandb/apis/importers/wandb.py,sha256=Znlhj920kzVZD3e0kp89hvSeFG_xa7UU34evGI4ZI1A,54351 +wandb/apis/internal.py,sha256=hXMqTqugWiqlluWkZENwwFl5hXEWEx2HayP7klbTGAY,7451 +wandb/apis/normalize.py,sha256=RYLGB2g3c-b4J-dPM58qBjDkcQ6AHJ7TviPKRSprRw8,2710 +wandb/apis/paginator.py,sha256=WDmlWcaUP4EsU_7R4Mvfx7tkni1fSgPkPOKsDgEqWE0,5793 +wandb/apis/public/__init__.py,sha256=PkbOr7OddVzObAxABNMOjuO0h0v9gWLwRH0W3A1TVx4,2365 +wandb/apis/public/__pycache__/__init__.cpython-310.pyc,, +wandb/apis/public/__pycache__/api.cpython-310.pyc,, +wandb/apis/public/__pycache__/artifacts.cpython-310.pyc,, +wandb/apis/public/__pycache__/automations.cpython-310.pyc,, +wandb/apis/public/__pycache__/const.cpython-310.pyc,, +wandb/apis/public/__pycache__/files.cpython-310.pyc,, +wandb/apis/public/__pycache__/history.cpython-310.pyc,, +wandb/apis/public/__pycache__/integrations.cpython-310.pyc,, +wandb/apis/public/__pycache__/jobs.cpython-310.pyc,, +wandb/apis/public/__pycache__/projects.cpython-310.pyc,, +wandb/apis/public/__pycache__/query_generator.cpython-310.pyc,, +wandb/apis/public/__pycache__/reports.cpython-310.pyc,, +wandb/apis/public/__pycache__/runs.cpython-310.pyc,, +wandb/apis/public/__pycache__/sweeps.cpython-310.pyc,, +wandb/apis/public/__pycache__/teams.cpython-310.pyc,, +wandb/apis/public/__pycache__/users.cpython-310.pyc,, +wandb/apis/public/__pycache__/utils.cpython-310.pyc,, +wandb/apis/public/api.py,sha256=-faJXapKgVqFGkQv6EQsOODfLn2A1gryazPFT1CPzEc,91656 +wandb/apis/public/artifacts.py,sha256=LP9lvwaIbCE05bzJ7WTgTolozntNvZ_kJoX5uyGWTRc,33620 +wandb/apis/public/automations.py,sha256=fJd_wMJP5rAKpmZlWb8guzuIKfSiXWcJd47XHEerwag,2173 +wandb/apis/public/const.py,sha256=lalM0qiWJrpneya84HRspYDrm8htRSaZcxC7_SPhIJA,157 +wandb/apis/public/files.py,sha256=iV70SI-r4iFz1WNmFw8sHI_tnfnjKGju7IS4Y0e3owU,14680 +wandb/apis/public/history.py,sha256=4FJSgW5-3urcB-DB4kPQdIv8jX7_sOSG5MU82_OXz7g,10859 +wandb/apis/public/integrations.py,sha256=7rOB0dDtwG87cSMt2bS1MbzD58-myCL4bhJVo4yNoOw,3038 +wandb/apis/public/jobs.py,sha256=sphKtlmZExUNt4LMKA2RklxXHph9nWBfIF2XMP89QRA,26908 +wandb/apis/public/projects.py,sha256=yXx5MwvkCNxF9ZUofxWSGwtQQkPfFpgV47Gny5vW4vc,8142 +wandb/apis/public/query_generator.py,sha256=mxJHCw8J3lTc2l-mV9HFwCCDyoc2akNyxQnaU8QHyCM,6557 +wandb/apis/public/registries/__init__.py,sha256=FLugggtF8YwBR1zJJYF3DGKJlYThAwQTOFTFEL24c_0,152 +wandb/apis/public/registries/__pycache__/__init__.cpython-310.pyc,, +wandb/apis/public/registries/__pycache__/_freezable_list.cpython-310.pyc,, +wandb/apis/public/registries/__pycache__/_members.cpython-310.pyc,, +wandb/apis/public/registries/__pycache__/_utils.cpython-310.pyc,, +wandb/apis/public/registries/__pycache__/registries_search.cpython-310.pyc,, +wandb/apis/public/registries/__pycache__/registry.cpython-310.pyc,, +wandb/apis/public/registries/_freezable_list.py,sha256=PoiYS4PkvunLid6XckIKaCo132zbdja0Te8SKEYO2eI,6313 +wandb/apis/public/registries/_members.py,sha256=VdvEHnLstUmNhNQHEF5bOE1SjY9Vrcfn3QCCTL-6FZI,3377 +wandb/apis/public/registries/_utils.py,sha256=BPzLXKTf69rLbgD7qvsZmp01fLB-qZHut5LzXSIrjxI,4273 +wandb/apis/public/registries/registries_search.py,sha256=wHK6FIiqpeJRJMof9e4PdyNF8Kb0-xoJdMFwdPcv1VA,11321 +wandb/apis/public/registries/registry.py,sha256=_NQsd5wS_AnqdSagGJmLJPIZJOPZzaI04CujHnXOsKI,23547 +wandb/apis/public/reports.py,sha256=wTRpnpHAZEckuQPnQRciUQmXf5p_0LImzpavdhllcWY,20383 +wandb/apis/public/runhistory/__init__.py,sha256=-1I2kQuRiRZ1J2asHZwfM01koGPEcrLlytNpfz3ogEQ,238 +wandb/apis/public/runhistory/__pycache__/__init__.cpython-310.pyc,, +wandb/apis/public/runhistory/__pycache__/downloads.cpython-310.pyc,, +wandb/apis/public/runhistory/downloads.py,sha256=_XvOInhMA987LGmsXcYjnDaOrIK4JnkOpILtFJMJdtw,5023 +wandb/apis/public/runs.py,sha256=c7EQ94hgJW4eu0KVLz-P9ppfbQ11cyOEBcyZ4aYSgYw,59690 +wandb/apis/public/sweeps.py,sha256=CHigFGLYovv-swljLhreImVZVgmqPtdAWmLKmMDW3GA,12063 +wandb/apis/public/teams.py,sha256=QDhZ4imIuf7j00ZIrYvtTvFUX9qilzpS3o15yQIeSk8,5547 +wandb/apis/public/users.py,sha256=LcqkL6fM-EIvUs2J5qdbenLeRmOtBs2FoOwK6ub-dNM,5375 +wandb/apis/public/utils.py,sha256=fEPZvCfs7UYnGSMU3zR6orv0L2AGc-4XsK25uIQ79ZI,9375 +wandb/apis/reports/__init__.py,sha256=5ZkKvOqwks3UmVeaPuwIZYwyV8_afsGbtybDOXYjSsg,32 +wandb/apis/reports/__pycache__/__init__.cpython-310.pyc,, +wandb/apis/reports/v1/__init__.py,sha256=L5l1BqMaap-w5wXCzn8pC8RXB7_72MsjTx8HeLuC3XU,263 +wandb/apis/reports/v1/__pycache__/__init__.cpython-310.pyc,, +wandb/apis/reports/v2/__init__.py,sha256=jdLiTqf5QIRxnWH8drWV9Y06bZEhI5N6uGGSKAT7tv0,263 +wandb/apis/reports/v2/__pycache__/__init__.cpython-310.pyc,, +wandb/apis/workspaces/__init__.py,sha256=buvqtqELpCFWC7sHzEuslJgx24ZWDj-5lo2mdV6aHdg,265 +wandb/apis/workspaces/__pycache__/__init__.cpython-310.pyc,, +wandb/automations/__init__.py,sha256=U4ks1cBARyQgXgnHm2ICoTcFXf4U6GE74VNtF_2av40,2491 +wandb/automations/__pycache__/__init__.cpython-310.pyc,, +wandb/automations/__pycache__/_utils.cpython-310.pyc,, +wandb/automations/__pycache__/_validators.cpython-310.pyc,, +wandb/automations/__pycache__/actions.cpython-310.pyc,, +wandb/automations/__pycache__/automations.cpython-310.pyc,, +wandb/automations/__pycache__/events.cpython-310.pyc,, +wandb/automations/__pycache__/integrations.cpython-310.pyc,, +wandb/automations/__pycache__/scopes.cpython-310.pyc,, +wandb/automations/_filters/__init__.py,sha256=UxAEPbeI7wUqZY-w8FgsMU4Jp5rgSxwuQXc_VhdpDWE,466 +wandb/automations/_filters/__pycache__/__init__.cpython-310.pyc,, +wandb/automations/_filters/__pycache__/expressions.cpython-310.pyc,, +wandb/automations/_filters/__pycache__/filterutils.cpython-310.pyc,, +wandb/automations/_filters/__pycache__/operators.cpython-310.pyc,, +wandb/automations/_filters/__pycache__/run_metrics.cpython-310.pyc,, +wandb/automations/_filters/__pycache__/run_states.cpython-310.pyc,, +wandb/automations/_filters/expressions.py,sha256=QVgSEEexVtBOlxquqqeV4ed0fzL3DUtkWZVDNAX8nug,5921 +wandb/automations/_filters/filterutils.py,sha256=HipHl-XmBPHzVD9wSSIpghn1yiGFHnrqhgWn5_rUjk8,2701 +wandb/automations/_filters/operators.py,sha256=hat0OhXhk0mHG3hjoAovUh7Az-M9BAfkqSg5779L5fg,7872 +wandb/automations/_filters/run_metrics.py,sha256=gJhv2ZQxUkVKV2jzNw2u5UG3b8-lv3wGw8ZbxtD7GAI,19196 +wandb/automations/_filters/run_states.py,sha256=o3rrnNyu4UB-2q3oxrmRUi1VRbOZ-_cGcNGnLQv5nuo,3059 +wandb/automations/_generated/__init__.py,sha256=JSW4vZ-9uMv5MhLmLNiWd1Xb_zptIJPnKeYokJUxalc,2681 +wandb/automations/_generated/__pycache__/__init__.cpython-310.pyc,, +wandb/automations/_generated/__pycache__/create_automation.cpython-310.pyc,, +wandb/automations/_generated/__pycache__/create_generic_webhook_integration.cpython-310.pyc,, +wandb/automations/_generated/__pycache__/delete_automation.cpython-310.pyc,, +wandb/automations/_generated/__pycache__/enums.cpython-310.pyc,, +wandb/automations/_generated/__pycache__/fragments.cpython-310.pyc,, +wandb/automations/_generated/__pycache__/get_automations.cpython-310.pyc,, +wandb/automations/_generated/__pycache__/get_automations_by_entity.cpython-310.pyc,, +wandb/automations/_generated/__pycache__/input_types.cpython-310.pyc,, +wandb/automations/_generated/__pycache__/integrations_by_entity.cpython-310.pyc,, +wandb/automations/_generated/__pycache__/operations.cpython-310.pyc,, +wandb/automations/_generated/__pycache__/update_automation.cpython-310.pyc,, +wandb/automations/_generated/create_automation.py,sha256=MSCMnE-Hz_Zufj6kuXh6e9Z1JZPZ-oXogZ_D4gdlXEc,454 +wandb/automations/_generated/create_generic_webhook_integration.py,sha256=sce6q01uJ7YBSkyXcUO-qKhMqI9x03Wj0fAMvj2uz2A,1137 +wandb/automations/_generated/delete_automation.py,sha256=Ff-zrNy5xLahh4vxSrMrd8JB30Ynsb4g6JGmhEKSeJQ,319 +wandb/automations/_generated/enums.py,sha256=wNC3EiRkk0mAVFQMKxgLS7fJaT-Tz-FRFSlGOqaCu-Q,957 +wandb/automations/_generated/fragments.py,sha256=PBID0Bekdn23T9bmVN1MCdZcLm59cl5uZxwn9rdDr0Y,5321 +wandb/automations/_generated/get_automations.py,sha256=XTl3_WS9sFnMLtxQA7rvFsEoV8XCgnpXDVGug0WGbPQ,855 +wandb/automations/_generated/get_automations_by_entity.py,sha256=21euildzFyEmt50QXy9OCJOnH5EAG0SeUsHx-owv9PQ,943 +wandb/automations/_generated/input_types.py,sha256=gRBUywvvBatdtyn-NT2OXy7UzVhNlBTaUwnVKW6gZJQ,3963 +wandb/automations/_generated/integrations_by_entity.py,sha256=TYXTaI4JyU0Km5TENz13rwTCGElHYI8sRNVlmZfobXE,1429 +wandb/automations/_generated/operations.py,sha256=ILyDRSxGnGh0ka-3d5lMqJ28bTk9GVtHFOwl9434qWw,8846 +wandb/automations/_generated/update_automation.py,sha256=cw4yRi3aOFseulrarVVjcn5bQ8wJOm_nftVI9iIuIH4,454 +wandb/automations/_utils.py,sha256=eGN8Rp-rLEFuTb5rSal-MGYz2SZPA3qoIE312zCalr4,8122 +wandb/automations/_validators.py,sha256=L6_qYjePQWkCEV4RyH_6-BHSpaLdB6oCbzj4Gl2Ik-E,4795 +wandb/automations/actions.py,sha256=f6tk47WegOul7Lk9nUn_76-FhSCtEsrwqw_JSIvmjWU,7589 +wandb/automations/automations.py,sha256=dclzyie6QM5AzLJtJa8gkln-4Rbf_QnPxJHH-oRKqn8,2683 +wandb/automations/events.py,sha256=58lI5lMnq6Gv40ECuZxRmeko4KUReaBd8aesjT68EfA,13924 +wandb/automations/integrations.py,sha256=-VM1FwYK-jJILk8J0gwpoc6lMymSwAuDmie2fd58A4c,972 +wandb/automations/scopes.py,sha256=X-MPLaNDyF2x4mCwV7vRDDS3hLnT-ER-Dl4VCoHgXDw,2290 +wandb/bin/gpu_stats,sha256=dB_VKSfEysrK4QfAX34XPDi4TinkU4ckInvrdReyK6A,11341928 +wandb/bin/wandb-core,sha256=RopZMFvQybB2kYq6y4nZwMhjwcoytPuWhh072TzgBKI,64131256 +wandb/cli/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +wandb/cli/__pycache__/__init__.cpython-310.pyc,, +wandb/cli/__pycache__/beta.cpython-310.pyc,, +wandb/cli/__pycache__/beta_leet.cpython-310.pyc,, +wandb/cli/__pycache__/beta_sync.cpython-310.pyc,, +wandb/cli/__pycache__/cli.cpython-310.pyc,, +wandb/cli/beta.py,sha256=Lk30T2niFlgu5oaJoKSHR3oNsMPbwzsdq_uDzduOy7o,5902 +wandb/cli/beta_leet.py,sha256=cgOijckBf03ifVGvR0lFJR863G-8ouezq_kMksOIn90,3388 +wandb/cli/beta_sync.py,sha256=LdXqPOP9pY8_uVdcymDRRBlXyDr6SYPTo5TyHHYt6m8,10385 +wandb/cli/cli.py,sha256=7I4lvksIogyq0iFv8pRCKRgewhGirwYmve-EblYulaI,97371 +wandb/data_types.py,sha256=M-wqAO0FtIqvj28556u3h4nzSwlRcbxhXoX0B9jlJSo,2283 +wandb/docker/__init__.py,sha256=er2YUygrfpcDISnGbzsJgCu7Eam8xg6OIx2CUgXBSZI,8529 +wandb/docker/__pycache__/__init__.cpython-310.pyc,, +wandb/docker/__pycache__/names.cpython-310.pyc,, +wandb/docker/names.py,sha256=xI3DYzgYpkjaCz4qTKnm49fnexMkNCUjBuhunxAYyeE,1311 +wandb/docker/wandb-entrypoint.sh,sha256=P4eTMG7wYsgTfJIws_HT7QFlYBI70ZLnNlDGTZdmYVE,989 +wandb/env.py,sha256=ifRR6ek3iIO9IuFCAWSUgIZ8_3Cipjstaj-Vu4Pg5rc,14002 +wandb/errors/__init__.py,sha256=Tlij_4c-SxruLN-p0sDfDpF-HktBcHeAbztwGqQ84cU,293 +wandb/errors/__pycache__/__init__.cpython-310.pyc,, +wandb/errors/__pycache__/errors.cpython-310.pyc,, +wandb/errors/__pycache__/links.cpython-310.pyc,, +wandb/errors/__pycache__/term.cpython-310.pyc,, +wandb/errors/__pycache__/util.cpython-310.pyc,, +wandb/errors/__pycache__/warnings.cpython-310.pyc,, +wandb/errors/errors.py,sha256=FyCJHVK0VS_B2jfX2grF085c8xStm9rZItnV8SslhsI,981 +wandb/errors/links.py,sha256=sNwJ74e9qb0w4GRZfnbPXK5ZdpIqc5lkuaT4T2Snnqw,2520 +wandb/errors/term.py,sha256=E0FmS_t_J_uZfJSynHapcin0x5tg8H-iiP2OHcJ9yaQ,16968 +wandb/errors/util.py,sha256=yfAaDHfxG4O8Hm3e0LfVJt1jo_5u4EMOBjMVbF-0sMI,1713 +wandb/errors/warnings.py,sha256=kyLP3bfXSmlztp8nOepLtfTdM-03N-i7Ho1Y568BOtk,57 +wandb/filesync/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +wandb/filesync/__pycache__/__init__.cpython-310.pyc,, +wandb/filesync/__pycache__/dir_watcher.cpython-310.pyc,, +wandb/filesync/__pycache__/stats.cpython-310.pyc,, +wandb/filesync/__pycache__/step_checksum.cpython-310.pyc,, +wandb/filesync/__pycache__/step_prepare.cpython-310.pyc,, +wandb/filesync/__pycache__/step_upload.cpython-310.pyc,, +wandb/filesync/__pycache__/upload_job.cpython-310.pyc,, +wandb/filesync/dir_watcher.py,sha256=TAGbzACf10Re7XymOFuZBp2Z4XdD4rykmRIgzNIPBTI,16340 +wandb/filesync/stats.py,sha256=RAqyV1GtxsEMcvBY191NBa7VVwX97IJEy1R62NvUJoA,2968 +wandb/filesync/step_checksum.py,sha256=4ET8u8dwj4jcpIfbNTYdEQo3GWs0xwrFf3Kvcck9WM4,4679 +wandb/filesync/step_prepare.py,sha256=-pOeZ7gWwCIcSD6pOgvaaoa28WywFN_tk4XMMxQ8J-E,5451 +wandb/filesync/step_upload.py,sha256=YAkNrcPfDdpjCy77UT4ynwcr7CF7aj8KNc8jyB6vMls,10232 +wandb/filesync/upload_job.py,sha256=VJJ5FslmoSHD2Q-D2i_zWYUJT8xuyPw0VTKEiZbCeXY,5534 +wandb/integration/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +wandb/integration/__pycache__/__init__.cpython-310.pyc,, +wandb/integration/catboost/__init__.py,sha256=dxef0C9s9Xez_sF3sOqSJpKaSrAibAqMA_TpVUyIwac,127 +wandb/integration/catboost/__pycache__/__init__.cpython-310.pyc,, +wandb/integration/catboost/__pycache__/catboost.cpython-310.pyc,, +wandb/integration/catboost/catboost.py,sha256=kz8KzvmZHJcC5UWglDV4txMBk_V43i-4op-wJgt_7F4,5973 +wandb/integration/cohere/__init__.py,sha256=8yTJGhWznxEAxHYDY7oMghvsak_KqLngSLpqjR8ic3g,52 +wandb/integration/cohere/__pycache__/__init__.cpython-310.pyc,, +wandb/integration/cohere/__pycache__/cohere.cpython-310.pyc,, +wandb/integration/cohere/__pycache__/resolver.cpython-310.pyc,, +wandb/integration/cohere/cohere.py,sha256=CyALJXyLDnic6ZRc8I4UXmR7hYqtIOCi5Wav12JcXd0,453 +wandb/integration/cohere/resolver.py,sha256=AiVj0YQSyAC0MSGBYjbaeNj7c5Az5rFhpSJzL7XkPC8,13844 +wandb/integration/diffusers/__init__.py,sha256=Rdenl4seOrFR1_LrKP9P2Sl9_JwGnD3BC5bgHSWXRgY,55 +wandb/integration/diffusers/__pycache__/__init__.cpython-310.pyc,, +wandb/integration/diffusers/__pycache__/autologger.cpython-310.pyc,, +wandb/integration/diffusers/__pycache__/pipeline_resolver.cpython-310.pyc,, +wandb/integration/diffusers/autologger.py,sha256=RsfHZsJQnZBGL9TSHHkspdWOTotveBcVPXGdeqL2YBE,3254 +wandb/integration/diffusers/pipeline_resolver.py,sha256=91WTRhGHITsBi9SsK_xPqFFvr5bg5JC1C_xpijQXyzs,1855 +wandb/integration/diffusers/resolvers/__init__.py,sha256=07La9KIUpsOE3nNPnrcA4fESpmkeJFNhTI4FL8WPJ5k,201 +wandb/integration/diffusers/resolvers/__pycache__/__init__.cpython-310.pyc,, +wandb/integration/diffusers/resolvers/__pycache__/multimodal.cpython-310.pyc,, +wandb/integration/diffusers/resolvers/__pycache__/utils.cpython-310.pyc,, +wandb/integration/diffusers/resolvers/multimodal.py,sha256=fVttwoTkgryNqVcW2JVhy-ANqCzfmP9Q7tV42ad5YM0,30005 +wandb/integration/diffusers/resolvers/utils.py,sha256=4Zk4Z-WwNPON5FehsppIYM22MyylR_msDx-mXrKyv20,3842 +wandb/integration/dspy/__init__.py,sha256=gC1FQ9NNB9Npa7zi_QmrzmxkfYvWreTm2AQtf0b2Ol0,106 +wandb/integration/dspy/__pycache__/__init__.cpython-310.pyc,, +wandb/integration/dspy/__pycache__/dspy.cpython-310.pyc,, +wandb/integration/dspy/dspy.py,sha256=SSqoWe37AwGet2RWNIGGkF66PJ8BthePYBtiudY308Q,15546 +wandb/integration/fastai/__init__.py,sha256=xE5kWxOh8pAOnfmTyjwEkKnOSmnbHiKbjK0q1YMfyPY,9279 +wandb/integration/fastai/__pycache__/__init__.cpython-310.pyc,, +wandb/integration/gym/__init__.py,sha256=AI7QQ-dLa4jEjeIbwbP4oc8RugWQ89lMlIgzSsO6xzM,3000 +wandb/integration/gym/__pycache__/__init__.cpython-310.pyc,, +wandb/integration/huggingface/__init__.py,sha256=Ui-JiM_yel2YZuS9U_LyReL3mhBZZSIUNLBODjS4l4Q,57 +wandb/integration/huggingface/__pycache__/__init__.cpython-310.pyc,, +wandb/integration/huggingface/__pycache__/huggingface.cpython-310.pyc,, +wandb/integration/huggingface/__pycache__/resolver.cpython-310.pyc,, +wandb/integration/huggingface/huggingface.py,sha256=KYP0dCYERORLNE1Sk6jfp0krHF2BQ4q4qOlF-0H-vrI,443 +wandb/integration/huggingface/resolver.py,sha256=62iMdcIFJDfP1wZj96GtDgLtKzs405GlZl4I_qN0vXg,7843 +wandb/integration/keras/__init__.py,sha256=8_vNA4cEbj1lg2pgMz-c5Iu1XJQtX9x5_vNGrv4NBdE,345 +wandb/integration/keras/__pycache__/__init__.cpython-310.pyc,, +wandb/integration/keras/__pycache__/keras.cpython-310.pyc,, +wandb/integration/keras/callbacks/__init__.py,sha256=sY5AMC3x28iA815fqbqkkArtjctqG-m9N2D5FnyR0no,223 +wandb/integration/keras/callbacks/__pycache__/__init__.cpython-310.pyc,, +wandb/integration/keras/callbacks/__pycache__/metrics_logger.cpython-310.pyc,, +wandb/integration/keras/callbacks/__pycache__/model_checkpoint.cpython-310.pyc,, +wandb/integration/keras/callbacks/__pycache__/tables_builder.cpython-310.pyc,, +wandb/integration/keras/callbacks/metrics_logger.py,sha256=EKP7DcMVmcz-oZZpLo6WumBpkGVkCYUBs8g0hwT5sRg,4911 +wandb/integration/keras/callbacks/model_checkpoint.py,sha256=G-D8eZ0DfApgZRObyMb3YXyAIbdYhDP_Tn5datp14R4,8512 +wandb/integration/keras/callbacks/tables_builder.py,sha256=jqqsDDdXldG8L9_3u92WIPh8KCVJ6CHT-GfLrZqpItc,8880 +wandb/integration/keras/keras.py,sha256=lrspJvcDG47-WxJowvKGjMLXniJqhvNaD_5_d_E0nnw,44172 +wandb/integration/kfp/__init__.py,sha256=WhBhg3mQopGNDbWzGJ8Xyld8w3FAAvmP1G1Wtv_QaC0,136 +wandb/integration/kfp/__pycache__/__init__.cpython-310.pyc,, +wandb/integration/kfp/__pycache__/helpers.cpython-310.pyc,, +wandb/integration/kfp/__pycache__/kfp_patch.cpython-310.pyc,, +wandb/integration/kfp/__pycache__/wandb_logging.cpython-310.pyc,, +wandb/integration/kfp/helpers.py,sha256=yEVO9rrz27hc4nk3WwNL3v1aRAUlS-OlXMC8Rj0G1tI,1016 +wandb/integration/kfp/kfp_patch.py,sha256=kfnxTgbNexPZmvSuMiFakrtihaK72bjhZbQ3PCfFpCw,13239 +wandb/integration/kfp/wandb_logging.py,sha256=fYMImccQagOm6HB-dTV7O1LvH_1jJ-qrd7ngTUu7WVo,6167 +wandb/integration/langchain/__init__.py,sha256=afRoYH4bPOw6Tyrn9YvuYHzbSae97iQT-Ufi0puJqNw,66 +wandb/integration/langchain/__pycache__/__init__.cpython-310.pyc,, +wandb/integration/langchain/__pycache__/wandb_tracer.cpython-310.pyc,, +wandb/integration/langchain/wandb_tracer.py,sha256=iu07VJEbHJDm2blokqf7K2EwO2QUIUtwmUCrsBQOXW8,2289 +wandb/integration/lightgbm/__init__.py,sha256=WBuLl7272srId1VZnjJo3Qp_pAQeOcpVc7q_twCtp_o,7962 +wandb/integration/lightgbm/__pycache__/__init__.cpython-310.pyc,, +wandb/integration/lightning/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +wandb/integration/lightning/__pycache__/__init__.cpython-310.pyc,, +wandb/integration/lightning/fabric/__init__.py,sha256=RFhr2VkC0D8b6bAXUMZzcVzqDQaoOozfP_HOogAWi9o,94 +wandb/integration/lightning/fabric/__pycache__/__init__.cpython-310.pyc,, +wandb/integration/lightning/fabric/__pycache__/logger.cpython-310.pyc,, +wandb/integration/lightning/fabric/logger.py,sha256=-WPnIaa7fBO8z4vX7zjSe76NijcIvbAGwUb3QH42wK8,27135 +wandb/integration/metaflow/__init__.py,sha256=viDBeFSetM0I4BnUx8TEjJScHSDzO9mHHBijkZ1L9zk,263 +wandb/integration/metaflow/__pycache__/__init__.cpython-310.pyc,, +wandb/integration/metaflow/__pycache__/data_pandas.cpython-310.pyc,, +wandb/integration/metaflow/__pycache__/data_pytorch.cpython-310.pyc,, +wandb/integration/metaflow/__pycache__/data_sklearn.cpython-310.pyc,, +wandb/integration/metaflow/__pycache__/errors.cpython-310.pyc,, +wandb/integration/metaflow/__pycache__/metaflow.cpython-310.pyc,, +wandb/integration/metaflow/data_pandas.py,sha256=od7wFqM_j2Z1ra96wJl13wGN7M1WrZksEB6wQxCZRhc,1713 +wandb/integration/metaflow/data_pytorch.py,sha256=aFM7vNRM15hi9nu-HPXHdla2DPij6ZBBRHJWTgcu6Ko,1712 +wandb/integration/metaflow/data_sklearn.py,sha256=I3Ty2lUZUeFD1Qjbsg5tG6RKtt72VaHmyW9XOjpNG5Y,1753 +wandb/integration/metaflow/errors.py,sha256=wRKiojelW9DuPwhEiU7RzbV2aWIgHQPG7RXrcGiLgM0,347 +wandb/integration/metaflow/metaflow.py,sha256=gXzjn-McUnK24fkedxhyVjmuKQB5QwLLd-xnwxIYhqw,9360 +wandb/integration/openai/__init__.py,sha256=T6x9lIFfw2NzOSi46wi3otY_-DSwyMgnIjMIOIod7iU,66 +wandb/integration/openai/__pycache__/__init__.cpython-310.pyc,, +wandb/integration/openai/__pycache__/fine_tuning.cpython-310.pyc,, +wandb/integration/openai/__pycache__/openai.cpython-310.pyc,, +wandb/integration/openai/__pycache__/resolver.cpython-310.pyc,, +wandb/integration/openai/fine_tuning.py,sha256=mZ_mU93wx28wL_9l_TxqtrzToq68he4EaCMJIRXfEck,18470 +wandb/integration/openai/openai.py,sha256=zGD1kj6yjDP1IfAAYRcltuXD5Bf569CSnMHMf4rDm54,496 +wandb/integration/openai/resolver.py,sha256=3I2WKMl-mOOnsAJ82aZDEbyCofLA6Lb3xn7SX6jOtLs,8202 +wandb/integration/prodigy/__init__.py,sha256=1-Hg98Y4T1kSNAbrlR9TUrr7dwL1Gxxa-Exu0fsfxl0,66 +wandb/integration/prodigy/__pycache__/__init__.cpython-310.pyc,, +wandb/integration/prodigy/__pycache__/prodigy.cpython-310.pyc,, +wandb/integration/prodigy/prodigy.py,sha256=kdJevdOYEkZuc59zvfEHKzgleue2iVlCo1G6OURd9IQ,11131 +wandb/integration/sacred/__init__.py,sha256=Qno116BvHEdOXy6XC7xFck12pXoht2_tGw8Bga-Hul8,5736 +wandb/integration/sacred/__pycache__/__init__.cpython-310.pyc,, +wandb/integration/sagemaker/__init__.py,sha256=Eyd7rArw0IKGR2ll6zGiTXBi6y7E5nYYuyrVABt_9sI,360 +wandb/integration/sagemaker/__pycache__/__init__.cpython-310.pyc,, +wandb/integration/sagemaker/__pycache__/auth.cpython-310.pyc,, +wandb/integration/sagemaker/__pycache__/config.cpython-310.pyc,, +wandb/integration/sagemaker/__pycache__/files.cpython-310.pyc,, +wandb/integration/sagemaker/__pycache__/resources.cpython-310.pyc,, +wandb/integration/sagemaker/auth.py,sha256=oj2nghSBbyduiTEP-B9PyURjf8seL8r82WbZf87tdUo,1124 +wandb/integration/sagemaker/config.py,sha256=XLtB9n0cEUe3hA1N9OAA51E9rKco5UZGRteGv_9SCfE,1748 +wandb/integration/sagemaker/files.py,sha256=WaMBg5Im3GoPHM2AU8GnWEzqmm29EAOtsGsaE3nBaB4,89 +wandb/integration/sagemaker/resources.py,sha256=YBU_dgMt3kqhOCShc2Ge6FFPlwPBjb44fvgvkRMfvJk,1944 +wandb/integration/sb3/__init__.py,sha256=w_VX7C6qAE1vK7xb24JchQtORxzfpXvl6YmZHUIskJM,60 +wandb/integration/sb3/__pycache__/__init__.cpython-310.pyc,, +wandb/integration/sb3/__pycache__/sb3.cpython-310.pyc,, +wandb/integration/sb3/sb3.py,sha256=ym0vZfwgIn_OwWqanLcM87rJJk88TV-s8a3115IzxXg,4829 +wandb/integration/sklearn/__init__.py,sha256=bDnzytR60EFQblaAZdw76WlJBmfG-O7NrKavIEY97Ck,861 +wandb/integration/sklearn/__pycache__/__init__.cpython-310.pyc,, +wandb/integration/sklearn/__pycache__/utils.cpython-310.pyc,, +wandb/integration/sklearn/calculate/__init__.py,sha256=T19bKtuyTbRNzcIg3QbnRD8vm085QJXQFZfQ_STjrCk,1055 +wandb/integration/sklearn/calculate/__pycache__/__init__.cpython-310.pyc,, +wandb/integration/sklearn/calculate/__pycache__/calibration_curves.cpython-310.pyc,, +wandb/integration/sklearn/calculate/__pycache__/class_proportions.cpython-310.pyc,, +wandb/integration/sklearn/calculate/__pycache__/confusion_matrix.cpython-310.pyc,, +wandb/integration/sklearn/calculate/__pycache__/decision_boundaries.cpython-310.pyc,, +wandb/integration/sklearn/calculate/__pycache__/elbow_curve.cpython-310.pyc,, +wandb/integration/sklearn/calculate/__pycache__/feature_importances.cpython-310.pyc,, +wandb/integration/sklearn/calculate/__pycache__/learning_curve.cpython-310.pyc,, +wandb/integration/sklearn/calculate/__pycache__/outlier_candidates.cpython-310.pyc,, +wandb/integration/sklearn/calculate/__pycache__/residuals.cpython-310.pyc,, +wandb/integration/sklearn/calculate/__pycache__/silhouette.cpython-310.pyc,, +wandb/integration/sklearn/calculate/__pycache__/summary_metrics.cpython-310.pyc,, +wandb/integration/sklearn/calculate/calibration_curves.py,sha256=MFGIyWnK5b3Y5uHMHJhtI_a_ZKFawtCgzVYzlw9pf_U,3823 +wandb/integration/sklearn/calculate/class_proportions.py,sha256=0cJQ2RKluzX4Y7bykqxfctkB_D6yT6Bz54SFoymTrVg,2074 +wandb/integration/sklearn/calculate/confusion_matrix.py,sha256=9u6AieiGlq8NPyQIiybalJ4ZQRkPDAZMxFrB2Q_KaJM,2543 +wandb/integration/sklearn/calculate/decision_boundaries.py,sha256=jHpx3WN6_Dbv3C4mUrRegZYmi5NnT-8SJGKkXpNG4Qo,1087 +wandb/integration/sklearn/calculate/elbow_curve.py,sha256=bMkksPxpySAVgzITe-WECwkCXQa2iT6wH1v3po6G328,1454 +wandb/integration/sklearn/calculate/feature_importances.py,sha256=MyhIsOac3P43wDyExblzfFK54ZI2-FfAZpF9jK7is5o,2261 +wandb/integration/sklearn/calculate/learning_curve.py,sha256=c45MVKN9c6nusVs4qNDLr7H5C0OvfHX8W-6yRUQCZJ4,1728 +wandb/integration/sklearn/calculate/outlier_candidates.py,sha256=JCva0qVvamlYQ3KbvL50Wdd9M1-NV9mIos5O1pmjAAw,1946 +wandb/integration/sklearn/calculate/residuals.py,sha256=mkw4VH_JjK2i31zu3dliTWqnwwQa41PZzUMc3abpaHI,2371 +wandb/integration/sklearn/calculate/silhouette.py,sha256=efTHK3sCjLDiTrpnfrYg7AwhSPg8MTRbLPOehfnG2vc,3321 +wandb/integration/sklearn/calculate/summary_metrics.py,sha256=moxThZVRHVHMIp_A5mzS7_66FZTN3w2hu1wY_AgcKj4,2010 +wandb/integration/sklearn/plot/__init__.py,sha256=7RgC3Dakive4tLSmYOBTiNWtFZz-9AJG3AWtW00xcJs,1368 +wandb/integration/sklearn/plot/__pycache__/__init__.cpython-310.pyc,, +wandb/integration/sklearn/plot/__pycache__/classifier.cpython-310.pyc,, +wandb/integration/sklearn/plot/__pycache__/clusterer.cpython-310.pyc,, +wandb/integration/sklearn/plot/__pycache__/regressor.cpython-310.pyc,, +wandb/integration/sklearn/plot/__pycache__/shared.cpython-310.pyc,, +wandb/integration/sklearn/plot/classifier.py,sha256=d9YsJ5Y3j8F4WikxkALruvqilzq5hqLIFuhghzyB48E,11753 +wandb/integration/sklearn/plot/clusterer.py,sha256=iV-UsSjc3VVUKboILhTUZRmd_rLm58HR-xda_5D-fAg,4917 +wandb/integration/sklearn/plot/regressor.py,sha256=mFLK7yhxfRE6MAoF2aQRPbS1hDJQtTxw8W-yD2uau8s,3943 +wandb/integration/sklearn/plot/shared.py,sha256=elvnlCHFlASs7Olnh-MVh7kvuuR89qvfmit2GmbeRMo,2763 +wandb/integration/sklearn/utils.py,sha256=3Nqo9poTsFmpRdBlNhzoyQBkVI_1fjCKyMsL1eQ503w,5794 +wandb/integration/tensorboard/__init__.py,sha256=6WVdC0NhHePhIk1-j_yqm7jNjByevhfzxgotGsfGm-g,199 +wandb/integration/tensorboard/__pycache__/__init__.cpython-310.pyc,, +wandb/integration/tensorboard/__pycache__/log.cpython-310.pyc,, +wandb/integration/tensorboard/__pycache__/monkeypatch.cpython-310.pyc,, +wandb/integration/tensorboard/log.py,sha256=Ibca6VJqQkLjsZ4KPQ3cpc51ykGuHCNRJhtNYp3hO2o,14055 +wandb/integration/tensorboard/monkeypatch.py,sha256=-V--H6Psfn5TwiPGKa_Wl8w4p9r1mMTNrTpuTWM1iBA,6906 +wandb/integration/tensorflow/__init__.py,sha256=_g9Ic-Y4giu-kQHge9Q3kIT52gvFOYVtGXUtMpmH1KU,97 +wandb/integration/tensorflow/__pycache__/__init__.cpython-310.pyc,, +wandb/integration/tensorflow/__pycache__/estimator_hook.cpython-310.pyc,, +wandb/integration/tensorflow/estimator_hook.py,sha256=fi-UtjNZxUnDkzfbNP09iH074z5x0ItZiB4dkvwMGNI,1756 +wandb/integration/torch/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +wandb/integration/torch/__pycache__/__init__.cpython-310.pyc,, +wandb/integration/torch/__pycache__/wandb_torch.cpython-310.pyc,, +wandb/integration/torch/wandb_torch.py,sha256=VL7gXlZVptUPg8hV4-V7dpfH0R5MyqT4o-J_MFGdGVo,21546 +wandb/integration/ultralytics/__init__.py,sha256=omtrUwOg6GWKWyunhIPclFdQmxW8XIXQaPoF1Ai5WxU,340 +wandb/integration/ultralytics/__pycache__/__init__.cpython-310.pyc,, +wandb/integration/ultralytics/__pycache__/bbox_utils.cpython-310.pyc,, +wandb/integration/ultralytics/__pycache__/callback.cpython-310.pyc,, +wandb/integration/ultralytics/__pycache__/classification_utils.cpython-310.pyc,, +wandb/integration/ultralytics/__pycache__/mask_utils.cpython-310.pyc,, +wandb/integration/ultralytics/__pycache__/pose_utils.cpython-310.pyc,, +wandb/integration/ultralytics/bbox_utils.py,sha256=n0kp3VQxfPKJSAhcJUNk4vaneOtOktw9SyHwQsn081c,8011 +wandb/integration/ultralytics/callback.py,sha256=qQuYTeNGNM2qwqXzWEPEAwKJupr30o8v5gpfZXBggtc,21311 +wandb/integration/ultralytics/classification_utils.py,sha256=eCBFksM8aAB6ttO-hdLOgOf0e0iKP-cKeoZt2qFJ7qw,3185 +wandb/integration/ultralytics/mask_utils.py,sha256=DRY5QzRy6srE1nq7wehdnbbz4FfBhS4cGSjuAFB6IwQ,7068 +wandb/integration/ultralytics/pose_utils.py,sha256=4JN0fM8CeqSAKz9hRFZvybXALCis3JYrwFWYxuMyROk,3729 +wandb/integration/weave/__init__.py,sha256=SW1X2J6az3XTbAKmxfi0O0R9qBuJRv7o9SITiJmiRUg,158 +wandb/integration/weave/__pycache__/__init__.cpython-310.pyc,, +wandb/integration/weave/__pycache__/interface.cpython-310.pyc,, +wandb/integration/weave/__pycache__/weave.cpython-310.pyc,, +wandb/integration/weave/interface.py,sha256=7PMQEDN9rOGMmhf_EKAsViYQ65wl6YccJcQGSLCJQCQ,1165 +wandb/integration/weave/weave.py,sha256=8d3N6dygd-HVJoOlKmbGevacG_iFprBj7VPA1gMbfnI,3472 +wandb/integration/xgboost/__init__.py,sha256=Pwmii-OI64seJjfwM28cS4BdkEN2_Ms_qMGdwp3QRn8,343 +wandb/integration/xgboost/__pycache__/__init__.cpython-310.pyc,, +wandb/integration/xgboost/__pycache__/xgboost.cpython-310.pyc,, +wandb/integration/xgboost/xgboost.py,sha256=MsXfBqIPwzD_-omd0tWI23fC8Wz11Ho2H7-Oxz2txZ0,6877 +wandb/integration/yolov8/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +wandb/integration/yolov8/__pycache__/__init__.cpython-310.pyc,, +wandb/integration/yolov8/__pycache__/yolov8.cpython-310.pyc,, +wandb/integration/yolov8/yolov8.py,sha256=xcGjvsYq4GTOdnU2I_NFbOTxsIZN81RHA6FNhHVgUpc,11355 +wandb/jupyter.py,sha256=p_O3lia3WIS3Iy1c6dVdAjcmbBDxmLIDipTRVHXXn_E,16092 +wandb/mpmain/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +wandb/mpmain/__main__.py,sha256=bLhspPeHQvNMyRNR7xi9v-02XfW1mhJY2yBWI3bYtbg,57 +wandb/mpmain/__pycache__/__init__.cpython-310.pyc,, +wandb/mpmain/__pycache__/__main__.cpython-310.pyc,, +wandb/old/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +wandb/old/__pycache__/__init__.cpython-310.pyc,, +wandb/old/__pycache__/core.cpython-310.pyc,, +wandb/old/__pycache__/summary.cpython-310.pyc,, +wandb/old/core.py,sha256=bIIFlU3_E2hvrVCzMQk1VcwJtxbadbAZwDC0qsF4C2g,1501 +wandb/old/summary.py,sha256=GzvrTMz4ewDT4bkiSyq04jPo6BbrvaPRHTgGxHRac9k,13843 +wandb/plot/__init__.py,sha256=M7sOlxO_hYYV64ZM007B3OjmIqSxF8ToY1aU0DtC-dI,863 +wandb/plot/__pycache__/__init__.cpython-310.pyc,, +wandb/plot/__pycache__/bar.cpython-310.pyc,, +wandb/plot/__pycache__/confusion_matrix.cpython-310.pyc,, +wandb/plot/__pycache__/custom_chart.cpython-310.pyc,, +wandb/plot/__pycache__/histogram.cpython-310.pyc,, +wandb/plot/__pycache__/line.cpython-310.pyc,, +wandb/plot/__pycache__/line_series.cpython-310.pyc,, +wandb/plot/__pycache__/pr_curve.cpython-310.pyc,, +wandb/plot/__pycache__/roc_curve.cpython-310.pyc,, +wandb/plot/__pycache__/scatter.cpython-310.pyc,, +wandb/plot/__pycache__/utils.cpython-310.pyc,, +wandb/plot/__pycache__/viz.cpython-310.pyc,, +wandb/plot/bar.py,sha256=gH29ianBYs-1iV8jjuUlWO6KixXA8Bq_kz0nXmlLmQU,2036 +wandb/plot/confusion_matrix.py,sha256=Qt3XYUp6RnwHceeeFvhswxUPQuSadRGybVUMfzacB9Y,6366 +wandb/plot/custom_chart.py,sha256=GzLoUoeCMg1bdDKkCWDFjNHKsYs_bU52USVSEFshbWg,5010 +wandb/plot/histogram.py,sha256=aZqM5gLaVU3BbFnngFfchb-2QFSYc32TtEqcBofhaTQ,1701 +wandb/plot/line.py,sha256=LCGgQKhvDwEsypsUMVuGMKKi_AmC716mNh1p1hCWljE,2369 +wandb/plot/line_series.py,sha256=OD7dkqQ-0IpSmA6pp-902eCNYO7XgQI5dTn4nxTGOHs,5585 +wandb/plot/pr_curve.py,sha256=E8payqH4tCv4v50yTFJVmR-yOrcZt6FEIkK5nG_GfuE,6629 +wandb/plot/roc_curve.py,sha256=R5H0De99cEp4V1zANj8aaQr6tUUoBTFhGiJXHsvkQ1I,5646 +wandb/plot/scatter.py,sha256=ilFNDknfPL7qj6VRCTKVTeq3-8agS-3ogU83UpP-gUA,2045 +wandb/plot/utils.py,sha256=tZrMkjs4E7V6vxmE3oCdxX4K0BkEI2a5BA4cRti5eXA,6688 +wandb/plot/viz.py,sha256=ni1MTkt3k1TxSqArdIR_sVcD1cV0j9eKmJdX0QlBcOM,943 +wandb/proto/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +wandb/proto/__pycache__/__init__.cpython-310.pyc,, +wandb/proto/__pycache__/wandb_api_pb2.cpython-310.pyc,, +wandb/proto/__pycache__/wandb_base_pb2.cpython-310.pyc,, +wandb/proto/__pycache__/wandb_generate_proto.cpython-310.pyc,, +wandb/proto/__pycache__/wandb_internal_pb2.cpython-310.pyc,, +wandb/proto/__pycache__/wandb_server_pb2.cpython-310.pyc,, +wandb/proto/__pycache__/wandb_settings_pb2.cpython-310.pyc,, +wandb/proto/__pycache__/wandb_sync_pb2.cpython-310.pyc,, +wandb/proto/__pycache__/wandb_telemetry_pb2.cpython-310.pyc,, +wandb/proto/v3/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +wandb/proto/v3/__pycache__/__init__.cpython-310.pyc,, +wandb/proto/v3/__pycache__/wandb_api_pb2.cpython-310.pyc,, +wandb/proto/v3/__pycache__/wandb_base_pb2.cpython-310.pyc,, +wandb/proto/v3/__pycache__/wandb_internal_pb2.cpython-310.pyc,, +wandb/proto/v3/__pycache__/wandb_server_pb2.cpython-310.pyc,, +wandb/proto/v3/__pycache__/wandb_settings_pb2.cpython-310.pyc,, +wandb/proto/v3/__pycache__/wandb_sync_pb2.cpython-310.pyc,, +wandb/proto/v3/__pycache__/wandb_telemetry_pb2.cpython-310.pyc,, +wandb/proto/v3/wandb_api_pb2.py,sha256=qsKQsvFRJWpUgr6bZ7NnaB5D54lp0FC_ikeLpAYpfdQ,17242 +wandb/proto/v3/wandb_base_pb2.py,sha256=_nsr_HW4Fdz62-KiXGo6Dw0_9bwdXz07auZkkH2QfSI,2355 +wandb/proto/v3/wandb_internal_pb2.py,sha256=-GcQifZ7l5jx6lIxTKn1dRgnQ6HlCw6LlPtYw_xq7sI,117867 +wandb/proto/v3/wandb_server_pb2.py,sha256=HZ9JVh8hPwVR96yYCzM_mEMf9Ep8bC2ETtBiQeyLHd8,15835 +wandb/proto/v3/wandb_settings_pb2.py,sha256=Y6GmiToxXH01uFnFTjDQIzVgHQAamuD7iEFVkn-ZV3s,21956 +wandb/proto/v3/wandb_sync_pb2.py,sha256=fj3G_-czbmu73dIb2eRjqY3VJAsTKxK8e1MCl9RncGc,7032 +wandb/proto/v3/wandb_telemetry_pb2.py,sha256=zK5kHr1qp4sabaj7MGU990CekdNqU2pPu-iFW0U-qrA,14594 +wandb/proto/v4/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +wandb/proto/v4/__pycache__/__init__.cpython-310.pyc,, +wandb/proto/v4/__pycache__/wandb_api_pb2.cpython-310.pyc,, +wandb/proto/v4/__pycache__/wandb_base_pb2.cpython-310.pyc,, +wandb/proto/v4/__pycache__/wandb_internal_pb2.cpython-310.pyc,, +wandb/proto/v4/__pycache__/wandb_server_pb2.cpython-310.pyc,, +wandb/proto/v4/__pycache__/wandb_settings_pb2.cpython-310.pyc,, +wandb/proto/v4/__pycache__/wandb_sync_pb2.cpython-310.pyc,, +wandb/proto/v4/__pycache__/wandb_telemetry_pb2.cpython-310.pyc,, +wandb/proto/v4/wandb_api_pb2.py,sha256=dYPrMzUeR-lLdfspYyQOLCV8v-pwNKEDfU2lYCSlHAY,7608 +wandb/proto/v4/wandb_base_pb2.py,sha256=El5lnZMRpkc1W4SlZgeKoDPqWiJau0BG8QfigMMt6bM,1422 +wandb/proto/v4/wandb_internal_pb2.py,sha256=d9aTKamoO6Xs3G2lPGhYkU94zye9f88fzhPDwZjfUoA,54129 +wandb/proto/v4/wandb_server_pb2.py,sha256=FFDDjkXazOf_oUAfVYBVjxTA9JJc1U-_G8KGrmOeK0g,7778 +wandb/proto/v4/wandb_settings_pb2.py,sha256=qdHYhaw82yLrc5KzbK-HQn-KuWh8AzDNXlbkJMMAKpo,18331 +wandb/proto/v4/wandb_sync_pb2.py,sha256=OxVPZH4Kf2PKkJ3bYxAC0smyOuceKFzFxMP1zz66wf8,3668 +wandb/proto/v4/wandb_telemetry_pb2.py,sha256=JD6TcSwHajE1zO63IsYHBODp5JSXitoCdB45-l1oQ0A,12041 +wandb/proto/v5/__pycache__/wandb_api_pb2.cpython-310.pyc,, +wandb/proto/v5/__pycache__/wandb_base_pb2.cpython-310.pyc,, +wandb/proto/v5/__pycache__/wandb_internal_pb2.cpython-310.pyc,, +wandb/proto/v5/__pycache__/wandb_server_pb2.cpython-310.pyc,, +wandb/proto/v5/__pycache__/wandb_settings_pb2.cpython-310.pyc,, +wandb/proto/v5/__pycache__/wandb_sync_pb2.cpython-310.pyc,, +wandb/proto/v5/__pycache__/wandb_telemetry_pb2.cpython-310.pyc,, +wandb/proto/v5/wandb_api_pb2.py,sha256=_H656tPYDYOdtYzJGncyko_P3tcuc4DHCU87m2Mvaa4,8293 +wandb/proto/v5/wandb_base_pb2.py,sha256=u7VVWdExJ4WDkYNMV-xvWvyQ-NTIbAqToTKtgEqt_Lg,1572 +wandb/proto/v5/wandb_internal_pb2.py,sha256=UeAgGfDT9VrJuG302fgSDf6uIbzhCdWhh0Bq_gef-cc,58500 +wandb/proto/v5/wandb_server_pb2.py,sha256=AXLwb3NtYJ362LEmq2nvEixbEXjcWHqZkIwtwFiJUpE,8312 +wandb/proto/v5/wandb_settings_pb2.py,sha256=K6a-EdN2Vgh9voAqNQjitEmkV3TUNspLLyHgSBkZCl0,18687 +wandb/proto/v5/wandb_sync_pb2.py,sha256=igNOwFgmdz_GVbAHih7wkfZcsYOVh2O8awLQkxAotLs,3993 +wandb/proto/v5/wandb_telemetry_pb2.py,sha256=zl_Thc55nmp-ukAQCkSckEgW-9MkBQJFWZEx_sui2D4,12311 +wandb/proto/v6/__pycache__/wandb_api_pb2.cpython-310.pyc,, +wandb/proto/v6/__pycache__/wandb_base_pb2.cpython-310.pyc,, +wandb/proto/v6/__pycache__/wandb_internal_pb2.cpython-310.pyc,, +wandb/proto/v6/__pycache__/wandb_server_pb2.cpython-310.pyc,, +wandb/proto/v6/__pycache__/wandb_settings_pb2.cpython-310.pyc,, +wandb/proto/v6/__pycache__/wandb_sync_pb2.cpython-310.pyc,, +wandb/proto/v6/__pycache__/wandb_telemetry_pb2.cpython-310.pyc,, +wandb/proto/v6/wandb_api_pb2.py,sha256=Du9si25J8Hegc0tSxZPvFnTa3KpmQLmljiav3T-hfKM,8541 +wandb/proto/v6/wandb_base_pb2.py,sha256=33R_7uY3eNy3D-UOpqU9NqkKOXxxBi-qCBRvFygjB1Y,1821 +wandb/proto/v6/wandb_internal_pb2.py,sha256=PxFTMLeszexHtyS33CQxl_6nZbx40g1-LUaOyN7CpOQ,58753 +wandb/proto/v6/wandb_server_pb2.py,sha256=pdkWkh-AvZ3JW782_ETTiJr5xx41qvL6zOMx7gT7ofQ,8563 +wandb/proto/v6/wandb_settings_pb2.py,sha256=yKiaaZpb2DpFB_XiWa1j-eXQQlDvoh7y0qfgX18SArg,18940 +wandb/proto/v6/wandb_sync_pb2.py,sha256=lcBzTwIKjkMbNLrsotwl0zWmbypeAPyJ3Th9g_euVkM,4242 +wandb/proto/v6/wandb_telemetry_pb2.py,sha256=ggidm5T1n3w8UzWusXy825TtWmUd5GUJ9_jQV7nrjkA,12565 +wandb/proto/wandb_api_pb2.py,sha256=MSQh2A8g7MzBm4F4cqpP_v2f99xDNcu86yLkn_A2PAc,608 +wandb/proto/wandb_base_pb2.py,sha256=h09-9fMDbMC82T3jWHzmh8MB8llZ9o9za0uBOF_bL_s,385 +wandb/proto/wandb_generate_proto.py,sha256=BRtjAvvHYcvcElxzBOdcDIpjWL0SktQ08a9C68yundQ,1325 +wandb/proto/wandb_internal_pb2.py,sha256=hTpbURqJyoNcwHD7o3k0ofmKgZdmKEYUm9sBqLHa5iA,628 +wandb/proto/wandb_server_pb2.py,sha256=82Cf27PnDjHbkQT_-ZPjQyI0AVYd9YWoAlABrGPD-xo,393 +wandb/proto/wandb_settings_pb2.py,sha256=Wba7SDYTKy-Sm2sYrTmqwYH6sBvdD9ogE1i87lt_85A,401 +wandb/proto/wandb_sync_pb2.py,sha256=CjyWIcWc6tM1zgOPwN8OssJebfoUou6QlXVDarwnt90,385 +wandb/proto/wandb_telemetry_pb2.py,sha256=Y9uzA6O9yUJ3HKqYOi86hg-mZ49NtSzQ_XRFSCONolA,405 +wandb/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +wandb/sdk/__init__.py,sha256=RiAAHKotCWpj1e7ZJjr-DtCUPa9qZlZqmsRLx1fgCt8,783 +wandb/sdk/__pycache__/__init__.cpython-310.pyc,, +wandb/sdk/__pycache__/wandb_alerts.cpython-310.pyc,, +wandb/sdk/__pycache__/wandb_config.cpython-310.pyc,, +wandb/sdk/__pycache__/wandb_helper.cpython-310.pyc,, +wandb/sdk/__pycache__/wandb_init.cpython-310.pyc,, +wandb/sdk/__pycache__/wandb_login.cpython-310.pyc,, +wandb/sdk/__pycache__/wandb_metric.cpython-310.pyc,, +wandb/sdk/__pycache__/wandb_require.cpython-310.pyc,, +wandb/sdk/__pycache__/wandb_require_helpers.cpython-310.pyc,, +wandb/sdk/__pycache__/wandb_run.cpython-310.pyc,, +wandb/sdk/__pycache__/wandb_settings.cpython-310.pyc,, +wandb/sdk/__pycache__/wandb_setup.cpython-310.pyc,, +wandb/sdk/__pycache__/wandb_summary.cpython-310.pyc,, +wandb/sdk/__pycache__/wandb_sweep.cpython-310.pyc,, +wandb/sdk/__pycache__/wandb_watch.cpython-310.pyc,, +wandb/sdk/artifacts/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +wandb/sdk/artifacts/__pycache__/__init__.cpython-310.pyc,, +wandb/sdk/artifacts/__pycache__/_factories.cpython-310.pyc,, +wandb/sdk/artifacts/__pycache__/_gqlutils.cpython-310.pyc,, +wandb/sdk/artifacts/__pycache__/_internal_artifact.cpython-310.pyc,, +wandb/sdk/artifacts/__pycache__/_validators.cpython-310.pyc,, +wandb/sdk/artifacts/__pycache__/artifact.cpython-310.pyc,, +wandb/sdk/artifacts/__pycache__/artifact_download_logger.cpython-310.pyc,, +wandb/sdk/artifacts/__pycache__/artifact_file_cache.cpython-310.pyc,, +wandb/sdk/artifacts/__pycache__/artifact_instance_cache.cpython-310.pyc,, +wandb/sdk/artifacts/__pycache__/artifact_manifest.cpython-310.pyc,, +wandb/sdk/artifacts/__pycache__/artifact_manifest_entry.cpython-310.pyc,, +wandb/sdk/artifacts/__pycache__/artifact_saver.cpython-310.pyc,, +wandb/sdk/artifacts/__pycache__/artifact_state.cpython-310.pyc,, +wandb/sdk/artifacts/__pycache__/artifact_ttl.cpython-310.pyc,, +wandb/sdk/artifacts/__pycache__/exceptions.cpython-310.pyc,, +wandb/sdk/artifacts/__pycache__/staging.cpython-310.pyc,, +wandb/sdk/artifacts/__pycache__/storage_handler.cpython-310.pyc,, +wandb/sdk/artifacts/__pycache__/storage_layout.cpython-310.pyc,, +wandb/sdk/artifacts/__pycache__/storage_policy.cpython-310.pyc,, +wandb/sdk/artifacts/_factories.py,sha256=h2cUsHu_DWiGFeo2hlFEEm5_6BGZhksrn8OPso_DmgE,461 +wandb/sdk/artifacts/_generated/__init__.py,sha256=l2CGdMmty3HjN51-hjtTj-y9ZycXZlto1JoFKF-uDek,10112 +wandb/sdk/artifacts/_generated/__pycache__/__init__.cpython-310.pyc,, +wandb/sdk/artifacts/_generated/__pycache__/add_aliases.cpython-310.pyc,, +wandb/sdk/artifacts/_generated/__pycache__/add_artifact_collection_tags.cpython-310.pyc,, +wandb/sdk/artifacts/_generated/__pycache__/artifact_by_id.cpython-310.pyc,, +wandb/sdk/artifacts/_generated/__pycache__/artifact_by_name.cpython-310.pyc,, +wandb/sdk/artifacts/_generated/__pycache__/artifact_collection_aliases.cpython-310.pyc,, +wandb/sdk/artifacts/_generated/__pycache__/artifact_created_by.cpython-310.pyc,, +wandb/sdk/artifacts/_generated/__pycache__/artifact_membership_by_name.cpython-310.pyc,, +wandb/sdk/artifacts/_generated/__pycache__/artifact_type.cpython-310.pyc,, +wandb/sdk/artifacts/_generated/__pycache__/artifact_used_by.cpython-310.pyc,, +wandb/sdk/artifacts/_generated/__pycache__/create_registry_members.cpython-310.pyc,, +wandb/sdk/artifacts/_generated/__pycache__/delete_aliases.cpython-310.pyc,, +wandb/sdk/artifacts/_generated/__pycache__/delete_artifact.cpython-310.pyc,, +wandb/sdk/artifacts/_generated/__pycache__/delete_artifact_collection_tags.cpython-310.pyc,, +wandb/sdk/artifacts/_generated/__pycache__/delete_artifact_portfolio.cpython-310.pyc,, +wandb/sdk/artifacts/_generated/__pycache__/delete_artifact_sequence.cpython-310.pyc,, +wandb/sdk/artifacts/_generated/__pycache__/delete_registry.cpython-310.pyc,, +wandb/sdk/artifacts/_generated/__pycache__/delete_registry_members.cpython-310.pyc,, +wandb/sdk/artifacts/_generated/__pycache__/enums.cpython-310.pyc,, +wandb/sdk/artifacts/_generated/__pycache__/fetch_artifact_manifest.cpython-310.pyc,, +wandb/sdk/artifacts/_generated/__pycache__/fetch_linked_artifacts.cpython-310.pyc,, +wandb/sdk/artifacts/_generated/__pycache__/fetch_org_entity_from_organization.cpython-310.pyc,, +wandb/sdk/artifacts/_generated/__pycache__/fetch_org_info_from_entity.cpython-310.pyc,, +wandb/sdk/artifacts/_generated/__pycache__/fetch_registries.cpython-310.pyc,, +wandb/sdk/artifacts/_generated/__pycache__/fetch_registry.cpython-310.pyc,, +wandb/sdk/artifacts/_generated/__pycache__/fragments.cpython-310.pyc,, +wandb/sdk/artifacts/_generated/__pycache__/get_artifact_file_urls.cpython-310.pyc,, +wandb/sdk/artifacts/_generated/__pycache__/get_artifact_files.cpython-310.pyc,, +wandb/sdk/artifacts/_generated/__pycache__/get_artifact_membership_file_urls.cpython-310.pyc,, +wandb/sdk/artifacts/_generated/__pycache__/get_artifact_membership_files.cpython-310.pyc,, +wandb/sdk/artifacts/_generated/__pycache__/input_types.cpython-310.pyc,, +wandb/sdk/artifacts/_generated/__pycache__/link_artifact.cpython-310.pyc,, +wandb/sdk/artifacts/_generated/__pycache__/operations.cpython-310.pyc,, +wandb/sdk/artifacts/_generated/__pycache__/project_artifact_collection.cpython-310.pyc,, +wandb/sdk/artifacts/_generated/__pycache__/project_artifact_collections.cpython-310.pyc,, +wandb/sdk/artifacts/_generated/__pycache__/project_artifact_type.cpython-310.pyc,, +wandb/sdk/artifacts/_generated/__pycache__/project_artifact_types.cpython-310.pyc,, +wandb/sdk/artifacts/_generated/__pycache__/project_artifacts.cpython-310.pyc,, +wandb/sdk/artifacts/_generated/__pycache__/registry_collections.cpython-310.pyc,, +wandb/sdk/artifacts/_generated/__pycache__/registry_team_members.cpython-310.pyc,, +wandb/sdk/artifacts/_generated/__pycache__/registry_user_members.cpython-310.pyc,, +wandb/sdk/artifacts/_generated/__pycache__/registry_versions.cpython-310.pyc,, +wandb/sdk/artifacts/_generated/__pycache__/rename_registry.cpython-310.pyc,, +wandb/sdk/artifacts/_generated/__pycache__/run_input_artifacts.cpython-310.pyc,, +wandb/sdk/artifacts/_generated/__pycache__/run_output_artifacts.cpython-310.pyc,, +wandb/sdk/artifacts/_generated/__pycache__/type_info.cpython-310.pyc,, +wandb/sdk/artifacts/_generated/__pycache__/unlink_artifact.cpython-310.pyc,, +wandb/sdk/artifacts/_generated/__pycache__/update_artifact.cpython-310.pyc,, +wandb/sdk/artifacts/_generated/__pycache__/update_artifact_portfolio.cpython-310.pyc,, +wandb/sdk/artifacts/_generated/__pycache__/update_artifact_sequence.cpython-310.pyc,, +wandb/sdk/artifacts/_generated/__pycache__/update_artifact_sequence_type.cpython-310.pyc,, +wandb/sdk/artifacts/_generated/__pycache__/update_team_registry_role.cpython-310.pyc,, +wandb/sdk/artifacts/_generated/__pycache__/update_user_registry_role.cpython-310.pyc,, +wandb/sdk/artifacts/_generated/__pycache__/upsert_registry.cpython-310.pyc,, +wandb/sdk/artifacts/_generated/add_aliases.py,sha256=gpkg6C-X4zLZHdLVw1ltLzCypMSFRQfSX0YHy0x6SPE,332 +wandb/sdk/artifacts/_generated/add_artifact_collection_tags.py,sha256=LXZT4N-xbg7niRWHpaWe0mPpcuqAw6cWezW1oduZLSk,492 +wandb/sdk/artifacts/_generated/artifact_by_id.py,sha256=4DgdREABFycmaZhX3mXt3YQtSpxh2b_nv_qCaYbOgpg,324 +wandb/sdk/artifacts/_generated/artifact_by_name.py,sha256=FOfw8Kz4itpk_B10_vWs3G28M1s5k3koC1PdVsBGDTc,453 +wandb/sdk/artifacts/_generated/artifact_collection_aliases.py,sha256=UHBkDNpf7hKtpEs8uWUh1q3kqJ1SaKkkt3S8mz87Vn0,1272 +wandb/sdk/artifacts/_generated/artifact_created_by.py,sha256=lNIlMHJBH0vqCsMBQDLz08RkdTNYdUogwdcXNQSVNeY,807 +wandb/sdk/artifacts/_generated/artifact_membership_by_name.py,sha256=PCGs89nsOdhlGBXwT58HibRtnx6W9scMZVZ5ntIsQjY,633 +wandb/sdk/artifacts/_generated/artifact_type.py,sha256=HTc-_9xXfCU8I27AE_0eh7_TWcw5o4gUO9M0FC7wCU8,696 +wandb/sdk/artifacts/_generated/artifact_used_by.py,sha256=5DydoUBblNXnaMCITZDgG0oqJOHKW4R6t_q10bCZCQ0,790 +wandb/sdk/artifacts/_generated/create_registry_members.py,sha256=KmQi98pimOhR99xVzLB3HnO72gn7KNc-OM44l5pSUqo,376 +wandb/sdk/artifacts/_generated/delete_aliases.py,sha256=_5Y23GDBnXPeZqNfMVsFsrJNGhyvRyORN9ZetBsUIGI,344 +wandb/sdk/artifacts/_generated/delete_artifact.py,sha256=MBT2UtsKXc7tygo8LFKU-DEWyA-KI3JV4uQppNvbZW8,480 +wandb/sdk/artifacts/_generated/delete_artifact_collection_tags.py,sha256=RNUBIn62dTT6e8LP9PUrA_qZI4lOgbqy9bddd8dCRsw,404 +wandb/sdk/artifacts/_generated/delete_artifact_portfolio.py,sha256=wOEBPWX79Dhjff6CrgIqsbJ6cZqJgLO_iXmf49OC7rY,840 +wandb/sdk/artifacts/_generated/delete_artifact_sequence.py,sha256=r3QY7uQ5RTK4bACeHMMQLQNP9M61-m1EJwxTwgUEm_A,833 +wandb/sdk/artifacts/_generated/delete_registry.py,sha256=KY-bt_554JHrgZQsSW5_wfYcZV-TtPxE9ga85LtSYw4,431 +wandb/sdk/artifacts/_generated/delete_registry_members.py,sha256=yInWx_bpTimPImLZlVkXij5fwBPAUi49SA9hBkHYZM8,376 +wandb/sdk/artifacts/_generated/enums.py,sha256=HuszKoFEDc1wF6CA_f-ggzjpm8tvdnSzPb3HK5ljr2o,442 +wandb/sdk/artifacts/_generated/fetch_artifact_manifest.py,sha256=dsy2xaEYZIhlDuVfaSrVsJpqjoPHFl9Az6s1tsrvqSk,591 +wandb/sdk/artifacts/_generated/fetch_linked_artifacts.py,sha256=akW-EZw-sDnrhKwusmvSmQznNGxIWWe3HyNHDntmf8o,1417 +wandb/sdk/artifacts/_generated/fetch_org_entity_from_organization.py,sha256=0f_0WK4wCU33UB98qzr0jw_72oUiFPpo5OtR9IcawKk,704 +wandb/sdk/artifacts/_generated/fetch_org_info_from_entity.py,sha256=rgTw7vQVPuBI3jA2NJ-EQyfAv_Td5o_-WttN4_M5JI4,693 +wandb/sdk/artifacts/_generated/fetch_registries.py,sha256=wYGVLg5ji37svWyZkrHhbekZfJwnJFX4U8WPrqU4yFE,1196 +wandb/sdk/artifacts/_generated/fetch_registry.py,sha256=YUoxE6Eo9nupSA2x2ngqHgorcTUQUsdnC2nBxYzD1XI,443 +wandb/sdk/artifacts/_generated/fragments.py,sha256=7BUmoCggYzbTNi5tAGiZFfu95uY3d3FnnpC8FCDmXgA,10852 +wandb/sdk/artifacts/_generated/get_artifact_file_urls.py,sha256=bVaVFHqvd-v81qcw4pO-f0ui5jY6YVOkpAkZil0DxH8,917 +wandb/sdk/artifacts/_generated/get_artifact_files.py,sha256=JwBRsmLi1pYIJZrNPVsx_Ntye7_lGmpONmnYBIjk39Q,1462 +wandb/sdk/artifacts/_generated/get_artifact_membership_file_urls.py,sha256=Qp0R9p6PxhzDdyWl2qqBszHvjI-PHqKBpad61AshJGE,2035 +wandb/sdk/artifacts/_generated/get_artifact_membership_files.py,sha256=QnMGEhL9KFhr-2815azkoU1f4JIzZyopG-_tx7U-Tqs,2037 +wandb/sdk/artifacts/_generated/input_types.py,sha256=-Fxzle97oznCxH9e61_ow38Gu77Oa8mXLNzu_KGQTUs,8783 +wandb/sdk/artifacts/_generated/link_artifact.py,sha256=L_pcdyqISmDqwkhW141vvetwodM3C2XF8xO3AIIdVr4,625 +wandb/sdk/artifacts/_generated/operations.py,sha256=jdtxLghitfYVX5IYFErnWMpGZmjnI5Hsju4LrK6nUCo,32873 +wandb/sdk/artifacts/_generated/project_artifact_collection.py,sha256=ox6wwehLLM2gMovJQzSjc8-yrjDstDrcBQL8dgqR3ds,861 +wandb/sdk/artifacts/_generated/project_artifact_collections.py,sha256=xNRFvjKlFVXRZP1uQ8Ar_VvNE1WRy_tq89ftU4umpcU,1516 +wandb/sdk/artifacts/_generated/project_artifact_type.py,sha256=lT5A902duZgYU_UsgHkhXg8PaCD3EmeGWJlPDNThGXE,549 +wandb/sdk/artifacts/_generated/project_artifact_types.py,sha256=VQkAGgiJIBmW6RKlXNcf7vOUBqSxc_8sRKAHgOeNDxE,1012 +wandb/sdk/artifacts/_generated/project_artifacts.py,sha256=RXDt3KCn9MOoD1xouq8Bq5Meig7wG7eOHKmZXch2oKg,1762 +wandb/sdk/artifacts/_generated/registry_collections.py,sha256=La6SwfRXtUYw8xckb_JOaH4e7n5TthwhBQtKR7FJhh4,1464 +wandb/sdk/artifacts/_generated/registry_team_members.py,sha256=-NE3Z2J33CeHn0eozZHw32JrTMT82ZobDNU1t6bLCMY,561 +wandb/sdk/artifacts/_generated/registry_user_members.py,sha256=mVefCh1CQhCNwJgtvGW1pc7uzjsn9LCtSpP9G5ITH6o,499 +wandb/sdk/artifacts/_generated/registry_versions.py,sha256=6OoB6sx6JlQ5e4_7Cr4tPWm08ub_RQYtYeT-lmdSYRg,1373 +wandb/sdk/artifacts/_generated/rename_registry.py,sha256=nNFRuRCg7rl82e_Q3NPtOMDs3Gn2Ym6tA5WyUwuCRCo,565 +wandb/sdk/artifacts/_generated/run_input_artifacts.py,sha256=0LqP4cdRCeU6pxpNOCS--FBTzq4J8LO910HApueKzLk,1113 +wandb/sdk/artifacts/_generated/run_output_artifacts.py,sha256=Z7vRD6F_hBfv-amwGFWcljwuDHvE1yyV2ZXcC3nh7Gs,1127 +wandb/sdk/artifacts/_generated/type_info.py,sha256=6dw3ShNvTUsiWgpmlA66hQU8FF1eBbiL7sKxVxR_mII,364 +wandb/sdk/artifacts/_generated/unlink_artifact.py,sha256=vewfSMXtziI-IBlputJGIY497iGrXUjCVfTFoK3UHOg,348 +wandb/sdk/artifacts/_generated/update_artifact.py,sha256=pvfL8da5TpXmzYqK-Z-xQ40DyryEg67hVgpIEaTzps0,439 +wandb/sdk/artifacts/_generated/update_artifact_portfolio.py,sha256=tvK9ZzTJKizsZnGG7Sn8ef5s662CfhV8CeT47gdPYBM,579 +wandb/sdk/artifacts/_generated/update_artifact_sequence.py,sha256=Izfb_7ow8MODDfjrNkY89UTU2Na-w3xyaKRO3kwQy0A,574 +wandb/sdk/artifacts/_generated/update_artifact_sequence_type.py,sha256=aRIM24tNzNdBZAsZdW8DwgF08Q0hgeSyelZb8pEvm8s,618 +wandb/sdk/artifacts/_generated/update_team_registry_role.py,sha256=0VnBsIcN6_a-g5PYlRZtMe9xBBQ1VTidLVyo-NQzHyc,380 +wandb/sdk/artifacts/_generated/update_user_registry_role.py,sha256=gvN1hdNZ33-6h9N5nPHSMtYV4OQPo7HCx2Kt3_fQm9c,380 +wandb/sdk/artifacts/_generated/upsert_registry.py,sha256=DKQrqAMNhX3iHiUNtwsdFmWaoKI2-BNMDDsRyryLyiE,555 +wandb/sdk/artifacts/_gqlutils.py,sha256=VaOMjTasv1J2JGbzniREnEHtjbhnI70nlRNok2E6vDk,7499 +wandb/sdk/artifacts/_internal_artifact.py,sha256=P0Y-dFYOo-Tz3xNi5ceKqJzKS9bdFzk5IumsTDHdILE,1923 +wandb/sdk/artifacts/_models/__init__.py,sha256=A9QBK0v7qvgbXfXOrBZt1yjumU7lNWJiqwedZ8lve-g,322 +wandb/sdk/artifacts/_models/__pycache__/__init__.cpython-310.pyc,, +wandb/sdk/artifacts/_models/__pycache__/artifact_collection.cpython-310.pyc,, +wandb/sdk/artifacts/_models/__pycache__/base_model.cpython-310.pyc,, +wandb/sdk/artifacts/_models/__pycache__/manifest.cpython-310.pyc,, +wandb/sdk/artifacts/_models/__pycache__/pagination.cpython-310.pyc,, +wandb/sdk/artifacts/_models/__pycache__/registry.cpython-310.pyc,, +wandb/sdk/artifacts/_models/__pycache__/storage.cpython-310.pyc,, +wandb/sdk/artifacts/_models/artifact_collection.py,sha256=Xzz9bEwD73oWydN7h1eefViN319MDczwygUMxxXSU4U,3868 +wandb/sdk/artifacts/_models/base_model.py,sha256=JNs9Ain1-iX7ZHDkYfEFO0DUZJEO-ryNoncK5jCgAMM,761 +wandb/sdk/artifacts/_models/manifest.py,sha256=uguAGaTZfC92Pkjcvy60qyXb5fNWbx5Hg7lBgAlHCdA,965 +wandb/sdk/artifacts/_models/pagination.py,sha256=OK8BRTwPqCrdlWmONsngA-EuHXuGinsuWpDya2uc2_M,908 +wandb/sdk/artifacts/_models/registry.py,sha256=RHirhyPJRu_ZCy2HkRwM7DYjLRPs7jKEbRa5Nq2b458,3724 +wandb/sdk/artifacts/_models/storage.py,sha256=BHABXq7AmDINIn9g5qiKqK7iRuaudjgL1H7rBTribSU,908 +wandb/sdk/artifacts/_validators.py,sha256=47cIUUOuarER2T8-V4-foRRan0ekxkJ2pFuZyeemWMQ,12187 +wandb/sdk/artifacts/artifact.py,sha256=um2xErgmSpR1s72mcUYejv_n-tnbxnKw5E6HGxaj4gI,106379 +wandb/sdk/artifacts/artifact_download_logger.py,sha256=bS4v544rFcTOTRTXMUSd6tfLUXzezbIogDpQmZUjah0,1537 +wandb/sdk/artifacts/artifact_file_cache.py,sha256=B1zC2S-7nswzPQ-SNyPLfSEHaiEIjSrM3UIsXRUkymo,10031 +wandb/sdk/artifacts/artifact_instance_cache.py,sha256=XSP38QiA6jEchJXd9jubFH8DQ7VT8-MTFu4mXac8CCc,602 +wandb/sdk/artifacts/artifact_manifest.py,sha256=xuHQTsbXZ8pD7TUQmhC4GjRBw56Gdantz7gjFRwhAZo,2702 +wandb/sdk/artifacts/artifact_manifest_entry.py,sha256=CgclMZbK89yUuO9BDKxE6UTklYvILF0UUpQcOCMzIfI,9729 +wandb/sdk/artifacts/artifact_manifests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +wandb/sdk/artifacts/artifact_manifests/__pycache__/__init__.cpython-310.pyc,, +wandb/sdk/artifacts/artifact_manifests/__pycache__/artifact_manifest_v1.cpython-310.pyc,, +wandb/sdk/artifacts/artifact_manifests/artifact_manifest_v1.py,sha256=isA_r_pijLfZVcaIb2BJRy7Eaf_Ydt6Z7sVuFvmBfM4,2722 +wandb/sdk/artifacts/artifact_saver.py,sha256=GhV1O7NvqzUaMaS_9NAFOU51zsfZSlWYK8DPrRhih1M,9623 +wandb/sdk/artifacts/artifact_state.py,sha256=JbPVinN8Vaq16IKdPtFmiYbBdBtCKLDMVU_ViMI8QOA,272 +wandb/sdk/artifacts/artifact_ttl.py,sha256=kD_JfKVcQzZlif6PF-WKnemucWPwcISq8hX6Y8lKtY8,122 +wandb/sdk/artifacts/exceptions.py,sha256=7xucPVz-i5nDYUZjiQs9uqL4rAYhvtRqetrq9T7EZ2w,2323 +wandb/sdk/artifacts/staging.py,sha256=QNbPQhlW-w2liQ_5ZgGJaxsp-prPrOAZ1InmCx3N9Zk,890 +wandb/sdk/artifacts/storage_handler.py,sha256=9-04vxaDdHm2WLIc00m_Xf_3i35tzdCxucRSKJP_RHo,2045 +wandb/sdk/artifacts/storage_handlers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +wandb/sdk/artifacts/storage_handlers/__pycache__/__init__.cpython-310.pyc,, +wandb/sdk/artifacts/storage_handlers/__pycache__/_timing.cpython-310.pyc,, +wandb/sdk/artifacts/storage_handlers/__pycache__/azure_handler.cpython-310.pyc,, +wandb/sdk/artifacts/storage_handlers/__pycache__/gcs_handler.cpython-310.pyc,, +wandb/sdk/artifacts/storage_handlers/__pycache__/http_handler.cpython-310.pyc,, +wandb/sdk/artifacts/storage_handlers/__pycache__/local_file_handler.cpython-310.pyc,, +wandb/sdk/artifacts/storage_handlers/__pycache__/multi_handler.cpython-310.pyc,, +wandb/sdk/artifacts/storage_handlers/__pycache__/s3_handler.cpython-310.pyc,, +wandb/sdk/artifacts/storage_handlers/__pycache__/tracking_handler.cpython-310.pyc,, +wandb/sdk/artifacts/storage_handlers/__pycache__/wb_artifact_handler.cpython-310.pyc,, +wandb/sdk/artifacts/storage_handlers/__pycache__/wb_local_artifact_handler.cpython-310.pyc,, +wandb/sdk/artifacts/storage_handlers/_timing.py,sha256=la4ej-NBnmYvLUy_1z8_EkTJOzEA3XpzkBL-PomIliM,938 +wandb/sdk/artifacts/storage_handlers/azure_handler.py,sha256=YckDbo7LGSlE8UapQgFQwDZia_9caQzCoyhaC1yUnI4,8472 +wandb/sdk/artifacts/storage_handlers/gcs_handler.py,sha256=__dZ2ZyFcrTEuuAG4MRhEo0bZqtBnAxDorr0SywGxjo,9124 +wandb/sdk/artifacts/storage_handlers/http_handler.py,sha256=T32kcQAz0Vpm0EY-3HFqHFD97rCt3LrUruJ7q703w2w,4447 +wandb/sdk/artifacts/storage_handlers/local_file_handler.py,sha256=6B6yVlYtYimwpjTfgz3QDF6-iiWH2vlQF1AwzMifcHc,5537 +wandb/sdk/artifacts/storage_handlers/multi_handler.py,sha256=GAs8eUy2Fo_9kYAmi8usxc9esuscuKLfHAfDpt-XFQw,1898 +wandb/sdk/artifacts/storage_handlers/s3_handler.py,sha256=766IIpMDbdJ14pN_CyftSvpgoxLeZfKl_AncDxhBuIg,12853 +wandb/sdk/artifacts/storage_handlers/tracking_handler.py,sha256=Ntb2k4dcVnta47DAr-CzVuXihjZ4YS8pl0SlobaHvSc,2476 +wandb/sdk/artifacts/storage_handlers/wb_artifact_handler.py,sha256=CYD8dOMZVIWYAzSMGlg-VLy3HbvKPBokRhzBgyp-k30,4949 +wandb/sdk/artifacts/storage_handlers/wb_local_artifact_handler.py,sha256=7bFD9LYAlGwpQL9C462-8KcOn5BGVQKTxvD9qg1XwdU,2672 +wandb/sdk/artifacts/storage_layout.py,sha256=r0FMjIA_j5W3Jeq_OdOguY_lH17KPMLLZ2jOVw-R31E,313 +wandb/sdk/artifacts/storage_policies/__init__.py,sha256=bgpWKElL-3iHcLO8pF-L8oezG-dQbp_6vcCYo7CEFAU,226 +wandb/sdk/artifacts/storage_policies/__pycache__/__init__.cpython-310.pyc,, +wandb/sdk/artifacts/storage_policies/__pycache__/_factories.cpython-310.pyc,, +wandb/sdk/artifacts/storage_policies/__pycache__/_multipart.cpython-310.pyc,, +wandb/sdk/artifacts/storage_policies/__pycache__/register.cpython-310.pyc,, +wandb/sdk/artifacts/storage_policies/__pycache__/wandb_storage_policy.cpython-310.pyc,, +wandb/sdk/artifacts/storage_policies/_factories.py,sha256=qBBlT_EdYTD0UGh1AKz-uYSqM0EsljDSZs5U3xIZgA0,2819 +wandb/sdk/artifacts/storage_policies/_multipart.py,sha256=CAapu_gxrvTYadViNT8xyBO6fuubvIae_HFTwRs1eTE,10126 +wandb/sdk/artifacts/storage_policies/register.py,sha256=xT7kUxubtLqyE-9S6U9E4mCo1PtXl0ZEJ6gVQiS-kGQ,49 +wandb/sdk/artifacts/storage_policies/wandb_storage_policy.py,sha256=_s459NvuedXUiQnAO1NuzuzBWEJeZKvroQ_BKnYbYw8,14052 +wandb/sdk/artifacts/storage_policy.py,sha256=6rbe1jbLOrIVVJ4W0X6fFyIlriK7ZVV_7VO2I6gJ4Jc,2546 +wandb/sdk/backend/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +wandb/sdk/backend/__pycache__/__init__.cpython-310.pyc,, +wandb/sdk/backend/__pycache__/backend.cpython-310.pyc,, +wandb/sdk/backend/backend.py,sha256=0_d1VJ-H4QSNH-OiVTHxbsGmE2KxfHxJXy08MuBIWXc,1327 +wandb/sdk/data_types/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +wandb/sdk/data_types/__pycache__/__init__.cpython-310.pyc,, +wandb/sdk/data_types/__pycache__/_dtypes.cpython-310.pyc,, +wandb/sdk/data_types/__pycache__/_private.cpython-310.pyc,, +wandb/sdk/data_types/__pycache__/audio.cpython-310.pyc,, +wandb/sdk/data_types/__pycache__/bokeh.cpython-310.pyc,, +wandb/sdk/data_types/__pycache__/graph.cpython-310.pyc,, +wandb/sdk/data_types/__pycache__/histogram.cpython-310.pyc,, +wandb/sdk/data_types/__pycache__/html.cpython-310.pyc,, +wandb/sdk/data_types/__pycache__/image.cpython-310.pyc,, +wandb/sdk/data_types/__pycache__/molecule.cpython-310.pyc,, +wandb/sdk/data_types/__pycache__/object_3d.cpython-310.pyc,, +wandb/sdk/data_types/__pycache__/plotly.cpython-310.pyc,, +wandb/sdk/data_types/__pycache__/saved_model.cpython-310.pyc,, +wandb/sdk/data_types/__pycache__/table.cpython-310.pyc,, +wandb/sdk/data_types/__pycache__/table_decorators.cpython-310.pyc,, +wandb/sdk/data_types/__pycache__/trace_tree.cpython-310.pyc,, +wandb/sdk/data_types/__pycache__/utils.cpython-310.pyc,, +wandb/sdk/data_types/__pycache__/video.cpython-310.pyc,, +wandb/sdk/data_types/_dtypes.py,sha256=IdIlo0ZgYACdbyBoKJs_S1p6NLkGbWtmyezvJQ6ASeM,29454 +wandb/sdk/data_types/_private.py,sha256=zp2NRarTlIq4Hk3R2xp7j_qPGNzBMnaGHrZUN82shaY,299 +wandb/sdk/data_types/audio.py,sha256=BAfpC0FV37BJ8-PeXFv2SXNtavWL2prx8m25LWgXEQM,6453 +wandb/sdk/data_types/base_types/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +wandb/sdk/data_types/base_types/__pycache__/__init__.cpython-310.pyc,, +wandb/sdk/data_types/base_types/__pycache__/json_metadata.cpython-310.pyc,, +wandb/sdk/data_types/base_types/__pycache__/media.cpython-310.pyc,, +wandb/sdk/data_types/base_types/__pycache__/wb_value.cpython-310.pyc,, +wandb/sdk/data_types/base_types/json_metadata.py,sha256=ONOJ2xzPglshy5WxRbxrC-atV0VofDdKOw21BZtzzJg,1564 +wandb/sdk/data_types/base_types/media.py,sha256=yASY1KAiQggfKcd7gBOuTMeVxfixcgB4Dis6rjBYZxY,12429 +wandb/sdk/data_types/base_types/wb_value.py,sha256=0-DfKW4qRWu0qUhV5uCqjt5oG8uh7gRYHLdUFnOk9pk,11592 +wandb/sdk/data_types/bokeh.py,sha256=ShvPih65jCAyDJd_EQYXbjZM8_hPeZO6ncTmbampGcU,2995 +wandb/sdk/data_types/graph.py,sha256=c8P0aN9sNzS6ebccantN4kl_wK-xRczrCBIn4JnJs2A,12845 +wandb/sdk/data_types/helper_types/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +wandb/sdk/data_types/helper_types/__pycache__/__init__.cpython-310.pyc,, +wandb/sdk/data_types/helper_types/__pycache__/bounding_boxes_2d.cpython-310.pyc,, +wandb/sdk/data_types/helper_types/__pycache__/classes.cpython-310.pyc,, +wandb/sdk/data_types/helper_types/__pycache__/image_mask.cpython-310.pyc,, +wandb/sdk/data_types/helper_types/bounding_boxes_2d.py,sha256=sZDgQlRq8gk6Ibng3UVLOn0mG7NPni220_53JOmrBrA,13765 +wandb/sdk/data_types/helper_types/classes.py,sha256=bbFSttKZtJB5qNVx9ReuztvfqDO4qkdf1saizE_3A2Q,5496 +wandb/sdk/data_types/helper_types/image_mask.py,sha256=wu7USySZK1f3mXPTZz1I1IGo8c58QjcR70qgtFqVXmY,8845 +wandb/sdk/data_types/histogram.py,sha256=qHD3zgvLELaSQfO0k2xlEWWJkz7ZapC1j_24TWlr6zw,3387 +wandb/sdk/data_types/html.py,sha256=GpEYbbcstb29xcVYEK903bFn96o12nElI3_aZB6nH2Y,5018 +wandb/sdk/data_types/image.py,sha256=be3BRrt-_zXESJkP-4T97Rt396F6VoO-zfJ4UA41vqk,35773 +wandb/sdk/data_types/molecule.py,sha256=012HrNwZLzD8ve7rsXrD-lxnP0_9XPWkaKxrybuogSs,8973 +wandb/sdk/data_types/object_3d.py,sha256=xLA5SmngkqusxUPYwPd6UR_wFpYCXS9FuZrLO7wr6f4,19051 +wandb/sdk/data_types/plotly.py,sha256=x9L3so5pthykovvLYFA3erW4plxEVtaBAY3A19ZqqzM,3372 +wandb/sdk/data_types/saved_model.py,sha256=8Upi_rfGDCimGiMM944mz-fGtOD6KAojte_7BqBl8Xs,16423 +wandb/sdk/data_types/table.py,sha256=EOsix1Nl5Twxsw9ge5VSxjymdfAgHUCvK1puj1jCMok,54221 +wandb/sdk/data_types/table_decorators.py,sha256=2D0dlnv7sBvrHyYH61LCCMhowmg8CENqyvth9BID-VQ,3727 +wandb/sdk/data_types/trace_tree.py,sha256=NdAvPSb8LkWDbnPlBGm-WvjIMOAoaweiuE0MQ_7Dt9s,14693 +wandb/sdk/data_types/utils.py,sha256=qA45y0pjbBXnbl-6Jz4UPBpWMQqW68TfWe62jrA_lRw,8971 +wandb/sdk/data_types/video.py,sha256=JR67ItmmbsmxA0sdNxdxlszxAFWlEJhmeUIsilLJ3hQ,10584 +wandb/sdk/integration_utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +wandb/sdk/integration_utils/__pycache__/__init__.cpython-310.pyc,, +wandb/sdk/integration_utils/__pycache__/auto_logging.cpython-310.pyc,, +wandb/sdk/integration_utils/__pycache__/data_logging.cpython-310.pyc,, +wandb/sdk/integration_utils/auto_logging.py,sha256=URyjjtTVsaSMLjNatoaEFm9xfix1RW_A8f319jvoUR0,8231 +wandb/sdk/integration_utils/data_logging.py,sha256=2wz0SKWQpWM3EuqkAlLmDjQhJXuEsDkmvgOtej1A1pM,19382 +wandb/sdk/interface/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +wandb/sdk/interface/__pycache__/__init__.cpython-310.pyc,, +wandb/sdk/interface/__pycache__/constants.cpython-310.pyc,, +wandb/sdk/interface/__pycache__/interface.cpython-310.pyc,, +wandb/sdk/interface/__pycache__/interface_queue.cpython-310.pyc,, +wandb/sdk/interface/__pycache__/interface_shared.cpython-310.pyc,, +wandb/sdk/interface/__pycache__/interface_sock.cpython-310.pyc,, +wandb/sdk/interface/__pycache__/summary_record.cpython-310.pyc,, +wandb/sdk/interface/constants.py,sha256=NJNBFr7LkshLI837D3LU3JuEURLzBwza9H-kxcy4ihw,60 +wandb/sdk/interface/interface.py,sha256=cknAIMcwNCOJsvevDPGbOvcNukFbTpTD-ZZ2hb3xfMk,39362 +wandb/sdk/interface/interface_queue.py,sha256=1fIqJHt_afql_m3iy6K4hPCE00tyYQhLnw65oggTpnw,1736 +wandb/sdk/interface/interface_shared.py,sha256=SEhJNpJwxDbs3Uv5ZHrlyuJpWNVdiPG9bdeyJ8AvQfU,18751 +wandb/sdk/interface/interface_sock.py,sha256=y0XyWbmtgqibQTH3gM9P1-P9Y9m5OZQpZhnEFnnGiGs,1779 +wandb/sdk/interface/summary_record.py,sha256=u6wh55VkRu35wKz1ta2ob7ZgsgzJI87mLXvL3XBGlHU,1703 +wandb/sdk/internal/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +wandb/sdk/internal/__pycache__/__init__.cpython-310.pyc,, +wandb/sdk/internal/__pycache__/context.cpython-310.pyc,, +wandb/sdk/internal/__pycache__/datastore.cpython-310.pyc,, +wandb/sdk/internal/__pycache__/file_pusher.cpython-310.pyc,, +wandb/sdk/internal/__pycache__/file_stream.cpython-310.pyc,, +wandb/sdk/internal/__pycache__/handler.cpython-310.pyc,, +wandb/sdk/internal/__pycache__/incremental_table_util.cpython-310.pyc,, +wandb/sdk/internal/__pycache__/internal_api.cpython-310.pyc,, +wandb/sdk/internal/__pycache__/job_builder.cpython-310.pyc,, +wandb/sdk/internal/__pycache__/profiler.cpython-310.pyc,, +wandb/sdk/internal/__pycache__/progress.cpython-310.pyc,, +wandb/sdk/internal/__pycache__/run.cpython-310.pyc,, +wandb/sdk/internal/__pycache__/sample.cpython-310.pyc,, +wandb/sdk/internal/__pycache__/sender.cpython-310.pyc,, +wandb/sdk/internal/__pycache__/sender_config.cpython-310.pyc,, +wandb/sdk/internal/__pycache__/settings_static.cpython-310.pyc,, +wandb/sdk/internal/__pycache__/tb_watcher.cpython-310.pyc,, +wandb/sdk/internal/_generated/__init__.py,sha256=mEJ0eZ7YAZRsOPDX8PU9Ts_ViO4FHoS8fzcgLvtAF6c,200 +wandb/sdk/internal/_generated/__pycache__/__init__.cpython-310.pyc,, +wandb/sdk/internal/_generated/__pycache__/enums.cpython-310.pyc,, +wandb/sdk/internal/_generated/__pycache__/input_types.cpython-310.pyc,, +wandb/sdk/internal/_generated/__pycache__/operations.cpython-310.pyc,, +wandb/sdk/internal/_generated/__pycache__/server_features_query.cpython-310.pyc,, +wandb/sdk/internal/_generated/enums.py,sha256=vPRi0TPBkZS4D4to-WzhesolsPj3a2B1Okr1xmjRy5k,124 +wandb/sdk/internal/_generated/input_types.py,sha256=vPRi0TPBkZS4D4to-WzhesolsPj3a2B1Okr1xmjRy5k,124 +wandb/sdk/internal/_generated/operations.py,sha256=e_jeUmwP9mnaFe2WUssdmKw2AeN-Iuf3j3FkG9fDnUY,245 +wandb/sdk/internal/_generated/server_features_query.py,sha256=jhXMQv37V4nAgMTyojC0X1txuvfpXA6W6-fS_9fenGo,655 +wandb/sdk/internal/context.py,sha256=7pm1vQQEa0FE0K32grBgSqJfxfjh9i2877O_pKba5v0,2514 +wandb/sdk/internal/datastore.py,sha256=HrSK1RDIQ5BY--q218gNEAMXPtQhLcWiKaxnS-sfmsk,9469 +wandb/sdk/internal/file_pusher.py,sha256=dvCs-bymJgQSIDEsbRxe6Et5w45QXc3ktGmPXu_Krww,6024 +wandb/sdk/internal/file_stream.py,sha256=gPw5PD4C3nDp8XKjIAcF5cY8kwuXqpnbm2v816RM61M,25354 +wandb/sdk/internal/handler.py,sha256=SqwvmE6hzgGuSRfK-SMxZsCO5gZshH6ZcGoU0laUD3A,31382 +wandb/sdk/internal/incremental_table_util.py,sha256=SwcLG366undgZ5nw4xfyVZ5BZS4mAUw1K9HfmenFbqg,1490 +wandb/sdk/internal/internal_api.py,sha256=MiQo1I7eepuEZNnzbdzTad5XFxabd5AtEFGV6wo_HwE,162879 +wandb/sdk/internal/job_builder.py,sha256=CnqS0FrCv4EHgq1b0DA8bMU2HGMlAohhEYJNYHucaDI,23179 +wandb/sdk/internal/profiler.py,sha256=6IJ18j5saTzX_GrGUm-qKLAYF8tW_iQMCP_jUqbaVn8,2391 +wandb/sdk/internal/progress.py,sha256=gWRLA9-rapa1KKuBfzmkAxYmZGuJiGFgnWz66D3nEng,2296 +wandb/sdk/internal/run.py,sha256=MD3D-o8Zo9hYpd-v9UlslTAuvCJHD6J1gBnZeZoD4o0,624 +wandb/sdk/internal/sample.py,sha256=USAWLhEeP83J13BVOSIy1Rb3kDDKTK9kzR88SlhO7dw,2470 +wandb/sdk/internal/sender.py,sha256=21S2P1Lhpmb3ioht_bCGL-FFaxykYvyNKgTT-lkuDps,65020 +wandb/sdk/internal/sender_config.py,sha256=vBEiyCJEFZSLfShHvAxtv6BaEAzc6WIb3jyHQBa2C6s,7171 +wandb/sdk/internal/settings_static.py,sha256=i1AsYZz3iV3OSs7_bMHiyJUDe25wS43oUl6jhFABNZQ,1202 +wandb/sdk/internal/tb_watcher.py,sha256=igods_Z9uX16U6zHrEFP0NlgDHn0t141CQCc1WKS9TU,18540 +wandb/sdk/launch/__init__.py,sha256=moXY557JibPbvE1GSSh3nGFiyelTVaJZMdFSv61Dn2k,399 +wandb/sdk/launch/__pycache__/__init__.cpython-310.pyc,, +wandb/sdk/launch/__pycache__/_launch.cpython-310.pyc,, +wandb/sdk/launch/__pycache__/_launch_add.cpython-310.pyc,, +wandb/sdk/launch/__pycache__/_project_spec.cpython-310.pyc,, +wandb/sdk/launch/__pycache__/create_job.cpython-310.pyc,, +wandb/sdk/launch/__pycache__/errors.cpython-310.pyc,, +wandb/sdk/launch/__pycache__/git_reference.cpython-310.pyc,, +wandb/sdk/launch/__pycache__/loader.cpython-310.pyc,, +wandb/sdk/launch/__pycache__/utils.cpython-310.pyc,, +wandb/sdk/launch/__pycache__/wandb_reference.cpython-310.pyc,, +wandb/sdk/launch/_launch.py,sha256=sLOKLV3fPOUlZuAVZgYjwQ3tME5WtjxqFwyqUuwaQm0,11733 +wandb/sdk/launch/_launch_add.py,sha256=OfIEqT5j5xZWs3mis7py5OI6u6xqhgXCgGKoEZQeV-Y,8670 +wandb/sdk/launch/_project_spec.py,sha256=trzhKmT5imVpEvGqcXxbH9WXTep1hP6-zongzn_8tR8,21495 +wandb/sdk/launch/agent/__init__.py,sha256=nwGHzJptq87cXCSAJi7Wv2ShL-HZwDgMo2aFC2Rh20w,85 +wandb/sdk/launch/agent/__pycache__/__init__.cpython-310.pyc,, +wandb/sdk/launch/agent/__pycache__/agent.cpython-310.pyc,, +wandb/sdk/launch/agent/__pycache__/config.cpython-310.pyc,, +wandb/sdk/launch/agent/__pycache__/job_status_tracker.cpython-310.pyc,, +wandb/sdk/launch/agent/__pycache__/run_queue_item_file_saver.cpython-310.pyc,, +wandb/sdk/launch/agent/agent.py,sha256=u4UcU60_WgT0UcNwLqyd2PxenYvrT0ykKjOluYtMpLo,36726 +wandb/sdk/launch/agent/config.py,sha256=a9Xlh0otPqzbVf9HAivb_l7vkJjJJ99xtMoChRtuT-w,9425 +wandb/sdk/launch/agent/job_status_tracker.py,sha256=Tih7u-_ICnuYzsEcvySpjZOVO6OvWD8ZP7gtL-keGJs,1823 +wandb/sdk/launch/agent/run_queue_item_file_saver.py,sha256=pcQ1BCvVKBPz1xWYMJD1zAo2mbXVCH-l96fHQqIaeS4,1320 +wandb/sdk/launch/builder/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +wandb/sdk/launch/builder/__pycache__/__init__.cpython-310.pyc,, +wandb/sdk/launch/builder/__pycache__/abstract.cpython-310.pyc,, +wandb/sdk/launch/builder/__pycache__/build.cpython-310.pyc,, +wandb/sdk/launch/builder/__pycache__/context_manager.cpython-310.pyc,, +wandb/sdk/launch/builder/__pycache__/docker_builder.cpython-310.pyc,, +wandb/sdk/launch/builder/__pycache__/kaniko_builder.cpython-310.pyc,, +wandb/sdk/launch/builder/__pycache__/noop.cpython-310.pyc,, +wandb/sdk/launch/builder/abstract.py,sha256=npneD1_cDNMsqOyHNCS9kh0a89HXzgCn2sn8CJCZ3_A,5089 +wandb/sdk/launch/builder/build.py,sha256=eOKwsB5P42jL0m0FBB7kpLy7mZexoDCEr5aUlHLWA9Q,10794 +wandb/sdk/launch/builder/context_manager.py,sha256=5h7asyAT_86GTHqP33vNfvFrRZRU_qEv0g0cdnC1SMc,9593 +wandb/sdk/launch/builder/docker_builder.py,sha256=f-97q5aKzhCD1rTs03mXto2i-zMU5X5gZwoIlXiARV0,6331 +wandb/sdk/launch/builder/kaniko_builder.py,sha256=_t9NbxD_a2i_o0A2XIvzNx5RtU9_dFFmlUwvywL1--s,23926 +wandb/sdk/launch/builder/noop.py,sha256=pu0GQJI63LmxXSp02g-cuT04LKCgWywpJvA3Ew422ds,1915 +wandb/sdk/launch/builder/templates/__pycache__/_wandb_bootstrap.cpython-310.pyc,, +wandb/sdk/launch/builder/templates/__pycache__/dockerfile.cpython-310.pyc,, +wandb/sdk/launch/builder/templates/_wandb_bootstrap.py,sha256=uXHBa7Ibo8V_ekVt4qIsKiKNn71A_vrpVptIMNQFKbo,7289 +wandb/sdk/launch/builder/templates/dockerfile.py,sha256=X8D6n6tyyh69oNHeFiUp-d8ClEtMpHSjwk45N12CR68,2264 +wandb/sdk/launch/create_job.py,sha256=VzZGFLJWHkQ4HrP2U3vA3zJk2xtr9ySO2kbfJm5HOLE,17611 +wandb/sdk/launch/environment/__pycache__/abstract.cpython-310.pyc,, +wandb/sdk/launch/environment/__pycache__/aws_environment.cpython-310.pyc,, +wandb/sdk/launch/environment/__pycache__/azure_environment.cpython-310.pyc,, +wandb/sdk/launch/environment/__pycache__/gcp_environment.cpython-310.pyc,, +wandb/sdk/launch/environment/__pycache__/local_environment.cpython-310.pyc,, +wandb/sdk/launch/environment/abstract.py,sha256=FpQSsLqJ_PpU5Jy25YpZnWTiN4_6cihmynZFI1isuE0,951 +wandb/sdk/launch/environment/aws_environment.py,sha256=Mfd-OGBDpIDq_XSi8b8kWCLOGZ_Ex2wi_c59NeZejw4,12515 +wandb/sdk/launch/environment/azure_environment.py,sha256=7QBtLfcbEMBXwpVWFfFQ18xs5bVlnr1EcUi1K-Z1R3c,3880 +wandb/sdk/launch/environment/gcp_environment.py,sha256=qNphMdPsSct0o62EpQeTJKkyX8CUs6XKoLYB_WtBX-c,12707 +wandb/sdk/launch/environment/local_environment.py,sha256=V8zkVJNdVcRHvOyzvsjIuApiHae_977_ulTC0zHH0tc,2246 +wandb/sdk/launch/errors.py,sha256=G86cx2IZSRBBxLE7thxcVFKzN9d4mGyvciaWRz0uWWM,275 +wandb/sdk/launch/git_reference.py,sha256=IwxcvShAUe-D1V-jyz7_smi4PfvD2UJDiF9Q1rYxmv0,3734 +wandb/sdk/launch/inputs/__pycache__/files.cpython-310.pyc,, +wandb/sdk/launch/inputs/__pycache__/internal.cpython-310.pyc,, +wandb/sdk/launch/inputs/__pycache__/manage.cpython-310.pyc,, +wandb/sdk/launch/inputs/__pycache__/schema.cpython-310.pyc,, +wandb/sdk/launch/inputs/files.py,sha256=dLh9s4OkETroJQhdFW1r02Iotxb4Emd96FTK1GTlW_M,4647 +wandb/sdk/launch/inputs/internal.py,sha256=tQZQAgsdJ379wXMfY9DXWDo_qaC9_5FoZy0TJyusiew,9785 +wandb/sdk/launch/inputs/manage.py,sha256=ygwDF60MjIM130cFWG3ZeeopzD2thM6x8A4CpTaa9QY,5005 +wandb/sdk/launch/inputs/schema.py,sha256=oP8orPuDUC67bRNZlYbTG21KYAFbSs1udXTDfMPX8gg,2900 +wandb/sdk/launch/loader.py,sha256=MQaTog28w2oyIFvGijJSZvIeehdXp0b0LVrislb4x_Q,8938 +wandb/sdk/launch/registry/__pycache__/abstract.cpython-310.pyc,, +wandb/sdk/launch/registry/__pycache__/anon.cpython-310.pyc,, +wandb/sdk/launch/registry/__pycache__/azure_container_registry.cpython-310.pyc,, +wandb/sdk/launch/registry/__pycache__/elastic_container_registry.cpython-310.pyc,, +wandb/sdk/launch/registry/__pycache__/google_artifact_registry.cpython-310.pyc,, +wandb/sdk/launch/registry/__pycache__/local_registry.cpython-310.pyc,, +wandb/sdk/launch/registry/abstract.py,sha256=3rCxhWquSHUrRP-sm5C5XoBGBa9gReDoxiCp5q4NYjc,1143 +wandb/sdk/launch/registry/anon.py,sha256=H1lIIoAwEl70nr3a_3WB2DSLX-GPDCLe8iGbfXJOueQ,939 +wandb/sdk/launch/registry/azure_container_registry.py,sha256=tCg_A6eHEDZ8P7sm94G1otZMKFUkH57PIrPmuhrtRlU,4550 +wandb/sdk/launch/registry/elastic_container_registry.py,sha256=Hzv7YtrNuVPMJ2hQmU7Kyavz4SfzqF2BaZiB-B7b5ww,7229 +wandb/sdk/launch/registry/google_artifact_registry.py,sha256=3cK6KVRyAz7-w-GzBg3g4S5ioRXH_Fl8LUoC1LiambY,8494 +wandb/sdk/launch/registry/local_registry.py,sha256=vowMkGojwCP4CVZXpexh9WNsBpQQGzzgt8bsKl9mExU,1755 +wandb/sdk/launch/runner/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +wandb/sdk/launch/runner/__pycache__/__init__.cpython-310.pyc,, +wandb/sdk/launch/runner/__pycache__/abstract.cpython-310.pyc,, +wandb/sdk/launch/runner/__pycache__/kubernetes_monitor.cpython-310.pyc,, +wandb/sdk/launch/runner/__pycache__/kubernetes_runner.cpython-310.pyc,, +wandb/sdk/launch/runner/__pycache__/local_container.cpython-310.pyc,, +wandb/sdk/launch/runner/__pycache__/local_process.cpython-310.pyc,, +wandb/sdk/launch/runner/__pycache__/sagemaker_runner.cpython-310.pyc,, +wandb/sdk/launch/runner/__pycache__/vertex_runner.cpython-310.pyc,, +wandb/sdk/launch/runner/abstract.py,sha256=NElKldgnJS8C7sbpxf13-_mTnhEQuhRmwT251X4FTFU,5593 +wandb/sdk/launch/runner/kubernetes_monitor.py,sha256=Mzub8CijALzu23KQtDv-HAQwlZZzej6ThimYIWQ6PHg,17803 +wandb/sdk/launch/runner/kubernetes_runner.py,sha256=GeVrEY3eAOI2Xa-P7hgzHADm3YMVATcXuQLRPOA87mM,47758 +wandb/sdk/launch/runner/local_container.py,sha256=96mBcUnO8E0-ehbVa1TDz4qdw0nalavKCvfs10jiZ7M,10777 +wandb/sdk/launch/runner/local_process.py,sha256=JM_6UdGwfz_nUc8Z00UYOcp2BVgzPwf_KbomUHFRSM4,2682 +wandb/sdk/launch/runner/sagemaker_runner.py,sha256=WRi9D5kViSuZ4kKcJr1_tilCA3QnhwWS5SKDw_tLbGY,15241 +wandb/sdk/launch/runner/vertex_runner.py,sha256=kDT4sxK2qF0VCpaK-sQMtz6xZXCtbHfcOwlJ5uwWdnI,8183 +wandb/sdk/launch/sweeps/__init__.py,sha256=lqSxU-eUXCwa4IyAOFV_UnlnlfobPxVK_wUmw0r6iHs,1065 +wandb/sdk/launch/sweeps/__pycache__/__init__.cpython-310.pyc,, +wandb/sdk/launch/sweeps/__pycache__/scheduler.cpython-310.pyc,, +wandb/sdk/launch/sweeps/__pycache__/scheduler_sweep.cpython-310.pyc,, +wandb/sdk/launch/sweeps/__pycache__/utils.cpython-310.pyc,, +wandb/sdk/launch/sweeps/scheduler.py,sha256=AjWFE11HpJkP0szFNWCNbzAppUSiZ0pFtDhlsNSDo_8,26735 +wandb/sdk/launch/sweeps/scheduler_sweep.py,sha256=rYO-6rqZ3I-_iL6HLglKV3GvKUfkXkJn05uhzYwmkN4,3302 +wandb/sdk/launch/sweeps/utils.py,sha256=vvxfN6wiDEnWx3TD-2h_hY-1ULpw9ompnKLhisUe48k,10199 +wandb/sdk/launch/utils.py,sha256=kLqQ3lrQDi1Q_GvZoFIHEBW_aM39jzwrPJcsNJnh0n8,27858 +wandb/sdk/launch/wandb_reference.py,sha256=fcS-wMbsDST-WYlXPHCroazxLjHYBk33gbRRpHFwOYE,3971 +wandb/sdk/lib/__init__.py,sha256=53BA5lIOtUXciXZcPpNsFbp-iUPzI5gQFxplTykNmOE,183 +wandb/sdk/lib/__pycache__/__init__.cpython-310.pyc,, +wandb/sdk/lib/__pycache__/asyncio_compat.cpython-310.pyc,, +wandb/sdk/lib/__pycache__/asyncio_manager.cpython-310.pyc,, +wandb/sdk/lib/__pycache__/capped_dict.cpython-310.pyc,, +wandb/sdk/lib/__pycache__/config_util.cpython-310.pyc,, +wandb/sdk/lib/__pycache__/console_capture.cpython-310.pyc,, +wandb/sdk/lib/__pycache__/credentials.cpython-310.pyc,, +wandb/sdk/lib/__pycache__/deprecation.cpython-310.pyc,, +wandb/sdk/lib/__pycache__/disabled.cpython-310.pyc,, +wandb/sdk/lib/__pycache__/exit_hooks.cpython-310.pyc,, +wandb/sdk/lib/__pycache__/file_stream_utils.cpython-310.pyc,, +wandb/sdk/lib/__pycache__/filenames.cpython-310.pyc,, +wandb/sdk/lib/__pycache__/filesystem.cpython-310.pyc,, +wandb/sdk/lib/__pycache__/fsm.cpython-310.pyc,, +wandb/sdk/lib/__pycache__/gitlib.cpython-310.pyc,, +wandb/sdk/lib/__pycache__/gql_request.cpython-310.pyc,, +wandb/sdk/lib/__pycache__/handler_util.cpython-310.pyc,, +wandb/sdk/lib/__pycache__/hashutil.cpython-310.pyc,, +wandb/sdk/lib/__pycache__/import_hooks.cpython-310.pyc,, +wandb/sdk/lib/__pycache__/interrupt.cpython-310.pyc,, +wandb/sdk/lib/__pycache__/ipython.cpython-310.pyc,, +wandb/sdk/lib/__pycache__/json_util.cpython-310.pyc,, +wandb/sdk/lib/__pycache__/lazyloader.cpython-310.pyc,, +wandb/sdk/lib/__pycache__/module.cpython-310.pyc,, +wandb/sdk/lib/__pycache__/paths.cpython-310.pyc,, +wandb/sdk/lib/__pycache__/preinit.cpython-310.pyc,, +wandb/sdk/lib/__pycache__/printer.cpython-310.pyc,, +wandb/sdk/lib/__pycache__/printer_asyncio.cpython-310.pyc,, +wandb/sdk/lib/__pycache__/progress.cpython-310.pyc,, +wandb/sdk/lib/__pycache__/proto_util.cpython-310.pyc,, +wandb/sdk/lib/__pycache__/redirect.cpython-310.pyc,, +wandb/sdk/lib/__pycache__/retry.cpython-310.pyc,, +wandb/sdk/lib/__pycache__/run_moment.cpython-310.pyc,, +wandb/sdk/lib/__pycache__/runid.cpython-310.pyc,, +wandb/sdk/lib/__pycache__/server.cpython-310.pyc,, +wandb/sdk/lib/__pycache__/settings_file.cpython-310.pyc,, +wandb/sdk/lib/__pycache__/sparkline.cpython-310.pyc,, +wandb/sdk/lib/__pycache__/telemetry.cpython-310.pyc,, +wandb/sdk/lib/__pycache__/timed_input.cpython-310.pyc,, +wandb/sdk/lib/__pycache__/timer.cpython-310.pyc,, +wandb/sdk/lib/__pycache__/urls.cpython-310.pyc,, +wandb/sdk/lib/__pycache__/wb_logging.cpython-310.pyc,, +wandb/sdk/lib/asyncio_compat.py,sha256=9UlMRzEtrt_X7EzGOSlBcezEsmvoI-BkL1uW7K1_FnU,9354 +wandb/sdk/lib/asyncio_manager.py,sha256=I8_t-Jt-kQHC-YD29xGzbhAEIrxWyaCPy772ZDglaxg,8742 +wandb/sdk/lib/capped_dict.py,sha256=hDQUE82nerUbPbm1Sk-Pu-B5ipTyJPuy0NO7kZGDGn0,843 +wandb/sdk/lib/config_util.py,sha256=0ad882rK_ErdfEhZ_SxU7UeU7npj-Qh6kJg0eRmlUiU,2931 +wandb/sdk/lib/console_capture.py,sha256=ko9f9dNFG7kwN24i8LXVbT7juSeV7FXqt_qaWFR8cnU,8360 +wandb/sdk/lib/credentials.py,sha256=eLfLpMZmCf-ZAVPjda49ayHkknyxqKVG9sm5eYCkzjM,4735 +wandb/sdk/lib/deprecation.py,sha256=qTvtpcvS3iRSHmnxrMGgOeKDuQ4Oj2HIgI8mnJgDzE4,1404 +wandb/sdk/lib/disabled.py,sha256=BTce9lMnc-NvNDFqLW68CwT56G2_FOGYtAQ_zG1w2w8,963 +wandb/sdk/lib/exit_hooks.py,sha256=BRTo0-iGUScMHinflz4rDnw6LY1R4s3wg69X8aSdKjI,1555 +wandb/sdk/lib/file_stream_utils.py,sha256=DlSYBXhybjZMhrFPPpxswRhcbzOU7jUu62pwLBe5ojM,4040 +wandb/sdk/lib/filenames.py,sha256=LnKbKXKKHC1atHn4RbpMc-Ou741ktKIVRUxe0BU_VEE,1993 +wandb/sdk/lib/filesystem.py,sha256=34ZEq12-NTPtXssXzlQR8NFr-1MFH-PAzceZ4U1JLd4,19851 +wandb/sdk/lib/fsm.py,sha256=NtMOUzEbFnic1RfnHi63ssdx34Q-95AnvhIxANoxJgE,5079 +wandb/sdk/lib/gitlib.py,sha256=CJ9RTMq_W9G7NdSB5mGPy12iAJLjJplFj7P-drR8LIQ,7860 +wandb/sdk/lib/gql_request.py,sha256=zSOE4lnWKDGSbH1hn57jCtGpn_8HbYAzqZ9OWzvUs2Q,2674 +wandb/sdk/lib/handler_util.py,sha256=mT9CKsmboq4lPWElsi4uo9ORHhx6OYTr7KY2QtgbM6M,589 +wandb/sdk/lib/hashutil.py,sha256=0oNmcJ-wOte2uJdTiMywf5BDMMc1JDAb9cheMMwoR0Q,3499 +wandb/sdk/lib/import_hooks.py,sha256=pY4HTJirg-iEbC2dkCPpspDVp8XySJ2fy_yt4EefFTM,10258 +wandb/sdk/lib/interrupt.py,sha256=Ea7aSVHcY0wLYnyMfm4jZbQcwGPgRcuPuoBSe0Swuds,1353 +wandb/sdk/lib/ipython.py,sha256=_Uj0gtZg_DrWDbzjk79LK2m2KfO5GCOnOKTJ40JKIus,4174 +wandb/sdk/lib/json_util.py,sha256=sgKspmP7Ye6C9vHGwy3eAgcBHn2yr-FiC13PZnfJiOM,2489 +wandb/sdk/lib/lazyloader.py,sha256=4Seis4C8Ph6a2-3scfYqeHh7KjKG6PO0WJ2ZPW30O0o,1891 +wandb/sdk/lib/module.py,sha256=p4vKIq-rfj-txcUfj0RdknLlb-8sCNmwakn49HTWdsQ,1916 +wandb/sdk/lib/paths.py,sha256=-5mtOUwtf7LUrM4NxQWqi0HGsNSHujD0QOhLa0HXzFo,4565 +wandb/sdk/lib/preinit.py,sha256=4CGlfklYvJ9Eu2MSYEb0KyLfnA5itt8YA7M0AVsIJcs,1470 +wandb/sdk/lib/printer.py,sha256=WRsjZjHS8zoVIHKCqb-fpUeEwZEzGJifqQ5BL4jLYy8,16045 +wandb/sdk/lib/printer_asyncio.py,sha256=XnSiCP5sh1S6-blEf4E11dZCwY0iC5GN0uOwp1W1vFk,1330 +wandb/sdk/lib/progress.py,sha256=8umdq742eiOZm7zdbiYaRkVxS5h9DRHSe3VaaxdEKN8,11157 +wandb/sdk/lib/proto_util.py,sha256=NoyW1EC1h-oZLUs5pGaHbvMbjnPPEFC_PD5a_V5D9F0,2895 +wandb/sdk/lib/redirect.py,sha256=zpC2ru5OFrlVYZNQaJAHB3UOPFGiD58q4R8CJlgi8UI,27346 +wandb/sdk/lib/retry.py,sha256=DJw-krL4v3LmqBuqBmTgkmcaWUt4RmpKI4KXcX10Ejo,13079 +wandb/sdk/lib/run_moment.py,sha256=hFx3S-F9SAF6xtwRYbBnP5fMDkllMJvGSSla_eqbsA8,2419 +wandb/sdk/lib/runid.py,sha256=bUYGEJqE3l5oJZFeIXED2bYvLo7kM5so-GtIHV8hwQ8,1016 +wandb/sdk/lib/server.py,sha256=O0b0m-QsreNiB2eGoDHvzF7PFZ1sRBYKtvy09Gjj-dA,1632 +wandb/sdk/lib/service/__pycache__/ipc_support.cpython-310.pyc,, +wandb/sdk/lib/service/__pycache__/service_client.cpython-310.pyc,, +wandb/sdk/lib/service/__pycache__/service_connection.cpython-310.pyc,, +wandb/sdk/lib/service/__pycache__/service_port_file.cpython-310.pyc,, +wandb/sdk/lib/service/__pycache__/service_process.cpython-310.pyc,, +wandb/sdk/lib/service/__pycache__/service_token.cpython-310.pyc,, +wandb/sdk/lib/service/ipc_support.py,sha256=UPa-bV_wY25WhYmMelVyLGZzbztSz2LSf2SUhVB-omQ,341 +wandb/sdk/lib/service/service_client.py,sha256=IK5Nfc_Yg4t-PNNv31ZvdNol8xAIkx5WBToRyBaFm1k,5089 +wandb/sdk/lib/service/service_connection.py,sha256=08Dm_h8vA33gFlN2qDY6XzO9-3IOOHs0WpdTlU8Xfkw,11197 +wandb/sdk/lib/service/service_port_file.py,sha256=Oonq46Ml4vKR-JTcxx4exi5MthGYRvIqy8hCv84Lc5k,2943 +wandb/sdk/lib/service/service_process.py,sha256=RqXbb7Eq08c9quU4Z0gaJ_ur8JdEyOXZrd52olTABWg,3128 +wandb/sdk/lib/service/service_token.py,sha256=2J68CZqNqN4sRIkI7oDUpqX6vhfWQi8pXNzU_hUxoGc,5107 +wandb/sdk/lib/settings_file.py,sha256=Qi2e6zZkrhtuce_1uOZU6VWtDcC0Ro-91Dq90xCINw4,6595 +wandb/sdk/lib/sparkline.py,sha256=l8pj6RUGFO2e1EAnQxRcOEE79dceYmjOe1LKYfPetnQ,1361 +wandb/sdk/lib/telemetry.py,sha256=M3YXLLineyR2kwoG86B8Xflv9UmRz-TvjGlAclbThm8,2765 +wandb/sdk/lib/timed_input.py,sha256=_DbYfWUX_BoWQHyzAvBnR0uqAmTjXw1wntO3kxKDNMQ,3508 +wandb/sdk/lib/timer.py,sha256=qz70rt0NkjEG5M2KYepCjSsjwEvCr_zoR4MVzavcRJY,473 +wandb/sdk/lib/urls.py,sha256=tXOUkRagzVTxqFEdVsf9mb7Lfiq2zFvl0TvYs729gpY,4840 +wandb/sdk/lib/wb_logging.py,sha256=X6HxlxQFP3b_W3r4VBcFoue_e_eOwy0Y1VcBRjBUPPA,4905 +wandb/sdk/lib/wbauth/__init__.py,sha256=KA3kUTu2aNQ2giBxtHtLu7pFzCkvtIEPa38coEly-yM,695 +wandb/sdk/lib/wbauth/__pycache__/__init__.cpython-310.pyc,, +wandb/sdk/lib/wbauth/__pycache__/auth.cpython-310.pyc,, +wandb/sdk/lib/wbauth/__pycache__/authenticate.cpython-310.pyc,, +wandb/sdk/lib/wbauth/__pycache__/host_url.cpython-310.pyc,, +wandb/sdk/lib/wbauth/__pycache__/prompt.cpython-310.pyc,, +wandb/sdk/lib/wbauth/__pycache__/saas.cpython-310.pyc,, +wandb/sdk/lib/wbauth/__pycache__/validation.cpython-310.pyc,, +wandb/sdk/lib/wbauth/__pycache__/wbnetrc.cpython-310.pyc,, +wandb/sdk/lib/wbauth/auth.py,sha256=K-JhwTcOAenyWepOkm9lKfl5nzRpigJ4-ByHWE3P_is,6084 +wandb/sdk/lib/wbauth/authenticate.py,sha256=AeYhjwpDHQzmV4dh9-AagDovylIgWI4oA-Usbtf6XJ4,8484 +wandb/sdk/lib/wbauth/host_url.py,sha256=UDj-zQEyjh2GCKlVl26vWQ988kbVggQ8gJjlsdiu4uc,2144 +wandb/sdk/lib/wbauth/prompt.py,sha256=td7SIjCvabKUMKe_1ZMhdeZkC3iExrnFuUZB0fc40Cg,5230 +wandb/sdk/lib/wbauth/saas.py,sha256=g_N6_-H_VM6cYODpWQAdTl9bTcb95Tif-fLfbUfEdsM,221 +wandb/sdk/lib/wbauth/validation.py,sha256=JGY4md-y-F9uT-chlvQ-1PEPR2CnDZ8eUAFEi3ng2dg,1201 +wandb/sdk/lib/wbauth/wbnetrc.py,sha256=CBrbUzCdZ3bHW-rWxqM0LLpnESyQuIFRDpj3Oakp_70,5524 +wandb/sdk/mailbox/__init__.py,sha256=C4x3ym_hymymKFZiI1Q0HPlGx5x5CzeKPVF229Z2V8w,856 +wandb/sdk/mailbox/__pycache__/__init__.cpython-310.pyc,, +wandb/sdk/mailbox/__pycache__/mailbox.cpython-310.pyc,, +wandb/sdk/mailbox/__pycache__/mailbox_handle.cpython-310.pyc,, +wandb/sdk/mailbox/__pycache__/response_handle.cpython-310.pyc,, +wandb/sdk/mailbox/__pycache__/wait_with_progress.cpython-310.pyc,, +wandb/sdk/mailbox/mailbox.py,sha256=fVQlO20XRMtu3foEm7S1cncUThfd-Up7_wCNkqgfLFg,5260 +wandb/sdk/mailbox/mailbox_handle.py,sha256=mtDl5I0xBjoPHnjTY8VQr0IMBj-pF_lA2u17ub5rfzo,3695 +wandb/sdk/mailbox/response_handle.py,sha256=jHXlc2qN5dBjhrE6ekWvua6L-X8gdEwrW3-rDQOJQ_s,3583 +wandb/sdk/mailbox/wait_with_progress.py,sha256=GQR07elLBzeOe-TsJZbXiMf_IXRr7n5GXummiCtlxcw,3117 +wandb/sdk/verify/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +wandb/sdk/verify/__pycache__/__init__.cpython-310.pyc,, +wandb/sdk/verify/__pycache__/verify.cpython-310.pyc,, +wandb/sdk/verify/verify.py,sha256=3tVK1ZsHNQQl68sC4PIuvLnqtaO69K4oIvDPmkmqQSw,18217 +wandb/sdk/wandb_alerts.py,sha256=SwBPBiXRxknMTMGbsVoMMWqWK65UWMcKAdTWZtdwAeo,193 +wandb/sdk/wandb_config.py,sha256=pDqzHSK35XVfmSUvaJyyHQQH2UkCqFksePGo3CkgGaI,10708 +wandb/sdk/wandb_helper.py,sha256=IbJ7opO8UkfwCDekSjRYIrGBblUxnTPBfp1EdesfF4U,1824 +wandb/sdk/wandb_init.py,sha256=a3lbBMnupwyepj2hsG-NNlSsccV5nT_3blLQLkL5zcU,61099 +wandb/sdk/wandb_login.py,sha256=Fl9Pv08Hn5ZIS9yVvp-XRsUCy6WwalUI4q8IbY6ZmlY,10323 +wandb/sdk/wandb_metric.py,sha256=0cvLaIcw5yOZPEd40U-eimrsNLBwFB7PyE2VSfNnUPg,3338 +wandb/sdk/wandb_require.py,sha256=LxVxPouRGJLokB2QtVvqhugKtaa8nPFSsDe5I8gdCG0,2722 +wandb/sdk/wandb_require_helpers.py,sha256=ePW7Tmf2KYSjZPTvY_V1np-GyTsG_Eh_i0vtwCRa-rA,1325 +wandb/sdk/wandb_run.py,sha256=9PxHTfNc2xEVzNQ9T-7FDw45piM77qQEPF5Ss49O2FA,147360 +wandb/sdk/wandb_settings.py,sha256=u-TjaDyDfucZT4vTr0aIUTxmdBwtVQEhJ0D8oEPt5B0,77741 +wandb/sdk/wandb_setup.py,sha256=mayuDwk-48dmIwwpsTAP0w2sQVwyMb4D6dWQfH2-N1U,20061 +wandb/sdk/wandb_summary.py,sha256=rCjB4IakMPnLubmvPlRIlMR4F3GZdAfXfsyoQ6Ve-3U,4485 +wandb/sdk/wandb_sweep.py,sha256=wNB2zSY60-xHLWrNnQxbcAmo43ItrHhvBaTadzKfvVY,3966 +wandb/sdk/wandb_watch.py,sha256=oDGWl2fL6BO9ltOLUQgGreeA7tV_jWVugKV3tYcRa5Y,4773 +wandb/sklearn.py,sha256=hbPkefhS39A1RRymn0nHZZmKM2TrOd4xjlkthTZe9pY,803 +wandb/sync/__init__.py,sha256=e0Ygm4RRlZjqQe8tkBkF7aYtXAYWxR2PeY_zLi-dzZc,79 +wandb/sync/__pycache__/__init__.cpython-310.pyc,, +wandb/sync/__pycache__/sync.cpython-310.pyc,, +wandb/sync/sync.py,sha256=k2heQYujqs-LrTWnUj4rO9g1O1O31F5DvLQJvZfziRY,16121 +wandb/trigger.py,sha256=PaitU3sX6ekGkd2R8iD6d_VtI72ypF7LaPBXh3rXY7Q,615 +wandb/util.py,sha256=kr8seLoiNLOunTHQ7JmDpqbNAV3JrY9lFz26SrV_vH8,62755 +wandb/vendor/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +wandb/vendor/__pycache__/__init__.cpython-310.pyc,, +wandb/vendor/gql-0.2.0/__pycache__/setup.cpython-310.pyc,, +wandb/vendor/gql-0.2.0/setup.py,sha256=_osNap_aCOVvTlDwP9f-aI10TJbpIflxcG6fEQoAxNs,1314 +wandb/vendor/gql-0.2.0/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +wandb/vendor/gql-0.2.0/tests/__pycache__/__init__.cpython-310.pyc,, +wandb/vendor/gql-0.2.0/tests/__pycache__/test_client.cpython-310.pyc,, +wandb/vendor/gql-0.2.0/tests/__pycache__/test_transport.cpython-310.pyc,, +wandb/vendor/gql-0.2.0/tests/starwars/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +wandb/vendor/gql-0.2.0/tests/starwars/__pycache__/__init__.cpython-310.pyc,, +wandb/vendor/gql-0.2.0/tests/starwars/__pycache__/fixtures.cpython-310.pyc,, +wandb/vendor/gql-0.2.0/tests/starwars/__pycache__/schema.cpython-310.pyc,, +wandb/vendor/gql-0.2.0/tests/starwars/__pycache__/test_dsl.cpython-310.pyc,, +wandb/vendor/gql-0.2.0/tests/starwars/__pycache__/test_query.cpython-310.pyc,, +wandb/vendor/gql-0.2.0/tests/starwars/__pycache__/test_validation.cpython-310.pyc,, +wandb/vendor/gql-0.2.0/tests/starwars/fixtures.py,sha256=VSe1BHn6ltu2O_tPOUAFqDg7extW41OiEFO7AjRb8ic,1681 +wandb/vendor/gql-0.2.0/tests/starwars/schema.py,sha256=uCQATEOQIPd3IP4LSEtVjLHmKJ_ArLvEUArVFDf-D0U,4755 +wandb/vendor/gql-0.2.0/tests/starwars/test_dsl.py,sha256=DjJ5ot7wAt84ICcFPpKcxlL-zZTHUBn0QF6I2eSZk9o,5986 +wandb/vendor/gql-0.2.0/tests/starwars/test_query.py,sha256=QcjH1DwLqqb1N-qCx5shN4yo9Qw3-j-NlxoBUw3huqI,7964 +wandb/vendor/gql-0.2.0/tests/starwars/test_validation.py,sha256=DvaFqQ_hy0W92Gsw2av8IjQR51QN2tfZ-NHTM_KCbWs,3350 +wandb/vendor/gql-0.2.0/tests/test_client.py,sha256=ITo-5YBgRTq7vrBOJ97ztXKcyQn5niWOnAkE6sqJgM0,697 +wandb/vendor/gql-0.2.0/tests/test_transport.py,sha256=BZwYV6DQBlRFkLVHp_dH2CzSbOQsLNR9peEPCsZCqmU,2240 +wandb/vendor/gql-0.2.0/wandb_gql/__init__.py,sha256=sokx5ACyDmgDtL-io3gBEVKcBAi1CV4nSiXEjeGMjVI,77 +wandb/vendor/gql-0.2.0/wandb_gql/__pycache__/__init__.cpython-310.pyc,, +wandb/vendor/gql-0.2.0/wandb_gql/__pycache__/client.cpython-310.pyc,, +wandb/vendor/gql-0.2.0/wandb_gql/__pycache__/dsl.cpython-310.pyc,, +wandb/vendor/gql-0.2.0/wandb_gql/__pycache__/gql.cpython-310.pyc,, +wandb/vendor/gql-0.2.0/wandb_gql/__pycache__/utils.cpython-310.pyc,, +wandb/vendor/gql-0.2.0/wandb_gql/client.py,sha256=AR45930Eaf1DYmcA-Fm9NouXU0kKTCl1aEyZtECKAY0,2964 +wandb/vendor/gql-0.2.0/wandb_gql/dsl.py,sha256=fZTUZlq7NbuJULYgfTpQ_oNSK-gvF1v3O7Soaq-tv6M,4375 +wandb/vendor/gql-0.2.0/wandb_gql/gql.py,sha256=JZEozVeuOxb6rkactNzs_0v6TvM799KYCdXQTzorbFM,348 +wandb/vendor/gql-0.2.0/wandb_gql/transport/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +wandb/vendor/gql-0.2.0/wandb_gql/transport/__pycache__/__init__.cpython-310.pyc,, +wandb/vendor/gql-0.2.0/wandb_gql/transport/__pycache__/http.cpython-310.pyc,, +wandb/vendor/gql-0.2.0/wandb_gql/transport/__pycache__/local_schema.cpython-310.pyc,, +wandb/vendor/gql-0.2.0/wandb_gql/transport/__pycache__/requests.cpython-310.pyc,, +wandb/vendor/gql-0.2.0/wandb_gql/transport/http.py,sha256=W_21pHSLCNme_ukkin1muiF7vUtK21LEzUcqPNK-6_k,172 +wandb/vendor/gql-0.2.0/wandb_gql/transport/local_schema.py,sha256=rWiVTPpRJGCZIkLkp-QiV26pc0YkgVpt2PtoNivihGg,316 +wandb/vendor/gql-0.2.0/wandb_gql/transport/requests.py,sha256=eaSF9HIGaBwRvXbUzifemmQ5uNbDj4e9lzGfD4zH-gY,1637 +wandb/vendor/gql-0.2.0/wandb_gql/utils.py,sha256=rV2mkAU9-6DBPTyyHTSq0lBuXC5o6HHOLN2Kmy0ifds,676 +wandb/vendor/graphql-core-1.1/__pycache__/setup.cpython-310.pyc,, +wandb/vendor/graphql-core-1.1/setup.py,sha256=FV94NFqGy3w5eILAhH_rldtMwyQ7KNEomxwUR-ceJ3M,2743 +wandb/vendor/graphql-core-1.1/wandb_graphql/__init__.py,sha256=x2MzOC7YipdFCsvCmZV1ogaacUxvdHaTTkbdb4dZuNI,7300 +wandb/vendor/graphql-core-1.1/wandb_graphql/__pycache__/__init__.cpython-310.pyc,, +wandb/vendor/graphql-core-1.1/wandb_graphql/__pycache__/graphql.cpython-310.pyc,, +wandb/vendor/graphql-core-1.1/wandb_graphql/error/__init__.py,sha256=9yXJJMFCWiPT_ljIvpkYvDJ0-nx9BAx3bEGOwtPQkqA,251 +wandb/vendor/graphql-core-1.1/wandb_graphql/error/__pycache__/__init__.cpython-310.pyc,, +wandb/vendor/graphql-core-1.1/wandb_graphql/error/__pycache__/base.cpython-310.pyc,, +wandb/vendor/graphql-core-1.1/wandb_graphql/error/__pycache__/format_error.cpython-310.pyc,, +wandb/vendor/graphql-core-1.1/wandb_graphql/error/__pycache__/located_error.cpython-310.pyc,, +wandb/vendor/graphql-core-1.1/wandb_graphql/error/__pycache__/syntax_error.cpython-310.pyc,, +wandb/vendor/graphql-core-1.1/wandb_graphql/error/base.py,sha256=PxPIdFLH6bfl3cy1HUsFNch6jcMS6lqUUwL2lTvOPOM,1270 +wandb/vendor/graphql-core-1.1/wandb_graphql/error/format_error.py,sha256=McCg1u3AEgfAGug7QnhXWUHHYpzbsJpaW8YGbS5f4XQ,296 +wandb/vendor/graphql-core-1.1/wandb_graphql/error/located_error.py,sha256=HLg4fJmLDtRcUVZ331dhd2rIA9Lg3DI09kpq7cSS6BA,757 +wandb/vendor/graphql-core-1.1/wandb_graphql/error/syntax_error.py,sha256=d5oGQt5wjORtqR7o8hKYsITl1COSt_gZlT3gScSds4I,1132 +wandb/vendor/graphql-core-1.1/wandb_graphql/execution/__init__.py,sha256=OQcZ6FkavSXLlrqOYTC1Q-H7CQ4S1onzJnsSOkta6IA,723 +wandb/vendor/graphql-core-1.1/wandb_graphql/execution/__pycache__/__init__.cpython-310.pyc,, +wandb/vendor/graphql-core-1.1/wandb_graphql/execution/__pycache__/base.cpython-310.pyc,, +wandb/vendor/graphql-core-1.1/wandb_graphql/execution/__pycache__/executor.cpython-310.pyc,, +wandb/vendor/graphql-core-1.1/wandb_graphql/execution/__pycache__/middleware.cpython-310.pyc,, +wandb/vendor/graphql-core-1.1/wandb_graphql/execution/__pycache__/values.cpython-310.pyc,, +wandb/vendor/graphql-core-1.1/wandb_graphql/execution/base.py,sha256=WYuAfruLgMl9__UMg24yA9VBckcOaWgw0csrFDQ_oxw,11264 +wandb/vendor/graphql-core-1.1/wandb_graphql/execution/executor.py,sha256=67xPlV8im1YlLem8V3KY8_9U3mKaiCZlNKiRRfCRI0c,14308 +wandb/vendor/graphql-core-1.1/wandb_graphql/execution/executors/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +wandb/vendor/graphql-core-1.1/wandb_graphql/execution/executors/__pycache__/__init__.cpython-310.pyc,, +wandb/vendor/graphql-core-1.1/wandb_graphql/execution/executors/__pycache__/asyncio.cpython-310.pyc,, +wandb/vendor/graphql-core-1.1/wandb_graphql/execution/executors/__pycache__/gevent.cpython-310.pyc,, +wandb/vendor/graphql-core-1.1/wandb_graphql/execution/executors/__pycache__/process.cpython-310.pyc,, +wandb/vendor/graphql-core-1.1/wandb_graphql/execution/executors/__pycache__/sync.cpython-310.pyc,, +wandb/vendor/graphql-core-1.1/wandb_graphql/execution/executors/__pycache__/thread.cpython-310.pyc,, +wandb/vendor/graphql-core-1.1/wandb_graphql/execution/executors/__pycache__/utils.cpython-310.pyc,, +wandb/vendor/graphql-core-1.1/wandb_graphql/execution/executors/asyncio.py,sha256=FS5HajefEO68JXw8vqpcYMir0jIsU-z9YQu5YT6bnjw,1794 +wandb/vendor/graphql-core-1.1/wandb_graphql/execution/executors/gevent.py,sha256=o4R9f77Fe0lldzeqnTPQOvkSsnrfT-90l6y2fBZkfTk,495 +wandb/vendor/graphql-core-1.1/wandb_graphql/execution/executors/process.py,sha256=ncW65pMpnfsXSw171p-sqEJRSfPC5bjbHY5A6hGtbxQ,757 +wandb/vendor/graphql-core-1.1/wandb_graphql/execution/executors/sync.py,sha256=57ylY5MVMo3P5EJbaNPQtsx8kLCK7ZaHDKuXKY30HQ8,157 +wandb/vendor/graphql-core-1.1/wandb_graphql/execution/executors/thread.py,sha256=JdXtp1hJaW7V1I58C7cGHziCqC3U3DAmOuYMXPrbvcc,953 +wandb/vendor/graphql-core-1.1/wandb_graphql/execution/executors/utils.py,sha256=3zHgHZKyrbDIWsDRuLHRtrRYFmi6mQ14q6n9hjKr30E,151 +wandb/vendor/graphql-core-1.1/wandb_graphql/execution/experimental/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +wandb/vendor/graphql-core-1.1/wandb_graphql/execution/experimental/__pycache__/__init__.cpython-310.pyc,, +wandb/vendor/graphql-core-1.1/wandb_graphql/execution/experimental/__pycache__/executor.cpython-310.pyc,, +wandb/vendor/graphql-core-1.1/wandb_graphql/execution/experimental/__pycache__/fragment.cpython-310.pyc,, +wandb/vendor/graphql-core-1.1/wandb_graphql/execution/experimental/__pycache__/resolver.cpython-310.pyc,, +wandb/vendor/graphql-core-1.1/wandb_graphql/execution/experimental/__pycache__/utils.cpython-310.pyc,, +wandb/vendor/graphql-core-1.1/wandb_graphql/execution/experimental/executor.py,sha256=gxwgR0Fl59b8dGkx5JgwjReBH4h3bT0-Bz0alL_5fcA,2251 +wandb/vendor/graphql-core-1.1/wandb_graphql/execution/experimental/fragment.py,sha256=ppscuvjnaMT-YgHcomzSfXRjrxT9rEQe-vb_zj5g_Ao,8329 +wandb/vendor/graphql-core-1.1/wandb_graphql/execution/experimental/resolver.py,sha256=9bakNNeCgI8YuAnV2OTAEkyvYOScuaIELCQ4WK5KqUg,6344 +wandb/vendor/graphql-core-1.1/wandb_graphql/execution/experimental/utils.py,sha256=akGcXkBUaN7Qig7Y1itPkcarjVZYwjfJG-97sNsylT4,149 +wandb/vendor/graphql-core-1.1/wandb_graphql/execution/middleware.py,sha256=CQBz9W-qgfLOHOKbm3TuDSG7It49PXTHfcUzozxjDpQ,1725 +wandb/vendor/graphql-core-1.1/wandb_graphql/execution/values.py,sha256=1t_uGTA86cs1vIa0imkMt-zSLKG1LyxbOA38yF-3Q7Y,4734 +wandb/vendor/graphql-core-1.1/wandb_graphql/graphql.py,sha256=9Fu2CLxgimKzSpZAkqeWUSA8lDK8LRRkUnn40-rTjF0,2224 +wandb/vendor/graphql-core-1.1/wandb_graphql/language/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +wandb/vendor/graphql-core-1.1/wandb_graphql/language/__pycache__/__init__.cpython-310.pyc,, +wandb/vendor/graphql-core-1.1/wandb_graphql/language/__pycache__/ast.cpython-310.pyc,, +wandb/vendor/graphql-core-1.1/wandb_graphql/language/__pycache__/base.cpython-310.pyc,, +wandb/vendor/graphql-core-1.1/wandb_graphql/language/__pycache__/lexer.cpython-310.pyc,, +wandb/vendor/graphql-core-1.1/wandb_graphql/language/__pycache__/location.cpython-310.pyc,, +wandb/vendor/graphql-core-1.1/wandb_graphql/language/__pycache__/parser.cpython-310.pyc,, +wandb/vendor/graphql-core-1.1/wandb_graphql/language/__pycache__/printer.cpython-310.pyc,, +wandb/vendor/graphql-core-1.1/wandb_graphql/language/__pycache__/source.cpython-310.pyc,, +wandb/vendor/graphql-core-1.1/wandb_graphql/language/__pycache__/visitor.cpython-310.pyc,, +wandb/vendor/graphql-core-1.1/wandb_graphql/language/__pycache__/visitor_meta.cpython-310.pyc,, +wandb/vendor/graphql-core-1.1/wandb_graphql/language/ast.py,sha256=VnBTudpMQoxmGHgiHyKN_74uGf3baiU-c13zzcR_QtQ,35008 +wandb/vendor/graphql-core-1.1/wandb_graphql/language/base.py,sha256=Q07CFeZbOfxiR_Dc5HOIBRbJK6Zk5mfl8KE2e7WVrq4,408 +wandb/vendor/graphql-core-1.1/wandb_graphql/language/lexer.py,sha256=TMlNjDoNatPxVdJsCjp4OSvH3K-lxfBhips4MqRbkoI,11467 +wandb/vendor/graphql-core-1.1/wandb_graphql/language/location.py,sha256=QcVvx0NKUUt8L2LSGQzSWKjnCoaOnoxqokp-mlnQ9TI,746 +wandb/vendor/graphql-core-1.1/wandb_graphql/language/parser.py,sha256=da64gvknlunEC3TDgrgf74h22NpfsEPPm-OdBmof92A,20905 +wandb/vendor/graphql-core-1.1/wandb_graphql/language/printer.py,sha256=gH-I-gieWXw9FcCIISaXoxK_v_mzmhzAOqwiRiVbTQ8,5888 +wandb/vendor/graphql-core-1.1/wandb_graphql/language/source.py,sha256=UI0kq69Mujj986BiQoqeNDrxEBWPzf3IH4C1NZ1PXW8,405 +wandb/vendor/graphql-core-1.1/wandb_graphql/language/visitor.py,sha256=VzScdaIv3q8cCt95GiK3h8bDPXm8p-0wdBot8cthSuY,6247 +wandb/vendor/graphql-core-1.1/wandb_graphql/language/visitor_meta.py,sha256=Qat5ccqiNGOHE9W7z38YGdtW2c8koBw0OUWEMxpdBhk,2980 +wandb/vendor/graphql-core-1.1/wandb_graphql/pyutils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +wandb/vendor/graphql-core-1.1/wandb_graphql/pyutils/__pycache__/__init__.cpython-310.pyc,, +wandb/vendor/graphql-core-1.1/wandb_graphql/pyutils/__pycache__/cached_property.cpython-310.pyc,, +wandb/vendor/graphql-core-1.1/wandb_graphql/pyutils/__pycache__/contain_subset.cpython-310.pyc,, +wandb/vendor/graphql-core-1.1/wandb_graphql/pyutils/__pycache__/default_ordered_dict.cpython-310.pyc,, +wandb/vendor/graphql-core-1.1/wandb_graphql/pyutils/__pycache__/ordereddict.cpython-310.pyc,, +wandb/vendor/graphql-core-1.1/wandb_graphql/pyutils/__pycache__/pair_set.cpython-310.pyc,, +wandb/vendor/graphql-core-1.1/wandb_graphql/pyutils/__pycache__/version.cpython-310.pyc,, +wandb/vendor/graphql-core-1.1/wandb_graphql/pyutils/cached_property.py,sha256=eaxADzdmkEbkQmiu47k5p72Inyce9pxaVto1gvkkmMY,588 +wandb/vendor/graphql-core-1.1/wandb_graphql/pyutils/contain_subset.py,sha256=_-KYbYuSC3fiVSxcCwKHpwtS_Ig85HgRP6Hx5xbDF0E,1006 +wandb/vendor/graphql-core-1.1/wandb_graphql/pyutils/default_ordered_dict.py,sha256=xcFbt16AzcQsYehMOn-w04q1gOUiMzzySsKhpvpSQ6o,1288 +wandb/vendor/graphql-core-1.1/wandb_graphql/pyutils/ordereddict.py,sha256=YNLfN47G2nhMvl9Tm4DYPSJMzeLXKwTwAIPDarMtgjk,256 +wandb/vendor/graphql-core-1.1/wandb_graphql/pyutils/pair_set.py,sha256=gbdnd55q1UkTBdNSsAYVquiSSOAhI1q4mMWe6xfNkoI,1168 +wandb/vendor/graphql-core-1.1/wandb_graphql/pyutils/version.py,sha256=sd6hPQbuZ3kwijdPr5h6iZm2YFsmvqc9-6KtjRw7JU8,2454 +wandb/vendor/graphql-core-1.1/wandb_graphql/type/__init__.py,sha256=B_uo71CK3pr19VJjJf0G2dSEvS5p6zA5KbS53OxGsbY,1366 +wandb/vendor/graphql-core-1.1/wandb_graphql/type/__pycache__/__init__.cpython-310.pyc,, +wandb/vendor/graphql-core-1.1/wandb_graphql/type/__pycache__/definition.cpython-310.pyc,, +wandb/vendor/graphql-core-1.1/wandb_graphql/type/__pycache__/directives.cpython-310.pyc,, +wandb/vendor/graphql-core-1.1/wandb_graphql/type/__pycache__/introspection.cpython-310.pyc,, +wandb/vendor/graphql-core-1.1/wandb_graphql/type/__pycache__/scalars.cpython-310.pyc,, +wandb/vendor/graphql-core-1.1/wandb_graphql/type/__pycache__/schema.cpython-310.pyc,, +wandb/vendor/graphql-core-1.1/wandb_graphql/type/__pycache__/typemap.cpython-310.pyc,, +wandb/vendor/graphql-core-1.1/wandb_graphql/type/definition.py,sha256=IHihIcxrBxVlyYtFFQr4R_4qC6o3JELUvwzL08goRbw,19250 +wandb/vendor/graphql-core-1.1/wandb_graphql/type/directives.py,sha256=snrI-WsyBoxOqEG3NC5Aau2e8_YiMmBPd2_TBgu41ks,4098 +wandb/vendor/graphql-core-1.1/wandb_graphql/type/introspection.py,sha256=ZyyA_zIbe8HaSThL7O9Kl44NKDBAkKKp0QOlbUI4tLU,17580 +wandb/vendor/graphql-core-1.1/wandb_graphql/type/scalars.py,sha256=HTwIgW1-O5tww8nA9pnEDTykaAVWQDWX1VV5zbkseK4,3849 +wandb/vendor/graphql-core-1.1/wandb_graphql/type/schema.py,sha256=grEnY-oKDaEu3Fr5LfsUk7xtXVhXD7MuOrIprkQ5q14,3474 +wandb/vendor/graphql-core-1.1/wandb_graphql/type/typemap.py,sha256=SB-wqQ7-UVtyv4HrK0rh5DLb6-T3nYpsOvhJAjHlwhU,6844 +wandb/vendor/graphql-core-1.1/wandb_graphql/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +wandb/vendor/graphql-core-1.1/wandb_graphql/utils/__pycache__/__init__.cpython-310.pyc,, +wandb/vendor/graphql-core-1.1/wandb_graphql/utils/__pycache__/assert_valid_name.cpython-310.pyc,, +wandb/vendor/graphql-core-1.1/wandb_graphql/utils/__pycache__/ast_from_value.cpython-310.pyc,, +wandb/vendor/graphql-core-1.1/wandb_graphql/utils/__pycache__/ast_to_code.cpython-310.pyc,, +wandb/vendor/graphql-core-1.1/wandb_graphql/utils/__pycache__/ast_to_dict.cpython-310.pyc,, +wandb/vendor/graphql-core-1.1/wandb_graphql/utils/__pycache__/base.cpython-310.pyc,, +wandb/vendor/graphql-core-1.1/wandb_graphql/utils/__pycache__/build_ast_schema.cpython-310.pyc,, +wandb/vendor/graphql-core-1.1/wandb_graphql/utils/__pycache__/build_client_schema.cpython-310.pyc,, +wandb/vendor/graphql-core-1.1/wandb_graphql/utils/__pycache__/concat_ast.cpython-310.pyc,, +wandb/vendor/graphql-core-1.1/wandb_graphql/utils/__pycache__/extend_schema.cpython-310.pyc,, +wandb/vendor/graphql-core-1.1/wandb_graphql/utils/__pycache__/get_field_def.cpython-310.pyc,, +wandb/vendor/graphql-core-1.1/wandb_graphql/utils/__pycache__/get_operation_ast.cpython-310.pyc,, +wandb/vendor/graphql-core-1.1/wandb_graphql/utils/__pycache__/introspection_query.cpython-310.pyc,, +wandb/vendor/graphql-core-1.1/wandb_graphql/utils/__pycache__/is_valid_literal_value.cpython-310.pyc,, +wandb/vendor/graphql-core-1.1/wandb_graphql/utils/__pycache__/is_valid_value.cpython-310.pyc,, +wandb/vendor/graphql-core-1.1/wandb_graphql/utils/__pycache__/quoted_or_list.cpython-310.pyc,, +wandb/vendor/graphql-core-1.1/wandb_graphql/utils/__pycache__/schema_printer.cpython-310.pyc,, +wandb/vendor/graphql-core-1.1/wandb_graphql/utils/__pycache__/suggestion_list.cpython-310.pyc,, +wandb/vendor/graphql-core-1.1/wandb_graphql/utils/__pycache__/type_comparators.cpython-310.pyc,, +wandb/vendor/graphql-core-1.1/wandb_graphql/utils/__pycache__/type_from_ast.cpython-310.pyc,, +wandb/vendor/graphql-core-1.1/wandb_graphql/utils/__pycache__/type_info.cpython-310.pyc,, +wandb/vendor/graphql-core-1.1/wandb_graphql/utils/__pycache__/value_from_ast.cpython-310.pyc,, +wandb/vendor/graphql-core-1.1/wandb_graphql/utils/assert_valid_name.py,sha256=xqNTzOxF5UjdxIev_hUy3ewgBA9OOCiBQbIpdQlI3xs,308 +wandb/vendor/graphql-core-1.1/wandb_graphql/utils/ast_from_value.py,sha256=mx8CdvRQAllQniX0IXiVaTOvbKXYHFqMFPr5dNMhRK4,1998 +wandb/vendor/graphql-core-1.1/wandb_graphql/utils/ast_to_code.py,sha256=b5Qf8SeaqULW16bGIWTCZV5Mi0n-oUB_d5A-ez-d47k,1200 +wandb/vendor/graphql-core-1.1/wandb_graphql/utils/ast_to_dict.py,sha256=VtXQ63TuKC1EpKt3A96v4Bd4xIciRqVhk-rIHv8JiSs,638 +wandb/vendor/graphql-core-1.1/wandb_graphql/utils/base.py,sha256=qDhQwKRHDUN63UY4UbocIj6J8BnCEZD4meP_15ujzeo,2120 +wandb/vendor/graphql-core-1.1/wandb_graphql/utils/build_ast_schema.py,sha256=ljtWw-UiZZWaBsY3lfuHvsyXpoJ39KaxBwFVpbQjJ2o,10596 +wandb/vendor/graphql-core-1.1/wandb_graphql/utils/build_client_schema.py,sha256=a3x9-BKBa0xAQRNAuFtY6xbn9PChLrqpdG4Nu2sYPcY,10027 +wandb/vendor/graphql-core-1.1/wandb_graphql/utils/concat_ast.py,sha256=M7tFprLml4VjGXpxB5C_HLrRPbXcgr0dYyS_Ph4XCI8,204 +wandb/vendor/graphql-core-1.1/wandb_graphql/utils/extend_schema.py,sha256=A3uGbTgctv3AK4Bjd1tJM0x-AP6nP1Tv9MUYfoGhlaw,14143 +wandb/vendor/graphql-core-1.1/wandb_graphql/utils/get_field_def.py,sha256=PQU-C728tQHUOHBwK0oIc6iCnI8RdAEWZ3D3xtAJUkc,1108 +wandb/vendor/graphql-core-1.1/wandb_graphql/utils/get_operation_ast.py,sha256=h5_Ftqy1f2UExbOIw0EWENj-CY91KP_eStXRBvuL9Xc,834 +wandb/vendor/graphql-core-1.1/wandb_graphql/utils/introspection_query.py,sha256=UUt5Uiw9JHpkClfXyd6CIuC9LABoW2qxg95EH6OK_OE,1472 +wandb/vendor/graphql-core-1.1/wandb_graphql/utils/is_valid_literal_value.py,sha256=bIU5jV8pLARq_3qIc6jAWf1N2OCC5w4-qYCMzljupss,2366 +wandb/vendor/graphql-core-1.1/wandb_graphql/utils/is_valid_value.py,sha256=mUXwjh_1HKTJ0Mke7JSLhFWOaLT7qDQqBzpSHvTE4cY,2143 +wandb/vendor/graphql-core-1.1/wandb_graphql/utils/quoted_or_list.py,sha256=5nxFfvx2zMjravOr4uQadWxZ5KilIfOFSFyiGuTv9SY,704 +wandb/vendor/graphql-core-1.1/wandb_graphql/utils/schema_printer.py,sha256=dPXqQI-HjebWPcjKJj_Sgj4jiRauGPQMTaV808PLpCw,4792 +wandb/vendor/graphql-core-1.1/wandb_graphql/utils/suggestion_list.py,sha256=eW9FUe3-ByBL86Rr3EZ5wSMqX_rEHWkzSFCYt_67jeI,1845 +wandb/vendor/graphql-core-1.1/wandb_graphql/utils/type_comparators.py,sha256=bwHJP9lVRgTiwhxgGyrwpcn9VAE1q7J2coJRJZs-ETg,2433 +wandb/vendor/graphql-core-1.1/wandb_graphql/utils/type_from_ast.py,sha256=TylOn7PMSmbggdoKibSA2-O2A_JvGn3NDWySeJ6k9g8,703 +wandb/vendor/graphql-core-1.1/wandb_graphql/utils/type_info.py,sha256=md0lKaIolOlyzHSHY0ZwZaE_9DB6aO3ztQRYFrxiE0w,4886 +wandb/vendor/graphql-core-1.1/wandb_graphql/utils/value_from_ast.py,sha256=XVlFlYTPeXf5HaO0M3lZjFj_3jvlAMJRjbQTFcQhURc,2437 +wandb/vendor/graphql-core-1.1/wandb_graphql/validation/__init__.py,sha256=dZtKP6R2FTSCc2gAkTOTayqmyrRl_gQlzBQCIDb3k10,111 +wandb/vendor/graphql-core-1.1/wandb_graphql/validation/__pycache__/__init__.cpython-310.pyc,, +wandb/vendor/graphql-core-1.1/wandb_graphql/validation/__pycache__/validation.cpython-310.pyc,, +wandb/vendor/graphql-core-1.1/wandb_graphql/validation/rules/__init__.py,sha256=WZsygnTsLd51GgWvmSWUAhGptrV0GzCB2pIcmDExFYA,2736 +wandb/vendor/graphql-core-1.1/wandb_graphql/validation/rules/__pycache__/__init__.cpython-310.pyc,, +wandb/vendor/graphql-core-1.1/wandb_graphql/validation/rules/__pycache__/arguments_of_correct_type.cpython-310.pyc,, +wandb/vendor/graphql-core-1.1/wandb_graphql/validation/rules/__pycache__/base.cpython-310.pyc,, +wandb/vendor/graphql-core-1.1/wandb_graphql/validation/rules/__pycache__/default_values_of_correct_type.cpython-310.pyc,, +wandb/vendor/graphql-core-1.1/wandb_graphql/validation/rules/__pycache__/fields_on_correct_type.cpython-310.pyc,, +wandb/vendor/graphql-core-1.1/wandb_graphql/validation/rules/__pycache__/fragments_on_composite_types.cpython-310.pyc,, +wandb/vendor/graphql-core-1.1/wandb_graphql/validation/rules/__pycache__/known_argument_names.cpython-310.pyc,, +wandb/vendor/graphql-core-1.1/wandb_graphql/validation/rules/__pycache__/known_directives.cpython-310.pyc,, +wandb/vendor/graphql-core-1.1/wandb_graphql/validation/rules/__pycache__/known_fragment_names.cpython-310.pyc,, +wandb/vendor/graphql-core-1.1/wandb_graphql/validation/rules/__pycache__/known_type_names.cpython-310.pyc,, +wandb/vendor/graphql-core-1.1/wandb_graphql/validation/rules/__pycache__/lone_anonymous_operation.cpython-310.pyc,, +wandb/vendor/graphql-core-1.1/wandb_graphql/validation/rules/__pycache__/no_fragment_cycles.cpython-310.pyc,, +wandb/vendor/graphql-core-1.1/wandb_graphql/validation/rules/__pycache__/no_undefined_variables.cpython-310.pyc,, +wandb/vendor/graphql-core-1.1/wandb_graphql/validation/rules/__pycache__/no_unused_fragments.cpython-310.pyc,, +wandb/vendor/graphql-core-1.1/wandb_graphql/validation/rules/__pycache__/no_unused_variables.cpython-310.pyc,, +wandb/vendor/graphql-core-1.1/wandb_graphql/validation/rules/__pycache__/overlapping_fields_can_be_merged.cpython-310.pyc,, +wandb/vendor/graphql-core-1.1/wandb_graphql/validation/rules/__pycache__/possible_fragment_spreads.cpython-310.pyc,, +wandb/vendor/graphql-core-1.1/wandb_graphql/validation/rules/__pycache__/provided_non_null_arguments.cpython-310.pyc,, +wandb/vendor/graphql-core-1.1/wandb_graphql/validation/rules/__pycache__/scalar_leafs.cpython-310.pyc,, +wandb/vendor/graphql-core-1.1/wandb_graphql/validation/rules/__pycache__/unique_argument_names.cpython-310.pyc,, +wandb/vendor/graphql-core-1.1/wandb_graphql/validation/rules/__pycache__/unique_fragment_names.cpython-310.pyc,, +wandb/vendor/graphql-core-1.1/wandb_graphql/validation/rules/__pycache__/unique_input_field_names.cpython-310.pyc,, +wandb/vendor/graphql-core-1.1/wandb_graphql/validation/rules/__pycache__/unique_operation_names.cpython-310.pyc,, +wandb/vendor/graphql-core-1.1/wandb_graphql/validation/rules/__pycache__/unique_variable_names.cpython-310.pyc,, +wandb/vendor/graphql-core-1.1/wandb_graphql/validation/rules/__pycache__/variables_are_input_types.cpython-310.pyc,, +wandb/vendor/graphql-core-1.1/wandb_graphql/validation/rules/__pycache__/variables_in_allowed_position.cpython-310.pyc,, +wandb/vendor/graphql-core-1.1/wandb_graphql/validation/rules/arguments_of_correct_type.py,sha256=0aFzTM-khI1psJZWnAMG91bCg1aZZphdSYRGslaymwc,982 +wandb/vendor/graphql-core-1.1/wandb_graphql/validation/rules/base.py,sha256=7hsprORsfDPcxJ4Ojvpn0qe1ZuGrnbrDT9BgK3Bd3EQ,165 +wandb/vendor/graphql-core-1.1/wandb_graphql/validation/rules/default_values_of_correct_type.py,sha256=l6khdFWN7K_we_uftEOjpaIx6bFYNdqTNqHr9RZHG9Q,1851 +wandb/vendor/graphql-core-1.1/wandb_graphql/validation/rules/fields_on_correct_type.py,sha256=hySfm5eYpG8ZIhDMVqpd2Ryo2JksBQBAlJZUoMekdF4,4401 +wandb/vendor/graphql-core-1.1/wandb_graphql/validation/rules/fragments_on_composite_types.py,sha256=5C4MABVySMpqlnE54e54D1gUn1EtBgQxTliu_aG_IV4,1333 +wandb/vendor/graphql-core-1.1/wandb_graphql/validation/rules/known_argument_names.py,sha256=4uDSSjMWlCVmYspTU0TR-SKBmjGqcuhBdbtejx4pctY,2484 +wandb/vendor/graphql-core-1.1/wandb_graphql/validation/rules/known_directives.py,sha256=0_V12oJpcblXXdPD7yZDeL_vp2lg90xfKT0-Q1N-nU0,3434 +wandb/vendor/graphql-core-1.1/wandb_graphql/validation/rules/known_fragment_names.py,sha256=W7k15YYDlsQqET6Frdn7_5NRhXGz0YKzlH8sBj30m90,597 +wandb/vendor/graphql-core-1.1/wandb_graphql/validation/rules/known_type_names.py,sha256=bLW1UkYYCu_KFEGZJEHydMjqrSprkHjHlzAnmLZjQnw,1258 +wandb/vendor/graphql-core-1.1/wandb_graphql/validation/rules/lone_anonymous_operation.py,sha256=egiNdBr2s1QHpP9Z2i9fL6PtlT17GXPfEiMh2F_v1Os,897 +wandb/vendor/graphql-core-1.1/wandb_graphql/validation/rules/no_fragment_cycles.py,sha256=myRMv0nLzmW0KGfyYUxvv6DiMZG50y7FTfNKkFg42MU,2275 +wandb/vendor/graphql-core-1.1/wandb_graphql/validation/rules/no_undefined_variables.py,sha256=1LqfZ3rH9E5KH3zQA5wd_BXUQdihrkFSTqVKG4j7gVo,1391 +wandb/vendor/graphql-core-1.1/wandb_graphql/validation/rules/no_unused_fragments.py,sha256=RG4DVQL7nA2MCijZtCVqKLVJN4dqQxVM_I1IQUUluNA,1489 +wandb/vendor/graphql-core-1.1/wandb_graphql/validation/rules/no_unused_variables.py,sha256=L4N3BzkvJ1GZI6gi2zsMinhej5bWQZqUcJWQ1qu5YJw,1508 +wandb/vendor/graphql-core-1.1/wandb_graphql/validation/rules/overlapping_fields_can_be_merged.py,sha256=CbtRQfEnQP6FTsqC_Jk9XSw4eGVb8shkA5P6yWxAxpk,24145 +wandb/vendor/graphql-core-1.1/wandb_graphql/validation/rules/possible_fragment_spreads.py,sha256=Oky-9Ta0aYgP0Fe1oOtwiOjrWvTpLVWGGwY6B-18l0g,2193 +wandb/vendor/graphql-core-1.1/wandb_graphql/validation/rules/provided_non_null_arguments.py,sha256=fdTVBXQXVgi3MKhGL0FYHYGq-HKCh3HLKAyc9POqD5c,1869 +wandb/vendor/graphql-core-1.1/wandb_graphql/validation/rules/scalar_leafs.py,sha256=Dei3Ss_ycaYfan-F8UBL6IyBjCWdGRoQ85nAq8Y2sFg,1115 +wandb/vendor/graphql-core-1.1/wandb_graphql/validation/rules/unique_argument_names.py,sha256=sCdSGBraWwNUpHhwPu3dk0t3aCPqVWgo1Y4v6LOMnzU,1024 +wandb/vendor/graphql-core-1.1/wandb_graphql/validation/rules/unique_fragment_names.py,sha256=xb_0UhQF7YDlK-vA1u-li6PL3V2FF3Z_kTLGTEKksoI,1002 +wandb/vendor/graphql-core-1.1/wandb_graphql/validation/rules/unique_input_field_names.py,sha256=_YAne-NO_OIenreW4v1XnJES4AK3Y9O_HhUk6M6ilPo,1187 +wandb/vendor/graphql-core-1.1/wandb_graphql/validation/rules/unique_operation_names.py,sha256=kzWjZtAiBou5WhZaOMzrB9UE_fZ8iN2M-VuOlN93lqA,1114 +wandb/vendor/graphql-core-1.1/wandb_graphql/validation/rules/unique_variable_names.py,sha256=5L90Rgnz8UM7N16mxZ4f263Wa4GCGIfLIHKh-UW3mlU,1034 +wandb/vendor/graphql-core-1.1/wandb_graphql/validation/rules/variables_are_input_types.py,sha256=9SbvdDA6ZshPM9-LqHI1byqO-3PwtfvyIgeXr5PHHvA,826 +wandb/vendor/graphql-core-1.1/wandb_graphql/validation/rules/variables_in_allowed_position.py,sha256=hqX7f5LJw3we9OoPWXgQpF333nrYDG_AZr4sSITTyXc,2367 +wandb/vendor/graphql-core-1.1/wandb_graphql/validation/validation.py,sha256=hRqVfs3jp0GFm44DDfKQipb0BEs-dgEeg8X5BcXf8lA,5580 +wandb/vendor/promise-2.3.0/__pycache__/conftest.cpython-310.pyc,, +wandb/vendor/promise-2.3.0/__pycache__/setup.cpython-310.pyc,, +wandb/vendor/promise-2.3.0/conftest.py,sha256=c455VxJib8oEtrs7X9Ixz9rHVlQVl9mRVDVnJ5PhE0g,1010 +wandb/vendor/promise-2.3.0/setup.py,sha256=Wy9FnhHpm7dTLLnTPWYP2RTD8w_31zNlzl28GVv67PQ,1899 +wandb/vendor/promise-2.3.0/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +wandb/vendor/promise-2.3.0/tests/__pycache__/__init__.cpython-310.pyc,, +wandb/vendor/promise-2.3.0/tests/__pycache__/conftest.cpython-310.pyc,, +wandb/vendor/promise-2.3.0/tests/__pycache__/test_awaitable.cpython-310.pyc,, +wandb/vendor/promise-2.3.0/tests/__pycache__/test_awaitable_35.cpython-310.pyc,, +wandb/vendor/promise-2.3.0/tests/__pycache__/test_benchmark.cpython-310.pyc,, +wandb/vendor/promise-2.3.0/tests/__pycache__/test_complex_threads.cpython-310.pyc,, +wandb/vendor/promise-2.3.0/tests/__pycache__/test_dataloader.cpython-310.pyc,, +wandb/vendor/promise-2.3.0/tests/__pycache__/test_dataloader_awaitable_35.cpython-310.pyc,, +wandb/vendor/promise-2.3.0/tests/__pycache__/test_dataloader_extra.cpython-310.pyc,, +wandb/vendor/promise-2.3.0/tests/__pycache__/test_extra.cpython-310.pyc,, +wandb/vendor/promise-2.3.0/tests/__pycache__/test_issues.cpython-310.pyc,, +wandb/vendor/promise-2.3.0/tests/__pycache__/test_promise_list.cpython-310.pyc,, +wandb/vendor/promise-2.3.0/tests/__pycache__/test_spec.cpython-310.pyc,, +wandb/vendor/promise-2.3.0/tests/__pycache__/test_thread_safety.cpython-310.pyc,, +wandb/vendor/promise-2.3.0/tests/__pycache__/utils.cpython-310.pyc,, +wandb/vendor/promise-2.3.0/tests/conftest.py,sha256=cNLj3Q3qG2bYyALzO3xbkYp1Gz5zwjZf_aHw-kk_84U,268 +wandb/vendor/promise-2.3.0/tests/test_awaitable.py,sha256=hWLcgrmySIF2o6dvQqbp84sWVsAowa7GU91rccvhge4,598 +wandb/vendor/promise-2.3.0/tests/test_awaitable_35.py,sha256=h2xndKzvtHF5aEtfRbtKXwjIeHuufOt2luBIBpmOjp8,980 +wandb/vendor/promise-2.3.0/tests/test_benchmark.py,sha256=6X2wr4_cSNXI0oKrPar8DUU3pUMnBQ3morJ4CwzW8iY,2868 +wandb/vendor/promise-2.3.0/tests/test_complex_threads.py,sha256=kQEw0mH2o1VGAx4qOKrcaE_zJJSUicGpvCpMEUOPZNA,485 +wandb/vendor/promise-2.3.0/tests/test_dataloader.py,sha256=gC_PiGDR64LxCcs4aB1NCl-G9oIssbvkwGazrTOrN9U,10637 +wandb/vendor/promise-2.3.0/tests/test_dataloader_awaitable_35.py,sha256=7toBZsOtUXsxeheeHFYiRNOaw1OAc-jDwHx46342hxU,2846 +wandb/vendor/promise-2.3.0/tests/test_dataloader_extra.py,sha256=nN9X1HevfUSkBuFXdLZKad9OFKCYTL9aDIqaeq5Qs1U,1522 +wandb/vendor/promise-2.3.0/tests/test_extra.py,sha256=F2cYhWoIEXo57xZQMU01lQBOZmVNbRhejdjX63xGUMY,14574 +wandb/vendor/promise-2.3.0/tests/test_issues.py,sha256=1eKsHU6MJqHo4CH2sJ2Q7zKPNj3dZLZM678Nx1LKdb4,3690 +wandb/vendor/promise-2.3.0/tests/test_promise_list.py,sha256=aqZT-Nm4qc_vPxWiUZXIpY-Zp2SecQLjpZihiWHbE20,1645 +wandb/vendor/promise-2.3.0/tests/test_spec.py,sha256=uRzXFn6lmPhs8ti9Zj2hRoK2LX2z2lTqDozyGmIEXrA,13441 +wandb/vendor/promise-2.3.0/tests/test_thread_safety.py,sha256=b5HZX5yHFShzG19Pm1qR-cbJUiqfrQhJZCKmPOeOShA,3457 +wandb/vendor/promise-2.3.0/tests/utils.py,sha256=_u7VFe-6rDWwj8xrQQnI_hnQNgYo5OqusSx7LPkImCE,178 +wandb/vendor/promise-2.3.0/wandb_promise/__init__.py,sha256=3IRTDwg63JE0VfdxcJyLIrstgU85Ya8HIkkHN1XWCUY,873 +wandb/vendor/promise-2.3.0/wandb_promise/__pycache__/__init__.cpython-310.pyc,, +wandb/vendor/promise-2.3.0/wandb_promise/__pycache__/async_.cpython-310.pyc,, +wandb/vendor/promise-2.3.0/wandb_promise/__pycache__/compat.cpython-310.pyc,, +wandb/vendor/promise-2.3.0/wandb_promise/__pycache__/dataloader.cpython-310.pyc,, +wandb/vendor/promise-2.3.0/wandb_promise/__pycache__/iterate_promise.cpython-310.pyc,, +wandb/vendor/promise-2.3.0/wandb_promise/__pycache__/promise.cpython-310.pyc,, +wandb/vendor/promise-2.3.0/wandb_promise/__pycache__/promise_list.cpython-310.pyc,, +wandb/vendor/promise-2.3.0/wandb_promise/__pycache__/utils.cpython-310.pyc,, +wandb/vendor/promise-2.3.0/wandb_promise/async_.py,sha256=7L041olXPGPURDMFMgIxec_BWptaZ0ArFh_APTJ8I7Y,3959 +wandb/vendor/promise-2.3.0/wandb_promise/compat.py,sha256=IvY3E6_FyJZDkOahxPTX0or-86V0MFe5YnW3ve90a8Y,875 +wandb/vendor/promise-2.3.0/wandb_promise/dataloader.py,sha256=D_wZCiqu6CTOulhOGttyku6G31ravLt0nV_vXR3PQKQ,10853 +wandb/vendor/promise-2.3.0/wandb_promise/iterate_promise.py,sha256=1HGjWRD8KJkhvgx0hQYhipi-O6Hq1xMRrtajMZrgXA8,296 +wandb/vendor/promise-2.3.0/wandb_promise/promise.py,sha256=_hNgnM_uSrQwQDXCJCxD7tvfQCVQ9gA0TJo0NCSGyro,28218 +wandb/vendor/promise-2.3.0/wandb_promise/promise_list.py,sha256=aODoTWMTTAWRXa1VXZx-9i2R4VNyPkVHvoVwiRPnFdk,4646 +wandb/vendor/promise-2.3.0/wandb_promise/pyutils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +wandb/vendor/promise-2.3.0/wandb_promise/pyutils/__pycache__/__init__.cpython-310.pyc,, +wandb/vendor/promise-2.3.0/wandb_promise/pyutils/__pycache__/version.cpython-310.pyc,, +wandb/vendor/promise-2.3.0/wandb_promise/pyutils/version.py,sha256=crKfIm8N8Ysy1DEuoZFOgnPZCnntpmZtNbS3ZeP00gY,2507 +wandb/vendor/promise-2.3.0/wandb_promise/schedulers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +wandb/vendor/promise-2.3.0/wandb_promise/schedulers/__pycache__/__init__.cpython-310.pyc,, +wandb/vendor/promise-2.3.0/wandb_promise/schedulers/__pycache__/asyncio.cpython-310.pyc,, +wandb/vendor/promise-2.3.0/wandb_promise/schedulers/__pycache__/gevent.cpython-310.pyc,, +wandb/vendor/promise-2.3.0/wandb_promise/schedulers/__pycache__/immediate.cpython-310.pyc,, +wandb/vendor/promise-2.3.0/wandb_promise/schedulers/__pycache__/thread.cpython-310.pyc,, +wandb/vendor/promise-2.3.0/wandb_promise/schedulers/asyncio.py,sha256=Z94PwkAXd8PDybJUM7_tLlDh_AUw5JbI4CFRg6J3_NI,512 +wandb/vendor/promise-2.3.0/wandb_promise/schedulers/gevent.py,sha256=PnB1LI2OXnbK64qvIcXnoV98VbF6kPah5zqsh8v6QmA,502 +wandb/vendor/promise-2.3.0/wandb_promise/schedulers/immediate.py,sha256=4addDLBFlXwiOBXU2i2wGced_zotfEoYEm-_sdeKy1U,663 +wandb/vendor/promise-2.3.0/wandb_promise/schedulers/thread.py,sha256=pK8zhnJWhvM3iiAc8ryoo8-bK2ny2hE4JoSsISBBU9s,435 +wandb/vendor/promise-2.3.0/wandb_promise/utils.py,sha256=v7Ssd2lm9_gLEvy64Q7oXv5VhOt4rPMHOGhIlr9oJew,1624 +wandb/vendor/pygments/__init__.py,sha256=IkWLwTf8uusJPx4c3f3gpHwVJVi0UqeD6mo5wWHHdWs,3145 +wandb/vendor/pygments/__pycache__/__init__.cpython-310.pyc,, +wandb/vendor/pygments/__pycache__/cmdline.cpython-310.pyc,, +wandb/vendor/pygments/__pycache__/console.cpython-310.pyc,, +wandb/vendor/pygments/__pycache__/filter.cpython-310.pyc,, +wandb/vendor/pygments/__pycache__/formatter.cpython-310.pyc,, +wandb/vendor/pygments/__pycache__/lexer.cpython-310.pyc,, +wandb/vendor/pygments/__pycache__/modeline.cpython-310.pyc,, +wandb/vendor/pygments/__pycache__/plugin.cpython-310.pyc,, +wandb/vendor/pygments/__pycache__/regexopt.cpython-310.pyc,, +wandb/vendor/pygments/__pycache__/scanner.cpython-310.pyc,, +wandb/vendor/pygments/__pycache__/sphinxext.cpython-310.pyc,, +wandb/vendor/pygments/__pycache__/style.cpython-310.pyc,, +wandb/vendor/pygments/__pycache__/token.cpython-310.pyc,, +wandb/vendor/pygments/__pycache__/unistring.cpython-310.pyc,, +wandb/vendor/pygments/__pycache__/util.cpython-310.pyc,, +wandb/vendor/pygments/cmdline.py,sha256=_UA78VWUx--QdlHM0OuTu0W3zjDPhoVz8ipmjomf2Ac,19326 +wandb/vendor/pygments/console.py,sha256=AgkV5lDp2ghozb_J8V_UPZ0uudTWTz3isSK9oUvo750,1809 +wandb/vendor/pygments/filter.py,sha256=IY_c2IryClkgeVQDEQeEXoauZryHx9cvTOiedX3jaHc,2036 +wandb/vendor/pygments/filters/__init__.py,sha256=IlSO7Mm0meA1rfssNwR9u7626sscMnASJlZ94yEy9lA,11573 +wandb/vendor/pygments/filters/__pycache__/__init__.cpython-310.pyc,, +wandb/vendor/pygments/formatter.py,sha256=RaPGA3oLywAbvSkzrj61U5Y8xzYai32bbajg8L3xreE,2948 +wandb/vendor/pygments/formatters/__init__.py,sha256=g5hpFvO_jy4-OV-pJr0jRP-vktKi6pXJKZ1z_XDnLIE,5099 +wandb/vendor/pygments/formatters/__pycache__/__init__.cpython-310.pyc,, +wandb/vendor/pygments/formatters/__pycache__/_mapping.cpython-310.pyc,, +wandb/vendor/pygments/formatters/__pycache__/bbcode.cpython-310.pyc,, +wandb/vendor/pygments/formatters/__pycache__/html.cpython-310.pyc,, +wandb/vendor/pygments/formatters/__pycache__/img.cpython-310.pyc,, +wandb/vendor/pygments/formatters/__pycache__/irc.cpython-310.pyc,, +wandb/vendor/pygments/formatters/__pycache__/latex.cpython-310.pyc,, +wandb/vendor/pygments/formatters/__pycache__/other.cpython-310.pyc,, +wandb/vendor/pygments/formatters/__pycache__/rtf.cpython-310.pyc,, +wandb/vendor/pygments/formatters/__pycache__/svg.cpython-310.pyc,, +wandb/vendor/pygments/formatters/__pycache__/terminal.cpython-310.pyc,, +wandb/vendor/pygments/formatters/__pycache__/terminal256.cpython-310.pyc,, +wandb/vendor/pygments/formatters/_mapping.py,sha256=E2DsoS8TZDCv_jJ1mn48rb3Qs4RIr8SJwILEVhYpGk4,6214 +wandb/vendor/pygments/formatters/bbcode.py,sha256=LYa2w-Ep7475be0GSH4MbuYiwH3gWIqpG4dQFCZLbGk,3314 +wandb/vendor/pygments/formatters/html.py,sha256=gvCUGAsxerTWRKnXa3a5ezmJg70KLt7wDb57JGjZhug,31759 +wandb/vendor/pygments/formatters/img.py,sha256=yWhrS8vgisj9XGOWjUrwtd8VZNuAffnBF8IAWl6p44g,19780 +wandb/vendor/pygments/formatters/irc.py,sha256=ApSLVBfjK78gkzXnMC8UrgnBLQulOvb-fza2e-D_RCI,5775 +wandb/vendor/pygments/formatters/latex.py,sha256=izNn5NjCTgu0gq8cyvvwNlRwc52CyAwvprN6DwlbUvU,17758 +wandb/vendor/pygments/formatters/other.py,sha256=p14Jboe9qeJ4xy9Xcb4f90szuQvQ0RI0q9DctZZmXDY,5162 +wandb/vendor/pygments/formatters/rtf.py,sha256=8HK5CpvqLchEWlbYptQKQ2RxQmayNLYyPOovCYBw4l4,5049 +wandb/vendor/pygments/formatters/svg.py,sha256=FT-DWvkC7bJ34-szEmh14PoqyqQkUE2jDPPVwOelqYQ,5840 +wandb/vendor/pygments/formatters/terminal.py,sha256=KkBzLxYMDvfbJXOecTgM1rAIVkYWYkE1a9pNIqtT0AA,4919 +wandb/vendor/pygments/formatters/terminal256.py,sha256=UKFNPANdnt2eGvYw_fRkyW2gKKXVpL9A5jVgEpGxd3g,10776 +wandb/vendor/pygments/lexer.py,sha256=CrUoLYlQbxO5W0YLH_a1lI8Dkw2l4nRZ5ciy9-R-n0I,31054 +wandb/vendor/pygments/lexers/__init__.py,sha256=77oWKOFsKWByzG5aMNDsWBJl0lQYSNgIC8XUUV2pCW4,10906 +wandb/vendor/pygments/lexers/__pycache__/__init__.cpython-310.pyc,, +wandb/vendor/pygments/lexers/__pycache__/_asy_builtins.cpython-310.pyc,, +wandb/vendor/pygments/lexers/__pycache__/_cl_builtins.cpython-310.pyc,, +wandb/vendor/pygments/lexers/__pycache__/_cocoa_builtins.cpython-310.pyc,, +wandb/vendor/pygments/lexers/__pycache__/_csound_builtins.cpython-310.pyc,, +wandb/vendor/pygments/lexers/__pycache__/_lasso_builtins.cpython-310.pyc,, +wandb/vendor/pygments/lexers/__pycache__/_lua_builtins.cpython-310.pyc,, +wandb/vendor/pygments/lexers/__pycache__/_mapping.cpython-310.pyc,, +wandb/vendor/pygments/lexers/__pycache__/_mql_builtins.cpython-310.pyc,, +wandb/vendor/pygments/lexers/__pycache__/_openedge_builtins.cpython-310.pyc,, +wandb/vendor/pygments/lexers/__pycache__/_php_builtins.cpython-310.pyc,, +wandb/vendor/pygments/lexers/__pycache__/_postgres_builtins.cpython-310.pyc,, +wandb/vendor/pygments/lexers/__pycache__/_scilab_builtins.cpython-310.pyc,, +wandb/vendor/pygments/lexers/__pycache__/_sourcemod_builtins.cpython-310.pyc,, +wandb/vendor/pygments/lexers/__pycache__/_stan_builtins.cpython-310.pyc,, +wandb/vendor/pygments/lexers/__pycache__/_stata_builtins.cpython-310.pyc,, +wandb/vendor/pygments/lexers/__pycache__/_tsql_builtins.cpython-310.pyc,, +wandb/vendor/pygments/lexers/__pycache__/_vim_builtins.cpython-310.pyc,, +wandb/vendor/pygments/lexers/__pycache__/actionscript.cpython-310.pyc,, +wandb/vendor/pygments/lexers/__pycache__/agile.cpython-310.pyc,, +wandb/vendor/pygments/lexers/__pycache__/algebra.cpython-310.pyc,, +wandb/vendor/pygments/lexers/__pycache__/ambient.cpython-310.pyc,, +wandb/vendor/pygments/lexers/__pycache__/ampl.cpython-310.pyc,, +wandb/vendor/pygments/lexers/__pycache__/apl.cpython-310.pyc,, +wandb/vendor/pygments/lexers/__pycache__/archetype.cpython-310.pyc,, +wandb/vendor/pygments/lexers/__pycache__/asm.cpython-310.pyc,, +wandb/vendor/pygments/lexers/__pycache__/automation.cpython-310.pyc,, +wandb/vendor/pygments/lexers/__pycache__/basic.cpython-310.pyc,, +wandb/vendor/pygments/lexers/__pycache__/bibtex.cpython-310.pyc,, +wandb/vendor/pygments/lexers/__pycache__/business.cpython-310.pyc,, +wandb/vendor/pygments/lexers/__pycache__/c_cpp.cpython-310.pyc,, +wandb/vendor/pygments/lexers/__pycache__/c_like.cpython-310.pyc,, +wandb/vendor/pygments/lexers/__pycache__/capnproto.cpython-310.pyc,, +wandb/vendor/pygments/lexers/__pycache__/chapel.cpython-310.pyc,, +wandb/vendor/pygments/lexers/__pycache__/clean.cpython-310.pyc,, +wandb/vendor/pygments/lexers/__pycache__/compiled.cpython-310.pyc,, +wandb/vendor/pygments/lexers/__pycache__/configs.cpython-310.pyc,, +wandb/vendor/pygments/lexers/__pycache__/console.cpython-310.pyc,, +wandb/vendor/pygments/lexers/__pycache__/crystal.cpython-310.pyc,, +wandb/vendor/pygments/lexers/__pycache__/csound.cpython-310.pyc,, +wandb/vendor/pygments/lexers/__pycache__/css.cpython-310.pyc,, +wandb/vendor/pygments/lexers/__pycache__/d.cpython-310.pyc,, +wandb/vendor/pygments/lexers/__pycache__/dalvik.cpython-310.pyc,, +wandb/vendor/pygments/lexers/__pycache__/data.cpython-310.pyc,, +wandb/vendor/pygments/lexers/__pycache__/diff.cpython-310.pyc,, +wandb/vendor/pygments/lexers/__pycache__/dotnet.cpython-310.pyc,, +wandb/vendor/pygments/lexers/__pycache__/dsls.cpython-310.pyc,, +wandb/vendor/pygments/lexers/__pycache__/dylan.cpython-310.pyc,, +wandb/vendor/pygments/lexers/__pycache__/ecl.cpython-310.pyc,, +wandb/vendor/pygments/lexers/__pycache__/eiffel.cpython-310.pyc,, +wandb/vendor/pygments/lexers/__pycache__/elm.cpython-310.pyc,, +wandb/vendor/pygments/lexers/__pycache__/erlang.cpython-310.pyc,, +wandb/vendor/pygments/lexers/__pycache__/esoteric.cpython-310.pyc,, +wandb/vendor/pygments/lexers/__pycache__/ezhil.cpython-310.pyc,, +wandb/vendor/pygments/lexers/__pycache__/factor.cpython-310.pyc,, +wandb/vendor/pygments/lexers/__pycache__/fantom.cpython-310.pyc,, +wandb/vendor/pygments/lexers/__pycache__/felix.cpython-310.pyc,, +wandb/vendor/pygments/lexers/__pycache__/forth.cpython-310.pyc,, +wandb/vendor/pygments/lexers/__pycache__/fortran.cpython-310.pyc,, +wandb/vendor/pygments/lexers/__pycache__/foxpro.cpython-310.pyc,, +wandb/vendor/pygments/lexers/__pycache__/functional.cpython-310.pyc,, +wandb/vendor/pygments/lexers/__pycache__/go.cpython-310.pyc,, +wandb/vendor/pygments/lexers/__pycache__/grammar_notation.cpython-310.pyc,, +wandb/vendor/pygments/lexers/__pycache__/graph.cpython-310.pyc,, +wandb/vendor/pygments/lexers/__pycache__/graphics.cpython-310.pyc,, +wandb/vendor/pygments/lexers/__pycache__/haskell.cpython-310.pyc,, +wandb/vendor/pygments/lexers/__pycache__/haxe.cpython-310.pyc,, +wandb/vendor/pygments/lexers/__pycache__/hdl.cpython-310.pyc,, +wandb/vendor/pygments/lexers/__pycache__/hexdump.cpython-310.pyc,, +wandb/vendor/pygments/lexers/__pycache__/html.cpython-310.pyc,, +wandb/vendor/pygments/lexers/__pycache__/idl.cpython-310.pyc,, +wandb/vendor/pygments/lexers/__pycache__/igor.cpython-310.pyc,, +wandb/vendor/pygments/lexers/__pycache__/inferno.cpython-310.pyc,, +wandb/vendor/pygments/lexers/__pycache__/installers.cpython-310.pyc,, +wandb/vendor/pygments/lexers/__pycache__/int_fiction.cpython-310.pyc,, +wandb/vendor/pygments/lexers/__pycache__/iolang.cpython-310.pyc,, +wandb/vendor/pygments/lexers/__pycache__/j.cpython-310.pyc,, +wandb/vendor/pygments/lexers/__pycache__/javascript.cpython-310.pyc,, +wandb/vendor/pygments/lexers/__pycache__/julia.cpython-310.pyc,, +wandb/vendor/pygments/lexers/__pycache__/jvm.cpython-310.pyc,, +wandb/vendor/pygments/lexers/__pycache__/lisp.cpython-310.pyc,, +wandb/vendor/pygments/lexers/__pycache__/make.cpython-310.pyc,, +wandb/vendor/pygments/lexers/__pycache__/markup.cpython-310.pyc,, +wandb/vendor/pygments/lexers/__pycache__/math.cpython-310.pyc,, +wandb/vendor/pygments/lexers/__pycache__/matlab.cpython-310.pyc,, +wandb/vendor/pygments/lexers/__pycache__/ml.cpython-310.pyc,, +wandb/vendor/pygments/lexers/__pycache__/modeling.cpython-310.pyc,, +wandb/vendor/pygments/lexers/__pycache__/modula2.cpython-310.pyc,, +wandb/vendor/pygments/lexers/__pycache__/monte.cpython-310.pyc,, +wandb/vendor/pygments/lexers/__pycache__/ncl.cpython-310.pyc,, +wandb/vendor/pygments/lexers/__pycache__/nimrod.cpython-310.pyc,, +wandb/vendor/pygments/lexers/__pycache__/nit.cpython-310.pyc,, +wandb/vendor/pygments/lexers/__pycache__/nix.cpython-310.pyc,, +wandb/vendor/pygments/lexers/__pycache__/oberon.cpython-310.pyc,, +wandb/vendor/pygments/lexers/__pycache__/objective.cpython-310.pyc,, +wandb/vendor/pygments/lexers/__pycache__/ooc.cpython-310.pyc,, +wandb/vendor/pygments/lexers/__pycache__/other.cpython-310.pyc,, +wandb/vendor/pygments/lexers/__pycache__/parasail.cpython-310.pyc,, +wandb/vendor/pygments/lexers/__pycache__/parsers.cpython-310.pyc,, +wandb/vendor/pygments/lexers/__pycache__/pascal.cpython-310.pyc,, +wandb/vendor/pygments/lexers/__pycache__/pawn.cpython-310.pyc,, +wandb/vendor/pygments/lexers/__pycache__/perl.cpython-310.pyc,, +wandb/vendor/pygments/lexers/__pycache__/php.cpython-310.pyc,, +wandb/vendor/pygments/lexers/__pycache__/praat.cpython-310.pyc,, +wandb/vendor/pygments/lexers/__pycache__/prolog.cpython-310.pyc,, +wandb/vendor/pygments/lexers/__pycache__/python.cpython-310.pyc,, +wandb/vendor/pygments/lexers/__pycache__/qvt.cpython-310.pyc,, +wandb/vendor/pygments/lexers/__pycache__/r.cpython-310.pyc,, +wandb/vendor/pygments/lexers/__pycache__/rdf.cpython-310.pyc,, +wandb/vendor/pygments/lexers/__pycache__/rebol.cpython-310.pyc,, +wandb/vendor/pygments/lexers/__pycache__/resource.cpython-310.pyc,, +wandb/vendor/pygments/lexers/__pycache__/rnc.cpython-310.pyc,, +wandb/vendor/pygments/lexers/__pycache__/roboconf.cpython-310.pyc,, +wandb/vendor/pygments/lexers/__pycache__/robotframework.cpython-310.pyc,, +wandb/vendor/pygments/lexers/__pycache__/ruby.cpython-310.pyc,, +wandb/vendor/pygments/lexers/__pycache__/rust.cpython-310.pyc,, +wandb/vendor/pygments/lexers/__pycache__/sas.cpython-310.pyc,, +wandb/vendor/pygments/lexers/__pycache__/scripting.cpython-310.pyc,, +wandb/vendor/pygments/lexers/__pycache__/shell.cpython-310.pyc,, +wandb/vendor/pygments/lexers/__pycache__/smalltalk.cpython-310.pyc,, +wandb/vendor/pygments/lexers/__pycache__/smv.cpython-310.pyc,, +wandb/vendor/pygments/lexers/__pycache__/snobol.cpython-310.pyc,, +wandb/vendor/pygments/lexers/__pycache__/special.cpython-310.pyc,, +wandb/vendor/pygments/lexers/__pycache__/sql.cpython-310.pyc,, +wandb/vendor/pygments/lexers/__pycache__/stata.cpython-310.pyc,, +wandb/vendor/pygments/lexers/__pycache__/supercollider.cpython-310.pyc,, +wandb/vendor/pygments/lexers/__pycache__/tcl.cpython-310.pyc,, +wandb/vendor/pygments/lexers/__pycache__/templates.cpython-310.pyc,, +wandb/vendor/pygments/lexers/__pycache__/testing.cpython-310.pyc,, +wandb/vendor/pygments/lexers/__pycache__/text.cpython-310.pyc,, +wandb/vendor/pygments/lexers/__pycache__/textedit.cpython-310.pyc,, +wandb/vendor/pygments/lexers/__pycache__/textfmts.cpython-310.pyc,, +wandb/vendor/pygments/lexers/__pycache__/theorem.cpython-310.pyc,, +wandb/vendor/pygments/lexers/__pycache__/trafficscript.cpython-310.pyc,, +wandb/vendor/pygments/lexers/__pycache__/typoscript.cpython-310.pyc,, +wandb/vendor/pygments/lexers/__pycache__/urbi.cpython-310.pyc,, +wandb/vendor/pygments/lexers/__pycache__/varnish.cpython-310.pyc,, +wandb/vendor/pygments/lexers/__pycache__/verification.cpython-310.pyc,, +wandb/vendor/pygments/lexers/__pycache__/web.cpython-310.pyc,, +wandb/vendor/pygments/lexers/__pycache__/webmisc.cpython-310.pyc,, +wandb/vendor/pygments/lexers/__pycache__/whiley.cpython-310.pyc,, +wandb/vendor/pygments/lexers/__pycache__/x10.cpython-310.pyc,, +wandb/vendor/pygments/lexers/_asy_builtins.py,sha256=zph3J1PBBtWjrvc_hUrmY-vk2WkN4zwT3OICH6nnyN0,27321 +wandb/vendor/pygments/lexers/_cl_builtins.py,sha256=1KrMgXg50ZsI02_WlDFuHugJzA-1LygeeUmHGBHBIgw,14053 +wandb/vendor/pygments/lexers/_cocoa_builtins.py,sha256=8b6As01z9rEa14hp7DXSXKHQXnRVI13eWEZ5rcmn5Bk,39982 +wandb/vendor/pygments/lexers/_csound_builtins.py,sha256=JkAZhrG-lXndYAsxWU2VqPce7MfwDknl7u8cYi3tAjs,21643 +wandb/vendor/pygments/lexers/_lasso_builtins.py,sha256=5PNX3gtW3f0X8gzoZUR6JW3mYzck3RcO1J6XtkUhY6Q,134534 +wandb/vendor/pygments/lexers/_lua_builtins.py,sha256=q1bCBDWwe7g-FwonM_xrGibEGdEYJvcdWRVGpYgBPpo,8340 +wandb/vendor/pygments/lexers/_mapping.py,sha256=_P3TsdkuN1NptMfEQkplLCf5TklMRNDi6Rtl_oc4XR4,54715 +wandb/vendor/pygments/lexers/_mql_builtins.py,sha256=qa9s_tUqXl16pAKzRDtWsJKzDPoU-bGaGdgrmHx7XOk,24736 +wandb/vendor/pygments/lexers/_openedge_builtins.py,sha256=0ADwH8PqzC6rJ_SZ8b3j0TgNut1kvLZL8RxpbC3J_nk,48362 +wandb/vendor/pygments/lexers/_php_builtins.py,sha256=cpkFCfHjPG1zExNaMI1JQY1at54pf5RMu-yCBmtwl78,154368 +wandb/vendor/pygments/lexers/_postgres_builtins.py,sha256=me5pfqtfUMpXYSvuTYXscyLCYUY9TcmBX8pGwimHG1U,11210 +wandb/vendor/pygments/lexers/_scilab_builtins.py,sha256=yXpa-XsMiNRgsPpDENWvZFZZJndUGFgv8uioKcfnejI,52405 +wandb/vendor/pygments/lexers/_sourcemod_builtins.py,sha256=DPFvfIi76GawQ603QG_EAFzl_6mmK5xZxfGWl4qlKFM,27113 +wandb/vendor/pygments/lexers/_stan_builtins.py,sha256=y6S6OymabXXmgrF3tMVkTxMHzkdyOi-Q_s0M2qdh-Xk,10121 +wandb/vendor/pygments/lexers/_stata_builtins.py,sha256=Hods-_4P3Ixov_hf9z6oeq-J_W_a8XOo8p--bECWJKo,25139 +wandb/vendor/pygments/lexers/_tsql_builtins.py,sha256=opXLcAQOoAgcizztFXepEHBABOrGjSvDWU3TxVvJS3M,15484 +wandb/vendor/pygments/lexers/_vim_builtins.py,sha256=mIYAlwzf687UR8oPcY6y48H-BjTyPNDx1oHiRc5wByw,57090 +wandb/vendor/pygments/lexers/actionscript.py,sha256=HWGTyjPGho_kZVVTxemN0_5iyhK5wFgFQQ0MYVS0as8,11179 +wandb/vendor/pygments/lexers/agile.py,sha256=zB0BGCISgQB2b-3ch3QNRgV2O7jq7QPD5nvBbXA_K5U,900 +wandb/vendor/pygments/lexers/algebra.py,sha256=fhvIdLDS3oW0iMsDSBAzg8l9DuBXxfLRFC53xRIzvHU,7201 +wandb/vendor/pygments/lexers/ambient.py,sha256=M77HDk4dzs3Amlgwi_ogj1PV1Ch77PyEW6SU5AFtL4w,2557 +wandb/vendor/pygments/lexers/ampl.py,sha256=6AQASY--hmYXtgkzsthZymRM4bzQ_RQZZC5Wu4RJG-A,4120 +wandb/vendor/pygments/lexers/apl.py,sha256=Lpv2nI1bSC_VpmckdbpMiuxWx-WVb6FgFWoJ31q002w,3167 +wandb/vendor/pygments/lexers/archetype.py,sha256=IwyDTh-U673WHQQThuf2dBz0Fc-XlcAP-xAhtnR2DH4,11136 +wandb/vendor/pygments/lexers/asm.py,sha256=YysaSPQr0Ir79aM5C0eOB7g8-vJ6m2gWdbghsEElGBM,25261 +wandb/vendor/pygments/lexers/automation.py,sha256=g_laLS9LstvXvrvVQI01fAf0fyZ4-ZHFewdVLtXPXf0,19648 +wandb/vendor/pygments/lexers/basic.py,sha256=XfeI7Tk78lN7YMqS6bYdRB6CRPa2vxcm5PzA2EbILnc,20306 +wandb/vendor/pygments/lexers/bibtex.py,sha256=CcIdWMtCUtpHoqXU9JtGYKOmQJscO7AwofABCnEx_lk,4724 +wandb/vendor/pygments/lexers/business.py,sha256=iJbZjsF_CwJvkWmuDEAUgRhIPN3Vus_sp2m4V9AsKuo,27665 +wandb/vendor/pygments/lexers/c_cpp.py,sha256=Ty6LTWNG_ZR8eLNmcdBmJfUIJlkAyd033JqIH3Mfric,10523 +wandb/vendor/pygments/lexers/c_like.py,sha256=AoPSFV_TFPudAnvkV0wLlM00A3_JrddoTd5GRMyeHcY,24124 +wandb/vendor/pygments/lexers/capnproto.py,sha256=8pl0G3q7k5AJeoe6Yfr2eMs81V8KW1IlduzkRPaNb7A,2188 +wandb/vendor/pygments/lexers/chapel.py,sha256=dMPHVlkPsEhqOHQmuX8QlxJ48c1Pml8Q7RpOhc9lYUk,3511 +wandb/vendor/pygments/lexers/clean.py,sha256=IukUXRAQigyPLlD4K1tfZhQ8qH2l6gVn4hGFuHsz_vc,10403 +wandb/vendor/pygments/lexers/compiled.py,sha256=9d_XDV75Fi_EnrsVPAexfs8LRAysfixpZDNqVEhjGUU,1385 +wandb/vendor/pygments/lexers/configs.py,sha256=W1OdBJEwZWp7imQE1bC6a4sGIGoKw5LIbmYwau6u6Ds,28266 +wandb/vendor/pygments/lexers/console.py,sha256=7rwV7Jsci0nC74JDVzNlD5-PlRsfzZspHfYFSC8OKtM,4120 +wandb/vendor/pygments/lexers/crystal.py,sha256=h6M1BX-vWjCUtPQNXH1KqgqoxuB6geR3kCKp74sIb48,16845 +wandb/vendor/pygments/lexers/csound.py,sha256=t4bVgLEkNXEFZdfdfB43yWGXjJhT3aiKN9uLHNrTtZA,12544 +wandb/vendor/pygments/lexers/css.py,sha256=QZadHT6mYr14tMhZKDVRP3uu_AWSmGNIkn7KUr5H_0k,31513 +wandb/vendor/pygments/lexers/d.py,sha256=G-RV1UPAI8Q6mstQCMa4vNhwop0pG2NO1APHkOLdayA,9530 +wandb/vendor/pygments/lexers/dalvik.py,sha256=RDuGFuTqCG1PxhBn-I80iJxegrJpUDi_knxCKwN1cKQ,4420 +wandb/vendor/pygments/lexers/data.py,sha256=HOBr6Xw4QOYI6sD3vvtuSoYRdMaQYBnT0IcgpWUwTx0,18771 +wandb/vendor/pygments/lexers/diff.py,sha256=n7dxgD0_z0W2LH_zf55E1erBs5iBHFZPZ0bItXSeiLI,4873 +wandb/vendor/pygments/lexers/dotnet.py,sha256=IxNL30wmyw-Z_QRSUf9G9kbhz017BP5Pjqn2LEcfE9A,27668 +wandb/vendor/pygments/lexers/dsls.py,sha256=6v76UwDB7PngLM0Ye79mz_cXpg075RBgTzS9VXIsMQw,33336 +wandb/vendor/pygments/lexers/dylan.py,sha256=YJyoYcXD622vwYxqCNtyoHqi-L67CABzNfcg9ERt1Ic,10421 +wandb/vendor/pygments/lexers/ecl.py,sha256=bRD_m3B8npOLIyHjxhcWUCXeD9YCw7I6u5WsCUb7Kpc,5875 +wandb/vendor/pygments/lexers/eiffel.py,sha256=1-7weE5oflU_dzDVhaQFx5ildMbBuCZ3OFXJpJ-U78c,2482 +wandb/vendor/pygments/lexers/elm.py,sha256=3qhDIU0GFJ4YzuVDyvbHZ39dOyY60QFVpRvDdpDeYUw,2996 +wandb/vendor/pygments/lexers/erlang.py,sha256=Ja1SxnF-f48ort3oRb4R9aaHXbLJZIp0ItsgI8ITDJM,18936 +wandb/vendor/pygments/lexers/esoteric.py,sha256=wdtih2rpCV-N79Rf2laxzlqSBMYwzQgeCtBcutTbt1E,9490 +wandb/vendor/pygments/lexers/ezhil.py,sha256=o3qj60N-fyLGjcho1lrVW4x-CZ0Fu-rDe7tuqInD5oQ,3020 +wandb/vendor/pygments/lexers/factor.py,sha256=Trq7bM5thNo6BFZ2Tnit82FnWuUK70TL-atOKkLdHng,17864 +wandb/vendor/pygments/lexers/fantom.py,sha256=AGk3ewVsJ8gA9dU6N7iWGIlJLt5p61vRiJmVhyCj7Zg,9982 +wandb/vendor/pygments/lexers/felix.py,sha256=94Ffv8uhADGlom_cjKKvlE1QYpDnxRo0EdPGYhlxNTA,9408 +wandb/vendor/pygments/lexers/forth.py,sha256=uN-Sr5fi4SHnTluGzwmUsPgMFt470gSM212e7M5bH9Q,7144 +wandb/vendor/pygments/lexers/fortran.py,sha256=QRpUhXg0xnUu8EqsbEG6S33Sn8AWU326RiC8J-r2ZVw,9768 +wandb/vendor/pygments/lexers/foxpro.py,sha256=AWnHAryB1dUQkU4I48zoJFI8M_DsoIlEmvemDs1O4nM,26236 +wandb/vendor/pygments/lexers/functional.py,sha256=PPhynqxQZ602rCV-TxNldHRwhjMPfyHkGIOPx0BoVZo,698 +wandb/vendor/pygments/lexers/go.py,sha256=6IS3PKkqGG18OIlYqDGUp46S1jcfAfjhixNJe8Dd3gQ,3701 +wandb/vendor/pygments/lexers/grammar_notation.py,sha256=xyJi8t0X8SFElc3HTsmzF4_2mZs-qHW-ur9kZKt48D0,6328 +wandb/vendor/pygments/lexers/graph.py,sha256=-71ZtKUTq4LX4uUyRWFruA57Z_8lyOas1z1bWdq8eMs,2370 +wandb/vendor/pygments/lexers/graphics.py,sha256=6AoxbU5ybgg0_Mm48dZlspishe7PuK0pa_8bsPsDVfM,25836 +wandb/vendor/pygments/lexers/haskell.py,sha256=uOzfXPsn9mBs26GzEm-3qNNNJy6Oxc66lt0NVDVRR-M,31218 +wandb/vendor/pygments/lexers/haxe.py,sha256=QWR5lBwbdCMrJbFcUAs4SnP66zVV8O-DiT4c4x6XtBA,30953 +wandb/vendor/pygments/lexers/hdl.py,sha256=h3CYE2ShUOejE7w0d1eSHkGgCS4EXJodOVgjfACWYz8,18699 +wandb/vendor/pygments/lexers/hexdump.py,sha256=-_u6qAw7yH7b8_25tHNLiybD3r5-OaYYwtf9RsSxfeE,3507 +wandb/vendor/pygments/lexers/html.py,sha256=1f0HI3wZoGZL9PY6dLdmG8AytfT3oEosKHQp3DuDZmY,19269 +wandb/vendor/pygments/lexers/idl.py,sha256=gNT6hIlEMD-ZjLZ3ru6RH7Z-X5u7TKQ7lRP_9Sz1SSg,14984 +wandb/vendor/pygments/lexers/igor.py,sha256=PsDRDxMkwslMjd4GdZmAOXLrblsc2FANBMlNfv-XbVg,19994 +wandb/vendor/pygments/lexers/inferno.py,sha256=G4uU8YQD9EGvDNCc6Av6LWvyRB8unp5qv47PfLUek_8,3116 +wandb/vendor/pygments/lexers/installers.py,sha256=QEPP1YcZ38DvErs7xwpChvKQFh1I6fIp0V6MXxIwzeY,12866 +wandb/vendor/pygments/lexers/int_fiction.py,sha256=m8rYr5egxBSxZ9FKunV_Yl_EtpoRBz1j55J_dtKG9oo,55778 +wandb/vendor/pygments/lexers/iolang.py,sha256=1kvzEPcJZ2eyF7mu58NT9yyqZobOvx1MlbUxA98bLJs,1904 +wandb/vendor/pygments/lexers/j.py,sha256=e6oqJQslgSl6q3hfEuTl0mtFnqCj4G29SwcMnTeBDBc,4525 +wandb/vendor/pygments/lexers/javascript.py,sha256=79c9e2wn7HiJ9S4WvRQ0qymMqj-YV7CS308_pMRNirk,60134 +wandb/vendor/pygments/lexers/julia.py,sha256=vXU5r_p6ko-I_fKITqiFmMn0rpw0NWujKVGGrndkfOI,14093 +wandb/vendor/pygments/lexers/jvm.py,sha256=9fjCUGFGApGNMDsrCWzaEiDA_CcoZPDaYAvBHFAh524,66792 +wandb/vendor/pygments/lexers/lisp.py,sha256=xeF_wQGdm-vkJ2j1JQd9mipAAtjwY3giOEH2cW2j0jk,140673 +wandb/vendor/pygments/lexers/make.py,sha256=jGkYUD5PD4vG7gC6qExOAp8ZE4KoB0jLMcTF5NzZGQs,7332 +wandb/vendor/pygments/lexers/markup.py,sha256=KQsXc5K_rn7G7bATKt81yURJjHHi5kCLokJXXom997I,20452 +wandb/vendor/pygments/lexers/math.py,sha256=TaE1dzOfu6ukxMFAInZI_Ua105LDnxx86Ufk4YdnvfA,700 +wandb/vendor/pygments/lexers/matlab.py,sha256=GUys_wezfz7n_F9U5l2HZauxlsSxrRh0bkgIjfhZ7ro,29146 +wandb/vendor/pygments/lexers/ml.py,sha256=GDreW4Pmgqt8BlfbeRG43e3wS3wSm_A7cHPKGeGY9hQ,27891 +wandb/vendor/pygments/lexers/modeling.py,sha256=4O9hB4wAhjD2HFYa74HsLf9QK4E8kq7k8c5M7WuM1f4,12833 +wandb/vendor/pygments/lexers/modula2.py,sha256=mNbhlG9lNZRXP9kzx9diJj7l6hiPQVqmOzrfJ53GarU,52561 +wandb/vendor/pygments/lexers/monte.py,sha256=MNswWqletPzSIg6TcECb-Dcq1bv-eSPhYLsbc-vnJzM,6307 +wandb/vendor/pygments/lexers/ncl.py,sha256=cvnCcYpC0jpHBrwtNXZhY5HheY3UMThsYbgscHGvZLM,63986 +wandb/vendor/pygments/lexers/nimrod.py,sha256=OizSj9kHvtFEu0OPXuBrXZCf_ZBMnR4hm3nMbjw50hQ,5174 +wandb/vendor/pygments/lexers/nit.py,sha256=1SJ45GOd9zQKuWhPuVy-KhLkXQn6V-7ESvjJJ7U9Vpo,2743 +wandb/vendor/pygments/lexers/nix.py,sha256=dWzLp5QxzLmskDflyMUGidGNau9Vtk8ViK5c6B2O4kI,4031 +wandb/vendor/pygments/lexers/oberon.py,sha256=CbqkEOdqxvWXfez5FiGeCE-f-Vlt6tu9kqPFEVVXAQc,3733 +wandb/vendor/pygments/lexers/objective.py,sha256=qCPLLfU3hl-CIOJWAZdQYjeIl1Ox1igZaPRGKowKYbs,22764 +wandb/vendor/pygments/lexers/ooc.py,sha256=_lnOynAR0vHli7OKWJ4yZs9-hyPZE5DGKwkdkP6SCuM,2999 +wandb/vendor/pygments/lexers/other.py,sha256=Utlo5esm3DetK9PSOueHu5mEjR25dIN3T_g2-u9cmeA,1768 +wandb/vendor/pygments/lexers/parasail.py,sha256=Egm3PcuCBjDgwUvvI0-t3oXMz4PPRY0dER3orrrlnfc,2737 +wandb/vendor/pygments/lexers/parsers.py,sha256=S93llPIzcqL0VU2C_SzFa-pykNcFE37Kvy9_7fNmdg4,27582 +wandb/vendor/pygments/lexers/pascal.py,sha256=tA4Na6dzTz8nd9-Q_tcBFVDo161qfG9bR4xIIIB8FY0,32646 +wandb/vendor/pygments/lexers/pawn.py,sha256=eJJfXLHPYEPflh3fKgyq4PD5b52pcqjBnAGDicqHK9w,8094 +wandb/vendor/pygments/lexers/perl.py,sha256=-k_lftMhedsEIQwmvEZyy8Xbtlgj28_fic6HhN_ZYGI,32012 +wandb/vendor/pygments/lexers/php.py,sha256=7tgZQvYAnprFRQfAUxOlXgNkeUyOYsvIkM5oW0NSzOU,10730 +wandb/vendor/pygments/lexers/praat.py,sha256=GpHWS1IyqpvFCbZ7JWXSyxgBl8KAQED8IonkJM-Ml28,12556 +wandb/vendor/pygments/lexers/prolog.py,sha256=GWAUHvP3eyROfr3ry8g_7OJSNpD3vwfAFTJsrqIL7cQ,12066 +wandb/vendor/pygments/lexers/python.py,sha256=pn_V-1XyAqoYD4x8Pclk4eP8nkYvacpObY06xwDYSq8,42384 +wandb/vendor/pygments/lexers/qvt.py,sha256=LnLMM2jTrc5k4kInraQmmui1mgf76Wx5Ln2CfBFqj4I,6111 +wandb/vendor/pygments/lexers/r.py,sha256=6aUQ8T4qn6qIWuR-D9P_r05CEcP5SJ8wMadzUVrgJ4k,23755 +wandb/vendor/pygments/lexers/rdf.py,sha256=qbH7suOIdGY435x721iWhJ9QXT3MYPo874Jss8f2WCY,9398 +wandb/vendor/pygments/lexers/rebol.py,sha256=91kF9ueomN_2-Za8u1nIsuYN6uTQ3T1UbZk3IfRoiD8,18617 +wandb/vendor/pygments/lexers/resource.py,sha256=uS23PmW5COZfyyCte9s6xLhqZS2uhfH5P3G41QGp5U0,2933 +wandb/vendor/pygments/lexers/rnc.py,sha256=QvwLWh7IG9LYp9hmD7dI2MM4ikNaeqSQf26LmCBPVLA,1990 +wandb/vendor/pygments/lexers/roboconf.py,sha256=2__rRqffgFjrqyFFHHjibSg1qHCm2_lIT7lOGu63DNI,2070 +wandb/vendor/pygments/lexers/robotframework.py,sha256=qKKxIoTAMDnr_iDEnFsF9sjH63uhr1hDQUMStJydMYo,18744 +wandb/vendor/pygments/lexers/ruby.py,sha256=pukJJddNWR7jC4Uxc_qnOrcFXI5am3d0A8ApiZfeAnQ,22141 +wandb/vendor/pygments/lexers/rust.py,sha256=q18g2pHP_srVa8ANoyiIoMmXB4XkYI6Xp57rC-V9xmU,7695 +wandb/vendor/pygments/lexers/sas.py,sha256=oKP_7bIyKUnFS8kDGKsWxHqKhkRBV4emle28pX3MUzE,9449 +wandb/vendor/pygments/lexers/scripting.py,sha256=1_gD_-cQHrDF-uDEmBlelrUSWV5cQoz79EZ_3RpAh48,67761 +wandb/vendor/pygments/lexers/shell.py,sha256=H1byqbwQefCUaSDra6EabmI2o15zfpeusc73p1mBDQw,31426 +wandb/vendor/pygments/lexers/smalltalk.py,sha256=QJHVLNsCWr8zWHoF9C9Lev7LwefFYgI7L4mtY-LWJRU,7215 +wandb/vendor/pygments/lexers/smv.py,sha256=HnLzDk-zFDXhaHXxFI-ZINv6pW6stkk0IfxVHgStOLY,2802 +wandb/vendor/pygments/lexers/snobol.py,sha256=glC_g_14iKbHWaYCdkMibhGBNdPbzOgl7MVlJbpZMUI,2756 +wandb/vendor/pygments/lexers/special.py,sha256=Q1qXU0E8ecPXL_rMnzksLNbcisjOexxjXmo9j5ODBmM,3151 +wandb/vendor/pygments/lexers/sql.py,sha256=eMnkUuSpfII72c_lCcxOSWkuAuZH7qN6GkwM1xllMpA,29445 +wandb/vendor/pygments/lexers/stata.py,sha256=XI46JTQw-9YH5TkDB35FfFy8lJVaxr7qbdnOWbFhG3s,3627 +wandb/vendor/pygments/lexers/supercollider.py,sha256=t5LHZNcKwtgxnnCJnHCSYGjHBGXZzNR_TLF_pPOMrh4,3516 +wandb/vendor/pygments/lexers/tcl.py,sha256=ulsFqa6OwCKUoJHDvqBLdVHZL31EA5BDI8bf3iB703E,5398 +wandb/vendor/pygments/lexers/templates.py,sha256=V4ColLZh2NTkxI_zr4J7JnpRAafVNEezy3GWjq8knXs,73457 +wandb/vendor/pygments/lexers/testing.py,sha256=lup3FuiDthufXo3ujm6HSV4QKBscYoTpNe9K5iHCZ2g,10751 +wandb/vendor/pygments/lexers/text.py,sha256=7nKWCivruly7wyquaug3-IF8v2fUdXUVSYXHMVUlkdY,977 +wandb/vendor/pygments/lexers/textedit.py,sha256=1kH4uCnq4j80c0KGSMRJgzRgglm_5ckoiQVZX21qXvc,6057 +wandb/vendor/pygments/lexers/textfmts.py,sha256=sOQ4vDo5P1SpY_obS7N5oObolY501Tk2va69iDQyWWM,10852 +wandb/vendor/pygments/lexers/theorem.py,sha256=HmW981GDEA0TM8H7siEv2lszH-U9S7hcExRyom2eX2w,19034 +wandb/vendor/pygments/lexers/trafficscript.py,sha256=Xyfa407k2_rzvlKuExUcB5h6bC89WN6eQx6K3o3uV3o,1546 +wandb/vendor/pygments/lexers/typoscript.py,sha256=c6gOzNkvqgixbRKeQO7vXSrEPf6K4pnrFLFQ9SzusA8,8392 +wandb/vendor/pygments/lexers/urbi.py,sha256=p4gxSltIKKMFL8wJuLQ_cC40zSAC8bqc7aXZT0s5M7Y,5750 +wandb/vendor/pygments/lexers/varnish.py,sha256=5aSrhCfYFRbZsvKtQuKzJjHGCosabDGua3_LCG-JLlA,7265 +wandb/vendor/pygments/lexers/verification.py,sha256=Pb3upMUI03UFFsYAmqEzB2VK3N-ppMs1KYExE_tS1yE,3705 +wandb/vendor/pygments/lexers/web.py,sha256=5RB4JP962BUzuMIHon_H3tRgO458FAROJ91S8uk-gno,918 +wandb/vendor/pygments/lexers/webmisc.py,sha256=-6FzwUll5VU4oN6rSutfQmqPqD_OvWZ7kZWO1H3WMXo,39891 +wandb/vendor/pygments/lexers/whiley.py,sha256=YNCb-hXy8rPPVH9ea4q8QAXqncXNPHtgqAqAKPLfHfM,4012 +wandb/vendor/pygments/lexers/x10.py,sha256=FyCneMc5r_PRL7a0iaAsvgfyrxk2dYSzE9WJa1O4ZBw,1965 +wandb/vendor/pygments/modeline.py,sha256=83v6_3Zo9RHEc0K8aepm1Sc8Iou7mRcwogl9MLUciiI,1010 +wandb/vendor/pygments/plugin.py,sha256=NFKzfoPXMA8x6yXqMVbM0k1YKHHeQIwnDEvVlxd-MEQ,1721 +wandb/vendor/pygments/regexopt.py,sha256=t8y9hRPYQKJysZQhWd_t15aqRAGJSk0ABynKyjmogIQ,3094 +wandb/vendor/pygments/scanner.py,sha256=Mf-ya9riFJ85N3AiGKvBUsAsjSEfTd0Bqw8KMxhj2ew,3123 +wandb/vendor/pygments/sphinxext.py,sha256=1nig8VbRlfIDZd1fhOKQmX2KcxyQoexwsOdX3DSGE1I,4655 +wandb/vendor/pygments/style.py,sha256=R-iSqMPqnMtciPTgPMvqNjUkWtg7CCQTpyyCBSAOv_g,4807 +wandb/vendor/pygments/styles/__init__.py,sha256=bMJA5A-As-KqVlgOVa1ryoivG-fI20nE5mlEvneFqT0,2553 +wandb/vendor/pygments/styles/__pycache__/__init__.cpython-310.pyc,, +wandb/vendor/pygments/styles/__pycache__/abap.cpython-310.pyc,, +wandb/vendor/pygments/styles/__pycache__/algol.cpython-310.pyc,, +wandb/vendor/pygments/styles/__pycache__/algol_nu.cpython-310.pyc,, +wandb/vendor/pygments/styles/__pycache__/arduino.cpython-310.pyc,, +wandb/vendor/pygments/styles/__pycache__/autumn.cpython-310.pyc,, +wandb/vendor/pygments/styles/__pycache__/borland.cpython-310.pyc,, +wandb/vendor/pygments/styles/__pycache__/bw.cpython-310.pyc,, +wandb/vendor/pygments/styles/__pycache__/colorful.cpython-310.pyc,, +wandb/vendor/pygments/styles/__pycache__/default.cpython-310.pyc,, +wandb/vendor/pygments/styles/__pycache__/emacs.cpython-310.pyc,, +wandb/vendor/pygments/styles/__pycache__/friendly.cpython-310.pyc,, +wandb/vendor/pygments/styles/__pycache__/fruity.cpython-310.pyc,, +wandb/vendor/pygments/styles/__pycache__/igor.cpython-310.pyc,, +wandb/vendor/pygments/styles/__pycache__/lovelace.cpython-310.pyc,, +wandb/vendor/pygments/styles/__pycache__/manni.cpython-310.pyc,, +wandb/vendor/pygments/styles/__pycache__/monokai.cpython-310.pyc,, +wandb/vendor/pygments/styles/__pycache__/murphy.cpython-310.pyc,, +wandb/vendor/pygments/styles/__pycache__/native.cpython-310.pyc,, +wandb/vendor/pygments/styles/__pycache__/paraiso_dark.cpython-310.pyc,, +wandb/vendor/pygments/styles/__pycache__/paraiso_light.cpython-310.pyc,, +wandb/vendor/pygments/styles/__pycache__/pastie.cpython-310.pyc,, +wandb/vendor/pygments/styles/__pycache__/perldoc.cpython-310.pyc,, +wandb/vendor/pygments/styles/__pycache__/rainbow_dash.cpython-310.pyc,, +wandb/vendor/pygments/styles/__pycache__/rrt.cpython-310.pyc,, +wandb/vendor/pygments/styles/__pycache__/sas.cpython-310.pyc,, +wandb/vendor/pygments/styles/__pycache__/stata.cpython-310.pyc,, +wandb/vendor/pygments/styles/__pycache__/tango.cpython-310.pyc,, +wandb/vendor/pygments/styles/__pycache__/trac.cpython-310.pyc,, +wandb/vendor/pygments/styles/__pycache__/vim.cpython-310.pyc,, +wandb/vendor/pygments/styles/__pycache__/vs.cpython-310.pyc,, +wandb/vendor/pygments/styles/__pycache__/xcode.cpython-310.pyc,, +wandb/vendor/pygments/styles/abap.py,sha256=GYW80_C20vlhROQCE9RIn8oOy0uFO5VeJJMm7FXCEz8,751 +wandb/vendor/pygments/styles/algol.py,sha256=mE09x_hUp-ferskH8OLAWO115u9GQQYMR70Y-2zS6Y0,2263 +wandb/vendor/pygments/styles/algol_nu.py,sha256=psY0F47Bl5LThIeih15ghZvkalijyq6jrUnx84n_TFg,2278 +wandb/vendor/pygments/styles/arduino.py,sha256=UTcdXehOhcXWda9NlYeW3piKZUbEpQQkx0ARZCC7Ih4,4492 +wandb/vendor/pygments/styles/autumn.py,sha256=FpFEPsPBnGugtBp4M-3FqKPbKlGomYAbq9HSNiYh3DU,2144 +wandb/vendor/pygments/styles/borland.py,sha256=QhOMFrDL3PAwEJZkuEt9qzPN8T8cVooRG5vtLROgkRc,1562 +wandb/vendor/pygments/styles/bw.py,sha256=vBQMjQhou4csJMHTIE5AJCeLESFaE5UqgSPN2ZAli6o,1355 +wandb/vendor/pygments/styles/colorful.py,sha256=SWzWtEmeEoZ7DNIh6XQeZxDz6bIOlgBuwGFePB2PUmc,2778 +wandb/vendor/pygments/styles/default.py,sha256=UUN6VGAOB12b_R2ky-6cHfdaXE34xJaNtaHwsBzl1I8,2532 +wandb/vendor/pygments/styles/emacs.py,sha256=CndsC1mEd6GGVCFA1uKmb5rMqjMiMCqJ1uBE2fgKCQA,2486 +wandb/vendor/pygments/styles/friendly.py,sha256=0c5ibD9ldewtsKzgjHSV2-FN_iRdDa_bUkVWi8ZnfdE,2515 +wandb/vendor/pygments/styles/fruity.py,sha256=cSYED092upFc4kekb2m-f34Wh4BWxXyEb8N6rYLZOas,1298 +wandb/vendor/pygments/styles/igor.py,sha256=MZNAVwgWh5FU2bRbKaXo5uV9_h2IH3gh4Cm3MspnFIc,739 +wandb/vendor/pygments/styles/lovelace.py,sha256=u0fQW4OUZ37w9Z1A0pzsMYfJX68kxMrp0CbjWJg46pE,3173 +wandb/vendor/pygments/styles/manni.py,sha256=2CC4G2o6hUYfCceP4O9bpNBgNONW7HCJ--L3khD7jhc,2374 +wandb/vendor/pygments/styles/monokai.py,sha256=QgSUuhv6DDz7LhyfL9lW5VMIRJIj0ID_GqTJupunWgs,5080 +wandb/vendor/pygments/styles/murphy.py,sha256=m2bWPIFW8gnR2miA6FF2kYDwXT2sltSJ9MMcA1AEnqg,2751 +wandb/vendor/pygments/styles/native.py,sha256=V_mDvPG5eUm8V2XSCYsKsqkp0XfxK8gn80wryiUmmIU,1938 +wandb/vendor/pygments/styles/paraiso_dark.py,sha256=YxdADs3KBND4ZXfYqkQBXGxIs2y4VxjaiKw8f3AdoFo,5641 +wandb/vendor/pygments/styles/paraiso_light.py,sha256=-HHuYHnJBX7Yehza875DjU4ly95ATC1sh6o_RuqbeuI,5645 +wandb/vendor/pygments/styles/pastie.py,sha256=6ku_vX2aFP7N9iAsT8a-1lzf9L1DR_j0SE37HVbFoSw,2473 +wandb/vendor/pygments/styles/perldoc.py,sha256=CJq6FzNG22C3aru3QO2_l6ebksqnAQhSBLeiYYoJjhw,2175 +wandb/vendor/pygments/styles/rainbow_dash.py,sha256=mPI5Yfl-sRW9Aig_xvs63i3sjWqO5fpihBbiaLozyYM,2480 +wandb/vendor/pygments/styles/rrt.py,sha256=-UUYhzna_sPcmwUXEtnDoAaUD8cnomk8grWfKOsmJ-M,852 +wandb/vendor/pygments/styles/sas.py,sha256=yKgZ8AiADLXtVZLZ0JtxlB6BGJAVkcX0DyG8g-R8nSE,1441 +wandb/vendor/pygments/styles/stata.py,sha256=PH8ckY6Q68QQXjv8wDK_Z-DVbyiWfy5vRLd4HUYd02k,1249 +wandb/vendor/pygments/styles/tango.py,sha256=Bsn6unVhwiOJ8dc1-csQYHanRjIZ7JOxQndq6Dc-BxE,7096 +wandb/vendor/pygments/styles/trac.py,sha256=XlcVcvSqIfVeqSsQo34V5B0VLi_FQwlpfaE0Zv7LE0M,1933 +wandb/vendor/pygments/styles/vim.py,sha256=hgv2HvW3kriTmj0HE7TdzeJhJhxvblqEG-S3ELiZEX4,1976 +wandb/vendor/pygments/styles/vs.py,sha256=X7jUKNoKNnNE6ewe9vsGgTeSxK4a7x8oBbaA6LNzpGQ,1073 +wandb/vendor/pygments/styles/xcode.py,sha256=gWl7xboxgvDzARO8-VmBfUX0GOnWWbGU9Su_TAIyEFQ,1501 +wandb/vendor/pygments/token.py,sha256=qowb6oBuyzaRfTyUe7F-LeMcNwRNLEiwjZl9o3ggsxc,6167 +wandb/vendor/pygments/unistring.py,sha256=rkFlgo6QzdUFWQ-uiOaz6MFfQg1f0-hH_B5F3PFXwXA,51150 +wandb/vendor/pygments/util.py,sha256=xO8RGLd_-7DoXCL799lWYgyub4whP2pSmnIsx1-wMyA,11900 +wandb/vendor/watchdog_0_9_0/wandb_watchdog/__init__.py,sha256=-eu2NcfsKwZHudYM1DwZob-gagx9DhVVvJOvmIGWo8o,684 +wandb/vendor/watchdog_0_9_0/wandb_watchdog/__pycache__/__init__.cpython-310.pyc,, +wandb/vendor/watchdog_0_9_0/wandb_watchdog/__pycache__/events.cpython-310.pyc,, +wandb/vendor/watchdog_0_9_0/wandb_watchdog/__pycache__/patterns.cpython-310.pyc,, +wandb/vendor/watchdog_0_9_0/wandb_watchdog/__pycache__/version.cpython-310.pyc,, +wandb/vendor/watchdog_0_9_0/wandb_watchdog/__pycache__/watchmedo.cpython-310.pyc,, +wandb/vendor/watchdog_0_9_0/wandb_watchdog/events.py,sha256=1ASc8KEcDJr9zL47lLmV2oz8qgepk6NvaZgYKyRLUaE,18623 +wandb/vendor/watchdog_0_9_0/wandb_watchdog/observers/__init__.py,sha256=tu15U0Qqv_306QJNVbjkxDuiTXJ0qV11uVboBBwiDFM,3864 +wandb/vendor/watchdog_0_9_0/wandb_watchdog/observers/__pycache__/__init__.cpython-310.pyc,, +wandb/vendor/watchdog_0_9_0/wandb_watchdog/observers/__pycache__/api.cpython-310.pyc,, +wandb/vendor/watchdog_0_9_0/wandb_watchdog/observers/__pycache__/fsevents.cpython-310.pyc,, +wandb/vendor/watchdog_0_9_0/wandb_watchdog/observers/__pycache__/fsevents2.cpython-310.pyc,, +wandb/vendor/watchdog_0_9_0/wandb_watchdog/observers/__pycache__/inotify.cpython-310.pyc,, +wandb/vendor/watchdog_0_9_0/wandb_watchdog/observers/__pycache__/inotify_buffer.cpython-310.pyc,, +wandb/vendor/watchdog_0_9_0/wandb_watchdog/observers/__pycache__/inotify_c.cpython-310.pyc,, +wandb/vendor/watchdog_0_9_0/wandb_watchdog/observers/__pycache__/kqueue.cpython-310.pyc,, +wandb/vendor/watchdog_0_9_0/wandb_watchdog/observers/__pycache__/polling.cpython-310.pyc,, +wandb/vendor/watchdog_0_9_0/wandb_watchdog/observers/__pycache__/read_directory_changes.cpython-310.pyc,, +wandb/vendor/watchdog_0_9_0/wandb_watchdog/observers/__pycache__/winapi.cpython-310.pyc,, +wandb/vendor/watchdog_0_9_0/wandb_watchdog/observers/api.py,sha256=cS0sFG4bwV6ZgdpDasBIqLjvure7herE5TsiBP4sMAo,11738 +wandb/vendor/watchdog_0_9_0/wandb_watchdog/observers/fsevents.py,sha256=EbY5I7F7jCkHovbVq2w2kUtHBVeUIL4t4dZPzZFevFI,6546 +wandb/vendor/watchdog_0_9_0/wandb_watchdog/observers/fsevents2.py,sha256=yumICK41X4-r7AeSHF3MzzT9BXnGRkRhLzOT53oM9fY,9043 +wandb/vendor/watchdog_0_9_0/wandb_watchdog/observers/inotify.py,sha256=n8kgJ1zC_96SLEw8v0ZqHvOMRUg558zShwvIgdgLdJQ,8546 +wandb/vendor/watchdog_0_9_0/wandb_watchdog/observers/inotify_buffer.py,sha256=KT-1Unpru9UOMrKVgBt-KcI67dffMZNQpBmU27-uNgg,3055 +wandb/vendor/watchdog_0_9_0/wandb_watchdog/observers/inotify_c.py,sha256=IVH9UuEyLnYYiMXcLzpF0udT8jxAGSNbdCM38ttmf7M,18911 +wandb/vendor/watchdog_0_9_0/wandb_watchdog/observers/kqueue.py,sha256=vND2sY0FHxbliFacyaaKAoFg0XIfOPW4azk0UshVBVs,25419 +wandb/vendor/watchdog_0_9_0/wandb_watchdog/observers/polling.py,sha256=qoWOKJ4g_FFbrz_kzMEHAU5F7piWsQr-TsJzHA2tk0g,4875 +wandb/vendor/watchdog_0_9_0/wandb_watchdog/observers/read_directory_changes.py,sha256=qDppFQyKrxC9eZy8DRWVbalIBLjYAN10fwp1OSrzugY,5262 +wandb/vendor/watchdog_0_9_0/wandb_watchdog/observers/winapi.py,sha256=dsnl8btBrosGICw-EW_aHr-B0c5hgsS0P7O6JAjAVOw,11685 +wandb/vendor/watchdog_0_9_0/wandb_watchdog/patterns.py,sha256=xWatHsYukVTIwVOw8O4BB0-_-ajx2z2vgGCA_NUfyss,10698 +wandb/vendor/watchdog_0_9_0/wandb_watchdog/tricks/__init__.py,sha256=b9I8ob_xvIQXqAVOx6Ujvhac2Es5mj4Kcp9m5gB1sd8,5198 +wandb/vendor/watchdog_0_9_0/wandb_watchdog/tricks/__pycache__/__init__.cpython-310.pyc,, +wandb/vendor/watchdog_0_9_0/wandb_watchdog/utils/__init__.py,sha256=GK7wGeS6z8UkG5BDUB-sHuLu8lFt7h77UdHFe5QBZmY,4472 +wandb/vendor/watchdog_0_9_0/wandb_watchdog/utils/__pycache__/__init__.cpython-310.pyc,, +wandb/vendor/watchdog_0_9_0/wandb_watchdog/utils/__pycache__/bricks.cpython-310.pyc,, +wandb/vendor/watchdog_0_9_0/wandb_watchdog/utils/__pycache__/compat.cpython-310.pyc,, +wandb/vendor/watchdog_0_9_0/wandb_watchdog/utils/__pycache__/decorators.cpython-310.pyc,, +wandb/vendor/watchdog_0_9_0/wandb_watchdog/utils/__pycache__/delayed_queue.cpython-310.pyc,, +wandb/vendor/watchdog_0_9_0/wandb_watchdog/utils/__pycache__/dirsnapshot.cpython-310.pyc,, +wandb/vendor/watchdog_0_9_0/wandb_watchdog/utils/__pycache__/echo.cpython-310.pyc,, +wandb/vendor/watchdog_0_9_0/wandb_watchdog/utils/__pycache__/event_backport.cpython-310.pyc,, +wandb/vendor/watchdog_0_9_0/wandb_watchdog/utils/__pycache__/importlib2.cpython-310.pyc,, +wandb/vendor/watchdog_0_9_0/wandb_watchdog/utils/__pycache__/platform.cpython-310.pyc,, +wandb/vendor/watchdog_0_9_0/wandb_watchdog/utils/__pycache__/unicode_paths.cpython-310.pyc,, +wandb/vendor/watchdog_0_9_0/wandb_watchdog/utils/__pycache__/win32stat.cpython-310.pyc,, +wandb/vendor/watchdog_0_9_0/wandb_watchdog/utils/bricks.py,sha256=0iMa_IT_lX2-aY_GR0Yf2d925kFCajvnz-kXdV5d1vc,7548 +wandb/vendor/watchdog_0_9_0/wandb_watchdog/utils/compat.py,sha256=ezeJrD0LTvg2arGGWhQ0oq4CB31Hqi2FvJoJbDgX7No,860 +wandb/vendor/watchdog_0_9_0/wandb_watchdog/utils/decorators.py,sha256=MkJQIlK9L3FD62_mzr-zlgJMQG6bey8C06xUxWkKucQ,4451 +wandb/vendor/watchdog_0_9_0/wandb_watchdog/utils/delayed_queue.py,sha256=Q0Eylpvc-9wuKmvVcgk1dvm8GKJvif7zdLdk58P17aI,2926 +wandb/vendor/watchdog_0_9_0/wandb_watchdog/utils/dirsnapshot.py,sha256=l4I52zaCbXS3wt1dxYHT2JhaH8UUuQtrcyvULlBFP3o,9319 +wandb/vendor/watchdog_0_9_0/wandb_watchdog/utils/echo.py,sha256=frPR2B1ZOvNue66V1WfzDjjX-fnv5_xYw36hQT6tuU4,5305 +wandb/vendor/watchdog_0_9_0/wandb_watchdog/utils/event_backport.py,sha256=vnOWu6nNdSJJo69VSxeCfnfsXOo4CwTQDlMr6jAa6eI,902 +wandb/vendor/watchdog_0_9_0/wandb_watchdog/utils/importlib2.py,sha256=cJIaJ2EQsoA8eWZ3d8hvgXq3OUxoRDdD5jo9XbUMRMI,1840 +wandb/vendor/watchdog_0_9_0/wandb_watchdog/utils/platform.py,sha256=UORYTNVcUSE2NpFcq9UVLIS-tsS0TS_Qw8akhKxn2eY,1506 +wandb/vendor/watchdog_0_9_0/wandb_watchdog/utils/unicode_paths.py,sha256=UWX8DB97ygkEeSxWQUYCHR4MahNilux7vl5TCTQtPPk,2190 +wandb/vendor/watchdog_0_9_0/wandb_watchdog/utils/win32stat.py,sha256=ZOevOTbSo8NRiIxkuBVGaG4yigWnPoO0goxAi-jsBkM,3828 +wandb/vendor/watchdog_0_9_0/wandb_watchdog/version.py,sha256=GAUJcx7KVSbKa25fjKipygYc9zPtEPDDDcwlUpKfgmI,974 +wandb/vendor/watchdog_0_9_0/wandb_watchdog/watchmedo.py,sha256=wiAGdrwO3F3bOxExzkzve0cSPEUskuPo4VR1u41qRU8,17458 +wandb/wandb_agent.py,sha256=eqSOWS33hdc6s1Hyhi6jfLpWN87oeHad9Eu_44pb7yA,25326 +wandb/wandb_controller.py,sha256=RPvCa3xjzKphoh9KE4td7GuHrJ9HdK-bPXr5BHbYnsM,24646 +wandb/wandb_run.py,sha256=RRjZweHEMpfTyQghzOrSZdmViIItT9wLJYzcZ4nlvjk,128 diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb-0.25.0.dist-info/REQUESTED b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb-0.25.0.dist-info/REQUESTED new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb-0.25.0.dist-info/WHEEL b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb-0.25.0.dist-info/WHEEL new file mode 100644 index 0000000000000000000000000000000000000000..9ea5dc082d6cd2c21aad3dcd85c64c7a609adc83 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb-0.25.0.dist-info/WHEEL @@ -0,0 +1,5 @@ +Wheel-Version: 1.0 +Generator: hatchling 1.27.0 +Root-Is-Purelib: true +Tag: py3-none-manylinux_2_28_x86_64 + diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb-0.25.0.dist-info/entry_points.txt b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb-0.25.0.dist-info/entry_points.txt new file mode 100644 index 0000000000000000000000000000000000000000..bd9806f6b8b58b8ad6081627328a817c45942064 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb-0.25.0.dist-info/entry_points.txt @@ -0,0 +1,3 @@ +[console_scripts] +wandb = wandb.cli.cli:cli +wb = wandb.cli.cli:cli diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb-0.25.0.dist-info/licenses/LICENSE b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb-0.25.0.dist-info/licenses/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..1f4e645404cd4ae9f131e45091c1cf9db97af225 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb-0.25.0.dist-info/licenses/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2021 Weights and Biases, Inc. + +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/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/diff.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/diff.py new file mode 100644 index 0000000000000000000000000000000000000000..f7019440290b694e69787f2fa909cb9fd6add0b0 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/diff.py @@ -0,0 +1,165 @@ +# -*- coding: utf-8 -*- +""" + pygments.lexers.diff + ~~~~~~~~~~~~~~~~~~~~ + + Lexers for diff/patch formats. + + :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS. + :license: BSD, see LICENSE for details. +""" + +import re + +from pygments.lexer import RegexLexer, include, bygroups +from pygments.token import Text, Comment, Operator, Keyword, Name, Generic, \ + Literal + +__all__ = ['DiffLexer', 'DarcsPatchLexer', 'WDiffLexer'] + + +class DiffLexer(RegexLexer): + """ + Lexer for unified or context-style diffs or patches. + """ + + name = 'Diff' + aliases = ['diff', 'udiff'] + filenames = ['*.diff', '*.patch'] + mimetypes = ['text/x-diff', 'text/x-patch'] + + tokens = { + 'root': [ + (r' .*\n', Text), + (r'\+.*\n', Generic.Inserted), + (r'-.*\n', Generic.Deleted), + (r'!.*\n', Generic.Strong), + (r'@.*\n', Generic.Subheading), + (r'([Ii]ndex|diff).*\n', Generic.Heading), + (r'=.*\n', Generic.Heading), + (r'.*\n', Text), + ] + } + + def analyse_text(text): + if text[:7] == 'Index: ': + return True + if text[:5] == 'diff ': + return True + if text[:4] == '--- ': + return 0.9 + + +class DarcsPatchLexer(RegexLexer): + """ + DarcsPatchLexer is a lexer for the various versions of the darcs patch + format. Examples of this format are derived by commands such as + ``darcs annotate --patch`` and ``darcs send``. + + .. versionadded:: 0.10 + """ + + name = 'Darcs Patch' + aliases = ['dpatch'] + filenames = ['*.dpatch', '*.darcspatch'] + + DPATCH_KEYWORDS = ('hunk', 'addfile', 'adddir', 'rmfile', 'rmdir', 'move', + 'replace') + + tokens = { + 'root': [ + (r'<', Operator), + (r'>', Operator), + (r'\{', Operator), + (r'\}', Operator), + (r'(\[)((?:TAG )?)(.*)(\n)(.*)(\*\*)(\d+)(\s?)(\])', + bygroups(Operator, Keyword, Name, Text, Name, Operator, + Literal.Date, Text, Operator)), + (r'(\[)((?:TAG )?)(.*)(\n)(.*)(\*\*)(\d+)(\s?)', + bygroups(Operator, Keyword, Name, Text, Name, Operator, + Literal.Date, Text), 'comment'), + (r'New patches:', Generic.Heading), + (r'Context:', Generic.Heading), + (r'Patch bundle hash:', Generic.Heading), + (r'(\s*)(%s)(.*\n)' % '|'.join(DPATCH_KEYWORDS), + bygroups(Text, Keyword, Text)), + (r'\+', Generic.Inserted, "insert"), + (r'-', Generic.Deleted, "delete"), + (r'.*\n', Text), + ], + 'comment': [ + (r'[^\]].*\n', Comment), + (r'\]', Operator, "#pop"), + ], + 'specialText': [ # darcs add [_CODE_] special operators for clarity + (r'\n', Text, "#pop"), # line-based + (r'\[_[^_]*_]', Operator), + ], + 'insert': [ + include('specialText'), + (r'\[', Generic.Inserted), + (r'[^\n\[]+', Generic.Inserted), + ], + 'delete': [ + include('specialText'), + (r'\[', Generic.Deleted), + (r'[^\n\[]+', Generic.Deleted), + ], + } + + +class WDiffLexer(RegexLexer): + """ + A `wdiff `_ lexer. + + Note that: + + * only to normal output (without option like -l). + * if target files of wdiff contain "[-", "-]", "{+", "+}", + especially they are unbalanced, this lexer will get confusing. + + .. versionadded:: 2.2 + """ + + name = 'WDiff' + aliases = ['wdiff'] + filenames = ['*.wdiff'] + mimetypes = [] + + flags = re.MULTILINE | re.DOTALL + + # We can only assume "[-" after "[-" before "-]" is `nested`, + # for instance wdiff to wdiff outputs. We have no way to + # distinct these marker is of wdiff output from original text. + + ins_op = r"\{\+" + ins_cl = r"\+\}" + del_op = r"\[\-" + del_cl = r"\-\]" + normal = r'[^{}[\]+-]+' # for performance + tokens = { + 'root': [ + (ins_op, Generic.Inserted, 'inserted'), + (del_op, Generic.Deleted, 'deleted'), + (normal, Text), + (r'.', Text), + ], + 'inserted': [ + (ins_op, Generic.Inserted, '#push'), + (del_op, Generic.Inserted, '#push'), + (del_cl, Generic.Inserted, '#pop'), + + (ins_cl, Generic.Inserted, '#pop'), + (normal, Generic.Inserted), + (r'.', Generic.Inserted), + ], + 'deleted': [ + (del_op, Generic.Deleted, '#push'), + (ins_op, Generic.Deleted, '#push'), + (ins_cl, Generic.Deleted, '#pop'), + + (del_cl, Generic.Deleted, '#pop'), + (normal, Generic.Deleted), + (r'.', Generic.Deleted), + ], + } diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/dotnet.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/dotnet.py new file mode 100644 index 0000000000000000000000000000000000000000..4e2bc8ab5c91b5444a90a31948e4dd35b10b79f8 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/dotnet.py @@ -0,0 +1,691 @@ +# -*- coding: utf-8 -*- +""" + pygments.lexers.dotnet + ~~~~~~~~~~~~~~~~~~~~~~ + + Lexers for .net languages. + + :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS. + :license: BSD, see LICENSE for details. +""" +import re + +from pygments.lexer import RegexLexer, DelegatingLexer, bygroups, include, \ + using, this, default, words +from pygments.token import Punctuation, \ + Text, Comment, Operator, Keyword, Name, String, Number, Literal, Other +from pygments.util import get_choice_opt, iteritems +from pygments import unistring as uni + +from pygments.lexers.html import XmlLexer + +__all__ = ['CSharpLexer', 'NemerleLexer', 'BooLexer', 'VbNetLexer', + 'CSharpAspxLexer', 'VbNetAspxLexer', 'FSharpLexer'] + + +class CSharpLexer(RegexLexer): + """ + For `C# `_ + source code. + + Additional options accepted: + + `unicodelevel` + Determines which Unicode characters this lexer allows for identifiers. + The possible values are: + + * ``none`` -- only the ASCII letters and numbers are allowed. This + is the fastest selection. + * ``basic`` -- all Unicode characters from the specification except + category ``Lo`` are allowed. + * ``full`` -- all Unicode characters as specified in the C# specs + are allowed. Note that this means a considerable slowdown since the + ``Lo`` category has more than 40,000 characters in it! + + The default value is ``basic``. + + .. versionadded:: 0.8 + """ + + name = 'C#' + aliases = ['csharp', 'c#'] + filenames = ['*.cs'] + mimetypes = ['text/x-csharp'] # inferred + + flags = re.MULTILINE | re.DOTALL | re.UNICODE + + # for the range of allowed unicode characters in identifiers, see + # http://www.ecma-international.org/publications/files/ECMA-ST/Ecma-334.pdf + + levels = { + 'none': '@?[_a-zA-Z]\w*', + 'basic': ('@?[_' + uni.combine('Lu', 'Ll', 'Lt', 'Lm', 'Nl') + ']' + + '[' + uni.combine('Lu', 'Ll', 'Lt', 'Lm', 'Nl', 'Nd', 'Pc', + 'Cf', 'Mn', 'Mc') + ']*'), + 'full': ('@?(?:_|[^' + + uni.allexcept('Lu', 'Ll', 'Lt', 'Lm', 'Lo', 'Nl') + '])' + + '[^' + uni.allexcept('Lu', 'Ll', 'Lt', 'Lm', 'Lo', 'Nl', + 'Nd', 'Pc', 'Cf', 'Mn', 'Mc') + ']*'), + } + + tokens = {} + token_variants = True + + for levelname, cs_ident in iteritems(levels): + tokens[levelname] = { + 'root': [ + # method names + (r'^([ \t]*(?:' + cs_ident + r'(?:\[\])?\s+)+?)' # return type + r'(' + cs_ident + ')' # method name + r'(\s*)(\()', # signature start + bygroups(using(this), Name.Function, Text, Punctuation)), + (r'^\s*\[.*?\]', Name.Attribute), + (r'[^\S\n]+', Text), + (r'\\\n', Text), # line continuation + (r'//.*?\n', Comment.Single), + (r'/[*].*?[*]/', Comment.Multiline), + (r'\n', Text), + (r'[~!%^&*()+=|\[\]:;,.<>/?-]', Punctuation), + (r'[{}]', Punctuation), + (r'@"(""|[^"])*"', String), + (r'"(\\\\|\\"|[^"\n])*["\n]', String), + (r"'\\.'|'[^\\]'", String.Char), + (r"[0-9](\.[0-9]*)?([eE][+-][0-9]+)?" + r"[flFLdD]?|0[xX][0-9a-fA-F]+[Ll]?", Number), + (r'#[ \t]*(if|endif|else|elif|define|undef|' + r'line|error|warning|region|endregion|pragma)\b.*?\n', + Comment.Preproc), + (r'\b(extern)(\s+)(alias)\b', bygroups(Keyword, Text, + Keyword)), + (r'(abstract|as|async|await|base|break|by|case|catch|' + r'checked|const|continue|default|delegate|' + r'do|else|enum|event|explicit|extern|false|finally|' + r'fixed|for|foreach|goto|if|implicit|in|interface|' + r'internal|is|let|lock|new|null|on|operator|' + r'out|override|params|private|protected|public|readonly|' + r'ref|return|sealed|sizeof|stackalloc|static|' + r'switch|this|throw|true|try|typeof|' + r'unchecked|unsafe|virtual|void|while|' + r'get|set|new|partial|yield|add|remove|value|alias|ascending|' + r'descending|from|group|into|orderby|select|thenby|where|' + r'join|equals)\b', Keyword), + (r'(global)(::)', bygroups(Keyword, Punctuation)), + (r'(bool|byte|char|decimal|double|dynamic|float|int|long|object|' + r'sbyte|short|string|uint|ulong|ushort|var)\b\??', Keyword.Type), + (r'(class|struct)(\s+)', bygroups(Keyword, Text), 'class'), + (r'(namespace|using)(\s+)', bygroups(Keyword, Text), 'namespace'), + (cs_ident, Name), + ], + 'class': [ + (cs_ident, Name.Class, '#pop'), + default('#pop'), + ], + 'namespace': [ + (r'(?=\()', Text, '#pop'), # using (resource) + ('(' + cs_ident + r'|\.)+', Name.Namespace, '#pop'), + ] + } + + def __init__(self, **options): + level = get_choice_opt(options, 'unicodelevel', list(self.tokens), 'basic') + if level not in self._all_tokens: + # compile the regexes now + self._tokens = self.__class__.process_tokendef(level) + else: + self._tokens = self._all_tokens[level] + + RegexLexer.__init__(self, **options) + + +class NemerleLexer(RegexLexer): + """ + For `Nemerle `_ source code. + + Additional options accepted: + + `unicodelevel` + Determines which Unicode characters this lexer allows for identifiers. + The possible values are: + + * ``none`` -- only the ASCII letters and numbers are allowed. This + is the fastest selection. + * ``basic`` -- all Unicode characters from the specification except + category ``Lo`` are allowed. + * ``full`` -- all Unicode characters as specified in the C# specs + are allowed. Note that this means a considerable slowdown since the + ``Lo`` category has more than 40,000 characters in it! + + The default value is ``basic``. + + .. versionadded:: 1.5 + """ + + name = 'Nemerle' + aliases = ['nemerle'] + filenames = ['*.n'] + mimetypes = ['text/x-nemerle'] # inferred + + flags = re.MULTILINE | re.DOTALL | re.UNICODE + + # for the range of allowed unicode characters in identifiers, see + # http://www.ecma-international.org/publications/files/ECMA-ST/Ecma-334.pdf + + levels = { + 'none': '@?[_a-zA-Z]\w*', + 'basic': ('@?[_' + uni.combine('Lu', 'Ll', 'Lt', 'Lm', 'Nl') + ']' + + '[' + uni.combine('Lu', 'Ll', 'Lt', 'Lm', 'Nl', 'Nd', 'Pc', + 'Cf', 'Mn', 'Mc') + ']*'), + 'full': ('@?(?:_|[^' + + uni.allexcept('Lu', 'Ll', 'Lt', 'Lm', 'Lo', 'Nl') + '])' + + '[^' + uni.allexcept('Lu', 'Ll', 'Lt', 'Lm', 'Lo', 'Nl', + 'Nd', 'Pc', 'Cf', 'Mn', 'Mc') + ']*'), + } + + tokens = {} + token_variants = True + + for levelname, cs_ident in iteritems(levels): + tokens[levelname] = { + 'root': [ + # method names + (r'^([ \t]*(?:' + cs_ident + r'(?:\[\])?\s+)+?)' # return type + r'(' + cs_ident + ')' # method name + r'(\s*)(\()', # signature start + bygroups(using(this), Name.Function, Text, Punctuation)), + (r'^\s*\[.*?\]', Name.Attribute), + (r'[^\S\n]+', Text), + (r'\\\n', Text), # line continuation + (r'//.*?\n', Comment.Single), + (r'/[*].*?[*]/', Comment.Multiline), + (r'\n', Text), + (r'\$\s*"', String, 'splice-string'), + (r'\$\s*<#', String, 'splice-string2'), + (r'<#', String, 'recursive-string'), + + (r'(<\[)\s*(' + cs_ident + ':)?', Keyword), + (r'\]\>', Keyword), + + # quasiquotation only + (r'\$' + cs_ident, Name), + (r'(\$)(\()', bygroups(Name, Punctuation), + 'splice-string-content'), + + (r'[~!%^&*()+=|\[\]:;,.<>/?-]', Punctuation), + (r'[{}]', Punctuation), + (r'@"(""|[^"])*"', String), + (r'"(\\\\|\\"|[^"\n])*["\n]', String), + (r"'\\.'|'[^\\]'", String.Char), + (r"0[xX][0-9a-fA-F]+[Ll]?", Number), + (r"[0-9](\.[0-9]*)?([eE][+-][0-9]+)?[flFLdD]?", Number), + (r'#[ \t]*(if|endif|else|elif|define|undef|' + r'line|error|warning|region|endregion|pragma)\b.*?\n', + Comment.Preproc), + (r'\b(extern)(\s+)(alias)\b', bygroups(Keyword, Text, + Keyword)), + (r'(abstract|and|as|base|catch|def|delegate|' + r'enum|event|extern|false|finally|' + r'fun|implements|interface|internal|' + r'is|macro|match|matches|module|mutable|new|' + r'null|out|override|params|partial|private|' + r'protected|public|ref|sealed|static|' + r'syntax|this|throw|true|try|type|typeof|' + r'virtual|volatile|when|where|with|' + r'assert|assert2|async|break|checked|continue|do|else|' + r'ensures|for|foreach|if|late|lock|new|nolate|' + r'otherwise|regexp|repeat|requires|return|surroundwith|' + r'unchecked|unless|using|while|yield)\b', Keyword), + (r'(global)(::)', bygroups(Keyword, Punctuation)), + (r'(bool|byte|char|decimal|double|float|int|long|object|sbyte|' + r'short|string|uint|ulong|ushort|void|array|list)\b\??', + Keyword.Type), + (r'(:>?)\s*(' + cs_ident + r'\??)', + bygroups(Punctuation, Keyword.Type)), + (r'(class|struct|variant|module)(\s+)', + bygroups(Keyword, Text), 'class'), + (r'(namespace|using)(\s+)', bygroups(Keyword, Text), + 'namespace'), + (cs_ident, Name), + ], + 'class': [ + (cs_ident, Name.Class, '#pop') + ], + 'namespace': [ + (r'(?=\()', Text, '#pop'), # using (resource) + ('(' + cs_ident + r'|\.)+', Name.Namespace, '#pop') + ], + 'splice-string': [ + (r'[^"$]', String), + (r'\$' + cs_ident, Name), + (r'(\$)(\()', bygroups(Name, Punctuation), + 'splice-string-content'), + (r'\\"', String), + (r'"', String, '#pop') + ], + 'splice-string2': [ + (r'[^#<>$]', String), + (r'\$' + cs_ident, Name), + (r'(\$)(\()', bygroups(Name, Punctuation), + 'splice-string-content'), + (r'<#', String, '#push'), + (r'#>', String, '#pop') + ], + 'recursive-string': [ + (r'[^#<>]', String), + (r'<#', String, '#push'), + (r'#>', String, '#pop') + ], + 'splice-string-content': [ + (r'if|match', Keyword), + (r'[~!%^&*+=|\[\]:;,.<>/?-\\"$ ]', Punctuation), + (cs_ident, Name), + (r'\d+', Number), + (r'\(', Punctuation, '#push'), + (r'\)', Punctuation, '#pop') + ] + } + + def __init__(self, **options): + level = get_choice_opt(options, 'unicodelevel', list(self.tokens), + 'basic') + if level not in self._all_tokens: + # compile the regexes now + self._tokens = self.__class__.process_tokendef(level) + else: + self._tokens = self._all_tokens[level] + + RegexLexer.__init__(self, **options) + + +class BooLexer(RegexLexer): + """ + For `Boo `_ source code. + """ + + name = 'Boo' + aliases = ['boo'] + filenames = ['*.boo'] + mimetypes = ['text/x-boo'] + + tokens = { + 'root': [ + (r'\s+', Text), + (r'(#|//).*$', Comment.Single), + (r'/[*]', Comment.Multiline, 'comment'), + (r'[]{}:(),.;[]', Punctuation), + (r'\\\n', Text), + (r'\\', Text), + (r'(in|is|and|or|not)\b', Operator.Word), + (r'/(\\\\|\\/|[^/\s])/', String.Regex), + (r'@/(\\\\|\\/|[^/])*/', String.Regex), + (r'=~|!=|==|<<|>>|[-+/*%=<>&^|]', Operator), + (r'(as|abstract|callable|constructor|destructor|do|import|' + r'enum|event|final|get|interface|internal|of|override|' + r'partial|private|protected|public|return|set|static|' + r'struct|transient|virtual|yield|super|and|break|cast|' + r'continue|elif|else|ensure|except|for|given|goto|if|in|' + r'is|isa|not|or|otherwise|pass|raise|ref|try|unless|when|' + r'while|from|as)\b', Keyword), + (r'def(?=\s+\(.*?\))', Keyword), + (r'(def)(\s+)', bygroups(Keyword, Text), 'funcname'), + (r'(class)(\s+)', bygroups(Keyword, Text), 'classname'), + (r'(namespace)(\s+)', bygroups(Keyword, Text), 'namespace'), + (r'(?`_ + source code. + """ + + name = 'VB.net' + aliases = ['vb.net', 'vbnet'] + filenames = ['*.vb', '*.bas'] + mimetypes = ['text/x-vbnet', 'text/x-vba'] # (?) + + uni_name = '[_' + uni.combine('Ll', 'Lt', 'Lm', 'Nl') + ']' + \ + '[' + uni.combine('Ll', 'Lt', 'Lm', 'Nl', 'Nd', 'Pc', + 'Cf', 'Mn', 'Mc') + ']*' + + flags = re.MULTILINE | re.IGNORECASE + tokens = { + 'root': [ + (r'^\s*<.*?>', Name.Attribute), + (r'\s+', Text), + (r'\n', Text), + (r'rem\b.*?\n', Comment), + (r"'.*?\n", Comment), + (r'#If\s.*?\sThen|#ElseIf\s.*?\sThen|#Else|#End\s+If|#Const|' + r'#ExternalSource.*?\n|#End\s+ExternalSource|' + r'#Region.*?\n|#End\s+Region|#ExternalChecksum', + Comment.Preproc), + (r'[(){}!#,.:]', Punctuation), + (r'Option\s+(Strict|Explicit|Compare)\s+' + r'(On|Off|Binary|Text)', Keyword.Declaration), + (words(( + 'AddHandler', 'Alias', 'ByRef', 'ByVal', 'Call', 'Case', + 'Catch', 'CBool', 'CByte', 'CChar', 'CDate', 'CDec', 'CDbl', + 'CInt', 'CLng', 'CObj', 'Continue', 'CSByte', 'CShort', 'CSng', + 'CStr', 'CType', 'CUInt', 'CULng', 'CUShort', 'Declare', + 'Default', 'Delegate', 'DirectCast', 'Do', 'Each', 'Else', + 'ElseIf', 'EndIf', 'Erase', 'Error', 'Event', 'Exit', 'False', + 'Finally', 'For', 'Friend', 'Get', 'Global', 'GoSub', 'GoTo', + 'Handles', 'If', 'Implements', 'Inherits', 'Interface', 'Let', + 'Lib', 'Loop', 'Me', 'MustInherit', 'MustOverride', 'MyBase', + 'MyClass', 'Narrowing', 'New', 'Next', 'Not', 'Nothing', + 'NotInheritable', 'NotOverridable', 'Of', 'On', 'Operator', + 'Option', 'Optional', 'Overloads', 'Overridable', 'Overrides', + 'ParamArray', 'Partial', 'Private', 'Protected', 'Public', + 'RaiseEvent', 'ReadOnly', 'ReDim', 'RemoveHandler', 'Resume', + 'Return', 'Select', 'Set', 'Shadows', 'Shared', 'Single', + 'Static', 'Step', 'Stop', 'SyncLock', 'Then', 'Throw', 'To', + 'True', 'Try', 'TryCast', 'Wend', 'Using', 'When', 'While', + 'Widening', 'With', 'WithEvents', 'WriteOnly'), + prefix='(?>=|<<|>>|:=|' + r'<=|>=|<>|[-&*/\\^+=<>\[\]]', + Operator), + ('"', String, 'string'), + (r'_\n', Text), # Line continuation (must be before Name) + (uni_name + '[%&@!#$]?', Name), + ('#.*?#', Literal.Date), + (r'(\d+\.\d*|\d*\.\d+)(F[+-]?[0-9]+)?', Number.Float), + (r'\d+([SILDFR]|US|UI|UL)?', Number.Integer), + (r'&H[0-9a-f]+([SILDFR]|US|UI|UL)?', Number.Integer), + (r'&O[0-7]+([SILDFR]|US|UI|UL)?', Number.Integer), + ], + 'string': [ + (r'""', String), + (r'"C?', String, '#pop'), + (r'[^"]+', String), + ], + 'dim': [ + (uni_name, Name.Variable, '#pop'), + default('#pop'), # any other syntax + ], + 'funcname': [ + (uni_name, Name.Function, '#pop'), + ], + 'classname': [ + (uni_name, Name.Class, '#pop'), + ], + 'namespace': [ + (uni_name, Name.Namespace), + (r'\.', Name.Namespace), + default('#pop'), + ], + 'end': [ + (r'\s+', Text), + (r'(Function|Sub|Property|Class|Structure|Enum|Module|Namespace)\b', + Keyword, '#pop'), + default('#pop'), + ] + } + + def analyse_text(text): + if re.search(r'^\s*(#If|Module|Namespace)', text, re.MULTILINE): + return 0.5 + + +class GenericAspxLexer(RegexLexer): + """ + Lexer for ASP.NET pages. + """ + + name = 'aspx-gen' + filenames = [] + mimetypes = [] + + flags = re.DOTALL + + tokens = { + 'root': [ + (r'(<%[@=#]?)(.*?)(%>)', bygroups(Name.Tag, Other, Name.Tag)), + (r'()(.*?)()', bygroups(using(XmlLexer), + Other, + using(XmlLexer))), + (r'(.+?)(?=<)', using(XmlLexer)), + (r'.+', using(XmlLexer)), + ], + } + + +# TODO support multiple languages within the same source file +class CSharpAspxLexer(DelegatingLexer): + """ + Lexer for highlighting C# within ASP.NET pages. + """ + + name = 'aspx-cs' + aliases = ['aspx-cs'] + filenames = ['*.aspx', '*.asax', '*.ascx', '*.ashx', '*.asmx', '*.axd'] + mimetypes = [] + + def __init__(self, **options): + super(CSharpAspxLexer, self).__init__(CSharpLexer, GenericAspxLexer, + **options) + + def analyse_text(text): + if re.search(r'Page\s*Language="C#"', text, re.I) is not None: + return 0.2 + elif re.search(r'script[^>]+language=["\']C#', text, re.I) is not None: + return 0.15 + + +class VbNetAspxLexer(DelegatingLexer): + """ + Lexer for highlighting Visual Basic.net within ASP.NET pages. + """ + + name = 'aspx-vb' + aliases = ['aspx-vb'] + filenames = ['*.aspx', '*.asax', '*.ascx', '*.ashx', '*.asmx', '*.axd'] + mimetypes = [] + + def __init__(self, **options): + super(VbNetAspxLexer, self).__init__(VbNetLexer, GenericAspxLexer, + **options) + + def analyse_text(text): + if re.search(r'Page\s*Language="Vb"', text, re.I) is not None: + return 0.2 + elif re.search(r'script[^>]+language=["\']vb', text, re.I) is not None: + return 0.15 + + +# Very close to functional.OcamlLexer +class FSharpLexer(RegexLexer): + """ + For the F# language (version 3.0). + + AAAAACK Strings + http://research.microsoft.com/en-us/um/cambridge/projects/fsharp/manual/spec.html#_Toc335818775 + + .. versionadded:: 1.5 + """ + + name = 'FSharp' + aliases = ['fsharp'] + filenames = ['*.fs', '*.fsi'] + mimetypes = ['text/x-fsharp'] + + keywords = [ + 'abstract', 'as', 'assert', 'base', 'begin', 'class', 'default', + 'delegate', 'do!', 'do', 'done', 'downcast', 'downto', 'elif', 'else', + 'end', 'exception', 'extern', 'false', 'finally', 'for', 'function', + 'fun', 'global', 'if', 'inherit', 'inline', 'interface', 'internal', + 'in', 'lazy', 'let!', 'let', 'match', 'member', 'module', 'mutable', + 'namespace', 'new', 'null', 'of', 'open', 'override', 'private', 'public', + 'rec', 'return!', 'return', 'select', 'static', 'struct', 'then', 'to', + 'true', 'try', 'type', 'upcast', 'use!', 'use', 'val', 'void', 'when', + 'while', 'with', 'yield!', 'yield', + ] + # Reserved words; cannot hurt to color them as keywords too. + keywords += [ + 'atomic', 'break', 'checked', 'component', 'const', 'constraint', + 'constructor', 'continue', 'eager', 'event', 'external', 'fixed', + 'functor', 'include', 'method', 'mixin', 'object', 'parallel', + 'process', 'protected', 'pure', 'sealed', 'tailcall', 'trait', + 'virtual', 'volatile', + ] + keyopts = [ + '!=', '#', '&&', '&', '\(', '\)', '\*', '\+', ',', '-\.', + '->', '-', '\.\.', '\.', '::', ':=', ':>', ':', ';;', ';', '<-', + '<\]', '<', '>\]', '>', '\?\?', '\?', '\[<', '\[\|', '\[', '\]', + '_', '`', '\{', '\|\]', '\|', '\}', '~', '<@@', '<@', '=', '@>', '@@>', + ] + + operators = r'[!$%&*+\./:<=>?@^|~-]' + word_operators = ['and', 'or', 'not'] + prefix_syms = r'[!?~]' + infix_syms = r'[=<>@^|&+\*/$%-]' + primitives = [ + 'sbyte', 'byte', 'char', 'nativeint', 'unativeint', 'float32', 'single', + 'float', 'double', 'int8', 'uint8', 'int16', 'uint16', 'int32', + 'uint32', 'int64', 'uint64', 'decimal', 'unit', 'bool', 'string', + 'list', 'exn', 'obj', 'enum', + ] + + # See http://msdn.microsoft.com/en-us/library/dd233181.aspx and/or + # http://fsharp.org/about/files/spec.pdf for reference. Good luck. + + tokens = { + 'escape-sequence': [ + (r'\\[\\"\'ntbrafv]', String.Escape), + (r'\\[0-9]{3}', String.Escape), + (r'\\u[0-9a-fA-F]{4}', String.Escape), + (r'\\U[0-9a-fA-F]{8}', String.Escape), + ], + 'root': [ + (r'\s+', Text), + (r'\(\)|\[\]', Name.Builtin.Pseudo), + (r'\b(?`_ + definition files. + + .. versionadded:: 1.4 + """ + + name = 'Protocol Buffer' + aliases = ['protobuf', 'proto'] + filenames = ['*.proto'] + + tokens = { + 'root': [ + (r'[ \t]+', Text), + (r'[,;{}\[\]()<>]', Punctuation), + (r'/(\\\n)?/(\n|(.|\n)*?[^\\]\n)', Comment.Single), + (r'/(\\\n)?\*(.|\n)*?\*(\\\n)?/', Comment.Multiline), + (words(( + 'import', 'option', 'optional', 'required', 'repeated', 'default', + 'packed', 'ctype', 'extensions', 'to', 'max', 'rpc', 'returns', + 'oneof'), prefix=r'\b', suffix=r'\b'), + Keyword), + (words(( + 'int32', 'int64', 'uint32', 'uint64', 'sint32', 'sint64', + 'fixed32', 'fixed64', 'sfixed32', 'sfixed64', + 'float', 'double', 'bool', 'string', 'bytes'), suffix=r'\b'), + Keyword.Type), + (r'(true|false)\b', Keyword.Constant), + (r'(package)(\s+)', bygroups(Keyword.Namespace, Text), 'package'), + (r'(message|extend)(\s+)', + bygroups(Keyword.Declaration, Text), 'message'), + (r'(enum|group|service)(\s+)', + bygroups(Keyword.Declaration, Text), 'type'), + (r'\".*?\"', String), + (r'\'.*?\'', String), + (r'(\d+\.\d*|\.\d+|\d+)[eE][+-]?\d+[LlUu]*', Number.Float), + (r'(\d+\.\d*|\.\d+|\d+[fF])[fF]?', Number.Float), + (r'(\-?(inf|nan))\b', Number.Float), + (r'0x[0-9a-fA-F]+[LlUu]*', Number.Hex), + (r'0[0-7]+[LlUu]*', Number.Oct), + (r'\d+[LlUu]*', Number.Integer), + (r'[+-=]', Operator), + (r'([a-zA-Z_][\w.]*)([ \t]*)(=)', + bygroups(Name.Attribute, Text, Operator)), + ('[a-zA-Z_][\w.]*', Name), + ], + 'package': [ + (r'[a-zA-Z_]\w*', Name.Namespace, '#pop'), + default('#pop'), + ], + 'message': [ + (r'[a-zA-Z_]\w*', Name.Class, '#pop'), + default('#pop'), + ], + 'type': [ + (r'[a-zA-Z_]\w*', Name, '#pop'), + default('#pop'), + ], + } + + +class ThriftLexer(RegexLexer): + """ + For `Thrift `__ interface definitions. + + .. versionadded:: 2.1 + """ + name = 'Thrift' + aliases = ['thrift'] + filenames = ['*.thrift'] + mimetypes = ['application/x-thrift'] + + tokens = { + 'root': [ + include('whitespace'), + include('comments'), + (r'"', String.Double, combined('stringescape', 'dqs')), + (r'\'', String.Single, combined('stringescape', 'sqs')), + (r'(namespace)(\s+)', + bygroups(Keyword.Namespace, Text.Whitespace), 'namespace'), + (r'(enum|union|struct|service|exception)(\s+)', + bygroups(Keyword.Declaration, Text.Whitespace), 'class'), + (r'((?:(?:[^\W\d]|\$)[\w.\[\]$<>]*\s+)+?)' # return arguments + r'((?:[^\W\d]|\$)[\w$]*)' # method name + r'(\s*)(\()', # signature start + bygroups(using(this), Name.Function, Text, Operator)), + include('keywords'), + include('numbers'), + (r'[&=]', Operator), + (r'[:;,{}()<>\[\]]', Punctuation), + (r'[a-zA-Z_](\.\w|\w)*', Name), + ], + 'whitespace': [ + (r'\n', Text.Whitespace), + (r'\s+', Text.Whitespace), + ], + 'comments': [ + (r'#.*$', Comment), + (r'//.*?\n', Comment), + (r'/\*[\w\W]*?\*/', Comment.Multiline), + ], + 'stringescape': [ + (r'\\([\\nrt"\'])', String.Escape), + ], + 'dqs': [ + (r'"', String.Double, '#pop'), + (r'[^\\"\n]+', String.Double), + ], + 'sqs': [ + (r"'", String.Single, '#pop'), + (r'[^\\\'\n]+', String.Single), + ], + 'namespace': [ + (r'[a-z*](\.\w|\w)*', Name.Namespace, '#pop'), + default('#pop'), + ], + 'class': [ + (r'[a-zA-Z_]\w*', Name.Class, '#pop'), + default('#pop'), + ], + 'keywords': [ + (r'(async|oneway|extends|throws|required|optional)\b', Keyword), + (r'(true|false)\b', Keyword.Constant), + (r'(const|typedef)\b', Keyword.Declaration), + (words(( + 'cpp_namespace', 'cpp_include', 'cpp_type', 'java_package', + 'cocoa_prefix', 'csharp_namespace', 'delphi_namespace', + 'php_namespace', 'py_module', 'perl_package', + 'ruby_namespace', 'smalltalk_category', 'smalltalk_prefix', + 'xsd_all', 'xsd_optional', 'xsd_nillable', 'xsd_namespace', + 'xsd_attrs', 'include'), suffix=r'\b'), + Keyword.Namespace), + (words(( + 'void', 'bool', 'byte', 'i16', 'i32', 'i64', 'double', + 'string', 'binary', 'map', 'list', 'set', 'slist', + 'senum'), suffix=r'\b'), + Keyword.Type), + (words(( + 'BEGIN', 'END', '__CLASS__', '__DIR__', '__FILE__', + '__FUNCTION__', '__LINE__', '__METHOD__', '__NAMESPACE__', + 'abstract', 'alias', 'and', 'args', 'as', 'assert', 'begin', + 'break', 'case', 'catch', 'class', 'clone', 'continue', + 'declare', 'def', 'default', 'del', 'delete', 'do', 'dynamic', + 'elif', 'else', 'elseif', 'elsif', 'end', 'enddeclare', + 'endfor', 'endforeach', 'endif', 'endswitch', 'endwhile', + 'ensure', 'except', 'exec', 'finally', 'float', 'for', + 'foreach', 'function', 'global', 'goto', 'if', 'implements', + 'import', 'in', 'inline', 'instanceof', 'interface', 'is', + 'lambda', 'module', 'native', 'new', 'next', 'nil', 'not', + 'or', 'pass', 'public', 'print', 'private', 'protected', + 'raise', 'redo', 'rescue', 'retry', 'register', 'return', + 'self', 'sizeof', 'static', 'super', 'switch', 'synchronized', + 'then', 'this', 'throw', 'transient', 'try', 'undef', + 'unless', 'unsigned', 'until', 'use', 'var', 'virtual', + 'volatile', 'when', 'while', 'with', 'xor', 'yield'), + prefix=r'\b', suffix=r'\b'), + Keyword.Reserved), + ], + 'numbers': [ + (r'[+-]?(\d+\.\d+([eE][+-]?\d+)?|\.?\d+[eE][+-]?\d+)', Number.Float), + (r'[+-]?0x[0-9A-Fa-f]+', Number.Hex), + (r'[+-]?[0-9]+', Number.Integer), + ], + } + + +class BroLexer(RegexLexer): + """ + For `Bro `_ scripts. + + .. versionadded:: 1.5 + """ + name = 'Bro' + aliases = ['bro'] + filenames = ['*.bro'] + + _hex = r'[0-9a-fA-F_]' + _float = r'((\d*\.?\d+)|(\d+\.?\d*))([eE][-+]?\d+)?' + _h = r'[A-Za-z0-9][-A-Za-z0-9]*' + + tokens = { + 'root': [ + # Whitespace + (r'^@.*?\n', Comment.Preproc), + (r'#.*?\n', Comment.Single), + (r'\n', Text), + (r'\s+', Text), + (r'\\\n', Text), + # Keywords + (r'(add|alarm|break|case|const|continue|delete|do|else|enum|event' + r'|export|for|function|if|global|hook|local|module|next' + r'|of|print|redef|return|schedule|switch|type|when|while)\b', Keyword), + (r'(addr|any|bool|count|counter|double|file|int|interval|net' + r'|pattern|port|record|set|string|subnet|table|time|timer' + r'|vector)\b', Keyword.Type), + (r'(T|F)\b', Keyword.Constant), + (r'(&)((?:add|delete|expire)_func|attr|(?:create|read|write)_expire' + r'|default|disable_print_hook|raw_output|encrypt|group|log' + r'|mergeable|optional|persistent|priority|redef' + r'|rotate_(?:interval|size)|synchronized)\b', + bygroups(Punctuation, Keyword)), + (r'\s+module\b', Keyword.Namespace), + # Addresses, ports and networks + (r'\d+/(tcp|udp|icmp|unknown)\b', Number), + (r'(\d+\.){3}\d+', Number), + (r'(' + _hex + r'){7}' + _hex, Number), + (r'0x' + _hex + r'(' + _hex + r'|:)*::(' + _hex + r'|:)*', Number), + (r'((\d+|:)(' + _hex + r'|:)*)?::(' + _hex + r'|:)*', Number), + (r'(\d+\.\d+\.|(\d+\.){2}\d+)', Number), + # Hostnames + (_h + r'(\.' + _h + r')+', String), + # Numeric + (_float + r'\s+(day|hr|min|sec|msec|usec)s?\b', Literal.Date), + (r'0[xX]' + _hex, Number.Hex), + (_float, Number.Float), + (r'\d+', Number.Integer), + (r'/', String.Regex, 'regex'), + (r'"', String, 'string'), + # Operators + (r'[!%*/+:<=>?~|-]', Operator), + (r'([-+=&|]{2}|[+=!><-]=)', Operator), + (r'(in|match)\b', Operator.Word), + (r'[{}()\[\]$.,;]', Punctuation), + # Identfier + (r'([_a-zA-Z]\w*)(::)', bygroups(Name, Name.Namespace)), + (r'[a-zA-Z_]\w*', Name) + ], + 'string': [ + (r'"', String, '#pop'), + (r'\\([\\abfnrtv"\']|x[a-fA-F0-9]{2,4}|[0-7]{1,3})', String.Escape), + (r'[^\\"\n]+', String), + (r'\\\n', String), + (r'\\', String) + ], + 'regex': [ + (r'/', String.Regex, '#pop'), + (r'\\[\\nt/]', String.Regex), # String.Escape is too intense here. + (r'[^\\/\n]+', String.Regex), + (r'\\\n', String.Regex), + (r'\\', String.Regex) + ] + } + + +class PuppetLexer(RegexLexer): + """ + For `Puppet `__ configuration DSL. + + .. versionadded:: 1.6 + """ + name = 'Puppet' + aliases = ['puppet'] + filenames = ['*.pp'] + + tokens = { + 'root': [ + include('comments'), + include('keywords'), + include('names'), + include('numbers'), + include('operators'), + include('strings'), + + (r'[]{}:(),;[]', Punctuation), + (r'[^\S\n]+', Text), + ], + + 'comments': [ + (r'\s*#.*$', Comment), + (r'/(\\\n)?[*](.|\n)*?[*](\\\n)?/', Comment.Multiline), + ], + + 'operators': [ + (r'(=>|\?|<|>|=|\+|-|/|\*|~|!|\|)', Operator), + (r'(in|and|or|not)\b', Operator.Word), + ], + + 'names': [ + ('[a-zA-Z_]\w*', Name.Attribute), + (r'(\$\S+)(\[)(\S+)(\])', bygroups(Name.Variable, Punctuation, + String, Punctuation)), + (r'\$\S+', Name.Variable), + ], + + 'numbers': [ + # Copypasta from the Python lexer + (r'(\d+\.\d*|\d*\.\d+)([eE][+-]?[0-9]+)?j?', Number.Float), + (r'\d+[eE][+-]?[0-9]+j?', Number.Float), + (r'0[0-7]+j?', Number.Oct), + (r'0[xX][a-fA-F0-9]+', Number.Hex), + (r'\d+L', Number.Integer.Long), + (r'\d+j?', Number.Integer) + ], + + 'keywords': [ + # Left out 'group' and 'require' + # Since they're often used as attributes + (words(( + 'absent', 'alert', 'alias', 'audit', 'augeas', 'before', 'case', + 'check', 'class', 'computer', 'configured', 'contained', + 'create_resources', 'crit', 'cron', 'debug', 'default', + 'define', 'defined', 'directory', 'else', 'elsif', 'emerg', + 'err', 'exec', 'extlookup', 'fail', 'false', 'file', + 'filebucket', 'fqdn_rand', 'generate', 'host', 'if', 'import', + 'include', 'info', 'inherits', 'inline_template', 'installed', + 'interface', 'k5login', 'latest', 'link', 'loglevel', + 'macauthorization', 'mailalias', 'maillist', 'mcx', 'md5', + 'mount', 'mounted', 'nagios_command', 'nagios_contact', + 'nagios_contactgroup', 'nagios_host', 'nagios_hostdependency', + 'nagios_hostescalation', 'nagios_hostextinfo', 'nagios_hostgroup', + 'nagios_service', 'nagios_servicedependency', 'nagios_serviceescalation', + 'nagios_serviceextinfo', 'nagios_servicegroup', 'nagios_timeperiod', + 'node', 'noop', 'notice', 'notify', 'package', 'present', 'purged', + 'realize', 'regsubst', 'resources', 'role', 'router', 'running', + 'schedule', 'scheduled_task', 'search', 'selboolean', 'selmodule', + 'service', 'sha1', 'shellquote', 'split', 'sprintf', + 'ssh_authorized_key', 'sshkey', 'stage', 'stopped', 'subscribe', + 'tag', 'tagged', 'template', 'tidy', 'true', 'undef', 'unmounted', + 'user', 'versioncmp', 'vlan', 'warning', 'yumrepo', 'zfs', 'zone', + 'zpool'), prefix='(?i)', suffix=r'\b'), + Keyword), + ], + + 'strings': [ + (r'"([^"])*"', String), + (r"'(\\'|[^'])*'", String), + ], + + } + + +class RslLexer(RegexLexer): + """ + `RSL `_ is the formal specification + language used in RAISE (Rigorous Approach to Industrial Software Engineering) + method. + + .. versionadded:: 2.0 + """ + name = 'RSL' + aliases = ['rsl'] + filenames = ['*.rsl'] + mimetypes = ['text/rsl'] + + flags = re.MULTILINE | re.DOTALL + + tokens = { + 'root': [ + (words(( + 'Bool', 'Char', 'Int', 'Nat', 'Real', 'Text', 'Unit', 'abs', + 'all', 'always', 'any', 'as', 'axiom', 'card', 'case', 'channel', + 'chaos', 'class', 'devt_relation', 'dom', 'elems', 'else', 'elif', + 'end', 'exists', 'extend', 'false', 'for', 'hd', 'hide', 'if', + 'in', 'is', 'inds', 'initialise', 'int', 'inter', 'isin', 'len', + 'let', 'local', 'ltl_assertion', 'object', 'of', 'out', 'post', + 'pre', 'read', 'real', 'rng', 'scheme', 'skip', 'stop', 'swap', + 'then', 'theory', 'test_case', 'tl', 'transition_system', 'true', + 'type', 'union', 'until', 'use', 'value', 'variable', 'while', + 'with', 'write', '~isin', '-inflist', '-infset', '-list', + '-set'), prefix=r'\b', suffix=r'\b'), + Keyword), + (r'(variable|value)\b', Keyword.Declaration), + (r'--.*?\n', Comment), + (r'<:.*?:>', Comment), + (r'\{!.*?!\}', Comment), + (r'/\*.*?\*/', Comment), + (r'^[ \t]*([\w]+)[ \t]*:[^:]', Name.Function), + (r'(^[ \t]*)([\w]+)([ \t]*\([\w\s,]*\)[ \t]*)(is|as)', + bygroups(Text, Name.Function, Text, Keyword)), + (r'\b[A-Z]\w*\b', Keyword.Type), + (r'(true|false)\b', Keyword.Constant), + (r'".*"', String), + (r'\'.\'', String.Char), + (r'(><|->|-m->|/\\|<=|<<=|<\.|\|\||\|\^\||-~->|-~m->|\\/|>=|>>|' + r'\.>|\+\+|-\\|<->|=>|:-|~=|\*\*|<<|>>=|\+>|!!|\|=\||#)', + Operator), + (r'[0-9]+\.[0-9]+([eE][0-9]+)?[fd]?', Number.Float), + (r'0x[0-9a-f]+', Number.Hex), + (r'[0-9]+', Number.Integer), + (r'.', Text), + ], + } + + def analyse_text(text): + """ + Check for the most common text in the beginning of a RSL file. + """ + if re.search(r'scheme\s*.*?=\s*class\s*type', text, re.I) is not None: + return 1.0 + + +class MscgenLexer(RegexLexer): + """ + For `Mscgen `_ files. + + .. versionadded:: 1.6 + """ + name = 'Mscgen' + aliases = ['mscgen', 'msc'] + filenames = ['*.msc'] + + _var = r'(\w+|"(?:\\"|[^"])*")' + + tokens = { + 'root': [ + (r'msc\b', Keyword.Type), + # Options + (r'(hscale|HSCALE|width|WIDTH|wordwraparcs|WORDWRAPARCS' + r'|arcgradient|ARCGRADIENT)\b', Name.Property), + # Operators + (r'(abox|ABOX|rbox|RBOX|box|BOX|note|NOTE)\b', Operator.Word), + (r'(\.|-|\|){3}', Keyword), + (r'(?:-|=|\.|:){2}' + r'|<<=>>|<->|<=>|<<>>|<:>' + r'|->|=>>|>>|=>|:>|-x|-X' + r'|<-|<<=|<<|<=|<:|x-|X-|=', Operator), + # Names + (r'\*', Name.Builtin), + (_var, Name.Variable), + # Other + (r'\[', Punctuation, 'attrs'), + (r'\{|\}|,|;', Punctuation), + include('comments') + ], + 'attrs': [ + (r'\]', Punctuation, '#pop'), + (_var + r'(\s*)(=)(\s*)' + _var, + bygroups(Name.Attribute, Text.Whitespace, Operator, Text.Whitespace, + String)), + (r',', Punctuation), + include('comments') + ], + 'comments': [ + (r'(?://|#).*?\n', Comment.Single), + (r'/\*(?:.|\n)*?\*/', Comment.Multiline), + (r'[ \t\r\n]+', Text.Whitespace) + ] + } + + +class VGLLexer(RegexLexer): + """ + For `SampleManager VGL `_ + source code. + + .. versionadded:: 1.6 + """ + name = 'VGL' + aliases = ['vgl'] + filenames = ['*.rpf'] + + flags = re.MULTILINE | re.DOTALL | re.IGNORECASE + + tokens = { + 'root': [ + (r'\{[^}]*\}', Comment.Multiline), + (r'declare', Keyword.Constant), + (r'(if|then|else|endif|while|do|endwhile|and|or|prompt|object' + r'|create|on|line|with|global|routine|value|endroutine|constant' + r'|global|set|join|library|compile_option|file|exists|create|copy' + r'|delete|enable|windows|name|notprotected)(?! *[=<>.,()])', + Keyword), + (r'(true|false|null|empty|error|locked)', Keyword.Constant), + (r'[~^*#!%&\[\]()<>|+=:;,./?-]', Operator), + (r'"[^"]*"', String), + (r'(\.)([a-z_$][\w$]*)', bygroups(Operator, Name.Attribute)), + (r'[0-9][0-9]*(\.[0-9]+(e[+\-]?[0-9]+)?)?', Number), + (r'[a-z_$][\w$]*', Name), + (r'[\r\n]+', Text), + (r'\s+', Text) + ] + } + + +class AlloyLexer(RegexLexer): + """ + For `Alloy `_ source code. + + .. versionadded:: 2.0 + """ + + name = 'Alloy' + aliases = ['alloy'] + filenames = ['*.als'] + mimetypes = ['text/x-alloy'] + + flags = re.MULTILINE | re.DOTALL + + iden_rex = r'[a-zA-Z_][\w\']*' + text_tuple = (r'[^\S\n]+', Text) + + tokens = { + 'sig': [ + (r'(extends)\b', Keyword, '#pop'), + (iden_rex, Name), + text_tuple, + (r',', Punctuation), + (r'\{', Operator, '#pop'), + ], + 'module': [ + text_tuple, + (iden_rex, Name, '#pop'), + ], + 'fun': [ + text_tuple, + (r'\{', Operator, '#pop'), + (iden_rex, Name, '#pop'), + ], + 'root': [ + (r'--.*?$', Comment.Single), + (r'//.*?$', Comment.Single), + (r'/\*.*?\*/', Comment.Multiline), + text_tuple, + (r'(module|open)(\s+)', bygroups(Keyword.Namespace, Text), + 'module'), + (r'(sig|enum)(\s+)', bygroups(Keyword.Declaration, Text), 'sig'), + (r'(iden|univ|none)\b', Keyword.Constant), + (r'(int|Int)\b', Keyword.Type), + (r'(this|abstract|extends|set|seq|one|lone|let)\b', Keyword), + (r'(all|some|no|sum|disj|when|else)\b', Keyword), + (r'(run|check|for|but|exactly|expect|as)\b', Keyword), + (r'(and|or|implies|iff|in)\b', Operator.Word), + (r'(fun|pred|fact|assert)(\s+)', bygroups(Keyword, Text), 'fun'), + (r'!|#|&&|\+\+|<<|>>|>=|<=>|<=|\.|->', Operator), + (r'[-+/*%=<>&!^|~{}\[\]().]', Operator), + (iden_rex, Name), + (r'[:,]', Punctuation), + (r'[0-9]+', Number.Integer), + (r'"(\\\\|\\"|[^"])*"', String), + (r'\n', Text), + ] + } + + +class PanLexer(RegexLexer): + """ + Lexer for `pan `_ source files. + + Based on tcsh lexer. + + .. versionadded:: 2.0 + """ + + name = 'Pan' + aliases = ['pan'] + filenames = ['*.pan'] + + tokens = { + 'root': [ + include('basic'), + (r'\(', Keyword, 'paren'), + (r'\{', Keyword, 'curly'), + include('data'), + ], + 'basic': [ + (words(( + 'if', 'for', 'with', 'else', 'type', 'bind', 'while', 'valid', 'final', + 'prefix', 'unique', 'object', 'foreach', 'include', 'template', + 'function', 'variable', 'structure', 'extensible', 'declaration'), + prefix=r'\b', suffix=r'\s*\b'), + Keyword), + (words(( + 'file_contents', 'format', 'index', 'length', 'match', 'matches', + 'replace', 'splice', 'split', 'substr', 'to_lowercase', 'to_uppercase', + 'debug', 'error', 'traceback', 'deprecated', 'base64_decode', + 'base64_encode', 'digest', 'escape', 'unescape', 'append', 'create', + 'first', 'nlist', 'key', 'list', 'merge', 'next', 'prepend', 'is_boolean', + 'is_defined', 'is_double', 'is_list', 'is_long', 'is_nlist', 'is_null', + 'is_number', 'is_property', 'is_resource', 'is_string', 'to_boolean', + 'to_double', 'to_long', 'to_string', 'clone', 'delete', 'exists', + 'path_exists', 'if_exists', 'return', 'value'), + prefix=r'\b', suffix=r'\s*\b'), + Name.Builtin), + (r'#.*', Comment), + (r'\\[\w\W]', String.Escape), + (r'(\b\w+)(\s*)(=)', bygroups(Name.Variable, Text, Operator)), + (r'[\[\]{}()=]+', Operator), + (r'<<\s*(\'?)\\?(\w+)[\w\W]+?\2', String), + (r';', Punctuation), + ], + 'data': [ + (r'(?s)"(\\\\|\\[0-7]+|\\.|[^"\\])*"', String.Double), + (r"(?s)'(\\\\|\\[0-7]+|\\.|[^'\\])*'", String.Single), + (r'\s+', Text), + (r'[^=\s\[\]{}()$"\'`\\;#]+', Text), + (r'\d+(?= |\Z)', Number), + ], + 'curly': [ + (r'\}', Keyword, '#pop'), + (r':-', Keyword), + (r'\w+', Name.Variable), + (r'[^}:"\'`$]+', Punctuation), + (r':', Punctuation), + include('root'), + ], + 'paren': [ + (r'\)', Keyword, '#pop'), + include('root'), + ], + } + + +class CrmshLexer(RegexLexer): + """ + Lexer for `crmsh `_ configuration files + for Pacemaker clusters. + + .. versionadded:: 2.1 + """ + name = 'Crmsh' + aliases = ['crmsh', 'pcmk'] + filenames = ['*.crmsh', '*.pcmk'] + mimetypes = [] + + elem = words(( + 'node', 'primitive', 'group', 'clone', 'ms', 'location', + 'colocation', 'order', 'fencing_topology', 'rsc_ticket', + 'rsc_template', 'property', 'rsc_defaults', + 'op_defaults', 'acl_target', 'acl_group', 'user', 'role', + 'tag'), suffix=r'(?![\w#$-])') + sub = words(( + 'params', 'meta', 'operations', 'op', 'rule', + 'attributes', 'utilization'), suffix=r'(?![\w#$-])') + acl = words(('read', 'write', 'deny'), suffix=r'(?![\w#$-])') + bin_rel = words(('and', 'or'), suffix=r'(?![\w#$-])') + un_ops = words(('defined', 'not_defined'), suffix=r'(?![\w#$-])') + date_exp = words(('in_range', 'date', 'spec', 'in'), suffix=r'(?![\w#$-])') + acl_mod = (r'(?:tag|ref|reference|attribute|type|xpath)') + bin_ops = (r'(?:lt|gt|lte|gte|eq|ne)') + val_qual = (r'(?:string|version|number)') + rsc_role_action = (r'(?:Master|Started|Slave|Stopped|' + r'start|promote|demote|stop)') + + tokens = { + 'root': [ + (r'^#.*\n?', Comment), + # attr=value (nvpair) + (r'([\w#$-]+)(=)("(?:""|[^"])*"|\S+)', + bygroups(Name.Attribute, Punctuation, String)), + # need this construct, otherwise numeric node ids + # are matched as scores + # elem id: + (r'(node)(\s+)([\w#$-]+)(:)', + bygroups(Keyword, Whitespace, Name, Punctuation)), + # scores + (r'([+-]?([0-9]+|inf)):', Number), + # keywords (elements and other) + (elem, Keyword), + (sub, Keyword), + (acl, Keyword), + # binary operators + (r'(?:%s:)?(%s)(?![\w#$-])' % (val_qual, bin_ops), Operator.Word), + # other operators + (bin_rel, Operator.Word), + (un_ops, Operator.Word), + (date_exp, Operator.Word), + # builtin attributes (e.g. #uname) + (r'#[a-z]+(?![\w#$-])', Name.Builtin), + # acl_mod:blah + (r'(%s)(:)("(?:""|[^"])*"|\S+)' % acl_mod, + bygroups(Keyword, Punctuation, Name)), + # rsc_id[:(role|action)] + # NB: this matches all other identifiers + (r'([\w#$-]+)(?:(:)(%s))?(?![\w#$-])' % rsc_role_action, + bygroups(Name, Punctuation, Operator.Word)), + # punctuation + (r'(\\(?=\n)|[[\](){}/:@])', Punctuation), + (r'\s+|\n', Whitespace), + ], + } + + +class FlatlineLexer(RegexLexer): + """ + Lexer for `Flatline `_ expressions. + + .. versionadded:: 2.2 + """ + name = 'Flatline' + aliases = ['flatline'] + filenames = [] + mimetypes = ['text/x-flatline'] + + special_forms = ('let',) + + builtins = ( + "!=", "*", "+", "-", "<", "<=", "=", ">", ">=", "abs", "acos", "all", + "all-but", "all-with-defaults", "all-with-numeric-default", "and", + "asin", "atan", "avg", "avg-window", "bin-center", "bin-count", "call", + "category-count", "ceil", "cond", "cond-window", "cons", "cos", "cosh", + "count", "diff-window", "div", "ensure-value", "ensure-weighted-value", + "epoch", "epoch-day", "epoch-fields", "epoch-hour", "epoch-millisecond", + "epoch-minute", "epoch-month", "epoch-second", "epoch-weekday", + "epoch-year", "exp", "f", "field", "field-prop", "fields", "filter", + "first", "floor", "head", "if", "in", "integer", "language", "length", + "levenshtein", "linear-regression", "list", "ln", "log", "log10", "map", + "matches", "matches?", "max", "maximum", "md5", "mean", "median", "min", + "minimum", "missing", "missing-count", "missing?", "missing_count", + "mod", "mode", "normalize", "not", "nth", "occurrences", "or", + "percentile", "percentile-label", "population", "population-fraction", + "pow", "preferred", "preferred?", "quantile-label", "rand", "rand-int", + "random-value", "re-quote", "real", "replace", "replace-first", "rest", + "round", "row-number", "segment-label", "sha1", "sha256", "sin", "sinh", + "sqrt", "square", "standard-deviation", "standard_deviation", "str", + "subs", "sum", "sum-squares", "sum-window", "sum_squares", "summary", + "summary-no", "summary-str", "tail", "tan", "tanh", "to-degrees", + "to-radians", "variance", "vectorize", "weighted-random-value", "window", + "winnow", "within-percentiles?", "z-score", + ) + + valid_name = r'(?!#)[\w!$%*+<=>?/.#-]+' + + tokens = { + 'root': [ + # whitespaces - usually not relevant + (r'[,\s]+', Text), + + # numbers + (r'-?\d+\.\d+', Number.Float), + (r'-?\d+', Number.Integer), + (r'0x-?[a-f\d]+', Number.Hex), + + # strings, symbols and characters + (r'"(\\\\|\\"|[^"])*"', String), + (r"\\(.|[a-z]+)", String.Char), + + # expression template placeholder + (r'_', String.Symbol), + + # highlight the special forms + (words(special_forms, suffix=' '), Keyword), + + # highlight the builtins + (words(builtins, suffix=' '), Name.Builtin), + + # the remaining functions + (r'(?<=\()' + valid_name, Name.Function), + + # find the remaining variables + (valid_name, Name.Variable), + + # parentheses + (r'(\(|\))', Punctuation), + ], + } + + +class SnowballLexer(ExtendedRegexLexer): + """ + Lexer for `Snowball `_ source code. + + .. versionadded:: 2.2 + """ + + name = 'Snowball' + aliases = ['snowball'] + filenames = ['*.sbl'] + + _ws = r'\n\r\t ' + + def __init__(self, **options): + self._reset_stringescapes() + ExtendedRegexLexer.__init__(self, **options) + + def _reset_stringescapes(self): + self._start = "'" + self._end = "'" + + def _string(do_string_first): + def callback(lexer, match, ctx): + s = match.start() + text = match.group() + string = re.compile(r'([^%s]*)(.)' % re.escape(lexer._start)).match + escape = re.compile(r'([^%s]*)(.)' % re.escape(lexer._end)).match + pos = 0 + do_string = do_string_first + while pos < len(text): + if do_string: + match = string(text, pos) + yield s + match.start(1), String.Single, match.group(1) + if match.group(2) == "'": + yield s + match.start(2), String.Single, match.group(2) + ctx.stack.pop() + break + yield s + match.start(2), String.Escape, match.group(2) + pos = match.end() + match = escape(text, pos) + yield s + match.start(), String.Escape, match.group() + if match.group(2) != lexer._end: + ctx.stack[-1] = 'escape' + break + pos = match.end() + do_string = True + ctx.pos = s + match.end() + return callback + + def _stringescapes(lexer, match, ctx): + lexer._start = match.group(3) + lexer._end = match.group(5) + return bygroups(Keyword.Reserved, Text, String.Escape, Text, + String.Escape)(lexer, match, ctx) + + tokens = { + 'root': [ + (words(('len', 'lenof'), suffix=r'\b'), Operator.Word), + include('root1'), + ], + 'root1': [ + (r'[%s]+' % _ws, Text), + (r'\d+', Number.Integer), + (r"'", String.Single, 'string'), + (r'[()]', Punctuation), + (r'/\*[\w\W]*?\*/', Comment.Multiline), + (r'//.*', Comment.Single), + (r'[!*+\-/<=>]=|[-=]>|<[+-]|[$*+\-/<=>?\[\]]', Operator), + (words(('as', 'get', 'hex', 'among', 'define', 'decimal', + 'backwardmode'), suffix=r'\b'), + Keyword.Reserved), + (words(('strings', 'booleans', 'integers', 'routines', 'externals', + 'groupings'), suffix=r'\b'), + Keyword.Reserved, 'declaration'), + (words(('do', 'or', 'and', 'for', 'hop', 'non', 'not', 'set', 'try', + 'fail', 'goto', 'loop', 'next', 'test', 'true', + 'false', 'unset', 'atmark', 'attach', 'delete', 'gopast', + 'insert', 'repeat', 'sizeof', 'tomark', 'atleast', + 'atlimit', 'reverse', 'setmark', 'tolimit', 'setlimit', + 'backwards', 'substring'), suffix=r'\b'), + Operator.Word), + (words(('size', 'limit', 'cursor', 'maxint', 'minint'), + suffix=r'\b'), + Name.Builtin), + (r'(stringdef\b)([%s]*)([^%s]+)' % (_ws, _ws), + bygroups(Keyword.Reserved, Text, String.Escape)), + (r'(stringescapes\b)([%s]*)(.)([%s]*)(.)' % (_ws, _ws), + _stringescapes), + (r'[A-Za-z]\w*', Name), + ], + 'declaration': [ + (r'\)', Punctuation, '#pop'), + (words(('len', 'lenof'), suffix=r'\b'), Name, + ('root1', 'declaration')), + include('root1'), + ], + 'string': [ + (r"[^']*'", _string(True)), + ], + 'escape': [ + (r"[^']*'", _string(False)), + ], + } + + def get_tokens_unprocessed(self, text=None, context=None): + self._reset_stringescapes() + return ExtendedRegexLexer.get_tokens_unprocessed(self, text, context) diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/dylan.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/dylan.py new file mode 100644 index 0000000000000000000000000000000000000000..f61bb60d162282c73af505ea649f13064ab557c5 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/dylan.py @@ -0,0 +1,289 @@ +# -*- coding: utf-8 -*- +""" + pygments.lexers.dylan + ~~~~~~~~~~~~~~~~~~~~~ + + Lexers for the Dylan language. + + :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS. + :license: BSD, see LICENSE for details. +""" + +import re + +from pygments.lexer import Lexer, RegexLexer, bygroups, do_insertions, default +from pygments.token import Text, Comment, Operator, Keyword, Name, String, \ + Number, Punctuation, Generic, Literal + +__all__ = ['DylanLexer', 'DylanConsoleLexer', 'DylanLidLexer'] + + +class DylanLexer(RegexLexer): + """ + For the `Dylan `_ language. + + .. versionadded:: 0.7 + """ + + name = 'Dylan' + aliases = ['dylan'] + filenames = ['*.dylan', '*.dyl', '*.intr'] + mimetypes = ['text/x-dylan'] + + flags = re.IGNORECASE + + builtins = set(( + 'subclass', 'abstract', 'block', 'concrete', 'constant', 'class', + 'compiler-open', 'compiler-sideways', 'domain', 'dynamic', + 'each-subclass', 'exception', 'exclude', 'function', 'generic', + 'handler', 'inherited', 'inline', 'inline-only', 'instance', + 'interface', 'import', 'keyword', 'library', 'macro', 'method', + 'module', 'open', 'primary', 'required', 'sealed', 'sideways', + 'singleton', 'slot', 'thread', 'variable', 'virtual')) + + keywords = set(( + 'above', 'afterwards', 'begin', 'below', 'by', 'case', 'cleanup', + 'create', 'define', 'else', 'elseif', 'end', 'export', 'finally', + 'for', 'from', 'if', 'in', 'let', 'local', 'otherwise', 'rename', + 'select', 'signal', 'then', 'to', 'unless', 'until', 'use', 'when', + 'while')) + + operators = set(( + '~', '+', '-', '*', '|', '^', '=', '==', '~=', '~==', '<', '<=', + '>', '>=', '&', '|')) + + functions = set(( + 'abort', 'abs', 'add', 'add!', 'add-method', 'add-new', 'add-new!', + 'all-superclasses', 'always', 'any?', 'applicable-method?', 'apply', + 'aref', 'aref-setter', 'as', 'as-lowercase', 'as-lowercase!', + 'as-uppercase', 'as-uppercase!', 'ash', 'backward-iteration-protocol', + 'break', 'ceiling', 'ceiling/', 'cerror', 'check-type', 'choose', + 'choose-by', 'complement', 'compose', 'concatenate', 'concatenate-as', + 'condition-format-arguments', 'condition-format-string', 'conjoin', + 'copy-sequence', 'curry', 'default-handler', 'dimension', 'dimensions', + 'direct-subclasses', 'direct-superclasses', 'disjoin', 'do', + 'do-handlers', 'element', 'element-setter', 'empty?', 'error', 'even?', + 'every?', 'false-or', 'fill!', 'find-key', 'find-method', 'first', + 'first-setter', 'floor', 'floor/', 'forward-iteration-protocol', + 'function-arguments', 'function-return-values', + 'function-specializers', 'gcd', 'generic-function-mandatory-keywords', + 'generic-function-methods', 'head', 'head-setter', 'identity', + 'initialize', 'instance?', 'integral?', 'intersection', + 'key-sequence', 'key-test', 'last', 'last-setter', 'lcm', 'limited', + 'list', 'logand', 'logbit?', 'logior', 'lognot', 'logxor', 'make', + 'map', 'map-as', 'map-into', 'max', 'member?', 'merge-hash-codes', + 'min', 'modulo', 'negative', 'negative?', 'next-method', + 'object-class', 'object-hash', 'odd?', 'one-of', 'pair', 'pop', + 'pop-last', 'positive?', 'push', 'push-last', 'range', 'rank', + 'rcurry', 'reduce', 'reduce1', 'remainder', 'remove', 'remove!', + 'remove-duplicates', 'remove-duplicates!', 'remove-key!', + 'remove-method', 'replace-elements!', 'replace-subsequence!', + 'restart-query', 'return-allowed?', 'return-description', + 'return-query', 'reverse', 'reverse!', 'round', 'round/', + 'row-major-index', 'second', 'second-setter', 'shallow-copy', + 'signal', 'singleton', 'size', 'size-setter', 'slot-initialized?', + 'sort', 'sort!', 'sorted-applicable-methods', 'subsequence-position', + 'subtype?', 'table-protocol', 'tail', 'tail-setter', 'third', + 'third-setter', 'truncate', 'truncate/', 'type-error-expected-type', + 'type-error-value', 'type-for-copy', 'type-union', 'union', 'values', + 'vector', 'zero?')) + + valid_name = '\\\\?[\\w!&*<>|^$%@\\-+~?/=]+' + + def get_tokens_unprocessed(self, text): + for index, token, value in RegexLexer.get_tokens_unprocessed(self, text): + if token is Name: + lowercase_value = value.lower() + if lowercase_value in self.builtins: + yield index, Name.Builtin, value + continue + if lowercase_value in self.keywords: + yield index, Keyword, value + continue + if lowercase_value in self.functions: + yield index, Name.Builtin, value + continue + if lowercase_value in self.operators: + yield index, Operator, value + continue + yield index, token, value + + tokens = { + 'root': [ + # Whitespace + (r'\s+', Text), + + # single line comment + (r'//.*?\n', Comment.Single), + + # lid header + (r'([a-z0-9-]+)(:)([ \t]*)(.*(?:\n[ \t].+)*)', + bygroups(Name.Attribute, Operator, Text, String)), + + default('code') # no header match, switch to code + ], + 'code': [ + # Whitespace + (r'\s+', Text), + + # single line comment + (r'//.*?\n', Comment.Single), + + # multi-line comment + (r'/\*', Comment.Multiline, 'comment'), + + # strings and characters + (r'"', String, 'string'), + (r"'(\\.|\\[0-7]{1,3}|\\x[a-f0-9]{1,2}|[^\\\'\n])'", String.Char), + + # binary integer + (r'#b[01]+', Number.Bin), + + # octal integer + (r'#o[0-7]+', Number.Oct), + + # floating point + (r'[-+]?(\d*\.\d+(e[-+]?\d+)?|\d+(\.\d*)?e[-+]?\d+)', Number.Float), + + # decimal integer + (r'[-+]?\d+', Number.Integer), + + # hex integer + (r'#x[0-9a-f]+', Number.Hex), + + # Macro parameters + (r'(\?' + valid_name + ')(:)' + r'(token|name|variable|expression|body|case-body|\*)', + bygroups(Name.Tag, Operator, Name.Builtin)), + (r'(\?)(:)(token|name|variable|expression|body|case-body|\*)', + bygroups(Name.Tag, Operator, Name.Builtin)), + (r'\?' + valid_name, Name.Tag), + + # Punctuation + (r'(=>|::|#\(|#\[|##|\?\?|\?=|\?|[(){}\[\],.;])', Punctuation), + + # Most operators are picked up as names and then re-flagged. + # This one isn't valid in a name though, so we pick it up now. + (r':=', Operator), + + # Pick up #t / #f before we match other stuff with #. + (r'#[tf]', Literal), + + # #"foo" style keywords + (r'#"', String.Symbol, 'keyword'), + + # #rest, #key, #all-keys, etc. + (r'#[a-z0-9-]+', Keyword), + + # required-init-keyword: style keywords. + (valid_name + ':', Keyword), + + # class names + (r'<' + valid_name + '>', Name.Class), + + # define variable forms. + (r'\*' + valid_name + '\*', Name.Variable.Global), + + # define constant forms. + (r'\$' + valid_name, Name.Constant), + + # everything else. We re-flag some of these in the method above. + (valid_name, Name), + ], + 'comment': [ + (r'[^*/]', Comment.Multiline), + (r'/\*', Comment.Multiline, '#push'), + (r'\*/', Comment.Multiline, '#pop'), + (r'[*/]', Comment.Multiline) + ], + 'keyword': [ + (r'"', String.Symbol, '#pop'), + (r'[^\\"]+', String.Symbol), # all other characters + ], + 'string': [ + (r'"', String, '#pop'), + (r'\\([\\abfnrtv"\']|x[a-f0-9]{2,4}|[0-7]{1,3})', String.Escape), + (r'[^\\"\n]+', String), # all other characters + (r'\\\n', String), # line continuation + (r'\\', String), # stray backslash + ] + } + + +class DylanLidLexer(RegexLexer): + """ + For Dylan LID (Library Interchange Definition) files. + + .. versionadded:: 1.6 + """ + + name = 'DylanLID' + aliases = ['dylan-lid', 'lid'] + filenames = ['*.lid', '*.hdp'] + mimetypes = ['text/x-dylan-lid'] + + flags = re.IGNORECASE + + tokens = { + 'root': [ + # Whitespace + (r'\s+', Text), + + # single line comment + (r'//.*?\n', Comment.Single), + + # lid header + (r'(.*?)(:)([ \t]*)(.*(?:\n[ \t].+)*)', + bygroups(Name.Attribute, Operator, Text, String)), + ] + } + + +class DylanConsoleLexer(Lexer): + """ + For Dylan interactive console output like: + + .. sourcecode:: dylan-console + + ? let a = 1; + => 1 + ? a + => 1 + + This is based on a copy of the RubyConsoleLexer. + + .. versionadded:: 1.6 + """ + name = 'Dylan session' + aliases = ['dylan-console', 'dylan-repl'] + filenames = ['*.dylan-console'] + mimetypes = ['text/x-dylan-console'] + + _line_re = re.compile('.*?\n') + _prompt_re = re.compile('\?| ') + + def get_tokens_unprocessed(self, text): + dylexer = DylanLexer(**self.options) + + curcode = '' + insertions = [] + for match in self._line_re.finditer(text): + line = match.group() + m = self._prompt_re.match(line) + if m is not None: + end = m.end() + insertions.append((len(curcode), + [(0, Generic.Prompt, line[:end])])) + curcode += line[end:] + else: + if curcode: + for item in do_insertions(insertions, + dylexer.get_tokens_unprocessed(curcode)): + yield item + curcode = '' + insertions = [] + yield match.start(), Generic.Output, line + if curcode: + for item in do_insertions(insertions, + dylexer.get_tokens_unprocessed(curcode)): + yield item diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/ecl.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/ecl.py new file mode 100644 index 0000000000000000000000000000000000000000..bd80ad19df4b7872e817a7d37447a077cf8eca00 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/ecl.py @@ -0,0 +1,125 @@ +# -*- coding: utf-8 -*- +""" + pygments.lexers.ecl + ~~~~~~~~~~~~~~~~~~~ + + Lexers for the ECL language. + + :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS. + :license: BSD, see LICENSE for details. +""" + +import re + +from pygments.lexer import RegexLexer, include, bygroups, words +from pygments.token import Text, Comment, Operator, Keyword, Name, String, \ + Number, Punctuation, Error + +__all__ = ['ECLLexer'] + + +class ECLLexer(RegexLexer): + """ + Lexer for the declarative big-data `ECL + `_ + language. + + .. versionadded:: 1.5 + """ + + name = 'ECL' + aliases = ['ecl'] + filenames = ['*.ecl'] + mimetypes = ['application/x-ecl'] + + flags = re.IGNORECASE | re.MULTILINE + + tokens = { + 'root': [ + include('whitespace'), + include('statements'), + ], + 'whitespace': [ + (r'\s+', Text), + (r'\/\/.*', Comment.Single), + (r'/(\\\n)?\*(.|\n)*?\*(\\\n)?/', Comment.Multiline), + ], + 'statements': [ + include('types'), + include('keywords'), + include('functions'), + include('hash'), + (r'"', String, 'string'), + (r'\'', String, 'string'), + (r'(\d+\.\d*|\.\d+|\d+)e[+-]?\d+[lu]*', Number.Float), + (r'(\d+\.\d*|\.\d+|\d+f)f?', Number.Float), + (r'0x[0-9a-f]+[lu]*', Number.Hex), + (r'0[0-7]+[lu]*', Number.Oct), + (r'\d+[lu]*', Number.Integer), + (r'\*/', Error), + (r'[~!%^&*+=|?:<>/-]+', Operator), + (r'[{}()\[\],.;]', Punctuation), + (r'[a-z_]\w*', Name), + ], + 'hash': [ + (r'^#.*$', Comment.Preproc), + ], + 'types': [ + (r'(RECORD|END)\D', Keyword.Declaration), + (r'((?:ASCII|BIG_ENDIAN|BOOLEAN|DATA|DECIMAL|EBCDIC|INTEGER|PATTERN|' + r'QSTRING|REAL|RECORD|RULE|SET OF|STRING|TOKEN|UDECIMAL|UNICODE|' + r'UNSIGNED|VARSTRING|VARUNICODE)\d*)(\s+)', + bygroups(Keyword.Type, Text)), + ], + 'keywords': [ + (words(( + 'APPLY', 'ASSERT', 'BUILD', 'BUILDINDEX', 'EVALUATE', 'FAIL', + 'KEYDIFF', 'KEYPATCH', 'LOADXML', 'NOTHOR', 'NOTIFY', 'OUTPUT', + 'PARALLEL', 'SEQUENTIAL', 'SOAPCALL', 'CHECKPOINT', 'DEPRECATED', + 'FAILCODE', 'FAILMESSAGE', 'FAILURE', 'GLOBAL', 'INDEPENDENT', + 'ONWARNING', 'PERSIST', 'PRIORITY', 'RECOVERY', 'STORED', 'SUCCESS', + 'WAIT', 'WHEN'), suffix=r'\b'), + Keyword.Reserved), + # These are classed differently, check later + (words(( + 'ALL', 'AND', 'ANY', 'AS', 'ATMOST', 'BEFORE', 'BEGINC++', 'BEST', 'BETWEEN', 'CASE', + 'CONST', 'COUNTER', 'CSV', 'DESCEND', 'ENCRYPT', 'ENDC++', 'ENDMACRO', 'EXCEPT', + 'EXCLUSIVE', 'EXPIRE', 'EXPORT', 'EXTEND', 'FALSE', 'FEW', 'FIRST', 'FLAT', 'FULL', + 'FUNCTION', 'GROUP', 'HEADER', 'HEADING', 'HOLE', 'IFBLOCK', 'IMPORT', 'IN', 'JOINED', + 'KEEP', 'KEYED', 'LAST', 'LEFT', 'LIMIT', 'LOAD', 'LOCAL', 'LOCALE', 'LOOKUP', 'MACRO', + 'MANY', 'MAXCOUNT', 'MAXLENGTH', 'MIN SKEW', 'MODULE', 'INTERFACE', 'NAMED', 'NOCASE', + 'NOROOT', 'NOSCAN', 'NOSORT', 'NOT', 'OF', 'ONLY', 'OPT', 'OR', 'OUTER', 'OVERWRITE', + 'PACKED', 'PARTITION', 'PENALTY', 'PHYSICALLENGTH', 'PIPE', 'QUOTE', 'RELATIONSHIP', + 'REPEAT', 'RETURN', 'RIGHT', 'SCAN', 'SELF', 'SEPARATOR', 'SERVICE', 'SHARED', 'SKEW', + 'SKIP', 'SQL', 'STORE', 'TERMINATOR', 'THOR', 'THRESHOLD', 'TOKEN', 'TRANSFORM', 'TRIM', + 'TRUE', 'TYPE', 'UNICODEORDER', 'UNSORTED', 'VALIDATE', 'VIRTUAL', 'WHOLE', 'WILD', + 'WITHIN', 'XML', 'XPATH', '__COMPRESSED__'), suffix=r'\b'), + Keyword.Reserved), + ], + 'functions': [ + (words(( + 'ABS', 'ACOS', 'ALLNODES', 'ASCII', 'ASIN', 'ASSTRING', 'ATAN', 'ATAN2', 'AVE', 'CASE', + 'CHOOSE', 'CHOOSEN', 'CHOOSESETS', 'CLUSTERSIZE', 'COMBINE', 'CORRELATION', 'COS', + 'COSH', 'COUNT', 'COVARIANCE', 'CRON', 'DATASET', 'DEDUP', 'DEFINE', 'DENORMALIZE', + 'DISTRIBUTE', 'DISTRIBUTED', 'DISTRIBUTION', 'EBCDIC', 'ENTH', 'ERROR', 'EVALUATE', + 'EVENT', 'EVENTEXTRA', 'EVENTNAME', 'EXISTS', 'EXP', 'FAILCODE', 'FAILMESSAGE', + 'FETCH', 'FROMUNICODE', 'GETISVALID', 'GLOBAL', 'GRAPH', 'GROUP', 'HASH', 'HASH32', + 'HASH64', 'HASHCRC', 'HASHMD5', 'HAVING', 'IF', 'INDEX', 'INTFORMAT', 'ISVALID', + 'ITERATE', 'JOIN', 'KEYUNICODE', 'LENGTH', 'LIBRARY', 'LIMIT', 'LN', 'LOCAL', 'LOG', 'LOOP', + 'MAP', 'MATCHED', 'MATCHLENGTH', 'MATCHPOSITION', 'MATCHTEXT', 'MATCHUNICODE', + 'MAX', 'MERGE', 'MERGEJOIN', 'MIN', 'NOLOCAL', 'NONEMPTY', 'NORMALIZE', 'PARSE', 'PIPE', + 'POWER', 'PRELOAD', 'PROCESS', 'PROJECT', 'PULL', 'RANDOM', 'RANGE', 'RANK', 'RANKED', + 'REALFORMAT', 'RECORDOF', 'REGEXFIND', 'REGEXREPLACE', 'REGROUP', 'REJECTED', + 'ROLLUP', 'ROUND', 'ROUNDUP', 'ROW', 'ROWDIFF', 'SAMPLE', 'SET', 'SIN', 'SINH', 'SIZEOF', + 'SOAPCALL', 'SORT', 'SORTED', 'SQRT', 'STEPPED', 'STORED', 'SUM', 'TABLE', 'TAN', 'TANH', + 'THISNODE', 'TOPN', 'TOUNICODE', 'TRANSFER', 'TRIM', 'TRUNCATE', 'TYPEOF', 'UNGROUP', + 'UNICODEORDER', 'VARIANCE', 'WHICH', 'WORKUNIT', 'XMLDECODE', 'XMLENCODE', + 'XMLTEXT', 'XMLUNICODE'), suffix=r'\b'), + Name.Function), + ], + 'string': [ + (r'"', String, '#pop'), + (r'\'', String, '#pop'), + (r'[^"\']+', String), + ], + } diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/eiffel.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/eiffel.py new file mode 100644 index 0000000000000000000000000000000000000000..a90ab0a5535599649c4e63043bd03a6dcc6c3f13 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/eiffel.py @@ -0,0 +1,65 @@ +# -*- coding: utf-8 -*- +""" + pygments.lexers.eiffel + ~~~~~~~~~~~~~~~~~~~~~~ + + Lexer for the Eiffel language. + + :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS. + :license: BSD, see LICENSE for details. +""" + +from pygments.lexer import RegexLexer, include, words +from pygments.token import Text, Comment, Operator, Keyword, Name, String, \ + Number, Punctuation + +__all__ = ['EiffelLexer'] + + +class EiffelLexer(RegexLexer): + """ + For `Eiffel `_ source code. + + .. versionadded:: 2.0 + """ + name = 'Eiffel' + aliases = ['eiffel'] + filenames = ['*.e'] + mimetypes = ['text/x-eiffel'] + + tokens = { + 'root': [ + (r'[^\S\n]+', Text), + (r'--.*?\n', Comment.Single), + (r'[^\S\n]+', Text), + # Please note that keyword and operator are case insensitive. + (r'(?i)(true|false|void|current|result|precursor)\b', Keyword.Constant), + (r'(?i)(and(\s+then)?|not|xor|implies|or(\s+else)?)\b', Operator.Word), + (words(( + 'across', 'agent', 'alias', 'all', 'as', 'assign', 'attached', + 'attribute', 'check', 'class', 'convert', 'create', 'debug', + 'deferred', 'detachable', 'do', 'else', 'elseif', 'end', 'ensure', + 'expanded', 'export', 'external', 'feature', 'from', 'frozen', 'if', + 'inherit', 'inspect', 'invariant', 'like', 'local', 'loop', 'none', + 'note', 'obsolete', 'old', 'once', 'only', 'redefine', 'rename', + 'require', 'rescue', 'retry', 'select', 'separate', 'then', + 'undefine', 'until', 'variant', 'when'), prefix=r'(?i)\b', suffix=r'\b'), + Keyword.Reserved), + (r'"\[(([^\]%]|\n)|%(.|\n)|\][^"])*?\]"', String), + (r'"([^"%\n]|%.)*?"', String), + include('numbers'), + (r"'([^'%]|%'|%%)'", String.Char), + (r"(//|\\\\|>=|<=|:=|/=|~|/~|[\\?!#%&@|+/\-=>*$<^\[\]])", Operator), + (r"([{}():;,.])", Punctuation), + (r'([a-z]\w*)|([A-Z][A-Z0-9_]*[a-z]\w*)', Name), + (r'([A-Z][A-Z0-9_]*)', Name.Class), + (r'\n+', Text), + ], + 'numbers': [ + (r'0[xX][a-fA-F0-9]+', Number.Hex), + (r'0[bB][01]+', Number.Bin), + (r'0[cC][0-7]+', Number.Oct), + (r'([0-9]+\.[0-9]*)|([0-9]*\.[0-9]+)', Number.Float), + (r'[0-9]+', Number.Integer), + ], + } diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/elm.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/elm.py new file mode 100644 index 0000000000000000000000000000000000000000..0fa36367880ee572e60dff018278dd26881fc3a1 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/elm.py @@ -0,0 +1,121 @@ +# -*- coding: utf-8 -*- +""" + pygments.lexers.elm + ~~~~~~~~~~~~~~~~~~~ + + Lexer for the Elm programming language. + + :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS. + :license: BSD, see LICENSE for details. +""" + +from pygments.lexer import RegexLexer, words, include +from pygments.token import Comment, Keyword, Name, Number, Punctuation, String, Text + +__all__ = ['ElmLexer'] + + +class ElmLexer(RegexLexer): + """ + For `Elm `_ source code. + + .. versionadded:: 2.1 + """ + + name = 'Elm' + aliases = ['elm'] + filenames = ['*.elm'] + mimetypes = ['text/x-elm'] + + validName = r'[a-z_][a-zA-Z_\']*' + + specialName = r'^main ' + + builtinOps = ( + '~', '||', '|>', '|', '`', '^', '\\', '\'', '>>', '>=', '>', '==', + '=', '<~', '<|', '<=', '<<', '<-', '<', '::', ':', '/=', '//', '/', + '..', '.', '->', '-', '++', '+', '*', '&&', '%', + ) + + reservedWords = words(( + 'alias', 'as', 'case', 'else', 'if', 'import', 'in', + 'let', 'module', 'of', 'port', 'then', 'type', 'where', + ), suffix=r'\b') + + tokens = { + 'root': [ + + # Comments + (r'\{-', Comment.Multiline, 'comment'), + (r'--.*', Comment.Single), + + # Whitespace + (r'\s+', Text), + + # Strings + (r'"', String, 'doublequote'), + + # Modules + (r'^\s*module\s*', Keyword.Namespace, 'imports'), + + # Imports + (r'^\s*import\s*', Keyword.Namespace, 'imports'), + + # Shaders + (r'\[glsl\|.*', Name.Entity, 'shader'), + + # Keywords + (reservedWords, Keyword.Reserved), + + # Types + (r'[A-Z]\w*', Keyword.Type), + + # Main + (specialName, Keyword.Reserved), + + # Prefix Operators + (words((builtinOps), prefix=r'\(', suffix=r'\)'), Name.Function), + + # Infix Operators + (words((builtinOps)), Name.Function), + + # Numbers + include('numbers'), + + # Variable Names + (validName, Name.Variable), + + # Parens + (r'[,()\[\]{}]', Punctuation), + + ], + + 'comment': [ + (r'-(?!\})', Comment.Multiline), + (r'\{-', Comment.Multiline, 'comment'), + (r'[^-}]', Comment.Multiline), + (r'-\}', Comment.Multiline, '#pop'), + ], + + 'doublequote': [ + (r'\\u[0-9a-fA-F]{4}', String.Escape), + (r'\\[nrfvb\\"]', String.Escape), + (r'[^"]', String), + (r'"', String, '#pop'), + ], + + 'imports': [ + (r'\w+(\.\w+)*', Name.Class, '#pop'), + ], + + 'numbers': [ + (r'_?\d+\.(?=\d+)', Number.Float), + (r'_?\d+', Number.Integer), + ], + + 'shader': [ + (r'\|(?!\])', Name.Entity), + (r'\|\]', Name.Entity, '#pop'), + (r'.*\n', Name.Entity), + ], + } diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/erlang.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/erlang.py new file mode 100644 index 0000000000000000000000000000000000000000..9e7f85c1adaec89a7dee56a511388858a17a2926 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/erlang.py @@ -0,0 +1,533 @@ +# -*- coding: utf-8 -*- +""" + pygments.lexers.erlang + ~~~~~~~~~~~~~~~~~~~~~~ + + Lexers for Erlang. + + :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS. + :license: BSD, see LICENSE for details. +""" + +import re + +from pygments.lexer import Lexer, RegexLexer, bygroups, words, do_insertions, \ + include, default +from pygments.token import Text, Comment, Operator, Keyword, Name, String, \ + Number, Punctuation, Generic + +__all__ = ['ErlangLexer', 'ErlangShellLexer', 'ElixirConsoleLexer', + 'ElixirLexer'] + + +line_re = re.compile('.*?\n') + + +class ErlangLexer(RegexLexer): + """ + For the Erlang functional programming language. + + Blame Jeremy Thurgood (http://jerith.za.net/). + + .. versionadded:: 0.9 + """ + + name = 'Erlang' + aliases = ['erlang'] + filenames = ['*.erl', '*.hrl', '*.es', '*.escript'] + mimetypes = ['text/x-erlang'] + + keywords = ( + 'after', 'begin', 'case', 'catch', 'cond', 'end', 'fun', 'if', + 'let', 'of', 'query', 'receive', 'try', 'when', + ) + + builtins = ( # See erlang(3) man page + 'abs', 'append_element', 'apply', 'atom_to_list', 'binary_to_list', + 'bitstring_to_list', 'binary_to_term', 'bit_size', 'bump_reductions', + 'byte_size', 'cancel_timer', 'check_process_code', 'delete_module', + 'demonitor', 'disconnect_node', 'display', 'element', 'erase', 'exit', + 'float', 'float_to_list', 'fun_info', 'fun_to_list', + 'function_exported', 'garbage_collect', 'get', 'get_keys', + 'group_leader', 'hash', 'hd', 'integer_to_list', 'iolist_to_binary', + 'iolist_size', 'is_atom', 'is_binary', 'is_bitstring', 'is_boolean', + 'is_builtin', 'is_float', 'is_function', 'is_integer', 'is_list', + 'is_number', 'is_pid', 'is_port', 'is_process_alive', 'is_record', + 'is_reference', 'is_tuple', 'length', 'link', 'list_to_atom', + 'list_to_binary', 'list_to_bitstring', 'list_to_existing_atom', + 'list_to_float', 'list_to_integer', 'list_to_pid', 'list_to_tuple', + 'load_module', 'localtime_to_universaltime', 'make_tuple', 'md5', + 'md5_final', 'md5_update', 'memory', 'module_loaded', 'monitor', + 'monitor_node', 'node', 'nodes', 'open_port', 'phash', 'phash2', + 'pid_to_list', 'port_close', 'port_command', 'port_connect', + 'port_control', 'port_call', 'port_info', 'port_to_list', + 'process_display', 'process_flag', 'process_info', 'purge_module', + 'put', 'read_timer', 'ref_to_list', 'register', 'resume_process', + 'round', 'send', 'send_after', 'send_nosuspend', 'set_cookie', + 'setelement', 'size', 'spawn', 'spawn_link', 'spawn_monitor', + 'spawn_opt', 'split_binary', 'start_timer', 'statistics', + 'suspend_process', 'system_flag', 'system_info', 'system_monitor', + 'system_profile', 'term_to_binary', 'tl', 'trace', 'trace_delivered', + 'trace_info', 'trace_pattern', 'trunc', 'tuple_size', 'tuple_to_list', + 'universaltime_to_localtime', 'unlink', 'unregister', 'whereis' + ) + + operators = r'(\+\+?|--?|\*|/|<|>|/=|=:=|=/=|=<|>=|==?|<-|!|\?)' + word_operators = ( + 'and', 'andalso', 'band', 'bnot', 'bor', 'bsl', 'bsr', 'bxor', + 'div', 'not', 'or', 'orelse', 'rem', 'xor' + ) + + atom_re = r"(?:[a-z]\w*|'[^\n']*[^\\]')" + + variable_re = r'(?:[A-Z_]\w*)' + + esc_char_re = r'[bdefnrstv\'"\\]' + esc_octal_re = r'[0-7][0-7]?[0-7]?' + esc_hex_re = r'(?:x[0-9a-fA-F]{2}|x\{[0-9a-fA-F]+\})' + esc_ctrl_re = r'\^[a-zA-Z]' + escape_re = r'(?:\\(?:'+esc_char_re+r'|'+esc_octal_re+r'|'+esc_hex_re+r'|'+esc_ctrl_re+r'))' + + macro_re = r'(?:'+variable_re+r'|'+atom_re+r')' + + base_re = r'(?:[2-9]|[12][0-9]|3[0-6])' + + tokens = { + 'root': [ + (r'\s+', Text), + (r'%.*\n', Comment), + (words(keywords, suffix=r'\b'), Keyword), + (words(builtins, suffix=r'\b'), Name.Builtin), + (words(word_operators, suffix=r'\b'), Operator.Word), + (r'^-', Punctuation, 'directive'), + (operators, Operator), + (r'"', String, 'string'), + (r'<<', Name.Label), + (r'>>', Name.Label), + ('(' + atom_re + ')(:)', bygroups(Name.Namespace, Punctuation)), + ('(?:^|(?<=:))(' + atom_re + r')(\s*)(\()', + bygroups(Name.Function, Text, Punctuation)), + (r'[+-]?' + base_re + r'#[0-9a-zA-Z]+', Number.Integer), + (r'[+-]?\d+', Number.Integer), + (r'[+-]?\d+.\d+', Number.Float), + (r'[]\[:_@\".{}()|;,]', Punctuation), + (variable_re, Name.Variable), + (atom_re, Name), + (r'\?'+macro_re, Name.Constant), + (r'\$(?:'+escape_re+r'|\\[ %]|[^\\])', String.Char), + (r'#'+atom_re+r'(:?\.'+atom_re+r')?', Name.Label), + + # Erlang script shebang + (r'\A#!.+\n', Comment.Hashbang), + + # EEP 43: Maps + # http://www.erlang.org/eeps/eep-0043.html + (r'#\{', Punctuation, 'map_key'), + ], + 'string': [ + (escape_re, String.Escape), + (r'"', String, '#pop'), + (r'~[0-9.*]*[~#+BPWXb-ginpswx]', String.Interpol), + (r'[^"\\~]+', String), + (r'~', String), + ], + 'directive': [ + (r'(define)(\s*)(\()('+macro_re+r')', + bygroups(Name.Entity, Text, Punctuation, Name.Constant), '#pop'), + (r'(record)(\s*)(\()('+macro_re+r')', + bygroups(Name.Entity, Text, Punctuation, Name.Label), '#pop'), + (atom_re, Name.Entity, '#pop'), + ], + 'map_key': [ + include('root'), + (r'=>', Punctuation, 'map_val'), + (r':=', Punctuation, 'map_val'), + (r'\}', Punctuation, '#pop'), + ], + 'map_val': [ + include('root'), + (r',', Punctuation, '#pop'), + (r'(?=\})', Punctuation, '#pop'), + ], + } + + +class ErlangShellLexer(Lexer): + """ + Shell sessions in erl (for Erlang code). + + .. versionadded:: 1.1 + """ + name = 'Erlang erl session' + aliases = ['erl'] + filenames = ['*.erl-sh'] + mimetypes = ['text/x-erl-shellsession'] + + _prompt_re = re.compile(r'\d+>(?=\s|\Z)') + + def get_tokens_unprocessed(self, text): + erlexer = ErlangLexer(**self.options) + + curcode = '' + insertions = [] + for match in line_re.finditer(text): + line = match.group() + m = self._prompt_re.match(line) + if m is not None: + end = m.end() + insertions.append((len(curcode), + [(0, Generic.Prompt, line[:end])])) + curcode += line[end:] + else: + if curcode: + for item in do_insertions(insertions, + erlexer.get_tokens_unprocessed(curcode)): + yield item + curcode = '' + insertions = [] + if line.startswith('*'): + yield match.start(), Generic.Traceback, line + else: + yield match.start(), Generic.Output, line + if curcode: + for item in do_insertions(insertions, + erlexer.get_tokens_unprocessed(curcode)): + yield item + + +def gen_elixir_string_rules(name, symbol, token): + states = {} + states['string_' + name] = [ + (r'[^#%s\\]+' % (symbol,), token), + include('escapes'), + (r'\\.', token), + (r'(%s)' % (symbol,), bygroups(token), "#pop"), + include('interpol') + ] + return states + + +def gen_elixir_sigstr_rules(term, token, interpol=True): + if interpol: + return [ + (r'[^#%s\\]+' % (term,), token), + include('escapes'), + (r'\\.', token), + (r'%s[a-zA-Z]*' % (term,), token, '#pop'), + include('interpol') + ] + else: + return [ + (r'[^%s\\]+' % (term,), token), + (r'\\.', token), + (r'%s[a-zA-Z]*' % (term,), token, '#pop'), + ] + + +class ElixirLexer(RegexLexer): + """ + For the `Elixir language `_. + + .. versionadded:: 1.5 + """ + + name = 'Elixir' + aliases = ['elixir', 'ex', 'exs'] + filenames = ['*.ex', '*.exs'] + mimetypes = ['text/x-elixir'] + + KEYWORD = ('fn', 'do', 'end', 'after', 'else', 'rescue', 'catch') + KEYWORD_OPERATOR = ('not', 'and', 'or', 'when', 'in') + BUILTIN = ( + 'case', 'cond', 'for', 'if', 'unless', 'try', 'receive', 'raise', + 'quote', 'unquote', 'unquote_splicing', 'throw', 'super', + ) + BUILTIN_DECLARATION = ( + 'def', 'defp', 'defmodule', 'defprotocol', 'defmacro', 'defmacrop', + 'defdelegate', 'defexception', 'defstruct', 'defimpl', 'defcallback', + ) + + BUILTIN_NAMESPACE = ('import', 'require', 'use', 'alias') + CONSTANT = ('nil', 'true', 'false') + + PSEUDO_VAR = ('_', '__MODULE__', '__DIR__', '__ENV__', '__CALLER__') + + OPERATORS3 = ( + '<<<', '>>>', '|||', '&&&', '^^^', '~~~', '===', '!==', + '~>>', '<~>', '|~>', '<|>', + ) + OPERATORS2 = ( + '==', '!=', '<=', '>=', '&&', '||', '<>', '++', '--', '|>', '=~', + '->', '<-', '|', '.', '=', '~>', '<~', + ) + OPERATORS1 = ('<', '>', '+', '-', '*', '/', '!', '^', '&') + + PUNCTUATION = ( + '\\\\', '<<', '>>', '=>', '(', ')', ':', ';', ',', '[', ']', + ) + + def get_tokens_unprocessed(self, text): + for index, token, value in RegexLexer.get_tokens_unprocessed(self, text): + if token is Name: + if value in self.KEYWORD: + yield index, Keyword, value + elif value in self.KEYWORD_OPERATOR: + yield index, Operator.Word, value + elif value in self.BUILTIN: + yield index, Keyword, value + elif value in self.BUILTIN_DECLARATION: + yield index, Keyword.Declaration, value + elif value in self.BUILTIN_NAMESPACE: + yield index, Keyword.Namespace, value + elif value in self.CONSTANT: + yield index, Name.Constant, value + elif value in self.PSEUDO_VAR: + yield index, Name.Builtin.Pseudo, value + else: + yield index, token, value + else: + yield index, token, value + + def gen_elixir_sigil_rules(): + # all valid sigil terminators (excluding heredocs) + terminators = [ + (r'\{', r'\}', 'cb'), + (r'\[', r'\]', 'sb'), + (r'\(', r'\)', 'pa'), + (r'<', r'>', 'ab'), + (r'/', r'/', 'slas'), + (r'\|', r'\|', 'pipe'), + ('"', '"', 'quot'), + ("'", "'", 'apos'), + ] + + # heredocs have slightly different rules + triquotes = [(r'"""', 'triquot'), (r"'''", 'triapos')] + + token = String.Other + states = {'sigils': []} + + for term, name in triquotes: + states['sigils'] += [ + (r'(~[a-z])(%s)' % (term,), bygroups(token, String.Heredoc), + (name + '-end', name + '-intp')), + (r'(~[A-Z])(%s)' % (term,), bygroups(token, String.Heredoc), + (name + '-end', name + '-no-intp')), + ] + + states[name + '-end'] = [ + (r'[a-zA-Z]+', token, '#pop'), + default('#pop'), + ] + states[name + '-intp'] = [ + (r'^\s*' + term, String.Heredoc, '#pop'), + include('heredoc_interpol'), + ] + states[name + '-no-intp'] = [ + (r'^\s*' + term, String.Heredoc, '#pop'), + include('heredoc_no_interpol'), + ] + + for lterm, rterm, name in terminators: + states['sigils'] += [ + (r'~[a-z]' + lterm, token, name + '-intp'), + (r'~[A-Z]' + lterm, token, name + '-no-intp'), + ] + states[name + '-intp'] = gen_elixir_sigstr_rules(rterm, token) + states[name + '-no-intp'] = \ + gen_elixir_sigstr_rules(rterm, token, interpol=False) + + return states + + op3_re = "|".join(re.escape(s) for s in OPERATORS3) + op2_re = "|".join(re.escape(s) for s in OPERATORS2) + op1_re = "|".join(re.escape(s) for s in OPERATORS1) + ops_re = r'(?:%s|%s|%s)' % (op3_re, op2_re, op1_re) + punctuation_re = "|".join(re.escape(s) for s in PUNCTUATION) + alnum = '\w' + name_re = r'(?:\.\.\.|[a-z_]%s*[!?]?)' % alnum + modname_re = r'[A-Z]%(alnum)s*(?:\.[A-Z]%(alnum)s*)*' % {'alnum': alnum} + complex_name_re = r'(?:%s|%s|%s)' % (name_re, modname_re, ops_re) + special_atom_re = r'(?:\.\.\.|<<>>|%\{\}|%|\{\})' + + long_hex_char_re = r'(\\x\{)([\da-fA-F]+)(\})' + hex_char_re = r'(\\x[\da-fA-F]{1,2})' + escape_char_re = r'(\\[abdefnrstv])' + + tokens = { + 'root': [ + (r'\s+', Text), + (r'#.*$', Comment.Single), + + # Various kinds of characters + (r'(\?)' + long_hex_char_re, + bygroups(String.Char, + String.Escape, Number.Hex, String.Escape)), + (r'(\?)' + hex_char_re, + bygroups(String.Char, String.Escape)), + (r'(\?)' + escape_char_re, + bygroups(String.Char, String.Escape)), + (r'\?\\?.', String.Char), + + # '::' has to go before atoms + (r':::', String.Symbol), + (r'::', Operator), + + # atoms + (r':' + special_atom_re, String.Symbol), + (r':' + complex_name_re, String.Symbol), + (r':"', String.Symbol, 'string_double_atom'), + (r":'", String.Symbol, 'string_single_atom'), + + # [keywords: ...] + (r'(%s|%s)(:)(?=\s|\n)' % (special_atom_re, complex_name_re), + bygroups(String.Symbol, Punctuation)), + + # @attributes + (r'@' + name_re, Name.Attribute), + + # identifiers + (name_re, Name), + (r'(%%?)(%s)' % (modname_re,), bygroups(Punctuation, Name.Class)), + + # operators and punctuation + (op3_re, Operator), + (op2_re, Operator), + (punctuation_re, Punctuation), + (r'&\d', Name.Entity), # anon func arguments + (op1_re, Operator), + + # numbers + (r'0b[01]+', Number.Bin), + (r'0o[0-7]+', Number.Oct), + (r'0x[\da-fA-F]+', Number.Hex), + (r'\d(_?\d)*\.\d(_?\d)*([eE][-+]?\d(_?\d)*)?', Number.Float), + (r'\d(_?\d)*', Number.Integer), + + # strings and heredocs + (r'"""\s*', String.Heredoc, 'heredoc_double'), + (r"'''\s*$", String.Heredoc, 'heredoc_single'), + (r'"', String.Double, 'string_double'), + (r"'", String.Single, 'string_single'), + + include('sigils'), + + (r'%\{', Punctuation, 'map_key'), + (r'\{', Punctuation, 'tuple'), + ], + 'heredoc_double': [ + (r'^\s*"""', String.Heredoc, '#pop'), + include('heredoc_interpol'), + ], + 'heredoc_single': [ + (r"^\s*'''", String.Heredoc, '#pop'), + include('heredoc_interpol'), + ], + 'heredoc_interpol': [ + (r'[^#\\\n]+', String.Heredoc), + include('escapes'), + (r'\\.', String.Heredoc), + (r'\n+', String.Heredoc), + include('interpol'), + ], + 'heredoc_no_interpol': [ + (r'[^\\\n]+', String.Heredoc), + (r'\\.', String.Heredoc), + (r'\n+', String.Heredoc), + ], + 'escapes': [ + (long_hex_char_re, + bygroups(String.Escape, Number.Hex, String.Escape)), + (hex_char_re, String.Escape), + (escape_char_re, String.Escape), + ], + 'interpol': [ + (r'#\{', String.Interpol, 'interpol_string'), + ], + 'interpol_string': [ + (r'\}', String.Interpol, "#pop"), + include('root') + ], + 'map_key': [ + include('root'), + (r':', Punctuation, 'map_val'), + (r'=>', Punctuation, 'map_val'), + (r'\}', Punctuation, '#pop'), + ], + 'map_val': [ + include('root'), + (r',', Punctuation, '#pop'), + (r'(?=\})', Punctuation, '#pop'), + ], + 'tuple': [ + include('root'), + (r'\}', Punctuation, '#pop'), + ], + } + tokens.update(gen_elixir_string_rules('double', '"', String.Double)) + tokens.update(gen_elixir_string_rules('single', "'", String.Single)) + tokens.update(gen_elixir_string_rules('double_atom', '"', String.Symbol)) + tokens.update(gen_elixir_string_rules('single_atom', "'", String.Symbol)) + tokens.update(gen_elixir_sigil_rules()) + + +class ElixirConsoleLexer(Lexer): + """ + For Elixir interactive console (iex) output like: + + .. sourcecode:: iex + + iex> [head | tail] = [1,2,3] + [1,2,3] + iex> head + 1 + iex> tail + [2,3] + iex> [head | tail] + [1,2,3] + iex> length [head | tail] + 3 + + .. versionadded:: 1.5 + """ + + name = 'Elixir iex session' + aliases = ['iex'] + mimetypes = ['text/x-elixir-shellsession'] + + _prompt_re = re.compile('(iex|\.{3})(\(\d+\))?> ') + + def get_tokens_unprocessed(self, text): + exlexer = ElixirLexer(**self.options) + + curcode = '' + in_error = False + insertions = [] + for match in line_re.finditer(text): + line = match.group() + if line.startswith(u'** '): + in_error = True + insertions.append((len(curcode), + [(0, Generic.Error, line[:-1])])) + curcode += line[-1:] + else: + m = self._prompt_re.match(line) + if m is not None: + in_error = False + end = m.end() + insertions.append((len(curcode), + [(0, Generic.Prompt, line[:end])])) + curcode += line[end:] + else: + if curcode: + for item in do_insertions( + insertions, exlexer.get_tokens_unprocessed(curcode)): + yield item + curcode = '' + insertions = [] + token = Generic.Error if in_error else Generic.Output + yield match.start(), token, line + if curcode: + for item in do_insertions( + insertions, exlexer.get_tokens_unprocessed(curcode)): + yield item diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/esoteric.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/esoteric.py new file mode 100644 index 0000000000000000000000000000000000000000..793c28be4b038adbf0502ce0faa209e2a970d791 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/esoteric.py @@ -0,0 +1,277 @@ +# -*- coding: utf-8 -*- +""" + pygments.lexers.esoteric + ~~~~~~~~~~~~~~~~~~~~~~~~ + + Lexers for esoteric languages. + + :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS. + :license: BSD, see LICENSE for details. +""" + +from pygments.lexer import RegexLexer, include, words +from pygments.token import Text, Comment, Operator, Keyword, Name, String, \ + Number, Punctuation, Error + +__all__ = ['BrainfuckLexer', 'BefungeLexer', 'RedcodeLexer', 'CAmkESLexer', + 'CapDLLexer', 'AheuiLexer'] + + +class BrainfuckLexer(RegexLexer): + """ + Lexer for the esoteric `BrainFuck `_ + language. + """ + + name = 'Brainfuck' + aliases = ['brainfuck', 'bf'] + filenames = ['*.bf', '*.b'] + mimetypes = ['application/x-brainfuck'] + + tokens = { + 'common': [ + # use different colors for different instruction types + (r'[.,]+', Name.Tag), + (r'[+-]+', Name.Builtin), + (r'[<>]+', Name.Variable), + (r'[^.,+\-<>\[\]]+', Comment), + ], + 'root': [ + (r'\[', Keyword, 'loop'), + (r'\]', Error), + include('common'), + ], + 'loop': [ + (r'\[', Keyword, '#push'), + (r'\]', Keyword, '#pop'), + include('common'), + ] + } + + +class BefungeLexer(RegexLexer): + """ + Lexer for the esoteric `Befunge `_ + language. + + .. versionadded:: 0.7 + """ + name = 'Befunge' + aliases = ['befunge'] + filenames = ['*.befunge'] + mimetypes = ['application/x-befunge'] + + tokens = { + 'root': [ + (r'[0-9a-f]', Number), + (r'[+*/%!`-]', Operator), # Traditional math + (r'[<>^v?\[\]rxjk]', Name.Variable), # Move, imperatives + (r'[:\\$.,n]', Name.Builtin), # Stack ops, imperatives + (r'[|_mw]', Keyword), + (r'[{}]', Name.Tag), # Befunge-98 stack ops + (r'".*?"', String.Double), # Strings don't appear to allow escapes + (r'\'.', String.Single), # Single character + (r'[#;]', Comment), # Trampoline... depends on direction hit + (r'[pg&~=@iotsy]', Keyword), # Misc + (r'[()A-Z]', Comment), # Fingerprints + (r'\s+', Text), # Whitespace doesn't matter + ], + } + + +class CAmkESLexer(RegexLexer): + """ + Basic lexer for the input language for the + `CAmkES `_ component platform. + + .. versionadded:: 2.1 + """ + name = 'CAmkES' + aliases = ['camkes', 'idl4'] + filenames = ['*.camkes', '*.idl4'] + + tokens = { + 'root': [ + # C pre-processor directive + (r'^\s*#.*\n', Comment.Preproc), + + # Whitespace, comments + (r'\s+', Text), + (r'/\*(.|\n)*?\*/', Comment), + (r'//.*\n', Comment), + + (r'[\[(){},.;\]]', Punctuation), + (r'[~!%^&*+=|?:<>/-]', Operator), + + (words(('assembly', 'attribute', 'component', 'composition', + 'configuration', 'connection', 'connector', 'consumes', + 'control', 'dataport', 'Dataport', 'Dataports', 'emits', + 'event', 'Event', 'Events', 'export', 'from', 'group', + 'hardware', 'has', 'interface', 'Interface', 'maybe', + 'procedure', 'Procedure', 'Procedures', 'provides', + 'template', 'thread', 'threads', 'to', 'uses', 'with'), + suffix=r'\b'), Keyword), + + (words(('bool', 'boolean', 'Buf', 'char', 'character', 'double', + 'float', 'in', 'inout', 'int', 'int16_6', 'int32_t', + 'int64_t', 'int8_t', 'integer', 'mutex', 'out', 'real', + 'refin', 'semaphore', 'signed', 'string', 'struct', + 'uint16_t', 'uint32_t', 'uint64_t', 'uint8_t', 'uintptr_t', + 'unsigned', 'void'), + suffix=r'\b'), Keyword.Type), + + # Recognised attributes + (r'[a-zA-Z_]\w*_(priority|domain|buffer)', Keyword.Reserved), + (words(('dma_pool', 'from_access', 'to_access'), suffix=r'\b'), + Keyword.Reserved), + + # CAmkES-level include + (r'import\s+(<[^>]*>|"[^"]*");', Comment.Preproc), + + # C-level include + (r'include\s+(<[^>]*>|"[^"]*");', Comment.Preproc), + + # Literals + (r'0[xX][\da-fA-F]+', Number.Hex), + (r'-?[\d]+', Number), + (r'-?[\d]+\.[\d]+', Number.Float), + (r'"[^"]*"', String), + (r'[Tt]rue|[Ff]alse', Name.Builtin), + + # Identifiers + (r'[a-zA-Z_]\w*', Name), + ], + } + + +class CapDLLexer(RegexLexer): + """ + Basic lexer for + `CapDL `_. + + The source of the primary tool that reads such specifications is available + at https://github.com/seL4/capdl/tree/master/capDL-tool. Note that this + lexer only supports a subset of the grammar. For example, identifiers can + shadow type names, but these instances are currently incorrectly + highlighted as types. Supporting this would need a stateful lexer that is + considered unnecessarily complex for now. + + .. versionadded:: 2.2 + """ + name = 'CapDL' + aliases = ['capdl'] + filenames = ['*.cdl'] + + tokens = { + 'root': [ + # C pre-processor directive + (r'^\s*#.*\n', Comment.Preproc), + + # Whitespace, comments + (r'\s+', Text), + (r'/\*(.|\n)*?\*/', Comment), + (r'(//|--).*\n', Comment), + + (r'[<>\[(){},:;=\]]', Punctuation), + (r'\.\.', Punctuation), + + (words(('arch', 'arm11', 'caps', 'child_of', 'ia32', 'irq', 'maps', + 'objects'), suffix=r'\b'), Keyword), + + (words(('aep', 'asid_pool', 'cnode', 'ep', 'frame', 'io_device', + 'io_ports', 'io_pt', 'notification', 'pd', 'pt', 'tcb', + 'ut', 'vcpu'), suffix=r'\b'), Keyword.Type), + + # Properties + (words(('asid', 'addr', 'badge', 'cached', 'dom', 'domainID', 'elf', + 'fault_ep', 'G', 'guard', 'guard_size', 'init', 'ip', + 'prio', 'sp', 'R', 'RG', 'RX', 'RW', 'RWG', 'RWX', 'W', + 'WG', 'WX', 'level', 'masked', 'master_reply', 'paddr', + 'ports', 'reply', 'uncached'), suffix=r'\b'), + Keyword.Reserved), + + # Literals + (r'0[xX][\da-fA-F]+', Number.Hex), + (r'\d+(\.\d+)?(k|M)?', Number), + (words(('bits',), suffix=r'\b'), Number), + (words(('cspace', 'vspace', 'reply_slot', 'caller_slot', + 'ipc_buffer_slot'), suffix=r'\b'), Number), + + # Identifiers + (r'[a-zA-Z_][-@\.\w]*', Name), + ], + } + + +class RedcodeLexer(RegexLexer): + """ + A simple Redcode lexer based on ICWS'94. + Contributed by Adam Blinkinsop . + + .. versionadded:: 0.8 + """ + name = 'Redcode' + aliases = ['redcode'] + filenames = ['*.cw'] + + opcodes = ('DAT', 'MOV', 'ADD', 'SUB', 'MUL', 'DIV', 'MOD', + 'JMP', 'JMZ', 'JMN', 'DJN', 'CMP', 'SLT', 'SPL', + 'ORG', 'EQU', 'END') + modifiers = ('A', 'B', 'AB', 'BA', 'F', 'X', 'I') + + tokens = { + 'root': [ + # Whitespace: + (r'\s+', Text), + (r';.*$', Comment.Single), + # Lexemes: + # Identifiers + (r'\b(%s)\b' % '|'.join(opcodes), Name.Function), + (r'\b(%s)\b' % '|'.join(modifiers), Name.Decorator), + (r'[A-Za-z_]\w+', Name), + # Operators + (r'[-+*/%]', Operator), + (r'[#$@<>]', Operator), # mode + (r'[.,]', Punctuation), # mode + # Numbers + (r'[-+]?\d+', Number.Integer), + ], + } + + +class AheuiLexer(RegexLexer): + """ + Aheui_ Lexer. + + Aheui_ is esoteric language based on Korean alphabets. + + .. _Aheui:: http://aheui.github.io/ + + """ + + name = 'Aheui' + aliases = ['aheui'] + filenames = ['*.aheui'] + + tokens = { + 'root': [ + (u'[' + u'나-낳냐-냫너-넣녀-녛노-놓뇨-눟뉴-닇' + u'다-닿댜-댷더-덯뎌-뎧도-돟됴-둫듀-딓' + u'따-땋땨-떃떠-떻뗘-뗳또-똫뚀-뚷뜌-띟' + u'라-랗랴-럏러-렇려-렿로-롷료-뤃류-릫' + u'마-맣먀-먛머-멓며-몋모-뫃묘-뭏뮤-믷' + u'바-밯뱌-뱧버-벟벼-볗보-봏뵤-붛뷰-빃' + u'빠-빻뺘-뺳뻐-뻫뼈-뼣뽀-뽛뾰-뿧쀼-삏' + u'사-샇샤-샿서-섷셔-셯소-솧쇼-숳슈-싛' + u'싸-쌓쌰-썋써-쎃쎠-쎻쏘-쏳쑈-쑿쓔-씧' + u'자-잫쟈-쟣저-젛져-졓조-좋죠-줗쥬-즿' + u'차-챃챠-챻처-첳쳐-쳫초-촣쵸-춯츄-칗' + u'카-캏캬-컇커-컿켜-켷코-콯쿄-쿻큐-킣' + u'타-탛탸-턓터-텋텨-톃토-톻툐-퉇튜-틯' + u'파-팧퍄-퍟퍼-펗펴-폏포-퐇표-풓퓨-픻' + u'하-핳햐-햫허-헣혀-혛호-홓효-훟휴-힇' + u']', Operator), + ('.', Comment), + ], + } diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/ezhil.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/ezhil.py new file mode 100644 index 0000000000000000000000000000000000000000..ce1cdb2df1ab5a385d1c88076845738195f3e54e --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/ezhil.py @@ -0,0 +1,69 @@ +# -*- coding: utf-8 -*- +""" + pygments.lexers.ezhil + ~~~~~~~~~~~~~~~~~~~~~ + + Pygments lexers for Ezhil language. + + :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS. + :license: BSD, see LICENSE for details. +""" + +import re +from pygments.lexer import RegexLexer, include, words +from pygments.token import Keyword, Text, Comment, Name +from pygments.token import String, Number, Punctuation, Operator + +__all__ = ['EzhilLexer'] + + +class EzhilLexer(RegexLexer): + """ + Lexer for `Ezhil, a Tamil script-based programming language `_ + + .. versionadded:: 2.1 + """ + name = 'Ezhil' + aliases = ['ezhil'] + filenames = ['*.n'] + mimetypes = ['text/x-ezhil'] + flags = re.MULTILINE | re.UNICODE + # Refer to tamil.utf8.tamil_letters from open-tamil for a stricter version of this. + # This much simpler version is close enough, and includes combining marks. + _TALETTERS = u'[a-zA-Z_]|[\u0b80-\u0bff]' + tokens = { + 'root': [ + include('keywords'), + (r'#.*\n', Comment.Single), + (r'[@+/*,^\-%]|[!<>=]=?|&&?|\|\|?', Operator), + (u'இல்', Operator.Word), + (words((u'assert', u'max', u'min', + u'நீளம்', u'சரம்_இடமாற்று', u'சரம்_கண்டுபிடி', + u'பட்டியல்', u'பின்இணை', u'வரிசைப்படுத்து', + u'எடு', u'தலைகீழ்', u'நீட்டிக்க', u'நுழைக்க', u'வை', + u'கோப்பை_திற', u'கோப்பை_எழுது', u'கோப்பை_மூடு', + u'pi', u'sin', u'cos', u'tan', u'sqrt', u'hypot', u'pow', + u'exp', u'log', u'log10', u'exit', + ), suffix=r'\b'), Name.Builtin), + (r'(True|False)\b', Keyword.Constant), + (r'[^\S\n]+', Text), + include('identifier'), + include('literal'), + (r'[(){}\[\]:;.]', Punctuation), + ], + 'keywords': [ + (u'பதிப்பி|தேர்ந்தெடு|தேர்வு|ஏதேனில்|ஆனால்|இல்லைஆனால்|இல்லை|ஆக|ஒவ்வொன்றாக|இல்|வரை|செய்|முடியேனில்|பின்கொடு|முடி|நிரல்பாகம்|தொடர்|நிறுத்து|நிரல்பாகம்', Keyword), + ], + 'identifier': [ + (u'(?:'+_TALETTERS+u')(?:[0-9]|'+_TALETTERS+u')*', Name), + ], + 'literal': [ + (r'".*?"', String), + (r'(?u)\d+((\.\d*)?[eE][+-]?\d+|\.\d*)', Number.Float), + (r'(?u)\d+', Number.Integer), + ] + } + + def __init__(self, **options): + super(EzhilLexer, self).__init__(**options) + self.encoding = options.get('encoding', 'utf-8') diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/factor.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/factor.py new file mode 100644 index 0000000000000000000000000000000000000000..09d85c276a2f6ef102f8c8614daf785ba56604a6 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/factor.py @@ -0,0 +1,344 @@ +# -*- coding: utf-8 -*- +""" + pygments.lexers.factor + ~~~~~~~~~~~~~~~~~~~~~~ + + Lexers for the Factor language. + + :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS. + :license: BSD, see LICENSE for details. +""" + +import re + +from pygments.lexer import RegexLexer, bygroups, default, words +from pygments.token import Text, Comment, Keyword, Name, String, Number + +__all__ = ['FactorLexer'] + + +class FactorLexer(RegexLexer): + """ + Lexer for the `Factor `_ language. + + .. versionadded:: 1.4 + """ + name = 'Factor' + aliases = ['factor'] + filenames = ['*.factor'] + mimetypes = ['text/x-factor'] + + flags = re.MULTILINE | re.UNICODE + + builtin_kernel = words(( + '-rot', '2bi', '2bi@', '2bi*', '2curry', '2dip', '2drop', '2dup', '2keep', '2nip', + '2over', '2tri', '2tri@', '2tri*', '3bi', '3curry', '3dip', '3drop', '3dup', '3keep', + '3tri', '4dip', '4drop', '4dup', '4keep', '', '=', '>boolean', 'clone', + '?', '?execute', '?if', 'and', 'assert', 'assert=', 'assert?', 'bi', 'bi-curry', + 'bi-curry@', 'bi-curry*', 'bi@', 'bi*', 'boa', 'boolean', 'boolean?', 'both?', + 'build', 'call', 'callstack', 'callstack>array', 'callstack?', 'clear', '(clone)', + 'compose', 'compose?', 'curry', 'curry?', 'datastack', 'die', 'dip', 'do', 'drop', + 'dup', 'dupd', 'either?', 'eq?', 'equal?', 'execute', 'hashcode', 'hashcode*', + 'identity-hashcode', 'identity-tuple', 'identity-tuple?', 'if', 'if*', + 'keep', 'loop', 'most', 'new', 'nip', 'not', 'null', 'object', 'or', 'over', + 'pick', 'prepose', 'retainstack', 'rot', 'same?', 'swap', 'swapd', 'throw', + 'tri', 'tri-curry', 'tri-curry@', 'tri-curry*', 'tri@', 'tri*', 'tuple', + 'tuple?', 'unless', 'unless*', 'until', 'when', 'when*', 'while', 'with', + 'wrapper', 'wrapper?', 'xor'), suffix=r'\s') + + builtin_assocs = words(( + '2cache', '', '>alist', '?at', '?of', 'assoc', 'assoc-all?', + 'assoc-any?', 'assoc-clone-like', 'assoc-combine', 'assoc-diff', + 'assoc-diff!', 'assoc-differ', 'assoc-each', 'assoc-empty?', + 'assoc-filter', 'assoc-filter!', 'assoc-filter-as', 'assoc-find', + 'assoc-hashcode', 'assoc-intersect', 'assoc-like', 'assoc-map', + 'assoc-map-as', 'assoc-partition', 'assoc-refine', 'assoc-size', + 'assoc-stack', 'assoc-subset?', 'assoc-union', 'assoc-union!', + 'assoc=', 'assoc>map', 'assoc?', 'at', 'at+', 'at*', 'cache', 'change-at', + 'clear-assoc', 'delete-at', 'delete-at*', 'enum', 'enum?', 'extract-keys', + 'inc-at', 'key?', 'keys', 'map>assoc', 'maybe-set-at', 'new-assoc', 'of', + 'push-at', 'rename-at', 'set-at', 'sift-keys', 'sift-values', 'substitute', + 'unzip', 'value-at', 'value-at*', 'value?', 'values', 'zip'), suffix=r'\s') + + builtin_combinators = words(( + '2cleave', '2cleave>quot', '3cleave', '3cleave>quot', '4cleave', + '4cleave>quot', 'alist>quot', 'call-effect', 'case', 'case-find', + 'case>quot', 'cleave', 'cleave>quot', 'cond', 'cond>quot', 'deep-spread>quot', + 'execute-effect', 'linear-case-quot', 'no-case', 'no-case?', 'no-cond', + 'no-cond?', 'recursive-hashcode', 'shallow-spread>quot', 'spread', + 'to-fixed-point', 'wrong-values', 'wrong-values?'), suffix=r'\s') + + builtin_math = words(( + '-', '/', '/f', '/i', '/mod', '2/', '2^', '<', '<=', '', '>', + '>=', '>bignum', '>fixnum', '>float', '>integer', '(all-integers?)', + '(each-integer)', '(find-integer)', '*', '+', '?1+', + 'abs', 'align', 'all-integers?', 'bignum', 'bignum?', 'bit?', 'bitand', + 'bitnot', 'bitor', 'bits>double', 'bits>float', 'bitxor', 'complex', + 'complex?', 'denominator', 'double>bits', 'each-integer', 'even?', + 'find-integer', 'find-last-integer', 'fixnum', 'fixnum?', 'float', + 'float>bits', 'float?', 'fp-bitwise=', 'fp-infinity?', 'fp-nan-payload', + 'fp-nan?', 'fp-qnan?', 'fp-sign', 'fp-snan?', 'fp-special?', + 'if-zero', 'imaginary-part', 'integer', 'integer>fixnum', + 'integer>fixnum-strict', 'integer?', 'log2', 'log2-expects-positive', + 'log2-expects-positive?', 'mod', 'neg', 'neg?', 'next-float', + 'next-power-of-2', 'number', 'number=', 'number?', 'numerator', 'odd?', + 'out-of-fixnum-range', 'out-of-fixnum-range?', 'power-of-2?', + 'prev-float', 'ratio', 'ratio?', 'rational', 'rational?', 'real', + 'real-part', 'real?', 'recip', 'rem', 'sgn', 'shift', 'sq', 'times', + 'u<', 'u<=', 'u>', 'u>=', 'unless-zero', 'unordered?', 'when-zero', + 'zero?'), suffix=r'\s') + + builtin_sequences = words(( + '1sequence', '2all?', '2each', '2map', '2map-as', '2map-reduce', '2reduce', + '2selector', '2sequence', '3append', '3append-as', '3each', '3map', '3map-as', + '3sequence', '4sequence', '', '', '', '?first', + '?last', '?nth', '?second', '?set-nth', 'accumulate', 'accumulate!', + 'accumulate-as', 'all?', 'any?', 'append', 'append!', 'append-as', + 'assert-sequence', 'assert-sequence=', 'assert-sequence?', + 'binary-reduce', 'bounds-check', 'bounds-check?', 'bounds-error', + 'bounds-error?', 'but-last', 'but-last-slice', 'cartesian-each', + 'cartesian-map', 'cartesian-product', 'change-nth', 'check-slice', + 'check-slice-error', 'clone-like', 'collapse-slice', 'collector', + 'collector-for', 'concat', 'concat-as', 'copy', 'count', 'cut', 'cut-slice', + 'cut*', 'delete-all', 'delete-slice', 'drop-prefix', 'each', 'each-from', + 'each-index', 'empty?', 'exchange', 'filter', 'filter!', 'filter-as', 'find', + 'find-from', 'find-index', 'find-index-from', 'find-last', 'find-last-from', + 'first', 'first2', 'first3', 'first4', 'flip', 'follow', 'fourth', 'glue', 'halves', + 'harvest', 'head', 'head-slice', 'head-slice*', 'head*', 'head?', + 'if-empty', 'immutable', 'immutable-sequence', 'immutable-sequence?', + 'immutable?', 'index', 'index-from', 'indices', 'infimum', 'infimum-by', + 'insert-nth', 'interleave', 'iota', 'iota-tuple', 'iota-tuple?', 'join', + 'join-as', 'last', 'last-index', 'last-index-from', 'length', 'lengthen', + 'like', 'longer', 'longer?', 'longest', 'map', 'map!', 'map-as', 'map-find', + 'map-find-last', 'map-index', 'map-integers', 'map-reduce', 'map-sum', + 'max-length', 'member-eq?', 'member?', 'midpoint@', 'min-length', + 'mismatch', 'move', 'new-like', 'new-resizable', 'new-sequence', + 'non-negative-integer-expected', 'non-negative-integer-expected?', + 'nth', 'nths', 'pad-head', 'pad-tail', 'padding', 'partition', 'pop', 'pop*', + 'prefix', 'prepend', 'prepend-as', 'produce', 'produce-as', 'product', 'push', + 'push-all', 'push-either', 'push-if', 'reduce', 'reduce-index', 'remove', + 'remove!', 'remove-eq', 'remove-eq!', 'remove-nth', 'remove-nth!', 'repetition', + 'repetition?', 'replace-slice', 'replicate', 'replicate-as', 'rest', + 'rest-slice', 'reverse', 'reverse!', 'reversed', 'reversed?', 'second', + 'selector', 'selector-for', 'sequence', 'sequence-hashcode', 'sequence=', + 'sequence?', 'set-first', 'set-fourth', 'set-last', 'set-length', 'set-nth', + 'set-second', 'set-third', 'short', 'shorten', 'shorter', 'shorter?', + 'shortest', 'sift', 'slice', 'slice-error', 'slice-error?', 'slice?', + 'snip', 'snip-slice', 'start', 'start*', 'subseq', 'subseq?', 'suffix', + 'suffix!', 'sum', 'sum-lengths', 'supremum', 'supremum-by', 'surround', 'tail', + 'tail-slice', 'tail-slice*', 'tail*', 'tail?', 'third', 'trim', + 'trim-head', 'trim-head-slice', 'trim-slice', 'trim-tail', 'trim-tail-slice', + 'unclip', 'unclip-last', 'unclip-last-slice', 'unclip-slice', 'unless-empty', + 'virtual-exemplar', 'virtual-sequence', 'virtual-sequence?', 'virtual@', + 'when-empty'), suffix=r'\s') + + builtin_namespaces = words(( + '+@', 'change', 'change-global', 'counter', 'dec', 'get', 'get-global', + 'global', 'inc', 'init-namespaces', 'initialize', 'is-global', 'make-assoc', + 'namespace', 'namestack', 'off', 'on', 'set', 'set-global', 'set-namestack', + 'toggle', 'with-global', 'with-scope', 'with-variable', 'with-variables'), + suffix=r'\s') + + builtin_arrays = words(( + '1array', '2array', '3array', '4array', '', '>array', 'array', + 'array?', 'pair', 'pair?', 'resize-array'), suffix=r'\s') + + builtin_io = words(( + '(each-stream-block-slice)', '(each-stream-block)', + '(stream-contents-by-block)', '(stream-contents-by-element)', + '(stream-contents-by-length-or-block)', + '(stream-contents-by-length)', '+byte+', '+character+', + 'bad-seek-type', 'bad-seek-type?', 'bl', 'contents', 'each-block', + 'each-block-size', 'each-block-slice', 'each-line', 'each-morsel', + 'each-stream-block', 'each-stream-block-slice', 'each-stream-line', + 'error-stream', 'flush', 'input-stream', 'input-stream?', + 'invalid-read-buffer', 'invalid-read-buffer?', 'lines', 'nl', + 'output-stream', 'output-stream?', 'print', 'read', 'read-into', + 'read-partial', 'read-partial-into', 'read-until', 'read1', 'readln', + 'seek-absolute', 'seek-absolute?', 'seek-end', 'seek-end?', + 'seek-input', 'seek-output', 'seek-relative', 'seek-relative?', + 'stream-bl', 'stream-contents', 'stream-contents*', 'stream-copy', + 'stream-copy*', 'stream-element-type', 'stream-flush', + 'stream-length', 'stream-lines', 'stream-nl', 'stream-print', + 'stream-read', 'stream-read-into', 'stream-read-partial', + 'stream-read-partial-into', 'stream-read-partial-unsafe', + 'stream-read-unsafe', 'stream-read-until', 'stream-read1', + 'stream-readln', 'stream-seek', 'stream-seekable?', 'stream-tell', + 'stream-write', 'stream-write1', 'tell-input', 'tell-output', + 'with-error-stream', 'with-error-stream*', 'with-error>output', + 'with-input-output+error-streams', + 'with-input-output+error-streams*', 'with-input-stream', + 'with-input-stream*', 'with-output-stream', 'with-output-stream*', + 'with-output>error', 'with-output+error-stream', + 'with-output+error-stream*', 'with-streams', 'with-streams*', + 'write', 'write1'), suffix=r'\s') + + builtin_strings = words(( + '1string', '', '>string', 'resize-string', 'string', + 'string?'), suffix=r'\s') + + builtin_vectors = words(( + '1vector', '', '>vector', '?push', 'vector', 'vector?'), + suffix=r'\s') + + builtin_continuations = words(( + '', '', '', 'attempt-all', + 'attempt-all-error', 'attempt-all-error?', 'callback-error-hook', + 'callcc0', 'callcc1', 'cleanup', 'compute-restarts', 'condition', + 'condition?', 'continuation', 'continuation?', 'continue', + 'continue-restart', 'continue-with', 'current-continuation', + 'error', 'error-continuation', 'error-in-thread', 'error-thread', + 'ifcc', 'ignore-errors', 'in-callback?', 'original-error', 'recover', + 'restart', 'restart?', 'restarts', 'rethrow', 'rethrow-restarts', + 'return', 'return-continuation', 'thread-error-hook', 'throw-continue', + 'throw-restarts', 'with-datastack', 'with-return'), suffix=r'\s') + + tokens = { + 'root': [ + # factor allows a file to start with a shebang + (r'#!.*$', Comment.Preproc), + default('base'), + ], + 'base': [ + (r'\s+', Text), + + # defining words + (r'((?:MACRO|MEMO|TYPED)?:[:]?)(\s+)(\S+)', + bygroups(Keyword, Text, Name.Function)), + (r'(M:[:]?)(\s+)(\S+)(\s+)(\S+)', + bygroups(Keyword, Text, Name.Class, Text, Name.Function)), + (r'(C:)(\s+)(\S+)(\s+)(\S+)', + bygroups(Keyword, Text, Name.Function, Text, Name.Class)), + (r'(GENERIC:)(\s+)(\S+)', + bygroups(Keyword, Text, Name.Function)), + (r'(HOOK:|GENERIC#)(\s+)(\S+)(\s+)(\S+)', + bygroups(Keyword, Text, Name.Function, Text, Name.Function)), + (r'\(\s', Name.Function, 'stackeffect'), + (r';\s', Keyword), + + # imports and namespaces + (r'(USING:)(\s+)', + bygroups(Keyword.Namespace, Text), 'vocabs'), + (r'(USE:|UNUSE:|IN:|QUALIFIED:)(\s+)(\S+)', + bygroups(Keyword.Namespace, Text, Name.Namespace)), + (r'(QUALIFIED-WITH:)(\s+)(\S+)(\s+)(\S+)', + bygroups(Keyword.Namespace, Text, Name.Namespace, Text, Name.Namespace)), + (r'(FROM:|EXCLUDE:)(\s+)(\S+)(\s+=>\s)', + bygroups(Keyword.Namespace, Text, Name.Namespace, Text), 'words'), + (r'(RENAME:)(\s+)(\S+)(\s+)(\S+)(\s+=>\s+)(\S+)', + bygroups(Keyword.Namespace, Text, Name.Function, Text, Name.Namespace, Text, Name.Function)), + (r'(ALIAS:|TYPEDEF:)(\s+)(\S+)(\s+)(\S+)', + bygroups(Keyword.Namespace, Text, Name.Function, Text, Name.Function)), + (r'(DEFER:|FORGET:|POSTPONE:)(\s+)(\S+)', + bygroups(Keyword.Namespace, Text, Name.Function)), + + # tuples and classes + (r'(TUPLE:|ERROR:)(\s+)(\S+)(\s+<\s+)(\S+)', + bygroups(Keyword, Text, Name.Class, Text, Name.Class), 'slots'), + (r'(TUPLE:|ERROR:|BUILTIN:)(\s+)(\S+)', + bygroups(Keyword, Text, Name.Class), 'slots'), + (r'(MIXIN:|UNION:|INTERSECTION:)(\s+)(\S+)', + bygroups(Keyword, Text, Name.Class)), + (r'(PREDICATE:)(\s+)(\S+)(\s+<\s+)(\S+)', + bygroups(Keyword, Text, Name.Class, Text, Name.Class)), + (r'(C:)(\s+)(\S+)(\s+)(\S+)', + bygroups(Keyword, Text, Name.Function, Text, Name.Class)), + (r'(INSTANCE:)(\s+)(\S+)(\s+)(\S+)', + bygroups(Keyword, Text, Name.Class, Text, Name.Class)), + (r'(SLOT:)(\s+)(\S+)', bygroups(Keyword, Text, Name.Function)), + (r'(SINGLETON:)(\s+)(\S+)', bygroups(Keyword, Text, Name.Class)), + (r'SINGLETONS:', Keyword, 'classes'), + + # other syntax + (r'(CONSTANT:|SYMBOL:|MAIN:|HELP:)(\s+)(\S+)', + bygroups(Keyword, Text, Name.Function)), + (r'SYMBOLS:\s', Keyword, 'words'), + (r'SYNTAX:\s', Keyword), + (r'ALIEN:\s', Keyword), + (r'(STRUCT:)(\s+)(\S+)', bygroups(Keyword, Text, Name.Class)), + (r'(FUNCTION:)(\s+\S+\s+)(\S+)(\s+\(\s+[^)]+\)\s)', + bygroups(Keyword.Namespace, Text, Name.Function, Text)), + (r'(FUNCTION-ALIAS:)(\s+)(\S+)(\s+\S+\s+)(\S+)(\s+\(\s+[^)]+\)\s)', + bygroups(Keyword.Namespace, Text, Name.Function, Text, Name.Function, Text)), + + # vocab.private + (r'(?:)\s', Keyword.Namespace), + + # strings + (r'"""\s+(?:.|\n)*?\s+"""', String), + (r'"(?:\\\\|\\"|[^"])*"', String), + (r'\S+"\s+(?:\\\\|\\"|[^"])*"', String), + (r'CHAR:\s+(?:\\[\\abfnrstv]|[^\\]\S*)\s', String.Char), + + # comments + (r'!\s+.*$', Comment), + (r'#!\s+.*$', Comment), + (r'/\*\s+(?:.|\n)*?\s\*/\s', Comment), + + # boolean constants + (r'[tf]\s', Name.Constant), + + # symbols and literals + (r'[\\$]\s+\S+', Name.Constant), + (r'M\\\s+\S+\s+\S+', Name.Constant), + + # numbers + (r'[+-]?(?:[\d,]*\d)?\.(?:\d([\d,]*\d)?)?(?:[eE][+-]?\d+)?\s', Number), + (r'[+-]?\d(?:[\d,]*\d)?(?:[eE][+-]?\d+)?\s', Number), + (r'0x[a-fA-F\d](?:[a-fA-F\d,]*[a-fA-F\d])?(?:p\d([\d,]*\d)?)?\s', Number), + (r'NAN:\s+[a-fA-F\d](?:[a-fA-F\d,]*[a-fA-F\d])?(?:p\d([\d,]*\d)?)?\s', Number), + (r'0b[01]+\s', Number.Bin), + (r'0o[0-7]+\s', Number.Oct), + (r'(?:\d([\d,]*\d)?)?\+\d(?:[\d,]*\d)?/\d(?:[\d,]*\d)?\s', Number), + (r'(?:\-\d([\d,]*\d)?)?\-\d(?:[\d,]*\d)?/\d(?:[\d,]*\d)?\s', Number), + + # keywords + (r'(?:deprecated|final|foldable|flushable|inline|recursive)\s', + Keyword), + + # builtins + (builtin_kernel, Name.Builtin), + (builtin_assocs, Name.Builtin), + (builtin_combinators, Name.Builtin), + (builtin_math, Name.Builtin), + (builtin_sequences, Name.Builtin), + (builtin_namespaces, Name.Builtin), + (builtin_arrays, Name.Builtin), + (builtin_io, Name.Builtin), + (builtin_strings, Name.Builtin), + (builtin_vectors, Name.Builtin), + (builtin_continuations, Name.Builtin), + + # everything else is text + (r'\S+', Text), + ], + 'stackeffect': [ + (r'\s+', Text), + (r'\(\s+', Name.Function, 'stackeffect'), + (r'\)\s', Name.Function, '#pop'), + (r'--\s', Name.Function), + (r'\S+', Name.Variable), + ], + 'slots': [ + (r'\s+', Text), + (r';\s', Keyword, '#pop'), + (r'(\{\s+)(\S+)(\s+[^}]+\s+\}\s)', + bygroups(Text, Name.Variable, Text)), + (r'\S+', Name.Variable), + ], + 'vocabs': [ + (r'\s+', Text), + (r';\s', Keyword, '#pop'), + (r'\S+', Name.Namespace), + ], + 'classes': [ + (r'\s+', Text), + (r';\s', Keyword, '#pop'), + (r'\S+', Name.Class), + ], + 'words': [ + (r'\s+', Text), + (r';\s', Keyword, '#pop'), + (r'\S+', Name.Function), + ], + } diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/fantom.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/fantom.py new file mode 100644 index 0000000000000000000000000000000000000000..3ea2177c7bebe7f2743a5ebca49336a3ebbbb292 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/fantom.py @@ -0,0 +1,250 @@ +# -*- coding: utf-8 -*- +""" + pygments.lexers.fantom + ~~~~~~~~~~~~~~~~~~~~~~ + + Lexer for the Fantom language. + + :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS. + :license: BSD, see LICENSE for details. +""" + +from string import Template + +from pygments.lexer import RegexLexer, include, bygroups, using, \ + this, default, words +from pygments.token import Text, Comment, Operator, Keyword, Name, String, \ + Number, Punctuation, Literal + +__all__ = ['FantomLexer'] + + +class FantomLexer(RegexLexer): + """ + For Fantom source code. + + .. versionadded:: 1.5 + """ + name = 'Fantom' + aliases = ['fan'] + filenames = ['*.fan'] + mimetypes = ['application/x-fantom'] + + # often used regexes + def s(str): + return Template(str).substitute( + dict( + pod=r'[\"\w\.]+', + eos=r'\n|;', + id=r'[a-zA-Z_]\w*', + # all chars which can be part of type definition. Starts with + # either letter, or [ (maps), or | (funcs) + type=r'(?:\[|[a-zA-Z_]|\|)[:\w\[\]|\->?]*?', + ) + ) + + tokens = { + 'comments': [ + (r'(?s)/\*.*?\*/', Comment.Multiline), # Multiline + (r'//.*?\n', Comment.Single), # Single line + # TODO: highlight references in fandocs + (r'\*\*.*?\n', Comment.Special), # Fandoc + (r'#.*\n', Comment.Single) # Shell-style + ], + 'literals': [ + (r'\b-?[\d_]+(ns|ms|sec|min|hr|day)', Number), # Duration + (r'\b-?[\d_]*\.[\d_]+(ns|ms|sec|min|hr|day)', Number), # Duration with dot + (r'\b-?(\d+)?\.\d+(f|F|d|D)?', Number.Float), # Float/Decimal + (r'\b-?0x[0-9a-fA-F_]+', Number.Hex), # Hex + (r'\b-?[\d_]+', Number.Integer), # Int + (r"'\\.'|'[^\\]'|'\\u[0-9a-f]{4}'", String.Char), # Char + (r'"', Punctuation, 'insideStr'), # Opening quote + (r'`', Punctuation, 'insideUri'), # Opening accent + (r'\b(true|false|null)\b', Keyword.Constant), # Bool & null + (r'(?:(\w+)(::))?(\w+)(<\|)(.*?)(\|>)', # DSL + bygroups(Name.Namespace, Punctuation, Name.Class, + Punctuation, String, Punctuation)), + (r'(?:(\w+)(::))?(\w+)?(#)(\w+)?', # Type/slot literal + bygroups(Name.Namespace, Punctuation, Name.Class, + Punctuation, Name.Function)), + (r'\[,\]', Literal), # Empty list + (s(r'($type)(\[,\])'), # Typed empty list + bygroups(using(this, state='inType'), Literal)), + (r'\[:\]', Literal), # Empty Map + (s(r'($type)(\[:\])'), + bygroups(using(this, state='inType'), Literal)), + ], + 'insideStr': [ + (r'\\\\', String.Escape), # Escaped backslash + (r'\\"', String.Escape), # Escaped " + (r'\\`', String.Escape), # Escaped ` + (r'\$\w+', String.Interpol), # Subst var + (r'\$\{.*?\}', String.Interpol), # Subst expr + (r'"', Punctuation, '#pop'), # Closing quot + (r'.', String) # String content + ], + 'insideUri': [ # TODO: remove copy/paste str/uri + (r'\\\\', String.Escape), # Escaped backslash + (r'\\"', String.Escape), # Escaped " + (r'\\`', String.Escape), # Escaped ` + (r'\$\w+', String.Interpol), # Subst var + (r'\$\{.*?\}', String.Interpol), # Subst expr + (r'`', Punctuation, '#pop'), # Closing tick + (r'.', String.Backtick) # URI content + ], + 'protectionKeywords': [ + (r'\b(public|protected|private|internal)\b', Keyword), + ], + 'typeKeywords': [ + (r'\b(abstract|final|const|native|facet|enum)\b', Keyword), + ], + 'methodKeywords': [ + (r'\b(abstract|native|once|override|static|virtual|final)\b', + Keyword), + ], + 'fieldKeywords': [ + (r'\b(abstract|const|final|native|override|static|virtual|' + r'readonly)\b', Keyword) + ], + 'otherKeywords': [ + (words(( + 'try', 'catch', 'throw', 'finally', 'for', 'if', 'else', 'while', + 'as', 'is', 'isnot', 'switch', 'case', 'default', 'continue', + 'break', 'do', 'return', 'get', 'set'), prefix=r'\b', suffix=r'\b'), + Keyword), + (r'\b(it|this|super)\b', Name.Builtin.Pseudo), + ], + 'operators': [ + (r'\+\+|\-\-|\+|\-|\*|/|\|\||&&|<=>|<=|<|>=|>|=|!|\[|\]', Operator) + ], + 'inType': [ + (r'[\[\]|\->:?]', Punctuation), + (s(r'$id'), Name.Class), + default('#pop'), + + ], + 'root': [ + include('comments'), + include('protectionKeywords'), + include('typeKeywords'), + include('methodKeywords'), + include('fieldKeywords'), + include('literals'), + include('otherKeywords'), + include('operators'), + (r'using\b', Keyword.Namespace, 'using'), # Using stmt + (r'@\w+', Name.Decorator, 'facet'), # Symbol + (r'(class|mixin)(\s+)(\w+)', bygroups(Keyword, Text, Name.Class), + 'inheritance'), # Inheritance list + + # Type var := val + (s(r'($type)([ \t]+)($id)(\s*)(:=)'), + bygroups(using(this, state='inType'), Text, + Name.Variable, Text, Operator)), + + # var := val + (s(r'($id)(\s*)(:=)'), + bygroups(Name.Variable, Text, Operator)), + + # .someId( or ->someId( ### + (s(r'(\.|(?:\->))($id)(\s*)(\()'), + bygroups(Operator, Name.Function, Text, Punctuation), + 'insideParen'), + + # .someId or ->someId + (s(r'(\.|(?:\->))($id)'), + bygroups(Operator, Name.Function)), + + # new makeXXX ( + (r'(new)(\s+)(make\w*)(\s*)(\()', + bygroups(Keyword, Text, Name.Function, Text, Punctuation), + 'insideMethodDeclArgs'), + + # Type name ( + (s(r'($type)([ \t]+)' # Return type and whitespace + r'($id)(\s*)(\()'), # method name + open brace + bygroups(using(this, state='inType'), Text, + Name.Function, Text, Punctuation), + 'insideMethodDeclArgs'), + + # ArgType argName, + (s(r'($type)(\s+)($id)(\s*)(,)'), + bygroups(using(this, state='inType'), Text, Name.Variable, + Text, Punctuation)), + + # ArgType argName) + # Covered in 'insideParen' state + + # ArgType argName -> ArgType| + (s(r'($type)(\s+)($id)(\s*)(\->)(\s*)($type)(\|)'), + bygroups(using(this, state='inType'), Text, Name.Variable, + Text, Punctuation, Text, using(this, state='inType'), + Punctuation)), + + # ArgType argName| + (s(r'($type)(\s+)($id)(\s*)(\|)'), + bygroups(using(this, state='inType'), Text, Name.Variable, + Text, Punctuation)), + + # Type var + (s(r'($type)([ \t]+)($id)'), + bygroups(using(this, state='inType'), Text, + Name.Variable)), + + (r'\(', Punctuation, 'insideParen'), + (r'\{', Punctuation, 'insideBrace'), + (r'.', Text) + ], + 'insideParen': [ + (r'\)', Punctuation, '#pop'), + include('root'), + ], + 'insideMethodDeclArgs': [ + (r'\)', Punctuation, '#pop'), + (s(r'($type)(\s+)($id)(\s*)(\))'), + bygroups(using(this, state='inType'), Text, Name.Variable, + Text, Punctuation), '#pop'), + include('root'), + ], + 'insideBrace': [ + (r'\}', Punctuation, '#pop'), + include('root'), + ], + 'inheritance': [ + (r'\s+', Text), # Whitespace + (r':|,', Punctuation), + (r'(?:(\w+)(::))?(\w+)', + bygroups(Name.Namespace, Punctuation, Name.Class)), + (r'\{', Punctuation, '#pop') + ], + 'using': [ + (r'[ \t]+', Text), # consume whitespaces + (r'(\[)(\w+)(\])', + bygroups(Punctuation, Comment.Special, Punctuation)), # ffi + (r'(\")?([\w.]+)(\")?', + bygroups(Punctuation, Name.Namespace, Punctuation)), # podname + (r'::', Punctuation, 'usingClass'), + default('#pop') + ], + 'usingClass': [ + (r'[ \t]+', Text), # consume whitespaces + (r'(as)(\s+)(\w+)', + bygroups(Keyword.Declaration, Text, Name.Class), '#pop:2'), + (r'[\w$]+', Name.Class), + default('#pop:2') # jump out to root state + ], + 'facet': [ + (r'\s+', Text), + (r'\{', Punctuation, 'facetFields'), + default('#pop') + ], + 'facetFields': [ + include('comments'), + include('literals'), + include('operators'), + (r'\s+', Text), + (r'(\s*)(\w+)(\s*)(=)', bygroups(Text, Name, Text, Operator)), + (r'\}', Punctuation, '#pop'), + (r'.', Text) + ], + } diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/felix.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/felix.py new file mode 100644 index 0000000000000000000000000000000000000000..8f0695b5cc6be7706cd68e19d4da7bb18b32019e --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/felix.py @@ -0,0 +1,273 @@ +# -*- coding: utf-8 -*- +""" + pygments.lexers.felix + ~~~~~~~~~~~~~~~~~~~~~ + + Lexer for the Felix language. + + :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS. + :license: BSD, see LICENSE for details. +""" + +from pygments.lexer import RegexLexer, include, bygroups, default, words, \ + combined +from pygments.token import Text, Comment, Operator, Keyword, Name, String, \ + Number, Punctuation + +__all__ = ['FelixLexer'] + + +class FelixLexer(RegexLexer): + """ + For `Felix `_ source code. + + .. versionadded:: 1.2 + """ + + name = 'Felix' + aliases = ['felix', 'flx'] + filenames = ['*.flx', '*.flxh'] + mimetypes = ['text/x-felix'] + + preproc = ( + 'elif', 'else', 'endif', 'if', 'ifdef', 'ifndef', + ) + + keywords = ( + '_', '_deref', 'all', 'as', + 'assert', 'attempt', 'call', 'callback', 'case', 'caseno', 'cclass', + 'code', 'compound', 'ctypes', 'do', 'done', 'downto', 'elif', 'else', + 'endattempt', 'endcase', 'endif', 'endmatch', 'enum', 'except', + 'exceptions', 'expect', 'finally', 'for', 'forall', 'forget', 'fork', + 'functor', 'goto', 'ident', 'if', 'incomplete', 'inherit', 'instance', + 'interface', 'jump', 'lambda', 'loop', 'match', 'module', 'namespace', + 'new', 'noexpand', 'nonterm', 'obj', 'of', 'open', 'parse', 'raise', + 'regexp', 'reglex', 'regmatch', 'rename', 'return', 'the', 'then', + 'to', 'type', 'typecase', 'typedef', 'typematch', 'typeof', 'upto', + 'when', 'whilst', 'with', 'yield', + ) + + keyword_directives = ( + '_gc_pointer', '_gc_type', 'body', 'comment', 'const', 'export', + 'header', 'inline', 'lval', 'macro', 'noinline', 'noreturn', + 'package', 'private', 'pod', 'property', 'public', 'publish', + 'requires', 'todo', 'virtual', 'use', + ) + + keyword_declarations = ( + 'def', 'let', 'ref', 'val', 'var', + ) + + keyword_types = ( + 'unit', 'void', 'any', 'bool', + 'byte', 'offset', + 'address', 'caddress', 'cvaddress', 'vaddress', + 'tiny', 'short', 'int', 'long', 'vlong', + 'utiny', 'ushort', 'vshort', 'uint', 'ulong', 'uvlong', + 'int8', 'int16', 'int32', 'int64', + 'uint8', 'uint16', 'uint32', 'uint64', + 'float', 'double', 'ldouble', + 'complex', 'dcomplex', 'lcomplex', + 'imaginary', 'dimaginary', 'limaginary', + 'char', 'wchar', 'uchar', + 'charp', 'charcp', 'ucharp', 'ucharcp', + 'string', 'wstring', 'ustring', + 'cont', + 'array', 'varray', 'list', + 'lvalue', 'opt', 'slice', + ) + + keyword_constants = ( + 'false', 'true', + ) + + operator_words = ( + 'and', 'not', 'in', 'is', 'isin', 'or', 'xor', + ) + + name_builtins = ( + '_svc', 'while', + ) + + name_pseudo = ( + 'root', 'self', 'this', + ) + + decimal_suffixes = '([tTsSiIlLvV]|ll|LL|([iIuU])(8|16|32|64))?' + + tokens = { + 'root': [ + include('whitespace'), + + # Keywords + (words(('axiom', 'ctor', 'fun', 'gen', 'proc', 'reduce', + 'union'), suffix=r'\b'), + Keyword, 'funcname'), + (words(('class', 'cclass', 'cstruct', 'obj', 'struct'), suffix=r'\b'), + Keyword, 'classname'), + (r'(instance|module|typeclass)\b', Keyword, 'modulename'), + + (words(keywords, suffix=r'\b'), Keyword), + (words(keyword_directives, suffix=r'\b'), Name.Decorator), + (words(keyword_declarations, suffix=r'\b'), Keyword.Declaration), + (words(keyword_types, suffix=r'\b'), Keyword.Type), + (words(keyword_constants, suffix=r'\b'), Keyword.Constant), + + # Operators + include('operators'), + + # Float Literal + # -- Hex Float + (r'0[xX]([0-9a-fA-F_]*\.[0-9a-fA-F_]+|[0-9a-fA-F_]+)' + r'[pP][+\-]?[0-9_]+[lLfFdD]?', Number.Float), + # -- DecimalFloat + (r'[0-9_]+(\.[0-9_]+[eE][+\-]?[0-9_]+|' + r'\.[0-9_]*|[eE][+\-]?[0-9_]+)[lLfFdD]?', Number.Float), + (r'\.(0|[1-9][0-9_]*)([eE][+\-]?[0-9_]+)?[lLfFdD]?', + Number.Float), + + # IntegerLiteral + # -- Binary + (r'0[Bb][01_]+%s' % decimal_suffixes, Number.Bin), + # -- Octal + (r'0[0-7_]+%s' % decimal_suffixes, Number.Oct), + # -- Hexadecimal + (r'0[xX][0-9a-fA-F_]+%s' % decimal_suffixes, Number.Hex), + # -- Decimal + (r'(0|[1-9][0-9_]*)%s' % decimal_suffixes, Number.Integer), + + # Strings + ('([rR][cC]?|[cC][rR])"""', String, 'tdqs'), + ("([rR][cC]?|[cC][rR])'''", String, 'tsqs'), + ('([rR][cC]?|[cC][rR])"', String, 'dqs'), + ("([rR][cC]?|[cC][rR])'", String, 'sqs'), + ('[cCfFqQwWuU]?"""', String, combined('stringescape', 'tdqs')), + ("[cCfFqQwWuU]?'''", String, combined('stringescape', 'tsqs')), + ('[cCfFqQwWuU]?"', String, combined('stringescape', 'dqs')), + ("[cCfFqQwWuU]?'", String, combined('stringescape', 'sqs')), + + # Punctuation + (r'[\[\]{}:(),;?]', Punctuation), + + # Labels + (r'[a-zA-Z_]\w*:>', Name.Label), + + # Identifiers + (r'(%s)\b' % '|'.join(name_builtins), Name.Builtin), + (r'(%s)\b' % '|'.join(name_pseudo), Name.Builtin.Pseudo), + (r'[a-zA-Z_]\w*', Name), + ], + 'whitespace': [ + (r'\n', Text), + (r'\s+', Text), + + include('comment'), + + # Preprocessor + (r'#\s*if\s+0', Comment.Preproc, 'if0'), + (r'#', Comment.Preproc, 'macro'), + ], + 'operators': [ + (r'(%s)\b' % '|'.join(operator_words), Operator.Word), + (r'!=|==|<<|>>|\|\||&&|[-~+/*%=<>&^|.$]', Operator), + ], + 'comment': [ + (r'//(.*?)\n', Comment.Single), + (r'/[*]', Comment.Multiline, 'comment2'), + ], + 'comment2': [ + (r'[^/*]', Comment.Multiline), + (r'/[*]', Comment.Multiline, '#push'), + (r'[*]/', Comment.Multiline, '#pop'), + (r'[/*]', Comment.Multiline), + ], + 'if0': [ + (r'^\s*#if.*?(?]*?>)', + bygroups(Comment.Preproc, Text, String), '#pop'), + (r'(import|include)(\s+)("[^"]*?")', + bygroups(Comment.Preproc, Text, String), '#pop'), + (r"(import|include)(\s+)('[^']*?')", + bygroups(Comment.Preproc, Text, String), '#pop'), + (r'[^/\n]+', Comment.Preproc), + # (r'/[*](.|\n)*?[*]/', Comment), + # (r'//.*?\n', Comment, '#pop'), + (r'/', Comment.Preproc), + (r'(?<=\\)\n', Comment.Preproc), + (r'\n', Comment.Preproc, '#pop'), + ], + 'funcname': [ + include('whitespace'), + (r'[a-zA-Z_]\w*', Name.Function, '#pop'), + # anonymous functions + (r'(?=\()', Text, '#pop'), + ], + 'classname': [ + include('whitespace'), + (r'[a-zA-Z_]\w*', Name.Class, '#pop'), + # anonymous classes + (r'(?=\{)', Text, '#pop'), + ], + 'modulename': [ + include('whitespace'), + (r'\[', Punctuation, ('modulename2', 'tvarlist')), + default('modulename2'), + ], + 'modulename2': [ + include('whitespace'), + (r'([a-zA-Z_]\w*)', Name.Namespace, '#pop:2'), + ], + 'tvarlist': [ + include('whitespace'), + include('operators'), + (r'\[', Punctuation, '#push'), + (r'\]', Punctuation, '#pop'), + (r',', Punctuation), + (r'(with|where)\b', Keyword), + (r'[a-zA-Z_]\w*', Name), + ], + 'stringescape': [ + (r'\\([\\abfnrtv"\']|\n|N\{.*?\}|u[a-fA-F0-9]{4}|' + r'U[a-fA-F0-9]{8}|x[a-fA-F0-9]{2}|[0-7]{1,3})', String.Escape) + ], + 'strings': [ + (r'%(\([a-zA-Z0-9]+\))?[-#0 +]*([0-9]+|[*])?(\.([0-9]+|[*]))?' + '[hlL]?[E-GXc-giorsux%]', String.Interpol), + (r'[^\\\'"%\n]+', String), + # quotes, percents and backslashes must be parsed one at a time + (r'[\'"\\]', String), + # unhandled string formatting sign + (r'%', String) + # newlines are an error (use "nl" state) + ], + 'nl': [ + (r'\n', String) + ], + 'dqs': [ + (r'"', String, '#pop'), + # included here again for raw strings + (r'\\\\|\\"|\\\n', String.Escape), + include('strings') + ], + 'sqs': [ + (r"'", String, '#pop'), + # included here again for raw strings + (r"\\\\|\\'|\\\n", String.Escape), + include('strings') + ], + 'tdqs': [ + (r'"""', String, '#pop'), + include('strings'), + include('nl') + ], + 'tsqs': [ + (r"'''", String, '#pop'), + include('strings'), + include('nl') + ], + } diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/forth.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/forth.py new file mode 100644 index 0000000000000000000000000000000000000000..a51f1b57e5f012a0e1da8bd28d2dba0260e15bb1 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/forth.py @@ -0,0 +1,177 @@ +# -*- coding: utf-8 -*- +""" + pygments.lexers.forth + ~~~~~~~~~~~~~~~~~~~~~ + + :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS. + :license: BSD, see LICENSE for details. +""" + +import re + +from pygments.lexer import RegexLexer, include, bygroups +from pygments.token import Error, Punctuation, Literal, Token, \ + Text, Comment, Operator, Keyword, Name, String, Number, Generic + + +__all__ = ['ForthLexer'] + + +class ForthLexer(RegexLexer): + """ + Lexer for Forth files. + + .. versionadded:: 2.2 + """ + name = 'Forth' + aliases = ['forth'] + filenames = ['*.frt', '*.fs'] + mimetypes = ['application/x-forth'] + + delimiter = r'\s' + delimiter_end = r'(?=[%s])' % delimiter + + valid_name_chars = r'[^%s]' % delimiter + valid_name = r"%s+%s" % (valid_name_chars, delimiter_end) + + flags = re.IGNORECASE | re.MULTILINE + + tokens = { + 'root': [ + (r'\s+', Text), + # All comment types + (r'\\.*?\n', Comment.Single), + (r'\([\s].*?\)', Comment.Single), + # defining words. The next word is a new command name + (r'(:|variable|constant|value|buffer:)(\s+)', + bygroups(Keyword.Namespace, Text), 'worddef'), + # strings are rather simple + (r'([.sc]")(\s+?)', bygroups(String, Text), 'stringdef'), + # keywords from the various wordsets + # *** Wordset BLOCK + (r'(blk|block|buffer|evaluate|flush|load|save-buffers|update|' + # *** Wordset BLOCK-EXT + r'empty-buffers|list|refill|scr|thru|' + # *** Wordset CORE + r'\#s|\*\/mod|\+loop|\/mod|0<|0=|1\+|1-|2!|' + r'2\*|2\/|2@|2drop|2dup|2over|2swap|>body|' + r'>in|>number|>r|\?dup|abort|abort\"|abs|' + r'accept|align|aligned|allot|and|base|begin|' + r'bl|c!|c,|c@|cell\+|cells|char|char\+|' + r'chars|constant|count|cr|create|decimal|' + r'depth|do|does>|drop|dup|else|emit|environment\?|' + r'evaluate|execute|exit|fill|find|fm\/mod|' + r'here|hold|i|if|immediate|invert|j|key|' + r'leave|literal|loop|lshift|m\*|max|min|' + r'mod|move|negate|or|over|postpone|quit|' + r'r>|r@|recurse|repeat|rot|rshift|s\"|s>d|' + r'sign|sm\/rem|source|space|spaces|state|swap|' + r'then|type|u\.|u\<|um\*|um\/mod|unloop|until|' + r'variable|while|word|xor|\[char\]|\[\'\]|' + r'@|!|\#|<\#|\#>|:|;|\+|-|\*|\/|,|<|>|\|1\+|1-|\.|' + # *** Wordset CORE-EXT + r'\.r|0<>|' + r'0>|2>r|2r>|2r@|:noname|\?do|again|c\"|' + r'case|compile,|endcase|endof|erase|false|' + r'hex|marker|nip|of|pad|parse|pick|refill|' + r'restore-input|roll|save-input|source-id|to|' + r'true|tuck|u\.r|u>|unused|value|within|' + r'\[compile\]|' + # *** Wordset CORE-EXT-obsolescent + r'\#tib|convert|expect|query|span|' + r'tib|' + # *** Wordset DOUBLE + r'2constant|2literal|2variable|d\+|d-|' + r'd\.|d\.r|d0<|d0=|d2\*|d2\/|d<|d=|d>s|' + r'dabs|dmax|dmin|dnegate|m\*\/|m\+|' + # *** Wordset DOUBLE-EXT + r'2rot|du<|' + # *** Wordset EXCEPTION + r'catch|throw|' + # *** Wordset EXCEPTION-EXT + r'abort|abort\"|' + # *** Wordset FACILITY + r'at-xy|key\?|page|' + # *** Wordset FACILITY-EXT + r'ekey|ekey>char|ekey\?|emit\?|ms|time&date|' + # *** Wordset FILE + r'BIN|CLOSE-FILE|CREATE-FILE|DELETE-FILE|FILE-POSITION|' + r'FILE-SIZE|INCLUDE-FILE|INCLUDED|OPEN-FILE|R\/O|' + r'R\/W|READ-FILE|READ-LINE|REPOSITION-FILE|RESIZE-FILE|' + r'S\"|SOURCE-ID|W/O|WRITE-FILE|WRITE-LINE|' + # *** Wordset FILE-EXT + r'FILE-STATUS|FLUSH-FILE|REFILL|RENAME-FILE|' + # *** Wordset FLOAT + r'>float|d>f|' + r'f!|f\*|f\+|f-|f\/|f0<|f0=|f<|f>d|f@|' + r'falign|faligned|fconstant|fdepth|fdrop|fdup|' + r'fliteral|float\+|floats|floor|fmax|fmin|' + r'fnegate|fover|frot|fround|fswap|fvariable|' + r'represent|' + # *** Wordset FLOAT-EXT + r'df!|df@|dfalign|dfaligned|dfloat\+|' + r'dfloats|f\*\*|f\.|fabs|facos|facosh|falog|' + r'fasin|fasinh|fatan|fatan2|fatanh|fcos|fcosh|' + r'fe\.|fexp|fexpm1|fln|flnp1|flog|fs\.|fsin|' + r'fsincos|fsinh|fsqrt|ftan|ftanh|f~|precision|' + r'set-precision|sf!|sf@|sfalign|sfaligned|sfloat\+|' + r'sfloats|' + # *** Wordset LOCAL + r'\(local\)|to|' + # *** Wordset LOCAL-EXT + r'locals\||' + # *** Wordset MEMORY + r'allocate|free|resize|' + # *** Wordset SEARCH + r'definitions|find|forth-wordlist|get-current|' + r'get-order|search-wordlist|set-current|set-order|' + r'wordlist|' + # *** Wordset SEARCH-EXT + r'also|forth|only|order|previous|' + # *** Wordset STRING + r'-trailing|\/string|blank|cmove|cmove>|compare|' + r'search|sliteral|' + # *** Wordset TOOLS + r'.s|dump|see|words|' + # *** Wordset TOOLS-EXT + r';code|' + r'ahead|assembler|bye|code|cs-pick|cs-roll|' + r'editor|state|\[else\]|\[if\]|\[then\]|' + # *** Wordset TOOLS-EXT-obsolescent + r'forget|' + # Forth 2012 + r'defer|defer@|defer!|action-of|begin-structure|field:|buffer:|' + r'parse-name|buffer:|traverse-wordlist|n>r|nr>|2value|fvalue|' + r'name>interpret|name>compile|name>string|' + r'cfield:|end-structure)'+delimiter, Keyword), + + # Numbers + (r'(\$[0-9A-F]+)', Number.Hex), + (r'(\#|%|&|\-|\+)?[0-9]+', Number.Integer), + (r'(\#|%|&|\-|\+)?[0-9.]+', Keyword.Type), + # amforth specific + (r'(@i|!i|@e|!e|pause|noop|turnkey|sleep|' + r'itype|icompare|sp@|sp!|rp@|rp!|up@|up!|' + r'>a|a>|a@|a!|a@+|a@-|>b|b>|b@|b!|b@+|b@-|' + r'find-name|1ms|' + r'sp0|rp0|\(evaluate\)|int-trap|int!)' + delimiter, + Name.Constant), + # a proposal + (r'(do-recognizer|r:fail|recognizer:|get-recognizers|' + r'set-recognizers|r:float|r>comp|r>int|r>post|' + r'r:name|r:word|r:dnum|r:num|recognizer|forth-recognizer|' + r'rec:num|rec:float|rec:word)' + delimiter, Name.Decorator), + # defining words. The next word is a new command name + (r'(Evalue|Rvalue|Uvalue|Edefer|Rdefer|Udefer)(\s+)', + bygroups(Keyword.Namespace, Text), 'worddef'), + + (valid_name, Name.Function), # Anything else is executed + + ], + 'worddef': [ + (r'\S+', Name.Class, '#pop'), + ], + 'stringdef': [ + (r'[^"]+', String, '#pop'), + ], + } diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/fortran.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/fortran.py new file mode 100644 index 0000000000000000000000000000000000000000..1a611c9dc21104b0043c6fcd9d10f89a6dba35fb --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/fortran.py @@ -0,0 +1,205 @@ +# -*- coding: utf-8 -*- +""" + pygments.lexers.fortran + ~~~~~~~~~~~~~~~~~~~~~~~ + + Lexers for Fortran languages. + + :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS. + :license: BSD, see LICENSE for details. +""" + +import re + +from pygments.lexer import RegexLexer, bygroups, include, words, using, default +from pygments.token import Text, Comment, Operator, Keyword, Name, String, \ + Number, Punctuation, Generic + +__all__ = ['FortranLexer', 'FortranFixedLexer'] + + +class FortranLexer(RegexLexer): + """ + Lexer for FORTRAN 90 code. + + .. versionadded:: 0.10 + """ + name = 'Fortran' + aliases = ['fortran'] + filenames = ['*.f03', '*.f90', '*.F03', '*.F90'] + mimetypes = ['text/x-fortran'] + flags = re.IGNORECASE | re.MULTILINE + + # Data Types: INTEGER, REAL, COMPLEX, LOGICAL, CHARACTER and DOUBLE PRECISION + # Operators: **, *, +, -, /, <, >, <=, >=, ==, /= + # Logical (?): NOT, AND, OR, EQV, NEQV + + # Builtins: + # http://gcc.gnu.org/onlinedocs/gcc-3.4.6/g77/Table-of-Intrinsic-Functions.html + + tokens = { + 'root': [ + (r'^#.*\n', Comment.Preproc), + (r'!.*\n', Comment), + include('strings'), + include('core'), + (r'[a-z][\w$]*', Name), + include('nums'), + (r'[\s]+', Text), + ], + 'core': [ + # Statements + (words(( + 'ABSTRACT', 'ACCEPT', 'ALL', 'ALLSTOP', 'ALLOCATABLE', 'ALLOCATE', + 'ARRAY', 'ASSIGN', 'ASSOCIATE', 'ASYNCHRONOUS', 'BACKSPACE', 'BIND', + 'BLOCK', 'BLOCKDATA', 'BYTE', 'CALL', 'CASE', 'CLASS', 'CLOSE', + 'CODIMENSION', 'COMMON', 'CONCURRRENT', 'CONTIGUOUS', 'CONTAINS', + 'CONTINUE', 'CRITICAL', 'CYCLE', 'DATA', 'DEALLOCATE', 'DECODE', + 'DEFERRED', 'DIMENSION', 'DO', 'ELEMENTAL', 'ELSE', 'ENCODE', 'END', + 'ENTRY', 'ENUM', 'ENUMERATOR', 'EQUIVALENCE', 'EXIT', 'EXTENDS', + 'EXTERNAL', 'EXTRINSIC', 'FILE', 'FINAL', 'FORALL', 'FORMAT', + 'FUNCTION', 'GENERIC', 'GOTO', 'IF', 'IMAGES', 'IMPLICIT', + 'IMPORT', 'IMPURE', 'INCLUDE', 'INQUIRE', 'INTENT', 'INTERFACE', + 'INTRINSIC', 'IS', 'LOCK', 'MEMORY', 'MODULE', 'NAMELIST', 'NULLIFY', + 'NONE', 'NON_INTRINSIC', 'NON_OVERRIDABLE', 'NOPASS', 'OPEN', 'OPTIONAL', + 'OPTIONS', 'PARAMETER', 'PASS', 'PAUSE', 'POINTER', 'PRINT', 'PRIVATE', + 'PROGRAM', 'PROCEDURE', 'PROTECTED', 'PUBLIC', 'PURE', 'READ', + 'RECURSIVE', 'RESULT', 'RETURN', 'REWIND', 'SAVE', 'SELECT', 'SEQUENCE', + 'STOP', 'SUBMODULE', 'SUBROUTINE', 'SYNC', 'SYNCALL', 'SYNCIMAGES', + 'SYNCMEMORY', 'TARGET', 'THEN', 'TYPE', 'UNLOCK', 'USE', 'VALUE', + 'VOLATILE', 'WHERE', 'WRITE', 'WHILE'), prefix=r'\b', suffix=r'\s*\b'), + Keyword), + + # Data Types + (words(( + 'CHARACTER', 'COMPLEX', 'DOUBLE PRECISION', 'DOUBLE COMPLEX', 'INTEGER', + 'LOGICAL', 'REAL', 'C_INT', 'C_SHORT', 'C_LONG', 'C_LONG_LONG', + 'C_SIGNED_CHAR', 'C_SIZE_T', 'C_INT8_T', 'C_INT16_T', 'C_INT32_T', + 'C_INT64_T', 'C_INT_LEAST8_T', 'C_INT_LEAST16_T', 'C_INT_LEAST32_T', + 'C_INT_LEAST64_T', 'C_INT_FAST8_T', 'C_INT_FAST16_T', 'C_INT_FAST32_T', + 'C_INT_FAST64_T', 'C_INTMAX_T', 'C_INTPTR_T', 'C_FLOAT', 'C_DOUBLE', + 'C_LONG_DOUBLE', 'C_FLOAT_COMPLEX', 'C_DOUBLE_COMPLEX', + 'C_LONG_DOUBLE_COMPLEX', 'C_BOOL', 'C_CHAR', 'C_PTR', 'C_FUNPTR'), + prefix=r'\b', suffix=r'\s*\b'), + Keyword.Type), + + # Operators + (r'(\*\*|\*|\+|-|\/|<|>|<=|>=|==|\/=|=)', Operator), + + (r'(::)', Keyword.Declaration), + + (r'[()\[\],:&%;.]', Punctuation), + # Intrinsics + (words(( + 'Abort', 'Abs', 'Access', 'AChar', 'ACos', 'ACosH', 'AdjustL', + 'AdjustR', 'AImag', 'AInt', 'Alarm', 'All', 'Allocated', 'ALog', + 'AMax', 'AMin', 'AMod', 'And', 'ANInt', 'Any', 'ASin', 'ASinH', + 'Associated', 'ATan', 'ATanH', 'Atomic_Define', 'Atomic_Ref', + 'BesJ', 'BesJN', 'Bessel_J0', 'Bessel_J1', 'Bessel_JN', 'Bessel_Y0', + 'Bessel_Y1', 'Bessel_YN', 'BesY', 'BesYN', 'BGE', 'BGT', 'BLE', + 'BLT', 'Bit_Size', 'BTest', 'CAbs', 'CCos', 'Ceiling', 'CExp', + 'Char', 'ChDir', 'ChMod', 'CLog', 'Cmplx', 'Command_Argument_Count', + 'Complex', 'Conjg', 'Cos', 'CosH', 'Count', 'CPU_Time', 'CShift', + 'CSin', 'CSqRt', 'CTime', 'C_Loc', 'C_Associated', + 'C_Null_Ptr', 'C_Null_Funptr', 'C_F_Pointer', 'C_F_ProcPointer', + 'C_Null_Char', 'C_Alert', 'C_Backspace', 'C_Form_Feed', 'C_FunLoc', + 'C_Sizeof', 'C_New_Line', 'C_Carriage_Return', + 'C_Horizontal_Tab', 'C_Vertical_Tab', 'DAbs', 'DACos', 'DASin', + 'DATan', 'Date_and_Time', 'DbesJ', 'DbesJN', 'DbesY', + 'DbesYN', 'Dble', 'DCos', 'DCosH', 'DDiM', 'DErF', + 'DErFC', 'DExp', 'Digits', 'DiM', 'DInt', 'DLog', 'DMax', + 'DMin', 'DMod', 'DNInt', 'Dot_Product', 'DProd', 'DSign', 'DSinH', + 'DShiftL', 'DShiftR', 'DSin', 'DSqRt', 'DTanH', 'DTan', 'DTime', + 'EOShift', 'Epsilon', 'ErF', 'ErFC', 'ErFC_Scaled', 'ETime', + 'Execute_Command_Line', 'Exit', 'Exp', 'Exponent', 'Extends_Type_Of', + 'FDate', 'FGet', 'FGetC', 'FindLoc', 'Float', 'Floor', 'Flush', + 'FNum', 'FPutC', 'FPut', 'Fraction', 'FSeek', 'FStat', 'FTell', + 'Gamma', 'GError', 'GetArg', 'Get_Command', 'Get_Command_Argument', + 'Get_Environment_Variable', 'GetCWD', 'GetEnv', 'GetGId', 'GetLog', + 'GetPId', 'GetUId', 'GMTime', 'HostNm', 'Huge', 'Hypot', 'IAbs', + 'IAChar', 'IAll', 'IAnd', 'IAny', 'IArgC', 'IBClr', 'IBits', + 'IBSet', 'IChar', 'IDate', 'IDiM', 'IDInt', 'IDNInt', 'IEOr', + 'IErrNo', 'IFix', 'Imag', 'ImagPart', 'Image_Index', 'Index', + 'Int', 'IOr', 'IParity', 'IRand', 'IsaTty', 'IShft', 'IShftC', + 'ISign', 'Iso_C_Binding', 'Is_Contiguous', 'Is_Iostat_End', + 'Is_Iostat_Eor', 'ITime', 'Kill', 'Kind', 'LBound', 'LCoBound', + 'Len', 'Len_Trim', 'LGe', 'LGt', 'Link', 'LLe', 'LLt', 'LnBlnk', + 'Loc', 'Log', 'Log_Gamma', 'Logical', 'Long', 'LShift', 'LStat', + 'LTime', 'MaskL', 'MaskR', 'MatMul', 'Max', 'MaxExponent', + 'MaxLoc', 'MaxVal', 'MClock', 'Merge', 'Merge_Bits', 'Move_Alloc', + 'Min', 'MinExponent', 'MinLoc', 'MinVal', 'Mod', 'Modulo', 'MvBits', + 'Nearest', 'New_Line', 'NInt', 'Norm2', 'Not', 'Null', 'Num_Images', + 'Or', 'Pack', 'Parity', 'PError', 'Precision', 'Present', 'Product', + 'Radix', 'Rand', 'Random_Number', 'Random_Seed', 'Range', 'Real', + 'RealPart', 'Rename', 'Repeat', 'Reshape', 'RRSpacing', 'RShift', + 'Same_Type_As', 'Scale', 'Scan', 'Second', 'Selected_Char_Kind', + 'Selected_Int_Kind', 'Selected_Real_Kind', 'Set_Exponent', 'Shape', + 'ShiftA', 'ShiftL', 'ShiftR', 'Short', 'Sign', 'Signal', 'SinH', + 'Sin', 'Sleep', 'Sngl', 'Spacing', 'Spread', 'SqRt', 'SRand', + 'Stat', 'Storage_Size', 'Sum', 'SymLnk', 'System', 'System_Clock', + 'Tan', 'TanH', 'Time', 'This_Image', 'Tiny', 'TrailZ', 'Transfer', + 'Transpose', 'Trim', 'TtyNam', 'UBound', 'UCoBound', 'UMask', + 'Unlink', 'Unpack', 'Verify', 'XOr', 'ZAbs', 'ZCos', 'ZExp', + 'ZLog', 'ZSin', 'ZSqRt'), prefix=r'\b', suffix=r'\s*\b'), + Name.Builtin), + + # Booleans + (r'\.(true|false)\.', Name.Builtin), + # Comparing Operators + (r'\.(eq|ne|lt|le|gt|ge|not|and|or|eqv|neqv)\.', Operator.Word), + ], + + 'strings': [ + (r'(?s)"(\\\\|\\[0-7]+|\\.|[^"\\])*"', String.Double), + (r"(?s)'(\\\\|\\[0-7]+|\\.|[^'\\])*'", String.Single), + ], + + 'nums': [ + (r'\d+(?![.e])(_[a-z]\w+)?', Number.Integer), + (r'[+-]?\d*\.\d+([ed][-+]?\d+)?(_[a-z]\w+)?', Number.Float), + (r'[+-]?\d+\.\d*([ed][-+]?\d+)?(_[a-z]\w+)?', Number.Float), + ], + } + + +class FortranFixedLexer(RegexLexer): + """ + Lexer for fixed format Fortran. + + .. versionadded:: 2.1 + """ + name = 'FortranFixed' + aliases = ['fortranfixed'] + filenames = ['*.f', '*.F'] + + flags = re.IGNORECASE + + def _lex_fortran(self, match, ctx=None): + """Lex a line just as free form fortran without line break.""" + lexer = FortranLexer() + text = match.group(0) + "\n" + for index, token, value in lexer.get_tokens_unprocessed(text): + value = value.replace('\n', '') + if value != '': + yield index, token, value + + tokens = { + 'root': [ + (r'[C*].*\n', Comment), + (r'#.*\n', Comment.Preproc), + (r' {0,4}!.*\n', Comment), + (r'(.{5})', Name.Label, 'cont-char'), + (r'.*\n', using(FortranLexer)), + ], + 'cont-char': [ + (' ', Text, 'code'), + ('0', Comment, 'code'), + ('.', Generic.Strong, 'code'), + ], + 'code': [ + (r'(.{66})(.*)(\n)', + bygroups(_lex_fortran, Comment, Text), 'root'), + (r'(.*)(\n)', bygroups(_lex_fortran, Text), 'root'), + default('root'), + ] + } diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/foxpro.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/foxpro.py new file mode 100644 index 0000000000000000000000000000000000000000..7c0d2621919abde9cb0cd70de2c108b88bb7ab3c --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/foxpro.py @@ -0,0 +1,428 @@ +# -*- coding: utf-8 -*- +""" + pygments.lexers.foxpro + ~~~~~~~~~~~~~~~~~~~~~~ + + Simple lexer for Microsoft Visual FoxPro source code. + + :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS. + :license: BSD, see LICENSE for details. +""" + +import re + +from pygments.lexer import RegexLexer +from pygments.token import Punctuation, Text, Comment, Operator, Keyword, \ + Name, String + +__all__ = ['FoxProLexer'] + + +class FoxProLexer(RegexLexer): + """Lexer for Microsoft Visual FoxPro language. + + FoxPro syntax allows to shorten all keywords and function names + to 4 characters. Shortened forms are not recognized by this lexer. + + .. versionadded:: 1.6 + """ + + name = 'FoxPro' + aliases = ['foxpro', 'vfp', 'clipper', 'xbase'] + filenames = ['*.PRG', '*.prg'] + mimetype = [] + + flags = re.IGNORECASE | re.MULTILINE + + tokens = { + 'root': [ + (r';\s*\n', Punctuation), # consume newline + (r'(^|\n)\s*', Text, 'newline'), + + # Square brackets may be used for array indices + # and for string literal. Look for arrays + # before matching string literals. + (r'(?<=\w)\[[0-9, ]+\]', Text), + (r'\'[^\'\n]*\'|"[^"\n]*"|\[[^]*]\]', String), + (r'(^\s*\*|&&|&&).*?\n', Comment.Single), + + (r'(ABS|ACLASS|ACOPY|ACOS|ADATABASES|ADBOBJECTS|ADDBS|' + r'ADDPROPERTY|ADEL|ADIR|ADLLS|ADOCKSTATE|AELEMENT|AERROR|' + r'AEVENTS|AFIELDS|AFONT|AGETCLASS|AGETFILEVERSION|AINS|' + r'AINSTANCE|ALANGUAGE|ALEN|ALIAS|ALINES|ALLTRIM|' + r'AMEMBERS|AMOUSEOBJ|ANETRESOURCES|APRINTERS|APROCINFO|' + r'ASC|ASCAN|ASELOBJ|ASESSIONS|ASIN|ASORT|ASQLHANDLES|' + r'ASTACKINFO|ASUBSCRIPT|AT|AT_C|ATAGINFO|ATAN|ATC|ATCC|' + r'ATCLINE|ATLINE|ATN2|AUSED|AVCXCLASSES|BAR|BARCOUNT|' + r'BARPROMPT|BETWEEN|BINDEVENT|BINTOC|BITAND|BITCLEAR|' + r'BITLSHIFT|BITNOT|BITOR|BITRSHIFT|BITSET|BITTEST|BITXOR|' + r'BOF|CANDIDATE|CAPSLOCK|CAST|CDOW|CDX|CEILING|CHR|CHRSAW|' + r'CHRTRAN|CHRTRANC|CLEARRESULTSET|CMONTH|CNTBAR|CNTPAD|COL|' + r'COM|Functions|COMARRAY|COMCLASSINFO|COMPOBJ|COMPROP|' + r'COMRETURNERROR|COS|CPCONVERT|CPCURRENT|CPDBF|CREATEBINARY|' + r'CREATEOBJECT|CREATEOBJECTEX|CREATEOFFLINE|CTOBIN|CTOD|' + r'CTOT|CURDIR|CURSORGETPROP|CURSORSETPROP|CURSORTOXML|' + r'CURVAL|DATE|DATETIME|DAY|DBC|DBF|DBGETPROP|DBSETPROP|' + r'DBUSED|DDEAbortTrans|DDEAdvise|DDEEnabled|DDEExecute|' + r'DDEInitiate|DDELastError|DDEPoke|DDERequest|DDESetOption|' + r'DDESetService|DDESetTopic|DDETerminate|DEFAULTEXT|' + r'DELETED|DESCENDING|DIFFERENCE|DIRECTORY|DISKSPACE|' + r'DisplayPath|DMY|DODEFAULT|DOW|DRIVETYPE|DROPOFFLINE|' + r'DTOC|DTOR|DTOS|DTOT|EDITSOURCE|EMPTY|EOF|ERROR|EVAL(UATE)?|' + r'EVENTHANDLER|EVL|EXECSCRIPT|EXP|FCHSIZE|FCLOSE|FCOUNT|' + r'FCREATE|FDATE|FEOF|FERROR|FFLUSH|FGETS|FIELD|FILE|' + r'FILETOSTR|FILTER|FKLABEL|FKMAX|FLDLIST|FLOCK|FLOOR|' + r'FONTMETRIC|FOPEN|FOR|FORCEEXT|FORCEPATH|FOUND|FPUTS|' + r'FREAD|FSEEK|FSIZE|FTIME|FULLPATH|FV|FWRITE|' + r'GETAUTOINCVALUE|GETBAR|GETCOLOR|GETCP|GETDIR|GETENV|' + r'GETFILE|GETFLDSTATE|GETFONT|GETINTERFACE|' + r'GETNEXTMODIFIED|GETOBJECT|GETPAD|GETPEM|GETPICT|' + r'GETPRINTER|GETRESULTSET|GETWORDCOUNT|GETWORDNUM|' + r'GETCURSORADAPTER|GOMONTH|HEADER|HOME|HOUR|ICASE|' + r'IDXCOLLATE|IIF|IMESTATUS|INDBC|INDEXSEEK|INKEY|INLIST|' + r'INPUTBOX|INSMODE|INT|ISALPHA|ISBLANK|ISCOLOR|ISDIGIT|' + r'ISEXCLUSIVE|ISFLOCKED|ISLEADBYTE|ISLOWER|ISMEMOFETCHED|' + r'ISMOUSE|ISNULL|ISPEN|ISREADONLY|ISRLOCKED|' + r'ISTRANSACTABLE|ISUPPER|JUSTDRIVE|JUSTEXT|JUSTFNAME|' + r'JUSTPATH|JUSTSTEM|KEY|KEYMATCH|LASTKEY|LEFT|LEFTC|LEN|' + r'LENC|LIKE|LIKEC|LINENO|LOADPICTURE|LOCFILE|LOCK|LOG|' + r'LOG10|LOOKUP|LOWER|LTRIM|LUPDATE|MAKETRANSACTABLE|MAX|' + r'MCOL|MDOWN|MDX|MDY|MEMLINES|MEMORY|MENU|MESSAGE|' + r'MESSAGEBOX|MIN|MINUTE|MLINE|MOD|MONTH|MRKBAR|MRKPAD|' + r'MROW|MTON|MWINDOW|NDX|NEWOBJECT|NORMALIZE|NTOM|NUMLOCK|' + r'NVL|OBJNUM|OBJTOCLIENT|OBJVAR|OCCURS|OEMTOANSI|OLDVAL|' + r'ON|ORDER|OS|PAD|PADL|PARAMETERS|PAYMENT|PCOL|PCOUNT|' + r'PEMSTATUS|PI|POPUP|PRIMARY|PRINTSTATUS|PRMBAR|PRMPAD|' + r'PROGRAM|PROMPT|PROPER|PROW|PRTINFO|PUTFILE|PV|QUARTER|' + r'RAISEEVENT|RAND|RAT|RATC|RATLINE|RDLEVEL|READKEY|RECCOUNT|' + r'RECNO|RECSIZE|REFRESH|RELATION|REPLICATE|REQUERY|RGB|' + r'RGBSCHEME|RIGHT|RIGHTC|RLOCK|ROUND|ROW|RTOD|RTRIM|' + r'SAVEPICTURE|SCHEME|SCOLS|SEC|SECONDS|SEEK|SELECT|SET|' + r'SETFLDSTATE|SETRESULTSET|SIGN|SIN|SKPBAR|SKPPAD|SOUNDEX|' + r'SPACE|SQLCANCEL|SQLCOLUMNS|SQLCOMMIT|SQLCONNECT|' + r'SQLDISCONNECT|SQLEXEC|SQLGETPROP|SQLIDLEDISCONNECT|' + r'SQLMORERESULTS|SQLPREPARE|SQLROLLBACK|SQLSETPROP|' + r'SQLSTRINGCONNECT|SQLTABLES|SQRT|SROWS|STR|STRCONV|' + r'STREXTRACT|STRTOFILE|STRTRAN|STUFF|STUFFC|SUBSTR|' + r'SUBSTRC|SYS|SYSMETRIC|TABLEREVERT|TABLEUPDATE|TAG|' + r'TAGCOUNT|TAGNO|TAN|TARGET|TEXTMERGE|TIME|TRANSFORM|' + r'TRIM|TTOC|TTOD|TXNLEVEL|TXTWIDTH|TYPE|UNBINDEVENTS|' + r'UNIQUE|UPDATED|UPPER|USED|VAL|VARREAD|VARTYPE|VERSION|' + r'WBORDER|WCHILD|WCOLS|WDOCKABLE|WEEK|WEXIST|WFONT|WLAST|' + r'WLCOL|WLROW|WMAXIMUM|WMINIMUM|WONTOP|WOUTPUT|WPARENT|' + r'WREAD|WROWS|WTITLE|WVISIBLE|XMLTOCURSOR|XMLUPDATEGRAM|' + r'YEAR)(?=\s*\()', Name.Function), + + (r'_ALIGNMENT|_ASCIICOLS|_ASCIIROWS|_ASSIST|_BEAUTIFY|_BOX|' + r'_BROWSER|_BUILDER|_CALCMEM|_CALCVALUE|_CLIPTEXT|_CONVERTER|' + r'_COVERAGE|_CUROBJ|_DBLCLICK|_DIARYDATE|_DOS|_FOXDOC|_FOXREF|' + r'_GALLERY|_GENGRAPH|_GENHTML|_GENMENU|_GENPD|_GENSCRN|' + r'_GENXTAB|_GETEXPR|_INCLUDE|_INCSEEK|_INDENT|_LMARGIN|_MAC|' + r'_MENUDESIGNER|_MLINE|_PADVANCE|_PAGENO|_PAGETOTAL|_PBPAGE|' + r'_PCOLNO|_PCOPIES|_PDRIVER|_PDSETUP|_PECODE|_PEJECT|_PEPAGE|' + r'_PLENGTH|_PLINENO|_PLOFFSET|_PPITCH|_PQUALITY|_PRETEXT|' + r'_PSCODE|_PSPACING|_PWAIT|_RMARGIN|_REPORTBUILDER|' + r'_REPORTOUTPUT|_REPORTPREVIEW|_SAMPLES|_SCCTEXT|_SCREEN|' + r'_SHELL|_SPELLCHK|_STARTUP|_TABS|_TALLY|_TASKPANE|_TEXT|' + r'_THROTTLE|_TOOLBOX|_TOOLTIPTIMEOUT|_TRANSPORT|_TRIGGERLEVEL|' + r'_UNIX|_VFP|_WINDOWS|_WIZARD|_WRAP', Keyword.Pseudo), + + (r'THISFORMSET|THISFORM|THIS', Name.Builtin), + + (r'Application|CheckBox|Collection|Column|ComboBox|' + r'CommandButton|CommandGroup|Container|Control|CursorAdapter|' + r'Cursor|Custom|DataEnvironment|DataObject|EditBox|' + r'Empty|Exception|Fields|Files|File|FormSet|Form|FoxCode|' + r'Grid|Header|Hyperlink|Image|Label|Line|ListBox|Objects|' + r'OptionButton|OptionGroup|PageFrame|Page|ProjectHook|Projects|' + r'Project|Relation|ReportListener|Separator|Servers|Server|' + r'Session|Shape|Spinner|Tables|TextBox|Timer|ToolBar|' + r'XMLAdapter|XMLField|XMLTable', Name.Class), + + (r'm\.[a-z_]\w*', Name.Variable), + (r'\.(F|T|AND|OR|NOT|NULL)\.|\b(AND|OR|NOT|NULL)\b', Operator.Word), + + (r'\.(ActiveColumn|ActiveControl|ActiveForm|ActivePage|' + r'ActiveProject|ActiveRow|AddLineFeeds|ADOCodePage|Alias|' + r'Alignment|Align|AllowAddNew|AllowAutoColumnFit|' + r'AllowCellSelection|AllowDelete|AllowHeaderSizing|' + r'AllowInsert|AllowModalMessages|AllowOutput|AllowRowSizing|' + r'AllowSimultaneousFetch|AllowTabs|AllowUpdate|' + r'AlwaysOnBottom|AlwaysOnTop|Anchor|Application|' + r'AutoActivate|AutoCenter|AutoCloseTables|AutoComplete|' + r'AutoCompSource|AutoCompTable|AutoHideScrollBar|' + r'AutoIncrement|AutoOpenTables|AutoRelease|AutoSize|' + r'AutoVerbMenu|AutoYield|BackColor|ForeColor|BackStyle|' + r'BaseClass|BatchUpdateCount|BindControls|BorderColor|' + r'BorderStyle|BorderWidth|BoundColumn|BoundTo|Bound|' + r'BreakOnError|BufferModeOverride|BufferMode|' + r'BuildDateTime|ButtonCount|Buttons|Cancel|Caption|' + r'Centered|Century|ChildAlias|ChildOrder|ChildTable|' + r'ClassLibrary|Class|ClipControls|Closable|CLSID|CodePage|' + r'ColorScheme|ColorSource|ColumnCount|ColumnLines|' + r'ColumnOrder|Columns|ColumnWidths|CommandClauses|' + r'Comment|CompareMemo|ConflictCheckCmd|ConflictCheckType|' + r'ContinuousScroll|ControlBox|ControlCount|Controls|' + r'ControlSource|ConversionFunc|Count|CurrentControl|' + r'CurrentDataSession|CurrentPass|CurrentX|CurrentY|' + r'CursorSchema|CursorSource|CursorStatus|Curvature|' + r'Database|DataSessionID|DataSession|DataSourceType|' + r'DataSource|DataType|DateFormat|DateMark|Debug|' + r'DeclareXMLPrefix|DEClassLibrary|DEClass|DefaultFilePath|' + r'Default|DefOLELCID|DeleteCmdDataSourceType|DeleteCmdDataSource|' + r'DeleteCmd|DeleteMark|Description|Desktop|' + r'Details|DisabledBackColor|DisabledForeColor|' + r'DisabledItemBackColor|DisabledItemForeColor|' + r'DisabledPicture|DisableEncode|DisplayCount|' + r'DisplayValue|Dockable|Docked|DockPosition|' + r'DocumentFile|DownPicture|DragIcon|DragMode|DrawMode|' + r'DrawStyle|DrawWidth|DynamicAlignment|DynamicBackColor|' + r'DynamicForeColor|DynamicCurrentControl|DynamicFontBold|' + r'DynamicFontItalic|DynamicFontStrikethru|' + r'DynamicFontUnderline|DynamicFontName|DynamicFontOutline|' + r'DynamicFontShadow|DynamicFontSize|DynamicInputMask|' + r'DynamicLineHeight|EditorOptions|Enabled|' + r'EnableHyperlinks|Encrypted|ErrorNo|Exclude|Exclusive|' + r'FetchAsNeeded|FetchMemoCmdList|FetchMemoDataSourceType|' + r'FetchMemoDataSource|FetchMemo|FetchSize|' + r'FileClassLibrary|FileClass|FillColor|FillStyle|Filter|' + r'FirstElement|FirstNestedTable|Flags|FontBold|FontItalic|' + r'FontStrikethru|FontUnderline|FontCharSet|FontCondense|' + r'FontExtend|FontName|FontOutline|FontShadow|FontSize|' + r'ForceCloseTag|Format|FormCount|FormattedOutput|Forms|' + r'FractionDigits|FRXDataSession|FullName|GDIPlusGraphics|' + r'GridLineColor|GridLines|GridLineWidth|HalfHeightCaption|' + r'HeaderClassLibrary|HeaderClass|HeaderHeight|Height|' + r'HelpContextID|HideSelection|HighlightBackColor|' + r'HighlightForeColor|HighlightStyle|HighlightRowLineWidth|' + r'HighlightRow|Highlight|HomeDir|Hours|HostName|' + r'HScrollSmallChange|hWnd|Icon|IncrementalSearch|Increment|' + r'InitialSelectedAlias|InputMask|InsertCmdDataSourceType|' + r'InsertCmdDataSource|InsertCmdRefreshCmd|' + r'InsertCmdRefreshFieldList|InsertCmdRefreshKeyFieldList|' + r'InsertCmd|Instancing|IntegralHeight|' + r'Interval|IMEMode|IsAttribute|IsBase64|IsBinary|IsNull|' + r'IsDiffGram|IsLoaded|ItemBackColor,|ItemData|ItemIDData|' + r'ItemTips|IXMLDOMElement|KeyboardHighValue|KeyboardLowValue|' + r'Keyfield|KeyFieldList|KeyPreview|KeySort|LanguageOptions|' + r'LeftColumn|Left|LineContents|LineNo|LineSlant|LinkMaster|' + r'ListCount|ListenerType|ListIndex|ListItemID|ListItem|' + r'List|LockColumnsLeft|LockColumns|LockScreen|MacDesktop|' + r'MainFile|MapN19_4ToCurrency|MapBinary|MapVarchar|Margin|' + r'MaxButton|MaxHeight|MaxLeft|MaxLength|MaxRecords|MaxTop|' + r'MaxWidth|MDIForm|MemberClassLibrary|MemberClass|' + r'MemoWindow|Message|MinButton|MinHeight|MinWidth|' + r'MouseIcon|MousePointer|Movable|MoverBars|MultiSelect|' + r'Name|NestedInto|NewIndex|NewItemID|NextSiblingTable|' + r'NoCpTrans|NoDataOnLoad|NoData|NullDisplay|' + r'NumberOfElements|Object|OLEClass|OLEDragMode|' + r'OLEDragPicture|OLEDropEffects|OLEDropHasData|' + r'OLEDropMode|OLEDropTextInsertion|OLELCID|' + r'OLERequestPendingTimeout|OLEServerBusyRaiseError|' + r'OLEServerBusyTimeout|OLETypeAllowed|OneToMany|' + r'OpenViews|OpenWindow|Optimize|OrderDirection|Order|' + r'OutputPageCount|OutputType|PageCount|PageHeight|' + r'PageNo|PageOrder|Pages|PageTotal|PageWidth|' + r'PanelLink|Panel|ParentAlias|ParentClass|ParentTable|' + r'Parent|Partition|PasswordChar|PictureMargin|' + r'PicturePosition|PictureSpacing|PictureSelectionDisplay|' + r'PictureVal|Picture|Prepared|' + r'PolyPoints|PreserveWhiteSpace|PreviewContainer|' + r'PrintJobName|Procedure|PROCESSID|ProgID|ProjectHookClass|' + r'ProjectHookLibrary|ProjectHook|QuietMode|' + r'ReadCycle|ReadLock|ReadMouse|ReadObject|ReadOnly|' + r'ReadSave|ReadTimeout|RecordMark|RecordSourceType|' + r'RecordSource|RefreshAlias|' + r'RefreshCmdDataSourceType|RefreshCmdDataSource|RefreshCmd|' + r'RefreshIgnoreFieldList|RefreshTimeStamp|RelationalExpr|' + r'RelativeColumn|RelativeRow|ReleaseType|Resizable|' + r'RespectCursorCP|RespectNesting|RightToLeft|RotateFlip|' + r'Rotation|RowColChange|RowHeight|RowSourceType|' + r'RowSource|ScaleMode|SCCProvider|SCCStatus|ScrollBars|' + r'Seconds|SelectCmd|SelectedID|' + r'SelectedItemBackColor|SelectedItemForeColor|Selected|' + r'SelectionNamespaces|SelectOnEntry|SelLength|SelStart|' + r'SelText|SendGDIPlusImage|SendUpdates|ServerClassLibrary|' + r'ServerClass|ServerHelpFile|ServerName|' + r'ServerProject|ShowTips|ShowInTaskbar|ShowWindow|' + r'Sizable|SizeBox|SOM|Sorted|Sparse|SpecialEffect|' + r'SpinnerHighValue|SpinnerLowValue|SplitBar|StackLevel|' + r'StartMode|StatusBarText|StatusBar|Stretch|StrictDateEntry|' + r'Style|TabIndex|Tables|TabOrientation|Tabs|TabStop|' + r'TabStretch|TabStyle|Tag|TerminateRead|Text|Themes|' + r'ThreadID|TimestampFieldList|TitleBar|ToolTipText|' + r'TopIndex|TopItemID|Top|TwoPassProcess|TypeLibCLSID|' + r'TypeLibDesc|TypeLibName|Type|Unicode|UpdatableFieldList|' + r'UpdateCmdDataSourceType|UpdateCmdDataSource|' + r'UpdateCmdRefreshCmd|UpdateCmdRefreshFieldList|' + r'UpdateCmdRefreshKeyFieldList|UpdateCmd|' + r'UpdateGramSchemaLocation|UpdateGram|UpdateNameList|UpdateType|' + r'UseCodePage|UseCursorSchema|UseDeDataSource|UseMemoSize|' + r'UserValue|UseTransactions|UTF8Encoded|Value|VersionComments|' + r'VersionCompany|VersionCopyright|VersionDescription|' + r'VersionNumber|VersionProduct|VersionTrademarks|Version|' + r'VFPXMLProgID|ViewPortHeight|ViewPortLeft|' + r'ViewPortTop|ViewPortWidth|VScrollSmallChange|View|Visible|' + r'VisualEffect|WhatsThisButton|WhatsThisHelpID|WhatsThisHelp|' + r'WhereType|Width|WindowList|WindowState|WindowType|WordWrap|' + r'WrapCharInCDATA|WrapInCDATA|WrapMemoInCDATA|XMLAdapter|' + r'XMLConstraints|XMLNameIsXPath|XMLNamespace|XMLName|' + r'XMLPrefix|XMLSchemaLocation|XMLTable|XMLType|' + r'XSDfractionDigits|XSDmaxLength|XSDtotalDigits|' + r'XSDtype|ZoomBox)', Name.Attribute), + + (r'\.(ActivateCell|AddColumn|AddItem|AddListItem|AddObject|' + r'AddProperty|AddTableSchema|AddToSCC|Add|' + r'ApplyDiffgram|Attach|AutoFit|AutoOpen|Box|Build|' + r'CancelReport|ChangesToCursor|CheckIn|CheckOut|Circle|' + r'CleanUp|ClearData|ClearStatus|Clear|CloneObject|CloseTables|' + r'Close|Cls|CursorAttach|CursorDetach|CursorFill|' + r'CursorRefresh|DataToClip|DelayedMemoFetch|DeleteColumn|' + r'Dock|DoMessage|DoScroll|DoStatus|DoVerb|Drag|Draw|Eval|' + r'GetData|GetDockState|GetFormat|GetKey|GetLatestVersion|' + r'GetPageHeight|GetPageWidth|Help|Hide|IncludePageInOutput|' + r'IndexToItemID|ItemIDToIndex|Item|LoadXML|Line|Modify|' + r'MoveItem|Move|Nest|OLEDrag|OnPreviewClose|OutputPage|' + r'Point|Print|PSet|Quit|ReadExpression|ReadMethod|' + r'RecordRefresh|Refresh|ReleaseXML|Release|RemoveFromSCC|' + r'RemoveItem|RemoveListItem|RemoveObject|Remove|' + r'Render|Requery|RequestData|ResetToDefault|Reset|Run|' + r'SaveAsClass|SaveAs|SetAll|SetData|SetFocus|SetFormat|' + r'SetMain|SetVar|SetViewPort|ShowWhatsThis|Show|' + r'SupportsListenerType|TextHeight|TextWidth|ToCursor|' + r'ToXML|UndoCheckOut|Unnest|UpdateStatus|WhatsThisMode|' + r'WriteExpression|WriteMethod|ZOrder)', Name.Function), + + (r'\.(Activate|AdjustObjectSize|AfterBand|AfterBuild|' + r'AfterCloseTables|AfterCursorAttach|AfterCursorClose|' + r'AfterCursorDetach|AfterCursorFill|AfterCursorRefresh|' + r'AfterCursorUpdate|AfterDelete|AfterInsert|' + r'AfterRecordRefresh|AfterUpdate|AfterDock|AfterReport|' + r'AfterRowColChange|BeforeBand|BeforeCursorAttach|' + r'BeforeCursorClose|BeforeCursorDetach|BeforeCursorFill|' + r'BeforeCursorRefresh|BeforeCursorUpdate|BeforeDelete|' + r'BeforeInsert|BeforeDock|BeforeOpenTables|' + r'BeforeRecordRefresh|BeforeReport|BeforeRowColChange|' + r'BeforeUpdate|Click|dbc_Activate|dbc_AfterAddTable|' + r'dbc_AfterAppendProc|dbc_AfterCloseTable|dbc_AfterCopyProc|' + r'dbc_AfterCreateConnection|dbc_AfterCreateOffline|' + r'dbc_AfterCreateTable|dbc_AfterCreateView|dbc_AfterDBGetProp|' + r'dbc_AfterDBSetProp|dbc_AfterDeleteConnection|' + r'dbc_AfterDropOffline|dbc_AfterDropTable|' + r'dbc_AfterModifyConnection|dbc_AfterModifyProc|' + r'dbc_AfterModifyTable|dbc_AfterModifyView|dbc_AfterOpenTable|' + r'dbc_AfterRemoveTable|dbc_AfterRenameConnection|' + r'dbc_AfterRenameTable|dbc_AfterRenameView|' + r'dbc_AfterValidateData|dbc_BeforeAddTable|' + r'dbc_BeforeAppendProc|dbc_BeforeCloseTable|' + r'dbc_BeforeCopyProc|dbc_BeforeCreateConnection|' + r'dbc_BeforeCreateOffline|dbc_BeforeCreateTable|' + r'dbc_BeforeCreateView|dbc_BeforeDBGetProp|' + r'dbc_BeforeDBSetProp|dbc_BeforeDeleteConnection|' + r'dbc_BeforeDropOffline|dbc_BeforeDropTable|' + r'dbc_BeforeModifyConnection|dbc_BeforeModifyProc|' + r'dbc_BeforeModifyTable|dbc_BeforeModifyView|' + r'dbc_BeforeOpenTable|dbc_BeforeRemoveTable|' + r'dbc_BeforeRenameConnection|dbc_BeforeRenameTable|' + r'dbc_BeforeRenameView|dbc_BeforeValidateData|' + r'dbc_CloseData|dbc_Deactivate|dbc_ModifyData|dbc_OpenData|' + r'dbc_PackData|DblClick|Deactivate|Deleted|Destroy|DoCmd|' + r'DownClick|DragDrop|DragOver|DropDown|ErrorMessage|Error|' + r'EvaluateContents|GotFocus|Init|InteractiveChange|KeyPress|' + r'LoadReport|Load|LostFocus|Message|MiddleClick|MouseDown|' + r'MouseEnter|MouseLeave|MouseMove|MouseUp|MouseWheel|Moved|' + r'OLECompleteDrag|OLEDragOver|OLEGiveFeedback|OLESetData|' + r'OLEStartDrag|OnMoveItem|Paint|ProgrammaticChange|' + r'QueryAddFile|QueryModifyFile|QueryNewFile|QueryRemoveFile|' + r'QueryRunFile|QueryUnload|RangeHigh|RangeLow|ReadActivate|' + r'ReadDeactivate|ReadShow|ReadValid|ReadWhen|Resize|' + r'RightClick|SCCInit|SCCDestroy|Scrolled|Timer|UIEnable|' + r'UnDock|UnloadReport|Unload|UpClick|Valid|When)', Name.Function), + + (r'\s+', Text), + # everything else is not colored + (r'.', Text), + ], + 'newline': [ + (r'\*.*?$', Comment.Single, '#pop'), + (r'(ACCEPT|ACTIVATE\s*MENU|ACTIVATE\s*POPUP|ACTIVATE\s*SCREEN|' + r'ACTIVATE\s*WINDOW|APPEND|APPEND\s*FROM|APPEND\s*FROM\s*ARRAY|' + r'APPEND\s*GENERAL|APPEND\s*MEMO|ASSIST|AVERAGE|BLANK|BROWSE|' + r'BUILD\s*APP|BUILD\s*EXE|BUILD\s*PROJECT|CALCULATE|CALL|' + r'CANCEL|CHANGE|CLEAR|CLOSE|CLOSE\s*MEMO|COMPILE|CONTINUE|' + r'COPY\s*FILE|COPY\s*INDEXES|COPY\s*MEMO|COPY\s*STRUCTURE|' + r'COPY\s*STRUCTURE\s*EXTENDED|COPY\s*TAG|COPY\s*TO|' + r'COPY\s*TO\s*ARRAY|COUNT|CREATE|CREATE\s*COLOR\s*SET|' + r'CREATE\s*CURSOR|CREATE\s*FROM|CREATE\s*LABEL|CREATE\s*MENU|' + r'CREATE\s*PROJECT|CREATE\s*QUERY|CREATE\s*REPORT|' + r'CREATE\s*SCREEN|CREATE\s*TABLE|CREATE\s*VIEW|DDE|' + r'DEACTIVATE\s*MENU|DEACTIVATE\s*POPUP|DEACTIVATE\s*WINDOW|' + r'DECLARE|DEFINE\s*BAR|DEFINE\s*BOX|DEFINE\s*MENU|' + r'DEFINE\s*PAD|DEFINE\s*POPUP|DEFINE\s*WINDOW|DELETE|' + r'DELETE\s*FILE|DELETE\s*TAG|DIMENSION|DIRECTORY|DISPLAY|' + r'DISPLAY\s*FILES|DISPLAY\s*MEMORY|DISPLAY\s*STATUS|' + r'DISPLAY\s*STRUCTURE|DO|EDIT|EJECT|EJECT\s*PAGE|ERASE|' + r'EXIT|EXPORT|EXTERNAL|FILER|FIND|FLUSH|FUNCTION|GATHER|' + r'GETEXPR|GO|GOTO|HELP|HIDE\s*MENU|HIDE\s*POPUP|' + r'HIDE\s*WINDOW|IMPORT|INDEX|INPUT|INSERT|JOIN|KEYBOARD|' + r'LABEL|LIST|LOAD|LOCATE|LOOP|MENU|MENU\s*TO|MODIFY\s*COMMAND|' + r'MODIFY\s*FILE|MODIFY\s*GENERAL|MODIFY\s*LABEL|MODIFY\s*MEMO|' + r'MODIFY\s*MENU|MODIFY\s*PROJECT|MODIFY\s*QUERY|' + r'MODIFY\s*REPORT|MODIFY\s*SCREEN|MODIFY\s*STRUCTURE|' + r'MODIFY\s*WINDOW|MOVE\s*POPUP|MOVE\s*WINDOW|NOTE|' + r'ON\s*APLABOUT|ON\s*BAR|ON\s*ERROR|ON\s*ESCAPE|' + r'ON\s*EXIT\s*BAR|ON\s*EXIT\s*MENU|ON\s*EXIT\s*PAD|' + r'ON\s*EXIT\s*POPUP|ON\s*KEY|ON\s*KEY\s*=|ON\s*KEY\s*LABEL|' + r'ON\s*MACHELP|ON\s*PAD|ON\s*PAGE|ON\s*READERROR|' + r'ON\s*SELECTION\s*BAR|ON\s*SELECTION\s*MENU|' + r'ON\s*SELECTION\s*PAD|ON\s*SELECTION\s*POPUP|ON\s*SHUTDOWN|' + r'PACK|PARAMETERS|PLAY\s*MACRO|POP\s*KEY|POP\s*MENU|' + r'POP\s*POPUP|PRIVATE|PROCEDURE|PUBLIC|PUSH\s*KEY|' + r'PUSH\s*MENU|PUSH\s*POPUP|QUIT|READ|READ\s*MENU|RECALL|' + r'REINDEX|RELEASE|RELEASE\s*MODULE|RENAME|REPLACE|' + r'REPLACE\s*FROM\s*ARRAY|REPORT|RESTORE\s*FROM|' + r'RESTORE\s*MACROS|RESTORE\s*SCREEN|RESTORE\s*WINDOW|' + r'RESUME|RETRY|RETURN|RUN|RUN\s*\/N"|RUNSCRIPT|' + r'SAVE\s*MACROS|SAVE\s*SCREEN|SAVE\s*TO|SAVE\s*WINDOWS|' + r'SCATTER|SCROLL|SEEK|SELECT|SET|SET\s*ALTERNATE|' + r'SET\s*ANSI|SET\s*APLABOUT|SET\s*AUTOSAVE|SET\s*BELL|' + r'SET\s*BLINK|SET\s*BLOCKSIZE|SET\s*BORDER|SET\s*BRSTATUS|' + r'SET\s*CARRY|SET\s*CENTURY|SET\s*CLEAR|SET\s*CLOCK|' + r'SET\s*COLLATE|SET\s*COLOR\s*OF|SET\s*COLOR\s*OF\s*SCHEME|' + r'SET\s*COLOR\s*SET|SET\s*COLOR\s*TO|SET\s*COMPATIBLE|' + r'SET\s*CONFIRM|SET\s*CONSOLE|SET\s*CURRENCY|SET\s*CURSOR|' + r'SET\s*DATE|SET\s*DEBUG|SET\s*DECIMALS|SET\s*DEFAULT|' + r'SET\s*DELETED|SET\s*DELIMITERS|SET\s*DEVELOPMENT|' + r'SET\s*DEVICE|SET\s*DISPLAY|SET\s*DOHISTORY|SET\s*ECHO|' + r'SET\s*ESCAPE|SET\s*EXACT|SET\s*EXCLUSIVE|SET\s*FIELDS|' + r'SET\s*FILTER|SET\s*FIXED|SET\s*FORMAT|SET\s*FULLPATH|' + r'SET\s*FUNCTION|SET\s*HEADINGS|SET\s*HELP|SET\s*HELPFILTER|' + r'SET\s*HOURS|SET\s*INDEX|SET\s*INTENSITY|SET\s*KEY|' + r'SET\s*KEYCOMP|SET\s*LIBRARY|SET\s*LOCK|SET\s*LOGERRORS|' + r'SET\s*MACDESKTOP|SET\s*MACHELP|SET\s*MACKEY|SET\s*MARGIN|' + r'SET\s*MARK\s*OF|SET\s*MARK\s*TO|SET\s*MEMOWIDTH|' + r'SET\s*MESSAGE|SET\s*MOUSE|SET\s*MULTILOCKS|SET\s*NEAR|' + r'SET\s*NOCPTRANS|SET\s*NOTIFY|SET\s*ODOMETER|SET\s*OPTIMIZE|' + r'SET\s*ORDER|SET\s*PALETTE|SET\s*PATH|SET\s*PDSETUP|' + r'SET\s*POINT|SET\s*PRINTER|SET\s*PROCEDURE|SET\s*READBORDER|' + r'SET\s*REFRESH|SET\s*RELATION|SET\s*RELATION\s*OFF|' + r'SET\s*REPROCESS|SET\s*RESOURCE|SET\s*SAFETY|SET\s*SCOREBOARD|' + r'SET\s*SEPARATOR|SET\s*SHADOWS|SET\s*SKIP|SET\s*SKIP\s*OF|' + r'SET\s*SPACE|SET\s*STATUS|SET\s*STATUS\s*BAR|SET\s*STEP|' + r'SET\s*STICKY|SET\s*SYSMENU|SET\s*TALK|SET\s*TEXTMERGE|' + r'SET\s*TEXTMERGE\s*DELIMITERS|SET\s*TOPIC|SET\s*TRBETWEEN|' + r'SET\s*TYPEAHEAD|SET\s*UDFPARMS|SET\s*UNIQUE|SET\s*VIEW|' + r'SET\s*VOLUME|SET\s*WINDOW\s*OF\s*MEMO|SET\s*XCMDFILE|' + r'SHOW\s*GET|SHOW\s*GETS|SHOW\s*MENU|SHOW\s*OBJECT|' + r'SHOW\s*POPUP|SHOW\s*WINDOW|SIZE\s*POPUP|SKIP|SORT|' + r'STORE|SUM|SUSPEND|TOTAL|TYPE|UNLOCK|UPDATE|USE|WAIT|' + r'ZAP|ZOOM\s*WINDOW|DO\s*CASE|CASE|OTHERWISE|ENDCASE|' + r'DO\s*WHILE|ENDDO|FOR|ENDFOR|NEXT|IF|ELSE|ENDIF|PRINTJOB|' + r'ENDPRINTJOB|SCAN|ENDSCAN|TEXT|ENDTEXT|=)', + Keyword.Reserved, '#pop'), + (r'#\s*(IF|ELIF|ELSE|ENDIF|DEFINE|IFDEF|IFNDEF|INCLUDE)', + Comment.Preproc, '#pop'), + (r'(m\.)?[a-z_]\w*', Name.Variable, '#pop'), + (r'.', Text, '#pop'), + ], + } diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/functional.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/functional.py new file mode 100644 index 0000000000000000000000000000000000000000..254df795f6b54090a0d00bf96e8c235240b17258 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/functional.py @@ -0,0 +1,21 @@ +# -*- coding: utf-8 -*- +""" + pygments.lexers.functional + ~~~~~~~~~~~~~~~~~~~~~~~~~~ + + Just export lexer classes previously contained in this module. + + :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS. + :license: BSD, see LICENSE for details. +""" + +from pygments.lexers.lisp import SchemeLexer, CommonLispLexer, RacketLexer, \ + NewLispLexer, ShenLexer +from pygments.lexers.haskell import HaskellLexer, LiterateHaskellLexer, \ + KokaLexer +from pygments.lexers.theorem import CoqLexer +from pygments.lexers.erlang import ErlangLexer, ErlangShellLexer, \ + ElixirConsoleLexer, ElixirLexer +from pygments.lexers.ml import SMLLexer, OcamlLexer, OpaLexer + +__all__ = [] diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/go.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/go.py new file mode 100644 index 0000000000000000000000000000000000000000..cc2a6d631225b683622f12b87d8600d055b1512c --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/go.py @@ -0,0 +1,101 @@ +# -*- coding: utf-8 -*- +""" + pygments.lexers.go + ~~~~~~~~~~~~~~~~~~ + + Lexers for the Google Go language. + + :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS. + :license: BSD, see LICENSE for details. +""" + +import re + +from pygments.lexer import RegexLexer, bygroups, words +from pygments.token import Text, Comment, Operator, Keyword, Name, String, \ + Number, Punctuation + +__all__ = ['GoLexer'] + + +class GoLexer(RegexLexer): + """ + For `Go `_ source. + + .. versionadded:: 1.2 + """ + name = 'Go' + filenames = ['*.go'] + aliases = ['go'] + mimetypes = ['text/x-gosrc'] + + flags = re.MULTILINE | re.UNICODE + + tokens = { + 'root': [ + (r'\n', Text), + (r'\s+', Text), + (r'\\\n', Text), # line continuations + (r'//(.*?)\n', Comment.Single), + (r'/(\\\n)?[*](.|\n)*?[*](\\\n)?/', Comment.Multiline), + (r'(import|package)\b', Keyword.Namespace), + (r'(var|func|struct|map|chan|type|interface|const)\b', + Keyword.Declaration), + (words(( + 'break', 'default', 'select', 'case', 'defer', 'go', + 'else', 'goto', 'switch', 'fallthrough', 'if', 'range', + 'continue', 'for', 'return'), suffix=r'\b'), + Keyword), + (r'(true|false|iota|nil)\b', Keyword.Constant), + # It seems the builtin types aren't actually keywords, but + # can be used as functions. So we need two declarations. + (words(( + 'uint', 'uint8', 'uint16', 'uint32', 'uint64', + 'int', 'int8', 'int16', 'int32', 'int64', + 'float', 'float32', 'float64', + 'complex64', 'complex128', 'byte', 'rune', + 'string', 'bool', 'error', 'uintptr', + 'print', 'println', 'panic', 'recover', 'close', 'complex', + 'real', 'imag', 'len', 'cap', 'append', 'copy', 'delete', + 'new', 'make'), suffix=r'\b(\()'), + bygroups(Name.Builtin, Punctuation)), + (words(( + 'uint', 'uint8', 'uint16', 'uint32', 'uint64', + 'int', 'int8', 'int16', 'int32', 'int64', + 'float', 'float32', 'float64', + 'complex64', 'complex128', 'byte', 'rune', + 'string', 'bool', 'error', 'uintptr'), suffix=r'\b'), + Keyword.Type), + # imaginary_lit + (r'\d+i', Number), + (r'\d+\.\d*([Ee][-+]\d+)?i', Number), + (r'\.\d+([Ee][-+]\d+)?i', Number), + (r'\d+[Ee][-+]\d+i', Number), + # float_lit + (r'\d+(\.\d+[eE][+\-]?\d+|' + r'\.\d*|[eE][+\-]?\d+)', Number.Float), + (r'\.\d+([eE][+\-]?\d+)?', Number.Float), + # int_lit + # -- octal_lit + (r'0[0-7]+', Number.Oct), + # -- hex_lit + (r'0[xX][0-9a-fA-F]+', Number.Hex), + # -- decimal_lit + (r'(0|[1-9][0-9]*)', Number.Integer), + # char_lit + (r"""'(\\['"\\abfnrtv]|\\x[0-9a-fA-F]{2}|\\[0-7]{1,3}""" + r"""|\\u[0-9a-fA-F]{4}|\\U[0-9a-fA-F]{8}|[^\\])'""", + String.Char), + # StringLiteral + # -- raw_string_lit + (r'`[^`]*`', String), + # -- interpreted_string_lit + (r'"(\\\\|\\"|[^"])*"', String), + # Tokens + (r'(<<=|>>=|<<|>>|<=|>=|&\^=|&\^|\+=|-=|\*=|/=|%=|&=|\|=|&&|\|\|' + r'|<-|\+\+|--|==|!=|:=|\.\.\.|[+\-*/%&])', Operator), + (r'[|^<>=!()\[\]{}.,;:]', Punctuation), + # identifier + (r'[^\W\d]\w*', Name.Other), + ] + } diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/grammar_notation.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/grammar_notation.py new file mode 100644 index 0000000000000000000000000000000000000000..076249d3df6c4f81a38e8c76172d1589d5e35840 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/grammar_notation.py @@ -0,0 +1,213 @@ +# -*- coding: utf-8 -*- +""" + pygments.lexers.grammar_notation + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + Lexers for grammer notations like BNF. + + :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS. + :license: BSD, see LICENSE for details. +""" + +import re + +from pygments.lexer import RegexLexer, bygroups, include, this, using, words +from pygments.token import Comment, Keyword, Literal, Name, Number, \ + Operator, Punctuation, String, Text + +__all__ = ['BnfLexer', 'AbnfLexer', 'JsgfLexer'] + + +class BnfLexer(RegexLexer): + """ + This lexer is for grammer notations which are similar to + original BNF. + + In order to maximize a number of targets of this lexer, + let's decide some designs: + + * We don't distinguish `Terminal Symbol`. + + * We do assume that `NonTerminal Symbol` are always enclosed + with arrow brackets. + + * We do assume that `NonTerminal Symbol` may include + any printable characters except arrow brackets and ASCII 0x20. + This assumption is for `RBNF `_. + + * We do assume that target notation doesn't support comment. + + * We don't distinguish any operators and punctuation except + `::=`. + + Though these desision making might cause too minimal highlighting + and you might be disappointed, but it is reasonable for us. + + .. versionadded:: 2.1 + """ + + name = 'BNF' + aliases = ['bnf'] + filenames = ['*.bnf'] + mimetypes = ['text/x-bnf'] + + tokens = { + 'root': [ + (r'(<)([ -;=?-~]+)(>)', + bygroups(Punctuation, Name.Class, Punctuation)), + + # an only operator + (r'::=', Operator), + + # fallback + (r'[^<>:]+', Text), # for performance + (r'.', Text), + ], + } + + +class AbnfLexer(RegexLexer): + """ + Lexer for `IETF 7405 ABNF + `_ + (Updates `5234 `_) + grammars. + + .. versionadded:: 2.1 + """ + + name = 'ABNF' + aliases = ['abnf'] + filenames = ['*.abnf'] + mimetypes = ['text/x-abnf'] + + _core_rules = ( + 'ALPHA', 'BIT', 'CHAR', 'CR', 'CRLF', 'CTL', 'DIGIT', + 'DQUOTE', 'HEXDIG', 'HTAB', 'LF', 'LWSP', 'OCTET', + 'SP', 'VCHAR', 'WSP') + + tokens = { + 'root': [ + # comment + (r';.*$', Comment.Single), + + # quoted + # double quote itself in this state, it is as '%x22'. + (r'(%[si])?"[^"]*"', Literal), + + # binary (but i have never seen...) + (r'%b[01]+\-[01]+\b', Literal), # range + (r'%b[01]+(\.[01]+)*\b', Literal), # concat + + # decimal + (r'%d[0-9]+\-[0-9]+\b', Literal), # range + (r'%d[0-9]+(\.[0-9]+)*\b', Literal), # concat + + # hexadecimal + (r'%x[0-9a-fA-F]+\-[0-9a-fA-F]+\b', Literal), # range + (r'%x[0-9a-fA-F]+(\.[0-9a-fA-F]+)*\b', Literal), # concat + + # repetition (*element) including nRule + (r'\b[0-9]+\*[0-9]+', Operator), + (r'\b[0-9]+\*', Operator), + (r'\b[0-9]+', Operator), + (r'\*', Operator), + + # Strictly speaking, these are not keyword but + # are called `Core Rule'. + (words(_core_rules, suffix=r'\b'), Keyword), + + # nonterminals (ALPHA *(ALPHA / DIGIT / "-")) + (r'[a-zA-Z][a-zA-Z0-9-]+\b', Name.Class), + + # operators + (r'(=/|=|/)', Operator), + + # punctuation + (r'[\[\]()]', Punctuation), + + # fallback + (r'\s+', Text), + (r'.', Text), + ], + } + + +class JsgfLexer(RegexLexer): + """ + For `JSpeech Grammar Format `_ + grammars. + + .. versionadded:: 2.2 + """ + name = 'JSGF' + aliases = ['jsgf'] + filenames = ['*.jsgf'] + mimetypes = ['application/jsgf', 'application/x-jsgf', 'text/jsgf'] + + flags = re.MULTILINE | re.UNICODE + + tokens = { + 'root': [ + include('comments'), + include('non-comments'), + ], + 'comments': [ + (r'/\*\*(?!/)', Comment.Multiline, 'documentation comment'), + (r'/\*[\w\W]*?\*/', Comment.Multiline), + (r'//.*', Comment.Single), + ], + 'non-comments': [ + ('\A#JSGF[^;]*', Comment.Preproc), + (r'\s+', Text), + (r';', Punctuation), + (r'[=|()\[\]*+]', Operator), + (r'/[^/]+/', Number.Float), + (r'"', String.Double, 'string'), + (r'\{', String.Other, 'tag'), + (words(('import', 'public'), suffix=r'\b'), Keyword.Reserved), + (r'grammar\b', Keyword.Reserved, 'grammar name'), + (r'(<)(NULL|VOID)(>)', + bygroups(Punctuation, Name.Builtin, Punctuation)), + (r'<', Punctuation, 'rulename'), + (r'\w+|[^\s;=|()\[\]*+/"{<\w]+', Text), + ], + 'string': [ + (r'"', String.Double, '#pop'), + (r'\\.', String.Escape), + (r'[^\\"]+', String.Double), + ], + 'tag': [ + (r'\}', String.Other, '#pop'), + (r'\\.', String.Escape), + (r'[^\\}]+', String.Other), + ], + 'grammar name': [ + (r';', Punctuation, '#pop'), + (r'\s+', Text), + (r'\.', Punctuation), + (r'[^;\s.]+', Name.Namespace), + ], + 'rulename': [ + (r'>', Punctuation, '#pop'), + (r'\*', Punctuation), + (r'\s+', Text), + (r'([^.>]+)(\s*)(\.)', bygroups(Name.Namespace, Text, Punctuation)), + (r'[^.>]+', Name.Constant), + ], + 'documentation comment': [ + (r'\*/', Comment.Multiline, '#pop'), + (r'(^\s*\*?\s*)(@(?:example|see)\s+)' + r'([\w\W]*?(?=(?:^\s*\*?\s*@|\*/)))', + bygroups(Comment.Multiline, Comment.Special, + using(this, state='example'))), + (r'(^\s*\*?\s*)(@\S*)', + bygroups(Comment.Multiline, Comment.Special)), + (r'[^*\n@]+|\w|\W', Comment.Multiline), + ], + 'example': [ + (r'\n\s*\*', Comment.Multiline), + include('non-comments'), + (r'.', Comment.Multiline), + ], + } diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/graph.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/graph.py new file mode 100644 index 0000000000000000000000000000000000000000..1a33824603a62ff243a7fec94c576dd447a75625 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/graph.py @@ -0,0 +1,80 @@ +# -*- coding: utf-8 -*- +""" + pygments.lexers.graph + ~~~~~~~~~~~~~~~~~~~~~ + + Lexers for graph query languages. + + :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS. + :license: BSD, see LICENSE for details. +""" + +import re + +from pygments.lexer import RegexLexer, include, bygroups, using, this +from pygments.token import Keyword, Punctuation, Comment, Operator, Name,\ + String, Number, Whitespace + + +__all__ = ['CypherLexer'] + + +class CypherLexer(RegexLexer): + """ + For `Cypher Query Language + `_ + + For the Cypher version in Neo4J 2.0 + + .. versionadded:: 2.0 + """ + name = 'Cypher' + aliases = ['cypher'] + filenames = ['*.cyp', '*.cypher'] + + flags = re.MULTILINE | re.IGNORECASE + + tokens = { + 'root': [ + include('comment'), + include('keywords'), + include('clauses'), + include('relations'), + include('strings'), + include('whitespace'), + include('barewords'), + ], + 'comment': [ + (r'^.*//.*\n', Comment.Single), + ], + 'keywords': [ + (r'(create|order|match|limit|set|skip|start|return|with|where|' + r'delete|foreach|not|by)\b', Keyword), + ], + 'clauses': [ + # TODO: many missing ones, see http://docs.neo4j.org/refcard/2.0/ + (r'(all|any|as|asc|create|create\s+unique|delete|' + r'desc|distinct|foreach|in|is\s+null|limit|match|none|' + r'order\s+by|return|set|skip|single|start|union|where|with)\b', + Keyword), + ], + 'relations': [ + (r'(-\[)(.*?)(\]->)', bygroups(Operator, using(this), Operator)), + (r'(<-\[)(.*?)(\]-)', bygroups(Operator, using(this), Operator)), + (r'(-\[)(.*?)(\]-)', bygroups(Operator, using(this), Operator)), + (r'-->|<--|\[|\]', Operator), + (r'<|>|<>|=|<=|=>|\(|\)|\||:|,|;', Punctuation), + (r'[.*{}]', Punctuation), + ], + 'strings': [ + (r'"(?:\\[tbnrf\'"\\]|[^\\"])*"', String), + (r'`(?:``|[^`])+`', Name.Variable), + ], + 'whitespace': [ + (r'\s+', Whitespace), + ], + 'barewords': [ + (r'[a-z]\w*', Name), + (r'\d+', Number), + ], + } diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/graphics.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/graphics.py new file mode 100644 index 0000000000000000000000000000000000000000..c8af9f9916eb453e44d6ff1e950bf38c6ee85778 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/graphics.py @@ -0,0 +1,553 @@ +# -*- coding: utf-8 -*- +""" + pygments.lexers.graphics + ~~~~~~~~~~~~~~~~~~~~~~~~ + + Lexers for computer graphics and plotting related languages. + + :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS. + :license: BSD, see LICENSE for details. +""" + +from pygments.lexer import RegexLexer, words, include, bygroups, using, \ + this, default +from pygments.token import Text, Comment, Operator, Keyword, Name, \ + Number, Punctuation, String + +__all__ = ['GLShaderLexer', 'PostScriptLexer', 'AsymptoteLexer', 'GnuplotLexer', + 'PovrayLexer'] + + +class GLShaderLexer(RegexLexer): + """ + GLSL (OpenGL Shader) lexer. + + .. versionadded:: 1.1 + """ + name = 'GLSL' + aliases = ['glsl'] + filenames = ['*.vert', '*.frag', '*.geo'] + mimetypes = ['text/x-glslsrc'] + + tokens = { + 'root': [ + (r'^#.*', Comment.Preproc), + (r'//.*', Comment.Single), + (r'/(\\\n)?[*](.|\n)*?[*](\\\n)?/', Comment.Multiline), + (r'\+|-|~|!=?|\*|/|%|<<|>>|<=?|>=?|==?|&&?|\^|\|\|?', + Operator), + (r'[?:]', Operator), # quick hack for ternary + (r'\bdefined\b', Operator), + (r'[;{}(),\[\]]', Punctuation), + # FIXME when e is present, no decimal point needed + (r'[+-]?\d*\.\d+([eE][-+]?\d+)?', Number.Float), + (r'[+-]?\d+\.\d*([eE][-+]?\d+)?', Number.Float), + (r'0[xX][0-9a-fA-F]*', Number.Hex), + (r'0[0-7]*', Number.Oct), + (r'[1-9][0-9]*', Number.Integer), + (words(( + 'attribute', 'const', 'uniform', 'varying', 'centroid', 'break', + 'continue', 'do', 'for', 'while', 'if', 'else', 'in', 'out', + 'inout', 'float', 'int', 'void', 'bool', 'true', 'false', + 'invariant', 'discard', 'return', 'mat2', 'mat3' 'mat4', + 'mat2x2', 'mat3x2', 'mat4x2', 'mat2x3', 'mat3x3', 'mat4x3', + 'mat2x4', 'mat3x4', 'mat4x4', 'vec2', 'vec3', 'vec4', + 'ivec2', 'ivec3', 'ivec4', 'bvec2', 'bvec3', 'bvec4', + 'sampler1D', 'sampler2D', 'sampler3D' 'samplerCube', + 'sampler1DShadow', 'sampler2DShadow', 'struct'), + prefix=r'\b', suffix=r'\b'), + Keyword), + (words(( + 'asm', 'class', 'union', 'enum', 'typedef', 'template', 'this', + 'packed', 'goto', 'switch', 'default', 'inline', 'noinline', + 'volatile', 'public', 'static', 'extern', 'external', 'interface', + 'long', 'short', 'double', 'half', 'fixed', 'unsigned', 'lowp', + 'mediump', 'highp', 'precision', 'input', 'output', + 'hvec2', 'hvec3', 'hvec4', 'dvec2', 'dvec3', 'dvec4', + 'fvec2', 'fvec3', 'fvec4', 'sampler2DRect', 'sampler3DRect', + 'sampler2DRectShadow', 'sizeof', 'cast', 'namespace', 'using'), + prefix=r'\b', suffix=r'\b'), + Keyword), # future use + (r'[a-zA-Z_]\w*', Name), + (r'\.', Punctuation), + (r'\s+', Text), + ], + } + + +class PostScriptLexer(RegexLexer): + """ + Lexer for PostScript files. + + The PostScript Language Reference published by Adobe at + + is the authority for this. + + .. versionadded:: 1.4 + """ + name = 'PostScript' + aliases = ['postscript', 'postscr'] + filenames = ['*.ps', '*.eps'] + mimetypes = ['application/postscript'] + + delimiter = r'()<>\[\]{}/%\s' + delimiter_end = r'(?=[%s])' % delimiter + + valid_name_chars = r'[^%s]' % delimiter + valid_name = r"%s+%s" % (valid_name_chars, delimiter_end) + + tokens = { + 'root': [ + # All comment types + (r'^%!.+\n', Comment.Preproc), + (r'%%.*\n', Comment.Special), + (r'(^%.*\n){2,}', Comment.Multiline), + (r'%.*\n', Comment.Single), + + # String literals are awkward; enter separate state. + (r'\(', String, 'stringliteral'), + + (r'[{}<>\[\]]', Punctuation), + + # Numbers + (r'<[0-9A-Fa-f]+>' + delimiter_end, Number.Hex), + # Slight abuse: use Oct to signify any explicit base system + (r'[0-9]+\#(\-|\+)?([0-9]+\.?|[0-9]*\.[0-9]+|[0-9]+\.[0-9]*)' + r'((e|E)[0-9]+)?' + delimiter_end, Number.Oct), + (r'(\-|\+)?([0-9]+\.?|[0-9]*\.[0-9]+|[0-9]+\.[0-9]*)((e|E)[0-9]+)?' + + delimiter_end, Number.Float), + (r'(\-|\+)?[0-9]+' + delimiter_end, Number.Integer), + + # References + (r'\/%s' % valid_name, Name.Variable), + + # Names + (valid_name, Name.Function), # Anything else is executed + + # These keywords taken from + # + # Is there an authoritative list anywhere that doesn't involve + # trawling documentation? + + (r'(false|true)' + delimiter_end, Keyword.Constant), + + # Conditionals / flow control + (r'(eq|ne|g[et]|l[et]|and|or|not|if(?:else)?|for(?:all)?)' + + delimiter_end, Keyword.Reserved), + + (words(( + 'abs', 'add', 'aload', 'arc', 'arcn', 'array', 'atan', 'begin', + 'bind', 'ceiling', 'charpath', 'clip', 'closepath', 'concat', + 'concatmatrix', 'copy', 'cos', 'currentlinewidth', 'currentmatrix', + 'currentpoint', 'curveto', 'cvi', 'cvs', 'def', 'defaultmatrix', + 'dict', 'dictstackoverflow', 'div', 'dtransform', 'dup', 'end', + 'exch', 'exec', 'exit', 'exp', 'fill', 'findfont', 'floor', 'get', + 'getinterval', 'grestore', 'gsave', 'gt', 'identmatrix', 'idiv', + 'idtransform', 'index', 'invertmatrix', 'itransform', 'length', + 'lineto', 'ln', 'load', 'log', 'loop', 'matrix', 'mod', 'moveto', + 'mul', 'neg', 'newpath', 'pathforall', 'pathbbox', 'pop', 'print', + 'pstack', 'put', 'quit', 'rand', 'rangecheck', 'rcurveto', 'repeat', + 'restore', 'rlineto', 'rmoveto', 'roll', 'rotate', 'round', 'run', + 'save', 'scale', 'scalefont', 'setdash', 'setfont', 'setgray', + 'setlinecap', 'setlinejoin', 'setlinewidth', 'setmatrix', + 'setrgbcolor', 'shfill', 'show', 'showpage', 'sin', 'sqrt', + 'stack', 'stringwidth', 'stroke', 'strokepath', 'sub', 'syntaxerror', + 'transform', 'translate', 'truncate', 'typecheck', 'undefined', + 'undefinedfilename', 'undefinedresult'), suffix=delimiter_end), + Name.Builtin), + + (r'\s+', Text), + ], + + 'stringliteral': [ + (r'[^()\\]+', String), + (r'\\', String.Escape, 'escape'), + (r'\(', String, '#push'), + (r'\)', String, '#pop'), + ], + + 'escape': [ + (r'[0-8]{3}|n|r|t|b|f|\\|\(|\)', String.Escape, '#pop'), + default('#pop'), + ], + } + + +class AsymptoteLexer(RegexLexer): + """ + For `Asymptote `_ source code. + + .. versionadded:: 1.2 + """ + name = 'Asymptote' + aliases = ['asy', 'asymptote'] + filenames = ['*.asy'] + mimetypes = ['text/x-asymptote'] + + #: optional Comment or Whitespace + _ws = r'(?:\s|//.*?\n|/\*.*?\*/)+' + + tokens = { + 'whitespace': [ + (r'\n', Text), + (r'\s+', Text), + (r'\\\n', Text), # line continuation + (r'//(\n|(.|\n)*?[^\\]\n)', Comment), + (r'/(\\\n)?\*(.|\n)*?\*(\\\n)?/', Comment), + ], + 'statements': [ + # simple string (TeX friendly) + (r'"(\\\\|\\"|[^"])*"', String), + # C style string (with character escapes) + (r"'", String, 'string'), + (r'(\d+\.\d*|\.\d+|\d+)[eE][+-]?\d+[lL]?', Number.Float), + (r'(\d+\.\d*|\.\d+|\d+[fF])[fF]?', Number.Float), + (r'0x[0-9a-fA-F]+[Ll]?', Number.Hex), + (r'0[0-7]+[Ll]?', Number.Oct), + (r'\d+[Ll]?', Number.Integer), + (r'[~!%^&*+=|?:<>/-]', Operator), + (r'[()\[\],.]', Punctuation), + (r'\b(case)(.+?)(:)', bygroups(Keyword, using(this), Text)), + (r'(and|controls|tension|atleast|curl|if|else|while|for|do|' + r'return|break|continue|struct|typedef|new|access|import|' + r'unravel|from|include|quote|static|public|private|restricted|' + r'this|explicit|true|false|null|cycle|newframe|operator)\b', Keyword), + # Since an asy-type-name can be also an asy-function-name, + # in the following we test if the string " [a-zA-Z]" follows + # the Keyword.Type. + # Of course it is not perfect ! + (r'(Braid|FitResult|Label|Legend|TreeNode|abscissa|arc|arrowhead|' + r'binarytree|binarytreeNode|block|bool|bool3|bounds|bqe|circle|' + r'conic|coord|coordsys|cputime|ellipse|file|filltype|frame|grid3|' + r'guide|horner|hsv|hyperbola|indexedTransform|int|inversion|key|' + r'light|line|linefit|marginT|marker|mass|object|pair|parabola|path|' + r'path3|pen|picture|point|position|projection|real|revolution|' + r'scaleT|scientific|segment|side|slice|splitface|string|surface|' + r'tensionSpecifier|ticklocate|ticksgridT|tickvalues|transform|' + r'transformation|tree|triangle|trilinear|triple|vector|' + r'vertex|void)(?=\s+[a-zA-Z])', Keyword.Type), + # Now the asy-type-name which are not asy-function-name + # except yours ! + # Perhaps useless + (r'(Braid|FitResult|TreeNode|abscissa|arrowhead|block|bool|bool3|' + r'bounds|coord|frame|guide|horner|int|linefit|marginT|pair|pen|' + r'picture|position|real|revolution|slice|splitface|ticksgridT|' + r'tickvalues|tree|triple|vertex|void)\b', Keyword.Type), + ('[a-zA-Z_]\w*:(?!:)', Name.Label), + ('[a-zA-Z_]\w*', Name), + ], + 'root': [ + include('whitespace'), + # functions + (r'((?:[\w*\s])+?(?:\s|\*))' # return arguments + r'([a-zA-Z_]\w*)' # method name + r'(\s*\([^;]*?\))' # signature + r'(' + _ws + r')(\{)', + bygroups(using(this), Name.Function, using(this), using(this), + Punctuation), + 'function'), + # function declarations + (r'((?:[\w*\s])+?(?:\s|\*))' # return arguments + r'([a-zA-Z_]\w*)' # method name + r'(\s*\([^;]*?\))' # signature + r'(' + _ws + r')(;)', + bygroups(using(this), Name.Function, using(this), using(this), + Punctuation)), + default('statement'), + ], + 'statement': [ + include('whitespace'), + include('statements'), + ('[{}]', Punctuation), + (';', Punctuation, '#pop'), + ], + 'function': [ + include('whitespace'), + include('statements'), + (';', Punctuation), + (r'\{', Punctuation, '#push'), + (r'\}', Punctuation, '#pop'), + ], + 'string': [ + (r"'", String, '#pop'), + (r'\\([\\abfnrtv"\'?]|x[a-fA-F0-9]{2,4}|[0-7]{1,3})', String.Escape), + (r'\n', String), + (r"[^\\'\n]+", String), # all other characters + (r'\\\n', String), + (r'\\n', String), # line continuation + (r'\\', String), # stray backslash + ], + } + + def get_tokens_unprocessed(self, text): + from pygments.lexers._asy_builtins import ASYFUNCNAME, ASYVARNAME + for index, token, value in \ + RegexLexer.get_tokens_unprocessed(self, text): + if token is Name and value in ASYFUNCNAME: + token = Name.Function + elif token is Name and value in ASYVARNAME: + token = Name.Variable + yield index, token, value + + +def _shortened(word): + dpos = word.find('$') + return '|'.join(word[:dpos] + word[dpos+1:i] + r'\b' + for i in range(len(word), dpos, -1)) + + +def _shortened_many(*words): + return '|'.join(map(_shortened, words)) + + +class GnuplotLexer(RegexLexer): + """ + For `Gnuplot `_ plotting scripts. + + .. versionadded:: 0.11 + """ + + name = 'Gnuplot' + aliases = ['gnuplot'] + filenames = ['*.plot', '*.plt'] + mimetypes = ['text/x-gnuplot'] + + tokens = { + 'root': [ + include('whitespace'), + (_shortened('bi$nd'), Keyword, 'bind'), + (_shortened_many('ex$it', 'q$uit'), Keyword, 'quit'), + (_shortened('f$it'), Keyword, 'fit'), + (r'(if)(\s*)(\()', bygroups(Keyword, Text, Punctuation), 'if'), + (r'else\b', Keyword), + (_shortened('pa$use'), Keyword, 'pause'), + (_shortened_many('p$lot', 'rep$lot', 'sp$lot'), Keyword, 'plot'), + (_shortened('sa$ve'), Keyword, 'save'), + (_shortened('se$t'), Keyword, ('genericargs', 'optionarg')), + (_shortened_many('sh$ow', 'uns$et'), + Keyword, ('noargs', 'optionarg')), + (_shortened_many('low$er', 'ra$ise', 'ca$ll', 'cd$', 'cl$ear', + 'h$elp', '\\?$', 'hi$story', 'l$oad', 'pr$int', + 'pwd$', 're$read', 'res$et', 'scr$eendump', + 'she$ll', 'sy$stem', 'up$date'), + Keyword, 'genericargs'), + (_shortened_many('pwd$', 're$read', 'res$et', 'scr$eendump', + 'she$ll', 'test$'), + Keyword, 'noargs'), + ('([a-zA-Z_]\w*)(\s*)(=)', + bygroups(Name.Variable, Text, Operator), 'genericargs'), + ('([a-zA-Z_]\w*)(\s*\(.*?\)\s*)(=)', + bygroups(Name.Function, Text, Operator), 'genericargs'), + (r'@[a-zA-Z_]\w*', Name.Constant), # macros + (r';', Keyword), + ], + 'comment': [ + (r'[^\\\n]', Comment), + (r'\\\n', Comment), + (r'\\', Comment), + # don't add the newline to the Comment token + default('#pop'), + ], + 'whitespace': [ + ('#', Comment, 'comment'), + (r'[ \t\v\f]+', Text), + ], + 'noargs': [ + include('whitespace'), + # semicolon and newline end the argument list + (r';', Punctuation, '#pop'), + (r'\n', Text, '#pop'), + ], + 'dqstring': [ + (r'"', String, '#pop'), + (r'\\([\\abfnrtv"\']|x[a-fA-F0-9]{2,4}|[0-7]{1,3})', String.Escape), + (r'[^\\"\n]+', String), # all other characters + (r'\\\n', String), # line continuation + (r'\\', String), # stray backslash + (r'\n', String, '#pop'), # newline ends the string too + ], + 'sqstring': [ + (r"''", String), # escaped single quote + (r"'", String, '#pop'), + (r"[^\\'\n]+", String), # all other characters + (r'\\\n', String), # line continuation + (r'\\', String), # normal backslash + (r'\n', String, '#pop'), # newline ends the string too + ], + 'genericargs': [ + include('noargs'), + (r'"', String, 'dqstring'), + (r"'", String, 'sqstring'), + (r'(\d+\.\d*|\.\d+|\d+)[eE][+-]?\d+', Number.Float), + (r'(\d+\.\d*|\.\d+)', Number.Float), + (r'-?\d+', Number.Integer), + ('[,.~!%^&*+=|?:<>/-]', Operator), + ('[{}()\[\]]', Punctuation), + (r'(eq|ne)\b', Operator.Word), + (r'([a-zA-Z_]\w*)(\s*)(\()', + bygroups(Name.Function, Text, Punctuation)), + (r'[a-zA-Z_]\w*', Name), + (r'@[a-zA-Z_]\w*', Name.Constant), # macros + (r'\\\n', Text), + ], + 'optionarg': [ + include('whitespace'), + (_shortened_many( + "a$ll", "an$gles", "ar$row", "au$toscale", "b$ars", "bor$der", + "box$width", "cl$abel", "c$lip", "cn$trparam", "co$ntour", "da$ta", + "data$file", "dg$rid3d", "du$mmy", "enc$oding", "dec$imalsign", + "fit$", "font$path", "fo$rmat", "fu$nction", "fu$nctions", "g$rid", + "hid$den3d", "his$torysize", "is$osamples", "k$ey", "keyt$itle", + "la$bel", "li$nestyle", "ls$", "loa$dpath", "loc$ale", "log$scale", + "mac$ros", "map$ping", "map$ping3d", "mar$gin", "lmar$gin", + "rmar$gin", "tmar$gin", "bmar$gin", "mo$use", "multi$plot", + "mxt$ics", "nomxt$ics", "mx2t$ics", "nomx2t$ics", "myt$ics", + "nomyt$ics", "my2t$ics", "nomy2t$ics", "mzt$ics", "nomzt$ics", + "mcbt$ics", "nomcbt$ics", "of$fsets", "or$igin", "o$utput", + "pa$rametric", "pm$3d", "pal$ette", "colorb$ox", "p$lot", + "poi$ntsize", "pol$ar", "pr$int", "obj$ect", "sa$mples", "si$ze", + "st$yle", "su$rface", "table$", "t$erminal", "termo$ptions", "ti$cs", + "ticsc$ale", "ticsl$evel", "timef$mt", "tim$estamp", "tit$le", + "v$ariables", "ve$rsion", "vi$ew", "xyp$lane", "xda$ta", "x2da$ta", + "yda$ta", "y2da$ta", "zda$ta", "cbda$ta", "xl$abel", "x2l$abel", + "yl$abel", "y2l$abel", "zl$abel", "cbl$abel", "xti$cs", "noxti$cs", + "x2ti$cs", "nox2ti$cs", "yti$cs", "noyti$cs", "y2ti$cs", "noy2ti$cs", + "zti$cs", "nozti$cs", "cbti$cs", "nocbti$cs", "xdti$cs", "noxdti$cs", + "x2dti$cs", "nox2dti$cs", "ydti$cs", "noydti$cs", "y2dti$cs", + "noy2dti$cs", "zdti$cs", "nozdti$cs", "cbdti$cs", "nocbdti$cs", + "xmti$cs", "noxmti$cs", "x2mti$cs", "nox2mti$cs", "ymti$cs", + "noymti$cs", "y2mti$cs", "noy2mti$cs", "zmti$cs", "nozmti$cs", + "cbmti$cs", "nocbmti$cs", "xr$ange", "x2r$ange", "yr$ange", + "y2r$ange", "zr$ange", "cbr$ange", "rr$ange", "tr$ange", "ur$ange", + "vr$ange", "xzeroa$xis", "x2zeroa$xis", "yzeroa$xis", "y2zeroa$xis", + "zzeroa$xis", "zeroa$xis", "z$ero"), Name.Builtin, '#pop'), + ], + 'bind': [ + ('!', Keyword, '#pop'), + (_shortened('all$windows'), Name.Builtin), + include('genericargs'), + ], + 'quit': [ + (r'gnuplot\b', Keyword), + include('noargs'), + ], + 'fit': [ + (r'via\b', Name.Builtin), + include('plot'), + ], + 'if': [ + (r'\)', Punctuation, '#pop'), + include('genericargs'), + ], + 'pause': [ + (r'(mouse|any|button1|button2|button3)\b', Name.Builtin), + (_shortened('key$press'), Name.Builtin), + include('genericargs'), + ], + 'plot': [ + (_shortened_many('ax$es', 'axi$s', 'bin$ary', 'ev$ery', 'i$ndex', + 'mat$rix', 's$mooth', 'thru$', 't$itle', + 'not$itle', 'u$sing', 'w$ith'), + Name.Builtin), + include('genericargs'), + ], + 'save': [ + (_shortened_many('f$unctions', 's$et', 't$erminal', 'v$ariables'), + Name.Builtin), + include('genericargs'), + ], + } + + +class PovrayLexer(RegexLexer): + """ + For `Persistence of Vision Raytracer `_ files. + + .. versionadded:: 0.11 + """ + name = 'POVRay' + aliases = ['pov'] + filenames = ['*.pov', '*.inc'] + mimetypes = ['text/x-povray'] + + tokens = { + 'root': [ + (r'/\*[\w\W]*?\*/', Comment.Multiline), + (r'//.*\n', Comment.Single), + (r'(?s)"(?:\\.|[^"\\])+"', String.Double), + (words(( + 'break', 'case', 'debug', 'declare', 'default', 'define', 'else', + 'elseif', 'end', 'error', 'fclose', 'fopen', 'for', 'if', 'ifdef', + 'ifndef', 'include', 'local', 'macro', 'range', 'read', 'render', + 'statistics', 'switch', 'undef', 'version', 'warning', 'while', + 'write'), prefix=r'#', suffix=r'\b'), + Comment.Preproc), + (words(( + 'aa_level', 'aa_threshold', 'abs', 'acos', 'acosh', 'adaptive', 'adc_bailout', + 'agate', 'agate_turb', 'all', 'alpha', 'ambient', 'ambient_light', 'angle', + 'aperture', 'arc_angle', 'area_light', 'asc', 'asin', 'asinh', 'assumed_gamma', + 'atan', 'atan2', 'atanh', 'atmosphere', 'atmospheric_attenuation', + 'attenuating', 'average', 'background', 'black_hole', 'blue', 'blur_samples', + 'bounded_by', 'box_mapping', 'bozo', 'break', 'brick', 'brick_size', + 'brightness', 'brilliance', 'bumps', 'bumpy1', 'bumpy2', 'bumpy3', 'bump_map', + 'bump_size', 'case', 'caustics', 'ceil', 'checker', 'chr', 'clipped_by', 'clock', + 'color', 'color_map', 'colour', 'colour_map', 'component', 'composite', 'concat', + 'confidence', 'conic_sweep', 'constant', 'control0', 'control1', 'cos', 'cosh', + 'count', 'crackle', 'crand', 'cube', 'cubic_spline', 'cylindrical_mapping', + 'debug', 'declare', 'default', 'degrees', 'dents', 'diffuse', 'direction', + 'distance', 'distance_maximum', 'div', 'dust', 'dust_type', 'eccentricity', + 'else', 'emitting', 'end', 'error', 'error_bound', 'exp', 'exponent', + 'fade_distance', 'fade_power', 'falloff', 'falloff_angle', 'false', + 'file_exists', 'filter', 'finish', 'fisheye', 'flatness', 'flip', 'floor', + 'focal_point', 'fog', 'fog_alt', 'fog_offset', 'fog_type', 'frequency', 'gif', + 'global_settings', 'glowing', 'gradient', 'granite', 'gray_threshold', + 'green', 'halo', 'hexagon', 'hf_gray_16', 'hierarchy', 'hollow', 'hypercomplex', + 'if', 'ifdef', 'iff', 'image_map', 'incidence', 'include', 'int', 'interpolate', + 'inverse', 'ior', 'irid', 'irid_wavelength', 'jitter', 'lambda', 'leopard', + 'linear', 'linear_spline', 'linear_sweep', 'location', 'log', 'looks_like', + 'look_at', 'low_error_factor', 'mandel', 'map_type', 'marble', 'material_map', + 'matrix', 'max', 'max_intersections', 'max_iteration', 'max_trace_level', + 'max_value', 'metallic', 'min', 'minimum_reuse', 'mod', 'mortar', + 'nearest_count', 'no', 'normal', 'normal_map', 'no_shadow', 'number_of_waves', + 'octaves', 'off', 'offset', 'omega', 'omnimax', 'on', 'once', 'onion', 'open', + 'orthographic', 'panoramic', 'pattern1', 'pattern2', 'pattern3', + 'perspective', 'pgm', 'phase', 'phong', 'phong_size', 'pi', 'pigment', + 'pigment_map', 'planar_mapping', 'png', 'point_at', 'pot', 'pow', 'ppm', + 'precision', 'pwr', 'quadratic_spline', 'quaternion', 'quick_color', + 'quick_colour', 'quilted', 'radial', 'radians', 'radiosity', 'radius', 'rainbow', + 'ramp_wave', 'rand', 'range', 'reciprocal', 'recursion_limit', 'red', + 'reflection', 'refraction', 'render', 'repeat', 'rgb', 'rgbf', 'rgbft', 'rgbt', + 'right', 'ripples', 'rotate', 'roughness', 'samples', 'scale', 'scallop_wave', + 'scattering', 'seed', 'shadowless', 'sin', 'sine_wave', 'sinh', 'sky', 'sky_sphere', + 'slice', 'slope_map', 'smooth', 'specular', 'spherical_mapping', 'spiral', + 'spiral1', 'spiral2', 'spotlight', 'spotted', 'sqr', 'sqrt', 'statistics', 'str', + 'strcmp', 'strength', 'strlen', 'strlwr', 'strupr', 'sturm', 'substr', 'switch', 'sys', + 't', 'tan', 'tanh', 'test_camera_1', 'test_camera_2', 'test_camera_3', + 'test_camera_4', 'texture', 'texture_map', 'tga', 'thickness', 'threshold', + 'tightness', 'tile2', 'tiles', 'track', 'transform', 'translate', 'transmit', + 'triangle_wave', 'true', 'ttf', 'turbulence', 'turb_depth', 'type', + 'ultra_wide_angle', 'up', 'use_color', 'use_colour', 'use_index', 'u_steps', + 'val', 'variance', 'vaxis_rotate', 'vcross', 'vdot', 'version', 'vlength', + 'vnormalize', 'volume_object', 'volume_rendered', 'vol_with_light', + 'vrotate', 'v_steps', 'warning', 'warp', 'water_level', 'waves', 'while', 'width', + 'wood', 'wrinkles', 'yes'), prefix=r'\b', suffix=r'\b'), + Keyword), + (words(( + 'bicubic_patch', 'blob', 'box', 'camera', 'cone', 'cubic', 'cylinder', 'difference', + 'disc', 'height_field', 'intersection', 'julia_fractal', 'lathe', + 'light_source', 'merge', 'mesh', 'object', 'plane', 'poly', 'polygon', 'prism', + 'quadric', 'quartic', 'smooth_triangle', 'sor', 'sphere', 'superellipsoid', + 'text', 'torus', 'triangle', 'union'), suffix=r'\b'), + Name.Builtin), + # TODO: <=, etc + (r'[\[\](){}<>;,]', Punctuation), + (r'[-+*/=]', Operator), + (r'\b(x|y|z|u|v)\b', Name.Builtin.Pseudo), + (r'[a-zA-Z_]\w*', Name), + (r'[0-9]+\.[0-9]*', Number.Float), + (r'\.[0-9]+', Number.Float), + (r'[0-9]+', Number.Integer), + (r'"(\\\\|\\"|[^"])*"', String), + (r'\s+', Text), + ] + } diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/haskell.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/haskell.py new file mode 100644 index 0000000000000000000000000000000000000000..1a2f221771ff1b30867835352a207e9f01e1e3bd --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/haskell.py @@ -0,0 +1,843 @@ +# -*- coding: utf-8 -*- +""" + pygments.lexers.haskell + ~~~~~~~~~~~~~~~~~~~~~~~ + + Lexers for Haskell and related languages. + + :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS. + :license: BSD, see LICENSE for details. +""" + +import re + +from pygments.lexer import Lexer, RegexLexer, bygroups, do_insertions, \ + default, include +from pygments.token import Text, Comment, Operator, Keyword, Name, String, \ + Number, Punctuation, Generic +from pygments import unistring as uni + +__all__ = ['HaskellLexer', 'IdrisLexer', 'AgdaLexer', 'CryptolLexer', + 'LiterateHaskellLexer', 'LiterateIdrisLexer', 'LiterateAgdaLexer', + 'LiterateCryptolLexer', 'KokaLexer'] + + +line_re = re.compile('.*?\n') + + +class HaskellLexer(RegexLexer): + """ + A Haskell lexer based on the lexemes defined in the Haskell 98 Report. + + .. versionadded:: 0.8 + """ + name = 'Haskell' + aliases = ['haskell', 'hs'] + filenames = ['*.hs'] + mimetypes = ['text/x-haskell'] + + flags = re.MULTILINE | re.UNICODE + + reserved = ('case', 'class', 'data', 'default', 'deriving', 'do', 'else', + 'family', 'if', 'in', 'infix[lr]?', 'instance', + 'let', 'newtype', 'of', 'then', 'type', 'where', '_') + ascii = ('NUL', 'SOH', '[SE]TX', 'EOT', 'ENQ', 'ACK', + 'BEL', 'BS', 'HT', 'LF', 'VT', 'FF', 'CR', 'S[OI]', 'DLE', + 'DC[1-4]', 'NAK', 'SYN', 'ETB', 'CAN', + 'EM', 'SUB', 'ESC', '[FGRU]S', 'SP', 'DEL') + + tokens = { + 'root': [ + # Whitespace: + (r'\s+', Text), + # (r'--\s*|.*$', Comment.Doc), + (r'--(?![!#$%&*+./<=>?@^|_~:\\]).*?$', Comment.Single), + (r'\{-', Comment.Multiline, 'comment'), + # Lexemes: + # Identifiers + (r'\bimport\b', Keyword.Reserved, 'import'), + (r'\bmodule\b', Keyword.Reserved, 'module'), + (r'\berror\b', Name.Exception), + (r'\b(%s)(?!\')\b' % '|'.join(reserved), Keyword.Reserved), + (r"'[^\\]'", String.Char), # this has to come before the TH quote + (r'^[_' + uni.Ll + r'][\w\']*', Name.Function), + (r"'?[_" + uni.Ll + r"][\w']*", Name), + (r"('')?[" + uni.Lu + r"][\w\']*", Keyword.Type), + (r"(')[" + uni.Lu + r"][\w\']*", Keyword.Type), + (r"(')\[[^\]]*\]", Keyword.Type), # tuples and lists get special treatment in GHC + (r"(')\([^)]*\)", Keyword.Type), # .. + # Operators + (r'\\(?![:!#$%&*+.\\/<=>?@^|~-]+)', Name.Function), # lambda operator + (r'(<-|::|->|=>|=)(?![:!#$%&*+.\\/<=>?@^|~-]+)', Operator.Word), # specials + (r':[:!#$%&*+.\\/<=>?@^|~-]*', Keyword.Type), # Constructor operators + (r'[:!#$%&*+.\\/<=>?@^|~-]+', Operator), # Other operators + # Numbers + (r'\d+[eE][+-]?\d+', Number.Float), + (r'\d+\.\d+([eE][+-]?\d+)?', Number.Float), + (r'0[oO][0-7]+', Number.Oct), + (r'0[xX][\da-fA-F]+', Number.Hex), + (r'\d+', Number.Integer), + # Character/String Literals + (r"'", String.Char, 'character'), + (r'"', String, 'string'), + # Special + (r'\[\]', Keyword.Type), + (r'\(\)', Name.Builtin), + (r'[][(),;`{}]', Punctuation), + ], + 'import': [ + # Import statements + (r'\s+', Text), + (r'"', String, 'string'), + # after "funclist" state + (r'\)', Punctuation, '#pop'), + (r'qualified\b', Keyword), + # import X as Y + (r'([' + uni.Lu + r'][\w.]*)(\s+)(as)(\s+)([' + uni.Lu + r'][\w.]*)', + bygroups(Name.Namespace, Text, Keyword, Text, Name), '#pop'), + # import X hiding (functions) + (r'([' + uni.Lu + r'][\w.]*)(\s+)(hiding)(\s+)(\()', + bygroups(Name.Namespace, Text, Keyword, Text, Punctuation), 'funclist'), + # import X (functions) + (r'([' + uni.Lu + r'][\w.]*)(\s+)(\()', + bygroups(Name.Namespace, Text, Punctuation), 'funclist'), + # import X + (r'[\w.]+', Name.Namespace, '#pop'), + ], + 'module': [ + (r'\s+', Text), + (r'([' + uni.Lu + r'][\w.]*)(\s+)(\()', + bygroups(Name.Namespace, Text, Punctuation), 'funclist'), + (r'[' + uni.Lu + r'][\w.]*', Name.Namespace, '#pop'), + ], + 'funclist': [ + (r'\s+', Text), + (r'[' + uni.Lu + r']\w*', Keyword.Type), + (r'(_[\w\']+|[' + uni.Ll + r'][\w\']*)', Name.Function), + (r'--(?![!#$%&*+./<=>?@^|_~:\\]).*?$', Comment.Single), + (r'\{-', Comment.Multiline, 'comment'), + (r',', Punctuation), + (r'[:!#$%&*+.\\/<=>?@^|~-]+', Operator), + # (HACK, but it makes sense to push two instances, believe me) + (r'\(', Punctuation, ('funclist', 'funclist')), + (r'\)', Punctuation, '#pop:2'), + ], + # NOTE: the next four states are shared in the AgdaLexer; make sure + # any change is compatible with Agda as well or copy over and change + 'comment': [ + # Multiline Comments + (r'[^-{}]+', Comment.Multiline), + (r'\{-', Comment.Multiline, '#push'), + (r'-\}', Comment.Multiline, '#pop'), + (r'[-{}]', Comment.Multiline), + ], + 'character': [ + # Allows multi-chars, incorrectly. + (r"[^\\']'", String.Char, '#pop'), + (r"\\", String.Escape, 'escape'), + ("'", String.Char, '#pop'), + ], + 'string': [ + (r'[^\\"]+', String), + (r"\\", String.Escape, 'escape'), + ('"', String, '#pop'), + ], + 'escape': [ + (r'[abfnrtv"\'&\\]', String.Escape, '#pop'), + (r'\^[][' + uni.Lu + r'@^_]', String.Escape, '#pop'), + ('|'.join(ascii), String.Escape, '#pop'), + (r'o[0-7]+', String.Escape, '#pop'), + (r'x[\da-fA-F]+', String.Escape, '#pop'), + (r'\d+', String.Escape, '#pop'), + (r'\s+\\', String.Escape, '#pop'), + ], + } + + +class IdrisLexer(RegexLexer): + """ + A lexer for the dependently typed programming language Idris. + + Based on the Haskell and Agda Lexer. + + .. versionadded:: 2.0 + """ + name = 'Idris' + aliases = ['idris', 'idr'] + filenames = ['*.idr'] + mimetypes = ['text/x-idris'] + + reserved = ('case', 'class', 'data', 'default', 'using', 'do', 'else', + 'if', 'in', 'infix[lr]?', 'instance', 'rewrite', 'auto', + 'namespace', 'codata', 'mutual', 'private', 'public', 'abstract', + 'total', 'partial', + 'let', 'proof', 'of', 'then', 'static', 'where', '_', 'with', + 'pattern', 'term', 'syntax', 'prefix', + 'postulate', 'parameters', 'record', 'dsl', 'impossible', 'implicit', + 'tactics', 'intros', 'intro', 'compute', 'refine', 'exact', 'trivial') + + ascii = ('NUL', 'SOH', '[SE]TX', 'EOT', 'ENQ', 'ACK', + 'BEL', 'BS', 'HT', 'LF', 'VT', 'FF', 'CR', 'S[OI]', 'DLE', + 'DC[1-4]', 'NAK', 'SYN', 'ETB', 'CAN', + 'EM', 'SUB', 'ESC', '[FGRU]S', 'SP', 'DEL') + + directives = ('lib', 'link', 'flag', 'include', 'hide', 'freeze', 'access', + 'default', 'logging', 'dynamic', 'name', 'error_handlers', 'language') + + tokens = { + 'root': [ + # Comments + (r'^(\s*)(%%%s)' % '|'.join(directives), + bygroups(Text, Keyword.Reserved)), + (r'(\s*)(--(?![!#$%&*+./<=>?@^|_~:\\]).*?)$', bygroups(Text, Comment.Single)), + (r'(\s*)(\|{3}.*?)$', bygroups(Text, Comment.Single)), + (r'(\s*)(\{-)', bygroups(Text, Comment.Multiline), 'comment'), + # Declaration + (r'^(\s*)([^\s(){}]+)(\s*)(:)(\s*)', + bygroups(Text, Name.Function, Text, Operator.Word, Text)), + # Identifiers + (r'\b(%s)(?!\')\b' % '|'.join(reserved), Keyword.Reserved), + (r'(import|module)(\s+)', bygroups(Keyword.Reserved, Text), 'module'), + (r"('')?[A-Z][\w\']*", Keyword.Type), + (r'[a-z][\w\']*', Text), + # Special Symbols + (r'(<-|::|->|=>|=)', Operator.Word), # specials + (r'([(){}\[\]:!#$%&*+.\\/<=>?@^|~-]+)', Operator.Word), # specials + # Numbers + (r'\d+[eE][+-]?\d+', Number.Float), + (r'\d+\.\d+([eE][+-]?\d+)?', Number.Float), + (r'0[xX][\da-fA-F]+', Number.Hex), + (r'\d+', Number.Integer), + # Strings + (r"'", String.Char, 'character'), + (r'"', String, 'string'), + (r'[^\s(){}]+', Text), + (r'\s+?', Text), # Whitespace + ], + 'module': [ + (r'\s+', Text), + (r'([A-Z][\w.]*)(\s+)(\()', + bygroups(Name.Namespace, Text, Punctuation), 'funclist'), + (r'[A-Z][\w.]*', Name.Namespace, '#pop'), + ], + 'funclist': [ + (r'\s+', Text), + (r'[A-Z]\w*', Keyword.Type), + (r'(_[\w\']+|[a-z][\w\']*)', Name.Function), + (r'--.*$', Comment.Single), + (r'\{-', Comment.Multiline, 'comment'), + (r',', Punctuation), + (r'[:!#$%&*+.\\/<=>?@^|~-]+', Operator), + # (HACK, but it makes sense to push two instances, believe me) + (r'\(', Punctuation, ('funclist', 'funclist')), + (r'\)', Punctuation, '#pop:2'), + ], + # NOTE: the next four states are shared in the AgdaLexer; make sure + # any change is compatible with Agda as well or copy over and change + 'comment': [ + # Multiline Comments + (r'[^-{}]+', Comment.Multiline), + (r'\{-', Comment.Multiline, '#push'), + (r'-\}', Comment.Multiline, '#pop'), + (r'[-{}]', Comment.Multiline), + ], + 'character': [ + # Allows multi-chars, incorrectly. + (r"[^\\']", String.Char), + (r"\\", String.Escape, 'escape'), + ("'", String.Char, '#pop'), + ], + 'string': [ + (r'[^\\"]+', String), + (r"\\", String.Escape, 'escape'), + ('"', String, '#pop'), + ], + 'escape': [ + (r'[abfnrtv"\'&\\]', String.Escape, '#pop'), + (r'\^[][A-Z@^_]', String.Escape, '#pop'), + ('|'.join(ascii), String.Escape, '#pop'), + (r'o[0-7]+', String.Escape, '#pop'), + (r'x[\da-fA-F]+', String.Escape, '#pop'), + (r'\d+', String.Escape, '#pop'), + (r'\s+\\', String.Escape, '#pop') + ], + } + + +class AgdaLexer(RegexLexer): + """ + For the `Agda `_ + dependently typed functional programming language and proof assistant. + + .. versionadded:: 2.0 + """ + + name = 'Agda' + aliases = ['agda'] + filenames = ['*.agda'] + mimetypes = ['text/x-agda'] + + reserved = ['abstract', 'codata', 'coinductive', 'constructor', 'data', + 'field', 'forall', 'hiding', 'in', 'inductive', 'infix', + 'infixl', 'infixr', 'instance', 'let', 'mutual', 'open', + 'pattern', 'postulate', 'primitive', 'private', + 'quote', 'quoteGoal', 'quoteTerm', + 'record', 'renaming', 'rewrite', 'syntax', 'tactic', + 'unquote', 'unquoteDecl', 'using', 'where', 'with'] + + tokens = { + 'root': [ + # Declaration + (r'^(\s*)([^\s(){}]+)(\s*)(:)(\s*)', + bygroups(Text, Name.Function, Text, Operator.Word, Text)), + # Comments + (r'--(?![!#$%&*+./<=>?@^|_~:\\]).*?$', Comment.Single), + (r'\{-', Comment.Multiline, 'comment'), + # Holes + (r'\{!', Comment.Directive, 'hole'), + # Lexemes: + # Identifiers + (r'\b(%s)(?!\')\b' % '|'.join(reserved), Keyword.Reserved), + (r'(import|module)(\s+)', bygroups(Keyword.Reserved, Text), 'module'), + (r'\b(Set|Prop)\b', Keyword.Type), + # Special Symbols + (r'(\(|\)|\{|\})', Operator), + (u'(\\.{1,3}|\\||\u039B|\u2200|\u2192|:|=|->)', Operator.Word), + # Numbers + (r'\d+[eE][+-]?\d+', Number.Float), + (r'\d+\.\d+([eE][+-]?\d+)?', Number.Float), + (r'0[xX][\da-fA-F]+', Number.Hex), + (r'\d+', Number.Integer), + # Strings + (r"'", String.Char, 'character'), + (r'"', String, 'string'), + (r'[^\s(){}]+', Text), + (r'\s+?', Text), # Whitespace + ], + 'hole': [ + # Holes + (r'[^!{}]+', Comment.Directive), + (r'\{!', Comment.Directive, '#push'), + (r'!\}', Comment.Directive, '#pop'), + (r'[!{}]', Comment.Directive), + ], + 'module': [ + (r'\{-', Comment.Multiline, 'comment'), + (r'[a-zA-Z][\w.]*', Name, '#pop'), + (r'[\W0-9_]+', Text) + ], + 'comment': HaskellLexer.tokens['comment'], + 'character': HaskellLexer.tokens['character'], + 'string': HaskellLexer.tokens['string'], + 'escape': HaskellLexer.tokens['escape'] + } + + +class CryptolLexer(RegexLexer): + """ + FIXME: A Cryptol2 lexer based on the lexemes defined in the Haskell 98 Report. + + .. versionadded:: 2.0 + """ + name = 'Cryptol' + aliases = ['cryptol', 'cry'] + filenames = ['*.cry'] + mimetypes = ['text/x-cryptol'] + + reserved = ('Arith', 'Bit', 'Cmp', 'False', 'Inf', 'True', 'else', + 'export', 'extern', 'fin', 'if', 'import', 'inf', 'lg2', + 'max', 'min', 'module', 'newtype', 'pragma', 'property', + 'then', 'type', 'where', 'width') + ascii = ('NUL', 'SOH', '[SE]TX', 'EOT', 'ENQ', 'ACK', + 'BEL', 'BS', 'HT', 'LF', 'VT', 'FF', 'CR', 'S[OI]', 'DLE', + 'DC[1-4]', 'NAK', 'SYN', 'ETB', 'CAN', + 'EM', 'SUB', 'ESC', '[FGRU]S', 'SP', 'DEL') + + tokens = { + 'root': [ + # Whitespace: + (r'\s+', Text), + # (r'--\s*|.*$', Comment.Doc), + (r'//.*$', Comment.Single), + (r'/\*', Comment.Multiline, 'comment'), + # Lexemes: + # Identifiers + (r'\bimport\b', Keyword.Reserved, 'import'), + (r'\bmodule\b', Keyword.Reserved, 'module'), + (r'\berror\b', Name.Exception), + (r'\b(%s)(?!\')\b' % '|'.join(reserved), Keyword.Reserved), + (r'^[_a-z][\w\']*', Name.Function), + (r"'?[_a-z][\w']*", Name), + (r"('')?[A-Z][\w\']*", Keyword.Type), + # Operators + (r'\\(?![:!#$%&*+.\\/<=>?@^|~-]+)', Name.Function), # lambda operator + (r'(<-|::|->|=>|=)(?![:!#$%&*+.\\/<=>?@^|~-]+)', Operator.Word), # specials + (r':[:!#$%&*+.\\/<=>?@^|~-]*', Keyword.Type), # Constructor operators + (r'[:!#$%&*+.\\/<=>?@^|~-]+', Operator), # Other operators + # Numbers + (r'\d+[eE][+-]?\d+', Number.Float), + (r'\d+\.\d+([eE][+-]?\d+)?', Number.Float), + (r'0[oO][0-7]+', Number.Oct), + (r'0[xX][\da-fA-F]+', Number.Hex), + (r'\d+', Number.Integer), + # Character/String Literals + (r"'", String.Char, 'character'), + (r'"', String, 'string'), + # Special + (r'\[\]', Keyword.Type), + (r'\(\)', Name.Builtin), + (r'[][(),;`{}]', Punctuation), + ], + 'import': [ + # Import statements + (r'\s+', Text), + (r'"', String, 'string'), + # after "funclist" state + (r'\)', Punctuation, '#pop'), + (r'qualified\b', Keyword), + # import X as Y + (r'([A-Z][\w.]*)(\s+)(as)(\s+)([A-Z][\w.]*)', + bygroups(Name.Namespace, Text, Keyword, Text, Name), '#pop'), + # import X hiding (functions) + (r'([A-Z][\w.]*)(\s+)(hiding)(\s+)(\()', + bygroups(Name.Namespace, Text, Keyword, Text, Punctuation), 'funclist'), + # import X (functions) + (r'([A-Z][\w.]*)(\s+)(\()', + bygroups(Name.Namespace, Text, Punctuation), 'funclist'), + # import X + (r'[\w.]+', Name.Namespace, '#pop'), + ], + 'module': [ + (r'\s+', Text), + (r'([A-Z][\w.]*)(\s+)(\()', + bygroups(Name.Namespace, Text, Punctuation), 'funclist'), + (r'[A-Z][\w.]*', Name.Namespace, '#pop'), + ], + 'funclist': [ + (r'\s+', Text), + (r'[A-Z]\w*', Keyword.Type), + (r'(_[\w\']+|[a-z][\w\']*)', Name.Function), + # TODO: these don't match the comments in docs, remove. + #(r'--(?![!#$%&*+./<=>?@^|_~:\\]).*?$', Comment.Single), + #(r'{-', Comment.Multiline, 'comment'), + (r',', Punctuation), + (r'[:!#$%&*+.\\/<=>?@^|~-]+', Operator), + # (HACK, but it makes sense to push two instances, believe me) + (r'\(', Punctuation, ('funclist', 'funclist')), + (r'\)', Punctuation, '#pop:2'), + ], + 'comment': [ + # Multiline Comments + (r'[^/*]+', Comment.Multiline), + (r'/\*', Comment.Multiline, '#push'), + (r'\*/', Comment.Multiline, '#pop'), + (r'[*/]', Comment.Multiline), + ], + 'character': [ + # Allows multi-chars, incorrectly. + (r"[^\\']'", String.Char, '#pop'), + (r"\\", String.Escape, 'escape'), + ("'", String.Char, '#pop'), + ], + 'string': [ + (r'[^\\"]+', String), + (r"\\", String.Escape, 'escape'), + ('"', String, '#pop'), + ], + 'escape': [ + (r'[abfnrtv"\'&\\]', String.Escape, '#pop'), + (r'\^[][A-Z@^_]', String.Escape, '#pop'), + ('|'.join(ascii), String.Escape, '#pop'), + (r'o[0-7]+', String.Escape, '#pop'), + (r'x[\da-fA-F]+', String.Escape, '#pop'), + (r'\d+', String.Escape, '#pop'), + (r'\s+\\', String.Escape, '#pop'), + ], + } + + EXTRA_KEYWORDS = set(('join', 'split', 'reverse', 'transpose', 'width', + 'length', 'tail', '<<', '>>', '<<<', '>>>', 'const', + 'reg', 'par', 'seq', 'ASSERT', 'undefined', 'error', + 'trace')) + + def get_tokens_unprocessed(self, text): + stack = ['root'] + for index, token, value in \ + RegexLexer.get_tokens_unprocessed(self, text, stack): + if token is Name and value in self.EXTRA_KEYWORDS: + yield index, Name.Builtin, value + else: + yield index, token, value + + +class LiterateLexer(Lexer): + """ + Base class for lexers of literate file formats based on LaTeX or Bird-style + (prefixing each code line with ">"). + + Additional options accepted: + + `litstyle` + If given, must be ``"bird"`` or ``"latex"``. If not given, the style + is autodetected: if the first non-whitespace character in the source + is a backslash or percent character, LaTeX is assumed, else Bird. + """ + + bird_re = re.compile(r'(>[ \t]*)(.*\n)') + + def __init__(self, baselexer, **options): + self.baselexer = baselexer + Lexer.__init__(self, **options) + + def get_tokens_unprocessed(self, text): + style = self.options.get('litstyle') + if style is None: + style = (text.lstrip()[0:1] in '%\\') and 'latex' or 'bird' + + code = '' + insertions = [] + if style == 'bird': + # bird-style + for match in line_re.finditer(text): + line = match.group() + m = self.bird_re.match(line) + if m: + insertions.append((len(code), + [(0, Comment.Special, m.group(1))])) + code += m.group(2) + else: + insertions.append((len(code), [(0, Text, line)])) + else: + # latex-style + from pygments.lexers.markup import TexLexer + lxlexer = TexLexer(**self.options) + codelines = 0 + latex = '' + for match in line_re.finditer(text): + line = match.group() + if codelines: + if line.lstrip().startswith('\\end{code}'): + codelines = 0 + latex += line + else: + code += line + elif line.lstrip().startswith('\\begin{code}'): + codelines = 1 + latex += line + insertions.append((len(code), + list(lxlexer.get_tokens_unprocessed(latex)))) + latex = '' + else: + latex += line + insertions.append((len(code), + list(lxlexer.get_tokens_unprocessed(latex)))) + for item in do_insertions(insertions, self.baselexer.get_tokens_unprocessed(code)): + yield item + + +class LiterateHaskellLexer(LiterateLexer): + """ + For Literate Haskell (Bird-style or LaTeX) source. + + Additional options accepted: + + `litstyle` + If given, must be ``"bird"`` or ``"latex"``. If not given, the style + is autodetected: if the first non-whitespace character in the source + is a backslash or percent character, LaTeX is assumed, else Bird. + + .. versionadded:: 0.9 + """ + name = 'Literate Haskell' + aliases = ['lhs', 'literate-haskell', 'lhaskell'] + filenames = ['*.lhs'] + mimetypes = ['text/x-literate-haskell'] + + def __init__(self, **options): + hslexer = HaskellLexer(**options) + LiterateLexer.__init__(self, hslexer, **options) + + +class LiterateIdrisLexer(LiterateLexer): + """ + For Literate Idris (Bird-style or LaTeX) source. + + Additional options accepted: + + `litstyle` + If given, must be ``"bird"`` or ``"latex"``. If not given, the style + is autodetected: if the first non-whitespace character in the source + is a backslash or percent character, LaTeX is assumed, else Bird. + + .. versionadded:: 2.0 + """ + name = 'Literate Idris' + aliases = ['lidr', 'literate-idris', 'lidris'] + filenames = ['*.lidr'] + mimetypes = ['text/x-literate-idris'] + + def __init__(self, **options): + hslexer = IdrisLexer(**options) + LiterateLexer.__init__(self, hslexer, **options) + + +class LiterateAgdaLexer(LiterateLexer): + """ + For Literate Agda source. + + Additional options accepted: + + `litstyle` + If given, must be ``"bird"`` or ``"latex"``. If not given, the style + is autodetected: if the first non-whitespace character in the source + is a backslash or percent character, LaTeX is assumed, else Bird. + + .. versionadded:: 2.0 + """ + name = 'Literate Agda' + aliases = ['lagda', 'literate-agda'] + filenames = ['*.lagda'] + mimetypes = ['text/x-literate-agda'] + + def __init__(self, **options): + agdalexer = AgdaLexer(**options) + LiterateLexer.__init__(self, agdalexer, litstyle='latex', **options) + + +class LiterateCryptolLexer(LiterateLexer): + """ + For Literate Cryptol (Bird-style or LaTeX) source. + + Additional options accepted: + + `litstyle` + If given, must be ``"bird"`` or ``"latex"``. If not given, the style + is autodetected: if the first non-whitespace character in the source + is a backslash or percent character, LaTeX is assumed, else Bird. + + .. versionadded:: 2.0 + """ + name = 'Literate Cryptol' + aliases = ['lcry', 'literate-cryptol', 'lcryptol'] + filenames = ['*.lcry'] + mimetypes = ['text/x-literate-cryptol'] + + def __init__(self, **options): + crylexer = CryptolLexer(**options) + LiterateLexer.__init__(self, crylexer, **options) + + +class KokaLexer(RegexLexer): + """ + Lexer for the `Koka `_ + language. + + .. versionadded:: 1.6 + """ + + name = 'Koka' + aliases = ['koka'] + filenames = ['*.kk', '*.kki'] + mimetypes = ['text/x-koka'] + + keywords = [ + 'infix', 'infixr', 'infixl', + 'type', 'cotype', 'rectype', 'alias', + 'struct', 'con', + 'fun', 'function', 'val', 'var', + 'external', + 'if', 'then', 'else', 'elif', 'return', 'match', + 'private', 'public', 'private', + 'module', 'import', 'as', + 'include', 'inline', + 'rec', + 'try', 'yield', 'enum', + 'interface', 'instance', + ] + + # keywords that are followed by a type + typeStartKeywords = [ + 'type', 'cotype', 'rectype', 'alias', 'struct', 'enum', + ] + + # keywords valid in a type + typekeywords = [ + 'forall', 'exists', 'some', 'with', + ] + + # builtin names and special names + builtin = [ + 'for', 'while', 'repeat', + 'foreach', 'foreach-indexed', + 'error', 'catch', 'finally', + 'cs', 'js', 'file', 'ref', 'assigned', + ] + + # symbols that can be in an operator + symbols = r'[$%&*+@!/\\^~=.:\-?|<>]+' + + # symbol boundary: an operator keyword should not be followed by any of these + sboundary = '(?!'+symbols+')' + + # name boundary: a keyword should not be followed by any of these + boundary = '(?![\w/])' + + # koka token abstractions + tokenType = Name.Attribute + tokenTypeDef = Name.Class + tokenConstructor = Generic.Emph + + # main lexer + tokens = { + 'root': [ + include('whitespace'), + + # go into type mode + (r'::?' + sboundary, tokenType, 'type'), + (r'(alias)(\s+)([a-z]\w*)?', bygroups(Keyword, Text, tokenTypeDef), + 'alias-type'), + (r'(struct)(\s+)([a-z]\w*)?', bygroups(Keyword, Text, tokenTypeDef), + 'struct-type'), + ((r'(%s)' % '|'.join(typeStartKeywords)) + + r'(\s+)([a-z]\w*)?', bygroups(Keyword, Text, tokenTypeDef), + 'type'), + + # special sequences of tokens (we use ?: for non-capturing group as + # required by 'bygroups') + (r'(module)(\s+)(interface\s+)?((?:[a-z]\w*/)*[a-z]\w*)', + bygroups(Keyword, Text, Keyword, Name.Namespace)), + (r'(import)(\s+)((?:[a-z]\w*/)*[a-z]\w*)' + r'(?:(\s*)(=)(\s*)((?:qualified\s*)?)' + r'((?:[a-z]\w*/)*[a-z]\w*))?', + bygroups(Keyword, Text, Name.Namespace, Text, Keyword, Text, + Keyword, Name.Namespace)), + + (r'(^(?:(?:public|private)\s*)?(?:function|fun|val))' + r'(\s+)([a-z]\w*|\((?:' + symbols + r'|/)\))', + bygroups(Keyword, Text, Name.Function)), + (r'(^(?:(?:public|private)\s*)?external)(\s+)(inline\s+)?' + r'([a-z]\w*|\((?:' + symbols + r'|/)\))', + bygroups(Keyword, Text, Keyword, Name.Function)), + + # keywords + (r'(%s)' % '|'.join(typekeywords) + boundary, Keyword.Type), + (r'(%s)' % '|'.join(keywords) + boundary, Keyword), + (r'(%s)' % '|'.join(builtin) + boundary, Keyword.Pseudo), + (r'::?|:=|\->|[=.]' + sboundary, Keyword), + + # names + (r'((?:[a-z]\w*/)*)([A-Z]\w*)', + bygroups(Name.Namespace, tokenConstructor)), + (r'((?:[a-z]\w*/)*)([a-z]\w*)', bygroups(Name.Namespace, Name)), + (r'((?:[a-z]\w*/)*)(\((?:' + symbols + r'|/)\))', + bygroups(Name.Namespace, Name)), + (r'_\w*', Name.Variable), + + # literal string + (r'@"', String.Double, 'litstring'), + + # operators + (symbols + "|/(?![*/])", Operator), + (r'`', Operator), + (r'[{}()\[\];,]', Punctuation), + + # literals. No check for literal characters with len > 1 + (r'[0-9]+\.[0-9]+([eE][\-+]?[0-9]+)?', Number.Float), + (r'0[xX][0-9a-fA-F]+', Number.Hex), + (r'[0-9]+', Number.Integer), + + (r"'", String.Char, 'char'), + (r'"', String.Double, 'string'), + ], + + # type started by alias + 'alias-type': [ + (r'=', Keyword), + include('type') + ], + + # type started by struct + 'struct-type': [ + (r'(?=\((?!,*\)))', Punctuation, '#pop'), + include('type') + ], + + # type started by colon + 'type': [ + (r'[(\[<]', tokenType, 'type-nested'), + include('type-content') + ], + + # type nested in brackets: can contain parameters, comma etc. + 'type-nested': [ + (r'[)\]>]', tokenType, '#pop'), + (r'[(\[<]', tokenType, 'type-nested'), + (r',', tokenType), + (r'([a-z]\w*)(\s*)(:)(?!:)', + bygroups(Name, Text, tokenType)), # parameter name + include('type-content') + ], + + # shared contents of a type + 'type-content': [ + include('whitespace'), + + # keywords + (r'(%s)' % '|'.join(typekeywords) + boundary, Keyword), + (r'(?=((%s)' % '|'.join(keywords) + boundary + '))', + Keyword, '#pop'), # need to match because names overlap... + + # kinds + (r'[EPHVX]' + boundary, tokenType), + + # type names + (r'[a-z][0-9]*(?![\w/])', tokenType), + (r'_\w*', tokenType.Variable), # Generic.Emph + (r'((?:[a-z]\w*/)*)([A-Z]\w*)', + bygroups(Name.Namespace, tokenType)), + (r'((?:[a-z]\w*/)*)([a-z]\w+)', + bygroups(Name.Namespace, tokenType)), + + # type keyword operators + (r'::|->|[.:|]', tokenType), + + # catchall + default('#pop') + ], + + # comments and literals + 'whitespace': [ + (r'\n\s*#.*$', Comment.Preproc), + (r'\s+', Text), + (r'/\*', Comment.Multiline, 'comment'), + (r'//.*$', Comment.Single) + ], + 'comment': [ + (r'[^/*]+', Comment.Multiline), + (r'/\*', Comment.Multiline, '#push'), + (r'\*/', Comment.Multiline, '#pop'), + (r'[*/]', Comment.Multiline), + ], + 'litstring': [ + (r'[^"]+', String.Double), + (r'""', String.Escape), + (r'"', String.Double, '#pop'), + ], + 'string': [ + (r'[^\\"\n]+', String.Double), + include('escape-sequence'), + (r'["\n]', String.Double, '#pop'), + ], + 'char': [ + (r'[^\\\'\n]+', String.Char), + include('escape-sequence'), + (r'[\'\n]', String.Char, '#pop'), + ], + 'escape-sequence': [ + (r'\\[nrt\\"\']', String.Escape), + (r'\\x[0-9a-fA-F]{2}', String.Escape), + (r'\\u[0-9a-fA-F]{4}', String.Escape), + # Yes, \U literals are 6 hex digits. + (r'\\U[0-9a-fA-F]{6}', String.Escape) + ] + } diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/haxe.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/haxe.py new file mode 100644 index 0000000000000000000000000000000000000000..6f5c3599c607c55c6b43a058179be99be4ebfb0a --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/haxe.py @@ -0,0 +1,936 @@ +# -*- coding: utf-8 -*- +""" + pygments.lexers.haxe + ~~~~~~~~~~~~~~~~~~~~ + + Lexers for Haxe and related stuff. + + :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS. + :license: BSD, see LICENSE for details. +""" + +import re + +from pygments.lexer import ExtendedRegexLexer, RegexLexer, include, bygroups, \ + default +from pygments.token import Text, Comment, Operator, Keyword, Name, String, \ + Number, Punctuation, Generic, Whitespace + +__all__ = ['HaxeLexer', 'HxmlLexer'] + + +class HaxeLexer(ExtendedRegexLexer): + """ + For Haxe source code (http://haxe.org/). + + .. versionadded:: 1.3 + """ + + name = 'Haxe' + aliases = ['hx', 'haxe', 'hxsl'] + filenames = ['*.hx', '*.hxsl'] + mimetypes = ['text/haxe', 'text/x-haxe', 'text/x-hx'] + + # keywords extracted from lexer.mll in the haxe compiler source + keyword = (r'(?:function|class|static|var|if|else|while|do|for|' + r'break|return|continue|extends|implements|import|' + r'switch|case|default|public|private|try|untyped|' + r'catch|new|this|throw|extern|enum|in|interface|' + r'cast|override|dynamic|typedef|package|' + r'inline|using|null|true|false|abstract)\b') + + # idtype in lexer.mll + typeid = r'_*[A-Z]\w*' + + # combined ident and dollar and idtype + ident = r'(?:_*[a-z]\w*|_+[0-9]\w*|' + typeid + '|_+|\$\w+)' + + binop = (r'(?:%=|&=|\|=|\^=|\+=|\-=|\*=|/=|<<=|>\s*>\s*=|>\s*>\s*>\s*=|==|' + r'!=|<=|>\s*=|&&|\|\||<<|>>>|>\s*>|\.\.\.|<|>|%|&|\||\^|\+|\*|' + r'/|\-|=>|=)') + + # ident except keywords + ident_no_keyword = r'(?!' + keyword + ')' + ident + + flags = re.DOTALL | re.MULTILINE + + preproc_stack = [] + + def preproc_callback(self, match, ctx): + proc = match.group(2) + + if proc == 'if': + # store the current stack + self.preproc_stack.append(ctx.stack[:]) + elif proc in ['else', 'elseif']: + # restore the stack back to right before #if + if self.preproc_stack: + ctx.stack = self.preproc_stack[-1][:] + elif proc == 'end': + # remove the saved stack of previous #if + if self.preproc_stack: + self.preproc_stack.pop() + + # #if and #elseif should follow by an expr + if proc in ['if', 'elseif']: + ctx.stack.append('preproc-expr') + + # #error can be optionally follow by the error msg + if proc in ['error']: + ctx.stack.append('preproc-error') + + yield match.start(), Comment.Preproc, '#' + proc + ctx.pos = match.end() + + tokens = { + 'root': [ + include('spaces'), + include('meta'), + (r'(?:package)\b', Keyword.Namespace, ('semicolon', 'package')), + (r'(?:import)\b', Keyword.Namespace, ('semicolon', 'import')), + (r'(?:using)\b', Keyword.Namespace, ('semicolon', 'using')), + (r'(?:extern|private)\b', Keyword.Declaration), + (r'(?:abstract)\b', Keyword.Declaration, 'abstract'), + (r'(?:class|interface)\b', Keyword.Declaration, 'class'), + (r'(?:enum)\b', Keyword.Declaration, 'enum'), + (r'(?:typedef)\b', Keyword.Declaration, 'typedef'), + + # top-level expression + # although it is not supported in haxe, but it is common to write + # expression in web pages the positive lookahead here is to prevent + # an infinite loop at the EOF + (r'(?=.)', Text, 'expr-statement'), + ], + + # space/tab/comment/preproc + 'spaces': [ + (r'\s+', Text), + (r'//[^\n\r]*', Comment.Single), + (r'/\*.*?\*/', Comment.Multiline), + (r'(#)(if|elseif|else|end|error)\b', preproc_callback), + ], + + 'string-single-interpol': [ + (r'\$\{', String.Interpol, ('string-interpol-close', 'expr')), + (r'\$\$', String.Escape), + (r'\$(?=' + ident + ')', String.Interpol, 'ident'), + include('string-single'), + ], + + 'string-single': [ + (r"'", String.Single, '#pop'), + (r'\\.', String.Escape), + (r'.', String.Single), + ], + + 'string-double': [ + (r'"', String.Double, '#pop'), + (r'\\.', String.Escape), + (r'.', String.Double), + ], + + 'string-interpol-close': [ + (r'\$'+ident, String.Interpol), + (r'\}', String.Interpol, '#pop'), + ], + + 'package': [ + include('spaces'), + (ident, Name.Namespace), + (r'\.', Punctuation, 'import-ident'), + default('#pop'), + ], + + 'import': [ + include('spaces'), + (ident, Name.Namespace), + (r'\*', Keyword), # wildcard import + (r'\.', Punctuation, 'import-ident'), + (r'in', Keyword.Namespace, 'ident'), + default('#pop'), + ], + + 'import-ident': [ + include('spaces'), + (r'\*', Keyword, '#pop'), # wildcard import + (ident, Name.Namespace, '#pop'), + ], + + 'using': [ + include('spaces'), + (ident, Name.Namespace), + (r'\.', Punctuation, 'import-ident'), + default('#pop'), + ], + + 'preproc-error': [ + (r'\s+', Comment.Preproc), + (r"'", String.Single, ('#pop', 'string-single')), + (r'"', String.Double, ('#pop', 'string-double')), + default('#pop'), + ], + + 'preproc-expr': [ + (r'\s+', Comment.Preproc), + (r'\!', Comment.Preproc), + (r'\(', Comment.Preproc, ('#pop', 'preproc-parenthesis')), + + (ident, Comment.Preproc, '#pop'), + + # Float + (r'\.[0-9]+', Number.Float), + (r'[0-9]+[eE][+\-]?[0-9]+', Number.Float), + (r'[0-9]+\.[0-9]*[eE][+\-]?[0-9]+', Number.Float), + (r'[0-9]+\.[0-9]+', Number.Float), + (r'[0-9]+\.(?!' + ident + '|\.\.)', Number.Float), + + # Int + (r'0x[0-9a-fA-F]+', Number.Hex), + (r'[0-9]+', Number.Integer), + + # String + (r"'", String.Single, ('#pop', 'string-single')), + (r'"', String.Double, ('#pop', 'string-double')), + ], + + 'preproc-parenthesis': [ + (r'\s+', Comment.Preproc), + (r'\)', Comment.Preproc, '#pop'), + default('preproc-expr-in-parenthesis'), + ], + + 'preproc-expr-chain': [ + (r'\s+', Comment.Preproc), + (binop, Comment.Preproc, ('#pop', 'preproc-expr-in-parenthesis')), + default('#pop'), + ], + + # same as 'preproc-expr' but able to chain 'preproc-expr-chain' + 'preproc-expr-in-parenthesis': [ + (r'\s+', Comment.Preproc), + (r'\!', Comment.Preproc), + (r'\(', Comment.Preproc, + ('#pop', 'preproc-expr-chain', 'preproc-parenthesis')), + + (ident, Comment.Preproc, ('#pop', 'preproc-expr-chain')), + + # Float + (r'\.[0-9]+', Number.Float, ('#pop', 'preproc-expr-chain')), + (r'[0-9]+[eE][+\-]?[0-9]+', Number.Float, ('#pop', 'preproc-expr-chain')), + (r'[0-9]+\.[0-9]*[eE][+\-]?[0-9]+', Number.Float, ('#pop', 'preproc-expr-chain')), + (r'[0-9]+\.[0-9]+', Number.Float, ('#pop', 'preproc-expr-chain')), + (r'[0-9]+\.(?!' + ident + '|\.\.)', Number.Float, ('#pop', 'preproc-expr-chain')), + + # Int + (r'0x[0-9a-fA-F]+', Number.Hex, ('#pop', 'preproc-expr-chain')), + (r'[0-9]+', Number.Integer, ('#pop', 'preproc-expr-chain')), + + # String + (r"'", String.Single, + ('#pop', 'preproc-expr-chain', 'string-single')), + (r'"', String.Double, + ('#pop', 'preproc-expr-chain', 'string-double')), + ], + + 'abstract': [ + include('spaces'), + default(('#pop', 'abstract-body', 'abstract-relation', + 'abstract-opaque', 'type-param-constraint', 'type-name')), + ], + + 'abstract-body': [ + include('spaces'), + (r'\{', Punctuation, ('#pop', 'class-body')), + ], + + 'abstract-opaque': [ + include('spaces'), + (r'\(', Punctuation, ('#pop', 'parenthesis-close', 'type')), + default('#pop'), + ], + + 'abstract-relation': [ + include('spaces'), + (r'(?:to|from)', Keyword.Declaration, 'type'), + (r',', Punctuation), + default('#pop'), + ], + + 'meta': [ + include('spaces'), + (r'@', Name.Decorator, ('meta-body', 'meta-ident', 'meta-colon')), + ], + + # optional colon + 'meta-colon': [ + include('spaces'), + (r':', Name.Decorator, '#pop'), + default('#pop'), + ], + + # same as 'ident' but set token as Name.Decorator instead of Name + 'meta-ident': [ + include('spaces'), + (ident, Name.Decorator, '#pop'), + ], + + 'meta-body': [ + include('spaces'), + (r'\(', Name.Decorator, ('#pop', 'meta-call')), + default('#pop'), + ], + + 'meta-call': [ + include('spaces'), + (r'\)', Name.Decorator, '#pop'), + default(('#pop', 'meta-call-sep', 'expr')), + ], + + 'meta-call-sep': [ + include('spaces'), + (r'\)', Name.Decorator, '#pop'), + (r',', Punctuation, ('#pop', 'meta-call')), + ], + + 'typedef': [ + include('spaces'), + default(('#pop', 'typedef-body', 'type-param-constraint', + 'type-name')), + ], + + 'typedef-body': [ + include('spaces'), + (r'=', Operator, ('#pop', 'optional-semicolon', 'type')), + ], + + 'enum': [ + include('spaces'), + default(('#pop', 'enum-body', 'bracket-open', + 'type-param-constraint', 'type-name')), + ], + + 'enum-body': [ + include('spaces'), + include('meta'), + (r'\}', Punctuation, '#pop'), + (ident_no_keyword, Name, ('enum-member', 'type-param-constraint')), + ], + + 'enum-member': [ + include('spaces'), + (r'\(', Punctuation, + ('#pop', 'semicolon', 'flag', 'function-param')), + default(('#pop', 'semicolon', 'flag')), + ], + + 'class': [ + include('spaces'), + default(('#pop', 'class-body', 'bracket-open', 'extends', + 'type-param-constraint', 'type-name')), + ], + + 'extends': [ + include('spaces'), + (r'(?:extends|implements)\b', Keyword.Declaration, 'type'), + (r',', Punctuation), # the comma is made optional here, since haxe2 + # requires the comma but haxe3 does not allow it + default('#pop'), + ], + + 'bracket-open': [ + include('spaces'), + (r'\{', Punctuation, '#pop'), + ], + + 'bracket-close': [ + include('spaces'), + (r'\}', Punctuation, '#pop'), + ], + + 'class-body': [ + include('spaces'), + include('meta'), + (r'\}', Punctuation, '#pop'), + (r'(?:static|public|private|override|dynamic|inline|macro)\b', + Keyword.Declaration), + default('class-member'), + ], + + 'class-member': [ + include('spaces'), + (r'(var)\b', Keyword.Declaration, + ('#pop', 'optional-semicolon', 'var')), + (r'(function)\b', Keyword.Declaration, + ('#pop', 'optional-semicolon', 'class-method')), + ], + + # local function, anonymous or not + 'function-local': [ + include('spaces'), + (ident_no_keyword, Name.Function, + ('#pop', 'optional-expr', 'flag', 'function-param', + 'parenthesis-open', 'type-param-constraint')), + default(('#pop', 'optional-expr', 'flag', 'function-param', + 'parenthesis-open', 'type-param-constraint')), + ], + + 'optional-expr': [ + include('spaces'), + include('expr'), + default('#pop'), + ], + + 'class-method': [ + include('spaces'), + (ident, Name.Function, ('#pop', 'optional-expr', 'flag', + 'function-param', 'parenthesis-open', + 'type-param-constraint')), + ], + + # function arguments + 'function-param': [ + include('spaces'), + (r'\)', Punctuation, '#pop'), + (r'\?', Punctuation), + (ident_no_keyword, Name, + ('#pop', 'function-param-sep', 'assign', 'flag')), + ], + + 'function-param-sep': [ + include('spaces'), + (r'\)', Punctuation, '#pop'), + (r',', Punctuation, ('#pop', 'function-param')), + ], + + 'prop-get-set': [ + include('spaces'), + (r'\(', Punctuation, ('#pop', 'parenthesis-close', + 'prop-get-set-opt', 'comma', 'prop-get-set-opt')), + default('#pop'), + ], + + 'prop-get-set-opt': [ + include('spaces'), + (r'(?:default|null|never|dynamic|get|set)\b', Keyword, '#pop'), + (ident_no_keyword, Text, '#pop'), # custom getter/setter + ], + + 'expr-statement': [ + include('spaces'), + # makes semicolon optional here, just to avoid checking the last + # one is bracket or not. + default(('#pop', 'optional-semicolon', 'expr')), + ], + + 'expr': [ + include('spaces'), + (r'@', Name.Decorator, ('#pop', 'optional-expr', 'meta-body', + 'meta-ident', 'meta-colon')), + (r'(?:\+\+|\-\-|~(?!/)|!|\-)', Operator), + (r'\(', Punctuation, ('#pop', 'expr-chain', 'parenthesis')), + (r'(?:static|public|private|override|dynamic|inline)\b', + Keyword.Declaration), + (r'(?:function)\b', Keyword.Declaration, ('#pop', 'expr-chain', + 'function-local')), + (r'\{', Punctuation, ('#pop', 'expr-chain', 'bracket')), + (r'(?:true|false|null)\b', Keyword.Constant, ('#pop', 'expr-chain')), + (r'(?:this)\b', Keyword, ('#pop', 'expr-chain')), + (r'(?:cast)\b', Keyword, ('#pop', 'expr-chain', 'cast')), + (r'(?:try)\b', Keyword, ('#pop', 'catch', 'expr')), + (r'(?:var)\b', Keyword.Declaration, ('#pop', 'var')), + (r'(?:new)\b', Keyword, ('#pop', 'expr-chain', 'new')), + (r'(?:switch)\b', Keyword, ('#pop', 'switch')), + (r'(?:if)\b', Keyword, ('#pop', 'if')), + (r'(?:do)\b', Keyword, ('#pop', 'do')), + (r'(?:while)\b', Keyword, ('#pop', 'while')), + (r'(?:for)\b', Keyword, ('#pop', 'for')), + (r'(?:untyped|throw)\b', Keyword), + (r'(?:return)\b', Keyword, ('#pop', 'optional-expr')), + (r'(?:macro)\b', Keyword, ('#pop', 'macro')), + (r'(?:continue|break)\b', Keyword, '#pop'), + (r'(?:\$\s*[a-z]\b|\$(?!'+ident+'))', Name, ('#pop', 'dollar')), + (ident_no_keyword, Name, ('#pop', 'expr-chain')), + + # Float + (r'\.[0-9]+', Number.Float, ('#pop', 'expr-chain')), + (r'[0-9]+[eE][+\-]?[0-9]+', Number.Float, ('#pop', 'expr-chain')), + (r'[0-9]+\.[0-9]*[eE][+\-]?[0-9]+', Number.Float, ('#pop', 'expr-chain')), + (r'[0-9]+\.[0-9]+', Number.Float, ('#pop', 'expr-chain')), + (r'[0-9]+\.(?!' + ident + '|\.\.)', Number.Float, ('#pop', 'expr-chain')), + + # Int + (r'0x[0-9a-fA-F]+', Number.Hex, ('#pop', 'expr-chain')), + (r'[0-9]+', Number.Integer, ('#pop', 'expr-chain')), + + # String + (r"'", String.Single, ('#pop', 'expr-chain', 'string-single-interpol')), + (r'"', String.Double, ('#pop', 'expr-chain', 'string-double')), + + # EReg + (r'~/(\\\\|\\/|[^/\n])*/[gimsu]*', String.Regex, ('#pop', 'expr-chain')), + + # Array + (r'\[', Punctuation, ('#pop', 'expr-chain', 'array-decl')), + ], + + 'expr-chain': [ + include('spaces'), + (r'(?:\+\+|\-\-)', Operator), + (binop, Operator, ('#pop', 'expr')), + (r'(?:in)\b', Keyword, ('#pop', 'expr')), + (r'\?', Operator, ('#pop', 'expr', 'ternary', 'expr')), + (r'(\.)(' + ident_no_keyword + ')', bygroups(Punctuation, Name)), + (r'\[', Punctuation, 'array-access'), + (r'\(', Punctuation, 'call'), + default('#pop'), + ], + + # macro reification + 'macro': [ + include('spaces'), + include('meta'), + (r':', Punctuation, ('#pop', 'type')), + + (r'(?:extern|private)\b', Keyword.Declaration), + (r'(?:abstract)\b', Keyword.Declaration, ('#pop', 'optional-semicolon', 'abstract')), + (r'(?:class|interface)\b', Keyword.Declaration, ('#pop', 'optional-semicolon', 'macro-class')), + (r'(?:enum)\b', Keyword.Declaration, ('#pop', 'optional-semicolon', 'enum')), + (r'(?:typedef)\b', Keyword.Declaration, ('#pop', 'optional-semicolon', 'typedef')), + + default(('#pop', 'expr')), + ], + + 'macro-class': [ + (r'\{', Punctuation, ('#pop', 'class-body')), + include('class') + ], + + # cast can be written as "cast expr" or "cast(expr, type)" + 'cast': [ + include('spaces'), + (r'\(', Punctuation, ('#pop', 'parenthesis-close', + 'cast-type', 'expr')), + default(('#pop', 'expr')), + ], + + # optionally give a type as the 2nd argument of cast() + 'cast-type': [ + include('spaces'), + (r',', Punctuation, ('#pop', 'type')), + default('#pop'), + ], + + 'catch': [ + include('spaces'), + (r'(?:catch)\b', Keyword, ('expr', 'function-param', + 'parenthesis-open')), + default('#pop'), + ], + + # do-while loop + 'do': [ + include('spaces'), + default(('#pop', 'do-while', 'expr')), + ], + + # the while after do + 'do-while': [ + include('spaces'), + (r'(?:while)\b', Keyword, ('#pop', 'parenthesis', + 'parenthesis-open')), + ], + + 'while': [ + include('spaces'), + (r'\(', Punctuation, ('#pop', 'expr', 'parenthesis')), + ], + + 'for': [ + include('spaces'), + (r'\(', Punctuation, ('#pop', 'expr', 'parenthesis')), + ], + + 'if': [ + include('spaces'), + (r'\(', Punctuation, ('#pop', 'else', 'optional-semicolon', 'expr', + 'parenthesis')), + ], + + 'else': [ + include('spaces'), + (r'(?:else)\b', Keyword, ('#pop', 'expr')), + default('#pop'), + ], + + 'switch': [ + include('spaces'), + default(('#pop', 'switch-body', 'bracket-open', 'expr')), + ], + + 'switch-body': [ + include('spaces'), + (r'(?:case|default)\b', Keyword, ('case-block', 'case')), + (r'\}', Punctuation, '#pop'), + ], + + 'case': [ + include('spaces'), + (r':', Punctuation, '#pop'), + default(('#pop', 'case-sep', 'case-guard', 'expr')), + ], + + 'case-sep': [ + include('spaces'), + (r':', Punctuation, '#pop'), + (r',', Punctuation, ('#pop', 'case')), + ], + + 'case-guard': [ + include('spaces'), + (r'(?:if)\b', Keyword, ('#pop', 'parenthesis', 'parenthesis-open')), + default('#pop'), + ], + + # optional multiple expr under a case + 'case-block': [ + include('spaces'), + (r'(?!(?:case|default)\b|\})', Keyword, 'expr-statement'), + default('#pop'), + ], + + 'new': [ + include('spaces'), + default(('#pop', 'call', 'parenthesis-open', 'type')), + ], + + 'array-decl': [ + include('spaces'), + (r'\]', Punctuation, '#pop'), + default(('#pop', 'array-decl-sep', 'expr')), + ], + + 'array-decl-sep': [ + include('spaces'), + (r'\]', Punctuation, '#pop'), + (r',', Punctuation, ('#pop', 'array-decl')), + ], + + 'array-access': [ + include('spaces'), + default(('#pop', 'array-access-close', 'expr')), + ], + + 'array-access-close': [ + include('spaces'), + (r'\]', Punctuation, '#pop'), + ], + + 'comma': [ + include('spaces'), + (r',', Punctuation, '#pop'), + ], + + 'colon': [ + include('spaces'), + (r':', Punctuation, '#pop'), + ], + + 'semicolon': [ + include('spaces'), + (r';', Punctuation, '#pop'), + ], + + 'optional-semicolon': [ + include('spaces'), + (r';', Punctuation, '#pop'), + default('#pop'), + ], + + # identity that CAN be a Haxe keyword + 'ident': [ + include('spaces'), + (ident, Name, '#pop'), + ], + + 'dollar': [ + include('spaces'), + (r'\{', Punctuation, ('#pop', 'expr-chain', 'bracket-close', 'expr')), + default(('#pop', 'expr-chain')), + ], + + 'type-name': [ + include('spaces'), + (typeid, Name, '#pop'), + ], + + 'type-full-name': [ + include('spaces'), + (r'\.', Punctuation, 'ident'), + default('#pop'), + ], + + 'type': [ + include('spaces'), + (r'\?', Punctuation), + (ident, Name, ('#pop', 'type-check', 'type-full-name')), + (r'\{', Punctuation, ('#pop', 'type-check', 'type-struct')), + (r'\(', Punctuation, ('#pop', 'type-check', 'type-parenthesis')), + ], + + 'type-parenthesis': [ + include('spaces'), + default(('#pop', 'parenthesis-close', 'type')), + ], + + 'type-check': [ + include('spaces'), + (r'->', Punctuation, ('#pop', 'type')), + (r'<(?!=)', Punctuation, 'type-param'), + default('#pop'), + ], + + 'type-struct': [ + include('spaces'), + (r'\}', Punctuation, '#pop'), + (r'\?', Punctuation), + (r'>', Punctuation, ('comma', 'type')), + (ident_no_keyword, Name, ('#pop', 'type-struct-sep', 'type', 'colon')), + include('class-body'), + ], + + 'type-struct-sep': [ + include('spaces'), + (r'\}', Punctuation, '#pop'), + (r',', Punctuation, ('#pop', 'type-struct')), + ], + + # type-param can be a normal type or a constant literal... + 'type-param-type': [ + # Float + (r'\.[0-9]+', Number.Float, '#pop'), + (r'[0-9]+[eE][+\-]?[0-9]+', Number.Float, '#pop'), + (r'[0-9]+\.[0-9]*[eE][+\-]?[0-9]+', Number.Float, '#pop'), + (r'[0-9]+\.[0-9]+', Number.Float, '#pop'), + (r'[0-9]+\.(?!' + ident + '|\.\.)', Number.Float, '#pop'), + + # Int + (r'0x[0-9a-fA-F]+', Number.Hex, '#pop'), + (r'[0-9]+', Number.Integer, '#pop'), + + # String + (r"'", String.Single, ('#pop', 'string-single')), + (r'"', String.Double, ('#pop', 'string-double')), + + # EReg + (r'~/(\\\\|\\/|[^/\n])*/[gim]*', String.Regex, '#pop'), + + # Array + (r'\[', Operator, ('#pop', 'array-decl')), + + include('type'), + ], + + # type-param part of a type + # ie. the path in Map + 'type-param': [ + include('spaces'), + default(('#pop', 'type-param-sep', 'type-param-type')), + ], + + 'type-param-sep': [ + include('spaces'), + (r'>', Punctuation, '#pop'), + (r',', Punctuation, ('#pop', 'type-param')), + ], + + # optional type-param that may include constraint + # ie. + 'type-param-constraint': [ + include('spaces'), + (r'<(?!=)', Punctuation, ('#pop', 'type-param-constraint-sep', + 'type-param-constraint-flag', 'type-name')), + default('#pop'), + ], + + 'type-param-constraint-sep': [ + include('spaces'), + (r'>', Punctuation, '#pop'), + (r',', Punctuation, ('#pop', 'type-param-constraint-sep', + 'type-param-constraint-flag', 'type-name')), + ], + + # the optional constraint inside type-param + 'type-param-constraint-flag': [ + include('spaces'), + (r':', Punctuation, ('#pop', 'type-param-constraint-flag-type')), + default('#pop'), + ], + + 'type-param-constraint-flag-type': [ + include('spaces'), + (r'\(', Punctuation, ('#pop', 'type-param-constraint-flag-type-sep', + 'type')), + default(('#pop', 'type')), + ], + + 'type-param-constraint-flag-type-sep': [ + include('spaces'), + (r'\)', Punctuation, '#pop'), + (r',', Punctuation, 'type'), + ], + + # a parenthesis expr that contain exactly one expr + 'parenthesis': [ + include('spaces'), + default(('#pop', 'parenthesis-close', 'flag', 'expr')), + ], + + 'parenthesis-open': [ + include('spaces'), + (r'\(', Punctuation, '#pop'), + ], + + 'parenthesis-close': [ + include('spaces'), + (r'\)', Punctuation, '#pop'), + ], + + 'var': [ + include('spaces'), + (ident_no_keyword, Text, ('#pop', 'var-sep', 'assign', 'flag', 'prop-get-set')), + ], + + # optional more var decl. + 'var-sep': [ + include('spaces'), + (r',', Punctuation, ('#pop', 'var')), + default('#pop'), + ], + + # optional assignment + 'assign': [ + include('spaces'), + (r'=', Operator, ('#pop', 'expr')), + default('#pop'), + ], + + # optional type flag + 'flag': [ + include('spaces'), + (r':', Punctuation, ('#pop', 'type')), + default('#pop'), + ], + + # colon as part of a ternary operator (?:) + 'ternary': [ + include('spaces'), + (r':', Operator, '#pop'), + ], + + # function call + 'call': [ + include('spaces'), + (r'\)', Punctuation, '#pop'), + default(('#pop', 'call-sep', 'expr')), + ], + + # after a call param + 'call-sep': [ + include('spaces'), + (r'\)', Punctuation, '#pop'), + (r',', Punctuation, ('#pop', 'call')), + ], + + # bracket can be block or object + 'bracket': [ + include('spaces'), + (r'(?!(?:\$\s*[a-z]\b|\$(?!'+ident+')))' + ident_no_keyword, Name, + ('#pop', 'bracket-check')), + (r"'", String.Single, ('#pop', 'bracket-check', 'string-single')), + (r'"', String.Double, ('#pop', 'bracket-check', 'string-double')), + default(('#pop', 'block')), + ], + + 'bracket-check': [ + include('spaces'), + (r':', Punctuation, ('#pop', 'object-sep', 'expr')), # is object + default(('#pop', 'block', 'optional-semicolon', 'expr-chain')), # is block + ], + + # code block + 'block': [ + include('spaces'), + (r'\}', Punctuation, '#pop'), + default('expr-statement'), + ], + + # object in key-value pairs + 'object': [ + include('spaces'), + (r'\}', Punctuation, '#pop'), + default(('#pop', 'object-sep', 'expr', 'colon', 'ident-or-string')) + ], + + # a key of an object + 'ident-or-string': [ + include('spaces'), + (ident_no_keyword, Name, '#pop'), + (r"'", String.Single, ('#pop', 'string-single')), + (r'"', String.Double, ('#pop', 'string-double')), + ], + + # after a key-value pair in object + 'object-sep': [ + include('spaces'), + (r'\}', Punctuation, '#pop'), + (r',', Punctuation, ('#pop', 'object')), + ], + + + + } + + def analyse_text(text): + if re.match(r'\w+\s*:\s*\w', text): + return 0.3 + + +class HxmlLexer(RegexLexer): + """ + Lexer for `haXe build `_ files. + + .. versionadded:: 1.6 + """ + name = 'Hxml' + aliases = ['haxeml', 'hxml'] + filenames = ['*.hxml'] + + tokens = { + 'root': [ + # Seperator + (r'(--)(next)', bygroups(Punctuation, Generic.Heading)), + # Compiler switches with one dash + (r'(-)(prompt|debug|v)', bygroups(Punctuation, Keyword.Keyword)), + # Compilerswitches with two dashes + (r'(--)(neko-source|flash-strict|flash-use-stage|no-opt|no-traces|' + r'no-inline|times|no-output)', bygroups(Punctuation, Keyword)), + # Targets and other options that take an argument + (r'(-)(cpp|js|neko|x|as3|swf9?|swf-lib|php|xml|main|lib|D|resource|' + r'cp|cmd)( +)(.+)', + bygroups(Punctuation, Keyword, Whitespace, String)), + # Options that take only numerical arguments + (r'(-)(swf-version)( +)(\d+)', + bygroups(Punctuation, Keyword, Number.Integer)), + # An Option that defines the size, the fps and the background + # color of an flash movie + (r'(-)(swf-header)( +)(\d+)(:)(\d+)(:)(\d+)(:)([A-Fa-f0-9]{6})', + bygroups(Punctuation, Keyword, Whitespace, Number.Integer, + Punctuation, Number.Integer, Punctuation, Number.Integer, + Punctuation, Number.Hex)), + # options with two dashes that takes arguments + (r'(--)(js-namespace|php-front|php-lib|remap|gen-hx-classes)( +)' + r'(.+)', bygroups(Punctuation, Keyword, Whitespace, String)), + # Single line comment, multiline ones are not allowed. + (r'#.*', Comment.Single) + ] + } diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/hdl.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/hdl.py new file mode 100644 index 0000000000000000000000000000000000000000..57fb7ac96242ce7e0084bed66d22e058b5c02cef --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/hdl.py @@ -0,0 +1,382 @@ +# -*- coding: utf-8 -*- +""" + pygments.lexers.hdl + ~~~~~~~~~~~~~~~~~~~ + + Lexers for hardware descriptor languages. + + :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS. + :license: BSD, see LICENSE for details. +""" + +import re + +from pygments.lexer import RegexLexer, bygroups, include, using, this, words +from pygments.token import Text, Comment, Operator, Keyword, Name, String, \ + Number, Punctuation, Error + +__all__ = ['VerilogLexer', 'SystemVerilogLexer', 'VhdlLexer'] + + +class VerilogLexer(RegexLexer): + """ + For verilog source code with preprocessor directives. + + .. versionadded:: 1.4 + """ + name = 'verilog' + aliases = ['verilog', 'v'] + filenames = ['*.v'] + mimetypes = ['text/x-verilog'] + + #: optional Comment or Whitespace + _ws = r'(?:\s|//.*?\n|/[*].*?[*]/)+' + + tokens = { + 'root': [ + (r'^\s*`define', Comment.Preproc, 'macro'), + (r'\n', Text), + (r'\s+', Text), + (r'\\\n', Text), # line continuation + (r'/(\\\n)?/(\n|(.|\n)*?[^\\]\n)', Comment.Single), + (r'/(\\\n)?[*](.|\n)*?[*](\\\n)?/', Comment.Multiline), + (r'[{}#@]', Punctuation), + (r'L?"', String, 'string'), + (r"L?'(\\.|\\[0-7]{1,3}|\\x[a-fA-F0-9]{1,2}|[^\\\'\n])'", String.Char), + (r'(\d+\.\d*|\.\d+|\d+)[eE][+-]?\d+[lL]?', Number.Float), + (r'(\d+\.\d*|\.\d+|\d+[fF])[fF]?', Number.Float), + (r'([0-9]+)|(\'h)[0-9a-fA-F]+', Number.Hex), + (r'([0-9]+)|(\'b)[01]+', Number.Bin), + (r'([0-9]+)|(\'d)[0-9]+', Number.Integer), + (r'([0-9]+)|(\'o)[0-7]+', Number.Oct), + (r'\'[01xz]', Number), + (r'\d+[Ll]?', Number.Integer), + (r'\*/', Error), + (r'[~!%^&*+=|?:<>/-]', Operator), + (r'[()\[\],.;\']', Punctuation), + (r'`[a-zA-Z_]\w*', Name.Constant), + + (r'^(\s*)(package)(\s+)', bygroups(Text, Keyword.Namespace, Text)), + (r'^(\s*)(import)(\s+)', bygroups(Text, Keyword.Namespace, Text), + 'import'), + + (words(( + 'always', 'always_comb', 'always_ff', 'always_latch', 'and', + 'assign', 'automatic', 'begin', 'break', 'buf', 'bufif0', 'bufif1', + 'case', 'casex', 'casez', 'cmos', 'const', 'continue', 'deassign', + 'default', 'defparam', 'disable', 'do', 'edge', 'else', 'end', 'endcase', + 'endfunction', 'endgenerate', 'endmodule', 'endpackage', 'endprimitive', + 'endspecify', 'endtable', 'endtask', 'enum', 'event', 'final', 'for', + 'force', 'forever', 'fork', 'function', 'generate', 'genvar', 'highz0', + 'highz1', 'if', 'initial', 'inout', 'input', 'integer', 'join', 'large', + 'localparam', 'macromodule', 'medium', 'module', 'nand', 'negedge', + 'nmos', 'nor', 'not', 'notif0', 'notif1', 'or', 'output', 'packed', + 'parameter', 'pmos', 'posedge', 'primitive', 'pull0', 'pull1', + 'pulldown', 'pullup', 'rcmos', 'ref', 'release', 'repeat', 'return', + 'rnmos', 'rpmos', 'rtran', 'rtranif0', 'rtranif1', 'scalared', 'signed', + 'small', 'specify', 'specparam', 'strength', 'string', 'strong0', + 'strong1', 'struct', 'table', 'task', 'tran', 'tranif0', 'tranif1', + 'type', 'typedef', 'unsigned', 'var', 'vectored', 'void', 'wait', + 'weak0', 'weak1', 'while', 'xnor', 'xor'), suffix=r'\b'), + Keyword), + + (words(( + 'accelerate', 'autoexpand_vectornets', 'celldefine', 'default_nettype', + 'else', 'elsif', 'endcelldefine', 'endif', 'endprotect', 'endprotected', + 'expand_vectornets', 'ifdef', 'ifndef', 'include', 'noaccelerate', + 'noexpand_vectornets', 'noremove_gatenames', 'noremove_netnames', + 'nounconnected_drive', 'protect', 'protected', 'remove_gatenames', + 'remove_netnames', 'resetall', 'timescale', 'unconnected_drive', + 'undef'), prefix=r'`', suffix=r'\b'), + Comment.Preproc), + + (words(( + 'bits', 'bitstoreal', 'bitstoshortreal', 'countdrivers', 'display', 'fclose', + 'fdisplay', 'finish', 'floor', 'fmonitor', 'fopen', 'fstrobe', 'fwrite', + 'getpattern', 'history', 'incsave', 'input', 'itor', 'key', 'list', 'log', + 'monitor', 'monitoroff', 'monitoron', 'nokey', 'nolog', 'printtimescale', + 'random', 'readmemb', 'readmemh', 'realtime', 'realtobits', 'reset', + 'reset_count', 'reset_value', 'restart', 'rtoi', 'save', 'scale', 'scope', + 'shortrealtobits', 'showscopes', 'showvariables', 'showvars', 'sreadmemb', + 'sreadmemh', 'stime', 'stop', 'strobe', 'time', 'timeformat', 'write'), + prefix=r'\$', suffix=r'\b'), + Name.Builtin), + + (words(( + 'byte', 'shortint', 'int', 'longint', 'integer', 'time', + 'bit', 'logic', 'reg', 'supply0', 'supply1', 'tri', 'triand', + 'trior', 'tri0', 'tri1', 'trireg', 'uwire', 'wire', 'wand', 'wo' + 'shortreal', 'real', 'realtime'), suffix=r'\b'), + Keyword.Type), + (r'[a-zA-Z_]\w*:(?!:)', Name.Label), + (r'\$?[a-zA-Z_]\w*', Name), + ], + 'string': [ + (r'"', String, '#pop'), + (r'\\([\\abfnrtv"\']|x[a-fA-F0-9]{2,4}|[0-7]{1,3})', String.Escape), + (r'[^\\"\n]+', String), # all other characters + (r'\\\n', String), # line continuation + (r'\\', String), # stray backslash + ], + 'macro': [ + (r'[^/\n]+', Comment.Preproc), + (r'/[*](.|\n)*?[*]/', Comment.Multiline), + (r'//.*?\n', Comment.Single, '#pop'), + (r'/', Comment.Preproc), + (r'(?<=\\)\n', Comment.Preproc), + (r'\n', Comment.Preproc, '#pop'), + ], + 'import': [ + (r'[\w:]+\*?', Name.Namespace, '#pop') + ] + } + + def get_tokens_unprocessed(self, text): + for index, token, value in \ + RegexLexer.get_tokens_unprocessed(self, text): + # Convention: mark all upper case names as constants + if token is Name: + if value.isupper(): + token = Name.Constant + yield index, token, value + + +class SystemVerilogLexer(RegexLexer): + """ + Extends verilog lexer to recognise all SystemVerilog keywords from IEEE + 1800-2009 standard. + + .. versionadded:: 1.5 + """ + name = 'systemverilog' + aliases = ['systemverilog', 'sv'] + filenames = ['*.sv', '*.svh'] + mimetypes = ['text/x-systemverilog'] + + #: optional Comment or Whitespace + _ws = r'(?:\s|//.*?\n|/[*].*?[*]/)+' + + tokens = { + 'root': [ + (r'^\s*`define', Comment.Preproc, 'macro'), + (r'^(\s*)(package)(\s+)', bygroups(Text, Keyword.Namespace, Text)), + (r'^(\s*)(import)(\s+)', bygroups(Text, Keyword.Namespace, Text), 'import'), + + (r'\n', Text), + (r'\s+', Text), + (r'\\\n', Text), # line continuation + (r'/(\\\n)?/(\n|(.|\n)*?[^\\]\n)', Comment.Single), + (r'/(\\\n)?[*](.|\n)*?[*](\\\n)?/', Comment.Multiline), + (r'[{}#@]', Punctuation), + (r'L?"', String, 'string'), + (r"L?'(\\.|\\[0-7]{1,3}|\\x[a-fA-F0-9]{1,2}|[^\\\'\n])'", String.Char), + (r'(\d+\.\d*|\.\d+|\d+)[eE][+-]?\d+[lL]?', Number.Float), + (r'(\d+\.\d*|\.\d+|\d+[fF])[fF]?', Number.Float), + (r'([0-9]+)|(\'h)[0-9a-fA-F]+', Number.Hex), + (r'([0-9]+)|(\'b)[01]+', Number.Bin), + (r'([0-9]+)|(\'d)[0-9]+', Number.Integer), + (r'([0-9]+)|(\'o)[0-7]+', Number.Oct), + (r'\'[01xz]', Number), + (r'\d+[Ll]?', Number.Integer), + (r'\*/', Error), + (r'[~!%^&*+=|?:<>/-]', Operator), + (r'[()\[\],.;\']', Punctuation), + (r'`[a-zA-Z_]\w*', Name.Constant), + + (words(( + 'accept_on', 'alias', 'always', 'always_comb', 'always_ff', 'always_latch', + 'and', 'assert', 'assign', 'assume', 'automatic', 'before', 'begin', 'bind', 'bins', + 'binsof', 'bit', 'break', 'buf', 'bufif0', 'bufif1', 'byte', 'case', 'casex', 'casez', + 'cell', 'chandle', 'checker', 'class', 'clocking', 'cmos', 'config', 'const', 'constraint', + 'context', 'continue', 'cover', 'covergroup', 'coverpoint', 'cross', 'deassign', + 'default', 'defparam', 'design', 'disable', 'dist', 'do', 'edge', 'else', 'end', 'endcase', + 'endchecker', 'endclass', 'endclocking', 'endconfig', 'endfunction', 'endgenerate', + 'endgroup', 'endinterface', 'endmodule', 'endpackage', 'endprimitive', + 'endprogram', 'endproperty', 'endsequence', 'endspecify', 'endtable', + 'endtask', 'enum', 'event', 'eventually', 'expect', 'export', 'extends', 'extern', + 'final', 'first_match', 'for', 'force', 'foreach', 'forever', 'fork', 'forkjoin', + 'function', 'generate', 'genvar', 'global', 'highz0', 'highz1', 'if', 'iff', 'ifnone', + 'ignore_bins', 'illegal_bins', 'implies', 'import', 'incdir', 'include', + 'initial', 'inout', 'input', 'inside', 'instance', 'int', 'integer', 'interface', + 'intersect', 'join', 'join_any', 'join_none', 'large', 'let', 'liblist', 'library', + 'local', 'localparam', 'logic', 'longint', 'macromodule', 'matches', 'medium', + 'modport', 'module', 'nand', 'negedge', 'new', 'nexttime', 'nmos', 'nor', 'noshowcancelled', + 'not', 'notif0', 'notif1', 'null', 'or', 'output', 'package', 'packed', 'parameter', + 'pmos', 'posedge', 'primitive', 'priority', 'program', 'property', 'protected', + 'pull0', 'pull1', 'pulldown', 'pullup', 'pulsestyle_ondetect', 'pulsestyle_onevent', + 'pure', 'rand', 'randc', 'randcase', 'randsequence', 'rcmos', 'real', 'realtime', + 'ref', 'reg', 'reject_on', 'release', 'repeat', 'restrict', 'return', 'rnmos', + 'rpmos', 'rtran', 'rtranif0', 'rtranif1', 's_always', 's_eventually', 's_nexttime', + 's_until', 's_until_with', 'scalared', 'sequence', 'shortint', 'shortreal', + 'showcancelled', 'signed', 'small', 'solve', 'specify', 'specparam', 'static', + 'string', 'strong', 'strong0', 'strong1', 'struct', 'super', 'supply0', 'supply1', + 'sync_accept_on', 'sync_reject_on', 'table', 'tagged', 'task', 'this', 'throughout', + 'time', 'timeprecision', 'timeunit', 'tran', 'tranif0', 'tranif1', 'tri', 'tri0', + 'tri1', 'triand', 'trior', 'trireg', 'type', 'typedef', 'union', 'unique', 'unique0', + 'unsigned', 'until', 'until_with', 'untyped', 'use', 'uwire', 'var', 'vectored', + 'virtual', 'void', 'wait', 'wait_order', 'wand', 'weak', 'weak0', 'weak1', 'while', + 'wildcard', 'wire', 'with', 'within', 'wor', 'xnor', 'xor'), suffix=r'\b'), + Keyword), + + (words(( + '`__FILE__', '`__LINE__', '`begin_keywords', '`celldefine', '`default_nettype', + '`define', '`else', '`elsif', '`end_keywords', '`endcelldefine', '`endif', + '`ifdef', '`ifndef', '`include', '`line', '`nounconnected_drive', '`pragma', + '`resetall', '`timescale', '`unconnected_drive', '`undef', '`undefineall'), + suffix=r'\b'), + Comment.Preproc), + + (words(( + '$display', '$displayb', '$displayh', '$displayo', '$dumpall', '$dumpfile', + '$dumpflush', '$dumplimit', '$dumpoff', '$dumpon', '$dumpports', + '$dumpportsall', '$dumpportsflush', '$dumpportslimit', '$dumpportsoff', + '$dumpportson', '$dumpvars', '$fclose', '$fdisplay', '$fdisplayb', + '$fdisplayh', '$fdisplayo', '$feof', '$ferror', '$fflush', '$fgetc', + '$fgets', '$finish', '$fmonitor', '$fmonitorb', '$fmonitorh', '$fmonitoro', + '$fopen', '$fread', '$fscanf', '$fseek', '$fstrobe', '$fstrobeb', '$fstrobeh', + '$fstrobeo', '$ftell', '$fwrite', '$fwriteb', '$fwriteh', '$fwriteo', + '$monitor', '$monitorb', '$monitorh', '$monitoro', '$monitoroff', + '$monitoron', '$plusargs', '$random', '$readmemb', '$readmemh', '$rewind', + '$sformat', '$sformatf', '$sscanf', '$strobe', '$strobeb', '$strobeh', '$strobeo', + '$swrite', '$swriteb', '$swriteh', '$swriteo', '$test', '$ungetc', + '$value$plusargs', '$write', '$writeb', '$writeh', '$writememb', + '$writememh', '$writeo'), suffix=r'\b'), + Name.Builtin), + + (r'(class)(\s+)', bygroups(Keyword, Text), 'classname'), + (words(( + 'byte', 'shortint', 'int', 'longint', 'integer', 'time', + 'bit', 'logic', 'reg', 'supply0', 'supply1', 'tri', 'triand', + 'trior', 'tri0', 'tri1', 'trireg', 'uwire', 'wire', 'wand', 'wo' + 'shortreal', 'real', 'realtime'), suffix=r'\b'), + Keyword.Type), + (r'[a-zA-Z_]\w*:(?!:)', Name.Label), + (r'\$?[a-zA-Z_]\w*', Name), + ], + 'classname': [ + (r'[a-zA-Z_]\w*', Name.Class, '#pop'), + ], + 'string': [ + (r'"', String, '#pop'), + (r'\\([\\abfnrtv"\']|x[a-fA-F0-9]{2,4}|[0-7]{1,3})', String.Escape), + (r'[^\\"\n]+', String), # all other characters + (r'\\\n', String), # line continuation + (r'\\', String), # stray backslash + ], + 'macro': [ + (r'[^/\n]+', Comment.Preproc), + (r'/[*](.|\n)*?[*]/', Comment.Multiline), + (r'//.*?\n', Comment.Single, '#pop'), + (r'/', Comment.Preproc), + (r'(?<=\\)\n', Comment.Preproc), + (r'\n', Comment.Preproc, '#pop'), + ], + 'import': [ + (r'[\w:]+\*?', Name.Namespace, '#pop') + ] + } + + def get_tokens_unprocessed(self, text): + for index, token, value in \ + RegexLexer.get_tokens_unprocessed(self, text): + # Convention: mark all upper case names as constants + if token is Name: + if value.isupper(): + token = Name.Constant + yield index, token, value + + +class VhdlLexer(RegexLexer): + """ + For VHDL source code. + + .. versionadded:: 1.5 + """ + name = 'vhdl' + aliases = ['vhdl'] + filenames = ['*.vhdl', '*.vhd'] + mimetypes = ['text/x-vhdl'] + flags = re.MULTILINE | re.IGNORECASE + + tokens = { + 'root': [ + (r'\n', Text), + (r'\s+', Text), + (r'\\\n', Text), # line continuation + (r'--.*?$', Comment.Single), + (r"'(U|X|0|1|Z|W|L|H|-)'", String.Char), + (r'[~!%^&*+=|?:<>/-]', Operator), + (r"'[a-z_]\w*", Name.Attribute), + (r'[()\[\],.;\']', Punctuation), + (r'"[^\n\\"]*"', String), + + (r'(library)(\s+)([a-z_]\w*)', + bygroups(Keyword, Text, Name.Namespace)), + (r'(use)(\s+)(entity)', bygroups(Keyword, Text, Keyword)), + (r'(use)(\s+)([a-z_][\w.]*\.)(all)', + bygroups(Keyword, Text, Name.Namespace, Keyword)), + (r'(use)(\s+)([a-z_][\w.]*)', + bygroups(Keyword, Text, Name.Namespace)), + (r'(std|ieee)(\.[a-z_]\w*)', + bygroups(Name.Namespace, Name.Namespace)), + (words(('std', 'ieee', 'work'), suffix=r'\b'), + Name.Namespace), + (r'(entity|component)(\s+)([a-z_]\w*)', + bygroups(Keyword, Text, Name.Class)), + (r'(architecture|configuration)(\s+)([a-z_]\w*)(\s+)' + r'(of)(\s+)([a-z_]\w*)(\s+)(is)', + bygroups(Keyword, Text, Name.Class, Text, Keyword, Text, + Name.Class, Text, Keyword)), + (r'([a-z_]\w*)(:)(\s+)(process|for)', + bygroups(Name.Class, Operator, Text, Keyword)), + (r'(end)(\s+)', bygroups(using(this), Text), 'endblock'), + + include('types'), + include('keywords'), + include('numbers'), + + (r'[a-z_]\w*', Name), + ], + 'endblock': [ + include('keywords'), + (r'[a-z_]\w*', Name.Class), + (r'(\s+)', Text), + (r';', Punctuation, '#pop'), + ], + 'types': [ + (words(( + 'boolean', 'bit', 'character', 'severity_level', 'integer', 'time', + 'delay_length', 'natural', 'positive', 'string', 'bit_vector', + 'file_open_kind', 'file_open_status', 'std_ulogic', 'std_ulogic_vector', + 'std_logic', 'std_logic_vector', 'signed', 'unsigned'), suffix=r'\b'), + Keyword.Type), + ], + 'keywords': [ + (words(( + 'abs', 'access', 'after', 'alias', 'all', 'and', + 'architecture', 'array', 'assert', 'attribute', 'begin', 'block', + 'body', 'buffer', 'bus', 'case', 'component', 'configuration', + 'constant', 'disconnect', 'downto', 'else', 'elsif', 'end', + 'entity', 'exit', 'file', 'for', 'function', 'generate', + 'generic', 'group', 'guarded', 'if', 'impure', 'in', + 'inertial', 'inout', 'is', 'label', 'library', 'linkage', + 'literal', 'loop', 'map', 'mod', 'nand', 'new', + 'next', 'nor', 'not', 'null', 'of', 'on', + 'open', 'or', 'others', 'out', 'package', 'port', + 'postponed', 'procedure', 'process', 'pure', 'range', 'record', + 'register', 'reject', 'rem', 'return', 'rol', 'ror', 'select', + 'severity', 'signal', 'shared', 'sla', 'sll', 'sra', + 'srl', 'subtype', 'then', 'to', 'transport', 'type', + 'units', 'until', 'use', 'variable', 'wait', 'when', + 'while', 'with', 'xnor', 'xor'), suffix=r'\b'), + Keyword), + ], + 'numbers': [ + (r'\d{1,2}#[0-9a-f_]+#?', Number.Integer), + (r'\d+', Number.Integer), + (r'(\d+\.\d*|\.\d+|\d+)E[+-]?\d+', Number.Float), + (r'X"[0-9a-f_]+"', Number.Hex), + (r'O"[0-7_]+"', Number.Oct), + (r'B"[01_]+"', Number.Bin), + ], + } diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/hexdump.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/hexdump.py new file mode 100644 index 0000000000000000000000000000000000000000..cba49be720eca200e6753b1fe023a5c8752942af --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/hexdump.py @@ -0,0 +1,103 @@ +# -*- coding: utf-8 -*- +""" + pygments.lexers.hexdump + ~~~~~~~~~~~~~~~~~~~~~~~ + + Lexers for hexadecimal dumps. + + :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS. + :license: BSD, see LICENSE for details. +""" + +from pygments.lexer import RegexLexer, bygroups, include +from pygments.token import Text, Name, Number, String, Punctuation + +__all__ = ['HexdumpLexer'] + + +class HexdumpLexer(RegexLexer): + """ + For typical hex dump output formats by the UNIX and GNU/Linux tools ``hexdump``, + ``hd``, ``hexcat``, ``od`` and ``xxd``, and the DOS tool ``DEBUG``. For example: + + .. sourcecode:: hexdump + + 00000000 7f 45 4c 46 02 01 01 00 00 00 00 00 00 00 00 00 |.ELF............| + 00000010 02 00 3e 00 01 00 00 00 c5 48 40 00 00 00 00 00 |..>......H@.....| + + The specific supported formats are the outputs of: + + * ``hexdump FILE`` + * ``hexdump -C FILE`` -- the `canonical` format used in the example. + * ``hd FILE`` -- same as ``hexdump -C FILE``. + * ``hexcat FILE`` + * ``od -t x1z FILE`` + * ``xxd FILE`` + * ``DEBUG.EXE FILE.COM`` and entering ``d`` to the prompt. + + .. versionadded:: 2.1 + """ + name = 'Hexdump' + aliases = ['hexdump'] + + hd = r'[0-9A-Ha-h]' + + tokens = { + 'root': [ + (r'\n', Text), + include('offset'), + (r'('+hd+r'{2})(\-)('+hd+r'{2})', + bygroups(Number.Hex, Punctuation, Number.Hex)), + (hd+r'{2}', Number.Hex), + (r'(\s{2,3})(\>)(.{16})(\<)$', + bygroups(Text, Punctuation, String, Punctuation), 'bracket-strings'), + (r'(\s{2,3})(\|)(.{16})(\|)$', + bygroups(Text, Punctuation, String, Punctuation), 'piped-strings'), + (r'(\s{2,3})(\>)(.{1,15})(\<)$', + bygroups(Text, Punctuation, String, Punctuation)), + (r'(\s{2,3})(\|)(.{1,15})(\|)$', + bygroups(Text, Punctuation, String, Punctuation)), + (r'(\s{2,3})(.{1,15})$', bygroups(Text, String)), + (r'(\s{2,3})(.{16}|.{20})$', bygroups(Text, String), 'nonpiped-strings'), + (r'\s', Text), + (r'^\*', Punctuation), + ], + 'offset': [ + (r'^('+hd+'+)(:)', bygroups(Name.Label, Punctuation), 'offset-mode'), + (r'^'+hd+'+', Name.Label), + ], + 'offset-mode': [ + (r'\s', Text, '#pop'), + (hd+'+', Name.Label), + (r':', Punctuation) + ], + 'piped-strings': [ + (r'\n', Text), + include('offset'), + (hd+r'{2}', Number.Hex), + (r'(\s{2,3})(\|)(.{1,16})(\|)$', + bygroups(Text, Punctuation, String, Punctuation)), + (r'\s', Text), + (r'^\*', Punctuation), + ], + 'bracket-strings': [ + (r'\n', Text), + include('offset'), + (hd+r'{2}', Number.Hex), + (r'(\s{2,3})(\>)(.{1,16})(\<)$', + bygroups(Text, Punctuation, String, Punctuation)), + (r'\s', Text), + (r'^\*', Punctuation), + ], + 'nonpiped-strings': [ + (r'\n', Text), + include('offset'), + (r'('+hd+r'{2})(\-)('+hd+r'{2})', + bygroups(Number.Hex, Punctuation, Number.Hex)), + (hd+r'{2}', Number.Hex), + (r'(\s{19,})(.{1,20}?)$', bygroups(Text, String)), + (r'(\s{2,3})(.{1,20})$', bygroups(Text, String)), + (r'\s', Text), + (r'^\*', Punctuation), + ], + } diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/html.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/html.py new file mode 100644 index 0000000000000000000000000000000000000000..73f020fa825d2c80441c3958ea3936873007a1e1 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/html.py @@ -0,0 +1,602 @@ +# -*- coding: utf-8 -*- +""" + pygments.lexers.html + ~~~~~~~~~~~~~~~~~~~~ + + Lexers for HTML, XML and related markup. + + :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS. + :license: BSD, see LICENSE for details. +""" + +import re + +from pygments.lexer import RegexLexer, ExtendedRegexLexer, include, bygroups, \ + default, using +from pygments.token import Text, Comment, Operator, Keyword, Name, String, \ + Punctuation +from pygments.util import looks_like_xml, html_doctype_matches + +from pygments.lexers.javascript import JavascriptLexer +from pygments.lexers.jvm import ScalaLexer +from pygments.lexers.css import CssLexer, _indentation, _starts_block +from pygments.lexers.ruby import RubyLexer + +__all__ = ['HtmlLexer', 'DtdLexer', 'XmlLexer', 'XsltLexer', 'HamlLexer', + 'ScamlLexer', 'PugLexer'] + + +class HtmlLexer(RegexLexer): + """ + For HTML 4 and XHTML 1 markup. Nested JavaScript and CSS is highlighted + by the appropriate lexer. + """ + + name = 'HTML' + aliases = ['html'] + filenames = ['*.html', '*.htm', '*.xhtml', '*.xslt'] + mimetypes = ['text/html', 'application/xhtml+xml'] + + flags = re.IGNORECASE | re.DOTALL + tokens = { + 'root': [ + ('[^<&]+', Text), + (r'&\S*?;', Name.Entity), + (r'\<\!\[CDATA\[.*?\]\]\>', Comment.Preproc), + ('', Comment, '#pop'), + ('-', Comment), + ], + 'tag': [ + (r'\s+', Text), + (r'([\w:-]+\s*)(=)(\s*)', bygroups(Name.Attribute, Operator, Text), + 'attr'), + (r'[\w:-]+', Name.Attribute), + (r'(/?)(\s*)(>)', bygroups(Punctuation, Text, Punctuation), '#pop'), + ], + 'script-content': [ + (r'(<)(\s*)(/)(\s*)(script)(\s*)(>)', + bygroups(Punctuation, Text, Punctuation, Text, Name.Tag, Text, + Punctuation), '#pop'), + (r'.+?(?=<\s*/\s*script\s*>)', using(JavascriptLexer)), + ], + 'style-content': [ + (r'(<)(\s*)(/)(\s*)(style)(\s*)(>)', + bygroups(Punctuation, Text, Punctuation, Text, Name.Tag, Text, + Punctuation),'#pop'), + (r'.+?(?=<\s*/\s*style\s*>)', using(CssLexer)), + ], + 'attr': [ + ('".*?"', String, '#pop'), + ("'.*?'", String, '#pop'), + (r'[^\s>]+', String, '#pop'), + ], + } + + def analyse_text(text): + if html_doctype_matches(text): + return 0.5 + + +class DtdLexer(RegexLexer): + """ + A lexer for DTDs (Document Type Definitions). + + .. versionadded:: 1.5 + """ + + flags = re.MULTILINE | re.DOTALL + + name = 'DTD' + aliases = ['dtd'] + filenames = ['*.dtd'] + mimetypes = ['application/xml-dtd'] + + tokens = { + 'root': [ + include('common'), + + (r'(\s]+)', + bygroups(Keyword, Text, Name.Tag)), + (r'PUBLIC|SYSTEM', Keyword.Constant), + (r'[\[\]>]', Keyword), + ], + + 'common': [ + (r'\s+', Text), + (r'(%|&)[^;]*;', Name.Entity), + ('', Comment, '#pop'), + ('-', Comment), + ], + + 'element': [ + include('common'), + (r'EMPTY|ANY|#PCDATA', Keyword.Constant), + (r'[^>\s|()?+*,]+', Name.Tag), + (r'>', Keyword, '#pop'), + ], + + 'attlist': [ + include('common'), + (r'CDATA|IDREFS|IDREF|ID|NMTOKENS|NMTOKEN|ENTITIES|ENTITY|NOTATION', + Keyword.Constant), + (r'#REQUIRED|#IMPLIED|#FIXED', Keyword.Constant), + (r'xml:space|xml:lang', Keyword.Reserved), + (r'[^>\s|()?+*,]+', Name.Attribute), + (r'>', Keyword, '#pop'), + ], + + 'entity': [ + include('common'), + (r'SYSTEM|PUBLIC|NDATA', Keyword.Constant), + (r'[^>\s|()?+*,]+', Name.Entity), + (r'>', Keyword, '#pop'), + ], + + 'notation': [ + include('common'), + (r'SYSTEM|PUBLIC', Keyword.Constant), + (r'[^>\s|()?+*,]+', Name.Attribute), + (r'>', Keyword, '#pop'), + ], + } + + def analyse_text(text): + if not looks_like_xml(text) and \ + ('', Comment.Preproc), + ('', Comment, '#pop'), + ('-', Comment), + ], + 'tag': [ + (r'\s+', Text), + (r'[\w.:-]+\s*=', Name.Attribute, 'attr'), + (r'/?\s*>', Name.Tag, '#pop'), + ], + 'attr': [ + ('\s+', Text), + ('".*?"', String, '#pop'), + ("'.*?'", String, '#pop'), + (r'[^\s>]+', String, '#pop'), + ], + } + + def analyse_text(text): + if looks_like_xml(text): + return 0.45 # less than HTML + + +class XsltLexer(XmlLexer): + """ + A lexer for XSLT. + + .. versionadded:: 0.10 + """ + + name = 'XSLT' + aliases = ['xslt'] + filenames = ['*.xsl', '*.xslt', '*.xpl'] # xpl is XProc + mimetypes = ['application/xsl+xml', 'application/xslt+xml'] + + EXTRA_KEYWORDS = set(( + 'apply-imports', 'apply-templates', 'attribute', + 'attribute-set', 'call-template', 'choose', 'comment', + 'copy', 'copy-of', 'decimal-format', 'element', 'fallback', + 'for-each', 'if', 'import', 'include', 'key', 'message', + 'namespace-alias', 'number', 'otherwise', 'output', 'param', + 'preserve-space', 'processing-instruction', 'sort', + 'strip-space', 'stylesheet', 'template', 'text', 'transform', + 'value-of', 'variable', 'when', 'with-param' + )) + + def get_tokens_unprocessed(self, text): + for index, token, value in XmlLexer.get_tokens_unprocessed(self, text): + m = re.match(']*)/?>?', value) + + if token is Name.Tag and m and m.group(1) in self.EXTRA_KEYWORDS: + yield index, Keyword, value + else: + yield index, token, value + + def analyse_text(text): + if looks_like_xml(text) and ']{1,2}(?=[ \t=])', Punctuation), + include('eval-or-plain'), + ], + + 'plain': [ + (r'([^#\n]|#[^{\n]|(\\\\)*\\#\{)+', Text), + (r'(#\{)(' + _dot + '*?)(\})', + bygroups(String.Interpol, using(RubyLexer), String.Interpol)), + (r'\n', Text, 'root'), + ], + + 'html-attributes': [ + (r'\s+', Text), + (r'[\w:-]+[ \t]*=', Name.Attribute, 'html-attribute-value'), + (r'[\w:-]+', Name.Attribute), + (r'\)', Text, '#pop'), + ], + + 'html-attribute-value': [ + (r'[ \t]+', Text), + (r'\w+', Name.Variable, '#pop'), + (r'@\w+', Name.Variable.Instance, '#pop'), + (r'\$\w+', Name.Variable.Global, '#pop'), + (r"'(\\\\|\\'|[^'\n])*'", String, '#pop'), + (r'"(\\\\|\\"|[^"\n])*"', String, '#pop'), + ], + + 'html-comment-block': [ + (_dot + '+', Comment), + (r'\n', Text, 'root'), + ], + + 'haml-comment-block': [ + (_dot + '+', Comment.Preproc), + (r'\n', Text, 'root'), + ], + + 'filter-block': [ + (r'([^#\n]|#[^{\n]|(\\\\)*\\#\{)+', Name.Decorator), + (r'(#\{)(' + _dot + '*?)(\})', + bygroups(String.Interpol, using(RubyLexer), String.Interpol)), + (r'\n', Text, 'root'), + ], + } + + +class ScamlLexer(ExtendedRegexLexer): + """ + For `Scaml markup `_. Scaml is Haml for Scala. + + .. versionadded:: 1.4 + """ + + name = 'Scaml' + aliases = ['scaml'] + filenames = ['*.scaml'] + mimetypes = ['text/x-scaml'] + + flags = re.IGNORECASE + # Scaml does not yet support the " |\n" notation to + # wrap long lines. Once it does, use the custom faux + # dot instead. + # _dot = r'(?: \|\n(?=.* \|)|.)' + _dot = r'.' + + tokens = { + 'root': [ + (r'[ \t]*\n', Text), + (r'[ \t]*', _indentation), + ], + + 'css': [ + (r'\.[\w:-]+', Name.Class, 'tag'), + (r'\#[\w:-]+', Name.Function, 'tag'), + ], + + 'eval-or-plain': [ + (r'[&!]?==', Punctuation, 'plain'), + (r'([&!]?[=~])(' + _dot + r'*\n)', + bygroups(Punctuation, using(ScalaLexer)), + 'root'), + default('plain'), + ], + + 'content': [ + include('css'), + (r'%[\w:-]+', Name.Tag, 'tag'), + (r'!!!' + _dot + r'*\n', Name.Namespace, '#pop'), + (r'(/)(\[' + _dot + '*?\])(' + _dot + r'*\n)', + bygroups(Comment, Comment.Special, Comment), + '#pop'), + (r'/' + _dot + r'*\n', _starts_block(Comment, 'html-comment-block'), + '#pop'), + (r'-#' + _dot + r'*\n', _starts_block(Comment.Preproc, + 'scaml-comment-block'), '#pop'), + (r'(-@\s*)(import)?(' + _dot + r'*\n)', + bygroups(Punctuation, Keyword, using(ScalaLexer)), + '#pop'), + (r'(-)(' + _dot + r'*\n)', + bygroups(Punctuation, using(ScalaLexer)), + '#pop'), + (r':' + _dot + r'*\n', _starts_block(Name.Decorator, 'filter-block'), + '#pop'), + include('eval-or-plain'), + ], + + 'tag': [ + include('css'), + (r'\{(,\n|' + _dot + ')*?\}', using(ScalaLexer)), + (r'\[' + _dot + '*?\]', using(ScalaLexer)), + (r'\(', Text, 'html-attributes'), + (r'/[ \t]*\n', Punctuation, '#pop:2'), + (r'[<>]{1,2}(?=[ \t=])', Punctuation), + include('eval-or-plain'), + ], + + 'plain': [ + (r'([^#\n]|#[^{\n]|(\\\\)*\\#\{)+', Text), + (r'(#\{)(' + _dot + '*?)(\})', + bygroups(String.Interpol, using(ScalaLexer), String.Interpol)), + (r'\n', Text, 'root'), + ], + + 'html-attributes': [ + (r'\s+', Text), + (r'[\w:-]+[ \t]*=', Name.Attribute, 'html-attribute-value'), + (r'[\w:-]+', Name.Attribute), + (r'\)', Text, '#pop'), + ], + + 'html-attribute-value': [ + (r'[ \t]+', Text), + (r'\w+', Name.Variable, '#pop'), + (r'@\w+', Name.Variable.Instance, '#pop'), + (r'\$\w+', Name.Variable.Global, '#pop'), + (r"'(\\\\|\\'|[^'\n])*'", String, '#pop'), + (r'"(\\\\|\\"|[^"\n])*"', String, '#pop'), + ], + + 'html-comment-block': [ + (_dot + '+', Comment), + (r'\n', Text, 'root'), + ], + + 'scaml-comment-block': [ + (_dot + '+', Comment.Preproc), + (r'\n', Text, 'root'), + ], + + 'filter-block': [ + (r'([^#\n]|#[^{\n]|(\\\\)*\\#\{)+', Name.Decorator), + (r'(#\{)(' + _dot + '*?)(\})', + bygroups(String.Interpol, using(ScalaLexer), String.Interpol)), + (r'\n', Text, 'root'), + ], + } + + +class PugLexer(ExtendedRegexLexer): + """ + For Pug markup. + Pug is a variant of Scaml, see: + http://scalate.fusesource.org/documentation/scaml-reference.html + + .. versionadded:: 1.4 + """ + + name = 'Pug' + aliases = ['pug', 'jade'] + filenames = ['*.pug', '*.jade'] + mimetypes = ['text/x-pug', 'text/x-jade'] + + flags = re.IGNORECASE + _dot = r'.' + + tokens = { + 'root': [ + (r'[ \t]*\n', Text), + (r'[ \t]*', _indentation), + ], + + 'css': [ + (r'\.[\w:-]+', Name.Class, 'tag'), + (r'\#[\w:-]+', Name.Function, 'tag'), + ], + + 'eval-or-plain': [ + (r'[&!]?==', Punctuation, 'plain'), + (r'([&!]?[=~])(' + _dot + r'*\n)', + bygroups(Punctuation, using(ScalaLexer)), 'root'), + default('plain'), + ], + + 'content': [ + include('css'), + (r'!!!' + _dot + r'*\n', Name.Namespace, '#pop'), + (r'(/)(\[' + _dot + '*?\])(' + _dot + r'*\n)', + bygroups(Comment, Comment.Special, Comment), + '#pop'), + (r'/' + _dot + r'*\n', _starts_block(Comment, 'html-comment-block'), + '#pop'), + (r'-#' + _dot + r'*\n', _starts_block(Comment.Preproc, + 'scaml-comment-block'), '#pop'), + (r'(-@\s*)(import)?(' + _dot + r'*\n)', + bygroups(Punctuation, Keyword, using(ScalaLexer)), + '#pop'), + (r'(-)(' + _dot + r'*\n)', + bygroups(Punctuation, using(ScalaLexer)), + '#pop'), + (r':' + _dot + r'*\n', _starts_block(Name.Decorator, 'filter-block'), + '#pop'), + (r'[\w:-]+', Name.Tag, 'tag'), + (r'\|', Text, 'eval-or-plain'), + ], + + 'tag': [ + include('css'), + (r'\{(,\n|' + _dot + ')*?\}', using(ScalaLexer)), + (r'\[' + _dot + '*?\]', using(ScalaLexer)), + (r'\(', Text, 'html-attributes'), + (r'/[ \t]*\n', Punctuation, '#pop:2'), + (r'[<>]{1,2}(?=[ \t=])', Punctuation), + include('eval-or-plain'), + ], + + 'plain': [ + (r'([^#\n]|#[^{\n]|(\\\\)*\\#\{)+', Text), + (r'(#\{)(' + _dot + '*?)(\})', + bygroups(String.Interpol, using(ScalaLexer), String.Interpol)), + (r'\n', Text, 'root'), + ], + + 'html-attributes': [ + (r'\s+', Text), + (r'[\w:-]+[ \t]*=', Name.Attribute, 'html-attribute-value'), + (r'[\w:-]+', Name.Attribute), + (r'\)', Text, '#pop'), + ], + + 'html-attribute-value': [ + (r'[ \t]+', Text), + (r'\w+', Name.Variable, '#pop'), + (r'@\w+', Name.Variable.Instance, '#pop'), + (r'\$\w+', Name.Variable.Global, '#pop'), + (r"'(\\\\|\\'|[^'\n])*'", String, '#pop'), + (r'"(\\\\|\\"|[^"\n])*"', String, '#pop'), + ], + + 'html-comment-block': [ + (_dot + '+', Comment), + (r'\n', Text, 'root'), + ], + + 'scaml-comment-block': [ + (_dot + '+', Comment.Preproc), + (r'\n', Text, 'root'), + ], + + 'filter-block': [ + (r'([^#\n]|#[^{\n]|(\\\\)*\\#\{)+', Name.Decorator), + (r'(#\{)(' + _dot + '*?)(\})', + bygroups(String.Interpol, using(ScalaLexer), String.Interpol)), + (r'\n', Text, 'root'), + ], + } +JadeLexer = PugLexer # compat diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/idl.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/idl.py new file mode 100644 index 0000000000000000000000000000000000000000..990789702799df1a66dc7f854df55b0fbc4b78b2 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/idl.py @@ -0,0 +1,270 @@ +# -*- coding: utf-8 -*- +""" + pygments.lexers.idl + ~~~~~~~~~~~~~~~~~~~ + + Lexers for IDL. + + :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS. + :license: BSD, see LICENSE for details. +""" + +import re + +from pygments.lexer import RegexLexer, words +from pygments.token import Text, Comment, Operator, Keyword, Name, Number, String + +__all__ = ['IDLLexer'] + + +class IDLLexer(RegexLexer): + """ + Pygments Lexer for IDL (Interactive Data Language). + + .. versionadded:: 1.6 + """ + name = 'IDL' + aliases = ['idl'] + filenames = ['*.pro'] + mimetypes = ['text/idl'] + + flags = re.IGNORECASE | re.MULTILINE + + _RESERVED = ( + 'and', 'begin', 'break', 'case', 'common', 'compile_opt', + 'continue', 'do', 'else', 'end', 'endcase', 'elseelse', + 'endfor', 'endforeach', 'endif', 'endrep', 'endswitch', + 'endwhile', 'eq', 'for', 'foreach', 'forward_function', + 'function', 'ge', 'goto', 'gt', 'if', 'inherits', 'le', + 'lt', 'mod', 'ne', 'not', 'of', 'on_ioerror', 'or', 'pro', + 'repeat', 'switch', 'then', 'until', 'while', 'xor') + """Reserved words from: http://www.exelisvis.com/docs/reswords.html""" + + _BUILTIN_LIB = ( + 'abs', 'acos', 'adapt_hist_equal', 'alog', 'alog10', + 'amoeba', 'annotate', 'app_user_dir', 'app_user_dir_query', + 'arg_present', 'array_equal', 'array_indices', 'arrow', + 'ascii_template', 'asin', 'assoc', 'atan', 'axis', + 'a_correlate', 'bandpass_filter', 'bandreject_filter', + 'barplot', 'bar_plot', 'beseli', 'beselj', 'beselk', + 'besely', 'beta', 'bilinear', 'binary_template', 'bindgen', + 'binomial', 'bin_date', 'bit_ffs', 'bit_population', + 'blas_axpy', 'blk_con', 'box_cursor', 'breakpoint', + 'broyden', 'butterworth', 'bytarr', 'byte', 'byteorder', + 'bytscl', 'caldat', 'calendar', 'call_external', + 'call_function', 'call_method', 'call_procedure', 'canny', + 'catch', 'cd', 'cdf_\w*', 'ceil', 'chebyshev', + 'check_math', + 'chisqr_cvf', 'chisqr_pdf', 'choldc', 'cholsol', 'cindgen', + 'cir_3pnt', 'close', 'cluster', 'cluster_tree', 'clust_wts', + 'cmyk_convert', 'colorbar', 'colorize_sample', + 'colormap_applicable', 'colormap_gradient', + 'colormap_rotation', 'colortable', 'color_convert', + 'color_exchange', 'color_quan', 'color_range_map', 'comfit', + 'command_line_args', 'complex', 'complexarr', 'complexround', + 'compute_mesh_normals', 'cond', 'congrid', 'conj', + 'constrained_min', 'contour', 'convert_coord', 'convol', + 'convol_fft', 'coord2to3', 'copy_lun', 'correlate', 'cos', + 'cosh', 'cpu', 'cramer', 'create_cursor', 'create_struct', + 'create_view', 'crossp', 'crvlength', 'cti_test', + 'ct_luminance', 'cursor', 'curvefit', 'cvttobm', 'cv_coord', + 'cw_animate', 'cw_animate_getp', 'cw_animate_load', + 'cw_animate_run', 'cw_arcball', 'cw_bgroup', 'cw_clr_index', + 'cw_colorsel', 'cw_defroi', 'cw_field', 'cw_filesel', + 'cw_form', 'cw_fslider', 'cw_light_editor', + 'cw_light_editor_get', 'cw_light_editor_set', 'cw_orient', + 'cw_palette_editor', 'cw_palette_editor_get', + 'cw_palette_editor_set', 'cw_pdmenu', 'cw_rgbslider', + 'cw_tmpl', 'cw_zoom', 'c_correlate', 'dblarr', 'db_exists', + 'dcindgen', 'dcomplex', 'dcomplexarr', 'define_key', + 'define_msgblk', 'define_msgblk_from_file', 'defroi', + 'defsysv', 'delvar', 'dendrogram', 'dendro_plot', 'deriv', + 'derivsig', 'determ', 'device', 'dfpmin', 'diag_matrix', + 'dialog_dbconnect', 'dialog_message', 'dialog_pickfile', + 'dialog_printersetup', 'dialog_printjob', + 'dialog_read_image', 'dialog_write_image', 'digital_filter', + 'dilate', 'dindgen', 'dissolve', 'dist', 'distance_measure', + 'dlm_load', 'dlm_register', 'doc_library', 'double', + 'draw_roi', 'edge_dog', 'efont', 'eigenql', 'eigenvec', + 'ellipse', 'elmhes', 'emboss', 'empty', 'enable_sysrtn', + 'eof', 'eos_\w*', 'erase', 'erf', 'erfc', 'erfcx', + 'erode', 'errorplot', 'errplot', 'estimator_filter', + 'execute', 'exit', 'exp', 'expand', 'expand_path', 'expint', + 'extrac', 'extract_slice', 'factorial', 'fft', 'filepath', + 'file_basename', 'file_chmod', 'file_copy', 'file_delete', + 'file_dirname', 'file_expand_path', 'file_info', + 'file_lines', 'file_link', 'file_mkdir', 'file_move', + 'file_poll_input', 'file_readlink', 'file_same', + 'file_search', 'file_test', 'file_which', 'findgen', + 'finite', 'fix', 'flick', 'float', 'floor', 'flow3', + 'fltarr', 'flush', 'format_axis_values', 'free_lun', + 'fstat', 'fulstr', 'funct', 'fv_test', 'fx_root', + 'fz_roots', 'f_cvf', 'f_pdf', 'gamma', 'gamma_ct', + 'gauss2dfit', 'gaussfit', 'gaussian_function', 'gaussint', + 'gauss_cvf', 'gauss_pdf', 'gauss_smooth', 'getenv', + 'getwindows', 'get_drive_list', 'get_dxf_objects', + 'get_kbrd', 'get_login_info', 'get_lun', 'get_screen_size', + 'greg2jul', 'grib_\w*', 'grid3', 'griddata', + 'grid_input', 'grid_tps', 'gs_iter', + 'h5[adfgirst]_\w*', 'h5_browser', 'h5_close', + 'h5_create', 'h5_get_libversion', 'h5_open', 'h5_parse', + 'hanning', 'hash', 'hdf_\w*', 'heap_free', + 'heap_gc', 'heap_nosave', 'heap_refcount', 'heap_save', + 'help', 'hilbert', 'histogram', 'hist_2d', 'hist_equal', + 'hls', 'hough', 'hqr', 'hsv', 'h_eq_ct', 'h_eq_int', + 'i18n_multibytetoutf8', 'i18n_multibytetowidechar', + 'i18n_utf8tomultibyte', 'i18n_widechartomultibyte', + 'ibeta', 'icontour', 'iconvertcoord', 'idelete', 'identity', + 'idlexbr_assistant', 'idlitsys_createtool', 'idl_base64', + 'idl_validname', 'iellipse', 'igamma', 'igetcurrent', + 'igetdata', 'igetid', 'igetproperty', 'iimage', 'image', + 'image_cont', 'image_statistics', 'imaginary', 'imap', + 'indgen', 'intarr', 'interpol', 'interpolate', + 'interval_volume', 'int_2d', 'int_3d', 'int_tabulated', + 'invert', 'ioctl', 'iopen', 'iplot', 'ipolygon', + 'ipolyline', 'iputdata', 'iregister', 'ireset', 'iresolve', + 'irotate', 'ir_filter', 'isa', 'isave', 'iscale', + 'isetcurrent', 'isetproperty', 'ishft', 'isocontour', + 'isosurface', 'isurface', 'itext', 'itranslate', 'ivector', + 'ivolume', 'izoom', 'i_beta', 'journal', 'json_parse', + 'json_serialize', 'jul2greg', 'julday', 'keyword_set', + 'krig2d', 'kurtosis', 'kw_test', 'l64indgen', 'label_date', + 'label_region', 'ladfit', 'laguerre', 'laplacian', + 'la_choldc', 'la_cholmprove', 'la_cholsol', 'la_determ', + 'la_eigenproblem', 'la_eigenql', 'la_eigenvec', 'la_elmhes', + 'la_gm_linear_model', 'la_hqr', 'la_invert', + 'la_least_squares', 'la_least_square_equality', + 'la_linear_equation', 'la_ludc', 'la_lumprove', 'la_lusol', + 'la_svd', 'la_tridc', 'la_trimprove', 'la_triql', + 'la_trired', 'la_trisol', 'least_squares_filter', 'leefilt', + 'legend', 'legendre', 'linbcg', 'lindgen', 'linfit', + 'linkimage', 'list', 'll_arc_distance', 'lmfit', 'lmgr', + 'lngamma', 'lnp_test', 'loadct', 'locale_get', + 'logical_and', 'logical_or', 'logical_true', 'lon64arr', + 'lonarr', 'long', 'long64', 'lsode', 'ludc', 'lumprove', + 'lusol', 'lu_complex', 'machar', 'make_array', 'make_dll', + 'make_rt', 'map', 'mapcontinents', 'mapgrid', 'map_2points', + 'map_continents', 'map_grid', 'map_image', 'map_patch', + 'map_proj_forward', 'map_proj_image', 'map_proj_info', + 'map_proj_init', 'map_proj_inverse', 'map_set', + 'matrix_multiply', 'matrix_power', 'max', 'md_test', + 'mean', 'meanabsdev', 'mean_filter', 'median', 'memory', + 'mesh_clip', 'mesh_decimate', 'mesh_issolid', 'mesh_merge', + 'mesh_numtriangles', 'mesh_obj', 'mesh_smooth', + 'mesh_surfacearea', 'mesh_validate', 'mesh_volume', + 'message', 'min', 'min_curve_surf', 'mk_html_help', + 'modifyct', 'moment', 'morph_close', 'morph_distance', + 'morph_gradient', 'morph_hitormiss', 'morph_open', + 'morph_thin', 'morph_tophat', 'multi', 'm_correlate', + 'ncdf_\w*', 'newton', 'noise_hurl', 'noise_pick', + 'noise_scatter', 'noise_slur', 'norm', 'n_elements', + 'n_params', 'n_tags', 'objarr', 'obj_class', 'obj_destroy', + 'obj_hasmethod', 'obj_isa', 'obj_new', 'obj_valid', + 'online_help', 'on_error', 'open', 'oplot', 'oploterr', + 'parse_url', 'particle_trace', 'path_cache', 'path_sep', + 'pcomp', 'plot', 'plot3d', 'ploterr', 'plots', 'plot_3dbox', + 'plot_field', 'pnt_line', 'point_lun', 'polarplot', + 'polar_contour', 'polar_surface', 'poly', 'polyfill', + 'polyfillv', 'polygon', 'polyline', 'polyshade', 'polywarp', + 'poly_2d', 'poly_area', 'poly_fit', 'popd', 'powell', + 'pref_commit', 'pref_get', 'pref_set', 'prewitt', 'primes', + 'print', 'printd', 'product', 'profile', 'profiler', + 'profiles', 'project_vol', 'psafm', 'pseudo', + 'ps_show_fonts', 'ptrarr', 'ptr_free', 'ptr_new', + 'ptr_valid', 'pushd', 'p_correlate', 'qgrid3', 'qhull', + 'qromb', 'qromo', 'qsimp', 'query_ascii', 'query_bmp', + 'query_csv', 'query_dicom', 'query_gif', 'query_image', + 'query_jpeg', 'query_jpeg2000', 'query_mrsid', 'query_pict', + 'query_png', 'query_ppm', 'query_srf', 'query_tiff', + 'query_wav', 'radon', 'randomn', 'randomu', 'ranks', + 'rdpix', 'read', 'reads', 'readu', 'read_ascii', + 'read_binary', 'read_bmp', 'read_csv', 'read_dicom', + 'read_gif', 'read_image', 'read_interfile', 'read_jpeg', + 'read_jpeg2000', 'read_mrsid', 'read_pict', 'read_png', + 'read_ppm', 'read_spr', 'read_srf', 'read_sylk', + 'read_tiff', 'read_wav', 'read_wave', 'read_x11_bitmap', + 'read_xwd', 'real_part', 'rebin', 'recall_commands', + 'recon3', 'reduce_colors', 'reform', 'region_grow', + 'register_cursor', 'regress', 'replicate', + 'replicate_inplace', 'resolve_all', 'resolve_routine', + 'restore', 'retall', 'return', 'reverse', 'rk4', 'roberts', + 'rot', 'rotate', 'round', 'routine_filepath', + 'routine_info', 'rs_test', 'r_correlate', 'r_test', + 'save', 'savgol', 'scale3', 'scale3d', 'scope_level', + 'scope_traceback', 'scope_varfetch', 'scope_varname', + 'search2d', 'search3d', 'sem_create', 'sem_delete', + 'sem_lock', 'sem_release', 'setenv', 'set_plot', + 'set_shading', 'sfit', 'shade_surf', 'shade_surf_irr', + 'shade_volume', 'shift', 'shift_diff', 'shmdebug', 'shmmap', + 'shmunmap', 'shmvar', 'show3', 'showfont', 'simplex', 'sin', + 'sindgen', 'sinh', 'size', 'skewness', 'skip_lun', + 'slicer3', 'slide_image', 'smooth', 'sobel', 'socket', + 'sort', 'spawn', 'spher_harm', 'sph_4pnt', 'sph_scat', + 'spline', 'spline_p', 'spl_init', 'spl_interp', 'sprsab', + 'sprsax', 'sprsin', 'sprstp', 'sqrt', 'standardize', + 'stddev', 'stop', 'strarr', 'strcmp', 'strcompress', + 'streamline', 'stregex', 'stretch', 'string', 'strjoin', + 'strlen', 'strlowcase', 'strmatch', 'strmessage', 'strmid', + 'strpos', 'strput', 'strsplit', 'strtrim', 'struct_assign', + 'struct_hide', 'strupcase', 'surface', 'surfr', 'svdc', + 'svdfit', 'svsol', 'swap_endian', 'swap_endian_inplace', + 'symbol', 'systime', 's_test', 't3d', 'tag_names', 'tan', + 'tanh', 'tek_color', 'temporary', 'tetra_clip', + 'tetra_surface', 'tetra_volume', 'text', 'thin', 'threed', + 'timegen', 'time_test2', 'tm_test', 'total', 'trace', + 'transpose', 'triangulate', 'trigrid', 'triql', 'trired', + 'trisol', 'tri_surf', 'truncate_lun', 'ts_coef', 'ts_diff', + 'ts_fcast', 'ts_smooth', 'tv', 'tvcrs', 'tvlct', 'tvrd', + 'tvscl', 'typename', 't_cvt', 't_pdf', 'uindgen', 'uint', + 'uintarr', 'ul64indgen', 'ulindgen', 'ulon64arr', 'ulonarr', + 'ulong', 'ulong64', 'uniq', 'unsharp_mask', 'usersym', + 'value_locate', 'variance', 'vector', 'vector_field', 'vel', + 'velovect', 'vert_t3d', 'voigt', 'voronoi', 'voxel_proj', + 'wait', 'warp_tri', 'watershed', 'wdelete', 'wf_draw', + 'where', 'widget_base', 'widget_button', 'widget_combobox', + 'widget_control', 'widget_displaycontextmen', 'widget_draw', + 'widget_droplist', 'widget_event', 'widget_info', + 'widget_label', 'widget_list', 'widget_propertysheet', + 'widget_slider', 'widget_tab', 'widget_table', + 'widget_text', 'widget_tree', 'widget_tree_move', + 'widget_window', 'wiener_filter', 'window', 'writeu', + 'write_bmp', 'write_csv', 'write_gif', 'write_image', + 'write_jpeg', 'write_jpeg2000', 'write_nrif', 'write_pict', + 'write_png', 'write_ppm', 'write_spr', 'write_srf', + 'write_sylk', 'write_tiff', 'write_wav', 'write_wave', + 'wset', 'wshow', 'wtn', 'wv_applet', 'wv_cwt', + 'wv_cw_wavelet', 'wv_denoise', 'wv_dwt', 'wv_fn_coiflet', + 'wv_fn_daubechies', 'wv_fn_gaussian', 'wv_fn_haar', + 'wv_fn_morlet', 'wv_fn_paul', 'wv_fn_symlet', + 'wv_import_data', 'wv_import_wavelet', 'wv_plot3d_wps', + 'wv_plot_multires', 'wv_pwt', 'wv_tool_denoise', + 'xbm_edit', 'xdisplayfile', 'xdxf', 'xfont', + 'xinteranimate', 'xloadct', 'xmanager', 'xmng_tmpl', + 'xmtool', 'xobjview', 'xobjview_rotate', + 'xobjview_write_image', 'xpalette', 'xpcolor', 'xplot3d', + 'xregistered', 'xroi', 'xsq_test', 'xsurface', 'xvaredit', + 'xvolume', 'xvolume_rotate', 'xvolume_write_image', + 'xyouts', 'zoom', 'zoom_24') + """Functions from: http://www.exelisvis.com/docs/routines-1.html""" + + tokens = { + 'root': [ + (r'^\s*;.*?\n', Comment.Singleline), + (words(_RESERVED, prefix=r'\b', suffix=r'\b'), Keyword), + (words(_BUILTIN_LIB, prefix=r'\b', suffix=r'\b'), Name.Builtin), + (r'\+=|-=|\^=|\*=|/=|#=|##=|<=|>=|=', Operator), + (r'\+\+|--|->|\+|-|##|#|\*|/|<|>|&&|\^|~|\|\|\?|:', Operator), + (r'\b(mod=|lt=|le=|eq=|ne=|ge=|gt=|not=|and=|or=|xor=)', Operator), + (r'\b(mod|lt|le|eq|ne|ge|gt|not|and|or|xor)\b', Operator), + (r'"[^\"]*"', String.Double), + (r"'[^\']*'", String.Single), + (r'\b[+\-]?([0-9]*\.[0-9]+|[0-9]+\.[0-9]*)(D|E)?([+\-]?[0-9]+)?\b', + Number.Float), + (r'\b\'[+\-]?[0-9A-F]+\'X(U?(S?|L{1,2})|B)\b', Number.Hex), + (r'\b\'[+\-]?[0-7]+\'O(U?(S?|L{1,2})|B)\b', Number.Oct), + (r'\b[+\-]?[0-9]+U?L{1,2}\b', Number.Integer.Long), + (r'\b[+\-]?[0-9]+U?S?\b', Number.Integer), + (r'\b[+\-]?[0-9]+B\b', Number), + (r'.', Text), + ] + } diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/igor.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/igor.py new file mode 100644 index 0000000000000000000000000000000000000000..1a21fe878967fa58131061d5b0ad2d5c62503ffb --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/igor.py @@ -0,0 +1,288 @@ +# -*- coding: utf-8 -*- +""" + pygments.lexers.igor + ~~~~~~~~~~~~~~~~~~~~ + + Lexers for Igor Pro. + + :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS. + :license: BSD, see LICENSE for details. +""" + +import re + +from pygments.lexer import RegexLexer, words +from pygments.token import Text, Comment, Keyword, Name, String + +__all__ = ['IgorLexer'] + + +class IgorLexer(RegexLexer): + """ + Pygments Lexer for Igor Pro procedure files (.ipf). + See http://www.wavemetrics.com/ and http://www.igorexchange.com/. + + .. versionadded:: 2.0 + """ + + name = 'Igor' + aliases = ['igor', 'igorpro'] + filenames = ['*.ipf'] + mimetypes = ['text/ipf'] + + flags = re.IGNORECASE | re.MULTILINE + + flowControl = ( + 'if', 'else', 'elseif', 'endif', 'for', 'endfor', 'strswitch', 'switch', + 'case', 'default', 'endswitch', 'do', 'while', 'try', 'catch', 'endtry', + 'break', 'continue', 'return', 'AbortOnRTE', 'AbortOnValue' + ) + types = ( + 'variable', 'string', 'constant', 'strconstant', 'NVAR', 'SVAR', 'WAVE', + 'STRUCT', 'dfref', 'funcref', 'char', 'uchar', 'int16', 'uint16', 'int32', + 'uint32', 'int64', 'uint64', 'float', 'double' + ) + keywords = ( + 'override', 'ThreadSafe', 'MultiThread', 'static', 'Proc', + 'Picture', 'Prompt', 'DoPrompt', 'macro', 'window', 'function', 'end', + 'Structure', 'EndStructure', 'EndMacro', 'Menu', 'SubMenu' + ) + operations = ( + 'Abort', 'AddFIFOData', 'AddFIFOVectData', 'AddMovieAudio', 'AddMovieFrame', + 'AdoptFiles', 'APMath', 'Append', 'AppendImage', 'AppendLayoutObject', + 'AppendMatrixContour', 'AppendText', 'AppendToGizmo', 'AppendToGraph', + 'AppendToLayout', 'AppendToTable', 'AppendXYZContour', 'AutoPositionWindow', + 'BackgroundInfo', 'Beep', 'BoundingBall', 'BoxSmooth', 'BrowseURL', 'BuildMenu', + 'Button', 'cd', 'Chart', 'CheckBox', 'CheckDisplayed', 'ChooseColor', 'Close', + 'CloseHelp', 'CloseMovie', 'CloseProc', 'ColorScale', 'ColorTab2Wave', + 'Concatenate', 'ControlBar', 'ControlInfo', 'ControlUpdate', + 'ConvertGlobalStringTextEncoding', 'ConvexHull', 'Convolve', 'CopyFile', + 'CopyFolder', 'CopyScales', 'Correlate', 'CreateAliasShortcut', 'CreateBrowser', + 'Cross', 'CtrlBackground', 'CtrlFIFO', 'CtrlNamedBackground', 'Cursor', + 'CurveFit', 'CustomControl', 'CWT', 'Debugger', 'DebuggerOptions', 'DefaultFont', + 'DefaultGuiControls', 'DefaultGuiFont', 'DefaultTextEncoding', 'DefineGuide', + 'DelayUpdate', 'DeleteAnnotations', 'DeleteFile', 'DeleteFolder', 'DeletePoints', + 'Differentiate', 'dir', 'Display', 'DisplayHelpTopic', 'DisplayProcedure', + 'DoAlert', 'DoIgorMenu', 'DoUpdate', 'DoWindow', 'DoXOPIdle', 'DPSS', + 'DrawAction', 'DrawArc', 'DrawBezier', 'DrawLine', 'DrawOval', 'DrawPICT', + 'DrawPoly', 'DrawRect', 'DrawRRect', 'DrawText', 'DrawUserShape', 'DSPDetrend', + 'DSPPeriodogram', 'Duplicate', 'DuplicateDataFolder', 'DWT', 'EdgeStats', 'Edit', + 'ErrorBars', 'EstimatePeakSizes', 'Execute', 'ExecuteScriptText', + 'ExperimentModified', 'ExportGizmo', 'Extract', 'FastGaussTransform', 'FastOp', + 'FBinRead', 'FBinWrite', 'FFT', 'FIFOStatus', 'FIFO2Wave', 'FilterFIR', + 'FilterIIR', 'FindAPeak', 'FindContour', 'FindDuplicates', 'FindLevel', + 'FindLevels', 'FindPeak', 'FindPointsInPoly', 'FindRoots', 'FindSequence', + 'FindValue', 'FPClustering', 'fprintf', 'FReadLine', 'FSetPos', 'FStatus', + 'FTPCreateDirectory', 'FTPDelete', 'FTPDownload', 'FTPUpload', 'FuncFit', + 'FuncFitMD', 'GBLoadWave', 'GetAxis', 'GetCamera', 'GetFileFolderInfo', + 'GetGizmo', 'GetLastUserMenuInfo', 'GetMarquee', 'GetMouse', 'GetSelection', + 'GetWindow', 'GPIBReadBinaryWave2', 'GPIBReadBinary2', 'GPIBReadWave2', + 'GPIBRead2', 'GPIBWriteBinaryWave2', 'GPIBWriteBinary2', 'GPIBWriteWave2', + 'GPIBWrite2', 'GPIB2', 'GraphNormal', 'GraphWaveDraw', 'GraphWaveEdit', 'Grep', + 'GroupBox', 'Hanning', 'HDF5CloseFile', 'HDF5CloseGroup', 'HDF5ConvertColors', + 'HDF5CreateFile', 'HDF5CreateGroup', 'HDF5CreateLink', 'HDF5Dump', + 'HDF5DumpErrors', 'HDF5DumpState', 'HDF5ListAttributes', 'HDF5ListGroup', + 'HDF5LoadData', 'HDF5LoadGroup', 'HDF5LoadImage', 'HDF5OpenFile', 'HDF5OpenGroup', + 'HDF5SaveData', 'HDF5SaveGroup', 'HDF5SaveImage', 'HDF5TestOperation', + 'HDF5UnlinkObject', 'HideIgorMenus', 'HideInfo', 'HideProcedures', 'HideTools', + 'HilbertTransform', 'Histogram', 'ICA', 'IFFT', 'ImageAnalyzeParticles', + 'ImageBlend', 'ImageBoundaryToMask', 'ImageEdgeDetection', 'ImageFileInfo', + 'ImageFilter', 'ImageFocus', 'ImageFromXYZ', 'ImageGenerateROIMask', 'ImageGLCM', + 'ImageHistModification', 'ImageHistogram', 'ImageInterpolate', 'ImageLineProfile', + 'ImageLoad', 'ImageMorphology', 'ImageRegistration', 'ImageRemoveBackground', + 'ImageRestore', 'ImageRotate', 'ImageSave', 'ImageSeedFill', 'ImageSkeleton3d', + 'ImageSnake', 'ImageStats', 'ImageThreshold', 'ImageTransform', + 'ImageUnwrapPhase', 'ImageWindow', 'IndexSort', 'InsertPoints', 'Integrate', + 'IntegrateODE', 'Integrate2D', 'Interpolate2', 'Interpolate3D', 'Interp3DPath', + 'JCAMPLoadWave', 'JointHistogram', 'KillBackground', 'KillControl', + 'KillDataFolder', 'KillFIFO', 'KillFreeAxis', 'KillPath', 'KillPICTs', + 'KillStrings', 'KillVariables', 'KillWaves', 'KillWindow', 'KMeans', 'Label', + 'Layout', 'LayoutPageAction', 'LayoutSlideShow', 'Legend', + 'LinearFeedbackShiftRegister', 'ListBox', 'LoadData', 'LoadPackagePreferences', + 'LoadPICT', 'LoadWave', 'Loess', 'LombPeriodogram', 'Make', 'MakeIndex', + 'MarkPerfTestTime', 'MatrixConvolve', 'MatrixCorr', 'MatrixEigenV', + 'MatrixFilter', 'MatrixGaussJ', 'MatrixGLM', 'MatrixInverse', 'MatrixLinearSolve', + 'MatrixLinearSolveTD', 'MatrixLLS', 'MatrixLUBkSub', 'MatrixLUD', 'MatrixLUDTD', + 'MatrixMultiply', 'MatrixOP', 'MatrixSchur', 'MatrixSolve', 'MatrixSVBkSub', + 'MatrixSVD', 'MatrixTranspose', 'MeasureStyledText', 'MLLoadWave', 'Modify', + 'ModifyBrowser', 'ModifyCamera', 'ModifyContour', 'ModifyControl', + 'ModifyControlList', 'ModifyFreeAxis', 'ModifyGizmo', 'ModifyGraph', + 'ModifyImage', 'ModifyLayout', 'ModifyPanel', 'ModifyTable', 'ModifyWaterfall', + 'MoveDataFolder', 'MoveFile', 'MoveFolder', 'MoveString', 'MoveSubwindow', + 'MoveVariable', 'MoveWave', 'MoveWindow', 'MultiTaperPSD', + 'MultiThreadingControl', 'NeuralNetworkRun', 'NeuralNetworkTrain', 'NewCamera', + 'NewDataFolder', 'NewFIFO', 'NewFIFOChan', 'NewFreeAxis', 'NewGizmo', 'NewImage', + 'NewLayout', 'NewMovie', 'NewNotebook', 'NewPanel', 'NewPath', 'NewWaterfall', + 'NI4882', 'Note', 'Notebook', 'NotebookAction', 'Open', 'OpenHelp', + 'OpenNotebook', 'Optimize', 'ParseOperationTemplate', 'PathInfo', 'PauseForUser', + 'PauseUpdate', 'PCA', 'PlayMovie', 'PlayMovieAction', 'PlaySound', + 'PopupContextualMenu', 'PopupMenu', 'Preferences', 'PrimeFactors', 'Print', + 'printf', 'PrintGraphs', 'PrintLayout', 'PrintNotebook', 'PrintSettings', + 'PrintTable', 'Project', 'PulseStats', 'PutScrapText', 'pwd', 'Quit', + 'RatioFromNumber', 'Redimension', 'Remove', 'RemoveContour', 'RemoveFromGizmo', + 'RemoveFromGraph', 'RemoveFromLayout', 'RemoveFromTable', 'RemoveImage', + 'RemoveLayoutObjects', 'RemovePath', 'Rename', 'RenameDataFolder', 'RenamePath', + 'RenamePICT', 'RenameWindow', 'ReorderImages', 'ReorderTraces', 'ReplaceText', + 'ReplaceWave', 'Resample', 'ResumeUpdate', 'Reverse', 'Rotate', 'Save', + 'SaveData', 'SaveExperiment', 'SaveGraphCopy', 'SaveNotebook', + 'SavePackagePreferences', 'SavePICT', 'SaveTableCopy', 'SetActiveSubwindow', + 'SetAxis', 'SetBackground', 'SetDashPattern', 'SetDataFolder', 'SetDimLabel', + 'SetDrawEnv', 'SetDrawLayer', 'SetFileFolderInfo', 'SetFormula', 'SetIgorHook', + 'SetIgorMenuMode', 'SetIgorOption', 'SetMarquee', 'SetProcessSleep', + 'SetRandomSeed', 'SetScale', 'SetVariable', 'SetWaveLock', 'SetWaveTextEncoding', + 'SetWindow', 'ShowIgorMenus', 'ShowInfo', 'ShowTools', 'Silent', 'Sleep', + 'Slider', 'Smooth', 'SmoothCustom', 'Sort', 'SortColumns', 'SoundInRecord', + 'SoundInSet', 'SoundInStartChart', 'SoundInStatus', 'SoundInStopChart', + 'SoundLoadWave', 'SoundSaveWave', 'SphericalInterpolate', 'SphericalTriangulate', + 'SplitString', 'SplitWave', 'sprintf', 'sscanf', 'Stack', 'StackWindows', + 'StatsAngularDistanceTest', 'StatsANOVA1Test', 'StatsANOVA2NRTest', + 'StatsANOVA2RMTest', 'StatsANOVA2Test', 'StatsChiTest', + 'StatsCircularCorrelationTest', 'StatsCircularMeans', 'StatsCircularMoments', + 'StatsCircularTwoSampleTest', 'StatsCochranTest', 'StatsContingencyTable', + 'StatsDIPTest', 'StatsDunnettTest', 'StatsFriedmanTest', 'StatsFTest', + 'StatsHodgesAjneTest', 'StatsJBTest', 'StatsKDE', 'StatsKendallTauTest', + 'StatsKSTest', 'StatsKWTest', 'StatsLinearCorrelationTest', + 'StatsLinearRegression', 'StatsMultiCorrelationTest', 'StatsNPMCTest', + 'StatsNPNominalSRTest', 'StatsQuantiles', 'StatsRankCorrelationTest', + 'StatsResample', 'StatsSample', 'StatsScheffeTest', 'StatsShapiroWilkTest', + 'StatsSignTest', 'StatsSRTest', 'StatsTTest', 'StatsTukeyTest', + 'StatsVariancesTest', 'StatsWatsonUSquaredTest', 'StatsWatsonWilliamsTest', + 'StatsWheelerWatsonTest', 'StatsWilcoxonRankTest', 'StatsWRCorrelationTest', + 'String', 'StructGet', 'StructPut', 'SumDimension', 'SumSeries', 'TabControl', + 'Tag', 'TextBox', 'ThreadGroupPutDF', 'ThreadStart', 'Tile', 'TileWindows', + 'TitleBox', 'ToCommandLine', 'ToolsGrid', 'Triangulate3d', 'Unwrap', 'URLRequest', + 'ValDisplay', 'Variable', 'VDTClosePort2', 'VDTGetPortList2', 'VDTGetStatus2', + 'VDTOpenPort2', 'VDTOperationsPort2', 'VDTReadBinaryWave2', 'VDTReadBinary2', + 'VDTReadHexWave2', 'VDTReadHex2', 'VDTReadWave2', 'VDTRead2', 'VDTTerminalPort2', + 'VDTWriteBinaryWave2', 'VDTWriteBinary2', 'VDTWriteHexWave2', 'VDTWriteHex2', + 'VDTWriteWave2', 'VDTWrite2', 'VDT2', 'WaveMeanStdv', 'WaveStats', + 'WaveTransform', 'wfprintf', 'WignerTransform', 'WindowFunction', 'XLLoadWave' + ) + functions = ( + 'abs', 'acos', 'acosh', 'AddListItem', 'AiryA', 'AiryAD', 'AiryB', 'AiryBD', + 'alog', 'AnnotationInfo', 'AnnotationList', 'area', 'areaXY', 'asin', 'asinh', + 'atan', 'atanh', 'atan2', 'AxisInfo', 'AxisList', 'AxisValFromPixel', 'Besseli', + 'Besselj', 'Besselk', 'Bessely', 'beta', 'betai', 'BinarySearch', + 'BinarySearchInterp', 'binomial', 'binomialln', 'binomialNoise', 'cabs', + 'CaptureHistory', 'CaptureHistoryStart', 'ceil', 'cequal', 'char2num', + 'chebyshev', 'chebyshevU', 'CheckName', 'ChildWindowList', 'CleanupName', 'cmplx', + 'cmpstr', 'conj', 'ContourInfo', 'ContourNameList', 'ContourNameToWaveRef', + 'ContourZ', 'ControlNameList', 'ConvertTextEncoding', 'cos', 'cosh', + 'cosIntegral', 'cot', 'coth', 'CountObjects', 'CountObjectsDFR', 'cpowi', + 'CreationDate', 'csc', 'csch', 'CsrInfo', 'CsrWave', 'CsrWaveRef', 'CsrXWave', + 'CsrXWaveRef', 'CTabList', 'DataFolderDir', 'DataFolderExists', + 'DataFolderRefsEqual', 'DataFolderRefStatus', 'date', 'datetime', 'DateToJulian', + 'date2secs', 'Dawson', 'DDERequestString', 'defined', 'deltax', 'digamma', + 'dilogarithm', 'DimDelta', 'DimOffset', 'DimSize', 'ei', 'enoise', 'equalWaves', + 'erf', 'erfc', 'erfcw', 'exists', 'exp', 'ExpConvExp', 'ExpConvExpFit', + 'ExpConvExpFitBL', 'ExpConvExpFit1Shape', 'ExpConvExpFit1ShapeBL', 'ExpGauss', + 'ExpGaussFit', 'ExpGaussFitBL', 'ExpGaussFit1Shape', 'ExpGaussFit1ShapeBL', + 'expInt', 'expIntegralE1', 'expNoise', 'factorial', 'fakedata', 'faverage', + 'faverageXY', 'FetchURL', 'FindDimLabel', 'FindListItem', 'floor', 'FontList', + 'FontSizeHeight', 'FontSizeStringWidth', 'FresnelCos', 'FresnelSin', + 'FuncRefInfo', 'FunctionInfo', 'FunctionList', 'FunctionPath', 'gamma', + 'gammaEuler', 'gammaInc', 'gammaNoise', 'gammln', 'gammp', 'gammq', 'Gauss', + 'GaussFit', 'GaussFitBL', 'GaussFit1Width', 'GaussFit1WidthBL', 'Gauss1D', + 'Gauss2D', 'gcd', 'GetBrowserLine', 'GetBrowserSelection', 'GetDataFolder', + 'GetDataFolderDFR', 'GetDefaultFont', 'GetDefaultFontSize', 'GetDefaultFontStyle', + 'GetDimLabel', 'GetEnvironmentVariable', 'GetErrMessage', 'GetFormula', + 'GetIndependentModuleName', 'GetIndexedObjName', 'GetIndexedObjNameDFR', + 'GetKeyState', 'GetRTErrMessage', 'GetRTError', 'GetRTLocation', 'GetRTLocInfo', + 'GetRTStackInfo', 'GetScrapText', 'GetUserData', 'GetWavesDataFolder', + 'GetWavesDataFolderDFR', 'GizmoInfo', 'GizmoScale', 'gnoise', 'GrepList', + 'GrepString', 'GuideInfo', 'GuideNameList', 'Hash', 'hcsr', 'HDF5AttributeInfo', + 'HDF5DatasetInfo', 'HDF5LibraryInfo', 'HDF5TypeInfo', 'hermite', 'hermiteGauss', + 'HyperGNoise', 'HyperGPFQ', 'HyperG0F1', 'HyperG1F1', 'HyperG2F1', 'IgorInfo', + 'IgorVersion', 'imag', 'ImageInfo', 'ImageNameList', 'ImageNameToWaveRef', + 'IndependentModuleList', 'IndexedDir', 'IndexedFile', 'Inf', 'Integrate1D', + 'interp', 'Interp2D', 'Interp3D', 'inverseERF', 'inverseERFC', 'ItemsInList', + 'JacobiCn', 'JacobiSn', 'JulianToDate', 'Laguerre', 'LaguerreA', 'LaguerreGauss', + 'LambertW', 'LayoutInfo', 'leftx', 'LegendreA', 'limit', 'ListMatch', + 'ListToTextWave', 'ListToWaveRefWave', 'ln', 'log', 'logNormalNoise', + 'LorentzianFit', 'LorentzianFitBL', 'LorentzianFit1Width', + 'LorentzianFit1WidthBL', 'lorentzianNoise', 'LowerStr', 'MacroList', 'magsqr', + 'MandelbrotPoint', 'MarcumQ', 'MatrixCondition', 'MatrixDet', 'MatrixDot', + 'MatrixRank', 'MatrixTrace', 'max', 'mean', 'median', 'min', 'mod', 'ModDate', + 'MPFXEMGPeak', 'MPFXExpConvExpPeak', 'MPFXGaussPeak', 'MPFXLorenzianPeak', + 'MPFXVoigtPeak', 'NameOfWave', 'NaN', 'NewFreeDataFolder', 'NewFreeWave', 'norm', + 'NormalizeUnicode', 'note', 'NumberByKey', 'numpnts', 'numtype', + 'NumVarOrDefault', 'num2char', 'num2istr', 'num2str', 'NVAR_Exists', + 'OperationList', 'PadString', 'PanelResolution', 'ParamIsDefault', + 'ParseFilePath', 'PathList', 'pcsr', 'Pi', 'PICTInfo', 'PICTList', + 'PixelFromAxisVal', 'pnt2x', 'poissonNoise', 'poly', 'PolygonArea', 'poly2D', + 'PossiblyQuoteName', 'ProcedureText', 'p2rect', 'qcsr', 'real', 'RemoveByKey', + 'RemoveEnding', 'RemoveFromList', 'RemoveListItem', 'ReplaceNumberByKey', + 'ReplaceString', 'ReplaceStringByKey', 'rightx', 'round', 'r2polar', 'sawtooth', + 'scaleToIndex', 'ScreenResolution', 'sec', 'sech', 'Secs2Date', 'Secs2Time', + 'SelectNumber', 'SelectString', 'SetEnvironmentVariable', 'sign', 'sin', 'sinc', + 'sinh', 'sinIntegral', 'SortList', 'SpecialCharacterInfo', 'SpecialCharacterList', + 'SpecialDirPath', 'SphericalBessJ', 'SphericalBessJD', 'SphericalBessY', + 'SphericalBessYD', 'SphericalHarmonics', 'sqrt', 'StartMSTimer', 'StatsBetaCDF', + 'StatsBetaPDF', 'StatsBinomialCDF', 'StatsBinomialPDF', 'StatsCauchyCDF', + 'StatsCauchyPDF', 'StatsChiCDF', 'StatsChiPDF', 'StatsCMSSDCDF', + 'StatsCorrelation', 'StatsDExpCDF', 'StatsDExpPDF', 'StatsErlangCDF', + 'StatsErlangPDF', 'StatsErrorPDF', 'StatsEValueCDF', 'StatsEValuePDF', + 'StatsExpCDF', 'StatsExpPDF', 'StatsFCDF', 'StatsFPDF', 'StatsFriedmanCDF', + 'StatsGammaCDF', 'StatsGammaPDF', 'StatsGeometricCDF', 'StatsGeometricPDF', + 'StatsGEVCDF', 'StatsGEVPDF', 'StatsHyperGCDF', 'StatsHyperGPDF', + 'StatsInvBetaCDF', 'StatsInvBinomialCDF', 'StatsInvCauchyCDF', 'StatsInvChiCDF', + 'StatsInvCMSSDCDF', 'StatsInvDExpCDF', 'StatsInvEValueCDF', 'StatsInvExpCDF', + 'StatsInvFCDF', 'StatsInvFriedmanCDF', 'StatsInvGammaCDF', 'StatsInvGeometricCDF', + 'StatsInvKuiperCDF', 'StatsInvLogisticCDF', 'StatsInvLogNormalCDF', + 'StatsInvMaxwellCDF', 'StatsInvMooreCDF', 'StatsInvNBinomialCDF', + 'StatsInvNCChiCDF', 'StatsInvNCFCDF', 'StatsInvNormalCDF', 'StatsInvParetoCDF', + 'StatsInvPoissonCDF', 'StatsInvPowerCDF', 'StatsInvQCDF', 'StatsInvQpCDF', + 'StatsInvRayleighCDF', 'StatsInvRectangularCDF', 'StatsInvSpearmanCDF', + 'StatsInvStudentCDF', 'StatsInvTopDownCDF', 'StatsInvTriangularCDF', + 'StatsInvUsquaredCDF', 'StatsInvVonMisesCDF', 'StatsInvWeibullCDF', + 'StatsKuiperCDF', 'StatsLogisticCDF', 'StatsLogisticPDF', 'StatsLogNormalCDF', + 'StatsLogNormalPDF', 'StatsMaxwellCDF', 'StatsMaxwellPDF', 'StatsMedian', + 'StatsMooreCDF', 'StatsNBinomialCDF', 'StatsNBinomialPDF', 'StatsNCChiCDF', + 'StatsNCChiPDF', 'StatsNCFCDF', 'StatsNCFPDF', 'StatsNCTCDF', 'StatsNCTPDF', + 'StatsNormalCDF', 'StatsNormalPDF', 'StatsParetoCDF', 'StatsParetoPDF', + 'StatsPermute', 'StatsPoissonCDF', 'StatsPoissonPDF', 'StatsPowerCDF', + 'StatsPowerNoise', 'StatsPowerPDF', 'StatsQCDF', 'StatsQpCDF', 'StatsRayleighCDF', + 'StatsRayleighPDF', 'StatsRectangularCDF', 'StatsRectangularPDF', 'StatsRunsCDF', + 'StatsSpearmanRhoCDF', 'StatsStudentCDF', 'StatsStudentPDF', 'StatsTopDownCDF', + 'StatsTriangularCDF', 'StatsTriangularPDF', 'StatsTrimmedMean', + 'StatsUSquaredCDF', 'StatsVonMisesCDF', 'StatsVonMisesNoise', 'StatsVonMisesPDF', + 'StatsWaldCDF', 'StatsWaldPDF', 'StatsWeibullCDF', 'StatsWeibullPDF', + 'StopMSTimer', 'StringByKey', 'stringCRC', 'StringFromList', 'StringList', + 'stringmatch', 'strlen', 'strsearch', 'StrVarOrDefault', 'str2num', 'StudentA', + 'StudentT', 'sum', 'SVAR_Exists', 'TableInfo', 'TagVal', 'TagWaveRef', 'tan', + 'tanh', 'TextEncodingCode', 'TextEncodingName', 'TextFile', 'ThreadGroupCreate', + 'ThreadGroupGetDF', 'ThreadGroupGetDFR', 'ThreadGroupRelease', 'ThreadGroupWait', + 'ThreadProcessorCount', 'ThreadReturnValue', 'ticks', 'time', 'TraceFromPixel', + 'TraceInfo', 'TraceNameList', 'TraceNameToWaveRef', 'trunc', 'UniqueName', + 'UnPadString', 'UnsetEnvironmentVariable', 'UpperStr', 'URLDecode', 'URLEncode', + 'VariableList', 'Variance', 'vcsr', 'Voigt', 'VoigtFit', 'VoigtFitBL', + 'VoigtFit1Shape', 'VoigtFit1ShapeBL', 'VoigtFit1Shape1Width', + 'VoigtFit1Shape1WidthBL', 'VoigtFunc', 'WaveCRC', 'WaveDims', 'WaveExists', + 'WaveInfo', 'WaveList', 'WaveMax', 'WaveMin', 'WaveName', 'WaveRefIndexed', + 'WaveRefIndexedDFR', 'WaveRefsEqual', 'WaveRefWaveToList', 'WaveTextEncoding', + 'WaveType', 'WaveUnits', 'WhichListItem', 'WinList', 'WinName', 'WinRecreation', + 'WinType', 'WMFindWholeWord', 'WNoise', 'xcsr', 'XWaveName', 'XWaveRefFromTrace', + 'x2pnt', 'zcsr', 'ZernikeR', 'zeta' + ) + + tokens = { + 'root': [ + (r'//.*$', Comment.Single), + (r'"([^"\\]|\\.)*"', String), + # Flow Control. + (words(flowControl, prefix=r'\b', suffix=r'\b'), Keyword), + # Types. + (words(types, prefix=r'\b', suffix=r'\b'), Keyword.Type), + # Keywords. + (words(keywords, prefix=r'\b', suffix=r'\b'), Keyword.Reserved), + # Built-in operations. + (words(operations, prefix=r'\b', suffix=r'\b'), Name.Class), + # Built-in functions. + (words(functions, prefix=r'\b', suffix=r'\b'), Name.Function), + # Compiler directives. + (r'^#(include|pragma|define|undef|ifdef|ifndef|if|elif|else|endif)', + Name.Decorator), + (r'[^a-z"/]+$', Text), + (r'.', Text), + ], + } diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/inferno.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/inferno.py new file mode 100644 index 0000000000000000000000000000000000000000..5fc5a0bad34b927a5955c7d5f8e7d0c03e5df60f --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/inferno.py @@ -0,0 +1,96 @@ +# -*- coding: utf-8 -*- +""" + pygments.lexers.inferno + ~~~~~~~~~~~~~~~~~~~~~~~ + + Lexers for Inferno os and all the related stuff. + + :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS. + :license: BSD, see LICENSE for details. +""" + +import re + +from pygments.lexer import RegexLexer, include, bygroups, default +from pygments.token import Punctuation, Text, Comment, Operator, Keyword, \ + Name, String, Number + +__all__ = ['LimboLexer'] + + +class LimboLexer(RegexLexer): + """ + Lexer for `Limbo programming language `_ + + TODO: + - maybe implement better var declaration highlighting + - some simple syntax error highlighting + + .. versionadded:: 2.0 + """ + name = 'Limbo' + aliases = ['limbo'] + filenames = ['*.b'] + mimetypes = ['text/limbo'] + + tokens = { + 'whitespace': [ + (r'^(\s*)([a-zA-Z_]\w*:(\s*)\n)', + bygroups(Text, Name.Label)), + (r'\n', Text), + (r'\s+', Text), + (r'#(\n|(.|\n)*?[^\\]\n)', Comment.Single), + ], + 'string': [ + (r'"', String, '#pop'), + (r'\\([\\abfnrtv"\']|x[a-fA-F0-9]{2,4}|' + r'u[a-fA-F0-9]{4}|U[a-fA-F0-9]{8}|[0-7]{1,3})', String.Escape), + (r'[^\\"\n]+', String), # all other characters + (r'\\', String), # stray backslash + ], + 'statements': [ + (r'"', String, 'string'), + (r"'(\\.|\\[0-7]{1,3}|\\x[a-fA-F0-9]{1,2}|[^\\\'\n])'", String.Char), + (r'(\d+\.\d*|\.\d+|\d+)[eE][+-]?\d+', Number.Float), + (r'(\d+\.\d*|\.\d+|\d+[fF])', Number.Float), + (r'16r[0-9a-fA-F]+', Number.Hex), + (r'8r[0-7]+', Number.Oct), + (r'((([1-3]\d)|([2-9]))r)?(\d+)', Number.Integer), + (r'[()\[\],.]', Punctuation), + (r'[~!%^&*+=|?:<>/-]|(->)|(<-)|(=>)|(::)', Operator), + (r'(alt|break|case|continue|cyclic|do|else|exit' + r'for|hd|if|implement|import|include|len|load|or' + r'pick|return|spawn|tagof|tl|to|while)\b', Keyword), + (r'(byte|int|big|real|string|array|chan|list|adt' + r'|fn|ref|of|module|self|type)\b', Keyword.Type), + (r'(con|iota|nil)\b', Keyword.Constant), + ('[a-zA-Z_]\w*', Name), + ], + 'statement' : [ + include('whitespace'), + include('statements'), + ('[{}]', Punctuation), + (';', Punctuation, '#pop'), + ], + 'root': [ + include('whitespace'), + default('statement'), + ], + } + + def analyse_text(text): + # Any limbo module implements something + if re.search(r'^implement \w+;', text, re.MULTILINE): + return 0.7 + +# TODO: +# - Make lexers for: +# - asm sources +# - man pages +# - mkfiles +# - module definitions +# - namespace definitions +# - shell scripts +# - maybe keyfiles and fonts +# they all seem to be quite similar to their equivalents +# from unix world, so there should not be a lot of problems diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/installers.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/installers.py new file mode 100644 index 0000000000000000000000000000000000000000..0323d140925d97b02da198d58769e2ef504ac015 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/installers.py @@ -0,0 +1,322 @@ +# -*- coding: utf-8 -*- +""" + pygments.lexers.installers + ~~~~~~~~~~~~~~~~~~~~~~~~~~ + + Lexers for installer/packager DSLs and formats. + + :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS. + :license: BSD, see LICENSE for details. +""" + +import re + +from pygments.lexer import RegexLexer, include, bygroups, using, this, default +from pygments.token import Text, Comment, Operator, Keyword, Name, String, \ + Punctuation, Generic, Number, Whitespace + +__all__ = ['NSISLexer', 'RPMSpecLexer', 'SourcesListLexer', + 'DebianControlLexer'] + + +class NSISLexer(RegexLexer): + """ + For `NSIS `_ scripts. + + .. versionadded:: 1.6 + """ + name = 'NSIS' + aliases = ['nsis', 'nsi', 'nsh'] + filenames = ['*.nsi', '*.nsh'] + mimetypes = ['text/x-nsis'] + + flags = re.IGNORECASE + + tokens = { + 'root': [ + (r'[;#].*\n', Comment), + (r"'.*?'", String.Single), + (r'"', String.Double, 'str_double'), + (r'`', String.Backtick, 'str_backtick'), + include('macro'), + include('interpol'), + include('basic'), + (r'\$\{[a-z_|][\w|]*\}', Keyword.Pseudo), + (r'/[a-z_]\w*', Name.Attribute), + ('.', Text), + ], + 'basic': [ + (r'(\n)(Function)(\s+)([._a-z][.\w]*)\b', + bygroups(Text, Keyword, Text, Name.Function)), + (r'\b([_a-z]\w*)(::)([a-z][a-z0-9]*)\b', + bygroups(Keyword.Namespace, Punctuation, Name.Function)), + (r'\b([_a-z]\w*)(:)', bygroups(Name.Label, Punctuation)), + (r'(\b[ULS]|\B)([!<>=]?=|\<\>?|\>)\B', Operator), + (r'[|+-]', Operator), + (r'\\', Punctuation), + (r'\b(Abort|Add(?:BrandingImage|Size)|' + r'Allow(?:RootDirInstall|SkipFiles)|AutoCloseWindow|' + r'BG(?:Font|Gradient)|BrandingText|BringToFront|Call(?:InstDLL)?|' + r'(?:Sub)?Caption|ChangeUI|CheckBitmap|ClearErrors|CompletedText|' + r'ComponentText|CopyFiles|CRCCheck|' + r'Create(?:Directory|Font|Shortcut)|Delete(?:INI(?:Sec|Str)|' + r'Reg(?:Key|Value))?|DetailPrint|DetailsButtonText|' + r'Dir(?:Show|Text|Var|Verify)|(?:Disabled|Enabled)Bitmap|' + r'EnableWindow|EnumReg(?:Key|Value)|Exch|Exec(?:Shell|Wait)?|' + r'ExpandEnvStrings|File(?:BufSize|Close|ErrorText|Open|' + r'Read(?:Byte)?|Seek|Write(?:Byte)?)?|' + r'Find(?:Close|First|Next|Window)|FlushINI|Function(?:End)?|' + r'Get(?:CurInstType|CurrentAddress|DlgItem|DLLVersion(?:Local)?|' + r'ErrorLevel|FileTime(?:Local)?|FullPathName|FunctionAddress|' + r'InstDirError|LabelAddress|TempFileName)|' + r'Goto|HideWindow|Icon|' + r'If(?:Abort|Errors|FileExists|RebootFlag|Silent)|' + r'InitPluginsDir|Install(?:ButtonText|Colors|Dir(?:RegKey)?)|' + r'Inst(?:ProgressFlags|Type(?:[GS]etText)?)|Int(?:CmpU?|Fmt|Op)|' + r'IsWindow|LangString(?:UP)?|' + r'License(?:BkColor|Data|ForceSelection|LangString|Text)|' + r'LoadLanguageFile|LockWindow|Log(?:Set|Text)|MessageBox|' + r'MiscButtonText|Name|Nop|OutFile|(?:Uninst)?Page(?:Ex(?:End)?)?|' + r'PluginDir|Pop|Push|Quit|Read(?:(?:Env|INI|Reg)Str|RegDWORD)|' + r'Reboot|(?:Un)?RegDLL|Rename|RequestExecutionLevel|ReserveFile|' + r'Return|RMDir|SearchPath|Section(?:Divider|End|' + r'(?:(?:Get|Set)(?:Flags|InstTypes|Size|Text))|Group(?:End)?|In)?|' + r'SendMessage|Set(?:AutoClose|BrandingImage|Compress(?:ionLevel|' + r'or(?:DictSize)?)?|CtlColors|CurInstType|DatablockOptimize|' + r'DateSave|Details(?:Print|View)|Error(?:s|Level)|FileAttributes|' + r'Font|OutPath|Overwrite|PluginUnload|RebootFlag|ShellVarContext|' + r'Silent|StaticBkColor)|' + r'Show(?:(?:I|Uni)nstDetails|Window)|Silent(?:Un)?Install|Sleep|' + r'SpaceTexts|Str(?:CmpS?|Cpy|Len)|SubSection(?:End)?|' + r'Uninstall(?:ButtonText|(?:Sub)?Caption|EXEName|Icon|Text)|' + r'UninstPage|Var|VI(?:AddVersionKey|ProductVersion)|WindowIcon|' + r'Write(?:INIStr|Reg(:?Bin|DWORD|(?:Expand)?Str)|Uninstaller)|' + r'XPStyle)\b', Keyword), + (r'\b(CUR|END|(?:FILE_ATTRIBUTE_)?' + r'(?:ARCHIVE|HIDDEN|NORMAL|OFFLINE|READONLY|SYSTEM|TEMPORARY)|' + r'HK(CC|CR|CU|DD|LM|PD|U)|' + r'HKEY_(?:CLASSES_ROOT|CURRENT_(?:CONFIG|USER)|DYN_DATA|' + r'LOCAL_MACHINE|PERFORMANCE_DATA|USERS)|' + r'ID(?:ABORT|CANCEL|IGNORE|NO|OK|RETRY|YES)|' + r'MB_(?:ABORTRETRYIGNORE|DEFBUTTON[1-4]|' + r'ICON(?:EXCLAMATION|INFORMATION|QUESTION|STOP)|' + r'OK(?:CANCEL)?|RETRYCANCEL|RIGHT|SETFOREGROUND|TOPMOST|USERICON|' + r'YESNO(?:CANCEL)?)|SET|SHCTX|' + r'SW_(?:HIDE|SHOW(?:MAXIMIZED|MINIMIZED|NORMAL))|' + r'admin|all|auto|both|bottom|bzip2|checkbox|colored|current|false|' + r'force|hide|highest|if(?:diff|newer)|lastused|leave|left|' + r'listonly|lzma|nevershow|none|normal|off|on|pop|push|' + r'radiobuttons|right|show|silent|silentlog|smooth|textonly|top|' + r'true|try|user|zlib)\b', Name.Constant), + ], + 'macro': [ + (r'\!(addincludedir(?:dir)?|addplugindir|appendfile|cd|define|' + r'delfilefile|echo(?:message)?|else|endif|error|execute|' + r'if(?:macro)?n?(?:def)?|include|insertmacro|macro(?:end)?|packhdr|' + r'search(?:parse|replace)|system|tempfilesymbol|undef|verbose|' + r'warning)\b', Comment.Preproc), + ], + 'interpol': [ + (r'\$(R?[0-9])', Name.Builtin.Pseudo), # registers + (r'\$(ADMINTOOLS|APPDATA|CDBURN_AREA|COOKIES|COMMONFILES(?:32|64)|' + r'DESKTOP|DOCUMENTS|EXE(?:DIR|FILE|PATH)|FAVORITES|FONTS|HISTORY|' + r'HWNDPARENT|INTERNET_CACHE|LOCALAPPDATA|MUSIC|NETHOOD|PICTURES|' + r'PLUGINSDIR|PRINTHOOD|PROFILE|PROGRAMFILES(?:32|64)|QUICKLAUNCH|' + r'RECENT|RESOURCES(?:_LOCALIZED)?|SENDTO|SM(?:PROGRAMS|STARTUP)|' + r'STARTMENU|SYSDIR|TEMP(?:LATES)?|VIDEOS|WINDIR|\{NSISDIR\})', + Name.Builtin), + (r'\$(CMDLINE|INSTDIR|OUTDIR|LANGUAGE)', Name.Variable.Global), + (r'\$[a-z_]\w*', Name.Variable), + ], + 'str_double': [ + (r'"', String, '#pop'), + (r'\$(\\[nrt"]|\$)', String.Escape), + include('interpol'), + (r'.', String.Double), + ], + 'str_backtick': [ + (r'`', String, '#pop'), + (r'\$(\\[nrt"]|\$)', String.Escape), + include('interpol'), + (r'.', String.Double), + ], + } + + +class RPMSpecLexer(RegexLexer): + """ + For RPM ``.spec`` files. + + .. versionadded:: 1.6 + """ + + name = 'RPMSpec' + aliases = ['spec'] + filenames = ['*.spec'] + mimetypes = ['text/x-rpm-spec'] + + _directives = ('(?:package|prep|build|install|clean|check|pre[a-z]*|' + 'post[a-z]*|trigger[a-z]*|files)') + + tokens = { + 'root': [ + (r'#.*\n', Comment), + include('basic'), + ], + 'description': [ + (r'^(%' + _directives + ')(.*)$', + bygroups(Name.Decorator, Text), '#pop'), + (r'\n', Text), + (r'.', Text), + ], + 'changelog': [ + (r'\*.*\n', Generic.Subheading), + (r'^(%' + _directives + ')(.*)$', + bygroups(Name.Decorator, Text), '#pop'), + (r'\n', Text), + (r'.', Text), + ], + 'string': [ + (r'"', String.Double, '#pop'), + (r'\\([\\abfnrtv"\']|x[a-fA-F0-9]{2,4}|[0-7]{1,3})', String.Escape), + include('interpol'), + (r'.', String.Double), + ], + 'basic': [ + include('macro'), + (r'(?i)^(Name|Version|Release|Epoch|Summary|Group|License|Packager|' + r'Vendor|Icon|URL|Distribution|Prefix|Patch[0-9]*|Source[0-9]*|' + r'Requires\(?[a-z]*\)?|[a-z]+Req|Obsoletes|Suggests|Provides|Conflicts|' + r'Build[a-z]+|[a-z]+Arch|Auto[a-z]+)(:)(.*)$', + bygroups(Generic.Heading, Punctuation, using(this))), + (r'^%description', Name.Decorator, 'description'), + (r'^%changelog', Name.Decorator, 'changelog'), + (r'^(%' + _directives + ')(.*)$', bygroups(Name.Decorator, Text)), + (r'%(attr|defattr|dir|doc(?:dir)?|setup|config(?:ure)?|' + r'make(?:install)|ghost|patch[0-9]+|find_lang|exclude|verify)', + Keyword), + include('interpol'), + (r"'.*?'", String.Single), + (r'"', String.Double, 'string'), + (r'.', Text), + ], + 'macro': [ + (r'%define.*\n', Comment.Preproc), + (r'%\{\!\?.*%define.*\}', Comment.Preproc), + (r'(%(?:if(?:n?arch)?|else(?:if)?|endif))(.*)$', + bygroups(Comment.Preproc, Text)), + ], + 'interpol': [ + (r'%\{?__[a-z_]+\}?', Name.Function), + (r'%\{?_([a-z_]+dir|[a-z_]+path|prefix)\}?', Keyword.Pseudo), + (r'%\{\?\w+\}', Name.Variable), + (r'\$\{?RPM_[A-Z0-9_]+\}?', Name.Variable.Global), + (r'%\{[a-zA-Z]\w+\}', Keyword.Constant), + ] + } + + +class SourcesListLexer(RegexLexer): + """ + Lexer that highlights debian sources.list files. + + .. versionadded:: 0.7 + """ + + name = 'Debian Sourcelist' + aliases = ['sourceslist', 'sources.list', 'debsources'] + filenames = ['sources.list'] + mimetype = ['application/x-debian-sourceslist'] + + tokens = { + 'root': [ + (r'\s+', Text), + (r'#.*?$', Comment), + (r'^(deb(?:-src)?)(\s+)', + bygroups(Keyword, Text), 'distribution') + ], + 'distribution': [ + (r'#.*?$', Comment, '#pop'), + (r'\$\(ARCH\)', Name.Variable), + (r'[^\s$[]+', String), + (r'\[', String.Other, 'escaped-distribution'), + (r'\$', String), + (r'\s+', Text, 'components') + ], + 'escaped-distribution': [ + (r'\]', String.Other, '#pop'), + (r'\$\(ARCH\)', Name.Variable), + (r'[^\]$]+', String.Other), + (r'\$', String.Other) + ], + 'components': [ + (r'#.*?$', Comment, '#pop:2'), + (r'$', Text, '#pop:2'), + (r'\s+', Text), + (r'\S+', Keyword.Pseudo), + ] + } + + def analyse_text(text): + for line in text.splitlines(): + line = line.strip() + if line.startswith('deb ') or line.startswith('deb-src '): + return True + + +class DebianControlLexer(RegexLexer): + """ + Lexer for Debian ``control`` files and ``apt-cache show `` outputs. + + .. versionadded:: 0.9 + """ + name = 'Debian Control file' + aliases = ['control', 'debcontrol'] + filenames = ['control'] + + tokens = { + 'root': [ + (r'^(Description)', Keyword, 'description'), + (r'^(Maintainer)(:\s*)', bygroups(Keyword, Text), 'maintainer'), + (r'^((Build-)?Depends)', Keyword, 'depends'), + (r'^((?:Python-)?Version)(:\s*)(\S+)$', + bygroups(Keyword, Text, Number)), + (r'^((?:Installed-)?Size)(:\s*)(\S+)$', + bygroups(Keyword, Text, Number)), + (r'^(MD5Sum|SHA1|SHA256)(:\s*)(\S+)$', + bygroups(Keyword, Text, Number)), + (r'^([a-zA-Z\-0-9\.]*?)(:\s*)(.*?)$', + bygroups(Keyword, Whitespace, String)), + ], + 'maintainer': [ + (r'<[^>]+>', Generic.Strong), + (r'<[^>]+>$', Generic.Strong, '#pop'), + (r',\n?', Text), + (r'.', Text), + ], + 'description': [ + (r'(.*)(Homepage)(: )(\S+)', + bygroups(Text, String, Name, Name.Class)), + (r':.*\n', Generic.Strong), + (r' .*\n', Text), + default('#pop'), + ], + 'depends': [ + (r':\s*', Text), + (r'(\$)(\{)(\w+\s*:\s*\w+)', bygroups(Operator, Text, Name.Entity)), + (r'\(', Text, 'depend_vers'), + (r',', Text), + (r'\|', Operator), + (r'[\s]+', Text), + (r'[})]\s*$', Text, '#pop'), + (r'\}', Text), + (r'[^,]$', Name.Function, '#pop'), + (r'([+.a-zA-Z0-9-])(\s*)', bygroups(Name.Function, Text)), + (r'\[.*?\]', Name.Entity), + ], + 'depend_vers': [ + (r'\),', Text, '#pop'), + (r'\)[^,]', Text, '#pop:2'), + (r'([><=]+)(\s*)([^)]+)', bygroups(Operator, Text, Number)) + ] + } diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/int_fiction.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/int_fiction.py new file mode 100644 index 0000000000000000000000000000000000000000..f280a56d85fe98204428e689f7332843e2490b0d --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/int_fiction.py @@ -0,0 +1,1343 @@ +# -*- coding: utf-8 -*- +""" + pygments.lexers.int_fiction + ~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + Lexers for interactive fiction languages. + + :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS. + :license: BSD, see LICENSE for details. +""" + +import re + +from pygments.lexer import RegexLexer, include, bygroups, using, \ + this, default, words +from pygments.token import Text, Comment, Operator, Keyword, Name, String, \ + Number, Punctuation, Error, Generic + +__all__ = ['Inform6Lexer', 'Inform6TemplateLexer', 'Inform7Lexer', + 'Tads3Lexer'] + + +class Inform6Lexer(RegexLexer): + """ + For `Inform 6 `_ source code. + + .. versionadded:: 2.0 + """ + + name = 'Inform 6' + aliases = ['inform6', 'i6'] + filenames = ['*.inf'] + + flags = re.MULTILINE | re.DOTALL | re.UNICODE + + _name = r'[a-zA-Z_]\w*' + + # Inform 7 maps these four character classes to their ASCII + # equivalents. To support Inform 6 inclusions within Inform 7, + # Inform6Lexer maps them too. + _dash = u'\\-\u2010-\u2014' + _dquote = u'"\u201c\u201d' + _squote = u"'\u2018\u2019" + _newline = u'\\n\u0085\u2028\u2029' + + tokens = { + 'root': [ + (r'\A(!%%[^%s]*[%s])+' % (_newline, _newline), Comment.Preproc, + 'directive'), + default('directive') + ], + '_whitespace': [ + (r'\s+', Text), + (r'![^%s]*' % _newline, Comment.Single) + ], + 'default': [ + include('_whitespace'), + (r'\[', Punctuation, 'many-values'), # Array initialization + (r':|(?=;)', Punctuation, '#pop'), + (r'<', Punctuation), # Second angle bracket in an action statement + default(('expression', '_expression')) + ], + + # Expressions + '_expression': [ + include('_whitespace'), + (r'(?=sp\b)', Text, '#pop'), + (r'(?=[%s%s$0-9#a-zA-Z_])' % (_dquote, _squote), Text, + ('#pop', 'value')), + (r'\+\+|[%s]{1,2}(?!>)|~~?' % _dash, Operator), + (r'(?=[()\[%s,?@{:;])' % _dash, Text, '#pop') + ], + 'expression': [ + include('_whitespace'), + (r'\(', Punctuation, ('expression', '_expression')), + (r'\)', Punctuation, '#pop'), + (r'\[', Punctuation, ('#pop', 'statements', 'locals')), + (r'>(?=(\s+|(![^%s]*))*[>;])' % _newline, Punctuation), + (r'\+\+|[%s]{2}(?!>)' % _dash, Operator), + (r',', Punctuation, '_expression'), + (r'&&?|\|\|?|[=~><]?=|[%s]{1,2}>?|\.\.?[&#]?|::|[<>+*/%%]' % _dash, + Operator, '_expression'), + (r'(has|hasnt|in|notin|ofclass|or|provides)\b', Operator.Word, + '_expression'), + (r'sp\b', Name), + (r'\?~?', Name.Label, 'label?'), + (r'[@{]', Error), + default('#pop') + ], + '_assembly-expression': [ + (r'\(', Punctuation, ('#push', '_expression')), + (r'[\[\]]', Punctuation), + (r'[%s]>' % _dash, Punctuation, '_expression'), + (r'sp\b', Keyword.Pseudo), + (r';', Punctuation, '#pop:3'), + include('expression') + ], + '_for-expression': [ + (r'\)', Punctuation, '#pop:2'), + (r':', Punctuation, '#pop'), + include('expression') + ], + '_keyword-expression': [ + (r'(from|near|to)\b', Keyword, '_expression'), + include('expression') + ], + '_list-expression': [ + (r',', Punctuation, '#pop'), + include('expression') + ], + '_object-expression': [ + (r'has\b', Keyword.Declaration, '#pop'), + include('_list-expression') + ], + + # Values + 'value': [ + include('_whitespace'), + # Strings + (r'[%s][^@][%s]' % (_squote, _squote), String.Char, '#pop'), + (r'([%s])(@\{[0-9a-fA-F]{1,4}\})([%s])' % (_squote, _squote), + bygroups(String.Char, String.Escape, String.Char), '#pop'), + (r'([%s])(@.{2})([%s])' % (_squote, _squote), + bygroups(String.Char, String.Escape, String.Char), '#pop'), + (r'[%s]' % _squote, String.Single, ('#pop', 'dictionary-word')), + (r'[%s]' % _dquote, String.Double, ('#pop', 'string')), + # Numbers + (r'\$[+%s][0-9]*\.?[0-9]*([eE][+%s]?[0-9]+)?' % (_dash, _dash), + Number.Float, '#pop'), + (r'\$[0-9a-fA-F]+', Number.Hex, '#pop'), + (r'\$\$[01]+', Number.Bin, '#pop'), + (r'[0-9]+', Number.Integer, '#pop'), + # Values prefixed by hashes + (r'(##|#a\$)(%s)' % _name, bygroups(Operator, Name), '#pop'), + (r'(#g\$)(%s)' % _name, + bygroups(Operator, Name.Variable.Global), '#pop'), + (r'#[nw]\$', Operator, ('#pop', 'obsolete-dictionary-word')), + (r'(#r\$)(%s)' % _name, bygroups(Operator, Name.Function), '#pop'), + (r'#', Name.Builtin, ('#pop', 'system-constant')), + # System functions + (words(( + 'child', 'children', 'elder', 'eldest', 'glk', 'indirect', 'metaclass', + 'parent', 'random', 'sibling', 'younger', 'youngest'), suffix=r'\b'), + Name.Builtin, '#pop'), + # Metaclasses + (r'(?i)(Class|Object|Routine|String)\b', Name.Builtin, '#pop'), + # Veneer routines + (words(( + 'Box__Routine', 'CA__Pr', 'CDefArt', 'CInDefArt', 'Cl__Ms', + 'Copy__Primitive', 'CP__Tab', 'DA__Pr', 'DB__Pr', 'DefArt', 'Dynam__String', + 'EnglishNumber', 'Glk__Wrap', 'IA__Pr', 'IB__Pr', 'InDefArt', 'Main__', + 'Meta__class', 'OB__Move', 'OB__Remove', 'OC__Cl', 'OP__Pr', 'Print__Addr', + 'Print__PName', 'PrintShortName', 'RA__Pr', 'RA__Sc', 'RL__Pr', 'R_Process', + 'RT__ChG', 'RT__ChGt', 'RT__ChLDB', 'RT__ChLDW', 'RT__ChPR', 'RT__ChPrintA', + 'RT__ChPrintC', 'RT__ChPrintO', 'RT__ChPrintS', 'RT__ChPS', 'RT__ChR', + 'RT__ChSTB', 'RT__ChSTW', 'RT__ChT', 'RT__Err', 'RT__TrPS', 'RV__Pr', + 'Symb__Tab', 'Unsigned__Compare', 'WV__Pr', 'Z__Region'), + prefix='(?i)', suffix=r'\b'), + Name.Builtin, '#pop'), + # Other built-in symbols + (words(( + 'call', 'copy', 'create', 'DEBUG', 'destroy', 'DICT_CHAR_SIZE', + 'DICT_ENTRY_BYTES', 'DICT_IS_UNICODE', 'DICT_WORD_SIZE', 'false', + 'FLOAT_INFINITY', 'FLOAT_NAN', 'FLOAT_NINFINITY', 'GOBJFIELD_CHAIN', + 'GOBJFIELD_CHILD', 'GOBJFIELD_NAME', 'GOBJFIELD_PARENT', + 'GOBJFIELD_PROPTAB', 'GOBJFIELD_SIBLING', 'GOBJ_EXT_START', + 'GOBJ_TOTAL_LENGTH', 'Grammar__Version', 'INDIV_PROP_START', 'INFIX', + 'infix__watching', 'MODULE_MODE', 'name', 'nothing', 'NUM_ATTR_BYTES', 'print', + 'print_to_array', 'recreate', 'remaining', 'self', 'sender', 'STRICT_MODE', + 'sw__var', 'sys__glob0', 'sys__glob1', 'sys__glob2', 'sys_statusline_flag', + 'TARGET_GLULX', 'TARGET_ZCODE', 'temp__global2', 'temp__global3', + 'temp__global4', 'temp_global', 'true', 'USE_MODULES', 'WORDSIZE'), + prefix='(?i)', suffix=r'\b'), + Name.Builtin, '#pop'), + # Other values + (_name, Name, '#pop') + ], + # Strings + 'dictionary-word': [ + (r'[~^]+', String.Escape), + (r'[^~^\\@({%s]+' % _squote, String.Single), + (r'[({]', String.Single), + (r'@\{[0-9a-fA-F]{,4}\}', String.Escape), + (r'@.{2}', String.Escape), + (r'[%s]' % _squote, String.Single, '#pop') + ], + 'string': [ + (r'[~^]+', String.Escape), + (r'[^~^\\@({%s]+' % _dquote, String.Double), + (r'[({]', String.Double), + (r'\\', String.Escape), + (r'@(\\\s*[%s]\s*)*@((\\\s*[%s]\s*)*[0-9])*' % + (_newline, _newline), String.Escape), + (r'@(\\\s*[%s]\s*)*\{((\\\s*[%s]\s*)*[0-9a-fA-F]){,4}' + r'(\\\s*[%s]\s*)*\}' % (_newline, _newline, _newline), + String.Escape), + (r'@(\\\s*[%s]\s*)*.(\\\s*[%s]\s*)*.' % (_newline, _newline), + String.Escape), + (r'[%s]' % _dquote, String.Double, '#pop') + ], + 'plain-string': [ + (r'[^~^\\({\[\]%s]+' % _dquote, String.Double), + (r'[~^({\[\]]', String.Double), + (r'\\', String.Escape), + (r'[%s]' % _dquote, String.Double, '#pop') + ], + # Names + '_constant': [ + include('_whitespace'), + (_name, Name.Constant, '#pop'), + include('value') + ], + '_global': [ + include('_whitespace'), + (_name, Name.Variable.Global, '#pop'), + include('value') + ], + 'label?': [ + include('_whitespace'), + (_name, Name.Label, '#pop'), + default('#pop') + ], + 'variable?': [ + include('_whitespace'), + (_name, Name.Variable, '#pop'), + default('#pop') + ], + # Values after hashes + 'obsolete-dictionary-word': [ + (r'\S\w*', String.Other, '#pop') + ], + 'system-constant': [ + include('_whitespace'), + (_name, Name.Builtin, '#pop') + ], + + # Directives + 'directive': [ + include('_whitespace'), + (r'#', Punctuation), + (r';', Punctuation, '#pop'), + (r'\[', Punctuation, + ('default', 'statements', 'locals', 'routine-name?')), + (words(( + 'abbreviate', 'endif', 'dictionary', 'ifdef', 'iffalse', 'ifndef', 'ifnot', + 'iftrue', 'ifv3', 'ifv5', 'release', 'serial', 'switches', 'system_file', + 'version'), prefix='(?i)', suffix=r'\b'), + Keyword, 'default'), + (r'(?i)(array|global)\b', Keyword, + ('default', 'directive-keyword?', '_global')), + (r'(?i)attribute\b', Keyword, ('default', 'alias?', '_constant')), + (r'(?i)class\b', Keyword, + ('object-body', 'duplicates', 'class-name')), + (r'(?i)(constant|default)\b', Keyword, + ('default', 'expression', '_constant')), + (r'(?i)(end\b)(.*)', bygroups(Keyword, Text)), + (r'(?i)(extend|verb)\b', Keyword, 'grammar'), + (r'(?i)fake_action\b', Keyword, ('default', '_constant')), + (r'(?i)import\b', Keyword, 'manifest'), + (r'(?i)(include|link)\b', Keyword, + ('default', 'before-plain-string')), + (r'(?i)(lowstring|undef)\b', Keyword, ('default', '_constant')), + (r'(?i)message\b', Keyword, ('default', 'diagnostic')), + (r'(?i)(nearby|object)\b', Keyword, + ('object-body', '_object-head')), + (r'(?i)property\b', Keyword, + ('default', 'alias?', '_constant', 'property-keyword*')), + (r'(?i)replace\b', Keyword, + ('default', 'routine-name?', 'routine-name?')), + (r'(?i)statusline\b', Keyword, ('default', 'directive-keyword?')), + (r'(?i)stub\b', Keyword, ('default', 'routine-name?')), + (r'(?i)trace\b', Keyword, + ('default', 'trace-keyword?', 'trace-keyword?')), + (r'(?i)zcharacter\b', Keyword, + ('default', 'directive-keyword?', 'directive-keyword?')), + (_name, Name.Class, ('object-body', '_object-head')) + ], + # [, Replace, Stub + 'routine-name?': [ + include('_whitespace'), + (_name, Name.Function, '#pop'), + default('#pop') + ], + 'locals': [ + include('_whitespace'), + (r';', Punctuation, '#pop'), + (r'\*', Punctuation), + (r'"', String.Double, 'plain-string'), + (_name, Name.Variable) + ], + # Array + 'many-values': [ + include('_whitespace'), + (r';', Punctuation), + (r'\]', Punctuation, '#pop'), + (r':', Error), + default(('expression', '_expression')) + ], + # Attribute, Property + 'alias?': [ + include('_whitespace'), + (r'alias\b', Keyword, ('#pop', '_constant')), + default('#pop') + ], + # Class, Object, Nearby + 'class-name': [ + include('_whitespace'), + (r'(?=[,;]|(class|has|private|with)\b)', Text, '#pop'), + (_name, Name.Class, '#pop') + ], + 'duplicates': [ + include('_whitespace'), + (r'\(', Punctuation, ('#pop', 'expression', '_expression')), + default('#pop') + ], + '_object-head': [ + (r'[%s]>' % _dash, Punctuation), + (r'(class|has|private|with)\b', Keyword.Declaration, '#pop'), + include('_global') + ], + 'object-body': [ + include('_whitespace'), + (r';', Punctuation, '#pop:2'), + (r',', Punctuation), + (r'class\b', Keyword.Declaration, 'class-segment'), + (r'(has|private|with)\b', Keyword.Declaration), + (r':', Error), + default(('_object-expression', '_expression')) + ], + 'class-segment': [ + include('_whitespace'), + (r'(?=[,;]|(class|has|private|with)\b)', Text, '#pop'), + (_name, Name.Class), + default('value') + ], + # Extend, Verb + 'grammar': [ + include('_whitespace'), + (r'=', Punctuation, ('#pop', 'default')), + (r'\*', Punctuation, ('#pop', 'grammar-line')), + default('_directive-keyword') + ], + 'grammar-line': [ + include('_whitespace'), + (r';', Punctuation, '#pop'), + (r'[/*]', Punctuation), + (r'[%s]>' % _dash, Punctuation, 'value'), + (r'(noun|scope)\b', Keyword, '=routine'), + default('_directive-keyword') + ], + '=routine': [ + include('_whitespace'), + (r'=', Punctuation, 'routine-name?'), + default('#pop') + ], + # Import + 'manifest': [ + include('_whitespace'), + (r';', Punctuation, '#pop'), + (r',', Punctuation), + (r'(?i)global\b', Keyword, '_global'), + default('_global') + ], + # Include, Link, Message + 'diagnostic': [ + include('_whitespace'), + (r'[%s]' % _dquote, String.Double, ('#pop', 'message-string')), + default(('#pop', 'before-plain-string', 'directive-keyword?')) + ], + 'before-plain-string': [ + include('_whitespace'), + (r'[%s]' % _dquote, String.Double, ('#pop', 'plain-string')) + ], + 'message-string': [ + (r'[~^]+', String.Escape), + include('plain-string') + ], + + # Keywords used in directives + '_directive-keyword!': [ + include('_whitespace'), + (words(( + 'additive', 'alias', 'buffer', 'class', 'creature', 'data', 'error', 'fatalerror', + 'first', 'has', 'held', 'initial', 'initstr', 'last', 'long', 'meta', 'multi', + 'multiexcept', 'multiheld', 'multiinside', 'noun', 'number', 'only', 'private', + 'replace', 'reverse', 'scope', 'score', 'special', 'string', 'table', 'terminating', + 'time', 'topic', 'warning', 'with'), suffix=r'\b'), + Keyword, '#pop'), + (r'[%s]{1,2}>|[+=]' % _dash, Punctuation, '#pop') + ], + '_directive-keyword': [ + include('_directive-keyword!'), + include('value') + ], + 'directive-keyword?': [ + include('_directive-keyword!'), + default('#pop') + ], + 'property-keyword*': [ + include('_whitespace'), + (r'(additive|long)\b', Keyword), + default('#pop') + ], + 'trace-keyword?': [ + include('_whitespace'), + (words(( + 'assembly', 'dictionary', 'expressions', 'lines', 'linker', + 'objects', 'off', 'on', 'symbols', 'tokens', 'verbs'), suffix=r'\b'), + Keyword, '#pop'), + default('#pop') + ], + + # Statements + 'statements': [ + include('_whitespace'), + (r'\]', Punctuation, '#pop'), + (r'[;{}]', Punctuation), + (words(( + 'box', 'break', 'continue', 'default', 'give', 'inversion', + 'new_line', 'quit', 'read', 'remove', 'return', 'rfalse', 'rtrue', + 'spaces', 'string', 'until'), suffix=r'\b'), + Keyword, 'default'), + (r'(do|else)\b', Keyword), + (r'(font|style)\b', Keyword, + ('default', 'miscellaneous-keyword?')), + (r'for\b', Keyword, ('for', '(?')), + (r'(if|switch|while)', Keyword, + ('expression', '_expression', '(?')), + (r'(jump|save|restore)\b', Keyword, ('default', 'label?')), + (r'objectloop\b', Keyword, + ('_keyword-expression', 'variable?', '(?')), + (r'print(_ret)?\b|(?=[%s])' % _dquote, Keyword, 'print-list'), + (r'\.', Name.Label, 'label?'), + (r'@', Keyword, 'opcode'), + (r'#(?![agrnw]\$|#)', Punctuation, 'directive'), + (r'<', Punctuation, 'default'), + (r'move\b', Keyword, + ('default', '_keyword-expression', '_expression')), + default(('default', '_keyword-expression', '_expression')) + ], + 'miscellaneous-keyword?': [ + include('_whitespace'), + (r'(bold|fixed|from|near|off|on|reverse|roman|to|underline)\b', + Keyword, '#pop'), + (r'(a|A|an|address|char|name|number|object|property|string|the|' + r'The)\b(?=(\s+|(![^%s]*))*\))' % _newline, Keyword.Pseudo, + '#pop'), + (r'%s(?=(\s+|(![^%s]*))*\))' % (_name, _newline), Name.Function, + '#pop'), + default('#pop') + ], + '(?': [ + include('_whitespace'), + (r'\(', Punctuation, '#pop'), + default('#pop') + ], + 'for': [ + include('_whitespace'), + (r';', Punctuation, ('_for-expression', '_expression')), + default(('_for-expression', '_expression')) + ], + 'print-list': [ + include('_whitespace'), + (r';', Punctuation, '#pop'), + (r':', Error), + default(('_list-expression', '_expression', '_list-expression', 'form')) + ], + 'form': [ + include('_whitespace'), + (r'\(', Punctuation, ('#pop', 'miscellaneous-keyword?')), + default('#pop') + ], + + # Assembly + 'opcode': [ + include('_whitespace'), + (r'[%s]' % _dquote, String.Double, ('operands', 'plain-string')), + (_name, Keyword, 'operands') + ], + 'operands': [ + (r':', Error), + default(('_assembly-expression', '_expression')) + ] + } + + def get_tokens_unprocessed(self, text): + # 'in' is either a keyword or an operator. + # If the token two tokens after 'in' is ')', 'in' is a keyword: + # objectloop(a in b) + # Otherwise, it is an operator: + # objectloop(a in b && true) + objectloop_queue = [] + objectloop_token_count = -1 + previous_token = None + for index, token, value in RegexLexer.get_tokens_unprocessed(self, + text): + if previous_token is Name.Variable and value == 'in': + objectloop_queue = [[index, token, value]] + objectloop_token_count = 2 + elif objectloop_token_count > 0: + if token not in Comment and token not in Text: + objectloop_token_count -= 1 + objectloop_queue.append((index, token, value)) + else: + if objectloop_token_count == 0: + if objectloop_queue[-1][2] == ')': + objectloop_queue[0][1] = Keyword + while objectloop_queue: + yield objectloop_queue.pop(0) + objectloop_token_count = -1 + yield index, token, value + if token not in Comment and token not in Text: + previous_token = token + while objectloop_queue: + yield objectloop_queue.pop(0) + + +class Inform7Lexer(RegexLexer): + """ + For `Inform 7 `_ source code. + + .. versionadded:: 2.0 + """ + + name = 'Inform 7' + aliases = ['inform7', 'i7'] + filenames = ['*.ni', '*.i7x'] + + flags = re.MULTILINE | re.DOTALL | re.UNICODE + + _dash = Inform6Lexer._dash + _dquote = Inform6Lexer._dquote + _newline = Inform6Lexer._newline + _start = r'\A|(?<=[%s])' % _newline + + # There are three variants of Inform 7, differing in how to + # interpret at signs and braces in I6T. In top-level inclusions, at + # signs in the first column are inweb syntax. In phrase definitions + # and use options, tokens in braces are treated as I7. Use options + # also interpret "{N}". + tokens = {} + token_variants = ['+i6t-not-inline', '+i6t-inline', '+i6t-use-option'] + + for level in token_variants: + tokens[level] = { + '+i6-root': list(Inform6Lexer.tokens['root']), + '+i6t-root': [ # For Inform6TemplateLexer + (r'[^%s]*' % Inform6Lexer._newline, Comment.Preproc, + ('directive', '+p')) + ], + 'root': [ + (r'(\|?\s)+', Text), + (r'\[', Comment.Multiline, '+comment'), + (r'[%s]' % _dquote, Generic.Heading, + ('+main', '+titling', '+titling-string')), + default(('+main', '+heading?')) + ], + '+titling-string': [ + (r'[^%s]+' % _dquote, Generic.Heading), + (r'[%s]' % _dquote, Generic.Heading, '#pop') + ], + '+titling': [ + (r'\[', Comment.Multiline, '+comment'), + (r'[^%s.;:|%s]+' % (_dquote, _newline), Generic.Heading), + (r'[%s]' % _dquote, Generic.Heading, '+titling-string'), + (r'[%s]{2}|(?<=[\s%s])\|[\s%s]' % (_newline, _dquote, _dquote), + Text, ('#pop', '+heading?')), + (r'[.;:]|(?<=[\s%s])\|' % _dquote, Text, '#pop'), + (r'[|%s]' % _newline, Generic.Heading) + ], + '+main': [ + (r'(?i)[^%s:a\[(|%s]+' % (_dquote, _newline), Text), + (r'[%s]' % _dquote, String.Double, '+text'), + (r':', Text, '+phrase-definition'), + (r'(?i)\bas\b', Text, '+use-option'), + (r'\[', Comment.Multiline, '+comment'), + (r'(\([%s])(.*?)([%s]\))' % (_dash, _dash), + bygroups(Punctuation, + using(this, state=('+i6-root', 'directive'), + i6t='+i6t-not-inline'), Punctuation)), + (r'(%s|(?<=[\s;:.%s]))\|\s|[%s]{2,}' % + (_start, _dquote, _newline), Text, '+heading?'), + (r'(?i)[a(|%s]' % _newline, Text) + ], + '+phrase-definition': [ + (r'\s+', Text), + (r'\[', Comment.Multiline, '+comment'), + (r'(\([%s])(.*?)([%s]\))' % (_dash, _dash), + bygroups(Punctuation, + using(this, state=('+i6-root', 'directive', + 'default', 'statements'), + i6t='+i6t-inline'), Punctuation), '#pop'), + default('#pop') + ], + '+use-option': [ + (r'\s+', Text), + (r'\[', Comment.Multiline, '+comment'), + (r'(\([%s])(.*?)([%s]\))' % (_dash, _dash), + bygroups(Punctuation, + using(this, state=('+i6-root', 'directive'), + i6t='+i6t-use-option'), Punctuation), '#pop'), + default('#pop') + ], + '+comment': [ + (r'[^\[\]]+', Comment.Multiline), + (r'\[', Comment.Multiline, '#push'), + (r'\]', Comment.Multiline, '#pop') + ], + '+text': [ + (r'[^\[%s]+' % _dquote, String.Double), + (r'\[.*?\]', String.Interpol), + (r'[%s]' % _dquote, String.Double, '#pop') + ], + '+heading?': [ + (r'(\|?\s)+', Text), + (r'\[', Comment.Multiline, '+comment'), + (r'[%s]{4}\s+' % _dash, Text, '+documentation-heading'), + (r'[%s]{1,3}' % _dash, Text), + (r'(?i)(volume|book|part|chapter|section)\b[^%s]*' % _newline, + Generic.Heading, '#pop'), + default('#pop') + ], + '+documentation-heading': [ + (r'\s+', Text), + (r'\[', Comment.Multiline, '+comment'), + (r'(?i)documentation\s+', Text, '+documentation-heading2'), + default('#pop') + ], + '+documentation-heading2': [ + (r'\s+', Text), + (r'\[', Comment.Multiline, '+comment'), + (r'[%s]{4}\s' % _dash, Text, '+documentation'), + default('#pop:2') + ], + '+documentation': [ + (r'(?i)(%s)\s*(chapter|example)\s*:[^%s]*' % + (_start, _newline), Generic.Heading), + (r'(?i)(%s)\s*section\s*:[^%s]*' % (_start, _newline), + Generic.Subheading), + (r'((%s)\t.*?[%s])+' % (_start, _newline), + using(this, state='+main')), + (r'[^%s\[]+|[%s\[]' % (_newline, _newline), Text), + (r'\[', Comment.Multiline, '+comment'), + ], + '+i6t-not-inline': [ + (r'(%s)@c( .*?)?([%s]|\Z)' % (_start, _newline), + Comment.Preproc), + (r'(%s)@([%s]+|Purpose:)[^%s]*' % (_start, _dash, _newline), + Comment.Preproc), + (r'(%s)@p( .*?)?([%s]|\Z)' % (_start, _newline), + Generic.Heading, '+p') + ], + '+i6t-use-option': [ + include('+i6t-not-inline'), + (r'(\{)(N)(\})', bygroups(Punctuation, Text, Punctuation)) + ], + '+i6t-inline': [ + (r'(\{)(\S[^}]*)?(\})', + bygroups(Punctuation, using(this, state='+main'), + Punctuation)) + ], + '+i6t': [ + (r'(\{[%s])(![^}]*)(\}?)' % _dash, + bygroups(Punctuation, Comment.Single, Punctuation)), + (r'(\{[%s])(lines)(:)([^}]*)(\}?)' % _dash, + bygroups(Punctuation, Keyword, Punctuation, Text, + Punctuation), '+lines'), + (r'(\{[%s])([^:}]*)(:?)([^}]*)(\}?)' % _dash, + bygroups(Punctuation, Keyword, Punctuation, Text, + Punctuation)), + (r'(\(\+)(.*?)(\+\)|\Z)', + bygroups(Punctuation, using(this, state='+main'), + Punctuation)) + ], + '+p': [ + (r'[^@]+', Comment.Preproc), + (r'(%s)@c( .*?)?([%s]|\Z)' % (_start, _newline), + Comment.Preproc, '#pop'), + (r'(%s)@([%s]|Purpose:)' % (_start, _dash), Comment.Preproc), + (r'(%s)@p( .*?)?([%s]|\Z)' % (_start, _newline), + Generic.Heading), + (r'@', Comment.Preproc) + ], + '+lines': [ + (r'(%s)@c( .*?)?([%s]|\Z)' % (_start, _newline), + Comment.Preproc), + (r'(%s)@([%s]|Purpose:)[^%s]*' % (_start, _dash, _newline), + Comment.Preproc), + (r'(%s)@p( .*?)?([%s]|\Z)' % (_start, _newline), + Generic.Heading, '+p'), + (r'(%s)@\w*[ %s]' % (_start, _newline), Keyword), + (r'![^%s]*' % _newline, Comment.Single), + (r'(\{)([%s]endlines)(\})' % _dash, + bygroups(Punctuation, Keyword, Punctuation), '#pop'), + (r'[^@!{]+?([%s]|\Z)|.' % _newline, Text) + ] + } + # Inform 7 can include snippets of Inform 6 template language, + # so all of Inform6Lexer's states are copied here, with + # modifications to account for template syntax. Inform7Lexer's + # own states begin with '+' to avoid name conflicts. Some of + # Inform6Lexer's states begin with '_': these are not modified. + # They deal with template syntax either by including modified + # states, or by matching r'' then pushing to modified states. + for token in Inform6Lexer.tokens: + if token == 'root': + continue + tokens[level][token] = list(Inform6Lexer.tokens[token]) + if not token.startswith('_'): + tokens[level][token][:0] = [include('+i6t'), include(level)] + + def __init__(self, **options): + level = options.get('i6t', '+i6t-not-inline') + if level not in self._all_tokens: + self._tokens = self.__class__.process_tokendef(level) + else: + self._tokens = self._all_tokens[level] + RegexLexer.__init__(self, **options) + + +class Inform6TemplateLexer(Inform7Lexer): + """ + For `Inform 6 template + `_ code. + + .. versionadded:: 2.0 + """ + + name = 'Inform 6 template' + aliases = ['i6t'] + filenames = ['*.i6t'] + + def get_tokens_unprocessed(self, text, stack=('+i6t-root',)): + return Inform7Lexer.get_tokens_unprocessed(self, text, stack) + + +class Tads3Lexer(RegexLexer): + """ + For `TADS 3 `_ source code. + """ + + name = 'TADS 3' + aliases = ['tads3'] + filenames = ['*.t'] + + flags = re.DOTALL | re.MULTILINE + + _comment_single = r'(?://(?:[^\\\n]|\\+[\w\W])*$)' + _comment_multiline = r'(?:/\*(?:[^*]|\*(?!/))*\*/)' + _escape = (r'(?:\\(?:[\n\\<>"\'^v bnrt]|u[\da-fA-F]{,4}|x[\da-fA-F]{,2}|' + r'[0-3]?[0-7]{1,2}))') + _name = r'(?:[_a-zA-Z]\w*)' + _no_quote = r'(?=\s|\\?>)' + _operator = (r'(?:&&|\|\||\+\+|--|\?\?|::|[.,@\[\]~]|' + r'(?:[=+\-*/%!&|^]|<>?>?)=?)') + _ws = r'(?:\\|\s|%s|%s)' % (_comment_single, _comment_multiline) + _ws_pp = r'(?:\\\n|[^\S\n]|%s|%s)' % (_comment_single, _comment_multiline) + + def _make_string_state(triple, double, verbatim=None, _escape=_escape): + if verbatim: + verbatim = ''.join(['(?:%s|%s)' % (re.escape(c.lower()), + re.escape(c.upper())) + for c in verbatim]) + char = r'"' if double else r"'" + token = String.Double if double else String.Single + escaped_quotes = r'+|%s(?!%s{2})' % (char, char) if triple else r'' + prefix = '%s%s' % ('t' if triple else '', 'd' if double else 's') + tag_state_name = '%sqt' % prefix + state = [] + if triple: + state += [ + (r'%s{3,}' % char, token, '#pop'), + (r'\\%s+' % char, String.Escape), + (char, token) + ] + else: + state.append((char, token, '#pop')) + state += [ + include('s/verbatim'), + (r'[^\\<&{}%s]+' % char, token) + ] + if verbatim: + # This regex can't use `(?i)` because escape sequences are + # case-sensitive. `<\XMP>` works; `<\xmp>` doesn't. + state.append((r'\\?<(/|\\\\|(?!%s)\\)%s(?=[\s=>])' % + (_escape, verbatim), + Name.Tag, ('#pop', '%sqs' % prefix, tag_state_name))) + else: + state += [ + (r'\\?<\\%s]|<(?!<)|\\%s%s|%s|\\.)*>?' % + (char, char, escaped_quotes, _escape), Comment.Multiline), + (r'(?i)\\?]|\\>)', Name.Tag, + ('#pop', '%sqs/listing' % prefix, tag_state_name)), + (r'(?i)\\?]|\\>)', Name.Tag, + ('#pop', '%sqs/xmp' % prefix, tag_state_name)), + (r'\\?<([^\s=><\\%s]|<(?!<)|\\%s%s|%s|\\.)*' % + (char, char, escaped_quotes, _escape), Name.Tag, + tag_state_name), + include('s/entity') + ] + state += [ + include('s/escape'), + (r'\{([^}<\\%s]|<(?!<)|\\%s%s|%s|\\.)*\}' % + (char, char, escaped_quotes, _escape), String.Interpol), + (r'[\\&{}<]', token) + ] + return state + + def _make_tag_state(triple, double, _escape=_escape): + char = r'"' if double else r"'" + quantifier = r'{3,}' if triple else r'' + state_name = '%s%sqt' % ('t' if triple else '', 'd' if double else 's') + token = String.Double if double else String.Single + escaped_quotes = r'+|%s(?!%s{2})' % (char, char) if triple else r'' + return [ + (r'%s%s' % (char, quantifier), token, '#pop:2'), + (r'(\s|\\\n)+', Text), + (r'(=)(\\?")', bygroups(Punctuation, String.Double), + 'dqs/%s' % state_name), + (r"(=)(\\?')", bygroups(Punctuation, String.Single), + 'sqs/%s' % state_name), + (r'=', Punctuation, 'uqs/%s' % state_name), + (r'\\?>', Name.Tag, '#pop'), + (r'\{([^}<\\%s]|<(?!<)|\\%s%s|%s|\\.)*\}' % + (char, char, escaped_quotes, _escape), String.Interpol), + (r'([^\s=><\\%s]|<(?!<)|\\%s%s|%s|\\.)+' % + (char, char, escaped_quotes, _escape), Name.Attribute), + include('s/escape'), + include('s/verbatim'), + include('s/entity'), + (r'[\\{}&]', Name.Attribute) + ] + + def _make_attribute_value_state(terminator, host_triple, host_double, + _escape=_escape): + token = (String.Double if terminator == r'"' else + String.Single if terminator == r"'" else String.Other) + host_char = r'"' if host_double else r"'" + host_quantifier = r'{3,}' if host_triple else r'' + host_token = String.Double if host_double else String.Single + escaped_quotes = (r'+|%s(?!%s{2})' % (host_char, host_char) + if host_triple else r'') + return [ + (r'%s%s' % (host_char, host_quantifier), host_token, '#pop:3'), + (r'%s%s' % (r'' if token is String.Other else r'\\?', terminator), + token, '#pop'), + include('s/verbatim'), + include('s/entity'), + (r'\{([^}<\\%s]|<(?!<)|\\%s%s|%s|\\.)*\}' % + (host_char, host_char, escaped_quotes, _escape), String.Interpol), + (r'([^\s"\'<%s{}\\&])+' % (r'>' if token is String.Other else r''), + token), + include('s/escape'), + (r'["\'\s&{<}\\]', token) + ] + + tokens = { + 'root': [ + (u'\ufeff', Text), + (r'\{', Punctuation, 'object-body'), + (r';+', Punctuation), + (r'(?=(argcount|break|case|catch|continue|default|definingobj|' + r'delegated|do|else|for|foreach|finally|goto|if|inherited|' + r'invokee|local|nil|new|operator|replaced|return|self|switch|' + r'targetobj|targetprop|throw|true|try|while)\b)', Text, 'block'), + (r'(%s)(%s*)(\()' % (_name, _ws), + bygroups(Name.Function, using(this, state='whitespace'), + Punctuation), + ('block?/root', 'more/parameters', 'main/parameters')), + include('whitespace'), + (r'\++', Punctuation), + (r'[^\s!"%-(*->@-_a-z{-~]+', Error), # Averts an infinite loop + (r'(?!\Z)', Text, 'main/root') + ], + 'main/root': [ + include('main/basic'), + default(('#pop', 'object-body/no-braces', 'classes', 'class')) + ], + 'object-body/no-braces': [ + (r';', Punctuation, '#pop'), + (r'\{', Punctuation, ('#pop', 'object-body')), + include('object-body') + ], + 'object-body': [ + (r';', Punctuation), + (r'\{', Punctuation, '#push'), + (r'\}', Punctuation, '#pop'), + (r':', Punctuation, ('classes', 'class')), + (r'(%s?)(%s*)(\()' % (_name, _ws), + bygroups(Name.Function, using(this, state='whitespace'), + Punctuation), + ('block?', 'more/parameters', 'main/parameters')), + (r'(%s)(%s*)(\{)' % (_name, _ws), + bygroups(Name.Function, using(this, state='whitespace'), + Punctuation), 'block'), + (r'(%s)(%s*)(:)' % (_name, _ws), + bygroups(Name.Variable, using(this, state='whitespace'), + Punctuation), + ('object-body/no-braces', 'classes', 'class')), + include('whitespace'), + (r'->|%s' % _operator, Punctuation, 'main'), + default('main/object-body') + ], + 'main/object-body': [ + include('main/basic'), + (r'(%s)(%s*)(=?)' % (_name, _ws), + bygroups(Name.Variable, using(this, state='whitespace'), + Punctuation), ('#pop', 'more', 'main')), + default('#pop:2') + ], + 'block?/root': [ + (r'\{', Punctuation, ('#pop', 'block')), + include('whitespace'), + (r'(?=[[\'"<(:])', Text, # It might be a VerbRule macro. + ('#pop', 'object-body/no-braces', 'grammar', 'grammar-rules')), + # It might be a macro like DefineAction. + default(('#pop', 'object-body/no-braces')) + ], + 'block?': [ + (r'\{', Punctuation, ('#pop', 'block')), + include('whitespace'), + default('#pop') + ], + 'block/basic': [ + (r'[;:]+', Punctuation), + (r'\{', Punctuation, '#push'), + (r'\}', Punctuation, '#pop'), + (r'default\b', Keyword.Reserved), + (r'(%s)(%s*)(:)' % (_name, _ws), + bygroups(Name.Label, using(this, state='whitespace'), + Punctuation)), + include('whitespace') + ], + 'block': [ + include('block/basic'), + (r'(?!\Z)', Text, ('more', 'main')) + ], + 'block/embed': [ + (r'>>', String.Interpol, '#pop'), + include('block/basic'), + (r'(?!\Z)', Text, ('more/embed', 'main')) + ], + 'main/basic': [ + include('whitespace'), + (r'\(', Punctuation, ('#pop', 'more', 'main')), + (r'\[', Punctuation, ('#pop', 'more/list', 'main')), + (r'\{', Punctuation, ('#pop', 'more/inner', 'main/inner', + 'more/parameters', 'main/parameters')), + (r'\*|\.{3}', Punctuation, '#pop'), + (r'(?i)0x[\da-f]+', Number.Hex, '#pop'), + (r'(\d+\.(?!\.)\d*|\.\d+)([eE][-+]?\d+)?|\d+[eE][-+]?\d+', + Number.Float, '#pop'), + (r'0[0-7]+', Number.Oct, '#pop'), + (r'\d+', Number.Integer, '#pop'), + (r'"""', String.Double, ('#pop', 'tdqs')), + (r"'''", String.Single, ('#pop', 'tsqs')), + (r'"', String.Double, ('#pop', 'dqs')), + (r"'", String.Single, ('#pop', 'sqs')), + (r'R"""', String.Regex, ('#pop', 'tdqr')), + (r"R'''", String.Regex, ('#pop', 'tsqr')), + (r'R"', String.Regex, ('#pop', 'dqr')), + (r"R'", String.Regex, ('#pop', 'sqr')), + # Two-token keywords + (r'(extern)(%s+)(object\b)' % _ws, + bygroups(Keyword.Reserved, using(this, state='whitespace'), + Keyword.Reserved)), + (r'(function|method)(%s*)(\()' % _ws, + bygroups(Keyword.Reserved, using(this, state='whitespace'), + Punctuation), + ('#pop', 'block?', 'more/parameters', 'main/parameters')), + (r'(modify)(%s+)(grammar\b)' % _ws, + bygroups(Keyword.Reserved, using(this, state='whitespace'), + Keyword.Reserved), + ('#pop', 'object-body/no-braces', ':', 'grammar')), + (r'(new)(%s+(?=(?:function|method)\b))' % _ws, + bygroups(Keyword.Reserved, using(this, state='whitespace'))), + (r'(object)(%s+)(template\b)' % _ws, + bygroups(Keyword.Reserved, using(this, state='whitespace'), + Keyword.Reserved), ('#pop', 'template')), + (r'(string)(%s+)(template\b)' % _ws, + bygroups(Keyword, using(this, state='whitespace'), + Keyword.Reserved), ('#pop', 'function-name')), + # Keywords + (r'(argcount|definingobj|invokee|replaced|targetobj|targetprop)\b', + Name.Builtin, '#pop'), + (r'(break|continue|goto)\b', Keyword.Reserved, ('#pop', 'label')), + (r'(case|extern|if|intrinsic|return|static|while)\b', + Keyword.Reserved), + (r'catch\b', Keyword.Reserved, ('#pop', 'catch')), + (r'class\b', Keyword.Reserved, + ('#pop', 'object-body/no-braces', 'class')), + (r'(default|do|else|finally|try)\b', Keyword.Reserved, '#pop'), + (r'(dictionary|property)\b', Keyword.Reserved, + ('#pop', 'constants')), + (r'enum\b', Keyword.Reserved, ('#pop', 'enum')), + (r'export\b', Keyword.Reserved, ('#pop', 'main')), + (r'(for|foreach)\b', Keyword.Reserved, + ('#pop', 'more/inner', 'main/inner')), + (r'(function|method)\b', Keyword.Reserved, + ('#pop', 'block?', 'function-name')), + (r'grammar\b', Keyword.Reserved, + ('#pop', 'object-body/no-braces', 'grammar')), + (r'inherited\b', Keyword.Reserved, ('#pop', 'inherited')), + (r'local\b', Keyword.Reserved, + ('#pop', 'more/local', 'main/local')), + (r'(modify|replace|switch|throw|transient)\b', Keyword.Reserved, + '#pop'), + (r'new\b', Keyword.Reserved, ('#pop', 'class')), + (r'(nil|true)\b', Keyword.Constant, '#pop'), + (r'object\b', Keyword.Reserved, ('#pop', 'object-body/no-braces')), + (r'operator\b', Keyword.Reserved, ('#pop', 'operator')), + (r'propertyset\b', Keyword.Reserved, + ('#pop', 'propertyset', 'main')), + (r'self\b', Name.Builtin.Pseudo, '#pop'), + (r'template\b', Keyword.Reserved, ('#pop', 'template')), + # Operators + (r'(__objref|defined)(%s*)(\()' % _ws, + bygroups(Operator.Word, using(this, state='whitespace'), + Operator), ('#pop', 'more/__objref', 'main')), + (r'delegated\b', Operator.Word), + # Compiler-defined macros and built-in properties + (r'(__DATE__|__DEBUG|__LINE__|__FILE__|' + r'__TADS_MACRO_FORMAT_VERSION|__TADS_SYS_\w*|__TADS_SYSTEM_NAME|' + r'__TADS_VERSION_MAJOR|__TADS_VERSION_MINOR|__TADS3|__TIME__|' + r'construct|finalize|grammarInfo|grammarTag|lexicalParent|' + r'miscVocab|sourceTextGroup|sourceTextGroupName|' + r'sourceTextGroupOrder|sourceTextOrder)\b', Name.Builtin, '#pop') + ], + 'main': [ + include('main/basic'), + (_name, Name, '#pop'), + default('#pop') + ], + 'more/basic': [ + (r'\(', Punctuation, ('more/list', 'main')), + (r'\[', Punctuation, ('more', 'main')), + (r'\.{3}', Punctuation), + (r'->|\.\.', Punctuation, 'main'), + (r'(?=;)|[:)\]]', Punctuation, '#pop'), + include('whitespace'), + (_operator, Operator, 'main'), + (r'\?', Operator, ('main', 'more/conditional', 'main')), + (r'(is|not)(%s+)(in\b)' % _ws, + bygroups(Operator.Word, using(this, state='whitespace'), + Operator.Word)), + (r'[^\s!"%-_a-z{-~]+', Error) # Averts an infinite loop + ], + 'more': [ + include('more/basic'), + default('#pop') + ], + # Then expression (conditional operator) + 'more/conditional': [ + (r':(?!:)', Operator, '#pop'), + include('more') + ], + # Embedded expressions + 'more/embed': [ + (r'>>', String.Interpol, '#pop:2'), + include('more') + ], + # For/foreach loop initializer or short-form anonymous function + 'main/inner': [ + (r'\(', Punctuation, ('#pop', 'more/inner', 'main/inner')), + (r'local\b', Keyword.Reserved, ('#pop', 'main/local')), + include('main') + ], + 'more/inner': [ + (r'\}', Punctuation, '#pop'), + (r',', Punctuation, 'main/inner'), + (r'(in|step)\b', Keyword, 'main/inner'), + include('more') + ], + # Local + 'main/local': [ + (_name, Name.Variable, '#pop'), + include('whitespace') + ], + 'more/local': [ + (r',', Punctuation, 'main/local'), + include('more') + ], + # List + 'more/list': [ + (r'[,:]', Punctuation, 'main'), + include('more') + ], + # Parameter list + 'main/parameters': [ + (r'(%s)(%s*)(?=:)' % (_name, _ws), + bygroups(Name.Variable, using(this, state='whitespace')), '#pop'), + (r'(%s)(%s+)(%s)' % (_name, _ws, _name), + bygroups(Name.Class, using(this, state='whitespace'), + Name.Variable), '#pop'), + (r'\[+', Punctuation), + include('main/basic'), + (_name, Name.Variable, '#pop'), + default('#pop') + ], + 'more/parameters': [ + (r'(:)(%s*(?=[?=,:)]))' % _ws, + bygroups(Punctuation, using(this, state='whitespace'))), + (r'[?\]]+', Punctuation), + (r'[:)]', Punctuation, ('#pop', 'multimethod?')), + (r',', Punctuation, 'main/parameters'), + (r'=', Punctuation, ('more/parameter', 'main')), + include('more') + ], + 'more/parameter': [ + (r'(?=[,)])', Text, '#pop'), + include('more') + ], + 'multimethod?': [ + (r'multimethod\b', Keyword, '#pop'), + include('whitespace'), + default('#pop') + ], + + # Statements and expressions + 'more/__objref': [ + (r',', Punctuation, 'mode'), + (r'\)', Operator, '#pop'), + include('more') + ], + 'mode': [ + (r'(error|warn)\b', Keyword, '#pop'), + include('whitespace') + ], + 'catch': [ + (r'\(+', Punctuation), + (_name, Name.Exception, ('#pop', 'variables')), + include('whitespace') + ], + 'enum': [ + include('whitespace'), + (r'token\b', Keyword, ('#pop', 'constants')), + default(('#pop', 'constants')) + ], + 'grammar': [ + (r'\)+', Punctuation), + (r'\(', Punctuation, 'grammar-tag'), + (r':', Punctuation, 'grammar-rules'), + (_name, Name.Class), + include('whitespace') + ], + 'grammar-tag': [ + include('whitespace'), + (r'"""([^\\"<]|""?(?!")|\\"+|\\.|<(?!<))+("{3,}|<<)|' + r'R"""([^\\"]|""?(?!")|\\"+|\\.)+"{3,}|' + r"'''([^\\'<]|''?(?!')|\\'+|\\.|<(?!<))+('{3,}|<<)|" + r"R'''([^\\']|''?(?!')|\\'+|\\.)+'{3,}|" + r'"([^\\"<]|\\.|<(?!<))+("|<<)|R"([^\\"]|\\.)+"|' + r"'([^\\'<]|\\.|<(?!<))+('|<<)|R'([^\\']|\\.)+'|" + r"([^)\s\\/]|/(?![/*]))+|\)", String.Other, '#pop') + ], + 'grammar-rules': [ + include('string'), + include('whitespace'), + (r'(\[)(%s*)(badness)' % _ws, + bygroups(Punctuation, using(this, state='whitespace'), Keyword), + 'main'), + (r'->|%s|[()]' % _operator, Punctuation), + (_name, Name.Constant), + default('#pop:2') + ], + ':': [ + (r':', Punctuation, '#pop') + ], + 'function-name': [ + (r'(<<([^>]|>>>|>(?!>))*>>)+', String.Interpol), + (r'(?=%s?%s*[({])' % (_name, _ws), Text, '#pop'), + (_name, Name.Function, '#pop'), + include('whitespace') + ], + 'inherited': [ + (r'<', Punctuation, ('#pop', 'classes', 'class')), + include('whitespace'), + (_name, Name.Class, '#pop'), + default('#pop') + ], + 'operator': [ + (r'negate\b', Operator.Word, '#pop'), + include('whitespace'), + (_operator, Operator), + default('#pop') + ], + 'propertyset': [ + (r'\(', Punctuation, ('more/parameters', 'main/parameters')), + (r'\{', Punctuation, ('#pop', 'object-body')), + include('whitespace') + ], + 'template': [ + (r'(?=;)', Text, '#pop'), + include('string'), + (r'inherited\b', Keyword.Reserved), + include('whitespace'), + (r'->|\?|%s' % _operator, Punctuation), + (_name, Name.Variable) + ], + + # Identifiers + 'class': [ + (r'\*|\.{3}', Punctuation, '#pop'), + (r'object\b', Keyword.Reserved, '#pop'), + (r'transient\b', Keyword.Reserved), + (_name, Name.Class, '#pop'), + include('whitespace'), + default('#pop') + ], + 'classes': [ + (r'[:,]', Punctuation, 'class'), + include('whitespace'), + (r'>', Punctuation, '#pop'), + default('#pop') + ], + 'constants': [ + (r',+', Punctuation), + (r';', Punctuation, '#pop'), + (r'property\b', Keyword.Reserved), + (_name, Name.Constant), + include('whitespace') + ], + 'label': [ + (_name, Name.Label, '#pop'), + include('whitespace'), + default('#pop') + ], + 'variables': [ + (r',+', Punctuation), + (r'\)', Punctuation, '#pop'), + include('whitespace'), + (_name, Name.Variable) + ], + + # Whitespace and comments + 'whitespace': [ + (r'^%s*#(%s|[^\n]|(?<=\\)\n)*\n?' % (_ws_pp, _comment_multiline), + Comment.Preproc), + (_comment_single, Comment.Single), + (_comment_multiline, Comment.Multiline), + (r'\\+\n+%s*#?|\n+|([^\S\n]|\\)+' % _ws_pp, Text) + ], + + # Strings + 'string': [ + (r'"""', String.Double, 'tdqs'), + (r"'''", String.Single, 'tsqs'), + (r'"', String.Double, 'dqs'), + (r"'", String.Single, 'sqs') + ], + 's/escape': [ + (r'\{\{|\}\}|%s' % _escape, String.Escape) + ], + 's/verbatim': [ + (r'<<\s*(as\s+decreasingly\s+likely\s+outcomes|cycling|else|end|' + r'first\s+time|one\s+of|only|or|otherwise|' + r'(sticky|(then\s+)?(purely\s+)?at)\s+random|stopping|' + r'(then\s+)?(half\s+)?shuffled|\|\|)\s*>>', String.Interpol), + (r'<<(%%(_(%s|\\?.)|[\-+ ,#]|\[\d*\]?)*\d*\.?\d*(%s|\\?.)|' + r'\s*((else|otherwise)\s+)?(if|unless)\b)?' % (_escape, _escape), + String.Interpol, ('block/embed', 'more/embed', 'main')) + ], + 's/entity': [ + (r'(?i)&(#(x[\da-f]+|\d+)|[a-z][\da-z]*);?', Name.Entity) + ], + 'tdqs': _make_string_state(True, True), + 'tsqs': _make_string_state(True, False), + 'dqs': _make_string_state(False, True), + 'sqs': _make_string_state(False, False), + 'tdqs/listing': _make_string_state(True, True, 'listing'), + 'tsqs/listing': _make_string_state(True, False, 'listing'), + 'dqs/listing': _make_string_state(False, True, 'listing'), + 'sqs/listing': _make_string_state(False, False, 'listing'), + 'tdqs/xmp': _make_string_state(True, True, 'xmp'), + 'tsqs/xmp': _make_string_state(True, False, 'xmp'), + 'dqs/xmp': _make_string_state(False, True, 'xmp'), + 'sqs/xmp': _make_string_state(False, False, 'xmp'), + + # Tags + 'tdqt': _make_tag_state(True, True), + 'tsqt': _make_tag_state(True, False), + 'dqt': _make_tag_state(False, True), + 'sqt': _make_tag_state(False, False), + 'dqs/tdqt': _make_attribute_value_state(r'"', True, True), + 'dqs/tsqt': _make_attribute_value_state(r'"', True, False), + 'dqs/dqt': _make_attribute_value_state(r'"', False, True), + 'dqs/sqt': _make_attribute_value_state(r'"', False, False), + 'sqs/tdqt': _make_attribute_value_state(r"'", True, True), + 'sqs/tsqt': _make_attribute_value_state(r"'", True, False), + 'sqs/dqt': _make_attribute_value_state(r"'", False, True), + 'sqs/sqt': _make_attribute_value_state(r"'", False, False), + 'uqs/tdqt': _make_attribute_value_state(_no_quote, True, True), + 'uqs/tsqt': _make_attribute_value_state(_no_quote, True, False), + 'uqs/dqt': _make_attribute_value_state(_no_quote, False, True), + 'uqs/sqt': _make_attribute_value_state(_no_quote, False, False), + + # Regular expressions + 'tdqr': [ + (r'[^\\"]+', String.Regex), + (r'\\"*', String.Regex), + (r'"{3,}', String.Regex, '#pop'), + (r'"', String.Regex) + ], + 'tsqr': [ + (r"[^\\']+", String.Regex), + (r"\\'*", String.Regex), + (r"'{3,}", String.Regex, '#pop'), + (r"'", String.Regex) + ], + 'dqr': [ + (r'[^\\"]+', String.Regex), + (r'\\"?', String.Regex), + (r'"', String.Regex, '#pop') + ], + 'sqr': [ + (r"[^\\']+", String.Regex), + (r"\\'?", String.Regex), + (r"'", String.Regex, '#pop') + ] + } + + def get_tokens_unprocessed(self, text, **kwargs): + pp = r'^%s*#%s*' % (self._ws_pp, self._ws_pp) + if_false_level = 0 + for index, token, value in ( + RegexLexer.get_tokens_unprocessed(self, text, **kwargs)): + if if_false_level == 0: # Not in a false #if + if (token is Comment.Preproc and + re.match(r'%sif%s+(0|nil)%s*$\n?' % + (pp, self._ws_pp, self._ws_pp), value)): + if_false_level = 1 + else: # In a false #if + if token is Comment.Preproc: + if (if_false_level == 1 and + re.match(r'%sel(if|se)\b' % pp, value)): + if_false_level = 0 + elif re.match(r'%sif' % pp, value): + if_false_level += 1 + elif re.match(r'%sendif\b' % pp, value): + if_false_level -= 1 + else: + token = Comment + yield index, token, value diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/iolang.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/iolang.py new file mode 100644 index 0000000000000000000000000000000000000000..bbc17faff05686e6bc1c20123cbb52980a289b9b --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/iolang.py @@ -0,0 +1,63 @@ +# -*- coding: utf-8 -*- +""" + pygments.lexers.iolang + ~~~~~~~~~~~~~~~~~~~~~~ + + Lexers for the Io language. + + :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS. + :license: BSD, see LICENSE for details. +""" + +from pygments.lexer import RegexLexer +from pygments.token import Text, Comment, Operator, Keyword, Name, String, \ + Number + +__all__ = ['IoLexer'] + + +class IoLexer(RegexLexer): + """ + For `Io `_ (a small, prototype-based + programming language) source. + + .. versionadded:: 0.10 + """ + name = 'Io' + filenames = ['*.io'] + aliases = ['io'] + mimetypes = ['text/x-iosrc'] + tokens = { + 'root': [ + (r'\n', Text), + (r'\s+', Text), + # Comments + (r'//(.*?)\n', Comment.Single), + (r'#(.*?)\n', Comment.Single), + (r'/(\\\n)?[*](.|\n)*?[*](\\\n)?/', Comment.Multiline), + (r'/\+', Comment.Multiline, 'nestedcomment'), + # DoubleQuotedString + (r'"(\\\\|\\"|[^"])*"', String), + # Operators + (r'::=|:=|=|\(|\)|;|,|\*|-|\+|>|<|@|!|/|\||\^|\.|%|&|\[|\]|\{|\}', + Operator), + # keywords + (r'(clone|do|doFile|doString|method|for|if|else|elseif|then)\b', + Keyword), + # constants + (r'(nil|false|true)\b', Name.Constant), + # names + (r'(Object|list|List|Map|args|Sequence|Coroutine|File)\b', + Name.Builtin), + ('[a-zA-Z_]\w*', Name), + # numbers + (r'(\d+\.?\d*|\d*\.\d+)([eE][+-]?[0-9]+)?', Number.Float), + (r'\d+', Number.Integer) + ], + 'nestedcomment': [ + (r'[^+/]+', Comment.Multiline), + (r'/\+', Comment.Multiline, '#push'), + (r'\+/', Comment.Multiline, '#pop'), + (r'[+/]', Comment.Multiline), + ] + } diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/j.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/j.py new file mode 100644 index 0000000000000000000000000000000000000000..434964fec125d243532c30a66803fb5716bf3de0 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/j.py @@ -0,0 +1,146 @@ +# -*- coding: utf-8 -*- +""" + pygments.lexers.j + ~~~~~~~~~~~~~~~~~ + + Lexer for the J programming language. + + :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS. + :license: BSD, see LICENSE for details. +""" + +from pygments.lexer import RegexLexer, words, include +from pygments.token import Comment, Keyword, Name, Number, Operator, Punctuation, \ + String, Text + +__all__ = ['JLexer'] + + +class JLexer(RegexLexer): + """ + For `J `_ source code. + + .. versionadded:: 2.1 + """ + + name = 'J' + aliases = ['j'] + filenames = ['*.ijs'] + mimetypes = ['text/x-j'] + + validName = r'\b[a-zA-Z]\w*' + + tokens = { + 'root': [ + # Shebang script + (r'#!.*$', Comment.Preproc), + + # Comments + (r'NB\..*', Comment.Single), + (r'\n+\s*Note', Comment.Multiline, 'comment'), + (r'\s*Note.*', Comment.Single), + + # Whitespace + (r'\s+', Text), + + # Strings + (r"'", String, 'singlequote'), + + # Definitions + (r'0\s+:\s*0|noun\s+define\s*$', Name.Entity, 'nounDefinition'), + (r'(([1-4]|13)\s+:\s*0|(adverb|conjunction|dyad|monad|verb)\s+define)\b', + Name.Function, 'explicitDefinition'), + + # Flow Control + (words(('for_', 'goto_', 'label_'), suffix=validName+'\.'), Name.Label), + (words(( + 'assert', 'break', 'case', 'catch', 'catchd', + 'catcht', 'continue', 'do', 'else', 'elseif', + 'end', 'fcase', 'for', 'if', 'return', + 'select', 'throw', 'try', 'while', 'whilst', + ), suffix='\.'), Name.Label), + + # Variable Names + (validName, Name.Variable), + + # Standard Library + (words(( + 'ARGV', 'CR', 'CRLF', 'DEL', 'Debug', + 'EAV', 'EMPTY', 'FF', 'JVERSION', 'LF', + 'LF2', 'Note', 'TAB', 'alpha17', 'alpha27', + 'apply', 'bind', 'boxopen', 'boxxopen', 'bx', + 'clear', 'cutLF', 'cutopen', 'datatype', 'def', + 'dfh', 'drop', 'each', 'echo', 'empty', + 'erase', 'every', 'evtloop', 'exit', 'expand', + 'fetch', 'file2url', 'fixdotdot', 'fliprgb', 'getargs', + 'getenv', 'hfd', 'inv', 'inverse', 'iospath', + 'isatty', 'isutf8', 'items', 'leaf', 'list', + 'nameclass', 'namelist', 'names', 'nc', + 'nl', 'on', 'pick', 'rows', + 'script', 'scriptd', 'sign', 'sminfo', 'smoutput', + 'sort', 'split', 'stderr', 'stdin', 'stdout', + 'table', 'take', 'timespacex', 'timex', 'tmoutput', + 'toCRLF', 'toHOST', 'toJ', 'tolower', 'toupper', + 'type', 'ucp', 'ucpcount', 'usleep', 'utf8', + 'uucp', + )), Name.Function), + + # Copula + (r'=[.:]', Operator), + + # Builtins + (r'[-=+*#$%@!~`^&";:.,<>{}\[\]\\|/]', Operator), + + # Short Keywords + (r'[abCdDeEfHiIjLMoprtT]\.', Keyword.Reserved), + (r'[aDiLpqsStux]\:', Keyword.Reserved), + (r'(_[0-9])\:', Keyword.Constant), + + # Parens + (r'\(', Punctuation, 'parentheses'), + + # Numbers + include('numbers'), + ], + + 'comment': [ + (r'[^)]', Comment.Multiline), + (r'^\)', Comment.Multiline, '#pop'), + (r'[)]', Comment.Multiline), + ], + + 'explicitDefinition': [ + (r'\b[nmuvxy]\b', Name.Decorator), + include('root'), + (r'[^)]', Name), + (r'^\)', Name.Label, '#pop'), + (r'[)]', Name), + ], + + 'numbers': [ + (r'\b_{1,2}\b', Number), + (r'_?\d+(\.\d+)?(\s*[ejr]\s*)_?\d+(\.?=\d+)?', Number), + (r'_?\d+\.(?=\d+)', Number.Float), + (r'_?\d+x', Number.Integer.Long), + (r'_?\d+', Number.Integer), + ], + + 'nounDefinition': [ + (r'[^)]', String), + (r'^\)', Name.Label, '#pop'), + (r'[)]', String), + ], + + 'parentheses': [ + (r'\)', Punctuation, '#pop'), + # include('nounDefinition'), + include('explicitDefinition'), + include('root'), + ], + + 'singlequote': [ + (r"[^']", String), + (r"''", String), + (r"'", String, '#pop'), + ], + } diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/javascript.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/javascript.py new file mode 100644 index 0000000000000000000000000000000000000000..862535c9867e8d39b8d672dc398f75e457c1e944 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/javascript.py @@ -0,0 +1,1525 @@ +# -*- coding: utf-8 -*- +""" + pygments.lexers.javascript + ~~~~~~~~~~~~~~~~~~~~~~~~~~ + + Lexers for JavaScript and related languages. + + :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS. + :license: BSD, see LICENSE for details. +""" + +import re + +from pygments.lexer import RegexLexer, include, bygroups, default, using, \ + this, words, combined +from pygments.token import Text, Comment, Operator, Keyword, Name, String, \ + Number, Punctuation, Other +from pygments.util import get_bool_opt, iteritems +import pygments.unistring as uni + +__all__ = ['JavascriptLexer', 'KalLexer', 'LiveScriptLexer', 'DartLexer', + 'TypeScriptLexer', 'LassoLexer', 'ObjectiveJLexer', + 'CoffeeScriptLexer', 'MaskLexer', 'EarlGreyLexer', 'JuttleLexer'] + +JS_IDENT_START = ('(?:[$_' + uni.combine('Lu', 'Ll', 'Lt', 'Lm', 'Lo', 'Nl') + + ']|\\\\u[a-fA-F0-9]{4})') +JS_IDENT_PART = ('(?:[$' + uni.combine('Lu', 'Ll', 'Lt', 'Lm', 'Lo', 'Nl', + 'Mn', 'Mc', 'Nd', 'Pc') + + u'\u200c\u200d]|\\\\u[a-fA-F0-9]{4})') +JS_IDENT = JS_IDENT_START + '(?:' + JS_IDENT_PART + ')*' + + +class JavascriptLexer(RegexLexer): + """ + For JavaScript source code. + """ + + name = 'JavaScript' + aliases = ['js', 'javascript'] + filenames = ['*.js', '*.jsm'] + mimetypes = ['application/javascript', 'application/x-javascript', + 'text/x-javascript', 'text/javascript'] + + flags = re.DOTALL | re.UNICODE | re.MULTILINE + + tokens = { + 'commentsandwhitespace': [ + (r'\s+', Text), + (r')?', Other), + (r'[^[<]+', Other), + ], + 'nosquarebrackets': [ + (r'\[noprocess\]', Comment.Preproc, 'noprocess'), + (r'\[', Other), + (r'<\?(lasso(script)?|=)', Comment.Preproc, 'anglebrackets'), + (r'<(!--.*?-->)?', Other), + (r'[^[<]+', Other), + ], + 'noprocess': [ + (r'\[/noprocess\]', Comment.Preproc, '#pop'), + (r'\[', Other), + (r'[^[]', Other), + ], + 'squarebrackets': [ + (r'\]', Comment.Preproc, '#pop'), + include('lasso'), + ], + 'anglebrackets': [ + (r'\?>', Comment.Preproc, '#pop'), + include('lasso'), + ], + 'lassofile': [ + (r'\]|\?>', Comment.Preproc, '#pop'), + include('lasso'), + ], + 'whitespacecomments': [ + (r'\s+', Text), + (r'//.*?\n', Comment.Single), + (r'/\*\*!.*?\*/', String.Doc), + (r'/\*.*?\*/', Comment.Multiline), + ], + 'lasso': [ + # whitespace/comments + include('whitespacecomments'), + + # literals + (r'\d*\.\d+(e[+-]?\d+)?', Number.Float), + (r'0x[\da-f]+', Number.Hex), + (r'\d+', Number.Integer), + (r'(infinity|NaN)\b', Number), + (r"'", String.Single, 'singlestring'), + (r'"', String.Double, 'doublestring'), + (r'`[^`]*`', String.Backtick), + + # names + (r'\$[a-z_][\w.]*', Name.Variable), + (r'#([a-z_][\w.]*|\d+\b)', Name.Variable.Instance), + (r"(\.\s*)('[a-z_][\w.]*')", + bygroups(Name.Builtin.Pseudo, Name.Variable.Class)), + (r"(self)(\s*->\s*)('[a-z_][\w.]*')", + bygroups(Name.Builtin.Pseudo, Operator, Name.Variable.Class)), + (r'(\.\.?\s*)([a-z_][\w.]*(=(?!=))?)', + bygroups(Name.Builtin.Pseudo, Name.Other.Member)), + (r'(->\\?\s*|&\s*)([a-z_][\w.]*(=(?!=))?)', + bygroups(Operator, Name.Other.Member)), + (r'(?)(self|inherited|currentcapture|givenblock)\b', + Name.Builtin.Pseudo), + (r'-(?!infinity)[a-z_][\w.]*', Name.Attribute), + (r'::\s*[a-z_][\w.]*', Name.Label), + (r'(error_(code|msg)_\w+|Error_AddError|Error_ColumnRestriction|' + r'Error_DatabaseConnectionUnavailable|Error_DatabaseTimeout|' + r'Error_DeleteError|Error_FieldRestriction|Error_FileNotFound|' + r'Error_InvalidDatabase|Error_InvalidPassword|' + r'Error_InvalidUsername|Error_ModuleNotFound|' + r'Error_NoError|Error_NoPermission|Error_OutOfMemory|' + r'Error_ReqColumnMissing|Error_ReqFieldMissing|' + r'Error_RequiredColumnMissing|Error_RequiredFieldMissing|' + r'Error_UpdateError)\b', Name.Exception), + + # definitions + (r'(define)(\s+)([a-z_][\w.]*)(\s*=>\s*)(type|trait|thread)\b', + bygroups(Keyword.Declaration, Text, Name.Class, Operator, Keyword)), + (r'(define)(\s+)([a-z_][\w.]*)(\s*->\s*)([a-z_][\w.]*=?|[-+*/%])', + bygroups(Keyword.Declaration, Text, Name.Class, Operator, + Name.Function), 'signature'), + (r'(define)(\s+)([a-z_][\w.]*)', + bygroups(Keyword.Declaration, Text, Name.Function), 'signature'), + (r'(public|protected|private|provide)(\s+)(([a-z_][\w.]*=?|[-+*/%])' + r'(?=\s*\())', bygroups(Keyword, Text, Name.Function), + 'signature'), + (r'(public|protected|private|provide)(\s+)([a-z_][\w.]*)', + bygroups(Keyword, Text, Name.Function)), + + # keywords + (r'(true|false|none|minimal|full|all|void)\b', Keyword.Constant), + (r'(local|var|variable|global|data(?=\s))\b', Keyword.Declaration), + (r'(array|date|decimal|duration|integer|map|pair|string|tag|xml|' + r'null|boolean|bytes|keyword|list|locale|queue|set|stack|' + r'staticarray)\b', Keyword.Type), + (r'([a-z_][\w.]*)(\s+)(in)\b', bygroups(Name, Text, Keyword)), + (r'(let|into)(\s+)([a-z_][\w.]*)', bygroups(Keyword, Text, Name)), + (r'require\b', Keyword, 'requiresection'), + (r'(/?)(Namespace_Using)\b', bygroups(Punctuation, Keyword.Namespace)), + (r'(/?)(Cache|Database_Names|Database_SchemaNames|' + r'Database_TableNames|Define_Tag|Define_Type|Email_Batch|' + r'Encode_Set|HTML_Comment|Handle|Handle_Error|Header|If|Inline|' + r'Iterate|LJAX_Target|Link|Link_CurrentAction|Link_CurrentGroup|' + r'Link_CurrentRecord|Link_Detail|Link_FirstGroup|Link_FirstRecord|' + r'Link_LastGroup|Link_LastRecord|Link_NextGroup|Link_NextRecord|' + r'Link_PrevGroup|Link_PrevRecord|Log|Loop|Output_None|Portal|' + r'Private|Protect|Records|Referer|Referrer|Repeating|ResultSet|' + r'Rows|Search_Args|Search_Arguments|Select|Sort_Args|' + r'Sort_Arguments|Thread_Atomic|Value_List|While|Abort|Case|Else|' + r'Fail_If|Fail_IfNot|Fail|If_Empty|If_False|If_Null|If_True|' + r'Loop_Abort|Loop_Continue|Loop_Count|Params|Params_Up|Return|' + r'Return_Value|Run_Children|SOAP_DefineTag|SOAP_LastRequest|' + r'SOAP_LastResponse|Tag_Name|ascending|average|by|define|' + r'descending|do|equals|frozen|group|handle_failure|import|in|into|' + r'join|let|match|max|min|on|order|parent|protected|provide|public|' + r'require|returnhome|skip|split_thread|sum|take|thread|to|trait|' + r'type|where|with|yield|yieldhome)\b', + bygroups(Punctuation, Keyword)), + + # other + (r',', Punctuation, 'commamember'), + (r'(and|or|not)\b', Operator.Word), + (r'([a-z_][\w.]*)(\s*::\s*[a-z_][\w.]*)?(\s*=(?!=))', + bygroups(Name, Name.Label, Operator)), + (r'(/?)([\w.]+)', bygroups(Punctuation, Name.Other)), + (r'(=)(n?bw|n?ew|n?cn|lte?|gte?|n?eq|n?rx|ft)\b', + bygroups(Operator, Operator.Word)), + (r':=|[-+*/%=<>&|!?\\]+', Operator), + (r'[{}():;,@^]', Punctuation), + ], + 'singlestring': [ + (r"'", String.Single, '#pop'), + (r"[^'\\]+", String.Single), + include('escape'), + (r"\\", String.Single), + ], + 'doublestring': [ + (r'"', String.Double, '#pop'), + (r'[^"\\]+', String.Double), + include('escape'), + (r'\\', String.Double), + ], + 'escape': [ + (r'\\(U[\da-f]{8}|u[\da-f]{4}|x[\da-f]{1,2}|[0-7]{1,3}|:[^:\n\r]+:|' + r'[abefnrtv?"\'\\]|$)', String.Escape), + ], + 'signature': [ + (r'=>', Operator, '#pop'), + (r'\)', Punctuation, '#pop'), + (r'[(,]', Punctuation, 'parameter'), + include('lasso'), + ], + 'parameter': [ + (r'\)', Punctuation, '#pop'), + (r'-?[a-z_][\w.]*', Name.Attribute, '#pop'), + (r'\.\.\.', Name.Builtin.Pseudo), + include('lasso'), + ], + 'requiresection': [ + (r'(([a-z_][\w.]*=?|[-+*/%])(?=\s*\())', Name, 'requiresignature'), + (r'(([a-z_][\w.]*=?|[-+*/%])(?=(\s*::\s*[\w.]+)?\s*,))', Name), + (r'[a-z_][\w.]*=?|[-+*/%]', Name, '#pop'), + (r'::\s*[a-z_][\w.]*', Name.Label), + (r',', Punctuation), + include('whitespacecomments'), + ], + 'requiresignature': [ + (r'(\)(?=(\s*::\s*[\w.]+)?\s*,))', Punctuation, '#pop'), + (r'\)', Punctuation, '#pop:2'), + (r'-?[a-z_][\w.]*', Name.Attribute), + (r'::\s*[a-z_][\w.]*', Name.Label), + (r'\.\.\.', Name.Builtin.Pseudo), + (r'[(,]', Punctuation), + include('whitespacecomments'), + ], + 'commamember': [ + (r'(([a-z_][\w.]*=?|[-+*/%])' + r'(?=\s*(\(([^()]*\([^()]*\))*[^)]*\)\s*)?(::[\w.\s]+)?=>))', + Name.Function, 'signature'), + include('whitespacecomments'), + default('#pop'), + ], + } + + def __init__(self, **options): + self.builtinshighlighting = get_bool_opt( + options, 'builtinshighlighting', True) + self.requiredelimiters = get_bool_opt( + options, 'requiredelimiters', False) + + self._builtins = set() + self._members = set() + if self.builtinshighlighting: + from pygments.lexers._lasso_builtins import BUILTINS, MEMBERS + for key, value in iteritems(BUILTINS): + self._builtins.update(value) + for key, value in iteritems(MEMBERS): + self._members.update(value) + RegexLexer.__init__(self, **options) + + def get_tokens_unprocessed(self, text): + stack = ['root'] + if self.requiredelimiters: + stack.append('delimiters') + for index, token, value in \ + RegexLexer.get_tokens_unprocessed(self, text, stack): + if (token is Name.Other and value.lower() in self._builtins or + token is Name.Other.Member and + value.lower().rstrip('=') in self._members): + yield index, Name.Builtin, value + continue + yield index, token, value + + def analyse_text(text): + rv = 0.0 + if 'bin/lasso9' in text: + rv += 0.8 + if re.search(r'<\?lasso', text, re.I): + rv += 0.4 + if re.search(r'local\(', text, re.I): + rv += 0.4 + return rv + + +class ObjectiveJLexer(RegexLexer): + """ + For Objective-J source code with preprocessor directives. + + .. versionadded:: 1.3 + """ + + name = 'Objective-J' + aliases = ['objective-j', 'objectivej', 'obj-j', 'objj'] + filenames = ['*.j'] + mimetypes = ['text/x-objective-j'] + + #: optional Comment or Whitespace + _ws = r'(?:\s|//.*?\n|/[*].*?[*]/)*' + + flags = re.DOTALL | re.MULTILINE + + tokens = { + 'root': [ + include('whitespace'), + + # function definition + (r'^(' + _ws + r'[+-]' + _ws + r')([(a-zA-Z_].*?[^(])(' + _ws + r'\{)', + bygroups(using(this), using(this, state='function_signature'), + using(this))), + + # class definition + (r'(@interface|@implementation)(\s+)', bygroups(Keyword, Text), + 'classname'), + (r'(@class|@protocol)(\s*)', bygroups(Keyword, Text), + 'forward_classname'), + (r'(\s*)(@end)(\s*)', bygroups(Text, Keyword, Text)), + + include('statements'), + ('[{()}]', Punctuation), + (';', Punctuation), + ], + 'whitespace': [ + (r'(@import)(\s+)("(?:\\\\|\\"|[^"])*")', + bygroups(Comment.Preproc, Text, String.Double)), + (r'(@import)(\s+)(<(?:\\\\|\\>|[^>])*>)', + bygroups(Comment.Preproc, Text, String.Double)), + (r'(#(?:include|import))(\s+)("(?:\\\\|\\"|[^"])*")', + bygroups(Comment.Preproc, Text, String.Double)), + (r'(#(?:include|import))(\s+)(<(?:\\\\|\\>|[^>])*>)', + bygroups(Comment.Preproc, Text, String.Double)), + + (r'#if\s+0', Comment.Preproc, 'if0'), + (r'#', Comment.Preproc, 'macro'), + + (r'\n', Text), + (r'\s+', Text), + (r'\\\n', Text), # line continuation + (r'//(\n|(.|\n)*?[^\\]\n)', Comment.Single), + (r'/(\\\n)?[*](.|\n)*?[*](\\\n)?/', Comment.Multiline), + (r'', + # prec-lazy-or + u'||', + # prec-lazy-and + u'&&', + # prec-comparison + u'>', u'<', u'>=', u'≥', u'<=', u'≤', u'==', u'===', u'≡', u'!=', u'≠', + u'!==', u'≢', u'.>', u'.<', u'.>=', u'.≥', u'.<=', u'.≤', u'.==', u'.!=', + u'.≠', u'.=', u'.!', u'<:', u'>:', u'∈', u'∉', u'∋', u'∌', u'⊆', + u'⊈', u'⊂', + u'⊄', u'⊊', + # prec-pipe + u'|>', u'<|', + # prec-colon + u':', + # prec-plus + u'+', u'-', u'.+', u'.-', u'|', u'∪', u'$', + # prec-bitshift + u'<<', u'>>', u'>>>', u'.<<', u'.>>', u'.>>>', + # prec-times + u'*', u'/', u'./', u'÷', u'.÷', u'%', u'⋅', u'.%', u'.*', u'\\', u'.\\', u'&', u'∩', + # prec-rational + u'//', u'.//', + # prec-power + u'^', u'.^', + # prec-decl + u'::', + # prec-dot + u'.', + # unary op + u'+', u'-', u'!', u'~', u'√', u'∛', u'∜' + ]), Operator), + + # chars + (r"'(\\.|\\[0-7]{1,3}|\\x[a-fA-F0-9]{1,3}|\\u[a-fA-F0-9]{1,4}|" + r"\\U[a-fA-F0-9]{1,6}|[^\\\'\n])'", String.Char), + + # try to match trailing transpose + (r'(?<=[.\w)\]])\'+', Operator), + + # strings + (r'"""', String, 'tqstring'), + (r'"', String, 'string'), + + # regular expressions + (r'r"""', String.Regex, 'tqregex'), + (r'r"', String.Regex, 'regex'), + + # backticks + (r'`', String.Backtick, 'command'), + + # names + (allowed_variable, Name), + (r'@' + allowed_variable, Name.Decorator), + + # numbers + (r'(\d+(_\d+)+\.\d*|\d*\.\d+(_\d+)+)([eEf][+-]?[0-9]+)?', Number.Float), + (r'(\d+\.\d*|\d*\.\d+)([eEf][+-]?[0-9]+)?', Number.Float), + (r'\d+(_\d+)+[eEf][+-]?[0-9]+', Number.Float), + (r'\d+[eEf][+-]?[0-9]+', Number.Float), + (r'0b[01]+(_[01]+)+', Number.Bin), + (r'0b[01]+', Number.Bin), + (r'0o[0-7]+(_[0-7]+)+', Number.Oct), + (r'0o[0-7]+', Number.Oct), + (r'0x[a-fA-F0-9]+(_[a-fA-F0-9]+)+', Number.Hex), + (r'0x[a-fA-F0-9]+', Number.Hex), + (r'\d+(_\d+)+', Number.Integer), + (r'\d+', Number.Integer) + ], + + "blockcomment": [ + (r'[^=#]', Comment.Multiline), + (r'#=', Comment.Multiline, '#push'), + (r'=#', Comment.Multiline, '#pop'), + (r'[=#]', Comment.Multiline), + ], + + 'string': [ + (r'"', String, '#pop'), + # FIXME: This escape pattern is not perfect. + (r'\\([\\"\'$nrbtfav]|(x|u|U)[a-fA-F0-9]+|\d+)', String.Escape), + # Interpolation is defined as "$" followed by the shortest full + # expression, which is something we can't parse. + # Include the most common cases here: $word, and $(paren'd expr). + (r'\$' + allowed_variable, String.Interpol), + # (r'\$[a-zA-Z_]+', String.Interpol), + (r'(\$)(\()', bygroups(String.Interpol, Punctuation), 'in-intp'), + # @printf and @sprintf formats + (r'%[-#0 +]*([0-9]+|[*])?(\.([0-9]+|[*]))?[hlL]?[E-GXc-giorsux%]', + String.Interpol), + (r'.|\s', String), + ], + + 'tqstring': [ + (r'"""', String, '#pop'), + (r'\\([\\"\'$nrbtfav]|(x|u|U)[a-fA-F0-9]+|\d+)', String.Escape), + (r'\$' + allowed_variable, String.Interpol), + (r'(\$)(\()', bygroups(String.Interpol, Punctuation), 'in-intp'), + (r'.|\s', String), + ], + + 'regex': [ + (r'"', String.Regex, '#pop'), + (r'\\"', String.Regex), + (r'.|\s', String.Regex), + ], + + 'tqregex': [ + (r'"""', String.Regex, '#pop'), + (r'.|\s', String.Regex), + ], + + 'command': [ + (r'`', String.Backtick, '#pop'), + (r'\$' + allowed_variable, String.Interpol), + (r'(\$)(\()', bygroups(String.Interpol, Punctuation), 'in-intp'), + (r'.|\s', String.Backtick) + ], + + 'in-intp': [ + (r'\(', Punctuation, '#push'), + (r'\)', Punctuation, '#pop'), + include('root'), + ] + } + + def analyse_text(text): + return shebang_matches(text, r'julia') + + +class JuliaConsoleLexer(Lexer): + """ + For Julia console sessions. Modeled after MatlabSessionLexer. + + .. versionadded:: 1.6 + """ + name = 'Julia console' + aliases = ['jlcon'] + + def get_tokens_unprocessed(self, text): + jllexer = JuliaLexer(**self.options) + start = 0 + curcode = '' + insertions = [] + output = False + error = False + + for line in text.splitlines(True): + if line.startswith('julia>'): + insertions.append((len(curcode), [(0, Generic.Prompt, line[:6])])) + curcode += line[6:] + output = False + error = False + elif line.startswith('help?>') or line.startswith('shell>'): + yield start, Generic.Prompt, line[:6] + yield start + 6, Text, line[6:] + output = False + error = False + elif line.startswith(' ') and not output: + insertions.append((len(curcode), [(0, Text, line[:6])])) + curcode += line[6:] + else: + if curcode: + for item in do_insertions( + insertions, jllexer.get_tokens_unprocessed(curcode)): + yield item + curcode = '' + insertions = [] + if line.startswith('ERROR: ') or error: + yield start, Generic.Error, line + error = True + else: + yield start, Generic.Output, line + output = True + start += len(line) + + if curcode: + for item in do_insertions( + insertions, jllexer.get_tokens_unprocessed(curcode)): + yield item diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/jvm.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/jvm.py new file mode 100644 index 0000000000000000000000000000000000000000..f4392839ea7f4251e0851b31553d6106daeae40e --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/jvm.py @@ -0,0 +1,1573 @@ +# -*- coding: utf-8 -*- +""" + pygments.lexers.jvm + ~~~~~~~~~~~~~~~~~~~ + + Pygments lexers for JVM languages. + + :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS. + :license: BSD, see LICENSE for details. +""" + +import re + +from pygments.lexer import Lexer, RegexLexer, include, bygroups, using, \ + this, combined, default, words +from pygments.token import Text, Comment, Operator, Keyword, Name, String, \ + Number, Punctuation +from pygments.util import shebang_matches +from pygments import unistring as uni + +__all__ = ['JavaLexer', 'ScalaLexer', 'GosuLexer', 'GosuTemplateLexer', + 'GroovyLexer', 'IokeLexer', 'ClojureLexer', 'ClojureScriptLexer', + 'KotlinLexer', 'XtendLexer', 'AspectJLexer', 'CeylonLexer', + 'PigLexer', 'GoloLexer', 'JasminLexer'] + + +class JavaLexer(RegexLexer): + """ + For `Java `_ source code. + """ + + name = 'Java' + aliases = ['java'] + filenames = ['*.java'] + mimetypes = ['text/x-java'] + + flags = re.MULTILINE | re.DOTALL | re.UNICODE + + tokens = { + 'root': [ + (r'[^\S\n]+', Text), + (r'//.*?\n', Comment.Single), + (r'/\*.*?\*/', Comment.Multiline), + # keywords: go before method names to avoid lexing "throw new XYZ" + # as a method signature + (r'(assert|break|case|catch|continue|default|do|else|finally|for|' + r'if|goto|instanceof|new|return|switch|this|throw|try|while)\b', + Keyword), + # method names + (r'((?:(?:[^\W\d]|\$)[\w.\[\]$<>]*\s+)+?)' # return arguments + r'((?:[^\W\d]|\$)[\w$]*)' # method name + r'(\s*)(\()', # signature start + bygroups(using(this), Name.Function, Text, Operator)), + (r'@[^\W\d][\w.]*', Name.Decorator), + (r'(abstract|const|enum|extends|final|implements|native|private|' + r'protected|public|static|strictfp|super|synchronized|throws|' + r'transient|volatile)\b', Keyword.Declaration), + (r'(boolean|byte|char|double|float|int|long|short|void)\b', + Keyword.Type), + (r'(package)(\s+)', bygroups(Keyword.Namespace, Text), 'import'), + (r'(true|false|null)\b', Keyword.Constant), + (r'(class|interface)(\s+)', bygroups(Keyword.Declaration, Text), + 'class'), + (r'(import(?:\s+static)?)(\s+)', bygroups(Keyword.Namespace, Text), + 'import'), + (r'"(\\\\|\\"|[^"])*"', String), + (r"'\\.'|'[^\\]'|'\\u[0-9a-fA-F]{4}'", String.Char), + (r'(\.)((?:[^\W\d]|\$)[\w$]*)', bygroups(Operator, Name.Attribute)), + (r'^\s*([^\W\d]|\$)[\w$]*:', Name.Label), + (r'([^\W\d]|\$)[\w$]*', Name), + (r'([0-9][0-9_]*\.([0-9][0-9_]*)?|' + r'\.[0-9][0-9_]*)' + r'([eE][+\-]?[0-9][0-9_]*)?[fFdD]?|' + r'[0-9][eE][+\-]?[0-9][0-9_]*[fFdD]?|' + r'[0-9]([eE][+\-]?[0-9][0-9_]*)?[fFdD]|' + r'0[xX]([0-9a-fA-F][0-9a-fA-F_]*\.?|' + r'([0-9a-fA-F][0-9a-fA-F_]*)?\.[0-9a-fA-F][0-9a-fA-F_]*)' + r'[pP][+\-]?[0-9][0-9_]*[fFdD]?', Number.Float), + (r'0[xX][0-9a-fA-F][0-9a-fA-F_]*[lL]?', Number.Hex), + (r'0[bB][01][01_]*[lL]?', Number.Bin), + (r'0[0-7_]+[lL]?', Number.Oct), + (r'0|[1-9][0-9_]*[lL]?', Number.Integer), + (r'[~^*!%&\[\](){}<>|+=:;,./?-]', Operator), + (r'\n', Text) + ], + 'class': [ + (r'([^\W\d]|\$)[\w$]*', Name.Class, '#pop') + ], + 'import': [ + (r'[\w.]+\*?', Name.Namespace, '#pop') + ], + } + + +class AspectJLexer(JavaLexer): + """ + For `AspectJ `_ source code. + + .. versionadded:: 1.6 + """ + + name = 'AspectJ' + aliases = ['aspectj'] + filenames = ['*.aj'] + mimetypes = ['text/x-aspectj'] + + aj_keywords = set(( + 'aspect', 'pointcut', 'privileged', 'call', 'execution', + 'initialization', 'preinitialization', 'handler', 'get', 'set', + 'staticinitialization', 'target', 'args', 'within', 'withincode', + 'cflow', 'cflowbelow', 'annotation', 'before', 'after', 'around', + 'proceed', 'throwing', 'returning', 'adviceexecution', 'declare', + 'parents', 'warning', 'error', 'soft', 'precedence', 'thisJoinPoint', + 'thisJoinPointStaticPart', 'thisEnclosingJoinPointStaticPart', + 'issingleton', 'perthis', 'pertarget', 'percflow', 'percflowbelow', + 'pertypewithin', 'lock', 'unlock', 'thisAspectInstance' + )) + aj_inter_type = set(('parents:', 'warning:', 'error:', 'soft:', 'precedence:')) + aj_inter_type_annotation = set(('@type', '@method', '@constructor', '@field')) + + def get_tokens_unprocessed(self, text): + for index, token, value in JavaLexer.get_tokens_unprocessed(self, text): + if token is Name and value in self.aj_keywords: + yield index, Keyword, value + elif token is Name.Label and value in self.aj_inter_type: + yield index, Keyword, value[:-1] + yield index, Operator, value[-1] + elif token is Name.Decorator and value in self.aj_inter_type_annotation: + yield index, Keyword, value + else: + yield index, token, value + + +class ScalaLexer(RegexLexer): + """ + For `Scala `_ source code. + """ + + name = 'Scala' + aliases = ['scala'] + filenames = ['*.scala'] + mimetypes = ['text/x-scala'] + + flags = re.MULTILINE | re.DOTALL + + # don't use raw unicode strings! + op = (u'[-~\\^\\*!%&\\\\<>\\|+=:/?@\u00a6-\u00a7\u00a9\u00ac\u00ae\u00b0-\u00b1' + u'\u00b6\u00d7\u00f7\u03f6\u0482\u0606-\u0608\u060e-\u060f\u06e9' + u'\u06fd-\u06fe\u07f6\u09fa\u0b70\u0bf3-\u0bf8\u0bfa\u0c7f\u0cf1-\u0cf2' + u'\u0d79\u0f01-\u0f03\u0f13-\u0f17\u0f1a-\u0f1f\u0f34\u0f36\u0f38' + u'\u0fbe-\u0fc5\u0fc7-\u0fcf\u109e-\u109f\u1360\u1390-\u1399\u1940' + u'\u19e0-\u19ff\u1b61-\u1b6a\u1b74-\u1b7c\u2044\u2052\u207a-\u207c' + u'\u208a-\u208c\u2100-\u2101\u2103-\u2106\u2108-\u2109\u2114\u2116-\u2118' + u'\u211e-\u2123\u2125\u2127\u2129\u212e\u213a-\u213b\u2140-\u2144' + u'\u214a-\u214d\u214f\u2190-\u2328\u232b-\u244a\u249c-\u24e9\u2500-\u2767' + u'\u2794-\u27c4\u27c7-\u27e5\u27f0-\u2982\u2999-\u29d7\u29dc-\u29fb' + u'\u29fe-\u2b54\u2ce5-\u2cea\u2e80-\u2ffb\u3004\u3012-\u3013\u3020' + u'\u3036-\u3037\u303e-\u303f\u3190-\u3191\u3196-\u319f\u31c0-\u31e3' + u'\u3200-\u321e\u322a-\u3250\u3260-\u327f\u328a-\u32b0\u32c0-\u33ff' + u'\u4dc0-\u4dff\ua490-\ua4c6\ua828-\ua82b\ufb29\ufdfd\ufe62\ufe64-\ufe66' + u'\uff0b\uff1c-\uff1e\uff5c\uff5e\uffe2\uffe4\uffe8-\uffee\ufffc-\ufffd]+') + + letter = (u'[a-zA-Z\\$_\u00aa\u00b5\u00ba\u00c0-\u00d6\u00d8-\u00f6' + u'\u00f8-\u02af\u0370-\u0373\u0376-\u0377\u037b-\u037d\u0386' + u'\u0388-\u03f5\u03f7-\u0481\u048a-\u0556\u0561-\u0587\u05d0-\u05f2' + u'\u0621-\u063f\u0641-\u064a\u066e-\u066f\u0671-\u06d3\u06d5' + u'\u06ee-\u06ef\u06fa-\u06fc\u06ff\u0710\u0712-\u072f\u074d-\u07a5' + u'\u07b1\u07ca-\u07ea\u0904-\u0939\u093d\u0950\u0958-\u0961' + u'\u0972-\u097f\u0985-\u09b9\u09bd\u09ce\u09dc-\u09e1\u09f0-\u09f1' + u'\u0a05-\u0a39\u0a59-\u0a5e\u0a72-\u0a74\u0a85-\u0ab9\u0abd' + u'\u0ad0-\u0ae1\u0b05-\u0b39\u0b3d\u0b5c-\u0b61\u0b71\u0b83-\u0bb9' + u'\u0bd0\u0c05-\u0c3d\u0c58-\u0c61\u0c85-\u0cb9\u0cbd\u0cde-\u0ce1' + u'\u0d05-\u0d3d\u0d60-\u0d61\u0d7a-\u0d7f\u0d85-\u0dc6\u0e01-\u0e30' + u'\u0e32-\u0e33\u0e40-\u0e45\u0e81-\u0eb0\u0eb2-\u0eb3\u0ebd-\u0ec4' + u'\u0edc-\u0f00\u0f40-\u0f6c\u0f88-\u0f8b\u1000-\u102a\u103f' + u'\u1050-\u1055\u105a-\u105d\u1061\u1065-\u1066\u106e-\u1070' + u'\u1075-\u1081\u108e\u10a0-\u10fa\u1100-\u135a\u1380-\u138f' + u'\u13a0-\u166c\u166f-\u1676\u1681-\u169a\u16a0-\u16ea\u16ee-\u1711' + u'\u1720-\u1731\u1740-\u1751\u1760-\u1770\u1780-\u17b3\u17dc' + u'\u1820-\u1842\u1844-\u18a8\u18aa-\u191c\u1950-\u19a9\u19c1-\u19c7' + u'\u1a00-\u1a16\u1b05-\u1b33\u1b45-\u1b4b\u1b83-\u1ba0\u1bae-\u1baf' + u'\u1c00-\u1c23\u1c4d-\u1c4f\u1c5a-\u1c77\u1d00-\u1d2b\u1d62-\u1d77' + u'\u1d79-\u1d9a\u1e00-\u1fbc\u1fbe\u1fc2-\u1fcc\u1fd0-\u1fdb' + u'\u1fe0-\u1fec\u1ff2-\u1ffc\u2071\u207f\u2102\u2107\u210a-\u2113' + u'\u2115\u2119-\u211d\u2124\u2126\u2128\u212a-\u212d\u212f-\u2139' + u'\u213c-\u213f\u2145-\u2149\u214e\u2160-\u2188\u2c00-\u2c7c' + u'\u2c80-\u2ce4\u2d00-\u2d65\u2d80-\u2dde\u3006-\u3007\u3021-\u3029' + u'\u3038-\u303a\u303c\u3041-\u3096\u309f\u30a1-\u30fa\u30ff-\u318e' + u'\u31a0-\u31b7\u31f0-\u31ff\u3400-\u4db5\u4e00-\ua014\ua016-\ua48c' + u'\ua500-\ua60b\ua610-\ua61f\ua62a-\ua66e\ua680-\ua697\ua722-\ua76f' + u'\ua771-\ua787\ua78b-\ua801\ua803-\ua805\ua807-\ua80a\ua80c-\ua822' + u'\ua840-\ua873\ua882-\ua8b3\ua90a-\ua925\ua930-\ua946\uaa00-\uaa28' + u'\uaa40-\uaa42\uaa44-\uaa4b\uac00-\ud7a3\uf900-\ufb1d\ufb1f-\ufb28' + u'\ufb2a-\ufd3d\ufd50-\ufdfb\ufe70-\ufefc\uff21-\uff3a\uff41-\uff5a' + u'\uff66-\uff6f\uff71-\uff9d\uffa0-\uffdc]') + + upper = (u'[A-Z\\$_\u00c0-\u00d6\u00d8-\u00de\u0100\u0102\u0104\u0106\u0108' + u'\u010a\u010c\u010e\u0110\u0112\u0114\u0116\u0118\u011a\u011c' + u'\u011e\u0120\u0122\u0124\u0126\u0128\u012a\u012c\u012e\u0130' + u'\u0132\u0134\u0136\u0139\u013b\u013d\u013f\u0141\u0143\u0145' + u'\u0147\u014a\u014c\u014e\u0150\u0152\u0154\u0156\u0158\u015a' + u'\u015c\u015e\u0160\u0162\u0164\u0166\u0168\u016a\u016c\u016e' + u'\u0170\u0172\u0174\u0176\u0178-\u0179\u017b\u017d\u0181-\u0182' + u'\u0184\u0186-\u0187\u0189-\u018b\u018e-\u0191\u0193-\u0194' + u'\u0196-\u0198\u019c-\u019d\u019f-\u01a0\u01a2\u01a4\u01a6-\u01a7' + u'\u01a9\u01ac\u01ae-\u01af\u01b1-\u01b3\u01b5\u01b7-\u01b8\u01bc' + u'\u01c4\u01c7\u01ca\u01cd\u01cf\u01d1\u01d3\u01d5\u01d7\u01d9' + u'\u01db\u01de\u01e0\u01e2\u01e4\u01e6\u01e8\u01ea\u01ec\u01ee' + u'\u01f1\u01f4\u01f6-\u01f8\u01fa\u01fc\u01fe\u0200\u0202\u0204' + u'\u0206\u0208\u020a\u020c\u020e\u0210\u0212\u0214\u0216\u0218' + u'\u021a\u021c\u021e\u0220\u0222\u0224\u0226\u0228\u022a\u022c' + u'\u022e\u0230\u0232\u023a-\u023b\u023d-\u023e\u0241\u0243-\u0246' + u'\u0248\u024a\u024c\u024e\u0370\u0372\u0376\u0386\u0388-\u038f' + u'\u0391-\u03ab\u03cf\u03d2-\u03d4\u03d8\u03da\u03dc\u03de\u03e0' + u'\u03e2\u03e4\u03e6\u03e8\u03ea\u03ec\u03ee\u03f4\u03f7' + u'\u03f9-\u03fa\u03fd-\u042f\u0460\u0462\u0464\u0466\u0468\u046a' + u'\u046c\u046e\u0470\u0472\u0474\u0476\u0478\u047a\u047c\u047e' + u'\u0480\u048a\u048c\u048e\u0490\u0492\u0494\u0496\u0498\u049a' + u'\u049c\u049e\u04a0\u04a2\u04a4\u04a6\u04a8\u04aa\u04ac\u04ae' + u'\u04b0\u04b2\u04b4\u04b6\u04b8\u04ba\u04bc\u04be\u04c0-\u04c1' + u'\u04c3\u04c5\u04c7\u04c9\u04cb\u04cd\u04d0\u04d2\u04d4\u04d6' + u'\u04d8\u04da\u04dc\u04de\u04e0\u04e2\u04e4\u04e6\u04e8\u04ea' + u'\u04ec\u04ee\u04f0\u04f2\u04f4\u04f6\u04f8\u04fa\u04fc\u04fe' + u'\u0500\u0502\u0504\u0506\u0508\u050a\u050c\u050e\u0510\u0512' + u'\u0514\u0516\u0518\u051a\u051c\u051e\u0520\u0522\u0531-\u0556' + u'\u10a0-\u10c5\u1e00\u1e02\u1e04\u1e06\u1e08\u1e0a\u1e0c\u1e0e' + u'\u1e10\u1e12\u1e14\u1e16\u1e18\u1e1a\u1e1c\u1e1e\u1e20\u1e22' + u'\u1e24\u1e26\u1e28\u1e2a\u1e2c\u1e2e\u1e30\u1e32\u1e34\u1e36' + u'\u1e38\u1e3a\u1e3c\u1e3e\u1e40\u1e42\u1e44\u1e46\u1e48\u1e4a' + u'\u1e4c\u1e4e\u1e50\u1e52\u1e54\u1e56\u1e58\u1e5a\u1e5c\u1e5e' + u'\u1e60\u1e62\u1e64\u1e66\u1e68\u1e6a\u1e6c\u1e6e\u1e70\u1e72' + u'\u1e74\u1e76\u1e78\u1e7a\u1e7c\u1e7e\u1e80\u1e82\u1e84\u1e86' + u'\u1e88\u1e8a\u1e8c\u1e8e\u1e90\u1e92\u1e94\u1e9e\u1ea0\u1ea2' + u'\u1ea4\u1ea6\u1ea8\u1eaa\u1eac\u1eae\u1eb0\u1eb2\u1eb4\u1eb6' + u'\u1eb8\u1eba\u1ebc\u1ebe\u1ec0\u1ec2\u1ec4\u1ec6\u1ec8\u1eca' + u'\u1ecc\u1ece\u1ed0\u1ed2\u1ed4\u1ed6\u1ed8\u1eda\u1edc\u1ede' + u'\u1ee0\u1ee2\u1ee4\u1ee6\u1ee8\u1eea\u1eec\u1eee\u1ef0\u1ef2' + u'\u1ef4\u1ef6\u1ef8\u1efa\u1efc\u1efe\u1f08-\u1f0f\u1f18-\u1f1d' + u'\u1f28-\u1f2f\u1f38-\u1f3f\u1f48-\u1f4d\u1f59-\u1f5f' + u'\u1f68-\u1f6f\u1fb8-\u1fbb\u1fc8-\u1fcb\u1fd8-\u1fdb' + u'\u1fe8-\u1fec\u1ff8-\u1ffb\u2102\u2107\u210b-\u210d\u2110-\u2112' + u'\u2115\u2119-\u211d\u2124\u2126\u2128\u212a-\u212d\u2130-\u2133' + u'\u213e-\u213f\u2145\u2183\u2c00-\u2c2e\u2c60\u2c62-\u2c64\u2c67' + u'\u2c69\u2c6b\u2c6d-\u2c6f\u2c72\u2c75\u2c80\u2c82\u2c84\u2c86' + u'\u2c88\u2c8a\u2c8c\u2c8e\u2c90\u2c92\u2c94\u2c96\u2c98\u2c9a' + u'\u2c9c\u2c9e\u2ca0\u2ca2\u2ca4\u2ca6\u2ca8\u2caa\u2cac\u2cae' + u'\u2cb0\u2cb2\u2cb4\u2cb6\u2cb8\u2cba\u2cbc\u2cbe\u2cc0\u2cc2' + u'\u2cc4\u2cc6\u2cc8\u2cca\u2ccc\u2cce\u2cd0\u2cd2\u2cd4\u2cd6' + u'\u2cd8\u2cda\u2cdc\u2cde\u2ce0\u2ce2\ua640\ua642\ua644\ua646' + u'\ua648\ua64a\ua64c\ua64e\ua650\ua652\ua654\ua656\ua658\ua65a' + u'\ua65c\ua65e\ua662\ua664\ua666\ua668\ua66a\ua66c\ua680\ua682' + u'\ua684\ua686\ua688\ua68a\ua68c\ua68e\ua690\ua692\ua694\ua696' + u'\ua722\ua724\ua726\ua728\ua72a\ua72c\ua72e\ua732\ua734\ua736' + u'\ua738\ua73a\ua73c\ua73e\ua740\ua742\ua744\ua746\ua748\ua74a' + u'\ua74c\ua74e\ua750\ua752\ua754\ua756\ua758\ua75a\ua75c\ua75e' + u'\ua760\ua762\ua764\ua766\ua768\ua76a\ua76c\ua76e\ua779\ua77b' + u'\ua77d-\ua77e\ua780\ua782\ua784\ua786\ua78b\uff21-\uff3a]') + + idrest = u'%s(?:%s|[0-9])*(?:(?<=_)%s)?' % (letter, letter, op) + letter_letter_digit = u'%s(?:%s|\d)*' % (letter, letter) + + tokens = { + 'root': [ + # method names + (r'(class|trait|object)(\s+)', bygroups(Keyword, Text), 'class'), + (r'[^\S\n]+', Text), + (r'//.*?\n', Comment.Single), + (r'/\*', Comment.Multiline, 'comment'), + (u'@%s' % idrest, Name.Decorator), + (u'(abstract|ca(?:se|tch)|d(?:ef|o)|e(?:lse|xtends)|' + u'f(?:inal(?:ly)?|or(?:Some)?)|i(?:f|mplicit)|' + u'lazy|match|new|override|pr(?:ivate|otected)' + u'|re(?:quires|turn)|s(?:ealed|uper)|' + u't(?:h(?:is|row)|ry)|va[lr]|w(?:hile|ith)|yield)\\b|' + u'(<[%:-]|=>|>:|[#=@_\u21D2\u2190])(\\b|(?=\\s)|$)', Keyword), + (u':(?!%s)' % op, Keyword, 'type'), + (u'%s%s\\b' % (upper, idrest), Name.Class), + (r'(true|false|null)\b', Keyword.Constant), + (r'(import|package)(\s+)', bygroups(Keyword, Text), 'import'), + (r'(type)(\s+)', bygroups(Keyword, Text), 'type'), + (r'""".*?"""(?!")', String), + (r'"(\\\\|\\"|[^"])*"', String), + (r"'\\.'|'[^\\]'|'\\u[0-9a-fA-F]{4}'", String.Char), + (u"'%s" % idrest, Text.Symbol), + (r'[fs]"""', String, 'interptriplestring'), # interpolated strings + (r'[fs]"', String, 'interpstring'), # interpolated strings + (r'raw"(\\\\|\\"|[^"])*"', String), # raw strings + # (ur'(\.)(%s|%s|`[^`]+`)' % (idrest, op), bygroups(Operator, + # Name.Attribute)), + (idrest, Name), + (r'`[^`]+`', Name), + (r'\[', Operator, 'typeparam'), + (r'[(){};,.#]', Operator), + (op, Operator), + (r'([0-9][0-9]*\.[0-9]*|\.[0-9]+)([eE][+-]?[0-9]+)?[fFdD]?', + Number.Float), + (r'0x[0-9a-fA-F]+', Number.Hex), + (r'[0-9]+L?', Number.Integer), + (r'\n', Text) + ], + 'class': [ + (u'(%s|%s|`[^`]+`)(\\s*)(\\[)' % (idrest, op), + bygroups(Name.Class, Text, Operator), 'typeparam'), + (r'\s+', Text), + (r'\{', Operator, '#pop'), + (r'\(', Operator, '#pop'), + (r'//.*?\n', Comment.Single, '#pop'), + (u'%s|%s|`[^`]+`' % (idrest, op), Name.Class, '#pop'), + ], + 'type': [ + (r'\s+', Text), + (r'<[%:]|>:|[#_]|forSome|type', Keyword), + (u'([,);}]|=>|=|\u21d2)(\\s*)', bygroups(Operator, Text), '#pop'), + (r'[({]', Operator, '#push'), + (u'((?:%s|%s|`[^`]+`)(?:\\.(?:%s|%s|`[^`]+`))*)(\\s*)(\\[)' % + (idrest, op, idrest, op), + bygroups(Keyword.Type, Text, Operator), ('#pop', 'typeparam')), + (u'((?:%s|%s|`[^`]+`)(?:\\.(?:%s|%s|`[^`]+`))*)(\\s*)$' % + (idrest, op, idrest, op), + bygroups(Keyword.Type, Text), '#pop'), + (r'//.*?\n', Comment.Single, '#pop'), + (u'\\.|%s|%s|`[^`]+`' % (idrest, op), Keyword.Type) + ], + 'typeparam': [ + (r'[\s,]+', Text), + (u'<[%:]|=>|>:|[#_\u21D2]|forSome|type', Keyword), + (r'([\])}])', Operator, '#pop'), + (r'[(\[{]', Operator, '#push'), + (u'\\.|%s|%s|`[^`]+`' % (idrest, op), Keyword.Type) + ], + 'comment': [ + (r'[^/*]+', Comment.Multiline), + (r'/\*', Comment.Multiline, '#push'), + (r'\*/', Comment.Multiline, '#pop'), + (r'[*/]', Comment.Multiline) + ], + 'import': [ + (u'(%s|\\.)+' % idrest, Name.Namespace, '#pop') + ], + 'interpstringcommon': [ + (r'[^"$\\]+', String), + (r'\$\$', String), + (r'\$' + letter_letter_digit, String.Interpol), + (r'\$\{', String.Interpol, 'interpbrace'), + (r'\\.', String), + ], + 'interptriplestring': [ + (r'"""(?!")', String, '#pop'), + (r'"', String), + include('interpstringcommon'), + ], + 'interpstring': [ + (r'"', String, '#pop'), + include('interpstringcommon'), + ], + 'interpbrace': [ + (r'\}', String.Interpol, '#pop'), + (r'\{', String.Interpol, '#push'), + include('root'), + ], + } + + +class GosuLexer(RegexLexer): + """ + For Gosu source code. + + .. versionadded:: 1.5 + """ + + name = 'Gosu' + aliases = ['gosu'] + filenames = ['*.gs', '*.gsx', '*.gsp', '*.vark'] + mimetypes = ['text/x-gosu'] + + flags = re.MULTILINE | re.DOTALL + + tokens = { + 'root': [ + # method names + (r'^(\s*(?:[a-zA-Z_][\w.\[\]]*\s+)+?)' # modifiers etc. + r'([a-zA-Z_]\w*)' # method name + r'(\s*)(\()', # signature start + bygroups(using(this), Name.Function, Text, Operator)), + (r'[^\S\n]+', Text), + (r'//.*?\n', Comment.Single), + (r'/\*.*?\*/', Comment.Multiline), + (r'@[a-zA-Z_][\w.]*', Name.Decorator), + (r'(in|as|typeof|statictypeof|typeis|typeas|if|else|foreach|for|' + r'index|while|do|continue|break|return|try|catch|finally|this|' + r'throw|new|switch|case|default|eval|super|outer|classpath|' + r'using)\b', Keyword), + (r'(var|delegate|construct|function|private|internal|protected|' + r'public|abstract|override|final|static|extends|transient|' + r'implements|represents|readonly)\b', Keyword.Declaration), + (r'(property\s+)(get|set)?', Keyword.Declaration), + (r'(boolean|byte|char|double|float|int|long|short|void|block)\b', + Keyword.Type), + (r'(package)(\s+)', bygroups(Keyword.Namespace, Text)), + (r'(true|false|null|NaN|Infinity)\b', Keyword.Constant), + (r'(class|interface|enhancement|enum)(\s+)([a-zA-Z_]\w*)', + bygroups(Keyword.Declaration, Text, Name.Class)), + (r'(uses)(\s+)([\w.]+\*?)', + bygroups(Keyword.Namespace, Text, Name.Namespace)), + (r'"', String, 'string'), + (r'(\??[.#])([a-zA-Z_]\w*)', + bygroups(Operator, Name.Attribute)), + (r'(:)([a-zA-Z_]\w*)', + bygroups(Operator, Name.Attribute)), + (r'[a-zA-Z_$]\w*', Name), + (r'and|or|not|[\\~^*!%&\[\](){}<>|+=:;,./?-]', Operator), + (r'[0-9][0-9]*\.[0-9]+([eE][0-9]+)?[fd]?', Number.Float), + (r'[0-9]+', Number.Integer), + (r'\n', Text) + ], + 'templateText': [ + (r'(\\<)|(\\\$)', String), + (r'(<%@\s+)(extends|params)', + bygroups(Operator, Name.Decorator), 'stringTemplate'), + (r'<%!--.*?--%>', Comment.Multiline), + (r'(<%)|(<%=)', Operator, 'stringTemplate'), + (r'\$\{', Operator, 'stringTemplateShorthand'), + (r'.', String) + ], + 'string': [ + (r'"', String, '#pop'), + include('templateText') + ], + 'stringTemplate': [ + (r'"', String, 'string'), + (r'%>', Operator, '#pop'), + include('root') + ], + 'stringTemplateShorthand': [ + (r'"', String, 'string'), + (r'\{', Operator, 'stringTemplateShorthand'), + (r'\}', Operator, '#pop'), + include('root') + ], + } + + +class GosuTemplateLexer(Lexer): + """ + For Gosu templates. + + .. versionadded:: 1.5 + """ + + name = 'Gosu Template' + aliases = ['gst'] + filenames = ['*.gst'] + mimetypes = ['text/x-gosu-template'] + + def get_tokens_unprocessed(self, text): + lexer = GosuLexer() + stack = ['templateText'] + for item in lexer.get_tokens_unprocessed(text, stack): + yield item + + +class GroovyLexer(RegexLexer): + """ + For `Groovy `_ source code. + + .. versionadded:: 1.5 + """ + + name = 'Groovy' + aliases = ['groovy'] + filenames = ['*.groovy','*.gradle'] + mimetypes = ['text/x-groovy'] + + flags = re.MULTILINE | re.DOTALL + + tokens = { + 'root': [ + # Groovy allows a file to start with a shebang + (r'#!(.*?)$', Comment.Preproc, 'base'), + default('base'), + ], + 'base': [ + # method names + (r'^(\s*(?:[a-zA-Z_][\w.\[\]]*\s+)+?)' # return arguments + r'([a-zA-Z_]\w*)' # method name + r'(\s*)(\()', # signature start + bygroups(using(this), Name.Function, Text, Operator)), + (r'[^\S\n]+', Text), + (r'//.*?\n', Comment.Single), + (r'/\*.*?\*/', Comment.Multiline), + (r'@[a-zA-Z_][\w.]*', Name.Decorator), + (r'(assert|break|case|catch|continue|default|do|else|finally|for|' + r'if|goto|instanceof|new|return|switch|this|throw|try|while|in|as)\b', + Keyword), + (r'(abstract|const|enum|extends|final|implements|native|private|' + r'protected|public|static|strictfp|super|synchronized|throws|' + r'transient|volatile)\b', Keyword.Declaration), + (r'(def|boolean|byte|char|double|float|int|long|short|void)\b', + Keyword.Type), + (r'(package)(\s+)', bygroups(Keyword.Namespace, Text)), + (r'(true|false|null)\b', Keyword.Constant), + (r'(class|interface)(\s+)', bygroups(Keyword.Declaration, Text), + 'class'), + (r'(import)(\s+)', bygroups(Keyword.Namespace, Text), 'import'), + (r'""".*?"""', String.Double), + (r"'''.*?'''", String.Single), + (r'"(\\\\|\\"|[^"])*"', String.Double), + (r"'(\\\\|\\'|[^'])*'", String.Single), + (r'\$/((?!/\$).)*/\$', String), + (r'/(\\\\|\\"|[^/])*/', String), + (r"'\\.'|'[^\\]'|'\\u[0-9a-fA-F]{4}'", String.Char), + (r'(\.)([a-zA-Z_]\w*)', bygroups(Operator, Name.Attribute)), + (r'[a-zA-Z_]\w*:', Name.Label), + (r'[a-zA-Z_$]\w*', Name), + (r'[~^*!%&\[\](){}<>|+=:;,./?-]', Operator), + (r'[0-9][0-9]*\.[0-9]+([eE][0-9]+)?[fd]?', Number.Float), + (r'0x[0-9a-fA-F]+', Number.Hex), + (r'[0-9]+L?', Number.Integer), + (r'\n', Text) + ], + 'class': [ + (r'[a-zA-Z_]\w*', Name.Class, '#pop') + ], + 'import': [ + (r'[\w.]+\*?', Name.Namespace, '#pop') + ], + } + + def analyse_text(text): + return shebang_matches(text, r'groovy') + + +class IokeLexer(RegexLexer): + """ + For `Ioke `_ (a strongly typed, dynamic, + prototype based programming language) source. + + .. versionadded:: 1.4 + """ + name = 'Ioke' + filenames = ['*.ik'] + aliases = ['ioke', 'ik'] + mimetypes = ['text/x-iokesrc'] + tokens = { + 'interpolatableText': [ + (r'(\\b|\\e|\\t|\\n|\\f|\\r|\\"|\\\\|\\#|\\\Z|\\u[0-9a-fA-F]{1,4}' + r'|\\[0-3]?[0-7]?[0-7])', String.Escape), + (r'#\{', Punctuation, 'textInterpolationRoot') + ], + + 'text': [ + (r'(?>|\|\|>>|\*\*>>|:::|::|\.\.\.|===|\*\*>|\*\*=|&&>|&&=|' + r'\|\|>|\|\|=|\->>|\+>>|!>>|<>>>|<>>|&>>|%>>|#>>|@>>|/>>|\*>>|' + r'\?>>|\|>>|\^>>|~>>|\$>>|=>>|<<=|>>=|<=>|<\->|=~|!~|=>|\+\+|' + r'\-\-|<=|>=|==|!=|&&|\.\.|\+=|\-=|\*=|\/=|%=|&=|\^=|\|=|<\-|' + r'\+>|!>|<>|&>|%>|#>|\@>|\/>|\*>|\?>|\|>|\^>|~>|\$>|<\->|\->|' + r'<<|>>|\*\*|\?\||\?&|\|\||>|<|\*|\/|%|\+|\-|&|\^|\||=|\$|!|~|' + u'\\?|#|\u2260|\u2218|\u2208|\u2209)', Operator), + (r'(and|nand|or|xor|nor|return|import)(?![\w!?])', + Operator), + + # Punctuation + (r'(\`\`|\`|\'\'|\'|\.|\,|@@|@|\[|\]|\(|\)|\{|\})', Punctuation), + + # kinds + (r'[A-Z][\w!:?]*', Name.Class), + + # default cellnames + (r'[a-z_][\w!:?]*', Name) + ] + } + + +class ClojureLexer(RegexLexer): + """ + Lexer for `Clojure `_ source code. + + .. versionadded:: 0.11 + """ + name = 'Clojure' + aliases = ['clojure', 'clj'] + filenames = ['*.clj'] + mimetypes = ['text/x-clojure', 'application/x-clojure'] + + special_forms = ( + '.', 'def', 'do', 'fn', 'if', 'let', 'new', 'quote', 'var', 'loop' + ) + + # It's safe to consider 'ns' a declaration thing because it defines a new + # namespace. + declarations = ( + 'def-', 'defn', 'defn-', 'defmacro', 'defmulti', 'defmethod', + 'defstruct', 'defonce', 'declare', 'definline', 'definterface', + 'defprotocol', 'defrecord', 'deftype', 'defproject', 'ns' + ) + + builtins = ( + '*', '+', '-', '->', '/', '<', '<=', '=', '==', '>', '>=', '..', + 'accessor', 'agent', 'agent-errors', 'aget', 'alength', 'all-ns', + 'alter', 'and', 'append-child', 'apply', 'array-map', 'aset', + 'aset-boolean', 'aset-byte', 'aset-char', 'aset-double', 'aset-float', + 'aset-int', 'aset-long', 'aset-short', 'assert', 'assoc', 'await', + 'await-for', 'bean', 'binding', 'bit-and', 'bit-not', 'bit-or', + 'bit-shift-left', 'bit-shift-right', 'bit-xor', 'boolean', 'branch?', + 'butlast', 'byte', 'cast', 'char', 'children', 'class', + 'clear-agent-errors', 'comment', 'commute', 'comp', 'comparator', + 'complement', 'concat', 'conj', 'cons', 'constantly', 'cond', 'if-not', + 'construct-proxy', 'contains?', 'count', 'create-ns', 'create-struct', + 'cycle', 'dec', 'deref', 'difference', 'disj', 'dissoc', 'distinct', + 'doall', 'doc', 'dorun', 'doseq', 'dosync', 'dotimes', 'doto', + 'double', 'down', 'drop', 'drop-while', 'edit', 'end?', 'ensure', + 'eval', 'every?', 'false?', 'ffirst', 'file-seq', 'filter', 'find', + 'find-doc', 'find-ns', 'find-var', 'first', 'float', 'flush', 'for', + 'fnseq', 'frest', 'gensym', 'get-proxy-class', 'get', + 'hash-map', 'hash-set', 'identical?', 'identity', 'if-let', 'import', + 'in-ns', 'inc', 'index', 'insert-child', 'insert-left', 'insert-right', + 'inspect-table', 'inspect-tree', 'instance?', 'int', 'interleave', + 'intersection', 'into', 'into-array', 'iterate', 'join', 'key', 'keys', + 'keyword', 'keyword?', 'last', 'lazy-cat', 'lazy-cons', 'left', + 'lefts', 'line-seq', 'list*', 'list', 'load', 'load-file', + 'locking', 'long', 'loop', 'macroexpand', 'macroexpand-1', + 'make-array', 'make-node', 'map', 'map-invert', 'map?', 'mapcat', + 'max', 'max-key', 'memfn', 'merge', 'merge-with', 'meta', 'min', + 'min-key', 'name', 'namespace', 'neg?', 'new', 'newline', 'next', + 'nil?', 'node', 'not', 'not-any?', 'not-every?', 'not=', 'ns-imports', + 'ns-interns', 'ns-map', 'ns-name', 'ns-publics', 'ns-refers', + 'ns-resolve', 'ns-unmap', 'nth', 'nthrest', 'or', 'parse', 'partial', + 'path', 'peek', 'pop', 'pos?', 'pr', 'pr-str', 'print', 'print-str', + 'println', 'println-str', 'prn', 'prn-str', 'project', 'proxy', + 'proxy-mappings', 'quot', 'rand', 'rand-int', 'range', 're-find', + 're-groups', 're-matcher', 're-matches', 're-pattern', 're-seq', + 'read', 'read-line', 'reduce', 'ref', 'ref-set', 'refer', 'rem', + 'remove', 'remove-method', 'remove-ns', 'rename', 'rename-keys', + 'repeat', 'replace', 'replicate', 'resolve', 'rest', 'resultset-seq', + 'reverse', 'rfirst', 'right', 'rights', 'root', 'rrest', 'rseq', + 'second', 'select', 'select-keys', 'send', 'send-off', 'seq', + 'seq-zip', 'seq?', 'set', 'short', 'slurp', 'some', 'sort', + 'sort-by', 'sorted-map', 'sorted-map-by', 'sorted-set', + 'special-symbol?', 'split-at', 'split-with', 'str', 'string?', + 'struct', 'struct-map', 'subs', 'subvec', 'symbol', 'symbol?', + 'sync', 'take', 'take-nth', 'take-while', 'test', 'time', 'to-array', + 'to-array-2d', 'tree-seq', 'true?', 'union', 'up', 'update-proxy', + 'val', 'vals', 'var-get', 'var-set', 'var?', 'vector', 'vector-zip', + 'vector?', 'when', 'when-first', 'when-let', 'when-not', + 'with-local-vars', 'with-meta', 'with-open', 'with-out-str', + 'xml-seq', 'xml-zip', 'zero?', 'zipmap', 'zipper') + + # valid names for identifiers + # well, names can only not consist fully of numbers + # but this should be good enough for now + + # TODO / should divide keywords/symbols into namespace/rest + # but that's hard, so just pretend / is part of the name + valid_name = r'(?!#)[\w!$%*+<=>?/.#-]+' + + tokens = { + 'root': [ + # the comments - always starting with semicolon + # and going to the end of the line + (r';.*$', Comment.Single), + + # whitespaces - usually not relevant + (r'[,\s]+', Text), + + # numbers + (r'-?\d+\.\d+', Number.Float), + (r'-?\d+', Number.Integer), + (r'0x-?[abcdef\d]+', Number.Hex), + + # strings, symbols and characters + (r'"(\\\\|\\"|[^"])*"', String), + (r"'" + valid_name, String.Symbol), + (r"\\(.|[a-z]+)", String.Char), + + # keywords + (r'::?#?' + valid_name, String.Symbol), + + # special operators + (r'~@|[`\'#^~&@]', Operator), + + # highlight the special forms + (words(special_forms, suffix=' '), Keyword), + + # Technically, only the special forms are 'keywords'. The problem + # is that only treating them as keywords means that things like + # 'defn' and 'ns' need to be highlighted as builtins. This is ugly + # and weird for most styles. So, as a compromise we're going to + # highlight them as Keyword.Declarations. + (words(declarations, suffix=' '), Keyword.Declaration), + + # highlight the builtins + (words(builtins, suffix=' '), Name.Builtin), + + # the remaining functions + (r'(?<=\()' + valid_name, Name.Function), + + # find the remaining variables + (valid_name, Name.Variable), + + # Clojure accepts vector notation + (r'(\[|\])', Punctuation), + + # Clojure accepts map notation + (r'(\{|\})', Punctuation), + + # the famous parentheses! + (r'(\(|\))', Punctuation), + ], + } + + +class ClojureScriptLexer(ClojureLexer): + """ + Lexer for `ClojureScript `_ + source code. + + .. versionadded:: 2.0 + """ + name = 'ClojureScript' + aliases = ['clojurescript', 'cljs'] + filenames = ['*.cljs'] + mimetypes = ['text/x-clojurescript', 'application/x-clojurescript'] + + +class TeaLangLexer(RegexLexer): + """ + For `Tea `_ source code. Only used within a + TeaTemplateLexer. + + .. versionadded:: 1.5 + """ + + flags = re.MULTILINE | re.DOTALL + + tokens = { + 'root': [ + # method names + (r'^(\s*(?:[a-zA-Z_][\w\.\[\]]*\s+)+?)' # return arguments + r'([a-zA-Z_]\w*)' # method name + r'(\s*)(\()', # signature start + bygroups(using(this), Name.Function, Text, Operator)), + (r'[^\S\n]+', Text), + (r'//.*?\n', Comment.Single), + (r'/\*.*?\*/', Comment.Multiline), + (r'@[a-zA-Z_][\w\.]*', Name.Decorator), + (r'(and|break|else|foreach|if|in|not|or|reverse)\b', + Keyword), + (r'(as|call|define)\b', Keyword.Declaration), + (r'(true|false|null)\b', Keyword.Constant), + (r'(template)(\s+)', bygroups(Keyword.Declaration, Text), 'template'), + (r'(import)(\s+)', bygroups(Keyword.Namespace, Text), 'import'), + (r'"(\\\\|\\"|[^"])*"', String), + (r'\'(\\\\|\\\'|[^\'])*\'', String), + (r'(\.)([a-zA-Z_]\w*)', bygroups(Operator, Name.Attribute)), + (r'[a-zA-Z_]\w*:', Name.Label), + (r'[a-zA-Z_\$]\w*', Name), + (r'(isa|[.]{3}|[.]{2}|[=#!<>+-/%&;,.\*\\\(\)\[\]\{\}])', Operator), + (r'[0-9][0-9]*\.[0-9]+([eE][0-9]+)?[fd]?', Number.Float), + (r'0x[0-9a-fA-F]+', Number.Hex), + (r'[0-9]+L?', Number.Integer), + (r'\n', Text) + ], + 'template': [ + (r'[a-zA-Z_]\w*', Name.Class, '#pop') + ], + 'import': [ + (r'[\w.]+\*?', Name.Namespace, '#pop') + ], + } + + +class CeylonLexer(RegexLexer): + """ + For `Ceylon `_ source code. + + .. versionadded:: 1.6 + """ + + name = 'Ceylon' + aliases = ['ceylon'] + filenames = ['*.ceylon'] + mimetypes = ['text/x-ceylon'] + + flags = re.MULTILINE | re.DOTALL + + #: optional Comment or Whitespace + _ws = r'(?:\s|//.*?\n|/[*].*?[*]/)+' + + tokens = { + 'root': [ + # method names + (r'^(\s*(?:[a-zA-Z_][\w.\[\]]*\s+)+?)' # return arguments + r'([a-zA-Z_]\w*)' # method name + r'(\s*)(\()', # signature start + bygroups(using(this), Name.Function, Text, Operator)), + (r'[^\S\n]+', Text), + (r'//.*?\n', Comment.Single), + (r'/\*', Comment.Multiline, 'comment'), + (r'(shared|abstract|formal|default|actual|variable|deprecated|small|' + r'late|literal|doc|by|see|throws|optional|license|tagged|final|native|' + r'annotation|sealed)\b', Name.Decorator), + (r'(break|case|catch|continue|else|finally|for|in|' + r'if|return|switch|this|throw|try|while|is|exists|dynamic|' + r'nonempty|then|outer|assert|let)\b', Keyword), + (r'(abstracts|extends|satisfies|' + r'super|given|of|out|assign)\b', Keyword.Declaration), + (r'(function|value|void|new)\b', + Keyword.Type), + (r'(assembly|module|package)(\s+)', bygroups(Keyword.Namespace, Text)), + (r'(true|false|null)\b', Keyword.Constant), + (r'(class|interface|object|alias)(\s+)', + bygroups(Keyword.Declaration, Text), 'class'), + (r'(import)(\s+)', bygroups(Keyword.Namespace, Text), 'import'), + (r'"(\\\\|\\"|[^"])*"', String), + (r"'\\.'|'[^\\]'|'\\\{#[0-9a-fA-F]{4}\}'", String.Char), + (r'".*``.*``.*"', String.Interpol), + (r'(\.)([a-z_]\w*)', + bygroups(Operator, Name.Attribute)), + (r'[a-zA-Z_]\w*:', Name.Label), + (r'[a-zA-Z_]\w*', Name), + (r'[~^*!%&\[\](){}<>|+=:;,./?-]', Operator), + (r'\d{1,3}(_\d{3})+\.\d{1,3}(_\d{3})+[kMGTPmunpf]?', Number.Float), + (r'\d{1,3}(_\d{3})+\.[0-9]+([eE][+-]?[0-9]+)?[kMGTPmunpf]?', + Number.Float), + (r'[0-9][0-9]*\.\d{1,3}(_\d{3})+[kMGTPmunpf]?', Number.Float), + (r'[0-9][0-9]*\.[0-9]+([eE][+-]?[0-9]+)?[kMGTPmunpf]?', + Number.Float), + (r'#([0-9a-fA-F]{4})(_[0-9a-fA-F]{4})+', Number.Hex), + (r'#[0-9a-fA-F]+', Number.Hex), + (r'\$([01]{4})(_[01]{4})+', Number.Bin), + (r'\$[01]+', Number.Bin), + (r'\d{1,3}(_\d{3})+[kMGTP]?', Number.Integer), + (r'[0-9]+[kMGTP]?', Number.Integer), + (r'\n', Text) + ], + 'class': [ + (r'[A-Za-z_]\w*', Name.Class, '#pop') + ], + 'import': [ + (r'[a-z][\w.]*', + Name.Namespace, '#pop') + ], + 'comment': [ + (r'[^*/]', Comment.Multiline), + (r'/\*', Comment.Multiline, '#push'), + (r'\*/', Comment.Multiline, '#pop'), + (r'[*/]', Comment.Multiline) + ], + } + + +class KotlinLexer(RegexLexer): + """ + For `Kotlin `_ + source code. + + .. versionadded:: 1.5 + """ + + name = 'Kotlin' + aliases = ['kotlin'] + filenames = ['*.kt'] + mimetypes = ['text/x-kotlin'] + + flags = re.MULTILINE | re.DOTALL | re.UNICODE + + kt_name = ('@?[_' + uni.combine('Lu', 'Ll', 'Lt', 'Lm', 'Nl') + ']' + + '[' + uni.combine('Lu', 'Ll', 'Lt', 'Lm', 'Nl', 'Nd', 'Pc', 'Cf', + 'Mn', 'Mc') + ']*') + kt_id = '(' + kt_name + '|`' + kt_name + '`)' + + tokens = { + 'root': [ + (r'^\s*\[.*?\]', Name.Attribute), + (r'[^\S\n]+', Text), + (r'\\\n', Text), # line continuation + (r'//.*?\n', Comment.Single), + (r'/[*].*?[*]/', Comment.Multiline), + (r'\n', Text), + (r'::|!!|\?[:.]', Operator), + (r'[~!%^&*()+=|\[\]:;,.<>/?-]', Punctuation), + (r'[{}]', Punctuation), + (r'@"(""|[^"])*"', String), + (r'"(\\\\|\\"|[^"\n])*["\n]', String), + (r"'\\.'|'[^\\]'", String.Char), + (r"[0-9](\.[0-9]*)?([eE][+-][0-9]+)?[flFL]?|" + r"0[xX][0-9a-fA-F]+[Ll]?", Number), + (r'(class)(\s+)(object)', bygroups(Keyword, Text, Keyword)), + (r'(class|interface|object)(\s+)', bygroups(Keyword, Text), 'class'), + (r'(package|import)(\s+)', bygroups(Keyword, Text), 'package'), + (r'(val|var)(\s+)', bygroups(Keyword, Text), 'property'), + (r'(fun)(\s+)', bygroups(Keyword, Text), 'function'), + (r'(abstract|annotation|as|break|by|catch|class|companion|const|' + r'constructor|continue|crossinline|data|do|dynamic|else|enum|' + r'external|false|final|finally|for|fun|get|if|import|in|infix|' + r'inline|inner|interface|internal|is|lateinit|noinline|null|' + r'object|open|operator|out|override|package|private|protected|' + r'public|reified|return|sealed|set|super|tailrec|this|throw|' + r'true|try|val|var|vararg|when|where|while)\b', Keyword), + (kt_id, Name), + ], + 'package': [ + (r'\S+', Name.Namespace, '#pop') + ], + 'class': [ + (kt_id, Name.Class, '#pop') + ], + 'property': [ + (kt_id, Name.Property, '#pop') + ], + 'function': [ + (kt_id, Name.Function, '#pop') + ], + } + + +class XtendLexer(RegexLexer): + """ + For `Xtend `_ source code. + + .. versionadded:: 1.6 + """ + + name = 'Xtend' + aliases = ['xtend'] + filenames = ['*.xtend'] + mimetypes = ['text/x-xtend'] + + flags = re.MULTILINE | re.DOTALL + + tokens = { + 'root': [ + # method names + (r'^(\s*(?:[a-zA-Z_][\w.\[\]]*\s+)+?)' # return arguments + r'([a-zA-Z_$][\w$]*)' # method name + r'(\s*)(\()', # signature start + bygroups(using(this), Name.Function, Text, Operator)), + (r'[^\S\n]+', Text), + (r'//.*?\n', Comment.Single), + (r'/\*.*?\*/', Comment.Multiline), + (r'@[a-zA-Z_][\w.]*', Name.Decorator), + (r'(assert|break|case|catch|continue|default|do|else|finally|for|' + r'if|goto|instanceof|new|return|switch|this|throw|try|while|IF|' + r'ELSE|ELSEIF|ENDIF|FOR|ENDFOR|SEPARATOR|BEFORE|AFTER)\b', + Keyword), + (r'(def|abstract|const|enum|extends|final|implements|native|private|' + r'protected|public|static|strictfp|super|synchronized|throws|' + r'transient|volatile)\b', Keyword.Declaration), + (r'(boolean|byte|char|double|float|int|long|short|void)\b', + Keyword.Type), + (r'(package)(\s+)', bygroups(Keyword.Namespace, Text)), + (r'(true|false|null)\b', Keyword.Constant), + (r'(class|interface)(\s+)', bygroups(Keyword.Declaration, Text), + 'class'), + (r'(import)(\s+)', bygroups(Keyword.Namespace, Text), 'import'), + (r"(''')", String, 'template'), + (u'(\u00BB)', String, 'template'), + (r'"(\\\\|\\"|[^"])*"', String), + (r"'(\\\\|\\'|[^'])*'", String), + (r'[a-zA-Z_]\w*:', Name.Label), + (r'[a-zA-Z_$]\w*', Name), + (r'[~^*!%&\[\](){}<>\|+=:;,./?-]', Operator), + (r'[0-9][0-9]*\.[0-9]+([eE][0-9]+)?[fd]?', Number.Float), + (r'0x[0-9a-fA-F]+', Number.Hex), + (r'[0-9]+L?', Number.Integer), + (r'\n', Text) + ], + 'class': [ + (r'[a-zA-Z_]\w*', Name.Class, '#pop') + ], + 'import': [ + (r'[\w.]+\*?', Name.Namespace, '#pop') + ], + 'template': [ + (r"'''", String, '#pop'), + (u'\u00AB', String, '#pop'), + (r'.', String) + ], + } + + +class PigLexer(RegexLexer): + """ + For `Pig Latin `_ source code. + + .. versionadded:: 2.0 + """ + + name = 'Pig' + aliases = ['pig'] + filenames = ['*.pig'] + mimetypes = ['text/x-pig'] + + flags = re.MULTILINE | re.IGNORECASE + + tokens = { + 'root': [ + (r'\s+', Text), + (r'--.*', Comment), + (r'/\*[\w\W]*?\*/', Comment.Multiline), + (r'\\\n', Text), + (r'\\', Text), + (r'\'(?:\\[ntbrf\\\']|\\u[0-9a-f]{4}|[^\'\\\n\r])*\'', String), + include('keywords'), + include('types'), + include('builtins'), + include('punct'), + include('operators'), + (r'[0-9]*\.[0-9]+(e[0-9]+)?[fd]?', Number.Float), + (r'0x[0-9a-f]+', Number.Hex), + (r'[0-9]+L?', Number.Integer), + (r'\n', Text), + (r'([a-z_]\w*)(\s*)(\()', + bygroups(Name.Function, Text, Punctuation)), + (r'[()#:]', Text), + (r'[^(:#\'")\s]+', Text), + (r'\S+\s+', Text) # TODO: make tests pass without \s+ + ], + 'keywords': [ + (r'(assert|and|any|all|arrange|as|asc|bag|by|cache|CASE|cat|cd|cp|' + r'%declare|%default|define|dense|desc|describe|distinct|du|dump|' + r'eval|exex|explain|filter|flatten|foreach|full|generate|group|' + r'help|if|illustrate|import|inner|input|into|is|join|kill|left|' + r'limit|load|ls|map|matches|mkdir|mv|not|null|onschema|or|order|' + r'outer|output|parallel|pig|pwd|quit|register|returns|right|rm|' + r'rmf|rollup|run|sample|set|ship|split|stderr|stdin|stdout|store|' + r'stream|through|union|using|void)\b', Keyword) + ], + 'builtins': [ + (r'(AVG|BinStorage|cogroup|CONCAT|copyFromLocal|copyToLocal|COUNT|' + r'cross|DIFF|MAX|MIN|PigDump|PigStorage|SIZE|SUM|TextLoader|' + r'TOKENIZE)\b', Name.Builtin) + ], + 'types': [ + (r'(bytearray|BIGINTEGER|BIGDECIMAL|chararray|datetime|double|float|' + r'int|long|tuple)\b', Keyword.Type) + ], + 'punct': [ + (r'[;(){}\[\]]', Punctuation), + ], + 'operators': [ + (r'[#=,./%+\-?]', Operator), + (r'(eq|gt|lt|gte|lte|neq|matches)\b', Operator), + (r'(==|<=|<|>=|>|!=)', Operator), + ], + } + + +class GoloLexer(RegexLexer): + """ + For `Golo `_ source code. + + .. versionadded:: 2.0 + """ + + name = 'Golo' + filenames = ['*.golo'] + aliases = ['golo'] + + tokens = { + 'root': [ + (r'[^\S\n]+', Text), + + (r'#.*$', Comment), + + (r'(\^|\.\.\.|:|\?:|->|==|!=|=|\+|\*|%|/|<=|<|>=|>|=|\.)', + Operator), + (r'(?<=[^-])(-)(?=[^-])', Operator), + + (r'(?<=[^`])(is|isnt|and|or|not|oftype|in|orIfNull)\b', Operator.Word), + (r'[]{}|(),[]', Punctuation), + + (r'(module|import)(\s+)', + bygroups(Keyword.Namespace, Text), + 'modname'), + (r'\b([a-zA-Z_][\w$.]*)(::)', bygroups(Name.Namespace, Punctuation)), + (r'\b([a-zA-Z_][\w$]*(?:\.[a-zA-Z_][\w$]*)+)\b', Name.Namespace), + + (r'(let|var)(\s+)', + bygroups(Keyword.Declaration, Text), + 'varname'), + (r'(struct)(\s+)', + bygroups(Keyword.Declaration, Text), + 'structname'), + (r'(function)(\s+)', + bygroups(Keyword.Declaration, Text), + 'funcname'), + + (r'(null|true|false)\b', Keyword.Constant), + (r'(augment|pimp' + r'|if|else|case|match|return' + r'|case|when|then|otherwise' + r'|while|for|foreach' + r'|try|catch|finally|throw' + r'|local' + r'|continue|break)\b', Keyword), + + (r'(map|array|list|set|vector|tuple)(\[)', + bygroups(Name.Builtin, Punctuation)), + (r'(print|println|readln|raise|fun' + r'|asInterfaceInstance)\b', Name.Builtin), + (r'(`?[a-zA-Z_][\w$]*)(\()', + bygroups(Name.Function, Punctuation)), + + (r'-?[\d_]*\.[\d_]*([eE][+-]?\d[\d_]*)?F?', Number.Float), + (r'0[0-7]+j?', Number.Oct), + (r'0[xX][a-fA-F0-9]+', Number.Hex), + (r'-?\d[\d_]*L', Number.Integer.Long), + (r'-?\d[\d_]*', Number.Integer), + + ('`?[a-zA-Z_][\w$]*', Name), + (r'@[a-zA-Z_][\w$.]*', Name.Decorator), + + (r'"""', String, combined('stringescape', 'triplestring')), + (r'"', String, combined('stringescape', 'doublestring')), + (r"'", String, combined('stringescape', 'singlestring')), + (r'----((.|\n)*?)----', String.Doc) + + ], + + 'funcname': [ + (r'`?[a-zA-Z_][\w$]*', Name.Function, '#pop'), + ], + 'modname': [ + (r'[a-zA-Z_][\w$.]*\*?', Name.Namespace, '#pop') + ], + 'structname': [ + (r'`?[\w.]+\*?', Name.Class, '#pop') + ], + 'varname': [ + (r'`?[a-zA-Z_][\w$]*', Name.Variable, '#pop'), + ], + 'string': [ + (r'[^\\\'"\n]+', String), + (r'[\'"\\]', String) + ], + 'stringescape': [ + (r'\\([\\abfnrtv"\']|\n|N\{.*?\}|u[a-fA-F0-9]{4}|' + r'U[a-fA-F0-9]{8}|x[a-fA-F0-9]{2}|[0-7]{1,3})', String.Escape) + ], + 'triplestring': [ + (r'"""', String, '#pop'), + include('string'), + (r'\n', String), + ], + 'doublestring': [ + (r'"', String.Double, '#pop'), + include('string'), + ], + 'singlestring': [ + (r"'", String, '#pop'), + include('string'), + ], + 'operators': [ + (r'[#=,./%+\-?]', Operator), + (r'(eq|gt|lt|gte|lte|neq|matches)\b', Operator), + (r'(==|<=|<|>=|>|!=)', Operator), + ], + } + + +class JasminLexer(RegexLexer): + """ + For `Jasmin `_ assembly code. + + .. versionadded:: 2.0 + """ + + name = 'Jasmin' + aliases = ['jasmin', 'jasminxt'] + filenames = ['*.j'] + + _whitespace = r' \n\t\r' + _ws = r'(?:[%s]+)' % _whitespace + _separator = r'%s:=' % _whitespace + _break = r'(?=[%s]|$)' % _separator + _name = r'[^%s]+' % _separator + _unqualified_name = r'(?:[^%s.;\[/]+)' % _separator + + tokens = { + 'default': [ + (r'\n', Text, '#pop'), + (r"'", String.Single, ('#pop', 'quote')), + (r'"', String.Double, 'string'), + (r'=', Punctuation), + (r':', Punctuation, 'label'), + (_ws, Text), + (r';.*', Comment.Single), + (r'(\$[-+])?0x-?[\da-fA-F]+%s' % _break, Number.Hex), + (r'(\$[-+]|\+)?-?\d+%s' % _break, Number.Integer), + (r'-?(\d+\.\d*|\.\d+)([eE][-+]?\d+)?[fFdD]?' + r'[\x00-\x08\x0b\x0c\x0e-\x1f]*%s' % _break, Number.Float), + (r'\$%s' % _name, Name.Variable), + + # Directives + (r'\.annotation%s' % _break, Keyword.Reserved, 'annotation'), + (r'(\.attribute|\.bytecode|\.debug|\.deprecated|\.enclosing|' + r'\.interface|\.line|\.signature|\.source|\.stack|\.var|abstract|' + r'annotation|bridge|class|default|enum|field|final|fpstrict|' + r'interface|native|private|protected|public|signature|static|' + r'synchronized|synthetic|transient|varargs|volatile)%s' % _break, + Keyword.Reserved), + (r'\.catch%s' % _break, Keyword.Reserved, 'caught-exception'), + (r'(\.class|\.implements|\.inner|\.super|inner|invisible|' + r'invisibleparam|outer|visible|visibleparam)%s' % _break, + Keyword.Reserved, 'class/convert-dots'), + (r'\.field%s' % _break, Keyword.Reserved, + ('descriptor/convert-dots', 'field')), + (r'(\.end|\.limit|use)%s' % _break, Keyword.Reserved, + 'no-verification'), + (r'\.method%s' % _break, Keyword.Reserved, 'method'), + (r'\.set%s' % _break, Keyword.Reserved, 'var'), + (r'\.throws%s' % _break, Keyword.Reserved, 'exception'), + (r'(from|offset|to|using)%s' % _break, Keyword.Reserved, 'label'), + (r'is%s' % _break, Keyword.Reserved, + ('descriptor/convert-dots', 'var')), + (r'(locals|stack)%s' % _break, Keyword.Reserved, 'verification'), + (r'method%s' % _break, Keyword.Reserved, 'enclosing-method'), + + # Instructions + (words(( + 'aaload', 'aastore', 'aconst_null', 'aload', 'aload_0', 'aload_1', 'aload_2', + 'aload_3', 'aload_w', 'areturn', 'arraylength', 'astore', 'astore_0', 'astore_1', + 'astore_2', 'astore_3', 'astore_w', 'athrow', 'baload', 'bastore', 'bipush', + 'breakpoint', 'caload', 'castore', 'd2f', 'd2i', 'd2l', 'dadd', 'daload', 'dastore', + 'dcmpg', 'dcmpl', 'dconst_0', 'dconst_1', 'ddiv', 'dload', 'dload_0', 'dload_1', + 'dload_2', 'dload_3', 'dload_w', 'dmul', 'dneg', 'drem', 'dreturn', 'dstore', 'dstore_0', + 'dstore_1', 'dstore_2', 'dstore_3', 'dstore_w', 'dsub', 'dup', 'dup2', 'dup2_x1', + 'dup2_x2', 'dup_x1', 'dup_x2', 'f2d', 'f2i', 'f2l', 'fadd', 'faload', 'fastore', 'fcmpg', + 'fcmpl', 'fconst_0', 'fconst_1', 'fconst_2', 'fdiv', 'fload', 'fload_0', 'fload_1', + 'fload_2', 'fload_3', 'fload_w', 'fmul', 'fneg', 'frem', 'freturn', 'fstore', 'fstore_0', + 'fstore_1', 'fstore_2', 'fstore_3', 'fstore_w', 'fsub', 'i2b', 'i2c', 'i2d', 'i2f', 'i2l', + 'i2s', 'iadd', 'iaload', 'iand', 'iastore', 'iconst_0', 'iconst_1', 'iconst_2', + 'iconst_3', 'iconst_4', 'iconst_5', 'iconst_m1', 'idiv', 'iinc', 'iinc_w', 'iload', + 'iload_0', 'iload_1', 'iload_2', 'iload_3', 'iload_w', 'imul', 'ineg', 'int2byte', + 'int2char', 'int2short', 'ior', 'irem', 'ireturn', 'ishl', 'ishr', 'istore', 'istore_0', + 'istore_1', 'istore_2', 'istore_3', 'istore_w', 'isub', 'iushr', 'ixor', 'l2d', 'l2f', + 'l2i', 'ladd', 'laload', 'land', 'lastore', 'lcmp', 'lconst_0', 'lconst_1', 'ldc2_w', + 'ldiv', 'lload', 'lload_0', 'lload_1', 'lload_2', 'lload_3', 'lload_w', 'lmul', 'lneg', + 'lookupswitch', 'lor', 'lrem', 'lreturn', 'lshl', 'lshr', 'lstore', 'lstore_0', + 'lstore_1', 'lstore_2', 'lstore_3', 'lstore_w', 'lsub', 'lushr', 'lxor', + 'monitorenter', 'monitorexit', 'nop', 'pop', 'pop2', 'ret', 'ret_w', 'return', 'saload', + 'sastore', 'sipush', 'swap'), suffix=_break), Keyword.Reserved), + (r'(anewarray|checkcast|instanceof|ldc|ldc_w|new)%s' % _break, + Keyword.Reserved, 'class/no-dots'), + (r'invoke(dynamic|interface|nonvirtual|special|' + r'static|virtual)%s' % _break, Keyword.Reserved, + 'invocation'), + (r'(getfield|putfield)%s' % _break, Keyword.Reserved, + ('descriptor/no-dots', 'field')), + (r'(getstatic|putstatic)%s' % _break, Keyword.Reserved, + ('descriptor/no-dots', 'static')), + (words(( + 'goto', 'goto_w', 'if_acmpeq', 'if_acmpne', 'if_icmpeq', + 'if_icmpge', 'if_icmpgt', 'if_icmple', 'if_icmplt', 'if_icmpne', + 'ifeq', 'ifge', 'ifgt', 'ifle', 'iflt', 'ifne', 'ifnonnull', + 'ifnull', 'jsr', 'jsr_w'), suffix=_break), + Keyword.Reserved, 'label'), + (r'(multianewarray|newarray)%s' % _break, Keyword.Reserved, + 'descriptor/convert-dots'), + (r'tableswitch%s' % _break, Keyword.Reserved, 'table') + ], + 'quote': [ + (r"'", String.Single, '#pop'), + (r'\\u[\da-fA-F]{4}', String.Escape), + (r"[^'\\]+", String.Single) + ], + 'string': [ + (r'"', String.Double, '#pop'), + (r'\\([nrtfb"\'\\]|u[\da-fA-F]{4}|[0-3]?[0-7]{1,2})', + String.Escape), + (r'[^"\\]+', String.Double) + ], + 'root': [ + (r'\n+', Text), + (r"'", String.Single, 'quote'), + include('default'), + (r'(%s)([ \t\r]*)(:)' % _name, + bygroups(Name.Label, Text, Punctuation)), + (_name, String.Other) + ], + 'annotation': [ + (r'\n', Text, ('#pop', 'annotation-body')), + (r'default%s' % _break, Keyword.Reserved, + ('#pop', 'annotation-default')), + include('default') + ], + 'annotation-body': [ + (r'\n+', Text), + (r'\.end%s' % _break, Keyword.Reserved, '#pop'), + include('default'), + (_name, String.Other, ('annotation-items', 'descriptor/no-dots')) + ], + 'annotation-default': [ + (r'\n+', Text), + (r'\.end%s' % _break, Keyword.Reserved, '#pop'), + include('default'), + default(('annotation-items', 'descriptor/no-dots')) + ], + 'annotation-items': [ + (r"'", String.Single, 'quote'), + include('default'), + (_name, String.Other) + ], + 'caught-exception': [ + (r'all%s' % _break, Keyword, '#pop'), + include('exception') + ], + 'class/convert-dots': [ + include('default'), + (r'(L)((?:%s[/.])*)(%s)(;)' % (_unqualified_name, _name), + bygroups(Keyword.Type, Name.Namespace, Name.Class, Punctuation), + '#pop'), + (r'((?:%s[/.])*)(%s)' % (_unqualified_name, _name), + bygroups(Name.Namespace, Name.Class), '#pop') + ], + 'class/no-dots': [ + include('default'), + (r'\[+', Punctuation, ('#pop', 'descriptor/no-dots')), + (r'(L)((?:%s/)*)(%s)(;)' % (_unqualified_name, _name), + bygroups(Keyword.Type, Name.Namespace, Name.Class, Punctuation), + '#pop'), + (r'((?:%s/)*)(%s)' % (_unqualified_name, _name), + bygroups(Name.Namespace, Name.Class), '#pop') + ], + 'descriptor/convert-dots': [ + include('default'), + (r'\[+', Punctuation), + (r'(L)((?:%s[/.])*)(%s?)(;)' % (_unqualified_name, _name), + bygroups(Keyword.Type, Name.Namespace, Name.Class, Punctuation), + '#pop'), + (r'[^%s\[)L]+' % _separator, Keyword.Type, '#pop'), + default('#pop') + ], + 'descriptor/no-dots': [ + include('default'), + (r'\[+', Punctuation), + (r'(L)((?:%s/)*)(%s)(;)' % (_unqualified_name, _name), + bygroups(Keyword.Type, Name.Namespace, Name.Class, Punctuation), + '#pop'), + (r'[^%s\[)L]+' % _separator, Keyword.Type, '#pop'), + default('#pop') + ], + 'descriptors/convert-dots': [ + (r'\)', Punctuation, '#pop'), + default('descriptor/convert-dots') + ], + 'enclosing-method': [ + (_ws, Text), + (r'(?=[^%s]*\()' % _separator, Text, ('#pop', 'invocation')), + default(('#pop', 'class/convert-dots')) + ], + 'exception': [ + include('default'), + (r'((?:%s[/.])*)(%s)' % (_unqualified_name, _name), + bygroups(Name.Namespace, Name.Exception), '#pop') + ], + 'field': [ + (r'static%s' % _break, Keyword.Reserved, ('#pop', 'static')), + include('default'), + (r'((?:%s[/.](?=[^%s]*[/.]))*)(%s[/.])?(%s)' % + (_unqualified_name, _separator, _unqualified_name, _name), + bygroups(Name.Namespace, Name.Class, Name.Variable.Instance), + '#pop') + ], + 'invocation': [ + include('default'), + (r'((?:%s[/.](?=[^%s(]*[/.]))*)(%s[/.])?(%s)(\()' % + (_unqualified_name, _separator, _unqualified_name, _name), + bygroups(Name.Namespace, Name.Class, Name.Function, Punctuation), + ('#pop', 'descriptor/convert-dots', 'descriptors/convert-dots', + 'descriptor/convert-dots')) + ], + 'label': [ + include('default'), + (_name, Name.Label, '#pop') + ], + 'method': [ + include('default'), + (r'(%s)(\()' % _name, bygroups(Name.Function, Punctuation), + ('#pop', 'descriptor/convert-dots', 'descriptors/convert-dots', + 'descriptor/convert-dots')) + ], + 'no-verification': [ + (r'(locals|method|stack)%s' % _break, Keyword.Reserved, '#pop'), + include('default') + ], + 'static': [ + include('default'), + (r'((?:%s[/.](?=[^%s]*[/.]))*)(%s[/.])?(%s)' % + (_unqualified_name, _separator, _unqualified_name, _name), + bygroups(Name.Namespace, Name.Class, Name.Variable.Class), '#pop') + ], + 'table': [ + (r'\n+', Text), + (r'default%s' % _break, Keyword.Reserved, '#pop'), + include('default'), + (_name, Name.Label) + ], + 'var': [ + include('default'), + (_name, Name.Variable, '#pop') + ], + 'verification': [ + include('default'), + (r'(Double|Float|Integer|Long|Null|Top|UninitializedThis)%s' % + _break, Keyword, '#pop'), + (r'Object%s' % _break, Keyword, ('#pop', 'class/no-dots')), + (r'Uninitialized%s' % _break, Keyword, ('#pop', 'label')) + ] + } + + def analyse_text(text): + score = 0 + if re.search(r'^\s*\.class\s', text, re.MULTILINE): + score += 0.5 + if re.search(r'^\s*[a-z]+_[a-z]+\b', text, re.MULTILINE): + score += 0.3 + if re.search(r'^\s*\.(attribute|bytecode|debug|deprecated|enclosing|' + r'inner|interface|limit|set|signature|stack)\b', text, + re.MULTILINE): + score += 0.6 + return score diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/lisp.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/lisp.py new file mode 100644 index 0000000000000000000000000000000000000000..e258c347bbfc71d79009bd8d79fcba4141296b50 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/lisp.py @@ -0,0 +1,2621 @@ +# -*- coding: utf-8 -*- +""" + pygments.lexers.lisp + ~~~~~~~~~~~~~~~~~~~~ + + Lexers for Lispy languages. + + :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS. + :license: BSD, see LICENSE for details. +""" + +import re + +from pygments.lexer import RegexLexer, include, bygroups, words, default +from pygments.token import Text, Comment, Operator, Keyword, Name, String, \ + Number, Punctuation, Literal, Error + +from pygments.lexers.python import PythonLexer + +__all__ = ['SchemeLexer', 'CommonLispLexer', 'HyLexer', 'RacketLexer', + 'NewLispLexer', 'EmacsLispLexer', 'ShenLexer', 'CPSALexer', + 'XtlangLexer'] + + +class SchemeLexer(RegexLexer): + """ + A Scheme lexer, parsing a stream and outputting the tokens + needed to highlight scheme code. + This lexer could be most probably easily subclassed to parse + other LISP-Dialects like Common Lisp, Emacs Lisp or AutoLisp. + + This parser is checked with pastes from the LISP pastebin + at http://paste.lisp.org/ to cover as much syntax as possible. + + It supports the full Scheme syntax as defined in R5RS. + + .. versionadded:: 0.6 + """ + name = 'Scheme' + aliases = ['scheme', 'scm'] + filenames = ['*.scm', '*.ss'] + mimetypes = ['text/x-scheme', 'application/x-scheme'] + + # list of known keywords and builtins taken form vim 6.4 scheme.vim + # syntax file. + keywords = ( + 'lambda', 'define', 'if', 'else', 'cond', 'and', 'or', 'case', 'let', + 'let*', 'letrec', 'begin', 'do', 'delay', 'set!', '=>', 'quote', + 'quasiquote', 'unquote', 'unquote-splicing', 'define-syntax', + 'let-syntax', 'letrec-syntax', 'syntax-rules' + ) + builtins = ( + '*', '+', '-', '/', '<', '<=', '=', '>', '>=', 'abs', 'acos', 'angle', + 'append', 'apply', 'asin', 'assoc', 'assq', 'assv', 'atan', + 'boolean?', 'caaaar', 'caaadr', 'caaar', 'caadar', 'caaddr', 'caadr', + 'caar', 'cadaar', 'cadadr', 'cadar', 'caddar', 'cadddr', 'caddr', + 'cadr', 'call-with-current-continuation', 'call-with-input-file', + 'call-with-output-file', 'call-with-values', 'call/cc', 'car', + 'cdaaar', 'cdaadr', 'cdaar', 'cdadar', 'cdaddr', 'cdadr', 'cdar', + 'cddaar', 'cddadr', 'cddar', 'cdddar', 'cddddr', 'cdddr', 'cddr', + 'cdr', 'ceiling', 'char->integer', 'char-alphabetic?', 'char-ci<=?', + 'char-ci=?', 'char-ci>?', 'char-downcase', + 'char-lower-case?', 'char-numeric?', 'char-ready?', 'char-upcase', + 'char-upper-case?', 'char-whitespace?', 'char<=?', 'char=?', 'char>?', 'char?', 'close-input-port', 'close-output-port', + 'complex?', 'cons', 'cos', 'current-input-port', 'current-output-port', + 'denominator', 'display', 'dynamic-wind', 'eof-object?', 'eq?', + 'equal?', 'eqv?', 'eval', 'even?', 'exact->inexact', 'exact?', 'exp', + 'expt', 'floor', 'for-each', 'force', 'gcd', 'imag-part', + 'inexact->exact', 'inexact?', 'input-port?', 'integer->char', + 'integer?', 'interaction-environment', 'lcm', 'length', 'list', + 'list->string', 'list->vector', 'list-ref', 'list-tail', 'list?', + 'load', 'log', 'magnitude', 'make-polar', 'make-rectangular', + 'make-string', 'make-vector', 'map', 'max', 'member', 'memq', 'memv', + 'min', 'modulo', 'negative?', 'newline', 'not', 'null-environment', + 'null?', 'number->string', 'number?', 'numerator', 'odd?', + 'open-input-file', 'open-output-file', 'output-port?', 'pair?', + 'peek-char', 'port?', 'positive?', 'procedure?', 'quotient', + 'rational?', 'rationalize', 'read', 'read-char', 'real-part', 'real?', + 'remainder', 'reverse', 'round', 'scheme-report-environment', + 'set-car!', 'set-cdr!', 'sin', 'sqrt', 'string', 'string->list', + 'string->number', 'string->symbol', 'string-append', 'string-ci<=?', + 'string-ci=?', 'string-ci>?', + 'string-copy', 'string-fill!', 'string-length', 'string-ref', + 'string-set!', 'string<=?', 'string=?', + 'string>?', 'string?', 'substring', 'symbol->string', 'symbol?', + 'tan', 'transcript-off', 'transcript-on', 'truncate', 'values', + 'vector', 'vector->list', 'vector-fill!', 'vector-length', + 'vector-ref', 'vector-set!', 'vector?', 'with-input-from-file', + 'with-output-to-file', 'write', 'write-char', 'zero?' + ) + + # valid names for identifiers + # well, names can only not consist fully of numbers + # but this should be good enough for now + valid_name = r'[\w!$%&*+,/:<=>?@^~|-]+' + + tokens = { + 'root': [ + # the comments + # and going to the end of the line + (r';.*$', Comment.Single), + # multi-line comment + (r'#\|', Comment.Multiline, 'multiline-comment'), + # commented form (entire sexpr folliwng) + (r'#;\s*\(', Comment, 'commented-form'), + # signifies that the program text that follows is written with the + # lexical and datum syntax described in r6rs + (r'#!r6rs', Comment), + + # whitespaces - usually not relevant + (r'\s+', Text), + + # numbers + (r'-?\d+\.\d+', Number.Float), + (r'-?\d+', Number.Integer), + # support for uncommon kinds of numbers - + # have to figure out what the characters mean + # (r'(#e|#i|#b|#o|#d|#x)[\d.]+', Number), + + # strings, symbols and characters + (r'"(\\\\|\\"|[^"])*"', String), + (r"'" + valid_name, String.Symbol), + (r"#\\([()/'\"._!§$%& ?=+-]|[a-zA-Z0-9]+)", String.Char), + + # constants + (r'(#t|#f)', Name.Constant), + + # special operators + (r"('|#|`|,@|,|\.)", Operator), + + # highlight the keywords + ('(%s)' % '|'.join(re.escape(entry) + ' ' for entry in keywords), + Keyword), + + # first variable in a quoted string like + # '(this is syntactic sugar) + (r"(?<='\()" + valid_name, Name.Variable), + (r"(?<=#\()" + valid_name, Name.Variable), + + # highlight the builtins + ("(?<=\()(%s)" % '|'.join(re.escape(entry) + ' ' for entry in builtins), + Name.Builtin), + + # the remaining functions + (r'(?<=\()' + valid_name, Name.Function), + # find the remaining variables + (valid_name, Name.Variable), + + # the famous parentheses! + (r'(\(|\))', Punctuation), + (r'(\[|\])', Punctuation), + ], + 'multiline-comment': [ + (r'#\|', Comment.Multiline, '#push'), + (r'\|#', Comment.Multiline, '#pop'), + (r'[^|#]+', Comment.Multiline), + (r'[|#]', Comment.Multiline), + ], + 'commented-form': [ + (r'\(', Comment, '#push'), + (r'\)', Comment, '#pop'), + (r'[^()]+', Comment), + ], + } + + +class CommonLispLexer(RegexLexer): + """ + A Common Lisp lexer. + + .. versionadded:: 0.9 + """ + name = 'Common Lisp' + aliases = ['common-lisp', 'cl', 'lisp'] + filenames = ['*.cl', '*.lisp'] + mimetypes = ['text/x-common-lisp'] + + flags = re.IGNORECASE | re.MULTILINE + + # couple of useful regexes + + # characters that are not macro-characters and can be used to begin a symbol + nonmacro = r'\\.|[\w!$%&*+-/<=>?@\[\]^{}~]' + constituent = nonmacro + '|[#.:]' + terminated = r'(?=[ "()\'\n,;`])' # whitespace or terminating macro characters + + # symbol token, reverse-engineered from hyperspec + # Take a deep breath... + symbol = r'(\|[^|]+\||(?:%s)(?:%s)*)' % (nonmacro, constituent) + + def __init__(self, **options): + from pygments.lexers._cl_builtins import BUILTIN_FUNCTIONS, \ + SPECIAL_FORMS, MACROS, LAMBDA_LIST_KEYWORDS, DECLARATIONS, \ + BUILTIN_TYPES, BUILTIN_CLASSES + self.builtin_function = BUILTIN_FUNCTIONS + self.special_forms = SPECIAL_FORMS + self.macros = MACROS + self.lambda_list_keywords = LAMBDA_LIST_KEYWORDS + self.declarations = DECLARATIONS + self.builtin_types = BUILTIN_TYPES + self.builtin_classes = BUILTIN_CLASSES + RegexLexer.__init__(self, **options) + + def get_tokens_unprocessed(self, text): + stack = ['root'] + for index, token, value in RegexLexer.get_tokens_unprocessed(self, text, stack): + if token is Name.Variable: + if value in self.builtin_function: + yield index, Name.Builtin, value + continue + if value in self.special_forms: + yield index, Keyword, value + continue + if value in self.macros: + yield index, Name.Builtin, value + continue + if value in self.lambda_list_keywords: + yield index, Keyword, value + continue + if value in self.declarations: + yield index, Keyword, value + continue + if value in self.builtin_types: + yield index, Keyword.Type, value + continue + if value in self.builtin_classes: + yield index, Name.Class, value + continue + yield index, token, value + + tokens = { + 'root': [ + default('body'), + ], + 'multiline-comment': [ + (r'#\|', Comment.Multiline, '#push'), # (cf. Hyperspec 2.4.8.19) + (r'\|#', Comment.Multiline, '#pop'), + (r'[^|#]+', Comment.Multiline), + (r'[|#]', Comment.Multiline), + ], + 'commented-form': [ + (r'\(', Comment.Preproc, '#push'), + (r'\)', Comment.Preproc, '#pop'), + (r'[^()]+', Comment.Preproc), + ], + 'body': [ + # whitespace + (r'\s+', Text), + + # single-line comment + (r';.*$', Comment.Single), + + # multi-line comment + (r'#\|', Comment.Multiline, 'multiline-comment'), + + # encoding comment (?) + (r'#\d*Y.*$', Comment.Special), + + # strings and characters + (r'"(\\.|\\\n|[^"\\])*"', String), + # quoting + (r":" + symbol, String.Symbol), + (r"::" + symbol, String.Symbol), + (r":#" + symbol, String.Symbol), + (r"'" + symbol, String.Symbol), + (r"'", Operator), + (r"`", Operator), + + # decimal numbers + (r'[-+]?\d+\.?' + terminated, Number.Integer), + (r'[-+]?\d+/\d+' + terminated, Number), + (r'[-+]?(\d*\.\d+([defls][-+]?\d+)?|\d+(\.\d*)?[defls][-+]?\d+)' + + terminated, Number.Float), + + # sharpsign strings and characters + (r"#\\." + terminated, String.Char), + (r"#\\" + symbol, String.Char), + + # vector + (r'#\(', Operator, 'body'), + + # bitstring + (r'#\d*\*[01]*', Literal.Other), + + # uninterned symbol + (r'#:' + symbol, String.Symbol), + + # read-time and load-time evaluation + (r'#[.,]', Operator), + + # function shorthand + (r'#\'', Name.Function), + + # binary rational + (r'#b[+-]?[01]+(/[01]+)?', Number.Bin), + + # octal rational + (r'#o[+-]?[0-7]+(/[0-7]+)?', Number.Oct), + + # hex rational + (r'#x[+-]?[0-9a-f]+(/[0-9a-f]+)?', Number.Hex), + + # radix rational + (r'#\d+r[+-]?[0-9a-z]+(/[0-9a-z]+)?', Number), + + # complex + (r'(#c)(\()', bygroups(Number, Punctuation), 'body'), + + # array + (r'(#\d+a)(\()', bygroups(Literal.Other, Punctuation), 'body'), + + # structure + (r'(#s)(\()', bygroups(Literal.Other, Punctuation), 'body'), + + # path + (r'#p?"(\\.|[^"])*"', Literal.Other), + + # reference + (r'#\d+=', Operator), + (r'#\d+#', Operator), + + # read-time comment + (r'#+nil' + terminated + '\s*\(', Comment.Preproc, 'commented-form'), + + # read-time conditional + (r'#[+-]', Operator), + + # special operators that should have been parsed already + (r'(,@|,|\.)', Operator), + + # special constants + (r'(t|nil)' + terminated, Name.Constant), + + # functions and variables + (r'\*' + symbol + '\*', Name.Variable.Global), + (symbol, Name.Variable), + + # parentheses + (r'\(', Punctuation, 'body'), + (r'\)', Punctuation, '#pop'), + ], + } + + +class HyLexer(RegexLexer): + """ + Lexer for `Hy `_ source code. + + .. versionadded:: 2.0 + """ + name = 'Hy' + aliases = ['hylang'] + filenames = ['*.hy'] + mimetypes = ['text/x-hy', 'application/x-hy'] + + special_forms = ( + 'cond', 'for', '->', '->>', 'car', + 'cdr', 'first', 'rest', 'let', 'when', 'unless', + 'import', 'do', 'progn', 'get', 'slice', 'assoc', 'with-decorator', + ',', 'list_comp', 'kwapply', '~', 'is', 'in', 'is-not', 'not-in', + 'quasiquote', 'unquote', 'unquote-splice', 'quote', '|', '<<=', '>>=', + 'foreach', 'while', + 'eval-and-compile', 'eval-when-compile' + ) + + declarations = ( + 'def', 'defn', 'defun', 'defmacro', 'defclass', 'lambda', 'fn', 'setv' + ) + + hy_builtins = () + + hy_core = ( + 'cycle', 'dec', 'distinct', 'drop', 'even?', 'filter', 'inc', + 'instance?', 'iterable?', 'iterate', 'iterator?', 'neg?', + 'none?', 'nth', 'numeric?', 'odd?', 'pos?', 'remove', 'repeat', + 'repeatedly', 'take', 'take_nth', 'take_while', 'zero?' + ) + + builtins = hy_builtins + hy_core + + # valid names for identifiers + # well, names can only not consist fully of numbers + # but this should be good enough for now + valid_name = r'(?!#)[\w!$%*+<=>?/.#-]+' + + def _multi_escape(entries): + return words(entries, suffix=' ') + + tokens = { + 'root': [ + # the comments - always starting with semicolon + # and going to the end of the line + (r';.*$', Comment.Single), + + # whitespaces - usually not relevant + (r'[,\s]+', Text), + + # numbers + (r'-?\d+\.\d+', Number.Float), + (r'-?\d+', Number.Integer), + (r'0[0-7]+j?', Number.Oct), + (r'0[xX][a-fA-F0-9]+', Number.Hex), + + # strings, symbols and characters + (r'"(\\\\|\\"|[^"])*"', String), + (r"'" + valid_name, String.Symbol), + (r"\\(.|[a-z]+)", String.Char), + (r'^(\s*)([rRuU]{,2}"""(?:.|\n)*?""")', bygroups(Text, String.Doc)), + (r"^(\s*)([rRuU]{,2}'''(?:.|\n)*?''')", bygroups(Text, String.Doc)), + + # keywords + (r'::?' + valid_name, String.Symbol), + + # special operators + (r'~@|[`\'#^~&@]', Operator), + + include('py-keywords'), + include('py-builtins'), + + # highlight the special forms + (_multi_escape(special_forms), Keyword), + + # Technically, only the special forms are 'keywords'. The problem + # is that only treating them as keywords means that things like + # 'defn' and 'ns' need to be highlighted as builtins. This is ugly + # and weird for most styles. So, as a compromise we're going to + # highlight them as Keyword.Declarations. + (_multi_escape(declarations), Keyword.Declaration), + + # highlight the builtins + (_multi_escape(builtins), Name.Builtin), + + # the remaining functions + (r'(?<=\()' + valid_name, Name.Function), + + # find the remaining variables + (valid_name, Name.Variable), + + # Hy accepts vector notation + (r'(\[|\])', Punctuation), + + # Hy accepts map notation + (r'(\{|\})', Punctuation), + + # the famous parentheses! + (r'(\(|\))', Punctuation), + + ], + 'py-keywords': PythonLexer.tokens['keywords'], + 'py-builtins': PythonLexer.tokens['builtins'], + } + + def analyse_text(text): + if '(import ' in text or '(defn ' in text: + return 0.9 + + +class RacketLexer(RegexLexer): + """ + Lexer for `Racket `_ source code (formerly + known as PLT Scheme). + + .. versionadded:: 1.6 + """ + + name = 'Racket' + aliases = ['racket', 'rkt'] + filenames = ['*.rkt', '*.rktd', '*.rktl'] + mimetypes = ['text/x-racket', 'application/x-racket'] + + # Generated by example.rkt + _keywords = ( + u'#%app', u'#%datum', u'#%declare', u'#%expression', u'#%module-begin', + u'#%plain-app', u'#%plain-lambda', u'#%plain-module-begin', + u'#%printing-module-begin', u'#%provide', u'#%require', + u'#%stratified-body', u'#%top', u'#%top-interaction', + u'#%variable-reference', u'->', u'->*', u'->*m', u'->d', u'->dm', u'->i', + u'->m', u'...', u':do-in', u'==', u'=>', u'_', u'absent', u'abstract', + u'all-defined-out', u'all-from-out', u'and', u'any', u'augment', u'augment*', + u'augment-final', u'augment-final*', u'augride', u'augride*', u'begin', + u'begin-for-syntax', u'begin0', u'case', u'case->', u'case->m', + u'case-lambda', u'class', u'class*', u'class-field-accessor', + u'class-field-mutator', u'class/c', u'class/derived', u'combine-in', + u'combine-out', u'command-line', u'compound-unit', u'compound-unit/infer', + u'cond', u'cons/dc', u'contract', u'contract-out', u'contract-struct', + u'contracted', u'define', u'define-compound-unit', + u'define-compound-unit/infer', u'define-contract-struct', + u'define-custom-hash-types', u'define-custom-set-types', + u'define-for-syntax', u'define-local-member-name', u'define-logger', + u'define-match-expander', u'define-member-name', + u'define-module-boundary-contract', u'define-namespace-anchor', + u'define-opt/c', u'define-sequence-syntax', u'define-serializable-class', + u'define-serializable-class*', u'define-signature', + u'define-signature-form', u'define-struct', u'define-struct/contract', + u'define-struct/derived', u'define-syntax', u'define-syntax-rule', + u'define-syntaxes', u'define-unit', u'define-unit-binding', + u'define-unit-from-context', u'define-unit/contract', + u'define-unit/new-import-export', u'define-unit/s', u'define-values', + u'define-values-for-export', u'define-values-for-syntax', + u'define-values/invoke-unit', u'define-values/invoke-unit/infer', + u'define/augment', u'define/augment-final', u'define/augride', + u'define/contract', u'define/final-prop', u'define/match', + u'define/overment', u'define/override', u'define/override-final', + u'define/private', u'define/public', u'define/public-final', + u'define/pubment', u'define/subexpression-pos-prop', + u'define/subexpression-pos-prop/name', u'delay', u'delay/idle', + u'delay/name', u'delay/strict', u'delay/sync', u'delay/thread', u'do', + u'else', u'except', u'except-in', u'except-out', u'export', u'extends', + u'failure-cont', u'false', u'false/c', u'field', u'field-bound?', u'file', + u'flat-murec-contract', u'flat-rec-contract', u'for', u'for*', u'for*/and', + u'for*/async', u'for*/first', u'for*/fold', u'for*/fold/derived', + u'for*/hash', u'for*/hasheq', u'for*/hasheqv', u'for*/last', u'for*/list', + u'for*/lists', u'for*/mutable-set', u'for*/mutable-seteq', + u'for*/mutable-seteqv', u'for*/or', u'for*/product', u'for*/set', + u'for*/seteq', u'for*/seteqv', u'for*/stream', u'for*/sum', u'for*/vector', + u'for*/weak-set', u'for*/weak-seteq', u'for*/weak-seteqv', u'for-label', + u'for-meta', u'for-syntax', u'for-template', u'for/and', u'for/async', + u'for/first', u'for/fold', u'for/fold/derived', u'for/hash', u'for/hasheq', + u'for/hasheqv', u'for/last', u'for/list', u'for/lists', u'for/mutable-set', + u'for/mutable-seteq', u'for/mutable-seteqv', u'for/or', u'for/product', + u'for/set', u'for/seteq', u'for/seteqv', u'for/stream', u'for/sum', + u'for/vector', u'for/weak-set', u'for/weak-seteq', u'for/weak-seteqv', + u'gen:custom-write', u'gen:dict', u'gen:equal+hash', u'gen:set', + u'gen:stream', u'generic', u'get-field', u'hash/dc', u'if', u'implies', + u'import', u'include', u'include-at/relative-to', + u'include-at/relative-to/reader', u'include/reader', u'inherit', + u'inherit-field', u'inherit/inner', u'inherit/super', u'init', + u'init-depend', u'init-field', u'init-rest', u'inner', u'inspect', + u'instantiate', u'interface', u'interface*', u'invariant-assertion', + u'invoke-unit', u'invoke-unit/infer', u'lambda', u'lazy', u'let', u'let*', + u'let*-values', u'let-syntax', u'let-syntaxes', u'let-values', u'let/cc', + u'let/ec', u'letrec', u'letrec-syntax', u'letrec-syntaxes', + u'letrec-syntaxes+values', u'letrec-values', u'lib', u'link', u'local', + u'local-require', u'log-debug', u'log-error', u'log-fatal', u'log-info', + u'log-warning', u'match', u'match*', u'match*/derived', u'match-define', + u'match-define-values', u'match-lambda', u'match-lambda*', + u'match-lambda**', u'match-let', u'match-let*', u'match-let*-values', + u'match-let-values', u'match-letrec', u'match-letrec-values', + u'match/derived', u'match/values', u'member-name-key', u'mixin', u'module', + u'module*', u'module+', u'nand', u'new', u'nor', u'object-contract', + u'object/c', u'only', u'only-in', u'only-meta-in', u'open', u'opt/c', u'or', + u'overment', u'overment*', u'override', u'override*', u'override-final', + u'override-final*', u'parameterize', u'parameterize*', + u'parameterize-break', u'parametric->/c', u'place', u'place*', + u'place/context', u'planet', u'prefix', u'prefix-in', u'prefix-out', + u'private', u'private*', u'prompt-tag/c', u'protect-out', u'provide', + u'provide-signature-elements', u'provide/contract', u'public', u'public*', + u'public-final', u'public-final*', u'pubment', u'pubment*', u'quasiquote', + u'quasisyntax', u'quasisyntax/loc', u'quote', u'quote-syntax', + u'quote-syntax/prune', u'recontract-out', u'recursive-contract', + u'relative-in', u'rename', u'rename-in', u'rename-inner', u'rename-out', + u'rename-super', u'require', u'send', u'send*', u'send+', u'send-generic', + u'send/apply', u'send/keyword-apply', u'set!', u'set!-values', + u'set-field!', u'shared', u'stream', u'stream*', u'stream-cons', u'struct', + u'struct*', u'struct-copy', u'struct-field-index', u'struct-out', + u'struct/c', u'struct/ctc', u'struct/dc', u'submod', u'super', + u'super-instantiate', u'super-make-object', u'super-new', u'syntax', + u'syntax-case', u'syntax-case*', u'syntax-id-rules', u'syntax-rules', + u'syntax/loc', u'tag', u'this', u'this%', u'thunk', u'thunk*', u'time', + u'unconstrained-domain->', u'unit', u'unit-from-context', u'unit/c', + u'unit/new-import-export', u'unit/s', u'unless', u'unquote', + u'unquote-splicing', u'unsyntax', u'unsyntax-splicing', u'values/drop', + u'when', u'with-continuation-mark', u'with-contract', + u'with-contract-continuation-mark', u'with-handlers', u'with-handlers*', + u'with-method', u'with-syntax', u'λ' + ) + + # Generated by example.rkt + _builtins = ( + u'*', u'*list/c', u'+', u'-', u'/', u'<', u'', u'>/c', u'>=', u'>=/c', u'abort-current-continuation', u'abs', + u'absolute-path?', u'acos', u'add-between', u'add1', u'alarm-evt', + u'always-evt', u'and/c', u'andmap', u'angle', u'any/c', u'append', u'append*', + u'append-map', u'apply', u'argmax', u'argmin', u'arithmetic-shift', + u'arity-at-least', u'arity-at-least-value', u'arity-at-least?', + u'arity-checking-wrapper', u'arity-includes?', u'arity=?', + u'arrow-contract-info', u'arrow-contract-info-accepts-arglist', + u'arrow-contract-info-chaperone-procedure', + u'arrow-contract-info-check-first-order', u'arrow-contract-info?', + u'asin', u'assf', u'assoc', u'assq', u'assv', u'atan', + u'bad-number-of-results', u'banner', u'base->-doms/c', u'base->-rngs/c', + u'base->?', u'between/c', u'bitwise-and', u'bitwise-bit-field', + u'bitwise-bit-set?', u'bitwise-ior', u'bitwise-not', u'bitwise-xor', + u'blame-add-car-context', u'blame-add-cdr-context', u'blame-add-context', + u'blame-add-missing-party', u'blame-add-nth-arg-context', + u'blame-add-range-context', u'blame-add-unknown-context', + u'blame-context', u'blame-contract', u'blame-fmt->-string', + u'blame-missing-party?', u'blame-negative', u'blame-original?', + u'blame-positive', u'blame-replace-negative', u'blame-source', + u'blame-swap', u'blame-swapped?', u'blame-update', u'blame-value', + u'blame?', u'boolean=?', u'boolean?', u'bound-identifier=?', u'box', + u'box-cas!', u'box-immutable', u'box-immutable/c', u'box/c', u'box?', + u'break-enabled', u'break-parameterization?', u'break-thread', + u'build-chaperone-contract-property', u'build-compound-type-name', + u'build-contract-property', u'build-flat-contract-property', + u'build-list', u'build-path', u'build-path/convention-type', + u'build-string', u'build-vector', u'byte-pregexp', u'byte-pregexp?', + u'byte-ready?', u'byte-regexp', u'byte-regexp?', u'byte?', u'bytes', + u'bytes->immutable-bytes', u'bytes->list', u'bytes->path', + u'bytes->path-element', u'bytes->string/latin-1', u'bytes->string/locale', + u'bytes->string/utf-8', u'bytes-append', u'bytes-append*', + u'bytes-close-converter', u'bytes-convert', u'bytes-convert-end', + u'bytes-converter?', u'bytes-copy', u'bytes-copy!', + u'bytes-environment-variable-name?', u'bytes-fill!', u'bytes-join', + u'bytes-length', u'bytes-no-nuls?', u'bytes-open-converter', u'bytes-ref', + u'bytes-set!', u'bytes-utf-8-index', u'bytes-utf-8-length', + u'bytes-utf-8-ref', u'bytes?', u'bytes?', u'caaaar', + u'caaadr', u'caaar', u'caadar', u'caaddr', u'caadr', u'caar', u'cadaar', + u'cadadr', u'cadar', u'caddar', u'cadddr', u'caddr', u'cadr', + u'call-in-nested-thread', u'call-with-atomic-output-file', + u'call-with-break-parameterization', + u'call-with-composable-continuation', u'call-with-continuation-barrier', + u'call-with-continuation-prompt', u'call-with-current-continuation', + u'call-with-default-reading-parameterization', + u'call-with-escape-continuation', u'call-with-exception-handler', + u'call-with-file-lock/timeout', u'call-with-immediate-continuation-mark', + u'call-with-input-bytes', u'call-with-input-file', + u'call-with-input-file*', u'call-with-input-string', + u'call-with-output-bytes', u'call-with-output-file', + u'call-with-output-file*', u'call-with-output-string', + u'call-with-parameterization', u'call-with-semaphore', + u'call-with-semaphore/enable-break', u'call-with-values', u'call/cc', + u'call/ec', u'car', u'cartesian-product', u'cdaaar', u'cdaadr', u'cdaar', + u'cdadar', u'cdaddr', u'cdadr', u'cdar', u'cddaar', u'cddadr', u'cddar', + u'cdddar', u'cddddr', u'cdddr', u'cddr', u'cdr', u'ceiling', u'channel-get', + u'channel-put', u'channel-put-evt', u'channel-put-evt?', + u'channel-try-get', u'channel/c', u'channel?', u'chaperone-box', + u'chaperone-channel', u'chaperone-continuation-mark-key', + u'chaperone-contract-property?', u'chaperone-contract?', u'chaperone-evt', + u'chaperone-hash', u'chaperone-hash-set', u'chaperone-of?', + u'chaperone-procedure', u'chaperone-procedure*', u'chaperone-prompt-tag', + u'chaperone-struct', u'chaperone-struct-type', u'chaperone-vector', + u'chaperone?', u'char->integer', u'char-alphabetic?', u'char-blank?', + u'char-ci<=?', u'char-ci=?', u'char-ci>?', + u'char-downcase', u'char-foldcase', u'char-general-category', + u'char-graphic?', u'char-in', u'char-in/c', u'char-iso-control?', + u'char-lower-case?', u'char-numeric?', u'char-punctuation?', + u'char-ready?', u'char-symbolic?', u'char-title-case?', u'char-titlecase', + u'char-upcase', u'char-upper-case?', u'char-utf-8-length', + u'char-whitespace?', u'char<=?', u'char=?', u'char>?', + u'char?', u'check-duplicate-identifier', u'check-duplicates', + u'checked-procedure-check-and-extract', u'choice-evt', + u'class->interface', u'class-info', u'class-seal', u'class-unseal', + u'class?', u'cleanse-path', u'close-input-port', u'close-output-port', + u'coerce-chaperone-contract', u'coerce-chaperone-contracts', + u'coerce-contract', u'coerce-contract/f', u'coerce-contracts', + u'coerce-flat-contract', u'coerce-flat-contracts', u'collect-garbage', + u'collection-file-path', u'collection-path', u'combinations', u'compile', + u'compile-allow-set!-undefined', u'compile-context-preservation-enabled', + u'compile-enforce-module-constants', u'compile-syntax', + u'compiled-expression-recompile', u'compiled-expression?', + u'compiled-module-expression?', u'complete-path?', u'complex?', u'compose', + u'compose1', u'conjoin', u'conjugate', u'cons', u'cons/c', u'cons?', u'const', + u'continuation-mark-key/c', u'continuation-mark-key?', + u'continuation-mark-set->context', u'continuation-mark-set->list', + u'continuation-mark-set->list*', u'continuation-mark-set-first', + u'continuation-mark-set?', u'continuation-marks', + u'continuation-prompt-available?', u'continuation-prompt-tag?', + u'continuation?', u'contract-continuation-mark-key', + u'contract-custom-write-property-proc', u'contract-exercise', + u'contract-first-order', u'contract-first-order-passes?', + u'contract-late-neg-projection', u'contract-name', u'contract-proc', + u'contract-projection', u'contract-property?', + u'contract-random-generate', u'contract-random-generate-fail', + u'contract-random-generate-fail?', + u'contract-random-generate-get-current-environment', + u'contract-random-generate-stash', u'contract-random-generate/choose', + u'contract-stronger?', u'contract-struct-exercise', + u'contract-struct-generate', u'contract-struct-late-neg-projection', + u'contract-struct-list-contract?', u'contract-val-first-projection', + u'contract?', u'convert-stream', u'copy-directory/files', u'copy-file', + u'copy-port', u'cos', u'cosh', u'count', u'current-blame-format', + u'current-break-parameterization', u'current-code-inspector', + u'current-command-line-arguments', u'current-compile', + u'current-compiled-file-roots', u'current-continuation-marks', + u'current-contract-region', u'current-custodian', u'current-directory', + u'current-directory-for-user', u'current-drive', + u'current-environment-variables', u'current-error-port', u'current-eval', + u'current-evt-pseudo-random-generator', + u'current-force-delete-permissions', u'current-future', + u'current-gc-milliseconds', u'current-get-interaction-input-port', + u'current-inexact-milliseconds', u'current-input-port', + u'current-inspector', u'current-library-collection-links', + u'current-library-collection-paths', u'current-load', + u'current-load-extension', u'current-load-relative-directory', + u'current-load/use-compiled', u'current-locale', u'current-logger', + u'current-memory-use', u'current-milliseconds', + u'current-module-declare-name', u'current-module-declare-source', + u'current-module-name-resolver', u'current-module-path-for-load', + u'current-namespace', u'current-output-port', u'current-parameterization', + u'current-plumber', u'current-preserved-thread-cell-values', + u'current-print', u'current-process-milliseconds', u'current-prompt-read', + u'current-pseudo-random-generator', u'current-read-interaction', + u'current-reader-guard', u'current-readtable', u'current-seconds', + u'current-security-guard', u'current-subprocess-custodian-mode', + u'current-thread', u'current-thread-group', + u'current-thread-initial-stack-size', + u'current-write-relative-directory', u'curry', u'curryr', + u'custodian-box-value', u'custodian-box?', u'custodian-limit-memory', + u'custodian-managed-list', u'custodian-memory-accounting-available?', + u'custodian-require-memory', u'custodian-shutdown-all', u'custodian?', + u'custom-print-quotable-accessor', u'custom-print-quotable?', + u'custom-write-accessor', u'custom-write-property-proc', u'custom-write?', + u'date', u'date*', u'date*-nanosecond', u'date*-time-zone-name', u'date*?', + u'date-day', u'date-dst?', u'date-hour', u'date-minute', u'date-month', + u'date-second', u'date-time-zone-offset', u'date-week-day', u'date-year', + u'date-year-day', u'date?', u'datum->syntax', u'datum-intern-literal', + u'default-continuation-prompt-tag', u'degrees->radians', + u'delete-directory', u'delete-directory/files', u'delete-file', + u'denominator', u'dict->list', u'dict-can-functional-set?', + u'dict-can-remove-keys?', u'dict-clear', u'dict-clear!', u'dict-copy', + u'dict-count', u'dict-empty?', u'dict-for-each', u'dict-has-key?', + u'dict-implements/c', u'dict-implements?', u'dict-iter-contract', + u'dict-iterate-first', u'dict-iterate-key', u'dict-iterate-next', + u'dict-iterate-value', u'dict-key-contract', u'dict-keys', u'dict-map', + u'dict-mutable?', u'dict-ref', u'dict-ref!', u'dict-remove', + u'dict-remove!', u'dict-set', u'dict-set!', u'dict-set*', u'dict-set*!', + u'dict-update', u'dict-update!', u'dict-value-contract', u'dict-values', + u'dict?', u'directory-exists?', u'directory-list', u'disjoin', u'display', + u'display-lines', u'display-lines-to-file', u'display-to-file', + u'displayln', u'double-flonum?', u'drop', u'drop-common-prefix', + u'drop-right', u'dropf', u'dropf-right', u'dump-memory-stats', + u'dup-input-port', u'dup-output-port', u'dynamic->*', u'dynamic-get-field', + u'dynamic-object/c', u'dynamic-place', u'dynamic-place*', + u'dynamic-require', u'dynamic-require-for-syntax', u'dynamic-send', + u'dynamic-set-field!', u'dynamic-wind', u'eighth', u'empty', + u'empty-sequence', u'empty-stream', u'empty?', + u'environment-variables-copy', u'environment-variables-names', + u'environment-variables-ref', u'environment-variables-set!', + u'environment-variables?', u'eof', u'eof-evt', u'eof-object?', + u'ephemeron-value', u'ephemeron?', u'eprintf', u'eq-contract-val', + u'eq-contract?', u'eq-hash-code', u'eq?', u'equal-contract-val', + u'equal-contract?', u'equal-hash-code', u'equal-secondary-hash-code', + u'equal<%>', u'equal?', u'equal?/recur', u'eqv-hash-code', u'eqv?', u'error', + u'error-display-handler', u'error-escape-handler', + u'error-print-context-length', u'error-print-source-location', + u'error-print-width', u'error-value->string-handler', u'eval', + u'eval-jit-enabled', u'eval-syntax', u'even?', u'evt/c', u'evt?', + u'exact->inexact', u'exact-ceiling', u'exact-floor', u'exact-integer?', + u'exact-nonnegative-integer?', u'exact-positive-integer?', u'exact-round', + u'exact-truncate', u'exact?', u'executable-yield-handler', u'exit', + u'exit-handler', u'exn', u'exn-continuation-marks', u'exn-message', + u'exn:break', u'exn:break-continuation', u'exn:break:hang-up', + u'exn:break:hang-up?', u'exn:break:terminate', u'exn:break:terminate?', + u'exn:break?', u'exn:fail', u'exn:fail:contract', + u'exn:fail:contract:arity', u'exn:fail:contract:arity?', + u'exn:fail:contract:blame', u'exn:fail:contract:blame-object', + u'exn:fail:contract:blame?', u'exn:fail:contract:continuation', + u'exn:fail:contract:continuation?', u'exn:fail:contract:divide-by-zero', + u'exn:fail:contract:divide-by-zero?', + u'exn:fail:contract:non-fixnum-result', + u'exn:fail:contract:non-fixnum-result?', u'exn:fail:contract:variable', + u'exn:fail:contract:variable-id', u'exn:fail:contract:variable?', + u'exn:fail:contract?', u'exn:fail:filesystem', + u'exn:fail:filesystem:errno', u'exn:fail:filesystem:errno-errno', + u'exn:fail:filesystem:errno?', u'exn:fail:filesystem:exists', + u'exn:fail:filesystem:exists?', u'exn:fail:filesystem:missing-module', + u'exn:fail:filesystem:missing-module-path', + u'exn:fail:filesystem:missing-module?', u'exn:fail:filesystem:version', + u'exn:fail:filesystem:version?', u'exn:fail:filesystem?', + u'exn:fail:network', u'exn:fail:network:errno', + u'exn:fail:network:errno-errno', u'exn:fail:network:errno?', + u'exn:fail:network?', u'exn:fail:object', u'exn:fail:object?', + u'exn:fail:out-of-memory', u'exn:fail:out-of-memory?', u'exn:fail:read', + u'exn:fail:read-srclocs', u'exn:fail:read:eof', u'exn:fail:read:eof?', + u'exn:fail:read:non-char', u'exn:fail:read:non-char?', u'exn:fail:read?', + u'exn:fail:syntax', u'exn:fail:syntax-exprs', + u'exn:fail:syntax:missing-module', + u'exn:fail:syntax:missing-module-path', + u'exn:fail:syntax:missing-module?', u'exn:fail:syntax:unbound', + u'exn:fail:syntax:unbound?', u'exn:fail:syntax?', u'exn:fail:unsupported', + u'exn:fail:unsupported?', u'exn:fail:user', u'exn:fail:user?', + u'exn:fail?', u'exn:misc:match?', u'exn:missing-module-accessor', + u'exn:missing-module?', u'exn:srclocs-accessor', u'exn:srclocs?', u'exn?', + u'exp', u'expand', u'expand-once', u'expand-syntax', u'expand-syntax-once', + u'expand-syntax-to-top-form', u'expand-to-top-form', u'expand-user-path', + u'explode-path', u'expt', u'externalizable<%>', u'failure-result/c', + u'false?', u'field-names', u'fifth', u'file->bytes', u'file->bytes-lines', + u'file->lines', u'file->list', u'file->string', u'file->value', + u'file-exists?', u'file-name-from-path', u'file-or-directory-identity', + u'file-or-directory-modify-seconds', u'file-or-directory-permissions', + u'file-position', u'file-position*', u'file-size', + u'file-stream-buffer-mode', u'file-stream-port?', u'file-truncate', + u'filename-extension', u'filesystem-change-evt', + u'filesystem-change-evt-cancel', u'filesystem-change-evt?', + u'filesystem-root-list', u'filter', u'filter-map', u'filter-not', + u'filter-read-input-port', u'find-executable-path', u'find-files', + u'find-library-collection-links', u'find-library-collection-paths', + u'find-relative-path', u'find-system-path', u'findf', u'first', + u'first-or/c', u'fixnum?', u'flat-contract', u'flat-contract-predicate', + u'flat-contract-property?', u'flat-contract?', u'flat-named-contract', + u'flatten', u'floating-point-bytes->real', u'flonum?', u'floor', + u'flush-output', u'fold-files', u'foldl', u'foldr', u'for-each', u'force', + u'format', u'fourth', u'fprintf', u'free-identifier=?', + u'free-label-identifier=?', u'free-template-identifier=?', + u'free-transformer-identifier=?', u'fsemaphore-count', u'fsemaphore-post', + u'fsemaphore-try-wait?', u'fsemaphore-wait', u'fsemaphore?', u'future', + u'future?', u'futures-enabled?', u'gcd', u'generate-member-key', + u'generate-temporaries', u'generic-set?', u'generic?', u'gensym', + u'get-output-bytes', u'get-output-string', u'get-preference', + u'get/build-late-neg-projection', u'get/build-val-first-projection', + u'getenv', u'global-port-print-handler', u'group-by', u'group-execute-bit', + u'group-read-bit', u'group-write-bit', u'guard-evt', u'handle-evt', + u'handle-evt?', u'has-blame?', u'has-contract?', u'hash', u'hash->list', + u'hash-clear', u'hash-clear!', u'hash-copy', u'hash-copy-clear', + u'hash-count', u'hash-empty?', u'hash-eq?', u'hash-equal?', u'hash-eqv?', + u'hash-for-each', u'hash-has-key?', u'hash-iterate-first', + u'hash-iterate-key', u'hash-iterate-key+value', u'hash-iterate-next', + u'hash-iterate-pair', u'hash-iterate-value', u'hash-keys', u'hash-map', + u'hash-placeholder?', u'hash-ref', u'hash-ref!', u'hash-remove', + u'hash-remove!', u'hash-set', u'hash-set!', u'hash-set*', u'hash-set*!', + u'hash-update', u'hash-update!', u'hash-values', u'hash-weak?', u'hash/c', + u'hash?', u'hasheq', u'hasheqv', u'identifier-binding', + u'identifier-binding-symbol', u'identifier-label-binding', + u'identifier-prune-lexical-context', + u'identifier-prune-to-source-module', + u'identifier-remove-from-definition-context', + u'identifier-template-binding', u'identifier-transformer-binding', + u'identifier?', u'identity', u'if/c', u'imag-part', u'immutable?', + u'impersonate-box', u'impersonate-channel', + u'impersonate-continuation-mark-key', u'impersonate-hash', + u'impersonate-hash-set', u'impersonate-procedure', + u'impersonate-procedure*', u'impersonate-prompt-tag', + u'impersonate-struct', u'impersonate-vector', u'impersonator-contract?', + u'impersonator-ephemeron', u'impersonator-of?', + u'impersonator-prop:application-mark', u'impersonator-prop:blame', + u'impersonator-prop:contracted', + u'impersonator-property-accessor-procedure?', u'impersonator-property?', + u'impersonator?', u'implementation?', u'implementation?/c', u'in-bytes', + u'in-bytes-lines', u'in-combinations', u'in-cycle', u'in-dict', + u'in-dict-keys', u'in-dict-pairs', u'in-dict-values', u'in-directory', + u'in-hash', u'in-hash-keys', u'in-hash-pairs', u'in-hash-values', + u'in-immutable-hash', u'in-immutable-hash-keys', + u'in-immutable-hash-pairs', u'in-immutable-hash-values', + u'in-immutable-set', u'in-indexed', u'in-input-port-bytes', + u'in-input-port-chars', u'in-lines', u'in-list', u'in-mlist', + u'in-mutable-hash', u'in-mutable-hash-keys', u'in-mutable-hash-pairs', + u'in-mutable-hash-values', u'in-mutable-set', u'in-naturals', + u'in-parallel', u'in-permutations', u'in-port', u'in-producer', u'in-range', + u'in-sequences', u'in-set', u'in-slice', u'in-stream', u'in-string', + u'in-syntax', u'in-value', u'in-values*-sequence', u'in-values-sequence', + u'in-vector', u'in-weak-hash', u'in-weak-hash-keys', u'in-weak-hash-pairs', + u'in-weak-hash-values', u'in-weak-set', u'inexact->exact', + u'inexact-real?', u'inexact?', u'infinite?', u'input-port-append', + u'input-port?', u'inspector?', u'instanceof/c', u'integer->char', + u'integer->integer-bytes', u'integer-bytes->integer', u'integer-in', + u'integer-length', u'integer-sqrt', u'integer-sqrt/remainder', u'integer?', + u'interface->method-names', u'interface-extension?', u'interface?', + u'internal-definition-context-binding-identifiers', + u'internal-definition-context-introduce', + u'internal-definition-context-seal', u'internal-definition-context?', + u'is-a?', u'is-a?/c', u'keyword->string', u'keyword-apply', u'keywordbytes', u'list->mutable-set', + u'list->mutable-seteq', u'list->mutable-seteqv', u'list->set', + u'list->seteq', u'list->seteqv', u'list->string', u'list->vector', + u'list->weak-set', u'list->weak-seteq', u'list->weak-seteqv', + u'list-contract?', u'list-prefix?', u'list-ref', u'list-set', u'list-tail', + u'list-update', u'list/c', u'list?', u'listen-port-number?', u'listof', + u'load', u'load-extension', u'load-on-demand-enabled', u'load-relative', + u'load-relative-extension', u'load/cd', u'load/use-compiled', + u'local-expand', u'local-expand/capture-lifts', + u'local-transformer-expand', u'local-transformer-expand/capture-lifts', + u'locale-string-encoding', u'log', u'log-all-levels', u'log-level-evt', + u'log-level?', u'log-max-level', u'log-message', u'log-receiver?', + u'logger-name', u'logger?', u'magnitude', u'make-arity-at-least', + u'make-base-empty-namespace', u'make-base-namespace', u'make-bytes', + u'make-channel', u'make-chaperone-contract', + u'make-continuation-mark-key', u'make-continuation-prompt-tag', + u'make-contract', u'make-custodian', u'make-custodian-box', + u'make-custom-hash', u'make-custom-hash-types', u'make-custom-set', + u'make-custom-set-types', u'make-date', u'make-date*', + u'make-derived-parameter', u'make-directory', u'make-directory*', + u'make-do-sequence', u'make-empty-namespace', + u'make-environment-variables', u'make-ephemeron', u'make-exn', + u'make-exn:break', u'make-exn:break:hang-up', u'make-exn:break:terminate', + u'make-exn:fail', u'make-exn:fail:contract', + u'make-exn:fail:contract:arity', u'make-exn:fail:contract:blame', + u'make-exn:fail:contract:continuation', + u'make-exn:fail:contract:divide-by-zero', + u'make-exn:fail:contract:non-fixnum-result', + u'make-exn:fail:contract:variable', u'make-exn:fail:filesystem', + u'make-exn:fail:filesystem:errno', u'make-exn:fail:filesystem:exists', + u'make-exn:fail:filesystem:missing-module', + u'make-exn:fail:filesystem:version', u'make-exn:fail:network', + u'make-exn:fail:network:errno', u'make-exn:fail:object', + u'make-exn:fail:out-of-memory', u'make-exn:fail:read', + u'make-exn:fail:read:eof', u'make-exn:fail:read:non-char', + u'make-exn:fail:syntax', u'make-exn:fail:syntax:missing-module', + u'make-exn:fail:syntax:unbound', u'make-exn:fail:unsupported', + u'make-exn:fail:user', u'make-file-or-directory-link', + u'make-flat-contract', u'make-fsemaphore', u'make-generic', + u'make-handle-get-preference-locked', u'make-hash', + u'make-hash-placeholder', u'make-hasheq', u'make-hasheq-placeholder', + u'make-hasheqv', u'make-hasheqv-placeholder', + u'make-immutable-custom-hash', u'make-immutable-hash', + u'make-immutable-hasheq', u'make-immutable-hasheqv', + u'make-impersonator-property', u'make-input-port', + u'make-input-port/read-to-peek', u'make-inspector', + u'make-keyword-procedure', u'make-known-char-range-list', + u'make-limited-input-port', u'make-list', u'make-lock-file-name', + u'make-log-receiver', u'make-logger', u'make-mixin-contract', + u'make-mutable-custom-set', u'make-none/c', u'make-object', + u'make-output-port', u'make-parameter', u'make-parent-directory*', + u'make-phantom-bytes', u'make-pipe', u'make-pipe-with-specials', + u'make-placeholder', u'make-plumber', u'make-polar', u'make-prefab-struct', + u'make-primitive-class', u'make-proj-contract', + u'make-pseudo-random-generator', u'make-reader-graph', u'make-readtable', + u'make-rectangular', u'make-rename-transformer', + u'make-resolved-module-path', u'make-security-guard', u'make-semaphore', + u'make-set!-transformer', u'make-shared-bytes', u'make-sibling-inspector', + u'make-special-comment', u'make-srcloc', u'make-string', + u'make-struct-field-accessor', u'make-struct-field-mutator', + u'make-struct-type', u'make-struct-type-property', + u'make-syntax-delta-introducer', u'make-syntax-introducer', + u'make-temporary-file', u'make-tentative-pretty-print-output-port', + u'make-thread-cell', u'make-thread-group', u'make-vector', + u'make-weak-box', u'make-weak-custom-hash', u'make-weak-custom-set', + u'make-weak-hash', u'make-weak-hasheq', u'make-weak-hasheqv', + u'make-will-executor', u'map', u'match-equality-test', + u'matches-arity-exactly?', u'max', u'mcar', u'mcdr', u'mcons', u'member', + u'member-name-key-hash-code', u'member-name-key=?', u'member-name-key?', + u'memf', u'memq', u'memv', u'merge-input', u'method-in-interface?', u'min', + u'mixin-contract', u'module->exports', u'module->imports', + u'module->language-info', u'module->namespace', + u'module-compiled-cross-phase-persistent?', u'module-compiled-exports', + u'module-compiled-imports', u'module-compiled-language-info', + u'module-compiled-name', u'module-compiled-submodules', + u'module-declared?', u'module-path-index-join', + u'module-path-index-resolve', u'module-path-index-split', + u'module-path-index-submodule', u'module-path-index?', u'module-path?', + u'module-predefined?', u'module-provide-protected?', u'modulo', u'mpair?', + u'mutable-set', u'mutable-seteq', u'mutable-seteqv', u'n->th', + u'nack-guard-evt', u'namespace-anchor->empty-namespace', + u'namespace-anchor->namespace', u'namespace-anchor?', + u'namespace-attach-module', u'namespace-attach-module-declaration', + u'namespace-base-phase', u'namespace-mapped-symbols', + u'namespace-module-identifier', u'namespace-module-registry', + u'namespace-require', u'namespace-require/constant', + u'namespace-require/copy', u'namespace-require/expansion-time', + u'namespace-set-variable-value!', u'namespace-symbol->identifier', + u'namespace-syntax-introduce', u'namespace-undefine-variable!', + u'namespace-unprotect-module', u'namespace-variable-value', u'namespace?', + u'nan?', u'natural-number/c', u'negate', u'negative?', u'never-evt', + u'new-∀/c', u'new-∃/c', u'newline', u'ninth', u'non-empty-listof', + u'non-empty-string?', u'none/c', u'normal-case-path', u'normalize-arity', + u'normalize-path', u'normalized-arity?', u'not', u'not/c', u'null', u'null?', + u'number->string', u'number?', u'numerator', u'object%', u'object->vector', + u'object-info', u'object-interface', u'object-method-arity-includes?', + u'object-name', u'object-or-false=?', u'object=?', u'object?', u'odd?', + u'one-of/c', u'open-input-bytes', u'open-input-file', + u'open-input-output-file', u'open-input-string', u'open-output-bytes', + u'open-output-file', u'open-output-nowhere', u'open-output-string', + u'or/c', u'order-of-magnitude', u'ormap', u'other-execute-bit', + u'other-read-bit', u'other-write-bit', u'output-port?', u'pair?', + u'parameter-procedure=?', u'parameter/c', u'parameter?', + u'parameterization?', u'parse-command-line', u'partition', u'path->bytes', + u'path->complete-path', u'path->directory-path', u'path->string', + u'path-add-suffix', u'path-convention-type', u'path-element->bytes', + u'path-element->string', u'path-element?', u'path-for-some-system?', + u'path-list-string->path-list', u'path-only', u'path-replace-suffix', + u'path-string?', u'pathbytes', u'port->bytes-lines', u'port->lines', + u'port->list', u'port->string', u'port-closed-evt', u'port-closed?', + u'port-commit-peeked', u'port-count-lines!', u'port-count-lines-enabled', + u'port-counts-lines?', u'port-display-handler', u'port-file-identity', + u'port-file-unlock', u'port-next-location', u'port-number?', + u'port-print-handler', u'port-progress-evt', + u'port-provides-progress-evts?', u'port-read-handler', + u'port-try-file-lock?', u'port-write-handler', u'port-writes-atomic?', + u'port-writes-special?', u'port?', u'positive?', u'predicate/c', + u'prefab-key->struct-type', u'prefab-key?', u'prefab-struct-key', + u'preferences-lock-file-mode', u'pregexp', u'pregexp?', u'pretty-display', + u'pretty-format', u'pretty-print', u'pretty-print-.-symbol-without-bars', + u'pretty-print-abbreviate-read-macros', u'pretty-print-columns', + u'pretty-print-current-style-table', u'pretty-print-depth', + u'pretty-print-exact-as-decimal', u'pretty-print-extend-style-table', + u'pretty-print-handler', u'pretty-print-newline', + u'pretty-print-post-print-hook', u'pretty-print-pre-print-hook', + u'pretty-print-print-hook', u'pretty-print-print-line', + u'pretty-print-remap-stylable', u'pretty-print-show-inexactness', + u'pretty-print-size-hook', u'pretty-print-style-table?', + u'pretty-printing', u'pretty-write', u'primitive-closure?', + u'primitive-result-arity', u'primitive?', u'print', u'print-as-expression', + u'print-boolean-long-form', u'print-box', u'print-graph', + u'print-hash-table', u'print-mpair-curly-braces', + u'print-pair-curly-braces', u'print-reader-abbreviations', + u'print-struct', u'print-syntax-width', u'print-unreadable', + u'print-vector-length', u'printable/c', u'printable<%>', u'printf', + u'println', u'procedure->method', u'procedure-arity', + u'procedure-arity-includes/c', u'procedure-arity-includes?', + u'procedure-arity?', u'procedure-closure-contents-eq?', + u'procedure-extract-target', u'procedure-keywords', + u'procedure-reduce-arity', u'procedure-reduce-keyword-arity', + u'procedure-rename', u'procedure-result-arity', u'procedure-specialize', + u'procedure-struct-type?', u'procedure?', u'process', u'process*', + u'process*/ports', u'process/ports', u'processor-count', u'progress-evt?', + u'promise-forced?', u'promise-running?', u'promise/c', u'promise/name?', + u'promise?', u'prop:arity-string', u'prop:arrow-contract', + u'prop:arrow-contract-get-info', u'prop:arrow-contract?', u'prop:blame', + u'prop:chaperone-contract', u'prop:checked-procedure', u'prop:contract', + u'prop:contracted', u'prop:custom-print-quotable', u'prop:custom-write', + u'prop:dict', u'prop:dict/contract', u'prop:equal+hash', u'prop:evt', + u'prop:exn:missing-module', u'prop:exn:srclocs', + u'prop:expansion-contexts', u'prop:flat-contract', + u'prop:impersonator-of', u'prop:input-port', + u'prop:liberal-define-context', u'prop:object-name', + u'prop:opt-chaperone-contract', u'prop:opt-chaperone-contract-get-test', + u'prop:opt-chaperone-contract?', u'prop:orc-contract', + u'prop:orc-contract-get-subcontracts', u'prop:orc-contract?', + u'prop:output-port', u'prop:place-location', u'prop:procedure', + u'prop:recursive-contract', u'prop:recursive-contract-unroll', + u'prop:recursive-contract?', u'prop:rename-transformer', u'prop:sequence', + u'prop:set!-transformer', u'prop:stream', u'proper-subset?', + u'pseudo-random-generator->vector', u'pseudo-random-generator-vector?', + u'pseudo-random-generator?', u'put-preferences', u'putenv', u'quotient', + u'quotient/remainder', u'radians->degrees', u'raise', + u'raise-argument-error', u'raise-arguments-error', u'raise-arity-error', + u'raise-blame-error', u'raise-contract-error', u'raise-mismatch-error', + u'raise-not-cons-blame-error', u'raise-range-error', + u'raise-result-error', u'raise-syntax-error', u'raise-type-error', + u'raise-user-error', u'random', u'random-seed', u'range', u'rational?', + u'rationalize', u'read', u'read-accept-bar-quote', u'read-accept-box', + u'read-accept-compiled', u'read-accept-dot', u'read-accept-graph', + u'read-accept-infix-dot', u'read-accept-lang', u'read-accept-quasiquote', + u'read-accept-reader', u'read-byte', u'read-byte-or-special', + u'read-bytes', u'read-bytes!', u'read-bytes!-evt', u'read-bytes-avail!', + u'read-bytes-avail!*', u'read-bytes-avail!-evt', + u'read-bytes-avail!/enable-break', u'read-bytes-evt', u'read-bytes-line', + u'read-bytes-line-evt', u'read-case-sensitive', u'read-cdot', u'read-char', + u'read-char-or-special', u'read-curly-brace-as-paren', + u'read-curly-brace-with-tag', u'read-decimal-as-inexact', + u'read-eval-print-loop', u'read-language', u'read-line', u'read-line-evt', + u'read-on-demand-source', u'read-square-bracket-as-paren', + u'read-square-bracket-with-tag', u'read-string', u'read-string!', + u'read-string!-evt', u'read-string-evt', u'read-syntax', + u'read-syntax/recursive', u'read/recursive', u'readtable-mapping', + u'readtable?', u'real->decimal-string', u'real->double-flonum', + u'real->floating-point-bytes', u'real->single-flonum', u'real-in', + u'real-part', u'real?', u'reencode-input-port', u'reencode-output-port', + u'regexp', u'regexp-match', u'regexp-match*', u'regexp-match-evt', + u'regexp-match-exact?', u'regexp-match-peek', + u'regexp-match-peek-immediate', u'regexp-match-peek-positions', + u'regexp-match-peek-positions*', + u'regexp-match-peek-positions-immediate', + u'regexp-match-peek-positions-immediate/end', + u'regexp-match-peek-positions/end', u'regexp-match-positions', + u'regexp-match-positions*', u'regexp-match-positions/end', + u'regexp-match/end', u'regexp-match?', u'regexp-max-lookbehind', + u'regexp-quote', u'regexp-replace', u'regexp-replace*', + u'regexp-replace-quote', u'regexp-replaces', u'regexp-split', + u'regexp-try-match', u'regexp?', u'relative-path?', u'relocate-input-port', + u'relocate-output-port', u'remainder', u'remf', u'remf*', u'remove', + u'remove*', u'remove-duplicates', u'remq', u'remq*', u'remv', u'remv*', + u'rename-contract', u'rename-file-or-directory', + u'rename-transformer-target', u'rename-transformer?', u'replace-evt', + u'reroot-path', u'resolve-path', u'resolved-module-path-name', + u'resolved-module-path?', u'rest', u'reverse', u'round', u'second', + u'seconds->date', u'security-guard?', u'semaphore-peek-evt', + u'semaphore-peek-evt?', u'semaphore-post', u'semaphore-try-wait?', + u'semaphore-wait', u'semaphore-wait/enable-break', u'semaphore?', + u'sequence->list', u'sequence->stream', u'sequence-add-between', + u'sequence-andmap', u'sequence-append', u'sequence-count', + u'sequence-filter', u'sequence-fold', u'sequence-for-each', + u'sequence-generate', u'sequence-generate*', u'sequence-length', + u'sequence-map', u'sequence-ormap', u'sequence-ref', u'sequence-tail', + u'sequence/c', u'sequence?', u'set', u'set!-transformer-procedure', + u'set!-transformer?', u'set->list', u'set->stream', u'set-add', u'set-add!', + u'set-box!', u'set-clear', u'set-clear!', u'set-copy', u'set-copy-clear', + u'set-count', u'set-empty?', u'set-eq?', u'set-equal?', u'set-eqv?', + u'set-first', u'set-for-each', u'set-implements/c', u'set-implements?', + u'set-intersect', u'set-intersect!', u'set-map', u'set-mcar!', u'set-mcdr!', + u'set-member?', u'set-mutable?', u'set-phantom-bytes!', + u'set-port-next-location!', u'set-remove', u'set-remove!', u'set-rest', + u'set-some-basic-contracts!', u'set-subtract', u'set-subtract!', + u'set-symmetric-difference', u'set-symmetric-difference!', u'set-union', + u'set-union!', u'set-weak?', u'set/c', u'set=?', u'set?', u'seteq', u'seteqv', + u'seventh', u'sgn', u'shared-bytes', u'shell-execute', u'shrink-path-wrt', + u'shuffle', u'simple-form-path', u'simplify-path', u'sin', + u'single-flonum?', u'sinh', u'sixth', u'skip-projection-wrapper?', u'sleep', + u'some-system-path->string', u'sort', u'special-comment-value', + u'special-comment?', u'special-filter-input-port', u'split-at', + u'split-at-right', u'split-common-prefix', u'split-path', u'splitf-at', + u'splitf-at-right', u'sqr', u'sqrt', u'srcloc', u'srcloc->string', + u'srcloc-column', u'srcloc-line', u'srcloc-position', u'srcloc-source', + u'srcloc-span', u'srcloc?', u'stop-after', u'stop-before', u'stream->list', + u'stream-add-between', u'stream-andmap', u'stream-append', u'stream-count', + u'stream-empty?', u'stream-filter', u'stream-first', u'stream-fold', + u'stream-for-each', u'stream-length', u'stream-map', u'stream-ormap', + u'stream-ref', u'stream-rest', u'stream-tail', u'stream/c', u'stream?', + u'string', u'string->bytes/latin-1', u'string->bytes/locale', + u'string->bytes/utf-8', u'string->immutable-string', u'string->keyword', + u'string->list', u'string->number', u'string->path', + u'string->path-element', u'string->some-system-path', u'string->symbol', + u'string->uninterned-symbol', u'string->unreadable-symbol', + u'string-append', u'string-append*', u'string-ci<=?', u'string-ci=?', u'string-ci>?', u'string-contains?', + u'string-copy', u'string-copy!', u'string-downcase', + u'string-environment-variable-name?', u'string-fill!', u'string-foldcase', + u'string-join', u'string-len/c', u'string-length', u'string-locale-ci?', u'string-locale-downcase', + u'string-locale-upcase', u'string-locale?', u'string-no-nuls?', u'string-normalize-nfc', + u'string-normalize-nfd', u'string-normalize-nfkc', + u'string-normalize-nfkd', u'string-normalize-spaces', u'string-port?', + u'string-prefix?', u'string-ref', u'string-replace', u'string-set!', + u'string-split', u'string-suffix?', u'string-titlecase', u'string-trim', + u'string-upcase', u'string-utf-8-length', u'string<=?', u'string=?', u'string>?', u'string?', u'struct->vector', + u'struct-accessor-procedure?', u'struct-constructor-procedure?', + u'struct-info', u'struct-mutator-procedure?', + u'struct-predicate-procedure?', u'struct-type-info', + u'struct-type-make-constructor', u'struct-type-make-predicate', + u'struct-type-property-accessor-procedure?', u'struct-type-property/c', + u'struct-type-property?', u'struct-type?', u'struct:arity-at-least', + u'struct:arrow-contract-info', u'struct:date', u'struct:date*', + u'struct:exn', u'struct:exn:break', u'struct:exn:break:hang-up', + u'struct:exn:break:terminate', u'struct:exn:fail', + u'struct:exn:fail:contract', u'struct:exn:fail:contract:arity', + u'struct:exn:fail:contract:blame', + u'struct:exn:fail:contract:continuation', + u'struct:exn:fail:contract:divide-by-zero', + u'struct:exn:fail:contract:non-fixnum-result', + u'struct:exn:fail:contract:variable', u'struct:exn:fail:filesystem', + u'struct:exn:fail:filesystem:errno', + u'struct:exn:fail:filesystem:exists', + u'struct:exn:fail:filesystem:missing-module', + u'struct:exn:fail:filesystem:version', u'struct:exn:fail:network', + u'struct:exn:fail:network:errno', u'struct:exn:fail:object', + u'struct:exn:fail:out-of-memory', u'struct:exn:fail:read', + u'struct:exn:fail:read:eof', u'struct:exn:fail:read:non-char', + u'struct:exn:fail:syntax', u'struct:exn:fail:syntax:missing-module', + u'struct:exn:fail:syntax:unbound', u'struct:exn:fail:unsupported', + u'struct:exn:fail:user', u'struct:srcloc', + u'struct:wrapped-extra-arg-arrow', u'struct?', u'sub1', u'subbytes', + u'subclass?', u'subclass?/c', u'subprocess', u'subprocess-group-enabled', + u'subprocess-kill', u'subprocess-pid', u'subprocess-status', + u'subprocess-wait', u'subprocess?', u'subset?', u'substring', u'suggest/c', + u'symbol->string', u'symbol-interned?', u'symbol-unreadable?', u'symboldatum', + u'syntax->list', u'syntax-arm', u'syntax-column', u'syntax-debug-info', + u'syntax-disarm', u'syntax-e', u'syntax-line', + u'syntax-local-bind-syntaxes', u'syntax-local-certifier', + u'syntax-local-context', u'syntax-local-expand-expression', + u'syntax-local-get-shadower', u'syntax-local-identifier-as-binding', + u'syntax-local-introduce', u'syntax-local-lift-context', + u'syntax-local-lift-expression', u'syntax-local-lift-module', + u'syntax-local-lift-module-end-declaration', + u'syntax-local-lift-provide', u'syntax-local-lift-require', + u'syntax-local-lift-values-expression', + u'syntax-local-make-definition-context', + u'syntax-local-make-delta-introducer', + u'syntax-local-module-defined-identifiers', + u'syntax-local-module-exports', + u'syntax-local-module-required-identifiers', u'syntax-local-name', + u'syntax-local-phase-level', u'syntax-local-submodules', + u'syntax-local-transforming-module-provides?', u'syntax-local-value', + u'syntax-local-value/immediate', u'syntax-original?', u'syntax-position', + u'syntax-property', u'syntax-property-preserved?', + u'syntax-property-symbol-keys', u'syntax-protect', u'syntax-rearm', + u'syntax-recertify', u'syntax-shift-phase-level', u'syntax-source', + u'syntax-source-module', u'syntax-span', u'syntax-taint', + u'syntax-tainted?', u'syntax-track-origin', + u'syntax-transforming-module-expression?', + u'syntax-transforming-with-lifts?', u'syntax-transforming?', u'syntax/c', + u'syntax?', u'system', u'system*', u'system*/exit-code', + u'system-big-endian?', u'system-idle-evt', u'system-language+country', + u'system-library-subpath', u'system-path-convention-type', u'system-type', + u'system/exit-code', u'tail-marks-match?', u'take', u'take-common-prefix', + u'take-right', u'takef', u'takef-right', u'tan', u'tanh', + u'tcp-abandon-port', u'tcp-accept', u'tcp-accept-evt', + u'tcp-accept-ready?', u'tcp-accept/enable-break', u'tcp-addresses', + u'tcp-close', u'tcp-connect', u'tcp-connect/enable-break', u'tcp-listen', + u'tcp-listener?', u'tcp-port?', u'tentative-pretty-print-port-cancel', + u'tentative-pretty-print-port-transfer', u'tenth', u'terminal-port?', + u'the-unsupplied-arg', u'third', u'thread', u'thread-cell-ref', + u'thread-cell-set!', u'thread-cell-values?', u'thread-cell?', + u'thread-dead-evt', u'thread-dead?', u'thread-group?', u'thread-receive', + u'thread-receive-evt', u'thread-resume', u'thread-resume-evt', + u'thread-rewind-receive', u'thread-running?', u'thread-send', + u'thread-suspend', u'thread-suspend-evt', u'thread-try-receive', + u'thread-wait', u'thread/suspend-to-kill', u'thread?', u'time-apply', + u'touch', u'transplant-input-port', u'transplant-output-port', u'true', + u'truncate', u'udp-addresses', u'udp-bind!', u'udp-bound?', u'udp-close', + u'udp-connect!', u'udp-connected?', u'udp-multicast-interface', + u'udp-multicast-join-group!', u'udp-multicast-leave-group!', + u'udp-multicast-loopback?', u'udp-multicast-set-interface!', + u'udp-multicast-set-loopback!', u'udp-multicast-set-ttl!', + u'udp-multicast-ttl', u'udp-open-socket', u'udp-receive!', + u'udp-receive!*', u'udp-receive!-evt', u'udp-receive!/enable-break', + u'udp-receive-ready-evt', u'udp-send', u'udp-send*', u'udp-send-evt', + u'udp-send-ready-evt', u'udp-send-to', u'udp-send-to*', u'udp-send-to-evt', + u'udp-send-to/enable-break', u'udp-send/enable-break', u'udp?', u'unbox', + u'uncaught-exception-handler', u'unit?', u'unspecified-dom', + u'unsupplied-arg?', u'use-collection-link-paths', + u'use-compiled-file-paths', u'use-user-specific-search-paths', + u'user-execute-bit', u'user-read-bit', u'user-write-bit', u'value-blame', + u'value-contract', u'values', u'variable-reference->empty-namespace', + u'variable-reference->module-base-phase', + u'variable-reference->module-declaration-inspector', + u'variable-reference->module-path-index', + u'variable-reference->module-source', u'variable-reference->namespace', + u'variable-reference->phase', + u'variable-reference->resolved-module-path', + u'variable-reference-constant?', u'variable-reference?', u'vector', + u'vector->immutable-vector', u'vector->list', + u'vector->pseudo-random-generator', u'vector->pseudo-random-generator!', + u'vector->values', u'vector-append', u'vector-argmax', u'vector-argmin', + u'vector-copy', u'vector-copy!', u'vector-count', u'vector-drop', + u'vector-drop-right', u'vector-fill!', u'vector-filter', + u'vector-filter-not', u'vector-immutable', u'vector-immutable/c', + u'vector-immutableof', u'vector-length', u'vector-map', u'vector-map!', + u'vector-member', u'vector-memq', u'vector-memv', u'vector-ref', + u'vector-set!', u'vector-set*!', u'vector-set-performance-stats!', + u'vector-split-at', u'vector-split-at-right', u'vector-take', + u'vector-take-right', u'vector/c', u'vector?', u'vectorof', u'version', + u'void', u'void?', u'weak-box-value', u'weak-box?', u'weak-set', + u'weak-seteq', u'weak-seteqv', u'will-execute', u'will-executor?', + u'will-register', u'will-try-execute', u'with-input-from-bytes', + u'with-input-from-file', u'with-input-from-string', + u'with-output-to-bytes', u'with-output-to-file', u'with-output-to-string', + u'would-be-future', u'wrap-evt', u'wrapped-extra-arg-arrow', + u'wrapped-extra-arg-arrow-extra-neg-party-argument', + u'wrapped-extra-arg-arrow-real-func', u'wrapped-extra-arg-arrow?', + u'writable<%>', u'write', u'write-byte', u'write-bytes', + u'write-bytes-avail', u'write-bytes-avail*', u'write-bytes-avail-evt', + u'write-bytes-avail/enable-break', u'write-char', u'write-special', + u'write-special-avail*', u'write-special-evt', u'write-string', + u'write-to-file', u'writeln', u'xor', u'zero?', u'~.a', u'~.s', u'~.v', u'~a', + u'~e', u'~r', u'~s', u'~v' + ) + + _opening_parenthesis = r'[([{]' + _closing_parenthesis = r'[)\]}]' + _delimiters = r'()[\]{}",\'`;\s' + _symbol = r'(?u)(?:\|[^|]*\||\\[\w\W]|[^|\\%s]+)+' % _delimiters + _exact_decimal_prefix = r'(?:#e)?(?:#d)?(?:#e)?' + _exponent = r'(?:[defls][-+]?\d+)' + _inexact_simple_no_hashes = r'(?:\d+(?:/\d+|\.\d*)?|\.\d+)' + _inexact_simple = (r'(?:%s|(?:\d+#+(?:\.#*|/\d+#*)?|\.\d+#+|' + r'\d+(?:\.\d*#+|/\d+#+)))' % _inexact_simple_no_hashes) + _inexact_normal_no_hashes = r'(?:%s%s?)' % (_inexact_simple_no_hashes, + _exponent) + _inexact_normal = r'(?:%s%s?)' % (_inexact_simple, _exponent) + _inexact_special = r'(?:(?:inf|nan)\.[0f])' + _inexact_real = r'(?:[-+]?%s|[-+]%s)' % (_inexact_normal, + _inexact_special) + _inexact_unsigned = r'(?:%s|%s)' % (_inexact_normal, _inexact_special) + + tokens = { + 'root': [ + (_closing_parenthesis, Error), + (r'(?!\Z)', Text, 'unquoted-datum') + ], + 'datum': [ + (r'(?s)#;|#![ /]([^\\\n]|\\.)*', Comment), + (u';[^\\n\\r\x85\u2028\u2029]*', Comment.Single), + (r'#\|', Comment.Multiline, 'block-comment'), + + # Whitespaces + (r'(?u)\s+', Text), + + # Numbers: Keep in mind Racket reader hash prefixes, which + # can denote the base or the type. These don't map neatly + # onto Pygments token types; some judgment calls here. + + # #d or no prefix + (r'(?i)%s[-+]?\d+(?=[%s])' % (_exact_decimal_prefix, _delimiters), + Number.Integer, '#pop'), + (r'(?i)%s[-+]?(\d+(\.\d*)?|\.\d+)([deflst][-+]?\d+)?(?=[%s])' % + (_exact_decimal_prefix, _delimiters), Number.Float, '#pop'), + (r'(?i)%s[-+]?(%s([-+]%s?i)?|[-+]%s?i)(?=[%s])' % + (_exact_decimal_prefix, _inexact_normal_no_hashes, + _inexact_normal_no_hashes, _inexact_normal_no_hashes, + _delimiters), Number, '#pop'), + + # Inexact without explicit #i + (r'(?i)(#d)?(%s([-+]%s?i)?|[-+]%s?i|%s@%s)(?=[%s])' % + (_inexact_real, _inexact_unsigned, _inexact_unsigned, + _inexact_real, _inexact_real, _delimiters), Number.Float, + '#pop'), + + # The remaining extflonums + (r'(?i)(([-+]?%st[-+]?\d+)|[-+](inf|nan)\.t)(?=[%s])' % + (_inexact_simple, _delimiters), Number.Float, '#pop'), + + # #b + (r'(?i)(#[ei])?#b%s' % _symbol, Number.Bin, '#pop'), + + # #o + (r'(?i)(#[ei])?#o%s' % _symbol, Number.Oct, '#pop'), + + # #x + (r'(?i)(#[ei])?#x%s' % _symbol, Number.Hex, '#pop'), + + # #i is always inexact, i.e. float + (r'(?i)(#d)?#i%s' % _symbol, Number.Float, '#pop'), + + # Strings and characters + (r'#?"', String.Double, ('#pop', 'string')), + (r'#<<(.+)\n(^(?!\1$).*$\n)*^\1$', String.Heredoc, '#pop'), + (r'#\\(u[\da-fA-F]{1,4}|U[\da-fA-F]{1,8})', String.Char, '#pop'), + (r'(?is)#\\([0-7]{3}|[a-z]+|.)', String.Char, '#pop'), + (r'(?s)#[pr]x#?"(\\?.)*?"', String.Regex, '#pop'), + + # Constants + (r'#(true|false|[tTfF])', Name.Constant, '#pop'), + + # Keyword argument names (e.g. #:keyword) + (r'#:%s' % _symbol, Keyword.Declaration, '#pop'), + + # Reader extensions + (r'(#lang |#!)(\S+)', + bygroups(Keyword.Namespace, Name.Namespace)), + (r'#reader', Keyword.Namespace, 'quoted-datum'), + + # Other syntax + (r"(?i)\.(?=[%s])|#c[is]|#['`]|#,@?" % _delimiters, Operator), + (r"'|#[s&]|#hash(eqv?)?|#\d*(?=%s)" % _opening_parenthesis, + Operator, ('#pop', 'quoted-datum')) + ], + 'datum*': [ + (r'`|,@?', Operator), + (_symbol, String.Symbol, '#pop'), + (r'[|\\]', Error), + default('#pop') + ], + 'list': [ + (_closing_parenthesis, Punctuation, '#pop') + ], + 'unquoted-datum': [ + include('datum'), + (r'quote(?=[%s])' % _delimiters, Keyword, + ('#pop', 'quoted-datum')), + (r'`', Operator, ('#pop', 'quasiquoted-datum')), + (r'quasiquote(?=[%s])' % _delimiters, Keyword, + ('#pop', 'quasiquoted-datum')), + (_opening_parenthesis, Punctuation, ('#pop', 'unquoted-list')), + (words(_keywords, prefix='(?u)', suffix='(?=[%s])' % _delimiters), + Keyword, '#pop'), + (words(_builtins, prefix='(?u)', suffix='(?=[%s])' % _delimiters), + Name.Builtin, '#pop'), + (_symbol, Name, '#pop'), + include('datum*') + ], + 'unquoted-list': [ + include('list'), + (r'(?!\Z)', Text, 'unquoted-datum') + ], + 'quasiquoted-datum': [ + include('datum'), + (r',@?', Operator, ('#pop', 'unquoted-datum')), + (r'unquote(-splicing)?(?=[%s])' % _delimiters, Keyword, + ('#pop', 'unquoted-datum')), + (_opening_parenthesis, Punctuation, ('#pop', 'quasiquoted-list')), + include('datum*') + ], + 'quasiquoted-list': [ + include('list'), + (r'(?!\Z)', Text, 'quasiquoted-datum') + ], + 'quoted-datum': [ + include('datum'), + (_opening_parenthesis, Punctuation, ('#pop', 'quoted-list')), + include('datum*') + ], + 'quoted-list': [ + include('list'), + (r'(?!\Z)', Text, 'quoted-datum') + ], + 'block-comment': [ + (r'#\|', Comment.Multiline, '#push'), + (r'\|#', Comment.Multiline, '#pop'), + (r'[^#|]+|.', Comment.Multiline) + ], + 'string': [ + (r'"', String.Double, '#pop'), + (r'(?s)\\([0-7]{1,3}|x[\da-fA-F]{1,2}|u[\da-fA-F]{1,4}|' + r'U[\da-fA-F]{1,8}|.)', String.Escape), + (r'[^\\"]+', String.Double) + ] + } + + +class NewLispLexer(RegexLexer): + """ + For `newLISP. `_ source code (version 10.3.0). + + .. versionadded:: 1.5 + """ + + name = 'NewLisp' + aliases = ['newlisp'] + filenames = ['*.lsp', '*.nl', '*.kif'] + mimetypes = ['text/x-newlisp', 'application/x-newlisp'] + + flags = re.IGNORECASE | re.MULTILINE | re.UNICODE + + # list of built-in functions for newLISP version 10.3 + builtins = ( + '^', '--', '-', ':', '!', '!=', '?', '@', '*', '/', '&', '%', '+', '++', + '<', '<<', '<=', '=', '>', '>=', '>>', '|', '~', '$', '$0', '$1', '$10', + '$11', '$12', '$13', '$14', '$15', '$2', '$3', '$4', '$5', '$6', '$7', + '$8', '$9', '$args', '$idx', '$it', '$main-args', 'abort', 'abs', + 'acos', 'acosh', 'add', 'address', 'amb', 'and', 'append-file', + 'append', 'apply', 'args', 'array-list', 'array?', 'array', 'asin', + 'asinh', 'assoc', 'atan', 'atan2', 'atanh', 'atom?', 'base64-dec', + 'base64-enc', 'bayes-query', 'bayes-train', 'begin', + 'beta', 'betai', 'bind', 'binomial', 'bits', 'callback', + 'case', 'catch', 'ceil', 'change-dir', 'char', 'chop', 'Class', 'clean', + 'close', 'command-event', 'cond', 'cons', 'constant', + 'context?', 'context', 'copy-file', 'copy', 'cos', 'cosh', 'count', + 'cpymem', 'crc32', 'crit-chi2', 'crit-z', 'current-line', 'curry', + 'date-list', 'date-parse', 'date-value', 'date', 'debug', 'dec', + 'def-new', 'default', 'define-macro', 'define', + 'delete-file', 'delete-url', 'delete', 'destroy', 'det', 'device', + 'difference', 'directory?', 'directory', 'div', 'do-until', 'do-while', + 'doargs', 'dolist', 'dostring', 'dotimes', 'dotree', 'dump', 'dup', + 'empty?', 'encrypt', 'ends-with', 'env', 'erf', 'error-event', + 'eval-string', 'eval', 'exec', 'exists', 'exit', 'exp', 'expand', + 'explode', 'extend', 'factor', 'fft', 'file-info', 'file?', 'filter', + 'find-all', 'find', 'first', 'flat', 'float?', 'float', 'floor', 'flt', + 'fn', 'for-all', 'for', 'fork', 'format', 'fv', 'gammai', 'gammaln', + 'gcd', 'get-char', 'get-float', 'get-int', 'get-long', 'get-string', + 'get-url', 'global?', 'global', 'if-not', 'if', 'ifft', 'import', 'inc', + 'index', 'inf?', 'int', 'integer?', 'integer', 'intersect', 'invert', + 'irr', 'join', 'lambda-macro', 'lambda?', 'lambda', 'last-error', + 'last', 'legal?', 'length', 'let', 'letex', 'letn', + 'list?', 'list', 'load', 'local', 'log', 'lookup', + 'lower-case', 'macro?', 'main-args', 'MAIN', 'make-dir', 'map', 'mat', + 'match', 'max', 'member', 'min', 'mod', 'module', 'mul', 'multiply', + 'NaN?', 'net-accept', 'net-close', 'net-connect', 'net-error', + 'net-eval', 'net-interface', 'net-ipv', 'net-listen', 'net-local', + 'net-lookup', 'net-packet', 'net-peek', 'net-peer', 'net-ping', + 'net-receive-from', 'net-receive-udp', 'net-receive', 'net-select', + 'net-send-to', 'net-send-udp', 'net-send', 'net-service', + 'net-sessions', 'new', 'nil?', 'nil', 'normal', 'not', 'now', 'nper', + 'npv', 'nth', 'null?', 'number?', 'open', 'or', 'ostype', 'pack', + 'parse-date', 'parse', 'peek', 'pipe', 'pmt', 'pop-assoc', 'pop', + 'post-url', 'pow', 'prefix', 'pretty-print', 'primitive?', 'print', + 'println', 'prob-chi2', 'prob-z', 'process', 'prompt-event', + 'protected?', 'push', 'put-url', 'pv', 'quote?', 'quote', 'rand', + 'random', 'randomize', 'read', 'read-char', 'read-expr', 'read-file', + 'read-key', 'read-line', 'read-utf8', 'reader-event', + 'real-path', 'receive', 'ref-all', 'ref', 'regex-comp', 'regex', + 'remove-dir', 'rename-file', 'replace', 'reset', 'rest', 'reverse', + 'rotate', 'round', 'save', 'search', 'seed', 'seek', 'select', 'self', + 'semaphore', 'send', 'sequence', 'series', 'set-locale', 'set-ref-all', + 'set-ref', 'set', 'setf', 'setq', 'sgn', 'share', 'signal', 'silent', + 'sin', 'sinh', 'sleep', 'slice', 'sort', 'source', 'spawn', 'sqrt', + 'starts-with', 'string?', 'string', 'sub', 'swap', 'sym', 'symbol?', + 'symbols', 'sync', 'sys-error', 'sys-info', 'tan', 'tanh', 'term', + 'throw-error', 'throw', 'time-of-day', 'time', 'timer', 'title-case', + 'trace-highlight', 'trace', 'transpose', 'Tree', 'trim', 'true?', + 'true', 'unicode', 'unify', 'unique', 'unless', 'unpack', 'until', + 'upper-case', 'utf8', 'utf8len', 'uuid', 'wait-pid', 'when', 'while', + 'write', 'write-char', 'write-file', 'write-line', + 'xfer-event', 'xml-error', 'xml-parse', 'xml-type-tags', 'zero?', + ) + + # valid names + valid_name = r'([\w!$%&*+.,/<=>?@^~|-])+|(\[.*?\])+' + + tokens = { + 'root': [ + # shebang + (r'#!(.*?)$', Comment.Preproc), + # comments starting with semicolon + (r';.*$', Comment.Single), + # comments starting with # + (r'#.*$', Comment.Single), + + # whitespace + (r'\s+', Text), + + # strings, symbols and characters + (r'"(\\\\|\\"|[^"])*"', String), + + # braces + (r'\{', String, "bracestring"), + + # [text] ... [/text] delimited strings + (r'\[text\]*', String, "tagstring"), + + # 'special' operators... + (r"('|:)", Operator), + + # highlight the builtins + (words(builtins, suffix=r'\b'), + Keyword), + + # the remaining functions + (r'(?<=\()' + valid_name, Name.Variable), + + # the remaining variables + (valid_name, String.Symbol), + + # parentheses + (r'(\(|\))', Punctuation), + ], + + # braced strings... + 'bracestring': [ + (r'\{', String, "#push"), + (r'\}', String, "#pop"), + ('[^{}]+', String), + ], + + # tagged [text]...[/text] delimited strings... + 'tagstring': [ + (r'(?s)(.*?)(\[/text\])', String, '#pop'), + ], + } + + +class EmacsLispLexer(RegexLexer): + """ + An ELisp lexer, parsing a stream and outputting the tokens + needed to highlight elisp code. + + .. versionadded:: 2.1 + """ + name = 'EmacsLisp' + aliases = ['emacs', 'elisp', 'emacs-lisp'] + filenames = ['*.el'] + mimetypes = ['text/x-elisp', 'application/x-elisp'] + + flags = re.MULTILINE + + # couple of useful regexes + + # characters that are not macro-characters and can be used to begin a symbol + nonmacro = r'\\.|[\w!$%&*+-/<=>?@^{}~|]' + constituent = nonmacro + '|[#.:]' + terminated = r'(?=[ "()\]\'\n,;`])' # whitespace or terminating macro characters + + # symbol token, reverse-engineered from hyperspec + # Take a deep breath... + symbol = r'((?:%s)(?:%s)*)' % (nonmacro, constituent) + + macros = set(( + 'atomic-change-group', 'case', 'block', 'cl-block', 'cl-callf', 'cl-callf2', + 'cl-case', 'cl-decf', 'cl-declaim', 'cl-declare', + 'cl-define-compiler-macro', 'cl-defmacro', 'cl-defstruct', + 'cl-defsubst', 'cl-deftype', 'cl-defun', 'cl-destructuring-bind', + 'cl-do', 'cl-do*', 'cl-do-all-symbols', 'cl-do-symbols', 'cl-dolist', + 'cl-dotimes', 'cl-ecase', 'cl-etypecase', 'eval-when', 'cl-eval-when', 'cl-flet', + 'cl-flet*', 'cl-function', 'cl-incf', 'cl-labels', 'cl-letf', + 'cl-letf*', 'cl-load-time-value', 'cl-locally', 'cl-loop', + 'cl-macrolet', 'cl-multiple-value-bind', 'cl-multiple-value-setq', + 'cl-progv', 'cl-psetf', 'cl-psetq', 'cl-pushnew', 'cl-remf', + 'cl-return', 'cl-return-from', 'cl-rotatef', 'cl-shiftf', + 'cl-symbol-macrolet', 'cl-tagbody', 'cl-the', 'cl-typecase', + 'combine-after-change-calls', 'condition-case-unless-debug', 'decf', + 'declaim', 'declare', 'declare-function', 'def-edebug-spec', + 'defadvice', 'defclass', 'defcustom', 'defface', 'defgeneric', + 'defgroup', 'define-advice', 'define-alternatives', + 'define-compiler-macro', 'define-derived-mode', 'define-generic-mode', + 'define-global-minor-mode', 'define-globalized-minor-mode', + 'define-minor-mode', 'define-modify-macro', + 'define-obsolete-face-alias', 'define-obsolete-function-alias', + 'define-obsolete-variable-alias', 'define-setf-expander', + 'define-skeleton', 'defmacro', 'defmethod', 'defsetf', 'defstruct', + 'defsubst', 'deftheme', 'deftype', 'defun', 'defvar-local', + 'delay-mode-hooks', 'destructuring-bind', 'do', 'do*', + 'do-all-symbols', 'do-symbols', 'dolist', 'dont-compile', 'dotimes', + 'dotimes-with-progress-reporter', 'ecase', 'ert-deftest', 'etypecase', + 'eval-and-compile', 'eval-when-compile', 'flet', 'ignore-errors', + 'incf', 'labels', 'lambda', 'letrec', 'lexical-let', 'lexical-let*', + 'loop', 'multiple-value-bind', 'multiple-value-setq', 'noreturn', + 'oref', 'oref-default', 'oset', 'oset-default', 'pcase', + 'pcase-defmacro', 'pcase-dolist', 'pcase-exhaustive', 'pcase-let', + 'pcase-let*', 'pop', 'psetf', 'psetq', 'push', 'pushnew', 'remf', + 'return', 'rotatef', 'rx', 'save-match-data', 'save-selected-window', + 'save-window-excursion', 'setf', 'setq-local', 'shiftf', + 'track-mouse', 'typecase', 'unless', 'use-package', 'when', + 'while-no-input', 'with-case-table', 'with-category-table', + 'with-coding-priority', 'with-current-buffer', 'with-demoted-errors', + 'with-eval-after-load', 'with-file-modes', 'with-local-quit', + 'with-output-to-string', 'with-output-to-temp-buffer', + 'with-parsed-tramp-file-name', 'with-selected-frame', + 'with-selected-window', 'with-silent-modifications', 'with-slots', + 'with-syntax-table', 'with-temp-buffer', 'with-temp-file', + 'with-temp-message', 'with-timeout', 'with-tramp-connection-property', + 'with-tramp-file-property', 'with-tramp-progress-reporter', + 'with-wrapper-hook', 'load-time-value', 'locally', 'macrolet', 'progv', + 'return-from', + )) + + special_forms = set(( + 'and', 'catch', 'cond', 'condition-case', 'defconst', 'defvar', + 'function', 'if', 'interactive', 'let', 'let*', 'or', 'prog1', + 'prog2', 'progn', 'quote', 'save-current-buffer', 'save-excursion', + 'save-restriction', 'setq', 'setq-default', 'subr-arity', + 'unwind-protect', 'while', + )) + + builtin_function = set(( + '%', '*', '+', '-', '/', '/=', '1+', '1-', '<', '<=', '=', '>', '>=', + 'Snarf-documentation', 'abort-recursive-edit', 'abs', + 'accept-process-output', 'access-file', 'accessible-keymaps', 'acos', + 'active-minibuffer-window', 'add-face-text-property', + 'add-name-to-file', 'add-text-properties', 'all-completions', + 'append', 'apply', 'apropos-internal', 'aref', 'arrayp', 'aset', + 'ash', 'asin', 'assoc', 'assoc-string', 'assq', 'atan', 'atom', + 'autoload', 'autoload-do-load', 'backtrace', 'backtrace--locals', + 'backtrace-debug', 'backtrace-eval', 'backtrace-frame', + 'backward-char', 'backward-prefix-chars', 'barf-if-buffer-read-only', + 'base64-decode-region', 'base64-decode-string', + 'base64-encode-region', 'base64-encode-string', 'beginning-of-line', + 'bidi-find-overridden-directionality', 'bidi-resolved-levels', + 'bitmap-spec-p', 'bobp', 'bolp', 'bool-vector', + 'bool-vector-count-consecutive', 'bool-vector-count-population', + 'bool-vector-exclusive-or', 'bool-vector-intersection', + 'bool-vector-not', 'bool-vector-p', 'bool-vector-set-difference', + 'bool-vector-subsetp', 'bool-vector-union', 'boundp', + 'buffer-base-buffer', 'buffer-chars-modified-tick', + 'buffer-enable-undo', 'buffer-file-name', 'buffer-has-markers-at', + 'buffer-list', 'buffer-live-p', 'buffer-local-value', + 'buffer-local-variables', 'buffer-modified-p', 'buffer-modified-tick', + 'buffer-name', 'buffer-size', 'buffer-string', 'buffer-substring', + 'buffer-substring-no-properties', 'buffer-swap-text', 'bufferp', + 'bury-buffer-internal', 'byte-code', 'byte-code-function-p', + 'byte-to-position', 'byte-to-string', 'byteorder', + 'call-interactively', 'call-last-kbd-macro', 'call-process', + 'call-process-region', 'cancel-kbd-macro-events', 'capitalize', + 'capitalize-region', 'capitalize-word', 'car', 'car-less-than-car', + 'car-safe', 'case-table-p', 'category-docstring', + 'category-set-mnemonics', 'category-table', 'category-table-p', + 'ccl-execute', 'ccl-execute-on-string', 'ccl-program-p', 'cdr', + 'cdr-safe', 'ceiling', 'char-after', 'char-before', + 'char-category-set', 'char-charset', 'char-equal', 'char-or-string-p', + 'char-resolve-modifiers', 'char-syntax', 'char-table-extra-slot', + 'char-table-p', 'char-table-parent', 'char-table-range', + 'char-table-subtype', 'char-to-string', 'char-width', 'characterp', + 'charset-after', 'charset-id-internal', 'charset-plist', + 'charset-priority-list', 'charsetp', 'check-coding-system', + 'check-coding-systems-region', 'clear-buffer-auto-save-failure', + 'clear-charset-maps', 'clear-face-cache', 'clear-font-cache', + 'clear-image-cache', 'clear-string', 'clear-this-command-keys', + 'close-font', 'clrhash', 'coding-system-aliases', + 'coding-system-base', 'coding-system-eol-type', 'coding-system-p', + 'coding-system-plist', 'coding-system-priority-list', + 'coding-system-put', 'color-distance', 'color-gray-p', + 'color-supported-p', 'combine-after-change-execute', + 'command-error-default-function', 'command-remapping', 'commandp', + 'compare-buffer-substrings', 'compare-strings', + 'compare-window-configurations', 'completing-read', + 'compose-region-internal', 'compose-string-internal', + 'composition-get-gstring', 'compute-motion', 'concat', 'cons', + 'consp', 'constrain-to-field', 'continue-process', + 'controlling-tty-p', 'coordinates-in-window-p', 'copy-alist', + 'copy-category-table', 'copy-file', 'copy-hash-table', 'copy-keymap', + 'copy-marker', 'copy-sequence', 'copy-syntax-table', 'copysign', + 'cos', 'current-active-maps', 'current-bidi-paragraph-direction', + 'current-buffer', 'current-case-table', 'current-column', + 'current-global-map', 'current-idle-time', 'current-indentation', + 'current-input-mode', 'current-local-map', 'current-message', + 'current-minor-mode-maps', 'current-time', 'current-time-string', + 'current-time-zone', 'current-window-configuration', + 'cygwin-convert-file-name-from-windows', + 'cygwin-convert-file-name-to-windows', 'daemon-initialized', + 'daemonp', 'dbus--init-bus', 'dbus-get-unique-name', + 'dbus-message-internal', 'debug-timer-check', 'declare-equiv-charset', + 'decode-big5-char', 'decode-char', 'decode-coding-region', + 'decode-coding-string', 'decode-sjis-char', 'decode-time', + 'default-boundp', 'default-file-modes', 'default-printer-name', + 'default-toplevel-value', 'default-value', 'define-category', + 'define-charset-alias', 'define-charset-internal', + 'define-coding-system-alias', 'define-coding-system-internal', + 'define-fringe-bitmap', 'define-hash-table-test', 'define-key', + 'define-prefix-command', 'delete', + 'delete-all-overlays', 'delete-and-extract-region', 'delete-char', + 'delete-directory-internal', 'delete-field', 'delete-file', + 'delete-frame', 'delete-other-windows-internal', 'delete-overlay', + 'delete-process', 'delete-region', 'delete-terminal', + 'delete-window-internal', 'delq', 'describe-buffer-bindings', + 'describe-vector', 'destroy-fringe-bitmap', 'detect-coding-region', + 'detect-coding-string', 'ding', 'directory-file-name', + 'directory-files', 'directory-files-and-attributes', 'discard-input', + 'display-supports-face-attributes-p', 'do-auto-save', 'documentation', + 'documentation-property', 'downcase', 'downcase-region', + 'downcase-word', 'draw-string', 'dump-colors', 'dump-emacs', + 'dump-face', 'dump-frame-glyph-matrix', 'dump-glyph-matrix', + 'dump-glyph-row', 'dump-redisplay-history', 'dump-tool-bar-row', + 'elt', 'emacs-pid', 'encode-big5-char', 'encode-char', + 'encode-coding-region', 'encode-coding-string', 'encode-sjis-char', + 'encode-time', 'end-kbd-macro', 'end-of-line', 'eobp', 'eolp', 'eq', + 'eql', 'equal', 'equal-including-properties', 'erase-buffer', + 'error-message-string', 'eval', 'eval-buffer', 'eval-region', + 'event-convert-list', 'execute-kbd-macro', 'exit-recursive-edit', + 'exp', 'expand-file-name', 'expt', 'external-debugging-output', + 'face-attribute-relative-p', 'face-attributes-as-vector', 'face-font', + 'fboundp', 'fceiling', 'fetch-bytecode', 'ffloor', + 'field-beginning', 'field-end', 'field-string', + 'field-string-no-properties', 'file-accessible-directory-p', + 'file-acl', 'file-attributes', 'file-attributes-lessp', + 'file-directory-p', 'file-executable-p', 'file-exists-p', + 'file-locked-p', 'file-modes', 'file-name-absolute-p', + 'file-name-all-completions', 'file-name-as-directory', + 'file-name-completion', 'file-name-directory', + 'file-name-nondirectory', 'file-newer-than-file-p', 'file-readable-p', + 'file-regular-p', 'file-selinux-context', 'file-symlink-p', + 'file-system-info', 'file-system-info', 'file-writable-p', + 'fillarray', 'find-charset-region', 'find-charset-string', + 'find-coding-systems-region-internal', 'find-composition-internal', + 'find-file-name-handler', 'find-font', 'find-operation-coding-system', + 'float', 'float-time', 'floatp', 'floor', 'fmakunbound', + 'following-char', 'font-at', 'font-drive-otf', 'font-face-attributes', + 'font-family-list', 'font-get', 'font-get-glyphs', + 'font-get-system-font', 'font-get-system-normal-font', 'font-info', + 'font-match-p', 'font-otf-alternates', 'font-put', + 'font-shape-gstring', 'font-spec', 'font-variation-glyphs', + 'font-xlfd-name', 'fontp', 'fontset-font', 'fontset-info', + 'fontset-list', 'fontset-list-all', 'force-mode-line-update', + 'force-window-update', 'format', 'format-mode-line', + 'format-network-address', 'format-time-string', 'forward-char', + 'forward-comment', 'forward-line', 'forward-word', + 'frame-border-width', 'frame-bottom-divider-width', + 'frame-can-run-window-configuration-change-hook', 'frame-char-height', + 'frame-char-width', 'frame-face-alist', 'frame-first-window', + 'frame-focus', 'frame-font-cache', 'frame-fringe-width', 'frame-list', + 'frame-live-p', 'frame-or-buffer-changed-p', 'frame-parameter', + 'frame-parameters', 'frame-pixel-height', 'frame-pixel-width', + 'frame-pointer-visible-p', 'frame-right-divider-width', + 'frame-root-window', 'frame-scroll-bar-height', + 'frame-scroll-bar-width', 'frame-selected-window', 'frame-terminal', + 'frame-text-cols', 'frame-text-height', 'frame-text-lines', + 'frame-text-width', 'frame-total-cols', 'frame-total-lines', + 'frame-visible-p', 'framep', 'frexp', 'fringe-bitmaps-at-pos', + 'fround', 'fset', 'ftruncate', 'funcall', 'funcall-interactively', + 'function-equal', 'functionp', 'gap-position', 'gap-size', + 'garbage-collect', 'gc-status', 'generate-new-buffer-name', 'get', + 'get-buffer', 'get-buffer-create', 'get-buffer-process', + 'get-buffer-window', 'get-byte', 'get-char-property', + 'get-char-property-and-overlay', 'get-file-buffer', 'get-file-char', + 'get-internal-run-time', 'get-load-suffixes', 'get-pos-property', + 'get-process', 'get-screen-color', 'get-text-property', + 'get-unicode-property-internal', 'get-unused-category', + 'get-unused-iso-final-char', 'getenv-internal', 'gethash', + 'gfile-add-watch', 'gfile-rm-watch', 'global-key-binding', + 'gnutls-available-p', 'gnutls-boot', 'gnutls-bye', 'gnutls-deinit', + 'gnutls-error-fatalp', 'gnutls-error-string', 'gnutls-errorp', + 'gnutls-get-initstage', 'gnutls-peer-status', + 'gnutls-peer-status-warning-describe', 'goto-char', 'gpm-mouse-start', + 'gpm-mouse-stop', 'group-gid', 'group-real-gid', + 'handle-save-session', 'handle-switch-frame', 'hash-table-count', + 'hash-table-p', 'hash-table-rehash-size', + 'hash-table-rehash-threshold', 'hash-table-size', 'hash-table-test', + 'hash-table-weakness', 'iconify-frame', 'identity', 'image-flush', + 'image-mask-p', 'image-metadata', 'image-size', 'imagemagick-types', + 'imagep', 'indent-to', 'indirect-function', 'indirect-variable', + 'init-image-library', 'inotify-add-watch', 'inotify-rm-watch', + 'input-pending-p', 'insert', 'insert-and-inherit', + 'insert-before-markers', 'insert-before-markers-and-inherit', + 'insert-buffer-substring', 'insert-byte', 'insert-char', + 'insert-file-contents', 'insert-startup-screen', 'int86', + 'integer-or-marker-p', 'integerp', 'interactive-form', 'intern', + 'intern-soft', 'internal--track-mouse', 'internal-char-font', + 'internal-complete-buffer', 'internal-copy-lisp-face', + 'internal-default-process-filter', + 'internal-default-process-sentinel', 'internal-describe-syntax-value', + 'internal-event-symbol-parse-modifiers', + 'internal-face-x-get-resource', 'internal-get-lisp-face-attribute', + 'internal-lisp-face-attribute-values', 'internal-lisp-face-empty-p', + 'internal-lisp-face-equal-p', 'internal-lisp-face-p', + 'internal-make-lisp-face', 'internal-make-var-non-special', + 'internal-merge-in-global-face', + 'internal-set-alternative-font-family-alist', + 'internal-set-alternative-font-registry-alist', + 'internal-set-font-selection-order', + 'internal-set-lisp-face-attribute', + 'internal-set-lisp-face-attribute-from-resource', + 'internal-show-cursor', 'internal-show-cursor-p', 'interrupt-process', + 'invisible-p', 'invocation-directory', 'invocation-name', 'isnan', + 'iso-charset', 'key-binding', 'key-description', + 'keyboard-coding-system', 'keymap-parent', 'keymap-prompt', 'keymapp', + 'keywordp', 'kill-all-local-variables', 'kill-buffer', 'kill-emacs', + 'kill-local-variable', 'kill-process', 'last-nonminibuffer-frame', + 'lax-plist-get', 'lax-plist-put', 'ldexp', 'length', + 'libxml-parse-html-region', 'libxml-parse-xml-region', + 'line-beginning-position', 'line-end-position', 'line-pixel-height', + 'list', 'list-fonts', 'list-system-processes', 'listp', 'load', + 'load-average', 'local-key-binding', 'local-variable-if-set-p', + 'local-variable-p', 'locale-info', 'locate-file-internal', + 'lock-buffer', 'log', 'logand', 'logb', 'logior', 'lognot', 'logxor', + 'looking-at', 'lookup-image', 'lookup-image-map', 'lookup-key', + 'lower-frame', 'lsh', 'macroexpand', 'make-bool-vector', + 'make-byte-code', 'make-category-set', 'make-category-table', + 'make-char', 'make-char-table', 'make-directory-internal', + 'make-frame-invisible', 'make-frame-visible', 'make-hash-table', + 'make-indirect-buffer', 'make-keymap', 'make-list', + 'make-local-variable', 'make-marker', 'make-network-process', + 'make-overlay', 'make-serial-process', 'make-sparse-keymap', + 'make-string', 'make-symbol', 'make-symbolic-link', 'make-temp-name', + 'make-terminal-frame', 'make-variable-buffer-local', + 'make-variable-frame-local', 'make-vector', 'makunbound', + 'map-char-table', 'map-charset-chars', 'map-keymap', + 'map-keymap-internal', 'mapatoms', 'mapc', 'mapcar', 'mapconcat', + 'maphash', 'mark-marker', 'marker-buffer', 'marker-insertion-type', + 'marker-position', 'markerp', 'match-beginning', 'match-data', + 'match-end', 'matching-paren', 'max', 'max-char', 'md5', 'member', + 'memory-info', 'memory-limit', 'memory-use-counts', 'memq', 'memql', + 'menu-bar-menu-at-x-y', 'menu-or-popup-active-p', + 'menu-or-popup-active-p', 'merge-face-attribute', 'message', + 'message-box', 'message-or-box', 'min', + 'minibuffer-completion-contents', 'minibuffer-contents', + 'minibuffer-contents-no-properties', 'minibuffer-depth', + 'minibuffer-prompt', 'minibuffer-prompt-end', + 'minibuffer-selected-window', 'minibuffer-window', 'minibufferp', + 'minor-mode-key-binding', 'mod', 'modify-category-entry', + 'modify-frame-parameters', 'modify-syntax-entry', + 'mouse-pixel-position', 'mouse-position', 'move-overlay', + 'move-point-visually', 'move-to-column', 'move-to-window-line', + 'msdos-downcase-filename', 'msdos-long-file-names', 'msdos-memget', + 'msdos-memput', 'msdos-mouse-disable', 'msdos-mouse-enable', + 'msdos-mouse-init', 'msdos-mouse-p', 'msdos-remember-default-colors', + 'msdos-set-keyboard', 'msdos-set-mouse-buttons', + 'multibyte-char-to-unibyte', 'multibyte-string-p', 'narrow-to-region', + 'natnump', 'nconc', 'network-interface-info', + 'network-interface-list', 'new-fontset', 'newline-cache-check', + 'next-char-property-change', 'next-frame', 'next-overlay-change', + 'next-property-change', 'next-read-file-uses-dialog-p', + 'next-single-char-property-change', 'next-single-property-change', + 'next-window', 'nlistp', 'nreverse', 'nth', 'nthcdr', 'null', + 'number-or-marker-p', 'number-to-string', 'numberp', + 'open-dribble-file', 'open-font', 'open-termscript', + 'optimize-char-table', 'other-buffer', 'other-window-for-scrolling', + 'overlay-buffer', 'overlay-end', 'overlay-get', 'overlay-lists', + 'overlay-properties', 'overlay-put', 'overlay-recenter', + 'overlay-start', 'overlayp', 'overlays-at', 'overlays-in', + 'parse-partial-sexp', 'play-sound-internal', 'plist-get', + 'plist-member', 'plist-put', 'point', 'point-marker', 'point-max', + 'point-max-marker', 'point-min', 'point-min-marker', + 'pos-visible-in-window-p', 'position-bytes', 'posix-looking-at', + 'posix-search-backward', 'posix-search-forward', 'posix-string-match', + 'posn-at-point', 'posn-at-x-y', 'preceding-char', + 'prefix-numeric-value', 'previous-char-property-change', + 'previous-frame', 'previous-overlay-change', + 'previous-property-change', 'previous-single-char-property-change', + 'previous-single-property-change', 'previous-window', 'prin1', + 'prin1-to-string', 'princ', 'print', 'process-attributes', + 'process-buffer', 'process-coding-system', 'process-command', + 'process-connection', 'process-contact', 'process-datagram-address', + 'process-exit-status', 'process-filter', 'process-filter-multibyte-p', + 'process-id', 'process-inherit-coding-system-flag', 'process-list', + 'process-mark', 'process-name', 'process-plist', + 'process-query-on-exit-flag', 'process-running-child-p', + 'process-send-eof', 'process-send-region', 'process-send-string', + 'process-sentinel', 'process-status', 'process-tty-name', + 'process-type', 'processp', 'profiler-cpu-log', + 'profiler-cpu-running-p', 'profiler-cpu-start', 'profiler-cpu-stop', + 'profiler-memory-log', 'profiler-memory-running-p', + 'profiler-memory-start', 'profiler-memory-stop', 'propertize', + 'purecopy', 'put', 'put-text-property', + 'put-unicode-property-internal', 'puthash', 'query-font', + 'query-fontset', 'quit-process', 'raise-frame', 'random', 'rassoc', + 'rassq', 're-search-backward', 're-search-forward', 'read', + 'read-buffer', 'read-char', 'read-char-exclusive', + 'read-coding-system', 'read-command', 'read-event', + 'read-from-minibuffer', 'read-from-string', 'read-function', + 'read-key-sequence', 'read-key-sequence-vector', + 'read-no-blanks-input', 'read-non-nil-coding-system', 'read-string', + 'read-variable', 'recent-auto-save-p', 'recent-doskeys', + 'recent-keys', 'recenter', 'recursion-depth', 'recursive-edit', + 'redirect-debugging-output', 'redirect-frame-focus', 'redisplay', + 'redraw-display', 'redraw-frame', 'regexp-quote', 'region-beginning', + 'region-end', 'register-ccl-program', 'register-code-conversion-map', + 'remhash', 'remove-list-of-text-properties', 'remove-text-properties', + 'rename-buffer', 'rename-file', 'replace-match', + 'reset-this-command-lengths', 'resize-mini-window-internal', + 'restore-buffer-modified-p', 'resume-tty', 'reverse', 'round', + 'run-hook-with-args', 'run-hook-with-args-until-failure', + 'run-hook-with-args-until-success', 'run-hook-wrapped', 'run-hooks', + 'run-window-configuration-change-hook', 'run-window-scroll-functions', + 'safe-length', 'scan-lists', 'scan-sexps', 'scroll-down', + 'scroll-left', 'scroll-other-window', 'scroll-right', 'scroll-up', + 'search-backward', 'search-forward', 'secure-hash', 'select-frame', + 'select-window', 'selected-frame', 'selected-window', + 'self-insert-command', 'send-string-to-terminal', 'sequencep', + 'serial-process-configure', 'set', 'set-buffer', + 'set-buffer-auto-saved', 'set-buffer-major-mode', + 'set-buffer-modified-p', 'set-buffer-multibyte', 'set-case-table', + 'set-category-table', 'set-char-table-extra-slot', + 'set-char-table-parent', 'set-char-table-range', 'set-charset-plist', + 'set-charset-priority', 'set-coding-system-priority', + 'set-cursor-size', 'set-default', 'set-default-file-modes', + 'set-default-toplevel-value', 'set-file-acl', 'set-file-modes', + 'set-file-selinux-context', 'set-file-times', 'set-fontset-font', + 'set-frame-height', 'set-frame-position', 'set-frame-selected-window', + 'set-frame-size', 'set-frame-width', 'set-fringe-bitmap-face', + 'set-input-interrupt-mode', 'set-input-meta-mode', 'set-input-mode', + 'set-keyboard-coding-system-internal', 'set-keymap-parent', + 'set-marker', 'set-marker-insertion-type', 'set-match-data', + 'set-message-beep', 'set-minibuffer-window', + 'set-mouse-pixel-position', 'set-mouse-position', + 'set-network-process-option', 'set-output-flow-control', + 'set-process-buffer', 'set-process-coding-system', + 'set-process-datagram-address', 'set-process-filter', + 'set-process-filter-multibyte', + 'set-process-inherit-coding-system-flag', 'set-process-plist', + 'set-process-query-on-exit-flag', 'set-process-sentinel', + 'set-process-window-size', 'set-quit-char', + 'set-safe-terminal-coding-system-internal', 'set-screen-color', + 'set-standard-case-table', 'set-syntax-table', + 'set-terminal-coding-system-internal', 'set-terminal-local-value', + 'set-terminal-parameter', 'set-text-properties', 'set-time-zone-rule', + 'set-visited-file-modtime', 'set-window-buffer', + 'set-window-combination-limit', 'set-window-configuration', + 'set-window-dedicated-p', 'set-window-display-table', + 'set-window-fringes', 'set-window-hscroll', 'set-window-margins', + 'set-window-new-normal', 'set-window-new-pixel', + 'set-window-new-total', 'set-window-next-buffers', + 'set-window-parameter', 'set-window-point', 'set-window-prev-buffers', + 'set-window-redisplay-end-trigger', 'set-window-scroll-bars', + 'set-window-start', 'set-window-vscroll', 'setcar', 'setcdr', + 'setplist', 'show-face-resources', 'signal', 'signal-process', 'sin', + 'single-key-description', 'skip-chars-backward', 'skip-chars-forward', + 'skip-syntax-backward', 'skip-syntax-forward', 'sleep-for', 'sort', + 'sort-charsets', 'special-variable-p', 'split-char', + 'split-window-internal', 'sqrt', 'standard-case-table', + 'standard-category-table', 'standard-syntax-table', 'start-kbd-macro', + 'start-process', 'stop-process', 'store-kbd-macro-event', 'string', + 'string-as-multibyte', 'string-as-unibyte', 'string-bytes', + 'string-collate-equalp', 'string-collate-lessp', 'string-equal', + 'string-lessp', 'string-make-multibyte', 'string-make-unibyte', + 'string-match', 'string-to-char', 'string-to-multibyte', + 'string-to-number', 'string-to-syntax', 'string-to-unibyte', + 'string-width', 'stringp', 'subr-name', 'subrp', + 'subst-char-in-region', 'substitute-command-keys', + 'substitute-in-file-name', 'substring', 'substring-no-properties', + 'suspend-emacs', 'suspend-tty', 'suspicious-object', 'sxhash', + 'symbol-function', 'symbol-name', 'symbol-plist', 'symbol-value', + 'symbolp', 'syntax-table', 'syntax-table-p', 'system-groups', + 'system-move-file-to-trash', 'system-name', 'system-users', 'tan', + 'terminal-coding-system', 'terminal-list', 'terminal-live-p', + 'terminal-local-value', 'terminal-name', 'terminal-parameter', + 'terminal-parameters', 'terpri', 'test-completion', + 'text-char-description', 'text-properties-at', 'text-property-any', + 'text-property-not-all', 'this-command-keys', + 'this-command-keys-vector', 'this-single-command-keys', + 'this-single-command-raw-keys', 'time-add', 'time-less-p', + 'time-subtract', 'tool-bar-get-system-style', 'tool-bar-height', + 'tool-bar-pixel-width', 'top-level', 'trace-redisplay', + 'trace-to-stderr', 'translate-region-internal', 'transpose-regions', + 'truncate', 'try-completion', 'tty-display-color-cells', + 'tty-display-color-p', 'tty-no-underline', + 'tty-suppress-bold-inverse-default-colors', 'tty-top-frame', + 'tty-type', 'type-of', 'undo-boundary', 'unencodable-char-position', + 'unhandled-file-name-directory', 'unibyte-char-to-multibyte', + 'unibyte-string', 'unicode-property-table-internal', 'unify-charset', + 'unintern', 'unix-sync', 'unlock-buffer', 'upcase', 'upcase-initials', + 'upcase-initials-region', 'upcase-region', 'upcase-word', + 'use-global-map', 'use-local-map', 'user-full-name', + 'user-login-name', 'user-real-login-name', 'user-real-uid', + 'user-uid', 'variable-binding-locus', 'vconcat', 'vector', + 'vector-or-char-table-p', 'vectorp', 'verify-visited-file-modtime', + 'vertical-motion', 'visible-frame-list', 'visited-file-modtime', + 'w16-get-clipboard-data', 'w16-selection-exists-p', + 'w16-set-clipboard-data', 'w32-battery-status', + 'w32-default-color-map', 'w32-define-rgb-color', + 'w32-display-monitor-attributes-list', 'w32-frame-menu-bar-size', + 'w32-frame-rect', 'w32-get-clipboard-data', + 'w32-get-codepage-charset', 'w32-get-console-codepage', + 'w32-get-console-output-codepage', 'w32-get-current-locale-id', + 'w32-get-default-locale-id', 'w32-get-keyboard-layout', + 'w32-get-locale-info', 'w32-get-valid-codepages', + 'w32-get-valid-keyboard-layouts', 'w32-get-valid-locale-ids', + 'w32-has-winsock', 'w32-long-file-name', 'w32-reconstruct-hot-key', + 'w32-register-hot-key', 'w32-registered-hot-keys', + 'w32-selection-exists-p', 'w32-send-sys-command', + 'w32-set-clipboard-data', 'w32-set-console-codepage', + 'w32-set-console-output-codepage', 'w32-set-current-locale', + 'w32-set-keyboard-layout', 'w32-set-process-priority', + 'w32-shell-execute', 'w32-short-file-name', 'w32-toggle-lock-key', + 'w32-unload-winsock', 'w32-unregister-hot-key', 'w32-window-exists-p', + 'w32notify-add-watch', 'w32notify-rm-watch', + 'waiting-for-user-input-p', 'where-is-internal', 'widen', + 'widget-apply', 'widget-get', 'widget-put', + 'window-absolute-pixel-edges', 'window-at', 'window-body-height', + 'window-body-width', 'window-bottom-divider-width', 'window-buffer', + 'window-combination-limit', 'window-configuration-frame', + 'window-configuration-p', 'window-dedicated-p', + 'window-display-table', 'window-edges', 'window-end', 'window-frame', + 'window-fringes', 'window-header-line-height', 'window-hscroll', + 'window-inside-absolute-pixel-edges', 'window-inside-edges', + 'window-inside-pixel-edges', 'window-left-child', + 'window-left-column', 'window-line-height', 'window-list', + 'window-list-1', 'window-live-p', 'window-margins', + 'window-minibuffer-p', 'window-mode-line-height', 'window-new-normal', + 'window-new-pixel', 'window-new-total', 'window-next-buffers', + 'window-next-sibling', 'window-normal-size', 'window-old-point', + 'window-parameter', 'window-parameters', 'window-parent', + 'window-pixel-edges', 'window-pixel-height', 'window-pixel-left', + 'window-pixel-top', 'window-pixel-width', 'window-point', + 'window-prev-buffers', 'window-prev-sibling', + 'window-redisplay-end-trigger', 'window-resize-apply', + 'window-resize-apply-total', 'window-right-divider-width', + 'window-scroll-bar-height', 'window-scroll-bar-width', + 'window-scroll-bars', 'window-start', 'window-system', + 'window-text-height', 'window-text-pixel-size', 'window-text-width', + 'window-top-child', 'window-top-line', 'window-total-height', + 'window-total-width', 'window-use-time', 'window-valid-p', + 'window-vscroll', 'windowp', 'write-char', 'write-region', + 'x-backspace-delete-keys-p', 'x-change-window-property', + 'x-change-window-property', 'x-close-connection', + 'x-close-connection', 'x-create-frame', 'x-create-frame', + 'x-delete-window-property', 'x-delete-window-property', + 'x-disown-selection-internal', 'x-display-backing-store', + 'x-display-backing-store', 'x-display-color-cells', + 'x-display-color-cells', 'x-display-grayscale-p', + 'x-display-grayscale-p', 'x-display-list', 'x-display-list', + 'x-display-mm-height', 'x-display-mm-height', 'x-display-mm-width', + 'x-display-mm-width', 'x-display-monitor-attributes-list', + 'x-display-pixel-height', 'x-display-pixel-height', + 'x-display-pixel-width', 'x-display-pixel-width', 'x-display-planes', + 'x-display-planes', 'x-display-save-under', 'x-display-save-under', + 'x-display-screens', 'x-display-screens', 'x-display-visual-class', + 'x-display-visual-class', 'x-family-fonts', 'x-file-dialog', + 'x-file-dialog', 'x-file-dialog', 'x-focus-frame', 'x-frame-geometry', + 'x-frame-geometry', 'x-get-atom-name', 'x-get-resource', + 'x-get-selection-internal', 'x-hide-tip', 'x-hide-tip', + 'x-list-fonts', 'x-load-color-file', 'x-menu-bar-open-internal', + 'x-menu-bar-open-internal', 'x-open-connection', 'x-open-connection', + 'x-own-selection-internal', 'x-parse-geometry', 'x-popup-dialog', + 'x-popup-menu', 'x-register-dnd-atom', 'x-select-font', + 'x-select-font', 'x-selection-exists-p', 'x-selection-owner-p', + 'x-send-client-message', 'x-server-max-request-size', + 'x-server-max-request-size', 'x-server-vendor', 'x-server-vendor', + 'x-server-version', 'x-server-version', 'x-show-tip', 'x-show-tip', + 'x-synchronize', 'x-synchronize', 'x-uses-old-gtk-dialog', + 'x-window-property', 'x-window-property', 'x-wm-set-size-hint', + 'xw-color-defined-p', 'xw-color-defined-p', 'xw-color-values', + 'xw-color-values', 'xw-display-color-p', 'xw-display-color-p', + 'yes-or-no-p', 'zlib-available-p', 'zlib-decompress-region', + 'forward-point', + )) + + builtin_function_highlighted = set(( + 'defvaralias', 'provide', 'require', + 'with-no-warnings', 'define-widget', 'with-electric-help', + 'throw', 'defalias', 'featurep' + )) + + lambda_list_keywords = set(( + '&allow-other-keys', '&aux', '&body', '&environment', '&key', '&optional', + '&rest', '&whole', + )) + + error_keywords = set(( + 'cl-assert', 'cl-check-type', 'error', 'signal', + 'user-error', 'warn', + )) + + def get_tokens_unprocessed(self, text): + stack = ['root'] + for index, token, value in RegexLexer.get_tokens_unprocessed(self, text, stack): + if token is Name.Variable: + if value in EmacsLispLexer.builtin_function: + yield index, Name.Function, value + continue + if value in EmacsLispLexer.special_forms: + yield index, Keyword, value + continue + if value in EmacsLispLexer.error_keywords: + yield index, Name.Exception, value + continue + if value in EmacsLispLexer.builtin_function_highlighted: + yield index, Name.Builtin, value + continue + if value in EmacsLispLexer.macros: + yield index, Name.Builtin, value + continue + if value in EmacsLispLexer.lambda_list_keywords: + yield index, Keyword.Pseudo, value + continue + yield index, token, value + + tokens = { + 'root': [ + default('body'), + ], + 'body': [ + # whitespace + (r'\s+', Text), + + # single-line comment + (r';.*$', Comment.Single), + + # strings and characters + (r'"', String, 'string'), + (r'\?([^\\]|\\.)', String.Char), + # quoting + (r":" + symbol, Name.Builtin), + (r"::" + symbol, String.Symbol), + (r"'" + symbol, String.Symbol), + (r"'", Operator), + (r"`", Operator), + + # decimal numbers + (r'[-+]?\d+\.?' + terminated, Number.Integer), + (r'[-+]?\d+/\d+' + terminated, Number), + (r'[-+]?(\d*\.\d+([defls][-+]?\d+)?|\d+(\.\d*)?[defls][-+]?\d+)' + + terminated, Number.Float), + + # vectors + (r'\[|\]', Punctuation), + + # uninterned symbol + (r'#:' + symbol, String.Symbol), + + # read syntax for char tables + (r'#\^\^?', Operator), + + # function shorthand + (r'#\'', Name.Function), + + # binary rational + (r'#[bB][+-]?[01]+(/[01]+)?', Number.Bin), + + # octal rational + (r'#[oO][+-]?[0-7]+(/[0-7]+)?', Number.Oct), + + # hex rational + (r'#[xX][+-]?[0-9a-fA-F]+(/[0-9a-fA-F]+)?', Number.Hex), + + # radix rational + (r'#\d+r[+-]?[0-9a-zA-Z]+(/[0-9a-zA-Z]+)?', Number), + + # reference + (r'#\d+=', Operator), + (r'#\d+#', Operator), + + # special operators that should have been parsed already + (r'(,@|,|\.|:)', Operator), + + # special constants + (r'(t|nil)' + terminated, Name.Constant), + + # functions and variables + (r'\*' + symbol + '\*', Name.Variable.Global), + (symbol, Name.Variable), + + # parentheses + (r'#\(', Operator, 'body'), + (r'\(', Punctuation, 'body'), + (r'\)', Punctuation, '#pop'), + ], + 'string': [ + (r'[^"\\`]+', String), + (r'`%s\'' % symbol, String.Symbol), + (r'`', String), + (r'\\.', String), + (r'\\\n', String), + (r'"', String, '#pop'), + ], + } + + +class ShenLexer(RegexLexer): + """ + Lexer for `Shen `_ source code. + + .. versionadded:: 2.1 + """ + name = 'Shen' + aliases = ['shen'] + filenames = ['*.shen'] + mimetypes = ['text/x-shen', 'application/x-shen'] + + DECLARATIONS = ( + 'datatype', 'define', 'defmacro', 'defprolog', 'defcc', + 'synonyms', 'declare', 'package', 'type', 'function', + ) + + SPECIAL_FORMS = ( + 'lambda', 'get', 'let', 'if', 'cases', 'cond', 'put', 'time', 'freeze', + 'value', 'load', '$', 'protect', 'or', 'and', 'not', 'do', 'output', + 'prolog?', 'trap-error', 'error', 'make-string', '/.', 'set', '@p', + '@s', '@v', + ) + + BUILTINS = ( + '==', '=', '*', '+', '-', '/', '<', '>', '>=', '<=', '<-address', + '<-vector', 'abort', 'absvector', 'absvector?', 'address->', 'adjoin', + 'append', 'arity', 'assoc', 'bind', 'boolean?', 'bound?', 'call', 'cd', + 'close', 'cn', 'compile', 'concat', 'cons', 'cons?', 'cut', 'destroy', + 'difference', 'element?', 'empty?', 'enable-type-theory', + 'error-to-string', 'eval', 'eval-kl', 'exception', 'explode', 'external', + 'fail', 'fail-if', 'file', 'findall', 'fix', 'fst', 'fwhen', 'gensym', + 'get-time', 'hash', 'hd', 'hdstr', 'hdv', 'head', 'identical', + 'implementation', 'in', 'include', 'include-all-but', 'inferences', + 'input', 'input+', 'integer?', 'intern', 'intersection', 'is', 'kill', + 'language', 'length', 'limit', 'lineread', 'loaded', 'macro', 'macroexpand', + 'map', 'mapcan', 'maxinferences', 'mode', 'n->string', 'nl', 'nth', 'null', + 'number?', 'occurrences', 'occurs-check', 'open', 'os', 'out', 'port', + 'porters', 'pos', 'pr', 'preclude', 'preclude-all-but', 'print', 'profile', + 'profile-results', 'ps', 'quit', 'read', 'read+', 'read-byte', 'read-file', + 'read-file-as-bytelist', 'read-file-as-string', 'read-from-string', + 'release', 'remove', 'return', 'reverse', 'run', 'save', 'set', + 'simple-error', 'snd', 'specialise', 'spy', 'step', 'stinput', 'stoutput', + 'str', 'string->n', 'string->symbol', 'string?', 'subst', 'symbol?', + 'systemf', 'tail', 'tc', 'tc?', 'thaw', 'tl', 'tlstr', 'tlv', 'track', + 'tuple?', 'undefmacro', 'unify', 'unify!', 'union', 'unprofile', + 'unspecialise', 'untrack', 'variable?', 'vector', 'vector->', 'vector?', + 'verified', 'version', 'warn', 'when', 'write-byte', 'write-to-file', + 'y-or-n?', + ) + + BUILTINS_ANYWHERE = ('where', 'skip', '>>', '_', '!', '', '') + + MAPPINGS = dict((s, Keyword) for s in DECLARATIONS) + MAPPINGS.update((s, Name.Builtin) for s in BUILTINS) + MAPPINGS.update((s, Keyword) for s in SPECIAL_FORMS) + + valid_symbol_chars = r'[\w!$%*+,<=>?/.\'@&#:-]' + valid_name = '%s+' % valid_symbol_chars + symbol_name = r'[a-z!$%%*+,<=>?/.\'@&#_-]%s*' % valid_symbol_chars + variable = r'[A-Z]%s*' % valid_symbol_chars + + tokens = { + 'string': [ + (r'"', String, '#pop'), + (r'c#\d{1,3};', String.Escape), + (r'~[ARS%]', String.Interpol), + (r'(?s).', String), + ], + + 'root': [ + (r'(?s)\\\*.*?\*\\', Comment.Multiline), # \* ... *\ + (r'\\\\.*', Comment.Single), # \\ ... + (r'\s+', Text), + (r'_{5,}', Punctuation), + (r'={5,}', Punctuation), + (r'(;|:=|\||--?>|<--?)', Punctuation), + (r'(:-|:|\{|\})', Literal), + (r'[+-]*\d*\.\d+(e[+-]?\d+)?', Number.Float), + (r'[+-]*\d+', Number.Integer), + (r'"', String, 'string'), + (variable, Name.Variable), + (r'(true|false|<>|\[\])', Keyword.Pseudo), + (symbol_name, Literal), + (r'(\[|\]|\(|\))', Punctuation), + ], + } + + def get_tokens_unprocessed(self, text): + tokens = RegexLexer.get_tokens_unprocessed(self, text) + tokens = self._process_symbols(tokens) + tokens = self._process_declarations(tokens) + return tokens + + def _relevant(self, token): + return token not in (Text, Comment.Single, Comment.Multiline) + + def _process_declarations(self, tokens): + opening_paren = False + for index, token, value in tokens: + yield index, token, value + if self._relevant(token): + if opening_paren and token == Keyword and value in self.DECLARATIONS: + declaration = value + for index, token, value in \ + self._process_declaration(declaration, tokens): + yield index, token, value + opening_paren = value == '(' and token == Punctuation + + def _process_symbols(self, tokens): + opening_paren = False + for index, token, value in tokens: + if opening_paren and token in (Literal, Name.Variable): + token = self.MAPPINGS.get(value, Name.Function) + elif token == Literal and value in self.BUILTINS_ANYWHERE: + token = Name.Builtin + opening_paren = value == '(' and token == Punctuation + yield index, token, value + + def _process_declaration(self, declaration, tokens): + for index, token, value in tokens: + if self._relevant(token): + break + yield index, token, value + + if declaration == 'datatype': + prev_was_colon = False + token = Keyword.Type if token == Literal else token + yield index, token, value + for index, token, value in tokens: + if prev_was_colon and token == Literal: + token = Keyword.Type + yield index, token, value + if self._relevant(token): + prev_was_colon = token == Literal and value == ':' + elif declaration == 'package': + token = Name.Namespace if token == Literal else token + yield index, token, value + elif declaration == 'define': + token = Name.Function if token == Literal else token + yield index, token, value + for index, token, value in tokens: + if self._relevant(token): + break + yield index, token, value + if value == '{' and token == Literal: + yield index, Punctuation, value + for index, token, value in self._process_signature(tokens): + yield index, token, value + else: + yield index, token, value + else: + token = Name.Function if token == Literal else token + yield index, token, value + + raise StopIteration + + def _process_signature(self, tokens): + for index, token, value in tokens: + if token == Literal and value == '}': + yield index, Punctuation, value + raise StopIteration + elif token in (Literal, Name.Function): + token = Name.Variable if value.istitle() else Keyword.Type + yield index, token, value + + +class CPSALexer(SchemeLexer): + """ + A CPSA lexer based on the CPSA language as of version 2.2.12 + + .. versionadded:: 2.1 + """ + name = 'CPSA' + aliases = ['cpsa'] + filenames = ['*.cpsa'] + mimetypes = [] + + # list of known keywords and builtins taken form vim 6.4 scheme.vim + # syntax file. + _keywords = ( + 'herald', 'vars', 'defmacro', 'include', 'defprotocol', 'defrole', + 'defskeleton', 'defstrand', 'deflistener', 'non-orig', 'uniq-orig', + 'pen-non-orig', 'precedes', 'trace', 'send', 'recv', 'name', 'text', + 'skey', 'akey', 'data', 'mesg', + ) + _builtins = ( + 'cat', 'enc', 'hash', 'privk', 'pubk', 'invk', 'ltk', 'gen', 'exp', + ) + + # valid names for identifiers + # well, names can only not consist fully of numbers + # but this should be good enough for now + valid_name = r'[\w!$%&*+,/:<=>?@^~|-]+' + + tokens = { + 'root': [ + # the comments - always starting with semicolon + # and going to the end of the line + (r';.*$', Comment.Single), + + # whitespaces - usually not relevant + (r'\s+', Text), + + # numbers + (r'-?\d+\.\d+', Number.Float), + (r'-?\d+', Number.Integer), + # support for uncommon kinds of numbers - + # have to figure out what the characters mean + # (r'(#e|#i|#b|#o|#d|#x)[\d.]+', Number), + + # strings, symbols and characters + (r'"(\\\\|\\"|[^"])*"', String), + (r"'" + valid_name, String.Symbol), + (r"#\\([()/'\"._!§$%& ?=+-]|[a-zA-Z0-9]+)", String.Char), + + # constants + (r'(#t|#f)', Name.Constant), + + # special operators + (r"('|#|`|,@|,|\.)", Operator), + + # highlight the keywords + (words(_keywords, suffix=r'\b'), Keyword), + + # first variable in a quoted string like + # '(this is syntactic sugar) + (r"(?<='\()" + valid_name, Name.Variable), + (r"(?<=#\()" + valid_name, Name.Variable), + + # highlight the builtins + (words(_builtins, prefix=r'(?<=\()', suffix=r'\b'), Name.Builtin), + + # the remaining functions + (r'(?<=\()' + valid_name, Name.Function), + # find the remaining variables + (valid_name, Name.Variable), + + # the famous parentheses! + (r'(\(|\))', Punctuation), + (r'(\[|\])', Punctuation), + ], + } + + +class XtlangLexer(RegexLexer): + """An xtlang lexer for the `Extempore programming environment + `_. + + This is a mixture of Scheme and xtlang, really. Keyword lists are + taken from the Extempore Emacs mode + (https://github.com/extemporelang/extempore-emacs-mode) + + .. versionadded:: 2.2 + """ + name = 'xtlang' + aliases = ['extempore'] + filenames = ['*.xtm'] + mimetypes = [] + + common_keywords = ( + 'lambda', 'define', 'if', 'else', 'cond', 'and', + 'or', 'let', 'begin', 'set!', 'map', 'for-each', + ) + scheme_keywords = ( + 'do', 'delay', 'quasiquote', 'unquote', 'unquote-splicing', 'eval', + 'case', 'let*', 'letrec', 'quote', + ) + xtlang_bind_keywords = ( + 'bind-func', 'bind-val', 'bind-lib', 'bind-type', 'bind-alias', + 'bind-poly', 'bind-dylib', 'bind-lib-func', 'bind-lib-val', + ) + xtlang_keywords = ( + 'letz', 'memzone', 'cast', 'convert', 'dotimes', 'doloop', + ) + common_functions = ( + '*', '+', '-', '/', '<', '<=', '=', '>', '>=', '%', 'abs', 'acos', + 'angle', 'append', 'apply', 'asin', 'assoc', 'assq', 'assv', + 'atan', 'boolean?', 'caaaar', 'caaadr', 'caaar', 'caadar', + 'caaddr', 'caadr', 'caar', 'cadaar', 'cadadr', 'cadar', + 'caddar', 'cadddr', 'caddr', 'cadr', 'car', 'cdaaar', + 'cdaadr', 'cdaar', 'cdadar', 'cdaddr', 'cdadr', 'cdar', + 'cddaar', 'cddadr', 'cddar', 'cdddar', 'cddddr', 'cdddr', + 'cddr', 'cdr', 'ceiling', 'cons', 'cos', 'floor', 'length', + 'list', 'log', 'max', 'member', 'min', 'modulo', 'not', + 'reverse', 'round', 'sin', 'sqrt', 'substring', 'tan', + 'println', 'random', 'null?', 'callback', 'now', + ) + scheme_functions = ( + 'call-with-current-continuation', 'call-with-input-file', + 'call-with-output-file', 'call-with-values', 'call/cc', + 'char->integer', 'char-alphabetic?', 'char-ci<=?', 'char-ci=?', 'char-ci>?', 'char-downcase', + 'char-lower-case?', 'char-numeric?', 'char-ready?', + 'char-upcase', 'char-upper-case?', 'char-whitespace?', + 'char<=?', 'char=?', 'char>?', 'char?', + 'close-input-port', 'close-output-port', 'complex?', + 'current-input-port', 'current-output-port', 'denominator', + 'display', 'dynamic-wind', 'eof-object?', 'eq?', 'equal?', + 'eqv?', 'even?', 'exact->inexact', 'exact?', 'exp', 'expt', + 'force', 'gcd', 'imag-part', 'inexact->exact', 'inexact?', + 'input-port?', 'integer->char', 'integer?', + 'interaction-environment', 'lcm', 'list->string', + 'list->vector', 'list-ref', 'list-tail', 'list?', 'load', + 'magnitude', 'make-polar', 'make-rectangular', 'make-string', + 'make-vector', 'memq', 'memv', 'negative?', 'newline', + 'null-environment', 'number->string', 'number?', + 'numerator', 'odd?', 'open-input-file', 'open-output-file', + 'output-port?', 'pair?', 'peek-char', 'port?', 'positive?', + 'procedure?', 'quotient', 'rational?', 'rationalize', 'read', + 'read-char', 'real-part', 'real?', + 'remainder', 'scheme-report-environment', 'set-car!', 'set-cdr!', + 'string', 'string->list', 'string->number', 'string->symbol', + 'string-append', 'string-ci<=?', 'string-ci=?', 'string-ci>?', 'string-copy', 'string-fill!', + 'string-length', 'string-ref', 'string-set!', 'string<=?', + 'string=?', 'string>?', 'string?', + 'symbol->string', 'symbol?', 'transcript-off', 'transcript-on', + 'truncate', 'values', 'vector', 'vector->list', 'vector-fill!', + 'vector-length', 'vector?', + 'with-input-from-file', 'with-output-to-file', 'write', + 'write-char', 'zero?', + ) + xtlang_functions = ( + 'toString', 'afill!', 'pfill!', 'tfill!', 'tbind', 'vfill!', + 'array-fill!', 'pointer-fill!', 'tuple-fill!', 'vector-fill!', 'free', + 'array', 'tuple', 'list', '~', 'cset!', 'cref', '&', 'bor', + 'ang-names', '<<', '>>', 'nil', 'printf', 'sprintf', 'null', 'now', + 'pset!', 'pref-ptr', 'vset!', 'vref', 'aset!', 'aref', 'aref-ptr', + 'tset!', 'tref', 'tref-ptr', 'salloc', 'halloc', 'zalloc', 'alloc', + 'schedule', 'exp', 'log', 'sin', 'cos', 'tan', 'asin', 'acos', 'atan', + 'sqrt', 'expt', 'floor', 'ceiling', 'truncate', 'round', + 'llvm_printf', 'push_zone', 'pop_zone', 'memzone', 'callback', + 'llvm_sprintf', 'make-array', 'array-set!', 'array-ref', + 'array-ref-ptr', 'pointer-set!', 'pointer-ref', 'pointer-ref-ptr', + 'stack-alloc', 'heap-alloc', 'zone-alloc', 'make-tuple', 'tuple-set!', + 'tuple-ref', 'tuple-ref-ptr', 'closure-set!', 'closure-ref', 'pref', + 'pdref', 'impc_null', 'bitcast', 'void', 'ifret', 'ret->', 'clrun->', + 'make-env-zone', 'make-env', '<>', 'dtof', 'ftod', 'i1tof', + 'i1tod', 'i1toi8', 'i1toi32', 'i1toi64', 'i8tof', 'i8tod', + 'i8toi1', 'i8toi32', 'i8toi64', 'i32tof', 'i32tod', 'i32toi1', + 'i32toi8', 'i32toi64', 'i64tof', 'i64tod', 'i64toi1', + 'i64toi8', 'i64toi32', + ) + + # valid names for Scheme identifiers (names cannot consist fully + # of numbers, but this should be good enough for now) + valid_scheme_name = r'[\w!$%&*+,/:<=>?@^~|-]+' + + # valid characters in xtlang names & types + valid_xtlang_name = r'[\w.!-]+' + valid_xtlang_type = r'[]{}[\w<>,*/|!-]+' + + tokens = { + # keep track of when we're exiting the xtlang form + 'xtlang': [ + (r'\(', Punctuation, '#push'), + (r'\)', Punctuation, '#pop'), + + (r'(?<=bind-func\s)' + valid_xtlang_name, Name.Function), + (r'(?<=bind-val\s)' + valid_xtlang_name, Name.Function), + (r'(?<=bind-type\s)' + valid_xtlang_name, Name.Function), + (r'(?<=bind-alias\s)' + valid_xtlang_name, Name.Function), + (r'(?<=bind-poly\s)' + valid_xtlang_name, Name.Function), + (r'(?<=bind-lib\s)' + valid_xtlang_name, Name.Function), + (r'(?<=bind-dylib\s)' + valid_xtlang_name, Name.Function), + (r'(?<=bind-lib-func\s)' + valid_xtlang_name, Name.Function), + (r'(?<=bind-lib-val\s)' + valid_xtlang_name, Name.Function), + + # type annotations + (r':' + valid_xtlang_type, Keyword.Type), + + # types + (r'(<' + valid_xtlang_type + r'>|\|' + valid_xtlang_type + r'\||/' + + valid_xtlang_type + r'/|' + valid_xtlang_type + r'\*)\**', + Keyword.Type), + + # keywords + (words(xtlang_keywords, prefix=r'(?<=\()'), Keyword), + + # builtins + (words(xtlang_functions, prefix=r'(?<=\()'), Name.Function), + + include('common'), + + # variables + (valid_xtlang_name, Name.Variable), + ], + 'scheme': [ + # quoted symbols + (r"'" + valid_scheme_name, String.Symbol), + + # char literals + (r"#\\([()/'\"._!§$%& ?=+-]|[a-zA-Z0-9]+)", String.Char), + + # special operators + (r"('|#|`|,@|,|\.)", Operator), + + # keywords + (words(scheme_keywords, prefix=r'(?<=\()'), Keyword), + + # builtins + (words(scheme_functions, prefix=r'(?<=\()'), Name.Function), + + include('common'), + + # variables + (valid_scheme_name, Name.Variable), + ], + # common to both xtlang and Scheme + 'common': [ + # comments + (r';.*$', Comment.Single), + + # whitespaces - usually not relevant + (r'\s+', Text), + + # numbers + (r'-?\d+\.\d+', Number.Float), + (r'-?\d+', Number.Integer), + + # binary/oct/hex literals + (r'(#b|#o|#x)[\d.]+', Number), + + # strings + (r'"(\\\\|\\"|[^"])*"', String), + + # true/false constants + (r'(#t|#f)', Name.Constant), + + # keywords + (words(common_keywords, prefix=r'(?<=\()'), Keyword), + + # builtins + (words(common_functions, prefix=r'(?<=\()'), Name.Function), + + # the famous parentheses! + (r'(\(|\))', Punctuation), + ], + 'root': [ + # go into xtlang mode + (words(xtlang_bind_keywords, prefix=r'(?<=\()', suffix=r'\b'), + Keyword, 'xtlang'), + + include('scheme') + ], + } diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/make.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/make.py new file mode 100644 index 0000000000000000000000000000000000000000..b222b67292777163db321d769f131473a903267e --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/make.py @@ -0,0 +1,202 @@ +# -*- coding: utf-8 -*- +""" + pygments.lexers.make + ~~~~~~~~~~~~~~~~~~~~ + + Lexers for Makefiles and similar. + + :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS. + :license: BSD, see LICENSE for details. +""" + +import re + +from pygments.lexer import Lexer, RegexLexer, include, bygroups, \ + do_insertions, using +from pygments.token import Text, Comment, Operator, Keyword, Name, String, \ + Punctuation +from pygments.lexers.shell import BashLexer + +__all__ = ['MakefileLexer', 'BaseMakefileLexer', 'CMakeLexer'] + + +class MakefileLexer(Lexer): + """ + Lexer for BSD and GNU make extensions (lenient enough to handle both in + the same file even). + + *Rewritten in Pygments 0.10.* + """ + + name = 'Makefile' + aliases = ['make', 'makefile', 'mf', 'bsdmake'] + filenames = ['*.mak', '*.mk', 'Makefile', 'makefile', 'Makefile.*', 'GNUmakefile'] + mimetypes = ['text/x-makefile'] + + r_special = re.compile( + r'^(?:' + # BSD Make + r'\.\s*(include|undef|error|warning|if|else|elif|endif|for|endfor)|' + # GNU Make + r'\s*(ifeq|ifneq|ifdef|ifndef|else|endif|-?include|define|endef|:|vpath)|' + # GNU Automake + r'\s*(if|else|endif))(?=\s)') + r_comment = re.compile(r'^\s*@?#') + + def get_tokens_unprocessed(self, text): + ins = [] + lines = text.splitlines(True) + done = '' + lex = BaseMakefileLexer(**self.options) + backslashflag = False + for line in lines: + if self.r_special.match(line) or backslashflag: + ins.append((len(done), [(0, Comment.Preproc, line)])) + backslashflag = line.strip().endswith('\\') + elif self.r_comment.match(line): + ins.append((len(done), [(0, Comment, line)])) + else: + done += line + for item in do_insertions(ins, lex.get_tokens_unprocessed(done)): + yield item + + def analyse_text(text): + # Many makefiles have $(BIG_CAPS) style variables + if re.search(r'\$\([A-Z_]+\)', text): + return 0.1 + + +class BaseMakefileLexer(RegexLexer): + """ + Lexer for simple Makefiles (no preprocessing). + + .. versionadded:: 0.10 + """ + + name = 'Base Makefile' + aliases = ['basemake'] + filenames = [] + mimetypes = [] + + tokens = { + 'root': [ + # recipes (need to allow spaces because of expandtabs) + (r'^(?:[\t ]+.*\n|\n)+', using(BashLexer)), + # special variables + (r'\$[<@$+%?|*]', Keyword), + (r'\s+', Text), + (r'#.*?\n', Comment), + (r'(export)(\s+)(?=[\w${}\t -]+\n)', + bygroups(Keyword, Text), 'export'), + (r'export\s+', Keyword), + # assignment + (r'([\w${}().-]+)(\s*)([!?:+]?=)([ \t]*)((?:.*\\\n)+|.*\n)', + bygroups(Name.Variable, Text, Operator, Text, using(BashLexer))), + # strings + (r'(?s)"(\\\\|\\.|[^"\\])*"', String.Double), + (r"(?s)'(\\\\|\\.|[^'\\])*'", String.Single), + # targets + (r'([^\n:]+)(:+)([ \t]*)', bygroups(Name.Function, Operator, Text), + 'block-header'), + # expansions + (r'\$\(', Keyword, 'expansion'), + ], + 'expansion': [ + (r'[^$a-zA-Z_()]+', Text), + (r'[a-zA-Z_]+', Name.Variable), + (r'\$', Keyword), + (r'\(', Keyword, '#push'), + (r'\)', Keyword, '#pop'), + ], + 'export': [ + (r'[\w${}-]+', Name.Variable), + (r'\n', Text, '#pop'), + (r'\s+', Text), + ], + 'block-header': [ + (r'[,|]', Punctuation), + (r'#.*?\n', Comment, '#pop'), + (r'\\\n', Text), # line continuation + (r'\$\(', Keyword, 'expansion'), + (r'[a-zA-Z_]+', Name), + (r'\n', Text, '#pop'), + (r'.', Text), + ], + } + + +class CMakeLexer(RegexLexer): + """ + Lexer for `CMake `_ files. + + .. versionadded:: 1.2 + """ + name = 'CMake' + aliases = ['cmake'] + filenames = ['*.cmake', 'CMakeLists.txt'] + mimetypes = ['text/x-cmake'] + + tokens = { + 'root': [ + # (r'(ADD_CUSTOM_COMMAND|ADD_CUSTOM_TARGET|ADD_DEFINITIONS|' + # r'ADD_DEPENDENCIES|ADD_EXECUTABLE|ADD_LIBRARY|ADD_SUBDIRECTORY|' + # r'ADD_TEST|AUX_SOURCE_DIRECTORY|BUILD_COMMAND|BUILD_NAME|' + # r'CMAKE_MINIMUM_REQUIRED|CONFIGURE_FILE|CREATE_TEST_SOURCELIST|' + # r'ELSE|ELSEIF|ENABLE_LANGUAGE|ENABLE_TESTING|ENDFOREACH|' + # r'ENDFUNCTION|ENDIF|ENDMACRO|ENDWHILE|EXEC_PROGRAM|' + # r'EXECUTE_PROCESS|EXPORT_LIBRARY_DEPENDENCIES|FILE|FIND_FILE|' + # r'FIND_LIBRARY|FIND_PACKAGE|FIND_PATH|FIND_PROGRAM|FLTK_WRAP_UI|' + # r'FOREACH|FUNCTION|GET_CMAKE_PROPERTY|GET_DIRECTORY_PROPERTY|' + # r'GET_FILENAME_COMPONENT|GET_SOURCE_FILE_PROPERTY|' + # r'GET_TARGET_PROPERTY|GET_TEST_PROPERTY|IF|INCLUDE|' + # r'INCLUDE_DIRECTORIES|INCLUDE_EXTERNAL_MSPROJECT|' + # r'INCLUDE_REGULAR_EXPRESSION|INSTALL|INSTALL_FILES|' + # r'INSTALL_PROGRAMS|INSTALL_TARGETS|LINK_DIRECTORIES|' + # r'LINK_LIBRARIES|LIST|LOAD_CACHE|LOAD_COMMAND|MACRO|' + # r'MAKE_DIRECTORY|MARK_AS_ADVANCED|MATH|MESSAGE|OPTION|' + # r'OUTPUT_REQUIRED_FILES|PROJECT|QT_WRAP_CPP|QT_WRAP_UI|REMOVE|' + # r'REMOVE_DEFINITIONS|SEPARATE_ARGUMENTS|SET|' + # r'SET_DIRECTORY_PROPERTIES|SET_SOURCE_FILES_PROPERTIES|' + # r'SET_TARGET_PROPERTIES|SET_TESTS_PROPERTIES|SITE_NAME|' + # r'SOURCE_GROUP|STRING|SUBDIR_DEPENDS|SUBDIRS|' + # r'TARGET_LINK_LIBRARIES|TRY_COMPILE|TRY_RUN|UNSET|' + # r'USE_MANGLED_MESA|UTILITY_SOURCE|VARIABLE_REQUIRES|' + # r'VTK_MAKE_INSTANTIATOR|VTK_WRAP_JAVA|VTK_WRAP_PYTHON|' + # r'VTK_WRAP_TCL|WHILE|WRITE_FILE|' + # r'COUNTARGS)\b', Name.Builtin, 'args'), + (r'\b(\w+)([ \t]*)(\()', bygroups(Name.Builtin, Text, + Punctuation), 'args'), + include('keywords'), + include('ws') + ], + 'args': [ + (r'\(', Punctuation, '#push'), + (r'\)', Punctuation, '#pop'), + (r'(\$\{)(.+?)(\})', bygroups(Operator, Name.Variable, Operator)), + (r'(\$ENV\{)(.+?)(\})', bygroups(Operator, Name.Variable, Operator)), + (r'(\$<)(.+?)(>)', bygroups(Operator, Name.Variable, Operator)), + (r'(?s)".*?"', String.Double), + (r'\\\S+', String), + (r'[^)$"# \t\n]+', String), + (r'\n', Text), # explicitly legal + include('keywords'), + include('ws') + ], + 'string': [ + + ], + 'keywords': [ + (r'\b(WIN32|UNIX|APPLE|CYGWIN|BORLAND|MINGW|MSVC|MSVC_IDE|MSVC60|' + r'MSVC70|MSVC71|MSVC80|MSVC90)\b', Keyword), + ], + 'ws': [ + (r'[ \t]+', Text), + (r'#.*\n', Comment), + ] + } + + def analyse_text(text): + exp = r'^ *CMAKE_MINIMUM_REQUIRED *\( *VERSION *\d(\.\d)* *( FATAL_ERROR)? *\) *$' + if re.search(exp, text, flags=re.MULTILINE | re.IGNORECASE): + return 0.8 + return 0.0 diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/markup.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/markup.py new file mode 100644 index 0000000000000000000000000000000000000000..92dc9e7a6185d7f7cb2f5bcc1e0fcea9242f3a32 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/markup.py @@ -0,0 +1,595 @@ +# -*- coding: utf-8 -*- +""" + pygments.lexers.markup + ~~~~~~~~~~~~~~~~~~~~~~ + + Lexers for non-HTML markup languages. + + :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS. + :license: BSD, see LICENSE for details. +""" + +import re + +from pygments.lexers.html import HtmlLexer, XmlLexer +from pygments.lexers.javascript import JavascriptLexer +from pygments.lexers.css import CssLexer + +from pygments.lexer import RegexLexer, DelegatingLexer, include, bygroups, \ + using, this, do_insertions, default, words +from pygments.token import Text, Comment, Operator, Keyword, Name, String, \ + Number, Punctuation, Generic, Other +from pygments.util import get_bool_opt, ClassNotFound + +__all__ = ['BBCodeLexer', 'MoinWikiLexer', 'RstLexer', 'TexLexer', 'GroffLexer', + 'MozPreprocHashLexer', 'MozPreprocPercentLexer', + 'MozPreprocXulLexer', 'MozPreprocJavascriptLexer', + 'MozPreprocCssLexer', 'MarkdownLexer'] + + +class BBCodeLexer(RegexLexer): + """ + A lexer that highlights BBCode(-like) syntax. + + .. versionadded:: 0.6 + """ + + name = 'BBCode' + aliases = ['bbcode'] + mimetypes = ['text/x-bbcode'] + + tokens = { + 'root': [ + (r'[^[]+', Text), + # tag/end tag begin + (r'\[/?\w+', Keyword, 'tag'), + # stray bracket + (r'\[', Text), + ], + 'tag': [ + (r'\s+', Text), + # attribute with value + (r'(\w+)(=)("?[^\s"\]]+"?)', + bygroups(Name.Attribute, Operator, String)), + # tag argument (a la [color=green]) + (r'(=)("?[^\s"\]]+"?)', + bygroups(Operator, String)), + # tag end + (r'\]', Keyword, '#pop'), + ], + } + + +class MoinWikiLexer(RegexLexer): + """ + For MoinMoin (and Trac) Wiki markup. + + .. versionadded:: 0.7 + """ + + name = 'MoinMoin/Trac Wiki markup' + aliases = ['trac-wiki', 'moin'] + filenames = [] + mimetypes = ['text/x-trac-wiki'] + flags = re.MULTILINE | re.IGNORECASE + + tokens = { + 'root': [ + (r'^#.*$', Comment), + (r'(!)(\S+)', bygroups(Keyword, Text)), # Ignore-next + # Titles + (r'^(=+)([^=]+)(=+)(\s*#.+)?$', + bygroups(Generic.Heading, using(this), Generic.Heading, String)), + # Literal code blocks, with optional shebang + (r'(\{\{\{)(\n#!.+)?', bygroups(Name.Builtin, Name.Namespace), 'codeblock'), + (r'(\'\'\'?|\|\||`|__|~~|\^|,,|::)', Comment), # Formatting + # Lists + (r'^( +)([.*-])( )', bygroups(Text, Name.Builtin, Text)), + (r'^( +)([a-z]{1,5}\.)( )', bygroups(Text, Name.Builtin, Text)), + # Other Formatting + (r'\[\[\w+.*?\]\]', Keyword), # Macro + (r'(\[[^\s\]]+)(\s+[^\]]+?)?(\])', + bygroups(Keyword, String, Keyword)), # Link + (r'^----+$', Keyword), # Horizontal rules + (r'[^\n\'\[{!_~^,|]+', Text), + (r'\n', Text), + (r'.', Text), + ], + 'codeblock': [ + (r'\}\}\}', Name.Builtin, '#pop'), + # these blocks are allowed to be nested in Trac, but not MoinMoin + (r'\{\{\{', Text, '#push'), + (r'[^{}]+', Comment.Preproc), # slurp boring text + (r'.', Comment.Preproc), # allow loose { or } + ], + } + + +class RstLexer(RegexLexer): + """ + For `reStructuredText `_ markup. + + .. versionadded:: 0.7 + + Additional options accepted: + + `handlecodeblocks` + Highlight the contents of ``.. sourcecode:: language``, + ``.. code:: language`` and ``.. code-block:: language`` + directives with a lexer for the given language (default: + ``True``). + + .. versionadded:: 0.8 + """ + name = 'reStructuredText' + aliases = ['rst', 'rest', 'restructuredtext'] + filenames = ['*.rst', '*.rest'] + mimetypes = ["text/x-rst", "text/prs.fallenstein.rst"] + flags = re.MULTILINE + + def _handle_sourcecode(self, match): + from pygments.lexers import get_lexer_by_name + + # section header + yield match.start(1), Punctuation, match.group(1) + yield match.start(2), Text, match.group(2) + yield match.start(3), Operator.Word, match.group(3) + yield match.start(4), Punctuation, match.group(4) + yield match.start(5), Text, match.group(5) + yield match.start(6), Keyword, match.group(6) + yield match.start(7), Text, match.group(7) + + # lookup lexer if wanted and existing + lexer = None + if self.handlecodeblocks: + try: + lexer = get_lexer_by_name(match.group(6).strip()) + except ClassNotFound: + pass + indention = match.group(8) + indention_size = len(indention) + code = (indention + match.group(9) + match.group(10) + match.group(11)) + + # no lexer for this language. handle it like it was a code block + if lexer is None: + yield match.start(8), String, code + return + + # highlight the lines with the lexer. + ins = [] + codelines = code.splitlines(True) + code = '' + for line in codelines: + if len(line) > indention_size: + ins.append((len(code), [(0, Text, line[:indention_size])])) + code += line[indention_size:] + else: + code += line + for item in do_insertions(ins, lexer.get_tokens_unprocessed(code)): + yield item + + # from docutils.parsers.rst.states + closers = u'\'")]}>\u2019\u201d\xbb!?' + unicode_delimiters = u'\u2010\u2011\u2012\u2013\u2014\u00a0' + end_string_suffix = (r'((?=$)|(?=[-/:.,; \n\x00%s%s]))' + % (re.escape(unicode_delimiters), + re.escape(closers))) + + tokens = { + 'root': [ + # Heading with overline + (r'^(=+|-+|`+|:+|\.+|\'+|"+|~+|\^+|_+|\*+|\++|#+)([ \t]*\n)' + r'(.+)(\n)(\1)(\n)', + bygroups(Generic.Heading, Text, Generic.Heading, + Text, Generic.Heading, Text)), + # Plain heading + (r'^(\S.*)(\n)(={3,}|-{3,}|`{3,}|:{3,}|\.{3,}|\'{3,}|"{3,}|' + r'~{3,}|\^{3,}|_{3,}|\*{3,}|\+{3,}|#{3,})(\n)', + bygroups(Generic.Heading, Text, Generic.Heading, Text)), + # Bulleted lists + (r'^(\s*)([-*+])( .+\n(?:\1 .+\n)*)', + bygroups(Text, Number, using(this, state='inline'))), + # Numbered lists + (r'^(\s*)([0-9#ivxlcmIVXLCM]+\.)( .+\n(?:\1 .+\n)*)', + bygroups(Text, Number, using(this, state='inline'))), + (r'^(\s*)(\(?[0-9#ivxlcmIVXLCM]+\))( .+\n(?:\1 .+\n)*)', + bygroups(Text, Number, using(this, state='inline'))), + # Numbered, but keep words at BOL from becoming lists + (r'^(\s*)([A-Z]+\.)( .+\n(?:\1 .+\n)+)', + bygroups(Text, Number, using(this, state='inline'))), + (r'^(\s*)(\(?[A-Za-z]+\))( .+\n(?:\1 .+\n)+)', + bygroups(Text, Number, using(this, state='inline'))), + # Line blocks + (r'^(\s*)(\|)( .+\n(?:\| .+\n)*)', + bygroups(Text, Operator, using(this, state='inline'))), + # Sourcecode directives + (r'^( *\.\.)(\s*)((?:source)?code(?:-block)?)(::)([ \t]*)([^\n]+)' + r'(\n[ \t]*\n)([ \t]+)(.*)(\n)((?:(?:\8.*|)\n)+)', + _handle_sourcecode), + # A directive + (r'^( *\.\.)(\s*)([\w:-]+?)(::)(?:([ \t]*)(.*))', + bygroups(Punctuation, Text, Operator.Word, Punctuation, Text, + using(this, state='inline'))), + # A reference target + (r'^( *\.\.)(\s*)(_(?:[^:\\]|\\.)+:)(.*?)$', + bygroups(Punctuation, Text, Name.Tag, using(this, state='inline'))), + # A footnote/citation target + (r'^( *\.\.)(\s*)(\[.+\])(.*?)$', + bygroups(Punctuation, Text, Name.Tag, using(this, state='inline'))), + # A substitution def + (r'^( *\.\.)(\s*)(\|.+\|)(\s*)([\w:-]+?)(::)(?:([ \t]*)(.*))', + bygroups(Punctuation, Text, Name.Tag, Text, Operator.Word, + Punctuation, Text, using(this, state='inline'))), + # Comments + (r'^ *\.\..*(\n( +.*\n|\n)+)?', Comment.Preproc), + # Field list + (r'^( *)(:[a-zA-Z-]+:)(\s*)$', bygroups(Text, Name.Class, Text)), + (r'^( *)(:.*?:)([ \t]+)(.*?)$', + bygroups(Text, Name.Class, Text, Name.Function)), + # Definition list + (r'^(\S.*(?)(`__?)', # reference with inline target + bygroups(String, String.Interpol, String)), + (r'`.+?`__?', String), # reference + (r'(`.+?`)(:[a-zA-Z0-9:-]+?:)?', + bygroups(Name.Variable, Name.Attribute)), # role + (r'(:[a-zA-Z0-9:-]+?:)(`.+?`)', + bygroups(Name.Attribute, Name.Variable)), # role (content first) + (r'\*\*.+?\*\*', Generic.Strong), # Strong emphasis + (r'\*.+?\*', Generic.Emph), # Emphasis + (r'\[.*?\]_', String), # Footnote or citation + (r'<.+?>', Name.Tag), # Hyperlink + (r'[^\\\n\[*`:]+', Text), + (r'.', Text), + ], + 'literal': [ + (r'[^`]+', String), + (r'``' + end_string_suffix, String, '#pop'), + (r'`', String), + ] + } + + def __init__(self, **options): + self.handlecodeblocks = get_bool_opt(options, 'handlecodeblocks', True) + RegexLexer.__init__(self, **options) + + def analyse_text(text): + if text[:2] == '..' and text[2:3] != '.': + return 0.3 + p1 = text.find("\n") + p2 = text.find("\n", p1 + 1) + if (p2 > -1 and # has two lines + p1 * 2 + 1 == p2 and # they are the same length + text[p1+1] in '-=' and # the next line both starts and ends with + text[p1+1] == text[p2-1]): # ...a sufficiently high header + return 0.5 + + +class TexLexer(RegexLexer): + """ + Lexer for the TeX and LaTeX typesetting languages. + """ + + name = 'TeX' + aliases = ['tex', 'latex'] + filenames = ['*.tex', '*.aux', '*.toc'] + mimetypes = ['text/x-tex', 'text/x-latex'] + + tokens = { + 'general': [ + (r'%.*?\n', Comment), + (r'[{}]', Name.Builtin), + (r'[&_^]', Name.Builtin), + ], + 'root': [ + (r'\\\[', String.Backtick, 'displaymath'), + (r'\\\(', String, 'inlinemath'), + (r'\$\$', String.Backtick, 'displaymath'), + (r'\$', String, 'inlinemath'), + (r'\\([a-zA-Z]+|.)', Keyword, 'command'), + (r'\\$', Keyword), + include('general'), + (r'[^\\$%&_^{}]+', Text), + ], + 'math': [ + (r'\\([a-zA-Z]+|.)', Name.Variable), + include('general'), + (r'[0-9]+', Number), + (r'[-=!+*/()\[\]]', Operator), + (r'[^=!+*/()\[\]\\$%&_^{}0-9-]+', Name.Builtin), + ], + 'inlinemath': [ + (r'\\\)', String, '#pop'), + (r'\$', String, '#pop'), + include('math'), + ], + 'displaymath': [ + (r'\\\]', String, '#pop'), + (r'\$\$', String, '#pop'), + (r'\$', Name.Builtin), + include('math'), + ], + 'command': [ + (r'\[.*?\]', Name.Attribute), + (r'\*', Keyword), + default('#pop'), + ], + } + + def analyse_text(text): + for start in ("\\documentclass", "\\input", "\\documentstyle", + "\\relax"): + if text[:len(start)] == start: + return True + + +class GroffLexer(RegexLexer): + """ + Lexer for the (g)roff typesetting language, supporting groff + extensions. Mainly useful for highlighting manpage sources. + + .. versionadded:: 0.6 + """ + + name = 'Groff' + aliases = ['groff', 'nroff', 'man'] + filenames = ['*.[1234567]', '*.man'] + mimetypes = ['application/x-troff', 'text/troff'] + + tokens = { + 'root': [ + (r'(\.)(\w+)', bygroups(Text, Keyword), 'request'), + (r'\.', Punctuation, 'request'), + # Regular characters, slurp till we find a backslash or newline + (r'[^\\\n]+', Text, 'textline'), + default('textline'), + ], + 'textline': [ + include('escapes'), + (r'[^\\\n]+', Text), + (r'\n', Text, '#pop'), + ], + 'escapes': [ + # groff has many ways to write escapes. + (r'\\"[^\n]*', Comment), + (r'\\[fn]\w', String.Escape), + (r'\\\(.{2}', String.Escape), + (r'\\.\[.*\]', String.Escape), + (r'\\.', String.Escape), + (r'\\\n', Text, 'request'), + ], + 'request': [ + (r'\n', Text, '#pop'), + include('escapes'), + (r'"[^\n"]+"', String.Double), + (r'\d+', Number), + (r'\S+', String), + (r'\s+', Text), + ], + } + + def analyse_text(text): + if text[:1] != '.': + return False + if text[:3] == '.\\"': + return True + if text[:4] == '.TH ': + return True + if text[1:3].isalnum() and text[3].isspace(): + return 0.9 + + +class MozPreprocHashLexer(RegexLexer): + """ + Lexer for Mozilla Preprocessor files (with '#' as the marker). + + Other data is left untouched. + + .. versionadded:: 2.0 + """ + name = 'mozhashpreproc' + aliases = [name] + filenames = [] + mimetypes = [] + + tokens = { + 'root': [ + (r'^#', Comment.Preproc, ('expr', 'exprstart')), + (r'.+', Other), + ], + 'exprstart': [ + (r'(literal)(.*)', bygroups(Comment.Preproc, Text), '#pop:2'), + (words(( + 'define', 'undef', 'if', 'ifdef', 'ifndef', 'else', 'elif', + 'elifdef', 'elifndef', 'endif', 'expand', 'filter', 'unfilter', + 'include', 'includesubst', 'error')), + Comment.Preproc, '#pop'), + ], + 'expr': [ + (words(('!', '!=', '==', '&&', '||')), Operator), + (r'(defined)(\()', bygroups(Keyword, Punctuation)), + (r'\)', Punctuation), + (r'[0-9]+', Number.Decimal), + (r'__\w+?__', Name.Variable), + (r'@\w+?@', Name.Class), + (r'\w+', Name), + (r'\n', Text, '#pop'), + (r'\s+', Text), + (r'\S', Punctuation), + ], + } + + +class MozPreprocPercentLexer(MozPreprocHashLexer): + """ + Lexer for Mozilla Preprocessor files (with '%' as the marker). + + Other data is left untouched. + + .. versionadded:: 2.0 + """ + name = 'mozpercentpreproc' + aliases = [name] + filenames = [] + mimetypes = [] + + tokens = { + 'root': [ + (r'^%', Comment.Preproc, ('expr', 'exprstart')), + (r'.+', Other), + ], + } + + +class MozPreprocXulLexer(DelegatingLexer): + """ + Subclass of the `MozPreprocHashLexer` that highlights unlexed data with the + `XmlLexer`. + + .. versionadded:: 2.0 + """ + name = "XUL+mozpreproc" + aliases = ['xul+mozpreproc'] + filenames = ['*.xul.in'] + mimetypes = [] + + def __init__(self, **options): + super(MozPreprocXulLexer, self).__init__( + XmlLexer, MozPreprocHashLexer, **options) + + +class MozPreprocJavascriptLexer(DelegatingLexer): + """ + Subclass of the `MozPreprocHashLexer` that highlights unlexed data with the + `JavascriptLexer`. + + .. versionadded:: 2.0 + """ + name = "Javascript+mozpreproc" + aliases = ['javascript+mozpreproc'] + filenames = ['*.js.in'] + mimetypes = [] + + def __init__(self, **options): + super(MozPreprocJavascriptLexer, self).__init__( + JavascriptLexer, MozPreprocHashLexer, **options) + + +class MozPreprocCssLexer(DelegatingLexer): + """ + Subclass of the `MozPreprocHashLexer` that highlights unlexed data with the + `CssLexer`. + + .. versionadded:: 2.0 + """ + name = "CSS+mozpreproc" + aliases = ['css+mozpreproc'] + filenames = ['*.css.in'] + mimetypes = [] + + def __init__(self, **options): + super(MozPreprocCssLexer, self).__init__( + CssLexer, MozPreprocPercentLexer, **options) + + +class MarkdownLexer(RegexLexer): + """ + For `Markdown `_ markup. + + .. versionadded:: 2.2 + """ + name = 'markdown' + aliases = ['md'] + filenames = ['*.md'] + mimetypes = ["text/x-markdown"] + flags = re.MULTILINE + + def _handle_codeblock(self, match): + """ + match args: 1:backticks, 2:lang_name, 3:newline, 4:code, 5:backticks + """ + from pygments.lexers import get_lexer_by_name + + # section header + yield match.start(1), String , match.group(1) + yield match.start(2), String , match.group(2) + yield match.start(3), Text , match.group(3) + + # lookup lexer if wanted and existing + lexer = None + if self.handlecodeblocks: + try: + lexer = get_lexer_by_name( match.group(2).strip() ) + except ClassNotFound: + pass + code = match.group(4) + + # no lexer for this language. handle it like it was a code block + if lexer is None: + yield match.start(4), String, code + return + + for item in do_insertions([], lexer.get_tokens_unprocessed(code)): + yield item + + yield match.start(5), String , match.group(5) + + tokens = { + 'root': [ + # heading with pound prefix + (r'^(#)([^#].+\n)', bygroups(Generic.Heading, Text)), + (r'^(#{2,6})(.+\n)', bygroups(Generic.Subheading, Text)), + # task list + (r'^(\s*)([*-] )(\[[ xX]\])( .+\n)', + bygroups(Text, Keyword, Keyword, using(this, state='inline'))), + # bulleted lists + (r'^(\s*)([*-])(\s)(.+\n)', + bygroups(Text, Keyword, Text, using(this, state='inline'))), + # numbered lists + (r'^(\s*)([0-9]+\.)( .+\n)', + bygroups(Text, Keyword, using(this, state='inline'))), + # quote + (r'^(\s*>\s)(.+\n)', bygroups(Keyword, Generic.Emph)), + # text block + (r'^(```\n)([\w\W]*?)(^```$)', bygroups(String, Text, String)), + # code block with language + (r'^(```)(\w+)(\n)([\w\W]*?)(^```$)', _handle_codeblock), + + include('inline'), + ], + 'inline': [ + # escape + (r'\\.', Text), + # italics + (r'(\s)([*_][^*_]+[*_])(\W|\n)', bygroups(Text, Generic.Emph, Text)), + # bold + # warning: the following rule eats internal tags. eg. **foo _bar_ baz** bar is not italics + (r'(\s)((\*\*|__).*\3)((?=\W|\n))', bygroups(Text, Generic.Strong, None, Text)), + # "proper way" (r'(\s)([*_]{2}[^*_]+[*_]{2})((?=\W|\n))', bygroups(Text, Generic.Strong, Text)), + # strikethrough + (r'(\s)(~~[^~]+~~)((?=\W|\n))', bygroups(Text, Generic.Deleted, Text)), + # inline code + (r'`[^`]+`', String.Backtick), + # mentions and topics (twitter and github stuff) + (r'[@#][\w/:]+', Name.Entity), + # (image?) links eg: ![Image of Yaktocat](https://octodex.github.com/images/yaktocat.png) + (r'(!?\[)([^]]+)(\])(\()([^)]+)(\))', bygroups(Text, Name.Tag, Text, Text, Name.Attribute, Text)), + + # general text, must come last! + (r'[^\\\s]+', Text), + (r'.', Text), + ], + } + + def __init__(self, **options): + self.handlecodeblocks = get_bool_opt(options, 'handlecodeblocks', True) + RegexLexer.__init__(self, **options) diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/math.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/math.py new file mode 100644 index 0000000000000000000000000000000000000000..ea0ebee2a777da643726fc943f2ba52d3691760a --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/math.py @@ -0,0 +1,21 @@ +# -*- coding: utf-8 -*- +""" + pygments.lexers.math + ~~~~~~~~~~~~~~~~~~~~ + + Just export lexers that were contained in this module. + + :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS. + :license: BSD, see LICENSE for details. +""" + +from pygments.lexers.python import NumPyLexer +from pygments.lexers.matlab import MatlabLexer, MatlabSessionLexer, \ + OctaveLexer, ScilabLexer +from pygments.lexers.julia import JuliaLexer, JuliaConsoleLexer +from pygments.lexers.r import RConsoleLexer, SLexer, RdLexer +from pygments.lexers.modeling import BugsLexer, JagsLexer, StanLexer +from pygments.lexers.idl import IDLLexer +from pygments.lexers.algebra import MuPADLexer + +__all__ = [] diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/matlab.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/matlab.py new file mode 100644 index 0000000000000000000000000000000000000000..56a0f6d6d1d6489b42eae1cebd46ba16b2e2b3ef --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/matlab.py @@ -0,0 +1,663 @@ +# -*- coding: utf-8 -*- +""" + pygments.lexers.matlab + ~~~~~~~~~~~~~~~~~~~~~~ + + Lexers for Matlab and related languages. + + :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS. + :license: BSD, see LICENSE for details. +""" + +import re + +from pygments.lexer import Lexer, RegexLexer, bygroups, words, do_insertions +from pygments.token import Text, Comment, Operator, Keyword, Name, String, \ + Number, Punctuation, Generic, Whitespace + +from pygments.lexers import _scilab_builtins + +__all__ = ['MatlabLexer', 'MatlabSessionLexer', 'OctaveLexer', 'ScilabLexer'] + + +class MatlabLexer(RegexLexer): + """ + For Matlab source code. + + .. versionadded:: 0.10 + """ + name = 'Matlab' + aliases = ['matlab'] + filenames = ['*.m'] + mimetypes = ['text/matlab'] + + # + # These lists are generated automatically. + # Run the following in bash shell: + # + # for f in elfun specfun elmat; do + # echo -n "$f = " + # matlab -nojvm -r "help $f;exit;" | perl -ne \ + # 'push(@c,$1) if /^ (\w+)\s+-/; END {print q{["}.join(q{","},@c).qq{"]\n};}' + # done + # + # elfun: Elementary math functions + # specfun: Special Math functions + # elmat: Elementary matrices and matrix manipulation + # + # taken from Matlab version 7.4.0.336 (R2007a) + # + elfun = ("sin", "sind", "sinh", "asin", "asind", "asinh", "cos", "cosd", "cosh", + "acos", "acosd", "acosh", "tan", "tand", "tanh", "atan", "atand", "atan2", + "atanh", "sec", "secd", "sech", "asec", "asecd", "asech", "csc", "cscd", + "csch", "acsc", "acscd", "acsch", "cot", "cotd", "coth", "acot", "acotd", + "acoth", "hypot", "exp", "expm1", "log", "log1p", "log10", "log2", "pow2", + "realpow", "reallog", "realsqrt", "sqrt", "nthroot", "nextpow2", "abs", + "angle", "complex", "conj", "imag", "real", "unwrap", "isreal", "cplxpair", + "fix", "floor", "ceil", "round", "mod", "rem", "sign") + specfun = ("airy", "besselj", "bessely", "besselh", "besseli", "besselk", "beta", + "betainc", "betaln", "ellipj", "ellipke", "erf", "erfc", "erfcx", + "erfinv", "expint", "gamma", "gammainc", "gammaln", "psi", "legendre", + "cross", "dot", "factor", "isprime", "primes", "gcd", "lcm", "rat", + "rats", "perms", "nchoosek", "factorial", "cart2sph", "cart2pol", + "pol2cart", "sph2cart", "hsv2rgb", "rgb2hsv") + elmat = ("zeros", "ones", "eye", "repmat", "rand", "randn", "linspace", "logspace", + "freqspace", "meshgrid", "accumarray", "size", "length", "ndims", "numel", + "disp", "isempty", "isequal", "isequalwithequalnans", "cat", "reshape", + "diag", "blkdiag", "tril", "triu", "fliplr", "flipud", "flipdim", "rot90", + "find", "end", "sub2ind", "ind2sub", "bsxfun", "ndgrid", "permute", + "ipermute", "shiftdim", "circshift", "squeeze", "isscalar", "isvector", + "ans", "eps", "realmax", "realmin", "pi", "i", "inf", "nan", "isnan", + "isinf", "isfinite", "j", "why", "compan", "gallery", "hadamard", "hankel", + "hilb", "invhilb", "magic", "pascal", "rosser", "toeplitz", "vander", + "wilkinson") + + tokens = { + 'root': [ + # line starting with '!' is sent as a system command. not sure what + # label to use... + (r'^!.*', String.Other), + (r'%\{\s*\n', Comment.Multiline, 'blockcomment'), + (r'%.*$', Comment), + (r'^\s*function', Keyword, 'deffunc'), + + # from 'iskeyword' on version 7.11 (R2010): + (words(( + 'break', 'case', 'catch', 'classdef', 'continue', 'else', 'elseif', + 'end', 'enumerated', 'events', 'for', 'function', 'global', 'if', + 'methods', 'otherwise', 'parfor', 'persistent', 'properties', + 'return', 'spmd', 'switch', 'try', 'while'), suffix=r'\b'), + Keyword), + + ("(" + "|".join(elfun + specfun + elmat) + r')\b', Name.Builtin), + + # line continuation with following comment: + (r'\.\.\..*$', Comment), + + # operators: + (r'-|==|~=|<|>|<=|>=|&&|&|~|\|\|?', Operator), + # operators requiring escape for re: + (r'\.\*|\*|\+|\.\^|\.\\|\.\/|\/|\\', Operator), + + # punctuation: + (r'\[|\]|\(|\)|\{|\}|:|@|\.|,', Punctuation), + (r'=|:|;', Punctuation), + + # quote can be transpose, instead of string: + # (not great, but handles common cases...) + (r'(?<=[\w)\].])\'+', Operator), + + (r'(\d+\.\d*|\d*\.\d+)([eEf][+-]?[0-9]+)?', Number.Float), + (r'\d+[eEf][+-]?[0-9]+', Number.Float), + (r'\d+', Number.Integer), + + (r'(?. + + .. versionadded:: 0.10 + """ + name = 'Matlab session' + aliases = ['matlabsession'] + + def get_tokens_unprocessed(self, text): + mlexer = MatlabLexer(**self.options) + + curcode = '' + insertions = [] + + for match in line_re.finditer(text): + line = match.group() + + if line.startswith('>> '): + insertions.append((len(curcode), + [(0, Generic.Prompt, line[:3])])) + curcode += line[3:] + + elif line.startswith('>>'): + insertions.append((len(curcode), + [(0, Generic.Prompt, line[:2])])) + curcode += line[2:] + + elif line.startswith('???'): + + idx = len(curcode) + + # without is showing error on same line as before...? + # line = "\n" + line + token = (0, Generic.Traceback, line) + insertions.append((idx, [token])) + + else: + if curcode: + for item in do_insertions( + insertions, mlexer.get_tokens_unprocessed(curcode)): + yield item + curcode = '' + insertions = [] + + yield match.start(), Generic.Output, line + + if curcode: # or item: + for item in do_insertions( + insertions, mlexer.get_tokens_unprocessed(curcode)): + yield item + + +class OctaveLexer(RegexLexer): + """ + For GNU Octave source code. + + .. versionadded:: 1.5 + """ + name = 'Octave' + aliases = ['octave'] + filenames = ['*.m'] + mimetypes = ['text/octave'] + + # These lists are generated automatically. + # Run the following in bash shell: + # + # First dump all of the Octave manual into a plain text file: + # + # $ info octave --subnodes -o octave-manual + # + # Now grep through it: + + # for i in \ + # "Built-in Function" "Command" "Function File" \ + # "Loadable Function" "Mapping Function"; + # do + # perl -e '@name = qw('"$i"'); + # print lc($name[0]),"_kw = [\n"'; + # + # perl -n -e 'print "\"$1\",\n" if /-- '"$i"': .* (\w*) \(/;' \ + # octave-manual | sort | uniq ; + # echo "]" ; + # echo; + # done + + # taken from Octave Mercurial changeset 8cc154f45e37 (30-jan-2011) + + builtin_kw = ( + "addlistener", "addpath", "addproperty", "all", + "and", "any", "argnames", "argv", "assignin", + "atexit", "autoload", + "available_graphics_toolkits", "beep_on_error", + "bitand", "bitmax", "bitor", "bitshift", "bitxor", + "cat", "cell", "cellstr", "char", "class", "clc", + "columns", "command_line_path", + "completion_append_char", "completion_matches", + "complex", "confirm_recursive_rmdir", "cputime", + "crash_dumps_octave_core", "ctranspose", "cumprod", + "cumsum", "debug_on_error", "debug_on_interrupt", + "debug_on_warning", "default_save_options", + "dellistener", "diag", "diff", "disp", + "doc_cache_file", "do_string_escapes", "double", + "drawnow", "e", "echo_executing_commands", "eps", + "eq", "errno", "errno_list", "error", "eval", + "evalin", "exec", "exist", "exit", "eye", "false", + "fclear", "fclose", "fcntl", "fdisp", "feof", + "ferror", "feval", "fflush", "fgetl", "fgets", + "fieldnames", "file_in_loadpath", "file_in_path", + "filemarker", "filesep", "find_dir_in_path", + "fixed_point_format", "fnmatch", "fopen", "fork", + "formula", "fprintf", "fputs", "fread", "freport", + "frewind", "fscanf", "fseek", "fskipl", "ftell", + "functions", "fwrite", "ge", "genpath", "get", + "getegid", "getenv", "geteuid", "getgid", + "getpgrp", "getpid", "getppid", "getuid", "glob", + "gt", "gui_mode", "history_control", + "history_file", "history_size", + "history_timestamp_format_string", "home", + "horzcat", "hypot", "ifelse", + "ignore_function_time_stamp", "inferiorto", + "info_file", "info_program", "inline", "input", + "intmax", "intmin", "ipermute", + "is_absolute_filename", "isargout", "isbool", + "iscell", "iscellstr", "ischar", "iscomplex", + "isempty", "isfield", "isfloat", "isglobal", + "ishandle", "isieee", "isindex", "isinteger", + "islogical", "ismatrix", "ismethod", "isnull", + "isnumeric", "isobject", "isreal", + "is_rooted_relative_filename", "issorted", + "isstruct", "isvarname", "kbhit", "keyboard", + "kill", "lasterr", "lasterror", "lastwarn", + "ldivide", "le", "length", "link", "linspace", + "logical", "lstat", "lt", "make_absolute_filename", + "makeinfo_program", "max_recursion_depth", "merge", + "methods", "mfilename", "minus", "mislocked", + "mkdir", "mkfifo", "mkstemp", "mldivide", "mlock", + "mouse_wheel_zoom", "mpower", "mrdivide", "mtimes", + "munlock", "nargin", "nargout", + "native_float_format", "ndims", "ne", "nfields", + "nnz", "norm", "not", "numel", "nzmax", + "octave_config_info", "octave_core_file_limit", + "octave_core_file_name", + "octave_core_file_options", "ones", "or", + "output_max_field_width", "output_precision", + "page_output_immediately", "page_screen_output", + "path", "pathsep", "pause", "pclose", "permute", + "pi", "pipe", "plus", "popen", "power", + "print_empty_dimensions", "printf", + "print_struct_array_contents", "prod", + "program_invocation_name", "program_name", + "putenv", "puts", "pwd", "quit", "rats", "rdivide", + "readdir", "readlink", "read_readline_init_file", + "realmax", "realmin", "rehash", "rename", + "repelems", "re_read_readline_init_file", "reset", + "reshape", "resize", "restoredefaultpath", + "rethrow", "rmdir", "rmfield", "rmpath", "rows", + "save_header_format_string", "save_precision", + "saving_history", "scanf", "set", "setenv", + "shell_cmd", "sighup_dumps_octave_core", + "sigterm_dumps_octave_core", "silent_functions", + "single", "size", "size_equal", "sizemax", + "sizeof", "sleep", "source", "sparse_auto_mutate", + "split_long_rows", "sprintf", "squeeze", "sscanf", + "stat", "stderr", "stdin", "stdout", "strcmp", + "strcmpi", "string_fill_char", "strncmp", + "strncmpi", "struct", "struct_levels_to_print", + "strvcat", "subsasgn", "subsref", "sum", "sumsq", + "superiorto", "suppress_verbose_help_message", + "symlink", "system", "tic", "tilde_expand", + "times", "tmpfile", "tmpnam", "toc", "toupper", + "transpose", "true", "typeinfo", "umask", "uminus", + "uname", "undo_string_escapes", "unlink", "uplus", + "upper", "usage", "usleep", "vec", "vectorize", + "vertcat", "waitpid", "warning", "warranty", + "whos_line_format", "yes_or_no", "zeros", + "inf", "Inf", "nan", "NaN") + + command_kw = ("close", "load", "who", "whos") + + function_kw = ( + "accumarray", "accumdim", "acosd", "acotd", + "acscd", "addtodate", "allchild", "ancestor", + "anova", "arch_fit", "arch_rnd", "arch_test", + "area", "arma_rnd", "arrayfun", "ascii", "asctime", + "asecd", "asind", "assert", "atand", + "autoreg_matrix", "autumn", "axes", "axis", "bar", + "barh", "bartlett", "bartlett_test", "beep", + "betacdf", "betainv", "betapdf", "betarnd", + "bicgstab", "bicubic", "binary", "binocdf", + "binoinv", "binopdf", "binornd", "bitcmp", + "bitget", "bitset", "blackman", "blanks", + "blkdiag", "bone", "box", "brighten", "calendar", + "cast", "cauchy_cdf", "cauchy_inv", "cauchy_pdf", + "cauchy_rnd", "caxis", "celldisp", "center", "cgs", + "chisquare_test_homogeneity", + "chisquare_test_independence", "circshift", "cla", + "clabel", "clf", "clock", "cloglog", "closereq", + "colon", "colorbar", "colormap", "colperm", + "comet", "common_size", "commutation_matrix", + "compan", "compare_versions", "compass", + "computer", "cond", "condest", "contour", + "contourc", "contourf", "contrast", "conv", + "convhull", "cool", "copper", "copyfile", "cor", + "corrcoef", "cor_test", "cosd", "cotd", "cov", + "cplxpair", "cross", "cscd", "cstrcat", "csvread", + "csvwrite", "ctime", "cumtrapz", "curl", "cut", + "cylinder", "date", "datenum", "datestr", + "datetick", "datevec", "dblquad", "deal", + "deblank", "deconv", "delaunay", "delaunayn", + "delete", "demo", "detrend", "diffpara", "diffuse", + "dir", "discrete_cdf", "discrete_inv", + "discrete_pdf", "discrete_rnd", "display", + "divergence", "dlmwrite", "dos", "dsearch", + "dsearchn", "duplication_matrix", "durbinlevinson", + "ellipsoid", "empirical_cdf", "empirical_inv", + "empirical_pdf", "empirical_rnd", "eomday", + "errorbar", "etime", "etreeplot", "example", + "expcdf", "expinv", "expm", "exppdf", "exprnd", + "ezcontour", "ezcontourf", "ezmesh", "ezmeshc", + "ezplot", "ezpolar", "ezsurf", "ezsurfc", "factor", + "factorial", "fail", "fcdf", "feather", "fftconv", + "fftfilt", "fftshift", "figure", "fileattrib", + "fileparts", "fill", "findall", "findobj", + "findstr", "finv", "flag", "flipdim", "fliplr", + "flipud", "fpdf", "fplot", "fractdiff", "freqz", + "freqz_plot", "frnd", "fsolve", + "f_test_regression", "ftp", "fullfile", "fzero", + "gamcdf", "gaminv", "gampdf", "gamrnd", "gca", + "gcbf", "gcbo", "gcf", "genvarname", "geocdf", + "geoinv", "geopdf", "geornd", "getfield", "ginput", + "glpk", "gls", "gplot", "gradient", + "graphics_toolkit", "gray", "grid", "griddata", + "griddatan", "gtext", "gunzip", "gzip", "hadamard", + "hamming", "hankel", "hanning", "hggroup", + "hidden", "hilb", "hist", "histc", "hold", "hot", + "hotelling_test", "housh", "hsv", "hurst", + "hygecdf", "hygeinv", "hygepdf", "hygernd", + "idivide", "ifftshift", "image", "imagesc", + "imfinfo", "imread", "imshow", "imwrite", "index", + "info", "inpolygon", "inputname", "interpft", + "interpn", "intersect", "invhilb", "iqr", "isa", + "isdefinite", "isdir", "is_duplicate_entry", + "isequal", "isequalwithequalnans", "isfigure", + "ishermitian", "ishghandle", "is_leap_year", + "isletter", "ismac", "ismember", "ispc", "isprime", + "isprop", "isscalar", "issquare", "isstrprop", + "issymmetric", "isunix", "is_valid_file_id", + "isvector", "jet", "kendall", + "kolmogorov_smirnov_cdf", + "kolmogorov_smirnov_test", "kruskal_wallis_test", + "krylov", "kurtosis", "laplace_cdf", "laplace_inv", + "laplace_pdf", "laplace_rnd", "legend", "legendre", + "license", "line", "linkprop", "list_primes", + "loadaudio", "loadobj", "logistic_cdf", + "logistic_inv", "logistic_pdf", "logistic_rnd", + "logit", "loglog", "loglogerr", "logm", "logncdf", + "logninv", "lognpdf", "lognrnd", "logspace", + "lookfor", "ls_command", "lsqnonneg", "magic", + "mahalanobis", "manova", "matlabroot", + "mcnemar_test", "mean", "meansq", "median", "menu", + "mesh", "meshc", "meshgrid", "meshz", "mexext", + "mget", "mkpp", "mode", "moment", "movefile", + "mpoles", "mput", "namelengthmax", "nargchk", + "nargoutchk", "nbincdf", "nbininv", "nbinpdf", + "nbinrnd", "nchoosek", "ndgrid", "newplot", "news", + "nonzeros", "normcdf", "normest", "norminv", + "normpdf", "normrnd", "now", "nthroot", "null", + "ocean", "ols", "onenormest", "optimget", + "optimset", "orderfields", "orient", "orth", + "pack", "pareto", "parseparams", "pascal", "patch", + "pathdef", "pcg", "pchip", "pcolor", "pcr", + "peaks", "periodogram", "perl", "perms", "pie", + "pink", "planerot", "playaudio", "plot", + "plotmatrix", "plotyy", "poisscdf", "poissinv", + "poisspdf", "poissrnd", "polar", "poly", + "polyaffine", "polyarea", "polyderiv", "polyfit", + "polygcd", "polyint", "polyout", "polyreduce", + "polyval", "polyvalm", "postpad", "powerset", + "ppder", "ppint", "ppjumps", "ppplot", "ppval", + "pqpnonneg", "prepad", "primes", "print", + "print_usage", "prism", "probit", "qp", "qqplot", + "quadcc", "quadgk", "quadl", "quadv", "quiver", + "qzhess", "rainbow", "randi", "range", "rank", + "ranks", "rat", "reallog", "realpow", "realsqrt", + "record", "rectangle_lw", "rectangle_sw", + "rectint", "refresh", "refreshdata", + "regexptranslate", "repmat", "residue", "ribbon", + "rindex", "roots", "rose", "rosser", "rotdim", + "rref", "run", "run_count", "rundemos", "run_test", + "runtests", "saveas", "saveaudio", "saveobj", + "savepath", "scatter", "secd", "semilogx", + "semilogxerr", "semilogy", "semilogyerr", + "setaudio", "setdiff", "setfield", "setxor", + "shading", "shift", "shiftdim", "sign_test", + "sinc", "sind", "sinetone", "sinewave", "skewness", + "slice", "sombrero", "sortrows", "spaugment", + "spconvert", "spdiags", "spearman", "spectral_adf", + "spectral_xdf", "specular", "speed", "spencer", + "speye", "spfun", "sphere", "spinmap", "spline", + "spones", "sprand", "sprandn", "sprandsym", + "spring", "spstats", "spy", "sqp", "stairs", + "statistics", "std", "stdnormal_cdf", + "stdnormal_inv", "stdnormal_pdf", "stdnormal_rnd", + "stem", "stft", "strcat", "strchr", "strjust", + "strmatch", "strread", "strsplit", "strtok", + "strtrim", "strtrunc", "structfun", "studentize", + "subplot", "subsindex", "subspace", "substr", + "substruct", "summer", "surf", "surface", "surfc", + "surfl", "surfnorm", "svds", "swapbytes", + "sylvester_matrix", "symvar", "synthesis", "table", + "tand", "tar", "tcdf", "tempdir", "tempname", + "test", "text", "textread", "textscan", "tinv", + "title", "toeplitz", "tpdf", "trace", "trapz", + "treelayout", "treeplot", "triangle_lw", + "triangle_sw", "tril", "trimesh", "triplequad", + "triplot", "trisurf", "triu", "trnd", "tsearchn", + "t_test", "t_test_regression", "type", "unidcdf", + "unidinv", "unidpdf", "unidrnd", "unifcdf", + "unifinv", "unifpdf", "unifrnd", "union", "unique", + "unix", "unmkpp", "unpack", "untabify", "untar", + "unwrap", "unzip", "u_test", "validatestring", + "vander", "var", "var_test", "vech", "ver", + "version", "view", "voronoi", "voronoin", + "waitforbuttonpress", "wavread", "wavwrite", + "wblcdf", "wblinv", "wblpdf", "wblrnd", "weekday", + "welch_test", "what", "white", "whitebg", + "wienrnd", "wilcoxon_test", "wilkinson", "winter", + "xlabel", "xlim", "ylabel", "yulewalker", "zip", + "zlabel", "z_test") + + loadable_kw = ( + "airy", "amd", "balance", "besselh", "besseli", + "besselj", "besselk", "bessely", "bitpack", + "bsxfun", "builtin", "ccolamd", "cellfun", + "cellslices", "chol", "choldelete", "cholinsert", + "cholinv", "cholshift", "cholupdate", "colamd", + "colloc", "convhulln", "convn", "csymamd", + "cummax", "cummin", "daspk", "daspk_options", + "dasrt", "dasrt_options", "dassl", "dassl_options", + "dbclear", "dbdown", "dbstack", "dbstatus", + "dbstop", "dbtype", "dbup", "dbwhere", "det", + "dlmread", "dmperm", "dot", "eig", "eigs", + "endgrent", "endpwent", "etree", "fft", "fftn", + "fftw", "filter", "find", "full", "gcd", + "getgrent", "getgrgid", "getgrnam", "getpwent", + "getpwnam", "getpwuid", "getrusage", "givens", + "gmtime", "gnuplot_binary", "hess", "ifft", + "ifftn", "inv", "isdebugmode", "issparse", "kron", + "localtime", "lookup", "lsode", "lsode_options", + "lu", "luinc", "luupdate", "matrix_type", "max", + "min", "mktime", "pinv", "qr", "qrdelete", + "qrinsert", "qrshift", "qrupdate", "quad", + "quad_options", "qz", "rand", "rande", "randg", + "randn", "randp", "randperm", "rcond", "regexp", + "regexpi", "regexprep", "schur", "setgrent", + "setpwent", "sort", "spalloc", "sparse", "spparms", + "sprank", "sqrtm", "strfind", "strftime", + "strptime", "strrep", "svd", "svd_driver", "syl", + "symamd", "symbfact", "symrcm", "time", "tsearch", + "typecast", "urlread", "urlwrite") + + mapping_kw = ( + "abs", "acos", "acosh", "acot", "acoth", "acsc", + "acsch", "angle", "arg", "asec", "asech", "asin", + "asinh", "atan", "atanh", "beta", "betainc", + "betaln", "bincoeff", "cbrt", "ceil", "conj", "cos", + "cosh", "cot", "coth", "csc", "csch", "erf", "erfc", + "erfcx", "erfinv", "exp", "finite", "fix", "floor", + "fmod", "gamma", "gammainc", "gammaln", "imag", + "isalnum", "isalpha", "isascii", "iscntrl", + "isdigit", "isfinite", "isgraph", "isinf", + "islower", "isna", "isnan", "isprint", "ispunct", + "isspace", "isupper", "isxdigit", "lcm", "lgamma", + "log", "lower", "mod", "real", "rem", "round", + "roundb", "sec", "sech", "sign", "sin", "sinh", + "sqrt", "tan", "tanh", "toascii", "tolower", "xor") + + builtin_consts = ( + "EDITOR", "EXEC_PATH", "I", "IMAGE_PATH", "NA", + "OCTAVE_HOME", "OCTAVE_VERSION", "PAGER", + "PAGER_FLAGS", "SEEK_CUR", "SEEK_END", "SEEK_SET", + "SIG", "S_ISBLK", "S_ISCHR", "S_ISDIR", "S_ISFIFO", + "S_ISLNK", "S_ISREG", "S_ISSOCK", "WCONTINUE", + "WCOREDUMP", "WEXITSTATUS", "WIFCONTINUED", + "WIFEXITED", "WIFSIGNALED", "WIFSTOPPED", "WNOHANG", + "WSTOPSIG", "WTERMSIG", "WUNTRACED") + + tokens = { + 'root': [ + # We should look into multiline comments + (r'[%#].*$', Comment), + (r'^\s*function', Keyword, 'deffunc'), + + # from 'iskeyword' on hg changeset 8cc154f45e37 + (words(( + '__FILE__', '__LINE__', 'break', 'case', 'catch', 'classdef', 'continue', 'do', 'else', + 'elseif', 'end', 'end_try_catch', 'end_unwind_protect', 'endclassdef', + 'endevents', 'endfor', 'endfunction', 'endif', 'endmethods', 'endproperties', + 'endswitch', 'endwhile', 'events', 'for', 'function', 'get', 'global', 'if', 'methods', + 'otherwise', 'persistent', 'properties', 'return', 'set', 'static', 'switch', 'try', + 'until', 'unwind_protect', 'unwind_protect_cleanup', 'while'), suffix=r'\b'), + Keyword), + + (words(builtin_kw + command_kw + function_kw + loadable_kw + mapping_kw, + suffix=r'\b'), Name.Builtin), + + (words(builtin_consts, suffix=r'\b'), Name.Constant), + + # operators in Octave but not Matlab: + (r'-=|!=|!|/=|--', Operator), + # operators: + (r'-|==|~=|<|>|<=|>=|&&|&|~|\|\|?', Operator), + # operators in Octave but not Matlab requiring escape for re: + (r'\*=|\+=|\^=|\/=|\\=|\*\*|\+\+|\.\*\*', Operator), + # operators requiring escape for re: + (r'\.\*|\*|\+|\.\^|\.\\|\.\/|\/|\\', Operator), + + + # punctuation: + (r'[\[\](){}:@.,]', Punctuation), + (r'=|:|;', Punctuation), + + (r'"[^"]*"', String), + + (r'(\d+\.\d*|\d*\.\d+)([eEf][+-]?[0-9]+)?', Number.Float), + (r'\d+[eEf][+-]?[0-9]+', Number.Float), + (r'\d+', Number.Integer), + + # quote can be transpose, instead of string: + # (not great, but handles common cases...) + (r'(?<=[\w)\].])\'+', Operator), + (r'(?|<=|>=|&&|&|~|\|\|?', Operator), + # operators requiring escape for re: + (r'\.\*|\*|\+|\.\^|\.\\|\.\/|\/|\\', Operator), + + # punctuation: + (r'[\[\](){}@.,=:;]', Punctuation), + + (r'"[^"]*"', String), + + # quote can be transpose, instead of string: + # (not great, but handles common cases...) + (r'(?<=[\w)\].])\'+', Operator), + (r'(?', '->', '#', + # Modules + ':>', + )) + + nonid_reserved = set(('(', ')', '[', ']', '{', '}', ',', ';', '...', '_')) + + alphanumid_re = r"[a-zA-Z][\w']*" + symbolicid_re = r"[!%&$#+\-/:<=>?@\\~`^|*]+" + + # A character constant is a sequence of the form #s, where s is a string + # constant denoting a string of size one character. This setup just parses + # the entire string as either a String.Double or a String.Char (depending + # on the argument), even if the String.Char is an erronous + # multiple-character string. + def stringy(whatkind): + return [ + (r'[^"\\]', whatkind), + (r'\\[\\"abtnvfr]', String.Escape), + # Control-character notation is used for codes < 32, + # where \^@ == \000 + (r'\\\^[\x40-\x5e]', String.Escape), + # Docs say 'decimal digits' + (r'\\[0-9]{3}', String.Escape), + (r'\\u[0-9a-fA-F]{4}', String.Escape), + (r'\\\s+\\', String.Interpol), + (r'"', whatkind, '#pop'), + ] + + # Callbacks for distinguishing tokens and reserved words + def long_id_callback(self, match): + if match.group(1) in self.alphanumid_reserved: + token = Error + else: + token = Name.Namespace + yield match.start(1), token, match.group(1) + yield match.start(2), Punctuation, match.group(2) + + def end_id_callback(self, match): + if match.group(1) in self.alphanumid_reserved: + token = Error + elif match.group(1) in self.symbolicid_reserved: + token = Error + else: + token = Name + yield match.start(1), token, match.group(1) + + def id_callback(self, match): + str = match.group(1) + if str in self.alphanumid_reserved: + token = Keyword.Reserved + elif str in self.symbolicid_reserved: + token = Punctuation + else: + token = Name + yield match.start(1), token, str + + tokens = { + # Whitespace and comments are (almost) everywhere + 'whitespace': [ + (r'\s+', Text), + (r'\(\*', Comment.Multiline, 'comment'), + ], + + 'delimiters': [ + # This lexer treats these delimiters specially: + # Delimiters define scopes, and the scope is how the meaning of + # the `|' is resolved - is it a case/handle expression, or function + # definition by cases? (This is not how the Definition works, but + # it's how MLton behaves, see http://mlton.org/SMLNJDeviations) + (r'\(|\[|\{', Punctuation, 'main'), + (r'\)|\]|\}', Punctuation, '#pop'), + (r'\b(let|if|local)\b(?!\')', Keyword.Reserved, ('main', 'main')), + (r'\b(struct|sig|while)\b(?!\')', Keyword.Reserved, 'main'), + (r'\b(do|else|end|in|then)\b(?!\')', Keyword.Reserved, '#pop'), + ], + + 'core': [ + # Punctuation that doesn't overlap symbolic identifiers + (r'(%s)' % '|'.join(re.escape(z) for z in nonid_reserved), + Punctuation), + + # Special constants: strings, floats, numbers in decimal and hex + (r'#"', String.Char, 'char'), + (r'"', String.Double, 'string'), + (r'~?0x[0-9a-fA-F]+', Number.Hex), + (r'0wx[0-9a-fA-F]+', Number.Hex), + (r'0w\d+', Number.Integer), + (r'~?\d+\.\d+[eE]~?\d+', Number.Float), + (r'~?\d+\.\d+', Number.Float), + (r'~?\d+[eE]~?\d+', Number.Float), + (r'~?\d+', Number.Integer), + + # Labels + (r'#\s*[1-9][0-9]*', Name.Label), + (r'#\s*(%s)' % alphanumid_re, Name.Label), + (r'#\s+(%s)' % symbolicid_re, Name.Label), + # Some reserved words trigger a special, local lexer state change + (r'\b(datatype|abstype)\b(?!\')', Keyword.Reserved, 'dname'), + (r'(?=\b(exception)\b(?!\'))', Text, ('ename')), + (r'\b(functor|include|open|signature|structure)\b(?!\')', + Keyword.Reserved, 'sname'), + (r'\b(type|eqtype)\b(?!\')', Keyword.Reserved, 'tname'), + + # Regular identifiers, long and otherwise + (r'\'[\w\']*', Name.Decorator), + (r'(%s)(\.)' % alphanumid_re, long_id_callback, "dotted"), + (r'(%s)' % alphanumid_re, id_callback), + (r'(%s)' % symbolicid_re, id_callback), + ], + 'dotted': [ + (r'(%s)(\.)' % alphanumid_re, long_id_callback), + (r'(%s)' % alphanumid_re, end_id_callback, "#pop"), + (r'(%s)' % symbolicid_re, end_id_callback, "#pop"), + (r'\s+', Error), + (r'\S+', Error), + ], + + + # Main parser (prevents errors in files that have scoping errors) + 'root': [ + default('main') + ], + + # In this scope, I expect '|' to not be followed by a function name, + # and I expect 'and' to be followed by a binding site + 'main': [ + include('whitespace'), + + # Special behavior of val/and/fun + (r'\b(val|and)\b(?!\')', Keyword.Reserved, 'vname'), + (r'\b(fun)\b(?!\')', Keyword.Reserved, + ('#pop', 'main-fun', 'fname')), + + include('delimiters'), + include('core'), + (r'\S+', Error), + ], + + # In this scope, I expect '|' and 'and' to be followed by a function + 'main-fun': [ + include('whitespace'), + + (r'\s', Text), + (r'\(\*', Comment.Multiline, 'comment'), + + # Special behavior of val/and/fun + (r'\b(fun|and)\b(?!\')', Keyword.Reserved, 'fname'), + (r'\b(val)\b(?!\')', Keyword.Reserved, + ('#pop', 'main', 'vname')), + + # Special behavior of '|' and '|'-manipulating keywords + (r'\|', Punctuation, 'fname'), + (r'\b(case|handle)\b(?!\')', Keyword.Reserved, + ('#pop', 'main')), + + include('delimiters'), + include('core'), + (r'\S+', Error), + ], + + # Character and string parsers + 'char': stringy(String.Char), + 'string': stringy(String.Double), + + 'breakout': [ + (r'(?=\b(%s)\b(?!\'))' % '|'.join(alphanumid_reserved), Text, '#pop'), + ], + + # Dealing with what comes after module system keywords + 'sname': [ + include('whitespace'), + include('breakout'), + + (r'(%s)' % alphanumid_re, Name.Namespace), + default('#pop'), + ], + + # Dealing with what comes after the 'fun' (or 'and' or '|') keyword + 'fname': [ + include('whitespace'), + (r'\'[\w\']*', Name.Decorator), + (r'\(', Punctuation, 'tyvarseq'), + + (r'(%s)' % alphanumid_re, Name.Function, '#pop'), + (r'(%s)' % symbolicid_re, Name.Function, '#pop'), + + # Ignore interesting function declarations like "fun (x + y) = ..." + default('#pop'), + ], + + # Dealing with what comes after the 'val' (or 'and') keyword + 'vname': [ + include('whitespace'), + (r'\'[\w\']*', Name.Decorator), + (r'\(', Punctuation, 'tyvarseq'), + + (r'(%s)(\s*)(=(?!%s))' % (alphanumid_re, symbolicid_re), + bygroups(Name.Variable, Text, Punctuation), '#pop'), + (r'(%s)(\s*)(=(?!%s))' % (symbolicid_re, symbolicid_re), + bygroups(Name.Variable, Text, Punctuation), '#pop'), + (r'(%s)' % alphanumid_re, Name.Variable, '#pop'), + (r'(%s)' % symbolicid_re, Name.Variable, '#pop'), + + # Ignore interesting patterns like 'val (x, y)' + default('#pop'), + ], + + # Dealing with what comes after the 'type' (or 'and') keyword + 'tname': [ + include('whitespace'), + include('breakout'), + + (r'\'[\w\']*', Name.Decorator), + (r'\(', Punctuation, 'tyvarseq'), + (r'=(?!%s)' % symbolicid_re, Punctuation, ('#pop', 'typbind')), + + (r'(%s)' % alphanumid_re, Keyword.Type), + (r'(%s)' % symbolicid_re, Keyword.Type), + (r'\S+', Error, '#pop'), + ], + + # A type binding includes most identifiers + 'typbind': [ + include('whitespace'), + + (r'\b(and)\b(?!\')', Keyword.Reserved, ('#pop', 'tname')), + + include('breakout'), + include('core'), + (r'\S+', Error, '#pop'), + ], + + # Dealing with what comes after the 'datatype' (or 'and') keyword + 'dname': [ + include('whitespace'), + include('breakout'), + + (r'\'[\w\']*', Name.Decorator), + (r'\(', Punctuation, 'tyvarseq'), + (r'(=)(\s*)(datatype)', + bygroups(Punctuation, Text, Keyword.Reserved), '#pop'), + (r'=(?!%s)' % symbolicid_re, Punctuation, + ('#pop', 'datbind', 'datcon')), + + (r'(%s)' % alphanumid_re, Keyword.Type), + (r'(%s)' % symbolicid_re, Keyword.Type), + (r'\S+', Error, '#pop'), + ], + + # common case - A | B | C of int + 'datbind': [ + include('whitespace'), + + (r'\b(and)\b(?!\')', Keyword.Reserved, ('#pop', 'dname')), + (r'\b(withtype)\b(?!\')', Keyword.Reserved, ('#pop', 'tname')), + (r'\b(of)\b(?!\')', Keyword.Reserved), + + (r'(\|)(\s*)(%s)' % alphanumid_re, + bygroups(Punctuation, Text, Name.Class)), + (r'(\|)(\s+)(%s)' % symbolicid_re, + bygroups(Punctuation, Text, Name.Class)), + + include('breakout'), + include('core'), + (r'\S+', Error), + ], + + # Dealing with what comes after an exception + 'ename': [ + include('whitespace'), + + (r'(exception|and)\b(\s+)(%s)' % alphanumid_re, + bygroups(Keyword.Reserved, Text, Name.Class)), + (r'(exception|and)\b(\s*)(%s)' % symbolicid_re, + bygroups(Keyword.Reserved, Text, Name.Class)), + (r'\b(of)\b(?!\')', Keyword.Reserved), + + include('breakout'), + include('core'), + (r'\S+', Error), + ], + + 'datcon': [ + include('whitespace'), + (r'(%s)' % alphanumid_re, Name.Class, '#pop'), + (r'(%s)' % symbolicid_re, Name.Class, '#pop'), + (r'\S+', Error, '#pop'), + ], + + # Series of type variables + 'tyvarseq': [ + (r'\s', Text), + (r'\(\*', Comment.Multiline, 'comment'), + + (r'\'[\w\']*', Name.Decorator), + (alphanumid_re, Name), + (r',', Punctuation), + (r'\)', Punctuation, '#pop'), + (symbolicid_re, Name), + ], + + 'comment': [ + (r'[^(*)]', Comment.Multiline), + (r'\(\*', Comment.Multiline, '#push'), + (r'\*\)', Comment.Multiline, '#pop'), + (r'[(*)]', Comment.Multiline), + ], + } + + +class OcamlLexer(RegexLexer): + """ + For the OCaml language. + + .. versionadded:: 0.7 + """ + + name = 'OCaml' + aliases = ['ocaml'] + filenames = ['*.ml', '*.mli', '*.mll', '*.mly'] + mimetypes = ['text/x-ocaml'] + + keywords = ( + 'as', 'assert', 'begin', 'class', 'constraint', 'do', 'done', + 'downto', 'else', 'end', 'exception', 'external', 'false', + 'for', 'fun', 'function', 'functor', 'if', 'in', 'include', + 'inherit', 'initializer', 'lazy', 'let', 'match', 'method', + 'module', 'mutable', 'new', 'object', 'of', 'open', 'private', + 'raise', 'rec', 'sig', 'struct', 'then', 'to', 'true', 'try', + 'type', 'value', 'val', 'virtual', 'when', 'while', 'with', + ) + keyopts = ( + '!=', '#', '&', '&&', r'\(', r'\)', r'\*', r'\+', ',', '-', + r'-\.', '->', r'\.', r'\.\.', ':', '::', ':=', ':>', ';', ';;', '<', + '<-', '=', '>', '>]', r'>\}', r'\?', r'\?\?', r'\[', r'\[<', r'\[>', + r'\[\|', ']', '_', '`', r'\{', r'\{<', r'\|', r'\|]', r'\}', '~' + ) + + operators = r'[!$%&*+\./:<=>?@^|~-]' + word_operators = ('and', 'asr', 'land', 'lor', 'lsl', 'lxor', 'mod', 'or') + prefix_syms = r'[!?~]' + infix_syms = r'[=<>@^|&+\*/$%-]' + primitives = ('unit', 'int', 'float', 'bool', 'string', 'char', 'list', 'array') + + tokens = { + 'escape-sequence': [ + (r'\\[\\"\'ntbr]', String.Escape), + (r'\\[0-9]{3}', String.Escape), + (r'\\x[0-9a-fA-F]{2}', String.Escape), + ], + 'root': [ + (r'\s+', Text), + (r'false|true|\(\)|\[\]', Name.Builtin.Pseudo), + (r'\b([A-Z][\w\']*)(?=\s*\.)', Name.Namespace, 'dotted'), + (r'\b([A-Z][\w\']*)', Name.Class), + (r'\(\*(?![)])', Comment, 'comment'), + (r'\b(%s)\b' % '|'.join(keywords), Keyword), + (r'(%s)' % '|'.join(keyopts[::-1]), Operator), + (r'(%s|%s)?%s' % (infix_syms, prefix_syms, operators), Operator), + (r'\b(%s)\b' % '|'.join(word_operators), Operator.Word), + (r'\b(%s)\b' % '|'.join(primitives), Keyword.Type), + + (r"[^\W\d][\w']*", Name), + + (r'-?\d[\d_]*(.[\d_]*)?([eE][+\-]?\d[\d_]*)', Number.Float), + (r'0[xX][\da-fA-F][\da-fA-F_]*', Number.Hex), + (r'0[oO][0-7][0-7_]*', Number.Oct), + (r'0[bB][01][01_]*', Number.Bin), + (r'\d[\d_]*', Number.Integer), + + (r"'(?:(\\[\\\"'ntbr ])|(\\[0-9]{3})|(\\x[0-9a-fA-F]{2}))'", + String.Char), + (r"'.'", String.Char), + (r"'", Keyword), # a stray quote is another syntax element + + (r'"', String.Double, 'string'), + + (r'[~?][a-z][\w\']*:', Name.Variable), + ], + 'comment': [ + (r'[^(*)]+', Comment), + (r'\(\*', Comment, '#push'), + (r'\*\)', Comment, '#pop'), + (r'[(*)]', Comment), + ], + 'string': [ + (r'[^\\"]+', String.Double), + include('escape-sequence'), + (r'\\\n', String.Double), + (r'"', String.Double, '#pop'), + ], + 'dotted': [ + (r'\s+', Text), + (r'\.', Punctuation), + (r'[A-Z][\w\']*(?=\s*\.)', Name.Namespace), + (r'[A-Z][\w\']*', Name.Class, '#pop'), + (r'[a-z_][\w\']*', Name, '#pop'), + default('#pop'), + ], + } + + +class OpaLexer(RegexLexer): + """ + Lexer for the Opa language (http://opalang.org). + + .. versionadded:: 1.5 + """ + + name = 'Opa' + aliases = ['opa'] + filenames = ['*.opa'] + mimetypes = ['text/x-opa'] + + # most of these aren't strictly keywords + # but if you color only real keywords, you might just + # as well not color anything + keywords = ( + 'and', 'as', 'begin', 'case', 'client', 'css', 'database', 'db', 'do', + 'else', 'end', 'external', 'forall', 'function', 'if', 'import', + 'match', 'module', 'or', 'package', 'parser', 'rec', 'server', 'then', + 'type', 'val', 'with', 'xml_parser', + ) + + # matches both stuff and `stuff` + ident_re = r'(([a-zA-Z_]\w*)|(`[^`]*`))' + + op_re = r'[.=\-<>,@~%/+?*&^!]' + punc_re = r'[()\[\],;|]' # '{' and '}' are treated elsewhere + # because they are also used for inserts + + tokens = { + # copied from the caml lexer, should be adapted + 'escape-sequence': [ + (r'\\[\\"\'ntr}]', String.Escape), + (r'\\[0-9]{3}', String.Escape), + (r'\\x[0-9a-fA-F]{2}', String.Escape), + ], + + # factorizing these rules, because they are inserted many times + 'comments': [ + (r'/\*', Comment, 'nested-comment'), + (r'//.*?$', Comment), + ], + 'comments-and-spaces': [ + include('comments'), + (r'\s+', Text), + ], + + 'root': [ + include('comments-and-spaces'), + # keywords + (words(keywords, prefix=r'\b', suffix=r'\b'), Keyword), + # directives + # we could parse the actual set of directives instead of anything + # starting with @, but this is troublesome + # because it needs to be adjusted all the time + # and assuming we parse only sources that compile, it is useless + (r'@' + ident_re + r'\b', Name.Builtin.Pseudo), + + # number literals + (r'-?.[\d]+([eE][+\-]?\d+)', Number.Float), + (r'-?\d+.\d*([eE][+\-]?\d+)', Number.Float), + (r'-?\d+[eE][+\-]?\d+', Number.Float), + (r'0[xX][\da-fA-F]+', Number.Hex), + (r'0[oO][0-7]+', Number.Oct), + (r'0[bB][01]+', Number.Bin), + (r'\d+', Number.Integer), + # color literals + (r'#[\da-fA-F]{3,6}', Number.Integer), + + # string literals + (r'"', String.Double, 'string'), + # char literal, should be checked because this is the regexp from + # the caml lexer + (r"'(?:(\\[\\\"'ntbr ])|(\\[0-9]{3})|(\\x[0-9a-fA-F]{2})|.)'", + String.Char), + + # this is meant to deal with embedded exprs in strings + # every time we find a '}' we pop a state so that if we were + # inside a string, we are back in the string state + # as a consequence, we must also push a state every time we find a + # '{' or else we will have errors when parsing {} for instance + (r'\{', Operator, '#push'), + (r'\}', Operator, '#pop'), + + # html literals + # this is a much more strict that the actual parser, + # since a])', String.Single, 'html-open-tag'), + + # db path + # matching the '[_]' in '/a[_]' because it is a part + # of the syntax of the db path definition + # unfortunately, i don't know how to match the ']' in + # /a[1], so this is somewhat inconsistent + (r'[@?!]?(/\w+)+(\[_\])?', Name.Variable), + # putting the same color on <- as on db path, since + # it can be used only to mean Db.write + (r'<-(?!'+op_re+r')', Name.Variable), + + # 'modules' + # although modules are not distinguished by their names as in caml + # the standard library seems to follow the convention that modules + # only area capitalized + (r'\b([A-Z]\w*)(?=\.)', Name.Namespace), + + # operators + # = has a special role because this is the only + # way to syntactic distinguish binding constructions + # unfortunately, this colors the equal in {x=2} too + (r'=(?!'+op_re+r')', Keyword), + (r'(%s)+' % op_re, Operator), + (r'(%s)+' % punc_re, Operator), + + # coercions + (r':', Operator, 'type'), + # type variables + # we need this rule because we don't parse specially type + # definitions so in "type t('a) = ...", "'a" is parsed by 'root' + ("'"+ident_re, Keyword.Type), + + # id literal, #something, or #{expr} + (r'#'+ident_re, String.Single), + (r'#(?=\{)', String.Single), + + # identifiers + # this avoids to color '2' in 'a2' as an integer + (ident_re, Text), + + # default, not sure if that is needed or not + # (r'.', Text), + ], + + # it is quite painful to have to parse types to know where they end + # this is the general rule for a type + # a type is either: + # * -> ty + # * type-with-slash + # * type-with-slash -> ty + # * type-with-slash (, type-with-slash)+ -> ty + # + # the code is pretty funky in here, but this code would roughly + # translate in caml to: + # let rec type stream = + # match stream with + # | [< "->"; stream >] -> type stream + # | [< ""; stream >] -> + # type_with_slash stream + # type_lhs_1 stream; + # and type_1 stream = ... + 'type': [ + include('comments-and-spaces'), + (r'->', Keyword.Type), + default(('#pop', 'type-lhs-1', 'type-with-slash')), + ], + + # parses all the atomic or closed constructions in the syntax of type + # expressions: record types, tuple types, type constructors, basic type + # and type variables + 'type-1': [ + include('comments-and-spaces'), + (r'\(', Keyword.Type, ('#pop', 'type-tuple')), + (r'~?\{', Keyword.Type, ('#pop', 'type-record')), + (ident_re+r'\(', Keyword.Type, ('#pop', 'type-tuple')), + (ident_re, Keyword.Type, '#pop'), + ("'"+ident_re, Keyword.Type), + # this case is not in the syntax but sometimes + # we think we are parsing types when in fact we are parsing + # some css, so we just pop the states until we get back into + # the root state + default('#pop'), + ], + + # type-with-slash is either: + # * type-1 + # * type-1 (/ type-1)+ + 'type-with-slash': [ + include('comments-and-spaces'), + default(('#pop', 'slash-type-1', 'type-1')), + ], + 'slash-type-1': [ + include('comments-and-spaces'), + ('/', Keyword.Type, ('#pop', 'type-1')), + # same remark as above + default('#pop'), + ], + + # we go in this state after having parsed a type-with-slash + # while trying to parse a type + # and at this point we must determine if we are parsing an arrow + # type (in which case we must continue parsing) or not (in which + # case we stop) + 'type-lhs-1': [ + include('comments-and-spaces'), + (r'->', Keyword.Type, ('#pop', 'type')), + (r'(?=,)', Keyword.Type, ('#pop', 'type-arrow')), + default('#pop'), + ], + 'type-arrow': [ + include('comments-and-spaces'), + # the look ahead here allows to parse f(x : int, y : float -> truc) + # correctly + (r',(?=[^:]*?->)', Keyword.Type, 'type-with-slash'), + (r'->', Keyword.Type, ('#pop', 'type')), + # same remark as above + default('#pop'), + ], + + # no need to do precise parsing for tuples and records + # because they are closed constructions, so we can simply + # find the closing delimiter + # note that this function would be not work if the source + # contained identifiers like `{)` (although it could be patched + # to support it) + 'type-tuple': [ + include('comments-and-spaces'), + (r'[^()/*]+', Keyword.Type), + (r'[/*]', Keyword.Type), + (r'\(', Keyword.Type, '#push'), + (r'\)', Keyword.Type, '#pop'), + ], + 'type-record': [ + include('comments-and-spaces'), + (r'[^{}/*]+', Keyword.Type), + (r'[/*]', Keyword.Type), + (r'\{', Keyword.Type, '#push'), + (r'\}', Keyword.Type, '#pop'), + ], + + # 'type-tuple': [ + # include('comments-and-spaces'), + # (r'\)', Keyword.Type, '#pop'), + # default(('#pop', 'type-tuple-1', 'type-1')), + # ], + # 'type-tuple-1': [ + # include('comments-and-spaces'), + # (r',?\s*\)', Keyword.Type, '#pop'), # ,) is a valid end of tuple, in (1,) + # (r',', Keyword.Type, 'type-1'), + # ], + # 'type-record':[ + # include('comments-and-spaces'), + # (r'\}', Keyword.Type, '#pop'), + # (r'~?(?:\w+|`[^`]*`)', Keyword.Type, 'type-record-field-expr'), + # ], + # 'type-record-field-expr': [ + # + # ], + + 'nested-comment': [ + (r'[^/*]+', Comment), + (r'/\*', Comment, '#push'), + (r'\*/', Comment, '#pop'), + (r'[/*]', Comment), + ], + + # the copy pasting between string and single-string + # is kinda sad. Is there a way to avoid that?? + 'string': [ + (r'[^\\"{]+', String.Double), + (r'"', String.Double, '#pop'), + (r'\{', Operator, 'root'), + include('escape-sequence'), + ], + 'single-string': [ + (r'[^\\\'{]+', String.Double), + (r'\'', String.Double, '#pop'), + (r'\{', Operator, 'root'), + include('escape-sequence'), + ], + + # all the html stuff + # can't really reuse some existing html parser + # because we must be able to parse embedded expressions + + # we are in this state after someone parsed the '<' that + # started the html literal + 'html-open-tag': [ + (r'[\w\-:]+', String.Single, ('#pop', 'html-attr')), + (r'>', String.Single, ('#pop', 'html-content')), + ], + + # we are in this state after someone parsed the ' is allowed + (r'[\w\-:]*>', String.Single, '#pop'), + ], + + # we are in this state after having parsed '', String.Single, '#pop'), + (r'>', String.Single, ('#pop', 'html-content')), + ], + + 'html-attr-value': [ + (r"'", String.Single, ('#pop', 'single-string')), + (r'"', String.Single, ('#pop', 'string')), + (r'#'+ident_re, String.Single, '#pop'), + (r'#(?=\{)', String.Single, ('#pop', 'root')), + (r'[^"\'{`=<>]+', String.Single, '#pop'), + (r'\{', Operator, ('#pop', 'root')), # this is a tail call! + ], + + # we should probably deal with '\' escapes here + 'html-content': [ + (r'', Comment, '#pop'), + (r'[^\-]+|-', Comment), + ], + } diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/modeling.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/modeling.py new file mode 100644 index 0000000000000000000000000000000000000000..b354f1cf0d156618e68ad79c49a57f528c5e701b --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/modeling.py @@ -0,0 +1,358 @@ +# -*- coding: utf-8 -*- +""" + pygments.lexers.modeling + ~~~~~~~~~~~~~~~~~~~~~~~~ + + Lexers for modeling languages. + + :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS. + :license: BSD, see LICENSE for details. +""" + +import re + +from pygments.lexer import RegexLexer, include, bygroups, using, default +from pygments.token import Text, Comment, Operator, Keyword, Name, String, \ + Number, Punctuation + +from pygments.lexers.html import HtmlLexer +from pygments.lexers import _stan_builtins + +__all__ = ['ModelicaLexer', 'BugsLexer', 'JagsLexer', 'StanLexer'] + + +class ModelicaLexer(RegexLexer): + """ + For `Modelica `_ source code. + + .. versionadded:: 1.1 + """ + name = 'Modelica' + aliases = ['modelica'] + filenames = ['*.mo'] + mimetypes = ['text/x-modelica'] + + flags = re.DOTALL | re.MULTILINE + + _name = r"(?:'(?:[^\\']|\\.)+'|[a-zA-Z_]\w*)" + + tokens = { + 'whitespace': [ + (u'[\\s\ufeff]+', Text), + (r'//[^\n]*\n?', Comment.Single), + (r'/\*.*?\*/', Comment.Multiline) + ], + 'root': [ + include('whitespace'), + (r'"', String.Double, 'string'), + (r'[()\[\]{},;]+', Punctuation), + (r'\.?[*^/+-]|\.|<>|[<>:=]=?', Operator), + (r'\d+(\.?\d*[eE][-+]?\d+|\.\d*)', Number.Float), + (r'\d+', Number.Integer), + (r'(abs|acos|actualStream|array|asin|assert|AssertionLevel|atan|' + r'atan2|backSample|Boolean|cardinality|cat|ceil|change|Clock|' + r'Connections|cos|cosh|cross|delay|diagonal|div|edge|exp|' + r'ExternalObject|fill|floor|getInstanceName|hold|homotopy|' + r'identity|inStream|integer|Integer|interval|inverse|isPresent|' + r'linspace|log|log10|matrix|max|min|mod|ndims|noClock|noEvent|' + r'ones|outerProduct|pre|previous|product|Real|reinit|rem|rooted|' + r'sample|scalar|semiLinear|shiftSample|sign|sin|sinh|size|skew|' + r'smooth|spatialDistribution|sqrt|StateSelect|String|subSample|' + r'sum|superSample|symmetric|tan|tanh|terminal|terminate|time|' + r'transpose|vector|zeros)\b', Name.Builtin), + (r'(algorithm|annotation|break|connect|constant|constrainedby|der|' + r'discrete|each|else|elseif|elsewhen|encapsulated|enumeration|' + r'equation|exit|expandable|extends|external|final|flow|for|if|' + r'import|impure|in|initial|inner|input|loop|nondiscrete|outer|' + r'output|parameter|partial|protected|public|pure|redeclare|' + r'replaceable|return|stream|then|when|while)\b', + Keyword.Reserved), + (r'(and|not|or)\b', Operator.Word), + (r'(block|class|connector|end|function|model|operator|package|' + r'record|type)\b', Keyword.Reserved, 'class'), + (r'(false|true)\b', Keyword.Constant), + (r'within\b', Keyword.Reserved, 'package-prefix'), + (_name, Name) + ], + 'class': [ + include('whitespace'), + (r'(function|record)\b', Keyword.Reserved), + (r'(if|for|when|while)\b', Keyword.Reserved, '#pop'), + (_name, Name.Class, '#pop'), + default('#pop') + ], + 'package-prefix': [ + include('whitespace'), + (_name, Name.Namespace, '#pop'), + default('#pop') + ], + 'string': [ + (r'"', String.Double, '#pop'), + (r'\\[\'"?\\abfnrtv]', String.Escape), + (r'(?i)<\s*html\s*>([^\\"]|\\.)+?(<\s*/\s*html\s*>|(?="))', + using(HtmlLexer)), + (r'<|\\?[^"\\<]+', String.Double) + ] + } + + +class BugsLexer(RegexLexer): + """ + Pygments Lexer for `OpenBugs `_ and WinBugs + models. + + .. versionadded:: 1.6 + """ + + name = 'BUGS' + aliases = ['bugs', 'winbugs', 'openbugs'] + filenames = ['*.bug'] + + _FUNCTIONS = ( + # Scalar functions + 'abs', 'arccos', 'arccosh', 'arcsin', 'arcsinh', 'arctan', 'arctanh', + 'cloglog', 'cos', 'cosh', 'cumulative', 'cut', 'density', 'deviance', + 'equals', 'expr', 'gammap', 'ilogit', 'icloglog', 'integral', 'log', + 'logfact', 'loggam', 'logit', 'max', 'min', 'phi', 'post.p.value', + 'pow', 'prior.p.value', 'probit', 'replicate.post', 'replicate.prior', + 'round', 'sin', 'sinh', 'solution', 'sqrt', 'step', 'tan', 'tanh', + 'trunc', + # Vector functions + 'inprod', 'interp.lin', 'inverse', 'logdet', 'mean', 'eigen.vals', + 'ode', 'prod', 'p.valueM', 'rank', 'ranked', 'replicate.postM', + 'sd', 'sort', 'sum', + # Special + 'D', 'I', 'F', 'T', 'C') + """ OpenBUGS built-in functions + + From http://www.openbugs.info/Manuals/ModelSpecification.html#ContentsAII + + This also includes + + - T, C, I : Truncation and censoring. + ``T`` and ``C`` are in OpenBUGS. ``I`` in WinBUGS. + - D : ODE + - F : Functional http://www.openbugs.info/Examples/Functionals.html + + """ + + _DISTRIBUTIONS = ('dbern', 'dbin', 'dcat', 'dnegbin', 'dpois', + 'dhyper', 'dbeta', 'dchisqr', 'ddexp', 'dexp', + 'dflat', 'dgamma', 'dgev', 'df', 'dggamma', 'dgpar', + 'dloglik', 'dlnorm', 'dlogis', 'dnorm', 'dpar', + 'dt', 'dunif', 'dweib', 'dmulti', 'ddirch', 'dmnorm', + 'dmt', 'dwish') + """ OpenBUGS built-in distributions + + Functions from + http://www.openbugs.info/Manuals/ModelSpecification.html#ContentsAI + """ + + tokens = { + 'whitespace': [ + (r"\s+", Text), + ], + 'comments': [ + # Comments + (r'#.*$', Comment.Single), + ], + 'root': [ + # Comments + include('comments'), + include('whitespace'), + # Block start + (r'(model)(\s+)(\{)', + bygroups(Keyword.Namespace, Text, Punctuation)), + # Reserved Words + (r'(for|in)(?![\w.])', Keyword.Reserved), + # Built-in Functions + (r'(%s)(?=\s*\()' + % r'|'.join(_FUNCTIONS + _DISTRIBUTIONS), + Name.Builtin), + # Regular variable names + (r'[A-Za-z][\w.]*', Name), + # Number Literals + (r'[-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?', Number), + # Punctuation + (r'\[|\]|\(|\)|:|,|;', Punctuation), + # Assignment operators + # SLexer makes these tokens Operators. + (r'<-|~', Operator), + # Infix and prefix operators + (r'\+|-|\*|/', Operator), + # Block + (r'[{}]', Punctuation), + ] + } + + def analyse_text(text): + if re.search(r"^\s*model\s*{", text, re.M): + return 0.7 + else: + return 0.0 + + +class JagsLexer(RegexLexer): + """ + Pygments Lexer for JAGS. + + .. versionadded:: 1.6 + """ + + name = 'JAGS' + aliases = ['jags'] + filenames = ['*.jag', '*.bug'] + + # JAGS + _FUNCTIONS = ( + 'abs', 'arccos', 'arccosh', 'arcsin', 'arcsinh', 'arctan', 'arctanh', + 'cos', 'cosh', 'cloglog', + 'equals', 'exp', 'icloglog', 'ifelse', 'ilogit', 'log', 'logfact', + 'loggam', 'logit', 'phi', 'pow', 'probit', 'round', 'sin', 'sinh', + 'sqrt', 'step', 'tan', 'tanh', 'trunc', 'inprod', 'interp.lin', + 'logdet', 'max', 'mean', 'min', 'prod', 'sum', 'sd', 'inverse', + 'rank', 'sort', 't', 'acos', 'acosh', 'asin', 'asinh', 'atan', + # Truncation/Censoring (should I include) + 'T', 'I') + # Distributions with density, probability and quartile functions + _DISTRIBUTIONS = tuple('[dpq]%s' % x for x in + ('bern', 'beta', 'dchiqsqr', 'ddexp', 'dexp', + 'df', 'gamma', 'gen.gamma', 'logis', 'lnorm', + 'negbin', 'nchisqr', 'norm', 'par', 'pois', 'weib')) + # Other distributions without density and probability + _OTHER_DISTRIBUTIONS = ( + 'dt', 'dunif', 'dbetabin', 'dbern', 'dbin', 'dcat', 'dhyper', + 'ddirch', 'dmnorm', 'dwish', 'dmt', 'dmulti', 'dbinom', 'dchisq', + 'dnbinom', 'dweibull', 'ddirich') + + tokens = { + 'whitespace': [ + (r"\s+", Text), + ], + 'names': [ + # Regular variable names + (r'[a-zA-Z][\w.]*\b', Name), + ], + 'comments': [ + # do not use stateful comments + (r'(?s)/\*.*?\*/', Comment.Multiline), + # Comments + (r'#.*$', Comment.Single), + ], + 'root': [ + # Comments + include('comments'), + include('whitespace'), + # Block start + (r'(model|data)(\s+)(\{)', + bygroups(Keyword.Namespace, Text, Punctuation)), + (r'var(?![\w.])', Keyword.Declaration), + # Reserved Words + (r'(for|in)(?![\w.])', Keyword.Reserved), + # Builtins + # Need to use lookahead because . is a valid char + (r'(%s)(?=\s*\()' % r'|'.join(_FUNCTIONS + + _DISTRIBUTIONS + + _OTHER_DISTRIBUTIONS), + Name.Builtin), + # Names + include('names'), + # Number Literals + (r'[-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?', Number), + (r'\[|\]|\(|\)|:|,|;', Punctuation), + # Assignment operators + (r'<-|~', Operator), + # # JAGS includes many more than OpenBUGS + (r'\+|-|\*|\/|\|\|[&]{2}|[<>=]=?|\^|%.*?%', Operator), + (r'[{}]', Punctuation), + ] + } + + def analyse_text(text): + if re.search(r'^\s*model\s*\{', text, re.M): + if re.search(r'^\s*data\s*\{', text, re.M): + return 0.9 + elif re.search(r'^\s*var', text, re.M): + return 0.9 + else: + return 0.3 + else: + return 0 + + +class StanLexer(RegexLexer): + """Pygments Lexer for Stan models. + + The Stan modeling language is specified in the *Stan Modeling Language + User's Guide and Reference Manual, v2.8.0*, + `pdf `__. + + .. versionadded:: 1.6 + """ + + name = 'Stan' + aliases = ['stan'] + filenames = ['*.stan'] + + tokens = { + 'whitespace': [ + (r"\s+", Text), + ], + 'comments': [ + (r'(?s)/\*.*?\*/', Comment.Multiline), + # Comments + (r'(//|#).*$', Comment.Single), + ], + 'root': [ + # Stan is more restrictive on strings than this regex + (r'"[^"]*"', String), + # Comments + include('comments'), + # block start + include('whitespace'), + # Block start + (r'(%s)(\s*)(\{)' % + r'|'.join(('functions', 'data', r'transformed\s+?data', + 'parameters', r'transformed\s+parameters', + 'model', r'generated\s+quantities')), + bygroups(Keyword.Namespace, Text, Punctuation)), + # Reserved Words + (r'(%s)\b' % r'|'.join(_stan_builtins.KEYWORDS), Keyword), + # Truncation + (r'T(?=\s*\[)', Keyword), + # Data types + (r'(%s)\b' % r'|'.join(_stan_builtins.TYPES), Keyword.Type), + # Punctuation + (r"[;:,\[\]()]", Punctuation), + # Builtin + (r'(%s)(?=\s*\()' + % r'|'.join(_stan_builtins.FUNCTIONS + + _stan_builtins.DISTRIBUTIONS), + Name.Builtin), + # Special names ending in __, like lp__ + (r'[A-Za-z]\w*__\b', Name.Builtin.Pseudo), + (r'(%s)\b' % r'|'.join(_stan_builtins.RESERVED), Keyword.Reserved), + # user-defined functions + (r'[A-Za-z]\w*(?=\s*\()]', Name.Function), + # Regular variable names + (r'[A-Za-z]\w*\b', Name), + # Real Literals + (r'-?[0-9]+(\.[0-9]+)?[eE]-?[0-9]+', Number.Float), + (r'-?[0-9]*\.[0-9]*', Number.Float), + # Integer Literals + (r'-?[0-9]+', Number.Integer), + # Assignment operators + # SLexer makes these tokens Operators. + (r'<-|~', Operator), + # Infix, prefix and postfix operators (and = ) + (r"\+|-|\.?\*|\.?/|\\|'|\^|==?|!=?|<=?|>=?|\|\||&&", Operator), + # Block delimiters + (r'[{}]', Punctuation), + ] + } + + def analyse_text(text): + if re.search(r'^\s*parameters\s*\{', text, re.M): + return 1.0 + else: + return 0.0 diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/modula2.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/modula2.py new file mode 100644 index 0000000000000000000000000000000000000000..c0a69b404f8626562845a466ea18d95d69ba6a9c --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/modula2.py @@ -0,0 +1,1561 @@ +# -*- coding: utf-8 -*- +""" + pygments.lexers.modula2 + ~~~~~~~~~~~~~~~~~~~~~~~ + + Multi-Dialect Lexer for Modula-2. + + :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS. + :license: BSD, see LICENSE for details. +""" + +import re + +from pygments.lexer import RegexLexer, include +from pygments.util import get_bool_opt, get_list_opt +from pygments.token import Text, Comment, Operator, Keyword, Name, \ + String, Number, Punctuation, Error + +__all__ = ['Modula2Lexer'] + + +# Multi-Dialect Modula-2 Lexer +class Modula2Lexer(RegexLexer): + """ + For `Modula-2 `_ source code. + + The Modula-2 lexer supports several dialects. By default, it operates in + fallback mode, recognising the *combined* literals, punctuation symbols + and operators of all supported dialects, and the *combined* reserved words + and builtins of PIM Modula-2, ISO Modula-2 and Modula-2 R10, while not + differentiating between library defined identifiers. + + To select a specific dialect, a dialect option may be passed + or a dialect tag may be embedded into a source file. + + Dialect Options: + + `m2pim` + Select PIM Modula-2 dialect. + `m2iso` + Select ISO Modula-2 dialect. + `m2r10` + Select Modula-2 R10 dialect. + `objm2` + Select Objective Modula-2 dialect. + + The PIM and ISO dialect options may be qualified with a language extension. + + Language Extensions: + + `+aglet` + Select Aglet Modula-2 extensions, available with m2iso. + `+gm2` + Select GNU Modula-2 extensions, available with m2pim. + `+p1` + Select p1 Modula-2 extensions, available with m2iso. + `+xds` + Select XDS Modula-2 extensions, available with m2iso. + + + Passing a Dialect Option via Unix Commandline Interface + + Dialect options may be passed to the lexer using the `dialect` key. + Only one such option should be passed. If multiple dialect options are + passed, the first valid option is used, any subsequent options are ignored. + + Examples: + + `$ pygmentize -O full,dialect=m2iso -f html -o /path/to/output /path/to/input` + Use ISO dialect to render input to HTML output + `$ pygmentize -O full,dialect=m2iso+p1 -f rtf -o /path/to/output /path/to/input` + Use ISO dialect with p1 extensions to render input to RTF output + + + Embedding a Dialect Option within a source file + + A dialect option may be embedded in a source file in form of a dialect + tag, a specially formatted comment that specifies a dialect option. + + Dialect Tag EBNF:: + + dialectTag : + OpeningCommentDelim Prefix dialectOption ClosingCommentDelim ; + + dialectOption : + 'm2pim' | 'm2iso' | 'm2r10' | 'objm2' | + 'm2iso+aglet' | 'm2pim+gm2' | 'm2iso+p1' | 'm2iso+xds' ; + + Prefix : '!' ; + + OpeningCommentDelim : '(*' ; + + ClosingCommentDelim : '*)' ; + + No whitespace is permitted between the tokens of a dialect tag. + + In the event that a source file contains multiple dialect tags, the first + tag that contains a valid dialect option will be used and any subsequent + dialect tags will be ignored. Ideally, a dialect tag should be placed + at the beginning of a source file. + + An embedded dialect tag overrides a dialect option set via command line. + + Examples: + + ``(*!m2r10*) DEFINITION MODULE Foobar; ...`` + Use Modula2 R10 dialect to render this source file. + ``(*!m2pim+gm2*) DEFINITION MODULE Bazbam; ...`` + Use PIM dialect with GNU extensions to render this source file. + + + Algol Publication Mode: + + In Algol publication mode, source text is rendered for publication of + algorithms in scientific papers and academic texts, following the format + of the Revised Algol-60 Language Report. It is activated by passing + one of two corresponding styles as an option: + + `algol` + render reserved words lowercase underline boldface + and builtins lowercase boldface italic + `algol_nu` + render reserved words lowercase boldface (no underlining) + and builtins lowercase boldface italic + + The lexer automatically performs the required lowercase conversion when + this mode is activated. + + Example: + + ``$ pygmentize -O full,style=algol -f latex -o /path/to/output /path/to/input`` + Render input file in Algol publication mode to LaTeX output. + + + Rendering Mode of First Class ADT Identifiers: + + The rendering of standard library first class ADT identifiers is controlled + by option flag "treat_stdlib_adts_as_builtins". + + When this option is turned on, standard library ADT identifiers are rendered + as builtins. When it is turned off, they are rendered as ordinary library + identifiers. + + `treat_stdlib_adts_as_builtins` (default: On) + + The option is useful for dialects that support ADTs as first class objects + and provide ADTs in the standard library that would otherwise be built-in. + + At present, only Modula-2 R10 supports library ADTs as first class objects + and therefore, no ADT identifiers are defined for any other dialects. + + Example: + + ``$ pygmentize -O full,dialect=m2r10,treat_stdlib_adts_as_builtins=Off ...`` + Render standard library ADTs as ordinary library types. + + .. versionadded:: 1.3 + + .. versionchanged:: 2.1 + Added multi-dialect support. + """ + name = 'Modula-2' + aliases = ['modula2', 'm2'] + filenames = ['*.def', '*.mod'] + mimetypes = ['text/x-modula2'] + + flags = re.MULTILINE | re.DOTALL + + tokens = { + 'whitespace': [ + (r'\n+', Text), # blank lines + (r'\s+', Text), # whitespace + ], + 'dialecttags': [ + # PIM Dialect Tag + (r'\(\*!m2pim\*\)', Comment.Special), + # ISO Dialect Tag + (r'\(\*!m2iso\*\)', Comment.Special), + # M2R10 Dialect Tag + (r'\(\*!m2r10\*\)', Comment.Special), + # ObjM2 Dialect Tag + (r'\(\*!objm2\*\)', Comment.Special), + # Aglet Extensions Dialect Tag + (r'\(\*!m2iso\+aglet\*\)', Comment.Special), + # GNU Extensions Dialect Tag + (r'\(\*!m2pim\+gm2\*\)', Comment.Special), + # p1 Extensions Dialect Tag + (r'\(\*!m2iso\+p1\*\)', Comment.Special), + # XDS Extensions Dialect Tag + (r'\(\*!m2iso\+xds\*\)', Comment.Special), + ], + 'identifiers': [ + (r'([a-zA-Z_$][\w$]*)', Name), + ], + 'prefixed_number_literals': [ + # + # Base-2, whole number + (r'0b[01]+(\'[01]+)*', Number.Bin), + # + # Base-16, whole number + (r'0[ux][0-9A-F]+(\'[0-9A-F]+)*', Number.Hex), + ], + 'plain_number_literals': [ + # + # Base-10, real number with exponent + (r'[0-9]+(\'[0-9]+)*' # integral part + r'\.[0-9]+(\'[0-9]+)*' # fractional part + r'[eE][+-]?[0-9]+(\'[0-9]+)*', # exponent + Number.Float), + # + # Base-10, real number without exponent + (r'[0-9]+(\'[0-9]+)*' # integral part + r'\.[0-9]+(\'[0-9]+)*', # fractional part + Number.Float), + # + # Base-10, whole number + (r'[0-9]+(\'[0-9]+)*', Number.Integer), + ], + 'suffixed_number_literals': [ + # + # Base-8, whole number + (r'[0-7]+B', Number.Oct), + # + # Base-8, character code + (r'[0-7]+C', Number.Oct), + # + # Base-16, number + (r'[0-9A-F]+H', Number.Hex), + ], + 'string_literals': [ + (r"'(\\\\|\\'|[^'])*'", String), # single quoted string + (r'"(\\\\|\\"|[^"])*"', String), # double quoted string + ], + 'digraph_operators': [ + # Dot Product Operator + (r'\*\.', Operator), + # Array Concatenation Operator + (r'\+>', Operator), # M2R10 + ObjM2 + # Inequality Operator + (r'<>', Operator), # ISO + PIM + # Less-Or-Equal, Subset + (r'<=', Operator), + # Greater-Or-Equal, Superset + (r'>=', Operator), + # Identity Operator + (r'==', Operator), # M2R10 + ObjM2 + # Type Conversion Operator + (r'::', Operator), # M2R10 + ObjM2 + # Assignment Symbol + (r':=', Operator), + # Postfix Increment Mutator + (r'\+\+', Operator), # M2R10 + ObjM2 + # Postfix Decrement Mutator + (r'--', Operator), # M2R10 + ObjM2 + ], + 'unigraph_operators': [ + # Arithmetic Operators + (r'[+-]', Operator), + (r'[*/]', Operator), + # ISO 80000-2 compliant Set Difference Operator + (r'\\', Operator), # M2R10 + ObjM2 + # Relational Operators + (r'[=#<>]', Operator), + # Dereferencing Operator + (r'\^', Operator), + # Dereferencing Operator Synonym + (r'@', Operator), # ISO + # Logical AND Operator Synonym + (r'&', Operator), # PIM + ISO + # Logical NOT Operator Synonym + (r'~', Operator), # PIM + ISO + # Smalltalk Message Prefix + (r'`', Operator), # ObjM2 + ], + 'digraph_punctuation': [ + # Range Constructor + (r'\.\.', Punctuation), + # Opening Chevron Bracket + (r'<<', Punctuation), # M2R10 + ISO + # Closing Chevron Bracket + (r'>>', Punctuation), # M2R10 + ISO + # Blueprint Punctuation + (r'->', Punctuation), # M2R10 + ISO + # Distinguish |# and # in M2 R10 + (r'\|#', Punctuation), + # Distinguish ## and # in M2 R10 + (r'##', Punctuation), + # Distinguish |* and * in M2 R10 + (r'\|\*', Punctuation), + ], + 'unigraph_punctuation': [ + # Common Punctuation + (r'[()\[\]{},.:;|]', Punctuation), + # Case Label Separator Synonym + (r'!', Punctuation), # ISO + # Blueprint Punctuation + (r'\?', Punctuation), # M2R10 + ObjM2 + ], + 'comments': [ + # Single Line Comment + (r'^//.*?\n', Comment.Single), # M2R10 + ObjM2 + # Block Comment + (r'\(\*([^$].*?)\*\)', Comment.Multiline), + # Template Block Comment + (r'/\*(.*?)\*/', Comment.Multiline), # M2R10 + ObjM2 + ], + 'pragmas': [ + # ISO Style Pragmas + (r'<\*.*?\*>', Comment.Preproc), # ISO, M2R10 + ObjM2 + # Pascal Style Pragmas + (r'\(\*\$.*?\*\)', Comment.Preproc), # PIM + ], + 'root': [ + include('whitespace'), + include('dialecttags'), + include('pragmas'), + include('comments'), + include('identifiers'), + include('suffixed_number_literals'), # PIM + ISO + include('prefixed_number_literals'), # M2R10 + ObjM2 + include('plain_number_literals'), + include('string_literals'), + include('digraph_punctuation'), + include('digraph_operators'), + include('unigraph_punctuation'), + include('unigraph_operators'), + ] + } + +# C o m m o n D a t a s e t s + + # Common Reserved Words Dataset + common_reserved_words = ( + # 37 common reserved words + 'AND', 'ARRAY', 'BEGIN', 'BY', 'CASE', 'CONST', 'DEFINITION', 'DIV', + 'DO', 'ELSE', 'ELSIF', 'END', 'EXIT', 'FOR', 'FROM', 'IF', + 'IMPLEMENTATION', 'IMPORT', 'IN', 'LOOP', 'MOD', 'MODULE', 'NOT', + 'OF', 'OR', 'POINTER', 'PROCEDURE', 'RECORD', 'REPEAT', 'RETURN', + 'SET', 'THEN', 'TO', 'TYPE', 'UNTIL', 'VAR', 'WHILE', + ) + + # Common Builtins Dataset + common_builtins = ( + # 16 common builtins + 'ABS', 'BOOLEAN', 'CARDINAL', 'CHAR', 'CHR', 'FALSE', 'INTEGER', + 'LONGINT', 'LONGREAL', 'MAX', 'MIN', 'NIL', 'ODD', 'ORD', 'REAL', + 'TRUE', + ) + + # Common Pseudo-Module Builtins Dataset + common_pseudo_builtins = ( + # 4 common pseudo builtins + 'ADDRESS', 'BYTE', 'WORD', 'ADR' + ) + +# P I M M o d u l a - 2 D a t a s e t s + + # Lexemes to Mark as Error Tokens for PIM Modula-2 + pim_lexemes_to_reject = ( + '!', '`', '@', '$', '%', '?', '\\', '==', '++', '--', '::', '*.', + '+>', '->', '<<', '>>', '|#', '##', + ) + + # PIM Modula-2 Additional Reserved Words Dataset + pim_additional_reserved_words = ( + # 3 additional reserved words + 'EXPORT', 'QUALIFIED', 'WITH', + ) + + # PIM Modula-2 Additional Builtins Dataset + pim_additional_builtins = ( + # 16 additional builtins + 'BITSET', 'CAP', 'DEC', 'DISPOSE', 'EXCL', 'FLOAT', 'HALT', 'HIGH', + 'INC', 'INCL', 'NEW', 'NIL', 'PROC', 'SIZE', 'TRUNC', 'VAL', + ) + + # PIM Modula-2 Additional Pseudo-Module Builtins Dataset + pim_additional_pseudo_builtins = ( + # 5 additional pseudo builtins + 'SYSTEM', 'PROCESS', 'TSIZE', 'NEWPROCESS', 'TRANSFER', + ) + +# I S O M o d u l a - 2 D a t a s e t s + + # Lexemes to Mark as Error Tokens for ISO Modula-2 + iso_lexemes_to_reject = ( + '`', '$', '%', '?', '\\', '==', '++', '--', '::', '*.', '+>', '->', + '<<', '>>', '|#', '##', + ) + + # ISO Modula-2 Additional Reserved Words Dataset + iso_additional_reserved_words = ( + # 9 additional reserved words (ISO 10514-1) + 'EXCEPT', 'EXPORT', 'FINALLY', 'FORWARD', 'PACKEDSET', 'QUALIFIED', + 'REM', 'RETRY', 'WITH', + # 10 additional reserved words (ISO 10514-2 & ISO 10514-3) + 'ABSTRACT', 'AS', 'CLASS', 'GUARD', 'INHERIT', 'OVERRIDE', 'READONLY', + 'REVEAL', 'TRACED', 'UNSAFEGUARDED', + ) + + # ISO Modula-2 Additional Builtins Dataset + iso_additional_builtins = ( + # 26 additional builtins (ISO 10514-1) + 'BITSET', 'CAP', 'CMPLX', 'COMPLEX', 'DEC', 'DISPOSE', 'EXCL', 'FLOAT', + 'HALT', 'HIGH', 'IM', 'INC', 'INCL', 'INT', 'INTERRUPTIBLE', 'LENGTH', + 'LFLOAT', 'LONGCOMPLEX', 'NEW', 'PROC', 'PROTECTION', 'RE', 'SIZE', + 'TRUNC', 'UNINTERRUBTIBLE', 'VAL', + # 5 additional builtins (ISO 10514-2 & ISO 10514-3) + 'CREATE', 'DESTROY', 'EMPTY', 'ISMEMBER', 'SELF', + ) + + # ISO Modula-2 Additional Pseudo-Module Builtins Dataset + iso_additional_pseudo_builtins = ( + # 14 additional builtins (SYSTEM) + 'SYSTEM', 'BITSPERLOC', 'LOCSPERBYTE', 'LOCSPERWORD', 'LOC', + 'ADDADR', 'SUBADR', 'DIFADR', 'MAKEADR', 'ADR', + 'ROTATE', 'SHIFT', 'CAST', 'TSIZE', + # 13 additional builtins (COROUTINES) + 'COROUTINES', 'ATTACH', 'COROUTINE', 'CURRENT', 'DETACH', 'HANDLER', + 'INTERRUPTSOURCE', 'IOTRANSFER', 'IsATTACHED', 'LISTEN', + 'NEWCOROUTINE', 'PROT', 'TRANSFER', + # 9 additional builtins (EXCEPTIONS) + 'EXCEPTIONS', 'AllocateSource', 'CurrentNumber', 'ExceptionNumber', + 'ExceptionSource', 'GetMessage', 'IsCurrentSource', + 'IsExceptionalExecution', 'RAISE', + # 3 additional builtins (TERMINATION) + 'TERMINATION', 'IsTerminating', 'HasHalted', + # 4 additional builtins (M2EXCEPTION) + 'M2EXCEPTION', 'M2Exceptions', 'M2Exception', 'IsM2Exception', + 'indexException', 'rangeException', 'caseSelectException', + 'invalidLocation', 'functionException', 'wholeValueException', + 'wholeDivException', 'realValueException', 'realDivException', + 'complexValueException', 'complexDivException', 'protException', + 'sysException', 'coException', 'exException', + ) + +# M o d u l a - 2 R 1 0 D a t a s e t s + + # Lexemes to Mark as Error Tokens for Modula-2 R10 + m2r10_lexemes_to_reject = ( + '!', '`', '@', '$', '%', '&', '<>', + ) + + # Modula-2 R10 reserved words in addition to the common set + m2r10_additional_reserved_words = ( + # 12 additional reserved words + 'ALIAS', 'ARGLIST', 'BLUEPRINT', 'COPY', 'GENLIB', 'INDETERMINATE', + 'NEW', 'NONE', 'OPAQUE', 'REFERENTIAL', 'RELEASE', 'RETAIN', + # 2 additional reserved words with symbolic assembly option + 'ASM', 'REG', + ) + + # Modula-2 R10 builtins in addition to the common set + m2r10_additional_builtins = ( + # 26 additional builtins + 'CARDINAL', 'COUNT', 'EMPTY', 'EXISTS', 'INSERT', 'LENGTH', 'LONGCARD', + 'OCTET', 'PTR', 'PRED', 'READ', 'READNEW', 'REMOVE', 'RETRIEVE', 'SORT', + 'STORE', 'SUBSET', 'SUCC', 'TLIMIT', 'TMAX', 'TMIN', 'TRUE', 'TSIZE', + 'UNICHAR', 'WRITE', 'WRITEF', + ) + + # Modula-2 R10 Additional Pseudo-Module Builtins Dataset + m2r10_additional_pseudo_builtins = ( + # 13 additional builtins (TPROPERTIES) + 'TPROPERTIES', 'PROPERTY', 'LITERAL', 'TPROPERTY', 'TLITERAL', + 'TBUILTIN', 'TDYN', 'TREFC', 'TNIL', 'TBASE', 'TPRECISION', + 'TMAXEXP', 'TMINEXP', + # 4 additional builtins (CONVERSION) + 'CONVERSION', 'TSXFSIZE', 'SXF', 'VAL', + # 35 additional builtins (UNSAFE) + 'UNSAFE', 'CAST', 'INTRINSIC', 'AVAIL', 'ADD', 'SUB', 'ADDC', 'SUBC', + 'FETCHADD', 'FETCHSUB', 'SHL', 'SHR', 'ASHR', 'ROTL', 'ROTR', 'ROTLC', + 'ROTRC', 'BWNOT', 'BWAND', 'BWOR', 'BWXOR', 'BWNAND', 'BWNOR', + 'SETBIT', 'TESTBIT', 'LSBIT', 'MSBIT', 'CSBITS', 'BAIL', 'HALT', + 'TODO', 'FFI', 'ADDR', 'VARGLIST', 'VARGC', + # 11 additional builtins (ATOMIC) + 'ATOMIC', 'INTRINSIC', 'AVAIL', 'SWAP', 'CAS', 'INC', 'DEC', 'BWAND', + 'BWNAND', 'BWOR', 'BWXOR', + # 7 additional builtins (COMPILER) + 'COMPILER', 'DEBUG', 'MODNAME', 'PROCNAME', 'LINENUM', 'DEFAULT', + 'HASH', + # 5 additional builtins (ASSEMBLER) + 'ASSEMBLER', 'REGISTER', 'SETREG', 'GETREG', 'CODE', + ) + +# O b j e c t i v e M o d u l a - 2 D a t a s e t s + + # Lexemes to Mark as Error Tokens for Objective Modula-2 + objm2_lexemes_to_reject = ( + '!', '$', '%', '&', '<>', + ) + + # Objective Modula-2 Extensions + # reserved words in addition to Modula-2 R10 + objm2_additional_reserved_words = ( + # 16 additional reserved words + 'BYCOPY', 'BYREF', 'CLASS', 'CONTINUE', 'CRITICAL', 'INOUT', 'METHOD', + 'ON', 'OPTIONAL', 'OUT', 'PRIVATE', 'PROTECTED', 'PROTOCOL', 'PUBLIC', + 'SUPER', 'TRY', + ) + + # Objective Modula-2 Extensions + # builtins in addition to Modula-2 R10 + objm2_additional_builtins = ( + # 3 additional builtins + 'OBJECT', 'NO', 'YES', + ) + + # Objective Modula-2 Extensions + # pseudo-module builtins in addition to Modula-2 R10 + objm2_additional_pseudo_builtins = ( + # None + ) + +# A g l e t M o d u l a - 2 D a t a s e t s + + # Aglet Extensions + # reserved words in addition to ISO Modula-2 + aglet_additional_reserved_words = ( + # None + ) + + # Aglet Extensions + # builtins in addition to ISO Modula-2 + aglet_additional_builtins = ( + # 9 additional builtins + 'BITSET8', 'BITSET16', 'BITSET32', 'CARDINAL8', 'CARDINAL16', + 'CARDINAL32', 'INTEGER8', 'INTEGER16', 'INTEGER32', + ) + + # Aglet Modula-2 Extensions + # pseudo-module builtins in addition to ISO Modula-2 + aglet_additional_pseudo_builtins = ( + # None + ) + +# G N U M o d u l a - 2 D a t a s e t s + + # GNU Extensions + # reserved words in addition to PIM Modula-2 + gm2_additional_reserved_words = ( + # 10 additional reserved words + 'ASM', '__ATTRIBUTE__', '__BUILTIN__', '__COLUMN__', '__DATE__', + '__FILE__', '__FUNCTION__', '__LINE__', '__MODULE__', 'VOLATILE', + ) + + # GNU Extensions + # builtins in addition to PIM Modula-2 + gm2_additional_builtins = ( + # 21 additional builtins + 'BITSET8', 'BITSET16', 'BITSET32', 'CARDINAL8', 'CARDINAL16', + 'CARDINAL32', 'CARDINAL64', 'COMPLEX32', 'COMPLEX64', 'COMPLEX96', + 'COMPLEX128', 'INTEGER8', 'INTEGER16', 'INTEGER32', 'INTEGER64', + 'REAL8', 'REAL16', 'REAL32', 'REAL96', 'REAL128', 'THROW', + ) + + # GNU Extensions + # pseudo-module builtins in addition to PIM Modula-2 + gm2_additional_pseudo_builtins = ( + # None + ) + +# p 1 M o d u l a - 2 D a t a s e t s + + # p1 Extensions + # reserved words in addition to ISO Modula-2 + p1_additional_reserved_words = ( + # None + ) + + # p1 Extensions + # builtins in addition to ISO Modula-2 + p1_additional_builtins = ( + # None + ) + + # p1 Modula-2 Extensions + # pseudo-module builtins in addition to ISO Modula-2 + p1_additional_pseudo_builtins = ( + # 1 additional builtin + 'BCD', + ) + +# X D S M o d u l a - 2 D a t a s e t s + + # XDS Extensions + # reserved words in addition to ISO Modula-2 + xds_additional_reserved_words = ( + # 1 additional reserved word + 'SEQ', + ) + + # XDS Extensions + # builtins in addition to ISO Modula-2 + xds_additional_builtins = ( + # 9 additional builtins + 'ASH', 'ASSERT', 'DIFFADR_TYPE', 'ENTIER', 'INDEX', 'LEN', + 'LONGCARD', 'SHORTCARD', 'SHORTINT', + ) + + # XDS Modula-2 Extensions + # pseudo-module builtins in addition to ISO Modula-2 + xds_additional_pseudo_builtins = ( + # 22 additional builtins (SYSTEM) + 'PROCESS', 'NEWPROCESS', 'BOOL8', 'BOOL16', 'BOOL32', 'CARD8', + 'CARD16', 'CARD32', 'INT8', 'INT16', 'INT32', 'REF', 'MOVE', + 'FILL', 'GET', 'PUT', 'CC', 'int', 'unsigned', 'size_t', 'void' + # 3 additional builtins (COMPILER) + 'COMPILER', 'OPTION', 'EQUATION' + ) + +# P I M S t a n d a r d L i b r a r y D a t a s e t s + + # PIM Modula-2 Standard Library Modules Dataset + pim_stdlib_module_identifiers = ( + 'Terminal', 'FileSystem', 'InOut', 'RealInOut', 'MathLib0', 'Storage', + ) + + # PIM Modula-2 Standard Library Types Dataset + pim_stdlib_type_identifiers = ( + 'Flag', 'FlagSet', 'Response', 'Command', 'Lock', 'Permission', + 'MediumType', 'File', 'FileProc', 'DirectoryProc', 'FileCommand', + 'DirectoryCommand', + ) + + # PIM Modula-2 Standard Library Procedures Dataset + pim_stdlib_proc_identifiers = ( + 'Read', 'BusyRead', 'ReadAgain', 'Write', 'WriteString', 'WriteLn', + 'Create', 'Lookup', 'Close', 'Delete', 'Rename', 'SetRead', 'SetWrite', + 'SetModify', 'SetOpen', 'Doio', 'SetPos', 'GetPos', 'Length', 'Reset', + 'Again', 'ReadWord', 'WriteWord', 'ReadChar', 'WriteChar', + 'CreateMedium', 'DeleteMedium', 'AssignName', 'DeassignName', + 'ReadMedium', 'LookupMedium', 'OpenInput', 'OpenOutput', 'CloseInput', + 'CloseOutput', 'ReadString', 'ReadInt', 'ReadCard', 'ReadWrd', + 'WriteInt', 'WriteCard', 'WriteOct', 'WriteHex', 'WriteWrd', + 'ReadReal', 'WriteReal', 'WriteFixPt', 'WriteRealOct', 'sqrt', 'exp', + 'ln', 'sin', 'cos', 'arctan', 'entier', 'ALLOCATE', 'DEALLOCATE', + ) + + # PIM Modula-2 Standard Library Variables Dataset + pim_stdlib_var_identifiers = ( + 'Done', 'termCH', 'in', 'out' + ) + + # PIM Modula-2 Standard Library Constants Dataset + pim_stdlib_const_identifiers = ( + 'EOL', + ) + +# I S O S t a n d a r d L i b r a r y D a t a s e t s + + # ISO Modula-2 Standard Library Modules Dataset + iso_stdlib_module_identifiers = ( + # TO DO + ) + + # ISO Modula-2 Standard Library Types Dataset + iso_stdlib_type_identifiers = ( + # TO DO + ) + + # ISO Modula-2 Standard Library Procedures Dataset + iso_stdlib_proc_identifiers = ( + # TO DO + ) + + # ISO Modula-2 Standard Library Variables Dataset + iso_stdlib_var_identifiers = ( + # TO DO + ) + + # ISO Modula-2 Standard Library Constants Dataset + iso_stdlib_const_identifiers = ( + # TO DO + ) + +# M 2 R 1 0 S t a n d a r d L i b r a r y D a t a s e t s + + # Modula-2 R10 Standard Library ADTs Dataset + m2r10_stdlib_adt_identifiers = ( + 'BCD', 'LONGBCD', 'BITSET', 'SHORTBITSET', 'LONGBITSET', + 'LONGLONGBITSET', 'COMPLEX', 'LONGCOMPLEX', 'SHORTCARD', 'LONGLONGCARD', + 'SHORTINT', 'LONGLONGINT', 'POSINT', 'SHORTPOSINT', 'LONGPOSINT', + 'LONGLONGPOSINT', 'BITSET8', 'BITSET16', 'BITSET32', 'BITSET64', + 'BITSET128', 'BS8', 'BS16', 'BS32', 'BS64', 'BS128', 'CARDINAL8', + 'CARDINAL16', 'CARDINAL32', 'CARDINAL64', 'CARDINAL128', 'CARD8', + 'CARD16', 'CARD32', 'CARD64', 'CARD128', 'INTEGER8', 'INTEGER16', + 'INTEGER32', 'INTEGER64', 'INTEGER128', 'INT8', 'INT16', 'INT32', + 'INT64', 'INT128', 'STRING', 'UNISTRING', + ) + + # Modula-2 R10 Standard Library Blueprints Dataset + m2r10_stdlib_blueprint_identifiers = ( + 'ProtoRoot', 'ProtoComputational', 'ProtoNumeric', 'ProtoScalar', + 'ProtoNonScalar', 'ProtoCardinal', 'ProtoInteger', 'ProtoReal', + 'ProtoComplex', 'ProtoVector', 'ProtoTuple', 'ProtoCompArray', + 'ProtoCollection', 'ProtoStaticArray', 'ProtoStaticSet', + 'ProtoStaticString', 'ProtoArray', 'ProtoString', 'ProtoSet', + 'ProtoMultiSet', 'ProtoDictionary', 'ProtoMultiDict', 'ProtoExtension', + 'ProtoIO', 'ProtoCardMath', 'ProtoIntMath', 'ProtoRealMath', + ) + + # Modula-2 R10 Standard Library Modules Dataset + m2r10_stdlib_module_identifiers = ( + 'ASCII', 'BooleanIO', 'CharIO', 'UnicharIO', 'OctetIO', + 'CardinalIO', 'LongCardIO', 'IntegerIO', 'LongIntIO', 'RealIO', + 'LongRealIO', 'BCDIO', 'LongBCDIO', 'CardMath', 'LongCardMath', + 'IntMath', 'LongIntMath', 'RealMath', 'LongRealMath', 'BCDMath', + 'LongBCDMath', 'FileIO', 'FileSystem', 'Storage', 'IOSupport', + ) + + # Modula-2 R10 Standard Library Types Dataset + m2r10_stdlib_type_identifiers = ( + 'File', 'Status', + # TO BE COMPLETED + ) + + # Modula-2 R10 Standard Library Procedures Dataset + m2r10_stdlib_proc_identifiers = ( + 'ALLOCATE', 'DEALLOCATE', 'SIZE', + # TO BE COMPLETED + ) + + # Modula-2 R10 Standard Library Variables Dataset + m2r10_stdlib_var_identifiers = ( + 'stdIn', 'stdOut', 'stdErr', + ) + + # Modula-2 R10 Standard Library Constants Dataset + m2r10_stdlib_const_identifiers = ( + 'pi', 'tau', + ) + +# D i a l e c t s + + # Dialect modes + dialects = ( + 'unknown', + 'm2pim', 'm2iso', 'm2r10', 'objm2', + 'm2iso+aglet', 'm2pim+gm2', 'm2iso+p1', 'm2iso+xds', + ) + +# D a t a b a s e s + + # Lexemes to Mark as Errors Database + lexemes_to_reject_db = { + # Lexemes to reject for unknown dialect + 'unknown': ( + # LEAVE THIS EMPTY + ), + # Lexemes to reject for PIM Modula-2 + 'm2pim': ( + pim_lexemes_to_reject, + ), + # Lexemes to reject for ISO Modula-2 + 'm2iso': ( + iso_lexemes_to_reject, + ), + # Lexemes to reject for Modula-2 R10 + 'm2r10': ( + m2r10_lexemes_to_reject, + ), + # Lexemes to reject for Objective Modula-2 + 'objm2': ( + objm2_lexemes_to_reject, + ), + # Lexemes to reject for Aglet Modula-2 + 'm2iso+aglet': ( + iso_lexemes_to_reject, + ), + # Lexemes to reject for GNU Modula-2 + 'm2pim+gm2': ( + pim_lexemes_to_reject, + ), + # Lexemes to reject for p1 Modula-2 + 'm2iso+p1': ( + iso_lexemes_to_reject, + ), + # Lexemes to reject for XDS Modula-2 + 'm2iso+xds': ( + iso_lexemes_to_reject, + ), + } + + # Reserved Words Database + reserved_words_db = { + # Reserved words for unknown dialect + 'unknown': ( + common_reserved_words, + pim_additional_reserved_words, + iso_additional_reserved_words, + m2r10_additional_reserved_words, + ), + + # Reserved words for PIM Modula-2 + 'm2pim': ( + common_reserved_words, + pim_additional_reserved_words, + ), + + # Reserved words for Modula-2 R10 + 'm2iso': ( + common_reserved_words, + iso_additional_reserved_words, + ), + + # Reserved words for ISO Modula-2 + 'm2r10': ( + common_reserved_words, + m2r10_additional_reserved_words, + ), + + # Reserved words for Objective Modula-2 + 'objm2': ( + common_reserved_words, + m2r10_additional_reserved_words, + objm2_additional_reserved_words, + ), + + # Reserved words for Aglet Modula-2 Extensions + 'm2iso+aglet': ( + common_reserved_words, + iso_additional_reserved_words, + aglet_additional_reserved_words, + ), + + # Reserved words for GNU Modula-2 Extensions + 'm2pim+gm2': ( + common_reserved_words, + pim_additional_reserved_words, + gm2_additional_reserved_words, + ), + + # Reserved words for p1 Modula-2 Extensions + 'm2iso+p1': ( + common_reserved_words, + iso_additional_reserved_words, + p1_additional_reserved_words, + ), + + # Reserved words for XDS Modula-2 Extensions + 'm2iso+xds': ( + common_reserved_words, + iso_additional_reserved_words, + xds_additional_reserved_words, + ), + } + + # Builtins Database + builtins_db = { + # Builtins for unknown dialect + 'unknown': ( + common_builtins, + pim_additional_builtins, + iso_additional_builtins, + m2r10_additional_builtins, + ), + + # Builtins for PIM Modula-2 + 'm2pim': ( + common_builtins, + pim_additional_builtins, + ), + + # Builtins for ISO Modula-2 + 'm2iso': ( + common_builtins, + iso_additional_builtins, + ), + + # Builtins for ISO Modula-2 + 'm2r10': ( + common_builtins, + m2r10_additional_builtins, + ), + + # Builtins for Objective Modula-2 + 'objm2': ( + common_builtins, + m2r10_additional_builtins, + objm2_additional_builtins, + ), + + # Builtins for Aglet Modula-2 Extensions + 'm2iso+aglet': ( + common_builtins, + iso_additional_builtins, + aglet_additional_builtins, + ), + + # Builtins for GNU Modula-2 Extensions + 'm2pim+gm2': ( + common_builtins, + pim_additional_builtins, + gm2_additional_builtins, + ), + + # Builtins for p1 Modula-2 Extensions + 'm2iso+p1': ( + common_builtins, + iso_additional_builtins, + p1_additional_builtins, + ), + + # Builtins for XDS Modula-2 Extensions + 'm2iso+xds': ( + common_builtins, + iso_additional_builtins, + xds_additional_builtins, + ), + } + + # Pseudo-Module Builtins Database + pseudo_builtins_db = { + # Builtins for unknown dialect + 'unknown': ( + common_pseudo_builtins, + pim_additional_pseudo_builtins, + iso_additional_pseudo_builtins, + m2r10_additional_pseudo_builtins, + ), + + # Builtins for PIM Modula-2 + 'm2pim': ( + common_pseudo_builtins, + pim_additional_pseudo_builtins, + ), + + # Builtins for ISO Modula-2 + 'm2iso': ( + common_pseudo_builtins, + iso_additional_pseudo_builtins, + ), + + # Builtins for ISO Modula-2 + 'm2r10': ( + common_pseudo_builtins, + m2r10_additional_pseudo_builtins, + ), + + # Builtins for Objective Modula-2 + 'objm2': ( + common_pseudo_builtins, + m2r10_additional_pseudo_builtins, + objm2_additional_pseudo_builtins, + ), + + # Builtins for Aglet Modula-2 Extensions + 'm2iso+aglet': ( + common_pseudo_builtins, + iso_additional_pseudo_builtins, + aglet_additional_pseudo_builtins, + ), + + # Builtins for GNU Modula-2 Extensions + 'm2pim+gm2': ( + common_pseudo_builtins, + pim_additional_pseudo_builtins, + gm2_additional_pseudo_builtins, + ), + + # Builtins for p1 Modula-2 Extensions + 'm2iso+p1': ( + common_pseudo_builtins, + iso_additional_pseudo_builtins, + p1_additional_pseudo_builtins, + ), + + # Builtins for XDS Modula-2 Extensions + 'm2iso+xds': ( + common_pseudo_builtins, + iso_additional_pseudo_builtins, + xds_additional_pseudo_builtins, + ), + } + + # Standard Library ADTs Database + stdlib_adts_db = { + # Empty entry for unknown dialect + 'unknown': ( + # LEAVE THIS EMPTY + ), + # Standard Library ADTs for PIM Modula-2 + 'm2pim': ( + # No first class library types + ), + + # Standard Library ADTs for ISO Modula-2 + 'm2iso': ( + # No first class library types + ), + + # Standard Library ADTs for Modula-2 R10 + 'm2r10': ( + m2r10_stdlib_adt_identifiers, + ), + + # Standard Library ADTs for Objective Modula-2 + 'objm2': ( + m2r10_stdlib_adt_identifiers, + ), + + # Standard Library ADTs for Aglet Modula-2 + 'm2iso+aglet': ( + # No first class library types + ), + + # Standard Library ADTs for GNU Modula-2 + 'm2pim+gm2': ( + # No first class library types + ), + + # Standard Library ADTs for p1 Modula-2 + 'm2iso+p1': ( + # No first class library types + ), + + # Standard Library ADTs for XDS Modula-2 + 'm2iso+xds': ( + # No first class library types + ), + } + + # Standard Library Modules Database + stdlib_modules_db = { + # Empty entry for unknown dialect + 'unknown': ( + # LEAVE THIS EMPTY + ), + # Standard Library Modules for PIM Modula-2 + 'm2pim': ( + pim_stdlib_module_identifiers, + ), + + # Standard Library Modules for ISO Modula-2 + 'm2iso': ( + iso_stdlib_module_identifiers, + ), + + # Standard Library Modules for Modula-2 R10 + 'm2r10': ( + m2r10_stdlib_blueprint_identifiers, + m2r10_stdlib_module_identifiers, + m2r10_stdlib_adt_identifiers, + ), + + # Standard Library Modules for Objective Modula-2 + 'objm2': ( + m2r10_stdlib_blueprint_identifiers, + m2r10_stdlib_module_identifiers, + ), + + # Standard Library Modules for Aglet Modula-2 + 'm2iso+aglet': ( + iso_stdlib_module_identifiers, + ), + + # Standard Library Modules for GNU Modula-2 + 'm2pim+gm2': ( + pim_stdlib_module_identifiers, + ), + + # Standard Library Modules for p1 Modula-2 + 'm2iso+p1': ( + iso_stdlib_module_identifiers, + ), + + # Standard Library Modules for XDS Modula-2 + 'm2iso+xds': ( + iso_stdlib_module_identifiers, + ), + } + + # Standard Library Types Database + stdlib_types_db = { + # Empty entry for unknown dialect + 'unknown': ( + # LEAVE THIS EMPTY + ), + # Standard Library Types for PIM Modula-2 + 'm2pim': ( + pim_stdlib_type_identifiers, + ), + + # Standard Library Types for ISO Modula-2 + 'm2iso': ( + iso_stdlib_type_identifiers, + ), + + # Standard Library Types for Modula-2 R10 + 'm2r10': ( + m2r10_stdlib_type_identifiers, + ), + + # Standard Library Types for Objective Modula-2 + 'objm2': ( + m2r10_stdlib_type_identifiers, + ), + + # Standard Library Types for Aglet Modula-2 + 'm2iso+aglet': ( + iso_stdlib_type_identifiers, + ), + + # Standard Library Types for GNU Modula-2 + 'm2pim+gm2': ( + pim_stdlib_type_identifiers, + ), + + # Standard Library Types for p1 Modula-2 + 'm2iso+p1': ( + iso_stdlib_type_identifiers, + ), + + # Standard Library Types for XDS Modula-2 + 'm2iso+xds': ( + iso_stdlib_type_identifiers, + ), + } + + # Standard Library Procedures Database + stdlib_procedures_db = { + # Empty entry for unknown dialect + 'unknown': ( + # LEAVE THIS EMPTY + ), + # Standard Library Procedures for PIM Modula-2 + 'm2pim': ( + pim_stdlib_proc_identifiers, + ), + + # Standard Library Procedures for ISO Modula-2 + 'm2iso': ( + iso_stdlib_proc_identifiers, + ), + + # Standard Library Procedures for Modula-2 R10 + 'm2r10': ( + m2r10_stdlib_proc_identifiers, + ), + + # Standard Library Procedures for Objective Modula-2 + 'objm2': ( + m2r10_stdlib_proc_identifiers, + ), + + # Standard Library Procedures for Aglet Modula-2 + 'm2iso+aglet': ( + iso_stdlib_proc_identifiers, + ), + + # Standard Library Procedures for GNU Modula-2 + 'm2pim+gm2': ( + pim_stdlib_proc_identifiers, + ), + + # Standard Library Procedures for p1 Modula-2 + 'm2iso+p1': ( + iso_stdlib_proc_identifiers, + ), + + # Standard Library Procedures for XDS Modula-2 + 'm2iso+xds': ( + iso_stdlib_proc_identifiers, + ), + } + + # Standard Library Variables Database + stdlib_variables_db = { + # Empty entry for unknown dialect + 'unknown': ( + # LEAVE THIS EMPTY + ), + # Standard Library Variables for PIM Modula-2 + 'm2pim': ( + pim_stdlib_var_identifiers, + ), + + # Standard Library Variables for ISO Modula-2 + 'm2iso': ( + iso_stdlib_var_identifiers, + ), + + # Standard Library Variables for Modula-2 R10 + 'm2r10': ( + m2r10_stdlib_var_identifiers, + ), + + # Standard Library Variables for Objective Modula-2 + 'objm2': ( + m2r10_stdlib_var_identifiers, + ), + + # Standard Library Variables for Aglet Modula-2 + 'm2iso+aglet': ( + iso_stdlib_var_identifiers, + ), + + # Standard Library Variables for GNU Modula-2 + 'm2pim+gm2': ( + pim_stdlib_var_identifiers, + ), + + # Standard Library Variables for p1 Modula-2 + 'm2iso+p1': ( + iso_stdlib_var_identifiers, + ), + + # Standard Library Variables for XDS Modula-2 + 'm2iso+xds': ( + iso_stdlib_var_identifiers, + ), + } + + # Standard Library Constants Database + stdlib_constants_db = { + # Empty entry for unknown dialect + 'unknown': ( + # LEAVE THIS EMPTY + ), + # Standard Library Constants for PIM Modula-2 + 'm2pim': ( + pim_stdlib_const_identifiers, + ), + + # Standard Library Constants for ISO Modula-2 + 'm2iso': ( + iso_stdlib_const_identifiers, + ), + + # Standard Library Constants for Modula-2 R10 + 'm2r10': ( + m2r10_stdlib_const_identifiers, + ), + + # Standard Library Constants for Objective Modula-2 + 'objm2': ( + m2r10_stdlib_const_identifiers, + ), + + # Standard Library Constants for Aglet Modula-2 + 'm2iso+aglet': ( + iso_stdlib_const_identifiers, + ), + + # Standard Library Constants for GNU Modula-2 + 'm2pim+gm2': ( + pim_stdlib_const_identifiers, + ), + + # Standard Library Constants for p1 Modula-2 + 'm2iso+p1': ( + iso_stdlib_const_identifiers, + ), + + # Standard Library Constants for XDS Modula-2 + 'm2iso+xds': ( + iso_stdlib_const_identifiers, + ), + } + +# M e t h o d s + + # initialise a lexer instance + def __init__(self, **options): + # + # check dialect options + # + dialects = get_list_opt(options, 'dialect', []) + # + for dialect_option in dialects: + if dialect_option in self.dialects[1:-1]: + # valid dialect option found + self.set_dialect(dialect_option) + break + # + # Fallback Mode (DEFAULT) + else: + # no valid dialect option + self.set_dialect('unknown') + # + self.dialect_set_by_tag = False + # + # check style options + # + styles = get_list_opt(options, 'style', []) + # + # use lowercase mode for Algol style + if 'algol' in styles or 'algol_nu' in styles: + self.algol_publication_mode = True + else: + self.algol_publication_mode = False + # + # Check option flags + # + self.treat_stdlib_adts_as_builtins = get_bool_opt( + options, 'treat_stdlib_adts_as_builtins', True) + # + # call superclass initialiser + RegexLexer.__init__(self, **options) + + # Set lexer to a specified dialect + def set_dialect(self, dialect_id): + # + # if __debug__: + # print 'entered set_dialect with arg: ', dialect_id + # + # check dialect name against known dialects + if dialect_id not in self.dialects: + dialect = 'unknown' # default + else: + dialect = dialect_id + # + # compose lexemes to reject set + lexemes_to_reject_set = set() + # add each list of reject lexemes for this dialect + for list in self.lexemes_to_reject_db[dialect]: + lexemes_to_reject_set.update(set(list)) + # + # compose reserved words set + reswords_set = set() + # add each list of reserved words for this dialect + for list in self.reserved_words_db[dialect]: + reswords_set.update(set(list)) + # + # compose builtins set + builtins_set = set() + # add each list of builtins for this dialect excluding reserved words + for list in self.builtins_db[dialect]: + builtins_set.update(set(list).difference(reswords_set)) + # + # compose pseudo-builtins set + pseudo_builtins_set = set() + # add each list of builtins for this dialect excluding reserved words + for list in self.pseudo_builtins_db[dialect]: + pseudo_builtins_set.update(set(list).difference(reswords_set)) + # + # compose ADTs set + adts_set = set() + # add each list of ADTs for this dialect excluding reserved words + for list in self.stdlib_adts_db[dialect]: + adts_set.update(set(list).difference(reswords_set)) + # + # compose modules set + modules_set = set() + # add each list of builtins for this dialect excluding builtins + for list in self.stdlib_modules_db[dialect]: + modules_set.update(set(list).difference(builtins_set)) + # + # compose types set + types_set = set() + # add each list of types for this dialect excluding builtins + for list in self.stdlib_types_db[dialect]: + types_set.update(set(list).difference(builtins_set)) + # + # compose procedures set + procedures_set = set() + # add each list of procedures for this dialect excluding builtins + for list in self.stdlib_procedures_db[dialect]: + procedures_set.update(set(list).difference(builtins_set)) + # + # compose variables set + variables_set = set() + # add each list of variables for this dialect excluding builtins + for list in self.stdlib_variables_db[dialect]: + variables_set.update(set(list).difference(builtins_set)) + # + # compose constants set + constants_set = set() + # add each list of constants for this dialect excluding builtins + for list in self.stdlib_constants_db[dialect]: + constants_set.update(set(list).difference(builtins_set)) + # + # update lexer state + self.dialect = dialect + self.lexemes_to_reject = lexemes_to_reject_set + self.reserved_words = reswords_set + self.builtins = builtins_set + self.pseudo_builtins = pseudo_builtins_set + self.adts = adts_set + self.modules = modules_set + self.types = types_set + self.procedures = procedures_set + self.variables = variables_set + self.constants = constants_set + # + # if __debug__: + # print 'exiting set_dialect' + # print ' self.dialect: ', self.dialect + # print ' self.lexemes_to_reject: ', self.lexemes_to_reject + # print ' self.reserved_words: ', self.reserved_words + # print ' self.builtins: ', self.builtins + # print ' self.pseudo_builtins: ', self.pseudo_builtins + # print ' self.adts: ', self.adts + # print ' self.modules: ', self.modules + # print ' self.types: ', self.types + # print ' self.procedures: ', self.procedures + # print ' self.variables: ', self.variables + # print ' self.types: ', self.types + # print ' self.constants: ', self.constants + + # Extracts a dialect name from a dialect tag comment string and checks + # the extracted name against known dialects. If a match is found, the + # matching name is returned, otherwise dialect id 'unknown' is returned + def get_dialect_from_dialect_tag(self, dialect_tag): + # + # if __debug__: + # print 'entered get_dialect_from_dialect_tag with arg: ', dialect_tag + # + # constants + left_tag_delim = '(*!' + right_tag_delim = '*)' + left_tag_delim_len = len(left_tag_delim) + right_tag_delim_len = len(right_tag_delim) + indicator_start = left_tag_delim_len + indicator_end = -(right_tag_delim_len) + # + # check comment string for dialect indicator + if len(dialect_tag) > (left_tag_delim_len + right_tag_delim_len) \ + and dialect_tag.startswith(left_tag_delim) \ + and dialect_tag.endswith(right_tag_delim): + # + # if __debug__: + # print 'dialect tag found' + # + # extract dialect indicator + indicator = dialect_tag[indicator_start:indicator_end] + # + # if __debug__: + # print 'extracted: ', indicator + # + # check against known dialects + for index in range(1, len(self.dialects)): + # + # if __debug__: + # print 'dialects[', index, ']: ', self.dialects[index] + # + if indicator == self.dialects[index]: + # + # if __debug__: + # print 'matching dialect found' + # + # indicator matches known dialect + return indicator + else: + # indicator does not match any dialect + return 'unknown' # default + else: + # invalid indicator string + return 'unknown' # default + + # intercept the token stream, modify token attributes and return them + def get_tokens_unprocessed(self, text): + for index, token, value in RegexLexer.get_tokens_unprocessed(self, text): + # + # check for dialect tag if dialect has not been set by tag + if not self.dialect_set_by_tag and token == Comment.Special: + indicated_dialect = self.get_dialect_from_dialect_tag(value) + if indicated_dialect != 'unknown': + # token is a dialect indicator + # reset reserved words and builtins + self.set_dialect(indicated_dialect) + self.dialect_set_by_tag = True + # + # check for reserved words, predefined and stdlib identifiers + if token is Name: + if value in self.reserved_words: + token = Keyword.Reserved + if self.algol_publication_mode: + value = value.lower() + # + elif value in self.builtins: + token = Name.Builtin + if self.algol_publication_mode: + value = value.lower() + # + elif value in self.pseudo_builtins: + token = Name.Builtin.Pseudo + if self.algol_publication_mode: + value = value.lower() + # + elif value in self.adts: + if not self.treat_stdlib_adts_as_builtins: + token = Name.Namespace + else: + token = Name.Builtin.Pseudo + if self.algol_publication_mode: + value = value.lower() + # + elif value in self.modules: + token = Name.Namespace + # + elif value in self.types: + token = Name.Class + # + elif value in self.procedures: + token = Name.Function + # + elif value in self.variables: + token = Name.Variable + # + elif value in self.constants: + token = Name.Constant + # + elif token in Number: + # + # mark prefix number literals as error for PIM and ISO dialects + if self.dialect not in ('unknown', 'm2r10', 'objm2'): + if "'" in value or value[0:2] in ('0b', '0x', '0u'): + token = Error + # + elif self.dialect in ('m2r10', 'objm2'): + # mark base-8 number literals as errors for M2 R10 and ObjM2 + if token is Number.Oct: + token = Error + # mark suffix base-16 literals as errors for M2 R10 and ObjM2 + elif token is Number.Hex and 'H' in value: + token = Error + # mark real numbers with E as errors for M2 R10 and ObjM2 + elif token is Number.Float and 'E' in value: + token = Error + # + elif token in Comment: + # + # mark single line comment as error for PIM and ISO dialects + if token is Comment.Single: + if self.dialect not in ('unknown', 'm2r10', 'objm2'): + token = Error + # + if token is Comment.Preproc: + # mark ISO pragma as error for PIM dialects + if value.startswith('<*') and \ + self.dialect.startswith('m2pim'): + token = Error + # mark PIM pragma as comment for other dialects + elif value.startswith('(*$') and \ + self.dialect != 'unknown' and \ + not self.dialect.startswith('m2pim'): + token = Comment.Multiline + # + else: # token is neither Name nor Comment + # + # mark lexemes matching the dialect's error token set as errors + if value in self.lexemes_to_reject: + token = Error + # + # substitute lexemes when in Algol mode + if self.algol_publication_mode: + if value == '#': + value = u'≠' + elif value == '<=': + value = u'≤' + elif value == '>=': + value = u'≥' + elif value == '==': + value = u'≡' + elif value == '*.': + value = u'•' + + # return result + yield index, token, value diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/monte.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/monte.py new file mode 100644 index 0000000000000000000000000000000000000000..ed6e20f86fc36f564773d0908eef91bdbdfcd334 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/monte.py @@ -0,0 +1,204 @@ +# -*- coding: utf-8 -*- +""" + pygments.lexers.monte + ~~~~~~~~~~~~~~~~~~~~~ + + Lexer for the Monte programming language. + + :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS. + :license: BSD, see LICENSE for details. +""" + +from pygments.token import Comment, Error, Keyword, Name, Number, Operator, \ + Punctuation, String, Whitespace +from pygments.lexer import RegexLexer, include, words + +__all__ = ['MonteLexer'] + + +# `var` handled separately +# `interface` handled separately +_declarations = ['bind', 'def', 'fn', 'object'] +_methods = ['method', 'to'] +_keywords = [ + 'as', 'break', 'catch', 'continue', 'else', 'escape', 'exit', 'exports', + 'extends', 'finally', 'for', 'guards', 'if', 'implements', 'import', + 'in', 'match', 'meta', 'pass', 'return', 'switch', 'try', 'via', 'when', + 'while', +] +_operators = [ + # Unary + '~', '!', + # Binary + '+', '-', '*', '/', '%', '**', '&', '|', '^', '<<', '>>', + # Binary augmented + '+=', '-=', '*=', '/=', '%=', '**=', '&=', '|=', '^=', '<<=', '>>=', + # Comparison + '==', '!=', '<', '<=', '>', '>=', '<=>', + # Patterns and assignment + ':=', '?', '=~', '!~', '=>', + # Calls and sends + '.', '<-', '->', +] +_escape_pattern = ( + r'(?:\\x[0-9a-fA-F]{2}|\\u[0-9a-fA-F]{4}|\\U[0-9a-fA-F]{8}|' + r'\\["\'\\bftnr])') +# _char = _escape_chars + [('.', String.Char)] +_identifier = r'[_a-zA-Z]\w*' + +_constants = [ + # Void constants + 'null', + # Bool constants + 'false', 'true', + # Double constants + 'Infinity', 'NaN', + # Special objects + 'M', 'Ref', 'throw', 'traceln', +] + +_guards = [ + 'Any', 'Binding', 'Bool', 'Bytes', 'Char', 'DeepFrozen', 'Double', + 'Empty', 'Int', 'List', 'Map', 'Near', 'NullOk', 'Same', 'Selfless', + 'Set', 'Str', 'SubrangeGuard', 'Transparent', 'Void', +] + +_safeScope = [ + '_accumulateList', '_accumulateMap', '_auditedBy', '_bind', + '_booleanFlow', '_comparer', '_equalizer', '_iterForever', '_loop', + '_makeBytes', '_makeDouble', '_makeFinalSlot', '_makeInt', '_makeList', + '_makeMap', '_makeMessageDesc', '_makeOrderedSpace', '_makeParamDesc', + '_makeProtocolDesc', '_makeSourceSpan', '_makeString', '_makeVarSlot', + '_makeVerbFacet', '_mapExtract', '_matchSame', '_quasiMatcher', + '_slotToBinding', '_splitList', '_suchThat', '_switchFailed', + '_validateFor', 'b__quasiParser', 'eval', 'import', 'm__quasiParser', + 'makeBrandPair', 'makeLazySlot', 'safeScope', 'simple__quasiParser', +] + + +class MonteLexer(RegexLexer): + """ + Lexer for the `Monte `_ programming language. + + .. versionadded:: 2.2 + """ + name = 'Monte' + aliases = ['monte'] + filenames = ['*.mt'] + + tokens = { + 'root': [ + # Comments + (r'#[^\n]*\n', Comment), + + # Docstrings + # Apologies for the non-greedy matcher here. + (r'/\*\*.*?\*/', String.Doc), + + # `var` declarations + (r'\bvar\b', Keyword.Declaration, 'var'), + + # `interface` declarations + (r'\binterface\b', Keyword.Declaration, 'interface'), + + # method declarations + (words(_methods, prefix='\\b', suffix='\\b'), + Keyword, 'method'), + + # All other declarations + (words(_declarations, prefix='\\b', suffix='\\b'), + Keyword.Declaration), + + # Keywords + (words(_keywords, prefix='\\b', suffix='\\b'), Keyword), + + # Literals + ('[+-]?0x[_0-9a-fA-F]+', Number.Hex), + (r'[+-]?[_0-9]+\.[_0-9]*([eE][+-]?[_0-9]+)?', Number.Float), + ('[+-]?[_0-9]+', Number.Integer), + ("'", String.Double, 'char'), + ('"', String.Double, 'string'), + + # Quasiliterals + ('`', String.Backtick, 'ql'), + + # Operators + (words(_operators), Operator), + + # Verb operators + (_identifier + '=', Operator.Word), + + # Safe scope constants + (words(_constants, prefix='\\b', suffix='\\b'), + Keyword.Pseudo), + + # Safe scope guards + (words(_guards, prefix='\\b', suffix='\\b'), Keyword.Type), + + # All other safe scope names + (words(_safeScope, prefix='\\b', suffix='\\b'), + Name.Builtin), + + # Identifiers + (_identifier, Name), + + # Punctuation + (r'\(|\)|\{|\}|\[|\]|:|,', Punctuation), + + # Whitespace + (' +', Whitespace), + + # Definite lexer errors + ('=', Error), + ], + 'char': [ + # It is definitely an error to have a char of width == 0. + ("'", Error, 'root'), + (_escape_pattern, String.Escape, 'charEnd'), + ('.', String.Char, 'charEnd'), + ], + 'charEnd': [ + ("'", String.Char, '#pop:2'), + # It is definitely an error to have a char of width > 1. + ('.', Error), + ], + # The state of things coming into an interface. + 'interface': [ + (' +', Whitespace), + (_identifier, Name.Class, '#pop'), + include('root'), + ], + # The state of things coming into a method. + 'method': [ + (' +', Whitespace), + (_identifier, Name.Function, '#pop'), + include('root'), + ], + 'string': [ + ('"', String.Double, 'root'), + (_escape_pattern, String.Escape), + (r'\n', String.Double), + ('.', String.Double), + ], + 'ql': [ + ('`', String.Backtick, 'root'), + (r'\$' + _escape_pattern, String.Escape), + (r'\$\$', String.Escape), + (r'@@', String.Escape), + (r'\$\{', String.Interpol, 'qlNest'), + (r'@\{', String.Interpol, 'qlNest'), + (r'\$' + _identifier, Name), + ('@' + _identifier, Name), + ('.', String.Backtick), + ], + 'qlNest': [ + (r'\}', String.Interpol, '#pop'), + include('root'), + ], + # The state of things immediately following `var`. + 'var': [ + (' +', Whitespace), + (_identifier, Name.Variable, '#pop'), + include('root'), + ], + } diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/ncl.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/ncl.py new file mode 100644 index 0000000000000000000000000000000000000000..3ca5135cc1bb1e375af8e05fb2fa1a31be68df9a --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/ncl.py @@ -0,0 +1,894 @@ +# -*- coding: utf-8 -*- +""" + pygments.lexers.ncl + ~~~~~~~~~~~~~~~~~~~ + + Lexers for NCAR Command Language. + + :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS. + :license: BSD, see LICENSE for details. +""" + +import re + +from pygments.lexer import RegexLexer, include, words +from pygments.token import Text, Comment, Operator, Keyword, Name, String, \ + Number, Punctuation + +__all__ = ['NCLLexer'] + + +class NCLLexer(RegexLexer): + """ + Lexer for NCL code. + + .. versionadded:: 2.2 + """ + name = 'NCL' + aliases = ['ncl'] + filenames = ['*.ncl'] + mimetypes = ['text/ncl'] + flags = re.MULTILINE + + tokens = { + 'root': [ + (r';.*\n', Comment), + include('strings'), + include('core'), + (r'[a-zA-Z_]\w*', Name), + include('nums'), + (r'[\s]+', Text), + ], + 'core': [ + # Statements + (words(( + 'begin', 'break', 'continue', 'create', 'defaultapp', 'do', + 'else', 'end', 'external', 'exit', 'True', 'False', 'file', 'function', + 'getvalues', 'graphic', 'group', 'if', 'list', 'load', 'local', + 'new', '_Missing', 'Missing', 'noparent', 'procedure', + 'quit', 'QUIT', 'Quit', 'record', 'return', 'setvalues', 'stop', + 'then', 'while'), prefix=r'\b', suffix=r'\s*\b'), + Keyword), + + # Data Types + (words(( + 'ubyte', 'uint', 'uint64', 'ulong', 'string', 'byte', + 'character', 'double', 'float', 'integer', 'int64', 'logical', + 'long', 'short', 'ushort', 'enumeric', 'numeric', 'snumeric'), + prefix=r'\b', suffix=r'\s*\b'), + Keyword.Type), + + # Operators + (r'[\%^*+\-/<>]', Operator), + + # punctuation: + (r'[\[\]():@$!&|.,\\{}]', Punctuation), + (r'[=:]', Punctuation), + + # Intrinsics + (words(( + 'abs', 'acos', 'addfile', 'addfiles', 'all', 'angmom_atm', 'any', + 'area_conserve_remap', 'area_hi2lores', 'area_poly_sphere', + 'asciiread', 'asciiwrite', 'asin', 'atan', 'atan2', 'attsetvalues', + 'avg', 'betainc', 'bin_avg', 'bin_sum', 'bw_bandpass_filter', + 'cancor', 'cbinread', 'cbinwrite', 'cd_calendar', 'cd_inv_calendar', + 'cdfbin_p', 'cdfbin_pr', 'cdfbin_s', 'cdfbin_xn', 'cdfchi_p', + 'cdfchi_x', 'cdfgam_p', 'cdfgam_x', 'cdfnor_p', 'cdfnor_x', + 'cdft_p', 'cdft_t', 'ceil', 'center_finite_diff', + 'center_finite_diff_n', 'cfftb', 'cfftf', 'cfftf_frq_reorder', + 'charactertodouble', 'charactertofloat', 'charactertointeger', + 'charactertolong', 'charactertoshort', 'charactertostring', + 'chartodouble', 'chartofloat', 'chartoint', 'chartointeger', + 'chartolong', 'chartoshort', 'chartostring', 'chiinv', 'clear', + 'color_index_to_rgba', 'conform', 'conform_dims', 'cos', 'cosh', + 'count_unique_values', 'covcorm', 'covcorm_xy', 'craybinnumrec', + 'craybinrecread', 'create_graphic', 'csa1', 'csa1d', 'csa1s', + 'csa1x', 'csa1xd', 'csa1xs', 'csa2', 'csa2d', 'csa2l', 'csa2ld', + 'csa2ls', 'csa2lx', 'csa2lxd', 'csa2lxs', 'csa2s', 'csa2x', + 'csa2xd', 'csa2xs', 'csa3', 'csa3d', 'csa3l', 'csa3ld', 'csa3ls', + 'csa3lx', 'csa3lxd', 'csa3lxs', 'csa3s', 'csa3x', 'csa3xd', + 'csa3xs', 'csc2s', 'csgetp', 'css2c', 'cssetp', 'cssgrid', 'csstri', + 'csvoro', 'cumsum', 'cz2ccm', 'datatondc', 'day_of_week', + 'day_of_year', 'days_in_month', 'default_fillvalue', 'delete', + 'depth_to_pres', 'destroy', 'determinant', 'dewtemp_trh', + 'dgeevx_lapack', 'dim_acumrun_n', 'dim_avg', 'dim_avg_n', + 'dim_avg_wgt', 'dim_avg_wgt_n', 'dim_cumsum', 'dim_cumsum_n', + 'dim_gamfit_n', 'dim_gbits', 'dim_max', 'dim_max_n', 'dim_median', + 'dim_median_n', 'dim_min', 'dim_min_n', 'dim_num', 'dim_num_n', + 'dim_numrun_n', 'dim_pqsort', 'dim_pqsort_n', 'dim_product', + 'dim_product_n', 'dim_rmsd', 'dim_rmsd_n', 'dim_rmvmean', + 'dim_rmvmean_n', 'dim_rmvmed', 'dim_rmvmed_n', 'dim_spi_n', + 'dim_standardize', 'dim_standardize_n', 'dim_stat4', 'dim_stat4_n', + 'dim_stddev', 'dim_stddev_n', 'dim_sum', 'dim_sum_n', 'dim_sum_wgt', + 'dim_sum_wgt_n', 'dim_variance', 'dim_variance_n', 'dimsizes', + 'doubletobyte', 'doubletochar', 'doubletocharacter', + 'doubletofloat', 'doubletoint', 'doubletointeger', 'doubletolong', + 'doubletoshort', 'dpres_hybrid_ccm', 'dpres_plevel', 'draw', + 'draw_color_palette', 'dsgetp', 'dsgrid2', 'dsgrid2d', 'dsgrid2s', + 'dsgrid3', 'dsgrid3d', 'dsgrid3s', 'dspnt2', 'dspnt2d', 'dspnt2s', + 'dspnt3', 'dspnt3d', 'dspnt3s', 'dssetp', 'dtrend', 'dtrend_msg', + 'dtrend_msg_n', 'dtrend_n', 'dtrend_quadratic', + 'dtrend_quadratic_msg_n', 'dv2uvf', 'dv2uvg', 'dz_height', + 'echo_off', 'echo_on', 'eof2data', 'eof_varimax', 'eofcor', + 'eofcor_pcmsg', 'eofcor_ts', 'eofcov', 'eofcov_pcmsg', 'eofcov_ts', + 'eofunc', 'eofunc_ts', 'eofunc_varimax', 'equiv_sample_size', 'erf', + 'erfc', 'esacr', 'esacv', 'esccr', 'esccv', 'escorc', 'escorc_n', + 'escovc', 'exit', 'exp', 'exp_tapersh', 'exp_tapersh_wgts', + 'exp_tapershC', 'ezfftb', 'ezfftb_n', 'ezfftf', 'ezfftf_n', + 'f2fosh', 'f2foshv', 'f2fsh', 'f2fshv', 'f2gsh', 'f2gshv', 'fabs', + 'fbindirread', 'fbindirwrite', 'fbinnumrec', 'fbinread', + 'fbinrecread', 'fbinrecwrite', 'fbinwrite', 'fft2db', 'fft2df', + 'fftshift', 'fileattdef', 'filechunkdimdef', 'filedimdef', + 'fileexists', 'filegrpdef', 'filevarattdef', 'filevarchunkdef', + 'filevarcompressleveldef', 'filevardef', 'filevardimsizes', + 'filwgts_lancos', 'filwgts_lanczos', 'filwgts_normal', + 'floattobyte', 'floattochar', 'floattocharacter', 'floattoint', + 'floattointeger', 'floattolong', 'floattoshort', 'floor', + 'fluxEddy', 'fo2fsh', 'fo2fshv', 'fourier_info', 'frame', 'fspan', + 'ftcurv', 'ftcurvd', 'ftcurvi', 'ftcurvp', 'ftcurvpi', 'ftcurvps', + 'ftcurvs', 'ftest', 'ftgetp', 'ftkurv', 'ftkurvd', 'ftkurvp', + 'ftkurvpd', 'ftsetp', 'ftsurf', 'g2fsh', 'g2fshv', 'g2gsh', + 'g2gshv', 'gamma', 'gammainc', 'gaus', 'gaus_lobat', + 'gaus_lobat_wgt', 'gc_aangle', 'gc_clkwise', 'gc_dangle', + 'gc_inout', 'gc_latlon', 'gc_onarc', 'gc_pnt2gc', 'gc_qarea', + 'gc_tarea', 'generate_2d_array', 'get_color_index', + 'get_color_rgba', 'get_cpu_time', 'get_isolines', 'get_ncl_version', + 'get_script_name', 'get_script_prefix_name', 'get_sphere_radius', + 'get_unique_values', 'getbitsone', 'getenv', 'getfiledimsizes', + 'getfilegrpnames', 'getfilepath', 'getfilevaratts', + 'getfilevarchunkdimsizes', 'getfilevardims', 'getfilevardimsizes', + 'getfilevarnames', 'getfilevartypes', 'getvaratts', 'getvardims', + 'gradsf', 'gradsg', 'greg2jul', 'grid2triple', 'hlsrgb', 'hsvrgb', + 'hydro', 'hyi2hyo', 'idsfft', 'igradsf', 'igradsg', 'ilapsf', + 'ilapsg', 'ilapvf', 'ilapvg', 'ind', 'ind_resolve', 'int2p', + 'int2p_n', 'integertobyte', 'integertochar', 'integertocharacter', + 'integertoshort', 'inttobyte', 'inttochar', 'inttoshort', + 'inverse_matrix', 'isatt', 'isbigendian', 'isbyte', 'ischar', + 'iscoord', 'isdefined', 'isdim', 'isdimnamed', 'isdouble', + 'isenumeric', 'isfile', 'isfilepresent', 'isfilevar', + 'isfilevaratt', 'isfilevarcoord', 'isfilevardim', 'isfloat', + 'isfunc', 'isgraphic', 'isint', 'isint64', 'isinteger', + 'isleapyear', 'islogical', 'islong', 'ismissing', 'isnan_ieee', + 'isnumeric', 'ispan', 'isproc', 'isshort', 'issnumeric', 'isstring', + 'isubyte', 'isuint', 'isuint64', 'isulong', 'isunlimited', + 'isunsigned', 'isushort', 'isvar', 'jul2greg', 'kmeans_as136', + 'kolsm2_n', 'kron_product', 'lapsf', 'lapsg', 'lapvf', 'lapvg', + 'latlon2utm', 'lclvl', 'lderuvf', 'lderuvg', 'linint1', 'linint1_n', + 'linint2', 'linint2_points', 'linmsg', 'linmsg_n', 'linrood_latwgt', + 'linrood_wgt', 'list_files', 'list_filevars', 'list_hlus', + 'list_procfuncs', 'list_vars', 'ListAppend', 'ListCount', + 'ListGetType', 'ListIndex', 'ListIndexFromName', 'ListPop', + 'ListPush', 'ListSetType', 'loadscript', 'local_max', 'local_min', + 'log', 'log10', 'longtobyte', 'longtochar', 'longtocharacter', + 'longtoint', 'longtointeger', 'longtoshort', 'lspoly', 'lspoly_n', + 'mask', 'max', 'maxind', 'min', 'minind', 'mixed_layer_depth', + 'mixhum_ptd', 'mixhum_ptrh', 'mjo_cross_coh2pha', + 'mjo_cross_segment', 'moc_globe_atl', 'monthday', 'natgrid', + 'natgridd', 'natgrids', 'ncargpath', 'ncargversion', 'ndctodata', + 'ndtooned', 'new', 'NewList', 'ngezlogo', 'nggcog', 'nggetp', + 'nglogo', 'ngsetp', 'NhlAddAnnotation', 'NhlAddData', + 'NhlAddOverlay', 'NhlAddPrimitive', 'NhlAppGetDefaultParentId', + 'NhlChangeWorkstation', 'NhlClassName', 'NhlClearWorkstation', + 'NhlDataPolygon', 'NhlDataPolyline', 'NhlDataPolymarker', + 'NhlDataToNDC', 'NhlDestroy', 'NhlDraw', 'NhlFrame', 'NhlFreeColor', + 'NhlGetBB', 'NhlGetClassResources', 'NhlGetErrorObjectId', + 'NhlGetNamedColorIndex', 'NhlGetParentId', + 'NhlGetParentWorkstation', 'NhlGetWorkspaceObjectId', + 'NhlIsAllocatedColor', 'NhlIsApp', 'NhlIsDataComm', 'NhlIsDataItem', + 'NhlIsDataSpec', 'NhlIsTransform', 'NhlIsView', 'NhlIsWorkstation', + 'NhlName', 'NhlNDCPolygon', 'NhlNDCPolyline', 'NhlNDCPolymarker', + 'NhlNDCToData', 'NhlNewColor', 'NhlNewDashPattern', 'NhlNewMarker', + 'NhlPalGetDefined', 'NhlRemoveAnnotation', 'NhlRemoveData', + 'NhlRemoveOverlay', 'NhlRemovePrimitive', 'NhlSetColor', + 'NhlSetDashPattern', 'NhlSetMarker', 'NhlUpdateData', + 'NhlUpdateWorkstation', 'nice_mnmxintvl', 'nngetaspectd', + 'nngetaspects', 'nngetp', 'nngetsloped', 'nngetslopes', 'nngetwts', + 'nngetwtsd', 'nnpnt', 'nnpntd', 'nnpntend', 'nnpntendd', + 'nnpntinit', 'nnpntinitd', 'nnpntinits', 'nnpnts', 'nnsetp', 'num', + 'obj_anal_ic', 'omega_ccm', 'onedtond', 'overlay', 'paleo_outline', + 'pdfxy_bin', 'poisson_grid_fill', 'pop_remap', 'potmp_insitu_ocn', + 'prcwater_dp', 'pres2hybrid', 'pres_hybrid_ccm', 'pres_sigma', + 'print', 'print_table', 'printFileVarSummary', 'printVarSummary', + 'product', 'pslec', 'pslhor', 'pslhyp', 'qsort', 'rand', + 'random_chi', 'random_gamma', 'random_normal', 'random_setallseed', + 'random_uniform', 'rcm2points', 'rcm2rgrid', 'rdsstoi', + 'read_colormap_file', 'reg_multlin', 'regcoef', 'regCoef_n', + 'regline', 'relhum', 'replace_ieeenan', 'reshape', 'reshape_ind', + 'rgba_to_color_index', 'rgbhls', 'rgbhsv', 'rgbyiq', 'rgrid2rcm', + 'rhomb_trunc', 'rip_cape_2d', 'rip_cape_3d', 'round', 'rtest', + 'runave', 'runave_n', 'set_default_fillvalue', 'set_sphere_radius', + 'setfileoption', 'sfvp2uvf', 'sfvp2uvg', 'shaec', 'shagc', + 'shgetnp', 'shgetp', 'shgrid', 'shorttobyte', 'shorttochar', + 'shorttocharacter', 'show_ascii', 'shsec', 'shsetp', 'shsgc', + 'shsgc_R42', 'sigma2hybrid', 'simpeq', 'simpne', 'sin', + 'sindex_yrmo', 'sinh', 'sizeof', 'sleep', 'smth9', 'snindex_yrmo', + 'solve_linsys', 'span_color_indexes', 'span_color_rgba', + 'sparse_matrix_mult', 'spcorr', 'spcorr_n', 'specx_anal', + 'specxy_anal', 'spei', 'sprintf', 'sprinti', 'sqrt', 'sqsort', + 'srand', 'stat2', 'stat4', 'stat_medrng', 'stat_trim', + 'status_exit', 'stdatmus_p2tdz', 'stdatmus_z2tdp', 'stddev', + 'str_capital', 'str_concat', 'str_fields_count', 'str_get_cols', + 'str_get_dq', 'str_get_field', 'str_get_nl', 'str_get_sq', + 'str_get_tab', 'str_index_of_substr', 'str_insert', 'str_is_blank', + 'str_join', 'str_left_strip', 'str_lower', 'str_match', + 'str_match_ic', 'str_match_ic_regex', 'str_match_ind', + 'str_match_ind_ic', 'str_match_ind_ic_regex', 'str_match_ind_regex', + 'str_match_regex', 'str_right_strip', 'str_split', + 'str_split_by_length', 'str_split_csv', 'str_squeeze', 'str_strip', + 'str_sub_str', 'str_switch', 'str_upper', 'stringtochar', + 'stringtocharacter', 'stringtodouble', 'stringtofloat', + 'stringtoint', 'stringtointeger', 'stringtolong', 'stringtoshort', + 'strlen', 'student_t', 'sum', 'svd_lapack', 'svdcov', 'svdcov_sv', + 'svdstd', 'svdstd_sv', 'system', 'systemfunc', 'tan', 'tanh', + 'taper', 'taper_n', 'tdclrs', 'tdctri', 'tdcudp', 'tdcurv', + 'tddtri', 'tdez2d', 'tdez3d', 'tdgetp', 'tdgrds', 'tdgrid', + 'tdgtrs', 'tdinit', 'tditri', 'tdlbla', 'tdlblp', 'tdlbls', + 'tdline', 'tdlndp', 'tdlnpa', 'tdlpdp', 'tdmtri', 'tdotri', + 'tdpara', 'tdplch', 'tdprpa', 'tdprpi', 'tdprpt', 'tdsetp', + 'tdsort', 'tdstri', 'tdstrs', 'tdttri', 'thornthwaite', 'tobyte', + 'tochar', 'todouble', 'tofloat', 'toint', 'toint64', 'tointeger', + 'tolong', 'toshort', 'tosigned', 'tostring', 'tostring_with_format', + 'totype', 'toubyte', 'touint', 'touint64', 'toulong', 'tounsigned', + 'toushort', 'trend_manken', 'tri_trunc', 'triple2grid', + 'triple2grid2d', 'trop_wmo', 'ttest', 'typeof', 'undef', + 'unique_string', 'update', 'ushorttoint', 'ut_calendar', + 'ut_inv_calendar', 'utm2latlon', 'uv2dv_cfd', 'uv2dvf', 'uv2dvg', + 'uv2sfvpf', 'uv2sfvpg', 'uv2vr_cfd', 'uv2vrdvf', 'uv2vrdvg', + 'uv2vrf', 'uv2vrg', 'v5d_close', 'v5d_create', 'v5d_setLowLev', + 'v5d_setUnits', 'v5d_write', 'v5d_write_var', 'variance', 'vhaec', + 'vhagc', 'vhsec', 'vhsgc', 'vibeta', 'vinth2p', 'vinth2p_ecmwf', + 'vinth2p_ecmwf_nodes', 'vinth2p_nodes', 'vintp2p_ecmwf', 'vr2uvf', + 'vr2uvg', 'vrdv2uvf', 'vrdv2uvg', 'wavelet', 'wavelet_default', + 'weibull', 'wgt_area_smooth', 'wgt_areaave', 'wgt_areaave2', + 'wgt_arearmse', 'wgt_arearmse2', 'wgt_areasum2', 'wgt_runave', + 'wgt_runave_n', 'wgt_vert_avg_beta', 'wgt_volave', 'wgt_volave_ccm', + 'wgt_volrmse', 'wgt_volrmse_ccm', 'where', 'wk_smooth121', 'wmbarb', + 'wmbarbmap', 'wmdrft', 'wmgetp', 'wmlabs', 'wmsetp', 'wmstnm', + 'wmvect', 'wmvectmap', 'wmvlbl', 'wrf_avo', 'wrf_cape_2d', + 'wrf_cape_3d', 'wrf_dbz', 'wrf_eth', 'wrf_helicity', 'wrf_ij_to_ll', + 'wrf_interp_1d', 'wrf_interp_2d_xy', 'wrf_interp_3d_z', + 'wrf_latlon_to_ij', 'wrf_ll_to_ij', 'wrf_omega', 'wrf_pvo', + 'wrf_rh', 'wrf_slp', 'wrf_smooth_2d', 'wrf_td', 'wrf_tk', + 'wrf_updraft_helicity', 'wrf_uvmet', 'wrf_virtual_temp', + 'wrf_wetbulb', 'wrf_wps_close_int', 'wrf_wps_open_int', + 'wrf_wps_rddata_int', 'wrf_wps_rdhead_int', 'wrf_wps_read_int', + 'wrf_wps_write_int', 'write_matrix', 'write_table', 'yiqrgb', + 'z2geouv', 'zonal_mpsi', 'addfiles_GetVar', 'advect_variable', + 'area_conserve_remap_Wrap', 'area_hi2lores_Wrap', + 'array_append_record', 'assignFillValue', 'byte2flt', + 'byte2flt_hdf', 'calcDayAnomTLL', 'calcMonAnomLLLT', + 'calcMonAnomLLT', 'calcMonAnomTLL', 'calcMonAnomTLLL', + 'calculate_monthly_values', 'cd_convert', 'changeCase', + 'changeCaseChar', 'clmDayTLL', 'clmDayTLLL', 'clmMon2clmDay', + 'clmMonLLLT', 'clmMonLLT', 'clmMonTLL', 'clmMonTLLL', 'closest_val', + 'copy_VarAtts', 'copy_VarCoords', 'copy_VarCoords_1', + 'copy_VarCoords_2', 'copy_VarMeta', 'copyatt', 'crossp3', + 'cshstringtolist', 'cssgrid_Wrap', 'dble2flt', 'decimalPlaces', + 'delete_VarAtts', 'dim_avg_n_Wrap', 'dim_avg_wgt_n_Wrap', + 'dim_avg_wgt_Wrap', 'dim_avg_Wrap', 'dim_cumsum_n_Wrap', + 'dim_cumsum_Wrap', 'dim_max_n_Wrap', 'dim_min_n_Wrap', + 'dim_rmsd_n_Wrap', 'dim_rmsd_Wrap', 'dim_rmvmean_n_Wrap', + 'dim_rmvmean_Wrap', 'dim_rmvmed_n_Wrap', 'dim_rmvmed_Wrap', + 'dim_standardize_n_Wrap', 'dim_standardize_Wrap', + 'dim_stddev_n_Wrap', 'dim_stddev_Wrap', 'dim_sum_n_Wrap', + 'dim_sum_wgt_n_Wrap', 'dim_sum_wgt_Wrap', 'dim_sum_Wrap', + 'dim_variance_n_Wrap', 'dim_variance_Wrap', 'dpres_plevel_Wrap', + 'dtrend_leftdim', 'dv2uvF_Wrap', 'dv2uvG_Wrap', 'eof_north', + 'eofcor_Wrap', 'eofcov_Wrap', 'eofunc_north', 'eofunc_ts_Wrap', + 'eofunc_varimax_reorder', 'eofunc_varimax_Wrap', 'eofunc_Wrap', + 'epsZero', 'f2fosh_Wrap', 'f2foshv_Wrap', 'f2fsh_Wrap', + 'f2fshv_Wrap', 'f2gsh_Wrap', 'f2gshv_Wrap', 'fbindirSwap', + 'fbinseqSwap1', 'fbinseqSwap2', 'flt2dble', 'flt2string', + 'fo2fsh_Wrap', 'fo2fshv_Wrap', 'g2fsh_Wrap', 'g2fshv_Wrap', + 'g2gsh_Wrap', 'g2gshv_Wrap', 'generate_resample_indices', + 'generate_sample_indices', 'generate_unique_indices', + 'genNormalDist', 'get1Dindex', 'get1Dindex_Collapse', + 'get1Dindex_Exclude', 'get_file_suffix', 'GetFillColor', + 'GetFillColorIndex', 'getFillValue', 'getind_latlon2d', + 'getVarDimNames', 'getVarFillValue', 'grib_stime2itime', + 'hyi2hyo_Wrap', 'ilapsF_Wrap', 'ilapsG_Wrap', 'ind_nearest_coord', + 'indStrSubset', 'int2dble', 'int2flt', 'int2p_n_Wrap', 'int2p_Wrap', + 'isMonotonic', 'isStrSubset', 'latGau', 'latGauWgt', 'latGlobeF', + 'latGlobeFo', 'latRegWgt', 'linint1_n_Wrap', 'linint1_Wrap', + 'linint2_points_Wrap', 'linint2_Wrap', 'local_max_1d', + 'local_min_1d', 'lonFlip', 'lonGlobeF', 'lonGlobeFo', 'lonPivot', + 'merge_levels_sfc', 'mod', 'month_to_annual', + 'month_to_annual_weighted', 'month_to_season', 'month_to_season12', + 'month_to_seasonN', 'monthly_total_to_daily_mean', 'nameDim', + 'natgrid_Wrap', 'NewCosWeight', 'niceLatLon2D', 'NormCosWgtGlobe', + 'numAsciiCol', 'numAsciiRow', 'numeric2int', + 'obj_anal_ic_deprecated', 'obj_anal_ic_Wrap', 'omega_ccm_driver', + 'omega_to_w', 'oneDtostring', 'pack_values', 'pattern_cor', 'pdfx', + 'pdfxy', 'pdfxy_conform', 'pot_temp', 'pot_vort_hybrid', + 'pot_vort_isobaric', 'pres2hybrid_Wrap', 'print_clock', + 'printMinMax', 'quadroots', 'rcm2points_Wrap', 'rcm2rgrid_Wrap', + 'readAsciiHead', 'readAsciiTable', 'reg_multlin_stats', + 'region_ind', 'regline_stats', 'relhum_ttd', 'replaceSingleChar', + 'RGBtoCmap', 'rgrid2rcm_Wrap', 'rho_mwjf', 'rm_single_dims', + 'rmAnnCycle1D', 'rmInsufData', 'rmMonAnnCycLLLT', 'rmMonAnnCycLLT', + 'rmMonAnnCycTLL', 'runave_n_Wrap', 'runave_Wrap', 'short2flt', + 'short2flt_hdf', 'shsgc_R42_Wrap', 'sign_f90', 'sign_matlab', + 'smth9_Wrap', 'smthClmDayTLL', 'smthClmDayTLLL', 'SqrtCosWeight', + 'stat_dispersion', 'static_stability', 'stdMonLLLT', 'stdMonLLT', + 'stdMonTLL', 'stdMonTLLL', 'symMinMaxPlt', 'table_attach_columns', + 'table_attach_rows', 'time_to_newtime', 'transpose', + 'triple2grid_Wrap', 'ut_convert', 'uv2dvF_Wrap', 'uv2dvG_Wrap', + 'uv2vrF_Wrap', 'uv2vrG_Wrap', 'vr2uvF_Wrap', 'vr2uvG_Wrap', + 'w_to_omega', 'wallClockElapseTime', 'wave_number_spc', + 'wgt_areaave_Wrap', 'wgt_runave_leftdim', 'wgt_runave_n_Wrap', + 'wgt_runave_Wrap', 'wgt_vertical_n', 'wind_component', + 'wind_direction', 'yyyyddd_to_yyyymmdd', 'yyyymm_time', + 'yyyymm_to_yyyyfrac', 'yyyymmdd_time', 'yyyymmdd_to_yyyyddd', + 'yyyymmdd_to_yyyyfrac', 'yyyymmddhh_time', 'yyyymmddhh_to_yyyyfrac', + 'zonal_mpsi_Wrap', 'zonalAve', 'calendar_decode2', 'cd_string', + 'kf_filter', 'run_cor', 'time_axis_labels', 'ut_string', + 'wrf_contour', 'wrf_map', 'wrf_map_overlay', 'wrf_map_overlays', + 'wrf_map_resources', 'wrf_map_zoom', 'wrf_overlay', 'wrf_overlays', + 'wrf_user_getvar', 'wrf_user_ij_to_ll', 'wrf_user_intrp2d', + 'wrf_user_intrp3d', 'wrf_user_latlon_to_ij', 'wrf_user_list_times', + 'wrf_user_ll_to_ij', 'wrf_user_unstagger', 'wrf_user_vert_interp', + 'wrf_vector', 'gsn_add_annotation', 'gsn_add_polygon', + 'gsn_add_polyline', 'gsn_add_polymarker', + 'gsn_add_shapefile_polygons', 'gsn_add_shapefile_polylines', + 'gsn_add_shapefile_polymarkers', 'gsn_add_text', 'gsn_attach_plots', + 'gsn_blank_plot', 'gsn_contour', 'gsn_contour_map', + 'gsn_contour_shade', 'gsn_coordinates', 'gsn_create_labelbar', + 'gsn_create_legend', 'gsn_create_text', + 'gsn_csm_attach_zonal_means', 'gsn_csm_blank_plot', + 'gsn_csm_contour', 'gsn_csm_contour_map', 'gsn_csm_contour_map_ce', + 'gsn_csm_contour_map_overlay', 'gsn_csm_contour_map_polar', + 'gsn_csm_hov', 'gsn_csm_lat_time', 'gsn_csm_map', 'gsn_csm_map_ce', + 'gsn_csm_map_polar', 'gsn_csm_pres_hgt', + 'gsn_csm_pres_hgt_streamline', 'gsn_csm_pres_hgt_vector', + 'gsn_csm_streamline', 'gsn_csm_streamline_contour_map', + 'gsn_csm_streamline_contour_map_ce', + 'gsn_csm_streamline_contour_map_polar', 'gsn_csm_streamline_map', + 'gsn_csm_streamline_map_ce', 'gsn_csm_streamline_map_polar', + 'gsn_csm_streamline_scalar', 'gsn_csm_streamline_scalar_map', + 'gsn_csm_streamline_scalar_map_ce', + 'gsn_csm_streamline_scalar_map_polar', 'gsn_csm_time_lat', + 'gsn_csm_vector', 'gsn_csm_vector_map', 'gsn_csm_vector_map_ce', + 'gsn_csm_vector_map_polar', 'gsn_csm_vector_scalar', + 'gsn_csm_vector_scalar_map', 'gsn_csm_vector_scalar_map_ce', + 'gsn_csm_vector_scalar_map_polar', 'gsn_csm_x2y', 'gsn_csm_x2y2', + 'gsn_csm_xy', 'gsn_csm_xy2', 'gsn_csm_xy3', 'gsn_csm_y', + 'gsn_define_colormap', 'gsn_draw_colormap', 'gsn_draw_named_colors', + 'gsn_histogram', 'gsn_labelbar_ndc', 'gsn_legend_ndc', 'gsn_map', + 'gsn_merge_colormaps', 'gsn_open_wks', 'gsn_panel', 'gsn_polygon', + 'gsn_polygon_ndc', 'gsn_polyline', 'gsn_polyline_ndc', + 'gsn_polymarker', 'gsn_polymarker_ndc', 'gsn_retrieve_colormap', + 'gsn_reverse_colormap', 'gsn_streamline', 'gsn_streamline_map', + 'gsn_streamline_scalar', 'gsn_streamline_scalar_map', 'gsn_table', + 'gsn_text', 'gsn_text_ndc', 'gsn_vector', 'gsn_vector_map', + 'gsn_vector_scalar', 'gsn_vector_scalar_map', 'gsn_xy', 'gsn_y', + 'hsv2rgb', 'maximize_output', 'namedcolor2rgb', 'namedcolor2rgba', + 'reset_device_coordinates', 'span_named_colors'), prefix=r'\b'), + Name.Builtin), + + # Resources + (words(( + 'amDataXF', 'amDataYF', 'amJust', 'amOn', 'amOrthogonalPosF', + 'amParallelPosF', 'amResizeNotify', 'amSide', 'amTrackData', + 'amViewId', 'amZone', 'appDefaultParent', 'appFileSuffix', + 'appResources', 'appSysDir', 'appUsrDir', 'caCopyArrays', + 'caXArray', 'caXCast', 'caXMaxV', 'caXMinV', 'caXMissingV', + 'caYArray', 'caYCast', 'caYMaxV', 'caYMinV', 'caYMissingV', + 'cnCellFillEdgeColor', 'cnCellFillMissingValEdgeColor', + 'cnConpackParams', 'cnConstFEnableFill', 'cnConstFLabelAngleF', + 'cnConstFLabelBackgroundColor', 'cnConstFLabelConstantSpacingF', + 'cnConstFLabelFont', 'cnConstFLabelFontAspectF', + 'cnConstFLabelFontColor', 'cnConstFLabelFontHeightF', + 'cnConstFLabelFontQuality', 'cnConstFLabelFontThicknessF', + 'cnConstFLabelFormat', 'cnConstFLabelFuncCode', 'cnConstFLabelJust', + 'cnConstFLabelOn', 'cnConstFLabelOrthogonalPosF', + 'cnConstFLabelParallelPosF', 'cnConstFLabelPerimColor', + 'cnConstFLabelPerimOn', 'cnConstFLabelPerimSpaceF', + 'cnConstFLabelPerimThicknessF', 'cnConstFLabelSide', + 'cnConstFLabelString', 'cnConstFLabelTextDirection', + 'cnConstFLabelZone', 'cnConstFUseInfoLabelRes', + 'cnExplicitLabelBarLabelsOn', 'cnExplicitLegendLabelsOn', + 'cnExplicitLineLabelsOn', 'cnFillBackgroundColor', 'cnFillColor', + 'cnFillColors', 'cnFillDotSizeF', 'cnFillDrawOrder', 'cnFillMode', + 'cnFillOn', 'cnFillOpacityF', 'cnFillPalette', 'cnFillPattern', + 'cnFillPatterns', 'cnFillScaleF', 'cnFillScales', 'cnFixFillBleed', + 'cnGridBoundFillColor', 'cnGridBoundFillPattern', + 'cnGridBoundFillScaleF', 'cnGridBoundPerimColor', + 'cnGridBoundPerimDashPattern', 'cnGridBoundPerimOn', + 'cnGridBoundPerimThicknessF', 'cnHighLabelAngleF', + 'cnHighLabelBackgroundColor', 'cnHighLabelConstantSpacingF', + 'cnHighLabelCount', 'cnHighLabelFont', 'cnHighLabelFontAspectF', + 'cnHighLabelFontColor', 'cnHighLabelFontHeightF', + 'cnHighLabelFontQuality', 'cnHighLabelFontThicknessF', + 'cnHighLabelFormat', 'cnHighLabelFuncCode', 'cnHighLabelPerimColor', + 'cnHighLabelPerimOn', 'cnHighLabelPerimSpaceF', + 'cnHighLabelPerimThicknessF', 'cnHighLabelString', 'cnHighLabelsOn', + 'cnHighLowLabelOverlapMode', 'cnHighUseLineLabelRes', + 'cnInfoLabelAngleF', 'cnInfoLabelBackgroundColor', + 'cnInfoLabelConstantSpacingF', 'cnInfoLabelFont', + 'cnInfoLabelFontAspectF', 'cnInfoLabelFontColor', + 'cnInfoLabelFontHeightF', 'cnInfoLabelFontQuality', + 'cnInfoLabelFontThicknessF', 'cnInfoLabelFormat', + 'cnInfoLabelFuncCode', 'cnInfoLabelJust', 'cnInfoLabelOn', + 'cnInfoLabelOrthogonalPosF', 'cnInfoLabelParallelPosF', + 'cnInfoLabelPerimColor', 'cnInfoLabelPerimOn', + 'cnInfoLabelPerimSpaceF', 'cnInfoLabelPerimThicknessF', + 'cnInfoLabelSide', 'cnInfoLabelString', 'cnInfoLabelTextDirection', + 'cnInfoLabelZone', 'cnLabelBarEndLabelsOn', 'cnLabelBarEndStyle', + 'cnLabelDrawOrder', 'cnLabelMasking', 'cnLabelScaleFactorF', + 'cnLabelScaleValueF', 'cnLabelScalingMode', 'cnLegendLevelFlags', + 'cnLevelCount', 'cnLevelFlag', 'cnLevelFlags', 'cnLevelSelectionMode', + 'cnLevelSpacingF', 'cnLevels', 'cnLineColor', 'cnLineColors', + 'cnLineDashPattern', 'cnLineDashPatterns', 'cnLineDashSegLenF', + 'cnLineDrawOrder', 'cnLineLabelAngleF', 'cnLineLabelBackgroundColor', + 'cnLineLabelConstantSpacingF', 'cnLineLabelCount', + 'cnLineLabelDensityF', 'cnLineLabelFont', 'cnLineLabelFontAspectF', + 'cnLineLabelFontColor', 'cnLineLabelFontColors', + 'cnLineLabelFontHeightF', 'cnLineLabelFontQuality', + 'cnLineLabelFontThicknessF', 'cnLineLabelFormat', + 'cnLineLabelFuncCode', 'cnLineLabelInterval', 'cnLineLabelPerimColor', + 'cnLineLabelPerimOn', 'cnLineLabelPerimSpaceF', + 'cnLineLabelPerimThicknessF', 'cnLineLabelPlacementMode', + 'cnLineLabelStrings', 'cnLineLabelsOn', 'cnLinePalette', + 'cnLineThicknessF', 'cnLineThicknesses', 'cnLinesOn', + 'cnLowLabelAngleF', 'cnLowLabelBackgroundColor', + 'cnLowLabelConstantSpacingF', 'cnLowLabelCount', 'cnLowLabelFont', + 'cnLowLabelFontAspectF', 'cnLowLabelFontColor', + 'cnLowLabelFontHeightF', 'cnLowLabelFontQuality', + 'cnLowLabelFontThicknessF', 'cnLowLabelFormat', 'cnLowLabelFuncCode', + 'cnLowLabelPerimColor', 'cnLowLabelPerimOn', 'cnLowLabelPerimSpaceF', + 'cnLowLabelPerimThicknessF', 'cnLowLabelString', 'cnLowLabelsOn', + 'cnLowUseHighLabelRes', 'cnMaxDataValueFormat', 'cnMaxLevelCount', + 'cnMaxLevelValF', 'cnMaxPointDistanceF', 'cnMinLevelValF', + 'cnMissingValFillColor', 'cnMissingValFillPattern', + 'cnMissingValFillScaleF', 'cnMissingValPerimColor', + 'cnMissingValPerimDashPattern', 'cnMissingValPerimGridBoundOn', + 'cnMissingValPerimOn', 'cnMissingValPerimThicknessF', + 'cnMonoFillColor', 'cnMonoFillPattern', 'cnMonoFillScale', + 'cnMonoLevelFlag', 'cnMonoLineColor', 'cnMonoLineDashPattern', + 'cnMonoLineLabelFontColor', 'cnMonoLineThickness', 'cnNoDataLabelOn', + 'cnNoDataLabelString', 'cnOutOfRangeFillColor', + 'cnOutOfRangeFillPattern', 'cnOutOfRangeFillScaleF', + 'cnOutOfRangePerimColor', 'cnOutOfRangePerimDashPattern', + 'cnOutOfRangePerimOn', 'cnOutOfRangePerimThicknessF', + 'cnRasterCellSizeF', 'cnRasterMinCellSizeF', 'cnRasterModeOn', + 'cnRasterSampleFactorF', 'cnRasterSmoothingOn', 'cnScalarFieldData', + 'cnSmoothingDistanceF', 'cnSmoothingOn', 'cnSmoothingTensionF', + 'cnSpanFillPalette', 'cnSpanLinePalette', 'ctCopyTables', + 'ctXElementSize', 'ctXMaxV', 'ctXMinV', 'ctXMissingV', 'ctXTable', + 'ctXTableLengths', 'ctXTableType', 'ctYElementSize', 'ctYMaxV', + 'ctYMinV', 'ctYMissingV', 'ctYTable', 'ctYTableLengths', + 'ctYTableType', 'dcDelayCompute', 'errBuffer', + 'errFileName', 'errFilePtr', 'errLevel', 'errPrint', 'errUnitNumber', + 'gsClipOn', 'gsColors', 'gsEdgeColor', 'gsEdgeDashPattern', + 'gsEdgeDashSegLenF', 'gsEdgeThicknessF', 'gsEdgesOn', + 'gsFillBackgroundColor', 'gsFillColor', 'gsFillDotSizeF', + 'gsFillIndex', 'gsFillLineThicknessF', 'gsFillOpacityF', + 'gsFillScaleF', 'gsFont', 'gsFontAspectF', 'gsFontColor', + 'gsFontHeightF', 'gsFontOpacityF', 'gsFontQuality', + 'gsFontThicknessF', 'gsLineColor', 'gsLineDashPattern', + 'gsLineDashSegLenF', 'gsLineLabelConstantSpacingF', 'gsLineLabelFont', + 'gsLineLabelFontAspectF', 'gsLineLabelFontColor', + 'gsLineLabelFontHeightF', 'gsLineLabelFontQuality', + 'gsLineLabelFontThicknessF', 'gsLineLabelFuncCode', + 'gsLineLabelString', 'gsLineOpacityF', 'gsLineThicknessF', + 'gsMarkerColor', 'gsMarkerIndex', 'gsMarkerOpacityF', 'gsMarkerSizeF', + 'gsMarkerThicknessF', 'gsSegments', 'gsTextAngleF', + 'gsTextConstantSpacingF', 'gsTextDirection', 'gsTextFuncCode', + 'gsTextJustification', 'gsnAboveYRefLineBarColors', + 'gsnAboveYRefLineBarFillScales', 'gsnAboveYRefLineBarPatterns', + 'gsnAboveYRefLineColor', 'gsnAddCyclic', 'gsnAttachBorderOn', + 'gsnAttachPlotsXAxis', 'gsnBelowYRefLineBarColors', + 'gsnBelowYRefLineBarFillScales', 'gsnBelowYRefLineBarPatterns', + 'gsnBelowYRefLineColor', 'gsnBoxMargin', 'gsnCenterString', + 'gsnCenterStringFontColor', 'gsnCenterStringFontHeightF', + 'gsnCenterStringFuncCode', 'gsnCenterStringOrthogonalPosF', + 'gsnCenterStringParallelPosF', 'gsnContourLineThicknessesScale', + 'gsnContourNegLineDashPattern', 'gsnContourPosLineDashPattern', + 'gsnContourZeroLineThicknessF', 'gsnDebugWriteFileName', 'gsnDraw', + 'gsnFrame', 'gsnHistogramBarWidthPercent', 'gsnHistogramBinIntervals', + 'gsnHistogramBinMissing', 'gsnHistogramBinWidth', + 'gsnHistogramClassIntervals', 'gsnHistogramCompare', + 'gsnHistogramComputePercentages', + 'gsnHistogramComputePercentagesNoMissing', + 'gsnHistogramDiscreteBinValues', 'gsnHistogramDiscreteClassValues', + 'gsnHistogramHorizontal', 'gsnHistogramMinMaxBinsOn', + 'gsnHistogramNumberOfBins', 'gsnHistogramPercentSign', + 'gsnHistogramSelectNiceIntervals', 'gsnLeftString', + 'gsnLeftStringFontColor', 'gsnLeftStringFontHeightF', + 'gsnLeftStringFuncCode', 'gsnLeftStringOrthogonalPosF', + 'gsnLeftStringParallelPosF', 'gsnMajorLatSpacing', + 'gsnMajorLonSpacing', 'gsnMaskLambertConformal', + 'gsnMaskLambertConformalOutlineOn', 'gsnMaximize', + 'gsnMinorLatSpacing', 'gsnMinorLonSpacing', 'gsnPanelBottom', + 'gsnPanelCenter', 'gsnPanelDebug', 'gsnPanelFigureStrings', + 'gsnPanelFigureStringsBackgroundFillColor', + 'gsnPanelFigureStringsFontHeightF', 'gsnPanelFigureStringsJust', + 'gsnPanelFigureStringsPerimOn', 'gsnPanelLabelBar', 'gsnPanelLeft', + 'gsnPanelMainFont', 'gsnPanelMainFontColor', + 'gsnPanelMainFontHeightF', 'gsnPanelMainString', 'gsnPanelRight', + 'gsnPanelRowSpec', 'gsnPanelScalePlotIndex', 'gsnPanelTop', + 'gsnPanelXF', 'gsnPanelXWhiteSpacePercent', 'gsnPanelYF', + 'gsnPanelYWhiteSpacePercent', 'gsnPaperHeight', 'gsnPaperMargin', + 'gsnPaperOrientation', 'gsnPaperWidth', 'gsnPolar', + 'gsnPolarLabelDistance', 'gsnPolarLabelFont', + 'gsnPolarLabelFontHeightF', 'gsnPolarLabelSpacing', 'gsnPolarTime', + 'gsnPolarUT', 'gsnRightString', 'gsnRightStringFontColor', + 'gsnRightStringFontHeightF', 'gsnRightStringFuncCode', + 'gsnRightStringOrthogonalPosF', 'gsnRightStringParallelPosF', + 'gsnScalarContour', 'gsnScale', 'gsnShape', 'gsnSpreadColorEnd', + 'gsnSpreadColorStart', 'gsnSpreadColors', 'gsnStringFont', + 'gsnStringFontColor', 'gsnStringFontHeightF', 'gsnStringFuncCode', + 'gsnTickMarksOn', 'gsnXAxisIrregular2Linear', 'gsnXAxisIrregular2Log', + 'gsnXRefLine', 'gsnXRefLineColor', 'gsnXRefLineDashPattern', + 'gsnXRefLineThicknessF', 'gsnXYAboveFillColors', 'gsnXYBarChart', + 'gsnXYBarChartBarWidth', 'gsnXYBarChartColors', + 'gsnXYBarChartColors2', 'gsnXYBarChartFillDotSizeF', + 'gsnXYBarChartFillLineThicknessF', 'gsnXYBarChartFillOpacityF', + 'gsnXYBarChartFillScaleF', 'gsnXYBarChartOutlineOnly', + 'gsnXYBarChartOutlineThicknessF', 'gsnXYBarChartPatterns', + 'gsnXYBarChartPatterns2', 'gsnXYBelowFillColors', 'gsnXYFillColors', + 'gsnXYFillOpacities', 'gsnXYLeftFillColors', 'gsnXYRightFillColors', + 'gsnYAxisIrregular2Linear', 'gsnYAxisIrregular2Log', 'gsnYRefLine', + 'gsnYRefLineColor', 'gsnYRefLineColors', 'gsnYRefLineDashPattern', + 'gsnYRefLineDashPatterns', 'gsnYRefLineThicknessF', + 'gsnYRefLineThicknesses', 'gsnZonalMean', 'gsnZonalMeanXMaxF', + 'gsnZonalMeanXMinF', 'gsnZonalMeanYRefLine', 'lbAutoManage', + 'lbBottomMarginF', 'lbBoxCount', 'lbBoxEndCapStyle', 'lbBoxFractions', + 'lbBoxLineColor', 'lbBoxLineDashPattern', 'lbBoxLineDashSegLenF', + 'lbBoxLineThicknessF', 'lbBoxLinesOn', 'lbBoxMajorExtentF', + 'lbBoxMinorExtentF', 'lbBoxSeparatorLinesOn', 'lbBoxSizing', + 'lbFillBackground', 'lbFillColor', 'lbFillColors', 'lbFillDotSizeF', + 'lbFillLineThicknessF', 'lbFillPattern', 'lbFillPatterns', + 'lbFillScaleF', 'lbFillScales', 'lbJustification', 'lbLabelAlignment', + 'lbLabelAngleF', 'lbLabelAutoStride', 'lbLabelBarOn', + 'lbLabelConstantSpacingF', 'lbLabelDirection', 'lbLabelFont', + 'lbLabelFontAspectF', 'lbLabelFontColor', 'lbLabelFontHeightF', + 'lbLabelFontQuality', 'lbLabelFontThicknessF', 'lbLabelFuncCode', + 'lbLabelJust', 'lbLabelOffsetF', 'lbLabelPosition', 'lbLabelStride', + 'lbLabelStrings', 'lbLabelsOn', 'lbLeftMarginF', 'lbMaxLabelLenF', + 'lbMinLabelSpacingF', 'lbMonoFillColor', 'lbMonoFillPattern', + 'lbMonoFillScale', 'lbOrientation', 'lbPerimColor', + 'lbPerimDashPattern', 'lbPerimDashSegLenF', 'lbPerimFill', + 'lbPerimFillColor', 'lbPerimOn', 'lbPerimThicknessF', + 'lbRasterFillOn', 'lbRightMarginF', 'lbTitleAngleF', + 'lbTitleConstantSpacingF', 'lbTitleDirection', 'lbTitleExtentF', + 'lbTitleFont', 'lbTitleFontAspectF', 'lbTitleFontColor', + 'lbTitleFontHeightF', 'lbTitleFontQuality', 'lbTitleFontThicknessF', + 'lbTitleFuncCode', 'lbTitleJust', 'lbTitleOffsetF', 'lbTitleOn', + 'lbTitlePosition', 'lbTitleString', 'lbTopMarginF', 'lgAutoManage', + 'lgBottomMarginF', 'lgBoxBackground', 'lgBoxLineColor', + 'lgBoxLineDashPattern', 'lgBoxLineDashSegLenF', 'lgBoxLineThicknessF', + 'lgBoxLinesOn', 'lgBoxMajorExtentF', 'lgBoxMinorExtentF', + 'lgDashIndex', 'lgDashIndexes', 'lgItemCount', 'lgItemOrder', + 'lgItemPlacement', 'lgItemPositions', 'lgItemType', 'lgItemTypes', + 'lgJustification', 'lgLabelAlignment', 'lgLabelAngleF', + 'lgLabelAutoStride', 'lgLabelConstantSpacingF', 'lgLabelDirection', + 'lgLabelFont', 'lgLabelFontAspectF', 'lgLabelFontColor', + 'lgLabelFontHeightF', 'lgLabelFontQuality', 'lgLabelFontThicknessF', + 'lgLabelFuncCode', 'lgLabelJust', 'lgLabelOffsetF', 'lgLabelPosition', + 'lgLabelStride', 'lgLabelStrings', 'lgLabelsOn', 'lgLeftMarginF', + 'lgLegendOn', 'lgLineColor', 'lgLineColors', 'lgLineDashSegLenF', + 'lgLineDashSegLens', 'lgLineLabelConstantSpacingF', 'lgLineLabelFont', + 'lgLineLabelFontAspectF', 'lgLineLabelFontColor', + 'lgLineLabelFontColors', 'lgLineLabelFontHeightF', + 'lgLineLabelFontHeights', 'lgLineLabelFontQuality', + 'lgLineLabelFontThicknessF', 'lgLineLabelFuncCode', + 'lgLineLabelStrings', 'lgLineLabelsOn', 'lgLineThicknessF', + 'lgLineThicknesses', 'lgMarkerColor', 'lgMarkerColors', + 'lgMarkerIndex', 'lgMarkerIndexes', 'lgMarkerSizeF', 'lgMarkerSizes', + 'lgMarkerThicknessF', 'lgMarkerThicknesses', 'lgMonoDashIndex', + 'lgMonoItemType', 'lgMonoLineColor', 'lgMonoLineDashSegLen', + 'lgMonoLineLabelFontColor', 'lgMonoLineLabelFontHeight', + 'lgMonoLineThickness', 'lgMonoMarkerColor', 'lgMonoMarkerIndex', + 'lgMonoMarkerSize', 'lgMonoMarkerThickness', 'lgOrientation', + 'lgPerimColor', 'lgPerimDashPattern', 'lgPerimDashSegLenF', + 'lgPerimFill', 'lgPerimFillColor', 'lgPerimOn', 'lgPerimThicknessF', + 'lgRightMarginF', 'lgTitleAngleF', 'lgTitleConstantSpacingF', + 'lgTitleDirection', 'lgTitleExtentF', 'lgTitleFont', + 'lgTitleFontAspectF', 'lgTitleFontColor', 'lgTitleFontHeightF', + 'lgTitleFontQuality', 'lgTitleFontThicknessF', 'lgTitleFuncCode', + 'lgTitleJust', 'lgTitleOffsetF', 'lgTitleOn', 'lgTitlePosition', + 'lgTitleString', 'lgTopMarginF', 'mpAreaGroupCount', + 'mpAreaMaskingOn', 'mpAreaNames', 'mpAreaTypes', 'mpBottomAngleF', + 'mpBottomMapPosF', 'mpBottomNDCF', 'mpBottomNPCF', + 'mpBottomPointLatF', 'mpBottomPointLonF', 'mpBottomWindowF', + 'mpCenterLatF', 'mpCenterLonF', 'mpCenterRotF', 'mpCountyLineColor', + 'mpCountyLineDashPattern', 'mpCountyLineDashSegLenF', + 'mpCountyLineThicknessF', 'mpDataBaseVersion', 'mpDataResolution', + 'mpDataSetName', 'mpDefaultFillColor', 'mpDefaultFillPattern', + 'mpDefaultFillScaleF', 'mpDynamicAreaGroups', 'mpEllipticalBoundary', + 'mpFillAreaSpecifiers', 'mpFillBoundarySets', 'mpFillColor', + 'mpFillColors', 'mpFillColors-default', 'mpFillDotSizeF', + 'mpFillDrawOrder', 'mpFillOn', 'mpFillPatternBackground', + 'mpFillPattern', 'mpFillPatterns', 'mpFillPatterns-default', + 'mpFillScaleF', 'mpFillScales', 'mpFillScales-default', + 'mpFixedAreaGroups', 'mpGeophysicalLineColor', + 'mpGeophysicalLineDashPattern', 'mpGeophysicalLineDashSegLenF', + 'mpGeophysicalLineThicknessF', 'mpGreatCircleLinesOn', + 'mpGridAndLimbDrawOrder', 'mpGridAndLimbOn', 'mpGridLatSpacingF', + 'mpGridLineColor', 'mpGridLineDashPattern', 'mpGridLineDashSegLenF', + 'mpGridLineThicknessF', 'mpGridLonSpacingF', 'mpGridMaskMode', + 'mpGridMaxLatF', 'mpGridPolarLonSpacingF', 'mpGridSpacingF', + 'mpInlandWaterFillColor', 'mpInlandWaterFillPattern', + 'mpInlandWaterFillScaleF', 'mpLabelDrawOrder', 'mpLabelFontColor', + 'mpLabelFontHeightF', 'mpLabelsOn', 'mpLambertMeridianF', + 'mpLambertParallel1F', 'mpLambertParallel2F', 'mpLandFillColor', + 'mpLandFillPattern', 'mpLandFillScaleF', 'mpLeftAngleF', + 'mpLeftCornerLatF', 'mpLeftCornerLonF', 'mpLeftMapPosF', + 'mpLeftNDCF', 'mpLeftNPCF', 'mpLeftPointLatF', + 'mpLeftPointLonF', 'mpLeftWindowF', 'mpLimbLineColor', + 'mpLimbLineDashPattern', 'mpLimbLineDashSegLenF', + 'mpLimbLineThicknessF', 'mpLimitMode', 'mpMaskAreaSpecifiers', + 'mpMaskOutlineSpecifiers', 'mpMaxLatF', 'mpMaxLonF', + 'mpMinLatF', 'mpMinLonF', 'mpMonoFillColor', 'mpMonoFillPattern', + 'mpMonoFillScale', 'mpNationalLineColor', 'mpNationalLineDashPattern', + 'mpNationalLineThicknessF', 'mpOceanFillColor', 'mpOceanFillPattern', + 'mpOceanFillScaleF', 'mpOutlineBoundarySets', 'mpOutlineDrawOrder', + 'mpOutlineMaskingOn', 'mpOutlineOn', 'mpOutlineSpecifiers', + 'mpPerimDrawOrder', 'mpPerimLineColor', 'mpPerimLineDashPattern', + 'mpPerimLineDashSegLenF', 'mpPerimLineThicknessF', 'mpPerimOn', + 'mpPolyMode', 'mpProjection', 'mpProvincialLineColor', + 'mpProvincialLineDashPattern', 'mpProvincialLineDashSegLenF', + 'mpProvincialLineThicknessF', 'mpRelativeCenterLat', + 'mpRelativeCenterLon', 'mpRightAngleF', 'mpRightCornerLatF', + 'mpRightCornerLonF', 'mpRightMapPosF', 'mpRightNDCF', + 'mpRightNPCF', 'mpRightPointLatF', 'mpRightPointLonF', + 'mpRightWindowF', 'mpSatelliteAngle1F', 'mpSatelliteAngle2F', + 'mpSatelliteDistF', 'mpShapeMode', 'mpSpecifiedFillColors', + 'mpSpecifiedFillDirectIndexing', 'mpSpecifiedFillPatterns', + 'mpSpecifiedFillPriority', 'mpSpecifiedFillScales', + 'mpTopAngleF', 'mpTopMapPosF', 'mpTopNDCF', 'mpTopNPCF', + 'mpTopPointLatF', 'mpTopPointLonF', 'mpTopWindowF', + 'mpUSStateLineColor', 'mpUSStateLineDashPattern', + 'mpUSStateLineDashSegLenF', 'mpUSStateLineThicknessF', + 'pmAnnoManagers', 'pmAnnoViews', 'pmLabelBarDisplayMode', + 'pmLabelBarHeightF', 'pmLabelBarKeepAspect', 'pmLabelBarOrthogonalPosF', + 'pmLabelBarParallelPosF', 'pmLabelBarSide', 'pmLabelBarWidthF', + 'pmLabelBarZone', 'pmLegendDisplayMode', 'pmLegendHeightF', + 'pmLegendKeepAspect', 'pmLegendOrthogonalPosF', + 'pmLegendParallelPosF', 'pmLegendSide', 'pmLegendWidthF', + 'pmLegendZone', 'pmOverlaySequenceIds', 'pmTickMarkDisplayMode', + 'pmTickMarkZone', 'pmTitleDisplayMode', 'pmTitleZone', + 'prGraphicStyle', 'prPolyType', 'prXArray', 'prYArray', + 'sfCopyData', 'sfDataArray', 'sfDataMaxV', 'sfDataMinV', + 'sfElementNodes', 'sfExchangeDimensions', 'sfFirstNodeIndex', + 'sfMissingValueV', 'sfXArray', 'sfXCActualEndF', 'sfXCActualStartF', + 'sfXCEndIndex', 'sfXCEndSubsetV', 'sfXCEndV', 'sfXCStartIndex', + 'sfXCStartSubsetV', 'sfXCStartV', 'sfXCStride', 'sfXCellBounds', + 'sfYArray', 'sfYCActualEndF', 'sfYCActualStartF', 'sfYCEndIndex', + 'sfYCEndSubsetV', 'sfYCEndV', 'sfYCStartIndex', 'sfYCStartSubsetV', + 'sfYCStartV', 'sfYCStride', 'sfYCellBounds', 'stArrowLengthF', + 'stArrowStride', 'stCrossoverCheckCount', + 'stExplicitLabelBarLabelsOn', 'stLabelBarEndLabelsOn', + 'stLabelFormat', 'stLengthCheckCount', 'stLevelColors', + 'stLevelCount', 'stLevelPalette', 'stLevelSelectionMode', + 'stLevelSpacingF', 'stLevels', 'stLineColor', 'stLineOpacityF', + 'stLineStartStride', 'stLineThicknessF', 'stMapDirection', + 'stMaxLevelCount', 'stMaxLevelValF', 'stMinArrowSpacingF', + 'stMinDistanceF', 'stMinLevelValF', 'stMinLineSpacingF', + 'stMinStepFactorF', 'stMonoLineColor', 'stNoDataLabelOn', + 'stNoDataLabelString', 'stScalarFieldData', 'stScalarMissingValColor', + 'stSpanLevelPalette', 'stStepSizeF', 'stStreamlineDrawOrder', + 'stUseScalarArray', 'stVectorFieldData', 'stZeroFLabelAngleF', + 'stZeroFLabelBackgroundColor', 'stZeroFLabelConstantSpacingF', + 'stZeroFLabelFont', 'stZeroFLabelFontAspectF', + 'stZeroFLabelFontColor', 'stZeroFLabelFontHeightF', + 'stZeroFLabelFontQuality', 'stZeroFLabelFontThicknessF', + 'stZeroFLabelFuncCode', 'stZeroFLabelJust', 'stZeroFLabelOn', + 'stZeroFLabelOrthogonalPosF', 'stZeroFLabelParallelPosF', + 'stZeroFLabelPerimColor', 'stZeroFLabelPerimOn', + 'stZeroFLabelPerimSpaceF', 'stZeroFLabelPerimThicknessF', + 'stZeroFLabelSide', 'stZeroFLabelString', 'stZeroFLabelTextDirection', + 'stZeroFLabelZone', 'tfDoNDCOverlay', 'tfPlotManagerOn', + 'tfPolyDrawList', 'tfPolyDrawOrder', 'tiDeltaF', 'tiMainAngleF', + 'tiMainConstantSpacingF', 'tiMainDirection', 'tiMainFont', + 'tiMainFontAspectF', 'tiMainFontColor', 'tiMainFontHeightF', + 'tiMainFontQuality', 'tiMainFontThicknessF', 'tiMainFuncCode', + 'tiMainJust', 'tiMainOffsetXF', 'tiMainOffsetYF', 'tiMainOn', + 'tiMainPosition', 'tiMainSide', 'tiMainString', 'tiUseMainAttributes', + 'tiXAxisAngleF', 'tiXAxisConstantSpacingF', 'tiXAxisDirection', + 'tiXAxisFont', 'tiXAxisFontAspectF', 'tiXAxisFontColor', + 'tiXAxisFontHeightF', 'tiXAxisFontQuality', 'tiXAxisFontThicknessF', + 'tiXAxisFuncCode', 'tiXAxisJust', 'tiXAxisOffsetXF', + 'tiXAxisOffsetYF', 'tiXAxisOn', 'tiXAxisPosition', 'tiXAxisSide', + 'tiXAxisString', 'tiYAxisAngleF', 'tiYAxisConstantSpacingF', + 'tiYAxisDirection', 'tiYAxisFont', 'tiYAxisFontAspectF', + 'tiYAxisFontColor', 'tiYAxisFontHeightF', 'tiYAxisFontQuality', + 'tiYAxisFontThicknessF', 'tiYAxisFuncCode', 'tiYAxisJust', + 'tiYAxisOffsetXF', 'tiYAxisOffsetYF', 'tiYAxisOn', 'tiYAxisPosition', + 'tiYAxisSide', 'tiYAxisString', 'tmBorderLineColor', + 'tmBorderThicknessF', 'tmEqualizeXYSizes', 'tmLabelAutoStride', + 'tmSciNoteCutoff', 'tmXBAutoPrecision', 'tmXBBorderOn', + 'tmXBDataLeftF', 'tmXBDataRightF', 'tmXBFormat', 'tmXBIrrTensionF', + 'tmXBIrregularPoints', 'tmXBLabelAngleF', 'tmXBLabelConstantSpacingF', + 'tmXBLabelDeltaF', 'tmXBLabelDirection', 'tmXBLabelFont', + 'tmXBLabelFontAspectF', 'tmXBLabelFontColor', 'tmXBLabelFontHeightF', + 'tmXBLabelFontQuality', 'tmXBLabelFontThicknessF', + 'tmXBLabelFuncCode', 'tmXBLabelJust', 'tmXBLabelStride', 'tmXBLabels', + 'tmXBLabelsOn', 'tmXBMajorLengthF', 'tmXBMajorLineColor', + 'tmXBMajorOutwardLengthF', 'tmXBMajorThicknessF', 'tmXBMaxLabelLenF', + 'tmXBMaxTicks', 'tmXBMinLabelSpacingF', 'tmXBMinorLengthF', + 'tmXBMinorLineColor', 'tmXBMinorOn', 'tmXBMinorOutwardLengthF', + 'tmXBMinorPerMajor', 'tmXBMinorThicknessF', 'tmXBMinorValues', + 'tmXBMode', 'tmXBOn', 'tmXBPrecision', 'tmXBStyle', 'tmXBTickEndF', + 'tmXBTickSpacingF', 'tmXBTickStartF', 'tmXBValues', 'tmXMajorGrid', + 'tmXMajorGridLineColor', 'tmXMajorGridLineDashPattern', + 'tmXMajorGridThicknessF', 'tmXMinorGrid', 'tmXMinorGridLineColor', + 'tmXMinorGridLineDashPattern', 'tmXMinorGridThicknessF', + 'tmXTAutoPrecision', 'tmXTBorderOn', 'tmXTDataLeftF', + 'tmXTDataRightF', 'tmXTFormat', 'tmXTIrrTensionF', + 'tmXTIrregularPoints', 'tmXTLabelAngleF', 'tmXTLabelConstantSpacingF', + 'tmXTLabelDeltaF', 'tmXTLabelDirection', 'tmXTLabelFont', + 'tmXTLabelFontAspectF', 'tmXTLabelFontColor', 'tmXTLabelFontHeightF', + 'tmXTLabelFontQuality', 'tmXTLabelFontThicknessF', + 'tmXTLabelFuncCode', 'tmXTLabelJust', 'tmXTLabelStride', 'tmXTLabels', + 'tmXTLabelsOn', 'tmXTMajorLengthF', 'tmXTMajorLineColor', + 'tmXTMajorOutwardLengthF', 'tmXTMajorThicknessF', 'tmXTMaxLabelLenF', + 'tmXTMaxTicks', 'tmXTMinLabelSpacingF', 'tmXTMinorLengthF', + 'tmXTMinorLineColor', 'tmXTMinorOn', 'tmXTMinorOutwardLengthF', + 'tmXTMinorPerMajor', 'tmXTMinorThicknessF', 'tmXTMinorValues', + 'tmXTMode', 'tmXTOn', 'tmXTPrecision', 'tmXTStyle', 'tmXTTickEndF', + 'tmXTTickSpacingF', 'tmXTTickStartF', 'tmXTValues', 'tmXUseBottom', + 'tmYLAutoPrecision', 'tmYLBorderOn', 'tmYLDataBottomF', + 'tmYLDataTopF', 'tmYLFormat', 'tmYLIrrTensionF', + 'tmYLIrregularPoints', 'tmYLLabelAngleF', 'tmYLLabelConstantSpacingF', + 'tmYLLabelDeltaF', 'tmYLLabelDirection', 'tmYLLabelFont', + 'tmYLLabelFontAspectF', 'tmYLLabelFontColor', 'tmYLLabelFontHeightF', + 'tmYLLabelFontQuality', 'tmYLLabelFontThicknessF', + 'tmYLLabelFuncCode', 'tmYLLabelJust', 'tmYLLabelStride', 'tmYLLabels', + 'tmYLLabelsOn', 'tmYLMajorLengthF', 'tmYLMajorLineColor', + 'tmYLMajorOutwardLengthF', 'tmYLMajorThicknessF', 'tmYLMaxLabelLenF', + 'tmYLMaxTicks', 'tmYLMinLabelSpacingF', 'tmYLMinorLengthF', + 'tmYLMinorLineColor', 'tmYLMinorOn', 'tmYLMinorOutwardLengthF', + 'tmYLMinorPerMajor', 'tmYLMinorThicknessF', 'tmYLMinorValues', + 'tmYLMode', 'tmYLOn', 'tmYLPrecision', 'tmYLStyle', 'tmYLTickEndF', + 'tmYLTickSpacingF', 'tmYLTickStartF', 'tmYLValues', 'tmYMajorGrid', + 'tmYMajorGridLineColor', 'tmYMajorGridLineDashPattern', + 'tmYMajorGridThicknessF', 'tmYMinorGrid', 'tmYMinorGridLineColor', + 'tmYMinorGridLineDashPattern', 'tmYMinorGridThicknessF', + 'tmYRAutoPrecision', 'tmYRBorderOn', 'tmYRDataBottomF', + 'tmYRDataTopF', 'tmYRFormat', 'tmYRIrrTensionF', + 'tmYRIrregularPoints', 'tmYRLabelAngleF', 'tmYRLabelConstantSpacingF', + 'tmYRLabelDeltaF', 'tmYRLabelDirection', 'tmYRLabelFont', + 'tmYRLabelFontAspectF', 'tmYRLabelFontColor', 'tmYRLabelFontHeightF', + 'tmYRLabelFontQuality', 'tmYRLabelFontThicknessF', + 'tmYRLabelFuncCode', 'tmYRLabelJust', 'tmYRLabelStride', 'tmYRLabels', + 'tmYRLabelsOn', 'tmYRMajorLengthF', 'tmYRMajorLineColor', + 'tmYRMajorOutwardLengthF', 'tmYRMajorThicknessF', 'tmYRMaxLabelLenF', + 'tmYRMaxTicks', 'tmYRMinLabelSpacingF', 'tmYRMinorLengthF', + 'tmYRMinorLineColor', 'tmYRMinorOn', 'tmYRMinorOutwardLengthF', + 'tmYRMinorPerMajor', 'tmYRMinorThicknessF', 'tmYRMinorValues', + 'tmYRMode', 'tmYROn', 'tmYRPrecision', 'tmYRStyle', 'tmYRTickEndF', + 'tmYRTickSpacingF', 'tmYRTickStartF', 'tmYRValues', 'tmYUseLeft', + 'trGridType', 'trLineInterpolationOn', + 'trXAxisType', 'trXCoordPoints', 'trXInterPoints', 'trXLog', + 'trXMaxF', 'trXMinF', 'trXReverse', 'trXSamples', 'trXTensionF', + 'trYAxisType', 'trYCoordPoints', 'trYInterPoints', 'trYLog', + 'trYMaxF', 'trYMinF', 'trYReverse', 'trYSamples', 'trYTensionF', + 'txAngleF', 'txBackgroundFillColor', 'txConstantSpacingF', 'txDirection', + 'txFont', 'HLU-Fonts', 'txFontAspectF', 'txFontColor', + 'txFontHeightF', 'txFontOpacityF', 'txFontQuality', + 'txFontThicknessF', 'txFuncCode', 'txJust', 'txPerimColor', + 'txPerimDashLengthF', 'txPerimDashPattern', 'txPerimOn', + 'txPerimSpaceF', 'txPerimThicknessF', 'txPosXF', 'txPosYF', + 'txString', 'vcExplicitLabelBarLabelsOn', 'vcFillArrowEdgeColor', + 'vcFillArrowEdgeThicknessF', 'vcFillArrowFillColor', + 'vcFillArrowHeadInteriorXF', 'vcFillArrowHeadMinFracXF', + 'vcFillArrowHeadMinFracYF', 'vcFillArrowHeadXF', 'vcFillArrowHeadYF', + 'vcFillArrowMinFracWidthF', 'vcFillArrowWidthF', 'vcFillArrowsOn', + 'vcFillOverEdge', 'vcGlyphOpacityF', 'vcGlyphStyle', + 'vcLabelBarEndLabelsOn', 'vcLabelFontColor', 'vcLabelFontHeightF', + 'vcLabelsOn', 'vcLabelsUseVectorColor', 'vcLevelColors', + 'vcLevelCount', 'vcLevelPalette', 'vcLevelSelectionMode', + 'vcLevelSpacingF', 'vcLevels', 'vcLineArrowColor', + 'vcLineArrowHeadMaxSizeF', 'vcLineArrowHeadMinSizeF', + 'vcLineArrowThicknessF', 'vcMagnitudeFormat', + 'vcMagnitudeScaleFactorF', 'vcMagnitudeScaleValueF', + 'vcMagnitudeScalingMode', 'vcMapDirection', 'vcMaxLevelCount', + 'vcMaxLevelValF', 'vcMaxMagnitudeF', 'vcMinAnnoAngleF', + 'vcMinAnnoArrowAngleF', 'vcMinAnnoArrowEdgeColor', + 'vcMinAnnoArrowFillColor', 'vcMinAnnoArrowLineColor', + 'vcMinAnnoArrowMinOffsetF', 'vcMinAnnoArrowSpaceF', + 'vcMinAnnoArrowUseVecColor', 'vcMinAnnoBackgroundColor', + 'vcMinAnnoConstantSpacingF', 'vcMinAnnoExplicitMagnitudeF', + 'vcMinAnnoFont', 'vcMinAnnoFontAspectF', 'vcMinAnnoFontColor', + 'vcMinAnnoFontHeightF', 'vcMinAnnoFontQuality', + 'vcMinAnnoFontThicknessF', 'vcMinAnnoFuncCode', 'vcMinAnnoJust', + 'vcMinAnnoOn', 'vcMinAnnoOrientation', 'vcMinAnnoOrthogonalPosF', + 'vcMinAnnoParallelPosF', 'vcMinAnnoPerimColor', 'vcMinAnnoPerimOn', + 'vcMinAnnoPerimSpaceF', 'vcMinAnnoPerimThicknessF', 'vcMinAnnoSide', + 'vcMinAnnoString1', 'vcMinAnnoString1On', 'vcMinAnnoString2', + 'vcMinAnnoString2On', 'vcMinAnnoTextDirection', 'vcMinAnnoZone', + 'vcMinDistanceF', 'vcMinFracLengthF', 'vcMinLevelValF', + 'vcMinMagnitudeF', 'vcMonoFillArrowEdgeColor', + 'vcMonoFillArrowFillColor', 'vcMonoLineArrowColor', + 'vcMonoWindBarbColor', 'vcNoDataLabelOn', 'vcNoDataLabelString', + 'vcPositionMode', 'vcRefAnnoAngleF', 'vcRefAnnoArrowAngleF', + 'vcRefAnnoArrowEdgeColor', 'vcRefAnnoArrowFillColor', + 'vcRefAnnoArrowLineColor', 'vcRefAnnoArrowMinOffsetF', + 'vcRefAnnoArrowSpaceF', 'vcRefAnnoArrowUseVecColor', + 'vcRefAnnoBackgroundColor', 'vcRefAnnoConstantSpacingF', + 'vcRefAnnoExplicitMagnitudeF', 'vcRefAnnoFont', + 'vcRefAnnoFontAspectF', 'vcRefAnnoFontColor', 'vcRefAnnoFontHeightF', + 'vcRefAnnoFontQuality', 'vcRefAnnoFontThicknessF', + 'vcRefAnnoFuncCode', 'vcRefAnnoJust', 'vcRefAnnoOn', + 'vcRefAnnoOrientation', 'vcRefAnnoOrthogonalPosF', + 'vcRefAnnoParallelPosF', 'vcRefAnnoPerimColor', 'vcRefAnnoPerimOn', + 'vcRefAnnoPerimSpaceF', 'vcRefAnnoPerimThicknessF', 'vcRefAnnoSide', + 'vcRefAnnoString1', 'vcRefAnnoString1On', 'vcRefAnnoString2', + 'vcRefAnnoString2On', 'vcRefAnnoTextDirection', 'vcRefAnnoZone', + 'vcRefLengthF', 'vcRefMagnitudeF', 'vcScalarFieldData', + 'vcScalarMissingValColor', 'vcScalarValueFormat', + 'vcScalarValueScaleFactorF', 'vcScalarValueScaleValueF', + 'vcScalarValueScalingMode', 'vcSpanLevelPalette', 'vcUseRefAnnoRes', + 'vcUseScalarArray', 'vcVectorDrawOrder', 'vcVectorFieldData', + 'vcWindBarbCalmCircleSizeF', 'vcWindBarbColor', + 'vcWindBarbLineThicknessF', 'vcWindBarbScaleFactorF', + 'vcWindBarbTickAngleF', 'vcWindBarbTickLengthF', + 'vcWindBarbTickSpacingF', 'vcZeroFLabelAngleF', + 'vcZeroFLabelBackgroundColor', 'vcZeroFLabelConstantSpacingF', + 'vcZeroFLabelFont', 'vcZeroFLabelFontAspectF', + 'vcZeroFLabelFontColor', 'vcZeroFLabelFontHeightF', + 'vcZeroFLabelFontQuality', 'vcZeroFLabelFontThicknessF', + 'vcZeroFLabelFuncCode', 'vcZeroFLabelJust', 'vcZeroFLabelOn', + 'vcZeroFLabelOrthogonalPosF', 'vcZeroFLabelParallelPosF', + 'vcZeroFLabelPerimColor', 'vcZeroFLabelPerimOn', + 'vcZeroFLabelPerimSpaceF', 'vcZeroFLabelPerimThicknessF', + 'vcZeroFLabelSide', 'vcZeroFLabelString', 'vcZeroFLabelTextDirection', + 'vcZeroFLabelZone', 'vfCopyData', 'vfDataArray', + 'vfExchangeDimensions', 'vfExchangeUVData', 'vfMagMaxV', 'vfMagMinV', + 'vfMissingUValueV', 'vfMissingVValueV', 'vfPolarData', + 'vfSingleMissingValue', 'vfUDataArray', 'vfUMaxV', 'vfUMinV', + 'vfVDataArray', 'vfVMaxV', 'vfVMinV', 'vfXArray', 'vfXCActualEndF', + 'vfXCActualStartF', 'vfXCEndIndex', 'vfXCEndSubsetV', 'vfXCEndV', + 'vfXCStartIndex', 'vfXCStartSubsetV', 'vfXCStartV', 'vfXCStride', + 'vfYArray', 'vfYCActualEndF', 'vfYCActualStartF', 'vfYCEndIndex', + 'vfYCEndSubsetV', 'vfYCEndV', 'vfYCStartIndex', 'vfYCStartSubsetV', + 'vfYCStartV', 'vfYCStride', 'vpAnnoManagerId', 'vpClipOn', + 'vpHeightF', 'vpKeepAspect', 'vpOn', 'vpUseSegments', 'vpWidthF', + 'vpXF', 'vpYF', 'wkAntiAlias', 'wkBackgroundColor', 'wkBackgroundOpacityF', + 'wkColorMapLen', 'wkColorMap', 'wkColorModel', 'wkDashTableLength', + 'wkDefGraphicStyleId', 'wkDeviceLowerX', 'wkDeviceLowerY', + 'wkDeviceUpperX', 'wkDeviceUpperY', 'wkFileName', 'wkFillTableLength', + 'wkForegroundColor', 'wkFormat', 'wkFullBackground', 'wkGksWorkId', + 'wkHeight', 'wkMarkerTableLength', 'wkMetaName', 'wkOrientation', + 'wkPDFFileName', 'wkPDFFormat', 'wkPDFResolution', 'wkPSFileName', + 'wkPSFormat', 'wkPSResolution', 'wkPaperHeightF', 'wkPaperSize', + 'wkPaperWidthF', 'wkPause', 'wkTopLevelViews', 'wkViews', + 'wkVisualType', 'wkWidth', 'wkWindowId', 'wkXColorMode', 'wsCurrentSize', + 'wsMaximumSize', 'wsThresholdSize', 'xyComputeXMax', + 'xyComputeXMin', 'xyComputeYMax', 'xyComputeYMin', 'xyCoordData', + 'xyCoordDataSpec', 'xyCurveDrawOrder', 'xyDashPattern', + 'xyDashPatterns', 'xyExplicitLabels', 'xyExplicitLegendLabels', + 'xyLabelMode', 'xyLineColor', 'xyLineColors', 'xyLineDashSegLenF', + 'xyLineLabelConstantSpacingF', 'xyLineLabelFont', + 'xyLineLabelFontAspectF', 'xyLineLabelFontColor', + 'xyLineLabelFontColors', 'xyLineLabelFontHeightF', + 'xyLineLabelFontQuality', 'xyLineLabelFontThicknessF', + 'xyLineLabelFuncCode', 'xyLineThicknessF', 'xyLineThicknesses', + 'xyMarkLineMode', 'xyMarkLineModes', 'xyMarker', 'xyMarkerColor', + 'xyMarkerColors', 'xyMarkerSizeF', 'xyMarkerSizes', + 'xyMarkerThicknessF', 'xyMarkerThicknesses', 'xyMarkers', + 'xyMonoDashPattern', 'xyMonoLineColor', 'xyMonoLineLabelFontColor', + 'xyMonoLineThickness', 'xyMonoMarkLineMode', 'xyMonoMarker', + 'xyMonoMarkerColor', 'xyMonoMarkerSize', 'xyMonoMarkerThickness', + 'xyXIrrTensionF', 'xyXIrregularPoints', 'xyXStyle', 'xyYIrrTensionF', + 'xyYIrregularPoints', 'xyYStyle'), prefix=r'\b'), + Name.Builtin), + + # Booleans + (r'\.(True|False)\.', Name.Builtin), + # Comparing Operators + (r'\.(eq|ne|lt|le|gt|ge|not|and|or|xor)\.', Operator.Word), + ], + + 'strings': [ + (r'(?s)"(\\\\|\\[0-7]+|\\.|[^"\\])*"', String.Double), + ], + + 'nums': [ + (r'\d+(?![.e])(_[a-z]\w+)?', Number.Integer), + (r'[+-]?\d*\.\d+(e[-+]?\d+)?(_[a-z]\w+)?', Number.Float), + (r'[+-]?\d+\.\d*(e[-+]?\d+)?(_[a-z]\w+)?', Number.Float), + ], + } diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/nimrod.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/nimrod.py new file mode 100644 index 0000000000000000000000000000000000000000..d438c1bfc1ca4f43d3c27a86df229e8642f3df8d --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/nimrod.py @@ -0,0 +1,159 @@ +# -*- coding: utf-8 -*- +""" + pygments.lexers.nimrod + ~~~~~~~~~~~~~~~~~~~~~~ + + Lexer for the Nim language (formerly known as Nimrod). + + :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS. + :license: BSD, see LICENSE for details. +""" + +import re + +from pygments.lexer import RegexLexer, include, default +from pygments.token import Text, Comment, Operator, Keyword, Name, String, \ + Number, Punctuation, Error + +__all__ = ['NimrodLexer'] + + +class NimrodLexer(RegexLexer): + """ + For `Nim `_ source code. + + .. versionadded:: 1.5 + """ + + name = 'Nimrod' + aliases = ['nim', 'nimrod'] + filenames = ['*.nim', '*.nimrod'] + mimetypes = ['text/x-nim'] + + flags = re.MULTILINE | re.IGNORECASE | re.UNICODE + + def underscorize(words): + newWords = [] + new = "" + for word in words: + for ch in word: + new += (ch + "_?") + newWords.append(new) + new = "" + return "|".join(newWords) + + keywords = [ + 'addr', 'and', 'as', 'asm', 'atomic', 'bind', 'block', 'break', 'case', + 'cast', 'concept', 'const', 'continue', 'converter', 'defer', 'discard', + 'distinct', 'div', 'do', 'elif', 'else', 'end', 'enum', 'except', + 'export', 'finally', 'for', 'func', 'if', 'in', 'yield', 'interface', + 'is', 'isnot', 'iterator', 'let', 'macro', 'method', 'mixin', 'mod', + 'not', 'notin', 'object', 'of', 'or', 'out', 'proc', 'ptr', 'raise', + 'ref', 'return', 'shared', 'shl', 'shr', 'static', 'template', 'try', + 'tuple', 'type', 'when', 'while', 'with', 'without', 'xor' + ] + + keywordsPseudo = [ + 'nil', 'true', 'false' + ] + + opWords = [ + 'and', 'or', 'not', 'xor', 'shl', 'shr', 'div', 'mod', 'in', + 'notin', 'is', 'isnot' + ] + + types = [ + 'int', 'int8', 'int16', 'int32', 'int64', 'float', 'float32', 'float64', + 'bool', 'char', 'range', 'array', 'seq', 'set', 'string' + ] + + tokens = { + 'root': [ + (r'##.*$', String.Doc), + (r'#.*$', Comment), + (r'[*=><+\-/@$~&%!?|\\\[\]]', Operator), + (r'\.\.|\.|,|\[\.|\.\]|\{\.|\.\}|\(\.|\.\)|\{|\}|\(|\)|:|\^|`|;', + Punctuation), + + # Strings + (r'(?:[\w]+)"', String, 'rdqs'), + (r'"""', String, 'tdqs'), + ('"', String, 'dqs'), + + # Char + ("'", String.Char, 'chars'), + + # Keywords + (r'(%s)\b' % underscorize(opWords), Operator.Word), + (r'(p_?r_?o_?c_?\s)(?![(\[\]])', Keyword, 'funcname'), + (r'(%s)\b' % underscorize(keywords), Keyword), + (r'(%s)\b' % underscorize(['from', 'import', 'include']), + Keyword.Namespace), + (r'(v_?a_?r)\b', Keyword.Declaration), + (r'(%s)\b' % underscorize(types), Keyword.Type), + (r'(%s)\b' % underscorize(keywordsPseudo), Keyword.Pseudo), + # Identifiers + (r'\b((?![_\d])\w)(((?!_)\w)|(_(?!_)\w))*', Name), + # Numbers + (r'[0-9][0-9_]*(?=([e.]|\'f(32|64)))', + Number.Float, ('float-suffix', 'float-number')), + (r'0x[a-f0-9][a-f0-9_]*', Number.Hex, 'int-suffix'), + (r'0b[01][01_]*', Number.Bin, 'int-suffix'), + (r'0o[0-7][0-7_]*', Number.Oct, 'int-suffix'), + (r'[0-9][0-9_]*', Number.Integer, 'int-suffix'), + # Whitespace + (r'\s+', Text), + (r'.+$', Error), + ], + 'chars': [ + (r'\\([\\abcefnrtvl"\']|x[a-f0-9]{2}|[0-9]{1,3})', String.Escape), + (r"'", String.Char, '#pop'), + (r".", String.Char) + ], + 'strings': [ + (r'(?`_ source. + + .. versionadded:: 2.0 + """ + + name = 'Nit' + aliases = ['nit'] + filenames = ['*.nit'] + tokens = { + 'root': [ + (r'#.*?$', Comment.Single), + (words(( + 'package', 'module', 'import', 'class', 'abstract', 'interface', + 'universal', 'enum', 'end', 'fun', 'type', 'init', 'redef', + 'isa', 'do', 'readable', 'writable', 'var', 'intern', 'extern', + 'public', 'protected', 'private', 'intrude', 'if', 'then', + 'else', 'while', 'loop', 'for', 'in', 'and', 'or', 'not', + 'implies', 'return', 'continue', 'break', 'abort', 'assert', + 'new', 'is', 'once', 'super', 'self', 'true', 'false', 'nullable', + 'null', 'as', 'isset', 'label', '__debug__'), suffix=r'(?=[\r\n\t( ])'), + Keyword), + (r'[A-Z]\w*', Name.Class), + (r'"""(([^\'\\]|\\.)|\\r|\\n)*((\{\{?)?(""?\{\{?)*""""*)', String), # Simple long string + (r'\'\'\'(((\\.|[^\'\\])|\\r|\\n)|\'((\\.|[^\'\\])|\\r|\\n)|' + r'\'\'((\\.|[^\'\\])|\\r|\\n))*\'\'\'', String), # Simple long string alt + (r'"""(([^\'\\]|\\.)|\\r|\\n)*((""?)?(\{\{?""?)*\{\{\{\{*)', String), # Start long string + (r'\}\}\}(((\\.|[^\'\\])|\\r|\\n))*(""?)?(\{\{?""?)*\{\{\{\{*', String), # Mid long string + (r'\}\}\}(((\\.|[^\'\\])|\\r|\\n))*(\{\{?)?(""?\{\{?)*""""*', String), # End long string + (r'"(\\.|([^"}{\\]))*"', String), # Simple String + (r'"(\\.|([^"}{\\]))*\{', String), # Start string + (r'\}(\\.|([^"}{\\]))*\{', String), # Mid String + (r'\}(\\.|([^"}{\\]))*"', String), # End String + (r'(\'[^\'\\]\')|(\'\\.\')', String.Char), + (r'[0-9]+', Number.Integer), + (r'[0-9]*.[0-9]+', Number.Float), + (r'0(x|X)[0-9A-Fa-f]+', Number.Hex), + (r'[a-z]\w*', Name), + (r'_\w+', Name.Variable.Instance), + (r'==|!=|<==>|>=|>>|>|<=|<<|<|\+|-|=|/|\*|%|\+=|-=|!|@', Operator), + (r'\(|\)|\[|\]|,|\.\.\.|\.\.|\.|::|:', Punctuation), + (r'`\{[^`]*`\}', Text), # Extern blocks won't be Lexed by Nit + (r'[\r\n\t ]+', Text), + ], + } diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/nix.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/nix.py new file mode 100644 index 0000000000000000000000000000000000000000..e148c9193886e50d60b4fba27dfac5ecc05f1055 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/nix.py @@ -0,0 +1,136 @@ +# -*- coding: utf-8 -*- +""" + pygments.lexers.nix + ~~~~~~~~~~~~~~~~~~~ + + Lexers for the NixOS Nix language. + + :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS. + :license: BSD, see LICENSE for details. +""" + +import re + +from pygments.lexer import RegexLexer, include +from pygments.token import Text, Comment, Operator, Keyword, Name, String, \ + Number, Punctuation, Literal + +__all__ = ['NixLexer'] + + +class NixLexer(RegexLexer): + """ + For the `Nix language `_. + + .. versionadded:: 2.0 + """ + + name = 'Nix' + aliases = ['nixos', 'nix'] + filenames = ['*.nix'] + mimetypes = ['text/x-nix'] + + flags = re.MULTILINE | re.UNICODE + + keywords = ['rec', 'with', 'let', 'in', 'inherit', 'assert', 'if', + 'else', 'then', '...'] + builtins = ['import', 'abort', 'baseNameOf', 'dirOf', 'isNull', 'builtins', + 'map', 'removeAttrs', 'throw', 'toString', 'derivation'] + operators = ['++', '+', '?', '.', '!', '//', '==', + '!=', '&&', '||', '->', '='] + + punctuations = ["(", ")", "[", "]", ";", "{", "}", ":", ",", "@"] + + tokens = { + 'root': [ + # comments starting with # + (r'#.*$', Comment.Single), + + # multiline comments + (r'/\*', Comment.Multiline, 'comment'), + + # whitespace + (r'\s+', Text), + + # keywords + ('(%s)' % '|'.join(re.escape(entry) + '\\b' for entry in keywords), Keyword), + + # highlight the builtins + ('(%s)' % '|'.join(re.escape(entry) + '\\b' for entry in builtins), + Name.Builtin), + + (r'\b(true|false|null)\b', Name.Constant), + + # operators + ('(%s)' % '|'.join(re.escape(entry) for entry in operators), + Operator), + + # word operators + (r'\b(or|and)\b', Operator.Word), + + # punctuations + ('(%s)' % '|'.join(re.escape(entry) for entry in punctuations), Punctuation), + + # integers + (r'[0-9]+', Number.Integer), + + # strings + (r'"', String.Double, 'doublequote'), + (r"''", String.Single, 'singlequote'), + + # paths + (r'[\w.+-]*(\/[\w.+-]+)+', Literal), + (r'\<[\w.+-]+(\/[\w.+-]+)*\>', Literal), + + # urls + (r'[a-zA-Z][a-zA-Z0-9\+\-\.]*\:[\w%/?:@&=+$,\\.!~*\'-]+', Literal), + + # names of variables + (r'[\w-]+\s*=', String.Symbol), + (r'[a-zA-Z_][\w\'-]*', Text), + + ], + 'comment': [ + (r'[^/*]+', Comment.Multiline), + (r'/\*', Comment.Multiline, '#push'), + (r'\*/', Comment.Multiline, '#pop'), + (r'[*/]', Comment.Multiline), + ], + 'singlequote': [ + (r"'''", String.Escape), + (r"''\$\{", String.Escape), + (r"''\n", String.Escape), + (r"''\r", String.Escape), + (r"''\t", String.Escape), + (r"''", String.Single, '#pop'), + (r'\$\{', String.Interpol, 'antiquote'), + (r"[^']", String.Single), + ], + 'doublequote': [ + (r'\\', String.Escape), + (r'\\"', String.Escape), + (r'\\$\{', String.Escape), + (r'"', String.Double, '#pop'), + (r'\$\{', String.Interpol, 'antiquote'), + (r'[^"]', String.Double), + ], + 'antiquote': [ + (r"\}", String.Interpol, '#pop'), + # TODO: we should probably escape also here ''${ \${ + (r"\$\{", String.Interpol, '#push'), + include('root'), + ], + } + + def analyse_text(text): + rv = 0.0 + # TODO: let/in + if re.search(r'import.+?<[^>]+>', text): + rv += 0.4 + if re.search(r'mkDerivation\s+(\(|\{|rec)', text): + rv += 0.4 + if re.search(r'=\s+mkIf\s+', text): + rv += 0.4 + if re.search(r'\{[a-zA-Z,\s]+\}:', text): + rv += 0.1 + return rv diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/oberon.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/oberon.py new file mode 100644 index 0000000000000000000000000000000000000000..3b5fb3e4ba3e2dc354a34a7924ee787fe857deb7 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/oberon.py @@ -0,0 +1,105 @@ +# -*- coding: utf-8 -*- +""" + pygments.lexers.oberon + ~~~~~~~~~~~~~~~~~~~~~~ + + Lexers for Oberon family languages. + + :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS. + :license: BSD, see LICENSE for details. +""" + +import re + +from pygments.lexer import RegexLexer, include, words +from pygments.token import Text, Comment, Operator, Keyword, Name, String, \ + Number, Punctuation + +__all__ = ['ComponentPascalLexer'] + + +class ComponentPascalLexer(RegexLexer): + """ + For `Component Pascal `_ source code. + + .. versionadded:: 2.1 + """ + name = 'Component Pascal' + aliases = ['componentpascal', 'cp'] + filenames = ['*.cp', '*.cps'] + mimetypes = ['text/x-component-pascal'] + + flags = re.MULTILINE | re.DOTALL + + tokens = { + 'root': [ + include('whitespace'), + include('comments'), + include('punctuation'), + include('numliterals'), + include('strings'), + include('operators'), + include('builtins'), + include('identifiers'), + ], + 'whitespace': [ + (r'\n+', Text), # blank lines + (r'\s+', Text), # whitespace + ], + 'comments': [ + (r'\(\*([^$].*?)\*\)', Comment.Multiline), + # TODO: nested comments (* (* ... *) ... (* ... *) *) not supported! + ], + 'punctuation': [ + (r'[()\[\]{},.:;|]', Punctuation), + ], + 'numliterals': [ + (r'[0-9A-F]+X\b', Number.Hex), # char code + (r'[0-9A-F]+[HL]\b', Number.Hex), # hexadecimal number + (r'[0-9]+\.[0-9]+E[+-][0-9]+', Number.Float), # real number + (r'[0-9]+\.[0-9]+', Number.Float), # real number + (r'[0-9]+', Number.Integer), # decimal whole number + ], + 'strings': [ + (r"'[^\n']*'", String), # single quoted string + (r'"[^\n"]*"', String), # double quoted string + ], + 'operators': [ + # Arithmetic Operators + (r'[+-]', Operator), + (r'[*/]', Operator), + # Relational Operators + (r'[=#<>]', Operator), + # Dereferencing Operator + (r'\^', Operator), + # Logical AND Operator + (r'&', Operator), + # Logical NOT Operator + (r'~', Operator), + # Assignment Symbol + (r':=', Operator), + # Range Constructor + (r'\.\.', Operator), + (r'\$', Operator), + ], + 'identifiers': [ + (r'([a-zA-Z_$][\w$]*)', Name), + ], + 'builtins': [ + (words(( + 'ANYPTR', 'ANYREC', 'BOOLEAN', 'BYTE', 'CHAR', 'INTEGER', 'LONGINT', + 'REAL', 'SET', 'SHORTCHAR', 'SHORTINT', 'SHORTREAL' + ), suffix=r'\b'), Keyword.Type), + (words(( + 'ABS', 'ABSTRACT', 'ARRAY', 'ASH', 'ASSERT', 'BEGIN', 'BITS', 'BY', + 'CAP', 'CASE', 'CHR', 'CLOSE', 'CONST', 'DEC', 'DIV', 'DO', 'ELSE', + 'ELSIF', 'EMPTY', 'END', 'ENTIER', 'EXCL', 'EXIT', 'EXTENSIBLE', 'FOR', + 'HALT', 'IF', 'IMPORT', 'IN', 'INC', 'INCL', 'IS', 'LEN', 'LIMITED', + 'LONG', 'LOOP', 'MAX', 'MIN', 'MOD', 'MODULE', 'NEW', 'ODD', 'OF', + 'OR', 'ORD', 'OUT', 'POINTER', 'PROCEDURE', 'RECORD', 'REPEAT', 'RETURN', + 'SHORT', 'SHORTCHAR', 'SHORTINT', 'SIZE', 'THEN', 'TYPE', 'TO', 'UNTIL', + 'VAR', 'WHILE', 'WITH' + ), suffix=r'\b'), Keyword.Reserved), + (r'(TRUE|FALSE|NIL|INF)\b', Keyword.Constant), + ] + } diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/objective.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/objective.py new file mode 100644 index 0000000000000000000000000000000000000000..7807255e6696adf3f7bc8b1ed457774098fc8d70 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/objective.py @@ -0,0 +1,504 @@ +# -*- coding: utf-8 -*- +""" + pygments.lexers.objective + ~~~~~~~~~~~~~~~~~~~~~~~~~ + + Lexers for Objective-C family languages. + + :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS. + :license: BSD, see LICENSE for details. +""" + +import re + +from pygments.lexer import RegexLexer, include, bygroups, using, this, words, \ + inherit, default +from pygments.token import Text, Keyword, Name, String, Operator, \ + Number, Punctuation, Literal, Comment + +from pygments.lexers.c_cpp import CLexer, CppLexer + +__all__ = ['ObjectiveCLexer', 'ObjectiveCppLexer', 'LogosLexer', 'SwiftLexer'] + + +def objective(baselexer): + """ + Generate a subclass of baselexer that accepts the Objective-C syntax + extensions. + """ + + # Have to be careful not to accidentally match JavaDoc/Doxygen syntax here, + # since that's quite common in ordinary C/C++ files. It's OK to match + # JavaDoc/Doxygen keywords that only apply to Objective-C, mind. + # + # The upshot of this is that we CANNOT match @class or @interface + _oc_keywords = re.compile(r'@(?:end|implementation|protocol)') + + # Matches [ ? identifier ( identifier ? ] | identifier? : ) + # (note the identifier is *optional* when there is a ':'!) + _oc_message = re.compile(r'\[\s*[a-zA-Z_]\w*\s+' + r'(?:[a-zA-Z_]\w*\s*\]|' + r'(?:[a-zA-Z_]\w*)?:)') + + class GeneratedObjectiveCVariant(baselexer): + """ + Implements Objective-C syntax on top of an existing C family lexer. + """ + + tokens = { + 'statements': [ + (r'@"', String, 'string'), + (r'@(YES|NO)', Number), + (r"@'(\\.|\\[0-7]{1,3}|\\x[a-fA-F0-9]{1,2}|[^\\\'\n])'", String.Char), + (r'@(\d+\.\d*|\.\d+|\d+)[eE][+-]?\d+[lL]?', Number.Float), + (r'@(\d+\.\d*|\.\d+|\d+[fF])[fF]?', Number.Float), + (r'@0x[0-9a-fA-F]+[Ll]?', Number.Hex), + (r'@0[0-7]+[Ll]?', Number.Oct), + (r'@\d+[Ll]?', Number.Integer), + (r'@\(', Literal, 'literal_number'), + (r'@\[', Literal, 'literal_array'), + (r'@\{', Literal, 'literal_dictionary'), + (words(( + '@selector', '@private', '@protected', '@public', '@encode', + '@synchronized', '@try', '@throw', '@catch', '@finally', + '@end', '@property', '@synthesize', '__bridge', '__bridge_transfer', + '__autoreleasing', '__block', '__weak', '__strong', 'weak', 'strong', + 'copy', 'retain', 'assign', 'unsafe_unretained', 'atomic', 'nonatomic', + 'readonly', 'readwrite', 'setter', 'getter', 'typeof', 'in', + 'out', 'inout', 'release', 'class', '@dynamic', '@optional', + '@required', '@autoreleasepool'), suffix=r'\b'), + Keyword), + (words(('id', 'instancetype', 'Class', 'IMP', 'SEL', 'BOOL', + 'IBOutlet', 'IBAction', 'unichar'), suffix=r'\b'), + Keyword.Type), + (r'@(true|false|YES|NO)\n', Name.Builtin), + (r'(YES|NO|nil|self|super)\b', Name.Builtin), + # Carbon types + (r'(Boolean|UInt8|SInt8|UInt16|SInt16|UInt32|SInt32)\b', Keyword.Type), + # Carbon built-ins + (r'(TRUE|FALSE)\b', Name.Builtin), + (r'(@interface|@implementation)(\s+)', bygroups(Keyword, Text), + ('#pop', 'oc_classname')), + (r'(@class|@protocol)(\s+)', bygroups(Keyword, Text), + ('#pop', 'oc_forward_classname')), + # @ can also prefix other expressions like @{...} or @(...) + (r'@', Punctuation), + inherit, + ], + 'oc_classname': [ + # interface definition that inherits + ('([a-zA-Z$_][\w$]*)(\s*:\s*)([a-zA-Z$_][\w$]*)?(\s*)(\{)', + bygroups(Name.Class, Text, Name.Class, Text, Punctuation), + ('#pop', 'oc_ivars')), + ('([a-zA-Z$_][\w$]*)(\s*:\s*)([a-zA-Z$_][\w$]*)?', + bygroups(Name.Class, Text, Name.Class), '#pop'), + # interface definition for a category + ('([a-zA-Z$_][\w$]*)(\s*)(\([a-zA-Z$_][\w$]*\))(\s*)(\{)', + bygroups(Name.Class, Text, Name.Label, Text, Punctuation), + ('#pop', 'oc_ivars')), + ('([a-zA-Z$_][\w$]*)(\s*)(\([a-zA-Z$_][\w$]*\))', + bygroups(Name.Class, Text, Name.Label), '#pop'), + # simple interface / implementation + ('([a-zA-Z$_][\w$]*)(\s*)(\{)', + bygroups(Name.Class, Text, Punctuation), ('#pop', 'oc_ivars')), + ('([a-zA-Z$_][\w$]*)', Name.Class, '#pop') + ], + 'oc_forward_classname': [ + ('([a-zA-Z$_][\w$]*)(\s*,\s*)', + bygroups(Name.Class, Text), 'oc_forward_classname'), + ('([a-zA-Z$_][\w$]*)(\s*;?)', + bygroups(Name.Class, Text), '#pop') + ], + 'oc_ivars': [ + include('whitespace'), + include('statements'), + (';', Punctuation), + (r'\{', Punctuation, '#push'), + (r'\}', Punctuation, '#pop'), + ], + 'root': [ + # methods + (r'^([-+])(\s*)' # method marker + r'(\(.*?\))?(\s*)' # return type + r'([a-zA-Z$_][\w$]*:?)', # begin of method name + bygroups(Punctuation, Text, using(this), + Text, Name.Function), + 'method'), + inherit, + ], + 'method': [ + include('whitespace'), + # TODO unsure if ellipses are allowed elsewhere, see + # discussion in Issue 789 + (r',', Punctuation), + (r'\.\.\.', Punctuation), + (r'(\(.*?\))(\s*)([a-zA-Z$_][\w$]*)', + bygroups(using(this), Text, Name.Variable)), + (r'[a-zA-Z$_][\w$]*:', Name.Function), + (';', Punctuation, '#pop'), + (r'\{', Punctuation, 'function'), + default('#pop'), + ], + 'literal_number': [ + (r'\(', Punctuation, 'literal_number_inner'), + (r'\)', Literal, '#pop'), + include('statement'), + ], + 'literal_number_inner': [ + (r'\(', Punctuation, '#push'), + (r'\)', Punctuation, '#pop'), + include('statement'), + ], + 'literal_array': [ + (r'\[', Punctuation, 'literal_array_inner'), + (r'\]', Literal, '#pop'), + include('statement'), + ], + 'literal_array_inner': [ + (r'\[', Punctuation, '#push'), + (r'\]', Punctuation, '#pop'), + include('statement'), + ], + 'literal_dictionary': [ + (r'\}', Literal, '#pop'), + include('statement'), + ], + } + + def analyse_text(text): + if _oc_keywords.search(text): + return 1.0 + elif '@"' in text: # strings + return 0.8 + elif re.search('@[0-9]+', text): + return 0.7 + elif _oc_message.search(text): + return 0.8 + return 0 + + def get_tokens_unprocessed(self, text): + from pygments.lexers._cocoa_builtins import COCOA_INTERFACES, \ + COCOA_PROTOCOLS, COCOA_PRIMITIVES + + for index, token, value in \ + baselexer.get_tokens_unprocessed(self, text): + if token is Name or token is Name.Class: + if value in COCOA_INTERFACES or value in COCOA_PROTOCOLS \ + or value in COCOA_PRIMITIVES: + token = Name.Builtin.Pseudo + + yield index, token, value + + return GeneratedObjectiveCVariant + + +class ObjectiveCLexer(objective(CLexer)): + """ + For Objective-C source code with preprocessor directives. + """ + + name = 'Objective-C' + aliases = ['objective-c', 'objectivec', 'obj-c', 'objc'] + filenames = ['*.m', '*.h'] + mimetypes = ['text/x-objective-c'] + priority = 0.05 # Lower than C + + +class ObjectiveCppLexer(objective(CppLexer)): + """ + For Objective-C++ source code with preprocessor directives. + """ + + name = 'Objective-C++' + aliases = ['objective-c++', 'objectivec++', 'obj-c++', 'objc++'] + filenames = ['*.mm', '*.hh'] + mimetypes = ['text/x-objective-c++'] + priority = 0.05 # Lower than C++ + + +class LogosLexer(ObjectiveCppLexer): + """ + For Logos + Objective-C source code with preprocessor directives. + + .. versionadded:: 1.6 + """ + + name = 'Logos' + aliases = ['logos'] + filenames = ['*.x', '*.xi', '*.xm', '*.xmi'] + mimetypes = ['text/x-logos'] + priority = 0.25 + + tokens = { + 'statements': [ + (r'(%orig|%log)\b', Keyword), + (r'(%c)\b(\()(\s*)([a-zA-Z$_][\w$]*)(\s*)(\))', + bygroups(Keyword, Punctuation, Text, Name.Class, Text, Punctuation)), + (r'(%init)\b(\()', + bygroups(Keyword, Punctuation), 'logos_init_directive'), + (r'(%init)(?=\s*;)', bygroups(Keyword)), + (r'(%hook|%group)(\s+)([a-zA-Z$_][\w$]+)', + bygroups(Keyword, Text, Name.Class), '#pop'), + (r'(%subclass)(\s+)', bygroups(Keyword, Text), + ('#pop', 'logos_classname')), + inherit, + ], + 'logos_init_directive': [ + ('\s+', Text), + (',', Punctuation, ('logos_init_directive', '#pop')), + ('([a-zA-Z$_][\w$]*)(\s*)(=)(\s*)([^);]*)', + bygroups(Name.Class, Text, Punctuation, Text, Text)), + ('([a-zA-Z$_][\w$]*)', Name.Class), + ('\)', Punctuation, '#pop'), + ], + 'logos_classname': [ + ('([a-zA-Z$_][\w$]*)(\s*:\s*)([a-zA-Z$_][\w$]*)?', + bygroups(Name.Class, Text, Name.Class), '#pop'), + ('([a-zA-Z$_][\w$]*)', Name.Class, '#pop') + ], + 'root': [ + (r'(%subclass)(\s+)', bygroups(Keyword, Text), + 'logos_classname'), + (r'(%hook|%group)(\s+)([a-zA-Z$_][\w$]+)', + bygroups(Keyword, Text, Name.Class)), + (r'(%config)(\s*\(\s*)(\w+)(\s*=\s*)(.*?)(\s*\)\s*)', + bygroups(Keyword, Text, Name.Variable, Text, String, Text)), + (r'(%ctor)(\s*)(\{)', bygroups(Keyword, Text, Punctuation), + 'function'), + (r'(%new)(\s*)(\()(\s*.*?\s*)(\))', + bygroups(Keyword, Text, Keyword, String, Keyword)), + (r'(\s*)(%end)(\s*)', bygroups(Text, Keyword, Text)), + inherit, + ], + } + + _logos_keywords = re.compile(r'%(?:hook|ctor|init|c\()') + + def analyse_text(text): + if LogosLexer._logos_keywords.search(text): + return 1.0 + return 0 + + +class SwiftLexer(RegexLexer): + """ + For `Swift `_ source. + + .. versionadded:: 2.0 + """ + name = 'Swift' + filenames = ['*.swift'] + aliases = ['swift'] + mimetypes = ['text/x-swift'] + + tokens = { + 'root': [ + # Whitespace and Comments + (r'\n', Text), + (r'\s+', Text), + (r'//', Comment.Single, 'comment-single'), + (r'/\*', Comment.Multiline, 'comment-multi'), + (r'#(if|elseif|else|endif|available)\b', Comment.Preproc, 'preproc'), + + # Keywords + include('keywords'), + + # Global Types + (words(( + 'Array', 'AutoreleasingUnsafeMutablePointer', 'BidirectionalReverseView', + 'Bit', 'Bool', 'CFunctionPointer', 'COpaquePointer', 'CVaListPointer', + 'Character', 'ClosedInterval', 'CollectionOfOne', 'ContiguousArray', + 'Dictionary', 'DictionaryGenerator', 'DictionaryIndex', 'Double', + 'EmptyCollection', 'EmptyGenerator', 'EnumerateGenerator', + 'EnumerateSequence', 'FilterCollectionView', + 'FilterCollectionViewIndex', 'FilterGenerator', 'FilterSequenceView', + 'Float', 'Float80', 'FloatingPointClassification', 'GeneratorOf', + 'GeneratorOfOne', 'GeneratorSequence', 'HalfOpenInterval', 'HeapBuffer', + 'HeapBufferStorage', 'ImplicitlyUnwrappedOptional', 'IndexingGenerator', + 'Int', 'Int16', 'Int32', 'Int64', 'Int8', 'LazyBidirectionalCollection', + 'LazyForwardCollection', 'LazyRandomAccessCollection', + 'LazySequence', 'MapCollectionView', 'MapSequenceGenerator', + 'MapSequenceView', 'MirrorDisposition', 'ObjectIdentifier', 'OnHeap', + 'Optional', 'PermutationGenerator', 'QuickLookObject', + 'RandomAccessReverseView', 'Range', 'RangeGenerator', 'RawByte', 'Repeat', + 'ReverseBidirectionalIndex', 'ReverseRandomAccessIndex', 'SequenceOf', + 'SinkOf', 'Slice', 'StaticString', 'StrideThrough', 'StrideThroughGenerator', + 'StrideTo', 'StrideToGenerator', 'String', 'UInt', 'UInt16', 'UInt32', + 'UInt64', 'UInt8', 'UTF16', 'UTF32', 'UTF8', 'UnicodeDecodingResult', + 'UnicodeScalar', 'Unmanaged', 'UnsafeBufferPointer', + 'UnsafeBufferPointerGenerator', 'UnsafeMutableBufferPointer', + 'UnsafeMutablePointer', 'UnsafePointer', 'Zip2', 'ZipGenerator2', + # Protocols + 'AbsoluteValuable', 'AnyObject', 'ArrayLiteralConvertible', + 'BidirectionalIndexType', 'BitwiseOperationsType', + 'BooleanLiteralConvertible', 'BooleanType', 'CVarArgType', + 'CollectionType', 'Comparable', 'DebugPrintable', + 'DictionaryLiteralConvertible', 'Equatable', + 'ExtendedGraphemeClusterLiteralConvertible', + 'ExtensibleCollectionType', 'FloatLiteralConvertible', + 'FloatingPointType', 'ForwardIndexType', 'GeneratorType', 'Hashable', + 'IntegerArithmeticType', 'IntegerLiteralConvertible', 'IntegerType', + 'IntervalType', 'MirrorType', 'MutableCollectionType', 'MutableSliceable', + 'NilLiteralConvertible', 'OutputStreamType', 'Printable', + 'RandomAccessIndexType', 'RangeReplaceableCollectionType', + 'RawOptionSetType', 'RawRepresentable', 'Reflectable', 'SequenceType', + 'SignedIntegerType', 'SignedNumberType', 'SinkType', 'Sliceable', + 'Streamable', 'Strideable', 'StringInterpolationConvertible', + 'StringLiteralConvertible', 'UnicodeCodecType', + 'UnicodeScalarLiteralConvertible', 'UnsignedIntegerType', + '_ArrayBufferType', '_BidirectionalIndexType', '_CocoaStringType', + '_CollectionType', '_Comparable', '_ExtensibleCollectionType', + '_ForwardIndexType', '_Incrementable', '_IntegerArithmeticType', + '_IntegerType', '_ObjectiveCBridgeable', '_RandomAccessIndexType', + '_RawOptionSetType', '_SequenceType', '_Sequence_Type', + '_SignedIntegerType', '_SignedNumberType', '_Sliceable', '_Strideable', + '_SwiftNSArrayRequiredOverridesType', '_SwiftNSArrayType', + '_SwiftNSCopyingType', '_SwiftNSDictionaryRequiredOverridesType', + '_SwiftNSDictionaryType', '_SwiftNSEnumeratorType', + '_SwiftNSFastEnumerationType', '_SwiftNSStringRequiredOverridesType', + '_SwiftNSStringType', '_UnsignedIntegerType', + # Variables + 'C_ARGC', 'C_ARGV', 'Process', + # Typealiases + 'Any', 'AnyClass', 'BooleanLiteralType', 'CBool', 'CChar', 'CChar16', + 'CChar32', 'CDouble', 'CFloat', 'CInt', 'CLong', 'CLongLong', 'CShort', + 'CSignedChar', 'CUnsignedInt', 'CUnsignedLong', 'CUnsignedShort', + 'CWideChar', 'ExtendedGraphemeClusterType', 'Float32', 'Float64', + 'FloatLiteralType', 'IntMax', 'IntegerLiteralType', 'StringLiteralType', + 'UIntMax', 'UWord', 'UnicodeScalarType', 'Void', 'Word', + # Foundation/Cocoa + 'NSErrorPointer', 'NSObjectProtocol', 'Selector'), suffix=r'\b'), + Name.Builtin), + # Functions + (words(( + 'abs', 'advance', 'alignof', 'alignofValue', 'assert', 'assertionFailure', + 'contains', 'count', 'countElements', 'debugPrint', 'debugPrintln', + 'distance', 'dropFirst', 'dropLast', 'dump', 'enumerate', 'equal', + 'extend', 'fatalError', 'filter', 'find', 'first', 'getVaList', 'indices', + 'insert', 'isEmpty', 'join', 'last', 'lazy', 'lexicographicalCompare', + 'map', 'max', 'maxElement', 'min', 'minElement', 'numericCast', 'overlaps', + 'partition', 'precondition', 'preconditionFailure', 'prefix', 'print', + 'println', 'reduce', 'reflect', 'removeAll', 'removeAtIndex', 'removeLast', + 'removeRange', 'reverse', 'sizeof', 'sizeofValue', 'sort', 'sorted', + 'splice', 'split', 'startsWith', 'stride', 'strideof', 'strideofValue', + 'suffix', 'swap', 'toDebugString', 'toString', 'transcode', + 'underestimateCount', 'unsafeAddressOf', 'unsafeBitCast', 'unsafeDowncast', + 'withExtendedLifetime', 'withUnsafeMutablePointer', + 'withUnsafeMutablePointers', 'withUnsafePointer', 'withUnsafePointers', + 'withVaList'), suffix=r'\b'), + Name.Builtin.Pseudo), + + # Implicit Block Variables + (r'\$\d+', Name.Variable), + + # Binary Literal + (r'0b[01_]+', Number.Bin), + # Octal Literal + (r'0o[0-7_]+', Number.Oct), + # Hexadecimal Literal + (r'0x[0-9a-fA-F_]+', Number.Hex), + # Decimal Literal + (r'[0-9][0-9_]*(\.[0-9_]+[eE][+\-]?[0-9_]+|' + r'\.[0-9_]*|[eE][+\-]?[0-9_]+)', Number.Float), + (r'[0-9][0-9_]*', Number.Integer), + # String Literal + (r'"', String, 'string'), + + # Operators and Punctuation + (r'[(){}\[\].,:;=@#`?]|->|[<&?](?=\w)|(?<=\w)[>!?]', Punctuation), + (r'[/=\-+!*%<>&|^?~]+', Operator), + + # Identifier + (r'[a-zA-Z_]\w*', Name) + ], + 'keywords': [ + (words(( + 'as', 'break', 'case', 'catch', 'continue', 'default', 'defer', + 'do', 'else', 'fallthrough', 'for', 'guard', 'if', 'in', 'is', + 'repeat', 'return', '#selector', 'switch', 'throw', 'try', + 'where', 'while'), suffix=r'\b'), + Keyword), + (r'@availability\([^)]+\)', Keyword.Reserved), + (words(( + 'associativity', 'convenience', 'dynamic', 'didSet', 'final', + 'get', 'indirect', 'infix', 'inout', 'lazy', 'left', 'mutating', + 'none', 'nonmutating', 'optional', 'override', 'postfix', + 'precedence', 'prefix', 'Protocol', 'required', 'rethrows', + 'right', 'set', 'throws', 'Type', 'unowned', 'weak', 'willSet', + '@availability', '@autoclosure', '@noreturn', + '@NSApplicationMain', '@NSCopying', '@NSManaged', '@objc', + '@UIApplicationMain', '@IBAction', '@IBDesignable', + '@IBInspectable', '@IBOutlet'), suffix=r'\b'), + Keyword.Reserved), + (r'(as|dynamicType|false|is|nil|self|Self|super|true|__COLUMN__' + r'|__FILE__|__FUNCTION__|__LINE__|_' + r'|#(?:file|line|column|function))\b', Keyword.Constant), + (r'import\b', Keyword.Declaration, 'module'), + (r'(class|enum|extension|struct|protocol)(\s+)([a-zA-Z_]\w*)', + bygroups(Keyword.Declaration, Text, Name.Class)), + (r'(func)(\s+)([a-zA-Z_]\w*)', + bygroups(Keyword.Declaration, Text, Name.Function)), + (r'(var|let)(\s+)([a-zA-Z_]\w*)', bygroups(Keyword.Declaration, + Text, Name.Variable)), + (words(( + 'class', 'deinit', 'enum', 'extension', 'func', 'import', 'init', + 'internal', 'let', 'operator', 'private', 'protocol', 'public', + 'static', 'struct', 'subscript', 'typealias', 'var'), suffix=r'\b'), + Keyword.Declaration) + ], + 'comment': [ + (r':param: [a-zA-Z_]\w*|:returns?:|(FIXME|MARK|TODO):', + Comment.Special) + ], + + # Nested + 'comment-single': [ + (r'\n', Text, '#pop'), + include('comment'), + (r'[^\n]', Comment.Single) + ], + 'comment-multi': [ + include('comment'), + (r'[^*/]', Comment.Multiline), + (r'/\*', Comment.Multiline, '#push'), + (r'\*/', Comment.Multiline, '#pop'), + (r'[*/]', Comment.Multiline) + ], + 'module': [ + (r'\n', Text, '#pop'), + (r'[a-zA-Z_]\w*', Name.Class), + include('root') + ], + 'preproc': [ + (r'\n', Text, '#pop'), + include('keywords'), + (r'[A-Za-z]\w*', Comment.Preproc), + include('root') + ], + 'string': [ + (r'\\\(', String.Interpol, 'string-intp'), + (r'"', String, '#pop'), + (r"""\\['"\\nrt]|\\x[0-9a-fA-F]{2}|\\[0-7]{1,3}""" + r"""|\\u[0-9a-fA-F]{4}|\\U[0-9a-fA-F]{8}""", String.Escape), + (r'[^\\"]+', String), + (r'\\', String) + ], + 'string-intp': [ + (r'\(', String.Interpol, '#push'), + (r'\)', String.Interpol, '#pop'), + include('root') + ] + } + + def get_tokens_unprocessed(self, text): + from pygments.lexers._cocoa_builtins import COCOA_INTERFACES, \ + COCOA_PROTOCOLS, COCOA_PRIMITIVES + + for index, token, value in \ + RegexLexer.get_tokens_unprocessed(self, text): + if token is Name or token is Name.Class: + if value in COCOA_INTERFACES or value in COCOA_PROTOCOLS \ + or value in COCOA_PRIMITIVES: + token = Name.Builtin.Pseudo + + yield index, token, value diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/ooc.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/ooc.py new file mode 100644 index 0000000000000000000000000000000000000000..957b72f168a56f2c63b58000ac13442dcb95c4bf --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/ooc.py @@ -0,0 +1,85 @@ +# -*- coding: utf-8 -*- +""" + pygments.lexers.ooc + ~~~~~~~~~~~~~~~~~~~ + + Lexers for the Ooc language. + + :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS. + :license: BSD, see LICENSE for details. +""" + +from pygments.lexer import RegexLexer, bygroups, words +from pygments.token import Text, Comment, Operator, Keyword, Name, String, \ + Number, Punctuation + +__all__ = ['OocLexer'] + + +class OocLexer(RegexLexer): + """ + For `Ooc `_ source code + + .. versionadded:: 1.2 + """ + name = 'Ooc' + aliases = ['ooc'] + filenames = ['*.ooc'] + mimetypes = ['text/x-ooc'] + + tokens = { + 'root': [ + (words(( + 'class', 'interface', 'implement', 'abstract', 'extends', 'from', + 'this', 'super', 'new', 'const', 'final', 'static', 'import', + 'use', 'extern', 'inline', 'proto', 'break', 'continue', + 'fallthrough', 'operator', 'if', 'else', 'for', 'while', 'do', + 'switch', 'case', 'as', 'in', 'version', 'return', 'true', + 'false', 'null'), prefix=r'\b', suffix=r'\b'), + Keyword), + (r'include\b', Keyword, 'include'), + (r'(cover)([ \t]+)(from)([ \t]+)(\w+[*@]?)', + bygroups(Keyword, Text, Keyword, Text, Name.Class)), + (r'(func)((?:[ \t]|\\\n)+)(~[a-z_]\w*)', + bygroups(Keyword, Text, Name.Function)), + (r'\bfunc\b', Keyword), + # Note: %= and ^= not listed on http://ooc-lang.org/syntax + (r'//.*', Comment), + (r'(?s)/\*.*?\*/', Comment.Multiline), + (r'(==?|\+=?|-[=>]?|\*=?|/=?|:=|!=?|%=?|\?|>{1,3}=?|<{1,3}=?|\.\.|' + r'&&?|\|\|?|\^=?)', Operator), + (r'(\.)([ \t]*)([a-z]\w*)', bygroups(Operator, Text, + Name.Function)), + (r'[A-Z][A-Z0-9_]+', Name.Constant), + (r'[A-Z]\w*([@*]|\[[ \t]*\])?', Name.Class), + + (r'([a-z]\w*(?:~[a-z]\w*)?)((?:[ \t]|\\\n)*)(?=\()', + bygroups(Name.Function, Text)), + (r'[a-z]\w*', Name.Variable), + + # : introduces types + (r'[:(){}\[\];,]', Punctuation), + + (r'0x[0-9a-fA-F]+', Number.Hex), + (r'0c[0-9]+', Number.Oct), + (r'0b[01]+', Number.Bin), + (r'[0-9_]\.[0-9_]*(?!\.)', Number.Float), + (r'[0-9_]+', Number.Decimal), + + (r'"(?:\\.|\\[0-7]{1,3}|\\x[a-fA-F0-9]{1,2}|[^\\"])*"', + String.Double), + (r"'(?:\\.|\\[0-9]{1,3}|\\x[a-fA-F0-9]{1,2}|[^\\\'\n])'", + String.Char), + (r'@', Punctuation), # pointer dereference + (r'\.', Punctuation), # imports or chain operator + + (r'\\[ \t\n]', Text), + (r'[ \t]+', Text), + ], + 'include': [ + (r'[\w/]+', Name), + (r',', Punctuation), + (r'[ \t]', Text), + (r'[;\n]', Text, '#pop'), + ], + } diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/other.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/other.py new file mode 100644 index 0000000000000000000000000000000000000000..bfce4c3c4281e142b25bc438f10dbcec610a6c45 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/other.py @@ -0,0 +1,41 @@ +# -*- coding: utf-8 -*- +""" + pygments.lexers.other + ~~~~~~~~~~~~~~~~~~~~~ + + Just export lexer classes previously contained in this module. + + :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS. + :license: BSD, see LICENSE for details. +""" + +from pygments.lexers.sql import SqlLexer, MySqlLexer, SqliteConsoleLexer +from pygments.lexers.shell import BashLexer, BashSessionLexer, BatchLexer, \ + TcshLexer +from pygments.lexers.robotframework import RobotFrameworkLexer +from pygments.lexers.testing import GherkinLexer +from pygments.lexers.esoteric import BrainfuckLexer, BefungeLexer, RedcodeLexer +from pygments.lexers.prolog import LogtalkLexer +from pygments.lexers.snobol import SnobolLexer +from pygments.lexers.rebol import RebolLexer +from pygments.lexers.configs import KconfigLexer, Cfengine3Lexer +from pygments.lexers.modeling import ModelicaLexer +from pygments.lexers.scripting import AppleScriptLexer, MOOCodeLexer, \ + HybrisLexer +from pygments.lexers.graphics import PostScriptLexer, GnuplotLexer, \ + AsymptoteLexer, PovrayLexer +from pygments.lexers.business import ABAPLexer, OpenEdgeLexer, \ + GoodDataCLLexer, MaqlLexer +from pygments.lexers.automation import AutoItLexer, AutohotkeyLexer +from pygments.lexers.dsls import ProtoBufLexer, BroLexer, PuppetLexer, \ + MscgenLexer, VGLLexer +from pygments.lexers.basic import CbmBasicV2Lexer +from pygments.lexers.pawn import SourcePawnLexer, PawnLexer +from pygments.lexers.ecl import ECLLexer +from pygments.lexers.urbi import UrbiscriptLexer +from pygments.lexers.smalltalk import SmalltalkLexer, NewspeakLexer +from pygments.lexers.installers import NSISLexer, RPMSpecLexer +from pygments.lexers.textedit import AwkLexer +from pygments.lexers.smv import NuSMVLexer + +__all__ = [] diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/parasail.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/parasail.py new file mode 100644 index 0000000000000000000000000000000000000000..53088023d456f2a4a5c655e948ee42b4d094a604 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/parasail.py @@ -0,0 +1,79 @@ +# -*- coding: utf-8 -*- +""" + pygments.lexers.parasail + ~~~~~~~~~~~~~~~~~~~~~~~~ + + Lexer for ParaSail. + + :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS. + :license: BSD, see LICENSE for details. +""" + +import re + +from pygments.lexer import RegexLexer, include +from pygments.token import Text, Comment, Operator, Keyword, Name, String, \ + Number, Punctuation, Literal + +__all__ = ['ParaSailLexer'] + + +class ParaSailLexer(RegexLexer): + """ + For `ParaSail `_ source code. + + .. versionadded:: 2.1 + """ + + name = 'ParaSail' + aliases = ['parasail'] + filenames = ['*.psi', '*.psl'] + mimetypes = ['text/x-parasail'] + + flags = re.MULTILINE + + tokens = { + 'root': [ + (r'[^\S\n]+', Text), + (r'//.*?\n', Comment.Single), + (r'\b(and|or|xor)=', Operator.Word), + (r'\b(and(\s+then)?|or(\s+else)?|xor|rem|mod|' + r'(is|not)\s+null)\b', + Operator.Word), + # Keywords + (r'\b(abs|abstract|all|block|class|concurrent|const|continue|' + r'each|end|exit|extends|exports|forward|func|global|implements|' + r'import|in|interface|is|lambda|locked|new|not|null|of|op|' + r'optional|private|queued|ref|return|reverse|separate|some|' + r'type|until|var|with|' + # Control flow + r'if|then|else|elsif|case|for|while|loop)\b', + Keyword.Reserved), + (r'(abstract\s+)?(interface|class|op|func|type)', + Keyword.Declaration), + # Literals + (r'"[^"]*"', String), + (r'\\[\'ntrf"0]', String.Escape), + (r'#[a-zA-Z]\w*', Literal), # Enumeration + include('numbers'), + (r"'[^']'", String.Char), + (r'[a-zA-Z]\w*', Name), + # Operators and Punctuation + (r'(<==|==>|<=>|\*\*=|<\|=|<<=|>>=|==|!=|=\?|<=|>=|' + r'\*\*|<<|>>|=>|:=|\+=|-=|\*=|\|=|\||/=|\+|-|\*|/|' + r'\.\.|<\.\.|\.\.<|<\.\.<)', + Operator), + (r'(<|>|\[|\]|\(|\)|\||:|;|,|.|\{|\}|->)', + Punctuation), + (r'\n+', Text), + ], + 'numbers': [ + (r'\d[0-9_]*#[0-9a-fA-F][0-9a-fA-F_]*#', Number.Hex), # any base + (r'0[xX][0-9a-fA-F][0-9a-fA-F_]*', Number.Hex), # C-like hex + (r'0[bB][01][01_]*', Number.Bin), # C-like bin + (r'\d[0-9_]*\.\d[0-9_]*[eE][+-]\d[0-9_]*', # float exp + Number.Float), + (r'\d[0-9_]*\.\d[0-9_]*', Number.Float), # float + (r'\d[0-9_]*', Number.Integer), # integer + ], + } diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/parsers.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/parsers.py new file mode 100644 index 0000000000000000000000000000000000000000..1f3c9b4d9755b7387180a6bac1343a5369a9380b --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/parsers.py @@ -0,0 +1,835 @@ +# -*- coding: utf-8 -*- +""" + pygments.lexers.parsers + ~~~~~~~~~~~~~~~~~~~~~~~ + + Lexers for parser generators. + + :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS. + :license: BSD, see LICENSE for details. +""" + +import re + +from pygments.lexer import RegexLexer, DelegatingLexer, \ + include, bygroups, using +from pygments.token import Punctuation, Other, Text, Comment, Operator, \ + Keyword, Name, String, Number, Whitespace +from pygments.lexers.jvm import JavaLexer +from pygments.lexers.c_cpp import CLexer, CppLexer +from pygments.lexers.objective import ObjectiveCLexer +from pygments.lexers.d import DLexer +from pygments.lexers.dotnet import CSharpLexer +from pygments.lexers.ruby import RubyLexer +from pygments.lexers.python import PythonLexer +from pygments.lexers.perl import PerlLexer + +__all__ = ['RagelLexer', 'RagelEmbeddedLexer', 'RagelCLexer', 'RagelDLexer', + 'RagelCppLexer', 'RagelObjectiveCLexer', 'RagelRubyLexer', + 'RagelJavaLexer', 'AntlrLexer', 'AntlrPythonLexer', + 'AntlrPerlLexer', 'AntlrRubyLexer', 'AntlrCppLexer', + # 'AntlrCLexer', + 'AntlrCSharpLexer', 'AntlrObjectiveCLexer', + 'AntlrJavaLexer', 'AntlrActionScriptLexer', + 'TreetopLexer', 'EbnfLexer'] + + +class RagelLexer(RegexLexer): + """ + A pure `Ragel `_ lexer. Use this for + fragments of Ragel. For ``.rl`` files, use RagelEmbeddedLexer instead + (or one of the language-specific subclasses). + + .. versionadded:: 1.1 + """ + + name = 'Ragel' + aliases = ['ragel'] + filenames = [] + + tokens = { + 'whitespace': [ + (r'\s+', Whitespace) + ], + 'comments': [ + (r'\#.*$', Comment), + ], + 'keywords': [ + (r'(access|action|alphtype)\b', Keyword), + (r'(getkey|write|machine|include)\b', Keyword), + (r'(any|ascii|extend|alpha|digit|alnum|lower|upper)\b', Keyword), + (r'(xdigit|cntrl|graph|print|punct|space|zlen|empty)\b', Keyword) + ], + 'numbers': [ + (r'0x[0-9A-Fa-f]+', Number.Hex), + (r'[+-]?[0-9]+', Number.Integer), + ], + 'literals': [ + (r'"(\\\\|\\"|[^"])*"', String), # double quote string + (r"'(\\\\|\\'|[^'])*'", String), # single quote string + (r'\[(\\\\|\\\]|[^\]])*\]', String), # square bracket literals + (r'/(?!\*)(\\\\|\\/|[^/])*/', String.Regex), # regular expressions + ], + 'identifiers': [ + (r'[a-zA-Z_]\w*', Name.Variable), + ], + 'operators': [ + (r',', Operator), # Join + (r'\||&|--?', Operator), # Union, Intersection and Subtraction + (r'\.|<:|:>>?', Operator), # Concatention + (r':', Operator), # Label + (r'->', Operator), # Epsilon Transition + (r'(>|\$|%|<|@|<>)(/|eof\b)', Operator), # EOF Actions + (r'(>|\$|%|<|@|<>)(!|err\b)', Operator), # Global Error Actions + (r'(>|\$|%|<|@|<>)(\^|lerr\b)', Operator), # Local Error Actions + (r'(>|\$|%|<|@|<>)(~|to\b)', Operator), # To-State Actions + (r'(>|\$|%|<|@|<>)(\*|from\b)', Operator), # From-State Actions + (r'>|@|\$|%', Operator), # Transition Actions and Priorities + (r'\*|\?|\+|\{[0-9]*,[0-9]*\}', Operator), # Repetition + (r'!|\^', Operator), # Negation + (r'\(|\)', Operator), # Grouping + ], + 'root': [ + include('literals'), + include('whitespace'), + include('comments'), + include('keywords'), + include('numbers'), + include('identifiers'), + include('operators'), + (r'\{', Punctuation, 'host'), + (r'=', Operator), + (r';', Punctuation), + ], + 'host': [ + (r'(' + r'|'.join(( # keep host code in largest possible chunks + r'[^{}\'"/#]+', # exclude unsafe characters + r'[^\\]\\[{}]', # allow escaped { or } + + # strings and comments may safely contain unsafe characters + r'"(\\\\|\\"|[^"])*"', # double quote string + r"'(\\\\|\\'|[^'])*'", # single quote string + r'//.*$\n?', # single line comment + r'/\*(.|\n)*?\*/', # multi-line javadoc-style comment + r'\#.*$\n?', # ruby comment + + # regular expression: There's no reason for it to start + # with a * and this stops confusion with comments. + r'/(?!\*)(\\\\|\\/|[^/])*/', + + # / is safe now that we've handled regex and javadoc comments + r'/', + )) + r')+', Other), + + (r'\{', Punctuation, '#push'), + (r'\}', Punctuation, '#pop'), + ], + } + + +class RagelEmbeddedLexer(RegexLexer): + """ + A lexer for `Ragel`_ embedded in a host language file. + + This will only highlight Ragel statements. If you want host language + highlighting then call the language-specific Ragel lexer. + + .. versionadded:: 1.1 + """ + + name = 'Embedded Ragel' + aliases = ['ragel-em'] + filenames = ['*.rl'] + + tokens = { + 'root': [ + (r'(' + r'|'.join(( # keep host code in largest possible chunks + r'[^%\'"/#]+', # exclude unsafe characters + r'%(?=[^%]|$)', # a single % sign is okay, just not 2 of them + + # strings and comments may safely contain unsafe characters + r'"(\\\\|\\"|[^"])*"', # double quote string + r"'(\\\\|\\'|[^'])*'", # single quote string + r'/\*(.|\n)*?\*/', # multi-line javadoc-style comment + r'//.*$\n?', # single line comment + r'\#.*$\n?', # ruby/ragel comment + r'/(?!\*)(\\\\|\\/|[^/])*/', # regular expression + + # / is safe now that we've handled regex and javadoc comments + r'/', + )) + r')+', Other), + + # Single Line FSM. + # Please don't put a quoted newline in a single line FSM. + # That's just mean. It will break this. + (r'(%%)(?![{%])(.*)($|;)(\n?)', bygroups(Punctuation, + using(RagelLexer), + Punctuation, Text)), + + # Multi Line FSM. + (r'(%%%%|%%)\{', Punctuation, 'multi-line-fsm'), + ], + 'multi-line-fsm': [ + (r'(' + r'|'.join(( # keep ragel code in largest possible chunks. + r'(' + r'|'.join(( + r'[^}\'"\[/#]', # exclude unsafe characters + r'\}(?=[^%]|$)', # } is okay as long as it's not followed by % + r'\}%(?=[^%]|$)', # ...well, one %'s okay, just not two... + r'[^\\]\\[{}]', # ...and } is okay if it's escaped + + # allow / if it's preceded with one of these symbols + # (ragel EOF actions) + r'(>|\$|%|<|@|<>)/', + + # specifically allow regex followed immediately by * + # so it doesn't get mistaken for a comment + r'/(?!\*)(\\\\|\\/|[^/])*/\*', + + # allow / as long as it's not followed by another / or by a * + r'/(?=[^/*]|$)', + + # We want to match as many of these as we can in one block. + # Not sure if we need the + sign here, + # does it help performance? + )) + r')+', + + # strings and comments may safely contain unsafe characters + r'"(\\\\|\\"|[^"])*"', # double quote string + r"'(\\\\|\\'|[^'])*'", # single quote string + r"\[(\\\\|\\\]|[^\]])*\]", # square bracket literal + r'/\*(.|\n)*?\*/', # multi-line javadoc-style comment + r'//.*$\n?', # single line comment + r'\#.*$\n?', # ruby/ragel comment + )) + r')+', using(RagelLexer)), + + (r'\}%%', Punctuation, '#pop'), + ] + } + + def analyse_text(text): + return '@LANG: indep' in text + + +class RagelRubyLexer(DelegatingLexer): + """ + A lexer for `Ragel`_ in a Ruby host file. + + .. versionadded:: 1.1 + """ + + name = 'Ragel in Ruby Host' + aliases = ['ragel-ruby', 'ragel-rb'] + filenames = ['*.rl'] + + def __init__(self, **options): + super(RagelRubyLexer, self).__init__(RubyLexer, RagelEmbeddedLexer, + **options) + + def analyse_text(text): + return '@LANG: ruby' in text + + +class RagelCLexer(DelegatingLexer): + """ + A lexer for `Ragel`_ in a C host file. + + .. versionadded:: 1.1 + """ + + name = 'Ragel in C Host' + aliases = ['ragel-c'] + filenames = ['*.rl'] + + def __init__(self, **options): + super(RagelCLexer, self).__init__(CLexer, RagelEmbeddedLexer, + **options) + + def analyse_text(text): + return '@LANG: c' in text + + +class RagelDLexer(DelegatingLexer): + """ + A lexer for `Ragel`_ in a D host file. + + .. versionadded:: 1.1 + """ + + name = 'Ragel in D Host' + aliases = ['ragel-d'] + filenames = ['*.rl'] + + def __init__(self, **options): + super(RagelDLexer, self).__init__(DLexer, RagelEmbeddedLexer, **options) + + def analyse_text(text): + return '@LANG: d' in text + + +class RagelCppLexer(DelegatingLexer): + """ + A lexer for `Ragel`_ in a CPP host file. + + .. versionadded:: 1.1 + """ + + name = 'Ragel in CPP Host' + aliases = ['ragel-cpp'] + filenames = ['*.rl'] + + def __init__(self, **options): + super(RagelCppLexer, self).__init__(CppLexer, RagelEmbeddedLexer, **options) + + def analyse_text(text): + return '@LANG: c++' in text + + +class RagelObjectiveCLexer(DelegatingLexer): + """ + A lexer for `Ragel`_ in an Objective C host file. + + .. versionadded:: 1.1 + """ + + name = 'Ragel in Objective C Host' + aliases = ['ragel-objc'] + filenames = ['*.rl'] + + def __init__(self, **options): + super(RagelObjectiveCLexer, self).__init__(ObjectiveCLexer, + RagelEmbeddedLexer, + **options) + + def analyse_text(text): + return '@LANG: objc' in text + + +class RagelJavaLexer(DelegatingLexer): + """ + A lexer for `Ragel`_ in a Java host file. + + .. versionadded:: 1.1 + """ + + name = 'Ragel in Java Host' + aliases = ['ragel-java'] + filenames = ['*.rl'] + + def __init__(self, **options): + super(RagelJavaLexer, self).__init__(JavaLexer, RagelEmbeddedLexer, + **options) + + def analyse_text(text): + return '@LANG: java' in text + + +class AntlrLexer(RegexLexer): + """ + Generic `ANTLR`_ Lexer. + Should not be called directly, instead + use DelegatingLexer for your target language. + + .. versionadded:: 1.1 + + .. _ANTLR: http://www.antlr.org/ + """ + + name = 'ANTLR' + aliases = ['antlr'] + filenames = [] + + _id = r'[A-Za-z]\w*' + _TOKEN_REF = r'[A-Z]\w*' + _RULE_REF = r'[a-z]\w*' + _STRING_LITERAL = r'\'(?:\\\\|\\\'|[^\']*)\'' + _INT = r'[0-9]+' + + tokens = { + 'whitespace': [ + (r'\s+', Whitespace), + ], + 'comments': [ + (r'//.*$', Comment), + (r'/\*(.|\n)*?\*/', Comment), + ], + 'root': [ + include('whitespace'), + include('comments'), + + (r'(lexer|parser|tree)?(\s*)(grammar\b)(\s*)(' + _id + ')(;)', + bygroups(Keyword, Whitespace, Keyword, Whitespace, Name.Class, + Punctuation)), + # optionsSpec + (r'options\b', Keyword, 'options'), + # tokensSpec + (r'tokens\b', Keyword, 'tokens'), + # attrScope + (r'(scope)(\s*)(' + _id + ')(\s*)(\{)', + bygroups(Keyword, Whitespace, Name.Variable, Whitespace, + Punctuation), 'action'), + # exception + (r'(catch|finally)\b', Keyword, 'exception'), + # action + (r'(@' + _id + ')(\s*)(::)?(\s*)(' + _id + ')(\s*)(\{)', + bygroups(Name.Label, Whitespace, Punctuation, Whitespace, + Name.Label, Whitespace, Punctuation), 'action'), + # rule + (r'((?:protected|private|public|fragment)\b)?(\s*)(' + _id + ')(!)?', + bygroups(Keyword, Whitespace, Name.Label, Punctuation), + ('rule-alts', 'rule-prelims')), + ], + 'exception': [ + (r'\n', Whitespace, '#pop'), + (r'\s', Whitespace), + include('comments'), + + (r'\[', Punctuation, 'nested-arg-action'), + (r'\{', Punctuation, 'action'), + ], + 'rule-prelims': [ + include('whitespace'), + include('comments'), + + (r'returns\b', Keyword), + (r'\[', Punctuation, 'nested-arg-action'), + (r'\{', Punctuation, 'action'), + # throwsSpec + (r'(throws)(\s+)(' + _id + ')', + bygroups(Keyword, Whitespace, Name.Label)), + (r'(,)(\s*)(' + _id + ')', + bygroups(Punctuation, Whitespace, Name.Label)), # Additional throws + # optionsSpec + (r'options\b', Keyword, 'options'), + # ruleScopeSpec - scope followed by target language code or name of action + # TODO finish implementing other possibilities for scope + # L173 ANTLRv3.g from ANTLR book + (r'(scope)(\s+)(\{)', bygroups(Keyword, Whitespace, Punctuation), + 'action'), + (r'(scope)(\s+)(' + _id + ')(\s*)(;)', + bygroups(Keyword, Whitespace, Name.Label, Whitespace, Punctuation)), + # ruleAction + (r'(@' + _id + ')(\s*)(\{)', + bygroups(Name.Label, Whitespace, Punctuation), 'action'), + # finished prelims, go to rule alts! + (r':', Punctuation, '#pop') + ], + 'rule-alts': [ + include('whitespace'), + include('comments'), + + # These might need to go in a separate 'block' state triggered by ( + (r'options\b', Keyword, 'options'), + (r':', Punctuation), + + # literals + (r"'(\\\\|\\'|[^'])*'", String), + (r'"(\\\\|\\"|[^"])*"', String), + (r'<<([^>]|>[^>])>>', String), + # identifiers + # Tokens start with capital letter. + (r'\$?[A-Z_]\w*', Name.Constant), + # Rules start with small letter. + (r'\$?[a-z_]\w*', Name.Variable), + # operators + (r'(\+|\||->|=>|=|\(|\)|\.\.|\.|\?|\*|\^|!|\#|~)', Operator), + (r',', Punctuation), + (r'\[', Punctuation, 'nested-arg-action'), + (r'\{', Punctuation, 'action'), + (r';', Punctuation, '#pop') + ], + 'tokens': [ + include('whitespace'), + include('comments'), + (r'\{', Punctuation), + (r'(' + _TOKEN_REF + r')(\s*)(=)?(\s*)(' + _STRING_LITERAL + + ')?(\s*)(;)', + bygroups(Name.Label, Whitespace, Punctuation, Whitespace, + String, Whitespace, Punctuation)), + (r'\}', Punctuation, '#pop'), + ], + 'options': [ + include('whitespace'), + include('comments'), + (r'\{', Punctuation), + (r'(' + _id + r')(\s*)(=)(\s*)(' + + '|'.join((_id, _STRING_LITERAL, _INT, '\*')) + ')(\s*)(;)', + bygroups(Name.Variable, Whitespace, Punctuation, Whitespace, + Text, Whitespace, Punctuation)), + (r'\}', Punctuation, '#pop'), + ], + 'action': [ + (r'(' + r'|'.join(( # keep host code in largest possible chunks + r'[^${}\'"/\\]+', # exclude unsafe characters + + # strings and comments may safely contain unsafe characters + r'"(\\\\|\\"|[^"])*"', # double quote string + r"'(\\\\|\\'|[^'])*'", # single quote string + r'//.*$\n?', # single line comment + r'/\*(.|\n)*?\*/', # multi-line javadoc-style comment + + # regular expression: There's no reason for it to start + # with a * and this stops confusion with comments. + r'/(?!\*)(\\\\|\\/|[^/])*/', + + # backslashes are okay, as long as we are not backslashing a % + r'\\(?!%)', + + # Now that we've handled regex and javadoc comments + # it's safe to let / through. + r'/', + )) + r')+', Other), + (r'(\\)(%)', bygroups(Punctuation, Other)), + (r'(\$[a-zA-Z]+)(\.?)(text|value)?', + bygroups(Name.Variable, Punctuation, Name.Property)), + (r'\{', Punctuation, '#push'), + (r'\}', Punctuation, '#pop'), + ], + 'nested-arg-action': [ + (r'(' + r'|'.join(( # keep host code in largest possible chunks. + r'[^$\[\]\'"/]+', # exclude unsafe characters + + # strings and comments may safely contain unsafe characters + r'"(\\\\|\\"|[^"])*"', # double quote string + r"'(\\\\|\\'|[^'])*'", # single quote string + r'//.*$\n?', # single line comment + r'/\*(.|\n)*?\*/', # multi-line javadoc-style comment + + # regular expression: There's no reason for it to start + # with a * and this stops confusion with comments. + r'/(?!\*)(\\\\|\\/|[^/])*/', + + # Now that we've handled regex and javadoc comments + # it's safe to let / through. + r'/', + )) + r')+', Other), + + + (r'\[', Punctuation, '#push'), + (r'\]', Punctuation, '#pop'), + (r'(\$[a-zA-Z]+)(\.?)(text|value)?', + bygroups(Name.Variable, Punctuation, Name.Property)), + (r'(\\\\|\\\]|\\\[|[^\[\]])+', Other), + ] + } + + def analyse_text(text): + return re.search(r'^\s*grammar\s+[a-zA-Z0-9]+\s*;', text, re.M) + +# http://www.antlr.org/wiki/display/ANTLR3/Code+Generation+Targets + +# TH: I'm not aware of any language features of C++ that will cause +# incorrect lexing of C files. Antlr doesn't appear to make a distinction, +# so just assume they're C++. No idea how to make Objective C work in the +# future. + +# class AntlrCLexer(DelegatingLexer): +# """ +# ANTLR with C Target +# +# .. versionadded:: 1.1 +# """ +# +# name = 'ANTLR With C Target' +# aliases = ['antlr-c'] +# filenames = ['*.G', '*.g'] +# +# def __init__(self, **options): +# super(AntlrCLexer, self).__init__(CLexer, AntlrLexer, **options) +# +# def analyse_text(text): +# return re.match(r'^\s*language\s*=\s*C\s*;', text) + + +class AntlrCppLexer(DelegatingLexer): + """ + `ANTLR`_ with CPP Target + + .. versionadded:: 1.1 + """ + + name = 'ANTLR With CPP Target' + aliases = ['antlr-cpp'] + filenames = ['*.G', '*.g'] + + def __init__(self, **options): + super(AntlrCppLexer, self).__init__(CppLexer, AntlrLexer, **options) + + def analyse_text(text): + return AntlrLexer.analyse_text(text) and \ + re.search(r'^\s*language\s*=\s*C\s*;', text, re.M) + + +class AntlrObjectiveCLexer(DelegatingLexer): + """ + `ANTLR`_ with Objective-C Target + + .. versionadded:: 1.1 + """ + + name = 'ANTLR With ObjectiveC Target' + aliases = ['antlr-objc'] + filenames = ['*.G', '*.g'] + + def __init__(self, **options): + super(AntlrObjectiveCLexer, self).__init__(ObjectiveCLexer, + AntlrLexer, **options) + + def analyse_text(text): + return AntlrLexer.analyse_text(text) and \ + re.search(r'^\s*language\s*=\s*ObjC\s*;', text) + + +class AntlrCSharpLexer(DelegatingLexer): + """ + `ANTLR`_ with C# Target + + .. versionadded:: 1.1 + """ + + name = 'ANTLR With C# Target' + aliases = ['antlr-csharp', 'antlr-c#'] + filenames = ['*.G', '*.g'] + + def __init__(self, **options): + super(AntlrCSharpLexer, self).__init__(CSharpLexer, AntlrLexer, + **options) + + def analyse_text(text): + return AntlrLexer.analyse_text(text) and \ + re.search(r'^\s*language\s*=\s*CSharp2\s*;', text, re.M) + + +class AntlrPythonLexer(DelegatingLexer): + """ + `ANTLR`_ with Python Target + + .. versionadded:: 1.1 + """ + + name = 'ANTLR With Python Target' + aliases = ['antlr-python'] + filenames = ['*.G', '*.g'] + + def __init__(self, **options): + super(AntlrPythonLexer, self).__init__(PythonLexer, AntlrLexer, + **options) + + def analyse_text(text): + return AntlrLexer.analyse_text(text) and \ + re.search(r'^\s*language\s*=\s*Python\s*;', text, re.M) + + +class AntlrJavaLexer(DelegatingLexer): + """ + `ANTLR`_ with Java Target + + .. versionadded:: 1. + """ + + name = 'ANTLR With Java Target' + aliases = ['antlr-java'] + filenames = ['*.G', '*.g'] + + def __init__(self, **options): + super(AntlrJavaLexer, self).__init__(JavaLexer, AntlrLexer, + **options) + + def analyse_text(text): + # Antlr language is Java by default + return AntlrLexer.analyse_text(text) and 0.9 + + +class AntlrRubyLexer(DelegatingLexer): + """ + `ANTLR`_ with Ruby Target + + .. versionadded:: 1.1 + """ + + name = 'ANTLR With Ruby Target' + aliases = ['antlr-ruby', 'antlr-rb'] + filenames = ['*.G', '*.g'] + + def __init__(self, **options): + super(AntlrRubyLexer, self).__init__(RubyLexer, AntlrLexer, + **options) + + def analyse_text(text): + return AntlrLexer.analyse_text(text) and \ + re.search(r'^\s*language\s*=\s*Ruby\s*;', text, re.M) + + +class AntlrPerlLexer(DelegatingLexer): + """ + `ANTLR`_ with Perl Target + + .. versionadded:: 1.1 + """ + + name = 'ANTLR With Perl Target' + aliases = ['antlr-perl'] + filenames = ['*.G', '*.g'] + + def __init__(self, **options): + super(AntlrPerlLexer, self).__init__(PerlLexer, AntlrLexer, + **options) + + def analyse_text(text): + return AntlrLexer.analyse_text(text) and \ + re.search(r'^\s*language\s*=\s*Perl5\s*;', text, re.M) + + +class AntlrActionScriptLexer(DelegatingLexer): + """ + `ANTLR`_ with ActionScript Target + + .. versionadded:: 1.1 + """ + + name = 'ANTLR With ActionScript Target' + aliases = ['antlr-as', 'antlr-actionscript'] + filenames = ['*.G', '*.g'] + + def __init__(self, **options): + from pygments.lexers.actionscript import ActionScriptLexer + super(AntlrActionScriptLexer, self).__init__(ActionScriptLexer, + AntlrLexer, **options) + + def analyse_text(text): + return AntlrLexer.analyse_text(text) and \ + re.search(r'^\s*language\s*=\s*ActionScript\s*;', text, re.M) + + +class TreetopBaseLexer(RegexLexer): + """ + A base lexer for `Treetop `_ grammars. + Not for direct use; use TreetopLexer instead. + + .. versionadded:: 1.6 + """ + + tokens = { + 'root': [ + include('space'), + (r'require[ \t]+[^\n\r]+[\n\r]', Other), + (r'module\b', Keyword.Namespace, 'module'), + (r'grammar\b', Keyword, 'grammar'), + ], + 'module': [ + include('space'), + include('end'), + (r'module\b', Keyword, '#push'), + (r'grammar\b', Keyword, 'grammar'), + (r'[A-Z]\w*(?:::[A-Z]\w*)*', Name.Namespace), + ], + 'grammar': [ + include('space'), + include('end'), + (r'rule\b', Keyword, 'rule'), + (r'include\b', Keyword, 'include'), + (r'[A-Z]\w*', Name), + ], + 'include': [ + include('space'), + (r'[A-Z]\w*(?:::[A-Z]\w*)*', Name.Class, '#pop'), + ], + 'rule': [ + include('space'), + include('end'), + (r'"(\\\\|\\"|[^"])*"', String.Double), + (r"'(\\\\|\\'|[^'])*'", String.Single), + (r'([A-Za-z_]\w*)(:)', bygroups(Name.Label, Punctuation)), + (r'[A-Za-z_]\w*', Name), + (r'[()]', Punctuation), + (r'[?+*/&!~]', Operator), + (r'\[(?:\\.|\[:\^?[a-z]+:\]|[^\\\]])+\]', String.Regex), + (r'([0-9]*)(\.\.)([0-9]*)', + bygroups(Number.Integer, Operator, Number.Integer)), + (r'(<)([^>]+)(>)', bygroups(Punctuation, Name.Class, Punctuation)), + (r'\{', Punctuation, 'inline_module'), + (r'\.', String.Regex), + ], + 'inline_module': [ + (r'\{', Other, 'ruby'), + (r'\}', Punctuation, '#pop'), + (r'[^{}]+', Other), + ], + 'ruby': [ + (r'\{', Other, '#push'), + (r'\}', Other, '#pop'), + (r'[^{}]+', Other), + ], + 'space': [ + (r'[ \t\n\r]+', Whitespace), + (r'#[^\n]*', Comment.Single), + ], + 'end': [ + (r'end\b', Keyword, '#pop'), + ], + } + + +class TreetopLexer(DelegatingLexer): + """ + A lexer for `Treetop `_ grammars. + + .. versionadded:: 1.6 + """ + + name = 'Treetop' + aliases = ['treetop'] + filenames = ['*.treetop', '*.tt'] + + def __init__(self, **options): + super(TreetopLexer, self).__init__(RubyLexer, TreetopBaseLexer, **options) + + +class EbnfLexer(RegexLexer): + """ + Lexer for `ISO/IEC 14977 EBNF + `_ + grammars. + + .. versionadded:: 2.0 + """ + + name = 'EBNF' + aliases = ['ebnf'] + filenames = ['*.ebnf'] + mimetypes = ['text/x-ebnf'] + + tokens = { + 'root': [ + include('whitespace'), + include('comment_start'), + include('identifier'), + (r'=', Operator, 'production'), + ], + 'production': [ + include('whitespace'), + include('comment_start'), + include('identifier'), + (r'"[^"]*"', String.Double), + (r"'[^']*'", String.Single), + (r'(\?[^?]*\?)', Name.Entity), + (r'[\[\]{}(),|]', Punctuation), + (r'-', Operator), + (r';', Punctuation, '#pop'), + (r'\.', Punctuation, '#pop'), + ], + 'whitespace': [ + (r'\s+', Text), + ], + 'comment_start': [ + (r'\(\*', Comment.Multiline, 'comment'), + ], + 'comment': [ + (r'[^*)]', Comment.Multiline), + include('comment_start'), + (r'\*\)', Comment.Multiline, '#pop'), + (r'[*)]', Comment.Multiline), + ], + 'identifier': [ + (r'([a-zA-Z][\w \-]*)', Keyword), + ], + } diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/pascal.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/pascal.py new file mode 100644 index 0000000000000000000000000000000000000000..9aa1ac8f8833c60416e1fa6fb6f8711b6d92aca0 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/pascal.py @@ -0,0 +1,644 @@ +# -*- coding: utf-8 -*- +""" + pygments.lexers.pascal + ~~~~~~~~~~~~~~~~~~~~~~ + + Lexers for Pascal family languages. + + :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS. + :license: BSD, see LICENSE for details. +""" + +import re + +from pygments.lexer import Lexer, RegexLexer, include, bygroups, words, \ + using, this, default +from pygments.util import get_bool_opt, get_list_opt +from pygments.token import Text, Comment, Operator, Keyword, Name, String, \ + Number, Punctuation, Error +from pygments.scanner import Scanner + +# compatibility import +from pygments.lexers.modula2 import Modula2Lexer + +__all__ = ['DelphiLexer', 'AdaLexer'] + + +class DelphiLexer(Lexer): + """ + For `Delphi `_ (Borland Object Pascal), + Turbo Pascal and Free Pascal source code. + + Additional options accepted: + + `turbopascal` + Highlight Turbo Pascal specific keywords (default: ``True``). + `delphi` + Highlight Borland Delphi specific keywords (default: ``True``). + `freepascal` + Highlight Free Pascal specific keywords (default: ``True``). + `units` + A list of units that should be considered builtin, supported are + ``System``, ``SysUtils``, ``Classes`` and ``Math``. + Default is to consider all of them builtin. + """ + name = 'Delphi' + aliases = ['delphi', 'pas', 'pascal', 'objectpascal'] + filenames = ['*.pas', '*.dpr'] + mimetypes = ['text/x-pascal'] + + TURBO_PASCAL_KEYWORDS = ( + 'absolute', 'and', 'array', 'asm', 'begin', 'break', 'case', + 'const', 'constructor', 'continue', 'destructor', 'div', 'do', + 'downto', 'else', 'end', 'file', 'for', 'function', 'goto', + 'if', 'implementation', 'in', 'inherited', 'inline', 'interface', + 'label', 'mod', 'nil', 'not', 'object', 'of', 'on', 'operator', + 'or', 'packed', 'procedure', 'program', 'record', 'reintroduce', + 'repeat', 'self', 'set', 'shl', 'shr', 'string', 'then', 'to', + 'type', 'unit', 'until', 'uses', 'var', 'while', 'with', 'xor' + ) + + DELPHI_KEYWORDS = ( + 'as', 'class', 'except', 'exports', 'finalization', 'finally', + 'initialization', 'is', 'library', 'on', 'property', 'raise', + 'threadvar', 'try' + ) + + FREE_PASCAL_KEYWORDS = ( + 'dispose', 'exit', 'false', 'new', 'true' + ) + + BLOCK_KEYWORDS = set(( + 'begin', 'class', 'const', 'constructor', 'destructor', 'end', + 'finalization', 'function', 'implementation', 'initialization', + 'label', 'library', 'operator', 'procedure', 'program', 'property', + 'record', 'threadvar', 'type', 'unit', 'uses', 'var' + )) + + FUNCTION_MODIFIERS = set(( + 'alias', 'cdecl', 'export', 'inline', 'interrupt', 'nostackframe', + 'pascal', 'register', 'safecall', 'softfloat', 'stdcall', + 'varargs', 'name', 'dynamic', 'near', 'virtual', 'external', + 'override', 'assembler' + )) + + # XXX: those aren't global. but currently we know no way for defining + # them just for the type context. + DIRECTIVES = set(( + 'absolute', 'abstract', 'assembler', 'cppdecl', 'default', 'far', + 'far16', 'forward', 'index', 'oldfpccall', 'private', 'protected', + 'published', 'public' + )) + + BUILTIN_TYPES = set(( + 'ansichar', 'ansistring', 'bool', 'boolean', 'byte', 'bytebool', + 'cardinal', 'char', 'comp', 'currency', 'double', 'dword', + 'extended', 'int64', 'integer', 'iunknown', 'longbool', 'longint', + 'longword', 'pansichar', 'pansistring', 'pbool', 'pboolean', + 'pbyte', 'pbytearray', 'pcardinal', 'pchar', 'pcomp', 'pcurrency', + 'pdate', 'pdatetime', 'pdouble', 'pdword', 'pextended', 'phandle', + 'pint64', 'pinteger', 'plongint', 'plongword', 'pointer', + 'ppointer', 'pshortint', 'pshortstring', 'psingle', 'psmallint', + 'pstring', 'pvariant', 'pwidechar', 'pwidestring', 'pword', + 'pwordarray', 'pwordbool', 'real', 'real48', 'shortint', + 'shortstring', 'single', 'smallint', 'string', 'tclass', 'tdate', + 'tdatetime', 'textfile', 'thandle', 'tobject', 'ttime', 'variant', + 'widechar', 'widestring', 'word', 'wordbool' + )) + + BUILTIN_UNITS = { + 'System': ( + 'abs', 'acquireexceptionobject', 'addr', 'ansitoutf8', + 'append', 'arctan', 'assert', 'assigned', 'assignfile', + 'beginthread', 'blockread', 'blockwrite', 'break', 'chdir', + 'chr', 'close', 'closefile', 'comptocurrency', 'comptodouble', + 'concat', 'continue', 'copy', 'cos', 'dec', 'delete', + 'dispose', 'doubletocomp', 'endthread', 'enummodules', + 'enumresourcemodules', 'eof', 'eoln', 'erase', 'exceptaddr', + 'exceptobject', 'exclude', 'exit', 'exp', 'filepos', 'filesize', + 'fillchar', 'finalize', 'findclasshinstance', 'findhinstance', + 'findresourcehinstance', 'flush', 'frac', 'freemem', + 'get8087cw', 'getdir', 'getlasterror', 'getmem', + 'getmemorymanager', 'getmodulefilename', 'getvariantmanager', + 'halt', 'hi', 'high', 'inc', 'include', 'initialize', 'insert', + 'int', 'ioresult', 'ismemorymanagerset', 'isvariantmanagerset', + 'length', 'ln', 'lo', 'low', 'mkdir', 'move', 'new', 'odd', + 'olestrtostring', 'olestrtostrvar', 'ord', 'paramcount', + 'paramstr', 'pi', 'pos', 'pred', 'ptr', 'pucs4chars', 'random', + 'randomize', 'read', 'readln', 'reallocmem', + 'releaseexceptionobject', 'rename', 'reset', 'rewrite', 'rmdir', + 'round', 'runerror', 'seek', 'seekeof', 'seekeoln', + 'set8087cw', 'setlength', 'setlinebreakstyle', + 'setmemorymanager', 'setstring', 'settextbuf', + 'setvariantmanager', 'sin', 'sizeof', 'slice', 'sqr', 'sqrt', + 'str', 'stringofchar', 'stringtoolestr', 'stringtowidechar', + 'succ', 'swap', 'trunc', 'truncate', 'typeinfo', + 'ucs4stringtowidestring', 'unicodetoutf8', 'uniquestring', + 'upcase', 'utf8decode', 'utf8encode', 'utf8toansi', + 'utf8tounicode', 'val', 'vararrayredim', 'varclear', + 'widecharlentostring', 'widecharlentostrvar', + 'widechartostring', 'widechartostrvar', + 'widestringtoucs4string', 'write', 'writeln' + ), + 'SysUtils': ( + 'abort', 'addexitproc', 'addterminateproc', 'adjustlinebreaks', + 'allocmem', 'ansicomparefilename', 'ansicomparestr', + 'ansicomparetext', 'ansidequotedstr', 'ansiextractquotedstr', + 'ansilastchar', 'ansilowercase', 'ansilowercasefilename', + 'ansipos', 'ansiquotedstr', 'ansisamestr', 'ansisametext', + 'ansistrcomp', 'ansistricomp', 'ansistrlastchar', 'ansistrlcomp', + 'ansistrlicomp', 'ansistrlower', 'ansistrpos', 'ansistrrscan', + 'ansistrscan', 'ansistrupper', 'ansiuppercase', + 'ansiuppercasefilename', 'appendstr', 'assignstr', 'beep', + 'booltostr', 'bytetocharindex', 'bytetocharlen', 'bytetype', + 'callterminateprocs', 'changefileext', 'charlength', + 'chartobyteindex', 'chartobytelen', 'comparemem', 'comparestr', + 'comparetext', 'createdir', 'createguid', 'currentyear', + 'currtostr', 'currtostrf', 'date', 'datetimetofiledate', + 'datetimetostr', 'datetimetostring', 'datetimetosystemtime', + 'datetimetotimestamp', 'datetostr', 'dayofweek', 'decodedate', + 'decodedatefully', 'decodetime', 'deletefile', 'directoryexists', + 'diskfree', 'disksize', 'disposestr', 'encodedate', 'encodetime', + 'exceptionerrormessage', 'excludetrailingbackslash', + 'excludetrailingpathdelimiter', 'expandfilename', + 'expandfilenamecase', 'expanduncfilename', 'extractfiledir', + 'extractfiledrive', 'extractfileext', 'extractfilename', + 'extractfilepath', 'extractrelativepath', 'extractshortpathname', + 'fileage', 'fileclose', 'filecreate', 'filedatetodatetime', + 'fileexists', 'filegetattr', 'filegetdate', 'fileisreadonly', + 'fileopen', 'fileread', 'filesearch', 'fileseek', 'filesetattr', + 'filesetdate', 'filesetreadonly', 'filewrite', 'finalizepackage', + 'findclose', 'findcmdlineswitch', 'findfirst', 'findnext', + 'floattocurr', 'floattodatetime', 'floattodecimal', 'floattostr', + 'floattostrf', 'floattotext', 'floattotextfmt', 'fmtloadstr', + 'fmtstr', 'forcedirectories', 'format', 'formatbuf', 'formatcurr', + 'formatdatetime', 'formatfloat', 'freeandnil', 'getcurrentdir', + 'getenvironmentvariable', 'getfileversion', 'getformatsettings', + 'getlocaleformatsettings', 'getmodulename', 'getpackagedescription', + 'getpackageinfo', 'gettime', 'guidtostring', 'incamonth', + 'includetrailingbackslash', 'includetrailingpathdelimiter', + 'incmonth', 'initializepackage', 'interlockeddecrement', + 'interlockedexchange', 'interlockedexchangeadd', + 'interlockedincrement', 'inttohex', 'inttostr', 'isdelimiter', + 'isequalguid', 'isleapyear', 'ispathdelimiter', 'isvalidident', + 'languages', 'lastdelimiter', 'loadpackage', 'loadstr', + 'lowercase', 'msecstotimestamp', 'newstr', 'nextcharindex', 'now', + 'outofmemoryerror', 'quotedstr', 'raiselastoserror', + 'raiselastwin32error', 'removedir', 'renamefile', 'replacedate', + 'replacetime', 'safeloadlibrary', 'samefilename', 'sametext', + 'setcurrentdir', 'showexception', 'sleep', 'stralloc', 'strbufsize', + 'strbytetype', 'strcat', 'strcharlength', 'strcomp', 'strcopy', + 'strdispose', 'strecopy', 'strend', 'strfmt', 'stricomp', + 'stringreplace', 'stringtoguid', 'strlcat', 'strlcomp', 'strlcopy', + 'strlen', 'strlfmt', 'strlicomp', 'strlower', 'strmove', 'strnew', + 'strnextchar', 'strpas', 'strpcopy', 'strplcopy', 'strpos', + 'strrscan', 'strscan', 'strtobool', 'strtobooldef', 'strtocurr', + 'strtocurrdef', 'strtodate', 'strtodatedef', 'strtodatetime', + 'strtodatetimedef', 'strtofloat', 'strtofloatdef', 'strtoint', + 'strtoint64', 'strtoint64def', 'strtointdef', 'strtotime', + 'strtotimedef', 'strupper', 'supports', 'syserrormessage', + 'systemtimetodatetime', 'texttofloat', 'time', 'timestamptodatetime', + 'timestamptomsecs', 'timetostr', 'trim', 'trimleft', 'trimright', + 'tryencodedate', 'tryencodetime', 'tryfloattocurr', 'tryfloattodatetime', + 'trystrtobool', 'trystrtocurr', 'trystrtodate', 'trystrtodatetime', + 'trystrtofloat', 'trystrtoint', 'trystrtoint64', 'trystrtotime', + 'unloadpackage', 'uppercase', 'widecomparestr', 'widecomparetext', + 'widefmtstr', 'wideformat', 'wideformatbuf', 'widelowercase', + 'widesamestr', 'widesametext', 'wideuppercase', 'win32check', + 'wraptext' + ), + 'Classes': ( + 'activateclassgroup', 'allocatehwnd', 'bintohex', 'checksynchronize', + 'collectionsequal', 'countgenerations', 'deallocatehwnd', 'equalrect', + 'extractstrings', 'findclass', 'findglobalcomponent', 'getclass', + 'groupdescendantswith', 'hextobin', 'identtoint', + 'initinheritedcomponent', 'inttoident', 'invalidpoint', + 'isuniqueglobalcomponentname', 'linestart', 'objectbinarytotext', + 'objectresourcetotext', 'objecttexttobinary', 'objecttexttoresource', + 'pointsequal', 'readcomponentres', 'readcomponentresex', + 'readcomponentresfile', 'rect', 'registerclass', 'registerclassalias', + 'registerclasses', 'registercomponents', 'registerintegerconsts', + 'registernoicon', 'registernonactivex', 'smallpoint', 'startclassgroup', + 'teststreamformat', 'unregisterclass', 'unregisterclasses', + 'unregisterintegerconsts', 'unregistermoduleclasses', + 'writecomponentresfile' + ), + 'Math': ( + 'arccos', 'arccosh', 'arccot', 'arccoth', 'arccsc', 'arccsch', 'arcsec', + 'arcsech', 'arcsin', 'arcsinh', 'arctan2', 'arctanh', 'ceil', + 'comparevalue', 'cosecant', 'cosh', 'cot', 'cotan', 'coth', 'csc', + 'csch', 'cycletodeg', 'cycletograd', 'cycletorad', 'degtocycle', + 'degtograd', 'degtorad', 'divmod', 'doubledecliningbalance', + 'ensurerange', 'floor', 'frexp', 'futurevalue', 'getexceptionmask', + 'getprecisionmode', 'getroundmode', 'gradtocycle', 'gradtodeg', + 'gradtorad', 'hypot', 'inrange', 'interestpayment', 'interestrate', + 'internalrateofreturn', 'intpower', 'isinfinite', 'isnan', 'iszero', + 'ldexp', 'lnxp1', 'log10', 'log2', 'logn', 'max', 'maxintvalue', + 'maxvalue', 'mean', 'meanandstddev', 'min', 'minintvalue', 'minvalue', + 'momentskewkurtosis', 'netpresentvalue', 'norm', 'numberofperiods', + 'payment', 'periodpayment', 'poly', 'popnstddev', 'popnvariance', + 'power', 'presentvalue', 'radtocycle', 'radtodeg', 'radtograd', + 'randg', 'randomrange', 'roundto', 'samevalue', 'sec', 'secant', + 'sech', 'setexceptionmask', 'setprecisionmode', 'setroundmode', + 'sign', 'simpleroundto', 'sincos', 'sinh', 'slndepreciation', 'stddev', + 'sum', 'sumint', 'sumofsquares', 'sumsandsquares', 'syddepreciation', + 'tan', 'tanh', 'totalvariance', 'variance' + ) + } + + ASM_REGISTERS = set(( + 'ah', 'al', 'ax', 'bh', 'bl', 'bp', 'bx', 'ch', 'cl', 'cr0', + 'cr1', 'cr2', 'cr3', 'cr4', 'cs', 'cx', 'dh', 'di', 'dl', 'dr0', + 'dr1', 'dr2', 'dr3', 'dr4', 'dr5', 'dr6', 'dr7', 'ds', 'dx', + 'eax', 'ebp', 'ebx', 'ecx', 'edi', 'edx', 'es', 'esi', 'esp', + 'fs', 'gs', 'mm0', 'mm1', 'mm2', 'mm3', 'mm4', 'mm5', 'mm6', + 'mm7', 'si', 'sp', 'ss', 'st0', 'st1', 'st2', 'st3', 'st4', 'st5', + 'st6', 'st7', 'xmm0', 'xmm1', 'xmm2', 'xmm3', 'xmm4', 'xmm5', + 'xmm6', 'xmm7' + )) + + ASM_INSTRUCTIONS = set(( + 'aaa', 'aad', 'aam', 'aas', 'adc', 'add', 'and', 'arpl', 'bound', + 'bsf', 'bsr', 'bswap', 'bt', 'btc', 'btr', 'bts', 'call', 'cbw', + 'cdq', 'clc', 'cld', 'cli', 'clts', 'cmc', 'cmova', 'cmovae', + 'cmovb', 'cmovbe', 'cmovc', 'cmovcxz', 'cmove', 'cmovg', + 'cmovge', 'cmovl', 'cmovle', 'cmovna', 'cmovnae', 'cmovnb', + 'cmovnbe', 'cmovnc', 'cmovne', 'cmovng', 'cmovnge', 'cmovnl', + 'cmovnle', 'cmovno', 'cmovnp', 'cmovns', 'cmovnz', 'cmovo', + 'cmovp', 'cmovpe', 'cmovpo', 'cmovs', 'cmovz', 'cmp', 'cmpsb', + 'cmpsd', 'cmpsw', 'cmpxchg', 'cmpxchg486', 'cmpxchg8b', 'cpuid', + 'cwd', 'cwde', 'daa', 'das', 'dec', 'div', 'emms', 'enter', 'hlt', + 'ibts', 'icebp', 'idiv', 'imul', 'in', 'inc', 'insb', 'insd', + 'insw', 'int', 'int01', 'int03', 'int1', 'int3', 'into', 'invd', + 'invlpg', 'iret', 'iretd', 'iretw', 'ja', 'jae', 'jb', 'jbe', + 'jc', 'jcxz', 'jcxz', 'je', 'jecxz', 'jg', 'jge', 'jl', 'jle', + 'jmp', 'jna', 'jnae', 'jnb', 'jnbe', 'jnc', 'jne', 'jng', 'jnge', + 'jnl', 'jnle', 'jno', 'jnp', 'jns', 'jnz', 'jo', 'jp', 'jpe', + 'jpo', 'js', 'jz', 'lahf', 'lar', 'lcall', 'lds', 'lea', 'leave', + 'les', 'lfs', 'lgdt', 'lgs', 'lidt', 'ljmp', 'lldt', 'lmsw', + 'loadall', 'loadall286', 'lock', 'lodsb', 'lodsd', 'lodsw', + 'loop', 'loope', 'loopne', 'loopnz', 'loopz', 'lsl', 'lss', 'ltr', + 'mov', 'movd', 'movq', 'movsb', 'movsd', 'movsw', 'movsx', + 'movzx', 'mul', 'neg', 'nop', 'not', 'or', 'out', 'outsb', 'outsd', + 'outsw', 'pop', 'popa', 'popad', 'popaw', 'popf', 'popfd', 'popfw', + 'push', 'pusha', 'pushad', 'pushaw', 'pushf', 'pushfd', 'pushfw', + 'rcl', 'rcr', 'rdmsr', 'rdpmc', 'rdshr', 'rdtsc', 'rep', 'repe', + 'repne', 'repnz', 'repz', 'ret', 'retf', 'retn', 'rol', 'ror', + 'rsdc', 'rsldt', 'rsm', 'sahf', 'sal', 'salc', 'sar', 'sbb', + 'scasb', 'scasd', 'scasw', 'seta', 'setae', 'setb', 'setbe', + 'setc', 'setcxz', 'sete', 'setg', 'setge', 'setl', 'setle', + 'setna', 'setnae', 'setnb', 'setnbe', 'setnc', 'setne', 'setng', + 'setnge', 'setnl', 'setnle', 'setno', 'setnp', 'setns', 'setnz', + 'seto', 'setp', 'setpe', 'setpo', 'sets', 'setz', 'sgdt', 'shl', + 'shld', 'shr', 'shrd', 'sidt', 'sldt', 'smi', 'smint', 'smintold', + 'smsw', 'stc', 'std', 'sti', 'stosb', 'stosd', 'stosw', 'str', + 'sub', 'svdc', 'svldt', 'svts', 'syscall', 'sysenter', 'sysexit', + 'sysret', 'test', 'ud1', 'ud2', 'umov', 'verr', 'verw', 'wait', + 'wbinvd', 'wrmsr', 'wrshr', 'xadd', 'xbts', 'xchg', 'xlat', + 'xlatb', 'xor' + )) + + def __init__(self, **options): + Lexer.__init__(self, **options) + self.keywords = set() + if get_bool_opt(options, 'turbopascal', True): + self.keywords.update(self.TURBO_PASCAL_KEYWORDS) + if get_bool_opt(options, 'delphi', True): + self.keywords.update(self.DELPHI_KEYWORDS) + if get_bool_opt(options, 'freepascal', True): + self.keywords.update(self.FREE_PASCAL_KEYWORDS) + self.builtins = set() + for unit in get_list_opt(options, 'units', list(self.BUILTIN_UNITS)): + self.builtins.update(self.BUILTIN_UNITS[unit]) + + def get_tokens_unprocessed(self, text): + scanner = Scanner(text, re.DOTALL | re.MULTILINE | re.IGNORECASE) + stack = ['initial'] + in_function_block = False + in_property_block = False + was_dot = False + next_token_is_function = False + next_token_is_property = False + collect_labels = False + block_labels = set() + brace_balance = [0, 0] + + while not scanner.eos: + token = Error + + if stack[-1] == 'initial': + if scanner.scan(r'\s+'): + token = Text + elif scanner.scan(r'\{.*?\}|\(\*.*?\*\)'): + if scanner.match.startswith('$'): + token = Comment.Preproc + else: + token = Comment.Multiline + elif scanner.scan(r'//.*?$'): + token = Comment.Single + elif scanner.scan(r'[-+*\/=<>:;,.@\^]'): + token = Operator + # stop label highlighting on next ";" + if collect_labels and scanner.match == ';': + collect_labels = False + elif scanner.scan(r'[\(\)\[\]]+'): + token = Punctuation + # abort function naming ``foo = Function(...)`` + next_token_is_function = False + # if we are in a function block we count the open + # braces because ootherwise it's impossible to + # determine the end of the modifier context + if in_function_block or in_property_block: + if scanner.match == '(': + brace_balance[0] += 1 + elif scanner.match == ')': + brace_balance[0] -= 1 + elif scanner.match == '[': + brace_balance[1] += 1 + elif scanner.match == ']': + brace_balance[1] -= 1 + elif scanner.scan(r'[A-Za-z_][A-Za-z_0-9]*'): + lowercase_name = scanner.match.lower() + if lowercase_name == 'result': + token = Name.Builtin.Pseudo + elif lowercase_name in self.keywords: + token = Keyword + # if we are in a special block and a + # block ending keyword occours (and the parenthesis + # is balanced) we end the current block context + if (in_function_block or in_property_block) and \ + lowercase_name in self.BLOCK_KEYWORDS and \ + brace_balance[0] <= 0 and \ + brace_balance[1] <= 0: + in_function_block = False + in_property_block = False + brace_balance = [0, 0] + block_labels = set() + if lowercase_name in ('label', 'goto'): + collect_labels = True + elif lowercase_name == 'asm': + stack.append('asm') + elif lowercase_name == 'property': + in_property_block = True + next_token_is_property = True + elif lowercase_name in ('procedure', 'operator', + 'function', 'constructor', + 'destructor'): + in_function_block = True + next_token_is_function = True + # we are in a function block and the current name + # is in the set of registered modifiers. highlight + # it as pseudo keyword + elif in_function_block and \ + lowercase_name in self.FUNCTION_MODIFIERS: + token = Keyword.Pseudo + # if we are in a property highlight some more + # modifiers + elif in_property_block and \ + lowercase_name in ('read', 'write'): + token = Keyword.Pseudo + next_token_is_function = True + # if the last iteration set next_token_is_function + # to true we now want this name highlighted as + # function. so do that and reset the state + elif next_token_is_function: + # Look if the next token is a dot. If yes it's + # not a function, but a class name and the + # part after the dot a function name + if scanner.test(r'\s*\.\s*'): + token = Name.Class + # it's not a dot, our job is done + else: + token = Name.Function + next_token_is_function = False + # same for properties + elif next_token_is_property: + token = Name.Property + next_token_is_property = False + # Highlight this token as label and add it + # to the list of known labels + elif collect_labels: + token = Name.Label + block_labels.add(scanner.match.lower()) + # name is in list of known labels + elif lowercase_name in block_labels: + token = Name.Label + elif lowercase_name in self.BUILTIN_TYPES: + token = Keyword.Type + elif lowercase_name in self.DIRECTIVES: + token = Keyword.Pseudo + # builtins are just builtins if the token + # before isn't a dot + elif not was_dot and lowercase_name in self.builtins: + token = Name.Builtin + else: + token = Name + elif scanner.scan(r"'"): + token = String + stack.append('string') + elif scanner.scan(r'\#(\d+|\$[0-9A-Fa-f]+)'): + token = String.Char + elif scanner.scan(r'\$[0-9A-Fa-f]+'): + token = Number.Hex + elif scanner.scan(r'\d+(?![eE]|\.[^.])'): + token = Number.Integer + elif scanner.scan(r'\d+(\.\d+([eE][+-]?\d+)?|[eE][+-]?\d+)'): + token = Number.Float + else: + # if the stack depth is deeper than once, pop + if len(stack) > 1: + stack.pop() + scanner.get_char() + + elif stack[-1] == 'string': + if scanner.scan(r"''"): + token = String.Escape + elif scanner.scan(r"'"): + token = String + stack.pop() + elif scanner.scan(r"[^']*"): + token = String + else: + scanner.get_char() + stack.pop() + + elif stack[-1] == 'asm': + if scanner.scan(r'\s+'): + token = Text + elif scanner.scan(r'end'): + token = Keyword + stack.pop() + elif scanner.scan(r'\{.*?\}|\(\*.*?\*\)'): + if scanner.match.startswith('$'): + token = Comment.Preproc + else: + token = Comment.Multiline + elif scanner.scan(r'//.*?$'): + token = Comment.Single + elif scanner.scan(r"'"): + token = String + stack.append('string') + elif scanner.scan(r'@@[A-Za-z_][A-Za-z_0-9]*'): + token = Name.Label + elif scanner.scan(r'[A-Za-z_][A-Za-z_0-9]*'): + lowercase_name = scanner.match.lower() + if lowercase_name in self.ASM_INSTRUCTIONS: + token = Keyword + elif lowercase_name in self.ASM_REGISTERS: + token = Name.Builtin + else: + token = Name + elif scanner.scan(r'[-+*\/=<>:;,.@\^]+'): + token = Operator + elif scanner.scan(r'[\(\)\[\]]+'): + token = Punctuation + elif scanner.scan(r'\$[0-9A-Fa-f]+'): + token = Number.Hex + elif scanner.scan(r'\d+(?![eE]|\.[^.])'): + token = Number.Integer + elif scanner.scan(r'\d+(\.\d+([eE][+-]?\d+)?|[eE][+-]?\d+)'): + token = Number.Float + else: + scanner.get_char() + stack.pop() + + # save the dot!!!11 + if scanner.match.strip(): + was_dot = scanner.match == '.' + yield scanner.start_pos, token, scanner.match or '' + + +class AdaLexer(RegexLexer): + """ + For Ada source code. + + .. versionadded:: 1.3 + """ + + name = 'Ada' + aliases = ['ada', 'ada95', 'ada2005'] + filenames = ['*.adb', '*.ads', '*.ada'] + mimetypes = ['text/x-ada'] + + flags = re.MULTILINE | re.IGNORECASE + + tokens = { + 'root': [ + (r'[^\S\n]+', Text), + (r'--.*?\n', Comment.Single), + (r'[^\S\n]+', Text), + (r'function|procedure|entry', Keyword.Declaration, 'subprogram'), + (r'(subtype|type)(\s+)(\w+)', + bygroups(Keyword.Declaration, Text, Keyword.Type), 'type_def'), + (r'task|protected', Keyword.Declaration), + (r'(subtype)(\s+)', bygroups(Keyword.Declaration, Text)), + (r'(end)(\s+)', bygroups(Keyword.Reserved, Text), 'end'), + (r'(pragma)(\s+)(\w+)', bygroups(Keyword.Reserved, Text, + Comment.Preproc)), + (r'(true|false|null)\b', Keyword.Constant), + (words(( + 'Address', 'Byte', 'Boolean', 'Character', 'Controlled', 'Count', + 'Cursor', 'Duration', 'File_Mode', 'File_Type', 'Float', 'Generator', + 'Integer', 'Long_Float', 'Long_Integer', 'Long_Long_Float', + 'Long_Long_Integer', 'Natural', 'Positive', 'Reference_Type', + 'Short_Float', 'Short_Integer', 'Short_Short_Float', + 'Short_Short_Integer', 'String', 'Wide_Character', 'Wide_String'), + suffix=r'\b'), + Keyword.Type), + (r'(and(\s+then)?|in|mod|not|or(\s+else)|rem)\b', Operator.Word), + (r'generic|private', Keyword.Declaration), + (r'package', Keyword.Declaration, 'package'), + (r'array\b', Keyword.Reserved, 'array_def'), + (r'(with|use)(\s+)', bygroups(Keyword.Namespace, Text), 'import'), + (r'(\w+)(\s*)(:)(\s*)(constant)', + bygroups(Name.Constant, Text, Punctuation, Text, + Keyword.Reserved)), + (r'<<\w+>>', Name.Label), + (r'(\w+)(\s*)(:)(\s*)(declare|begin|loop|for|while)', + bygroups(Name.Label, Text, Punctuation, Text, Keyword.Reserved)), + (words(( + 'abort', 'abs', 'abstract', 'accept', 'access', 'aliased', 'all', + 'array', 'at', 'begin', 'body', 'case', 'constant', 'declare', + 'delay', 'delta', 'digits', 'do', 'else', 'elsif', 'end', 'entry', + 'exception', 'exit', 'interface', 'for', 'goto', 'if', 'is', 'limited', + 'loop', 'new', 'null', 'of', 'or', 'others', 'out', 'overriding', + 'pragma', 'protected', 'raise', 'range', 'record', 'renames', 'requeue', + 'return', 'reverse', 'select', 'separate', 'subtype', 'synchronized', + 'task', 'tagged', 'terminate', 'then', 'type', 'until', 'when', + 'while', 'xor'), prefix=r'\b', suffix=r'\b'), + Keyword.Reserved), + (r'"[^"]*"', String), + include('attribute'), + include('numbers'), + (r"'[^']'", String.Character), + (r'(\w+)(\s*|[(,])', bygroups(Name, using(this))), + (r"(<>|=>|:=|[()|:;,.'])", Punctuation), + (r'[*<>+=/&-]', Operator), + (r'\n+', Text), + ], + 'numbers': [ + (r'[0-9_]+#[0-9a-f]+#', Number.Hex), + (r'[0-9_]+\.[0-9_]*', Number.Float), + (r'[0-9_]+', Number.Integer), + ], + 'attribute': [ + (r"(')(\w+)", bygroups(Punctuation, Name.Attribute)), + ], + 'subprogram': [ + (r'\(', Punctuation, ('#pop', 'formal_part')), + (r';', Punctuation, '#pop'), + (r'is\b', Keyword.Reserved, '#pop'), + (r'"[^"]+"|\w+', Name.Function), + include('root'), + ], + 'end': [ + ('(if|case|record|loop|select)', Keyword.Reserved), + ('"[^"]+"|[\w.]+', Name.Function), + ('\s+', Text), + (';', Punctuation, '#pop'), + ], + 'type_def': [ + (r';', Punctuation, '#pop'), + (r'\(', Punctuation, 'formal_part'), + (r'with|and|use', Keyword.Reserved), + (r'array\b', Keyword.Reserved, ('#pop', 'array_def')), + (r'record\b', Keyword.Reserved, ('record_def')), + (r'(null record)(;)', bygroups(Keyword.Reserved, Punctuation), '#pop'), + include('root'), + ], + 'array_def': [ + (r';', Punctuation, '#pop'), + (r'(\w+)(\s+)(range)', bygroups(Keyword.Type, Text, Keyword.Reserved)), + include('root'), + ], + 'record_def': [ + (r'end record', Keyword.Reserved, '#pop'), + include('root'), + ], + 'import': [ + (r'[\w.]+', Name.Namespace, '#pop'), + default('#pop'), + ], + 'formal_part': [ + (r'\)', Punctuation, '#pop'), + (r'\w+', Name.Variable), + (r',|:[^=]', Punctuation), + (r'(in|not|null|out|access)\b', Keyword.Reserved), + include('root'), + ], + 'package': [ + ('body', Keyword.Declaration), + ('is\s+new|renames', Keyword.Reserved), + ('is', Keyword.Reserved, '#pop'), + (';', Punctuation, '#pop'), + ('\(', Punctuation, 'package_instantiation'), + ('([\w.]+)', Name.Class), + include('root'), + ], + 'package_instantiation': [ + (r'("[^"]+"|\w+)(\s+)(=>)', bygroups(Name.Variable, Text, Punctuation)), + (r'[\w.\'"]', Text), + (r'\)', Punctuation, '#pop'), + include('root'), + ], + } diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/pawn.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/pawn.py new file mode 100644 index 0000000000000000000000000000000000000000..f462a883c1c6d4425e3f5e95eb3a32977188c5f0 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/pawn.py @@ -0,0 +1,199 @@ +# -*- coding: utf-8 -*- +""" + pygments.lexers.pawn + ~~~~~~~~~~~~~~~~~~~~ + + Lexers for the Pawn languages. + + :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS. + :license: BSD, see LICENSE for details. +""" + +from pygments.lexer import RegexLexer +from pygments.token import Text, Comment, Operator, Keyword, Name, String, \ + Number, Punctuation, Error +from pygments.util import get_bool_opt + +__all__ = ['SourcePawnLexer', 'PawnLexer'] + + +class SourcePawnLexer(RegexLexer): + """ + For SourcePawn source code with preprocessor directives. + + .. versionadded:: 1.6 + """ + name = 'SourcePawn' + aliases = ['sp'] + filenames = ['*.sp'] + mimetypes = ['text/x-sourcepawn'] + + #: optional Comment or Whitespace + _ws = r'(?:\s|//.*?\n|/\*.*?\*/)+' + #: only one /* */ style comment + _ws1 = r'\s*(?:/[*].*?[*]/\s*)*' + + tokens = { + 'root': [ + # preprocessor directives: without whitespace + ('^#if\s+0', Comment.Preproc, 'if0'), + ('^#', Comment.Preproc, 'macro'), + # or with whitespace + ('^' + _ws1 + r'#if\s+0', Comment.Preproc, 'if0'), + ('^' + _ws1 + '#', Comment.Preproc, 'macro'), + (r'\n', Text), + (r'\s+', Text), + (r'\\\n', Text), # line continuation + (r'/(\\\n)?/(\n|(.|\n)*?[^\\]\n)', Comment.Single), + (r'/(\\\n)?\*(.|\n)*?\*(\\\n)?/', Comment.Multiline), + (r'[{}]', Punctuation), + (r'L?"', String, 'string'), + (r"L?'(\\.|\\[0-7]{1,3}|\\x[a-fA-F0-9]{1,2}|[^\\\'\n])'", String.Char), + (r'(\d+\.\d*|\.\d+|\d+)[eE][+-]?\d+[LlUu]*', Number.Float), + (r'(\d+\.\d*|\.\d+|\d+[fF])[fF]?', Number.Float), + (r'0x[0-9a-fA-F]+[LlUu]*', Number.Hex), + (r'0[0-7]+[LlUu]*', Number.Oct), + (r'\d+[LlUu]*', Number.Integer), + (r'\*/', Error), + (r'[~!%^&*+=|?:<>/-]', Operator), + (r'[()\[\],.;]', Punctuation), + (r'(case|const|continue|native|' + r'default|else|enum|for|if|new|operator|' + r'public|return|sizeof|static|decl|struct|switch)\b', Keyword), + (r'(bool|Float)\b', Keyword.Type), + (r'(true|false)\b', Keyword.Constant), + ('[a-zA-Z_]\w*', Name), + ], + 'string': [ + (r'"', String, '#pop'), + (r'\\([\\abfnrtv"\']|x[a-fA-F0-9]{2,4}|[0-7]{1,3})', String.Escape), + (r'[^\\"\n]+', String), # all other characters + (r'\\\n', String), # line continuation + (r'\\', String), # stray backslash + ], + 'macro': [ + (r'[^/\n]+', Comment.Preproc), + (r'/\*(.|\n)*?\*/', Comment.Multiline), + (r'//.*?\n', Comment.Single, '#pop'), + (r'/', Comment.Preproc), + (r'(?<=\\)\n', Comment.Preproc), + (r'\n', Comment.Preproc, '#pop'), + ], + 'if0': [ + (r'^\s*#if.*?(?/-]', Operator), + (r'[()\[\],.;]', Punctuation), + (r'(switch|case|default|const|new|static|char|continue|break|' + r'if|else|for|while|do|operator|enum|' + r'public|return|sizeof|tagof|state|goto)\b', Keyword), + (r'(bool|Float)\b', Keyword.Type), + (r'(true|false)\b', Keyword.Constant), + ('[a-zA-Z_]\w*', Name), + ], + 'string': [ + (r'"', String, '#pop'), + (r'\\([\\abfnrtv"\']|x[a-fA-F0-9]{2,4}|[0-7]{1,3})', String.Escape), + (r'[^\\"\n]+', String), # all other characters + (r'\\\n', String), # line continuation + (r'\\', String), # stray backslash + ], + 'macro': [ + (r'[^/\n]+', Comment.Preproc), + (r'/\*(.|\n)*?\*/', Comment.Multiline), + (r'//.*?\n', Comment.Single, '#pop'), + (r'/', Comment.Preproc), + (r'(?<=\\)\n', Comment.Preproc), + (r'\n', Comment.Preproc, '#pop'), + ], + 'if0': [ + (r'^\s*#if.*?(?`_ source code. + """ + + name = 'Perl' + aliases = ['perl', 'pl'] + filenames = ['*.pl', '*.pm', '*.t'] + mimetypes = ['text/x-perl', 'application/x-perl'] + + flags = re.DOTALL | re.MULTILINE + # TODO: give this to a perl guy who knows how to parse perl... + tokens = { + 'balanced-regex': [ + (r'/(\\\\|\\[^\\]|[^\\/])*/[egimosx]*', String.Regex, '#pop'), + (r'!(\\\\|\\[^\\]|[^\\!])*![egimosx]*', String.Regex, '#pop'), + (r'\\(\\\\|[^\\])*\\[egimosx]*', String.Regex, '#pop'), + (r'\{(\\\\|\\[^\\]|[^\\}])*\}[egimosx]*', String.Regex, '#pop'), + (r'<(\\\\|\\[^\\]|[^\\>])*>[egimosx]*', String.Regex, '#pop'), + (r'\[(\\\\|\\[^\\]|[^\\\]])*\][egimosx]*', String.Regex, '#pop'), + (r'\((\\\\|\\[^\\]|[^\\)])*\)[egimosx]*', String.Regex, '#pop'), + (r'@(\\\\|\\[^\\]|[^\\@])*@[egimosx]*', String.Regex, '#pop'), + (r'%(\\\\|\\[^\\]|[^\\%])*%[egimosx]*', String.Regex, '#pop'), + (r'\$(\\\\|\\[^\\]|[^\\$])*\$[egimosx]*', String.Regex, '#pop'), + ], + 'root': [ + (r'\A\#!.+?$', Comment.Hashbang), + (r'\#.*?$', Comment.Single), + (r'^=[a-zA-Z0-9]+\s+.*?\n=cut', Comment.Multiline), + (words(( + 'case', 'continue', 'do', 'else', 'elsif', 'for', 'foreach', + 'if', 'last', 'my', 'next', 'our', 'redo', 'reset', 'then', + 'unless', 'until', 'while', 'print', 'new', 'BEGIN', + 'CHECK', 'INIT', 'END', 'return'), suffix=r'\b'), + Keyword), + (r'(format)(\s+)(\w+)(\s*)(=)(\s*\n)', + bygroups(Keyword, Text, Name, Text, Punctuation, Text), 'format'), + (r'(eq|lt|gt|le|ge|ne|not|and|or|cmp)\b', Operator.Word), + # common delimiters + (r's/(\\\\|\\[^\\]|[^\\/])*/(\\\\|\\[^\\]|[^\\/])*/[egimosx]*', + String.Regex), + (r's!(\\\\|\\!|[^!])*!(\\\\|\\!|[^!])*![egimosx]*', String.Regex), + (r's\\(\\\\|[^\\])*\\(\\\\|[^\\])*\\[egimosx]*', String.Regex), + (r's@(\\\\|\\[^\\]|[^\\@])*@(\\\\|\\[^\\]|[^\\@])*@[egimosx]*', + String.Regex), + (r's%(\\\\|\\[^\\]|[^\\%])*%(\\\\|\\[^\\]|[^\\%])*%[egimosx]*', + String.Regex), + # balanced delimiters + (r's\{(\\\\|\\[^\\]|[^\\}])*\}\s*', String.Regex, 'balanced-regex'), + (r's<(\\\\|\\[^\\]|[^\\>])*>\s*', String.Regex, 'balanced-regex'), + (r's\[(\\\\|\\[^\\]|[^\\\]])*\]\s*', String.Regex, + 'balanced-regex'), + (r's\((\\\\|\\[^\\]|[^\\)])*\)\s*', String.Regex, + 'balanced-regex'), + + (r'm?/(\\\\|\\[^\\]|[^\\/\n])*/[gcimosx]*', String.Regex), + (r'm(?=[/!\\{<\[(@%$])', String.Regex, 'balanced-regex'), + (r'((?<==~)|(?<=\())\s*/(\\\\|\\[^\\]|[^\\/])*/[gcimosx]*', + String.Regex), + (r'\s+', Text), + (words(( + 'abs', 'accept', 'alarm', 'atan2', 'bind', 'binmode', 'bless', 'caller', 'chdir', + 'chmod', 'chomp', 'chop', 'chown', 'chr', 'chroot', 'close', 'closedir', 'connect', + 'continue', 'cos', 'crypt', 'dbmclose', 'dbmopen', 'defined', 'delete', 'die', + 'dump', 'each', 'endgrent', 'endhostent', 'endnetent', 'endprotoent', + 'endpwent', 'endservent', 'eof', 'eval', 'exec', 'exists', 'exit', 'exp', 'fcntl', + 'fileno', 'flock', 'fork', 'format', 'formline', 'getc', 'getgrent', 'getgrgid', + 'getgrnam', 'gethostbyaddr', 'gethostbyname', 'gethostent', 'getlogin', + 'getnetbyaddr', 'getnetbyname', 'getnetent', 'getpeername', 'getpgrp', + 'getppid', 'getpriority', 'getprotobyname', 'getprotobynumber', + 'getprotoent', 'getpwent', 'getpwnam', 'getpwuid', 'getservbyname', + 'getservbyport', 'getservent', 'getsockname', 'getsockopt', 'glob', 'gmtime', + 'goto', 'grep', 'hex', 'import', 'index', 'int', 'ioctl', 'join', 'keys', 'kill', 'last', + 'lc', 'lcfirst', 'length', 'link', 'listen', 'local', 'localtime', 'log', 'lstat', + 'map', 'mkdir', 'msgctl', 'msgget', 'msgrcv', 'msgsnd', 'my', 'next', 'oct', 'open', + 'opendir', 'ord', 'our', 'pack', 'pipe', 'pop', 'pos', 'printf', + 'prototype', 'push', 'quotemeta', 'rand', 'read', 'readdir', + 'readline', 'readlink', 'readpipe', 'recv', 'redo', 'ref', 'rename', + 'reverse', 'rewinddir', 'rindex', 'rmdir', 'scalar', 'seek', 'seekdir', + 'select', 'semctl', 'semget', 'semop', 'send', 'setgrent', 'sethostent', 'setnetent', + 'setpgrp', 'setpriority', 'setprotoent', 'setpwent', 'setservent', + 'setsockopt', 'shift', 'shmctl', 'shmget', 'shmread', 'shmwrite', 'shutdown', + 'sin', 'sleep', 'socket', 'socketpair', 'sort', 'splice', 'split', 'sprintf', 'sqrt', + 'srand', 'stat', 'study', 'substr', 'symlink', 'syscall', 'sysopen', 'sysread', + 'sysseek', 'system', 'syswrite', 'tell', 'telldir', 'tie', 'tied', 'time', 'times', 'tr', + 'truncate', 'uc', 'ucfirst', 'umask', 'undef', 'unlink', 'unpack', 'unshift', 'untie', + 'utime', 'values', 'vec', 'wait', 'waitpid', 'wantarray', 'warn', 'write'), suffix=r'\b'), + Name.Builtin), + (r'((__(DATA|DIE|WARN)__)|(STD(IN|OUT|ERR)))\b', Name.Builtin.Pseudo), + (r'(<<)([\'"]?)([a-zA-Z_]\w*)(\2;?\n.*?\n)(\3)(\n)', + bygroups(String, String, String.Delimiter, String, String.Delimiter, Text)), + (r'__END__', Comment.Preproc, 'end-part'), + (r'\$\^[ADEFHILMOPSTWX]', Name.Variable.Global), + (r"\$[\\\"\[\]'&`+*.,;=%~?@$!<>(^|/-](?!\w)", Name.Variable.Global), + (r'[$@%#]+', Name.Variable, 'varname'), + (r'0_?[0-7]+(_[0-7]+)*', Number.Oct), + (r'0x[0-9A-Fa-f]+(_[0-9A-Fa-f]+)*', Number.Hex), + (r'0b[01]+(_[01]+)*', Number.Bin), + (r'(?i)(\d*(_\d*)*\.\d+(_\d*)*|\d+(_\d*)*\.\d+(_\d*)*)(e[+-]?\d+)?', + Number.Float), + (r'(?i)\d+(_\d*)*e[+-]?\d+(_\d*)*', Number.Float), + (r'\d+(_\d+)*', Number.Integer), + (r"'(\\\\|\\[^\\]|[^'\\])*'", String), + (r'"(\\\\|\\[^\\]|[^"\\])*"', String), + (r'`(\\\\|\\[^\\]|[^`\\])*`', String.Backtick), + (r'<([^\s>]+)>', String.Regex), + (r'(q|qq|qw|qr|qx)\{', String.Other, 'cb-string'), + (r'(q|qq|qw|qr|qx)\(', String.Other, 'rb-string'), + (r'(q|qq|qw|qr|qx)\[', String.Other, 'sb-string'), + (r'(q|qq|qw|qr|qx)\<', String.Other, 'lt-string'), + (r'(q|qq|qw|qr|qx)([\W_])(.|\n)*?\2', String.Other), + (r'(package)(\s+)([a-zA-Z_]\w*(?:::[a-zA-Z_]\w*)*)', + bygroups(Keyword, Text, Name.Namespace)), + (r'(use|require|no)(\s+)([a-zA-Z_]\w*(?:::[a-zA-Z_]\w*)*)', + bygroups(Keyword, Text, Name.Namespace)), + (r'(sub)(\s+)', bygroups(Keyword, Text), 'funcname'), + (words(( + 'no', 'package', 'require', 'use'), suffix=r'\b'), + Keyword), + (r'(\[\]|\*\*|::|<<|>>|>=|<=>|<=|={3}|!=|=~|' + r'!~|&&?|\|\||\.{1,3})', Operator), + (r'[-+/*%=<>&^|!\\~]=?', Operator), + (r'[()\[\]:;,<>/?{}]', Punctuation), # yes, there's no shortage + # of punctuation in Perl! + (r'(?=\w)', Name, 'name'), + ], + 'format': [ + (r'\.\n', String.Interpol, '#pop'), + (r'[^\n]*\n', String.Interpol), + ], + 'varname': [ + (r'\s+', Text), + (r'\{', Punctuation, '#pop'), # hash syntax? + (r'\)|,', Punctuation, '#pop'), # argument specifier + (r'\w+::', Name.Namespace), + (r'[\w:]+', Name.Variable, '#pop'), + ], + 'name': [ + (r'[a-zA-Z_]\w*(::[a-zA-Z_]\w*)*(::)?(?=\s*->)', Name.Namespace, '#pop'), + (r'[a-zA-Z_]\w*(::[a-zA-Z_]\w*)*::', Name.Namespace, '#pop'), + (r'[\w:]+', Name, '#pop'), + (r'[A-Z_]+(?=\W)', Name.Constant, '#pop'), + (r'(?=\W)', Text, '#pop'), + ], + 'funcname': [ + (r'[a-zA-Z_]\w*[!?]?', Name.Function), + (r'\s+', Text), + # argument declaration + (r'(\([$@%]*\))(\s*)', bygroups(Punctuation, Text)), + (r';', Punctuation, '#pop'), + (r'.*?\{', Punctuation, '#pop'), + ], + 'cb-string': [ + (r'\\[{}\\]', String.Other), + (r'\\', String.Other), + (r'\{', String.Other, 'cb-string'), + (r'\}', String.Other, '#pop'), + (r'[^{}\\]+', String.Other) + ], + 'rb-string': [ + (r'\\[()\\]', String.Other), + (r'\\', String.Other), + (r'\(', String.Other, 'rb-string'), + (r'\)', String.Other, '#pop'), + (r'[^()]+', String.Other) + ], + 'sb-string': [ + (r'\\[\[\]\\]', String.Other), + (r'\\', String.Other), + (r'\[', String.Other, 'sb-string'), + (r'\]', String.Other, '#pop'), + (r'[^\[\]]+', String.Other) + ], + 'lt-string': [ + (r'\\[<>\\]', String.Other), + (r'\\', String.Other), + (r'\<', String.Other, 'lt-string'), + (r'\>', String.Other, '#pop'), + (r'[^<>]+', String.Other) + ], + 'end-part': [ + (r'.+', Comment.Preproc, '#pop') + ] + } + + def analyse_text(text): + if shebang_matches(text, r'perl'): + return True + if re.search('(?:my|our)\s+[$@%(]', text): + return 0.9 + + +class Perl6Lexer(ExtendedRegexLexer): + """ + For `Perl 6 `_ source code. + + .. versionadded:: 2.0 + """ + + name = 'Perl6' + aliases = ['perl6', 'pl6'] + filenames = ['*.pl', '*.pm', '*.nqp', '*.p6', '*.6pl', '*.p6l', '*.pl6', + '*.6pm', '*.p6m', '*.pm6', '*.t'] + mimetypes = ['text/x-perl6', 'application/x-perl6'] + flags = re.MULTILINE | re.DOTALL | re.UNICODE + + PERL6_IDENTIFIER_RANGE = "['\w:-]" + + PERL6_KEYWORDS = ( + 'BEGIN', 'CATCH', 'CHECK', 'CONTROL', 'END', 'ENTER', 'FIRST', 'INIT', + 'KEEP', 'LAST', 'LEAVE', 'NEXT', 'POST', 'PRE', 'START', 'TEMP', + 'UNDO', 'as', 'assoc', 'async', 'augment', 'binary', 'break', 'but', + 'cached', 'category', 'class', 'constant', 'contend', 'continue', + 'copy', 'deep', 'default', 'defequiv', 'defer', 'die', 'do', 'else', + 'elsif', 'enum', 'equiv', 'exit', 'export', 'fail', 'fatal', 'for', + 'gather', 'given', 'goto', 'grammar', 'handles', 'has', 'if', 'inline', + 'irs', 'is', 'last', 'leave', 'let', 'lift', 'loop', 'looser', 'macro', + 'make', 'maybe', 'method', 'module', 'multi', 'my', 'next', 'of', + 'ofs', 'only', 'oo', 'ors', 'our', 'package', 'parsed', 'prec', + 'proto', 'readonly', 'redo', 'ref', 'regex', 'reparsed', 'repeat', + 'require', 'required', 'return', 'returns', 'role', 'rule', 'rw', + 'self', 'slang', 'state', 'sub', 'submethod', 'subset', 'supersede', + 'take', 'temp', 'tighter', 'token', 'trusts', 'try', 'unary', + 'unless', 'until', 'use', 'warn', 'when', 'where', 'while', 'will', + ) + + PERL6_BUILTINS = ( + 'ACCEPTS', 'HOW', 'REJECTS', 'VAR', 'WHAT', 'WHENCE', 'WHERE', 'WHICH', + 'WHO', 'abs', 'acos', 'acosec', 'acosech', 'acosh', 'acotan', 'acotanh', + 'all', 'any', 'approx', 'arity', 'asec', 'asech', 'asin', 'asinh', + 'assuming', 'atan', 'atan2', 'atanh', 'attr', 'bless', 'body', 'by', + 'bytes', 'caller', 'callsame', 'callwith', 'can', 'capitalize', 'cat', + 'ceiling', 'chars', 'chmod', 'chomp', 'chop', 'chr', 'chroot', + 'circumfix', 'cis', 'classify', 'clone', 'close', 'cmp_ok', 'codes', + 'comb', 'connect', 'contains', 'context', 'cos', 'cosec', 'cosech', + 'cosh', 'cotan', 'cotanh', 'count', 'defined', 'delete', 'diag', + 'dies_ok', 'does', 'e', 'each', 'eager', 'elems', 'end', 'eof', 'eval', + 'eval_dies_ok', 'eval_elsewhere', 'eval_lives_ok', 'evalfile', 'exists', + 'exp', 'first', 'flip', 'floor', 'flunk', 'flush', 'fmt', 'force_todo', + 'fork', 'from', 'getc', 'gethost', 'getlogin', 'getpeername', 'getpw', + 'gmtime', 'graphs', 'grep', 'hints', 'hyper', 'im', 'index', 'infix', + 'invert', 'is_approx', 'is_deeply', 'isa', 'isa_ok', 'isnt', 'iterator', + 'join', 'key', 'keys', 'kill', 'kv', 'lastcall', 'lazy', 'lc', 'lcfirst', + 'like', 'lines', 'link', 'lives_ok', 'localtime', 'log', 'log10', 'map', + 'max', 'min', 'minmax', 'name', 'new', 'nextsame', 'nextwith', 'nfc', + 'nfd', 'nfkc', 'nfkd', 'nok_error', 'nonce', 'none', 'normalize', 'not', + 'nothing', 'ok', 'once', 'one', 'open', 'opendir', 'operator', 'ord', + 'p5chomp', 'p5chop', 'pack', 'pair', 'pairs', 'pass', 'perl', 'pi', + 'pick', 'plan', 'plan_ok', 'polar', 'pop', 'pos', 'postcircumfix', + 'postfix', 'pred', 'prefix', 'print', 'printf', 'push', 'quasi', + 'quotemeta', 'rand', 're', 'read', 'readdir', 'readline', 'reduce', + 'reverse', 'rewind', 'rewinddir', 'rindex', 'roots', 'round', + 'roundrobin', 'run', 'runinstead', 'sameaccent', 'samecase', 'say', + 'sec', 'sech', 'sech', 'seek', 'shape', 'shift', 'sign', 'signature', + 'sin', 'sinh', 'skip', 'skip_rest', 'sleep', 'slurp', 'sort', 'splice', + 'split', 'sprintf', 'sqrt', 'srand', 'strand', 'subst', 'substr', 'succ', + 'sum', 'symlink', 'tan', 'tanh', 'throws_ok', 'time', 'times', 'to', + 'todo', 'trim', 'trim_end', 'trim_start', 'true', 'truncate', 'uc', + 'ucfirst', 'undef', 'undefine', 'uniq', 'unlike', 'unlink', 'unpack', + 'unpolar', 'unshift', 'unwrap', 'use_ok', 'value', 'values', 'vec', + 'version_lt', 'void', 'wait', 'want', 'wrap', 'write', 'zip', + ) + + PERL6_BUILTIN_CLASSES = ( + 'Abstraction', 'Any', 'AnyChar', 'Array', 'Associative', 'Bag', 'Bit', + 'Blob', 'Block', 'Bool', 'Buf', 'Byte', 'Callable', 'Capture', 'Char', 'Class', + 'Code', 'Codepoint', 'Comparator', 'Complex', 'Decreasing', 'Exception', + 'Failure', 'False', 'Grammar', 'Grapheme', 'Hash', 'IO', 'Increasing', + 'Int', 'Junction', 'KeyBag', 'KeyExtractor', 'KeyHash', 'KeySet', + 'KitchenSink', 'List', 'Macro', 'Mapping', 'Match', 'Matcher', 'Method', + 'Module', 'Num', 'Object', 'Ordered', 'Ordering', 'OrderingPair', + 'Package', 'Pair', 'Positional', 'Proxy', 'Range', 'Rat', 'Regex', + 'Role', 'Routine', 'Scalar', 'Seq', 'Set', 'Signature', 'Str', 'StrLen', + 'StrPos', 'Sub', 'Submethod', 'True', 'UInt', 'Undef', 'Version', 'Void', + 'Whatever', 'bit', 'bool', 'buf', 'buf1', 'buf16', 'buf2', 'buf32', + 'buf4', 'buf64', 'buf8', 'complex', 'int', 'int1', 'int16', 'int2', + 'int32', 'int4', 'int64', 'int8', 'num', 'rat', 'rat1', 'rat16', 'rat2', + 'rat32', 'rat4', 'rat64', 'rat8', 'uint', 'uint1', 'uint16', 'uint2', + 'uint32', 'uint4', 'uint64', 'uint8', 'utf16', 'utf32', 'utf8', + ) + + PERL6_OPERATORS = ( + 'X', 'Z', 'after', 'also', 'and', 'andthen', 'before', 'cmp', 'div', + 'eq', 'eqv', 'extra', 'ff', 'fff', 'ge', 'gt', 'le', 'leg', 'lt', 'm', + 'mm', 'mod', 'ne', 'or', 'orelse', 'rx', 's', 'tr', 'x', 'xor', 'xx', + '++', '--', '**', '!', '+', '-', '~', '?', '|', '||', '+^', '~^', '?^', + '^', '*', '/', '%', '%%', '+&', '+<', '+>', '~&', '~<', '~>', '?&', + 'gcd', 'lcm', '+', '-', '+|', '+^', '~|', '~^', '?|', '?^', + '~', '&', '^', 'but', 'does', '<=>', '..', '..^', '^..', '^..^', + '!=', '==', '<', '<=', '>', '>=', '~~', '===', '!eqv', + '&&', '||', '^^', '//', 'min', 'max', '??', '!!', 'ff', 'fff', 'so', + 'not', '<==', '==>', '<<==', '==>>', + ) + + # Perl 6 has a *lot* of possible bracketing characters + # this list was lifted from STD.pm6 (https://github.com/perl6/std) + PERL6_BRACKETS = { + u'\u0028': u'\u0029', u'\u003c': u'\u003e', u'\u005b': u'\u005d', + u'\u007b': u'\u007d', u'\u00ab': u'\u00bb', u'\u0f3a': u'\u0f3b', + u'\u0f3c': u'\u0f3d', u'\u169b': u'\u169c', u'\u2018': u'\u2019', + u'\u201a': u'\u2019', u'\u201b': u'\u2019', u'\u201c': u'\u201d', + u'\u201e': u'\u201d', u'\u201f': u'\u201d', u'\u2039': u'\u203a', + u'\u2045': u'\u2046', u'\u207d': u'\u207e', u'\u208d': u'\u208e', + u'\u2208': u'\u220b', u'\u2209': u'\u220c', u'\u220a': u'\u220d', + u'\u2215': u'\u29f5', u'\u223c': u'\u223d', u'\u2243': u'\u22cd', + u'\u2252': u'\u2253', u'\u2254': u'\u2255', u'\u2264': u'\u2265', + u'\u2266': u'\u2267', u'\u2268': u'\u2269', u'\u226a': u'\u226b', + u'\u226e': u'\u226f', u'\u2270': u'\u2271', u'\u2272': u'\u2273', + u'\u2274': u'\u2275', u'\u2276': u'\u2277', u'\u2278': u'\u2279', + u'\u227a': u'\u227b', u'\u227c': u'\u227d', u'\u227e': u'\u227f', + u'\u2280': u'\u2281', u'\u2282': u'\u2283', u'\u2284': u'\u2285', + u'\u2286': u'\u2287', u'\u2288': u'\u2289', u'\u228a': u'\u228b', + u'\u228f': u'\u2290', u'\u2291': u'\u2292', u'\u2298': u'\u29b8', + u'\u22a2': u'\u22a3', u'\u22a6': u'\u2ade', u'\u22a8': u'\u2ae4', + u'\u22a9': u'\u2ae3', u'\u22ab': u'\u2ae5', u'\u22b0': u'\u22b1', + u'\u22b2': u'\u22b3', u'\u22b4': u'\u22b5', u'\u22b6': u'\u22b7', + u'\u22c9': u'\u22ca', u'\u22cb': u'\u22cc', u'\u22d0': u'\u22d1', + u'\u22d6': u'\u22d7', u'\u22d8': u'\u22d9', u'\u22da': u'\u22db', + u'\u22dc': u'\u22dd', u'\u22de': u'\u22df', u'\u22e0': u'\u22e1', + u'\u22e2': u'\u22e3', u'\u22e4': u'\u22e5', u'\u22e6': u'\u22e7', + u'\u22e8': u'\u22e9', u'\u22ea': u'\u22eb', u'\u22ec': u'\u22ed', + u'\u22f0': u'\u22f1', u'\u22f2': u'\u22fa', u'\u22f3': u'\u22fb', + u'\u22f4': u'\u22fc', u'\u22f6': u'\u22fd', u'\u22f7': u'\u22fe', + u'\u2308': u'\u2309', u'\u230a': u'\u230b', u'\u2329': u'\u232a', + u'\u23b4': u'\u23b5', u'\u2768': u'\u2769', u'\u276a': u'\u276b', + u'\u276c': u'\u276d', u'\u276e': u'\u276f', u'\u2770': u'\u2771', + u'\u2772': u'\u2773', u'\u2774': u'\u2775', u'\u27c3': u'\u27c4', + u'\u27c5': u'\u27c6', u'\u27d5': u'\u27d6', u'\u27dd': u'\u27de', + u'\u27e2': u'\u27e3', u'\u27e4': u'\u27e5', u'\u27e6': u'\u27e7', + u'\u27e8': u'\u27e9', u'\u27ea': u'\u27eb', u'\u2983': u'\u2984', + u'\u2985': u'\u2986', u'\u2987': u'\u2988', u'\u2989': u'\u298a', + u'\u298b': u'\u298c', u'\u298d': u'\u298e', u'\u298f': u'\u2990', + u'\u2991': u'\u2992', u'\u2993': u'\u2994', u'\u2995': u'\u2996', + u'\u2997': u'\u2998', u'\u29c0': u'\u29c1', u'\u29c4': u'\u29c5', + u'\u29cf': u'\u29d0', u'\u29d1': u'\u29d2', u'\u29d4': u'\u29d5', + u'\u29d8': u'\u29d9', u'\u29da': u'\u29db', u'\u29f8': u'\u29f9', + u'\u29fc': u'\u29fd', u'\u2a2b': u'\u2a2c', u'\u2a2d': u'\u2a2e', + u'\u2a34': u'\u2a35', u'\u2a3c': u'\u2a3d', u'\u2a64': u'\u2a65', + u'\u2a79': u'\u2a7a', u'\u2a7d': u'\u2a7e', u'\u2a7f': u'\u2a80', + u'\u2a81': u'\u2a82', u'\u2a83': u'\u2a84', u'\u2a8b': u'\u2a8c', + u'\u2a91': u'\u2a92', u'\u2a93': u'\u2a94', u'\u2a95': u'\u2a96', + u'\u2a97': u'\u2a98', u'\u2a99': u'\u2a9a', u'\u2a9b': u'\u2a9c', + u'\u2aa1': u'\u2aa2', u'\u2aa6': u'\u2aa7', u'\u2aa8': u'\u2aa9', + u'\u2aaa': u'\u2aab', u'\u2aac': u'\u2aad', u'\u2aaf': u'\u2ab0', + u'\u2ab3': u'\u2ab4', u'\u2abb': u'\u2abc', u'\u2abd': u'\u2abe', + u'\u2abf': u'\u2ac0', u'\u2ac1': u'\u2ac2', u'\u2ac3': u'\u2ac4', + u'\u2ac5': u'\u2ac6', u'\u2acd': u'\u2ace', u'\u2acf': u'\u2ad0', + u'\u2ad1': u'\u2ad2', u'\u2ad3': u'\u2ad4', u'\u2ad5': u'\u2ad6', + u'\u2aec': u'\u2aed', u'\u2af7': u'\u2af8', u'\u2af9': u'\u2afa', + u'\u2e02': u'\u2e03', u'\u2e04': u'\u2e05', u'\u2e09': u'\u2e0a', + u'\u2e0c': u'\u2e0d', u'\u2e1c': u'\u2e1d', u'\u2e20': u'\u2e21', + u'\u3008': u'\u3009', u'\u300a': u'\u300b', u'\u300c': u'\u300d', + u'\u300e': u'\u300f', u'\u3010': u'\u3011', u'\u3014': u'\u3015', + u'\u3016': u'\u3017', u'\u3018': u'\u3019', u'\u301a': u'\u301b', + u'\u301d': u'\u301e', u'\ufd3e': u'\ufd3f', u'\ufe17': u'\ufe18', + u'\ufe35': u'\ufe36', u'\ufe37': u'\ufe38', u'\ufe39': u'\ufe3a', + u'\ufe3b': u'\ufe3c', u'\ufe3d': u'\ufe3e', u'\ufe3f': u'\ufe40', + u'\ufe41': u'\ufe42', u'\ufe43': u'\ufe44', u'\ufe47': u'\ufe48', + u'\ufe59': u'\ufe5a', u'\ufe5b': u'\ufe5c', u'\ufe5d': u'\ufe5e', + u'\uff08': u'\uff09', u'\uff1c': u'\uff1e', u'\uff3b': u'\uff3d', + u'\uff5b': u'\uff5d', u'\uff5f': u'\uff60', u'\uff62': u'\uff63', + } + + def _build_word_match(words, boundary_regex_fragment=None, prefix='', suffix=''): + if boundary_regex_fragment is None: + return r'\b(' + prefix + r'|'.join(re.escape(x) for x in words) + \ + suffix + r')\b' + else: + return r'(? 0: + next_open_pos = text.find(opening_chars, search_pos + n_chars) + next_close_pos = text.find(closing_chars, search_pos + n_chars) + + if next_close_pos == -1: + next_close_pos = len(text) + nesting_level = 0 + elif next_open_pos != -1 and next_open_pos < next_close_pos: + nesting_level += 1 + search_pos = next_open_pos + else: # next_close_pos < next_open_pos + nesting_level -= 1 + search_pos = next_close_pos + + end_pos = next_close_pos + + if end_pos < 0: # if we didn't find a closer, just highlight the + # rest of the text in this class + end_pos = len(text) + + if adverbs is not None and re.search(r':to\b', adverbs): + heredoc_terminator = text[match.start('delimiter') + n_chars:end_pos] + end_heredoc = re.search(r'^\s*' + re.escape(heredoc_terminator) + + r'\s*$', text[end_pos:], re.MULTILINE) + + if end_heredoc: + end_pos += end_heredoc.end() + else: + end_pos = len(text) + + yield match.start(), token_class, text[match.start():end_pos + n_chars] + context.pos = end_pos + n_chars + + return callback + + def opening_brace_callback(lexer, match, context): + stack = context.stack + + yield match.start(), Text, context.text[match.start():match.end()] + context.pos = match.end() + + # if we encounter an opening brace and we're one level + # below a token state, it means we need to increment + # the nesting level for braces so we know later when + # we should return to the token rules. + if len(stack) > 2 and stack[-2] == 'token': + context.perl6_token_nesting_level += 1 + + def closing_brace_callback(lexer, match, context): + stack = context.stack + + yield match.start(), Text, context.text[match.start():match.end()] + context.pos = match.end() + + # if we encounter a free closing brace and we're one level + # below a token state, it means we need to check the nesting + # level to see if we need to return to the token state. + if len(stack) > 2 and stack[-2] == 'token': + context.perl6_token_nesting_level -= 1 + if context.perl6_token_nesting_level == 0: + stack.pop() + + def embedded_perl6_callback(lexer, match, context): + context.perl6_token_nesting_level = 1 + yield match.start(), Text, context.text[match.start():match.end()] + context.pos = match.end() + context.stack.append('root') + + # If you're modifying these rules, be careful if you need to process '{' or '}' + # characters. We have special logic for processing these characters (due to the fact + # that you can nest Perl 6 code in regex blocks), so if you need to process one of + # them, make sure you also process the corresponding one! + tokens = { + 'common': [ + (r'#[`|=](?P(?P[' + ''.join(PERL6_BRACKETS) + r'])(?P=first_char)*)', + brackets_callback(Comment.Multiline)), + (r'#[^\n]*$', Comment.Singleline), + (r'^(\s*)=begin\s+(\w+)\b.*?^\1=end\s+\2', Comment.Multiline), + (r'^(\s*)=for.*?\n\s*?\n', Comment.Multiline), + (r'^=.*?\n\s*?\n', Comment.Multiline), + (r'(regex|token|rule)(\s*' + PERL6_IDENTIFIER_RANGE + '+:sym)', + bygroups(Keyword, Name), 'token-sym-brackets'), + (r'(regex|token|rule)(?!' + PERL6_IDENTIFIER_RANGE + ')(\s*' + PERL6_IDENTIFIER_RANGE + '+)?', + bygroups(Keyword, Name), 'pre-token'), + # deal with a special case in the Perl 6 grammar (role q { ... }) + (r'(role)(\s+)(q)(\s*)', bygroups(Keyword, Text, Name, Text)), + (_build_word_match(PERL6_KEYWORDS, PERL6_IDENTIFIER_RANGE), Keyword), + (_build_word_match(PERL6_BUILTIN_CLASSES, PERL6_IDENTIFIER_RANGE, suffix='(?::[UD])?'), + Name.Builtin), + (_build_word_match(PERL6_BUILTINS, PERL6_IDENTIFIER_RANGE), Name.Builtin), + # copied from PerlLexer + (r'[$@%&][.^:?=!~]?' + PERL6_IDENTIFIER_RANGE + u'+(?:<<.*?>>|<.*?>|«.*?»)*', + Name.Variable), + (r'\$[!/](?:<<.*?>>|<.*?>|«.*?»)*', Name.Variable.Global), + (r'::\?\w+', Name.Variable.Global), + (r'[$@%&]\*' + PERL6_IDENTIFIER_RANGE + u'+(?:<<.*?>>|<.*?>|«.*?»)*', + Name.Variable.Global), + (r'\$(?:<.*?>)+', Name.Variable), + (r'(?:q|qq|Q)[a-zA-Z]?\s*(?P:[\w\s:]+)?\s*(?P(?P[^0-9a-zA-Z:\s])' + r'(?P=first_char)*)', brackets_callback(String)), + # copied from PerlLexer + (r'0_?[0-7]+(_[0-7]+)*', Number.Oct), + (r'0x[0-9A-Fa-f]+(_[0-9A-Fa-f]+)*', Number.Hex), + (r'0b[01]+(_[01]+)*', Number.Bin), + (r'(?i)(\d*(_\d*)*\.\d+(_\d*)*|\d+(_\d*)*\.\d+(_\d*)*)(e[+-]?\d+)?', + Number.Float), + (r'(?i)\d+(_\d*)*e[+-]?\d+(_\d*)*', Number.Float), + (r'\d+(_\d+)*', Number.Integer), + (r'(?<=~~)\s*/(?:\\\\|\\/|.)*?/', String.Regex), + (r'(?<=[=(,])\s*/(?:\\\\|\\/|.)*?/', String.Regex), + (r'm\w+(?=\()', Name), + (r'(?:m|ms|rx)\s*(?P:[\w\s:]+)?\s*(?P(?P[^\w:\s])' + r'(?P=first_char)*)', brackets_callback(String.Regex)), + (r'(?:s|ss|tr)\s*(?::[\w\s:]+)?\s*/(?:\\\\|\\/|.)*?/(?:\\\\|\\/|.)*?/', + String.Regex), + (r'<[^\s=].*?\S>', String), + (_build_word_match(PERL6_OPERATORS), Operator), + (r'\w' + PERL6_IDENTIFIER_RANGE + '*', Name), + (r"'(\\\\|\\[^\\]|[^'\\])*'", String), + (r'"(\\\\|\\[^\\]|[^"\\])*"', String), + ], + 'root': [ + include('common'), + (r'\{', opening_brace_callback), + (r'\}', closing_brace_callback), + (r'.+?', Text), + ], + 'pre-token': [ + include('common'), + (r'\{', Text, ('#pop', 'token')), + (r'.+?', Text), + ], + 'token-sym-brackets': [ + (r'(?P(?P[' + ''.join(PERL6_BRACKETS) + '])(?P=first_char)*)', + brackets_callback(Name), ('#pop', 'pre-token')), + default(('#pop', 'pre-token')), + ], + 'token': [ + (r'\}', Text, '#pop'), + (r'(?<=:)(?:my|our|state|constant|temp|let).*?;', using(this)), + # make sure that quotes in character classes aren't treated as strings + (r'<(?:[-!?+.]\s*)?\[.*?\]>', String.Regex), + # make sure that '#' characters in quotes aren't treated as comments + (r"(?my|our)\s+)?(?:module|class|role|enum|grammar)', line) + if class_decl: + if saw_perl_decl or class_decl.group('scope') is not None: + return True + rating = 0.05 + continue + break + + return rating + + def __init__(self, **options): + super(Perl6Lexer, self).__init__(**options) + self.encoding = options.get('encoding', 'utf-8') diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/php.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/php.py new file mode 100644 index 0000000000000000000000000000000000000000..f618b5fde638fffa70a6d00a8e348c5ccdda5ab7 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/php.py @@ -0,0 +1,267 @@ +# -*- coding: utf-8 -*- +""" + pygments.lexers.php + ~~~~~~~~~~~~~~~~~~~ + + Lexers for PHP and related languages. + + :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS. + :license: BSD, see LICENSE for details. +""" + +import re + +from pygments.lexer import RegexLexer, include, bygroups, default, using, \ + this, words +from pygments.token import Text, Comment, Operator, Keyword, Name, String, \ + Number, Punctuation, Other +from pygments.util import get_bool_opt, get_list_opt, iteritems + +__all__ = ['ZephirLexer', 'PhpLexer'] + + +class ZephirLexer(RegexLexer): + """ + For `Zephir language `_ source code. + + Zephir is a compiled high level language aimed + to the creation of C-extensions for PHP. + + .. versionadded:: 2.0 + """ + + name = 'Zephir' + aliases = ['zephir'] + filenames = ['*.zep'] + + zephir_keywords = ['fetch', 'echo', 'isset', 'empty'] + zephir_type = ['bit', 'bits', 'string'] + + flags = re.DOTALL | re.MULTILINE + + tokens = { + 'commentsandwhitespace': [ + (r'\s+', Text), + (r'//.*?\n', Comment.Single), + (r'/\*.*?\*/', Comment.Multiline) + ], + 'slashstartsregex': [ + include('commentsandwhitespace'), + (r'/(\\.|[^[/\\\n]|\[(\\.|[^\]\\\n])*])+/' + r'([gim]+\b|\B)', String.Regex, '#pop'), + default('#pop') + ], + 'badregex': [ + (r'\n', Text, '#pop') + ], + 'root': [ + (r'^(?=\s|/|', Punctuation), + (r'"(?:\\x[0-9a-fA-F]+\\|\\u[0-9a-fA-F]{4}|\\U[0-9a-fA-F]{8}|' + r'\\[0-7]+\\|\\["\nabcefnrstv]|[^\\"])*"', String.Double), + (r"'(?:''|[^'])*'", String.Atom), # quoted atom + # Needs to not be followed by an atom. + # (r'=(?=\s|[a-zA-Z\[])', Operator), + (r'is\b', Operator), + (r'(<|>|=<|>=|==|=:=|=|/|//|\*|\+|-)(?=\s|[a-zA-Z0-9\[])', + Operator), + (r'(mod|div|not)\b', Operator), + (r'_', Keyword), # The don't-care variable + (r'([a-z]+)(:)', bygroups(Name.Namespace, Punctuation)), + (u'([a-z\u00c0-\u1fff\u3040-\ud7ff\ue000-\uffef]' + u'[\w$\u00c0-\u1fff\u3040-\ud7ff\ue000-\uffef]*)' + u'(\\s*)(:-|-->)', + bygroups(Name.Function, Text, Operator)), # function defn + (u'([a-z\u00c0-\u1fff\u3040-\ud7ff\ue000-\uffef]' + u'[\w$\u00c0-\u1fff\u3040-\ud7ff\ue000-\uffef]*)' + u'(\\s*)(\\()', + bygroups(Name.Function, Text, Punctuation)), + (u'[a-z\u00c0-\u1fff\u3040-\ud7ff\ue000-\uffef]' + u'[\w$\u00c0-\u1fff\u3040-\ud7ff\ue000-\uffef]*', + String.Atom), # atom, characters + # This one includes ! + (u'[#&*+\\-./:<=>?@\\\\^~\u00a1-\u00bf\u2010-\u303f]+', + String.Atom), # atom, graphics + (r'[A-Z_]\w*', Name.Variable), + (u'\\s+|[\u2000-\u200f\ufff0-\ufffe\uffef]', Text), + ], + 'nested-comment': [ + (r'\*/', Comment.Multiline, '#pop'), + (r'/\*', Comment.Multiline, '#push'), + (r'[^*/]+', Comment.Multiline), + (r'[*/]', Comment.Multiline), + ], + } + + def analyse_text(text): + return ':-' in text + + +class LogtalkLexer(RegexLexer): + """ + For `Logtalk `_ source code. + + .. versionadded:: 0.10 + """ + + name = 'Logtalk' + aliases = ['logtalk'] + filenames = ['*.lgt', '*.logtalk'] + mimetypes = ['text/x-logtalk'] + + tokens = { + 'root': [ + # Directives + (r'^\s*:-\s', Punctuation, 'directive'), + # Comments + (r'%.*?\n', Comment), + (r'/\*(.|\n)*?\*/', Comment), + # Whitespace + (r'\n', Text), + (r'\s+', Text), + # Numbers + (r"0'.", Number), + (r'0b[01]+', Number.Bin), + (r'0o[0-7]+', Number.Oct), + (r'0x[0-9a-fA-F]+', Number.Hex), + (r'\d+\.?\d*((e|E)(\+|-)?\d+)?', Number), + # Variables + (r'([A-Z_]\w*)', Name.Variable), + # Event handlers + (r'(after|before)(?=[(])', Keyword), + # Message forwarding handler + (r'forward(?=[(])', Keyword), + # Execution-context methods + (r'(parameter|this|se(lf|nder))(?=[(])', Keyword), + # Reflection + (r'(current_predicate|predicate_property)(?=[(])', Keyword), + # DCGs and term expansion + (r'(expand_(goal|term)|(goal|term)_expansion|phrase)(?=[(])', Keyword), + # Entity + (r'(abolish|c(reate|urrent))_(object|protocol|category)(?=[(])', Keyword), + (r'(object|protocol|category)_property(?=[(])', Keyword), + # Entity relations + (r'co(mplements_object|nforms_to_protocol)(?=[(])', Keyword), + (r'extends_(object|protocol|category)(?=[(])', Keyword), + (r'imp(lements_protocol|orts_category)(?=[(])', Keyword), + (r'(instantiat|specializ)es_class(?=[(])', Keyword), + # Events + (r'(current_event|(abolish|define)_events)(?=[(])', Keyword), + # Flags + (r'(current|set)_logtalk_flag(?=[(])', Keyword), + # Compiling, loading, and library paths + (r'logtalk_(compile|l(ibrary_path|oad|oad_context)|make)(?=[(])', Keyword), + (r'\blogtalk_make\b', Keyword), + # Database + (r'(clause|retract(all)?)(?=[(])', Keyword), + (r'a(bolish|ssert(a|z))(?=[(])', Keyword), + # Control constructs + (r'(ca(ll|tch)|throw)(?=[(])', Keyword), + (r'(fa(il|lse)|true)\b', Keyword), + # All solutions + (r'((bag|set)of|f(ind|or)all)(?=[(])', Keyword), + # Multi-threading meta-predicates + (r'threaded(_(call|once|ignore|exit|peek|wait|notify))?(?=[(])', Keyword), + # Term unification + (r'(subsumes_term|unify_with_occurs_check)(?=[(])', Keyword), + # Term creation and decomposition + (r'(functor|arg|copy_term|numbervars|term_variables)(?=[(])', Keyword), + # Evaluable functors + (r'(div|rem|m(ax|in|od)|abs|sign)(?=[(])', Keyword), + (r'float(_(integer|fractional)_part)?(?=[(])', Keyword), + (r'(floor|t(an|runcate)|round|ceiling)(?=[(])', Keyword), + # Other arithmetic functors + (r'(cos|a(cos|sin|tan|tan2)|exp|log|s(in|qrt)|xor)(?=[(])', Keyword), + # Term testing + (r'(var|atom(ic)?|integer|float|c(allable|ompound)|n(onvar|umber)|' + r'ground|acyclic_term)(?=[(])', Keyword), + # Term comparison + (r'compare(?=[(])', Keyword), + # Stream selection and control + (r'(curren|se)t_(in|out)put(?=[(])', Keyword), + (r'(open|close)(?=[(])', Keyword), + (r'flush_output(?=[(])', Keyword), + (r'(at_end_of_stream|flush_output)\b', Keyword), + (r'(stream_property|at_end_of_stream|set_stream_position)(?=[(])', Keyword), + # Character and byte input/output + (r'(nl|(get|peek|put)_(byte|c(har|ode)))(?=[(])', Keyword), + (r'\bnl\b', Keyword), + # Term input/output + (r'read(_term)?(?=[(])', Keyword), + (r'write(q|_(canonical|term))?(?=[(])', Keyword), + (r'(current_)?op(?=[(])', Keyword), + (r'(current_)?char_conversion(?=[(])', Keyword), + # Atomic term processing + (r'atom_(length|c(hars|o(ncat|des)))(?=[(])', Keyword), + (r'(char_code|sub_atom)(?=[(])', Keyword), + (r'number_c(har|ode)s(?=[(])', Keyword), + # Implementation defined hooks functions + (r'(se|curren)t_prolog_flag(?=[(])', Keyword), + (r'\bhalt\b', Keyword), + (r'halt(?=[(])', Keyword), + # Message sending operators + (r'(::|:|\^\^)', Operator), + # External call + (r'[{}]', Keyword), + # Logic and control + (r'(ignore|once)(?=[(])', Keyword), + (r'\brepeat\b', Keyword), + # Sorting + (r'(key)?sort(?=[(])', Keyword), + # Bitwise functors + (r'(>>|<<|/\\|\\\\|\\)', Operator), + # Predicate aliases + (r'\bas\b', Operator), + # Arithemtic evaluation + (r'\bis\b', Keyword), + # Arithemtic comparison + (r'(=:=|=\\=|<|=<|>=|>)', Operator), + # Term creation and decomposition + (r'=\.\.', Operator), + # Term unification + (r'(=|\\=)', Operator), + # Term comparison + (r'(==|\\==|@=<|@<|@>=|@>)', Operator), + # Evaluable functors + (r'(//|[-+*/])', Operator), + (r'\b(e|pi|div|mod|rem)\b', Operator), + # Other arithemtic functors + (r'\b\*\*\b', Operator), + # DCG rules + (r'-->', Operator), + # Control constructs + (r'([!;]|->)', Operator), + # Logic and control + (r'\\+', Operator), + # Mode operators + (r'[?@]', Operator), + # Existential quantifier + (r'\^', Operator), + # Strings + (r'"(\\\\|\\"|[^"])*"', String), + # Ponctuation + (r'[()\[\],.|]', Text), + # Atoms + (r"[a-z]\w*", Text), + (r"'", String, 'quoted_atom'), + ], + + 'quoted_atom': [ + (r"''", String), + (r"'", String, '#pop'), + (r'\\([\\abfnrtv"\']|(x[a-fA-F0-9]+|[0-7]+)\\)', String.Escape), + (r"[^\\'\n]+", String), + (r'\\', String), + ], + + 'directive': [ + # Conditional compilation directives + (r'(el)?if(?=[(])', Keyword, 'root'), + (r'(e(lse|ndif))[.]', Keyword, 'root'), + # Entity directives + (r'(category|object|protocol)(?=[(])', Keyword, 'entityrelations'), + (r'(end_(category|object|protocol))[.]', Keyword, 'root'), + # Predicate scope directives + (r'(public|protected|private)(?=[(])', Keyword, 'root'), + # Other directives + (r'e(n(coding|sure_loaded)|xport)(?=[(])', Keyword, 'root'), + (r'in(clude|itialization|fo)(?=[(])', Keyword, 'root'), + (r'(built_in|dynamic|synchronized|threaded)[.]', Keyword, 'root'), + (r'(alias|d(ynamic|iscontiguous)|m(eta_(non_terminal|predicate)|ode|ultifile)|' + r's(et_(logtalk|prolog)_flag|ynchronized))(?=[(])', Keyword, 'root'), + (r'op(?=[(])', Keyword, 'root'), + (r'(c(alls|oinductive)|module|reexport|use(s|_module))(?=[(])', Keyword, 'root'), + (r'[a-z]\w*(?=[(])', Text, 'root'), + (r'[a-z]\w*[.]', Text, 'root'), + ], + + 'entityrelations': [ + (r'(complements|extends|i(nstantiates|mp(lements|orts))|specializes)(?=[(])', Keyword), + # Numbers + (r"0'.", Number), + (r'0b[01]+', Number.Bin), + (r'0o[0-7]+', Number.Oct), + (r'0x[0-9a-fA-F]+', Number.Hex), + (r'\d+\.?\d*((e|E)(\+|-)?\d+)?', Number), + # Variables + (r'([A-Z_]\w*)', Name.Variable), + # Atoms + (r"[a-z]\w*", Text), + (r"'", String, 'quoted_atom'), + # Strings + (r'"(\\\\|\\"|[^"])*"', String), + # End of entity-opening directive + (r'([)]\.)', Text, 'root'), + # Scope operator + (r'(::)', Operator), + # Ponctuation + (r'[()\[\],.|]', Text), + # Comments + (r'%.*?\n', Comment), + (r'/\*(.|\n)*?\*/', Comment), + # Whitespace + (r'\n', Text), + (r'\s+', Text), + ] + } + + def analyse_text(text): + if ':- object(' in text: + return 1.0 + elif ':- protocol(' in text: + return 1.0 + elif ':- category(' in text: + return 1.0 + elif re.search('^:-\s[a-z]', text, re.M): + return 0.9 + else: + return 0.0 diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/python.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/python.py new file mode 100644 index 0000000000000000000000000000000000000000..390eafe853a398248b6b1c0da827ba0670c0daca --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/python.py @@ -0,0 +1,939 @@ +# -*- coding: utf-8 -*- +""" + pygments.lexers.python + ~~~~~~~~~~~~~~~~~~~~~~ + + Lexers for Python and related languages. + + :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS. + :license: BSD, see LICENSE for details. +""" + +import re + +from pygments.lexer import Lexer, RegexLexer, include, bygroups, using, \ + default, words, combined, do_insertions +from pygments.util import get_bool_opt, shebang_matches +from pygments.token import Text, Comment, Operator, Keyword, Name, String, \ + Number, Punctuation, Generic, Other, Error +from pygments import unistring as uni + +__all__ = ['PythonLexer', 'PythonConsoleLexer', 'PythonTracebackLexer', + 'Python3Lexer', 'Python3TracebackLexer', 'CythonLexer', + 'DgLexer', 'NumPyLexer'] + +line_re = re.compile('.*?\n') + + +class PythonLexer(RegexLexer): + """ + For `Python `_ source code. + """ + + name = 'Python' + aliases = ['python', 'py', 'sage'] + filenames = ['*.py', '*.pyw', '*.sc', 'SConstruct', 'SConscript', '*.tac', '*.sage'] + mimetypes = ['text/x-python', 'application/x-python'] + + def innerstring_rules(ttype): + return [ + # the old style '%s' % (...) string formatting + (r'%(\(\w+\))?[-#0 +]*([0-9]+|[*])?(\.([0-9]+|[*]))?' + '[hlL]?[E-GXc-giorsux%]', String.Interpol), + # backslashes, quotes and formatting signs must be parsed one at a time + (r'[^\\\'"%\n]+', ttype), + (r'[\'"\\]', ttype), + # unhandled string formatting sign + (r'%', ttype), + # newlines are an error (use "nl" state) + ] + + tokens = { + 'root': [ + (r'\n', Text), + (r'^(\s*)([rRuUbB]{,2})("""(?:.|\n)*?""")', + bygroups(Text, String.Affix, String.Doc)), + (r"^(\s*)([rRuUbB]{,2})('''(?:.|\n)*?''')", + bygroups(Text, String.Affix, String.Doc)), + (r'[^\S\n]+', Text), + (r'\A#!.+$', Comment.Hashbang), + (r'#.*$', Comment.Single), + (r'[]{}:(),;[]', Punctuation), + (r'\\\n', Text), + (r'\\', Text), + (r'(in|is|and|or|not)\b', Operator.Word), + (r'!=|==|<<|>>|[-~+/*%=<>&^|.]', Operator), + include('keywords'), + (r'(def)((?:\s|\\\s)+)', bygroups(Keyword, Text), 'funcname'), + (r'(class)((?:\s|\\\s)+)', bygroups(Keyword, Text), 'classname'), + (r'(from)((?:\s|\\\s)+)', bygroups(Keyword.Namespace, Text), + 'fromimport'), + (r'(import)((?:\s|\\\s)+)', bygroups(Keyword.Namespace, Text), + 'import'), + include('builtins'), + include('magicfuncs'), + include('magicvars'), + include('backtick'), + ('([rR]|[uUbB][rR]|[rR][uUbB])(""")', + bygroups(String.Affix, String.Double), 'tdqs'), + ("([rR]|[uUbB][rR]|[rR][uUbB])(''')", + bygroups(String.Affix, String.Single), 'tsqs'), + ('([rR]|[uUbB][rR]|[rR][uUbB])(")', + bygroups(String.Affix, String.Double), 'dqs'), + ("([rR]|[uUbB][rR]|[rR][uUbB])(')", + bygroups(String.Affix, String.Single), 'sqs'), + ('([uUbB]?)(""")', bygroups(String.Affix, String.Double), + combined('stringescape', 'tdqs')), + ("([uUbB]?)(''')", bygroups(String.Affix, String.Single), + combined('stringescape', 'tsqs')), + ('([uUbB]?)(")', bygroups(String.Affix, String.Double), + combined('stringescape', 'dqs')), + ("([uUbB]?)(')", bygroups(String.Affix, String.Single), + combined('stringescape', 'sqs')), + include('name'), + include('numbers'), + ], + 'keywords': [ + (words(( + 'assert', 'break', 'continue', 'del', 'elif', 'else', 'except', + 'exec', 'finally', 'for', 'global', 'if', 'lambda', 'pass', + 'print', 'raise', 'return', 'try', 'while', 'yield', + 'yield from', 'as', 'with'), suffix=r'\b'), + Keyword), + ], + 'builtins': [ + (words(( + '__import__', 'abs', 'all', 'any', 'apply', 'basestring', 'bin', + 'bool', 'buffer', 'bytearray', 'bytes', 'callable', 'chr', 'classmethod', + 'cmp', 'coerce', 'compile', 'complex', 'delattr', 'dict', 'dir', 'divmod', + 'enumerate', 'eval', 'execfile', 'exit', 'file', 'filter', 'float', + 'frozenset', 'getattr', 'globals', 'hasattr', 'hash', 'hex', 'id', + 'input', 'int', 'intern', 'isinstance', 'issubclass', 'iter', 'len', + 'list', 'locals', 'long', 'map', 'max', 'min', 'next', 'object', + 'oct', 'open', 'ord', 'pow', 'property', 'range', 'raw_input', 'reduce', + 'reload', 'repr', 'reversed', 'round', 'set', 'setattr', 'slice', + 'sorted', 'staticmethod', 'str', 'sum', 'super', 'tuple', 'type', + 'unichr', 'unicode', 'vars', 'xrange', 'zip'), + prefix=r'(?`_ source code (version 3.0). + + .. versionadded:: 0.10 + """ + + name = 'Python 3' + aliases = ['python3', 'py3'] + filenames = [] # Nothing until Python 3 gets widespread + mimetypes = ['text/x-python3', 'application/x-python3'] + + flags = re.MULTILINE | re.UNICODE + + uni_name = "[%s][%s]*" % (uni.xid_start, uni.xid_continue) + + def innerstring_rules(ttype): + return [ + # the old style '%s' % (...) string formatting (still valid in Py3) + (r'%(\(\w+\))?[-#0 +]*([0-9]+|[*])?(\.([0-9]+|[*]))?' + '[hlL]?[E-GXc-giorsux%]', String.Interpol), + # the new style '{}'.format(...) string formatting + (r'\{' + '((\w+)((\.\w+)|(\[[^\]]+\]))*)?' # field name + '(\![sra])?' # conversion + '(\:(.?[<>=\^])?[-+ ]?#?0?(\d+)?,?(\.\d+)?[E-GXb-gnosx%]?)?' + '\}', String.Interpol), + + # backslashes, quotes and formatting signs must be parsed one at a time + (r'[^\\\'"%{\n]+', ttype), + (r'[\'"\\]', ttype), + # unhandled string formatting sign + (r'%|(\{{1,2})', ttype) + # newlines are an error (use "nl" state) + ] + + tokens = PythonLexer.tokens.copy() + tokens['keywords'] = [ + (words(( + 'assert', 'async', 'await', 'break', 'continue', 'del', 'elif', + 'else', 'except', 'finally', 'for', 'global', 'if', 'lambda', 'pass', + 'raise', 'nonlocal', 'return', 'try', 'while', 'yield', 'yield from', + 'as', 'with'), suffix=r'\b'), + Keyword), + (words(( + 'True', 'False', 'None'), suffix=r'\b'), + Keyword.Constant), + ] + tokens['builtins'] = [ + (words(( + '__import__', 'abs', 'all', 'any', 'bin', 'bool', 'bytearray', 'bytes', + 'chr', 'classmethod', 'cmp', 'compile', 'complex', 'delattr', 'dict', + 'dir', 'divmod', 'enumerate', 'eval', 'filter', 'float', 'format', + 'frozenset', 'getattr', 'globals', 'hasattr', 'hash', 'hex', 'id', + 'input', 'int', 'isinstance', 'issubclass', 'iter', 'len', 'list', + 'locals', 'map', 'max', 'memoryview', 'min', 'next', 'object', 'oct', + 'open', 'ord', 'pow', 'print', 'property', 'range', 'repr', 'reversed', + 'round', 'set', 'setattr', 'slice', 'sorted', 'staticmethod', 'str', + 'sum', 'super', 'tuple', 'type', 'vars', 'zip'), prefix=r'(?>> a = 'foo' + >>> print a + foo + >>> 1 / 0 + Traceback (most recent call last): + File "", line 1, in + ZeroDivisionError: integer division or modulo by zero + + Additional options: + + `python3` + Use Python 3 lexer for code. Default is ``False``. + + .. versionadded:: 1.0 + """ + name = 'Python console session' + aliases = ['pycon'] + mimetypes = ['text/x-python-doctest'] + + def __init__(self, **options): + self.python3 = get_bool_opt(options, 'python3', False) + Lexer.__init__(self, **options) + + def get_tokens_unprocessed(self, text): + if self.python3: + pylexer = Python3Lexer(**self.options) + tblexer = Python3TracebackLexer(**self.options) + else: + pylexer = PythonLexer(**self.options) + tblexer = PythonTracebackLexer(**self.options) + + curcode = '' + insertions = [] + curtb = '' + tbindex = 0 + tb = 0 + for match in line_re.finditer(text): + line = match.group() + if line.startswith(u'>>> ') or line.startswith(u'... '): + tb = 0 + insertions.append((len(curcode), + [(0, Generic.Prompt, line[:4])])) + curcode += line[4:] + elif line.rstrip() == u'...' and not tb: + # only a new >>> prompt can end an exception block + # otherwise an ellipsis in place of the traceback frames + # will be mishandled + insertions.append((len(curcode), + [(0, Generic.Prompt, u'...')])) + curcode += line[3:] + else: + if curcode: + for item in do_insertions( + insertions, pylexer.get_tokens_unprocessed(curcode)): + yield item + curcode = '' + insertions = [] + if (line.startswith(u'Traceback (most recent call last):') or + re.match(u' File "[^"]+", line \\d+\\n$', line)): + tb = 1 + curtb = line + tbindex = match.start() + elif line == 'KeyboardInterrupt\n': + yield match.start(), Name.Class, line + elif tb: + curtb += line + if not (line.startswith(' ') or line.strip() == u'...'): + tb = 0 + for i, t, v in tblexer.get_tokens_unprocessed(curtb): + yield tbindex+i, t, v + curtb = '' + else: + yield match.start(), Generic.Output, line + if curcode: + for item in do_insertions(insertions, + pylexer.get_tokens_unprocessed(curcode)): + yield item + if curtb: + for i, t, v in tblexer.get_tokens_unprocessed(curtb): + yield tbindex+i, t, v + + +class PythonTracebackLexer(RegexLexer): + """ + For Python tracebacks. + + .. versionadded:: 0.7 + """ + + name = 'Python Traceback' + aliases = ['pytb'] + filenames = ['*.pytb'] + mimetypes = ['text/x-python-traceback'] + + tokens = { + 'root': [ + # Cover both (most recent call last) and (innermost last) + # The optional ^C allows us to catch keyboard interrupt signals. + (r'^(\^C)?(Traceback.*\n)', + bygroups(Text, Generic.Traceback), 'intb'), + # SyntaxError starts with this. + (r'^(?= File "[^"]+", line \d+)', Generic.Traceback, 'intb'), + (r'^.*\n', Other), + ], + 'intb': [ + (r'^( File )("[^"]+")(, line )(\d+)(, in )(.+)(\n)', + bygroups(Text, Name.Builtin, Text, Number, Text, Name, Text)), + (r'^( File )("[^"]+")(, line )(\d+)(\n)', + bygroups(Text, Name.Builtin, Text, Number, Text)), + (r'^( )(.+)(\n)', + bygroups(Text, using(PythonLexer), Text)), + (r'^([ \t]*)(\.\.\.)(\n)', + bygroups(Text, Comment, Text)), # for doctests... + (r'^([^:]+)(: )(.+)(\n)', + bygroups(Generic.Error, Text, Name, Text), '#pop'), + (r'^([a-zA-Z_]\w*)(:?\n)', + bygroups(Generic.Error, Text), '#pop') + ], + } + + +class Python3TracebackLexer(RegexLexer): + """ + For Python 3.0 tracebacks, with support for chained exceptions. + + .. versionadded:: 1.0 + """ + + name = 'Python 3.0 Traceback' + aliases = ['py3tb'] + filenames = ['*.py3tb'] + mimetypes = ['text/x-python3-traceback'] + + tokens = { + 'root': [ + (r'\n', Text), + (r'^Traceback \(most recent call last\):\n', Generic.Traceback, 'intb'), + (r'^During handling of the above exception, another ' + r'exception occurred:\n\n', Generic.Traceback), + (r'^The above exception was the direct cause of the ' + r'following exception:\n\n', Generic.Traceback), + (r'^(?= File "[^"]+", line \d+)', Generic.Traceback, 'intb'), + ], + 'intb': [ + (r'^( File )("[^"]+")(, line )(\d+)(, in )(.+)(\n)', + bygroups(Text, Name.Builtin, Text, Number, Text, Name, Text)), + (r'^( File )("[^"]+")(, line )(\d+)(\n)', + bygroups(Text, Name.Builtin, Text, Number, Text)), + (r'^( )(.+)(\n)', + bygroups(Text, using(Python3Lexer), Text)), + (r'^([ \t]*)(\.\.\.)(\n)', + bygroups(Text, Comment, Text)), # for doctests... + (r'^([^:]+)(: )(.+)(\n)', + bygroups(Generic.Error, Text, Name, Text), '#pop'), + (r'^([a-zA-Z_]\w*)(:?\n)', + bygroups(Generic.Error, Text), '#pop') + ], + } + + +class CythonLexer(RegexLexer): + """ + For Pyrex and `Cython `_ source code. + + .. versionadded:: 1.1 + """ + + name = 'Cython' + aliases = ['cython', 'pyx', 'pyrex'] + filenames = ['*.pyx', '*.pxd', '*.pxi'] + mimetypes = ['text/x-cython', 'application/x-cython'] + + tokens = { + 'root': [ + (r'\n', Text), + (r'^(\s*)("""(?:.|\n)*?""")', bygroups(Text, String.Doc)), + (r"^(\s*)('''(?:.|\n)*?''')", bygroups(Text, String.Doc)), + (r'[^\S\n]+', Text), + (r'#.*$', Comment), + (r'[]{}:(),;[]', Punctuation), + (r'\\\n', Text), + (r'\\', Text), + (r'(in|is|and|or|not)\b', Operator.Word), + (r'(<)([a-zA-Z0-9.?]+)(>)', + bygroups(Punctuation, Keyword.Type, Punctuation)), + (r'!=|==|<<|>>|[-~+/*%=<>&^|.?]', Operator), + (r'(from)(\d+)(<=)(\s+)(<)(\d+)(:)', + bygroups(Keyword, Number.Integer, Operator, Name, Operator, + Name, Punctuation)), + include('keywords'), + (r'(def|property)(\s+)', bygroups(Keyword, Text), 'funcname'), + (r'(cp?def)(\s+)', bygroups(Keyword, Text), 'cdef'), + # (should actually start a block with only cdefs) + (r'(cdef)(:)', bygroups(Keyword, Punctuation)), + (r'(class|struct)(\s+)', bygroups(Keyword, Text), 'classname'), + (r'(from)(\s+)', bygroups(Keyword, Text), 'fromimport'), + (r'(c?import)(\s+)', bygroups(Keyword, Text), 'import'), + include('builtins'), + include('backtick'), + ('(?:[rR]|[uU][rR]|[rR][uU])"""', String, 'tdqs'), + ("(?:[rR]|[uU][rR]|[rR][uU])'''", String, 'tsqs'), + ('(?:[rR]|[uU][rR]|[rR][uU])"', String, 'dqs'), + ("(?:[rR]|[uU][rR]|[rR][uU])'", String, 'sqs'), + ('[uU]?"""', String, combined('stringescape', 'tdqs')), + ("[uU]?'''", String, combined('stringescape', 'tsqs')), + ('[uU]?"', String, combined('stringescape', 'dqs')), + ("[uU]?'", String, combined('stringescape', 'sqs')), + include('name'), + include('numbers'), + ], + 'keywords': [ + (words(( + 'assert', 'break', 'by', 'continue', 'ctypedef', 'del', 'elif', + 'else', 'except', 'except?', 'exec', 'finally', 'for', 'fused', 'gil', + 'global', 'if', 'include', 'lambda', 'nogil', 'pass', 'print', + 'raise', 'return', 'try', 'while', 'yield', 'as', 'with'), suffix=r'\b'), + Keyword), + (r'(DEF|IF|ELIF|ELSE)\b', Comment.Preproc), + ], + 'builtins': [ + (words(( + '__import__', 'abs', 'all', 'any', 'apply', 'basestring', 'bin', + 'bool', 'buffer', 'bytearray', 'bytes', 'callable', 'chr', + 'classmethod', 'cmp', 'coerce', 'compile', 'complex', 'delattr', + 'dict', 'dir', 'divmod', 'enumerate', 'eval', 'execfile', 'exit', + 'file', 'filter', 'float', 'frozenset', 'getattr', 'globals', + 'hasattr', 'hash', 'hex', 'id', 'input', 'int', 'intern', 'isinstance', + 'issubclass', 'iter', 'len', 'list', 'locals', 'long', 'map', 'max', + 'min', 'next', 'object', 'oct', 'open', 'ord', 'pow', 'property', + 'range', 'raw_input', 'reduce', 'reload', 'repr', 'reversed', + 'round', 'set', 'setattr', 'slice', 'sorted', 'staticmethod', + 'str', 'sum', 'super', 'tuple', 'type', 'unichr', 'unicode', 'unsigned', + 'vars', 'xrange', 'zip'), prefix=r'(?`_, + a functional and object-oriented programming language + running on the CPython 3 VM. + + .. versionadded:: 1.6 + """ + name = 'dg' + aliases = ['dg'] + filenames = ['*.dg'] + mimetypes = ['text/x-dg'] + + tokens = { + 'root': [ + (r'\s+', Text), + (r'#.*?$', Comment.Single), + + (r'(?i)0b[01]+', Number.Bin), + (r'(?i)0o[0-7]+', Number.Oct), + (r'(?i)0x[0-9a-f]+', Number.Hex), + (r'(?i)[+-]?[0-9]+\.[0-9]+(e[+-]?[0-9]+)?j?', Number.Float), + (r'(?i)[+-]?[0-9]+e[+-]?\d+j?', Number.Float), + (r'(?i)[+-]?[0-9]+j?', Number.Integer), + + (r"(?i)(br|r?b?)'''", String, combined('stringescape', 'tsqs', 'string')), + (r'(?i)(br|r?b?)"""', String, combined('stringescape', 'tdqs', 'string')), + (r"(?i)(br|r?b?)'", String, combined('stringescape', 'sqs', 'string')), + (r'(?i)(br|r?b?)"', String, combined('stringescape', 'dqs', 'string')), + + (r"`\w+'*`", Operator), + (r'\b(and|in|is|or|where)\b', Operator.Word), + (r'[!$%&*+\-./:<-@\\^|~;,]+', Operator), + + (words(( + 'bool', 'bytearray', 'bytes', 'classmethod', 'complex', 'dict', 'dict\'', + 'float', 'frozenset', 'int', 'list', 'list\'', 'memoryview', 'object', + 'property', 'range', 'set', 'set\'', 'slice', 'staticmethod', 'str', + 'super', 'tuple', 'tuple\'', 'type'), + prefix=r'(?`_. + + Reference for implementing this: «Meta Object Facility (MOF) 2.0 + Query/View/Transformation Specification», Version 1.1 - January 2011 + (http://www.omg.org/spec/QVT/1.1/), see §8.4, «Concrete Syntax» in + particular. + + Notable tokens assignments: + + - Name.Class is assigned to the identifier following any of the following + keywords: metamodel, class, exception, primitive, enum, transformation + or library + + - Name.Function is assigned to the names of mappings and queries + + - Name.Builtin.Pseudo is assigned to the pre-defined variables 'this', + 'self' and 'result'. + """ + # With obvious borrowings & inspiration from the Java, Python and C lexers + + name = 'QVTO' + aliases = ['qvto', 'qvt'] + filenames = ['*.qvto'] + + tokens = { + 'root': [ + (r'\n', Text), + (r'[^\S\n]+', Text), + (r'(--|//)(\s*)(directive:)?(.*)$', + bygroups(Comment, Comment, Comment.Preproc, Comment)), + # Uncomment the following if you want to distinguish between + # '/*' and '/**', à la javadoc + # (r'/[*]{2}(.|\n)*?[*]/', Comment.Multiline), + (r'/[*](.|\n)*?[*]/', Comment.Multiline), + (r'\\\n', Text), + (r'(and|not|or|xor|##?)\b', Operator.Word), + (r'(:{1,2}=|[-+]=)\b', Operator.Word), + (r'(@|<<|>>)\b', Keyword), # stereotypes + (r'!=|<>|==|=|!->|->|>=|<=|[.]{3}|[+/*%=<>&|.~]', Operator), + (r'[]{}:(),;[]', Punctuation), + (r'(true|false|unlimited|null)\b', Keyword.Constant), + (r'(this|self|result)\b', Name.Builtin.Pseudo), + (r'(var)\b', Keyword.Declaration), + (r'(from|import)\b', Keyword.Namespace, 'fromimport'), + (r'(metamodel|class|exception|primitive|enum|transformation|' + r'library)(\s+)(\w+)', + bygroups(Keyword.Word, Text, Name.Class)), + (r'(exception)(\s+)(\w+)', + bygroups(Keyword.Word, Text, Name.Exception)), + (r'(main)\b', Name.Function), + (r'(mapping|helper|query)(\s+)', + bygroups(Keyword.Declaration, Text), 'operation'), + (r'(assert)(\s+)\b', bygroups(Keyword, Text), 'assert'), + (r'(Bag|Collection|Dict|OrderedSet|Sequence|Set|Tuple|List)\b', + Keyword.Type), + include('keywords'), + ('"', String, combined('stringescape', 'dqs')), + ("'", String, combined('stringescape', 'sqs')), + include('name'), + include('numbers'), + # (r'([a-zA-Z_]\w*)(::)([a-zA-Z_]\w*)', + # bygroups(Text, Text, Text)), + ], + + 'fromimport': [ + (r'(?:[ \t]|\\\n)+', Text), + (r'[a-zA-Z_][\w.]*', Name.Namespace), + default('#pop'), + ], + + 'operation': [ + (r'::', Text), + (r'(.*::)([a-zA-Z_]\w*)([ \t]*)(\()', + bygroups(Text, Name.Function, Text, Punctuation), '#pop') + ], + + 'assert': [ + (r'(warning|error|fatal)\b', Keyword, '#pop'), + default('#pop'), # all else: go back + ], + + 'keywords': [ + (words(( + 'abstract', 'access', 'any', 'assert', 'blackbox', 'break', + 'case', 'collect', 'collectNested', 'collectOne', 'collectselect', + 'collectselectOne', 'composes', 'compute', 'configuration', + 'constructor', 'continue', 'datatype', 'default', 'derived', + 'disjuncts', 'do', 'elif', 'else', 'end', 'endif', 'except', + 'exists', 'extends', 'forAll', 'forEach', 'forOne', 'from', 'if', + 'implies', 'in', 'inherits', 'init', 'inout', 'intermediate', + 'invresolve', 'invresolveIn', 'invresolveone', 'invresolveoneIn', + 'isUnique', 'iterate', 'late', 'let', 'literal', 'log', 'map', + 'merges', 'modeltype', 'new', 'object', 'one', 'ordered', 'out', + 'package', 'population', 'property', 'raise', 'readonly', + 'references', 'refines', 'reject', 'resolve', 'resolveIn', + 'resolveone', 'resolveoneIn', 'return', 'select', 'selectOne', + 'sortedBy', 'static', 'switch', 'tag', 'then', 'try', 'typedef', + 'unlimited', 'uses', 'when', 'where', 'while', 'with', 'xcollect', + 'xmap', 'xselect'), suffix=r'\b'), Keyword), + ], + + # There is no need to distinguish between String.Single and + # String.Double: 'strings' is factorised for 'dqs' and 'sqs' + 'strings': [ + (r'[^\\\'"\n]+', String), + # quotes, percents and backslashes must be parsed one at a time + (r'[\'"\\]', String), + ], + 'stringescape': [ + (r'\\([\\btnfr"\']|u[0-3][0-7]{2}|u[0-7]{1,2})', String.Escape) + ], + 'dqs': [ # double-quoted string + (r'"', String, '#pop'), + (r'\\\\|\\"', String.Escape), + include('strings') + ], + 'sqs': [ # single-quoted string + (r"'", String, '#pop'), + (r"\\\\|\\'", String.Escape), + include('strings') + ], + 'name': [ + ('[a-zA-Z_]\w*', Name), + ], + # numbers: excerpt taken from the python lexer + 'numbers': [ + (r'(\d+\.\d*|\d*\.\d+)([eE][+-]?[0-9]+)?', Number.Float), + (r'\d+[eE][+-]?[0-9]+', Number.Float), + (r'\d+', Number.Integer) + ], + } diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/r.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/r.py new file mode 100644 index 0000000000000000000000000000000000000000..dce6196943ab17dac8ba92e0340ee1718d3b5f09 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/r.py @@ -0,0 +1,453 @@ +# -*- coding: utf-8 -*- +""" + pygments.lexers.r + ~~~~~~~~~~~~~~~~~ + + Lexers for the R/S languages. + + :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS. + :license: BSD, see LICENSE for details. +""" + +import re + +from pygments.lexer import Lexer, RegexLexer, include, words, do_insertions +from pygments.token import Text, Comment, Operator, Keyword, Name, String, \ + Number, Punctuation, Generic + +__all__ = ['RConsoleLexer', 'SLexer', 'RdLexer'] + + +line_re = re.compile('.*?\n') + + +class RConsoleLexer(Lexer): + """ + For R console transcripts or R CMD BATCH output files. + """ + + name = 'RConsole' + aliases = ['rconsole', 'rout'] + filenames = ['*.Rout'] + + def get_tokens_unprocessed(self, text): + slexer = SLexer(**self.options) + + current_code_block = '' + insertions = [] + + for match in line_re.finditer(text): + line = match.group() + if line.startswith('>') or line.startswith('+'): + # Colorize the prompt as such, + # then put rest of line into current_code_block + insertions.append((len(current_code_block), + [(0, Generic.Prompt, line[:2])])) + current_code_block += line[2:] + else: + # We have reached a non-prompt line! + # If we have stored prompt lines, need to process them first. + if current_code_block: + # Weave together the prompts and highlight code. + for item in do_insertions( + insertions, slexer.get_tokens_unprocessed(current_code_block)): + yield item + # Reset vars for next code block. + current_code_block = '' + insertions = [] + # Now process the actual line itself, this is output from R. + yield match.start(), Generic.Output, line + + # If we happen to end on a code block with nothing after it, need to + # process the last code block. This is neither elegant nor DRY so + # should be changed. + if current_code_block: + for item in do_insertions( + insertions, slexer.get_tokens_unprocessed(current_code_block)): + yield item + + +class SLexer(RegexLexer): + """ + For S, S-plus, and R source code. + + .. versionadded:: 0.10 + """ + + name = 'S' + aliases = ['splus', 's', 'r'] + filenames = ['*.S', '*.R', '.Rhistory', '.Rprofile', '.Renviron'] + mimetypes = ['text/S-plus', 'text/S', 'text/x-r-source', 'text/x-r', + 'text/x-R', 'text/x-r-history', 'text/x-r-profile'] + + builtins_base = ( + 'Arg', 'Conj', 'Cstack_info', 'Encoding', 'FALSE', + 'Filter', 'Find', 'I', 'ISOdate', 'ISOdatetime', 'Im', 'Inf', + 'La.svd', 'Map', 'Math.Date', 'Math.POSIXt', 'Math.data.frame', + 'Math.difftime', 'Math.factor', 'Mod', 'NA_character_', + 'NA_complex_', 'NA_real_', 'NCOL', 'NROW', 'NULLNA_integer_', 'NaN', + 'Negate', 'NextMethod', 'Ops.Date', 'Ops.POSIXt', 'Ops.data.frame', + 'Ops.difftime', 'Ops.factor', 'Ops.numeric_version', 'Ops.ordered', + 'Position', 'R.Version', 'R.home', 'R.version', 'R.version.string', + 'RNGkind', 'RNGversion', 'R_system_version', 'Re', 'Recall', + 'Reduce', 'Summary.Date', 'Summary.POSIXct', 'Summary.POSIXlt', + 'Summary.data.frame', 'Summary.difftime', 'Summary.factor', + 'Summary.numeric_version', 'Summary.ordered', 'Sys.Date', + 'Sys.chmod', 'Sys.getenv', 'Sys.getlocale', 'Sys.getpid', + 'Sys.glob', 'Sys.info', 'Sys.localeconv', 'Sys.readlink', + 'Sys.setFileTime', 'Sys.setenv', 'Sys.setlocale', 'Sys.sleep', + 'Sys.time', 'Sys.timezone', 'Sys.umask', 'Sys.unsetenv', + 'Sys.which', 'TRUE', 'UseMethod', 'Vectorize', 'abbreviate', 'abs', + 'acos', 'acosh', 'addNA', 'addTaskCallback', 'agrep', 'alist', + 'all', 'all.equal', 'all.equal.POSIXct', 'all.equal.character', + 'all.equal.default', 'all.equal.factor', 'all.equal.formula', + 'all.equal.language', 'all.equal.list', 'all.equal.numeric', + 'all.equal.raw', 'all.names', 'all.vars', 'any', 'anyDuplicated', + 'anyDuplicated.array', 'anyDuplicated.data.frame', + 'anyDuplicated.default', 'anyDuplicated.matrix', 'aperm', + 'aperm.default', 'aperm.table', 'append', 'apply', 'args', + 'arrayInd', 'as.Date', 'as.Date.POSIXct', 'as.Date.POSIXlt', + 'as.Date.character', 'as.Date.date', 'as.Date.dates', + 'as.Date.default', 'as.Date.factor', 'as.Date.numeric', + 'as.POSIXct', 'as.POSIXct.Date', 'as.POSIXct.POSIXlt', + 'as.POSIXct.date', 'as.POSIXct.dates', 'as.POSIXct.default', + 'as.POSIXct.numeric', 'as.POSIXlt', 'as.POSIXlt.Date', + 'as.POSIXlt.POSIXct', 'as.POSIXlt.character', 'as.POSIXlt.date', + 'as.POSIXlt.dates', 'as.POSIXlt.default', 'as.POSIXlt.factor', + 'as.POSIXlt.numeric', 'as.array', 'as.array.default', 'as.call', + 'as.character', 'as.character.Date', 'as.character.POSIXt', + 'as.character.condition', 'as.character.default', + 'as.character.error', 'as.character.factor', 'as.character.hexmode', + 'as.character.numeric_version', 'as.character.octmode', + 'as.character.srcref', 'as.complex', 'as.data.frame', + 'as.data.frame.AsIs', 'as.data.frame.Date', 'as.data.frame.POSIXct', + 'as.data.frame.POSIXlt', 'as.data.frame.array', + 'as.data.frame.character', 'as.data.frame.complex', + 'as.data.frame.data.frame', 'as.data.frame.default', + 'as.data.frame.difftime', 'as.data.frame.factor', + 'as.data.frame.integer', 'as.data.frame.list', + 'as.data.frame.logical', 'as.data.frame.matrix', + 'as.data.frame.model.matrix', 'as.data.frame.numeric', + 'as.data.frame.numeric_version', 'as.data.frame.ordered', + 'as.data.frame.raw', 'as.data.frame.table', 'as.data.frame.ts', + 'as.data.frame.vector', 'as.difftime', 'as.double', + 'as.double.POSIXlt', 'as.double.difftime', 'as.environment', + 'as.expression', 'as.expression.default', 'as.factor', + 'as.function', 'as.function.default', 'as.hexmode', 'as.integer', + 'as.list', 'as.list.Date', 'as.list.POSIXct', 'as.list.data.frame', + 'as.list.default', 'as.list.environment', 'as.list.factor', + 'as.list.function', 'as.list.numeric_version', 'as.logical', + 'as.logical.factor', 'as.matrix', 'as.matrix.POSIXlt', + 'as.matrix.data.frame', 'as.matrix.default', 'as.matrix.noquote', + 'as.name', 'as.null', 'as.null.default', 'as.numeric', + 'as.numeric_version', 'as.octmode', 'as.ordered', + 'as.package_version', 'as.pairlist', 'as.qr', 'as.raw', 'as.single', + 'as.single.default', 'as.symbol', 'as.table', 'as.table.default', + 'as.vector', 'as.vector.factor', 'asNamespace', 'asS3', 'asS4', + 'asin', 'asinh', 'assign', 'atan', 'atan2', 'atanh', + 'attachNamespace', 'attr', 'attr.all.equal', 'attributes', + 'autoload', 'autoloader', 'backsolve', 'baseenv', 'basename', + 'besselI', 'besselJ', 'besselK', 'besselY', 'beta', + 'bindingIsActive', 'bindingIsLocked', 'bindtextdomain', 'bitwAnd', + 'bitwNot', 'bitwOr', 'bitwShiftL', 'bitwShiftR', 'bitwXor', 'body', + 'bquote', 'browser', 'browserCondition', 'browserSetDebug', + 'browserText', 'builtins', 'by', 'by.data.frame', 'by.default', + 'bzfile', 'c.Date', 'c.POSIXct', 'c.POSIXlt', 'c.noquote', + 'c.numeric_version', 'call', 'callCC', 'capabilities', 'casefold', + 'cat', 'category', 'cbind', 'cbind.data.frame', 'ceiling', + 'char.expand', 'charToRaw', 'charmatch', 'chartr', 'check_tzones', + 'chol', 'chol.default', 'chol2inv', 'choose', 'class', + 'clearPushBack', 'close', 'close.connection', 'close.srcfile', + 'close.srcfilealias', 'closeAllConnections', 'col', 'colMeans', + 'colSums', 'colnames', 'commandArgs', 'comment', 'computeRestarts', + 'conditionCall', 'conditionCall.condition', 'conditionMessage', + 'conditionMessage.condition', 'conflicts', 'contributors', 'cos', + 'cosh', 'crossprod', 'cummax', 'cummin', 'cumprod', 'cumsum', 'cut', + 'cut.Date', 'cut.POSIXt', 'cut.default', 'dQuote', 'data.class', + 'data.matrix', 'date', 'debug', 'debugonce', + 'default.stringsAsFactors', 'delayedAssign', 'deparse', 'det', + 'determinant', 'determinant.matrix', 'dget', 'diag', 'diff', + 'diff.Date', 'diff.POSIXt', 'diff.default', 'difftime', 'digamma', + 'dim', 'dim.data.frame', 'dimnames', 'dimnames.data.frame', 'dir', + 'dir.create', 'dirname', 'do.call', 'dput', 'drop', 'droplevels', + 'droplevels.data.frame', 'droplevels.factor', 'dump', 'duplicated', + 'duplicated.POSIXlt', 'duplicated.array', 'duplicated.data.frame', + 'duplicated.default', 'duplicated.matrix', + 'duplicated.numeric_version', 'dyn.load', 'dyn.unload', 'eapply', + 'eigen', 'else', 'emptyenv', 'enc2native', 'enc2utf8', + 'encodeString', 'enquote', 'env.profile', 'environment', + 'environmentIsLocked', 'environmentName', 'eval', 'eval.parent', + 'evalq', 'exists', 'exp', 'expand.grid', 'expm1', 'expression', + 'factor', 'factorial', 'fifo', 'file', 'file.access', 'file.append', + 'file.choose', 'file.copy', 'file.create', 'file.exists', + 'file.info', 'file.link', 'file.path', 'file.remove', 'file.rename', + 'file.show', 'file.symlink', 'find.package', 'findInterval', + 'findPackageEnv', 'findRestart', 'floor', 'flush', + 'flush.connection', 'force', 'formals', 'format', + 'format.AsIs', 'format.Date', 'format.POSIXct', 'format.POSIXlt', + 'format.data.frame', 'format.default', 'format.difftime', + 'format.factor', 'format.hexmode', 'format.info', + 'format.libraryIQR', 'format.numeric_version', 'format.octmode', + 'format.packageInfo', 'format.pval', 'format.summaryDefault', + 'formatC', 'formatDL', 'forwardsolve', 'gamma', 'gc', 'gc.time', + 'gcinfo', 'gctorture', 'gctorture2', 'get', 'getAllConnections', + 'getCallingDLL', 'getCallingDLLe', 'getConnection', + 'getDLLRegisteredRoutines', 'getDLLRegisteredRoutines.DLLInfo', + 'getDLLRegisteredRoutines.character', 'getElement', + 'getExportedValue', 'getHook', 'getLoadedDLLs', 'getNamespace', + 'getNamespaceExports', 'getNamespaceImports', 'getNamespaceInfo', + 'getNamespaceName', 'getNamespaceUsers', 'getNamespaceVersion', + 'getNativeSymbolInfo', 'getOption', 'getRversion', 'getSrcLines', + 'getTaskCallbackNames', 'geterrmessage', 'gettext', 'gettextf', + 'getwd', 'gl', 'globalenv', 'gregexpr', 'grep', 'grepRaw', 'grepl', + 'gsub', 'gzcon', 'gzfile', 'head', 'iconv', 'iconvlist', + 'icuSetCollate', 'identical', 'identity', 'ifelse', 'importIntoEnv', + 'in', 'inherits', 'intToBits', 'intToUtf8', 'interaction', 'interactive', + 'intersect', 'inverse.rle', 'invisible', 'invokeRestart', + 'invokeRestartInteractively', 'is.R', 'is.array', 'is.atomic', + 'is.call', 'is.character', 'is.complex', 'is.data.frame', + 'is.double', 'is.element', 'is.environment', 'is.expression', + 'is.factor', 'is.finite', 'is.function', 'is.infinite', + 'is.integer', 'is.language', 'is.list', 'is.loaded', 'is.logical', + 'is.matrix', 'is.na', 'is.na.POSIXlt', 'is.na.data.frame', + 'is.na.numeric_version', 'is.name', 'is.nan', 'is.null', + 'is.numeric', 'is.numeric.Date', 'is.numeric.POSIXt', + 'is.numeric.difftime', 'is.numeric_version', 'is.object', + 'is.ordered', 'is.package_version', 'is.pairlist', 'is.primitive', + 'is.qr', 'is.raw', 'is.recursive', 'is.single', 'is.symbol', + 'is.table', 'is.unsorted', 'is.vector', 'isBaseNamespace', + 'isIncomplete', 'isNamespace', 'isOpen', 'isRestart', 'isS4', + 'isSeekable', 'isSymmetric', 'isSymmetric.matrix', 'isTRUE', + 'isatty', 'isdebugged', 'jitter', 'julian', 'julian.Date', + 'julian.POSIXt', 'kappa', 'kappa.default', 'kappa.lm', 'kappa.qr', + 'kronecker', 'l10n_info', 'labels', 'labels.default', 'lapply', + 'lazyLoad', 'lazyLoadDBexec', 'lazyLoadDBfetch', 'lbeta', 'lchoose', + 'length', 'length.POSIXlt', 'letters', 'levels', 'levels.default', + 'lfactorial', 'lgamma', 'library.dynam', 'library.dynam.unload', + 'licence', 'license', 'list.dirs', 'list.files', 'list2env', 'load', + 'loadNamespace', 'loadedNamespaces', 'loadingNamespaceInfo', + 'local', 'lockBinding', 'lockEnvironment', 'log', 'log10', 'log1p', + 'log2', 'logb', 'lower.tri', 'ls', 'make.names', 'make.unique', + 'makeActiveBinding', 'mapply', 'margin.table', 'mat.or.vec', + 'match', 'match.arg', 'match.call', 'match.fun', 'max', 'max.col', + 'mean', 'mean.Date', 'mean.POSIXct', 'mean.POSIXlt', 'mean.default', + 'mean.difftime', 'mem.limits', 'memCompress', 'memDecompress', + 'memory.profile', 'merge', 'merge.data.frame', 'merge.default', + 'message', 'mget', 'min', 'missing', 'mode', 'month.abb', + 'month.name', 'months', 'months.Date', 'months.POSIXt', + 'months.abb', 'months.nameletters', 'names', 'names.POSIXlt', + 'namespaceExport', 'namespaceImport', 'namespaceImportClasses', + 'namespaceImportFrom', 'namespaceImportMethods', 'nargs', 'nchar', + 'ncol', 'new.env', 'ngettext', 'nlevels', 'noquote', 'norm', + 'normalizePath', 'nrow', 'numeric_version', 'nzchar', 'objects', + 'oldClass', 'on.exit', 'open', 'open.connection', 'open.srcfile', + 'open.srcfilealias', 'open.srcfilecopy', 'options', 'order', + 'ordered', 'outer', 'packBits', 'packageEvent', + 'packageHasNamespace', 'packageStartupMessage', 'package_version', + 'pairlist', 'parent.env', 'parent.frame', 'parse', + 'parseNamespaceFile', 'paste', 'paste0', 'path.expand', + 'path.package', 'pipe', 'pmatch', 'pmax', 'pmax.int', 'pmin', + 'pmin.int', 'polyroot', 'pos.to.env', 'pretty', 'pretty.default', + 'prettyNum', 'print', 'print.AsIs', 'print.DLLInfo', + 'print.DLLInfoList', 'print.DLLRegisteredRoutines', 'print.Date', + 'print.NativeRoutineList', 'print.POSIXct', 'print.POSIXlt', + 'print.by', 'print.condition', 'print.connection', + 'print.data.frame', 'print.default', 'print.difftime', + 'print.factor', 'print.function', 'print.hexmode', + 'print.libraryIQR', 'print.listof', 'print.noquote', + 'print.numeric_version', 'print.octmode', 'print.packageInfo', + 'print.proc_time', 'print.restart', 'print.rle', + 'print.simple.list', 'print.srcfile', 'print.srcref', + 'print.summary.table', 'print.summaryDefault', 'print.table', + 'print.warnings', 'prmatrix', 'proc.time', 'prod', 'prop.table', + 'provideDimnames', 'psigamma', 'pushBack', 'pushBackLength', 'q', + 'qr', 'qr.Q', 'qr.R', 'qr.X', 'qr.coef', 'qr.default', 'qr.fitted', + 'qr.qty', 'qr.qy', 'qr.resid', 'qr.solve', 'quarters', + 'quarters.Date', 'quarters.POSIXt', 'quit', 'quote', 'range', + 'range.default', 'rank', 'rapply', 'raw', 'rawConnection', + 'rawConnectionValue', 'rawShift', 'rawToBits', 'rawToChar', 'rbind', + 'rbind.data.frame', 'rcond', 'read.dcf', 'readBin', 'readChar', + 'readLines', 'readRDS', 'readRenviron', 'readline', 'reg.finalizer', + 'regexec', 'regexpr', 'registerS3method', 'registerS3methods', + 'regmatches', 'remove', 'removeTaskCallback', 'rep', 'rep.Date', + 'rep.POSIXct', 'rep.POSIXlt', 'rep.factor', 'rep.int', + 'rep.numeric_version', 'rep_len', 'replace', 'replicate', + 'requireNamespace', 'restartDescription', 'restartFormals', + 'retracemem', 'rev', 'rev.default', 'rle', 'rm', 'round', + 'round.Date', 'round.POSIXt', 'row', 'row.names', + 'row.names.data.frame', 'row.names.default', 'rowMeans', 'rowSums', + 'rownames', 'rowsum', 'rowsum.data.frame', 'rowsum.default', + 'sQuote', 'sample', 'sample.int', 'sapply', 'save', 'save.image', + 'saveRDS', 'scale', 'scale.default', 'scan', 'search', + 'searchpaths', 'seek', 'seek.connection', 'seq', 'seq.Date', + 'seq.POSIXt', 'seq.default', 'seq.int', 'seq_along', 'seq_len', + 'sequence', 'serialize', 'set.seed', 'setHook', 'setNamespaceInfo', + 'setSessionTimeLimit', 'setTimeLimit', 'setdiff', 'setequal', + 'setwd', 'shQuote', 'showConnections', 'sign', 'signalCondition', + 'signif', 'simpleCondition', 'simpleError', 'simpleMessage', + 'simpleWarning', 'simplify2array', 'sin', 'single', + 'sinh', 'sink', 'sink.number', 'slice.index', 'socketConnection', + 'socketSelect', 'solve', 'solve.default', 'solve.qr', 'sort', + 'sort.POSIXlt', 'sort.default', 'sort.int', 'sort.list', 'split', + 'split.Date', 'split.POSIXct', 'split.data.frame', 'split.default', + 'sprintf', 'sqrt', 'srcfile', 'srcfilealias', 'srcfilecopy', + 'srcref', 'standardGeneric', 'stderr', 'stdin', 'stdout', 'stop', + 'stopifnot', 'storage.mode', 'strftime', 'strptime', 'strsplit', + 'strtoi', 'strtrim', 'structure', 'strwrap', 'sub', 'subset', + 'subset.data.frame', 'subset.default', 'subset.matrix', + 'substitute', 'substr', 'substring', 'sum', 'summary', + 'summary.Date', 'summary.POSIXct', 'summary.POSIXlt', + 'summary.connection', 'summary.data.frame', 'summary.default', + 'summary.factor', 'summary.matrix', 'summary.proc_time', + 'summary.srcfile', 'summary.srcref', 'summary.table', + 'suppressMessages', 'suppressPackageStartupMessages', + 'suppressWarnings', 'svd', 'sweep', 'sys.call', 'sys.calls', + 'sys.frame', 'sys.frames', 'sys.function', 'sys.load.image', + 'sys.nframe', 'sys.on.exit', 'sys.parent', 'sys.parents', + 'sys.save.image', 'sys.source', 'sys.status', 'system', + 'system.file', 'system.time', 'system2', 't', 't.data.frame', + 't.default', 'table', 'tabulate', 'tail', 'tan', 'tanh', 'tapply', + 'taskCallbackManager', 'tcrossprod', 'tempdir', 'tempfile', + 'testPlatformEquivalence', 'textConnection', 'textConnectionValue', + 'toString', 'toString.default', 'tolower', 'topenv', 'toupper', + 'trace', 'traceback', 'tracemem', 'tracingState', 'transform', + 'transform.data.frame', 'transform.default', 'trigamma', 'trunc', + 'trunc.Date', 'trunc.POSIXt', 'truncate', 'truncate.connection', + 'try', 'tryCatch', 'typeof', 'unclass', 'undebug', 'union', + 'unique', 'unique.POSIXlt', 'unique.array', 'unique.data.frame', + 'unique.default', 'unique.matrix', 'unique.numeric_version', + 'units', 'units.difftime', 'unix.time', 'unlink', 'unlist', + 'unloadNamespace', 'unlockBinding', 'unname', 'unserialize', + 'unsplit', 'untrace', 'untracemem', 'unz', 'upper.tri', 'url', + 'utf8ToInt', 'vapply', 'version', 'warning', 'warnings', 'weekdays', + 'weekdays.Date', 'weekdays.POSIXt', 'which', 'which.max', + 'which.min', 'with', 'with.default', 'withCallingHandlers', + 'withRestarts', 'withVisible', 'within', 'within.data.frame', + 'within.list', 'write', 'write.dcf', 'writeBin', 'writeChar', + 'writeLines', 'xor', 'xor.hexmode', 'xor.octmode', + 'xpdrows.data.frame', 'xtfrm', 'xtfrm.AsIs', 'xtfrm.Date', + 'xtfrm.POSIXct', 'xtfrm.POSIXlt', 'xtfrm.Surv', 'xtfrm.default', + 'xtfrm.difftime', 'xtfrm.factor', 'xtfrm.numeric_version', 'xzfile', + 'zapsmall' + ) + + tokens = { + 'comments': [ + (r'#.*$', Comment.Single), + ], + 'valid_name': [ + (r'[a-zA-Z][\w.]*', Text), + # can begin with ., but not if that is followed by a digit + (r'\.[a-zA-Z_][\w.]*', Text), + ], + 'punctuation': [ + (r'\[{1,2}|\]{1,2}|\(|\)|;|,', Punctuation), + ], + 'keywords': [ + (words(builtins_base, suffix=r'(?![\w. =])'), + Keyword.Pseudo), + (r'(if|else|for|while|repeat|in|next|break|return|switch|function)' + r'(?![\w.])', + Keyword.Reserved), + (r'(array|category|character|complex|double|function|integer|list|' + r'logical|matrix|numeric|vector|data.frame|c)' + r'(?![\w.])', + Keyword.Type), + (r'(library|require|attach|detach|source)' + r'(?![\w.])', + Keyword.Namespace) + ], + 'operators': [ + (r'<>?|-|==|<=|>=|<|>|&&?|!=|\|\|?|\?', Operator), + (r'\*|\+|\^|/|!|%[^%]*%|=|~|\$|@|:{1,3}', Operator) + ], + 'builtin_symbols': [ + (r'(NULL|NA(_(integer|real|complex|character)_)?|' + r'letters|LETTERS|Inf|TRUE|FALSE|NaN|pi|\.\.(\.|[0-9]+))' + r'(?![\w.])', + Keyword.Constant), + (r'(T|F)\b', Name.Builtin.Pseudo), + ], + 'numbers': [ + # hex number + (r'0[xX][a-fA-F0-9]+([pP][0-9]+)?[Li]?', Number.Hex), + # decimal number + (r'[+-]?([0-9]+(\.[0-9]+)?|\.[0-9]+|\.)([eE][+-]?[0-9]+)?[Li]?', + Number), + ], + 'statements': [ + include('comments'), + # whitespaces + (r'\s+', Text), + (r'`.*?`', String.Backtick), + (r'\'', String, 'string_squote'), + (r'\"', String, 'string_dquote'), + include('builtin_symbols'), + include('numbers'), + include('keywords'), + include('punctuation'), + include('operators'), + include('valid_name'), + ], + 'root': [ + include('statements'), + # blocks: + (r'\{|\}', Punctuation), + # (r'\{', Punctuation, 'block'), + (r'.', Text), + ], + # 'block': [ + # include('statements'), + # ('\{', Punctuation, '#push'), + # ('\}', Punctuation, '#pop') + # ], + 'string_squote': [ + (r'([^\'\\]|\\.)*\'', String, '#pop'), + ], + 'string_dquote': [ + (r'([^"\\]|\\.)*"', String, '#pop'), + ], + } + + def analyse_text(text): + if re.search(r'[a-z0-9_\])\s]<-(?!-)', text): + return 0.11 + + +class RdLexer(RegexLexer): + """ + Pygments Lexer for R documentation (Rd) files + + This is a very minimal implementation, highlighting little more + than the macros. A description of Rd syntax is found in `Writing R + Extensions `_ + and `Parsing Rd files `_. + + .. versionadded:: 1.6 + """ + name = 'Rd' + aliases = ['rd'] + filenames = ['*.Rd'] + mimetypes = ['text/x-r-doc'] + + # To account for verbatim / LaTeX-like / and R-like areas + # would require parsing. + tokens = { + 'root': [ + # catch escaped brackets and percent sign + (r'\\[\\{}%]', String.Escape), + # comments + (r'%.*$', Comment), + # special macros with no arguments + (r'\\(?:cr|l?dots|R|tab)\b', Keyword.Constant), + # macros + (r'\\[a-zA-Z]+\b', Keyword), + # special preprocessor macros + (r'^\s*#(?:ifn?def|endif).*\b', Comment.Preproc), + # non-escaped brackets + (r'[{}]', Name.Builtin), + # everything else + (r'[^\\%\n{}]+', Text), + (r'.', Text), + ] + } diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/rdf.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/rdf.py new file mode 100644 index 0000000000000000000000000000000000000000..d0f8778adf2ae7d3b7e248e106865ee12158b309 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/rdf.py @@ -0,0 +1,270 @@ +# -*- coding: utf-8 -*- +""" + pygments.lexers.rdf + ~~~~~~~~~~~~~~~~~~~ + + Lexers for semantic web and RDF query languages and markup. + + :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS. + :license: BSD, see LICENSE for details. +""" + +import re + +from pygments.lexer import RegexLexer, bygroups, default +from pygments.token import Keyword, Punctuation, String, Number, Operator, Generic, \ + Whitespace, Name, Literal, Comment, Text + +__all__ = ['SparqlLexer', 'TurtleLexer'] + + +class SparqlLexer(RegexLexer): + """ + Lexer for `SPARQL `_ query language. + + .. versionadded:: 2.0 + """ + name = 'SPARQL' + aliases = ['sparql'] + filenames = ['*.rq', '*.sparql'] + mimetypes = ['application/sparql-query'] + + # character group definitions :: + + PN_CHARS_BASE_GRP = (u'a-zA-Z' + u'\u00c0-\u00d6' + u'\u00d8-\u00f6' + u'\u00f8-\u02ff' + u'\u0370-\u037d' + u'\u037f-\u1fff' + u'\u200c-\u200d' + u'\u2070-\u218f' + u'\u2c00-\u2fef' + u'\u3001-\ud7ff' + u'\uf900-\ufdcf' + u'\ufdf0-\ufffd') + + PN_CHARS_U_GRP = (PN_CHARS_BASE_GRP + '_') + + PN_CHARS_GRP = (PN_CHARS_U_GRP + + r'\-' + + r'0-9' + + u'\u00b7' + + u'\u0300-\u036f' + + u'\u203f-\u2040') + + HEX_GRP = '0-9A-Fa-f' + + PN_LOCAL_ESC_CHARS_GRP = r' _~.\-!$&"()*+,;=/?#@%' + + # terminal productions :: + + PN_CHARS_BASE = '[' + PN_CHARS_BASE_GRP + ']' + + PN_CHARS_U = '[' + PN_CHARS_U_GRP + ']' + + PN_CHARS = '[' + PN_CHARS_GRP + ']' + + HEX = '[' + HEX_GRP + ']' + + PN_LOCAL_ESC_CHARS = '[' + PN_LOCAL_ESC_CHARS_GRP + ']' + + IRIREF = r'<(?:[^<>"{}|^`\\\x00-\x20])*>' + + BLANK_NODE_LABEL = '_:[0-9' + PN_CHARS_U_GRP + '](?:[' + PN_CHARS_GRP + \ + '.]*' + PN_CHARS + ')?' + + PN_PREFIX = PN_CHARS_BASE + '(?:[' + PN_CHARS_GRP + '.]*' + PN_CHARS + ')?' + + VARNAME = u'[0-9' + PN_CHARS_U_GRP + '][' + PN_CHARS_U_GRP + \ + u'0-9\u00b7\u0300-\u036f\u203f-\u2040]*' + + PERCENT = '%' + HEX + HEX + + PN_LOCAL_ESC = r'\\' + PN_LOCAL_ESC_CHARS + + PLX = '(?:' + PERCENT + ')|(?:' + PN_LOCAL_ESC + ')' + + PN_LOCAL = ('(?:[' + PN_CHARS_U_GRP + ':0-9' + ']|' + PLX + ')' + + '(?:(?:[' + PN_CHARS_GRP + '.:]|' + PLX + ')*(?:[' + + PN_CHARS_GRP + ':]|' + PLX + '))?') + + EXPONENT = r'[eE][+-]?\d+' + + # Lexer token definitions :: + + tokens = { + 'root': [ + (r'\s+', Text), + # keywords :: + (r'((?i)select|construct|describe|ask|where|filter|group\s+by|minus|' + r'distinct|reduced|from\s+named|from|order\s+by|desc|asc|limit|' + r'offset|bindings|load|clear|drop|create|add|move|copy|' + r'insert\s+data|delete\s+data|delete\s+where|delete|insert|' + r'using\s+named|using|graph|default|named|all|optional|service|' + r'silent|bind|union|not\s+in|in|as|having|to|prefix|base)\b', Keyword), + (r'(a)\b', Keyword), + # IRIs :: + ('(' + IRIREF + ')', Name.Label), + # blank nodes :: + ('(' + BLANK_NODE_LABEL + ')', Name.Label), + # # variables :: + ('[?$]' + VARNAME, Name.Variable), + # prefixed names :: + (r'(' + PN_PREFIX + ')?(\:)(' + PN_LOCAL + ')?', + bygroups(Name.Namespace, Punctuation, Name.Tag)), + # function names :: + (r'((?i)str|lang|langmatches|datatype|bound|iri|uri|bnode|rand|abs|' + r'ceil|floor|round|concat|strlen|ucase|lcase|encode_for_uri|' + r'contains|strstarts|strends|strbefore|strafter|year|month|day|' + r'hours|minutes|seconds|timezone|tz|now|md5|sha1|sha256|sha384|' + r'sha512|coalesce|if|strlang|strdt|sameterm|isiri|isuri|isblank|' + r'isliteral|isnumeric|regex|substr|replace|exists|not\s+exists|' + r'count|sum|min|max|avg|sample|group_concat|separator)\b', + Name.Function), + # boolean literals :: + (r'(true|false)', Keyword.Constant), + # double literals :: + (r'[+\-]?(\d+\.\d*' + EXPONENT + '|\.?\d+' + EXPONENT + ')', Number.Float), + # decimal literals :: + (r'[+\-]?(\d+\.\d*|\.\d+)', Number.Float), + # integer literals :: + (r'[+\-]?\d+', Number.Integer), + # operators :: + (r'(\|\||&&|=|\*|\-|\+|/|!=|<=|>=|!|<|>)', Operator), + # punctuation characters :: + (r'[(){}.;,:^\[\]]', Punctuation), + # line comments :: + (r'#[^\n]*', Comment), + # strings :: + (r'"""', String, 'triple-double-quoted-string'), + (r'"', String, 'single-double-quoted-string'), + (r"'''", String, 'triple-single-quoted-string'), + (r"'", String, 'single-single-quoted-string'), + ], + 'triple-double-quoted-string': [ + (r'"""', String, 'end-of-string'), + (r'[^\\]+', String), + (r'\\', String, 'string-escape'), + ], + 'single-double-quoted-string': [ + (r'"', String, 'end-of-string'), + (r'[^"\\\n]+', String), + (r'\\', String, 'string-escape'), + ], + 'triple-single-quoted-string': [ + (r"'''", String, 'end-of-string'), + (r'[^\\]+', String), + (r'\\', String.Escape, 'string-escape'), + ], + 'single-single-quoted-string': [ + (r"'", String, 'end-of-string'), + (r"[^'\\\n]+", String), + (r'\\', String, 'string-escape'), + ], + 'string-escape': [ + (r'u' + HEX + '{4}', String.Escape, '#pop'), + (r'U' + HEX + '{8}', String.Escape, '#pop'), + (r'.', String.Escape, '#pop'), + ], + 'end-of-string': [ + (r'(@)([a-zA-Z]+(?:-[a-zA-Z0-9]+)*)', + bygroups(Operator, Name.Function), '#pop:2'), + (r'\^\^', Operator, '#pop:2'), + default('#pop:2'), + ], + } + + +class TurtleLexer(RegexLexer): + """ + Lexer for `Turtle `_ data language. + + .. versionadded:: 2.1 + """ + name = 'Turtle' + aliases = ['turtle'] + filenames = ['*.ttl'] + mimetypes = ['text/turtle', 'application/x-turtle'] + + flags = re.IGNORECASE + + patterns = { + 'PNAME_NS': r'((?:[a-z][\w-]*)?\:)', # Simplified character range + 'IRIREF': r'(<[^<>"{}|^`\\\x00-\x20]*>)' + } + + # PNAME_NS PN_LOCAL (with simplified character range) + patterns['PrefixedName'] = r'%(PNAME_NS)s([a-z][\w-]*)' % patterns + + tokens = { + 'root': [ + (r'\s+', Whitespace), + + # Base / prefix + (r'(@base|BASE)(\s+)%(IRIREF)s(\s*)(\.?)' % patterns, + bygroups(Keyword, Whitespace, Name.Variable, Whitespace, + Punctuation)), + (r'(@prefix|PREFIX)(\s+)%(PNAME_NS)s(\s+)%(IRIREF)s(\s*)(\.?)' % patterns, + bygroups(Keyword, Whitespace, Name.Namespace, Whitespace, + Name.Variable, Whitespace, Punctuation)), + + # The shorthand predicate 'a' + (r'(?<=\s)a(?=\s)', Keyword.Type), + + # IRIREF + (r'%(IRIREF)s' % patterns, Name.Variable), + + # PrefixedName + (r'%(PrefixedName)s' % patterns, + bygroups(Name.Namespace, Name.Tag)), + + # Comment + (r'#[^\n]+', Comment), + + (r'\b(true|false)\b', Literal), + (r'[+\-]?\d*\.\d+', Number.Float), + (r'[+\-]?\d*(:?\.\d+)?E[+\-]?\d+', Number.Float), + (r'[+\-]?\d+', Number.Integer), + (r'[\[\](){}.;,:^]', Punctuation), + + (r'"""', String, 'triple-double-quoted-string'), + (r'"', String, 'single-double-quoted-string'), + (r"'''", String, 'triple-single-quoted-string'), + (r"'", String, 'single-single-quoted-string'), + ], + 'triple-double-quoted-string': [ + (r'"""', String, 'end-of-string'), + (r'[^\\]+', String), + (r'\\', String, 'string-escape'), + ], + 'single-double-quoted-string': [ + (r'"', String, 'end-of-string'), + (r'[^"\\\n]+', String), + (r'\\', String, 'string-escape'), + ], + 'triple-single-quoted-string': [ + (r"'''", String, 'end-of-string'), + (r'[^\\]+', String), + (r'\\', String, 'string-escape'), + ], + 'single-single-quoted-string': [ + (r"'", String, 'end-of-string'), + (r"[^'\\\n]+", String), + (r'\\', String, 'string-escape'), + ], + 'string-escape': [ + (r'.', String, '#pop'), + ], + 'end-of-string': [ + (r'(@)([a-z]+(:?-[a-z0-9]+)*)', + bygroups(Operator, Generic.Emph), '#pop:2'), + + (r'(\^\^)%(IRIREF)s' % patterns, bygroups(Operator, Generic.Emph), '#pop:2'), + (r'(\^\^)%(PrefixedName)s' % patterns, + bygroups(Operator, Generic.Emph, Generic.Emph), '#pop:2'), + + default('#pop:2'), + + ], + } diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/rebol.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/rebol.py new file mode 100644 index 0000000000000000000000000000000000000000..f3d00200d02bb8ae825497b243b93ba8da6f500d --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/rebol.py @@ -0,0 +1,431 @@ +# -*- coding: utf-8 -*- +""" + pygments.lexers.rebol + ~~~~~~~~~~~~~~~~~~~~~ + + Lexers for the REBOL and related languages. + + :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS. + :license: BSD, see LICENSE for details. +""" + +import re + +from pygments.lexer import RegexLexer, bygroups +from pygments.token import Text, Comment, Operator, Keyword, Name, String, \ + Number, Generic, Whitespace + +__all__ = ['RebolLexer', 'RedLexer'] + + +class RebolLexer(RegexLexer): + """ + A `REBOL `_ lexer. + + .. versionadded:: 1.1 + """ + name = 'REBOL' + aliases = ['rebol'] + filenames = ['*.r', '*.r3', '*.reb'] + mimetypes = ['text/x-rebol'] + + flags = re.IGNORECASE | re.MULTILINE + + escape_re = r'(?:\^\([0-9a-f]{1,4}\)*)' + + def word_callback(lexer, match): + word = match.group() + + if re.match(".*:$", word): + yield match.start(), Generic.Subheading, word + elif re.match( + r'(native|alias|all|any|as-string|as-binary|bind|bound\?|case|' + r'catch|checksum|comment|debase|dehex|exclude|difference|disarm|' + r'either|else|enbase|foreach|remove-each|form|free|get|get-env|if|' + r'in|intersect|loop|minimum-of|maximum-of|mold|new-line|' + r'new-line\?|not|now|prin|print|reduce|compose|construct|repeat|' + r'reverse|save|script\?|set|shift|switch|throw|to-hex|trace|try|' + r'type\?|union|unique|unless|unprotect|unset|until|use|value\?|' + r'while|compress|decompress|secure|open|close|read|read-io|' + r'write-io|write|update|query|wait|input\?|exp|log-10|log-2|' + r'log-e|square-root|cosine|sine|tangent|arccosine|arcsine|' + r'arctangent|protect|lowercase|uppercase|entab|detab|connected\?|' + r'browse|launch|stats|get-modes|set-modes|to-local-file|' + r'to-rebol-file|encloak|decloak|create-link|do-browser|bind\?|' + r'hide|draw|show|size-text|textinfo|offset-to-caret|' + r'caret-to-offset|local-request-file|rgb-to-hsv|hsv-to-rgb|' + r'crypt-strength\?|dh-make-key|dh-generate-key|dh-compute-key|' + r'dsa-make-key|dsa-generate-key|dsa-make-signature|' + r'dsa-verify-signature|rsa-make-key|rsa-generate-key|' + r'rsa-encrypt)$', word): + yield match.start(), Name.Builtin, word + elif re.match( + r'(add|subtract|multiply|divide|remainder|power|and~|or~|xor~|' + r'minimum|maximum|negate|complement|absolute|random|head|tail|' + r'next|back|skip|at|pick|first|second|third|fourth|fifth|sixth|' + r'seventh|eighth|ninth|tenth|last|path|find|select|make|to|copy\*|' + r'insert|remove|change|poke|clear|trim|sort|min|max|abs|cp|' + r'copy)$', word): + yield match.start(), Name.Function, word + elif re.match( + r'(error|source|input|license|help|install|echo|Usage|with|func|' + r'throw-on-error|function|does|has|context|probe|\?\?|as-pair|' + r'mod|modulo|round|repend|about|set-net|append|join|rejoin|reform|' + r'remold|charset|array|replace|move|extract|forskip|forall|alter|' + r'first+|also|take|for|forever|dispatch|attempt|what-dir|' + r'change-dir|clean-path|list-dir|dirize|rename|split-path|delete|' + r'make-dir|delete-dir|in-dir|confirm|dump-obj|upgrade|what|' + r'build-tag|process-source|build-markup|decode-cgi|read-cgi|' + r'write-user|save-user|set-user-name|protect-system|parse-xml|' + r'cvs-date|cvs-version|do-boot|get-net-info|desktop|layout|' + r'scroll-para|get-face|alert|set-face|uninstall|unfocus|' + r'request-dir|center-face|do-events|net-error|decode-url|' + r'parse-header|parse-header-date|parse-email-addrs|import-email|' + r'send|build-attach-body|resend|show-popup|hide-popup|open-events|' + r'find-key-face|do-face|viewtop|confine|find-window|' + r'insert-event-func|remove-event-func|inform|dump-pane|dump-face|' + r'flag-face|deflag-face|clear-fields|read-net|vbug|path-thru|' + r'read-thru|load-thru|do-thru|launch-thru|load-image|' + r'request-download|do-face-alt|set-font|set-para|get-style|' + r'set-style|make-face|stylize|choose|hilight-text|hilight-all|' + r'unlight-text|focus|scroll-drag|clear-face|reset-face|scroll-face|' + r'resize-face|load-stock|load-stock-block|notify|request|flash|' + r'request-color|request-pass|request-text|request-list|' + r'request-date|request-file|dbug|editor|link-relative-path|' + r'emailer|parse-error)$', word): + yield match.start(), Keyword.Namespace, word + elif re.match( + r'(halt|quit|do|load|q|recycle|call|run|ask|parse|view|unview|' + r'return|exit|break)$', word): + yield match.start(), Name.Exception, word + elif re.match('REBOL$', word): + yield match.start(), Generic.Heading, word + elif re.match("to-.*", word): + yield match.start(), Keyword, word + elif re.match('(\+|-|\*|/|//|\*\*|and|or|xor|=\?|=|==|<>|<|>|<=|>=)$', + word): + yield match.start(), Operator, word + elif re.match(".*\?$", word): + yield match.start(), Keyword, word + elif re.match(".*\!$", word): + yield match.start(), Keyword.Type, word + elif re.match("'.*", word): + yield match.start(), Name.Variable.Instance, word # lit-word + elif re.match("#.*", word): + yield match.start(), Name.Label, word # issue + elif re.match("%.*", word): + yield match.start(), Name.Decorator, word # file + else: + yield match.start(), Name.Variable, word + + tokens = { + 'root': [ + (r'[^R]+', Comment), + (r'REBOL\s+\[', Generic.Strong, 'script'), + (r'R', Comment) + ], + 'script': [ + (r'\s+', Text), + (r'#"', String.Char, 'char'), + (r'#\{[0-9a-f]*\}', Number.Hex), + (r'2#\{', Number.Hex, 'bin2'), + (r'64#\{[0-9a-z+/=\s]*\}', Number.Hex), + (r'"', String, 'string'), + (r'\{', String, 'string2'), + (r';#+.*\n', Comment.Special), + (r';\*+.*\n', Comment.Preproc), + (r';.*\n', Comment), + (r'%"', Name.Decorator, 'stringFile'), + (r'%[^(^{")\s\[\]]+', Name.Decorator), + (r'[+-]?([a-z]{1,3})?\$\d+(\.\d+)?', Number.Float), # money + (r'[+-]?\d+\:\d+(\:\d+)?(\.\d+)?', String.Other), # time + (r'\d+[\-/][0-9a-z]+[\-/]\d+(\/\d+\:\d+((\:\d+)?' + r'([.\d+]?([+-]?\d+:\d+)?)?)?)?', String.Other), # date + (r'\d+(\.\d+)+\.\d+', Keyword.Constant), # tuple + (r'\d+X\d+', Keyword.Constant), # pair + (r'[+-]?\d+(\'\d+)?([.,]\d*)?E[+-]?\d+', Number.Float), + (r'[+-]?\d+(\'\d+)?[.,]\d*', Number.Float), + (r'[+-]?\d+(\'\d+)?', Number), + (r'[\[\]()]', Generic.Strong), + (r'[a-z]+[^(^{"\s:)]*://[^(^{"\s)]*', Name.Decorator), # url + (r'mailto:[^(^{"@\s)]+@[^(^{"@\s)]+', Name.Decorator), # url + (r'[^(^{"@\s)]+@[^(^{"@\s)]+', Name.Decorator), # email + (r'comment\s"', Comment, 'commentString1'), + (r'comment\s\{', Comment, 'commentString2'), + (r'comment\s\[', Comment, 'commentBlock'), + (r'comment\s[^(\s{"\[]+', Comment), + (r'/[^(^{")\s/[\]]*', Name.Attribute), + (r'([^(^{")\s/[\]]+)(?=[:({"\s/\[\]])', word_callback), + (r'<[\w:.-]*>', Name.Tag), + (r'<[^(<>\s")]+', Name.Tag, 'tag'), + (r'([^(^{")\s]+)', Text), + ], + 'string': [ + (r'[^(^")]+', String), + (escape_re, String.Escape), + (r'[(|)]+', String), + (r'\^.', String.Escape), + (r'"', String, '#pop'), + ], + 'string2': [ + (r'[^(^{})]+', String), + (escape_re, String.Escape), + (r'[(|)]+', String), + (r'\^.', String.Escape), + (r'\{', String, '#push'), + (r'\}', String, '#pop'), + ], + 'stringFile': [ + (r'[^(^")]+', Name.Decorator), + (escape_re, Name.Decorator), + (r'\^.', Name.Decorator), + (r'"', Name.Decorator, '#pop'), + ], + 'char': [ + (escape_re + '"', String.Char, '#pop'), + (r'\^."', String.Char, '#pop'), + (r'."', String.Char, '#pop'), + ], + 'tag': [ + (escape_re, Name.Tag), + (r'"', Name.Tag, 'tagString'), + (r'[^(<>\r\n")]+', Name.Tag), + (r'>', Name.Tag, '#pop'), + ], + 'tagString': [ + (r'[^(^")]+', Name.Tag), + (escape_re, Name.Tag), + (r'[(|)]+', Name.Tag), + (r'\^.', Name.Tag), + (r'"', Name.Tag, '#pop'), + ], + 'tuple': [ + (r'(\d+\.)+', Keyword.Constant), + (r'\d+', Keyword.Constant, '#pop'), + ], + 'bin2': [ + (r'\s+', Number.Hex), + (r'([01]\s*){8}', Number.Hex), + (r'\}', Number.Hex, '#pop'), + ], + 'commentString1': [ + (r'[^(^")]+', Comment), + (escape_re, Comment), + (r'[(|)]+', Comment), + (r'\^.', Comment), + (r'"', Comment, '#pop'), + ], + 'commentString2': [ + (r'[^(^{})]+', Comment), + (escape_re, Comment), + (r'[(|)]+', Comment), + (r'\^.', Comment), + (r'\{', Comment, '#push'), + (r'\}', Comment, '#pop'), + ], + 'commentBlock': [ + (r'\[', Comment, '#push'), + (r'\]', Comment, '#pop'), + (r'"', Comment, "commentString1"), + (r'\{', Comment, "commentString2"), + (r'[^(\[\]"{)]+', Comment), + ], + } + + def analyse_text(text): + """ + Check if code contains REBOL header and so it probably not R code + """ + if re.match(r'^\s*REBOL\s*\[', text, re.IGNORECASE): + # The code starts with REBOL header + return 1.0 + elif re.search(r'\s*REBOL\s*[', text, re.IGNORECASE): + # The code contains REBOL header but also some text before it + return 0.5 + + +class RedLexer(RegexLexer): + """ + A `Red-language `_ lexer. + + .. versionadded:: 2.0 + """ + name = 'Red' + aliases = ['red', 'red/system'] + filenames = ['*.red', '*.reds'] + mimetypes = ['text/x-red', 'text/x-red-system'] + + flags = re.IGNORECASE | re.MULTILINE + + escape_re = r'(?:\^\([0-9a-f]{1,4}\)*)' + + def word_callback(lexer, match): + word = match.group() + + if re.match(".*:$", word): + yield match.start(), Generic.Subheading, word + elif re.match(r'(if|unless|either|any|all|while|until|loop|repeat|' + r'foreach|forall|func|function|does|has|switch|' + r'case|reduce|compose|get|set|print|prin|equal\?|' + r'not-equal\?|strict-equal\?|lesser\?|greater\?|lesser-or-equal\?|' + r'greater-or-equal\?|same\?|not|type\?|stats|' + r'bind|union|replace|charset|routine)$', word): + yield match.start(), Name.Builtin, word + elif re.match(r'(make|random|reflect|to|form|mold|absolute|add|divide|multiply|negate|' + r'power|remainder|round|subtract|even\?|odd\?|and~|complement|or~|xor~|' + r'append|at|back|change|clear|copy|find|head|head\?|index\?|insert|' + r'length\?|next|pick|poke|remove|reverse|select|sort|skip|swap|tail|tail\?|' + r'take|trim|create|close|delete|modify|open|open\?|query|read|rename|' + r'update|write)$', word): + yield match.start(), Name.Function, word + elif re.match(r'(yes|on|no|off|true|false|tab|cr|lf|newline|escape|slash|sp|space|null|' + r'none|crlf|dot|null-byte)$', word): + yield match.start(), Name.Builtin.Pseudo, word + elif re.match(r'(#system-global|#include|#enum|#define|#either|#if|#import|#export|' + r'#switch|#default|#get-definition)$', word): + yield match.start(), Keyword.Namespace, word + elif re.match(r'(system|halt|quit|quit-return|do|load|q|recycle|call|run|ask|parse|' + r'raise-error|return|exit|break|alias|push|pop|probe|\?\?|spec-of|body-of|' + r'quote|forever)$', word): + yield match.start(), Name.Exception, word + elif re.match(r'(action\?|block\?|char\?|datatype\?|file\?|function\?|get-path\?|zero\?|' + r'get-word\?|integer\?|issue\?|lit-path\?|lit-word\?|logic\?|native\?|' + r'op\?|paren\?|path\?|refinement\?|set-path\?|set-word\?|string\?|unset\?|' + r'any-struct\?|none\?|word\?|any-series\?)$', word): + yield match.start(), Keyword, word + elif re.match(r'(JNICALL|stdcall|cdecl|infix)$', word): + yield match.start(), Keyword.Namespace, word + elif re.match("to-.*", word): + yield match.start(), Keyword, word + elif re.match('(\+|-\*\*|-|\*\*|//|/|\*|and|or|xor|=\?|===|==|=|<>|<=|>=|' + '<<<|>>>|<<|>>|<|>%)$', word): + yield match.start(), Operator, word + elif re.match(".*\!$", word): + yield match.start(), Keyword.Type, word + elif re.match("'.*", word): + yield match.start(), Name.Variable.Instance, word # lit-word + elif re.match("#.*", word): + yield match.start(), Name.Label, word # issue + elif re.match("%.*", word): + yield match.start(), Name.Decorator, word # file + elif re.match(":.*", word): + yield match.start(), Generic.Subheading, word # get-word + else: + yield match.start(), Name.Variable, word + + tokens = { + 'root': [ + (r'[^R]+', Comment), + (r'Red/System\s+\[', Generic.Strong, 'script'), + (r'Red\s+\[', Generic.Strong, 'script'), + (r'R', Comment) + ], + 'script': [ + (r'\s+', Text), + (r'#"', String.Char, 'char'), + (r'#\{[0-9a-f\s]*\}', Number.Hex), + (r'2#\{', Number.Hex, 'bin2'), + (r'64#\{[0-9a-z+/=\s]*\}', Number.Hex), + (r'([0-9a-f]+)(h)((\s)|(?=[\[\]{}"()]))', + bygroups(Number.Hex, Name.Variable, Whitespace)), + (r'"', String, 'string'), + (r'\{', String, 'string2'), + (r';#+.*\n', Comment.Special), + (r';\*+.*\n', Comment.Preproc), + (r';.*\n', Comment), + (r'%"', Name.Decorator, 'stringFile'), + (r'%[^(^{")\s\[\]]+', Name.Decorator), + (r'[+-]?([a-z]{1,3})?\$\d+(\.\d+)?', Number.Float), # money + (r'[+-]?\d+\:\d+(\:\d+)?(\.\d+)?', String.Other), # time + (r'\d+[\-/][0-9a-z]+[\-/]\d+(/\d+:\d+((:\d+)?' + r'([\.\d+]?([+-]?\d+:\d+)?)?)?)?', String.Other), # date + (r'\d+(\.\d+)+\.\d+', Keyword.Constant), # tuple + (r'\d+X\d+', Keyword.Constant), # pair + (r'[+-]?\d+(\'\d+)?([.,]\d*)?E[+-]?\d+', Number.Float), + (r'[+-]?\d+(\'\d+)?[.,]\d*', Number.Float), + (r'[+-]?\d+(\'\d+)?', Number), + (r'[\[\]()]', Generic.Strong), + (r'[a-z]+[^(^{"\s:)]*://[^(^{"\s)]*', Name.Decorator), # url + (r'mailto:[^(^{"@\s)]+@[^(^{"@\s)]+', Name.Decorator), # url + (r'[^(^{"@\s)]+@[^(^{"@\s)]+', Name.Decorator), # email + (r'comment\s"', Comment, 'commentString1'), + (r'comment\s\{', Comment, 'commentString2'), + (r'comment\s\[', Comment, 'commentBlock'), + (r'comment\s[^(\s{"\[]+', Comment), + (r'/[^(^{^")\s/[\]]*', Name.Attribute), + (r'([^(^{^")\s/[\]]+)(?=[:({"\s/\[\]])', word_callback), + (r'<[\w:.-]*>', Name.Tag), + (r'<[^(<>\s")]+', Name.Tag, 'tag'), + (r'([^(^{")\s]+)', Text), + ], + 'string': [ + (r'[^(^")]+', String), + (escape_re, String.Escape), + (r'[(|)]+', String), + (r'\^.', String.Escape), + (r'"', String, '#pop'), + ], + 'string2': [ + (r'[^(^{})]+', String), + (escape_re, String.Escape), + (r'[(|)]+', String), + (r'\^.', String.Escape), + (r'\{', String, '#push'), + (r'\}', String, '#pop'), + ], + 'stringFile': [ + (r'[^(^")]+', Name.Decorator), + (escape_re, Name.Decorator), + (r'\^.', Name.Decorator), + (r'"', Name.Decorator, '#pop'), + ], + 'char': [ + (escape_re + '"', String.Char, '#pop'), + (r'\^."', String.Char, '#pop'), + (r'."', String.Char, '#pop'), + ], + 'tag': [ + (escape_re, Name.Tag), + (r'"', Name.Tag, 'tagString'), + (r'[^(<>\r\n")]+', Name.Tag), + (r'>', Name.Tag, '#pop'), + ], + 'tagString': [ + (r'[^(^")]+', Name.Tag), + (escape_re, Name.Tag), + (r'[(|)]+', Name.Tag), + (r'\^.', Name.Tag), + (r'"', Name.Tag, '#pop'), + ], + 'tuple': [ + (r'(\d+\.)+', Keyword.Constant), + (r'\d+', Keyword.Constant, '#pop'), + ], + 'bin2': [ + (r'\s+', Number.Hex), + (r'([01]\s*){8}', Number.Hex), + (r'\}', Number.Hex, '#pop'), + ], + 'commentString1': [ + (r'[^(^")]+', Comment), + (escape_re, Comment), + (r'[(|)]+', Comment), + (r'\^.', Comment), + (r'"', Comment, '#pop'), + ], + 'commentString2': [ + (r'[^(^{})]+', Comment), + (escape_re, Comment), + (r'[(|)]+', Comment), + (r'\^.', Comment), + (r'\{', Comment, '#push'), + (r'\}', Comment, '#pop'), + ], + 'commentBlock': [ + (r'\[', Comment, '#push'), + (r'\]', Comment, '#pop'), + (r'"', Comment, "commentString1"), + (r'\{', Comment, "commentString2"), + (r'[^(\[\]"{)]+', Comment), + ], + } diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/resource.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/resource.py new file mode 100644 index 0000000000000000000000000000000000000000..f7494904769ee25ccb089ce8adcbe328d527300e --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/resource.py @@ -0,0 +1,85 @@ +# -*- coding: utf-8 -*- +""" + pygments.lexers.resource + ~~~~~~~~~~~~~~~~~~~~~~~~ + + Lexer for resource definition files. + + :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS. + :license: BSD, see LICENSE for details. +""" + +import re + +from pygments.lexer import RegexLexer, bygroups, words +from pygments.token import Comment, String, Number, Operator, Text, \ + Keyword, Name + +__all__ = ['ResourceLexer'] + + +class ResourceLexer(RegexLexer): + """Lexer for `ICU Resource bundles + `_. + + .. versionadded:: 2.0 + """ + name = 'ResourceBundle' + aliases = ['resource', 'resourcebundle'] + filenames = ['*.txt'] + + _types = (':table', ':array', ':string', ':bin', ':import', ':intvector', + ':int', ':alias') + + flags = re.MULTILINE | re.IGNORECASE + tokens = { + 'root': [ + (r'//.*?$', Comment), + (r'"', String, 'string'), + (r'-?\d+', Number.Integer), + (r'[,{}]', Operator), + (r'([^\s{:]+)(\s*)(%s?)' % '|'.join(_types), + bygroups(Name, Text, Keyword)), + (r'\s+', Text), + (words(_types), Keyword), + ], + 'string': [ + (r'(\\x[0-9a-f]{2}|\\u[0-9a-f]{4}|\\U00[0-9a-f]{6}|' + r'\\[0-7]{1,3}|\\c.|\\[abtnvfre\'"?\\]|\\\{|[^"{\\])+', String), + (r'\{', String.Escape, 'msgname'), + (r'"', String, '#pop') + ], + 'msgname': [ + (r'([^{},]+)(\s*)', bygroups(Name, String.Escape), ('#pop', 'message')) + ], + 'message': [ + (r'\{', String.Escape, 'msgname'), + (r'\}', String.Escape, '#pop'), + (r'(,)(\s*)([a-z]+)(\s*\})', + bygroups(Operator, String.Escape, Keyword, String.Escape), '#pop'), + (r'(,)(\s*)([a-z]+)(\s*)(,)(\s*)(offset)(\s*)(:)(\s*)(-?\d+)(\s*)', + bygroups(Operator, String.Escape, Keyword, String.Escape, Operator, + String.Escape, Operator.Word, String.Escape, Operator, + String.Escape, Number.Integer, String.Escape), 'choice'), + (r'(,)(\s*)([a-z]+)(\s*)(,)(\s*)', + bygroups(Operator, String.Escape, Keyword, String.Escape, Operator, + String.Escape), 'choice'), + (r'\s+', String.Escape) + ], + 'choice': [ + (r'(=|<|>|<=|>=|!=)(-?\d+)(\s*\{)', + bygroups(Operator, Number.Integer, String.Escape), 'message'), + (r'([a-z]+)(\s*\{)', bygroups(Keyword.Type, String.Escape), 'str'), + (r'\}', String.Escape, ('#pop', '#pop')), + (r'\s+', String.Escape) + ], + 'str': [ + (r'\}', String.Escape, '#pop'), + (r'\{', String.Escape, 'msgname'), + (r'[^{}]+', String) + ] + } + + def analyse_text(text): + if text.startswith('root:table'): + return 1.0 diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/rnc.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/rnc.py new file mode 100644 index 0000000000000000000000000000000000000000..2f2aacdd25a6be42cfc00728496a57f870376fd5 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/rnc.py @@ -0,0 +1,67 @@ +# -*- coding: utf-8 -*- +""" + pygments.lexers.rnc + ~~~~~~~~~~~~~~~~~~~ + + Lexer for Relax-NG Compact syntax + + :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS. + :license: BSD, see LICENSE for details. +""" + +from pygments.lexer import RegexLexer +from pygments.token import Text, Comment, Operator, Keyword, Name, String, \ + Punctuation + +__all__ = ['RNCCompactLexer'] + + +class RNCCompactLexer(RegexLexer): + """ + For `RelaxNG-compact `_ syntax. + + .. versionadded:: 2.2 + """ + + name = 'Relax-NG Compact' + aliases = ['rnc', 'rng-compact'] + filenames = ['*.rnc'] + + tokens = { + 'root': [ + (r'namespace\b', Keyword.Namespace), + (r'(?:default|datatypes)\b', Keyword.Declaration), + (r'##.*$', Comment.Preproc), + (r'#.*$', Comment.Single), + (r'"[^"]*"', String.Double), + # TODO single quoted strings and escape sequences outside of + # double-quoted strings + (r'(?:element|attribute|mixed)\b', Keyword.Declaration, 'variable'), + (r'(text\b|xsd:[^ ]+)', Keyword.Type, 'maybe_xsdattributes'), + (r'[,?&*=|~]|>>', Operator), + (r'[(){}]', Punctuation), + (r'.', Text), + ], + + # a variable has been declared using `element` or `attribute` + 'variable': [ + (r'[^{]+', Name.Variable), + (r'\{', Punctuation, '#pop'), + ], + + # after an xsd: declaration there may be attributes + 'maybe_xsdattributes': [ + (r'\{', Punctuation, 'xsdattributes'), + (r'\}', Punctuation, '#pop'), + (r'.', Text), + ], + + # attributes take the form { key1 = value1 key2 = value2 ... } + 'xsdattributes': [ + (r'[^ =}]', Name.Attribute), + (r'=', Operator), + (r'"[^"]*"', String.Double), + (r'\}', Punctuation, '#pop'), + (r'.', Text), + ], + } diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/roboconf.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/roboconf.py new file mode 100644 index 0000000000000000000000000000000000000000..8c7df83db30f1f2442de738dd59a96a45200b9a8 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/roboconf.py @@ -0,0 +1,82 @@ +# -*- coding: utf-8 -*- +""" + pygments.lexers.roboconf + ~~~~~~~~~~~~~~~~~~~~~~~~ + + Lexers for Roboconf DSL. + + :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS. + :license: BSD, see LICENSE for details. +""" + +from pygments.lexer import RegexLexer, words, re +from pygments.token import Text, Operator, Keyword, Name, Comment + +__all__ = ['RoboconfGraphLexer', 'RoboconfInstancesLexer'] + + +class RoboconfGraphLexer(RegexLexer): + """ + Lexer for `Roboconf `_ graph files. + + .. versionadded:: 2.1 + """ + name = 'Roboconf Graph' + aliases = ['roboconf-graph'] + filenames = ['*.graph'] + + flags = re.IGNORECASE | re.MULTILINE + tokens = { + 'root': [ + # Skip white spaces + (r'\s+', Text), + + # There is one operator + (r'=', Operator), + + # Keywords + (words(('facet', 'import'), suffix=r'\s*\b', prefix=r'\b'), Keyword), + (words(( + 'installer', 'extends', 'exports', 'imports', 'facets', + 'children'), suffix=r'\s*:?', prefix=r'\b'), Name), + + # Comments + (r'#.*\n', Comment), + + # Default + (r'[^#]', Text), + (r'.*\n', Text) + ] + } + + +class RoboconfInstancesLexer(RegexLexer): + """ + Lexer for `Roboconf `_ instances files. + + .. versionadded:: 2.1 + """ + name = 'Roboconf Instances' + aliases = ['roboconf-instances'] + filenames = ['*.instances'] + + flags = re.IGNORECASE | re.MULTILINE + tokens = { + 'root': [ + + # Skip white spaces + (r'\s+', Text), + + # Keywords + (words(('instance of', 'import'), suffix=r'\s*\b', prefix=r'\b'), Keyword), + (words(('name', 'count'), suffix=r's*:?', prefix=r'\b'), Name), + (r'\s*[\w.-]+\s*:', Name), + + # Comments + (r'#.*\n', Comment), + + # Default + (r'[^#]', Text), + (r'.*\n', Text) + ] + } diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/robotframework.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/robotframework.py new file mode 100644 index 0000000000000000000000000000000000000000..e868127b68a5869d9e5b2eb1b6224f22c6ef797d --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/robotframework.py @@ -0,0 +1,560 @@ +# -*- coding: utf-8 -*- +""" + pygments.lexers.robotframework + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + Lexer for Robot Framework. + + :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS. + :license: BSD, see LICENSE for details. +""" + +# Copyright 2012 Nokia Siemens Networks Oyj +# +# 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. + +import re + +from pygments.lexer import Lexer +from pygments.token import Token +from pygments.util import text_type + +__all__ = ['RobotFrameworkLexer'] + + +HEADING = Token.Generic.Heading +SETTING = Token.Keyword.Namespace +IMPORT = Token.Name.Namespace +TC_KW_NAME = Token.Generic.Subheading +KEYWORD = Token.Name.Function +ARGUMENT = Token.String +VARIABLE = Token.Name.Variable +COMMENT = Token.Comment +SEPARATOR = Token.Punctuation +SYNTAX = Token.Punctuation +GHERKIN = Token.Generic.Emph +ERROR = Token.Error + + +def normalize(string, remove=''): + string = string.lower() + for char in remove + ' ': + if char in string: + string = string.replace(char, '') + return string + + +class RobotFrameworkLexer(Lexer): + """ + For `Robot Framework `_ test data. + + Supports both space and pipe separated plain text formats. + + .. versionadded:: 1.6 + """ + name = 'RobotFramework' + aliases = ['robotframework'] + filenames = ['*.txt', '*.robot'] + mimetypes = ['text/x-robotframework'] + + def __init__(self, **options): + options['tabsize'] = 2 + options['encoding'] = 'UTF-8' + Lexer.__init__(self, **options) + + def get_tokens_unprocessed(self, text): + row_tokenizer = RowTokenizer() + var_tokenizer = VariableTokenizer() + index = 0 + for row in text.splitlines(): + for value, token in row_tokenizer.tokenize(row): + for value, token in var_tokenizer.tokenize(value, token): + if value: + yield index, token, text_type(value) + index += len(value) + + +class VariableTokenizer(object): + + def tokenize(self, string, token): + var = VariableSplitter(string, identifiers='$@%&') + if var.start < 0 or token in (COMMENT, ERROR): + yield string, token + return + for value, token in self._tokenize(var, string, token): + if value: + yield value, token + + def _tokenize(self, var, string, orig_token): + before = string[:var.start] + yield before, orig_token + yield var.identifier + '{', SYNTAX + for value, token in self.tokenize(var.base, VARIABLE): + yield value, token + yield '}', SYNTAX + if var.index: + yield '[', SYNTAX + for value, token in self.tokenize(var.index, VARIABLE): + yield value, token + yield ']', SYNTAX + for value, token in self.tokenize(string[var.end:], orig_token): + yield value, token + + +class RowTokenizer(object): + + def __init__(self): + self._table = UnknownTable() + self._splitter = RowSplitter() + testcases = TestCaseTable() + settings = SettingTable(testcases.set_default_template) + variables = VariableTable() + keywords = KeywordTable() + self._tables = {'settings': settings, 'setting': settings, + 'metadata': settings, + 'variables': variables, 'variable': variables, + 'testcases': testcases, 'testcase': testcases, + 'keywords': keywords, 'keyword': keywords, + 'userkeywords': keywords, 'userkeyword': keywords} + + def tokenize(self, row): + commented = False + heading = False + for index, value in enumerate(self._splitter.split(row)): + # First value, and every second after that, is a separator. + index, separator = divmod(index-1, 2) + if value.startswith('#'): + commented = True + elif index == 0 and value.startswith('*'): + self._table = self._start_table(value) + heading = True + for value, token in self._tokenize(value, index, commented, + separator, heading): + yield value, token + self._table.end_row() + + def _start_table(self, header): + name = normalize(header, remove='*') + return self._tables.get(name, UnknownTable()) + + def _tokenize(self, value, index, commented, separator, heading): + if commented: + yield value, COMMENT + elif separator: + yield value, SEPARATOR + elif heading: + yield value, HEADING + else: + for value, token in self._table.tokenize(value, index): + yield value, token + + +class RowSplitter(object): + _space_splitter = re.compile('( {2,})') + _pipe_splitter = re.compile('((?:^| +)\|(?: +|$))') + + def split(self, row): + splitter = (row.startswith('| ') and self._split_from_pipes + or self._split_from_spaces) + for value in splitter(row): + yield value + yield '\n' + + def _split_from_spaces(self, row): + yield '' # Start with (pseudo)separator similarly as with pipes + for value in self._space_splitter.split(row): + yield value + + def _split_from_pipes(self, row): + _, separator, rest = self._pipe_splitter.split(row, 1) + yield separator + while self._pipe_splitter.search(rest): + cell, separator, rest = self._pipe_splitter.split(rest, 1) + yield cell + yield separator + yield rest + + +class Tokenizer(object): + _tokens = None + + def __init__(self): + self._index = 0 + + def tokenize(self, value): + values_and_tokens = self._tokenize(value, self._index) + self._index += 1 + if isinstance(values_and_tokens, type(Token)): + values_and_tokens = [(value, values_and_tokens)] + return values_and_tokens + + def _tokenize(self, value, index): + index = min(index, len(self._tokens) - 1) + return self._tokens[index] + + def _is_assign(self, value): + if value.endswith('='): + value = value[:-1].strip() + var = VariableSplitter(value, identifiers='$@&') + return var.start == 0 and var.end == len(value) + + +class Comment(Tokenizer): + _tokens = (COMMENT,) + + +class Setting(Tokenizer): + _tokens = (SETTING, ARGUMENT) + _keyword_settings = ('suitesetup', 'suiteprecondition', 'suiteteardown', + 'suitepostcondition', 'testsetup', 'testprecondition', + 'testteardown', 'testpostcondition', 'testtemplate') + _import_settings = ('library', 'resource', 'variables') + _other_settings = ('documentation', 'metadata', 'forcetags', 'defaulttags', + 'testtimeout') + _custom_tokenizer = None + + def __init__(self, template_setter=None): + Tokenizer.__init__(self) + self._template_setter = template_setter + + def _tokenize(self, value, index): + if index == 1 and self._template_setter: + self._template_setter(value) + if index == 0: + normalized = normalize(value) + if normalized in self._keyword_settings: + self._custom_tokenizer = KeywordCall(support_assign=False) + elif normalized in self._import_settings: + self._custom_tokenizer = ImportSetting() + elif normalized not in self._other_settings: + return ERROR + elif self._custom_tokenizer: + return self._custom_tokenizer.tokenize(value) + return Tokenizer._tokenize(self, value, index) + + +class ImportSetting(Tokenizer): + _tokens = (IMPORT, ARGUMENT) + + +class TestCaseSetting(Setting): + _keyword_settings = ('setup', 'precondition', 'teardown', 'postcondition', + 'template') + _import_settings = () + _other_settings = ('documentation', 'tags', 'timeout') + + def _tokenize(self, value, index): + if index == 0: + type = Setting._tokenize(self, value[1:-1], index) + return [('[', SYNTAX), (value[1:-1], type), (']', SYNTAX)] + return Setting._tokenize(self, value, index) + + +class KeywordSetting(TestCaseSetting): + _keyword_settings = ('teardown',) + _other_settings = ('documentation', 'arguments', 'return', 'timeout', 'tags') + + +class Variable(Tokenizer): + _tokens = (SYNTAX, ARGUMENT) + + def _tokenize(self, value, index): + if index == 0 and not self._is_assign(value): + return ERROR + return Tokenizer._tokenize(self, value, index) + + +class KeywordCall(Tokenizer): + _tokens = (KEYWORD, ARGUMENT) + + def __init__(self, support_assign=True): + Tokenizer.__init__(self) + self._keyword_found = not support_assign + self._assigns = 0 + + def _tokenize(self, value, index): + if not self._keyword_found and self._is_assign(value): + self._assigns += 1 + return SYNTAX # VariableTokenizer tokenizes this later. + if self._keyword_found: + return Tokenizer._tokenize(self, value, index - self._assigns) + self._keyword_found = True + return GherkinTokenizer().tokenize(value, KEYWORD) + + +class GherkinTokenizer(object): + _gherkin_prefix = re.compile('^(Given|When|Then|And) ', re.IGNORECASE) + + def tokenize(self, value, token): + match = self._gherkin_prefix.match(value) + if not match: + return [(value, token)] + end = match.end() + return [(value[:end], GHERKIN), (value[end:], token)] + + +class TemplatedKeywordCall(Tokenizer): + _tokens = (ARGUMENT,) + + +class ForLoop(Tokenizer): + + def __init__(self): + Tokenizer.__init__(self) + self._in_arguments = False + + def _tokenize(self, value, index): + token = self._in_arguments and ARGUMENT or SYNTAX + if value.upper() in ('IN', 'IN RANGE'): + self._in_arguments = True + return token + + +class _Table(object): + _tokenizer_class = None + + def __init__(self, prev_tokenizer=None): + self._tokenizer = self._tokenizer_class() + self._prev_tokenizer = prev_tokenizer + self._prev_values_on_row = [] + + def tokenize(self, value, index): + if self._continues(value, index): + self._tokenizer = self._prev_tokenizer + yield value, SYNTAX + else: + for value_and_token in self._tokenize(value, index): + yield value_and_token + self._prev_values_on_row.append(value) + + def _continues(self, value, index): + return value == '...' and all(self._is_empty(t) + for t in self._prev_values_on_row) + + def _is_empty(self, value): + return value in ('', '\\') + + def _tokenize(self, value, index): + return self._tokenizer.tokenize(value) + + def end_row(self): + self.__init__(prev_tokenizer=self._tokenizer) + + +class UnknownTable(_Table): + _tokenizer_class = Comment + + def _continues(self, value, index): + return False + + +class VariableTable(_Table): + _tokenizer_class = Variable + + +class SettingTable(_Table): + _tokenizer_class = Setting + + def __init__(self, template_setter, prev_tokenizer=None): + _Table.__init__(self, prev_tokenizer) + self._template_setter = template_setter + + def _tokenize(self, value, index): + if index == 0 and normalize(value) == 'testtemplate': + self._tokenizer = Setting(self._template_setter) + return _Table._tokenize(self, value, index) + + def end_row(self): + self.__init__(self._template_setter, prev_tokenizer=self._tokenizer) + + +class TestCaseTable(_Table): + _setting_class = TestCaseSetting + _test_template = None + _default_template = None + + @property + def _tokenizer_class(self): + if self._test_template or (self._default_template and + self._test_template is not False): + return TemplatedKeywordCall + return KeywordCall + + def _continues(self, value, index): + return index > 0 and _Table._continues(self, value, index) + + def _tokenize(self, value, index): + if index == 0: + if value: + self._test_template = None + return GherkinTokenizer().tokenize(value, TC_KW_NAME) + if index == 1 and self._is_setting(value): + if self._is_template(value): + self._test_template = False + self._tokenizer = self._setting_class(self.set_test_template) + else: + self._tokenizer = self._setting_class() + if index == 1 and self._is_for_loop(value): + self._tokenizer = ForLoop() + if index == 1 and self._is_empty(value): + return [(value, SYNTAX)] + return _Table._tokenize(self, value, index) + + def _is_setting(self, value): + return value.startswith('[') and value.endswith(']') + + def _is_template(self, value): + return normalize(value) == '[template]' + + def _is_for_loop(self, value): + return value.startswith(':') and normalize(value, remove=':') == 'for' + + def set_test_template(self, template): + self._test_template = self._is_template_set(template) + + def set_default_template(self, template): + self._default_template = self._is_template_set(template) + + def _is_template_set(self, template): + return normalize(template) not in ('', '\\', 'none', '${empty}') + + +class KeywordTable(TestCaseTable): + _tokenizer_class = KeywordCall + _setting_class = KeywordSetting + + def _is_template(self, value): + return False + + +# Following code copied directly from Robot Framework 2.7.5. + +class VariableSplitter: + + def __init__(self, string, identifiers): + self.identifier = None + self.base = None + self.index = None + self.start = -1 + self.end = -1 + self._identifiers = identifiers + self._may_have_internal_variables = False + try: + self._split(string) + except ValueError: + pass + else: + self._finalize() + + def get_replaced_base(self, variables): + if self._may_have_internal_variables: + return variables.replace_string(self.base) + return self.base + + def _finalize(self): + self.identifier = self._variable_chars[0] + self.base = ''.join(self._variable_chars[2:-1]) + self.end = self.start + len(self._variable_chars) + if self._has_list_or_dict_variable_index(): + self.index = ''.join(self._list_and_dict_variable_index_chars[1:-1]) + self.end += len(self._list_and_dict_variable_index_chars) + + def _has_list_or_dict_variable_index(self): + return self._list_and_dict_variable_index_chars\ + and self._list_and_dict_variable_index_chars[-1] == ']' + + def _split(self, string): + start_index, max_index = self._find_variable(string) + self.start = start_index + self._open_curly = 1 + self._state = self._variable_state + self._variable_chars = [string[start_index], '{'] + self._list_and_dict_variable_index_chars = [] + self._string = string + start_index += 2 + for index, char in enumerate(string[start_index:]): + index += start_index # Giving start to enumerate only in Py 2.6+ + try: + self._state(char, index) + except StopIteration: + return + if index == max_index and not self._scanning_list_variable_index(): + return + + def _scanning_list_variable_index(self): + return self._state in [self._waiting_list_variable_index_state, + self._list_variable_index_state] + + def _find_variable(self, string): + max_end_index = string.rfind('}') + if max_end_index == -1: + raise ValueError('No variable end found') + if self._is_escaped(string, max_end_index): + return self._find_variable(string[:max_end_index]) + start_index = self._find_start_index(string, 1, max_end_index) + if start_index == -1: + raise ValueError('No variable start found') + return start_index, max_end_index + + def _find_start_index(self, string, start, end): + index = string.find('{', start, end) - 1 + if index < 0: + return -1 + if self._start_index_is_ok(string, index): + return index + return self._find_start_index(string, index+2, end) + + def _start_index_is_ok(self, string, index): + return string[index] in self._identifiers\ + and not self._is_escaped(string, index) + + def _is_escaped(self, string, index): + escaped = False + while index > 0 and string[index-1] == '\\': + index -= 1 + escaped = not escaped + return escaped + + def _variable_state(self, char, index): + self._variable_chars.append(char) + if char == '}' and not self._is_escaped(self._string, index): + self._open_curly -= 1 + if self._open_curly == 0: + if not self._is_list_or_dict_variable(): + raise StopIteration + self._state = self._waiting_list_variable_index_state + elif char in self._identifiers: + self._state = self._internal_variable_start_state + + def _is_list_or_dict_variable(self): + return self._variable_chars[0] in ('@','&') + + def _internal_variable_start_state(self, char, index): + self._state = self._variable_state + if char == '{': + self._variable_chars.append(char) + self._open_curly += 1 + self._may_have_internal_variables = True + else: + self._variable_state(char, index) + + def _waiting_list_variable_index_state(self, char, index): + if char != '[': + raise StopIteration + self._list_and_dict_variable_index_chars.append(char) + self._state = self._list_variable_index_state + + def _list_variable_index_state(self, char, index): + self._list_and_dict_variable_index_chars.append(char) + if char == ']': + raise StopIteration diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/ruby.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/ruby.py new file mode 100644 index 0000000000000000000000000000000000000000..fe750f1a2fb9bd5cadbdf430d8fc548197cdd21f --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/ruby.py @@ -0,0 +1,519 @@ +# -*- coding: utf-8 -*- +""" + pygments.lexers.ruby + ~~~~~~~~~~~~~~~~~~~~ + + Lexers for Ruby and related languages. + + :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS. + :license: BSD, see LICENSE for details. +""" + +import re + +from pygments.lexer import Lexer, RegexLexer, ExtendedRegexLexer, include, \ + bygroups, default, LexerContext, do_insertions, words +from pygments.token import Text, Comment, Operator, Keyword, Name, String, \ + Number, Punctuation, Error, Generic +from pygments.util import shebang_matches + +__all__ = ['RubyLexer', 'RubyConsoleLexer', 'FancyLexer'] + +line_re = re.compile('.*?\n') + + +RUBY_OPERATORS = ( + '*', '**', '-', '+', '-@', '+@', '/', '%', '&', '|', '^', '`', '~', + '[]', '[]=', '<<', '>>', '<', '<>', '<=>', '>', '>=', '==', '===' +) + + +class RubyLexer(ExtendedRegexLexer): + """ + For `Ruby `_ source code. + """ + + name = 'Ruby' + aliases = ['rb', 'ruby', 'duby'] + filenames = ['*.rb', '*.rbw', 'Rakefile', '*.rake', '*.gemspec', + '*.rbx', '*.duby', 'Gemfile'] + mimetypes = ['text/x-ruby', 'application/x-ruby'] + + flags = re.DOTALL | re.MULTILINE + + def heredoc_callback(self, match, ctx): + # okay, this is the hardest part of parsing Ruby... + # match: 1 = <<-?, 2 = quote? 3 = name 4 = quote? 5 = rest of line + + start = match.start(1) + yield start, Operator, match.group(1) # <<-? + yield match.start(2), String.Heredoc, match.group(2) # quote ", ', ` + yield match.start(3), String.Delimiter, match.group(3) # heredoc name + yield match.start(4), String.Heredoc, match.group(4) # quote again + + heredocstack = ctx.__dict__.setdefault('heredocstack', []) + outermost = not bool(heredocstack) + heredocstack.append((match.group(1) == '<<-', match.group(3))) + + ctx.pos = match.start(5) + ctx.end = match.end(5) + # this may find other heredocs + for i, t, v in self.get_tokens_unprocessed(context=ctx): + yield i, t, v + ctx.pos = match.end() + + if outermost: + # this is the outer heredoc again, now we can process them all + for tolerant, hdname in heredocstack: + lines = [] + for match in line_re.finditer(ctx.text, ctx.pos): + if tolerant: + check = match.group().strip() + else: + check = match.group().rstrip() + if check == hdname: + for amatch in lines: + yield amatch.start(), String.Heredoc, amatch.group() + yield match.start(), String.Delimiter, match.group() + ctx.pos = match.end() + break + else: + lines.append(match) + else: + # end of heredoc not found -- error! + for amatch in lines: + yield amatch.start(), Error, amatch.group() + ctx.end = len(ctx.text) + del heredocstack[:] + + def gen_rubystrings_rules(): + def intp_regex_callback(self, match, ctx): + yield match.start(1), String.Regex, match.group(1) # begin + nctx = LexerContext(match.group(3), 0, ['interpolated-regex']) + for i, t, v in self.get_tokens_unprocessed(context=nctx): + yield match.start(3)+i, t, v + yield match.start(4), String.Regex, match.group(4) # end[mixounse]* + ctx.pos = match.end() + + def intp_string_callback(self, match, ctx): + yield match.start(1), String.Other, match.group(1) + nctx = LexerContext(match.group(3), 0, ['interpolated-string']) + for i, t, v in self.get_tokens_unprocessed(context=nctx): + yield match.start(3)+i, t, v + yield match.start(4), String.Other, match.group(4) # end + ctx.pos = match.end() + + states = {} + states['strings'] = [ + # easy ones + (r'\:@{0,2}[a-zA-Z_]\w*[!?]?', String.Symbol), + (words(RUBY_OPERATORS, prefix=r'\:@{0,2}'), String.Symbol), + (r":'(\\\\|\\'|[^'])*'", String.Symbol), + (r"'(\\\\|\\'|[^'])*'", String.Single), + (r':"', String.Symbol, 'simple-sym'), + (r'([a-zA-Z_]\w*)(:)(?!:)', + bygroups(String.Symbol, Punctuation)), # Since Ruby 1.9 + (r'"', String.Double, 'simple-string'), + (r'(?', '<>', 'ab'): + states[name+'-intp-string'] = [ + (r'\\[\\' + bracecc + ']', String.Other), + (lbrace, String.Other, '#push'), + (rbrace, String.Other, '#pop'), + include('string-intp-escaped'), + (r'[\\#' + bracecc + ']', String.Other), + (r'[^\\#' + bracecc + ']+', String.Other), + ] + states['strings'].append((r'%[QWx]?' + lbrace, String.Other, + name+'-intp-string')) + states[name+'-string'] = [ + (r'\\[\\' + bracecc + ']', String.Other), + (lbrace, String.Other, '#push'), + (rbrace, String.Other, '#pop'), + (r'[\\#' + bracecc + ']', String.Other), + (r'[^\\#' + bracecc + ']+', String.Other), + ] + states['strings'].append((r'%[qsw]' + lbrace, String.Other, + name+'-string')) + states[name+'-regex'] = [ + (r'\\[\\' + bracecc + ']', String.Regex), + (lbrace, String.Regex, '#push'), + (rbrace + '[mixounse]*', String.Regex, '#pop'), + include('string-intp'), + (r'[\\#' + bracecc + ']', String.Regex), + (r'[^\\#' + bracecc + ']+', String.Regex), + ] + states['strings'].append((r'%r' + lbrace, String.Regex, + name+'-regex')) + + # these must come after %! + states['strings'] += [ + # %r regex + (r'(%r([\W_]))((?:\\\2|(?!\2).)*)(\2[mixounse]*)', + intp_regex_callback), + # regular fancy strings with qsw + (r'%[qsw]([\W_])((?:\\\1|(?!\1).)*)\1', String.Other), + (r'(%[QWx]([\W_]))((?:\\\2|(?!\2).)*)(\2)', + intp_string_callback), + # special forms of fancy strings after operators or + # in method calls with braces + (r'(?<=[-+/*%=<>&!^|~,(])(\s*)(%([\t ])(?:(?:\\\3|(?!\3).)*)\3)', + bygroups(Text, String.Other, None)), + # and because of fixed width lookbehinds the whole thing a + # second time for line startings... + (r'^(\s*)(%([\t ])(?:(?:\\\3|(?!\3).)*)\3)', + bygroups(Text, String.Other, None)), + # all regular fancy strings without qsw + (r'(%([^a-zA-Z0-9\s]))((?:\\\2|(?!\2).)*)(\2)', + intp_string_callback), + ] + + return states + + tokens = { + 'root': [ + (r'\A#!.+?$', Comment.Hashbang), + (r'#.*?$', Comment.Single), + (r'=begin\s.*?\n=end.*?$', Comment.Multiline), + # keywords + (words(( + 'BEGIN', 'END', 'alias', 'begin', 'break', 'case', 'defined?', + 'do', 'else', 'elsif', 'end', 'ensure', 'for', 'if', 'in', 'next', 'redo', + 'rescue', 'raise', 'retry', 'return', 'super', 'then', 'undef', + 'unless', 'until', 'when', 'while', 'yield'), suffix=r'\b'), + Keyword), + # start of function, class and module names + (r'(module)(\s+)([a-zA-Z_]\w*' + r'(?:::[a-zA-Z_]\w*)*)', + bygroups(Keyword, Text, Name.Namespace)), + (r'(def)(\s+)', bygroups(Keyword, Text), 'funcname'), + (r'def(?=[*%&^`~+-/\[<>=])', Keyword, 'funcname'), + (r'(class)(\s+)', bygroups(Keyword, Text), 'classname'), + # special methods + (words(( + 'initialize', 'new', 'loop', 'include', 'extend', 'raise', 'attr_reader', + 'attr_writer', 'attr_accessor', 'attr', 'catch', 'throw', 'private', + 'module_function', 'public', 'protected', 'true', 'false', 'nil'), + suffix=r'\b'), + Keyword.Pseudo), + (r'(not|and|or)\b', Operator.Word), + (words(( + 'autoload', 'block_given', 'const_defined', 'eql', 'equal', 'frozen', 'include', + 'instance_of', 'is_a', 'iterator', 'kind_of', 'method_defined', 'nil', + 'private_method_defined', 'protected_method_defined', + 'public_method_defined', 'respond_to', 'tainted'), suffix=r'\?'), + Name.Builtin), + (r'(chomp|chop|exit|gsub|sub)!', Name.Builtin), + (words(( + 'Array', 'Float', 'Integer', 'String', '__id__', '__send__', 'abort', + 'ancestors', 'at_exit', 'autoload', 'binding', 'callcc', 'caller', + 'catch', 'chomp', 'chop', 'class_eval', 'class_variables', + 'clone', 'const_defined?', 'const_get', 'const_missing', 'const_set', + 'constants', 'display', 'dup', 'eval', 'exec', 'exit', 'extend', 'fail', 'fork', + 'format', 'freeze', 'getc', 'gets', 'global_variables', 'gsub', + 'hash', 'id', 'included_modules', 'inspect', 'instance_eval', + 'instance_method', 'instance_methods', + 'instance_variable_get', 'instance_variable_set', 'instance_variables', + 'lambda', 'load', 'local_variables', 'loop', + 'method', 'method_missing', 'methods', 'module_eval', 'name', + 'object_id', 'open', 'p', 'print', 'printf', 'private_class_method', + 'private_instance_methods', + 'private_methods', 'proc', 'protected_instance_methods', + 'protected_methods', 'public_class_method', + 'public_instance_methods', 'public_methods', + 'putc', 'puts', 'raise', 'rand', 'readline', 'readlines', 'require', + 'scan', 'select', 'self', 'send', 'set_trace_func', 'singleton_methods', 'sleep', + 'split', 'sprintf', 'srand', 'sub', 'syscall', 'system', 'taint', + 'test', 'throw', 'to_a', 'to_s', 'trace_var', 'trap', 'untaint', + 'untrace_var', 'warn'), prefix=r'(?~!:])|' + r'(?<=(?:\s|;)when\s)|' + r'(?<=(?:\s|;)or\s)|' + r'(?<=(?:\s|;)and\s)|' + r'(?<=\.index\s)|' + r'(?<=\.scan\s)|' + r'(?<=\.sub\s)|' + r'(?<=\.sub!\s)|' + r'(?<=\.gsub\s)|' + r'(?<=\.gsub!\s)|' + r'(?<=\.match\s)|' + r'(?<=(?:\s|;)if\s)|' + r'(?<=(?:\s|;)elsif\s)|' + r'(?<=^when\s)|' + r'(?<=^index\s)|' + r'(?<=^scan\s)|' + r'(?<=^sub\s)|' + r'(?<=^gsub\s)|' + r'(?<=^sub!\s)|' + r'(?<=^gsub!\s)|' + r'(?<=^match\s)|' + r'(?<=^if\s)|' + r'(?<=^elsif\s)' + r')(\s*)(/)', bygroups(Text, String.Regex), 'multiline-regex'), + # multiline regex (in method calls or subscripts) + (r'(?<=\(|,|\[)/', String.Regex, 'multiline-regex'), + # multiline regex (this time the funny no whitespace rule) + (r'(\s+)(/)(?![\s=])', bygroups(Text, String.Regex), + 'multiline-regex'), + # lex numbers and ignore following regular expressions which + # are division operators in fact (grrrr. i hate that. any + # better ideas?) + # since pygments 0.7 we also eat a "?" operator after numbers + # so that the char operator does not work. Chars are not allowed + # there so that you can use the ternary operator. + # stupid example: + # x>=0?n[x]:"" + (r'(0_?[0-7]+(?:_[0-7]+)*)(\s*)([/?])?', + bygroups(Number.Oct, Text, Operator)), + (r'(0x[0-9A-Fa-f]+(?:_[0-9A-Fa-f]+)*)(\s*)([/?])?', + bygroups(Number.Hex, Text, Operator)), + (r'(0b[01]+(?:_[01]+)*)(\s*)([/?])?', + bygroups(Number.Bin, Text, Operator)), + (r'([\d]+(?:_\d+)*)(\s*)([/?])?', + bygroups(Number.Integer, Text, Operator)), + # Names + (r'@@[a-zA-Z_]\w*', Name.Variable.Class), + (r'@[a-zA-Z_]\w*', Name.Variable.Instance), + (r'\$\w+', Name.Variable.Global), + (r'\$[!@&`\'+~=/\\,;.<>_*$?:"^-]', Name.Variable.Global), + (r'\$-[0adFiIlpvw]', Name.Variable.Global), + (r'::', Operator), + include('strings'), + # chars + (r'\?(\\[MC]-)*' # modifiers + r'(\\([\\abefnrstv#"\']|x[a-fA-F0-9]{1,2}|[0-7]{1,3})|\S)' + r'(?!\w)', + String.Char), + (r'[A-Z]\w+', Name.Constant), + # this is needed because ruby attributes can look + # like keywords (class) or like this: ` ?!? + (words(RUBY_OPERATORS, prefix=r'(\.|::)'), + bygroups(Operator, Name.Operator)), + (r'(\.|::)([a-zA-Z_]\w*[!?]?|[*%&^`~+\-/\[<>=])', + bygroups(Operator, Name)), + (r'[a-zA-Z_]\w*[!?]?', Name), + (r'(\[|\]|\*\*|<>?|>=|<=|<=>|=~|={3}|' + r'!~|&&?|\|\||\.{1,3})', Operator), + (r'[-+/*%=<>&!^|~]=?', Operator), + (r'[(){};,/?:\\]', Punctuation), + (r'\s+', Text) + ], + 'funcname': [ + (r'\(', Punctuation, 'defexpr'), + (r'(?:([a-zA-Z_]\w*)(\.))?' + r'([a-zA-Z_]\w*[!?]?|\*\*?|[-+]@?|' + r'[/%&|^`~]|\[\]=?|<<|>>|<=?>|>=?|===?)', + bygroups(Name.Class, Operator, Name.Function), '#pop'), + default('#pop') + ], + 'classname': [ + (r'\(', Punctuation, 'defexpr'), + (r'<<', Operator, '#pop'), + (r'[A-Z_]\w*', Name.Class, '#pop'), + default('#pop') + ], + 'defexpr': [ + (r'(\))(\.|::)?', bygroups(Punctuation, Operator), '#pop'), + (r'\(', Operator, '#push'), + include('root') + ], + 'in-intp': [ + (r'\{', String.Interpol, '#push'), + (r'\}', String.Interpol, '#pop'), + include('root'), + ], + 'string-intp': [ + (r'#\{', String.Interpol, 'in-intp'), + (r'#@@?[a-zA-Z_]\w*', String.Interpol), + (r'#\$[a-zA-Z_]\w*', String.Interpol) + ], + 'string-intp-escaped': [ + include('string-intp'), + (r'\\([\\abefnrstv#"\']|x[a-fA-F0-9]{1,2}|[0-7]{1,3})', + String.Escape) + ], + 'interpolated-regex': [ + include('string-intp'), + (r'[\\#]', String.Regex), + (r'[^\\#]+', String.Regex), + ], + 'interpolated-string': [ + include('string-intp'), + (r'[\\#]', String.Other), + (r'[^\\#]+', String.Other), + ], + 'multiline-regex': [ + include('string-intp'), + (r'\\\\', String.Regex), + (r'\\/', String.Regex), + (r'[\\#]', String.Regex), + (r'[^\\/#]+', String.Regex), + (r'/[mixounse]*', String.Regex, '#pop'), + ], + 'end-part': [ + (r'.+', Comment.Preproc, '#pop') + ] + } + tokens.update(gen_rubystrings_rules()) + + def analyse_text(text): + return shebang_matches(text, r'ruby(1\.\d)?') + + +class RubyConsoleLexer(Lexer): + """ + For Ruby interactive console (**irb**) output like: + + .. sourcecode:: rbcon + + irb(main):001:0> a = 1 + => 1 + irb(main):002:0> puts a + 1 + => nil + """ + name = 'Ruby irb session' + aliases = ['rbcon', 'irb'] + mimetypes = ['text/x-ruby-shellsession'] + + _prompt_re = re.compile('irb\([a-zA-Z_]\w*\):\d{3}:\d+[>*"\'] ' + '|>> |\?> ') + + def get_tokens_unprocessed(self, text): + rblexer = RubyLexer(**self.options) + + curcode = '' + insertions = [] + for match in line_re.finditer(text): + line = match.group() + m = self._prompt_re.match(line) + if m is not None: + end = m.end() + insertions.append((len(curcode), + [(0, Generic.Prompt, line[:end])])) + curcode += line[end:] + else: + if curcode: + for item in do_insertions( + insertions, rblexer.get_tokens_unprocessed(curcode)): + yield item + curcode = '' + insertions = [] + yield match.start(), Generic.Output, line + if curcode: + for item in do_insertions( + insertions, rblexer.get_tokens_unprocessed(curcode)): + yield item + + +class FancyLexer(RegexLexer): + """ + Pygments Lexer For `Fancy `_. + + Fancy is a self-hosted, pure object-oriented, dynamic, + class-based, concurrent general-purpose programming language + running on Rubinius, the Ruby VM. + + .. versionadded:: 1.5 + """ + name = 'Fancy' + filenames = ['*.fy', '*.fancypack'] + aliases = ['fancy', 'fy'] + mimetypes = ['text/x-fancysrc'] + + tokens = { + # copied from PerlLexer: + 'balanced-regex': [ + (r'/(\\\\|\\/|[^/])*/[egimosx]*', String.Regex, '#pop'), + (r'!(\\\\|\\!|[^!])*![egimosx]*', String.Regex, '#pop'), + (r'\\(\\\\|[^\\])*\\[egimosx]*', String.Regex, '#pop'), + (r'\{(\\\\|\\\}|[^}])*\}[egimosx]*', String.Regex, '#pop'), + (r'<(\\\\|\\>|[^>])*>[egimosx]*', String.Regex, '#pop'), + (r'\[(\\\\|\\\]|[^\]])*\][egimosx]*', String.Regex, '#pop'), + (r'\((\\\\|\\\)|[^)])*\)[egimosx]*', String.Regex, '#pop'), + (r'@(\\\\|\\@|[^@])*@[egimosx]*', String.Regex, '#pop'), + (r'%(\\\\|\\%|[^%])*%[egimosx]*', String.Regex, '#pop'), + (r'\$(\\\\|\\\$|[^$])*\$[egimosx]*', String.Regex, '#pop'), + ], + 'root': [ + (r'\s+', Text), + + # balanced delimiters (copied from PerlLexer): + (r's\{(\\\\|\\\}|[^}])*\}\s*', String.Regex, 'balanced-regex'), + (r's<(\\\\|\\>|[^>])*>\s*', String.Regex, 'balanced-regex'), + (r's\[(\\\\|\\\]|[^\]])*\]\s*', String.Regex, 'balanced-regex'), + (r's\((\\\\|\\\)|[^)])*\)\s*', String.Regex, 'balanced-regex'), + (r'm?/(\\\\|\\/|[^/\n])*/[gcimosx]*', String.Regex), + (r'm(?=[/!\\{<\[(@%$])', String.Regex, 'balanced-regex'), + + # Comments + (r'#(.*?)\n', Comment.Single), + # Symbols + (r'\'([^\'\s\[\](){}]+|\[\])', String.Symbol), + # Multi-line DoubleQuotedString + (r'"""(\\\\|\\"|[^"])*"""', String), + # DoubleQuotedString + (r'"(\\\\|\\"|[^"])*"', String), + # keywords + (r'(def|class|try|catch|finally|retry|return|return_local|match|' + r'case|->|=>)\b', Keyword), + # constants + (r'(self|super|nil|false|true)\b', Name.Constant), + (r'[(){};,/?|:\\]', Punctuation), + # names + (words(( + 'Object', 'Array', 'Hash', 'Directory', 'File', 'Class', 'String', + 'Number', 'Enumerable', 'FancyEnumerable', 'Block', 'TrueClass', + 'NilClass', 'FalseClass', 'Tuple', 'Symbol', 'Stack', 'Set', + 'FancySpec', 'Method', 'Package', 'Range'), suffix=r'\b'), + Name.Builtin), + # functions + (r'[a-zA-Z](\w|[-+?!=*/^><%])*:', Name.Function), + # operators, must be below functions + (r'[-+*/~,<>=&!?%^\[\].$]+', Operator), + ('[A-Z]\w*', Name.Constant), + ('@[a-zA-Z_]\w*', Name.Variable.Instance), + ('@@[a-zA-Z_]\w*', Name.Variable.Class), + ('@@?', Operator), + ('[a-zA-Z_]\w*', Name), + # numbers - / checks are necessary to avoid mismarking regexes, + # see comment in RubyLexer + (r'(0[oO]?[0-7]+(?:_[0-7]+)*)(\s*)([/?])?', + bygroups(Number.Oct, Text, Operator)), + (r'(0[xX][0-9A-Fa-f]+(?:_[0-9A-Fa-f]+)*)(\s*)([/?])?', + bygroups(Number.Hex, Text, Operator)), + (r'(0[bB][01]+(?:_[01]+)*)(\s*)([/?])?', + bygroups(Number.Bin, Text, Operator)), + (r'([\d]+(?:_\d+)*)(\s*)([/?])?', + bygroups(Number.Integer, Text, Operator)), + (r'\d+([eE][+-]?[0-9]+)|\d+\.\d+([eE][+-]?[0-9]+)?', Number.Float), + (r'\d+', Number.Integer) + ] + } diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/rust.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/rust.py new file mode 100644 index 0000000000000000000000000000000000000000..6914f54d69b96cf009e228e53a3b46dba0bc2649 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/rust.py @@ -0,0 +1,220 @@ +# -*- coding: utf-8 -*- +""" + pygments.lexers.rust + ~~~~~~~~~~~~~~~~~~~~ + + Lexers for the Rust language. + + :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS. + :license: BSD, see LICENSE for details. +""" + +from pygments.lexer import RegexLexer, include, bygroups, words, default +from pygments.token import Text, Comment, Operator, Keyword, Name, String, \ + Number, Punctuation, Whitespace + +__all__ = ['RustLexer'] + + +class RustLexer(RegexLexer): + """ + Lexer for the Rust programming language (version 1.10). + + .. versionadded:: 1.6 + """ + name = 'Rust' + filenames = ['*.rs', '*.rs.in'] + aliases = ['rust'] + mimetypes = ['text/rust'] + + keyword_types = ( + words(('u8', 'u16', 'u32', 'u64', 'i8', 'i16', 'i32', 'i64', + 'usize', 'isize', 'f32', 'f64', 'str', 'bool'), + suffix=r'\b'), + Keyword.Type) + + builtin_types = (words(( + # Reexported core operators + 'Copy', 'Send', 'Sized', 'Sync', + 'Drop', 'Fn', 'FnMut', 'FnOnce', + + # Reexported types and traits + 'Box', + 'ToOwned', + 'Clone', + 'PartialEq', 'PartialOrd', 'Eq', 'Ord', + 'AsRef', 'AsMut', 'Into', 'From', + 'Default', + 'Iterator', 'Extend', 'IntoIterator', + 'DoubleEndedIterator', 'ExactSizeIterator', + 'Option', + 'Some', 'None', + 'Result', + 'Ok', 'Err', + 'SliceConcatExt', + 'String', 'ToString', + 'Vec'), suffix=r'\b'), + Name.Builtin) + + tokens = { + 'root': [ + # rust allows a file to start with a shebang, but if the first line + # starts with #![ then it’s not a shebang but a crate attribute. + (r'#![^[\r\n].*$', Comment.Preproc), + default('base'), + ], + 'base': [ + # Whitespace and Comments + (r'\n', Whitespace), + (r'\s+', Whitespace), + (r'//!.*?\n', String.Doc), + (r'///(\n|[^/].*?\n)', String.Doc), + (r'//(.*?)\n', Comment.Single), + (r'/\*\*(\n|[^/*])', String.Doc, 'doccomment'), + (r'/\*!', String.Doc, 'doccomment'), + (r'/\*', Comment.Multiline, 'comment'), + + # Macro parameters + (r"""\$([a-zA-Z_]\w*|\(,?|\),?|,?)""", Comment.Preproc), + # Keywords + (words(( + 'as', 'box', 'const', 'crate', 'else', 'extern', + 'for', 'if', 'impl', 'in', 'loop', 'match', 'move', + 'mut', 'pub', 'ref', 'return', 'static', 'super', + 'trait', 'unsafe', 'use', 'where', 'while'), suffix=r'\b'), + Keyword), + (words(('abstract', 'alignof', 'become', 'do', 'final', 'macro', + 'offsetof', 'override', 'priv', 'proc', 'pure', 'sizeof', + 'typeof', 'unsized', 'virtual', 'yield'), suffix=r'\b'), + Keyword.Reserved), + (r'(true|false)\b', Keyword.Constant), + (r'mod\b', Keyword, 'modname'), + (r'let\b', Keyword.Declaration), + (r'fn\b', Keyword, 'funcname'), + (r'(struct|enum|type|union)\b', Keyword, 'typename'), + (r'(default)(\s+)(type|fn)\b', bygroups(Keyword, Text, Keyword)), + keyword_types, + (r'self\b', Name.Builtin.Pseudo), + # Prelude (taken from Rust’s src/libstd/prelude.rs) + builtin_types, + # Path seperators, so types don't catch them. + (r'::\b', Text), + # Types in positions. + (r'(?::|->)', Text, 'typename'), + # Labels + (r'(break|continue)(\s*)(\'[A-Za-z_]\w*)?', + bygroups(Keyword, Text.Whitespace, Name.Label)), + # Character Literal + (r"""'(\\['"\\nrt]|\\x[0-7][0-9a-fA-F]|\\0""" + r"""|\\u\{[0-9a-fA-F]{1,6}\}|.)'""", + String.Char), + (r"""b'(\\['"\\nrt]|\\x[0-9a-fA-F]{2}|\\0""" + r"""|\\u\{[0-9a-fA-F]{1,6}\}|.)'""", + String.Char), + # Binary Literal + (r'0b[01_]+', Number.Bin, 'number_lit'), + # Octal Literal + (r'0o[0-7_]+', Number.Oct, 'number_lit'), + # Hexadecimal Literal + (r'0[xX][0-9a-fA-F_]+', Number.Hex, 'number_lit'), + # Decimal Literal + (r'[0-9][0-9_]*(\.[0-9_]+[eE][+\-]?[0-9_]+|' + r'\.[0-9_]*(?!\.)|[eE][+\-]?[0-9_]+)', Number.Float, + 'number_lit'), + (r'[0-9][0-9_]*', Number.Integer, 'number_lit'), + # String Literal + (r'b"', String, 'bytestring'), + (r'"', String, 'string'), + (r'b?r(#*)".*?"\1', String), + + # Lifetime + (r"""'static""", Name.Builtin), + (r"""'[a-zA-Z_]\w*""", Name.Attribute), + + # Operators and Punctuation + (r'[{}()\[\],.;]', Punctuation), + (r'[+\-*/%&|<>^!~@=:?]', Operator), + + # Identifier + (r'[a-zA-Z_]\w*', Name), + + # Attributes + (r'#!?\[', Comment.Preproc, 'attribute['), + # Macros + (r'([A-Za-z_]\w*)(!)(\s*)([A-Za-z_]\w*)?(\s*)(\{)', + bygroups(Comment.Preproc, Punctuation, Whitespace, Name, + Whitespace, Punctuation), 'macro{'), + (r'([A-Za-z_]\w*)(!)(\s*)([A-Za-z_]\w*)?(\()', + bygroups(Comment.Preproc, Punctuation, Whitespace, Name, + Punctuation), 'macro('), + ], + 'comment': [ + (r'[^*/]+', Comment.Multiline), + (r'/\*', Comment.Multiline, '#push'), + (r'\*/', Comment.Multiline, '#pop'), + (r'[*/]', Comment.Multiline), + ], + 'doccomment': [ + (r'[^*/]+', String.Doc), + (r'/\*', String.Doc, '#push'), + (r'\*/', String.Doc, '#pop'), + (r'[*/]', String.Doc), + ], + 'modname': [ + (r'\s+', Text), + (r'[a-zA-Z_]\w*', Name.Namespace, '#pop'), + default('#pop'), + ], + 'funcname': [ + (r'\s+', Text), + (r'[a-zA-Z_]\w*', Name.Function, '#pop'), + default('#pop'), + ], + 'typename': [ + (r'\s+', Text), + (r'&', Keyword.Pseudo), + builtin_types, + keyword_types, + (r'[a-zA-Z_]\w*', Name.Class, '#pop'), + default('#pop'), + ], + 'number_lit': [ + (r'[ui](8|16|32|64|size)', Keyword, '#pop'), + (r'f(32|64)', Keyword, '#pop'), + default('#pop'), + ], + 'string': [ + (r'"', String, '#pop'), + (r"""\\['"\\nrt]|\\x[0-7][0-9a-fA-F]|\\0""" + r"""|\\u\{[0-9a-fA-F]{1,6}\}""", String.Escape), + (r'[^\\"]+', String), + (r'\\', String), + ], + 'bytestring': [ + (r"""\\x[89a-fA-F][0-9a-fA-F]""", String.Escape), + include('string'), + ], + 'macro{': [ + (r'\{', Operator, '#push'), + (r'\}', Operator, '#pop'), + ], + 'macro(': [ + (r'\(', Operator, '#push'), + (r'\)', Operator, '#pop'), + ], + 'attribute_common': [ + (r'"', String, 'string'), + (r'\[', Comment.Preproc, 'attribute['), + (r'\(', Comment.Preproc, 'attribute('), + ], + 'attribute[': [ + include('attribute_common'), + (r'\];?', Comment.Preproc, '#pop'), + (r'[^"\]]+', Comment.Preproc), + ], + 'attribute(': [ + include('attribute_common'), + (r'\);?', Comment.Preproc, '#pop'), + (r'[^")]+', Comment.Preproc), + ], + } diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/sas.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/sas.py new file mode 100644 index 0000000000000000000000000000000000000000..3747ed9ab8af521565d698d2b59e204b48e596d7 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/sas.py @@ -0,0 +1,228 @@ +# -*- coding: utf-8 -*- +""" + pygments.lexers.sas + ~~~~~~~~~~~~~~~~~~~ + + Lexer for SAS. + + :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS. + :license: BSD, see LICENSE for details. +""" + +import re +from pygments.lexer import RegexLexer, include, words +from pygments.token import Comment, Keyword, Name, Number, String, Text, \ + Other, Generic + +__all__ = ['SASLexer'] + + +class SASLexer(RegexLexer): + """ + For `SAS `_ files. + + .. versionadded:: 2.2 + """ + # Syntax from syntax/sas.vim by James Kidd + + name = 'SAS' + aliases = ['sas'] + filenames = ['*.SAS', '*.sas'] + mimetypes = ['text/x-sas', 'text/sas', 'application/x-sas'] + flags = re.IGNORECASE | re.MULTILINE + + builtins_macros = ( + "bquote", "nrbquote", "cmpres", "qcmpres", "compstor", "datatyp", + "display", "do", "else", "end", "eval", "global", "goto", "if", + "index", "input", "keydef", "label", "left", "length", "let", + "local", "lowcase", "macro", "mend", "nrquote", + "nrstr", "put", "qleft", "qlowcase", "qscan", + "qsubstr", "qsysfunc", "qtrim", "quote", "qupcase", "scan", + "str", "substr", "superq", "syscall", "sysevalf", "sysexec", + "sysfunc", "sysget", "syslput", "sysprod", "sysrc", "sysrput", + "then", "to", "trim", "unquote", "until", "upcase", "verify", + "while", "window" + ) + + builtins_conditionals = ( + "do", "if", "then", "else", "end", "until", "while" + ) + + builtins_statements = ( + "abort", "array", "attrib", "by", "call", "cards", "cards4", + "catname", "continue", "datalines", "datalines4", "delete", "delim", + "delimiter", "display", "dm", "drop", "endsas", "error", "file", + "filename", "footnote", "format", "goto", "in", "infile", "informat", + "input", "keep", "label", "leave", "length", "libname", "link", + "list", "lostcard", "merge", "missing", "modify", "options", "output", + "out", "page", "put", "redirect", "remove", "rename", "replace", + "retain", "return", "select", "set", "skip", "startsas", "stop", + "title", "update", "waitsas", "where", "window", "x", "systask" + ) + + builtins_sql = ( + "add", "and", "alter", "as", "cascade", "check", "create", + "delete", "describe", "distinct", "drop", "foreign", "from", + "group", "having", "index", "insert", "into", "in", "key", "like", + "message", "modify", "msgtype", "not", "null", "on", "or", + "order", "primary", "references", "reset", "restrict", "select", + "set", "table", "unique", "update", "validate", "view", "where" + ) + + builtins_functions = ( + "abs", "addr", "airy", "arcos", "arsin", "atan", "attrc", + "attrn", "band", "betainv", "blshift", "bnot", "bor", + "brshift", "bxor", "byte", "cdf", "ceil", "cexist", "cinv", + "close", "cnonct", "collate", "compbl", "compound", + "compress", "cos", "cosh", "css", "curobs", "cv", "daccdb", + "daccdbsl", "daccsl", "daccsyd", "dacctab", "dairy", "date", + "datejul", "datepart", "datetime", "day", "dclose", "depdb", + "depdbsl", "depsl", "depsyd", + "deptab", "dequote", "dhms", "dif", "digamma", + "dim", "dinfo", "dnum", "dopen", "doptname", "doptnum", + "dread", "dropnote", "dsname", "erf", "erfc", "exist", "exp", + "fappend", "fclose", "fcol", "fdelete", "fetch", "fetchobs", + "fexist", "fget", "fileexist", "filename", "fileref", + "finfo", "finv", "fipname", "fipnamel", "fipstate", "floor", + "fnonct", "fnote", "fopen", "foptname", "foptnum", "fpoint", + "fpos", "fput", "fread", "frewind", "frlen", "fsep", "fuzz", + "fwrite", "gaminv", "gamma", "getoption", "getvarc", "getvarn", + "hbound", "hms", "hosthelp", "hour", "ibessel", "index", + "indexc", "indexw", "input", "inputc", "inputn", "int", + "intck", "intnx", "intrr", "irr", "jbessel", "juldate", + "kurtosis", "lag", "lbound", "left", "length", "lgamma", + "libname", "libref", "log", "log10", "log2", "logpdf", "logpmf", + "logsdf", "lowcase", "max", "mdy", "mean", "min", "minute", + "mod", "month", "mopen", "mort", "n", "netpv", "nmiss", + "normal", "note", "npv", "open", "ordinal", "pathname", + "pdf", "peek", "peekc", "pmf", "point", "poisson", "poke", + "probbeta", "probbnml", "probchi", "probf", "probgam", + "probhypr", "probit", "probnegb", "probnorm", "probt", + "put", "putc", "putn", "qtr", "quote", "ranbin", "rancau", + "ranexp", "rangam", "range", "rank", "rannor", "ranpoi", + "rantbl", "rantri", "ranuni", "repeat", "resolve", "reverse", + "rewind", "right", "round", "saving", "scan", "sdf", "second", + "sign", "sin", "sinh", "skewness", "soundex", "spedis", + "sqrt", "std", "stderr", "stfips", "stname", "stnamel", + "substr", "sum", "symget", "sysget", "sysmsg", "sysprod", + "sysrc", "system", "tan", "tanh", "time", "timepart", "tinv", + "tnonct", "today", "translate", "tranwrd", "trigamma", + "trim", "trimn", "trunc", "uniform", "upcase", "uss", "var", + "varfmt", "varinfmt", "varlabel", "varlen", "varname", + "varnum", "varray", "varrayx", "vartype", "verify", "vformat", + "vformatd", "vformatdx", "vformatn", "vformatnx", "vformatw", + "vformatwx", "vformatx", "vinarray", "vinarrayx", "vinformat", + "vinformatd", "vinformatdx", "vinformatn", "vinformatnx", + "vinformatw", "vinformatwx", "vinformatx", "vlabel", + "vlabelx", "vlength", "vlengthx", "vname", "vnamex", "vtype", + "vtypex", "weekday", "year", "yyq", "zipfips", "zipname", + "zipnamel", "zipstate" + ) + + tokens = { + 'root': [ + include('comments'), + include('proc-data'), + include('cards-datalines'), + include('logs'), + include('general'), + (r'.', Text), + ], + # SAS is multi-line regardless, but * is ended by ; + 'comments': [ + (r'^\s*\*.*?;', Comment), + (r'/\*.*?\*/', Comment), + (r'^\s*\*(.|\n)*?;', Comment.Multiline), + (r'/[*](.|\n)*?[*]/', Comment.Multiline), + ], + # Special highlight for proc, data, quit, run + 'proc-data': [ + (r'(^|;)\s*(proc \w+|data|run|quit)[\s;]', + Keyword.Reserved), + ], + # Special highlight cards and datalines + 'cards-datalines': [ + (r'^\s*(datalines|cards)\s*;\s*$', Keyword, 'data'), + ], + 'data': [ + (r'(.|\n)*^\s*;\s*$', Other, '#pop'), + ], + # Special highlight for put NOTE|ERROR|WARNING (order matters) + 'logs': [ + (r'\n?^\s*%?put ', Keyword, 'log-messages'), + ], + 'log-messages': [ + (r'NOTE(:|-).*', Generic, '#pop'), + (r'WARNING(:|-).*', Generic.Emph, '#pop'), + (r'ERROR(:|-).*', Generic.Error, '#pop'), + include('general'), + ], + 'general': [ + include('keywords'), + include('vars-strings'), + include('special'), + include('numbers'), + ], + # Keywords, statements, functions, macros + 'keywords': [ + (words(builtins_statements, + prefix = r'\b', + suffix = r'\b'), + Keyword), + (words(builtins_sql, + prefix = r'\b', + suffix = r'\b'), + Keyword), + (words(builtins_conditionals, + prefix = r'\b', + suffix = r'\b'), + Keyword), + (words(builtins_macros, + prefix = r'%', + suffix = r'\b'), + Name.Builtin), + (words(builtins_functions, + prefix = r'\b', + suffix = r'\('), + Name.Builtin), + ], + # Strings and user-defined variables and macros (order matters) + 'vars-strings': [ + (r'&[a-z_]\w{0,31}\.?', Name.Variable), + (r'%[a-z_]\w{0,31}', Name.Function), + (r'\'', String, 'string_squote'), + (r'"', String, 'string_dquote'), + ], + 'string_squote': [ + ('\'', String, '#pop'), + (r'\\\\|\\"|\\\n', String.Escape), + # AFAIK, macro variables are not evaluated in single quotes + # (r'&', Name.Variable, 'validvar'), + (r'[^$\'\\]+', String), + (r'[$\'\\]', String), + ], + 'string_dquote': [ + (r'"', String, '#pop'), + (r'\\\\|\\"|\\\n', String.Escape), + (r'&', Name.Variable, 'validvar'), + (r'[^$&"\\]+', String), + (r'[$"\\]', String), + ], + 'validvar': [ + (r'[a-z_]\w{0,31}\.?', Name.Variable, '#pop'), + ], + # SAS numbers and special variables + 'numbers': [ + (r'\b[+-]?([0-9]+(\.[0-9]+)?|\.[0-9]+|\.)(E[+-]?[0-9]+)?i?\b', + Number), + ], + 'special': [ + (r'(null|missing|_all_|_automatic_|_character_|_n_|' + r'_infile_|_name_|_null_|_numeric_|_user_|_webout_)', + Keyword.Constant), + ], + # 'operators': [ + # (r'(-|=|<=|>=|<|>|<>|&|!=|' + # r'\||\*|\+|\^|/|!|~|~=)', Operator) + # ], + } diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/scripting.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/scripting.py new file mode 100644 index 0000000000000000000000000000000000000000..b3af606e981b310e68dd6169bae1f159371d2126 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/scripting.py @@ -0,0 +1,1222 @@ +# -*- coding: utf-8 -*- +""" + pygments.lexers.scripting + ~~~~~~~~~~~~~~~~~~~~~~~~~ + + Lexer for scripting and embedded languages. + + :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS. + :license: BSD, see LICENSE for details. +""" + +import re + +from pygments.lexer import RegexLexer, include, bygroups, default, combined, \ + words +from pygments.token import Text, Comment, Operator, Keyword, Name, String, \ + Number, Punctuation, Error, Whitespace, Other +from pygments.util import get_bool_opt, get_list_opt, iteritems + +__all__ = ['LuaLexer', 'MoonScriptLexer', 'ChaiscriptLexer', 'LSLLexer', + 'AppleScriptLexer', 'RexxLexer', 'MOOCodeLexer', 'HybrisLexer', + 'EasytrieveLexer', 'JclLexer'] + + +class LuaLexer(RegexLexer): + """ + For `Lua `_ source code. + + Additional options accepted: + + `func_name_highlighting` + If given and ``True``, highlight builtin function names + (default: ``True``). + `disabled_modules` + If given, must be a list of module names whose function names + should not be highlighted. By default all modules are highlighted. + + To get a list of allowed modules have a look into the + `_lua_builtins` module: + + .. sourcecode:: pycon + + >>> from pygments.lexers._lua_builtins import MODULES + >>> MODULES.keys() + ['string', 'coroutine', 'modules', 'io', 'basic', ...] + """ + + name = 'Lua' + aliases = ['lua'] + filenames = ['*.lua', '*.wlua'] + mimetypes = ['text/x-lua', 'application/x-lua'] + + _comment_multiline = r'(?:--\[(?P=*)\[[\w\W]*?\](?P=level)\])' + _comment_single = r'(?:--.*$)' + _space = r'(?:\s+)' + _s = r'(?:%s|%s|%s)' % (_comment_multiline, _comment_single, _space) + _name = r'(?:[^\W\d]\w*)' + + tokens = { + 'root': [ + # Lua allows a file to start with a shebang. + (r'#!.*', Comment.Preproc), + default('base'), + ], + 'ws': [ + (_comment_multiline, Comment.Multiline), + (_comment_single, Comment.Single), + (_space, Text), + ], + 'base': [ + include('ws'), + + (r'(?i)0x[\da-f]*(\.[\da-f]*)?(p[+-]?\d+)?', Number.Hex), + (r'(?i)(\d*\.\d+|\d+\.\d*)(e[+-]?\d+)?', Number.Float), + (r'(?i)\d+e[+-]?\d+', Number.Float), + (r'\d+', Number.Integer), + + # multiline strings + (r'(?s)\[(=*)\[.*?\]\1\]', String), + + (r'::', Punctuation, 'label'), + (r'\.{3}', Punctuation), + (r'[=<>|~&+\-*/%#^]+|\.\.', Operator), + (r'[\[\]{}().,:;]', Punctuation), + (r'(and|or|not)\b', Operator.Word), + + ('(break|do|else|elseif|end|for|if|in|repeat|return|then|until|' + r'while)\b', Keyword.Reserved), + (r'goto\b', Keyword.Reserved, 'goto'), + (r'(local)\b', Keyword.Declaration), + (r'(true|false|nil)\b', Keyword.Constant), + + (r'(function)\b', Keyword.Reserved, 'funcname'), + + (r'[A-Za-z_]\w*(\.[A-Za-z_]\w*)?', Name), + + ("'", String.Single, combined('stringescape', 'sqs')), + ('"', String.Double, combined('stringescape', 'dqs')) + ], + + 'funcname': [ + include('ws'), + (r'[.:]', Punctuation), + (r'%s(?=%s*[.:])' % (_name, _s), Name.Class), + (_name, Name.Function, '#pop'), + # inline function + ('\(', Punctuation, '#pop'), + ], + + 'goto': [ + include('ws'), + (_name, Name.Label, '#pop'), + ], + + 'label': [ + include('ws'), + (r'::', Punctuation, '#pop'), + (_name, Name.Label), + ], + + 'stringescape': [ + (r'\\([abfnrtv\\"\']|[\r\n]{1,2}|z\s*|x[0-9a-fA-F]{2}|\d{1,3}|' + r'u\{[0-9a-fA-F]+\})', String.Escape), + ], + + 'sqs': [ + (r"'", String.Single, '#pop'), + (r"[^\\']+", String.Single), + ], + + 'dqs': [ + (r'"', String.Double, '#pop'), + (r'[^\\"]+', String.Double), + ] + } + + def __init__(self, **options): + self.func_name_highlighting = get_bool_opt( + options, 'func_name_highlighting', True) + self.disabled_modules = get_list_opt(options, 'disabled_modules', []) + + self._functions = set() + if self.func_name_highlighting: + from pygments.lexers._lua_builtins import MODULES + for mod, func in iteritems(MODULES): + if mod not in self.disabled_modules: + self._functions.update(func) + RegexLexer.__init__(self, **options) + + def get_tokens_unprocessed(self, text): + for index, token, value in \ + RegexLexer.get_tokens_unprocessed(self, text): + if token is Name: + if value in self._functions: + yield index, Name.Builtin, value + continue + elif '.' in value: + a, b = value.split('.') + yield index, Name, a + yield index + len(a), Punctuation, u'.' + yield index + len(a) + 1, Name, b + continue + yield index, token, value + + +class MoonScriptLexer(LuaLexer): + """ + For `MoonScript `_ source code. + + .. versionadded:: 1.5 + """ + + name = "MoonScript" + aliases = ["moon", "moonscript"] + filenames = ["*.moon"] + mimetypes = ['text/x-moonscript', 'application/x-moonscript'] + + tokens = { + 'root': [ + (r'#!(.*?)$', Comment.Preproc), + default('base'), + ], + 'base': [ + ('--.*$', Comment.Single), + (r'(?i)(\d*\.\d+|\d+\.\d*)(e[+-]?\d+)?', Number.Float), + (r'(?i)\d+e[+-]?\d+', Number.Float), + (r'(?i)0x[0-9a-f]*', Number.Hex), + (r'\d+', Number.Integer), + (r'\n', Text), + (r'[^\S\n]+', Text), + (r'(?s)\[(=*)\[.*?\]\1\]', String), + (r'(->|=>)', Name.Function), + (r':[a-zA-Z_]\w*', Name.Variable), + (r'(==|!=|~=|<=|>=|\.\.\.|\.\.|[=+\-*/%^<>#!.\\:])', Operator), + (r'[;,]', Punctuation), + (r'[\[\]{}()]', Keyword.Type), + (r'[a-zA-Z_]\w*:', Name.Variable), + (words(( + 'class', 'extends', 'if', 'then', 'super', 'do', 'with', + 'import', 'export', 'while', 'elseif', 'return', 'for', 'in', + 'from', 'when', 'using', 'else', 'and', 'or', 'not', 'switch', + 'break'), suffix=r'\b'), + Keyword), + (r'(true|false|nil)\b', Keyword.Constant), + (r'(and|or|not)\b', Operator.Word), + (r'(self)\b', Name.Builtin.Pseudo), + (r'@@?([a-zA-Z_]\w*)?', Name.Variable.Class), + (r'[A-Z]\w*', Name.Class), # proper name + (r'[A-Za-z_]\w*(\.[A-Za-z_]\w*)?', Name), + ("'", String.Single, combined('stringescape', 'sqs')), + ('"', String.Double, combined('stringescape', 'dqs')) + ], + 'stringescape': [ + (r'''\\([abfnrtv\\"']|\d{1,3})''', String.Escape) + ], + 'sqs': [ + ("'", String.Single, '#pop'), + (".", String) + ], + 'dqs': [ + ('"', String.Double, '#pop'), + (".", String) + ] + } + + def get_tokens_unprocessed(self, text): + # set . as Operator instead of Punctuation + for index, token, value in LuaLexer.get_tokens_unprocessed(self, text): + if token == Punctuation and value == ".": + token = Operator + yield index, token, value + + +class ChaiscriptLexer(RegexLexer): + """ + For `ChaiScript `_ source code. + + .. versionadded:: 2.0 + """ + + name = 'ChaiScript' + aliases = ['chai', 'chaiscript'] + filenames = ['*.chai'] + mimetypes = ['text/x-chaiscript', 'application/x-chaiscript'] + + flags = re.DOTALL | re.MULTILINE + + tokens = { + 'commentsandwhitespace': [ + (r'\s+', Text), + (r'//.*?\n', Comment.Single), + (r'/\*.*?\*/', Comment.Multiline), + (r'^\#.*?\n', Comment.Single) + ], + 'slashstartsregex': [ + include('commentsandwhitespace'), + (r'/(\\.|[^[/\\\n]|\[(\\.|[^\]\\\n])*])+/' + r'([gim]+\b|\B)', String.Regex, '#pop'), + (r'(?=/)', Text, ('#pop', 'badregex')), + default('#pop') + ], + 'badregex': [ + (r'\n', Text, '#pop') + ], + 'root': [ + include('commentsandwhitespace'), + (r'\n', Text), + (r'[^\S\n]+', Text), + (r'\+\+|--|~|&&|\?|:|\|\||\\(?=\n)|\.\.' + r'(<<|>>>?|==?|!=?|[-<>+*%&|^/])=?', Operator, 'slashstartsregex'), + (r'[{(\[;,]', Punctuation, 'slashstartsregex'), + (r'[})\].]', Punctuation), + (r'[=+\-*/]', Operator), + (r'(for|in|while|do|break|return|continue|if|else|' + r'throw|try|catch' + r')\b', Keyword, 'slashstartsregex'), + (r'(var)\b', Keyword.Declaration, 'slashstartsregex'), + (r'(attr|def|fun)\b', Keyword.Reserved), + (r'(true|false)\b', Keyword.Constant), + (r'(eval|throw)\b', Name.Builtin), + (r'`\S+`', Name.Builtin), + (r'[$a-zA-Z_]\w*', Name.Other), + (r'[0-9][0-9]*\.[0-9]+([eE][0-9]+)?[fd]?', Number.Float), + (r'0x[0-9a-fA-F]+', Number.Hex), + (r'[0-9]+', Number.Integer), + (r'"', String.Double, 'dqstring'), + (r"'(\\\\|\\'|[^'])*'", String.Single), + ], + 'dqstring': [ + (r'\$\{[^"}]+?\}', String.Interpol), + (r'\$', String.Double), + (r'\\\\', String.Double), + (r'\\"', String.Double), + (r'[^\\"$]+', String.Double), + (r'"', String.Double, '#pop'), + ], + } + + +class LSLLexer(RegexLexer): + """ + For Second Life's Linden Scripting Language source code. + + .. versionadded:: 2.0 + """ + + name = 'LSL' + aliases = ['lsl'] + filenames = ['*.lsl'] + mimetypes = ['text/x-lsl'] + + flags = re.MULTILINE + + lsl_keywords = r'\b(?:do|else|for|if|jump|return|while)\b' + lsl_types = r'\b(?:float|integer|key|list|quaternion|rotation|string|vector)\b' + lsl_states = r'\b(?:(?:state)\s+\w+|default)\b' + lsl_events = r'\b(?:state_(?:entry|exit)|touch(?:_(?:start|end))?|(?:land_)?collision(?:_(?:start|end))?|timer|listen|(?:no_)?sensor|control|(?:not_)?at_(?:rot_)?target|money|email|run_time_permissions|changed|attach|dataserver|moving_(?:start|end)|link_message|(?:on|object)_rez|remote_data|http_re(?:sponse|quest)|path_update|transaction_result)\b' + lsl_functions_builtin = r'\b(?:ll(?:ReturnObjectsBy(?:ID|Owner)|Json(?:2List|[GS]etValue|ValueType)|Sin|Cos|Tan|Atan2|Sqrt|Pow|Abs|Fabs|Frand|Floor|Ceil|Round|Vec(?:Mag|Norm|Dist)|Rot(?:Between|2(?:Euler|Fwd|Left|Up))|(?:Euler|Axes)2Rot|Whisper|(?:Region|Owner)?Say|Shout|Listen(?:Control|Remove)?|Sensor(?:Repeat|Remove)?|Detected(?:Name|Key|Owner|Type|Pos|Vel|Grab|Rot|Group|LinkNumber)|Die|Ground|Wind|(?:[GS]et)(?:AnimationOverride|MemoryLimit|PrimMediaParams|ParcelMusicURL|Object(?:Desc|Name)|PhysicsMaterial|Status|Scale|Color|Alpha|Texture|Pos|Rot|Force|Torque)|ResetAnimationOverride|(?:Scale|Offset|Rotate)Texture|(?:Rot)?Target(?:Remove)?|(?:Stop)?MoveToTarget|Apply(?:Rotational)?Impulse|Set(?:KeyframedMotion|ContentType|RegionPos|(?:Angular)?Velocity|Buoyancy|HoverHeight|ForceAndTorque|TimerEvent|ScriptState|Damage|TextureAnim|Sound(?:Queueing|Radius)|Vehicle(?:Type|(?:Float|Vector|Rotation)Param)|(?:Touch|Sit)?Text|Camera(?:Eye|At)Offset|PrimitiveParams|ClickAction|Link(?:Alpha|Color|PrimitiveParams(?:Fast)?|Texture(?:Anim)?|Camera|Media)|RemoteScriptAccessPin|PayPrice|LocalRot)|ScaleByFactor|Get(?:(?:Max|Min)ScaleFactor|ClosestNavPoint|StaticPath|SimStats|Env|PrimitiveParams|Link(?:PrimitiveParams|Number(?:OfSides)?|Key|Name|Media)|HTTPHeader|FreeURLs|Object(?:Details|PermMask|PrimCount)|Parcel(?:MaxPrims|Details|Prim(?:Count|Owners))|Attached|(?:SPMax|Free|Used)Memory|Region(?:Name|TimeDilation|FPS|Corner|AgentCount)|Root(?:Position|Rotation)|UnixTime|(?:Parcel|Region)Flags|(?:Wall|GMT)clock|SimulatorHostname|BoundingBox|GeometricCenter|Creator|NumberOf(?:Prims|NotecardLines|Sides)|Animation(?:List)?|(?:Camera|Local)(?:Pos|Rot)|Vel|Accel|Omega|Time(?:stamp|OfDay)|(?:Object|CenterOf)?Mass|MassMKS|Energy|Owner|(?:Owner)?Key|SunDirection|Texture(?:Offset|Scale|Rot)|Inventory(?:Number|Name|Key|Type|Creator|PermMask)|Permissions(?:Key)?|StartParameter|List(?:Length|EntryType)|Date|Agent(?:Size|Info|Language|List)|LandOwnerAt|NotecardLine|Script(?:Name|State))|(?:Get|Reset|GetAndReset)Time|PlaySound(?:Slave)?|LoopSound(?:Master|Slave)?|(?:Trigger|Stop|Preload)Sound|(?:(?:Get|Delete)Sub|Insert)String|To(?:Upper|Lower)|Give(?:InventoryList|Money)|RezObject|(?:Stop)?LookAt|Sleep|CollisionFilter|(?:Take|Release)Controls|DetachFromAvatar|AttachToAvatar(?:Temp)?|InstantMessage|(?:GetNext)?Email|StopHover|MinEventDelay|RotLookAt|String(?:Length|Trim)|(?:Start|Stop)Animation|TargetOmega|RequestPermissions|(?:Create|Break)Link|BreakAllLinks|(?:Give|Remove)Inventory|Water|PassTouches|Request(?:Agent|Inventory)Data|TeleportAgent(?:Home|GlobalCoords)?|ModifyLand|CollisionSound|ResetScript|MessageLinked|PushObject|PassCollisions|AxisAngle2Rot|Rot2(?:Axis|Angle)|A(?:cos|sin)|AngleBetween|AllowInventoryDrop|SubStringIndex|List2(?:CSV|Integer|Json|Float|String|Key|Vector|Rot|List(?:Strided)?)|DeleteSubList|List(?:Statistics|Sort|Randomize|(?:Insert|Find|Replace)List)|EdgeOfWorld|AdjustSoundVolume|Key2Name|TriggerSoundLimited|EjectFromLand|(?:CSV|ParseString)2List|OverMyLand|SameGroup|UnSit|Ground(?:Slope|Normal|Contour)|GroundRepel|(?:Set|Remove)VehicleFlags|(?:AvatarOn)?(?:Link)?SitTarget|Script(?:Danger|Profiler)|Dialog|VolumeDetect|ResetOtherScript|RemoteLoadScriptPin|(?:Open|Close)RemoteDataChannel|SendRemoteData|RemoteDataReply|(?:Integer|String)ToBase64|XorBase64|Log(?:10)?|Base64To(?:String|Integer)|ParseStringKeepNulls|RezAtRoot|RequestSimulatorData|ForceMouselook|(?:Load|Release|(?:E|Une)scape)URL|ParcelMedia(?:CommandList|Query)|ModPow|MapDestination|(?:RemoveFrom|AddTo|Reset)Land(?:Pass|Ban)List|(?:Set|Clear)CameraParams|HTTP(?:Request|Response)|TextBox|DetectedTouch(?:UV|Face|Pos|(?:N|Bin)ormal|ST)|(?:MD5|SHA1|DumpList2)String|Request(?:Secure)?URL|Clear(?:Prim|Link)Media|(?:Link)?ParticleSystem|(?:Get|Request)(?:Username|DisplayName)|RegionSayTo|CastRay|GenerateKey|TransferLindenDollars|ManageEstateAccess|(?:Create|Delete)Character|ExecCharacterCmd|Evade|FleeFrom|NavigateTo|PatrolPoints|Pursue|UpdateCharacter|WanderWithin))\b' + lsl_constants_float = r'\b(?:DEG_TO_RAD|PI(?:_BY_TWO)?|RAD_TO_DEG|SQRT2|TWO_PI)\b' + lsl_constants_integer = r'\b(?:JSON_APPEND|STATUS_(?:PHYSICS|ROTATE_[XYZ]|PHANTOM|SANDBOX|BLOCK_GRAB(?:_OBJECT)?|(?:DIE|RETURN)_AT_EDGE|CAST_SHADOWS|OK|MALFORMED_PARAMS|TYPE_MISMATCH|BOUNDS_ERROR|NOT_(?:FOUND|SUPPORTED)|INTERNAL_ERROR|WHITELIST_FAILED)|AGENT(?:_(?:BY_(?:LEGACY_|USER)NAME|FLYING|ATTACHMENTS|SCRIPTED|MOUSELOOK|SITTING|ON_OBJECT|AWAY|WALKING|IN_AIR|TYPING|CROUCHING|BUSY|ALWAYS_RUN|AUTOPILOT|LIST_(?:PARCEL(?:_OWNER)?|REGION)))?|CAMERA_(?:PITCH|DISTANCE|BEHINDNESS_(?:ANGLE|LAG)|(?:FOCUS|POSITION)(?:_(?:THRESHOLD|LOCKED|LAG))?|FOCUS_OFFSET|ACTIVE)|ANIM_ON|LOOP|REVERSE|PING_PONG|SMOOTH|ROTATE|SCALE|ALL_SIDES|LINK_(?:ROOT|SET|ALL_(?:OTHERS|CHILDREN)|THIS)|ACTIVE|PASSIVE|SCRIPTED|CONTROL_(?:FWD|BACK|(?:ROT_)?(?:LEFT|RIGHT)|UP|DOWN|(?:ML_)?LBUTTON)|PERMISSION_(?:RETURN_OBJECTS|DEBIT|OVERRIDE_ANIMATIONS|SILENT_ESTATE_MANAGEMENT|TAKE_CONTROLS|TRIGGER_ANIMATION|ATTACH|CHANGE_LINKS|(?:CONTROL|TRACK)_CAMERA|TELEPORT)|INVENTORY_(?:TEXTURE|SOUND|OBJECT|SCRIPT|LANDMARK|CLOTHING|NOTECARD|BODYPART|ANIMATION|GESTURE|ALL|NONE)|CHANGED_(?:INVENTORY|COLOR|SHAPE|SCALE|TEXTURE|LINK|ALLOWED_DROP|OWNER|REGION(?:_START)?|TELEPORT|MEDIA)|OBJECT_(?:(?:PHYSICS|SERVER|STREAMING)_COST|UNKNOWN_DETAIL|CHARACTER_TIME|PHANTOM|PHYSICS|TEMP_ON_REZ|NAME|DESC|POS|PRIM_EQUIVALENCE|RETURN_(?:PARCEL(?:_OWNER)?|REGION)|ROO?T|VELOCITY|OWNER|GROUP|CREATOR|ATTACHED_POINT|RENDER_WEIGHT|PATHFINDING_TYPE|(?:RUNNING|TOTAL)_SCRIPT_COUNT|SCRIPT_(?:MEMORY|TIME))|TYPE_(?:INTEGER|FLOAT|STRING|KEY|VECTOR|ROTATION|INVALID)|(?:DEBUG|PUBLIC)_CHANNEL|ATTACH_(?:AVATAR_CENTER|CHEST|HEAD|BACK|PELVIS|MOUTH|CHIN|NECK|NOSE|BELLY|[LR](?:SHOULDER|HAND|FOOT|EAR|EYE|[UL](?:ARM|LEG)|HIP)|(?:LEFT|RIGHT)_PEC|HUD_(?:CENTER_[12]|TOP_(?:RIGHT|CENTER|LEFT)|BOTTOM(?:_(?:RIGHT|LEFT))?))|LAND_(?:LEVEL|RAISE|LOWER|SMOOTH|NOISE|REVERT)|DATA_(?:ONLINE|NAME|BORN|SIM_(?:POS|STATUS|RATING)|PAYINFO)|PAYMENT_INFO_(?:ON_FILE|USED)|REMOTE_DATA_(?:CHANNEL|REQUEST|REPLY)|PSYS_(?:PART_(?:BF_(?:ZERO|ONE(?:_MINUS_(?:DEST_COLOR|SOURCE_(ALPHA|COLOR)))?|DEST_COLOR|SOURCE_(ALPHA|COLOR))|BLEND_FUNC_(DEST|SOURCE)|FLAGS|(?:START|END)_(?:COLOR|ALPHA|SCALE|GLOW)|MAX_AGE|(?:RIBBON|WIND|INTERP_(?:COLOR|SCALE)|BOUNCE|FOLLOW_(?:SRC|VELOCITY)|TARGET_(?:POS|LINEAR)|EMISSIVE)_MASK)|SRC_(?:MAX_AGE|PATTERN|ANGLE_(?:BEGIN|END)|BURST_(?:RATE|PART_COUNT|RADIUS|SPEED_(?:MIN|MAX))|ACCEL|TEXTURE|TARGET_KEY|OMEGA|PATTERN_(?:DROP|EXPLODE|ANGLE(?:_CONE(?:_EMPTY)?)?)))|VEHICLE_(?:REFERENCE_FRAME|TYPE_(?:NONE|SLED|CAR|BOAT|AIRPLANE|BALLOON)|(?:LINEAR|ANGULAR)_(?:FRICTION_TIMESCALE|MOTOR_DIRECTION)|LINEAR_MOTOR_OFFSET|HOVER_(?:HEIGHT|EFFICIENCY|TIMESCALE)|BUOYANCY|(?:LINEAR|ANGULAR)_(?:DEFLECTION_(?:EFFICIENCY|TIMESCALE)|MOTOR_(?:DECAY_)?TIMESCALE)|VERTICAL_ATTRACTION_(?:EFFICIENCY|TIMESCALE)|BANKING_(?:EFFICIENCY|MIX|TIMESCALE)|FLAG_(?:NO_DEFLECTION_UP|LIMIT_(?:ROLL_ONLY|MOTOR_UP)|HOVER_(?:(?:WATER|TERRAIN|UP)_ONLY|GLOBAL_HEIGHT)|MOUSELOOK_(?:STEER|BANK)|CAMERA_DECOUPLED))|PRIM_(?:TYPE(?:_(?:BOX|CYLINDER|PRISM|SPHERE|TORUS|TUBE|RING|SCULPT))?|HOLE_(?:DEFAULT|CIRCLE|SQUARE|TRIANGLE)|MATERIAL(?:_(?:STONE|METAL|GLASS|WOOD|FLESH|PLASTIC|RUBBER))?|SHINY_(?:NONE|LOW|MEDIUM|HIGH)|BUMP_(?:NONE|BRIGHT|DARK|WOOD|BARK|BRICKS|CHECKER|CONCRETE|TILE|STONE|DISKS|GRAVEL|BLOBS|SIDING|LARGETILE|STUCCO|SUCTION|WEAVE)|TEXGEN_(?:DEFAULT|PLANAR)|SCULPT_(?:TYPE_(?:SPHERE|TORUS|PLANE|CYLINDER|MASK)|FLAG_(?:MIRROR|INVERT))|PHYSICS(?:_(?:SHAPE_(?:CONVEX|NONE|PRIM|TYPE)))?|(?:POS|ROT)_LOCAL|SLICE|TEXT|FLEXIBLE|POINT_LIGHT|TEMP_ON_REZ|PHANTOM|POSITION|SIZE|ROTATION|TEXTURE|NAME|OMEGA|DESC|LINK_TARGET|COLOR|BUMP_SHINY|FULLBRIGHT|TEXGEN|GLOW|MEDIA_(?:ALT_IMAGE_ENABLE|CONTROLS|(?:CURRENT|HOME)_URL|AUTO_(?:LOOP|PLAY|SCALE|ZOOM)|FIRST_CLICK_INTERACT|(?:WIDTH|HEIGHT)_PIXELS|WHITELIST(?:_ENABLE)?|PERMS_(?:INTERACT|CONTROL)|PARAM_MAX|CONTROLS_(?:STANDARD|MINI)|PERM_(?:NONE|OWNER|GROUP|ANYONE)|MAX_(?:URL_LENGTH|WHITELIST_(?:SIZE|COUNT)|(?:WIDTH|HEIGHT)_PIXELS)))|MASK_(?:BASE|OWNER|GROUP|EVERYONE|NEXT)|PERM_(?:TRANSFER|MODIFY|COPY|MOVE|ALL)|PARCEL_(?:MEDIA_COMMAND_(?:STOP|PAUSE|PLAY|LOOP|TEXTURE|URL|TIME|AGENT|UNLOAD|AUTO_ALIGN|TYPE|SIZE|DESC|LOOP_SET)|FLAG_(?:ALLOW_(?:FLY|(?:GROUP_)?SCRIPTS|LANDMARK|TERRAFORM|DAMAGE|CREATE_(?:GROUP_)?OBJECTS)|USE_(?:ACCESS_(?:GROUP|LIST)|BAN_LIST|LAND_PASS_LIST)|LOCAL_SOUND_ONLY|RESTRICT_PUSHOBJECT|ALLOW_(?:GROUP|ALL)_OBJECT_ENTRY)|COUNT_(?:TOTAL|OWNER|GROUP|OTHER|SELECTED|TEMP)|DETAILS_(?:NAME|DESC|OWNER|GROUP|AREA|ID|SEE_AVATARS))|LIST_STAT_(?:MAX|MIN|MEAN|MEDIAN|STD_DEV|SUM(?:_SQUARES)?|NUM_COUNT|GEOMETRIC_MEAN|RANGE)|PAY_(?:HIDE|DEFAULT)|REGION_FLAG_(?:ALLOW_DAMAGE|FIXED_SUN|BLOCK_TERRAFORM|SANDBOX|DISABLE_(?:COLLISIONS|PHYSICS)|BLOCK_FLY|ALLOW_DIRECT_TELEPORT|RESTRICT_PUSHOBJECT)|HTTP_(?:METHOD|MIMETYPE|BODY_(?:MAXLENGTH|TRUNCATED)|CUSTOM_HEADER|PRAGMA_NO_CACHE|VERBOSE_THROTTLE|VERIFY_CERT)|STRING_(?:TRIM(?:_(?:HEAD|TAIL))?)|CLICK_ACTION_(?:NONE|TOUCH|SIT|BUY|PAY|OPEN(?:_MEDIA)?|PLAY|ZOOM)|TOUCH_INVALID_FACE|PROFILE_(?:NONE|SCRIPT_MEMORY)|RC_(?:DATA_FLAGS|DETECT_PHANTOM|GET_(?:LINK_NUM|NORMAL|ROOT_KEY)|MAX_HITS|REJECT_(?:TYPES|AGENTS|(?:NON)?PHYSICAL|LAND))|RCERR_(?:CAST_TIME_EXCEEDED|SIM_PERF_LOW|UNKNOWN)|ESTATE_ACCESS_(?:ALLOWED_(?:AGENT|GROUP)_(?:ADD|REMOVE)|BANNED_AGENT_(?:ADD|REMOVE))|DENSITY|FRICTION|RESTITUTION|GRAVITY_MULTIPLIER|KFM_(?:COMMAND|CMD_(?:PLAY|STOP|PAUSE|SET_MODE)|MODE|FORWARD|LOOP|PING_PONG|REVERSE|DATA|ROTATION|TRANSLATION)|ERR_(?:GENERIC|PARCEL_PERMISSIONS|MALFORMED_PARAMS|RUNTIME_PERMISSIONS|THROTTLED)|CHARACTER_(?:CMD_(?:(?:SMOOTH_)?STOP|JUMP)|DESIRED_(?:TURN_)?SPEED|RADIUS|STAY_WITHIN_PARCEL|LENGTH|ORIENTATION|ACCOUNT_FOR_SKIPPED_FRAMES|AVOIDANCE_MODE|TYPE(?:_(?:[A-D]|NONE))?|MAX_(?:DECEL|TURN_RADIUS|(?:ACCEL|SPEED)))|PURSUIT_(?:OFFSET|FUZZ_FACTOR|GOAL_TOLERANCE|INTERCEPT)|REQUIRE_LINE_OF_SIGHT|FORCE_DIRECT_PATH|VERTICAL|HORIZONTAL|AVOID_(?:CHARACTERS|DYNAMIC_OBSTACLES|NONE)|PU_(?:EVADE_(?:HIDDEN|SPOTTED)|FAILURE_(?:DYNAMIC_PATHFINDING_DISABLED|INVALID_(?:GOAL|START)|NO_(?:NAVMESH|VALID_DESTINATION)|OTHER|TARGET_GONE|(?:PARCEL_)?UNREACHABLE)|(?:GOAL|SLOWDOWN_DISTANCE)_REACHED)|TRAVERSAL_TYPE(?:_(?:FAST|NONE|SLOW))?|CONTENT_TYPE_(?:ATOM|FORM|HTML|JSON|LLSD|RSS|TEXT|XHTML|XML)|GCNP_(?:RADIUS|STATIC)|(?:PATROL|WANDER)_PAUSE_AT_WAYPOINTS|OPT_(?:AVATAR|CHARACTER|EXCLUSION_VOLUME|LEGACY_LINKSET|MATERIAL_VOLUME|OTHER|STATIC_OBSTACLE|WALKABLE)|SIM_STAT_PCT_CHARS_STEPPED)\b' + lsl_constants_integer_boolean = r'\b(?:FALSE|TRUE)\b' + lsl_constants_rotation = r'\b(?:ZERO_ROTATION)\b' + lsl_constants_string = r'\b(?:EOF|JSON_(?:ARRAY|DELETE|FALSE|INVALID|NULL|NUMBER|OBJECT|STRING|TRUE)|NULL_KEY|TEXTURE_(?:BLANK|DEFAULT|MEDIA|PLYWOOD|TRANSPARENT)|URL_REQUEST_(?:GRANTED|DENIED))\b' + lsl_constants_vector = r'\b(?:TOUCH_INVALID_(?:TEXCOORD|VECTOR)|ZERO_VECTOR)\b' + lsl_invalid_broken = r'\b(?:LAND_(?:LARGE|MEDIUM|SMALL)_BRUSH)\b' + lsl_invalid_deprecated = r'\b(?:ATTACH_[LR]PEC|DATA_RATING|OBJECT_ATTACHMENT_(?:GEOMETRY_BYTES|SURFACE_AREA)|PRIM_(?:CAST_SHADOWS|MATERIAL_LIGHT|TYPE_LEGACY)|PSYS_SRC_(?:INNER|OUTER)ANGLE|VEHICLE_FLAG_NO_FLY_UP|ll(?:Cloud|Make(?:Explosion|Fountain|Smoke|Fire)|RemoteDataSetRegion|Sound(?:Preload)?|XorBase64Strings(?:Correct)?))\b' + lsl_invalid_illegal = r'\b(?:event)\b' + lsl_invalid_unimplemented = r'\b(?:CHARACTER_(?:MAX_ANGULAR_(?:ACCEL|SPEED)|TURN_SPEED_MULTIPLIER)|PERMISSION_(?:CHANGE_(?:JOINTS|PERMISSIONS)|RELEASE_OWNERSHIP|REMAP_CONTROLS)|PRIM_PHYSICS_MATERIAL|PSYS_SRC_OBJ_REL_MASK|ll(?:CollisionSprite|(?:Stop)?PointAt|(?:(?:Refresh|Set)Prim)URL|(?:Take|Release)Camera|RemoteLoadScript))\b' + lsl_reserved_godmode = r'\b(?:ll(?:GodLikeRezObject|Set(?:Inventory|Object)PermMask))\b' + lsl_reserved_log = r'\b(?:print)\b' + lsl_operators = r'\+\+|\-\-|<<|>>|&&?|\|\|?|\^|~|[!%<>=*+\-/]=?' + + tokens = { + 'root': + [ + (r'//.*?\n', Comment.Single), + (r'/\*', Comment.Multiline, 'comment'), + (r'"', String.Double, 'string'), + (lsl_keywords, Keyword), + (lsl_types, Keyword.Type), + (lsl_states, Name.Class), + (lsl_events, Name.Builtin), + (lsl_functions_builtin, Name.Function), + (lsl_constants_float, Keyword.Constant), + (lsl_constants_integer, Keyword.Constant), + (lsl_constants_integer_boolean, Keyword.Constant), + (lsl_constants_rotation, Keyword.Constant), + (lsl_constants_string, Keyword.Constant), + (lsl_constants_vector, Keyword.Constant), + (lsl_invalid_broken, Error), + (lsl_invalid_deprecated, Error), + (lsl_invalid_illegal, Error), + (lsl_invalid_unimplemented, Error), + (lsl_reserved_godmode, Keyword.Reserved), + (lsl_reserved_log, Keyword.Reserved), + (r'\b([a-zA-Z_]\w*)\b', Name.Variable), + (r'(\d+\.\d*|\.\d+|\d+)[eE][+-]?\d*', Number.Float), + (r'(\d+\.\d*|\.\d+)', Number.Float), + (r'0[xX][0-9a-fA-F]+', Number.Hex), + (r'\d+', Number.Integer), + (lsl_operators, Operator), + (r':=?', Error), + (r'[,;{}()\[\]]', Punctuation), + (r'\n+', Whitespace), + (r'\s+', Whitespace) + ], + 'comment': + [ + (r'[^*/]+', Comment.Multiline), + (r'/\*', Comment.Multiline, '#push'), + (r'\*/', Comment.Multiline, '#pop'), + (r'[*/]', Comment.Multiline) + ], + 'string': + [ + (r'\\([nt"\\])', String.Escape), + (r'"', String.Double, '#pop'), + (r'\\.', Error), + (r'[^"\\]+', String.Double), + ] + } + + +class AppleScriptLexer(RegexLexer): + """ + For `AppleScript source code + `_, + including `AppleScript Studio + `_. + Contributed by Andreas Amann . + + .. versionadded:: 1.0 + """ + + name = 'AppleScript' + aliases = ['applescript'] + filenames = ['*.applescript'] + + flags = re.MULTILINE | re.DOTALL + + Identifiers = r'[a-zA-Z]\w*' + + # XXX: use words() for all of these + Literals = ('AppleScript', 'current application', 'false', 'linefeed', + 'missing value', 'pi', 'quote', 'result', 'return', 'space', + 'tab', 'text item delimiters', 'true', 'version') + Classes = ('alias ', 'application ', 'boolean ', 'class ', 'constant ', + 'date ', 'file ', 'integer ', 'list ', 'number ', 'POSIX file ', + 'real ', 'record ', 'reference ', 'RGB color ', 'script ', + 'text ', 'unit types', '(?:Unicode )?text', 'string') + BuiltIn = ('attachment', 'attribute run', 'character', 'day', 'month', + 'paragraph', 'word', 'year') + HandlerParams = ('about', 'above', 'against', 'apart from', 'around', + 'aside from', 'at', 'below', 'beneath', 'beside', + 'between', 'for', 'given', 'instead of', 'on', 'onto', + 'out of', 'over', 'since') + Commands = ('ASCII (character|number)', 'activate', 'beep', 'choose URL', + 'choose application', 'choose color', 'choose file( name)?', + 'choose folder', 'choose from list', + 'choose remote application', 'clipboard info', + 'close( access)?', 'copy', 'count', 'current date', 'delay', + 'delete', 'display (alert|dialog)', 'do shell script', + 'duplicate', 'exists', 'get eof', 'get volume settings', + 'info for', 'launch', 'list (disks|folder)', 'load script', + 'log', 'make', 'mount volume', 'new', 'offset', + 'open( (for access|location))?', 'path to', 'print', 'quit', + 'random number', 'read', 'round', 'run( script)?', + 'say', 'scripting components', + 'set (eof|the clipboard to|volume)', 'store script', + 'summarize', 'system attribute', 'system info', + 'the clipboard', 'time to GMT', 'write', 'quoted form') + References = ('(in )?back of', '(in )?front of', '[0-9]+(st|nd|rd|th)', + 'first', 'second', 'third', 'fourth', 'fifth', 'sixth', + 'seventh', 'eighth', 'ninth', 'tenth', 'after', 'back', + 'before', 'behind', 'every', 'front', 'index', 'last', + 'middle', 'some', 'that', 'through', 'thru', 'where', 'whose') + Operators = ("and", "or", "is equal", "equals", "(is )?equal to", "is not", + "isn't", "isn't equal( to)?", "is not equal( to)?", + "doesn't equal", "does not equal", "(is )?greater than", + "comes after", "is not less than or equal( to)?", + "isn't less than or equal( to)?", "(is )?less than", + "comes before", "is not greater than or equal( to)?", + "isn't greater than or equal( to)?", + "(is )?greater than or equal( to)?", "is not less than", + "isn't less than", "does not come before", + "doesn't come before", "(is )?less than or equal( to)?", + "is not greater than", "isn't greater than", + "does not come after", "doesn't come after", "starts? with", + "begins? with", "ends? with", "contains?", "does not contain", + "doesn't contain", "is in", "is contained by", "is not in", + "is not contained by", "isn't contained by", "div", "mod", + "not", "(a )?(ref( to)?|reference to)", "is", "does") + Control = ('considering', 'else', 'error', 'exit', 'from', 'if', + 'ignoring', 'in', 'repeat', 'tell', 'then', 'times', 'to', + 'try', 'until', 'using terms from', 'while', 'whith', + 'with timeout( of)?', 'with transaction', 'by', 'continue', + 'end', 'its?', 'me', 'my', 'return', 'of', 'as') + Declarations = ('global', 'local', 'prop(erty)?', 'set', 'get') + Reserved = ('but', 'put', 'returning', 'the') + StudioClasses = ('action cell', 'alert reply', 'application', 'box', + 'browser( cell)?', 'bundle', 'button( cell)?', 'cell', + 'clip view', 'color well', 'color-panel', + 'combo box( item)?', 'control', + 'data( (cell|column|item|row|source))?', 'default entry', + 'dialog reply', 'document', 'drag info', 'drawer', + 'event', 'font(-panel)?', 'formatter', + 'image( (cell|view))?', 'matrix', 'menu( item)?', 'item', + 'movie( view)?', 'open-panel', 'outline view', 'panel', + 'pasteboard', 'plugin', 'popup button', + 'progress indicator', 'responder', 'save-panel', + 'scroll view', 'secure text field( cell)?', 'slider', + 'sound', 'split view', 'stepper', 'tab view( item)?', + 'table( (column|header cell|header view|view))', + 'text( (field( cell)?|view))?', 'toolbar( item)?', + 'user-defaults', 'view', 'window') + StudioEvents = ('accept outline drop', 'accept table drop', 'action', + 'activated', 'alert ended', 'awake from nib', 'became key', + 'became main', 'begin editing', 'bounds changed', + 'cell value', 'cell value changed', 'change cell value', + 'change item value', 'changed', 'child of item', + 'choose menu item', 'clicked', 'clicked toolbar item', + 'closed', 'column clicked', 'column moved', + 'column resized', 'conclude drop', 'data representation', + 'deminiaturized', 'dialog ended', 'document nib name', + 'double clicked', 'drag( (entered|exited|updated))?', + 'drop', 'end editing', 'exposed', 'idle', 'item expandable', + 'item value', 'item value changed', 'items changed', + 'keyboard down', 'keyboard up', 'launched', + 'load data representation', 'miniaturized', 'mouse down', + 'mouse dragged', 'mouse entered', 'mouse exited', + 'mouse moved', 'mouse up', 'moved', + 'number of browser rows', 'number of items', + 'number of rows', 'open untitled', 'opened', 'panel ended', + 'parameters updated', 'plugin loaded', 'prepare drop', + 'prepare outline drag', 'prepare outline drop', + 'prepare table drag', 'prepare table drop', + 'read from file', 'resigned active', 'resigned key', + 'resigned main', 'resized( sub views)?', + 'right mouse down', 'right mouse dragged', + 'right mouse up', 'rows changed', 'scroll wheel', + 'selected tab view item', 'selection changed', + 'selection changing', 'should begin editing', + 'should close', 'should collapse item', + 'should end editing', 'should expand item', + 'should open( untitled)?', + 'should quit( after last window closed)?', + 'should select column', 'should select item', + 'should select row', 'should select tab view item', + 'should selection change', 'should zoom', 'shown', + 'update menu item', 'update parameters', + 'update toolbar item', 'was hidden', 'was miniaturized', + 'will become active', 'will close', 'will dismiss', + 'will display browser cell', 'will display cell', + 'will display item cell', 'will display outline cell', + 'will finish launching', 'will hide', 'will miniaturize', + 'will move', 'will open', 'will pop up', 'will quit', + 'will resign active', 'will resize( sub views)?', + 'will select tab view item', 'will show', 'will zoom', + 'write to file', 'zoomed') + StudioCommands = ('animate', 'append', 'call method', 'center', + 'close drawer', 'close panel', 'display', + 'display alert', 'display dialog', 'display panel', 'go', + 'hide', 'highlight', 'increment', 'item for', + 'load image', 'load movie', 'load nib', 'load panel', + 'load sound', 'localized string', 'lock focus', 'log', + 'open drawer', 'path for', 'pause', 'perform action', + 'play', 'register', 'resume', 'scroll', 'select( all)?', + 'show', 'size to fit', 'start', 'step back', + 'step forward', 'stop', 'synchronize', 'unlock focus', + 'update') + StudioProperties = ('accepts arrow key', 'action method', 'active', + 'alignment', 'allowed identifiers', + 'allows branch selection', 'allows column reordering', + 'allows column resizing', 'allows column selection', + 'allows customization', + 'allows editing text attributes', + 'allows empty selection', 'allows mixed state', + 'allows multiple selection', 'allows reordering', + 'allows undo', 'alpha( value)?', 'alternate image', + 'alternate increment value', 'alternate title', + 'animation delay', 'associated file name', + 'associated object', 'auto completes', 'auto display', + 'auto enables items', 'auto repeat', + 'auto resizes( outline column)?', + 'auto save expanded items', 'auto save name', + 'auto save table columns', 'auto saves configuration', + 'auto scroll', 'auto sizes all columns to fit', + 'auto sizes cells', 'background color', 'bezel state', + 'bezel style', 'bezeled', 'border rect', 'border type', + 'bordered', 'bounds( rotation)?', 'box type', + 'button returned', 'button type', + 'can choose directories', 'can choose files', + 'can draw', 'can hide', + 'cell( (background color|size|type))?', 'characters', + 'class', 'click count', 'clicked( data)? column', + 'clicked data item', 'clicked( data)? row', + 'closeable', 'collating', 'color( (mode|panel))', + 'command key down', 'configuration', + 'content(s| (size|view( margins)?))?', 'context', + 'continuous', 'control key down', 'control size', + 'control tint', 'control view', + 'controller visible', 'coordinate system', + 'copies( on scroll)?', 'corner view', 'current cell', + 'current column', 'current( field)? editor', + 'current( menu)? item', 'current row', + 'current tab view item', 'data source', + 'default identifiers', 'delta (x|y|z)', + 'destination window', 'directory', 'display mode', + 'displayed cell', 'document( (edited|rect|view))?', + 'double value', 'dragged column', 'dragged distance', + 'dragged items', 'draws( cell)? background', + 'draws grid', 'dynamically scrolls', 'echos bullets', + 'edge', 'editable', 'edited( data)? column', + 'edited data item', 'edited( data)? row', 'enabled', + 'enclosing scroll view', 'ending page', + 'error handling', 'event number', 'event type', + 'excluded from windows menu', 'executable path', + 'expanded', 'fax number', 'field editor', 'file kind', + 'file name', 'file type', 'first responder', + 'first visible column', 'flipped', 'floating', + 'font( panel)?', 'formatter', 'frameworks path', + 'frontmost', 'gave up', 'grid color', 'has data items', + 'has horizontal ruler', 'has horizontal scroller', + 'has parent data item', 'has resize indicator', + 'has shadow', 'has sub menu', 'has vertical ruler', + 'has vertical scroller', 'header cell', 'header view', + 'hidden', 'hides when deactivated', 'highlights by', + 'horizontal line scroll', 'horizontal page scroll', + 'horizontal ruler view', 'horizontally resizable', + 'icon image', 'id', 'identifier', + 'ignores multiple clicks', + 'image( (alignment|dims when disabled|frame style|scaling))?', + 'imports graphics', 'increment value', + 'indentation per level', 'indeterminate', 'index', + 'integer value', 'intercell spacing', 'item height', + 'key( (code|equivalent( modifier)?|window))?', + 'knob thickness', 'label', 'last( visible)? column', + 'leading offset', 'leaf', 'level', 'line scroll', + 'loaded', 'localized sort', 'location', 'loop mode', + 'main( (bunde|menu|window))?', 'marker follows cell', + 'matrix mode', 'maximum( content)? size', + 'maximum visible columns', + 'menu( form representation)?', 'miniaturizable', + 'miniaturized', 'minimized image', 'minimized title', + 'minimum column width', 'minimum( content)? size', + 'modal', 'modified', 'mouse down state', + 'movie( (controller|file|rect))?', 'muted', 'name', + 'needs display', 'next state', 'next text', + 'number of tick marks', 'only tick mark values', + 'opaque', 'open panel', 'option key down', + 'outline table column', 'page scroll', 'pages across', + 'pages down', 'palette label', 'pane splitter', + 'parent data item', 'parent window', 'pasteboard', + 'path( (names|separator))?', 'playing', + 'plays every frame', 'plays selection only', 'position', + 'preferred edge', 'preferred type', 'pressure', + 'previous text', 'prompt', 'properties', + 'prototype cell', 'pulls down', 'rate', + 'released when closed', 'repeated', + 'requested print time', 'required file type', + 'resizable', 'resized column', 'resource path', + 'returns records', 'reuses columns', 'rich text', + 'roll over', 'row height', 'rulers visible', + 'save panel', 'scripts path', 'scrollable', + 'selectable( identifiers)?', 'selected cell', + 'selected( data)? columns?', 'selected data items?', + 'selected( data)? rows?', 'selected item identifier', + 'selection by rect', 'send action on arrow key', + 'sends action when done editing', 'separates columns', + 'separator item', 'sequence number', 'services menu', + 'shared frameworks path', 'shared support path', + 'sheet', 'shift key down', 'shows alpha', + 'shows state by', 'size( mode)?', + 'smart insert delete enabled', 'sort case sensitivity', + 'sort column', 'sort order', 'sort type', + 'sorted( data rows)?', 'sound', 'source( mask)?', + 'spell checking enabled', 'starting page', 'state', + 'string value', 'sub menu', 'super menu', 'super view', + 'tab key traverses cells', 'tab state', 'tab type', + 'tab view', 'table view', 'tag', 'target( printer)?', + 'text color', 'text container insert', + 'text container origin', 'text returned', + 'tick mark position', 'time stamp', + 'title(d| (cell|font|height|position|rect))?', + 'tool tip', 'toolbar', 'trailing offset', 'transparent', + 'treat packages as directories', 'truncated labels', + 'types', 'unmodified characters', 'update views', + 'use sort indicator', 'user defaults', + 'uses data source', 'uses ruler', + 'uses threaded animation', + 'uses title from previous column', 'value wraps', + 'version', + 'vertical( (line scroll|page scroll|ruler view))?', + 'vertically resizable', 'view', + 'visible( document rect)?', 'volume', 'width', 'window', + 'windows menu', 'wraps', 'zoomable', 'zoomed') + + tokens = { + 'root': [ + (r'\s+', Text), + (u'¬\\n', String.Escape), + (r"'s\s+", Text), # This is a possessive, consider moving + (r'(--|#).*?$', Comment), + (r'\(\*', Comment.Multiline, 'comment'), + (r'[(){}!,.:]', Punctuation), + (u'(«)([^»]+)(»)', + bygroups(Text, Name.Builtin, Text)), + (r'\b((?:considering|ignoring)\s*)' + r'(application responses|case|diacriticals|hyphens|' + r'numeric strings|punctuation|white space)', + bygroups(Keyword, Name.Builtin)), + (u'(-|\\*|\\+|&|≠|>=?|<=?|=|≥|≤|/|÷|\\^)', Operator), + (r"\b(%s)\b" % '|'.join(Operators), Operator.Word), + (r'^(\s*(?:on|end)\s+)' + r'(%s)' % '|'.join(StudioEvents[::-1]), + bygroups(Keyword, Name.Function)), + (r'^(\s*)(in|on|script|to)(\s+)', bygroups(Text, Keyword, Text)), + (r'\b(as )(%s)\b' % '|'.join(Classes), + bygroups(Keyword, Name.Class)), + (r'\b(%s)\b' % '|'.join(Literals), Name.Constant), + (r'\b(%s)\b' % '|'.join(Commands), Name.Builtin), + (r'\b(%s)\b' % '|'.join(Control), Keyword), + (r'\b(%s)\b' % '|'.join(Declarations), Keyword), + (r'\b(%s)\b' % '|'.join(Reserved), Name.Builtin), + (r'\b(%s)s?\b' % '|'.join(BuiltIn), Name.Builtin), + (r'\b(%s)\b' % '|'.join(HandlerParams), Name.Builtin), + (r'\b(%s)\b' % '|'.join(StudioProperties), Name.Attribute), + (r'\b(%s)s?\b' % '|'.join(StudioClasses), Name.Builtin), + (r'\b(%s)\b' % '|'.join(StudioCommands), Name.Builtin), + (r'\b(%s)\b' % '|'.join(References), Name.Builtin), + (r'"(\\\\|\\"|[^"])*"', String.Double), + (r'\b(%s)\b' % Identifiers, Name.Variable), + (r'[-+]?(\d+\.\d*|\d*\.\d+)(E[-+][0-9]+)?', Number.Float), + (r'[-+]?\d+', Number.Integer), + ], + 'comment': [ + ('\(\*', Comment.Multiline, '#push'), + ('\*\)', Comment.Multiline, '#pop'), + ('[^*(]+', Comment.Multiline), + ('[*(]', Comment.Multiline), + ], + } + + +class RexxLexer(RegexLexer): + """ + `Rexx `_ is a scripting language available for + a wide range of different platforms with its roots found on mainframe + systems. It is popular for I/O- and data based tasks and can act as glue + language to bind different applications together. + + .. versionadded:: 2.0 + """ + name = 'Rexx' + aliases = ['rexx', 'arexx'] + filenames = ['*.rexx', '*.rex', '*.rx', '*.arexx'] + mimetypes = ['text/x-rexx'] + flags = re.IGNORECASE + + tokens = { + 'root': [ + (r'\s', Whitespace), + (r'/\*', Comment.Multiline, 'comment'), + (r'"', String, 'string_double'), + (r"'", String, 'string_single'), + (r'[0-9]+(\.[0-9]+)?(e[+-]?[0-9])?', Number), + (r'([a-z_]\w*)(\s*)(:)(\s*)(procedure)\b', + bygroups(Name.Function, Whitespace, Operator, Whitespace, + Keyword.Declaration)), + (r'([a-z_]\w*)(\s*)(:)', + bygroups(Name.Label, Whitespace, Operator)), + include('function'), + include('keyword'), + include('operator'), + (r'[a-z_]\w*', Text), + ], + 'function': [ + (words(( + 'abbrev', 'abs', 'address', 'arg', 'b2x', 'bitand', 'bitor', 'bitxor', + 'c2d', 'c2x', 'center', 'charin', 'charout', 'chars', 'compare', + 'condition', 'copies', 'd2c', 'd2x', 'datatype', 'date', 'delstr', + 'delword', 'digits', 'errortext', 'form', 'format', 'fuzz', 'insert', + 'lastpos', 'left', 'length', 'linein', 'lineout', 'lines', 'max', + 'min', 'overlay', 'pos', 'queued', 'random', 'reverse', 'right', 'sign', + 'sourceline', 'space', 'stream', 'strip', 'substr', 'subword', 'symbol', + 'time', 'trace', 'translate', 'trunc', 'value', 'verify', 'word', + 'wordindex', 'wordlength', 'wordpos', 'words', 'x2b', 'x2c', 'x2d', + 'xrange'), suffix=r'(\s*)(\()'), + bygroups(Name.Builtin, Whitespace, Operator)), + ], + 'keyword': [ + (r'(address|arg|by|call|do|drop|else|end|exit|for|forever|if|' + r'interpret|iterate|leave|nop|numeric|off|on|options|parse|' + r'pull|push|queue|return|say|select|signal|to|then|trace|until|' + r'while)\b', Keyword.Reserved), + ], + 'operator': [ + (r'(-|//|/|\(|\)|\*\*|\*|\\<<|\\<|\\==|\\=|\\>>|\\>|\\|\|\||\||' + r'&&|&|%|\+|<<=|<<|<=|<>|<|==|=|><|>=|>>=|>>|>|¬<<|¬<|¬==|¬=|' + r'¬>>|¬>|¬|\.|,)', Operator), + ], + 'string_double': [ + (r'[^"\n]+', String), + (r'""', String), + (r'"', String, '#pop'), + (r'\n', Text, '#pop'), # Stray linefeed also terminates strings. + ], + 'string_single': [ + (r'[^\'\n]', String), + (r'\'\'', String), + (r'\'', String, '#pop'), + (r'\n', Text, '#pop'), # Stray linefeed also terminates strings. + ], + 'comment': [ + (r'[^*]+', Comment.Multiline), + (r'\*/', Comment.Multiline, '#pop'), + (r'\*', Comment.Multiline), + ] + } + + _c = lambda s: re.compile(s, re.MULTILINE) + _ADDRESS_COMMAND_PATTERN = _c(r'^\s*address\s+command\b') + _ADDRESS_PATTERN = _c(r'^\s*address\s+') + _DO_WHILE_PATTERN = _c(r'^\s*do\s+while\b') + _IF_THEN_DO_PATTERN = _c(r'^\s*if\b.+\bthen\s+do\s*$') + _PROCEDURE_PATTERN = _c(r'^\s*([a-z_]\w*)(\s*)(:)(\s*)(procedure)\b') + _ELSE_DO_PATTERN = _c(r'\belse\s+do\s*$') + _PARSE_ARG_PATTERN = _c(r'^\s*parse\s+(upper\s+)?(arg|value)\b') + PATTERNS_AND_WEIGHTS = ( + (_ADDRESS_COMMAND_PATTERN, 0.2), + (_ADDRESS_PATTERN, 0.05), + (_DO_WHILE_PATTERN, 0.1), + (_ELSE_DO_PATTERN, 0.1), + (_IF_THEN_DO_PATTERN, 0.1), + (_PROCEDURE_PATTERN, 0.5), + (_PARSE_ARG_PATTERN, 0.2), + ) + + def analyse_text(text): + """ + Check for inital comment and patterns that distinguish Rexx from other + C-like languages. + """ + if re.search(r'/\*\**\s*rexx', text, re.IGNORECASE): + # Header matches MVS Rexx requirements, this is certainly a Rexx + # script. + return 1.0 + elif text.startswith('/*'): + # Header matches general Rexx requirements; the source code might + # still be any language using C comments such as C++, C# or Java. + lowerText = text.lower() + result = sum(weight + for (pattern, weight) in RexxLexer.PATTERNS_AND_WEIGHTS + if pattern.search(lowerText)) + 0.01 + return min(result, 1.0) + + +class MOOCodeLexer(RegexLexer): + """ + For `MOOCode `_ (the MOO scripting + language). + + .. versionadded:: 0.9 + """ + name = 'MOOCode' + filenames = ['*.moo'] + aliases = ['moocode', 'moo'] + mimetypes = ['text/x-moocode'] + + tokens = { + 'root': [ + # Numbers + (r'(0|[1-9][0-9_]*)', Number.Integer), + # Strings + (r'"(\\\\|\\"|[^"])*"', String), + # exceptions + (r'(E_PERM|E_DIV)', Name.Exception), + # db-refs + (r'((#[-0-9]+)|(\$\w+))', Name.Entity), + # Keywords + (r'\b(if|else|elseif|endif|for|endfor|fork|endfork|while' + r'|endwhile|break|continue|return|try' + r'|except|endtry|finally|in)\b', Keyword), + # builtins + (r'(random|length)', Name.Builtin), + # special variables + (r'(player|caller|this|args)', Name.Variable.Instance), + # skip whitespace + (r'\s+', Text), + (r'\n', Text), + # other operators + (r'([!;=,{}&|:.\[\]@()<>?]+)', Operator), + # function call + (r'(\w+)(\()', bygroups(Name.Function, Operator)), + # variables + (r'(\w+)', Text), + ] + } + + +class HybrisLexer(RegexLexer): + """ + For `Hybris `_ source code. + + .. versionadded:: 1.4 + """ + + name = 'Hybris' + aliases = ['hybris', 'hy'] + filenames = ['*.hy', '*.hyb'] + mimetypes = ['text/x-hybris', 'application/x-hybris'] + + flags = re.MULTILINE | re.DOTALL + + tokens = { + 'root': [ + # method names + (r'^(\s*(?:function|method|operator\s+)+?)' + r'([a-zA-Z_]\w*)' + r'(\s*)(\()', bygroups(Keyword, Name.Function, Text, Operator)), + (r'[^\S\n]+', Text), + (r'//.*?\n', Comment.Single), + (r'/\*.*?\*/', Comment.Multiline), + (r'@[a-zA-Z_][\w.]*', Name.Decorator), + (r'(break|case|catch|next|default|do|else|finally|for|foreach|of|' + r'unless|if|new|return|switch|me|throw|try|while)\b', Keyword), + (r'(extends|private|protected|public|static|throws|function|method|' + r'operator)\b', Keyword.Declaration), + (r'(true|false|null|__FILE__|__LINE__|__VERSION__|__LIB_PATH__|' + r'__INC_PATH__)\b', Keyword.Constant), + (r'(class|struct)(\s+)', + bygroups(Keyword.Declaration, Text), 'class'), + (r'(import|include)(\s+)', + bygroups(Keyword.Namespace, Text), 'import'), + (words(( + 'gc_collect', 'gc_mm_items', 'gc_mm_usage', 'gc_collect_threshold', + 'urlencode', 'urldecode', 'base64encode', 'base64decode', 'sha1', 'crc32', + 'sha2', 'md5', 'md5_file', 'acos', 'asin', 'atan', 'atan2', 'ceil', 'cos', + 'cosh', 'exp', 'fabs', 'floor', 'fmod', 'log', 'log10', 'pow', 'sin', + 'sinh', 'sqrt', 'tan', 'tanh', 'isint', 'isfloat', 'ischar', 'isstring', + 'isarray', 'ismap', 'isalias', 'typeof', 'sizeof', 'toint', 'tostring', + 'fromxml', 'toxml', 'binary', 'pack', 'load', 'eval', 'var_names', + 'var_values', 'user_functions', 'dyn_functions', 'methods', 'call', + 'call_method', 'mknod', 'mkfifo', 'mount', 'umount2', 'umount', 'ticks', + 'usleep', 'sleep', 'time', 'strtime', 'strdate', 'dllopen', 'dlllink', + 'dllcall', 'dllcall_argv', 'dllclose', 'env', 'exec', 'fork', 'getpid', + 'wait', 'popen', 'pclose', 'exit', 'kill', 'pthread_create', + 'pthread_create_argv', 'pthread_exit', 'pthread_join', 'pthread_kill', + 'smtp_send', 'http_get', 'http_post', 'http_download', 'socket', 'bind', + 'listen', 'accept', 'getsockname', 'getpeername', 'settimeout', 'connect', + 'server', 'recv', 'send', 'close', 'print', 'println', 'printf', 'input', + 'readline', 'serial_open', 'serial_fcntl', 'serial_get_attr', + 'serial_get_ispeed', 'serial_get_ospeed', 'serial_set_attr', + 'serial_set_ispeed', 'serial_set_ospeed', 'serial_write', 'serial_read', + 'serial_close', 'xml_load', 'xml_parse', 'fopen', 'fseek', 'ftell', + 'fsize', 'fread', 'fwrite', 'fgets', 'fclose', 'file', 'readdir', + 'pcre_replace', 'size', 'pop', 'unmap', 'has', 'keys', 'values', + 'length', 'find', 'substr', 'replace', 'split', 'trim', 'remove', + 'contains', 'join'), suffix=r'\b'), + Name.Builtin), + (words(( + 'MethodReference', 'Runner', 'Dll', 'Thread', 'Pipe', 'Process', + 'Runnable', 'CGI', 'ClientSocket', 'Socket', 'ServerSocket', + 'File', 'Console', 'Directory', 'Exception'), suffix=r'\b'), + Keyword.Type), + (r'"(\\\\|\\"|[^"])*"', String), + (r"'\\.'|'[^\\]'|'\\u[0-9a-f]{4}'", String.Char), + (r'(\.)([a-zA-Z_]\w*)', + bygroups(Operator, Name.Attribute)), + (r'[a-zA-Z_]\w*:', Name.Label), + (r'[a-zA-Z_$]\w*', Name), + (r'[~^*!%&\[\](){}<>|+=:;,./?\-@]+', Operator), + (r'[0-9][0-9]*\.[0-9]+([eE][0-9]+)?[fd]?', Number.Float), + (r'0x[0-9a-f]+', Number.Hex), + (r'[0-9]+L?', Number.Integer), + (r'\n', Text), + ], + 'class': [ + (r'[a-zA-Z_]\w*', Name.Class, '#pop') + ], + 'import': [ + (r'[\w.]+\*?', Name.Namespace, '#pop') + ], + } + + +class EasytrieveLexer(RegexLexer): + """ + Easytrieve Plus is a programming language for extracting, filtering and + converting sequential data. Furthermore it can layout data for reports. + It is mainly used on mainframe platforms and can access several of the + mainframe's native file formats. It is somewhat comparable to awk. + + .. versionadded:: 2.1 + """ + name = 'Easytrieve' + aliases = ['easytrieve'] + filenames = ['*.ezt', '*.mac'] + mimetypes = ['text/x-easytrieve'] + flags = 0 + + # Note: We cannot use r'\b' at the start and end of keywords because + # Easytrieve Plus delimiter characters are: + # + # * space ( ) + # * apostrophe (') + # * period (.) + # * comma (,) + # * paranthesis ( and ) + # * colon (:) + # + # Additionally words end once a '*' appears, indicatins a comment. + _DELIMITERS = r' \'.,():\n' + _DELIMITERS_OR_COMENT = _DELIMITERS + '*' + _DELIMITER_PATTERN = '[' + _DELIMITERS + ']' + _DELIMITER_PATTERN_CAPTURE = '(' + _DELIMITER_PATTERN + ')' + _NON_DELIMITER_OR_COMMENT_PATTERN = '[^' + _DELIMITERS_OR_COMENT + ']' + _OPERATORS_PATTERN = u'[.+\\-/=\\[\\](){}<>;,&%¬]' + _KEYWORDS = [ + 'AFTER-BREAK', 'AFTER-LINE', 'AFTER-SCREEN', 'AIM', 'AND', 'ATTR', + 'BEFORE', 'BEFORE-BREAK', 'BEFORE-LINE', 'BEFORE-SCREEN', 'BUSHU', + 'BY', 'CALL', 'CASE', 'CHECKPOINT', 'CHKP', 'CHKP-STATUS', 'CLEAR', + 'CLOSE', 'COL', 'COLOR', 'COMMIT', 'CONTROL', 'COPY', 'CURSOR', 'D', + 'DECLARE', 'DEFAULT', 'DEFINE', 'DELETE', 'DENWA', 'DISPLAY', 'DLI', + 'DO', 'DUPLICATE', 'E', 'ELSE', 'ELSE-IF', 'END', 'END-CASE', + 'END-DO', 'END-IF', 'END-PROC', 'ENDPAGE', 'ENDTABLE', 'ENTER', 'EOF', + 'EQ', 'ERROR', 'EXIT', 'EXTERNAL', 'EZLIB', 'F1', 'F10', 'F11', 'F12', + 'F13', 'F14', 'F15', 'F16', 'F17', 'F18', 'F19', 'F2', 'F20', 'F21', + 'F22', 'F23', 'F24', 'F25', 'F26', 'F27', 'F28', 'F29', 'F3', 'F30', + 'F31', 'F32', 'F33', 'F34', 'F35', 'F36', 'F4', 'F5', 'F6', 'F7', + 'F8', 'F9', 'FETCH', 'FILE-STATUS', 'FILL', 'FINAL', 'FIRST', + 'FIRST-DUP', 'FOR', 'GE', 'GET', 'GO', 'GOTO', 'GQ', 'GR', 'GT', + 'HEADING', 'HEX', 'HIGH-VALUES', 'IDD', 'IDMS', 'IF', 'IN', 'INSERT', + 'JUSTIFY', 'KANJI-DATE', 'KANJI-DATE-LONG', 'KANJI-TIME', 'KEY', + 'KEY-PRESSED', 'KOKUGO', 'KUN', 'LAST-DUP', 'LE', 'LEVEL', 'LIKE', + 'LINE', 'LINE-COUNT', 'LINE-NUMBER', 'LINK', 'LIST', 'LOW-VALUES', + 'LQ', 'LS', 'LT', 'MACRO', 'MASK', 'MATCHED', 'MEND', 'MESSAGE', + 'MOVE', 'MSTART', 'NE', 'NEWPAGE', 'NOMASK', 'NOPRINT', 'NOT', + 'NOTE', 'NOVERIFY', 'NQ', 'NULL', 'OF', 'OR', 'OTHERWISE', 'PA1', + 'PA2', 'PA3', 'PAGE-COUNT', 'PAGE-NUMBER', 'PARM-REGISTER', + 'PATH-ID', 'PATTERN', 'PERFORM', 'POINT', 'POS', 'PRIMARY', 'PRINT', + 'PROCEDURE', 'PROGRAM', 'PUT', 'READ', 'RECORD', 'RECORD-COUNT', + 'RECORD-LENGTH', 'REFRESH', 'RELEASE', 'RENUM', 'REPEAT', 'REPORT', + 'REPORT-INPUT', 'RESHOW', 'RESTART', 'RETRIEVE', 'RETURN-CODE', + 'ROLLBACK', 'ROW', 'S', 'SCREEN', 'SEARCH', 'SECONDARY', 'SELECT', + 'SEQUENCE', 'SIZE', 'SKIP', 'SOKAKU', 'SORT', 'SQL', 'STOP', 'SUM', + 'SYSDATE', 'SYSDATE-LONG', 'SYSIN', 'SYSIPT', 'SYSLST', 'SYSPRINT', + 'SYSSNAP', 'SYSTIME', 'TALLY', 'TERM-COLUMNS', 'TERM-NAME', + 'TERM-ROWS', 'TERMINATION', 'TITLE', 'TO', 'TRANSFER', 'TRC', + 'UNIQUE', 'UNTIL', 'UPDATE', 'UPPERCASE', 'USER', 'USERID', 'VALUE', + 'VERIFY', 'W', 'WHEN', 'WHILE', 'WORK', 'WRITE', 'X', 'XDM', 'XRST' + ] + + tokens = { + 'root': [ + (r'\*.*\n', Comment.Single), + (r'\n+', Whitespace), + # Macro argument + (r'&' + _NON_DELIMITER_OR_COMMENT_PATTERN + r'+\.', Name.Variable, + 'after_macro_argument'), + # Macro call + (r'%' + _NON_DELIMITER_OR_COMMENT_PATTERN + r'+', Name.Variable), + (r'(FILE|MACRO|REPORT)(\s+)', + bygroups(Keyword.Declaration, Whitespace), 'after_declaration'), + (r'(JOB|PARM)' + r'(' + _DELIMITER_PATTERN + r')', + bygroups(Keyword.Declaration, Operator)), + (words(_KEYWORDS, suffix=_DELIMITER_PATTERN_CAPTURE), + bygroups(Keyword.Reserved, Operator)), + (_OPERATORS_PATTERN, Operator), + # Procedure declaration + (r'(' + _NON_DELIMITER_OR_COMMENT_PATTERN + r'+)(\s*)(\.?)(\s*)(PROC)(\s*\n)', + bygroups(Name.Function, Whitespace, Operator, Whitespace, + Keyword.Declaration, Whitespace)), + (r'[0-9]+\.[0-9]*', Number.Float), + (r'[0-9]+', Number.Integer), + (r"'(''|[^'])*'", String), + (r'\s+', Whitespace), + # Everything else just belongs to a name + (_NON_DELIMITER_OR_COMMENT_PATTERN + r'+', Name), + ], + 'after_declaration': [ + (_NON_DELIMITER_OR_COMMENT_PATTERN + r'+', Name.Function), + default('#pop'), + ], + 'after_macro_argument': [ + (r'\*.*\n', Comment.Single, '#pop'), + (r'\s+', Whitespace, '#pop'), + (_OPERATORS_PATTERN, Operator, '#pop'), + (r"'(''|[^'])*'", String, '#pop'), + # Everything else just belongs to a name + (_NON_DELIMITER_OR_COMMENT_PATTERN + r'+', Name), + ], + } + _COMMENT_LINE_REGEX = re.compile(r'^\s*\*') + _MACRO_HEADER_REGEX = re.compile(r'^\s*MACRO') + + def analyse_text(text): + """ + Perform a structural analysis for basic Easytrieve constructs. + """ + result = 0.0 + lines = text.split('\n') + hasEndProc = False + hasHeaderComment = False + hasFile = False + hasJob = False + hasProc = False + hasParm = False + hasReport = False + + def isCommentLine(line): + return EasytrieveLexer._COMMENT_LINE_REGEX.match(lines[0]) is not None + + def isEmptyLine(line): + return not bool(line.strip()) + + # Remove possible empty lines and header comments. + while lines and (isEmptyLine(lines[0]) or isCommentLine(lines[0])): + if not isEmptyLine(lines[0]): + hasHeaderComment = True + del lines[0] + + if EasytrieveLexer._MACRO_HEADER_REGEX.match(lines[0]): + # Looks like an Easytrieve macro. + result = 0.4 + if hasHeaderComment: + result += 0.4 + else: + # Scan the source for lines starting with indicators. + for line in lines: + words = line.split() + if (len(words) >= 2): + firstWord = words[0] + if not hasReport: + if not hasJob: + if not hasFile: + if not hasParm: + if firstWord == 'PARM': + hasParm = True + if firstWord == 'FILE': + hasFile = True + if firstWord == 'JOB': + hasJob = True + elif firstWord == 'PROC': + hasProc = True + elif firstWord == 'END-PROC': + hasEndProc = True + elif firstWord == 'REPORT': + hasReport = True + + # Weight the findings. + if hasJob and (hasProc == hasEndProc): + if hasHeaderComment: + result += 0.1 + if hasParm: + if hasProc: + # Found PARM, JOB and PROC/END-PROC: + # pretty sure this is Easytrieve. + result += 0.8 + else: + # Found PARAM and JOB: probably this is Easytrieve + result += 0.5 + else: + # Found JOB and possibly other keywords: might be Easytrieve + result += 0.11 + if hasParm: + # Note: PARAM is not a proper English word, so this is + # regarded a much better indicator for Easytrieve than + # the other words. + result += 0.2 + if hasFile: + result += 0.01 + if hasReport: + result += 0.01 + assert 0.0 <= result <= 1.0 + return result + + +class JclLexer(RegexLexer): + """ + `Job Control Language (JCL) + `_ + is a scripting language used on mainframe platforms to instruct the system + on how to run a batch job or start a subsystem. It is somewhat + comparable to MS DOS batch and Unix shell scripts. + + .. versionadded:: 2.1 + """ + name = 'JCL' + aliases = ['jcl'] + filenames = ['*.jcl'] + mimetypes = ['text/x-jcl'] + flags = re.IGNORECASE + + tokens = { + 'root': [ + (r'//\*.*\n', Comment.Single), + (r'//', Keyword.Pseudo, 'statement'), + (r'/\*', Keyword.Pseudo, 'jes2_statement'), + # TODO: JES3 statement + (r'.*\n', Other) # Input text or inline code in any language. + ], + 'statement': [ + (r'\s*\n', Whitespace, '#pop'), + (r'([a-z]\w*)(\s+)(exec|job)(\s*)', + bygroups(Name.Label, Whitespace, Keyword.Reserved, Whitespace), + 'option'), + (r'[a-z]\w*', Name.Variable, 'statement_command'), + (r'\s+', Whitespace, 'statement_command'), + ], + 'statement_command': [ + (r'\s+(command|cntl|dd|endctl|endif|else|include|jcllib|' + r'output|pend|proc|set|then|xmit)\s+', Keyword.Reserved, 'option'), + include('option') + ], + 'jes2_statement': [ + (r'\s*\n', Whitespace, '#pop'), + (r'\$', Keyword, 'option'), + (r'\b(jobparam|message|netacct|notify|output|priority|route|' + r'setup|signoff|xeq|xmit)\b', Keyword, 'option'), + ], + 'option': [ + # (r'\n', Text, 'root'), + (r'\*', Name.Builtin), + (r'[\[\](){}<>;,]', Punctuation), + (r'[-+*/=&%]', Operator), + (r'[a-z_]\w*', Name), + (r'\d+\.\d*', Number.Float), + (r'\.\d+', Number.Float), + (r'\d+', Number.Integer), + (r"'", String, 'option_string'), + (r'[ \t]+', Whitespace, 'option_comment'), + (r'\.', Punctuation), + ], + 'option_string': [ + (r"(\n)(//)", bygroups(Text, Keyword.Pseudo)), + (r"''", String), + (r"[^']", String), + (r"'", String, '#pop'), + ], + 'option_comment': [ + # (r'\n', Text, 'root'), + (r'.+', Comment.Single), + ] + } + + _JOB_HEADER_PATTERN = re.compile(r'^//[a-z#$@][a-z0-9#$@]{0,7}\s+job(\s+.*)?$', + re.IGNORECASE) + + def analyse_text(text): + """ + Recognize JCL job by header. + """ + result = 0.0 + lines = text.split('\n') + if len(lines) > 0: + if JclLexer._JOB_HEADER_PATTERN.match(lines[0]): + result = 1.0 + assert 0.0 <= result <= 1.0 + return result diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/shell.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/shell.py new file mode 100644 index 0000000000000000000000000000000000000000..ceb6f14df7a83de7b5bb46a88d1506fe73a49fea --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/shell.py @@ -0,0 +1,794 @@ +# -*- coding: utf-8 -*- +""" + pygments.lexers.shell + ~~~~~~~~~~~~~~~~~~~~~ + + Lexers for various shells. + + :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS. + :license: BSD, see LICENSE for details. +""" + +import re + +from pygments.lexer import Lexer, RegexLexer, do_insertions, bygroups, \ + include, default, this, using, words +from pygments.token import Punctuation, \ + Text, Comment, Operator, Keyword, Name, String, Number, Generic +from pygments.util import shebang_matches + + +__all__ = ['BashLexer', 'BashSessionLexer', 'TcshLexer', 'BatchLexer', + 'MSDOSSessionLexer', 'PowerShellLexer', + 'PowerShellSessionLexer', 'TcshSessionLexer', 'FishShellLexer'] + +line_re = re.compile('.*?\n') + + +class BashLexer(RegexLexer): + """ + Lexer for (ba|k|z|)sh shell scripts. + + .. versionadded:: 0.6 + """ + + name = 'Bash' + aliases = ['bash', 'sh', 'ksh', 'zsh', 'shell'] + filenames = ['*.sh', '*.ksh', '*.bash', '*.ebuild', '*.eclass', + '*.exheres-0', '*.exlib', '*.zsh', + '.bashrc', 'bashrc', '.bash_*', 'bash_*', 'zshrc', '.zshrc', + 'PKGBUILD'] + mimetypes = ['application/x-sh', 'application/x-shellscript'] + + tokens = { + 'root': [ + include('basic'), + (r'`', String.Backtick, 'backticks'), + include('data'), + include('interp'), + ], + 'interp': [ + (r'\$\(\(', Keyword, 'math'), + (r'\$\(', Keyword, 'paren'), + (r'\$\{#?', String.Interpol, 'curly'), + (r'\$[a-zA-Z_]\w*', Name.Variable), # user variable + (r'\$(?:\d+|[#$?!_*@-])', Name.Variable), # builtin + (r'\$', Text), + ], + 'basic': [ + (r'\b(if|fi|else|while|do|done|for|then|return|function|case|' + r'select|continue|until|esac|elif)(\s*)\b', + bygroups(Keyword, Text)), + (r'\b(alias|bg|bind|break|builtin|caller|cd|command|compgen|' + r'complete|declare|dirs|disown|echo|enable|eval|exec|exit|' + r'export|false|fc|fg|getopts|hash|help|history|jobs|kill|let|' + r'local|logout|popd|printf|pushd|pwd|read|readonly|set|shift|' + r'shopt|source|suspend|test|time|times|trap|true|type|typeset|' + r'ulimit|umask|unalias|unset|wait)(?=[\s)`])', + Name.Builtin), + (r'\A#!.+\n', Comment.Hashbang), + (r'#.*\n', Comment.Single), + (r'\\[\w\W]', String.Escape), + (r'(\b\w+)(\s*)(\+?=)', bygroups(Name.Variable, Text, Operator)), + (r'[\[\]{}()=]', Operator), + (r'<<<', Operator), # here-string + (r'<<-?\s*(\'?)\\?(\w+)[\w\W]+?\2', String), + (r'&&|\|\|', Operator), + ], + 'data': [ + (r'(?s)\$?"(\\\\|\\[0-7]+|\\.|[^"\\$])*"', String.Double), + (r'"', String.Double, 'string'), + (r"(?s)\$'(\\\\|\\[0-7]+|\\.|[^'\\])*'", String.Single), + (r"(?s)'.*?'", String.Single), + (r';', Punctuation), + (r'&', Punctuation), + (r'\|', Punctuation), + (r'\s+', Text), + (r'\d+\b', Number), + (r'[^=\s\[\]{}()$"\'`\\<&|;]+', Text), + (r'<', Text), + ], + 'string': [ + (r'"', String.Double, '#pop'), + (r'(?s)(\\\\|\\[0-7]+|\\.|[^"\\$])+', String.Double), + include('interp'), + ], + 'curly': [ + (r'\}', String.Interpol, '#pop'), + (r':-', Keyword), + (r'\w+', Name.Variable), + (r'[^}:"\'`$\\]+', Punctuation), + (r':', Punctuation), + include('root'), + ], + 'paren': [ + (r'\)', Keyword, '#pop'), + include('root'), + ], + 'math': [ + (r'\)\)', Keyword, '#pop'), + (r'[-+*/%^|&]|\*\*|\|\|', Operator), + (r'\d+#\d+', Number), + (r'\d+#(?! )', Number), + (r'\d+', Number), + include('root'), + ], + 'backticks': [ + (r'`', String.Backtick, '#pop'), + include('root'), + ], + } + + def analyse_text(text): + if shebang_matches(text, r'(ba|z|)sh'): + return 1 + if text.startswith('$ '): + return 0.2 + + +class ShellSessionBaseLexer(Lexer): + """ + Base lexer for simplistic shell sessions. + + .. versionadded:: 2.1 + """ + def get_tokens_unprocessed(self, text): + innerlexer = self._innerLexerCls(**self.options) + + pos = 0 + curcode = '' + insertions = [] + backslash_continuation = False + + for match in line_re.finditer(text): + line = match.group() + m = re.match(self._ps1rgx, line) + if backslash_continuation: + curcode += line + backslash_continuation = curcode.endswith('\\\n') + elif m: + # To support output lexers (say diff output), the output + # needs to be broken by prompts whenever the output lexer + # changes. + if not insertions: + pos = match.start() + + insertions.append((len(curcode), + [(0, Generic.Prompt, m.group(1))])) + curcode += m.group(2) + backslash_continuation = curcode.endswith('\\\n') + elif line.startswith(self._ps2): + insertions.append((len(curcode), + [(0, Generic.Prompt, line[:len(self._ps2)])])) + curcode += line[len(self._ps2):] + backslash_continuation = curcode.endswith('\\\n') + else: + if insertions: + toks = innerlexer.get_tokens_unprocessed(curcode) + for i, t, v in do_insertions(insertions, toks): + yield pos+i, t, v + yield match.start(), Generic.Output, line + insertions = [] + curcode = '' + if insertions: + for i, t, v in do_insertions(insertions, + innerlexer.get_tokens_unprocessed(curcode)): + yield pos+i, t, v + + +class BashSessionLexer(ShellSessionBaseLexer): + """ + Lexer for simplistic shell sessions. + + .. versionadded:: 1.1 + """ + + name = 'Bash Session' + aliases = ['console', 'shell-session'] + filenames = ['*.sh-session', '*.shell-session'] + mimetypes = ['application/x-shell-session', 'application/x-sh-session'] + + _innerLexerCls = BashLexer + _ps1rgx = \ + r'^((?:(?:\[.*?\])|(?:\(\S+\))?(?:| |sh\S*?|\w+\S+[@:]\S+(?:\s+\S+)' \ + r'?|\[\S+[@:][^\n]+\].+))\s*[$#%])(.*\n?)' + _ps2 = '>' + + +class BatchLexer(RegexLexer): + """ + Lexer for the DOS/Windows Batch file format. + + .. versionadded:: 0.7 + """ + name = 'Batchfile' + aliases = ['bat', 'batch', 'dosbatch', 'winbatch'] + filenames = ['*.bat', '*.cmd'] + mimetypes = ['application/x-dos-batch'] + + flags = re.MULTILINE | re.IGNORECASE + + _nl = r'\n\x1a' + _punct = r'&<>|' + _ws = r'\t\v\f\r ,;=\xa0' + _space = r'(?:(?:(?:\^[%s])?[%s])+)' % (_nl, _ws) + _keyword_terminator = (r'(?=(?:\^[%s]?)?[%s+./:[\\\]]|[%s%s(])' % + (_nl, _ws, _nl, _punct)) + _token_terminator = r'(?=\^?[%s]|[%s%s])' % (_ws, _punct, _nl) + _start_label = r'((?:(?<=^[^:])|^[^:]?)[%s]*)(:)' % _ws + _label = r'(?:(?:[^%s%s%s+:^]|\^[%s]?[\w\W])*)' % (_nl, _punct, _ws, _nl) + _label_compound = (r'(?:(?:[^%s%s%s+:^)]|\^[%s]?[^)])*)' % + (_nl, _punct, _ws, _nl)) + _number = r'(?:-?(?:0[0-7]+|0x[\da-f]+|\d+)%s)' % _token_terminator + _opword = r'(?:equ|geq|gtr|leq|lss|neq)' + _string = r'(?:"[^%s"]*(?:"|(?=[%s])))' % (_nl, _nl) + _variable = (r'(?:(?:%%(?:\*|(?:~[a-z]*(?:\$[^:]+:)?)?\d|' + r'[^%%:%s]+(?::(?:~(?:-?\d+)?(?:,(?:-?\d+)?)?|(?:[^%%%s^]|' + r'\^[^%%%s])[^=%s]*=(?:[^%%%s^]|\^[^%%%s])*)?)?%%))|' + r'(?:\^?![^!:%s]+(?::(?:~(?:-?\d+)?(?:,(?:-?\d+)?)?|(?:' + r'[^!%s^]|\^[^!%s])[^=%s]*=(?:[^!%s^]|\^[^!%s])*)?)?\^?!))' % + (_nl, _nl, _nl, _nl, _nl, _nl, _nl, _nl, _nl, _nl, _nl, _nl)) + _core_token = r'(?:(?:(?:\^[%s]?)?[^"%s%s%s])+)' % (_nl, _nl, _punct, _ws) + _core_token_compound = r'(?:(?:(?:\^[%s]?)?[^"%s%s%s)])+)' % (_nl, _nl, + _punct, _ws) + _token = r'(?:[%s]+|%s)' % (_punct, _core_token) + _token_compound = r'(?:[%s]+|%s)' % (_punct, _core_token_compound) + _stoken = (r'(?:[%s]+|(?:%s|%s|%s)+)' % + (_punct, _string, _variable, _core_token)) + + def _make_begin_state(compound, _core_token=_core_token, + _core_token_compound=_core_token_compound, + _keyword_terminator=_keyword_terminator, + _nl=_nl, _punct=_punct, _string=_string, + _space=_space, _start_label=_start_label, + _stoken=_stoken, _token_terminator=_token_terminator, + _variable=_variable, _ws=_ws): + rest = '(?:%s|%s|[^"%%%s%s%s])*' % (_string, _variable, _nl, _punct, + ')' if compound else '') + rest_of_line = r'(?:(?:[^%s^]|\^[%s]?[\w\W])*)' % (_nl, _nl) + rest_of_line_compound = r'(?:(?:[^%s^)]|\^[%s]?[^)])*)' % (_nl, _nl) + set_space = r'((?:(?:\^[%s]?)?[^\S\n])*)' % _nl + suffix = '' + if compound: + _keyword_terminator = r'(?:(?=\))|%s)' % _keyword_terminator + _token_terminator = r'(?:(?=\))|%s)' % _token_terminator + suffix = '/compound' + return [ + ((r'\)', Punctuation, '#pop') if compound else + (r'\)((?=\()|%s)%s' % (_token_terminator, rest_of_line), + Comment.Single)), + (r'(?=%s)' % _start_label, Text, 'follow%s' % suffix), + (_space, using(this, state='text')), + include('redirect%s' % suffix), + (r'[%s]+' % _nl, Text), + (r'\(', Punctuation, 'root/compound'), + (r'@+', Punctuation), + (r'((?:for|if|rem)(?:(?=(?:\^[%s]?)?/)|(?:(?!\^)|' + r'(?<=m))(?:(?=\()|%s)))(%s?%s?(?:\^[%s]?)?/(?:\^[%s]?)?\?)' % + (_nl, _token_terminator, _space, + _core_token_compound if compound else _core_token, _nl, _nl), + bygroups(Keyword, using(this, state='text')), + 'follow%s' % suffix), + (r'(goto%s)(%s(?:\^[%s]?)?/(?:\^[%s]?)?\?%s)' % + (_keyword_terminator, rest, _nl, _nl, rest), + bygroups(Keyword, using(this, state='text')), + 'follow%s' % suffix), + (words(('assoc', 'break', 'cd', 'chdir', 'cls', 'color', 'copy', + 'date', 'del', 'dir', 'dpath', 'echo', 'endlocal', 'erase', + 'exit', 'ftype', 'keys', 'md', 'mkdir', 'mklink', 'move', + 'path', 'pause', 'popd', 'prompt', 'pushd', 'rd', 'ren', + 'rename', 'rmdir', 'setlocal', 'shift', 'start', 'time', + 'title', 'type', 'ver', 'verify', 'vol'), + suffix=_keyword_terminator), Keyword, 'follow%s' % suffix), + (r'(call)(%s?)(:)' % _space, + bygroups(Keyword, using(this, state='text'), Punctuation), + 'call%s' % suffix), + (r'call%s' % _keyword_terminator, Keyword), + (r'(for%s(?!\^))(%s)(/f%s)' % + (_token_terminator, _space, _token_terminator), + bygroups(Keyword, using(this, state='text'), Keyword), + ('for/f', 'for')), + (r'(for%s(?!\^))(%s)(/l%s)' % + (_token_terminator, _space, _token_terminator), + bygroups(Keyword, using(this, state='text'), Keyword), + ('for/l', 'for')), + (r'for%s(?!\^)' % _token_terminator, Keyword, ('for2', 'for')), + (r'(goto%s)(%s?)(:?)' % (_keyword_terminator, _space), + bygroups(Keyword, using(this, state='text'), Punctuation), + 'label%s' % suffix), + (r'(if(?:(?=\()|%s)(?!\^))(%s?)((?:/i%s)?)(%s?)((?:not%s)?)(%s?)' % + (_token_terminator, _space, _token_terminator, _space, + _token_terminator, _space), + bygroups(Keyword, using(this, state='text'), Keyword, + using(this, state='text'), Keyword, + using(this, state='text')), ('(?', 'if')), + (r'rem(((?=\()|%s)%s?%s?.*|%s%s)' % + (_token_terminator, _space, _stoken, _keyword_terminator, + rest_of_line_compound if compound else rest_of_line), + Comment.Single, 'follow%s' % suffix), + (r'(set%s)%s(/a)' % (_keyword_terminator, set_space), + bygroups(Keyword, using(this, state='text'), Keyword), + 'arithmetic%s' % suffix), + (r'(set%s)%s((?:/p)?)%s((?:(?:(?:\^[%s]?)?[^"%s%s^=%s]|' + r'\^[%s]?[^"=])+)?)((?:(?:\^[%s]?)?=)?)' % + (_keyword_terminator, set_space, set_space, _nl, _nl, _punct, + ')' if compound else '', _nl, _nl), + bygroups(Keyword, using(this, state='text'), Keyword, + using(this, state='text'), using(this, state='variable'), + Punctuation), + 'follow%s' % suffix), + default('follow%s' % suffix) + ] + + def _make_follow_state(compound, _label=_label, + _label_compound=_label_compound, _nl=_nl, + _space=_space, _start_label=_start_label, + _token=_token, _token_compound=_token_compound, + _ws=_ws): + suffix = '/compound' if compound else '' + state = [] + if compound: + state.append((r'(?=\))', Text, '#pop')) + state += [ + (r'%s([%s]*)(%s)(.*)' % + (_start_label, _ws, _label_compound if compound else _label), + bygroups(Text, Punctuation, Text, Name.Label, Comment.Single)), + include('redirect%s' % suffix), + (r'(?=[%s])' % _nl, Text, '#pop'), + (r'\|\|?|&&?', Punctuation, '#pop'), + include('text') + ] + return state + + def _make_arithmetic_state(compound, _nl=_nl, _punct=_punct, + _string=_string, _variable=_variable, _ws=_ws): + op = r'=+\-*/!~' + state = [] + if compound: + state.append((r'(?=\))', Text, '#pop')) + state += [ + (r'0[0-7]+', Number.Oct), + (r'0x[\da-f]+', Number.Hex), + (r'\d+', Number.Integer), + (r'[(),]+', Punctuation), + (r'([%s]|%%|\^\^)+' % op, Operator), + (r'(%s|%s|(\^[%s]?)?[^()%s%%^"%s%s%s]|\^[%s%s]?%s)+' % + (_string, _variable, _nl, op, _nl, _punct, _ws, _nl, _ws, + r'[^)]' if compound else r'[\w\W]'), + using(this, state='variable')), + (r'(?=[\x00|&])', Text, '#pop'), + include('follow') + ] + return state + + def _make_call_state(compound, _label=_label, + _label_compound=_label_compound): + state = [] + if compound: + state.append((r'(?=\))', Text, '#pop')) + state.append((r'(:?)(%s)' % (_label_compound if compound else _label), + bygroups(Punctuation, Name.Label), '#pop')) + return state + + def _make_label_state(compound, _label=_label, + _label_compound=_label_compound, _nl=_nl, + _punct=_punct, _string=_string, _variable=_variable): + state = [] + if compound: + state.append((r'(?=\))', Text, '#pop')) + state.append((r'(%s?)((?:%s|%s|\^[%s]?%s|[^"%%^%s%s%s])*)' % + (_label_compound if compound else _label, _string, + _variable, _nl, r'[^)]' if compound else r'[\w\W]', _nl, + _punct, r')' if compound else ''), + bygroups(Name.Label, Comment.Single), '#pop')) + return state + + def _make_redirect_state(compound, + _core_token_compound=_core_token_compound, + _nl=_nl, _punct=_punct, _stoken=_stoken, + _string=_string, _space=_space, + _variable=_variable, _ws=_ws): + stoken_compound = (r'(?:[%s]+|(?:%s|%s|%s)+)' % + (_punct, _string, _variable, _core_token_compound)) + return [ + (r'((?:(?<=[%s%s])\d)?)(>>?&|<&)([%s%s]*)(\d)' % + (_nl, _ws, _nl, _ws), + bygroups(Number.Integer, Punctuation, Text, Number.Integer)), + (r'((?:(?<=[%s%s])(?>?|<)(%s?%s)' % + (_nl, _ws, _nl, _space, stoken_compound if compound else _stoken), + bygroups(Number.Integer, Punctuation, using(this, state='text'))) + ] + + tokens = { + 'root': _make_begin_state(False), + 'follow': _make_follow_state(False), + 'arithmetic': _make_arithmetic_state(False), + 'call': _make_call_state(False), + 'label': _make_label_state(False), + 'redirect': _make_redirect_state(False), + 'root/compound': _make_begin_state(True), + 'follow/compound': _make_follow_state(True), + 'arithmetic/compound': _make_arithmetic_state(True), + 'call/compound': _make_call_state(True), + 'label/compound': _make_label_state(True), + 'redirect/compound': _make_redirect_state(True), + 'variable-or-escape': [ + (_variable, Name.Variable), + (r'%%%%|\^[%s]?(\^!|[\w\W])' % _nl, String.Escape) + ], + 'string': [ + (r'"', String.Double, '#pop'), + (_variable, Name.Variable), + (r'\^!|%%', String.Escape), + (r'[^"%%^%s]+|[%%^]' % _nl, String.Double), + default('#pop') + ], + 'sqstring': [ + include('variable-or-escape'), + (r'[^%]+|%', String.Single) + ], + 'bqstring': [ + include('variable-or-escape'), + (r'[^%]+|%', String.Backtick) + ], + 'text': [ + (r'"', String.Double, 'string'), + include('variable-or-escape'), + (r'[^"%%^%s%s%s\d)]+|.' % (_nl, _punct, _ws), Text) + ], + 'variable': [ + (r'"', String.Double, 'string'), + include('variable-or-escape'), + (r'[^"%%^%s]+|.' % _nl, Name.Variable) + ], + 'for': [ + (r'(%s)(in)(%s)(\()' % (_space, _space), + bygroups(using(this, state='text'), Keyword, + using(this, state='text'), Punctuation), '#pop'), + include('follow') + ], + 'for2': [ + (r'\)', Punctuation), + (r'(%s)(do%s)' % (_space, _token_terminator), + bygroups(using(this, state='text'), Keyword), '#pop'), + (r'[%s]+' % _nl, Text), + include('follow') + ], + 'for/f': [ + (r'(")((?:%s|[^"])*?")([%s%s]*)(\))' % (_variable, _nl, _ws), + bygroups(String.Double, using(this, state='string'), Text, + Punctuation)), + (r'"', String.Double, ('#pop', 'for2', 'string')), + (r"('(?:%%%%|%s|[\w\W])*?')([%s%s]*)(\))" % (_variable, _nl, _ws), + bygroups(using(this, state='sqstring'), Text, Punctuation)), + (r'(`(?:%%%%|%s|[\w\W])*?`)([%s%s]*)(\))' % (_variable, _nl, _ws), + bygroups(using(this, state='bqstring'), Text, Punctuation)), + include('for2') + ], + 'for/l': [ + (r'-?\d+', Number.Integer), + include('for2') + ], + 'if': [ + (r'((?:cmdextversion|errorlevel)%s)(%s)(\d+)' % + (_token_terminator, _space), + bygroups(Keyword, using(this, state='text'), + Number.Integer), '#pop'), + (r'(defined%s)(%s)(%s)' % (_token_terminator, _space, _stoken), + bygroups(Keyword, using(this, state='text'), + using(this, state='variable')), '#pop'), + (r'(exist%s)(%s%s)' % (_token_terminator, _space, _stoken), + bygroups(Keyword, using(this, state='text')), '#pop'), + (r'(%s%s)(%s)(%s%s)' % (_number, _space, _opword, _space, _number), + bygroups(using(this, state='arithmetic'), Operator.Word, + using(this, state='arithmetic')), '#pop'), + (_stoken, using(this, state='text'), ('#pop', 'if2')), + ], + 'if2': [ + (r'(%s?)(==)(%s?%s)' % (_space, _space, _stoken), + bygroups(using(this, state='text'), Operator, + using(this, state='text')), '#pop'), + (r'(%s)(%s)(%s%s)' % (_space, _opword, _space, _stoken), + bygroups(using(this, state='text'), Operator.Word, + using(this, state='text')), '#pop') + ], + '(?': [ + (_space, using(this, state='text')), + (r'\(', Punctuation, ('#pop', 'else?', 'root/compound')), + default('#pop') + ], + 'else?': [ + (_space, using(this, state='text')), + (r'else%s' % _token_terminator, Keyword, '#pop'), + default('#pop') + ] + } + + +class MSDOSSessionLexer(ShellSessionBaseLexer): + """ + Lexer for simplistic MSDOS sessions. + + .. versionadded:: 2.1 + """ + + name = 'MSDOS Session' + aliases = ['doscon'] + filenames = [] + mimetypes = [] + + _innerLexerCls = BatchLexer + _ps1rgx = r'^([^>]+>)(.*\n?)' + _ps2 = 'More? ' + + +class TcshLexer(RegexLexer): + """ + Lexer for tcsh scripts. + + .. versionadded:: 0.10 + """ + + name = 'Tcsh' + aliases = ['tcsh', 'csh'] + filenames = ['*.tcsh', '*.csh'] + mimetypes = ['application/x-csh'] + + tokens = { + 'root': [ + include('basic'), + (r'\$\(', Keyword, 'paren'), + (r'\$\{#?', Keyword, 'curly'), + (r'`', String.Backtick, 'backticks'), + include('data'), + ], + 'basic': [ + (r'\b(if|endif|else|while|then|foreach|case|default|' + r'continue|goto|breaksw|end|switch|endsw)\s*\b', + Keyword), + (r'\b(alias|alloc|bg|bindkey|break|builtins|bye|caller|cd|chdir|' + r'complete|dirs|echo|echotc|eval|exec|exit|fg|filetest|getxvers|' + r'glob|getspath|hashstat|history|hup|inlib|jobs|kill|' + r'limit|log|login|logout|ls-F|migrate|newgrp|nice|nohup|notify|' + r'onintr|popd|printenv|pushd|rehash|repeat|rootnode|popd|pushd|' + r'set|shift|sched|setenv|setpath|settc|setty|setxvers|shift|' + r'source|stop|suspend|source|suspend|telltc|time|' + r'umask|unalias|uncomplete|unhash|universe|unlimit|unset|unsetenv|' + r'ver|wait|warp|watchlog|where|which)\s*\b', + Name.Builtin), + (r'#.*', Comment), + (r'\\[\w\W]', String.Escape), + (r'(\b\w+)(\s*)(=)', bygroups(Name.Variable, Text, Operator)), + (r'[\[\]{}()=]+', Operator), + (r'<<\s*(\'?)\\?(\w+)[\w\W]+?\2', String), + (r';', Punctuation), + ], + 'data': [ + (r'(?s)"(\\\\|\\[0-7]+|\\.|[^"\\])*"', String.Double), + (r"(?s)'(\\\\|\\[0-7]+|\\.|[^'\\])*'", String.Single), + (r'\s+', Text), + (r'[^=\s\[\]{}()$"\'`\\;#]+', Text), + (r'\d+(?= |\Z)', Number), + (r'\$#?(\w+|.)', Name.Variable), + ], + 'curly': [ + (r'\}', Keyword, '#pop'), + (r':-', Keyword), + (r'\w+', Name.Variable), + (r'[^}:"\'`$]+', Punctuation), + (r':', Punctuation), + include('root'), + ], + 'paren': [ + (r'\)', Keyword, '#pop'), + include('root'), + ], + 'backticks': [ + (r'`', String.Backtick, '#pop'), + include('root'), + ], + } + + +class TcshSessionLexer(ShellSessionBaseLexer): + """ + Lexer for Tcsh sessions. + + .. versionadded:: 2.1 + """ + + name = 'Tcsh Session' + aliases = ['tcshcon'] + filenames = [] + mimetypes = [] + + _innerLexerCls = TcshLexer + _ps1rgx = r'^([^>]+>)(.*\n?)' + _ps2 = '? ' + + +class PowerShellLexer(RegexLexer): + """ + For Windows PowerShell code. + + .. versionadded:: 1.5 + """ + name = 'PowerShell' + aliases = ['powershell', 'posh', 'ps1', 'psm1'] + filenames = ['*.ps1', '*.psm1'] + mimetypes = ['text/x-powershell'] + + flags = re.DOTALL | re.IGNORECASE | re.MULTILINE + + keywords = ( + 'while validateset validaterange validatepattern validatelength ' + 'validatecount until trap switch return ref process param parameter in ' + 'if global: function foreach for finally filter end elseif else ' + 'dynamicparam do default continue cmdletbinding break begin alias \\? ' + '% #script #private #local #global mandatory parametersetname position ' + 'valuefrompipeline valuefrompipelinebypropertyname ' + 'valuefromremainingarguments helpmessage try catch throw').split() + + operators = ( + 'and as band bnot bor bxor casesensitive ccontains ceq cge cgt cle ' + 'clike clt cmatch cne cnotcontains cnotlike cnotmatch contains ' + 'creplace eq exact f file ge gt icontains ieq ige igt ile ilike ilt ' + 'imatch ine inotcontains inotlike inotmatch ireplace is isnot le like ' + 'lt match ne not notcontains notlike notmatch or regex replace ' + 'wildcard').split() + + verbs = ( + 'write where wait use update unregister undo trace test tee take ' + 'suspend stop start split sort skip show set send select scroll resume ' + 'restore restart resolve resize reset rename remove register receive ' + 'read push pop ping out new move measure limit join invoke import ' + 'group get format foreach export expand exit enter enable disconnect ' + 'disable debug cxnew copy convertto convertfrom convert connect ' + 'complete compare clear checkpoint aggregate add').split() + + commenthelp = ( + 'component description example externalhelp forwardhelpcategory ' + 'forwardhelptargetname functionality inputs link ' + 'notes outputs parameter remotehelprunspace role synopsis').split() + + tokens = { + 'root': [ + # we need to count pairs of parentheses for correct highlight + # of '$(...)' blocks in strings + (r'\(', Punctuation, 'child'), + (r'\s+', Text), + (r'^(\s*#[#\s]*)(\.(?:%s))([^\n]*$)' % '|'.join(commenthelp), + bygroups(Comment, String.Doc, Comment)), + (r'#[^\n]*?$', Comment), + (r'(<|<)#', Comment.Multiline, 'multline'), + (r'@"\n', String.Heredoc, 'heredoc-double'), + (r"@'\n.*?\n'@", String.Heredoc), + # escaped syntax + (r'`[\'"$@-]', Punctuation), + (r'"', String.Double, 'string'), + (r"'([^']|'')*'", String.Single), + (r'(\$|@@|@)((global|script|private|env):)?\w+', + Name.Variable), + (r'(%s)\b' % '|'.join(keywords), Keyword), + (r'-(%s)\b' % '|'.join(operators), Operator), + (r'(%s)-[a-z_]\w*\b' % '|'.join(verbs), Name.Builtin), + (r'\[[a-z_\[][\w. `,\[\]]*\]', Name.Constant), # .net [type]s + (r'-[a-z_]\w*', Name), + (r'\w+', Name), + (r'[.,;@{}\[\]$()=+*/\\&%!~?^`|<>-]|::', Punctuation), + ], + 'child': [ + (r'\)', Punctuation, '#pop'), + include('root'), + ], + 'multline': [ + (r'[^#&.]+', Comment.Multiline), + (r'#(>|>)', Comment.Multiline, '#pop'), + (r'\.(%s)' % '|'.join(commenthelp), String.Doc), + (r'[#&.]', Comment.Multiline), + ], + 'string': [ + (r"`[0abfnrtv'\"$`]", String.Escape), + (r'[^$`"]+', String.Double), + (r'\$\(', Punctuation, 'child'), + (r'""', String.Double), + (r'[`$]', String.Double), + (r'"', String.Double, '#pop'), + ], + 'heredoc-double': [ + (r'\n"@', String.Heredoc, '#pop'), + (r'\$\(', Punctuation, 'child'), + (r'[^@\n]+"]', String.Heredoc), + (r".", String.Heredoc), + ] + } + + +class PowerShellSessionLexer(ShellSessionBaseLexer): + """ + Lexer for simplistic Windows PowerShell sessions. + + .. versionadded:: 2.1 + """ + + name = 'PowerShell Session' + aliases = ['ps1con'] + filenames = [] + mimetypes = [] + + _innerLexerCls = PowerShellLexer + _ps1rgx = r'^(PS [^>]+> )(.*\n?)' + _ps2 = '>> ' + + +class FishShellLexer(RegexLexer): + """ + Lexer for Fish shell scripts. + + .. versionadded:: 2.1 + """ + + name = 'Fish' + aliases = ['fish', 'fishshell'] + filenames = ['*.fish', '*.load'] + mimetypes = ['application/x-fish'] + + tokens = { + 'root': [ + include('basic'), + include('data'), + include('interp'), + ], + 'interp': [ + (r'\$\(\(', Keyword, 'math'), + (r'\(', Keyword, 'paren'), + (r'\$#?(\w+|.)', Name.Variable), + ], + 'basic': [ + (r'\b(begin|end|if|else|while|break|for|in|return|function|block|' + r'case|continue|switch|not|and|or|set|echo|exit|pwd|true|false|' + r'cd|count|test)(\s*)\b', + bygroups(Keyword, Text)), + (r'\b(alias|bg|bind|breakpoint|builtin|command|commandline|' + r'complete|contains|dirh|dirs|emit|eval|exec|fg|fish|fish_config|' + r'fish_indent|fish_pager|fish_prompt|fish_right_prompt|' + r'fish_update_completions|fishd|funced|funcsave|functions|help|' + r'history|isatty|jobs|math|mimedb|nextd|open|popd|prevd|psub|' + r'pushd|random|read|set_color|source|status|trap|type|ulimit|' + r'umask|vared|fc|getopts|hash|kill|printf|time|wait)\s*\b(?!\.)', + Name.Builtin), + (r'#.*\n', Comment), + (r'\\[\w\W]', String.Escape), + (r'(\b\w+)(\s*)(=)', bygroups(Name.Variable, Text, Operator)), + (r'[\[\]()=]', Operator), + (r'<<-?\s*(\'?)\\?(\w+)[\w\W]+?\2', String), + ], + 'data': [ + (r'(?s)\$?"(\\\\|\\[0-7]+|\\.|[^"\\$])*"', String.Double), + (r'"', String.Double, 'string'), + (r"(?s)\$'(\\\\|\\[0-7]+|\\.|[^'\\])*'", String.Single), + (r"(?s)'.*?'", String.Single), + (r';', Punctuation), + (r'&|\||\^|<|>', Operator), + (r'\s+', Text), + (r'\d+(?= |\Z)', Number), + (r'[^=\s\[\]{}()$"\'`\\<&|;]+', Text), + ], + 'string': [ + (r'"', String.Double, '#pop'), + (r'(?s)(\\\\|\\[0-7]+|\\.|[^"\\$])+', String.Double), + include('interp'), + ], + 'paren': [ + (r'\)', Keyword, '#pop'), + include('root'), + ], + 'math': [ + (r'\)\)', Keyword, '#pop'), + (r'[-+*/%^|&]|\*\*|\|\|', Operator), + (r'\d+#\d+', Number), + (r'\d+#(?! )', Number), + (r'\d+', Number), + include('root'), + ], + } diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/smalltalk.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/smalltalk.py new file mode 100644 index 0000000000000000000000000000000000000000..79078b662dee357e0c099b4fd95ccd17c1e54069 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/smalltalk.py @@ -0,0 +1,195 @@ +# -*- coding: utf-8 -*- +""" + pygments.lexers.smalltalk + ~~~~~~~~~~~~~~~~~~~~~~~~~ + + Lexers for Smalltalk and related languages. + + :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS. + :license: BSD, see LICENSE for details. +""" + +from pygments.lexer import RegexLexer, include, bygroups, default +from pygments.token import Text, Comment, Operator, Keyword, Name, String, \ + Number, Punctuation + +__all__ = ['SmalltalkLexer', 'NewspeakLexer'] + + +class SmalltalkLexer(RegexLexer): + """ + For `Smalltalk `_ syntax. + Contributed by Stefan Matthias Aust. + Rewritten by Nils Winter. + + .. versionadded:: 0.10 + """ + name = 'Smalltalk' + filenames = ['*.st'] + aliases = ['smalltalk', 'squeak', 'st'] + mimetypes = ['text/x-smalltalk'] + + tokens = { + 'root': [ + (r'(<)(\w+:)(.*?)(>)', bygroups(Text, Keyword, Text, Text)), + include('squeak fileout'), + include('whitespaces'), + include('method definition'), + (r'(\|)([\w\s]*)(\|)', bygroups(Operator, Name.Variable, Operator)), + include('objects'), + (r'\^|\:=|\_', Operator), + # temporaries + (r'[\]({}.;!]', Text), + ], + 'method definition': [ + # Not perfect can't allow whitespaces at the beginning and the + # without breaking everything + (r'([a-zA-Z]+\w*:)(\s*)(\w+)', + bygroups(Name.Function, Text, Name.Variable)), + (r'^(\b[a-zA-Z]+\w*\b)(\s*)$', bygroups(Name.Function, Text)), + (r'^([-+*/\\~<>=|&!?,@%]+)(\s*)(\w+)(\s*)$', + bygroups(Name.Function, Text, Name.Variable, Text)), + ], + 'blockvariables': [ + include('whitespaces'), + (r'(:)(\s*)(\w+)', + bygroups(Operator, Text, Name.Variable)), + (r'\|', Operator, '#pop'), + default('#pop'), # else pop + ], + 'literals': [ + (r"'(''|[^'])*'", String, 'afterobject'), + (r'\$.', String.Char, 'afterobject'), + (r'#\(', String.Symbol, 'parenth'), + (r'\)', Text, 'afterobject'), + (r'(\d+r)?-?\d+(\.\d+)?(e-?\d+)?', Number, 'afterobject'), + ], + '_parenth_helper': [ + include('whitespaces'), + (r'(\d+r)?-?\d+(\.\d+)?(e-?\d+)?', Number), + (r'[-+*/\\~<>=|&#!?,@%\w:]+', String.Symbol), + # literals + (r"'(''|[^'])*'", String), + (r'\$.', String.Char), + (r'#*\(', String.Symbol, 'inner_parenth'), + ], + 'parenth': [ + # This state is a bit tricky since + # we can't just pop this state + (r'\)', String.Symbol, ('root', 'afterobject')), + include('_parenth_helper'), + ], + 'inner_parenth': [ + (r'\)', String.Symbol, '#pop'), + include('_parenth_helper'), + ], + 'whitespaces': [ + # skip whitespace and comments + (r'\s+', Text), + (r'"(""|[^"])*"', Comment), + ], + 'objects': [ + (r'\[', Text, 'blockvariables'), + (r'\]', Text, 'afterobject'), + (r'\b(self|super|true|false|nil|thisContext)\b', + Name.Builtin.Pseudo, 'afterobject'), + (r'\b[A-Z]\w*(?!:)\b', Name.Class, 'afterobject'), + (r'\b[a-z]\w*(?!:)\b', Name.Variable, 'afterobject'), + (r'#("(""|[^"])*"|[-+*/\\~<>=|&!?,@%]+|[\w:]+)', + String.Symbol, 'afterobject'), + include('literals'), + ], + 'afterobject': [ + (r'! !$', Keyword, '#pop'), # squeak chunk delimiter + include('whitespaces'), + (r'\b(ifTrue:|ifFalse:|whileTrue:|whileFalse:|timesRepeat:)', + Name.Builtin, '#pop'), + (r'\b(new\b(?!:))', Name.Builtin), + (r'\:=|\_', Operator, '#pop'), + (r'\b[a-zA-Z]+\w*:', Name.Function, '#pop'), + (r'\b[a-zA-Z]+\w*', Name.Function), + (r'\w+:?|[-+*/\\~<>=|&!?,@%]+', Name.Function, '#pop'), + (r'\.', Punctuation, '#pop'), + (r';', Punctuation), + (r'[\])}]', Text), + (r'[\[({]', Text, '#pop'), + ], + 'squeak fileout': [ + # Squeak fileout format (optional) + (r'^"(""|[^"])*"!', Keyword), + (r"^'(''|[^'])*'!", Keyword), + (r'^(!)(\w+)( commentStamp: )(.*?)( prior: .*?!\n)(.*?)(!)', + bygroups(Keyword, Name.Class, Keyword, String, Keyword, Text, Keyword)), + (r"^(!)(\w+(?: class)?)( methodsFor: )('(?:''|[^'])*')(.*?!)", + bygroups(Keyword, Name.Class, Keyword, String, Keyword)), + (r'^(\w+)( subclass: )(#\w+)' + r'(\s+instanceVariableNames: )(.*?)' + r'(\s+classVariableNames: )(.*?)' + r'(\s+poolDictionaries: )(.*?)' + r'(\s+category: )(.*?)(!)', + bygroups(Name.Class, Keyword, String.Symbol, Keyword, String, Keyword, + String, Keyword, String, Keyword, String, Keyword)), + (r'^(\w+(?: class)?)(\s+instanceVariableNames: )(.*?)(!)', + bygroups(Name.Class, Keyword, String, Keyword)), + (r'(!\n)(\].*)(! !)$', bygroups(Keyword, Text, Keyword)), + (r'! !$', Keyword), + ], + } + + +class NewspeakLexer(RegexLexer): + """ + For `Newspeak ` syntax. + + .. versionadded:: 1.1 + """ + name = 'Newspeak' + filenames = ['*.ns2'] + aliases = ['newspeak', ] + mimetypes = ['text/x-newspeak'] + + tokens = { + 'root': [ + (r'\b(Newsqueak2)\b', Keyword.Declaration), + (r"'[^']*'", String), + (r'\b(class)(\s+)(\w+)(\s*)', + bygroups(Keyword.Declaration, Text, Name.Class, Text)), + (r'\b(mixin|self|super|private|public|protected|nil|true|false)\b', + Keyword), + (r'(\w+\:)(\s*)([a-zA-Z_]\w+)', + bygroups(Name.Function, Text, Name.Variable)), + (r'(\w+)(\s*)(=)', + bygroups(Name.Attribute, Text, Operator)), + (r'<\w+>', Comment.Special), + include('expressionstat'), + include('whitespace') + ], + + 'expressionstat': [ + (r'(\d+\.\d*|\.\d+|\d+[fF])[fF]?', Number.Float), + (r'\d+', Number.Integer), + (r':\w+', Name.Variable), + (r'(\w+)(::)', bygroups(Name.Variable, Operator)), + (r'\w+:', Name.Function), + (r'\w+', Name.Variable), + (r'\(|\)', Punctuation), + (r'\[|\]', Punctuation), + (r'\{|\}', Punctuation), + + (r'(\^|\+|\/|~|\*|<|>|=|@|%|\||&|\?|!|,|-|:)', Operator), + (r'\.|;', Punctuation), + include('whitespace'), + include('literals'), + ], + 'literals': [ + (r'\$.', String), + (r"'[^']*'", String), + (r"#'[^']*'", String.Symbol), + (r"#\w+:?", String.Symbol), + (r"#(\+|\/|~|\*|<|>|=|@|%|\||&|\?|!|,|-)+", String.Symbol) + ], + 'whitespace': [ + (r'\s+', Text), + (r'"[^"]*"', Comment) + ], + } diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/smv.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/smv.py new file mode 100644 index 0000000000000000000000000000000000000000..380a3b703b4968952b9b2d859c2c2e51ddd5097f --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/smv.py @@ -0,0 +1,79 @@ +# -*- coding: utf-8 -*- +""" + pygments.lexers.smv + ~~~~~~~~~~~~~~~~~~~ + + Lexers for the SMV languages. + + :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS. + :license: BSD, see LICENSE for details. +""" + +from pygments.lexer import RegexLexer, words +from pygments.token import Comment, Generic, Keyword, Name, Number, \ + Operator, Punctuation, Text + +__all__ = ['NuSMVLexer'] + + +class NuSMVLexer(RegexLexer): + """ + Lexer for the NuSMV language. + + .. versionadded:: 2.2 + """ + + name = 'NuSMV' + aliases = ['nusmv'] + filenames = ['*.smv'] + mimetypes = [] + + tokens = { + 'root': [ + # Comments + (r'(?s)\/\-\-.*?\-\-/', Comment), + (r'--.*\n', Comment), + + # Reserved + (words(('MODULE', 'DEFINE', 'MDEFINE', 'CONSTANTS', 'VAR', 'IVAR', + 'FROZENVAR', 'INIT', 'TRANS', 'INVAR', 'SPEC', 'CTLSPEC', + 'LTLSPEC', 'PSLSPEC', 'COMPUTE', 'NAME', 'INVARSPEC', + 'FAIRNESS', 'JUSTICE', 'COMPASSION', 'ISA', 'ASSIGN', + 'CONSTRAINT', 'SIMPWFF', 'CTLWFF', 'LTLWFF', 'PSLWFF', + 'COMPWFF', 'IN', 'MIN', 'MAX', 'MIRROR', 'PRED', + 'PREDICATES'), suffix=r'(?![\w$#-])'), + Keyword.Declaration), + (r'process(?![\w$#-])', Keyword), + (words(('array', 'of', 'boolean', 'integer', 'real', 'word'), + suffix=r'(?![\w$#-])'), Keyword.Type), + (words(('case', 'esac'), suffix=r'(?![\w$#-])'), Keyword), + (words(('word1', 'bool', 'signed', 'unsigned', 'extend', 'resize', + 'sizeof', 'uwconst', 'swconst', 'init', 'self', 'count', + 'abs', 'max', 'min'), suffix=r'(?![\w$#-])'), + Name.Builtin), + (words(('EX', 'AX', 'EF', 'AF', 'EG', 'AG', 'E', 'F', 'O', 'G', + 'H', 'X', 'Y', 'Z', 'A', 'U', 'S', 'V', 'T', 'BU', 'EBF', + 'ABF', 'EBG', 'ABG', 'next', 'mod', 'union', 'in', 'xor', + 'xnor'), suffix=r'(?![\w$#-])'), + Operator.Word), + (words(('TRUE', 'FALSE'), suffix=r'(?![\w$#-])'), Keyword.Constant), + + # Names + (r'[a-zA-Z_][\w$#-]*', Name.Variable), + + # Operators + (r':=', Operator), + (r'[-&|+*/<>!=]', Operator), + + # Literals + (r'\-?\d+\b', Number.Integer), + (r'0[su][bB]\d*_[01_]+', Number.Bin), + (r'0[su][oO]\d*_[0-7_]+', Number.Oct), + (r'0[su][dD]\d*_[\d_]+', Number.Dec), + (r'0[su][hH]\d*_[\da-fA-F_]+', Number.Hex), + + # Whitespace, punctuation and the rest + (r'\s+', Text.Whitespace), + (r'[()\[\]{};?:.,]', Punctuation), + ], + } diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/snobol.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/snobol.py new file mode 100644 index 0000000000000000000000000000000000000000..f6e12fd26761d41d16e71260f679a6a86263f7a6 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/snobol.py @@ -0,0 +1,83 @@ +# -*- coding: utf-8 -*- +""" + pygments.lexers.snobol + ~~~~~~~~~~~~~~~~~~~~~~ + + Lexers for the SNOBOL language. + + :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS. + :license: BSD, see LICENSE for details. +""" + +from pygments.lexer import RegexLexer, bygroups +from pygments.token import Text, Comment, Operator, Keyword, Name, String, \ + Number, Punctuation + +__all__ = ['SnobolLexer'] + + +class SnobolLexer(RegexLexer): + """ + Lexer for the SNOBOL4 programming language. + + Recognizes the common ASCII equivalents of the original SNOBOL4 operators. + Does not require spaces around binary operators. + + .. versionadded:: 1.5 + """ + + name = "Snobol" + aliases = ["snobol"] + filenames = ['*.snobol'] + mimetypes = ['text/x-snobol'] + + tokens = { + # root state, start of line + # comments, continuation lines, and directives start in column 1 + # as do labels + 'root': [ + (r'\*.*\n', Comment), + (r'[+.] ', Punctuation, 'statement'), + (r'-.*\n', Comment), + (r'END\s*\n', Name.Label, 'heredoc'), + (r'[A-Za-z$][\w$]*', Name.Label, 'statement'), + (r'\s+', Text, 'statement'), + ], + # statement state, line after continuation or label + 'statement': [ + (r'\s*\n', Text, '#pop'), + (r'\s+', Text), + (r'(?<=[^\w.])(LT|LE|EQ|NE|GE|GT|INTEGER|IDENT|DIFFER|LGT|SIZE|' + r'REPLACE|TRIM|DUPL|REMDR|DATE|TIME|EVAL|APPLY|OPSYN|LOAD|UNLOAD|' + r'LEN|SPAN|BREAK|ANY|NOTANY|TAB|RTAB|REM|POS|RPOS|FAIL|FENCE|' + r'ABORT|ARB|ARBNO|BAL|SUCCEED|INPUT|OUTPUT|TERMINAL)(?=[^\w.])', + Name.Builtin), + (r'[A-Za-z][\w.]*', Name), + # ASCII equivalents of original operators + # | for the EBCDIC equivalent, ! likewise + # \ for EBCDIC negation + (r'\*\*|[?$.!%*/#+\-@|&\\=]', Operator), + (r'"[^"]*"', String), + (r"'[^']*'", String), + # Accept SPITBOL syntax for real numbers + # as well as Macro SNOBOL4 + (r'[0-9]+(?=[^.EeDd])', Number.Integer), + (r'[0-9]+(\.[0-9]*)?([EDed][-+]?[0-9]+)?', Number.Float), + # Goto + (r':', Punctuation, 'goto'), + (r'[()<>,;]', Punctuation), + ], + # Goto block + 'goto': [ + (r'\s*\n', Text, "#pop:2"), + (r'\s+', Text), + (r'F|S', Keyword), + (r'(\()([A-Za-z][\w.]*)(\))', + bygroups(Punctuation, Name.Label, Punctuation)) + ], + # everything after the END statement is basically one + # big heredoc. + 'heredoc': [ + (r'.*\n', String.Heredoc) + ] + } diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/special.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/special.py new file mode 100644 index 0000000000000000000000000000000000000000..6e076b0ce7b5c9c4b963b9995e19d5862b3f4b4b --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/special.py @@ -0,0 +1,103 @@ +# -*- coding: utf-8 -*- +""" + pygments.lexers.special + ~~~~~~~~~~~~~~~~~~~~~~~ + + Special lexers. + + :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS. + :license: BSD, see LICENSE for details. +""" + +import re + +from pygments.lexer import Lexer +from pygments.token import Token, Error, Text +from pygments.util import get_choice_opt, text_type, BytesIO + + +__all__ = ['TextLexer', 'RawTokenLexer'] + + +class TextLexer(Lexer): + """ + "Null" lexer, doesn't highlight anything. + """ + name = 'Text only' + aliases = ['text'] + filenames = ['*.txt'] + mimetypes = ['text/plain'] + priority = 0.01 + + def get_tokens_unprocessed(self, text): + yield 0, Text, text + + def analyse_text(text): + return TextLexer.priority + +_ttype_cache = {} + +line_re = re.compile(b'.*?\n') + + +class RawTokenLexer(Lexer): + """ + Recreate a token stream formatted with the `RawTokenFormatter`. This + lexer raises exceptions during parsing if the token stream in the + file is malformed. + + Additional options accepted: + + `compress` + If set to ``"gz"`` or ``"bz2"``, decompress the token stream with + the given compression algorithm before lexing (default: ``""``). + """ + name = 'Raw token data' + aliases = ['raw'] + filenames = [] + mimetypes = ['application/x-pygments-tokens'] + + def __init__(self, **options): + self.compress = get_choice_opt(options, 'compress', + ['', 'none', 'gz', 'bz2'], '') + Lexer.__init__(self, **options) + + def get_tokens(self, text): + if isinstance(text, text_type): + # raw token stream never has any non-ASCII characters + text = text.encode('ascii') + if self.compress == 'gz': + import gzip + gzipfile = gzip.GzipFile('', 'rb', 9, BytesIO(text)) + text = gzipfile.read() + elif self.compress == 'bz2': + import bz2 + text = bz2.decompress(text) + + # do not call Lexer.get_tokens() because we do not want Unicode + # decoding to occur, and stripping is not optional. + text = text.strip(b'\n') + b'\n' + for i, t, v in self.get_tokens_unprocessed(text): + yield t, v + + def get_tokens_unprocessed(self, text): + length = 0 + for match in line_re.finditer(text): + try: + ttypestr, val = match.group().split(b'\t', 1) + except ValueError: + val = match.group().decode('ascii', 'replace') + ttype = Error + else: + ttype = _ttype_cache.get(ttypestr) + if not ttype: + ttype = Token + ttypes = ttypestr.split('.')[1:] + for ttype_ in ttypes: + if not ttype_ or not ttype_[0].isupper(): + raise ValueError('malformed token name') + ttype = getattr(ttype, ttype_) + _ttype_cache[ttypestr] = ttype + val = val[2:-2].decode('unicode-escape') + yield length, ttype, val + length += len(val) diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/sql.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/sql.py new file mode 100644 index 0000000000000000000000000000000000000000..7507c0fc80f9891ff16378de93a9362f2b17b904 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wandb/vendor/pygments/lexers/sql.py @@ -0,0 +1,681 @@ +# -*- coding: utf-8 -*- +""" + pygments.lexers.sql + ~~~~~~~~~~~~~~~~~~~ + + Lexers for various SQL dialects and related interactive sessions. + + Postgres specific lexers: + + `PostgresLexer` + A SQL lexer for the PostgreSQL dialect. Differences w.r.t. the SQL + lexer are: + + - keywords and data types list parsed from the PG docs (run the + `_postgres_builtins` module to update them); + - Content of $-strings parsed using a specific lexer, e.g. the content + of a PL/Python function is parsed using the Python lexer; + - parse PG specific constructs: E-strings, $-strings, U&-strings, + different operators and punctuation. + + `PlPgsqlLexer` + A lexer for the PL/pgSQL language. Adds a few specific construct on + top of the PG SQL lexer (such as <${location}; +you should be redirected automatically. +${detail} +${html_comment}''') + + def __init__(self, detail=None, headers=None, comment=None, + body_template=None, location=None, add_slash=False): + super(_HTTPMove, self).__init__( + detail=detail, headers=headers, comment=comment, + body_template=body_template) + if location is not None: + if '\n' in location or '\r' in location: + raise ValueError('Control characters are not allowed in location') + + self.location = location + if add_slash: + raise TypeError( + "You can only provide one of the arguments location " + "and add_slash") + self.add_slash = add_slash + + def __call__(self, environ, start_response): + req = Request(environ) + if self.add_slash: + url = req.path_url + url += '/' + if req.environ.get('QUERY_STRING'): + url += '?' + req.environ['QUERY_STRING'] + self.location = url + self.location = urlparse.urljoin(req.path_url, self.location) + return super(_HTTPMove, self).__call__( + environ, start_response) + +class HTTPMultipleChoices(_HTTPMove): + """ + subclass of :class:`~_HTTPMove` + + This indicates that the requested resource corresponds to any one + of a set of representations, each with its own specific location, + and agent-driven negotiation information is being provided so that + the user can select a preferred representation and redirect its + request to that location. + + code: 300, title: Multiple Choices + """ + code = 300 + title = 'Multiple Choices' + +class HTTPMovedPermanently(_HTTPMove): + """ + subclass of :class:`~_HTTPMove` + + This indicates that the requested resource has been assigned a new + permanent URI and any future references to this resource SHOULD use + one of the returned URIs. + + code: 301, title: Moved Permanently + """ + code = 301 + title = 'Moved Permanently' + +class HTTPFound(_HTTPMove): + """ + subclass of :class:`~_HTTPMove` + + This indicates that the requested resource resides temporarily under + a different URI. + + code: 302, title: Found + """ + code = 302 + title = 'Found' + explanation = 'The resource was found at' + +# This one is safe after a POST (the redirected location will be +# retrieved with GET): +class HTTPSeeOther(_HTTPMove): + """ + subclass of :class:`~_HTTPMove` + + This indicates that the response to the request can be found under + a different URI and SHOULD be retrieved using a GET method on that + resource. + + code: 303, title: See Other + """ + code = 303 + title = 'See Other' + +class HTTPNotModified(HTTPRedirection): + """ + subclass of :class:`~HTTPRedirection` + + This indicates that if the client has performed a conditional GET + request and access is allowed, but the document has not been + modified, the server SHOULD respond with this status code. + + code: 304, title: Not Modified + """ + # TODO: this should include a date or etag header + code = 304 + title = 'Not Modified' + empty_body = True + +class HTTPUseProxy(_HTTPMove): + """ + subclass of :class:`~_HTTPMove` + + This indicates that the requested resource MUST be accessed through + the proxy given by the Location field. + + code: 305, title: Use Proxy + """ + # Not a move, but looks a little like one + code = 305 + title = 'Use Proxy' + explanation = ( + 'The resource must be accessed through a proxy located at') + +class HTTPTemporaryRedirect(_HTTPMove): + """ + subclass of :class:`~_HTTPMove` + + This indicates that the requested resource resides temporarily + under a different URI. + + code: 307, title: Temporary Redirect + """ + code = 307 + title = 'Temporary Redirect' + +class HTTPPermanentRedirect(_HTTPMove): + """ + subclass of :class:`~_HTTPMove` + + This indicates that the requested resource resides permanently + under a different URI. + + code: 308, title: Permanent Redirect + """ + code = 308 + title = 'Permanent Redirect' + + +############################################################ +## 4xx client error +############################################################ + +class HTTPClientError(HTTPError): + """ + base class for the 400's, where the client is in error + + This is an error condition in which the client is presumed to be + in-error. This is an expected problem, and thus is not considered + a bug. A server-side traceback is not warranted. Unless specialized, + this is a '400 Bad Request' + + code: 400, title: Bad Request + """ + code = 400 + title = 'Bad Request' + explanation = ('The server could not comply with the request since\r\n' + 'it is either malformed or otherwise incorrect.\r\n') + +class HTTPBadRequest(HTTPClientError): + pass + +class HTTPUnauthorized(HTTPClientError): + """ + subclass of :class:`~HTTPClientError` + + This indicates that the request requires user authentication. + + code: 401, title: Unauthorized + """ + code = 401 + title = 'Unauthorized' + explanation = ( + 'This server could not verify that you are authorized to\r\n' + 'access the document you requested. Either you supplied the\r\n' + 'wrong credentials (e.g., bad password), or your browser\r\n' + 'does not understand how to supply the credentials required.\r\n') + +class HTTPPaymentRequired(HTTPClientError): + """ + subclass of :class:`~HTTPClientError` + + code: 402, title: Payment Required + """ + code = 402 + title = 'Payment Required' + explanation = ('Access was denied for financial reasons.') + +class HTTPForbidden(HTTPClientError): + """ + subclass of :class:`~HTTPClientError` + + This indicates that the server understood the request, but is + refusing to fulfill it. + + code: 403, title: Forbidden + """ + code = 403 + title = 'Forbidden' + explanation = ('Access was denied to this resource.') + +class HTTPNotFound(HTTPClientError): + """ + subclass of :class:`~HTTPClientError` + + This indicates that the server did not find anything matching the + Request-URI. + + code: 404, title: Not Found + """ + code = 404 + title = 'Not Found' + explanation = ('The resource could not be found.') + +class HTTPMethodNotAllowed(HTTPClientError): + """ + subclass of :class:`~HTTPClientError` + + This indicates that the method specified in the Request-Line is + not allowed for the resource identified by the Request-URI. + + code: 405, title: Method Not Allowed + """ + code = 405 + title = 'Method Not Allowed' + # override template since we need an environment variable + body_template_obj = Template('''\ +The method ${REQUEST_METHOD} is not allowed for this resource.

+${detail}''') + +class HTTPNotAcceptable(HTTPClientError): + """ + subclass of :class:`~HTTPClientError` + + This indicates the resource identified by the request is only + capable of generating response entities which have content + characteristics not acceptable according to the accept headers + sent in the request. + + code: 406, title: Not Acceptable + """ + code = 406 + title = 'Not Acceptable' + # override template since we need an environment variable + body_template_obj = Template('''\ +The resource could not be generated that was acceptable to your browser +(content of type ${HTTP_ACCEPT}.

+${detail}''') + +class HTTPProxyAuthenticationRequired(HTTPClientError): + """ + subclass of :class:`~HTTPClientError` + + This is similar to 401, but indicates that the client must first + authenticate itself with the proxy. + + code: 407, title: Proxy Authentication Required + """ + code = 407 + title = 'Proxy Authentication Required' + explanation = ('Authentication with a local proxy is needed.') + +class HTTPRequestTimeout(HTTPClientError): + """ + subclass of :class:`~HTTPClientError` + + This indicates that the client did not produce a request within + the time that the server was prepared to wait. + + code: 408, title: Request Timeout + """ + code = 408 + title = 'Request Timeout' + explanation = ('The server has waited too long for the request to ' + 'be sent by the client.') + +class HTTPConflict(HTTPClientError): + """ + subclass of :class:`~HTTPClientError` + + This indicates that the request could not be completed due to a + conflict with the current state of the resource. + + code: 409, title: Conflict + """ + code = 409 + title = 'Conflict' + explanation = ('There was a conflict when trying to complete ' + 'your request.') + +class HTTPGone(HTTPClientError): + """ + subclass of :class:`~HTTPClientError` + + This indicates that the requested resource is no longer available + at the server and no forwarding address is known. + + code: 410, title: Gone + """ + code = 410 + title = 'Gone' + explanation = ('This resource is no longer available. No forwarding ' + 'address is given.') + +class HTTPLengthRequired(HTTPClientError): + """ + subclass of :class:`~HTTPClientError` + + This indicates that the the server refuses to accept the request + without a defined Content-Length. + + code: 411, title: Length Required + """ + code = 411 + title = 'Length Required' + explanation = ('Content-Length header required.') + +class HTTPPreconditionFailed(HTTPClientError): + """ + subclass of :class:`~HTTPClientError` + + This indicates that the precondition given in one or more of the + request-header fields evaluated to false when it was tested on the + server. + + code: 412, title: Precondition Failed + """ + code = 412 + title = 'Precondition Failed' + explanation = ('Request precondition failed.') + +class HTTPRequestEntityTooLarge(HTTPClientError): + """ + subclass of :class:`~HTTPClientError` + + This indicates that the server is refusing to process a request + because the request entity is larger than the server is willing or + able to process. + + code: 413, title: Request Entity Too Large + """ + code = 413 + title = 'Request Entity Too Large' + explanation = ('The body of your request was too large for this server.') + +class HTTPRequestURITooLong(HTTPClientError): + """ + subclass of :class:`~HTTPClientError` + + This indicates that the server is refusing to service the request + because the Request-URI is longer than the server is willing to + interpret. + + code: 414, title: Request-URI Too Long + """ + code = 414 + title = 'Request-URI Too Long' + explanation = ('The request URI was too long for this server.') + +class HTTPUnsupportedMediaType(HTTPClientError): + """ + subclass of :class:`~HTTPClientError` + + This indicates that the server is refusing to service the request + because the entity of the request is in a format not supported by + the requested resource for the requested method. + + code: 415, title: Unsupported Media Type + """ + code = 415 + title = 'Unsupported Media Type' + # override template since we need an environment variable + body_template_obj = Template('''\ +The request media type ${CONTENT_TYPE} is not supported by this server. +

+${detail}''') + +class HTTPRequestRangeNotSatisfiable(HTTPClientError): + """ + subclass of :class:`~HTTPClientError` + + The server SHOULD return a response with this status code if a + request included a Range request-header field, and none of the + range-specifier values in this field overlap the current extent + of the selected resource, and the request did not include an + If-Range request-header field. + + code: 416, title: Request Range Not Satisfiable + """ + code = 416 + title = 'Request Range Not Satisfiable' + explanation = ('The Range requested is not available.') + +class HTTPExpectationFailed(HTTPClientError): + """ + subclass of :class:`~HTTPClientError` + + This indidcates that the expectation given in an Expect + request-header field could not be met by this server. + + code: 417, title: Expectation Failed + """ + code = 417 + title = 'Expectation Failed' + explanation = ('Expectation failed.') + +class HTTPUnprocessableEntity(HTTPClientError): + """ + subclass of :class:`~HTTPClientError` + + This indicates that the server is unable to process the contained + instructions. + + code: 422, title: Unprocessable Entity + """ + ## Note: from WebDAV + code = 422 + title = 'Unprocessable Entity' + explanation = 'Unable to process the contained instructions' + +class HTTPLocked(HTTPClientError): + """ + subclass of :class:`~HTTPClientError` + + This indicates that the resource is locked. + + code: 423, title: Locked + """ + ## Note: from WebDAV + code = 423 + title = 'Locked' + explanation = ('The resource is locked') + +class HTTPFailedDependency(HTTPClientError): + """ + subclass of :class:`~HTTPClientError` + + This indicates that the method could not be performed because the + requested action depended on another action and that action failed. + + code: 424, title: Failed Dependency + """ + ## Note: from WebDAV + code = 424 + title = 'Failed Dependency' + explanation = ( + 'The method could not be performed because the requested ' + 'action dependended on another action and that action failed') + +class HTTPPreconditionRequired(HTTPClientError): + """ + subclass of :class:`~HTTPClientError` + + This indicates that the origin server requires the request to be + conditional. From RFC 6585, "Additional HTTP Status Codes". + + code: 428, title: Precondition Required + """ + code = 428 + title = 'Precondition Required' + explanation = ('This request is required to be conditional') + +class HTTPTooManyRequests(HTTPClientError): + """ + subclass of :class:`~HTTPClientError` + + This indicates that the client has sent too many requests in a + given amount of time. Useful for rate limiting. + + From RFC 6585, "Additional HTTP Status Codes". + + code: 429, title: Too Many Requests + """ + code = 429 + title = 'Too Many Requests' + explanation = ( + 'The client has sent too many requests in a given amount of time') + +class HTTPRequestHeaderFieldsTooLarge(HTTPClientError): + """ + subclass of :class:`~HTTPClientError` + + This indicates that the server is unwilling to process the request + because its header fields are too large. The request may be resubmitted + after reducing the size of the request header fields. + + From RFC 6585, "Additional HTTP Status Codes". + + code: 431, title: Request Header Fields Too Large + """ + code = 431 + title = 'Request Header Fields Too Large' + explanation = ( + 'The request header fields were too large') + +class HTTPUnavailableForLegalReasons(HTTPClientError): + """ + subclass of :class:`~HTTPClientError` + + This indicates that the server is unable to process the request + because of legal reasons, e.g. censorship or government-mandated + blocked access. + + From the draft "A New HTTP Status Code for Legally-restricted Resources" + by Tim Bray: + + https://tools.ietf.org/html/draft-tbray-http-legally-restricted-status-00 + + code: 451, title: Unavailable For Legal Reasons + """ + code = 451 + title = 'Unavailable For Legal Reasons' + explanation = ('The resource is not available due to legal reasons.') + +############################################################ +## 5xx Server Error +############################################################ +# Response status codes beginning with the digit "5" indicate cases in +# which the server is aware that it has erred or is incapable of +# performing the request. Except when responding to a HEAD request, the +# server SHOULD include an entity containing an explanation of the error +# situation, and whether it is a temporary or permanent condition. User +# agents SHOULD display any included entity to the user. These response +# codes are applicable to any request method. + +class HTTPServerError(HTTPError): + """ + base class for the 500's, where the server is in-error + + This is an error condition in which the server is presumed to be + in-error. This is usually unexpected, and thus requires a traceback; + ideally, opening a support ticket for the customer. Unless specialized, + this is a '500 Internal Server Error' + """ + code = 500 + title = 'Internal Server Error' + explanation = ( + 'The server has either erred or is incapable of performing\r\n' + 'the requested operation.\r\n') + +class HTTPInternalServerError(HTTPServerError): + pass + +class HTTPNotImplemented(HTTPServerError): + """ + subclass of :class:`~HTTPServerError` + + This indicates that the server does not support the functionality + required to fulfill the request. + + code: 501, title: Not Implemented + """ + code = 501 + title = 'Not Implemented' + body_template_obj = Template(''' +The request method ${REQUEST_METHOD} is not implemented for this server.

+${detail}''') + +class HTTPBadGateway(HTTPServerError): + """ + subclass of :class:`~HTTPServerError` + + This indicates that the server, while acting as a gateway or proxy, + received an invalid response from the upstream server it accessed + in attempting to fulfill the request. + + code: 502, title: Bad Gateway + """ + code = 502 + title = 'Bad Gateway' + explanation = ('Bad gateway.') + +class HTTPServiceUnavailable(HTTPServerError): + """ + subclass of :class:`~HTTPServerError` + + This indicates that the server is currently unable to handle the + request due to a temporary overloading or maintenance of the server. + + code: 503, title: Service Unavailable + """ + code = 503 + title = 'Service Unavailable' + explanation = ('The server is currently unavailable. ' + 'Please try again at a later time.') + +class HTTPGatewayTimeout(HTTPServerError): + """ + subclass of :class:`~HTTPServerError` + + This indicates that the server, while acting as a gateway or proxy, + did not receive a timely response from the upstream server specified + by the URI (e.g. HTTP, FTP, LDAP) or some other auxiliary server + (e.g. DNS) it needed to access in attempting to complete the request. + + code: 504, title: Gateway Timeout + """ + code = 504 + title = 'Gateway Timeout' + explanation = ('The gateway has timed out.') + +class HTTPVersionNotSupported(HTTPServerError): + """ + subclass of :class:`~HTTPServerError` + + This indicates that the server does not support, or refuses to + support, the HTTP protocol version that was used in the request + message. + + code: 505, title: HTTP Version Not Supported + """ + code = 505 + title = 'HTTP Version Not Supported' + explanation = ('The HTTP version is not supported.') + +class HTTPInsufficientStorage(HTTPServerError): + """ + subclass of :class:`~HTTPServerError` + + This indicates that the server does not have enough space to save + the resource. + + code: 507, title: Insufficient Storage + """ + code = 507 + title = 'Insufficient Storage' + explanation = ('There was not enough space to save the resource') + +class HTTPNetworkAuthenticationRequired(HTTPServerError): + """ + subclass of :class:`~HTTPServerError` + + This indicates that the client needs to authenticate to gain + network access. From RFC 6585, "Additional HTTP Status Codes". + + code: 511, title: Network Authentication Required + """ + code = 511 + title = 'Network Authentication Required' + explanation = ('Network authentication is required') + +class HTTPExceptionMiddleware(object): + """ + Middleware that catches exceptions in the sub-application. This + does not catch exceptions in the app_iter; only during the initial + calling of the application. + + This should be put *very close* to applications that might raise + these exceptions. This should not be applied globally; letting + *expected* exceptions raise through the WSGI stack is dangerous. + """ + + def __init__(self, application): + self.application = application + def __call__(self, environ, start_response): + try: + return self.application(environ, start_response) + except HTTPException: + parent_exc_info = sys.exc_info() + def repl_start_response(status, headers, exc_info=None): + if exc_info is None: + exc_info = parent_exc_info + return start_response(status, headers, exc_info) + return parent_exc_info[1](environ, repl_start_response) + +try: + from paste import httpexceptions +except ImportError: # pragma: no cover + # Without Paste we don't need to do this fixup + pass +else: # pragma: no cover + for name in dir(httpexceptions): + obj = globals().get(name) + if (obj and isinstance(obj, type) and issubclass(obj, HTTPException) + and obj is not HTTPException + and obj is not WSGIHTTPException): + obj.__bases__ = obj.__bases__ + (getattr(httpexceptions, name),) + del name, obj, httpexceptions + +__all__ = ['HTTPExceptionMiddleware', 'status_map'] +status_map={} +for name, value in list(globals().items()): + if (isinstance(value, (type, class_types)) and + issubclass(value, HTTPException) + and not name.startswith('_')): + __all__.append(name) + if all(( + getattr(value, 'code', None), + value not in (HTTPRedirection, HTTPClientError, HTTPServerError), + issubclass( + value, + (HTTPOk, HTTPRedirection, HTTPClientError, HTTPServerError) + ) + )): + status_map[value.code]=value + if hasattr(value, 'explanation'): + value.explanation = ' '.join(value.explanation.strip().split()) +del name, value diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/webob/headers.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/webob/headers.py new file mode 100644 index 0000000000000000000000000000000000000000..19aa4a2a0372c08558c0cfea3f7ca3e92dcae1ec --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/webob/headers.py @@ -0,0 +1,151 @@ +from webob.compat import ( + MutableMapping, + iteritems_, + string_types, + ) +from webob.multidict import MultiDict + +__all__ = ['ResponseHeaders', 'EnvironHeaders'] + +class ResponseHeaders(MultiDict): + """ + Dictionary view on the response headerlist. + Keys are normalized for case and whitespace. + """ + def __getitem__(self, key): + key = key.lower() + for k, v in reversed(self._items): + if k.lower() == key: + return v + raise KeyError(key) + + def getall(self, key): + key = key.lower() + return [v for (k, v) in self._items if k.lower() == key] + + def mixed(self): + r = self.dict_of_lists() + for key, val in iteritems_(r): + if len(val) == 1: + r[key] = val[0] + return r + + def dict_of_lists(self): + r = {} + for key, val in iteritems_(self): + r.setdefault(key.lower(), []).append(val) + return r + + def __setitem__(self, key, value): + norm_key = key.lower() + self._items[:] = [(k, v) for (k, v) in self._items if k.lower() != norm_key] + self._items.append((key, value)) + + def __delitem__(self, key): + key = key.lower() + items = self._items + found = False + for i in range(len(items)-1, -1, -1): + if items[i][0].lower() == key: + del items[i] + found = True + if not found: + raise KeyError(key) + + def __contains__(self, key): + key = key.lower() + for k, v in self._items: + if k.lower() == key: + return True + return False + + has_key = __contains__ + + def setdefault(self, key, default=None): + c_key = key.lower() + for k, v in self._items: + if k.lower() == c_key: + return v + self._items.append((key, default)) + return default + + def pop(self, key, *args): + if len(args) > 1: + raise TypeError("pop expected at most 2 arguments, got %s" + % repr(1 + len(args))) + key = key.lower() + for i in range(len(self._items)): + if self._items[i][0].lower() == key: + v = self._items[i][1] + del self._items[i] + return v + if args: + return args[0] + else: + raise KeyError(key) + + + + + + +key2header = { + 'CONTENT_TYPE': 'Content-Type', + 'CONTENT_LENGTH': 'Content-Length', + 'HTTP_CONTENT_TYPE': 'Content_Type', + 'HTTP_CONTENT_LENGTH': 'Content_Length', +} + +header2key = dict([(v.upper(),k) for (k,v) in key2header.items()]) + +def _trans_key(key): + if not isinstance(key, string_types): + return None + elif key in key2header: + return key2header[key] + elif key.startswith('HTTP_'): + return key[5:].replace('_', '-').title() + else: + return None + +def _trans_name(name): + name = name.upper() + if name in header2key: + return header2key[name] + return 'HTTP_'+name.replace('-', '_') + +class EnvironHeaders(MutableMapping): + """An object that represents the headers as present in a + WSGI environment. + + This object is a wrapper (with no internal state) for a WSGI + request object, representing the CGI-style HTTP_* keys as a + dictionary. Because a CGI environment can only hold one value for + each key, this dictionary is single-valued (unlike outgoing + headers). + """ + + def __init__(self, environ): + self.environ = environ + + def __getitem__(self, hname): + return self.environ[_trans_name(hname)] + + def __setitem__(self, hname, value): + self.environ[_trans_name(hname)] = value + + def __delitem__(self, hname): + del self.environ[_trans_name(hname)] + + def keys(self): + return filter(None, map(_trans_key, self.environ)) + + def __contains__(self, hname): + return _trans_name(hname) in self.environ + + def __len__(self): + return len(list(self.keys())) + + def __iter__(self): + for k in self.keys(): + yield k diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/webob/multidict.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/webob/multidict.py new file mode 100644 index 0000000000000000000000000000000000000000..838434a514b87922f4dbadd11b1d82b8df3cbddb --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/webob/multidict.py @@ -0,0 +1,506 @@ +# (c) 2005 Ian Bicking and contributors; written for Paste +# (http://pythonpaste.org) Licensed under the MIT license: +# http://www.opensource.org/licenses/mit-license.php +""" +Gives a multi-value dictionary object (MultiDict) plus several wrappers +""" +import binascii +import warnings + +from webob.compat import ( + MutableMapping, + PY2, + iteritems_, + itervalues_, + url_encode, + ) + +__all__ = ['MultiDict', 'NestedMultiDict', 'NoVars', 'GetDict'] + +class MultiDict(MutableMapping): + """ + An ordered dictionary that can have multiple values for each key. + Adds the methods getall, getone, mixed and extend and add to the normal + dictionary interface. + """ + + def __init__(self, *args, **kw): + if len(args) > 1: + raise TypeError("MultiDict can only be called with one positional " + "argument") + if args: + if hasattr(args[0], 'iteritems'): + items = list(args[0].iteritems()) + elif hasattr(args[0], 'items'): + items = list(args[0].items()) + else: + items = list(args[0]) + self._items = items + else: + self._items = [] + if kw: + self._items.extend(kw.items()) + + @classmethod + def view_list(cls, lst): + """ + Create a dict that is a view on the given list + """ + if not isinstance(lst, list): + raise TypeError( + "%s.view_list(obj) takes only actual list objects, not %r" + % (cls.__name__, lst)) + obj = cls() + obj._items = lst + return obj + + @classmethod + def from_fieldstorage(cls, fs): + """ + Create a dict from a cgi.FieldStorage instance + """ + obj = cls() + # fs.list can be None when there's nothing to parse + for field in fs.list or (): + charset = field.type_options.get('charset', 'utf8') + transfer_encoding = field.headers.get('Content-Transfer-Encoding', None) + supported_transfer_encoding = { + 'base64' : binascii.a2b_base64, + 'quoted-printable' : binascii.a2b_qp + } + if not PY2: + if charset == 'utf8': + decode = lambda b: b + else: + decode = lambda b: b.encode('utf8').decode(charset) + else: + decode = lambda b: b.decode(charset) + if field.filename: + field.filename = decode(field.filename) + obj.add(field.name, field) + else: + value = field.value + if transfer_encoding in supported_transfer_encoding: + if not PY2: + # binascii accepts bytes + value = value.encode('utf8') + value = supported_transfer_encoding[transfer_encoding](value) + if not PY2: + # binascii returns bytes + value = value.decode('utf8') + obj.add(field.name, decode(value)) + return obj + + def __getitem__(self, key): + for k, v in reversed(self._items): + if k == key: + return v + raise KeyError(key) + + def __setitem__(self, key, value): + try: + del self[key] + except KeyError: + pass + self._items.append((key, value)) + + def add(self, key, value): + """ + Add the key and value, not overwriting any previous value. + """ + self._items.append((key, value)) + + def getall(self, key): + """ + Return a list of all values matching the key (may be an empty list) + """ + return [v for k, v in self._items if k == key] + + def getone(self, key): + """ + Get one value matching the key, raising a KeyError if multiple + values were found. + """ + v = self.getall(key) + if not v: + raise KeyError('Key not found: %r' % key) + if len(v) > 1: + raise KeyError('Multiple values match %r: %r' % (key, v)) + return v[0] + + def mixed(self): + """ + Returns a dictionary where the values are either single + values, or a list of values when a key/value appears more than + once in this dictionary. This is similar to the kind of + dictionary often used to represent the variables in a web + request. + """ + result = {} + multi = {} + for key, value in self.items(): + if key in result: + # We do this to not clobber any lists that are + # *actual* values in this dictionary: + if key in multi: + result[key].append(value) + else: + result[key] = [result[key], value] + multi[key] = None + else: + result[key] = value + return result + + def dict_of_lists(self): + """ + Returns a dictionary where each key is associated with a list of values. + """ + r = {} + for key, val in self.items(): + r.setdefault(key, []).append(val) + return r + + def __delitem__(self, key): + items = self._items + found = False + for i in range(len(items)-1, -1, -1): + if items[i][0] == key: + del items[i] + found = True + if not found: + raise KeyError(key) + + def __contains__(self, key): + for k, v in self._items: + if k == key: + return True + return False + + has_key = __contains__ + + def clear(self): + del self._items[:] + + def copy(self): + return self.__class__(self) + + def setdefault(self, key, default=None): + for k, v in self._items: + if key == k: + return v + self._items.append((key, default)) + return default + + def pop(self, key, *args): + if len(args) > 1: + raise TypeError("pop expected at most 2 arguments, got %s" + % repr(1 + len(args))) + for i in range(len(self._items)): + if self._items[i][0] == key: + v = self._items[i][1] + del self._items[i] + return v + if args: + return args[0] + else: + raise KeyError(key) + + def popitem(self): + return self._items.pop() + + def update(self, *args, **kw): + if args: + lst = args[0] + if len(lst) != len(dict(lst)): + # this does not catch the cases where we overwrite existing + # keys, but those would produce too many warning + msg = ("Behavior of MultiDict.update() has changed " + "and overwrites duplicate keys. Consider using .extend()" + ) + warnings.warn(msg, UserWarning, stacklevel=2) + MutableMapping.update(self, *args, **kw) + + def extend(self, other=None, **kwargs): + if other is None: + pass + elif hasattr(other, 'items'): + self._items.extend(other.items()) + elif hasattr(other, 'keys'): + for k in other.keys(): + self._items.append((k, other[k])) + else: + for k, v in other: + self._items.append((k, v)) + if kwargs: + self.update(kwargs) + + def __repr__(self): + items = map('(%r, %r)'.__mod__, _hide_passwd(self.items())) + return '%s([%s])' % (self.__class__.__name__, ', '.join(items)) + + def __len__(self): + return len(self._items) + + ## + ## All the iteration: + ## + + def iterkeys(self): + for k, v in self._items: + yield k + if PY2: + def keys(self): + return [k for k, v in self._items] + else: + keys = iterkeys + + __iter__ = iterkeys + + def iteritems(self): + return iter(self._items) + + if PY2: + def items(self): + return self._items[:] + else: + items = iteritems + + def itervalues(self): + for k, v in self._items: + yield v + + if PY2: + def values(self): + return [v for k, v in self._items] + else: + values = itervalues + +_dummy = object() + +class GetDict(MultiDict): +# def __init__(self, data, tracker, encoding, errors): +# d = lambda b: b.decode(encoding, errors) +# data = [(d(k), d(v)) for k,v in data] + def __init__(self, data, env): + self.env = env + MultiDict.__init__(self, data) + def on_change(self): + e = lambda t: t.encode('utf8') + data = [(e(k), e(v)) for k,v in self.items()] + qs = url_encode(data) + self.env['QUERY_STRING'] = qs + self.env['webob._parsed_query_vars'] = (self, qs) + def __setitem__(self, key, value): + MultiDict.__setitem__(self, key, value) + self.on_change() + def add(self, key, value): + MultiDict.add(self, key, value) + self.on_change() + def __delitem__(self, key): + MultiDict.__delitem__(self, key) + self.on_change() + def clear(self): + MultiDict.clear(self) + self.on_change() + def setdefault(self, key, default=None): + result = MultiDict.setdefault(self, key, default) + self.on_change() + return result + def pop(self, key, *args): + result = MultiDict.pop(self, key, *args) + self.on_change() + return result + def popitem(self): + result = MultiDict.popitem(self) + self.on_change() + return result + def update(self, *args, **kwargs): + MultiDict.update(self, *args, **kwargs) + self.on_change() + def extend(self, *args, **kwargs): + MultiDict.extend(self, *args, **kwargs) + self.on_change() + def __repr__(self): + items = map('(%r, %r)'.__mod__, _hide_passwd(self.items())) + # TODO: GET -> GetDict + return 'GET([%s])' % (', '.join(items)) + def copy(self): + # Copies shouldn't be tracked + return MultiDict(self) + +class NestedMultiDict(MultiDict): + """ + Wraps several MultiDict objects, treating it as one large MultiDict + """ + + def __init__(self, *dicts): + self.dicts = dicts + + def __getitem__(self, key): + for d in self.dicts: + value = d.get(key, _dummy) + if value is not _dummy: + return value + raise KeyError(key) + + def _readonly(self, *args, **kw): + raise KeyError("NestedMultiDict objects are read-only") + __setitem__ = _readonly + add = _readonly + __delitem__ = _readonly + clear = _readonly + setdefault = _readonly + pop = _readonly + popitem = _readonly + update = _readonly + + def getall(self, key): + result = [] + for d in self.dicts: + result.extend(d.getall(key)) + return result + + # Inherited: + # getone + # mixed + # dict_of_lists + + def copy(self): + return MultiDict(self) + + def __contains__(self, key): + for d in self.dicts: + if key in d: + return True + return False + + has_key = __contains__ + + def __len__(self): + v = 0 + for d in self.dicts: + v += len(d) + return v + + def __nonzero__(self): + for d in self.dicts: + if d: + return True + return False + + def iteritems(self): + for d in self.dicts: + for item in iteritems_(d): + yield item + if PY2: + def items(self): + return list(self.iteritems()) + else: + items = iteritems + + def itervalues(self): + for d in self.dicts: + for value in itervalues_(d): + yield value + if PY2: + def values(self): + return list(self.itervalues()) + else: + values = itervalues + + def __iter__(self): + for d in self.dicts: + for key in d: + yield key + + iterkeys = __iter__ + + if PY2: + def keys(self): + return list(self.iterkeys()) + else: + keys = iterkeys + +class NoVars(object): + """ + Represents no variables; used when no variables + are applicable. + + This is read-only + """ + + def __init__(self, reason=None): + self.reason = reason or 'N/A' + + def __getitem__(self, key): + raise KeyError("No key %r: %s" % (key, self.reason)) + + def __setitem__(self, *args, **kw): + raise KeyError("Cannot add variables: %s" % self.reason) + + add = __setitem__ + setdefault = __setitem__ + update = __setitem__ + + def __delitem__(self, *args, **kw): + raise KeyError("No keys to delete: %s" % self.reason) + clear = __delitem__ + pop = __delitem__ + popitem = __delitem__ + + def get(self, key, default=None): + return default + + def getall(self, key): + return [] + + def getone(self, key): + return self[key] + + def mixed(self): + return {} + dict_of_lists = mixed + + def __contains__(self, key): + return False + has_key = __contains__ + + def copy(self): + return self + + def __repr__(self): + return '<%s: %s>' % (self.__class__.__name__, + self.reason) + + def __len__(self): + return 0 + + def iterkeys(self): + return iter([]) + + if PY2: + def __cmp__(self, other): + return cmp({}, other) + + def keys(self): + return [] + items = keys + values = keys + itervalues = iterkeys + iteritems = iterkeys + else: + keys = iterkeys + items = iterkeys + values = iterkeys + + __iter__ = iterkeys + +def _hide_passwd(items): + for k, v in items: + if ('password' in k + or 'passwd' in k + or 'pwd' in k + ): + yield k, '******' + else: + yield k, v diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/webob/request.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/webob/request.py new file mode 100644 index 0000000000000000000000000000000000000000..343f282206d598c383adf7cc1a48e36559834cb0 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/webob/request.py @@ -0,0 +1,1742 @@ +import binascii +import io +import os +import re +import sys +import tempfile +import mimetypes +try: + import simplejson as json +except ImportError: + import json +import warnings + +from webob.acceptparse import ( + accept_charset_property, + accept_encoding_property, + accept_language_property, + accept_property, + ) + +from webob.cachecontrol import ( + CacheControl, + serialize_cache_control, + ) + +from webob.compat import ( + PY2, + bytes_, + native_, + parse_qsl_text, + reraise, + text_type, + url_encode, + url_quote, + url_unquote, + quote_plus, + urlparse, + cgi_FieldStorage + ) + +from webob.cookies import RequestCookies + +from webob.descriptors import ( + CHARSET_RE, + SCHEME_RE, + converter, + converter_date, + environ_getter, + environ_decoder, + parse_auth, + parse_int, + parse_int_safe, + parse_range, + serialize_auth, + serialize_if_range, + serialize_int, + serialize_range, + upath_property, + ) + +from webob.etag import ( + IfRange, + AnyETag, + NoETag, + etag_property, + ) + +from webob.headers import EnvironHeaders + +from webob.multidict import ( + NestedMultiDict, + MultiDict, + NoVars, + GetDict, + ) + +__all__ = ['BaseRequest', 'Request', 'LegacyRequest'] + +class _NoDefault: + def __repr__(self): + return '(No Default)' +NoDefault = _NoDefault() + +PATH_SAFE = "/~!$&'()*+,;=:@" + +_LATIN_ENCODINGS = ( + 'ascii', 'latin-1', 'latin', 'latin_1', 'l1', 'latin1', + 'iso-8859-1', 'iso8859_1', 'iso_8859_1', 'iso8859', '8859', + ) + +class BaseRequest(object): + # The limit after which request bodies should be stored on disk + # if they are read in (under this, and the request body is stored + # in memory): + request_body_tempfile_limit = 10 * 1024 + + _charset = None + + def __init__(self, environ, charset=None, unicode_errors=None, + decode_param_names=None, **kw): + + if type(environ) is not dict: + raise TypeError( + "WSGI environ must be a dict; you passed %r" % (environ,)) + + if unicode_errors is not None: + warnings.warn( + "You unicode_errors=%r to the Request constructor. Passing a " + "``unicode_errors`` value to the Request is no longer " + "supported in WebOb 1.2+. This value has been ignored " % ( + unicode_errors,), + DeprecationWarning + ) + + if decode_param_names is not None: + warnings.warn( + "You passed decode_param_names=%r to the Request constructor. " + "Passing a ``decode_param_names`` value to the Request " + "is no longer supported in WebOb 1.2+. This value has " + "been ignored " % (decode_param_names,), + DeprecationWarning + ) + + if not _is_utf8(charset): + raise DeprecationWarning( + "You passed charset=%r to the Request constructor. As of " + "WebOb 1.2, if your application needs a non-UTF-8 request " + "charset, please construct the request without a charset or " + "with a charset of 'None', then use ``req = " + "req.decode(charset)``" % charset + ) + + d = self.__dict__ + d['environ'] = environ + + if kw: + cls = self.__class__ + + if 'method' in kw: + # set method first, because .body setters + # depend on it for checks + self.method = kw.pop('method') + + for name, value in kw.items(): + if not hasattr(cls, name): + raise TypeError( + "Unexpected keyword: %s=%r" % (name, value)) + setattr(self, name, value) + + def encget(self, key, default=NoDefault, encattr=None): + val = self.environ.get(key, default) + if val is NoDefault: + raise KeyError(key) + if val is default: + return default + if not encattr: + return val + encoding = getattr(self, encattr) + + if PY2: + return val.decode(encoding) + + if encoding in _LATIN_ENCODINGS: # shortcut + return val + return bytes_(val, 'latin-1').decode(encoding) + + def encset(self, key, val, encattr=None): + if encattr: + encoding = getattr(self, encattr) + else: + encoding = 'ascii' + if PY2: # pragma: no cover + self.environ[key] = bytes_(val, encoding) + else: + self.environ[key] = bytes_(val, encoding).decode('latin-1') + + @property + def charset(self): + if self._charset is None: + charset = detect_charset(self._content_type_raw) + if _is_utf8(charset): + charset = 'UTF-8' + self._charset = charset + return self._charset + + @charset.setter + def charset(self, charset): + if _is_utf8(charset): + charset = 'UTF-8' + if charset != self.charset: + raise DeprecationWarning("Use req = req.decode(%r)" % charset) + + def decode(self, charset=None, errors='strict'): + charset = charset or self.charset + if charset == 'UTF-8': + return self + # cookies and path are always utf-8 + t = Transcoder(charset, errors) + + new_content_type = CHARSET_RE.sub('; charset="UTF-8"', + self._content_type_raw) + content_type = self.content_type + r = self.__class__( + self.environ.copy(), + query_string=t.transcode_query(self.query_string), + content_type=new_content_type, + ) + + if content_type == 'application/x-www-form-urlencoded': + r.body = bytes_(t.transcode_query(native_(self.body))) + return r + elif content_type != 'multipart/form-data': + return r + + fs_environ = self.environ.copy() + fs_environ.setdefault('CONTENT_LENGTH', '0') + fs_environ['QUERY_STRING'] = '' + if PY2: + fs = cgi_FieldStorage(fp=self.body_file, + environ=fs_environ, + keep_blank_values=True) + else: + fs = cgi_FieldStorage(fp=self.body_file, + environ=fs_environ, + keep_blank_values=True, + encoding=charset, + errors=errors) + + fout = t.transcode_fs(fs, r._content_type_raw) + + # this order is important, because setting body_file + # resets content_length + r.body_file = fout + r.content_length = fout.tell() + fout.seek(0) + return r + + # this is necessary for correct warnings depth for both + # BaseRequest and Request (due to AdhocAttrMixin.__setattr__) + _setattr_stacklevel = 2 + + @property + def body_file(self): + """ + Input stream of the request (wsgi.input). + Setting this property resets the content_length and seekable flag + (unlike setting req.body_file_raw). + """ + + if not self.is_body_readable: + return io.BytesIO() + + r = self.body_file_raw + clen = self.content_length + + if not self.is_body_seekable and clen is not None: + # we need to wrap input in LimitedLengthFile + # but we have to cache the instance as well + # otherwise this would stop working + # (.remaining counter would reset between calls): + # req.body_file.read(100) + # req.body_file.read(100) + env = self.environ + wrapped, raw = env.get('webob._body_file', (0, 0)) + + if raw is not r: + wrapped = LimitedLengthFile(r, clen) + wrapped = io.BufferedReader(wrapped) + env['webob._body_file'] = wrapped, r + r = wrapped + + return r + + @body_file.setter + def body_file(self, value): + if isinstance(value, bytes): + raise ValueError('Excepted fileobj but received bytes.') + + self.content_length = None + self.body_file_raw = value + self.is_body_seekable = False + self.is_body_readable = True + + @body_file.deleter + def body_file(self): + self.body = b'' + + body_file_raw = environ_getter('wsgi.input') + + @property + def body_file_seekable(self): + """ + Get the body of the request (wsgi.input) as a seekable file-like + object. Middleware and routing applications should use this + attribute over .body_file. + + If you access this value, CONTENT_LENGTH will also be updated. + """ + if not self.is_body_seekable: + self.make_body_seekable() + return self.body_file_raw + + url_encoding = environ_getter('webob.url_encoding', 'UTF-8') + scheme = environ_getter('wsgi.url_scheme') + method = environ_getter('REQUEST_METHOD', 'GET') + http_version = environ_getter('SERVER_PROTOCOL') + content_length = converter( + environ_getter('CONTENT_LENGTH', None, '14.13'), + parse_int_safe, serialize_int, 'int') + remote_user = environ_getter('REMOTE_USER', None) + remote_host = environ_getter('REMOTE_HOST', None) + remote_addr = environ_getter('REMOTE_ADDR', None) + query_string = environ_getter('QUERY_STRING', '') + server_name = environ_getter('SERVER_NAME') + server_port = converter( + environ_getter('SERVER_PORT'), + parse_int, serialize_int, 'int') + + script_name = environ_decoder('SCRIPT_NAME', '', encattr='url_encoding') + path_info = environ_decoder('PATH_INFO', encattr='url_encoding') + + # bw compat + uscript_name = script_name + upath_info = path_info + + _content_type_raw = environ_getter('CONTENT_TYPE', '') + + def _content_type__get(self): + """Return the content type, but leaving off any parameters (like + charset, but also things like the type in ``application/atom+xml; + type=entry``) + + If you set this property, you can include parameters, or if + you don't include any parameters in the value then existing + parameters will be preserved. + """ + return self._content_type_raw.split(';', 1)[0] + def _content_type__set(self, value=None): + if value is not None: + value = str(value) + if ';' not in value: + content_type = self._content_type_raw + if ';' in content_type: + value += ';' + content_type.split(';', 1)[1] + self._content_type_raw = value + + content_type = property(_content_type__get, + _content_type__set, + _content_type__set, + _content_type__get.__doc__) + + _headers = None + + def _headers__get(self): + """ + All the request headers as a case-insensitive dictionary-like + object. + """ + if self._headers is None: + self._headers = EnvironHeaders(self.environ) + return self._headers + + def _headers__set(self, value): + self.headers.clear() + self.headers.update(value) + + headers = property(_headers__get, _headers__set, doc=_headers__get.__doc__) + + @property + def client_addr(self): + """ + The effective client IP address as a string. If the + ``HTTP_X_FORWARDED_FOR`` header exists in the WSGI environ, this + attribute returns the client IP address present in that header + (e.g. if the header value is ``192.168.1.1, 192.168.1.2``, the value + will be ``192.168.1.1``). If no ``HTTP_X_FORWARDED_FOR`` header is + present in the environ at all, this attribute will return the value + of the ``REMOTE_ADDR`` header. If the ``REMOTE_ADDR`` header is + unset, this attribute will return the value ``None``. + + .. warning:: + + It is possible for user agents to put someone else's IP or just + any string in ``HTTP_X_FORWARDED_FOR`` as it is a normal HTTP + header. Forward proxies can also provide incorrect values (private + IP addresses etc). You cannot "blindly" trust the result of this + method to provide you with valid data unless you're certain that + ``HTTP_X_FORWARDED_FOR`` has the correct values. The WSGI server + must be behind a trusted proxy for this to be true. + """ + e = self.environ + xff = e.get('HTTP_X_FORWARDED_FOR') + if xff is not None: + addr = xff.split(',')[0].strip() + else: + addr = e.get('REMOTE_ADDR') + return addr + + @property + def host_port(self): + """ + The effective server port number as a string. If the ``HTTP_HOST`` + header exists in the WSGI environ, this attribute returns the port + number present in that header. If the ``HTTP_HOST`` header exists but + contains no explicit port number: if the WSGI url scheme is "https" , + this attribute returns "443", if the WSGI url scheme is "http", this + attribute returns "80" . If no ``HTTP_HOST`` header is present in + the environ at all, this attribute will return the value of the + ``SERVER_PORT`` header (which is guaranteed to be present). + """ + e = self.environ + host = e.get('HTTP_HOST') + if host is not None: + if ':' in host and host[-1] != ']': + host, port = host.rsplit(':', 1) + else: + url_scheme = e['wsgi.url_scheme'] + if url_scheme == 'https': + port = '443' + else: + port = '80' + else: + port = e['SERVER_PORT'] + return port + + @property + def host_url(self): + """ + The URL through the host (no path) + """ + e = self.environ + scheme = e.get('wsgi.url_scheme') + url = scheme + '://' + host = e.get('HTTP_HOST') + if host is not None: + if ':' in host and host[-1] != ']': + host, port = host.rsplit(':', 1) + else: + port = None + else: + host = e.get('SERVER_NAME') + port = e.get('SERVER_PORT') + if scheme == 'https': + if port == '443': + port = None + elif scheme == 'http': + if port == '80': + port = None + url += host + if port: + url += ':%s' % port + return url + + @property + def application_url(self): + """ + The URL including SCRIPT_NAME (no PATH_INFO or query string) + """ + bscript_name = bytes_(self.script_name, self.url_encoding) + return self.host_url + url_quote(bscript_name, PATH_SAFE) + + @property + def path_url(self): + """ + The URL including SCRIPT_NAME and PATH_INFO, but not QUERY_STRING + """ + bpath_info = bytes_(self.path_info, self.url_encoding) + return self.application_url + url_quote(bpath_info, PATH_SAFE) + + @property + def path(self): + """ + The path of the request, without host or query string + """ + bscript = bytes_(self.script_name, self.url_encoding) + bpath = bytes_(self.path_info, self.url_encoding) + return url_quote(bscript, PATH_SAFE) + url_quote(bpath, PATH_SAFE) + + @property + def path_qs(self): + """ + The path of the request, without host but with query string + """ + path = self.path + qs = self.environ.get('QUERY_STRING') + if qs: + path += '?' + qs + return path + + @property + def url(self): + """ + The full request URL, including QUERY_STRING + """ + url = self.path_url + qs = self.environ.get('QUERY_STRING') + if qs: + url += '?' + qs + return url + + def relative_url(self, other_url, to_application=False): + """ + Resolve other_url relative to the request URL. + + If ``to_application`` is True, then resolve it relative to the + URL with only SCRIPT_NAME + """ + if to_application: + url = self.application_url + if not url.endswith('/'): + url += '/' + else: + url = self.path_url + return urlparse.urljoin(url, other_url) + + def path_info_pop(self, pattern=None): + """ + 'Pops' off the next segment of PATH_INFO, pushing it onto + SCRIPT_NAME, and returning the popped segment. Returns None if + there is nothing left on PATH_INFO. + + Does not return ``''`` when there's an empty segment (like + ``/path//path``); these segments are just ignored. + + Optional ``pattern`` argument is a regexp to match the return value + before returning. If there is no match, no changes are made to the + request and None is returned. + """ + path = self.path_info + if not path: + return None + slashes = '' + while path.startswith('/'): + slashes += '/' + path = path[1:] + idx = path.find('/') + if idx == -1: + idx = len(path) + r = path[:idx] + if pattern is None or re.match(pattern, r): + self.script_name += slashes + r + self.path_info = path[idx:] + return r + + def path_info_peek(self): + """ + Returns the next segment on PATH_INFO, or None if there is no + next segment. Doesn't modify the environment. + """ + path = self.path_info + if not path: + return None + path = path.lstrip('/') + return path.split('/', 1)[0] + + def _urlvars__get(self): + """ + Return any *named* variables matched in the URL. + + Takes values from ``environ['wsgiorg.routing_args']``. + Systems like ``routes`` set this value. + """ + if 'paste.urlvars' in self.environ: + return self.environ['paste.urlvars'] + elif 'wsgiorg.routing_args' in self.environ: + return self.environ['wsgiorg.routing_args'][1] + else: + result = {} + self.environ['wsgiorg.routing_args'] = ((), result) + return result + + def _urlvars__set(self, value): + environ = self.environ + if 'wsgiorg.routing_args' in environ: + environ['wsgiorg.routing_args'] = ( + environ['wsgiorg.routing_args'][0], value) + if 'paste.urlvars' in environ: + del environ['paste.urlvars'] + elif 'paste.urlvars' in environ: + environ['paste.urlvars'] = value + else: + environ['wsgiorg.routing_args'] = ((), value) + + def _urlvars__del(self): + if 'paste.urlvars' in self.environ: + del self.environ['paste.urlvars'] + if 'wsgiorg.routing_args' in self.environ: + if not self.environ['wsgiorg.routing_args'][0]: + del self.environ['wsgiorg.routing_args'] + else: + self.environ['wsgiorg.routing_args'] = ( + self.environ['wsgiorg.routing_args'][0], {}) + + urlvars = property(_urlvars__get, + _urlvars__set, + _urlvars__del, + doc=_urlvars__get.__doc__) + + def _urlargs__get(self): + """ + Return any *positional* variables matched in the URL. + + Takes values from ``environ['wsgiorg.routing_args']``. + Systems like ``routes`` set this value. + """ + if 'wsgiorg.routing_args' in self.environ: + return self.environ['wsgiorg.routing_args'][0] + else: + # Since you can't update this value in-place, we don't need + # to set the key in the environment + return () + + def _urlargs__set(self, value): + environ = self.environ + if 'paste.urlvars' in environ: + # Some overlap between this and wsgiorg.routing_args; we need + # wsgiorg.routing_args to make this work + routing_args = (value, environ.pop('paste.urlvars')) + elif 'wsgiorg.routing_args' in environ: + routing_args = (value, environ['wsgiorg.routing_args'][1]) + else: + routing_args = (value, {}) + environ['wsgiorg.routing_args'] = routing_args + + def _urlargs__del(self): + if 'wsgiorg.routing_args' in self.environ: + if not self.environ['wsgiorg.routing_args'][1]: + del self.environ['wsgiorg.routing_args'] + else: + self.environ['wsgiorg.routing_args'] = ( + (), self.environ['wsgiorg.routing_args'][1]) + + urlargs = property(_urlargs__get, + _urlargs__set, + _urlargs__del, + _urlargs__get.__doc__) + + @property + def is_xhr(self): + """Is X-Requested-With header present and equal to ``XMLHttpRequest``? + + Note: this isn't set by every XMLHttpRequest request, it is + only set if you are using a Javascript library that sets it + (or you set the header yourself manually). Currently + Prototype and jQuery are known to set this header.""" + return self.environ.get('HTTP_X_REQUESTED_WITH', '') == 'XMLHttpRequest' + + def _host__get(self): + """Host name provided in HTTP_HOST, with fall-back to SERVER_NAME""" + if 'HTTP_HOST' in self.environ: + return self.environ['HTTP_HOST'] + else: + return '%(SERVER_NAME)s:%(SERVER_PORT)s' % self.environ + def _host__set(self, value): + self.environ['HTTP_HOST'] = value + def _host__del(self): + if 'HTTP_HOST' in self.environ: + del self.environ['HTTP_HOST'] + host = property(_host__get, _host__set, _host__del, doc=_host__get.__doc__) + + @property + def domain(self): + """ Returns the domain portion of the host value. Equivalent to: + + .. code-block:: python + + domain = request.host + if ':' in domain and domain[-1] != ']': # Check for ] because of IPv6 + domain = domain.rsplit(':', 1)[0] + + This will be equivalent to the domain portion of the ``HTTP_HOST`` + value in the environment if it exists, or the ``SERVER_NAME`` value in + the environment if it doesn't. For example, if the environment + contains an ``HTTP_HOST`` value of ``foo.example.com:8000``, + ``request.domain`` will return ``foo.example.com``. + + Note that this value cannot be *set* on the request. To set the host + value use :meth:`webob.request.Request.host` instead. + """ + domain = self.host + if ':' in domain and domain[-1] != ']': + domain = domain.rsplit(':', 1)[0] + return domain + + @property + def body(self): + """ + Return the content of the request body. + """ + if not self.is_body_readable: + return b'' + + self.make_body_seekable() # we need this to have content_length + r = self.body_file.read(self.content_length) + self.body_file_raw.seek(0) + return r + + @body.setter + def body(self, value): + if value is None: + value = b'' + if not isinstance(value, bytes): + raise TypeError("You can only set Request.body to bytes (not %r)" + % type(value)) + self.content_length = len(value) + self.body_file_raw = io.BytesIO(value) + self.is_body_seekable = True + + @body.deleter + def body(self): + self.body = b'' + + def _json_body__get(self): + """Access the body of the request as JSON""" + return json.loads(self.body.decode(self.charset)) + + def _json_body__set(self, value): + self.body = json.dumps(value, separators=(',', ':')).encode(self.charset) + + def _json_body__del(self): + del self.body + + json = json_body = property(_json_body__get, _json_body__set, _json_body__del) + + def _text__get(self): + """ + Get/set the text value of the body + """ + if not self.charset: + raise AttributeError( + "You cannot access Request.text unless charset is set") + body = self.body + return body.decode(self.charset) + + def _text__set(self, value): + if not self.charset: + raise AttributeError( + "You cannot access Response.text unless charset is set") + if not isinstance(value, text_type): + raise TypeError( + "You can only set Request.text to a unicode string " + "(not %s)" % type(value)) + self.body = value.encode(self.charset) + + def _text__del(self): + del self.body + + text = property(_text__get, _text__set, _text__del, doc=_text__get.__doc__) + + @property + def POST(self): + """ + Return a MultiDict containing all the variables from a form + request. Returns an empty dict-like object for non-form requests. + + Form requests are typically POST requests, however any other + requests with an appropriate Content-Type are also supported. + """ + env = self.environ + if 'webob._parsed_post_vars' in env: + vars, body_file = env['webob._parsed_post_vars'] + if body_file is self.body_file_raw: + return vars + content_type = self.content_type + if ((self.method != 'POST' and not content_type) + or content_type not in + ('', + 'application/x-www-form-urlencoded', + 'multipart/form-data') + ): + # Not an HTML form submission + return NoVars('Not an HTML form submission (Content-Type: %s)' + % content_type) + self._check_charset() + + self.make_body_seekable() + self.body_file_raw.seek(0) + + fs_environ = env.copy() + # FieldStorage assumes a missing CONTENT_LENGTH, but a + # default of 0 is better: + fs_environ.setdefault('CONTENT_LENGTH', '0') + fs_environ['QUERY_STRING'] = '' + if PY2: + fs = cgi_FieldStorage( + fp=self.body_file, + environ=fs_environ, + keep_blank_values=True) + else: + fs = cgi_FieldStorage( + fp=self.body_file, + environ=fs_environ, + keep_blank_values=True, + encoding='utf8') + + vars = MultiDict.from_fieldstorage(fs) + env['webob._parsed_post_vars'] = (vars, self.body_file_raw) + return vars + + @property + def GET(self): + """ + Return a MultiDict containing all the variables from the + QUERY_STRING. + """ + env = self.environ + source = env.get('QUERY_STRING', '') + if 'webob._parsed_query_vars' in env: + vars, qs = env['webob._parsed_query_vars'] + if qs == source: + return vars + + data = [] + if source: + # this is disabled because we want to access req.GET + # for text/plain; charset=ascii uploads for example + #self._check_charset() + data = parse_qsl_text(source) + #d = lambda b: b.decode('utf8') + #data = [(d(k), d(v)) for k,v in data] + vars = GetDict(data, env) + env['webob._parsed_query_vars'] = (vars, source) + return vars + + def _check_charset(self): + if self.charset != 'UTF-8': + raise DeprecationWarning( + "Requests are expected to be submitted in UTF-8, not %s. " + "You can fix this by doing req = req.decode('%s')" % ( + self.charset, self.charset) + ) + + @property + def params(self): + """ + A dictionary-like object containing both the parameters from + the query string and request body. + """ + params = NestedMultiDict(self.GET, self.POST) + return params + + @property + def cookies(self): + """ + Return a dictionary of cookies as found in the request. + """ + return RequestCookies(self.environ) + + @cookies.setter + def cookies(self, val): + self.environ.pop('HTTP_COOKIE', None) + r = RequestCookies(self.environ) + r.update(val) + + def copy(self): + """ + Copy the request and environment object. + + This only does a shallow copy, except of wsgi.input + """ + self.make_body_seekable() + env = self.environ.copy() + new_req = self.__class__(env) + new_req.copy_body() + return new_req + + def copy_get(self): + """ + Copies the request and environment object, but turning this request + into a GET along the way. If this was a POST request (or any other + verb) then it becomes GET, and the request body is thrown away. + """ + env = self.environ.copy() + return self.__class__(env, method='GET', content_type=None, + body=b'') + + # webob.is_body_seekable marks input streams that are seekable + # this way we can have seekable input without testing the .seek() method + is_body_seekable = environ_getter('webob.is_body_seekable', False) + + @property + def is_body_readable(self): + """ + webob.is_body_readable is a flag that tells us that we can read the + input stream even though CONTENT_LENGTH is missing. + """ + + clen = self.content_length + + if clen is not None and clen != 0: + return True + elif clen is None: + # Rely on the special flag that signifies that either Chunked + # Encoding is allowed (and works) or we have replaced + # self.body_file with something that is readable and EOF's + # correctly. + return self.environ.get( + 'wsgi.input_terminated', + # For backwards compatibility, we fall back to checking if + # webob.is_body_readable is set in the environ + self.environ.get( + 'webob.is_body_readable', + False + ) + ) + + return False + + @is_body_readable.setter + def is_body_readable(self, flag): + self.environ['wsgi.input_terminated'] = bool(flag) + + def make_body_seekable(self): + """ + This forces ``environ['wsgi.input']`` to be seekable. + That means that, the content is copied into a BytesIO or temporary + file and flagged as seekable, so that it will not be unnecessarily + copied again. + + After calling this method the .body_file is always seeked to the + start of file and .content_length is not None. + + The choice to copy to BytesIO is made from + ``self.request_body_tempfile_limit`` + """ + if self.is_body_seekable: + self.body_file_raw.seek(0) + else: + self.copy_body() + + def copy_body(self): + """ + Copies the body, in cases where it might be shared with another request + object and that is not desired. + + This copies the body either into a BytesIO object (through setting + req.body) or a temporary file. + """ + + if self.is_body_readable: + # Before we copy, if we can, rewind the body file + if self.is_body_seekable: + self.body_file_raw.seek(0) + + tempfile_limit = self.request_body_tempfile_limit + todo = self.content_length if self.content_length is not None else 65535 + + newbody = b'' + fileobj = None + input = self.body_file + + while todo > 0: + data = input.read(min(todo, 65535)) + + if not data and self.content_length is None: + # We attempted to read more data, but got none, break. + # This can happen if for instance we are reading as much as + # we can because we don't have a Content-Length... + break + elif not data: + # We have a Content-Length and we attempted to read, but + # there was nothing more to read. Oh the humanity! This + # should rarely if never happen because self.body_file + # should be a LimitedLengthFile which should already have + # raised if there was less data than expected. + raise DisconnectionError( + "Client disconnected (%s more bytes were expected)" % todo + ) + + if fileobj: + fileobj.write(data) + else: + newbody += data + + # When we have enough data that we need a tempfile, let's + # create one, then clear the temporary variable we were + # using + if len(newbody) > tempfile_limit: + fileobj = self.make_tempfile() + fileobj.write(newbody) + newbody = b'' + + # Only decrement todo if Content-Length is set + if self.content_length is not None: + todo -= len(data) + + if fileobj: + # We apparently had enough data to need a file + + # Set the Content-Length to the amount of data that was just + # written. + self.content_length = fileobj.tell() + + # Seek it back to the beginning + fileobj.seek(0) + + self.body_file_raw = fileobj + + # Allow it to be seeked in the future, so we don't need to copy + # for things like .body + self.is_body_seekable = True + + # Not strictly required since Content-Length is set + self.is_body_readable = True + else: + # No file created, set the body and let it deal with creating + # Content-Length and other vars. + self.body = newbody + else: + # Always leave the request with a valid body, and this is pretty + # cheap. + self.body = b'' + + def make_tempfile(self): + """ + Create a tempfile to store big request body. + This API is not stable yet. A 'size' argument might be added. + """ + return tempfile.TemporaryFile() + + def remove_conditional_headers(self, + remove_encoding=True, + remove_range=True, + remove_match=True, + remove_modified=True): + """ + Remove headers that make the request conditional. + + These headers can cause the response to be 304 Not Modified, + which in some cases you may not want to be possible. + + This does not remove headers like If-Match, which are used for + conflict detection. + """ + check_keys = [] + if remove_range: + check_keys += ['HTTP_IF_RANGE', 'HTTP_RANGE'] + if remove_match: + check_keys.append('HTTP_IF_NONE_MATCH') + if remove_modified: + check_keys.append('HTTP_IF_MODIFIED_SINCE') + if remove_encoding: + check_keys.append('HTTP_ACCEPT_ENCODING') + + for key in check_keys: + if key in self.environ: + del self.environ[key] + + accept = accept_property() + accept_charset = accept_charset_property() + accept_encoding = accept_encoding_property() + accept_language = accept_language_property() + + authorization = converter( + environ_getter('HTTP_AUTHORIZATION', None, '14.8'), + parse_auth, serialize_auth, + ) + + def _cache_control__get(self): + """ + Get/set/modify the Cache-Control header (`HTTP spec section 14.9 + `_) + """ + env = self.environ + value = env.get('HTTP_CACHE_CONTROL', '') + cache_header, cache_obj = env.get('webob._cache_control', (None, None)) + if cache_obj is not None and cache_header == value: + return cache_obj + cache_obj = CacheControl.parse(value, + updates_to=self._update_cache_control, + type='request') + env['webob._cache_control'] = (value, cache_obj) + return cache_obj + + def _cache_control__set(self, value): + env = self.environ + value = value or '' + if isinstance(value, dict): + value = CacheControl(value, type='request') + if isinstance(value, CacheControl): + str_value = str(value) + env['HTTP_CACHE_CONTROL'] = str_value + env['webob._cache_control'] = (str_value, value) + else: + env['HTTP_CACHE_CONTROL'] = str(value) + env['webob._cache_control'] = (None, None) + + def _cache_control__del(self): + env = self.environ + if 'HTTP_CACHE_CONTROL' in env: + del env['HTTP_CACHE_CONTROL'] + if 'webob._cache_control' in env: + del env['webob._cache_control'] + + def _update_cache_control(self, prop_dict): + self.environ['HTTP_CACHE_CONTROL'] = serialize_cache_control(prop_dict) + + cache_control = property(_cache_control__get, + _cache_control__set, + _cache_control__del, + doc=_cache_control__get.__doc__) + + + if_match = etag_property('HTTP_IF_MATCH', AnyETag, '14.24') + if_none_match = etag_property('HTTP_IF_NONE_MATCH', NoETag, '14.26', + strong=False) + + date = converter_date(environ_getter('HTTP_DATE', None, '14.8')) + if_modified_since = converter_date( + environ_getter('HTTP_IF_MODIFIED_SINCE', None, '14.25')) + if_unmodified_since = converter_date( + environ_getter('HTTP_IF_UNMODIFIED_SINCE', None, '14.28')) + if_range = converter( + environ_getter('HTTP_IF_RANGE', None, '14.27'), + IfRange.parse, serialize_if_range, 'IfRange object') + + + max_forwards = converter( + environ_getter('HTTP_MAX_FORWARDS', None, '14.31'), + parse_int, serialize_int, 'int') + + pragma = environ_getter('HTTP_PRAGMA', None, '14.32') + + range = converter( + environ_getter('HTTP_RANGE', None, '14.35'), + parse_range, serialize_range, 'Range object') + + referer = environ_getter('HTTP_REFERER', None, '14.36') + referrer = referer + + user_agent = environ_getter('HTTP_USER_AGENT', None, '14.43') + + def __repr__(self): + try: + name = '%s %s' % (self.method, self.url) + except KeyError: + name = '(invalid WSGI environ)' + msg = '<%s at 0x%x %s>' % ( + self.__class__.__name__, + abs(id(self)), name) + return msg + + def as_bytes(self, skip_body=False): + """ + Return HTTP bytes representing this request. + If skip_body is True, exclude the body. + If skip_body is an integer larger than one, skip body + only if its length is bigger than that number. + """ + url = self.url + host = self.host_url + assert url.startswith(host) + url = url[len(host):] + parts = [bytes_('%s %s %s' % (self.method, url, self.http_version))] + + # acquire body before we handle headers so that + # content-length will be set + body = None + if self.is_body_readable: + if skip_body > 1: + if len(self.body) > skip_body: + body = bytes_('' % len(self.body)) + else: + skip_body = False + if not skip_body: + body = self.body + + for k, v in sorted(self.headers.items()): + header = bytes_('%s: %s' % (k, v)) + parts.append(header) + + if body: + parts.extend([b'', body]) + # HTTP clearly specifies CRLF + return b'\r\n'.join(parts) + + def as_text(self): + bytes = self.as_bytes() + return bytes.decode(self.charset) + + __str__ = as_text + + @classmethod + def from_bytes(cls, b): + """ + Create a request from HTTP bytes data. If the bytes contain + extra data after the request, raise a ValueError. + """ + f = io.BytesIO(b) + r = cls.from_file(f) + if f.tell() != len(b): + raise ValueError("The string contains more data than expected") + return r + + @classmethod + def from_text(cls, s): + b = bytes_(s, 'utf-8') + return cls.from_bytes(b) + + @classmethod + def from_file(cls, fp): + """Read a request from a file-like object (it must implement + ``.read(size)`` and ``.readline()``). + + It will read up to the end of the request, not the end of the + file (unless the request is a POST or PUT and has no + Content-Length, in that case, the entire file is read). + + This reads the request as represented by ``str(req)``; it may + not read every valid HTTP request properly. + """ + start_line = fp.readline() + is_text = isinstance(start_line, text_type) + if is_text: + crlf = '\r\n' + colon = ':' + else: + crlf = b'\r\n' + colon = b':' + try: + header = start_line.rstrip(crlf) + method, resource, http_version = header.split(None, 2) + method = native_(method, 'utf-8') + resource = native_(resource, 'utf-8') + http_version = native_(http_version, 'utf-8') + except ValueError: + raise ValueError('Bad HTTP request line: %r' % start_line) + r = cls(environ_from_url(resource), + http_version=http_version, + method=method.upper() + ) + del r.environ['HTTP_HOST'] + while 1: + line = fp.readline() + if not line.strip(): + # end of headers + break + hname, hval = line.split(colon, 1) + hname = native_(hname, 'utf-8') + hval = native_(hval, 'utf-8').strip() + if hname in r.headers: + hval = r.headers[hname] + ', ' + hval + r.headers[hname] = hval + + clen = r.content_length + if clen is None: + body = fp.read() + else: + body = fp.read(clen) + if is_text: + body = bytes_(body, 'utf-8') + r.body = body + + return r + + def call_application(self, application, catch_exc_info=False): + """ + Call the given WSGI application, returning ``(status_string, + headerlist, app_iter)`` + + Be sure to call ``app_iter.close()`` if it's there. + + If catch_exc_info is true, then returns ``(status_string, + headerlist, app_iter, exc_info)``, where the fourth item may + be None, but won't be if there was an exception. If you don't + do this and there was an exception, the exception will be + raised directly. + """ + if self.is_body_seekable: + self.body_file_raw.seek(0) + captured = [] + output = [] + def start_response(status, headers, exc_info=None): + if exc_info is not None and not catch_exc_info: + reraise(exc_info) + captured[:] = [status, headers, exc_info] + return output.append + app_iter = application(self.environ, start_response) + if output or not captured: + try: + output.extend(app_iter) + finally: + if hasattr(app_iter, 'close'): + app_iter.close() + app_iter = output + if catch_exc_info: + return (captured[0], captured[1], app_iter, captured[2]) + else: + return (captured[0], captured[1], app_iter) + + # Will be filled in later: + ResponseClass = None + + def send(self, application=None, catch_exc_info=False): + """ + Like ``.call_application(application)``, except returns a + response object with ``.status``, ``.headers``, and ``.body`` + attributes. + + This will use ``self.ResponseClass`` to figure out the class + of the response object to return. + + If ``application`` is not given, this will send the request to + ``self.make_default_send_app()`` + """ + if application is None: + application = self.make_default_send_app() + if catch_exc_info: + status, headers, app_iter, exc_info = self.call_application( + application, catch_exc_info=True) + del exc_info + else: + status, headers, app_iter = self.call_application( + application, catch_exc_info=False) + return self.ResponseClass( + status=status, headerlist=list(headers), app_iter=app_iter) + + get_response = send + + def make_default_send_app(self): + global _client + try: + client = _client + except NameError: + from webob import client + _client = client + return client.send_request_app + + @classmethod + def blank(cls, path, environ=None, base_url=None, + headers=None, POST=None, **kw): + """ + Create a blank request environ (and Request wrapper) with the + given path (path should be urlencoded), and any keys from + environ. + + The path will become path_info, with any query string split + off and used. + + All necessary keys will be added to the environ, but the + values you pass in will take precedence. If you pass in + base_url then wsgi.url_scheme, HTTP_HOST, and SCRIPT_NAME will + be filled in from that value. + + Any extra keyword will be passed to ``__init__``. + """ + env = environ_from_url(path) + if base_url: + scheme, netloc, path, query, fragment = urlparse.urlsplit(base_url) + if query or fragment: + raise ValueError( + "base_url (%r) cannot have a query or fragment" + % base_url) + if scheme: + env['wsgi.url_scheme'] = scheme + if netloc: + if ':' not in netloc: + if scheme == 'http': + netloc += ':80' + elif scheme == 'https': + netloc += ':443' + else: + raise ValueError( + "Unknown scheme: %r" % scheme) + host, port = netloc.split(':', 1) + env['SERVER_PORT'] = port + env['SERVER_NAME'] = host + env['HTTP_HOST'] = netloc + if path: + env['SCRIPT_NAME'] = url_unquote(path) + if environ: + env.update(environ) + content_type = kw.get('content_type', env.get('CONTENT_TYPE')) + if headers and 'Content-Type' in headers: + content_type = headers['Content-Type'] + if content_type is not None: + kw['content_type'] = content_type + environ_add_POST(env, POST, content_type=content_type) + obj = cls(env, **kw) + if headers is not None: + obj.headers.update(headers) + return obj + +class LegacyRequest(BaseRequest): + uscript_name = upath_property('SCRIPT_NAME') + upath_info = upath_property('PATH_INFO') + + def encget(self, key, default=NoDefault, encattr=None): + val = self.environ.get(key, default) + if val is NoDefault: + raise KeyError(key) + if val is default: + return default + return val + +class AdhocAttrMixin(object): + _setattr_stacklevel = 3 + + def __setattr__(self, attr, value, DEFAULT=object()): + if (getattr(self.__class__, attr, DEFAULT) is not DEFAULT or + attr.startswith('_')): + object.__setattr__(self, attr, value) + else: + self.environ.setdefault('webob.adhoc_attrs', {})[attr] = value + + def __getattr__(self, attr, DEFAULT=object()): + try: + return self.environ['webob.adhoc_attrs'][attr] + except KeyError: + raise AttributeError(attr) + + def __delattr__(self, attr, DEFAULT=object()): + if getattr(self.__class__, attr, DEFAULT) is not DEFAULT: + return object.__delattr__(self, attr) + try: + del self.environ['webob.adhoc_attrs'][attr] + except KeyError: + raise AttributeError(attr) + +class Request(AdhocAttrMixin, BaseRequest): + """ The default request implementation """ + +def environ_from_url(path): + if SCHEME_RE.search(path): + scheme, netloc, path, qs, fragment = urlparse.urlsplit(path) + if fragment: + raise TypeError("Path cannot contain a fragment (%r)" % fragment) + if qs: + path += '?' + qs + if ':' not in netloc: + if scheme == 'http': + netloc += ':80' + elif scheme == 'https': + netloc += ':443' + else: + raise TypeError("Unknown scheme: %r" % scheme) + else: + scheme = 'http' + netloc = 'localhost:80' + if path and '?' in path: + path_info, query_string = path.split('?', 1) + path_info = url_unquote(path_info) + else: + path_info = url_unquote(path) + query_string = '' + env = { + 'REQUEST_METHOD': 'GET', + 'SCRIPT_NAME': '', + 'PATH_INFO': path_info or '', + 'QUERY_STRING': query_string, + 'SERVER_NAME': netloc.split(':')[0], + 'SERVER_PORT': netloc.split(':')[1], + 'HTTP_HOST': netloc, + 'SERVER_PROTOCOL': 'HTTP/1.0', + 'wsgi.version': (1, 0), + 'wsgi.url_scheme': scheme, + 'wsgi.input': io.BytesIO(), + 'wsgi.errors': sys.stderr, + 'wsgi.multithread': False, + 'wsgi.multiprocess': False, + 'wsgi.run_once': False, + #'webob.is_body_seekable': True, + } + return env + + +def environ_add_POST(env, data, content_type=None): + if data is None: + return + elif isinstance(data, text_type): + data = data.encode('ascii') + if env['REQUEST_METHOD'] not in ('POST', 'PUT'): + env['REQUEST_METHOD'] = 'POST' + has_files = False + if hasattr(data, 'items'): + data = list(data.items()) + for k, v in data: + if isinstance(v, (tuple, list)): + has_files = True + break + if content_type is None: + if has_files: + content_type = 'multipart/form-data' + else: + content_type = 'application/x-www-form-urlencoded' + if content_type.startswith('multipart/form-data'): + if not isinstance(data, bytes): + content_type, data = _encode_multipart(data, content_type) + elif content_type.startswith('application/x-www-form-urlencoded'): + if has_files: + raise ValueError('Submiting files is not allowed for' + ' content type `%s`' % content_type) + if not isinstance(data, bytes): + data = url_encode(data) + else: + if not isinstance(data, bytes): + raise ValueError('Please provide `POST` data as bytes' + ' for content type `%s`' % content_type) + data = bytes_(data, 'utf8') + env['wsgi.input'] = io.BytesIO(data) + env['webob.is_body_seekable'] = True + env['CONTENT_LENGTH'] = str(len(data)) + env['CONTENT_TYPE'] = content_type + + +# +# Helper classes and monkeypatching +# + +class DisconnectionError(IOError): + pass + + +class LimitedLengthFile(io.RawIOBase): + def __init__(self, file, maxlen): + self.file = file + self.maxlen = maxlen + self.remaining = maxlen + + def __repr__(self): + return '<%s(%r, maxlen=%s)>' % ( + self.__class__.__name__, + self.file, + self.maxlen + ) + + def fileno(self): + return self.file.fileno() + + @staticmethod + def readable(): + return True + + def readinto(self, buff): + if not self.remaining: + return 0 + sz0 = min(len(buff), self.remaining) + data = self.file.read(sz0) + sz = len(data) + self.remaining -= sz + if sz < sz0 and self.remaining: + raise DisconnectionError( + "The client disconnected while sending the body " + "(%d more bytes were expected)" % (self.remaining,) + ) + buff[:sz] = data + return sz + + +def _cgi_FieldStorage__repr__patch(self): + """ monkey patch for FieldStorage.__repr__ + + Unbelievably, the default __repr__ on FieldStorage reads + the entire file content instead of being sane about it. + This is a simple replacement that doesn't do that + """ + if self.file: + return "FieldStorage(%r, %r)" % (self.name, self.filename) + return "FieldStorage(%r, %r, %r)" % (self.name, self.filename, self.value) + +cgi_FieldStorage.__repr__ = _cgi_FieldStorage__repr__patch + + +class FakeCGIBody(io.RawIOBase): + def __init__(self, vars, content_type): + warnings.warn( + "FakeCGIBody is no longer used by WebOb and will be removed from a future " + "version of WebOb. If you require FakeCGIBody please make a copy into " + "you own project", + DeprecationWarning + ) + + if content_type.startswith('multipart/form-data'): + if not _get_multipart_boundary(content_type): + raise ValueError('Content-type: %r does not contain boundary' + % content_type) + self.vars = vars + self.content_type = content_type + self.file = None + + def __repr__(self): + inner = repr(self.vars) + if len(inner) > 20: + inner = inner[:15] + '...' + inner[-5:] + return '<%s at 0x%x viewing %s>' % ( + self.__class__.__name__, + abs(id(self)), inner) + + def fileno(self): + return None + + @staticmethod + def readable(): + return True + + def readinto(self, buff): + if self.file is None: + if self.content_type.startswith('application/x-www-form-urlencoded'): + data = '&'.join( + '%s=%s' % ( + quote_plus(bytes_(k, 'utf8')), + quote_plus(bytes_(v, 'utf8')) + ) + for k, v in self.vars.items() + ) + self.file = io.BytesIO(bytes_(data)) + elif self.content_type.startswith('multipart/form-data'): + self.file = _encode_multipart( + self.vars.items(), + self.content_type, + fout=io.BytesIO() + )[1] + self.file.seek(0) + else: + assert 0, ('Bad content type: %r' % self.content_type) + return self.file.readinto(buff) + +def _get_multipart_boundary(ctype): + m = re.search(r'boundary=([^ ]+)', ctype, re.I) + if m: + return native_(m.group(1).strip('"')) + +def _encode_multipart(vars, content_type, fout=None): + """Encode a multipart request body into a string""" + f = fout or io.BytesIO() + w = f.write + def wt(t): + w(t.encode('utf8')) + + CRLF = b'\r\n' + boundary = _get_multipart_boundary(content_type) + if not boundary: + boundary = native_(binascii.hexlify(os.urandom(10))) + content_type += ('; boundary=%s' % boundary) + for name, value in vars: + w(b'--') + wt(boundary) + w(CRLF) + wt('Content-Disposition: form-data') + if name is not None: + wt('; name="%s"' % name) + filename = None + if getattr(value, 'filename', None): + filename = value.filename + elif isinstance(value, (list, tuple)): + filename, value = value + if hasattr(value, 'read'): + value = value.read() + + if filename is not None: + wt('; filename="%s"' % filename) + mime_type = mimetypes.guess_type(filename)[0] + else: + mime_type = None + + w(CRLF) + + # TODO: should handle value.disposition_options + if getattr(value, 'type', None): + wt('Content-type: %s' % value.type) + if value.type_options: + for ct_name, ct_value in sorted(value.type_options.items()): + wt('; %s="%s"' % (ct_name, ct_value)) + w(CRLF) + elif mime_type: + wt('Content-type: %s' % mime_type) + w(CRLF) + w(CRLF) + if hasattr(value, 'value'): + value = value.value + if isinstance(value, bytes): + w(value) + else: + wt(value) + w(CRLF) + wt('--%s--' % boundary) + if fout: + return content_type, fout + else: + return content_type, f.getvalue() + +def detect_charset(ctype): + m = CHARSET_RE.search(ctype) + if m: + return m.group(1).strip('"').strip() + +def _is_utf8(charset): + if not charset: + return True + else: + return charset.lower().replace('-', '') == 'utf8' + + +class Transcoder(object): + def __init__(self, charset, errors='strict'): + self.charset = charset # source charset + self.errors = errors # unicode errors + self._trans = lambda b: b.decode(charset, errors).encode('utf8') + + def transcode_query(self, q): + q_orig = q + if '=' not in q: + # this doesn't look like a form submission + return q_orig + + if PY2: + q = urlparse.parse_qsl(q, self.charset) + t = self._trans + q = [(t(k), t(v)) for k, v in q] + else: + q = list(parse_qsl_text(q, self.charset)) + + return url_encode(q) + + def transcode_fs(self, fs, content_type): + # transcode FieldStorage + if PY2: + def decode(b): + if b is not None: + return b.decode(self.charset, self.errors) + else: + return b + else: + def decode(b): + return b + + data = [] + for field in fs.list or (): + field.name = decode(field.name) + if field.filename: + field.filename = decode(field.filename) + data.append((field.name, field)) + else: + data.append((field.name, decode(field.value))) + + # TODO: transcode big requests to temp file + content_type, fout = _encode_multipart( + data, + content_type, + fout=io.BytesIO() + ) + return fout diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/webob/response.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/webob/response.py new file mode 100644 index 0000000000000000000000000000000000000000..efc38ecfc39af9bc3a2e854eb690a656de0dbef8 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/webob/response.py @@ -0,0 +1,1622 @@ +import re +import struct +import zlib +from base64 import b64encode +from datetime import datetime, timedelta +from hashlib import md5 + +from webob.byterange import ContentRange +from webob.cachecontrol import CacheControl, serialize_cache_control +from webob.compat import ( + PY2, + bytes_, + native_, + string_types, + text_type, + url_quote, + urlparse, +) +from webob.cookies import Cookie, make_cookie +from webob.datetime_utils import ( + parse_date_delta, + serialize_date_delta, + timedelta_to_seconds, +) +from webob.descriptors import ( + CHARSET_RE, + SCHEME_RE, + converter, + date_header, + header_getter, + list_header, + parse_auth, + parse_content_range, + parse_etag_response, + parse_int, + parse_int_safe, + serialize_auth, + serialize_content_range, + serialize_etag_response, + serialize_int, +) +from webob.headers import ResponseHeaders +from webob.request import BaseRequest +from webob.util import status_generic_reasons, status_reasons, warn_deprecation + +try: + import simplejson as json +except ImportError: + import json + +__all__ = ['Response'] + +_PARAM_RE = re.compile(r'([a-z0-9]+)=(?:"([^"]*)"|([a-z0-9_.-]*))', re.I) +_OK_PARAM_RE = re.compile(r'^[a-z0-9_.-]+$', re.I) + +_gzip_header = b'\x1f\x8b\x08\x00\x00\x00\x00\x00\x02\xff' + +_marker = object() + +class Response(object): + """ + Represents a WSGI response. + + If no arguments are passed, creates a :class:`~Response` that uses a + variety of defaults. The defaults may be changed by sub-classing the + :class:`~Response`. See the :ref:`sub-classing notes + `. + + :cvar ~Response.body: If ``body`` is a ``text_type``, then it will be + encoded using either ``charset`` when provided or ``default_encoding`` + when ``charset`` is not provided if the ``content_type`` allows for a + ``charset``. This argument is mutually exclusive with ``app_iter``. + + :vartype ~Response.body: bytes or text_type + + :cvar ~Response.status: Either an :class:`int` or a string that is + an integer followed by the status text. If it is an integer, it will be + converted to a proper status that also includes the status text. Any + existing status text will be kept. Non-standard values are allowed. + + :vartype ~Response.status: int or str + + :cvar ~Response.headerlist: A list of HTTP headers for the response. + + :vartype ~Response.headerlist: list + + :cvar ~Response.app_iter: An iterator that is used as the body of the + response. Should conform to the WSGI requirements and should provide + bytes. This argument is mutually exclusive with ``body``. + + :vartype ~Response.app_iter: iterable + + :cvar ~Response.content_type: Sets the ``Content-Type`` header. If no + ``content_type`` is provided, and there is no ``headerlist``, the + ``default_content_type`` will be automatically set. If ``headerlist`` + is provided then this value is ignored. + + :vartype ~Response.content_type: str or None + + :cvar conditional_response: Used to change the behavior of the + :class:`~Response` to check the original request for conditional + response headers. See :meth:`~Response.conditional_response_app` for + more information. + + :vartype conditional_response: bool + + :cvar ~Response.charset: Adds a ``charset`` ``Content-Type`` parameter. If + no ``charset`` is provided and the ``Content-Type`` is text, then the + ``default_charset`` will automatically be added. Currently the only + ``Content-Type``'s that allow for a ``charset`` are defined to be + ``text/*``, ``application/xml``, and ``*/*+xml``. Any other + ``Content-Type``'s will not have a ``charset`` added. If a + ``headerlist`` is provided this value is ignored. + + :vartype ~Response.charset: str or None + + All other response attributes may be set on the response by providing them + as keyword arguments. A :exc:`TypeError` will be raised for any unexpected + keywords. + + .. _response_subclassing_notes: + + **Sub-classing notes:** + + * The ``default_content_type`` is used as the default for the + ``Content-Type`` header that is returned on the response. It is + ``text/html``. + + * The ``default_charset`` is used as the default character set to return on + the ``Content-Type`` header, if the ``Content-Type`` allows for a + ``charset`` parameter. Currently the only ``Content-Type``'s that allow + for a ``charset`` are defined to be: ``text/*``, ``application/xml``, and + ``*/*+xml``. Any other ``Content-Type``'s will not have a ``charset`` + added. + + * The ``unicode_errors`` is set to ``strict``, and access on a + :attr:`~Response.text` will raise an error if it fails to decode the + :attr:`~Response.body`. + + * ``default_conditional_response`` is set to ``False``. This flag may be + set to ``True`` so that all ``Response`` objects will attempt to check + the original request for conditional response headers. See + :meth:`~Response.conditional_response_app` for more information. + + * ``default_body_encoding`` is set to 'UTF-8' by default. It exists to + allow users to get/set the ``Response`` object using ``.text``, even if + no ``charset`` has been set for the ``Content-Type``. + """ + + default_content_type = 'text/html' + default_charset = 'UTF-8' + unicode_errors = 'strict' + default_conditional_response = False + default_body_encoding = 'UTF-8' + + # These two are only around so that when people pass them into the + # constructor they correctly get saved and set, however they are not used + # by any part of the Response. See commit + # 627593bbcd4ab52adc7ee569001cdda91c670d5d for rationale. + request = None + environ = None + + # + # __init__, from_file, copy + # + + def __init__(self, body=None, status=None, headerlist=None, app_iter=None, + content_type=None, conditional_response=None, charset=_marker, + **kw): + # Do some sanity checking, and turn json_body into an actual body + if app_iter is None and body is None and ('json_body' in kw or 'json' in kw): + if 'json_body' in kw: + json_body = kw.pop('json_body') + else: + json_body = kw.pop('json') + body = json.dumps(json_body, separators=(',', ':')).encode('UTF-8') + + if content_type is None: + content_type = 'application/json' + + if app_iter is None: + if body is None: + body = b'' + elif body is not None: + raise TypeError( + "You may only give one of the body and app_iter arguments") + + # Set up Response.status + if status is None: + self._status = '200 OK' + else: + self.status = status + + # Initialize headers + self._headers = None + if headerlist is None: + self._headerlist = [] + else: + self._headerlist = headerlist + + # Set the encoding for the Response to charset, so if a charset is + # passed but the Content-Type does not allow for a charset, we can + # still encode text_type body's. + # r = Response( + # content_type='application/foo', + # charset='UTF-8', + # body=u'somebody') + # Should work without issues, and the header will be correctly set to + # Content-Type: application/foo with no charset on it. + + encoding = None + if charset is not _marker: + encoding = charset + + # Does the status code have a body or not? + code_has_body = ( + self._status[0] != '1' and + self._status[:3] not in ('204', '205', '304') + ) + + # We only set the content_type to the one passed to the constructor or + # the default content type if there is none that exists AND there was + # no headerlist passed. If a headerlist was provided then most likely + # the ommission of the Content-Type is on purpose and we shouldn't try + # to be smart about it. + # + # Also allow creation of a empty Response with just the status set to a + # Response with empty body, such as Response(status='204 No Content') + # without the default content_type being set (since empty bodies have + # no Content-Type) + # + # Check if content_type is set because default_content_type could be + # None, in which case there is no content_type, and thus we don't need + # to anything + + content_type = content_type or self.default_content_type + + if headerlist is None and code_has_body and content_type: + # Set up the charset, if the content_type doesn't already have one + + has_charset = 'charset=' in content_type + + # If the Content-Type already has a charset, we don't set the user + # provided charset on the Content-Type, so we shouldn't use it as + # the encoding for text_type based body's. + if has_charset: + encoding = None + + # Do not use the default_charset for the encoding because we + # want things like + # Response(content_type='image/jpeg',body=u'foo') to raise when + # trying to encode the body. + + new_charset = encoding + + if ( + not has_charset and + charset is _marker and + self.default_charset + ): + new_charset = self.default_charset + + # Optimize for the default_content_type as shipped by + # WebOb, becuase we know that 'text/html' has a charset, + # otherwise add a charset if the content_type has a charset. + # + # Even if the user supplied charset explicitly, we do not add + # it to the Content-Type unless it has has a charset, instead + # the user supplied charset is solely used for encoding the + # body if it is a text_type + + if ( + new_charset and + ( + content_type == 'text/html' or + _content_type_has_charset(content_type) + ) + ): + content_type += '; charset=' + new_charset + + self._headerlist.append(('Content-Type', content_type)) + + # Set up conditional response + if conditional_response is None: + self.conditional_response = self.default_conditional_response + else: + self.conditional_response = bool(conditional_response) + + # Set up app_iter if the HTTP Status code has a body + if app_iter is None and code_has_body: + if isinstance(body, text_type): + # Fall back to trying self.charset if encoding is not set. In + # most cases encoding will be set to the default value. + encoding = encoding or self.charset + if encoding is None: + raise TypeError( + "You cannot set the body to a text value without a " + "charset") + body = body.encode(encoding) + app_iter = [body] + + if headerlist is not None: + self._headerlist[:] = [ + (k, v) + for (k, v) + in self._headerlist + if k.lower() != 'content-length' + ] + self._headerlist.append(('Content-Length', str(len(body)))) + elif app_iter is None and not code_has_body: + app_iter = [b''] + + self._app_iter = app_iter + + # Loop through all the remaining keyword arguments + for name, value in kw.items(): + if not hasattr(self.__class__, name): + # Not a basic attribute + raise TypeError( + "Unexpected keyword: %s=%r" % (name, value)) + setattr(self, name, value) + + @classmethod + def from_file(cls, fp): + """Reads a response from a file-like object (it must implement + ``.read(size)`` and ``.readline()``). + + It will read up to the end of the response, not the end of the + file. + + This reads the response as represented by ``str(resp)``; it + may not read every valid HTTP response properly. Responses + must have a ``Content-Length``.""" + headerlist = [] + status = fp.readline().strip() + is_text = isinstance(status, text_type) + + if is_text: + _colon = ':' + _http = 'HTTP/' + else: + _colon = b':' + _http = b'HTTP/' + + if status.startswith(_http): + (http_ver, status_num, status_text) = status.split(None, 2) + status = '%s %s' % (native_(status_num), native_(status_text)) + + while 1: + line = fp.readline().strip() + if not line: + # end of headers + break + try: + header_name, value = line.split(_colon, 1) + except ValueError: + raise ValueError('Bad header line: %r' % line) + value = value.strip() + headerlist.append(( + native_(header_name, 'latin-1'), + native_(value, 'latin-1') + )) + r = cls( + status=status, + headerlist=headerlist, + app_iter=(), + ) + body = fp.read(r.content_length or 0) + if is_text: + r.text = body + else: + r.body = body + return r + + def copy(self): + """Makes a copy of the response.""" + # we need to do this for app_iter to be reusable + app_iter = list(self._app_iter) + iter_close(self._app_iter) + # and this to make sure app_iter instances are different + self._app_iter = list(app_iter) + return self.__class__( + status=self._status, + headerlist=self._headerlist[:], + app_iter=app_iter, + conditional_response=self.conditional_response) + + # + # __repr__, __str__ + # + + def __repr__(self): + return '<%s at 0x%x %s>' % (self.__class__.__name__, abs(id(self)), + self.status) + + def __str__(self, skip_body=False): + parts = [self.status] + if not skip_body: + # Force enumeration of the body (to set content-length) + self.body + parts += map('%s: %s'.__mod__, self.headerlist) + if not skip_body and self.body: + parts += ['', self.body if PY2 else self.text] + return '\r\n'.join(parts) + + # + # status, status_code/status_int + # + + def _status__get(self): + """ + The status string. + """ + return self._status + + def _status__set(self, value): + try: + code = int(value) + except (ValueError, TypeError): + pass + else: + self.status_code = code + return + if not PY2: + if isinstance(value, bytes): + value = value.decode('ascii') + elif isinstance(value, text_type): + value = value.encode('ascii') + if not isinstance(value, str): + raise TypeError( + "You must set status to a string or integer (not %s)" + % type(value)) + + # Attempt to get the status code itself, if this fails we should fail + try: + # We don't need this value anywhere, we just want to validate it's + # an integer. So we are using the side-effect of int() raises a + # ValueError as a test + int(value.split()[0]) + except ValueError: + raise ValueError('Invalid status code, integer required.') + self._status = value + + status = property(_status__get, _status__set, doc=_status__get.__doc__) + + def _status_code__get(self): + """ + The status as an integer. + """ + return int(self._status.split()[0]) + + def _status_code__set(self, code): + try: + self._status = '%d %s' % (code, status_reasons[code]) + except KeyError: + self._status = '%d %s' % (code, status_generic_reasons[code // 100]) + + status_code = status_int = property(_status_code__get, _status_code__set, + doc=_status_code__get.__doc__) + + # + # headerslist, headers + # + + def _headerlist__get(self): + """ + The list of response headers. + """ + return self._headerlist + + def _headerlist__set(self, value): + self._headers = None + if not isinstance(value, list): + if hasattr(value, 'items'): + value = value.items() + value = list(value) + self._headerlist = value + + def _headerlist__del(self): + self.headerlist = [] + + headerlist = property(_headerlist__get, _headerlist__set, + _headerlist__del, doc=_headerlist__get.__doc__) + + def _headers__get(self): + """ + The headers in a dictionary-like object. + """ + if self._headers is None: + self._headers = ResponseHeaders.view_list(self._headerlist) + return self._headers + + def _headers__set(self, value): + if hasattr(value, 'items'): + value = value.items() + self.headerlist = value + self._headers = None + + headers = property(_headers__get, _headers__set, doc=_headers__get.__doc__) + + # + # body + # + + def _body__get(self): + """ + The body of the response, as a :class:`bytes`. This will read in + the entire app_iter if necessary. + """ + app_iter = self._app_iter +# try: +# if len(app_iter) == 1: +# return app_iter[0] +# except: +# pass + if isinstance(app_iter, list) and len(app_iter) == 1: + return app_iter[0] + if app_iter is None: + raise AttributeError("No body has been set") + try: + body = b''.join(app_iter) + finally: + iter_close(app_iter) + if isinstance(body, text_type): + raise _error_unicode_in_app_iter(app_iter, body) + self._app_iter = [body] + if len(body) == 0: + # if body-length is zero, we assume it's a HEAD response and + # leave content_length alone + pass + elif self.content_length is None: + self.content_length = len(body) + elif self.content_length != len(body): + raise AssertionError( + "Content-Length is different from actual app_iter length " + "(%r!=%r)" + % (self.content_length, len(body)) + ) + return body + + def _body__set(self, value=b''): + if not isinstance(value, bytes): + if isinstance(value, text_type): + msg = ("You cannot set Response.body to a text object " + "(use Response.text)") + else: + msg = ("You can only set the body to a binary type (not %s)" % + type(value)) + raise TypeError(msg) + if self._app_iter is not None: + self.content_md5 = None + self._app_iter = [value] + self.content_length = len(value) + +# def _body__del(self): +# self.body = '' +# #self.content_length = None + + body = property(_body__get, _body__set, _body__set) + + def _json_body__get(self): + """ + Set/get the body of the response as JSON. + + .. note:: + + This will automatically :meth:`~bytes.decode` the + :attr:`~Response.body` as ``UTF-8`` on get, and + :meth:`~str.encode` the :meth:`json.dumps` as ``UTF-8`` + before assigning to :attr:`~Response.body`. + + """ + # Note: UTF-8 is a content-type specific default for JSON + return json.loads(self.body.decode('UTF-8')) + + def _json_body__set(self, value): + self.body = json.dumps(value, separators=(',', ':')).encode('UTF-8') + + def _json_body__del(self): + del self.body + + json = json_body = property(_json_body__get, _json_body__set, _json_body__del) + + def _has_body__get(self): + """ + Determine if the the response has a :attr:`~Response.body`. In + contrast to simply accessing :attr:`~Response.body`, this method + will **not** read the underlying :attr:`~Response.app_iter`. + """ + + app_iter = self._app_iter + + if isinstance(app_iter, list) and len(app_iter) == 1: + if app_iter[0] != b'': + return True + else: + return False + + if app_iter is None: # pragma: no cover + return False + + return True + + has_body = property(_has_body__get) + + # + # text, unicode_body, ubody + # + + def _text__get(self): + """ + Get/set the text value of the body using the ``charset`` of the + ``Content-Type`` or the ``default_body_encoding``. + """ + if not self.charset and not self.default_body_encoding: + raise AttributeError( + "You cannot access Response.text unless charset or default_body_encoding" + " is set" + ) + decoding = self.charset or self.default_body_encoding + body = self.body + return body.decode(decoding, self.unicode_errors) + + def _text__set(self, value): + if not self.charset and not self.default_body_encoding: + raise AttributeError( + "You cannot access Response.text unless charset or default_body_encoding" + " is set" + ) + if not isinstance(value, text_type): + raise TypeError( + "You can only set Response.text to a unicode string " + "(not %s)" % type(value)) + encoding = self.charset or self.default_body_encoding + self.body = value.encode(encoding) + + def _text__del(self): + del self.body + + text = property(_text__get, _text__set, _text__del, doc=_text__get.__doc__) + + unicode_body = ubody = property(_text__get, _text__set, _text__del, + "Deprecated alias for .text") + + # + # body_file, write(text) + # + + def _body_file__get(self): + """ + A file-like object that can be used to write to the + body. If you passed in a list ``app_iter``, that ``app_iter`` will be + modified by writes. + """ + return ResponseBodyFile(self) + + def _body_file__set(self, file): + self.app_iter = iter_file(file) + + def _body_file__del(self): + del self.body + + body_file = property(_body_file__get, _body_file__set, _body_file__del, + doc=_body_file__get.__doc__) + + def write(self, text): + if not isinstance(text, bytes): + if not isinstance(text, text_type): + msg = "You can only write str to a Response.body_file, not %s" + raise TypeError(msg % type(text)) + if not self.charset: + msg = ("You can only write text to Response if charset has " + "been set") + raise TypeError(msg) + text = text.encode(self.charset) + app_iter = self._app_iter + if not isinstance(app_iter, list): + try: + new_app_iter = self._app_iter = list(app_iter) + finally: + iter_close(app_iter) + app_iter = new_app_iter + self.content_length = sum(len(chunk) for chunk in app_iter) + app_iter.append(text) + if self.content_length is not None: + self.content_length += len(text) + + # + # app_iter + # + + def _app_iter__get(self): + """ + Returns the ``app_iter`` of the response. + + If ``body`` was set, this will create an ``app_iter`` from that + ``body`` (a single-item list). + """ + return self._app_iter + + def _app_iter__set(self, value): + if self._app_iter is not None: + # Undo the automatically-set content-length + self.content_length = None + self._app_iter = value + + def _app_iter__del(self): + self._app_iter = [] + self.content_length = None + + app_iter = property(_app_iter__get, _app_iter__set, _app_iter__del, + doc=_app_iter__get.__doc__) + + # + # headers attrs + # + + allow = list_header('Allow', '14.7') + # TODO: (maybe) support response.vary += 'something' + # TODO: same thing for all listy headers + vary = list_header('Vary', '14.44') + + content_length = converter( + header_getter('Content-Length', '14.17'), + parse_int, serialize_int, 'int') + + content_encoding = header_getter('Content-Encoding', '14.11') + content_language = list_header('Content-Language', '14.12') + content_location = header_getter('Content-Location', '14.14') + content_md5 = header_getter('Content-MD5', '14.14') + content_disposition = header_getter('Content-Disposition', '19.5.1') + + accept_ranges = header_getter('Accept-Ranges', '14.5') + content_range = converter( + header_getter('Content-Range', '14.16'), + parse_content_range, serialize_content_range, 'ContentRange object') + + date = date_header('Date', '14.18') + expires = date_header('Expires', '14.21') + last_modified = date_header('Last-Modified', '14.29') + + _etag_raw = header_getter('ETag', '14.19') + etag = converter( + _etag_raw, + parse_etag_response, serialize_etag_response, + 'Entity tag' + ) + @property + def etag_strong(self): + return parse_etag_response(self._etag_raw, strong=True) + + location = header_getter('Location', '14.30') + pragma = header_getter('Pragma', '14.32') + age = converter( + header_getter('Age', '14.6'), + parse_int_safe, serialize_int, 'int') + + retry_after = converter( + header_getter('Retry-After', '14.37'), + parse_date_delta, serialize_date_delta, 'HTTP date or delta seconds') + + server = header_getter('Server', '14.38') + + # TODO: the standard allows this to be a list of challenges + www_authenticate = converter( + header_getter('WWW-Authenticate', '14.47'), + parse_auth, serialize_auth, + ) + + # + # charset + # + + def _charset__get(self): + """ + Get/set the ``charset`` specified in ``Content-Type``. + + There is no checking to validate that a ``content_type`` actually + allows for a ``charset`` parameter. + """ + header = self.headers.get('Content-Type') + if not header: + return None + match = CHARSET_RE.search(header) + if match: + return match.group(1) + return None + + def _charset__set(self, charset): + if charset is None: + self._charset__del() + return + header = self.headers.get('Content-Type', None) + if header is None: + raise AttributeError("You cannot set the charset when no " + "content-type is defined") + match = CHARSET_RE.search(header) + if match: + header = header[:match.start()] + header[match.end():] + header += '; charset=%s' % charset + self.headers['Content-Type'] = header + + def _charset__del(self): + header = self.headers.pop('Content-Type', None) + if header is None: + # Don't need to remove anything + return + match = CHARSET_RE.search(header) + if match: + header = header[:match.start()] + header[match.end():] + self.headers['Content-Type'] = header + + charset = property(_charset__get, _charset__set, _charset__del, + doc=_charset__get.__doc__) + + # + # content_type + # + + def _content_type__get(self): + """ + Get/set the ``Content-Type`` header. If no ``Content-Type`` header is + set, this will return ``None``. + + .. versionchanged:: 1.7 + + Setting a new ``Content-Type`` will remove all ``Content-Type`` + parameters and reset the ``charset`` to the default if the + ``Content-Type`` is ``text/*`` or XML (``application/xml`` or + ``*/*+xml``). + + To preserve all ``Content-Type`` parameters, you may use the + following code: + + .. code-block:: python + + resp = Response() + params = resp.content_type_params + resp.content_type = 'application/something' + resp.content_type_params = params + """ + header = self.headers.get('Content-Type') + if not header: + return None + return header.split(';', 1)[0] + + def _content_type__set(self, value): + if not value: + self._content_type__del() + return + else: + if PY2 and isinstance(value, text_type): + value = value.encode("latin-1") + + if not isinstance(value, string_types): + raise TypeError("content_type requires value to be of string_types") + + content_type = value + + # Set up the charset if the content-type doesn't have one + + has_charset = 'charset=' in content_type + + new_charset = None + + if ( + not has_charset and + self.default_charset + ): + new_charset = self.default_charset + + # Optimize for the default_content_type as shipped by + # WebOb, becuase we know that 'text/html' has a charset, + # otherwise add a charset if the content_type has a charset. + # + # We add the default charset if the content-type is "texty". + if ( + new_charset and + ( + content_type == 'text/html' or + _content_type_has_charset(content_type) + ) + ): + content_type += '; charset=' + new_charset + + self.headers['Content-Type'] = content_type + + def _content_type__del(self): + self.headers.pop('Content-Type', None) + + content_type = property(_content_type__get, _content_type__set, + _content_type__del, doc=_content_type__get.__doc__) + + # + # content_type_params + # + + def _content_type_params__get(self): + """ + A dictionary of all the parameters in the content type. + + (This is not a view, set to change, modifications of the dict will not + be applied otherwise.) + """ + params = self.headers.get('Content-Type', '') + if ';' not in params: + return {} + params = params.split(';', 1)[1] + result = {} + for match in _PARAM_RE.finditer(params): + result[match.group(1)] = match.group(2) or match.group(3) or '' + return result + + def _content_type_params__set(self, value_dict): + if not value_dict: + self._content_type_params__del() + return + + params = [] + for k, v in sorted(value_dict.items()): + if not _OK_PARAM_RE.search(v): + v = '"%s"' % v.replace('"', '\\"') + params.append('; %s=%s' % (k, v)) + ct = self.headers.pop('Content-Type', '').split(';', 1)[0] + ct += ''.join(params) + self.headers['Content-Type'] = ct + + def _content_type_params__del(self): + self.headers['Content-Type'] = self.headers.get( + 'Content-Type', '').split(';', 1)[0] + + content_type_params = property( + _content_type_params__get, + _content_type_params__set, + _content_type_params__del, + _content_type_params__get.__doc__ + ) + + # + # set_cookie, unset_cookie, delete_cookie, merge_cookies + # + + def set_cookie(self, name, value='', max_age=None, + path='/', domain=None, secure=False, httponly=False, + comment=None, expires=None, overwrite=False, + samesite=None): + """ + Set (add) a cookie for the response. + + Arguments are: + + ``name`` + + The cookie name. + + ``value`` + + The cookie value, which should be a string or ``None``. If + ``value`` is ``None``, it's equivalent to calling the + :meth:`webob.response.Response.unset_cookie` method for this + cookie key (it effectively deletes the cookie on the client). + + ``max_age`` + + An integer representing a number of seconds, ``datetime.timedelta``, + or ``None``. This value is used as the ``Max-Age`` of the generated + cookie. If ``expires`` is not passed and this value is not + ``None``, the ``max_age`` value will also influence the ``Expires`` + value of the cookie (``Expires`` will be set to ``now`` + + ``max_age``). If this value is ``None``, the cookie will not have a + ``Max-Age`` value (unless ``expires`` is set). If both ``max_age`` + and ``expires`` are set, this value takes precedence. + + ``path`` + + A string representing the cookie ``Path`` value. It defaults to + ``/``. + + ``domain`` + + A string representing the cookie ``Domain``, or ``None``. If + domain is ``None``, no ``Domain`` value will be sent in the + cookie. + + ``secure`` + + A boolean. If it's ``True``, the ``secure`` flag will be sent in + the cookie, if it's ``False``, the ``secure`` flag will not be + sent in the cookie. + + ``httponly`` + + A boolean. If it's ``True``, the ``HttpOnly`` flag will be sent + in the cookie, if it's ``False``, the ``HttpOnly`` flag will not + be sent in the cookie. + + ``samesite`` + + A string representing the ``SameSite`` attribute of the cookie or + ``None``. If samesite is ``None`` no ``SameSite`` value will be sent + in the cookie. Should only be ``"strict"``, ``"lax"``, or ``"none"``. + + ``comment`` + + A string representing the cookie ``Comment`` value, or ``None``. + If ``comment`` is ``None``, no ``Comment`` value will be sent in + the cookie. + + ``expires`` + + A ``datetime.timedelta`` object representing an amount of time, + ``datetime.datetime`` or ``None``. A non-``None`` value is used to + generate the ``Expires`` value of the generated cookie. If + ``max_age`` is not passed, but this value is not ``None``, it will + influence the ``Max-Age`` header. If this value is ``None``, the + ``Expires`` cookie value will be unset (unless ``max_age`` is set). + If ``max_age`` is set, it will be used to generate the ``expires`` + and this value is ignored. + + If a ``datetime.datetime`` is provided it has to either be timezone + aware or be based on UTC. ``datetime.datetime`` objects that are + local time are not supported. Timezone aware ``datetime.datetime`` + objects are converted to UTC. + + This argument will be removed in future versions of WebOb (version + 1.9). + + ``overwrite`` + + If this key is ``True``, before setting the cookie, unset any + existing cookie. + + """ + + # Remove in WebOb 1.10 + if expires: + warn_deprecation('Argument "expires" will be removed in a future ' + 'version of WebOb, please use "max_age".', 1.10, 1) + + if overwrite: + self.unset_cookie(name, strict=False) + + # If expires is set, but not max_age we set max_age to expires + if not max_age and isinstance(expires, timedelta): + max_age = expires + + # expires can also be a datetime + if not max_age and isinstance(expires, datetime): + + # If expires has a timezone attached, convert it to UTC + if expires.tzinfo and expires.utcoffset(): + expires = (expires - expires.utcoffset()).replace(tzinfo=None) + + max_age = expires - datetime.utcnow() + + value = bytes_(value, 'utf-8') + + cookie = make_cookie(name, value, max_age=max_age, path=path, + domain=domain, secure=secure, httponly=httponly, + comment=comment, samesite=samesite) + self.headerlist.append(('Set-Cookie', cookie)) + + def delete_cookie(self, name, path='/', domain=None): + """ + Delete a cookie from the client. Note that ``path`` and ``domain`` + must match how the cookie was originally set. + + This sets the cookie to the empty string, and ``max_age=0`` so + that it should expire immediately. + """ + self.set_cookie(name, None, path=path, domain=domain) + + def unset_cookie(self, name, strict=True): + """ + Unset a cookie with the given name (remove it from the response). + """ + existing = self.headers.getall('Set-Cookie') + if not existing and not strict: + return + cookies = Cookie() + for header in existing: + cookies.load(header) + if isinstance(name, text_type): + name = name.encode('utf8') + if name in cookies: + del cookies[name] + del self.headers['Set-Cookie'] + for m in cookies.values(): + self.headerlist.append(('Set-Cookie', m.serialize())) + elif strict: + raise KeyError("No cookie has been set with the name %r" % name) + + def merge_cookies(self, resp): + """Merge the cookies that were set on this response with the + given ``resp`` object (which can be any WSGI application). + + If the ``resp`` is a :class:`webob.Response` object, then the + other object will be modified in-place. + """ + if not self.headers.get('Set-Cookie'): + return resp + if isinstance(resp, Response): + for header in self.headers.getall('Set-Cookie'): + resp.headers.add('Set-Cookie', header) + return resp + else: + c_headers = [h for h in self.headerlist if + h[0].lower() == 'set-cookie'] + def repl_app(environ, start_response): + def repl_start_response(status, headers, exc_info=None): + return start_response(status, headers + c_headers, + exc_info=exc_info) + return resp(environ, repl_start_response) + return repl_app + + # + # cache_control + # + + _cache_control_obj = None + + def _cache_control__get(self): + """ + Get/set/modify the Cache-Control header (`HTTP spec section 14.9 + `_). + """ + value = self.headers.get('cache-control', '') + if self._cache_control_obj is None: + self._cache_control_obj = CacheControl.parse( + value, updates_to=self._update_cache_control, type='response') + self._cache_control_obj.header_value = value + if self._cache_control_obj.header_value != value: + new_obj = CacheControl.parse(value, type='response') + self._cache_control_obj.properties.clear() + self._cache_control_obj.properties.update(new_obj.properties) + self._cache_control_obj.header_value = value + return self._cache_control_obj + + def _cache_control__set(self, value): + # This actually becomes a copy + if not value: + value = "" + if isinstance(value, dict): + value = CacheControl(value, 'response') + if isinstance(value, text_type): + value = str(value) + if isinstance(value, str): + if self._cache_control_obj is None: + self.headers['Cache-Control'] = value + return + value = CacheControl.parse(value, 'response') + cache = self.cache_control + cache.properties.clear() + cache.properties.update(value.properties) + + def _cache_control__del(self): + self.cache_control = {} + + def _update_cache_control(self, prop_dict): + value = serialize_cache_control(prop_dict) + if not value: + if 'Cache-Control' in self.headers: + del self.headers['Cache-Control'] + else: + self.headers['Cache-Control'] = value + + cache_control = property( + _cache_control__get, _cache_control__set, + _cache_control__del, doc=_cache_control__get.__doc__) + + # + # cache_expires + # + + def _cache_expires(self, seconds=0, **kw): + """ + Set expiration on this request. This sets the response to + expire in the given seconds, and any other attributes are used + for ``cache_control`` (e.g., ``private=True``). + """ + if seconds is True: + seconds = 0 + elif isinstance(seconds, timedelta): + seconds = timedelta_to_seconds(seconds) + cache_control = self.cache_control + if seconds is None: + pass + elif not seconds: + # To really expire something, you have to force a + # bunch of these cache control attributes, and IE may + # not pay attention to those still so we also set + # Expires. + cache_control.no_store = True + cache_control.no_cache = True + cache_control.must_revalidate = True + cache_control.max_age = 0 + cache_control.post_check = 0 + cache_control.pre_check = 0 + self.expires = datetime.utcnow() + if 'last-modified' not in self.headers: + self.last_modified = datetime.utcnow() + self.pragma = 'no-cache' + else: + cache_control.properties.clear() + cache_control.max_age = seconds + self.expires = datetime.utcnow() + timedelta(seconds=seconds) + self.pragma = None + for name, value in kw.items(): + setattr(cache_control, name, value) + + cache_expires = property(lambda self: self._cache_expires, _cache_expires) + + # + # encode_content, decode_content, md5_etag + # + + def encode_content(self, encoding='gzip', lazy=False): + """ + Encode the content with the given encoding (only ``gzip`` and + ``identity`` are supported). + """ + assert encoding in ('identity', 'gzip'), \ + "Unknown encoding: %r" % encoding + if encoding == 'identity': + self.decode_content() + return + if self.content_encoding == 'gzip': + return + if lazy: + self.app_iter = gzip_app_iter(self._app_iter) + self.content_length = None + else: + self.app_iter = list(gzip_app_iter(self._app_iter)) + self.content_length = sum(map(len, self._app_iter)) + self.content_encoding = 'gzip' + + def decode_content(self): + content_encoding = self.content_encoding or 'identity' + if content_encoding == 'identity': + return + if content_encoding not in ('gzip', 'deflate'): + raise ValueError( + "I don't know how to decode the content %s" % content_encoding) + if content_encoding == 'gzip': + from gzip import GzipFile + from io import BytesIO + gzip_f = GzipFile(filename='', mode='r', fileobj=BytesIO(self.body)) + self.body = gzip_f.read() + self.content_encoding = None + gzip_f.close() + else: + try: + # RFC7230 section 4.2.2 specifies that the body should be wrapped + # inside a ZLIB (RFC1950) container ... + self.body = zlib.decompress(self.body) + except zlib.error: + # ... but there are nonconformant implementations around which send + # the data without the ZLIB container, so we use maximum window size + # decompression without header check (the - sign) + self.body = zlib.decompress(self.body, -15) + self.content_encoding = None + + def md5_etag(self, body=None, set_content_md5=False): + """ + Generate an etag for the response object using an MD5 hash of + the body (the ``body`` parameter, or ``self.body`` if not given). + + Sets ``self.etag``. + + If ``set_content_md5`` is ``True``, sets ``self.content_md5`` as well. + """ + if body is None: + body = self.body + md5_digest = md5(body).digest() + md5_digest = b64encode(md5_digest) + md5_digest = md5_digest.replace(b'\n', b'') + md5_digest = native_(md5_digest) + self.etag = md5_digest.strip('=') + if set_content_md5: + self.content_md5 = md5_digest + + @staticmethod + def _make_location_absolute(environ, value): + if SCHEME_RE.search(value): + return value + + # This is to fix an open redirect issue due to the way that + # urlparse.urljoin works. See CVE-2024-42353 and + # https://github.com/Pylons/webob/security/advisories/GHSA-mg3v-6m49-jhp3 + if value.startswith("//"): + value = "/%2f{}".format(value[2:]) + new_location = urlparse.urljoin(_request_uri(environ), value) + return new_location + + def _abs_headerlist(self, environ): + # Build the headerlist, if we have a Location header, make it absolute + return [ + (k, v) if k.lower() != 'location' + else (k, self._make_location_absolute(environ, v)) + for (k, v) + in self._headerlist + ] + + # + # __call__, conditional_response_app + # + + def __call__(self, environ, start_response): + """ + WSGI application interface + """ + if self.conditional_response: + return self.conditional_response_app(environ, start_response) + + headerlist = self._abs_headerlist(environ) + + start_response(self.status, headerlist) + if environ['REQUEST_METHOD'] == 'HEAD': + # Special case here... + return EmptyResponse(self._app_iter) + return self._app_iter + + _safe_methods = ('GET', 'HEAD') + + def conditional_response_app(self, environ, start_response): + """ + Like the normal ``__call__`` interface, but checks conditional headers: + + * ``If-Modified-Since`` (``304 Not Modified``; only on ``GET``, + ``HEAD``) + * ``If-None-Match`` (``304 Not Modified``; only on ``GET``, + ``HEAD``) + * ``Range`` (``406 Partial Content``; only on ``GET``, + ``HEAD``) + """ + req = BaseRequest(environ) + + headerlist = self._abs_headerlist(environ) + + method = environ.get('REQUEST_METHOD', 'GET') + if method in self._safe_methods: + status304 = False + if req.if_none_match and self.etag: + status304 = self.etag in req.if_none_match + elif req.if_modified_since and self.last_modified: + status304 = self.last_modified <= req.if_modified_since + if status304: + start_response('304 Not Modified', filter_headers(headerlist)) + return EmptyResponse(self._app_iter) + if ( + req.range and self in req.if_range and + self.content_range is None and + method in ('HEAD', 'GET') and + self.status_code == 200 and + self.content_length is not None + ): + content_range = req.range.content_range(self.content_length) + if content_range is None: + iter_close(self._app_iter) + body = bytes_("Requested range not satisfiable: %s" % req.range) + headerlist = [ + ('Content-Length', str(len(body))), + ('Content-Range', str(ContentRange(None, None, + self.content_length))), + ('Content-Type', 'text/plain'), + ] + filter_headers(headerlist) + start_response('416 Requested Range Not Satisfiable', + headerlist) + if method == 'HEAD': + return () + return [body] + else: + app_iter = self.app_iter_range(content_range.start, + content_range.stop) + if app_iter is not None: + # the following should be guaranteed by + # Range.range_for_length(length) + assert content_range.start is not None + headerlist = [ + ('Content-Length', + str(content_range.stop - content_range.start)), + ('Content-Range', str(content_range)), + ] + filter_headers(headerlist, ('content-length',)) + start_response('206 Partial Content', headerlist) + if method == 'HEAD': + return EmptyResponse(app_iter) + return app_iter + + start_response(self.status, headerlist) + if method == 'HEAD': + return EmptyResponse(self._app_iter) + return self._app_iter + + def app_iter_range(self, start, stop): + """ + Return a new ``app_iter`` built from the response ``app_iter``, that + serves up only the given ``start:stop`` range. + """ + app_iter = self._app_iter + if hasattr(app_iter, 'app_iter_range'): + return app_iter.app_iter_range(start, stop) + return AppIterRange(app_iter, start, stop) + + +def filter_headers(hlist, remove_headers=('content-length', 'content-type')): + return [h for h in hlist if (h[0].lower() not in remove_headers)] + + +def iter_file(file, block_size=1 << 18): # 256Kb + while True: + data = file.read(block_size) + if not data: + break + yield data + +class ResponseBodyFile(object): + mode = 'wb' + closed = False + + def __init__(self, response): + """ + Represents a :class:`~Response` as a file like object. + """ + self.response = response + self.write = response.write + + def __repr__(self): + return '' % self.response + + encoding = property( + lambda self: self.response.charset, + doc="The encoding of the file (inherited from response.charset)" + ) + + def writelines(self, seq): + """ + Write a sequence of lines to the response. + """ + for item in seq: + self.write(item) + + def close(self): + raise NotImplementedError("Response bodies cannot be closed") + + def flush(self): + pass + + def tell(self): + """ + Provide the current location where we are going to start writing. + """ + if not self.response.has_body: + return 0 + + return sum([len(chunk) for chunk in self.response.app_iter]) + + +class AppIterRange(object): + """ + Wraps an ``app_iter``, returning just a range of bytes. + """ + + def __init__(self, app_iter, start, stop): + assert start >= 0, "Bad start: %r" % start + assert stop is None or (stop >= 0 and stop >= start), ( + "Bad stop: %r" % stop) + self.app_iter = iter(app_iter) + self._pos = 0 # position in app_iter + self.start = start + self.stop = stop + + def __iter__(self): + return self + + def _skip_start(self): + start, stop = self.start, self.stop + for chunk in self.app_iter: + self._pos += len(chunk) + if self._pos < start: + continue + elif self._pos == start: + return b'' + else: + chunk = chunk[start - self._pos:] + if stop is not None and self._pos > stop: + chunk = chunk[:stop - self._pos] + assert len(chunk) == stop - start + return chunk + else: + raise StopIteration() + + def next(self): + if self._pos < self.start: + # need to skip some leading bytes + return self._skip_start() + stop = self.stop + if stop is not None and self._pos >= stop: + raise StopIteration + + chunk = next(self.app_iter) + self._pos += len(chunk) + + if stop is None or self._pos <= stop: + return chunk + else: + return chunk[:stop - self._pos] + + __next__ = next # py3 + + def close(self): + iter_close(self.app_iter) + + +class EmptyResponse(object): + """ + An empty WSGI response. + + An iterator that immediately stops. Optionally provides a close + method to close an underlying ``app_iter`` it replaces. + """ + + def __init__(self, app_iter=None): + if app_iter is not None and hasattr(app_iter, 'close'): + self.close = app_iter.close + + def __iter__(self): + return self + + def __len__(self): + return 0 + + def next(self): + raise StopIteration() + + __next__ = next # py3 + +def _is_xml(content_type): + return ( + content_type.startswith('application/xml') or + ( + content_type.startswith('application/') and + content_type.endswith('+xml') + ) or + ( + content_type.startswith('image/') and + content_type.endswith('+xml') + ) + ) + +def _content_type_has_charset(content_type): + return ( + content_type.startswith('text/') or + _is_xml(content_type) + ) + +def _request_uri(environ): + """Like ``wsgiref.url.request_uri``, except eliminates ``:80`` ports. + + Returns the full request URI.""" + url = environ['wsgi.url_scheme'] + '://' + + if environ.get('HTTP_HOST'): + url += environ['HTTP_HOST'] + else: + url += environ['SERVER_NAME'] + ':' + environ['SERVER_PORT'] + if url.endswith(':80') and environ['wsgi.url_scheme'] == 'http': + url = url[:-3] + elif url.endswith(':443') and environ['wsgi.url_scheme'] == 'https': + url = url[:-4] + + if PY2: + script_name = environ.get('SCRIPT_NAME', '/') + path_info = environ.get('PATH_INFO', '') + else: + script_name = bytes_(environ.get('SCRIPT_NAME', '/'), 'latin-1') + path_info = bytes_(environ.get('PATH_INFO', ''), 'latin-1') + + url += url_quote(script_name) + qpath_info = url_quote(path_info) + if 'SCRIPT_NAME' not in environ: + url += qpath_info[1:] + else: + url += qpath_info + return url + + +def iter_close(iter): + if hasattr(iter, 'close'): + iter.close() + +def gzip_app_iter(app_iter): + size = 0 + crc = zlib.crc32(b"") & 0xffffffff + compress = zlib.compressobj(9, zlib.DEFLATED, -zlib.MAX_WBITS, + zlib.DEF_MEM_LEVEL, 0) + + yield _gzip_header + for item in app_iter: + size += len(item) + crc = zlib.crc32(item, crc) & 0xffffffff + + # The compress function may return zero length bytes if the input is + # small enough; it buffers the input for the next iteration or for a + # flush. + result = compress.compress(item) + if result: + yield result + + # Similarly, flush may also not yield a value. + result = compress.flush() + if result: + yield result + yield struct.pack("<2L", crc, size & 0xffffffff) + +def _error_unicode_in_app_iter(app_iter, body): + app_iter_repr = repr(app_iter) + if len(app_iter_repr) > 50: + app_iter_repr = ( + app_iter_repr[:30] + '...' + app_iter_repr[-10:]) + raise TypeError( + 'An item of the app_iter (%s) was text, causing a ' + 'text body: %r' % (app_iter_repr, body)) diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/webob/static.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/webob/static.py new file mode 100644 index 0000000000000000000000000000000000000000..35881d3883b14d5ac40c0551e7b2eead61dc6e3a --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/webob/static.py @@ -0,0 +1,168 @@ +import mimetypes +import os + +from webob import exc +from webob.dec import wsgify +from webob.response import Response + +__all__ = [ + 'FileApp', 'DirectoryApp', +] + +mimetypes._winreg = None # do not load mimetypes from windows registry +mimetypes.add_type('text/javascript', '.js') # stdlib default is application/x-javascript +mimetypes.add_type('image/x-icon', '.ico') # not among defaults + +BLOCK_SIZE = 1<<16 + + +class FileApp(object): + """An application that will send the file at the given filename. + + Adds a mime type based on `mimetypes.guess_type()`. + """ + + def __init__(self, filename, **kw): + self.filename = filename + content_type, content_encoding = mimetypes.guess_type(filename) + kw.setdefault('content_type', content_type) + kw.setdefault('content_encoding', content_encoding) + kw.setdefault('accept_ranges', 'bytes') + self.kw = kw + # Used for testing purpose + self._open = open + + @wsgify + def __call__(self, req): + if req.method not in ('GET', 'HEAD'): + return exc.HTTPMethodNotAllowed("You cannot %s a file" % + req.method) + try: + stat = os.stat(self.filename) + except (IOError, OSError) as e: + msg = "Can't open %r: %s" % (self.filename, e) + return exc.HTTPNotFound(comment=msg) + + try: + file = self._open(self.filename, 'rb') + except (IOError, OSError) as e: + msg = "You are not permitted to view this file (%s)" % e + return exc.HTTPForbidden(msg) + + if 'wsgi.file_wrapper' in req.environ: + app_iter = req.environ['wsgi.file_wrapper'](file, BLOCK_SIZE) + else: + app_iter = FileIter(file) + + return Response( + app_iter = app_iter, + content_length = stat.st_size, + last_modified = stat.st_mtime, + #@@ etag + **self.kw + ).conditional_response_app + + +class FileIter(object): + def __init__(self, file): + self.file = file + + def app_iter_range(self, seek=None, limit=None, block_size=None): + """Iter over the content of the file. + + You can set the `seek` parameter to read the file starting from a + specific position. + + You can set the `limit` parameter to read the file up to specific + position. + + Finally, you can change the number of bytes read at once by setting the + `block_size` parameter. + """ + + if block_size is None: + block_size = BLOCK_SIZE + + if seek: + self.file.seek(seek) + if limit is not None: + limit -= seek + try: + while True: + data = self.file.read(min(block_size, limit) + if limit is not None + else block_size) + if not data: + return + yield data + if limit is not None: + limit -= len(data) + if limit <= 0: + return + finally: + self.file.close() + + __iter__ = app_iter_range + + +class DirectoryApp(object): + """An application that serves up the files in a given directory. + + This will serve index files (by default ``index.html``), or set + ``index_page=None`` to disable this. If you set + ``hide_index_with_redirect=True`` (it defaults to False) then + requests to, e.g., ``/index.html`` will be redirected to ``/``. + + To customize `FileApp` instances creation (which is what actually + serves the responses), override the `make_fileapp` method. + """ + + def __init__(self, path, index_page='index.html', hide_index_with_redirect=False, + **kw): + self.path = os.path.abspath(path) + if not self.path.endswith(os.path.sep): + self.path += os.path.sep + if not os.path.isdir(self.path): + raise IOError( + "Path does not exist or is not directory: %r" % self.path) + self.index_page = index_page + self.hide_index_with_redirect = hide_index_with_redirect + self.fileapp_kw = kw + + def make_fileapp(self, path): + return FileApp(path, **self.fileapp_kw) + + @wsgify + def __call__(self, req): + path = os.path.abspath(os.path.join(self.path, + req.path_info.lstrip('/'))) + if os.path.isdir(path) and self.index_page: + return self.index(req, path) + if (self.index_page and self.hide_index_with_redirect + and path.endswith(os.path.sep + self.index_page)): + new_url = req.path_url.rsplit('/', 1)[0] + new_url += '/' + if req.query_string: + new_url += '?' + req.query_string + return Response( + status=301, + location=new_url) + if not path.startswith(self.path): + return exc.HTTPForbidden() + elif not os.path.isfile(path): + return exc.HTTPNotFound(comment=path) + else: + return self.make_fileapp(path) + + def index(self, req, path): + index_path = os.path.join(path, self.index_page) + if not os.path.isfile(index_path): + return exc.HTTPNotFound(comment=index_path) + if not req.path_info.endswith('/'): + url = req.path_url + '/' + if req.query_string: + url += '?' + req.query_string + return Response( + status=301, + location=url) + return self.make_fileapp(index_path) diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/webob/util.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/webob/util.py new file mode 100644 index 0000000000000000000000000000000000000000..b7db88c5bb5768176b1733c2be1eb7dc4878a0e5 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/webob/util.py @@ -0,0 +1,170 @@ +import warnings + +from webob.compat import ( + escape, + string_types, + text_, + text_type, + ) + +from webob.headers import _trans_key + +def html_escape(s): + """HTML-escape a string or object + + This converts any non-string objects passed into it to strings + (actually, using ``unicode()``). All values returned are + non-unicode strings (using ``&#num;`` entities for all non-ASCII + characters). + + None is treated specially, and returns the empty string. + """ + if s is None: + return '' + __html__ = getattr(s, '__html__', None) + if __html__ is not None and callable(__html__): + return s.__html__() + if not isinstance(s, string_types): + __unicode__ = getattr(s, '__unicode__', None) + if __unicode__ is not None and callable(__unicode__): + s = s.__unicode__() + else: + s = str(s) + s = escape(s, True) + if isinstance(s, text_type): + s = s.encode('ascii', 'xmlcharrefreplace') + return text_(s) + +def header_docstring(header, rfc_section): + if header.isupper(): + header = _trans_key(header) + major_section = rfc_section.split('.')[0] + link = 'http://www.w3.org/Protocols/rfc2616/rfc2616-sec%s.html#sec%s' % ( + major_section, rfc_section) + return "Gets and sets the ``%s`` header (`HTTP spec section %s <%s>`_)." % ( + header, rfc_section, link) + + +def warn_deprecation(text, version, stacklevel): + # version specifies when to start raising exceptions instead of warnings + if version in ('1.2', '1.3', '1.4', '1.5', '1.6', '1.7'): + raise DeprecationWarning(text) + else: + cls = DeprecationWarning + warnings.warn(text, cls, stacklevel=stacklevel + 1) + +status_reasons = { + # Status Codes + # Informational + 100: 'Continue', + 101: 'Switching Protocols', + 102: 'Processing', + + # Successful + 200: 'OK', + 201: 'Created', + 202: 'Accepted', + 203: 'Non-Authoritative Information', + 204: 'No Content', + 205: 'Reset Content', + 206: 'Partial Content', + 207: 'Multi Status', + 226: 'IM Used', + + # Redirection + 300: 'Multiple Choices', + 301: 'Moved Permanently', + 302: 'Found', + 303: 'See Other', + 304: 'Not Modified', + 305: 'Use Proxy', + 307: 'Temporary Redirect', + 308: 'Permanent Redirect', + + # Client Error + 400: 'Bad Request', + 401: 'Unauthorized', + 402: 'Payment Required', + 403: 'Forbidden', + 404: 'Not Found', + 405: 'Method Not Allowed', + 406: 'Not Acceptable', + 407: 'Proxy Authentication Required', + 408: 'Request Timeout', + 409: 'Conflict', + 410: 'Gone', + 411: 'Length Required', + 412: 'Precondition Failed', + 413: 'Request Entity Too Large', + 414: 'Request URI Too Long', + 415: 'Unsupported Media Type', + 416: 'Requested Range Not Satisfiable', + 417: 'Expectation Failed', + 418: "I'm a teapot", + 422: 'Unprocessable Entity', + 423: 'Locked', + 424: 'Failed Dependency', + 426: 'Upgrade Required', + 428: 'Precondition Required', + 429: 'Too Many Requests', + 451: 'Unavailable for Legal Reasons', + 431: 'Request Header Fields Too Large', + + # Server Error + 500: 'Internal Server Error', + 501: 'Not Implemented', + 502: 'Bad Gateway', + 503: 'Service Unavailable', + 504: 'Gateway Timeout', + 505: 'HTTP Version Not Supported', + 507: 'Insufficient Storage', + 510: 'Not Extended', + 511: 'Network Authentication Required', +} + +# generic class responses as per RFC2616 +status_generic_reasons = { + 1: 'Continue', + 2: 'Success', + 3: 'Multiple Choices', + 4: 'Unknown Client Error', + 5: 'Unknown Server Error', +} + +try: + # py3.3+ have native comparison support + from hmac import compare_digest +except ImportError: # pragma: nocover (Python 2.7.7 backported this) + compare_digest = None + +def strings_differ(string1, string2, compare_digest=compare_digest): + """Check whether two strings differ while avoiding timing attacks. + + This function returns True if the given strings differ and False + if they are equal. It's careful not to leak information about *where* + they differ as a result of its running time, which can be very important + to avoid certain timing-related crypto attacks: + + http://seb.dbzteam.org/crypto/python-oauth-timing-hmac.pdf + + .. versionchanged:: 1.5 + Support :func:`hmac.compare_digest` if it is available (Python 2.7.7+ + and Python 3.3+). + + """ + len_eq = len(string1) == len(string2) + if len_eq: + invalid_bits = 0 + left = string1 + else: + invalid_bits = 1 + left = string2 + right = string2 + + if compare_digest is not None: + invalid_bits += not compare_digest(left, right) + else: + for a, b in zip(left, right): + invalid_bits += a != b + return invalid_bits != 0 + diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/werkzeug-3.1.6.dist-info/INSTALLER b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/werkzeug-3.1.6.dist-info/INSTALLER new file mode 100644 index 0000000000000000000000000000000000000000..a1b589e38a32041e49332e5e81c2d363dc418d68 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/werkzeug-3.1.6.dist-info/INSTALLER @@ -0,0 +1 @@ +pip diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/werkzeug-3.1.6.dist-info/METADATA b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/werkzeug-3.1.6.dist-info/METADATA new file mode 100644 index 0000000000000000000000000000000000000000..1cc4bf8fc64ce97580ca90e27eecbe44af2e0f44 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/werkzeug-3.1.6.dist-info/METADATA @@ -0,0 +1,109 @@ +Metadata-Version: 2.4 +Name: Werkzeug +Version: 3.1.6 +Summary: The comprehensive WSGI web application library. +Maintainer-email: Pallets +Requires-Python: >=3.9 +Description-Content-Type: text/markdown +License-Expression: BSD-3-Clause +Classifier: Development Status :: 5 - Production/Stable +Classifier: Environment :: Web Environment +Classifier: Intended Audience :: Developers +Classifier: Operating System :: OS Independent +Classifier: Programming Language :: Python +Classifier: Topic :: Internet :: WWW/HTTP :: Dynamic Content +Classifier: Topic :: Internet :: WWW/HTTP :: WSGI +Classifier: Topic :: Internet :: WWW/HTTP :: WSGI :: Application +Classifier: Topic :: Internet :: WWW/HTTP :: WSGI :: Middleware +Classifier: Topic :: Software Development :: Libraries :: Application Frameworks +Classifier: Typing :: Typed +License-File: LICENSE.txt +Requires-Dist: markupsafe>=2.1.1 +Requires-Dist: watchdog>=2.3 ; extra == "watchdog" +Project-URL: Changes, https://werkzeug.palletsprojects.com/page/changes/ +Project-URL: Chat, https://discord.gg/pallets +Project-URL: Documentation, https://werkzeug.palletsprojects.com/ +Project-URL: Donate, https://palletsprojects.com/donate +Project-URL: Source, https://github.com/pallets/werkzeug/ +Provides-Extra: watchdog + +
+ +# Werkzeug + +*werkzeug* German noun: "tool". Etymology: *werk* ("work"), *zeug* ("stuff") + +Werkzeug is a comprehensive [WSGI][] web application library. It began as +a simple collection of various utilities for WSGI applications and has +become one of the most advanced WSGI utility libraries. + +It includes: + +- An interactive debugger that allows inspecting stack traces and + source code in the browser with an interactive interpreter for any + frame in the stack. +- A full-featured request object with objects to interact with + headers, query args, form data, files, and cookies. +- A response object that can wrap other WSGI applications and handle + streaming data. +- A routing system for matching URLs to endpoints and generating URLs + for endpoints, with an extensible system for capturing variables + from URLs. +- HTTP utilities to handle entity tags, cache control, dates, user + agents, cookies, files, and more. +- A threaded WSGI server for use while developing applications + locally. +- A test client for simulating HTTP requests during testing without + requiring running a server. + +Werkzeug doesn't enforce any dependencies. It is up to the developer to +choose a template engine, database adapter, and even how to handle +requests. It can be used to build all sorts of end user applications +such as blogs, wikis, or bulletin boards. + +[Flask][] wraps Werkzeug, using it to handle the details of WSGI while +providing more structure and patterns for defining powerful +applications. + +[WSGI]: https://wsgi.readthedocs.io/en/latest/ +[Flask]: https://www.palletsprojects.com/p/flask/ + + +## A Simple Example + +```python +# save this as app.py +from werkzeug.wrappers import Request, Response + +@Request.application +def application(request: Request) -> Response: + return Response("Hello, World!") + +if __name__ == "__main__": + from werkzeug.serving import run_simple + run_simple("127.0.0.1", 5000, application) +``` + +``` +$ python -m app + * Running on http://127.0.0.1:5000/ (Press CTRL+C to quit) +``` + + +## Donate + +The Pallets organization develops and supports Werkzeug and other +popular packages. In order to grow the community of contributors and +users, and allow the maintainers to devote more time to the projects, +[please donate today][]. + +[please donate today]: https://palletsprojects.com/donate + +## Contributing + +See our [detailed contributing documentation][contrib] for many ways to +contribute, including reporting issues, requesting features, asking or answering +questions, and making PRs. + +[contrib]: https://palletsprojects.com/contributing/ + diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/werkzeug-3.1.6.dist-info/RECORD b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/werkzeug-3.1.6.dist-info/RECORD new file mode 100644 index 0000000000000000000000000000000000000000..22fe861de1b3e77356fac7096e918f958d7d7621 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/werkzeug-3.1.6.dist-info/RECORD @@ -0,0 +1,116 @@ +werkzeug-3.1.6.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4 +werkzeug-3.1.6.dist-info/METADATA,sha256=3gkebnRugCLVmObgiGxJei3-DbVNlPDxrrIwukQWOE0,4029 +werkzeug-3.1.6.dist-info/RECORD,, +werkzeug-3.1.6.dist-info/WHEEL,sha256=G2gURzTEtmeR8nrdXUJfNiB3VYVxigPQ-bEQujpNiNs,82 +werkzeug-3.1.6.dist-info/licenses/LICENSE.txt,sha256=O0nc7kEF6ze6wQ-vG-JgQI_oXSUrjp3y4JefweCUQ3s,1475 +werkzeug/__init__.py,sha256=CejNWfCZKDaJ_FmshZFw8dFgjNAlu6q15ec7DwWJlM8,165 +werkzeug/__pycache__/__init__.cpython-310.pyc,, +werkzeug/__pycache__/_internal.cpython-310.pyc,, +werkzeug/__pycache__/_reloader.cpython-310.pyc,, +werkzeug/__pycache__/exceptions.cpython-310.pyc,, +werkzeug/__pycache__/formparser.cpython-310.pyc,, +werkzeug/__pycache__/http.cpython-310.pyc,, +werkzeug/__pycache__/local.cpython-310.pyc,, +werkzeug/__pycache__/security.cpython-310.pyc,, +werkzeug/__pycache__/serving.cpython-310.pyc,, +werkzeug/__pycache__/test.cpython-310.pyc,, +werkzeug/__pycache__/testapp.cpython-310.pyc,, +werkzeug/__pycache__/urls.cpython-310.pyc,, +werkzeug/__pycache__/user_agent.cpython-310.pyc,, +werkzeug/__pycache__/utils.cpython-310.pyc,, +werkzeug/__pycache__/wsgi.cpython-310.pyc,, +werkzeug/_internal.py,sha256=QRynfUEOngEAmm4qzhlufbhk1K-n901Q1KQWKznsaNU,5547 +werkzeug/_reloader.py,sha256=IppO3kX_GxQwaV6h8SPWe0lSTSw6kd_HJXqLiUhR7AU,15100 +werkzeug/datastructures/__init__.py,sha256=0Vt8Lt8KUYSoAe8ADt1jIE-w3Ib9tkrk0HEhBOktqUw,2615 +werkzeug/datastructures/__pycache__/__init__.cpython-310.pyc,, +werkzeug/datastructures/__pycache__/accept.cpython-310.pyc,, +werkzeug/datastructures/__pycache__/auth.cpython-310.pyc,, +werkzeug/datastructures/__pycache__/cache_control.cpython-310.pyc,, +werkzeug/datastructures/__pycache__/csp.cpython-310.pyc,, +werkzeug/datastructures/__pycache__/etag.cpython-310.pyc,, +werkzeug/datastructures/__pycache__/file_storage.cpython-310.pyc,, +werkzeug/datastructures/__pycache__/headers.cpython-310.pyc,, +werkzeug/datastructures/__pycache__/mixins.cpython-310.pyc,, +werkzeug/datastructures/__pycache__/range.cpython-310.pyc,, +werkzeug/datastructures/__pycache__/structures.cpython-310.pyc,, +werkzeug/datastructures/accept.py,sha256=xoDD4qwZeTjew_1Ze0gyyKWkbhtowwR5tHTWnobPeGI,12177 +werkzeug/datastructures/auth.py,sha256=Zcqdr8-uUpq6_czg1672S2XthG0UakhUHOuummzqz64,10055 +werkzeug/datastructures/cache_control.py,sha256=omtSmmAh3KgQRJYzaW05LtEt5HoJlLkJTxjil-Q3cuM,9711 +werkzeug/datastructures/csp.py,sha256=jWl1dxhkbc6_eE9qGnTGBJSimWNQljKKYwmlys4dFOA,3816 +werkzeug/datastructures/etag.py,sha256=N2dFqhFsLR0k5hgjol3QTGpcSltJhpgLWeyz6Va80G8,3278 +werkzeug/datastructures/file_storage.py,sha256=J57paAQGxBnq2yjY0yfsEuN1wPRkDXLkWH3wk_pQvTs,6715 +werkzeug/datastructures/headers.py,sha256=J3WQKnQGmt9hUDn-d_YI62PtrjW7U7sJTDNTFtjWgRA,21540 +werkzeug/datastructures/mixins.py,sha256=h8K_A0Sw47s2cO2ZNFf60ENbmVDsi3rgHr_f77VFwJE,9039 +werkzeug/datastructures/range.py,sha256=KAWLRDyL8bzSBDm_OirxwA17xkFM_vdedZINmyDfNUI,7034 +werkzeug/datastructures/structures.py,sha256=dQ3n8KP5UHyad1TMsWmQBK3K9pNPByK5Nd0AV09oOAo,41385 +werkzeug/debug/__init__.py,sha256=8QoMJ1iGA7NGp3wxw6Sa3fPJHlrCggrRH30bQg9ei2o,20319 +werkzeug/debug/__pycache__/__init__.cpython-310.pyc,, +werkzeug/debug/__pycache__/console.cpython-310.pyc,, +werkzeug/debug/__pycache__/repr.cpython-310.pyc,, +werkzeug/debug/__pycache__/tbtools.cpython-310.pyc,, +werkzeug/debug/console.py,sha256=t4hZ0Qg1p6Uu2MWimqoMDi7S3WYZvLMjnc8v_dPaxAo,6089 +werkzeug/debug/repr.py,sha256=iHMYny8whiiMDasvUqj0nm4-1VHVvwe697KleiZVK1s,9303 +werkzeug/debug/shared/ICON_LICENSE.md,sha256=DhA6Y1gUl5Jwfg0NFN9Rj4VWITt8tUx0IvdGf0ux9-s,222 +werkzeug/debug/shared/console.png,sha256=bxax6RXXlvOij_KeqvSNX0ojJf83YbnZ7my-3Gx9w2A,507 +werkzeug/debug/shared/debugger.js,sha256=SRL9YZ9FTVngaYD-INQNincEVdZ-kBHa_-VJx0U7-rg,10068 +werkzeug/debug/shared/less.png,sha256=-4-kNRaXJSONVLahrQKUxMwXGm9R4OnZ9SxDGpHlIR4,191 +werkzeug/debug/shared/more.png,sha256=GngN7CioHQoV58rH6ojnkYi8c_qED2Aka5FO5UXrReY,200 +werkzeug/debug/shared/style.css,sha256=-xSxzUEZGw_IqlDR5iZxitNl8LQUjBM-_Y4UAvXVH8g,6078 +werkzeug/debug/tbtools.py,sha256=L_CD1ha5WmyWrKVZ3zxovJ4gI1CATsc4Yc1Zms41EvE,13645 +werkzeug/exceptions.py,sha256=7XNgddMV3UQR6UPr7lWlzSFxO8Ur8bSJgLdvJuauEX0,26888 +werkzeug/formparser.py,sha256=v0-F9OcmNHuPLqXePW_b0asWzpH-Z_ZlGj8ao0CMmuo,15847 +werkzeug/http.py,sha256=gOc_P6u9Am2Z8fQolD_JnBi25FAUUpJXtp0js22Fwtg,44908 +werkzeug/local.py,sha256=o4Zz1ZAuNRBn8r-laGIxCdKXjxx1i0uJq3eNyKPy4cg,22184 +werkzeug/middleware/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +werkzeug/middleware/__pycache__/__init__.cpython-310.pyc,, +werkzeug/middleware/__pycache__/dispatcher.cpython-310.pyc,, +werkzeug/middleware/__pycache__/http_proxy.cpython-310.pyc,, +werkzeug/middleware/__pycache__/lint.cpython-310.pyc,, +werkzeug/middleware/__pycache__/profiler.cpython-310.pyc,, +werkzeug/middleware/__pycache__/proxy_fix.cpython-310.pyc,, +werkzeug/middleware/__pycache__/shared_data.cpython-310.pyc,, +werkzeug/middleware/dispatcher.py,sha256=zWN5_lqJr_sc9UDv-PPoSlDHN_zR33z6B74F_4Cxpo8,2602 +werkzeug/middleware/http_proxy.py,sha256=sdk-V6GoZ6aMny-D0QNKNf5MWD2OTO3AGbBg6upp4Hc,7834 +werkzeug/middleware/lint.py,sha256=jVdyljRxpkz18MiMR8N7YdiElna8DJVvO4CCjZsnSQI,14476 +werkzeug/middleware/profiler.py,sha256=1ZAHlDeYNdhgp8THOXkV5lgmcLl307phAr2Ufy30-lY,5562 +werkzeug/middleware/proxy_fix.py,sha256=n-HW-MRWJquCIhmqiZKoGdbbEeHuWJqPRHhFpuj4pzY,6755 +werkzeug/middleware/shared_data.py,sha256=gsjmgeEFLzDdKsgd19pMhI7BfU_TbL6AyEyZPG2ykfQ,9542 +werkzeug/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +werkzeug/routing/__init__.py,sha256=d8TRxsk24IWu2BdoOYUfL--deolHwiGVCBJqLoEe3YM,4820 +werkzeug/routing/__pycache__/__init__.cpython-310.pyc,, +werkzeug/routing/__pycache__/converters.cpython-310.pyc,, +werkzeug/routing/__pycache__/exceptions.cpython-310.pyc,, +werkzeug/routing/__pycache__/map.cpython-310.pyc,, +werkzeug/routing/__pycache__/matcher.cpython-310.pyc,, +werkzeug/routing/__pycache__/rules.cpython-310.pyc,, +werkzeug/routing/converters.py,sha256=iqpee_mAjr1oGbq0etujYF9PiDv5U7DgNkARHXnMId0,7297 +werkzeug/routing/exceptions.py,sha256=wNBiUmUk4OtFOpbdDSr7KKKUjH7yn84JqwBicUup8p8,4846 +werkzeug/routing/map.py,sha256=a7PSRAELyNyoPFP_uhyNDAsmPjEbrcyewPnEZIl-0ZI,35863 +werkzeug/routing/matcher.py,sha256=nfBbl37eGAkZ1dQlumshFcPuyfggmFjPuSSQOE6GuYs,7849 +werkzeug/routing/rules.py,sha256=XADfK242jF_r4-q7nBo2Zz66RTzcCPOqG5WNfRFNpoo,32538 +werkzeug/sansio/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +werkzeug/sansio/__pycache__/__init__.cpython-310.pyc,, +werkzeug/sansio/__pycache__/http.cpython-310.pyc,, +werkzeug/sansio/__pycache__/multipart.cpython-310.pyc,, +werkzeug/sansio/__pycache__/request.cpython-310.pyc,, +werkzeug/sansio/__pycache__/response.cpython-310.pyc,, +werkzeug/sansio/__pycache__/utils.cpython-310.pyc,, +werkzeug/sansio/http.py,sha256=l-N1ktc7WVgfDA9t1MhyeVFNJGvnRTC8mJViZDQYVGA,5351 +werkzeug/sansio/multipart.py,sha256=uLdLH7ffelFXRaXu2_WXK__X11uA7bHCsqfyLerqGSo,11841 +werkzeug/sansio/request.py,sha256=ijwestWQS-dpb61uKl0NRntzNtH6C72OXCNomx-XKxc,19832 +werkzeug/sansio/response.py,sha256=159j3TC2AbDvqppcegVmpLftot70UWtm5qZO0kqQpFk,27930 +werkzeug/sansio/utils.py,sha256=3-Gr0Qsa_Rx48mUm7zdFJZNNKMzHfPAknywujHnkhPs,5256 +werkzeug/security.py,sha256=WHb2oiwyOie5XI8WNnKYd4YVjSwBhGf3nPyKBSGGlI0,6654 +werkzeug/serving.py,sha256=jUSzy9o1iZ_LwdReXZusdoOJPjMK03xGCzhsZ_SUtpk,39826 +werkzeug/test.py,sha256=Xf8bCYkjKJLtTXWTvw4E5AlYrK7CYjnmIolxSHkkKsc,52779 +werkzeug/testapp.py,sha256=5_IS5Dh_WfWfNcTLmbydj01lomgcKA_4l9PPCNZnmdI,6332 +werkzeug/urls.py,sha256=XyNKwHvK5IC37-wuIDMYWkiCJ3yLTLGv7wn2GF3ndqI,6430 +werkzeug/user_agent.py,sha256=lSlLYKCcbzCUSkbdAoO8zPk2UR-8Mdn6iu_iA2kYPBA,1416 +werkzeug/utils.py,sha256=QRcyUe4JURGaOAqZGnECcsbwKsEkL7gUDZiTNlLV0W4,24623 +werkzeug/wrappers/__init__.py,sha256=b78jCM8x96kJUGLZ5FYFR3zlK-3pnFAmP9RJIGU0ses,138 +werkzeug/wrappers/__pycache__/__init__.cpython-310.pyc,, +werkzeug/wrappers/__pycache__/request.cpython-310.pyc,, +werkzeug/wrappers/__pycache__/response.cpython-310.pyc,, +werkzeug/wrappers/request.py,sha256=f9Jpe9zqs_v0n-DTZj7FfMyU_y3LhBBBX4YCYsrqGUs,24730 +werkzeug/wrappers/response.py,sha256=VRcXJVRjaYYE0Q93PVu0Y5nhDf9TJkjhY8j_RtMalX0,32443 +werkzeug/wsgi.py,sha256=SAj53op0Hqa6Bd10FHglfR8wk7jLGw5_vn9naPSDlpM,20920 diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/werkzeug-3.1.6.dist-info/WHEEL b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/werkzeug-3.1.6.dist-info/WHEEL new file mode 100644 index 0000000000000000000000000000000000000000..d8b9936dad9ab2513fa6979f411560d3b6b57e37 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/werkzeug-3.1.6.dist-info/WHEEL @@ -0,0 +1,4 @@ +Wheel-Version: 1.0 +Generator: flit 3.12.0 +Root-Is-Purelib: true +Tag: py3-none-any diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/werkzeug-3.1.6.dist-info/licenses/LICENSE.txt b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/werkzeug-3.1.6.dist-info/licenses/LICENSE.txt new file mode 100644 index 0000000000000000000000000000000000000000..c37cae49ec77ad6ebb25568c1605f1fee5313cfb --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/werkzeug-3.1.6.dist-info/licenses/LICENSE.txt @@ -0,0 +1,28 @@ +Copyright 2007 Pallets + +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. Neither the name of the copyright holder 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. diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/werkzeug/__init__.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/werkzeug/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..0b248fd86152e58889a226aa628c6222fe23ece1 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/werkzeug/__init__.py @@ -0,0 +1,4 @@ +from .serving import run_simple as run_simple +from .test import Client as Client +from .wrappers import Request as Request +from .wrappers import Response as Response diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/werkzeug/_internal.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/werkzeug/_internal.py new file mode 100644 index 0000000000000000000000000000000000000000..75e43358b629ec88692ca87d57deddc2252c554a --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/werkzeug/_internal.py @@ -0,0 +1,211 @@ +from __future__ import annotations + +import logging +import re +import sys +import typing as t +from datetime import datetime +from datetime import timezone + +if t.TYPE_CHECKING: + from _typeshed.wsgi import WSGIEnvironment + + from .wrappers.request import Request + +_logger: logging.Logger | None = None + + +class _Missing: + def __repr__(self) -> str: + return "no value" + + def __reduce__(self) -> str: + return "_missing" + + +_missing = _Missing() + + +def _wsgi_decoding_dance(s: str) -> str: + return s.encode("latin1").decode(errors="replace") + + +def _wsgi_encoding_dance(s: str) -> str: + return s.encode().decode("latin1") + + +def _get_environ(obj: WSGIEnvironment | Request) -> WSGIEnvironment: + env = getattr(obj, "environ", obj) + assert isinstance(env, dict), ( + f"{type(obj).__name__!r} is not a WSGI environment (has to be a dict)" + ) + return env + + +def _has_level_handler(logger: logging.Logger) -> bool: + """Check if there is a handler in the logging chain that will handle + the given logger's effective level. + """ + level = logger.getEffectiveLevel() + current = logger + + while current: + if any(handler.level <= level for handler in current.handlers): + return True + + if not current.propagate: + break + + current = current.parent # type: ignore + + return False + + +class _ColorStreamHandler(logging.StreamHandler): # type: ignore[type-arg] + """On Windows, wrap stream with Colorama for ANSI style support.""" + + def __init__(self) -> None: + try: + import colorama + except ImportError: + stream = None + else: + stream = colorama.AnsiToWin32(sys.stderr) + + super().__init__(stream) + + +def _log(type: str, message: str, *args: t.Any, **kwargs: t.Any) -> None: + """Log a message to the 'werkzeug' logger. + + The logger is created the first time it is needed. If there is no + level set, it is set to :data:`logging.INFO`. If there is no handler + for the logger's effective level, a :class:`logging.StreamHandler` + is added. + """ + global _logger + + if _logger is None: + _logger = logging.getLogger("werkzeug") + + if _logger.level == logging.NOTSET: + _logger.setLevel(logging.INFO) + + if not _has_level_handler(_logger): + _logger.addHandler(_ColorStreamHandler()) + + getattr(_logger, type)(message.rstrip(), *args, **kwargs) + + +@t.overload +def _dt_as_utc(dt: None) -> None: ... + + +@t.overload +def _dt_as_utc(dt: datetime) -> datetime: ... + + +def _dt_as_utc(dt: datetime | None) -> datetime | None: + if dt is None: + return dt + + if dt.tzinfo is None: + return dt.replace(tzinfo=timezone.utc) + elif dt.tzinfo != timezone.utc: + return dt.astimezone(timezone.utc) + + return dt + + +_TAccessorValue = t.TypeVar("_TAccessorValue") + + +class _DictAccessorProperty(t.Generic[_TAccessorValue]): + """Baseclass for `environ_property` and `header_property`.""" + + read_only = False + + def __init__( + self, + name: str, + default: _TAccessorValue | None = None, + load_func: t.Callable[[str], _TAccessorValue] | None = None, + dump_func: t.Callable[[_TAccessorValue], str] | None = None, + read_only: bool | None = None, + doc: str | None = None, + ) -> None: + self.name = name + self.default = default + self.load_func = load_func + self.dump_func = dump_func + if read_only is not None: + self.read_only = read_only + self.__doc__ = doc + + def lookup(self, instance: t.Any) -> t.MutableMapping[str, t.Any]: + raise NotImplementedError + + @t.overload + def __get__( + self, instance: None, owner: type + ) -> _DictAccessorProperty[_TAccessorValue]: ... + + @t.overload + def __get__(self, instance: t.Any, owner: type) -> _TAccessorValue: ... + + def __get__( + self, instance: t.Any | None, owner: type + ) -> _TAccessorValue | _DictAccessorProperty[_TAccessorValue]: + if instance is None: + return self + + storage = self.lookup(instance) + + if self.name not in storage: + return self.default # type: ignore + + value = storage[self.name] + + if self.load_func is not None: + try: + return self.load_func(value) + except (ValueError, TypeError): + return self.default # type: ignore + + return value # type: ignore + + def __set__(self, instance: t.Any, value: _TAccessorValue) -> None: + if self.read_only: + raise AttributeError("read only property") + + if self.dump_func is not None: + self.lookup(instance)[self.name] = self.dump_func(value) + else: + self.lookup(instance)[self.name] = value + + def __delete__(self, instance: t.Any) -> None: + if self.read_only: + raise AttributeError("read only property") + + self.lookup(instance).pop(self.name, None) + + def __repr__(self) -> str: + return f"<{type(self).__name__} {self.name}>" + + +_plain_int_re = re.compile(r"-?\d+", re.ASCII) + + +def _plain_int(value: str) -> int: + """Parse an int only if it is only ASCII digits and ``-``. + + This disallows ``+``, ``_``, and non-ASCII digits, which are accepted by ``int`` but + are not allowed in HTTP header values. + + Any leading or trailing whitespace is stripped + """ + value = value.strip() + if _plain_int_re.fullmatch(value) is None: + raise ValueError + + return int(value) diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/werkzeug/_reloader.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/werkzeug/_reloader.py new file mode 100644 index 0000000000000000000000000000000000000000..5eb64bc7d0db4acd88f10bd36bdf57822c2f5df3 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/werkzeug/_reloader.py @@ -0,0 +1,465 @@ +from __future__ import annotations + +import fnmatch +import os +import subprocess +import sys +import threading +import time +import typing as t +from itertools import chain +from pathlib import PurePath + +from ._internal import _log + +# The various system prefixes where imports are found. Base values are +# different when running in a virtualenv. All reloaders will ignore the +# base paths (usually the system installation). The stat reloader won't +# scan the virtualenv paths, it will only include modules that are +# already imported. +_ignore_always = tuple({sys.base_prefix, sys.base_exec_prefix}) +prefix = {*_ignore_always, sys.prefix, sys.exec_prefix} + +if hasattr(sys, "real_prefix"): + # virtualenv < 20 + prefix.add(sys.real_prefix) + +_stat_ignore_scan = tuple(prefix) +del prefix +# Ignore __pycache__ since a change there will always have a change to +# the source file (or initial pyc file) as well. Ignore common version control +# internals. Ignore common tool caches. +_ignore_common_dirs = { + "__pycache__", + ".git", + ".hg", + ".tox", + ".nox", + ".pytest_cache", + ".mypy_cache", +} + + +def _iter_module_paths() -> t.Iterator[str]: + """Find the filesystem paths associated with imported modules.""" + # List is in case the value is modified by the app while updating. + for module in list(sys.modules.values()): + name = getattr(module, "__file__", None) + + if name is None or name.startswith(_ignore_always): + continue + + while not os.path.isfile(name): + # Zip file, find the base file without the module path. + old = name + name = os.path.dirname(name) + + if name == old: # skip if it was all directories somehow + break + else: + yield name + + +def _remove_by_pattern(paths: set[str], exclude_patterns: set[str]) -> None: + for pattern in exclude_patterns: + paths.difference_update(fnmatch.filter(paths, pattern)) + + +def _find_stat_paths( + extra_files: set[str], exclude_patterns: set[str] +) -> t.Iterable[str]: + """Find paths for the stat reloader to watch. Returns imported + module files, Python files under non-system paths. Extra files and + Python files under extra directories can also be scanned. + + System paths have to be excluded for efficiency. Non-system paths, + such as a project root or ``sys.path.insert``, should be the paths + of interest to the user anyway. + """ + paths = set() + + for path in chain(list(sys.path), extra_files): + path = os.path.abspath(path) + + if os.path.isfile(path): + # zip file on sys.path, or extra file + paths.add(path) + continue + + parent_has_py = {os.path.dirname(path): True} + + for root, dirs, files in os.walk(path): + if ( + root.startswith(_stat_ignore_scan) + or os.path.basename(root) in _ignore_common_dirs + ): + dirs.clear() + continue + + has_py = False + + for name in files: + if name.endswith((".py", ".pyc")): + has_py = True + paths.add(os.path.join(root, name)) + + # Optimization: stop scanning a directory if neither it nor + # its parent contained Python files. + if not (has_py or parent_has_py[os.path.dirname(root)]): + dirs.clear() + continue + + parent_has_py[root] = has_py + + paths.update(_iter_module_paths()) + _remove_by_pattern(paths, exclude_patterns) + return paths + + +def _find_watchdog_paths( + extra_files: set[str], exclude_patterns: set[str] +) -> t.Iterable[str]: + """Find paths for the stat reloader to watch. Looks at the same + sources as the stat reloader, but watches everything under + directories instead of individual files. + """ + dirs = set() + + for name in chain(list(sys.path), extra_files): + name = os.path.abspath(name) + + if os.path.isfile(name): + name = os.path.dirname(name) + + dirs.add(name) + + for name in _iter_module_paths(): + dirs.add(os.path.dirname(name)) + + _remove_by_pattern(dirs, exclude_patterns) + return _find_common_roots(dirs) + + +def _find_common_roots(paths: t.Iterable[str]) -> t.Iterable[str]: + root: dict[str, dict[str, t.Any]] = {} + + for chunks in sorted((PurePath(x).parts for x in paths), key=len, reverse=True): + node = root + + for chunk in chunks: + node = node.setdefault(chunk, {}) + + node.clear() + + rv = set() + + def _walk(node: t.Mapping[str, dict[str, t.Any]], path: tuple[str, ...]) -> None: + for prefix, child in node.items(): + _walk(child, path + (prefix,)) + + # If there are no more nodes, and a path has been accumulated, add it. + # Path may be empty if the "" entry is in sys.path. + if not node and path: + rv.add(os.path.join(*path)) + + _walk(root, ()) + return rv + + +def _get_args_for_reloading() -> list[str]: + """Determine how the script was executed, and return the args needed + to execute it again in a new process. + """ + if sys.version_info >= (3, 10): + # sys.orig_argv, added in Python 3.10, contains the exact args used to invoke + # Python. Still replace argv[0] with sys.executable for accuracy. + return [sys.executable, *sys.orig_argv[1:]] + + rv = [sys.executable] + py_script = sys.argv[0] + args = sys.argv[1:] + # Need to look at main module to determine how it was executed. + __main__ = sys.modules["__main__"] + + # The value of __package__ indicates how Python was called. It may + # not exist if a setuptools script is installed as an egg. It may be + # set incorrectly for entry points created with pip on Windows. + if getattr(__main__, "__package__", None) is None or ( + os.name == "nt" + and __main__.__package__ == "" + and not os.path.exists(py_script) + and os.path.exists(f"{py_script}.exe") + ): + # Executed a file, like "python app.py". + py_script = os.path.abspath(py_script) + + if os.name == "nt": + # Windows entry points have ".exe" extension and should be + # called directly. + if not os.path.exists(py_script) and os.path.exists(f"{py_script}.exe"): + py_script += ".exe" + + if ( + os.path.splitext(sys.executable)[1] == ".exe" + and os.path.splitext(py_script)[1] == ".exe" + ): + rv.pop(0) + + rv.append(py_script) + else: + # Executed a module, like "python -m werkzeug.serving". + if os.path.isfile(py_script): + # Rewritten by Python from "-m script" to "/path/to/script.py". + py_module = t.cast(str, __main__.__package__) + name = os.path.splitext(os.path.basename(py_script))[0] + + if name != "__main__": + py_module += f".{name}" + else: + # Incorrectly rewritten by pydevd debugger from "-m script" to "script". + py_module = py_script + + rv.extend(("-m", py_module.lstrip("."))) + + rv.extend(args) + return rv + + +class ReloaderLoop: + name = "" + + def __init__( + self, + extra_files: t.Iterable[str] | None = None, + exclude_patterns: t.Iterable[str] | None = None, + interval: int | float = 1, + ) -> None: + self.extra_files: set[str] = {os.path.abspath(x) for x in extra_files or ()} + self.exclude_patterns: set[str] = set(exclude_patterns or ()) + self.interval = interval + + def __enter__(self) -> ReloaderLoop: + """Do any setup, then run one step of the watch to populate the + initial filesystem state. + """ + self.run_step() + return self + + def __exit__(self, exc_type, exc_val, exc_tb): # type: ignore + """Clean up any resources associated with the reloader.""" + pass + + def run(self) -> None: + """Continually run the watch step, sleeping for the configured + interval after each step. + """ + while True: + self.run_step() + time.sleep(self.interval) + + def run_step(self) -> None: + """Run one step for watching the filesystem. Called once to set + up initial state, then repeatedly to update it. + """ + pass + + def restart_with_reloader(self) -> int: + """Spawn a new Python interpreter with the same arguments as the + current one, but running the reloader thread. + """ + while True: + _log("info", f" * Restarting with {self.name}") + args = _get_args_for_reloading() + new_environ = os.environ.copy() + new_environ["WERKZEUG_RUN_MAIN"] = "true" + exit_code = subprocess.call(args, env=new_environ, close_fds=False) + + if exit_code != 3: + return exit_code + + def trigger_reload(self, filename: str) -> None: + self.log_reload(filename) + sys.exit(3) + + def log_reload(self, filename: str | bytes) -> None: + filename = os.path.abspath(filename) + _log("info", f" * Detected change in {filename!r}, reloading") + + +class StatReloaderLoop(ReloaderLoop): + name = "stat" + + def __enter__(self) -> ReloaderLoop: + self.mtimes: dict[str, float] = {} + return super().__enter__() + + def run_step(self) -> None: + for name in _find_stat_paths(self.extra_files, self.exclude_patterns): + try: + mtime = os.stat(name).st_mtime + except OSError: + continue + + old_time = self.mtimes.get(name) + + if old_time is None: + self.mtimes[name] = mtime + continue + + if mtime > old_time: + self.trigger_reload(name) + + +class WatchdogReloaderLoop(ReloaderLoop): + def __init__(self, *args: t.Any, **kwargs: t.Any) -> None: + from watchdog.events import EVENT_TYPE_CLOSED + from watchdog.events import EVENT_TYPE_CREATED + from watchdog.events import EVENT_TYPE_DELETED + from watchdog.events import EVENT_TYPE_MODIFIED + from watchdog.events import EVENT_TYPE_MOVED + from watchdog.events import FileModifiedEvent + from watchdog.events import PatternMatchingEventHandler + from watchdog.observers import Observer + + super().__init__(*args, **kwargs) + trigger_reload = self.trigger_reload + + class EventHandler(PatternMatchingEventHandler): + def on_any_event(self, event: FileModifiedEvent) -> None: # type: ignore[override] + if event.event_type not in { + EVENT_TYPE_CLOSED, + EVENT_TYPE_CREATED, + EVENT_TYPE_DELETED, + EVENT_TYPE_MODIFIED, + EVENT_TYPE_MOVED, + }: + # skip events that don't involve changes to the file + return + + trigger_reload(event.src_path) + + reloader_name = Observer.__name__.lower() # type: ignore[attr-defined] + + if reloader_name.endswith("observer"): + reloader_name = reloader_name[:-8] + + self.name = f"watchdog ({reloader_name})" + self.observer = Observer() + extra_patterns = (p for p in self.extra_files if not os.path.isdir(p)) + self.event_handler = EventHandler( + patterns=["*.py", "*.pyc", "*.zip", *extra_patterns], + ignore_patterns=[ + *[f"*/{d}/*" for d in _ignore_common_dirs], + *self.exclude_patterns, + ], + ) + self.should_reload = threading.Event() + + def trigger_reload(self, filename: str | bytes) -> None: + # This is called inside an event handler, which means throwing + # SystemExit has no effect. + # https://github.com/gorakhargosh/watchdog/issues/294 + self.should_reload.set() + self.log_reload(filename) + + def __enter__(self) -> ReloaderLoop: + self.watches: dict[str, t.Any] = {} + self.observer.start() + return super().__enter__() + + def __exit__(self, exc_type, exc_val, exc_tb): # type: ignore + self.observer.stop() + self.observer.join() + + def run(self) -> None: + while not self.should_reload.wait(timeout=self.interval): + self.run_step() + + sys.exit(3) + + def run_step(self) -> None: + to_delete = set(self.watches) + + for path in _find_watchdog_paths(self.extra_files, self.exclude_patterns): + if path not in self.watches: + try: + self.watches[path] = self.observer.schedule( + self.event_handler, path, recursive=True + ) + except OSError: + # Clear this path from list of watches. We don't want + # the same error message showing again in the next + # iteration. + self.watches[path] = None + + to_delete.discard(path) + + for path in to_delete: + watch = self.watches.pop(path, None) + + if watch is not None: + self.observer.unschedule(watch) + + +reloader_loops: dict[str, type[ReloaderLoop]] = { + "stat": StatReloaderLoop, + "watchdog": WatchdogReloaderLoop, +} + +try: + __import__("watchdog.observers") +except ImportError: + reloader_loops["auto"] = reloader_loops["stat"] +else: + reloader_loops["auto"] = reloader_loops["watchdog"] + + +def ensure_echo_on() -> None: + """Ensure that echo mode is enabled. Some tools such as PDB disable + it which causes usability issues after a reload.""" + # tcgetattr will fail if stdin isn't a tty + if sys.stdin is None or not sys.stdin.isatty(): + return + + try: + import termios + except ImportError: + return + + attributes = termios.tcgetattr(sys.stdin) + + if not attributes[3] & termios.ECHO: + attributes[3] |= termios.ECHO + termios.tcsetattr(sys.stdin, termios.TCSANOW, attributes) + + +def run_with_reloader( + main_func: t.Callable[[], None], + extra_files: t.Iterable[str] | None = None, + exclude_patterns: t.Iterable[str] | None = None, + interval: int | float = 1, + reloader_type: str = "auto", +) -> None: + """Run the given function in an independent Python interpreter.""" + import signal + + signal.signal(signal.SIGTERM, lambda *args: sys.exit(0)) + reloader = reloader_loops[reloader_type]( + extra_files=extra_files, exclude_patterns=exclude_patterns, interval=interval + ) + + try: + if os.environ.get("WERKZEUG_RUN_MAIN") == "true": + ensure_echo_on() + t = threading.Thread(target=main_func, args=()) + t.daemon = True + + # Enter the reloader to set up initial state, then start + # the app thread and reloader update loop. + with reloader: + t.start() + reloader.run() + else: + sys.exit(reloader.restart_with_reloader()) + except KeyboardInterrupt: + pass diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/werkzeug/datastructures/__init__.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/werkzeug/datastructures/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..6582de02c78b54a785bfbc0ec226e33d2ef48785 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/werkzeug/datastructures/__init__.py @@ -0,0 +1,64 @@ +from __future__ import annotations + +import typing as t + +from .accept import Accept as Accept +from .accept import CharsetAccept as CharsetAccept +from .accept import LanguageAccept as LanguageAccept +from .accept import MIMEAccept as MIMEAccept +from .auth import Authorization as Authorization +from .auth import WWWAuthenticate as WWWAuthenticate +from .cache_control import RequestCacheControl as RequestCacheControl +from .cache_control import ResponseCacheControl as ResponseCacheControl +from .csp import ContentSecurityPolicy as ContentSecurityPolicy +from .etag import ETags as ETags +from .file_storage import FileMultiDict as FileMultiDict +from .file_storage import FileStorage as FileStorage +from .headers import EnvironHeaders as EnvironHeaders +from .headers import Headers as Headers +from .mixins import ImmutableDictMixin as ImmutableDictMixin +from .mixins import ImmutableHeadersMixin as ImmutableHeadersMixin +from .mixins import ImmutableListMixin as ImmutableListMixin +from .mixins import ImmutableMultiDictMixin as ImmutableMultiDictMixin +from .mixins import UpdateDictMixin as UpdateDictMixin +from .range import ContentRange as ContentRange +from .range import IfRange as IfRange +from .range import Range as Range +from .structures import CallbackDict as CallbackDict +from .structures import CombinedMultiDict as CombinedMultiDict +from .structures import HeaderSet as HeaderSet +from .structures import ImmutableDict as ImmutableDict +from .structures import ImmutableList as ImmutableList +from .structures import ImmutableMultiDict as ImmutableMultiDict +from .structures import ImmutableTypeConversionDict as ImmutableTypeConversionDict +from .structures import iter_multi_items as iter_multi_items +from .structures import MultiDict as MultiDict +from .structures import TypeConversionDict as TypeConversionDict + + +def __getattr__(name: str) -> t.Any: + import warnings + + if name == "OrderedMultiDict": + from .structures import _OrderedMultiDict + + warnings.warn( + "'OrderedMultiDict' is deprecated and will be removed in Werkzeug" + " 3.2. Use 'MultiDict' instead.", + DeprecationWarning, + stacklevel=2, + ) + return _OrderedMultiDict + + if name == "ImmutableOrderedMultiDict": + from .structures import _ImmutableOrderedMultiDict + + warnings.warn( + "'OrderedMultiDict' is deprecated and will be removed in Werkzeug" + " 3.2. Use 'ImmutableMultiDict' instead.", + DeprecationWarning, + stacklevel=2, + ) + return _ImmutableOrderedMultiDict + + raise AttributeError(name) diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/werkzeug/datastructures/accept.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/werkzeug/datastructures/accept.py new file mode 100644 index 0000000000000000000000000000000000000000..44179a93f5f3d96bd50bc2c0da991ce048b8f530 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/werkzeug/datastructures/accept.py @@ -0,0 +1,350 @@ +from __future__ import annotations + +import codecs +import collections.abc as cabc +import re +import typing as t + +from .structures import ImmutableList + + +class Accept(ImmutableList[tuple[str, float]]): + """An :class:`Accept` object is just a list subclass for lists of + ``(value, quality)`` tuples. It is automatically sorted by specificity + and quality. + + All :class:`Accept` objects work similar to a list but provide extra + functionality for working with the data. Containment checks are + normalized to the rules of that header: + + >>> a = CharsetAccept([('ISO-8859-1', 1), ('utf-8', 0.7)]) + >>> a.best + 'ISO-8859-1' + >>> 'iso-8859-1' in a + True + >>> 'UTF8' in a + True + >>> 'utf7' in a + False + + To get the quality for an item you can use normal item lookup: + + >>> print a['utf-8'] + 0.7 + >>> a['utf7'] + 0 + + .. versionchanged:: 0.5 + :class:`Accept` objects are forced immutable now. + + .. versionchanged:: 1.0.0 + :class:`Accept` internal values are no longer ordered + alphabetically for equal quality tags. Instead the initial + order is preserved. + + """ + + def __init__( + self, values: Accept | cabc.Iterable[tuple[str, float]] | None = () + ) -> None: + if values is None: + super().__init__() + self.provided = False + elif isinstance(values, Accept): + self.provided = values.provided + super().__init__(values) + else: + self.provided = True + values = sorted( + values, key=lambda x: (self._specificity(x[0]), x[1]), reverse=True + ) + super().__init__(values) + + def _specificity(self, value: str) -> tuple[bool, ...]: + """Returns a tuple describing the value's specificity.""" + return (value != "*",) + + def _value_matches(self, value: str, item: str) -> bool: + """Check if a value matches a given accept item.""" + return item == "*" or item.lower() == value.lower() + + @t.overload + def __getitem__(self, key: str) -> float: ... + @t.overload + def __getitem__(self, key: t.SupportsIndex) -> tuple[str, float]: ... + @t.overload + def __getitem__(self, key: slice) -> list[tuple[str, float]]: ... + def __getitem__( + self, key: str | t.SupportsIndex | slice + ) -> float | tuple[str, float] | list[tuple[str, float]]: + """Besides index lookup (getting item n) you can also pass it a string + to get the quality for the item. If the item is not in the list, the + returned quality is ``0``. + """ + if isinstance(key, str): + return self.quality(key) + return list.__getitem__(self, key) + + def quality(self, key: str) -> float: + """Returns the quality of the key. + + .. versionadded:: 0.6 + In previous versions you had to use the item-lookup syntax + (eg: ``obj[key]`` instead of ``obj.quality(key)``) + """ + for item, quality in self: + if self._value_matches(key, item): + return quality + return 0 + + def __contains__(self, value: str) -> bool: # type: ignore[override] + for item, _quality in self: + if self._value_matches(value, item): + return True + return False + + def __repr__(self) -> str: + pairs_str = ", ".join(f"({x!r}, {y})" for x, y in self) + return f"{type(self).__name__}([{pairs_str}])" + + def index(self, key: str | tuple[str, float]) -> int: # type: ignore[override] + """Get the position of an entry or raise :exc:`ValueError`. + + :param key: The key to be looked up. + + .. versionchanged:: 0.5 + This used to raise :exc:`IndexError`, which was inconsistent + with the list API. + """ + if isinstance(key, str): + for idx, (item, _quality) in enumerate(self): + if self._value_matches(key, item): + return idx + raise ValueError(key) + return list.index(self, key) + + def find(self, key: str | tuple[str, float]) -> int: + """Get the position of an entry or return -1. + + :param key: The key to be looked up. + """ + try: + return self.index(key) + except ValueError: + return -1 + + def values(self) -> cabc.Iterator[str]: + """Iterate over all values.""" + for item in self: + yield item[0] + + def to_header(self) -> str: + """Convert the header set into an HTTP header string.""" + result = [] + for value, quality in self: + if quality != 1: + value = f"{value};q={quality}" + result.append(value) + return ",".join(result) + + def __str__(self) -> str: + return self.to_header() + + def _best_single_match(self, match: str) -> tuple[str, float] | None: + for client_item, quality in self: + if self._value_matches(match, client_item): + # self is sorted by specificity descending, we can exit + return client_item, quality + return None + + @t.overload + def best_match(self, matches: cabc.Iterable[str]) -> str | None: ... + @t.overload + def best_match(self, matches: cabc.Iterable[str], default: str = ...) -> str: ... + def best_match( + self, matches: cabc.Iterable[str], default: str | None = None + ) -> str | None: + """Returns the best match from a list of possible matches based + on the specificity and quality of the client. If two items have the + same quality and specificity, the one is returned that comes first. + + :param matches: a list of matches to check for + :param default: the value that is returned if none match + """ + result = default + best_quality: float = -1 + best_specificity: tuple[float, ...] = (-1,) + for server_item in matches: + match = self._best_single_match(server_item) + if not match: + continue + client_item, quality = match + specificity = self._specificity(client_item) + if quality <= 0 or quality < best_quality: + continue + # better quality or same quality but more specific => better match + if quality > best_quality or specificity > best_specificity: + result = server_item + best_quality = quality + best_specificity = specificity + return result + + @property + def best(self) -> str | None: + """The best match as value.""" + if self: + return self[0][0] + + return None + + +_mime_split_re = re.compile(r"/|(?:\s*;\s*)") + + +def _normalize_mime(value: str) -> list[str]: + return _mime_split_re.split(value.lower()) + + +class MIMEAccept(Accept): + """Like :class:`Accept` but with special methods and behavior for + mimetypes. + """ + + def _specificity(self, value: str) -> tuple[bool, ...]: + return tuple(x != "*" for x in _mime_split_re.split(value)) + + def _value_matches(self, value: str, item: str) -> bool: + # item comes from the client, can't match if it's invalid. + if "/" not in item: + return False + + # value comes from the application, tell the developer when it + # doesn't look valid. + if "/" not in value: + raise ValueError(f"invalid mimetype {value!r}") + + # Split the match value into type, subtype, and a sorted list of parameters. + normalized_value = _normalize_mime(value) + value_type, value_subtype = normalized_value[:2] + value_params = sorted(normalized_value[2:]) + + # "*/*" is the only valid value that can start with "*". + if value_type == "*" and value_subtype != "*": + raise ValueError(f"invalid mimetype {value!r}") + + # Split the accept item into type, subtype, and parameters. + normalized_item = _normalize_mime(item) + item_type, item_subtype = normalized_item[:2] + item_params = sorted(normalized_item[2:]) + + # "*/not-*" from the client is invalid, can't match. + if item_type == "*" and item_subtype != "*": + return False + + return ( + (item_type == "*" and item_subtype == "*") + or (value_type == "*" and value_subtype == "*") + ) or ( + item_type == value_type + and ( + item_subtype == "*" + or value_subtype == "*" + or (item_subtype == value_subtype and item_params == value_params) + ) + ) + + @property + def accept_html(self) -> bool: + """True if this object accepts HTML.""" + return "text/html" in self or self.accept_xhtml # type: ignore[comparison-overlap] + + @property + def accept_xhtml(self) -> bool: + """True if this object accepts XHTML.""" + return "application/xhtml+xml" in self or "application/xml" in self # type: ignore[comparison-overlap] + + @property + def accept_json(self) -> bool: + """True if this object accepts JSON.""" + return "application/json" in self # type: ignore[comparison-overlap] + + +_locale_delim_re = re.compile(r"[_-]") + + +def _normalize_lang(value: str) -> list[str]: + """Process a language tag for matching.""" + return _locale_delim_re.split(value.lower()) + + +class LanguageAccept(Accept): + """Like :class:`Accept` but with normalization for language tags.""" + + def _value_matches(self, value: str, item: str) -> bool: + return item == "*" or _normalize_lang(value) == _normalize_lang(item) + + @t.overload + def best_match(self, matches: cabc.Iterable[str]) -> str | None: ... + @t.overload + def best_match(self, matches: cabc.Iterable[str], default: str = ...) -> str: ... + def best_match( + self, matches: cabc.Iterable[str], default: str | None = None + ) -> str | None: + """Given a list of supported values, finds the best match from + the list of accepted values. + + Language tags are normalized for the purpose of matching, but + are returned unchanged. + + If no exact match is found, this will fall back to matching + the first subtag (primary language only), first with the + accepted values then with the match values. This partial is not + applied to any other language subtags. + + The default is returned if no exact or fallback match is found. + + :param matches: A list of supported languages to find a match. + :param default: The value that is returned if none match. + """ + # Look for an exact match first. If a client accepts "en-US", + # "en-US" is a valid match at this point. + result = super().best_match(matches) + + if result is not None: + return result + + # Fall back to accepting primary tags. If a client accepts + # "en-US", "en" is a valid match at this point. Need to use + # re.split to account for 2 or 3 letter codes. + fallback = Accept( + [(_locale_delim_re.split(item[0], 1)[0], item[1]) for item in self] + ) + result = fallback.best_match(matches) + + if result is not None: + return result + + # Fall back to matching primary tags. If the client accepts + # "en", "en-US" is a valid match at this point. + fallback_matches = [_locale_delim_re.split(item, 1)[0] for item in matches] + result = super().best_match(fallback_matches) + + # Return a value from the original match list. Find the first + # original value that starts with the matched primary tag. + if result is not None: + return next(item for item in matches if item.startswith(result)) + + return default + + +class CharsetAccept(Accept): + """Like :class:`Accept` but with normalization for charsets.""" + + def _value_matches(self, value: str, item: str) -> bool: + def _normalize(name: str) -> str: + try: + return codecs.lookup(name).name + except LookupError: + return name.lower() + + return item == "*" or _normalize(value) == _normalize(item) diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/werkzeug/datastructures/auth.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/werkzeug/datastructures/auth.py new file mode 100644 index 0000000000000000000000000000000000000000..42f7aa4683bcbd612fc8c5032572d5c48d3fc99e --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/werkzeug/datastructures/auth.py @@ -0,0 +1,317 @@ +from __future__ import annotations + +import base64 +import binascii +import collections.abc as cabc +import typing as t + +from ..http import dump_header +from ..http import parse_dict_header +from ..http import quote_header_value +from .structures import CallbackDict + +if t.TYPE_CHECKING: + import typing_extensions as te + + +class Authorization: + """Represents the parts of an ``Authorization`` request header. + + :attr:`.Request.authorization` returns an instance if the header is set. + + An instance can be used with the test :class:`.Client` request methods' ``auth`` + parameter to send the header in test requests. + + Depending on the auth scheme, either :attr:`parameters` or :attr:`token` will be + set. The ``Basic`` scheme's token is decoded into the ``username`` and ``password`` + parameters. + + For convenience, ``auth["key"]`` and ``auth.key`` both access the key in the + :attr:`parameters` dict, along with ``auth.get("key")`` and ``"key" in auth``. + + .. versionchanged:: 2.3 + The ``token`` parameter and attribute was added to support auth schemes that use + a token instead of parameters, such as ``Bearer``. + + .. versionchanged:: 2.3 + The object is no longer a ``dict``. + + .. versionchanged:: 0.5 + The object is an immutable dict. + """ + + def __init__( + self, + auth_type: str, + data: dict[str, str | None] | None = None, + token: str | None = None, + ) -> None: + self.type = auth_type + """The authorization scheme, like ``basic``, ``digest``, or ``bearer``.""" + + if data is None: + data = {} + + self.parameters = data + """A dict of parameters parsed from the header. Either this or :attr:`token` + will have a value for a given scheme. + """ + + self.token = token + """A token parsed from the header. Either this or :attr:`parameters` will have a + value for a given scheme. + + .. versionadded:: 2.3 + """ + + def __getattr__(self, name: str) -> str | None: + return self.parameters.get(name) + + def __getitem__(self, name: str) -> str | None: + return self.parameters.get(name) + + def get(self, key: str, default: str | None = None) -> str | None: + return self.parameters.get(key, default) + + def __contains__(self, key: str) -> bool: + return key in self.parameters + + def __eq__(self, other: object) -> bool: + if not isinstance(other, Authorization): + return NotImplemented + + return ( + other.type == self.type + and other.token == self.token + and other.parameters == self.parameters + ) + + @classmethod + def from_header(cls, value: str | None) -> te.Self | None: + """Parse an ``Authorization`` header value and return an instance, or ``None`` + if the value is empty. + + :param value: The header value to parse. + + .. versionadded:: 2.3 + """ + if not value: + return None + + scheme, _, rest = value.partition(" ") + scheme = scheme.lower() + rest = rest.strip() + + if scheme == "basic": + try: + username, _, password = base64.b64decode(rest).decode().partition(":") + except (binascii.Error, UnicodeError): + return None + + return cls(scheme, {"username": username, "password": password}) + + if "=" in rest.rstrip("="): + # = that is not trailing, this is parameters. + return cls(scheme, parse_dict_header(rest), None) + + # No = or only trailing =, this is a token. + return cls(scheme, None, rest) + + def to_header(self) -> str: + """Produce an ``Authorization`` header value representing this data. + + .. versionadded:: 2.0 + """ + if self.type == "basic": + value = base64.b64encode( + f"{self.username}:{self.password}".encode() + ).decode("ascii") + return f"Basic {value}" + + if self.token is not None: + return f"{self.type.title()} {self.token}" + + return f"{self.type.title()} {dump_header(self.parameters)}" + + def __str__(self) -> str: + return self.to_header() + + def __repr__(self) -> str: + return f"<{type(self).__name__} {self.to_header()}>" + + +class WWWAuthenticate: + """Represents the parts of a ``WWW-Authenticate`` response header. + + Set :attr:`.Response.www_authenticate` to an instance of list of instances to set + values for this header in the response. Modifying this instance will modify the + header value. + + Depending on the auth scheme, either :attr:`parameters` or :attr:`token` should be + set. The ``Basic`` scheme will encode ``username`` and ``password`` parameters to a + token. + + For convenience, ``auth["key"]`` and ``auth.key`` both act on the :attr:`parameters` + dict, and can be used to get, set, or delete parameters. ``auth.get("key")`` and + ``"key" in auth`` are also provided. + + .. versionchanged:: 2.3 + The ``token`` parameter and attribute was added to support auth schemes that use + a token instead of parameters, such as ``Bearer``. + + .. versionchanged:: 2.3 + The object is no longer a ``dict``. + + .. versionchanged:: 2.3 + The ``on_update`` parameter was removed. + """ + + def __init__( + self, + auth_type: str, + values: dict[str, str | None] | None = None, + token: str | None = None, + ): + self._type = auth_type.lower() + self._parameters: dict[str, str | None] = CallbackDict( + values, lambda _: self._trigger_on_update() + ) + self._token = token + self._on_update: cabc.Callable[[WWWAuthenticate], None] | None = None + + def _trigger_on_update(self) -> None: + if self._on_update is not None: + self._on_update(self) + + @property + def type(self) -> str: + """The authorization scheme, like ``basic``, ``digest``, or ``bearer``.""" + return self._type + + @type.setter + def type(self, value: str) -> None: + self._type = value + self._trigger_on_update() + + @property + def parameters(self) -> dict[str, str | None]: + """A dict of parameters for the header. Only one of this or :attr:`token` should + have a value for a given scheme. + """ + return self._parameters + + @parameters.setter + def parameters(self, value: dict[str, str]) -> None: + self._parameters = CallbackDict(value, lambda _: self._trigger_on_update()) + self._trigger_on_update() + + @property + def token(self) -> str | None: + """A dict of parameters for the header. Only one of this or :attr:`token` should + have a value for a given scheme. + """ + return self._token + + @token.setter + def token(self, value: str | None) -> None: + """A token for the header. Only one of this or :attr:`parameters` should have a + value for a given scheme. + + .. versionadded:: 2.3 + """ + self._token = value + self._trigger_on_update() + + def __getitem__(self, key: str) -> str | None: + return self.parameters.get(key) + + def __setitem__(self, key: str, value: str | None) -> None: + if value is None: + if key in self.parameters: + del self.parameters[key] + else: + self.parameters[key] = value + + self._trigger_on_update() + + def __delitem__(self, key: str) -> None: + if key in self.parameters: + del self.parameters[key] + self._trigger_on_update() + + def __getattr__(self, name: str) -> str | None: + return self[name] + + def __setattr__(self, name: str, value: str | None) -> None: + if name in {"_type", "_parameters", "_token", "_on_update"}: + super().__setattr__(name, value) + else: + self[name] = value + + def __delattr__(self, name: str) -> None: + del self[name] + + def __contains__(self, key: str) -> bool: + return key in self.parameters + + def __eq__(self, other: object) -> bool: + if not isinstance(other, WWWAuthenticate): + return NotImplemented + + return ( + other.type == self.type + and other.token == self.token + and other.parameters == self.parameters + ) + + def get(self, key: str, default: str | None = None) -> str | None: + return self.parameters.get(key, default) + + @classmethod + def from_header(cls, value: str | None) -> te.Self | None: + """Parse a ``WWW-Authenticate`` header value and return an instance, or ``None`` + if the value is empty. + + :param value: The header value to parse. + + .. versionadded:: 2.3 + """ + if not value: + return None + + scheme, _, rest = value.partition(" ") + scheme = scheme.lower() + rest = rest.strip() + + if "=" in rest.rstrip("="): + # = that is not trailing, this is parameters. + return cls(scheme, parse_dict_header(rest), None) + + # No = or only trailing =, this is a token. + return cls(scheme, None, rest) + + def to_header(self) -> str: + """Produce a ``WWW-Authenticate`` header value representing this data.""" + if self.token is not None: + return f"{self.type.title()} {self.token}" + + if self.type == "digest": + items = [] + + for key, value in self.parameters.items(): + if key in {"realm", "domain", "nonce", "opaque", "qop"}: + value = quote_header_value(value, allow_token=False) + else: + value = quote_header_value(value) + + items.append(f"{key}={value}") + + return f"Digest {', '.join(items)}" + + return f"{self.type.title()} {dump_header(self.parameters)}" + + def __str__(self) -> str: + return self.to_header() + + def __repr__(self) -> str: + return f"<{type(self).__name__} {self.to_header()}>" diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/werkzeug/datastructures/cache_control.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/werkzeug/datastructures/cache_control.py new file mode 100644 index 0000000000000000000000000000000000000000..3d963102825b036ebcd9a441b01dcdd5df1390b6 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/werkzeug/datastructures/cache_control.py @@ -0,0 +1,273 @@ +from __future__ import annotations + +import collections.abc as cabc +import typing as t +from inspect import cleandoc + +from .mixins import ImmutableDictMixin +from .structures import CallbackDict + + +def cache_control_property( + key: str, empty: t.Any, type: type[t.Any] | None, *, doc: str | None = None +) -> t.Any: + """Return a new property object for a cache header. Useful if you + want to add support for a cache extension in a subclass. + + :param key: The attribute name present in the parsed cache-control header dict. + :param empty: The value to use if the key is present without a value. + :param type: The type to convert the string value to instead of a string. If + conversion raises a ``ValueError``, the returned value is ``None``. + :param doc: The docstring for the property. If not given, it is generated + based on the other params. + + .. versionchanged:: 3.1 + Added the ``doc`` param. + + .. versionchanged:: 2.0 + Renamed from ``cache_property``. + """ + if doc is None: + parts = [f"The ``{key}`` attribute."] + + if type is bool: + parts.append("A ``bool``, either present or not.") + else: + if type is None: + parts.append("A ``str``,") + else: + parts.append(f"A ``{type.__name__}``,") + + if empty is not None: + parts.append(f"``{empty!r}`` if present with no value,") + + parts.append("or ``None`` if not present.") + + doc = " ".join(parts) + + return property( + lambda x: x._get_cache_value(key, empty, type), + lambda x, v: x._set_cache_value(key, v, type), + lambda x: x._del_cache_value(key), + doc=cleandoc(doc), + ) + + +class _CacheControl(CallbackDict[str, t.Optional[str]]): + """Subclass of a dict that stores values for a Cache-Control header. It + has accessors for all the cache-control directives specified in RFC 2616. + The class does not differentiate between request and response directives. + + Because the cache-control directives in the HTTP header use dashes the + python descriptors use underscores for that. + + To get a header of the :class:`CacheControl` object again you can convert + the object into a string or call the :meth:`to_header` method. If you plan + to subclass it and add your own items have a look at the sourcecode for + that class. + + .. versionchanged:: 3.1 + Dict values are always ``str | None``. Setting properties will + convert the value to a string. Setting a non-bool property to + ``False`` is equivalent to setting it to ``None``. Getting typed + properties will return ``None`` if conversion raises + ``ValueError``, rather than the string. + + .. versionchanged:: 2.1 + Setting int properties such as ``max_age`` will convert the + value to an int. + + .. versionchanged:: 0.4 + Setting ``no_cache`` or ``private`` to ``True`` will set the + implicit value ``"*"``. + """ + + no_store: bool = cache_control_property("no-store", None, bool) + max_age: int | None = cache_control_property("max-age", None, int) + no_transform: bool = cache_control_property("no-transform", None, bool) + stale_if_error: int | None = cache_control_property("stale-if-error", None, int) + + def __init__( + self, + values: cabc.Mapping[str, t.Any] | cabc.Iterable[tuple[str, t.Any]] | None = (), + on_update: cabc.Callable[[_CacheControl], None] | None = None, + ): + super().__init__(values, on_update) + self.provided = values is not None + + def _get_cache_value( + self, key: str, empty: t.Any, type: type[t.Any] | None + ) -> t.Any: + """Used internally by the accessor properties.""" + if type is bool: + return key in self + + if key not in self: + return None + + if (value := self[key]) is None: + return empty + + if type is not None: + try: + value = type(value) + except ValueError: + return None + + return value + + def _set_cache_value( + self, key: str, value: t.Any, type: type[t.Any] | None + ) -> None: + """Used internally by the accessor properties.""" + if type is bool: + if value: + self[key] = None + else: + self.pop(key, None) + elif value is None or value is False: + self.pop(key, None) + elif value is True: + self[key] = None + else: + if type is not None: + value = type(value) + + self[key] = str(value) + + def _del_cache_value(self, key: str) -> None: + """Used internally by the accessor properties.""" + if key in self: + del self[key] + + def to_header(self) -> str: + """Convert the stored values into a cache control header.""" + return http.dump_header(self) + + def __str__(self) -> str: + return self.to_header() + + def __repr__(self) -> str: + kv_str = " ".join(f"{k}={v!r}" for k, v in sorted(self.items())) + return f"<{type(self).__name__} {kv_str}>" + + cache_property = staticmethod(cache_control_property) + + +class RequestCacheControl(ImmutableDictMixin[str, t.Optional[str]], _CacheControl): # type: ignore[misc] + """A cache control for requests. This is immutable and gives access + to all the request-relevant cache control headers. + + To get a header of the :class:`RequestCacheControl` object again you can + convert the object into a string or call the :meth:`to_header` method. If + you plan to subclass it and add your own items have a look at the sourcecode + for that class. + + .. versionchanged:: 3.1 + Dict values are always ``str | None``. Setting properties will + convert the value to a string. Setting a non-bool property to + ``False`` is equivalent to setting it to ``None``. Getting typed + properties will return ``None`` if conversion raises + ``ValueError``, rather than the string. + + .. versionchanged:: 3.1 + ``max_age`` is ``None`` if present without a value, rather + than ``-1``. + + .. versionchanged:: 3.1 + ``no_cache`` is a boolean, it is ``True`` instead of ``"*"`` + when present. + + .. versionchanged:: 3.1 + ``max_stale`` is ``True`` if present without a value, rather + than ``"*"``. + + .. versionchanged:: 3.1 + ``no_transform`` is a boolean. Previously it was mistakenly + always ``None``. + + .. versionchanged:: 3.1 + ``min_fresh`` is ``None`` if present without a value, rather + than ``"*"``. + + .. versionchanged:: 2.1 + Setting int properties such as ``max_age`` will convert the + value to an int. + + .. versionadded:: 0.5 + Response-only properties are not present on this request class. + """ + + no_cache: bool = cache_control_property("no-cache", None, bool) + max_stale: int | t.Literal[True] | None = cache_control_property( + "max-stale", + True, + int, + ) + min_fresh: int | None = cache_control_property("min-fresh", None, int) + only_if_cached: bool = cache_control_property("only-if-cached", None, bool) + + +class ResponseCacheControl(_CacheControl): + """A cache control for responses. Unlike :class:`RequestCacheControl` + this is mutable and gives access to response-relevant cache control + headers. + + To get a header of the :class:`ResponseCacheControl` object again you can + convert the object into a string or call the :meth:`to_header` method. If + you plan to subclass it and add your own items have a look at the sourcecode + for that class. + + .. versionchanged:: 3.1 + Dict values are always ``str | None``. Setting properties will + convert the value to a string. Setting a non-bool property to + ``False`` is equivalent to setting it to ``None``. Getting typed + properties will return ``None`` if conversion raises + ``ValueError``, rather than the string. + + .. versionchanged:: 3.1 + ``no_cache`` is ``True`` if present without a value, rather than + ``"*"``. + + .. versionchanged:: 3.1 + ``private`` is ``True`` if present without a value, rather than + ``"*"``. + + .. versionchanged:: 3.1 + ``no_transform`` is a boolean. Previously it was mistakenly + always ``None``. + + .. versionchanged:: 3.1 + Added the ``must_understand``, ``stale_while_revalidate``, and + ``stale_if_error`` properties. + + .. versionchanged:: 2.1.1 + ``s_maxage`` converts the value to an int. + + .. versionchanged:: 2.1 + Setting int properties such as ``max_age`` will convert the + value to an int. + + .. versionadded:: 0.5 + Request-only properties are not present on this response class. + """ + + no_cache: str | t.Literal[True] | None = cache_control_property( + "no-cache", True, None + ) + public: bool = cache_control_property("public", None, bool) + private: str | t.Literal[True] | None = cache_control_property( + "private", True, None + ) + must_revalidate: bool = cache_control_property("must-revalidate", None, bool) + proxy_revalidate: bool = cache_control_property("proxy-revalidate", None, bool) + s_maxage: int | None = cache_control_property("s-maxage", None, int) + immutable: bool = cache_control_property("immutable", None, bool) + must_understand: bool = cache_control_property("must-understand", None, bool) + stale_while_revalidate: int | None = cache_control_property( + "stale-while-revalidate", None, int + ) + + +# circular dependencies +from .. import http # noqa: E402 diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/werkzeug/datastructures/csp.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/werkzeug/datastructures/csp.py new file mode 100644 index 0000000000000000000000000000000000000000..206c1e38b2db03e1232906bf0a689f459a2ee3ca --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/werkzeug/datastructures/csp.py @@ -0,0 +1,100 @@ +from __future__ import annotations + +import collections.abc as cabc +import typing as t + +from .structures import CallbackDict + + +def csp_property(key: str) -> t.Any: + """Return a new property object for a content security policy header. + Useful if you want to add support for a csp extension in a + subclass. + """ + return property( + lambda x: x._get_value(key), + lambda x, v: x._set_value(key, v), + lambda x: x._del_value(key), + f"accessor for {key!r}", + ) + + +class ContentSecurityPolicy(CallbackDict[str, str]): + """Subclass of a dict that stores values for a Content Security Policy + header. It has accessors for all the level 3 policies. + + Because the csp directives in the HTTP header use dashes the + python descriptors use underscores for that. + + To get a header of the :class:`ContentSecurityPolicy` object again + you can convert the object into a string or call the + :meth:`to_header` method. If you plan to subclass it and add your + own items have a look at the sourcecode for that class. + + .. versionadded:: 1.0.0 + Support for Content Security Policy headers was added. + + """ + + base_uri: str | None = csp_property("base-uri") + child_src: str | None = csp_property("child-src") + connect_src: str | None = csp_property("connect-src") + default_src: str | None = csp_property("default-src") + font_src: str | None = csp_property("font-src") + form_action: str | None = csp_property("form-action") + frame_ancestors: str | None = csp_property("frame-ancestors") + frame_src: str | None = csp_property("frame-src") + img_src: str | None = csp_property("img-src") + manifest_src: str | None = csp_property("manifest-src") + media_src: str | None = csp_property("media-src") + navigate_to: str | None = csp_property("navigate-to") + object_src: str | None = csp_property("object-src") + prefetch_src: str | None = csp_property("prefetch-src") + plugin_types: str | None = csp_property("plugin-types") + report_to: str | None = csp_property("report-to") + report_uri: str | None = csp_property("report-uri") + sandbox: str | None = csp_property("sandbox") + script_src: str | None = csp_property("script-src") + script_src_attr: str | None = csp_property("script-src-attr") + script_src_elem: str | None = csp_property("script-src-elem") + style_src: str | None = csp_property("style-src") + style_src_attr: str | None = csp_property("style-src-attr") + style_src_elem: str | None = csp_property("style-src-elem") + worker_src: str | None = csp_property("worker-src") + + def __init__( + self, + values: cabc.Mapping[str, str] | cabc.Iterable[tuple[str, str]] | None = (), + on_update: cabc.Callable[[ContentSecurityPolicy], None] | None = None, + ) -> None: + super().__init__(values, on_update) + self.provided = values is not None + + def _get_value(self, key: str) -> str | None: + """Used internally by the accessor properties.""" + return self.get(key) + + def _set_value(self, key: str, value: str | None) -> None: + """Used internally by the accessor properties.""" + if value is None: + self.pop(key, None) + else: + self[key] = value + + def _del_value(self, key: str) -> None: + """Used internally by the accessor properties.""" + if key in self: + del self[key] + + def to_header(self) -> str: + """Convert the stored values into a cache control header.""" + from ..http import dump_csp_header + + return dump_csp_header(self) + + def __str__(self) -> str: + return self.to_header() + + def __repr__(self) -> str: + kv_str = " ".join(f"{k}={v!r}" for k, v in sorted(self.items())) + return f"<{type(self).__name__} {kv_str}>" diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/werkzeug/datastructures/etag.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/werkzeug/datastructures/etag.py new file mode 100644 index 0000000000000000000000000000000000000000..a4ef342456480e3c08c870400be5cd0515ffd666 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/werkzeug/datastructures/etag.py @@ -0,0 +1,106 @@ +from __future__ import annotations + +import collections.abc as cabc + + +class ETags(cabc.Collection[str]): + """A set that can be used to check if one etag is present in a collection + of etags. + """ + + def __init__( + self, + strong_etags: cabc.Iterable[str] | None = None, + weak_etags: cabc.Iterable[str] | None = None, + star_tag: bool = False, + ): + if not star_tag and strong_etags: + self._strong = frozenset(strong_etags) + else: + self._strong = frozenset() + + self._weak = frozenset(weak_etags or ()) + self.star_tag = star_tag + + def as_set(self, include_weak: bool = False) -> set[str]: + """Convert the `ETags` object into a python set. Per default all the + weak etags are not part of this set.""" + rv = set(self._strong) + if include_weak: + rv.update(self._weak) + return rv + + def is_weak(self, etag: str) -> bool: + """Check if an etag is weak.""" + return etag in self._weak + + def is_strong(self, etag: str) -> bool: + """Check if an etag is strong.""" + return etag in self._strong + + def contains_weak(self, etag: str) -> bool: + """Check if an etag is part of the set including weak and strong tags.""" + return self.is_weak(etag) or self.contains(etag) + + def contains(self, etag: str) -> bool: + """Check if an etag is part of the set ignoring weak tags. + It is also possible to use the ``in`` operator. + """ + if self.star_tag: + return True + return self.is_strong(etag) + + def contains_raw(self, etag: str) -> bool: + """When passed a quoted tag it will check if this tag is part of the + set. If the tag is weak it is checked against weak and strong tags, + otherwise strong only.""" + from ..http import unquote_etag + + etag, weak = unquote_etag(etag) + if weak: + return self.contains_weak(etag) + return self.contains(etag) + + def to_header(self) -> str: + """Convert the etags set into a HTTP header string.""" + if self.star_tag: + return "*" + return ", ".join( + [f'"{x}"' for x in self._strong] + [f'W/"{x}"' for x in self._weak] + ) + + def __call__( + self, + etag: str | None = None, + data: bytes | None = None, + include_weak: bool = False, + ) -> bool: + if etag is None: + if data is None: + raise TypeError("'data' is required when 'etag' is not given.") + + from ..http import generate_etag + + etag = generate_etag(data) + if include_weak: + if etag in self._weak: + return True + return etag in self._strong + + def __bool__(self) -> bool: + return bool(self.star_tag or self._strong or self._weak) + + def __str__(self) -> str: + return self.to_header() + + def __len__(self) -> int: + return len(self._strong) + + def __iter__(self) -> cabc.Iterator[str]: + return iter(self._strong) + + def __contains__(self, etag: str) -> bool: # type: ignore[override] + return self.contains(etag) + + def __repr__(self) -> str: + return f"<{type(self).__name__} {str(self)!r}>" diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/werkzeug/datastructures/file_storage.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/werkzeug/datastructures/file_storage.py new file mode 100644 index 0000000000000000000000000000000000000000..3a17f5125a53bf41de0cb9488503b35580dca316 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/werkzeug/datastructures/file_storage.py @@ -0,0 +1,209 @@ +from __future__ import annotations + +import collections.abc as cabc +import mimetypes +import os +import typing as t +from io import BytesIO +from os import fsdecode +from os import fspath + +from .._internal import _plain_int +from .headers import Headers +from .structures import MultiDict + + +class FileStorage: + """The :class:`FileStorage` class is a thin wrapper over incoming files. + It is used by the request object to represent uploaded files. All the + attributes of the wrapper stream are proxied by the file storage so + it's possible to do ``storage.read()`` instead of the long form + ``storage.stream.read()``. + """ + + def __init__( + self, + stream: t.IO[bytes] | None = None, + filename: str | None = None, + name: str | None = None, + content_type: str | None = None, + content_length: int | None = None, + headers: Headers | None = None, + ): + self.name = name + self.stream = stream or BytesIO() + + # If no filename is provided, attempt to get the filename from + # the stream object. Python names special streams like + # ```` with angular brackets, skip these streams. + if filename is None: + filename = getattr(stream, "name", None) + + if filename is not None: + filename = fsdecode(filename) + + if filename and filename[0] == "<" and filename[-1] == ">": + filename = None + else: + filename = fsdecode(filename) + + self.filename = filename + + if headers is None: + headers = Headers() + self.headers = headers + if content_type is not None: + headers["Content-Type"] = content_type + if content_length is not None: + headers["Content-Length"] = str(content_length) + + def _parse_content_type(self) -> None: + if not hasattr(self, "_parsed_content_type"): + self._parsed_content_type = http.parse_options_header(self.content_type) + + @property + def content_type(self) -> str | None: + """The content-type sent in the header. Usually not available""" + return self.headers.get("content-type") + + @property + def content_length(self) -> int: + """The content-length sent in the header. Usually not available""" + if "content-length" in self.headers: + try: + return _plain_int(self.headers["content-length"]) + except ValueError: + pass + + return 0 + + @property + def mimetype(self) -> str: + """Like :attr:`content_type`, but without parameters (eg, without + charset, type etc.) and always lowercase. For example if the content + type is ``text/HTML; charset=utf-8`` the mimetype would be + ``'text/html'``. + + .. versionadded:: 0.7 + """ + self._parse_content_type() + return self._parsed_content_type[0].lower() + + @property + def mimetype_params(self) -> dict[str, str]: + """The mimetype parameters as dict. For example if the content + type is ``text/html; charset=utf-8`` the params would be + ``{'charset': 'utf-8'}``. + + .. versionadded:: 0.7 + """ + self._parse_content_type() + return self._parsed_content_type[1] + + def save( + self, dst: str | os.PathLike[str] | t.IO[bytes], buffer_size: int = 16384 + ) -> None: + """Save the file to a destination path or file object. If the + destination is a file object you have to close it yourself after the + call. The buffer size is the number of bytes held in memory during + the copy process. It defaults to 16KB. + + For secure file saving also have a look at :func:`secure_filename`. + + :param dst: a filename, :class:`os.PathLike`, or open file + object to write to. + :param buffer_size: Passed as the ``length`` parameter of + :func:`shutil.copyfileobj`. + + .. versionchanged:: 1.0 + Supports :mod:`pathlib`. + """ + from shutil import copyfileobj + + close_dst = False + + if hasattr(dst, "__fspath__"): + dst = fspath(dst) + + if isinstance(dst, str): + dst = open(dst, "wb") + close_dst = True + + try: + copyfileobj(self.stream, dst, buffer_size) + finally: + if close_dst: + dst.close() + + def close(self) -> None: + """Close the underlying file if possible.""" + try: + self.stream.close() + except Exception: + pass + + def __bool__(self) -> bool: + return bool(self.filename) + + def __getattr__(self, name: str) -> t.Any: + try: + return getattr(self.stream, name) + except AttributeError: + # SpooledTemporaryFile on Python < 3.11 doesn't implement IOBase, + # get the attribute from its backing file instead. + if hasattr(self.stream, "_file"): + return getattr(self.stream._file, name) + raise + + def __iter__(self) -> cabc.Iterator[bytes]: + return iter(self.stream) + + def __repr__(self) -> str: + return f"<{type(self).__name__}: {self.filename!r} ({self.content_type!r})>" + + +class FileMultiDict(MultiDict[str, FileStorage]): + """A special :class:`MultiDict` that has convenience methods to add + files to it. This is used for :class:`EnvironBuilder` and generally + useful for unittesting. + + .. versionadded:: 0.5 + """ + + def add_file( + self, + name: str, + file: str | os.PathLike[str] | t.IO[bytes] | FileStorage, + filename: str | None = None, + content_type: str | None = None, + ) -> None: + """Adds a new file to the dict. `file` can be a file name or + a :class:`file`-like or a :class:`FileStorage` object. + + :param name: the name of the field. + :param file: a filename or :class:`file`-like object + :param filename: an optional filename + :param content_type: an optional content type + """ + if isinstance(file, FileStorage): + self.add(name, file) + return + + if isinstance(file, (str, os.PathLike)): + if filename is None: + filename = os.fspath(file) + + file_obj: t.IO[bytes] = open(file, "rb") + else: + file_obj = file # type: ignore[assignment] + + if filename and content_type is None: + content_type = ( + mimetypes.guess_type(filename)[0] or "application/octet-stream" + ) + + self.add(name, FileStorage(file_obj, filename, name, content_type)) + + +# circular dependencies +from .. import http # noqa: E402 diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/werkzeug/datastructures/headers.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/werkzeug/datastructures/headers.py new file mode 100644 index 0000000000000000000000000000000000000000..b8983622b8300f5c444f8351b95f29e5f319866d --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/werkzeug/datastructures/headers.py @@ -0,0 +1,662 @@ +from __future__ import annotations + +import collections.abc as cabc +import re +import typing as t + +from .._internal import _missing +from ..exceptions import BadRequestKeyError +from .mixins import ImmutableHeadersMixin +from .structures import iter_multi_items +from .structures import MultiDict + +if t.TYPE_CHECKING: + import typing_extensions as te + from _typeshed.wsgi import WSGIEnvironment + +T = t.TypeVar("T") + + +class Headers: + """An object that stores some headers. It has a dict-like interface, + but is ordered, can store the same key multiple times, and iterating + yields ``(key, value)`` pairs instead of only keys. + + This data structure is useful if you want a nicer way to handle WSGI + headers which are stored as tuples in a list. + + From Werkzeug 0.3 onwards, the :exc:`KeyError` raised by this class is + also a subclass of the :class:`~exceptions.BadRequest` HTTP exception + and will render a page for a ``400 BAD REQUEST`` if caught in a + catch-all for HTTP exceptions. + + Headers is mostly compatible with the Python :class:`wsgiref.headers.Headers` + class, with the exception of `__getitem__`. :mod:`wsgiref` will return + `None` for ``headers['missing']``, whereas :class:`Headers` will raise + a :class:`KeyError`. + + To create a new ``Headers`` object, pass it a list, dict, or + other ``Headers`` object with default values. These values are + validated the same way values added later are. + + :param defaults: The list of default values for the :class:`Headers`. + + .. versionchanged:: 3.1 + Implement ``|`` and ``|=`` operators. + + .. versionchanged:: 2.1.0 + Default values are validated the same as values added later. + + .. versionchanged:: 0.9 + This data structure now stores unicode values similar to how the + multi dicts do it. The main difference is that bytes can be set as + well which will automatically be latin1 decoded. + + .. versionchanged:: 0.9 + The :meth:`linked` function was removed without replacement as it + was an API that does not support the changes to the encoding model. + """ + + def __init__( + self, + defaults: ( + Headers + | MultiDict[str, t.Any] + | cabc.Mapping[str, t.Any | list[t.Any] | tuple[t.Any, ...] | set[t.Any]] + | cabc.Iterable[tuple[str, t.Any]] + | None + ) = None, + ) -> None: + self._list: list[tuple[str, str]] = [] + + if defaults is not None: + self.extend(defaults) + + @t.overload + def __getitem__(self, key: str) -> str: ... + @t.overload + def __getitem__(self, key: int) -> tuple[str, str]: ... + @t.overload + def __getitem__(self, key: slice) -> te.Self: ... + def __getitem__(self, key: str | int | slice) -> str | tuple[str, str] | te.Self: + if isinstance(key, str): + return self._get_key(key) + + if isinstance(key, int): + return self._list[key] + + return self.__class__(self._list[key]) + + def _get_key(self, key: str) -> str: + ikey = key.lower() + + for k, v in self._list: + if k.lower() == ikey: + return v + + raise BadRequestKeyError(key) + + def __eq__(self, other: object) -> bool: + if other.__class__ is not self.__class__: + return NotImplemented + + def lowered(item: tuple[str, ...]) -> tuple[str, ...]: + return item[0].lower(), *item[1:] + + return set(map(lowered, other._list)) == set(map(lowered, self._list)) # type: ignore[attr-defined] + + __hash__ = None # type: ignore[assignment] + + @t.overload + def get(self, key: str) -> str | None: ... + @t.overload + def get(self, key: str, default: str) -> str: ... + @t.overload + def get(self, key: str, default: T) -> str | T: ... + @t.overload + def get(self, key: str, type: cabc.Callable[[str], T]) -> T | None: ... + @t.overload + def get(self, key: str, default: T, type: cabc.Callable[[str], T]) -> T: ... + def get( # type: ignore[misc] + self, + key: str, + default: str | T | None = None, + type: cabc.Callable[[str], T] | None = None, + ) -> str | T | None: + """Return the default value if the requested data doesn't exist. + If `type` is provided and is a callable it should convert the value, + return it or raise a :exc:`ValueError` if that is not possible. In + this case the function will return the default as if the value was not + found: + + >>> d = Headers([('Content-Length', '42')]) + >>> d.get('Content-Length', type=int) + 42 + + :param key: The key to be looked up. + :param default: The default value to be returned if the key can't + be looked up. If not further specified `None` is + returned. + :param type: A callable that is used to cast the value in the + :class:`Headers`. If a :exc:`ValueError` is raised + by this callable the default value is returned. + + .. versionchanged:: 3.0 + The ``as_bytes`` parameter was removed. + + .. versionchanged:: 0.9 + The ``as_bytes`` parameter was added. + """ + try: + rv = self._get_key(key) + except KeyError: + return default + + if type is None: + return rv + + try: + return type(rv) + except ValueError: + return default + + @t.overload + def getlist(self, key: str) -> list[str]: ... + @t.overload + def getlist(self, key: str, type: cabc.Callable[[str], T]) -> list[T]: ... + def getlist( + self, key: str, type: cabc.Callable[[str], T] | None = None + ) -> list[str] | list[T]: + """Return the list of items for a given key. If that key is not in the + :class:`Headers`, the return value will be an empty list. Just like + :meth:`get`, :meth:`getlist` accepts a `type` parameter. All items will + be converted with the callable defined there. + + :param key: The key to be looked up. + :param type: A callable that is used to cast the value in the + :class:`Headers`. If a :exc:`ValueError` is raised + by this callable the value will be removed from the list. + :return: a :class:`list` of all the values for the key. + + .. versionchanged:: 3.0 + The ``as_bytes`` parameter was removed. + + .. versionchanged:: 0.9 + The ``as_bytes`` parameter was added. + """ + ikey = key.lower() + + if type is not None: + result = [] + + for k, v in self: + if k.lower() == ikey: + try: + result.append(type(v)) + except ValueError: + continue + + return result + + return [v for k, v in self if k.lower() == ikey] + + def get_all(self, name: str) -> list[str]: + """Return a list of all the values for the named field. + + This method is compatible with the :mod:`wsgiref` + :meth:`~wsgiref.headers.Headers.get_all` method. + """ + return self.getlist(name) + + def items(self, lower: bool = False) -> t.Iterable[tuple[str, str]]: + for key, value in self: + if lower: + key = key.lower() + yield key, value + + def keys(self, lower: bool = False) -> t.Iterable[str]: + for key, _ in self.items(lower): + yield key + + def values(self) -> t.Iterable[str]: + for _, value in self.items(): + yield value + + def extend( + self, + arg: ( + Headers + | MultiDict[str, t.Any] + | cabc.Mapping[str, t.Any | list[t.Any] | tuple[t.Any, ...] | set[t.Any]] + | cabc.Iterable[tuple[str, t.Any]] + | None + ) = None, + /, + **kwargs: str, + ) -> None: + """Extend headers in this object with items from another object + containing header items as well as keyword arguments. + + To replace existing keys instead of extending, use + :meth:`update` instead. + + If provided, the first argument can be another :class:`Headers` + object, a :class:`MultiDict`, :class:`dict`, or iterable of + pairs. + + .. versionchanged:: 1.0 + Support :class:`MultiDict`. Allow passing ``kwargs``. + """ + if arg is not None: + for key, value in iter_multi_items(arg): + self.add(key, value) + + for key, value in iter_multi_items(kwargs): + self.add(key, value) + + def __delitem__(self, key: str | int | slice) -> None: + if isinstance(key, str): + self._del_key(key) + return + + del self._list[key] + + def _del_key(self, key: str) -> None: + key = key.lower() + new = [] + + for k, v in self._list: + if k.lower() != key: + new.append((k, v)) + + self._list[:] = new + + def remove(self, key: str) -> None: + """Remove a key. + + :param key: The key to be removed. + """ + return self._del_key(key) + + @t.overload + def pop(self) -> tuple[str, str]: ... + @t.overload + def pop(self, key: str) -> str: ... + @t.overload + def pop(self, key: int | None = ...) -> tuple[str, str]: ... + @t.overload + def pop(self, key: str, default: str) -> str: ... + @t.overload + def pop(self, key: str, default: T) -> str | T: ... + def pop( + self, + key: str | int | None = None, + default: str | T = _missing, # type: ignore[assignment] + ) -> str | tuple[str, str] | T: + """Removes and returns a key or index. + + :param key: The key to be popped. If this is an integer the item at + that position is removed, if it's a string the value for + that key is. If the key is omitted or `None` the last + item is removed. + :return: an item. + """ + if key is None: + return self._list.pop() + + if isinstance(key, int): + return self._list.pop(key) + + try: + rv = self._get_key(key) + except KeyError: + if default is not _missing: + return default + + raise + + self.remove(key) + return rv + + def popitem(self) -> tuple[str, str]: + """Removes a key or index and returns a (key, value) item.""" + return self._list.pop() + + def __contains__(self, key: str) -> bool: + """Check if a key is present.""" + try: + self._get_key(key) + except KeyError: + return False + + return True + + def __iter__(self) -> t.Iterator[tuple[str, str]]: + """Yield ``(key, value)`` tuples.""" + return iter(self._list) + + def __len__(self) -> int: + return len(self._list) + + def add(self, key: str, value: t.Any, /, **kwargs: t.Any) -> None: + """Add a new header tuple to the list. + + Keyword arguments can specify additional parameters for the header + value, with underscores converted to dashes:: + + >>> d = Headers() + >>> d.add('Content-Type', 'text/plain') + >>> d.add('Content-Disposition', 'attachment', filename='foo.png') + + The keyword argument dumping uses :func:`dump_options_header` + behind the scenes. + + .. versionchanged:: 0.4.1 + keyword arguments were added for :mod:`wsgiref` compatibility. + """ + if kwargs: + value = _options_header_vkw(value, kwargs) + + value_str = _str_header_value(value) + self._list.append((key, value_str)) + + def add_header(self, key: str, value: t.Any, /, **kwargs: t.Any) -> None: + """Add a new header tuple to the list. + + An alias for :meth:`add` for compatibility with the :mod:`wsgiref` + :meth:`~wsgiref.headers.Headers.add_header` method. + """ + self.add(key, value, **kwargs) + + def clear(self) -> None: + """Clears all headers.""" + self._list.clear() + + def set(self, key: str, value: t.Any, /, **kwargs: t.Any) -> None: + """Remove all header tuples for `key` and add a new one. The newly + added key either appears at the end of the list if there was no + entry or replaces the first one. + + Keyword arguments can specify additional parameters for the header + value, with underscores converted to dashes. See :meth:`add` for + more information. + + .. versionchanged:: 0.6.1 + :meth:`set` now accepts the same arguments as :meth:`add`. + + :param key: The key to be inserted. + :param value: The value to be inserted. + """ + if kwargs: + value = _options_header_vkw(value, kwargs) + + value_str = _str_header_value(value) + + if not self._list: + self._list.append((key, value_str)) + return + + iter_list = iter(self._list) + ikey = key.lower() + + for idx, (old_key, _) in enumerate(iter_list): + if old_key.lower() == ikey: + # replace first occurrence + self._list[idx] = (key, value_str) + break + else: + # no existing occurrences + self._list.append((key, value_str)) + return + + # remove remaining occurrences + self._list[idx + 1 :] = [t for t in iter_list if t[0].lower() != ikey] + + def setlist(self, key: str, values: cabc.Iterable[t.Any]) -> None: + """Remove any existing values for a header and add new ones. + + :param key: The header key to set. + :param values: An iterable of values to set for the key. + + .. versionadded:: 1.0 + """ + if values: + values_iter = iter(values) + self.set(key, next(values_iter)) + + for value in values_iter: + self.add(key, value) + else: + self.remove(key) + + def setdefault(self, key: str, default: t.Any) -> str: + """Return the first value for the key if it is in the headers, + otherwise set the header to the value given by ``default`` and + return that. + + :param key: The header key to get. + :param default: The value to set for the key if it is not in the + headers. + """ + try: + return self._get_key(key) + except KeyError: + pass + + self.set(key, default) + return self._get_key(key) + + def setlistdefault(self, key: str, default: cabc.Iterable[t.Any]) -> list[str]: + """Return the list of values for the key if it is in the + headers, otherwise set the header to the list of values given + by ``default`` and return that. + + Unlike :meth:`MultiDict.setlistdefault`, modifying the returned + list will not affect the headers. + + :param key: The header key to get. + :param default: An iterable of values to set for the key if it + is not in the headers. + + .. versionadded:: 1.0 + """ + if key not in self: + self.setlist(key, default) + + return self.getlist(key) + + @t.overload + def __setitem__(self, key: str, value: t.Any) -> None: ... + @t.overload + def __setitem__(self, key: int, value: tuple[str, t.Any]) -> None: ... + @t.overload + def __setitem__( + self, key: slice, value: cabc.Iterable[tuple[str, t.Any]] + ) -> None: ... + def __setitem__( + self, + key: str | int | slice, + value: t.Any | tuple[str, t.Any] | cabc.Iterable[tuple[str, t.Any]], + ) -> None: + """Like :meth:`set` but also supports index/slice based setting.""" + if isinstance(key, str): + self.set(key, value) + elif isinstance(key, int): + self._list[key] = value[0], _str_header_value(value[1]) # type: ignore[index] + else: + self._list[key] = [(k, _str_header_value(v)) for k, v in value] # type: ignore[misc] + + def update( + self, + arg: ( + Headers + | MultiDict[str, t.Any] + | cabc.Mapping[ + str, t.Any | list[t.Any] | tuple[t.Any, ...] | cabc.Set[t.Any] + ] + | cabc.Iterable[tuple[str, t.Any]] + | None + ) = None, + /, + **kwargs: t.Any | list[t.Any] | tuple[t.Any, ...] | cabc.Set[t.Any], + ) -> None: + """Replace headers in this object with items from another + headers object and keyword arguments. + + To extend existing keys instead of replacing, use :meth:`extend` + instead. + + If provided, the first argument can be another :class:`Headers` + object, a :class:`MultiDict`, :class:`dict`, or iterable of + pairs. + + .. versionadded:: 1.0 + """ + if arg is not None: + if isinstance(arg, (Headers, MultiDict)): + for key in arg.keys(): + self.setlist(key, arg.getlist(key)) + elif isinstance(arg, cabc.Mapping): + for key, value in arg.items(): + if isinstance(value, (list, tuple, set)): + self.setlist(key, value) + else: + self.set(key, value) + else: + for key, value in arg: + self.set(key, value) + + for key, value in kwargs.items(): + if isinstance(value, (list, tuple, set)): + self.setlist(key, value) + else: + self.set(key, value) + + def __or__( + self, + other: cabc.Mapping[ + str, t.Any | list[t.Any] | tuple[t.Any, ...] | cabc.Set[t.Any] + ], + ) -> te.Self: + if not isinstance(other, cabc.Mapping): + return NotImplemented + + rv = self.copy() + rv.update(other) + return rv + + def __ior__( + self, + other: ( + cabc.Mapping[str, t.Any | list[t.Any] | tuple[t.Any, ...] | cabc.Set[t.Any]] + | cabc.Iterable[tuple[str, t.Any]] + ), + ) -> te.Self: + if not isinstance(other, (cabc.Mapping, cabc.Iterable)): + return NotImplemented + + self.update(other) + return self + + def to_wsgi_list(self) -> list[tuple[str, str]]: + """Convert the headers into a list suitable for WSGI. + + :return: list + """ + return list(self) + + def copy(self) -> te.Self: + return self.__class__(self._list) + + def __copy__(self) -> te.Self: + return self.copy() + + def __str__(self) -> str: + """Returns formatted headers suitable for HTTP transmission.""" + strs = [] + for key, value in self.to_wsgi_list(): + strs.append(f"{key}: {value}") + strs.append("\r\n") + return "\r\n".join(strs) + + def __repr__(self) -> str: + return f"{type(self).__name__}({list(self)!r})" + + +def _options_header_vkw(value: str, kw: dict[str, t.Any]) -> str: + return http.dump_options_header( + value, {k.replace("_", "-"): v for k, v in kw.items()} + ) + + +_newline_re = re.compile(r"[\r\n]") + + +def _str_header_value(value: t.Any) -> str: + if not isinstance(value, str): + value = str(value) + + if _newline_re.search(value) is not None: + raise ValueError("Header values must not contain newline characters.") + + return value # type: ignore[no-any-return] + + +class EnvironHeaders(ImmutableHeadersMixin, Headers): # type: ignore[misc] + """Read only version of the headers from a WSGI environment. This + provides the same interface as `Headers` and is constructed from + a WSGI environment. + From Werkzeug 0.3 onwards, the `KeyError` raised by this class is also a + subclass of the :exc:`~exceptions.BadRequest` HTTP exception and will + render a page for a ``400 BAD REQUEST`` if caught in a catch-all for + HTTP exceptions. + """ + + def __init__(self, environ: WSGIEnvironment) -> None: + super().__init__() + self.environ = environ + + def __eq__(self, other: object) -> bool: + if not isinstance(other, EnvironHeaders): + return NotImplemented + + return self.environ is other.environ + + __hash__ = None + + def __getitem__(self, key: str) -> str: # type: ignore[override] + return self._get_key(key) + + def _get_key(self, key: str) -> str: + if not isinstance(key, str): + raise BadRequestKeyError(key) + + key = key.upper().replace("-", "_") + + if key in {"CONTENT_TYPE", "CONTENT_LENGTH"}: + return self.environ[key] # type: ignore[no-any-return] + + return self.environ[f"HTTP_{key}"] # type: ignore[no-any-return] + + def __len__(self) -> int: + return sum(1 for _ in self) + + def __iter__(self) -> cabc.Iterator[tuple[str, str]]: + for key, value in self.environ.items(): + if key.startswith("HTTP_") and key not in { + "HTTP_CONTENT_TYPE", + "HTTP_CONTENT_LENGTH", + }: + yield key[5:].replace("_", "-").title(), value + elif key in {"CONTENT_TYPE", "CONTENT_LENGTH"} and value: + yield key.replace("_", "-").title(), value + + def copy(self) -> t.NoReturn: + raise TypeError(f"cannot create {type(self).__name__!r} copies") + + def __or__(self, other: t.Any) -> t.NoReturn: + raise TypeError(f"cannot create {type(self).__name__!r} copies") + + +# circular dependencies +from .. import http # noqa: E402 diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/werkzeug/datastructures/mixins.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/werkzeug/datastructures/mixins.py new file mode 100644 index 0000000000000000000000000000000000000000..8e00bdadd30e8eab9a7f18640c68ad96023fd6b9 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/werkzeug/datastructures/mixins.py @@ -0,0 +1,317 @@ +from __future__ import annotations + +import collections.abc as cabc +import typing as t +from functools import update_wrapper +from itertools import repeat + +from .._internal import _missing + +if t.TYPE_CHECKING: + import typing_extensions as te + +K = t.TypeVar("K") +V = t.TypeVar("V") +T = t.TypeVar("T") +F = t.TypeVar("F", bound=cabc.Callable[..., t.Any]) + + +def _immutable_error(self: t.Any) -> t.NoReturn: + raise TypeError(f"{type(self).__name__!r} objects are immutable") + + +class ImmutableListMixin: + """Makes a :class:`list` immutable. + + .. versionadded:: 0.5 + + :private: + """ + + _hash_cache: int | None = None + + def __hash__(self) -> int: + if self._hash_cache is not None: + return self._hash_cache + rv = self._hash_cache = hash(tuple(self)) # type: ignore[arg-type] + return rv + + def __reduce_ex__(self, protocol: t.SupportsIndex) -> t.Any: + return type(self), (list(self),) # type: ignore[call-overload] + + def __delitem__(self, key: t.Any) -> t.NoReturn: + _immutable_error(self) + + def __iadd__(self, other: t.Any) -> t.NoReturn: + _immutable_error(self) + + def __imul__(self, other: t.Any) -> t.NoReturn: + _immutable_error(self) + + def __setitem__(self, key: t.Any, value: t.Any) -> t.NoReturn: + _immutable_error(self) + + def append(self, item: t.Any) -> t.NoReturn: + _immutable_error(self) + + def remove(self, item: t.Any) -> t.NoReturn: + _immutable_error(self) + + def extend(self, iterable: t.Any) -> t.NoReturn: + _immutable_error(self) + + def insert(self, pos: t.Any, value: t.Any) -> t.NoReturn: + _immutable_error(self) + + def pop(self, index: t.Any = -1) -> t.NoReturn: + _immutable_error(self) + + def reverse(self: t.Any) -> t.NoReturn: + _immutable_error(self) + + def sort(self, key: t.Any = None, reverse: t.Any = False) -> t.NoReturn: + _immutable_error(self) + + +class ImmutableDictMixin(t.Generic[K, V]): + """Makes a :class:`dict` immutable. + + .. versionchanged:: 3.1 + Disallow ``|=`` operator. + + .. versionadded:: 0.5 + + :private: + """ + + _hash_cache: int | None = None + + @classmethod + @t.overload + def fromkeys( + cls, keys: cabc.Iterable[K], value: None + ) -> ImmutableDictMixin[K, t.Any | None]: ... + @classmethod + @t.overload + def fromkeys(cls, keys: cabc.Iterable[K], value: V) -> ImmutableDictMixin[K, V]: ... + @classmethod + def fromkeys( + cls, keys: cabc.Iterable[K], value: V | None = None + ) -> ImmutableDictMixin[K, t.Any | None] | ImmutableDictMixin[K, V]: + instance = super().__new__(cls) + instance.__init__(zip(keys, repeat(value))) # type: ignore[misc] + return instance + + def __reduce_ex__(self, protocol: t.SupportsIndex) -> t.Any: + return type(self), (dict(self),) # type: ignore[call-overload] + + def _iter_hashitems(self) -> t.Iterable[t.Any]: + return self.items() # type: ignore[attr-defined,no-any-return] + + def __hash__(self) -> int: + if self._hash_cache is not None: + return self._hash_cache + rv = self._hash_cache = hash(frozenset(self._iter_hashitems())) + return rv + + def setdefault(self, key: t.Any, default: t.Any = None) -> t.NoReturn: + _immutable_error(self) + + def update(self, arg: t.Any, /, **kwargs: t.Any) -> t.NoReturn: + _immutable_error(self) + + def __ior__(self, other: t.Any) -> t.NoReturn: + _immutable_error(self) + + def pop(self, key: t.Any, default: t.Any = None) -> t.NoReturn: + _immutable_error(self) + + def popitem(self) -> t.NoReturn: + _immutable_error(self) + + def __setitem__(self, key: t.Any, value: t.Any) -> t.NoReturn: + _immutable_error(self) + + def __delitem__(self, key: t.Any) -> t.NoReturn: + _immutable_error(self) + + def clear(self) -> t.NoReturn: + _immutable_error(self) + + +class ImmutableMultiDictMixin(ImmutableDictMixin[K, V]): + """Makes a :class:`MultiDict` immutable. + + .. versionadded:: 0.5 + + :private: + """ + + def __reduce_ex__(self, protocol: t.SupportsIndex) -> t.Any: + return type(self), (list(self.items(multi=True)),) # type: ignore[attr-defined] + + def _iter_hashitems(self) -> t.Iterable[t.Any]: + return self.items(multi=True) # type: ignore[attr-defined,no-any-return] + + def add(self, key: t.Any, value: t.Any) -> t.NoReturn: + _immutable_error(self) + + def popitemlist(self) -> t.NoReturn: + _immutable_error(self) + + def poplist(self, key: t.Any) -> t.NoReturn: + _immutable_error(self) + + def setlist(self, key: t.Any, new_list: t.Any) -> t.NoReturn: + _immutable_error(self) + + def setlistdefault(self, key: t.Any, default_list: t.Any = None) -> t.NoReturn: + _immutable_error(self) + + +class ImmutableHeadersMixin: + """Makes a :class:`Headers` immutable. We do not mark them as + hashable though since the only usecase for this datastructure + in Werkzeug is a view on a mutable structure. + + .. versionchanged:: 3.1 + Disallow ``|=`` operator. + + .. versionadded:: 0.5 + + :private: + """ + + def __delitem__(self, key: t.Any, **kwargs: t.Any) -> t.NoReturn: + _immutable_error(self) + + def __setitem__(self, key: t.Any, value: t.Any) -> t.NoReturn: + _immutable_error(self) + + def set(self, key: t.Any, value: t.Any, /, **kwargs: t.Any) -> t.NoReturn: + _immutable_error(self) + + def setlist(self, key: t.Any, values: t.Any) -> t.NoReturn: + _immutable_error(self) + + def add(self, key: t.Any, value: t.Any, /, **kwargs: t.Any) -> t.NoReturn: + _immutable_error(self) + + def add_header(self, key: t.Any, value: t.Any, /, **kwargs: t.Any) -> t.NoReturn: + _immutable_error(self) + + def remove(self, key: t.Any) -> t.NoReturn: + _immutable_error(self) + + def extend(self, arg: t.Any, /, **kwargs: t.Any) -> t.NoReturn: + _immutable_error(self) + + def update(self, arg: t.Any, /, **kwargs: t.Any) -> t.NoReturn: + _immutable_error(self) + + def __ior__(self, other: t.Any) -> t.NoReturn: + _immutable_error(self) + + def insert(self, pos: t.Any, value: t.Any) -> t.NoReturn: + _immutable_error(self) + + def pop(self, key: t.Any = None, default: t.Any = _missing) -> t.NoReturn: + _immutable_error(self) + + def popitem(self) -> t.NoReturn: + _immutable_error(self) + + def setdefault(self, key: t.Any, default: t.Any) -> t.NoReturn: + _immutable_error(self) + + def setlistdefault(self, key: t.Any, default: t.Any) -> t.NoReturn: + _immutable_error(self) + + +def _always_update(f: F) -> F: + def wrapper( + self: UpdateDictMixin[t.Any, t.Any], /, *args: t.Any, **kwargs: t.Any + ) -> t.Any: + rv = f(self, *args, **kwargs) + + if self.on_update is not None: + self.on_update(self) + + return rv + + return update_wrapper(wrapper, f) # type: ignore[return-value] + + +class UpdateDictMixin(dict[K, V]): + """Makes dicts call `self.on_update` on modifications. + + .. versionchanged:: 3.1 + Implement ``|=`` operator. + + .. versionadded:: 0.5 + + :private: + """ + + on_update: cabc.Callable[[te.Self], None] | None = None + + def setdefault(self: te.Self, key: K, default: V | None = None) -> V: + modified = key not in self + rv = super().setdefault(key, default) # type: ignore[arg-type] + if modified and self.on_update is not None: + self.on_update(self) + return rv + + @t.overload + def pop(self: te.Self, key: K) -> V: ... + @t.overload + def pop(self: te.Self, key: K, default: V) -> V: ... + @t.overload + def pop(self: te.Self, key: K, default: T) -> T: ... + def pop( + self: te.Self, + key: K, + default: V | T = _missing, # type: ignore[assignment] + ) -> V | T: + modified = key in self + if default is _missing: + rv: V | T = super().pop(key) + else: + rv = super().pop(key, default) + if modified and self.on_update is not None: + self.on_update(self) + return rv + + @_always_update + def __setitem__(self, key: K, value: V) -> None: + super().__setitem__(key, value) + + @_always_update + def __delitem__(self, key: K) -> None: + super().__delitem__(key) + + @_always_update + def clear(self) -> None: + super().clear() + + @_always_update + def popitem(self) -> tuple[K, V]: + return super().popitem() + + @_always_update + def update( # type: ignore[override] + self, + arg: cabc.Mapping[K, V] | cabc.Iterable[tuple[K, V]] | None = None, + /, + **kwargs: V, + ) -> None: + if arg is None: + super().update(**kwargs) # type: ignore[call-overload] + else: + super().update(arg, **kwargs) + + @_always_update + def __ior__( # type: ignore[override] + self, other: cabc.Mapping[K, V] | cabc.Iterable[tuple[K, V]] + ) -> te.Self: + return super().__ior__(other) diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/werkzeug/datastructures/range.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/werkzeug/datastructures/range.py new file mode 100644 index 0000000000000000000000000000000000000000..72f863d2c97ff8e7e62540d2f839f92e404cbf3b --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/werkzeug/datastructures/range.py @@ -0,0 +1,214 @@ +from __future__ import annotations + +import collections.abc as cabc +import typing as t +from datetime import datetime + +if t.TYPE_CHECKING: + import typing_extensions as te + +T = t.TypeVar("T") + + +class IfRange: + """Very simple object that represents the `If-Range` header in parsed + form. It will either have neither a etag or date or one of either but + never both. + + .. versionadded:: 0.7 + """ + + def __init__(self, etag: str | None = None, date: datetime | None = None): + #: The etag parsed and unquoted. Ranges always operate on strong + #: etags so the weakness information is not necessary. + self.etag = etag + #: The date in parsed format or `None`. + self.date = date + + def to_header(self) -> str: + """Converts the object back into an HTTP header.""" + if self.date is not None: + return http.http_date(self.date) + if self.etag is not None: + return http.quote_etag(self.etag) + return "" + + def __str__(self) -> str: + return self.to_header() + + def __repr__(self) -> str: + return f"<{type(self).__name__} {str(self)!r}>" + + +class Range: + """Represents a ``Range`` header. All methods only support only + bytes as the unit. Stores a list of ranges if given, but the methods + only work if only one range is provided. + + :raise ValueError: If the ranges provided are invalid. + + .. versionchanged:: 0.15 + The ranges passed in are validated. + + .. versionadded:: 0.7 + """ + + def __init__( + self, units: str, ranges: cabc.Sequence[tuple[int, int | None]] + ) -> None: + #: The units of this range. Usually "bytes". + self.units = units + #: A list of ``(begin, end)`` tuples for the range header provided. + #: The ranges are non-inclusive. + self.ranges = ranges + + for start, end in ranges: + if start is None or (end is not None and (start < 0 or start >= end)): + raise ValueError(f"{(start, end)} is not a valid range.") + + def range_for_length(self, length: int | None) -> tuple[int, int] | None: + """If the range is for bytes, the length is not None and there is + exactly one range and it is satisfiable it returns a ``(start, stop)`` + tuple, otherwise `None`. + """ + if self.units != "bytes" or length is None or len(self.ranges) != 1: + return None + start, end = self.ranges[0] + if end is None: + end = length + if start < 0: + start += length + if http.is_byte_range_valid(start, end, length): + return start, min(end, length) + return None + + def make_content_range(self, length: int | None) -> ContentRange | None: + """Creates a :class:`~werkzeug.datastructures.ContentRange` object + from the current range and given content length. + """ + rng = self.range_for_length(length) + if rng is not None: + return ContentRange(self.units, rng[0], rng[1], length) + return None + + def to_header(self) -> str: + """Converts the object back into an HTTP header.""" + ranges = [] + for begin, end in self.ranges: + if end is None: + ranges.append(f"{begin}-" if begin >= 0 else str(begin)) + else: + ranges.append(f"{begin}-{end - 1}") + return f"{self.units}={','.join(ranges)}" + + def to_content_range_header(self, length: int | None) -> str | None: + """Converts the object into `Content-Range` HTTP header, + based on given length + """ + range = self.range_for_length(length) + if range is not None: + return f"{self.units} {range[0]}-{range[1] - 1}/{length}" + return None + + def __str__(self) -> str: + return self.to_header() + + def __repr__(self) -> str: + return f"<{type(self).__name__} {str(self)!r}>" + + +class _CallbackProperty(t.Generic[T]): + def __set_name__(self, owner: type[ContentRange], name: str) -> None: + self.attr = f"_{name}" + + @t.overload + def __get__(self, instance: None, owner: None) -> te.Self: ... + @t.overload + def __get__(self, instance: ContentRange, owner: type[ContentRange]) -> T: ... + def __get__( + self, instance: ContentRange | None, owner: type[ContentRange] | None + ) -> te.Self | T: + if instance is None: + return self + + return instance.__dict__[self.attr] # type: ignore[no-any-return] + + def __set__(self, instance: ContentRange, value: T) -> None: + instance.__dict__[self.attr] = value + + if instance.on_update is not None: + instance.on_update(instance) + + +class ContentRange: + """Represents the content range header. + + .. versionadded:: 0.7 + """ + + def __init__( + self, + units: str | None, + start: int | None, + stop: int | None, + length: int | None = None, + on_update: cabc.Callable[[ContentRange], None] | None = None, + ) -> None: + self.on_update = on_update + self.set(start, stop, length, units) + + #: The units to use, usually "bytes" + units: str | None = _CallbackProperty() # type: ignore[assignment] + #: The start point of the range or `None`. + start: int | None = _CallbackProperty() # type: ignore[assignment] + #: The stop point of the range (non-inclusive) or `None`. Can only be + #: `None` if also start is `None`. + stop: int | None = _CallbackProperty() # type: ignore[assignment] + #: The length of the range or `None`. + length: int | None = _CallbackProperty() # type: ignore[assignment] + + def set( + self, + start: int | None, + stop: int | None, + length: int | None = None, + units: str | None = "bytes", + ) -> None: + """Simple method to update the ranges.""" + assert http.is_byte_range_valid(start, stop, length), "Bad range provided" + self._units: str | None = units + self._start: int | None = start + self._stop: int | None = stop + self._length: int | None = length + if self.on_update is not None: + self.on_update(self) + + def unset(self) -> None: + """Sets the units to `None` which indicates that the header should + no longer be used. + """ + self.set(None, None, units=None) + + def to_header(self) -> str: + if self._units is None: + return "" + if self._length is None: + length: str | int = "*" + else: + length = self._length + if self._start is None: + return f"{self._units} */{length}" + return f"{self._units} {self._start}-{self._stop - 1}/{length}" # type: ignore[operator] + + def __bool__(self) -> bool: + return self._units is not None + + def __str__(self) -> str: + return self.to_header() + + def __repr__(self) -> str: + return f"<{type(self).__name__} {str(self)!r}>" + + +# circular dependencies +from .. import http # noqa: E402 diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/werkzeug/datastructures/structures.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/werkzeug/datastructures/structures.py new file mode 100644 index 0000000000000000000000000000000000000000..8dc6437a6973fc5c17c19e423f18b0b21500d476 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/werkzeug/datastructures/structures.py @@ -0,0 +1,1239 @@ +from __future__ import annotations + +import collections.abc as cabc +import typing as t +from copy import deepcopy + +from .. import exceptions +from .._internal import _missing +from .mixins import ImmutableDictMixin +from .mixins import ImmutableListMixin +from .mixins import ImmutableMultiDictMixin +from .mixins import UpdateDictMixin + +if t.TYPE_CHECKING: + import typing_extensions as te + +K = t.TypeVar("K") +V = t.TypeVar("V") +T = t.TypeVar("T") + + +def iter_multi_items( + mapping: ( + MultiDict[K, V] + | cabc.Mapping[K, V | list[V] | tuple[V, ...] | set[V]] + | cabc.Iterable[tuple[K, V]] + ), +) -> cabc.Iterator[tuple[K, V]]: + """Iterates over the items of a mapping yielding keys and values + without dropping any from more complex structures. + """ + if isinstance(mapping, MultiDict): + yield from mapping.items(multi=True) + elif isinstance(mapping, cabc.Mapping): + for key, value in mapping.items(): + if isinstance(value, (list, tuple, set)): + for v in value: + yield key, v + else: + yield key, value + else: + yield from mapping + + +class ImmutableList(ImmutableListMixin, list[V]): # type: ignore[misc] + """An immutable :class:`list`. + + .. versionadded:: 0.5 + + :private: + """ + + def __repr__(self) -> str: + return f"{type(self).__name__}({list.__repr__(self)})" + + +class TypeConversionDict(dict[K, V]): + """Works like a regular dict but the :meth:`get` method can perform + type conversions. :class:`MultiDict` and :class:`CombinedMultiDict` + are subclasses of this class and provide the same feature. + + .. versionadded:: 0.5 + """ + + @t.overload # type: ignore[override] + def get(self, key: K) -> V | None: ... + @t.overload + def get(self, key: K, default: V) -> V: ... + @t.overload + def get(self, key: K, default: T) -> V | T: ... + @t.overload + def get(self, key: str, type: cabc.Callable[[V], T]) -> T | None: ... + @t.overload + def get(self, key: str, default: T, type: cabc.Callable[[V], T]) -> T: ... + def get( # type: ignore[misc] + self, + key: K, + default: V | T | None = None, + type: cabc.Callable[[V], T] | None = None, + ) -> V | T | None: + """Return the default value if the requested data doesn't exist. + If `type` is provided and is a callable it should convert the value, + return it or raise a :exc:`ValueError` if that is not possible. In + this case the function will return the default as if the value was not + found: + + >>> d = TypeConversionDict(foo='42', bar='blub') + >>> d.get('foo', type=int) + 42 + >>> d.get('bar', -1, type=int) + -1 + + :param key: The key to be looked up. + :param default: The default value to be returned if the key can't + be looked up. If not further specified `None` is + returned. + :param type: A callable that is used to cast the value in the + :class:`MultiDict`. If a :exc:`ValueError` or a + :exc:`TypeError` is raised by this callable the default + value is returned. + + .. versionchanged:: 3.0.2 + Returns the default value on :exc:`TypeError`, too. + """ + try: + rv = self[key] + except KeyError: + return default + + if type is None: + return rv + + try: + return type(rv) + except (ValueError, TypeError): + return default + + +class ImmutableTypeConversionDict(ImmutableDictMixin[K, V], TypeConversionDict[K, V]): # type: ignore[misc] + """Works like a :class:`TypeConversionDict` but does not support + modifications. + + .. versionadded:: 0.5 + """ + + def copy(self) -> TypeConversionDict[K, V]: + """Return a shallow mutable copy of this object. Keep in mind that + the standard library's :func:`copy` function is a no-op for this class + like for any other python immutable type (eg: :class:`tuple`). + """ + return TypeConversionDict(self) + + def __copy__(self) -> te.Self: + return self + + +class MultiDict(TypeConversionDict[K, V]): + """A :class:`MultiDict` is a dictionary subclass customized to deal with + multiple values for the same key which is for example used by the parsing + functions in the wrappers. This is necessary because some HTML form + elements pass multiple values for the same key. + + :class:`MultiDict` implements all standard dictionary methods. + Internally, it saves all values for a key as a list, but the standard dict + access methods will only return the first value for a key. If you want to + gain access to the other values, too, you have to use the `list` methods as + explained below. + + Basic Usage: + + >>> d = MultiDict([('a', 'b'), ('a', 'c')]) + >>> d + MultiDict([('a', 'b'), ('a', 'c')]) + >>> d['a'] + 'b' + >>> d.getlist('a') + ['b', 'c'] + >>> 'a' in d + True + + It behaves like a normal dict thus all dict functions will only return the + first value when multiple values for one key are found. + + From Werkzeug 0.3 onwards, the `KeyError` raised by this class is also a + subclass of the :exc:`~exceptions.BadRequest` HTTP exception and will + render a page for a ``400 BAD REQUEST`` if caught in a catch-all for HTTP + exceptions. + + A :class:`MultiDict` can be constructed from an iterable of + ``(key, value)`` tuples, a dict, a :class:`MultiDict` or from Werkzeug 0.2 + onwards some keyword parameters. + + :param mapping: the initial value for the :class:`MultiDict`. Either a + regular dict, an iterable of ``(key, value)`` tuples + or `None`. + + .. versionchanged:: 3.1 + Implement ``|`` and ``|=`` operators. + """ + + def __init__( + self, + mapping: ( + MultiDict[K, V] + | cabc.Mapping[K, V | list[V] | tuple[V, ...] | set[V]] + | cabc.Iterable[tuple[K, V]] + | None + ) = None, + ) -> None: + if mapping is None: + super().__init__() + elif isinstance(mapping, MultiDict): + super().__init__((k, vs[:]) for k, vs in mapping.lists()) # type: ignore[misc] + elif isinstance(mapping, cabc.Mapping): + tmp = {} + for key, value in mapping.items(): + if isinstance(value, (list, tuple, set)): + value = list(value) + + if not value: + continue + else: + value = [value] + tmp[key] = value + super().__init__(tmp) # type: ignore[arg-type] + else: + tmp = {} + for key, value in mapping: + tmp.setdefault(key, []).append(value) + super().__init__(tmp) # type: ignore[arg-type] + + def __getstate__(self) -> t.Any: + return dict(self.lists()) + + def __setstate__(self, value: t.Any) -> None: + super().clear() + super().update(value) + + def __iter__(self) -> cabc.Iterator[K]: + # https://github.com/python/cpython/issues/87412 + # If __iter__ is not overridden, Python uses a fast path for dict(md), + # taking the data directly and getting lists of values, rather than + # calling __getitem__ and getting only the first value. + return super().__iter__() + + def __getitem__(self, key: K) -> V: + """Return the first data value for this key; + raises KeyError if not found. + + :param key: The key to be looked up. + :raise KeyError: if the key does not exist. + """ + + if key in self: + lst = super().__getitem__(key) + if len(lst) > 0: # type: ignore[arg-type] + return lst[0] # type: ignore[index,no-any-return] + raise exceptions.BadRequestKeyError(key) + + def __setitem__(self, key: K, value: V) -> None: + """Like :meth:`add` but removes an existing key first. + + :param key: the key for the value. + :param value: the value to set. + """ + super().__setitem__(key, [value]) # type: ignore[assignment] + + def add(self, key: K, value: V) -> None: + """Adds a new value for the key. + + .. versionadded:: 0.6 + + :param key: the key for the value. + :param value: the value to add. + """ + super().setdefault(key, []).append(value) # type: ignore[arg-type,attr-defined] + + @t.overload + def getlist(self, key: K) -> list[V]: ... + @t.overload + def getlist(self, key: K, type: cabc.Callable[[V], T]) -> list[T]: ... + def getlist( + self, key: K, type: cabc.Callable[[V], T] | None = None + ) -> list[V] | list[T]: + """Return the list of items for a given key. If that key is not in the + `MultiDict`, the return value will be an empty list. Just like `get`, + `getlist` accepts a `type` parameter. All items will be converted + with the callable defined there. + + :param key: The key to be looked up. + :param type: Callable to convert each value. If a ``ValueError`` or + ``TypeError`` is raised, the value is omitted. + :return: a :class:`list` of all the values for the key. + + .. versionchanged:: 3.1 + Catches ``TypeError`` in addition to ``ValueError``. + """ + try: + rv: list[V] = super().__getitem__(key) # type: ignore[assignment] + except KeyError: + return [] + if type is None: + return list(rv) + result = [] + for item in rv: + try: + result.append(type(item)) + except (ValueError, TypeError): + pass + return result + + def setlist(self, key: K, new_list: cabc.Iterable[V]) -> None: + """Remove the old values for a key and add new ones. Note that the list + you pass the values in will be shallow-copied before it is inserted in + the dictionary. + + >>> d = MultiDict() + >>> d.setlist('foo', ['1', '2']) + >>> d['foo'] + '1' + >>> d.getlist('foo') + ['1', '2'] + + :param key: The key for which the values are set. + :param new_list: An iterable with the new values for the key. Old values + are removed first. + """ + super().__setitem__(key, list(new_list)) # type: ignore[assignment] + + @t.overload + def setdefault(self, key: K) -> None: ... + @t.overload + def setdefault(self, key: K, default: V) -> V: ... + def setdefault(self, key: K, default: V | None = None) -> V | None: + """Returns the value for the key if it is in the dict, otherwise it + returns `default` and sets that value for `key`. + + :param key: The key to be looked up. + :param default: The default value to be returned if the key is not + in the dict. If not further specified it's `None`. + """ + if key not in self: + self[key] = default # type: ignore[assignment] + + return self[key] + + def setlistdefault( + self, key: K, default_list: cabc.Iterable[V] | None = None + ) -> list[V]: + """Like `setdefault` but sets multiple values. The list returned + is not a copy, but the list that is actually used internally. This + means that you can put new values into the dict by appending items + to the list: + + >>> d = MultiDict({"foo": 1}) + >>> d.setlistdefault("foo").extend([2, 3]) + >>> d.getlist("foo") + [1, 2, 3] + + :param key: The key to be looked up. + :param default_list: An iterable of default values. It is either copied + (in case it was a list) or converted into a list + before returned. + :return: a :class:`list` + """ + if key not in self: + super().__setitem__(key, list(default_list or ())) # type: ignore[assignment] + + return super().__getitem__(key) # type: ignore[return-value] + + def items(self, multi: bool = False) -> cabc.Iterable[tuple[K, V]]: # type: ignore[override] + """Return an iterator of ``(key, value)`` pairs. + + :param multi: If set to `True` the iterator returned will have a pair + for each value of each key. Otherwise it will only + contain pairs for the first value of each key. + """ + values: list[V] + + for key, values in super().items(): # type: ignore[assignment] + if multi: + for value in values: + yield key, value + else: + yield key, values[0] + + def lists(self) -> cabc.Iterable[tuple[K, list[V]]]: + """Return a iterator of ``(key, values)`` pairs, where values is the list + of all values associated with the key.""" + values: list[V] + + for key, values in super().items(): # type: ignore[assignment] + yield key, list(values) + + def values(self) -> cabc.Iterable[V]: # type: ignore[override] + """Returns an iterator of the first value on every key's value list.""" + values: list[V] + + for values in super().values(): # type: ignore[assignment] + yield values[0] + + def listvalues(self) -> cabc.Iterable[list[V]]: + """Return an iterator of all values associated with a key. Zipping + :meth:`keys` and this is the same as calling :meth:`lists`: + + >>> d = MultiDict({"foo": [1, 2, 3]}) + >>> zip(d.keys(), d.listvalues()) == d.lists() + True + """ + return super().values() # type: ignore[return-value] + + def copy(self) -> te.Self: + """Return a shallow copy of this object.""" + return self.__class__(self) + + def deepcopy(self, memo: t.Any = None) -> te.Self: + """Return a deep copy of this object.""" + return self.__class__(deepcopy(self.to_dict(flat=False), memo)) + + @t.overload + def to_dict(self, flat: t.Literal[True] = ...) -> dict[K, V]: ... + @t.overload + def to_dict(self, flat: t.Literal[False]) -> dict[K, list[V]]: ... + def to_dict(self, flat: bool = True) -> dict[K, V] | dict[K, list[V]]: + """Return the contents as regular dict. If `flat` is `True` the + returned dict will only have the first item present, if `flat` is + `False` all values will be returned as lists. + + :param flat: If set to `False` the dict returned will have lists + with all the values in it. Otherwise it will only + contain the first value for each key. + :return: a :class:`dict` + """ + if flat: + return dict(self.items()) + return dict(self.lists()) + + def update( # type: ignore[override] + self, + mapping: ( + MultiDict[K, V] + | cabc.Mapping[K, V | list[V] | tuple[V, ...] | set[V]] + | cabc.Iterable[tuple[K, V]] + ), + ) -> None: + """update() extends rather than replaces existing key lists: + + >>> a = MultiDict({'x': 1}) + >>> b = MultiDict({'x': 2, 'y': 3}) + >>> a.update(b) + >>> a + MultiDict([('y', 3), ('x', 1), ('x', 2)]) + + If the value list for a key in ``other_dict`` is empty, no new values + will be added to the dict and the key will not be created: + + >>> x = {'empty_list': []} + >>> y = MultiDict() + >>> y.update(x) + >>> y + MultiDict([]) + """ + for key, value in iter_multi_items(mapping): + self.add(key, value) + + def __or__( # type: ignore[override] + self, other: cabc.Mapping[K, V | list[V] | tuple[V, ...] | set[V]] + ) -> MultiDict[K, V]: + if not isinstance(other, cabc.Mapping): + return NotImplemented + + rv = self.copy() + rv.update(other) + return rv + + def __ior__( # type: ignore[override] + self, + other: ( + cabc.Mapping[K, V | list[V] | tuple[V, ...] | set[V]] + | cabc.Iterable[tuple[K, V]] + ), + ) -> te.Self: + if not isinstance(other, (cabc.Mapping, cabc.Iterable)): + return NotImplemented + + self.update(other) + return self + + @t.overload + def pop(self, key: K) -> V: ... + @t.overload + def pop(self, key: K, default: V) -> V: ... + @t.overload + def pop(self, key: K, default: T) -> V | T: ... + def pop( + self, + key: K, + default: V | T = _missing, # type: ignore[assignment] + ) -> V | T: + """Pop the first item for a list on the dict. Afterwards the + key is removed from the dict, so additional values are discarded: + + >>> d = MultiDict({"foo": [1, 2, 3]}) + >>> d.pop("foo") + 1 + >>> "foo" in d + False + + :param key: the key to pop. + :param default: if provided the value to return if the key was + not in the dictionary. + """ + lst: list[V] + + try: + lst = super().pop(key) # type: ignore[assignment] + + if len(lst) == 0: + raise exceptions.BadRequestKeyError(key) + + return lst[0] + except KeyError: + if default is not _missing: + return default + + raise exceptions.BadRequestKeyError(key) from None + + def popitem(self) -> tuple[K, V]: + """Pop an item from the dict.""" + item: tuple[K, list[V]] + + try: + item = super().popitem() # type: ignore[assignment] + + if len(item[1]) == 0: + raise exceptions.BadRequestKeyError(item[0]) + + return item[0], item[1][0] + except KeyError as e: + raise exceptions.BadRequestKeyError(e.args[0]) from None + + def poplist(self, key: K) -> list[V]: + """Pop the list for a key from the dict. If the key is not in the dict + an empty list is returned. + + .. versionchanged:: 0.5 + If the key does no longer exist a list is returned instead of + raising an error. + """ + return super().pop(key, []) # type: ignore[return-value] + + def popitemlist(self) -> tuple[K, list[V]]: + """Pop a ``(key, list)`` tuple from the dict.""" + try: + return super().popitem() # type: ignore[return-value] + except KeyError as e: + raise exceptions.BadRequestKeyError(e.args[0]) from None + + def __copy__(self) -> te.Self: + return self.copy() + + def __deepcopy__(self, memo: t.Any) -> te.Self: + return self.deepcopy(memo=memo) + + def __repr__(self) -> str: + return f"{type(self).__name__}({list(self.items(multi=True))!r})" + + +class _omd_bucket(t.Generic[K, V]): + """Wraps values in the :class:`OrderedMultiDict`. This makes it + possible to keep an order over multiple different keys. It requires + a lot of extra memory and slows down access a lot, but makes it + possible to access elements in O(1) and iterate in O(n). + """ + + __slots__ = ("prev", "key", "value", "next") + + def __init__(self, omd: _OrderedMultiDict[K, V], key: K, value: V) -> None: + self.prev: _omd_bucket[K, V] | None = omd._last_bucket + self.key: K = key + self.value: V = value + self.next: _omd_bucket[K, V] | None = None + + if omd._first_bucket is None: + omd._first_bucket = self + if omd._last_bucket is not None: + omd._last_bucket.next = self + omd._last_bucket = self + + def unlink(self, omd: _OrderedMultiDict[K, V]) -> None: + if self.prev: + self.prev.next = self.next + if self.next: + self.next.prev = self.prev + if omd._first_bucket is self: + omd._first_bucket = self.next + if omd._last_bucket is self: + omd._last_bucket = self.prev + + +class _OrderedMultiDict(MultiDict[K, V]): + """Works like a regular :class:`MultiDict` but preserves the + order of the fields. To convert the ordered multi dict into a + list you can use the :meth:`items` method and pass it ``multi=True``. + + In general an :class:`OrderedMultiDict` is an order of magnitude + slower than a :class:`MultiDict`. + + .. admonition:: note + + Due to a limitation in Python you cannot convert an ordered + multi dict into a regular dict by using ``dict(multidict)``. + Instead you have to use the :meth:`to_dict` method, otherwise + the internal bucket objects are exposed. + + .. deprecated:: 3.1 + Will be removed in Werkzeug 3.2. Use ``MultiDict`` instead. + """ + + def __init__( + self, + mapping: ( + MultiDict[K, V] + | cabc.Mapping[K, V | list[V] | tuple[V, ...] | set[V]] + | cabc.Iterable[tuple[K, V]] + | None + ) = None, + ) -> None: + import warnings + + warnings.warn( + "'OrderedMultiDict' is deprecated and will be removed in Werkzeug" + " 3.2. Use 'MultiDict' instead.", + DeprecationWarning, + stacklevel=2, + ) + super().__init__() + self._first_bucket: _omd_bucket[K, V] | None = None + self._last_bucket: _omd_bucket[K, V] | None = None + if mapping is not None: + self.update(mapping) + + def __eq__(self, other: object) -> bool: + if not isinstance(other, MultiDict): + return NotImplemented + if isinstance(other, _OrderedMultiDict): + iter1 = iter(self.items(multi=True)) + iter2 = iter(other.items(multi=True)) + try: + for k1, v1 in iter1: + k2, v2 = next(iter2) + if k1 != k2 or v1 != v2: + return False + except StopIteration: + return False + try: + next(iter2) + except StopIteration: + return True + return False + if len(self) != len(other): + return False + for key, values in self.lists(): + if other.getlist(key) != values: + return False + return True + + __hash__ = None # type: ignore[assignment] + + def __reduce_ex__(self, protocol: t.SupportsIndex) -> t.Any: + return type(self), (list(self.items(multi=True)),) + + def __getstate__(self) -> t.Any: + return list(self.items(multi=True)) + + def __setstate__(self, values: t.Any) -> None: + self.clear() + + for key, value in values: + self.add(key, value) + + def __getitem__(self, key: K) -> V: + if key in self: + return dict.__getitem__(self, key)[0].value # type: ignore[index,no-any-return] + raise exceptions.BadRequestKeyError(key) + + def __setitem__(self, key: K, value: V) -> None: + self.poplist(key) + self.add(key, value) + + def __delitem__(self, key: K) -> None: + self.pop(key) + + def keys(self) -> cabc.Iterable[K]: # type: ignore[override] + return (key for key, _ in self.items()) + + def __iter__(self) -> cabc.Iterator[K]: + return iter(self.keys()) + + def values(self) -> cabc.Iterable[V]: # type: ignore[override] + return (value for key, value in self.items()) + + def items(self, multi: bool = False) -> cabc.Iterable[tuple[K, V]]: # type: ignore[override] + ptr = self._first_bucket + if multi: + while ptr is not None: + yield ptr.key, ptr.value + ptr = ptr.next + else: + returned_keys = set() + while ptr is not None: + if ptr.key not in returned_keys: + returned_keys.add(ptr.key) + yield ptr.key, ptr.value + ptr = ptr.next + + def lists(self) -> cabc.Iterable[tuple[K, list[V]]]: + returned_keys = set() + ptr = self._first_bucket + while ptr is not None: + if ptr.key not in returned_keys: + yield ptr.key, self.getlist(ptr.key) + returned_keys.add(ptr.key) + ptr = ptr.next + + def listvalues(self) -> cabc.Iterable[list[V]]: + for _key, values in self.lists(): + yield values + + def add(self, key: K, value: V) -> None: + dict.setdefault(self, key, []).append(_omd_bucket(self, key, value)) # type: ignore[misc] + + @t.overload + def getlist(self, key: K) -> list[V]: ... + @t.overload + def getlist(self, key: K, type: cabc.Callable[[V], T]) -> list[T]: ... + def getlist( + self, key: K, type: cabc.Callable[[V], T] | None = None + ) -> list[V] | list[T]: + rv: list[_omd_bucket[K, V]] + + try: + rv = dict.__getitem__(self, key) # type: ignore[index] + except KeyError: + return [] + if type is None: + return [x.value for x in rv] + result = [] + for item in rv: + try: + result.append(type(item.value)) + except (ValueError, TypeError): + pass + return result + + def setlist(self, key: K, new_list: cabc.Iterable[V]) -> None: + self.poplist(key) + for value in new_list: + self.add(key, value) + + def setlistdefault(self, key: t.Any, default_list: t.Any = None) -> t.NoReturn: + raise TypeError("setlistdefault is unsupported for ordered multi dicts") + + def update( # type: ignore[override] + self, + mapping: ( + MultiDict[K, V] + | cabc.Mapping[K, V | list[V] | tuple[V, ...] | set[V]] + | cabc.Iterable[tuple[K, V]] + ), + ) -> None: + for key, value in iter_multi_items(mapping): + self.add(key, value) + + def poplist(self, key: K) -> list[V]: + buckets: cabc.Iterable[_omd_bucket[K, V]] = dict.pop(self, key, ()) # type: ignore[arg-type] + for bucket in buckets: + bucket.unlink(self) + return [x.value for x in buckets] + + @t.overload + def pop(self, key: K) -> V: ... + @t.overload + def pop(self, key: K, default: V) -> V: ... + @t.overload + def pop(self, key: K, default: T) -> V | T: ... + def pop( + self, + key: K, + default: V | T = _missing, # type: ignore[assignment] + ) -> V | T: + buckets: list[_omd_bucket[K, V]] + + try: + buckets = dict.pop(self, key) # type: ignore[arg-type] + except KeyError: + if default is not _missing: + return default + + raise exceptions.BadRequestKeyError(key) from None + + for bucket in buckets: + bucket.unlink(self) + + return buckets[0].value + + def popitem(self) -> tuple[K, V]: + key: K + buckets: list[_omd_bucket[K, V]] + + try: + key, buckets = dict.popitem(self) # type: ignore[arg-type] + except KeyError as e: + raise exceptions.BadRequestKeyError(e.args[0]) from None + + for bucket in buckets: + bucket.unlink(self) + + return key, buckets[0].value + + def popitemlist(self) -> tuple[K, list[V]]: + key: K + buckets: list[_omd_bucket[K, V]] + + try: + key, buckets = dict.popitem(self) # type: ignore[arg-type] + except KeyError as e: + raise exceptions.BadRequestKeyError(e.args[0]) from None + + for bucket in buckets: + bucket.unlink(self) + + return key, [x.value for x in buckets] + + +class CombinedMultiDict(ImmutableMultiDictMixin[K, V], MultiDict[K, V]): # type: ignore[misc] + """A read only :class:`MultiDict` that you can pass multiple :class:`MultiDict` + instances as sequence and it will combine the return values of all wrapped + dicts: + + >>> from werkzeug.datastructures import CombinedMultiDict, MultiDict + >>> post = MultiDict([('foo', 'bar')]) + >>> get = MultiDict([('blub', 'blah')]) + >>> combined = CombinedMultiDict([get, post]) + >>> combined['foo'] + 'bar' + >>> combined['blub'] + 'blah' + + This works for all read operations and will raise a `TypeError` for + methods that usually change data which isn't possible. + + From Werkzeug 0.3 onwards, the `KeyError` raised by this class is also a + subclass of the :exc:`~exceptions.BadRequest` HTTP exception and will + render a page for a ``400 BAD REQUEST`` if caught in a catch-all for HTTP + exceptions. + """ + + def __reduce_ex__(self, protocol: t.SupportsIndex) -> t.Any: + return type(self), (self.dicts,) + + def __init__(self, dicts: cabc.Iterable[MultiDict[K, V]] | None = None) -> None: + super().__init__() + self.dicts: list[MultiDict[K, V]] = list(dicts or ()) + + @classmethod + def fromkeys(cls, keys: t.Any, value: t.Any = None) -> t.NoReturn: + raise TypeError(f"cannot create {cls.__name__!r} instances by fromkeys") + + def __getitem__(self, key: K) -> V: + for d in self.dicts: + if key in d: + return d[key] + raise exceptions.BadRequestKeyError(key) + + @t.overload # type: ignore[override] + def get(self, key: K) -> V | None: ... + @t.overload + def get(self, key: K, default: V) -> V: ... + @t.overload + def get(self, key: K, default: T) -> V | T: ... + @t.overload + def get(self, key: str, type: cabc.Callable[[V], T]) -> T | None: ... + @t.overload + def get(self, key: str, default: T, type: cabc.Callable[[V], T]) -> T: ... + def get( # type: ignore[misc] + self, + key: K, + default: V | T | None = None, + type: cabc.Callable[[V], T] | None = None, + ) -> V | T | None: + for d in self.dicts: + if key in d: + if type is not None: + try: + return type(d[key]) + except (ValueError, TypeError): + continue + return d[key] + return default + + @t.overload + def getlist(self, key: K) -> list[V]: ... + @t.overload + def getlist(self, key: K, type: cabc.Callable[[V], T]) -> list[T]: ... + def getlist( + self, key: K, type: cabc.Callable[[V], T] | None = None + ) -> list[V] | list[T]: + rv = [] + for d in self.dicts: + rv.extend(d.getlist(key, type)) # type: ignore[arg-type] + return rv + + def _keys_impl(self) -> set[K]: + """This function exists so __len__ can be implemented more efficiently, + saving one list creation from an iterator. + """ + return set(k for d in self.dicts for k in d) + + def keys(self) -> cabc.Iterable[K]: # type: ignore[override] + return self._keys_impl() + + def __iter__(self) -> cabc.Iterator[K]: + return iter(self._keys_impl()) + + @t.overload # type: ignore[override] + def items(self) -> cabc.Iterable[tuple[K, V]]: ... + @t.overload + def items(self, multi: t.Literal[True]) -> cabc.Iterable[tuple[K, list[V]]]: ... + def items( + self, multi: bool = False + ) -> cabc.Iterable[tuple[K, V]] | cabc.Iterable[tuple[K, list[V]]]: + found = set() + for d in self.dicts: + for key, value in d.items(multi): + if multi: + yield key, value + elif key not in found: + found.add(key) + yield key, value + + def values(self) -> cabc.Iterable[V]: # type: ignore[override] + for _, value in self.items(): + yield value + + def lists(self) -> cabc.Iterable[tuple[K, list[V]]]: + rv: dict[K, list[V]] = {} + for d in self.dicts: + for key, values in d.lists(): + rv.setdefault(key, []).extend(values) + return rv.items() + + def listvalues(self) -> cabc.Iterable[list[V]]: + return (x[1] for x in self.lists()) + + def copy(self) -> MultiDict[K, V]: # type: ignore[override] + """Return a shallow mutable copy of this object. + + This returns a :class:`MultiDict` representing the data at the + time of copying. The copy will no longer reflect changes to the + wrapped dicts. + + .. versionchanged:: 0.15 + Return a mutable :class:`MultiDict`. + """ + return MultiDict(self) + + def __len__(self) -> int: + return len(self._keys_impl()) + + def __contains__(self, key: K) -> bool: # type: ignore[override] + for d in self.dicts: + if key in d: + return True + return False + + def __repr__(self) -> str: + return f"{type(self).__name__}({self.dicts!r})" + + +class ImmutableDict(ImmutableDictMixin[K, V], dict[K, V]): # type: ignore[misc] + """An immutable :class:`dict`. + + .. versionadded:: 0.5 + """ + + def __repr__(self) -> str: + return f"{type(self).__name__}({dict.__repr__(self)})" + + def copy(self) -> dict[K, V]: + """Return a shallow mutable copy of this object. Keep in mind that + the standard library's :func:`copy` function is a no-op for this class + like for any other python immutable type (eg: :class:`tuple`). + """ + return dict(self) + + def __copy__(self) -> te.Self: + return self + + +class ImmutableMultiDict(ImmutableMultiDictMixin[K, V], MultiDict[K, V]): # type: ignore[misc] + """An immutable :class:`MultiDict`. + + .. versionadded:: 0.5 + """ + + def copy(self) -> MultiDict[K, V]: # type: ignore[override] + """Return a shallow mutable copy of this object. Keep in mind that + the standard library's :func:`copy` function is a no-op for this class + like for any other python immutable type (eg: :class:`tuple`). + """ + return MultiDict(self) + + def __copy__(self) -> te.Self: + return self + + +class _ImmutableOrderedMultiDict( # type: ignore[misc] + ImmutableMultiDictMixin[K, V], _OrderedMultiDict[K, V] +): + """An immutable :class:`OrderedMultiDict`. + + .. deprecated:: 3.1 + Will be removed in Werkzeug 3.2. Use ``ImmutableMultiDict`` instead. + + .. versionadded:: 0.6 + """ + + def __init__( + self, + mapping: ( + MultiDict[K, V] + | cabc.Mapping[K, V | list[V] | tuple[V, ...] | set[V]] + | cabc.Iterable[tuple[K, V]] + | None + ) = None, + ) -> None: + super().__init__() + + if mapping is not None: + for k, v in iter_multi_items(mapping): + _OrderedMultiDict.add(self, k, v) + + def _iter_hashitems(self) -> cabc.Iterable[t.Any]: + return enumerate(self.items(multi=True)) + + def copy(self) -> _OrderedMultiDict[K, V]: # type: ignore[override] + """Return a shallow mutable copy of this object. Keep in mind that + the standard library's :func:`copy` function is a no-op for this class + like for any other python immutable type (eg: :class:`tuple`). + """ + return _OrderedMultiDict(self) + + def __copy__(self) -> te.Self: + return self + + +class CallbackDict(UpdateDictMixin[K, V], dict[K, V]): + """A dict that calls a function passed every time something is changed. + The function is passed the dict instance. + """ + + def __init__( + self, + initial: cabc.Mapping[K, V] | cabc.Iterable[tuple[K, V]] | None = None, + on_update: cabc.Callable[[te.Self], None] | None = None, + ) -> None: + if initial is None: + super().__init__() + else: + super().__init__(initial) + + self.on_update = on_update + + def __repr__(self) -> str: + return f"<{type(self).__name__} {super().__repr__()}>" + + +class HeaderSet(cabc.MutableSet[str]): + """Similar to the :class:`ETags` class this implements a set-like structure. + Unlike :class:`ETags` this is case insensitive and used for vary, allow, and + content-language headers. + + If not constructed using the :func:`parse_set_header` function the + instantiation works like this: + + >>> hs = HeaderSet(['foo', 'bar', 'baz']) + >>> hs + HeaderSet(['foo', 'bar', 'baz']) + """ + + def __init__( + self, + headers: cabc.Iterable[str] | None = None, + on_update: cabc.Callable[[te.Self], None] | None = None, + ) -> None: + self._headers = list(headers or ()) + self._set = {x.lower() for x in self._headers} + self.on_update = on_update + + def add(self, header: str) -> None: + """Add a new header to the set.""" + self.update((header,)) + + def remove(self: te.Self, header: str) -> None: + """Remove a header from the set. This raises an :exc:`KeyError` if the + header is not in the set. + + .. versionchanged:: 0.5 + In older versions a :exc:`IndexError` was raised instead of a + :exc:`KeyError` if the object was missing. + + :param header: the header to be removed. + """ + key = header.lower() + if key not in self._set: + raise KeyError(header) + self._set.remove(key) + for idx, key in enumerate(self._headers): + if key.lower() == header: + del self._headers[idx] + break + if self.on_update is not None: + self.on_update(self) + + def update(self: te.Self, iterable: cabc.Iterable[str]) -> None: + """Add all the headers from the iterable to the set. + + :param iterable: updates the set with the items from the iterable. + """ + inserted_any = False + for header in iterable: + key = header.lower() + if key not in self._set: + self._headers.append(header) + self._set.add(key) + inserted_any = True + if inserted_any and self.on_update is not None: + self.on_update(self) + + def discard(self, header: str) -> None: + """Like :meth:`remove` but ignores errors. + + :param header: the header to be discarded. + """ + try: + self.remove(header) + except KeyError: + pass + + def find(self, header: str) -> int: + """Return the index of the header in the set or return -1 if not found. + + :param header: the header to be looked up. + """ + header = header.lower() + for idx, item in enumerate(self._headers): + if item.lower() == header: + return idx + return -1 + + def index(self, header: str) -> int: + """Return the index of the header in the set or raise an + :exc:`IndexError`. + + :param header: the header to be looked up. + """ + rv = self.find(header) + if rv < 0: + raise IndexError(header) + return rv + + def clear(self: te.Self) -> None: + """Clear the set.""" + self._set.clear() + self._headers.clear() + + if self.on_update is not None: + self.on_update(self) + + def as_set(self, preserve_casing: bool = False) -> set[str]: + """Return the set as real python set type. When calling this, all + the items are converted to lowercase and the ordering is lost. + + :param preserve_casing: if set to `True` the items in the set returned + will have the original case like in the + :class:`HeaderSet`, otherwise they will + be lowercase. + """ + if preserve_casing: + return set(self._headers) + return set(self._set) + + def to_header(self) -> str: + """Convert the header set into an HTTP header string.""" + return ", ".join(map(http.quote_header_value, self._headers)) + + def __getitem__(self, idx: t.SupportsIndex) -> str: + return self._headers[idx] + + def __delitem__(self: te.Self, idx: t.SupportsIndex) -> None: + rv = self._headers.pop(idx) + self._set.remove(rv.lower()) + if self.on_update is not None: + self.on_update(self) + + def __setitem__(self: te.Self, idx: t.SupportsIndex, value: str) -> None: + old = self._headers[idx] + self._set.remove(old.lower()) + self._headers[idx] = value + self._set.add(value.lower()) + if self.on_update is not None: + self.on_update(self) + + def __contains__(self, header: str) -> bool: # type: ignore[override] + return header.lower() in self._set + + def __len__(self) -> int: + return len(self._set) + + def __iter__(self) -> cabc.Iterator[str]: + return iter(self._headers) + + def __bool__(self) -> bool: + return bool(self._set) + + def __str__(self) -> str: + return self.to_header() + + def __repr__(self) -> str: + return f"{type(self).__name__}({self._headers!r})" + + +# circular dependencies +from .. import http # noqa: E402 + + +def __getattr__(name: str) -> t.Any: + import warnings + + if name == "OrderedMultiDict": + warnings.warn( + "'OrderedMultiDict' is deprecated and will be removed in Werkzeug" + " 3.2. Use 'MultiDict' instead.", + DeprecationWarning, + stacklevel=2, + ) + return _OrderedMultiDict + + if name == "ImmutableOrderedMultiDict": + warnings.warn( + "'ImmutableOrderedMultiDict' is deprecated and will be removed in" + " Werkzeug 3.2. Use 'ImmutableMultiDict' instead.", + DeprecationWarning, + stacklevel=2, + ) + return _ImmutableOrderedMultiDict + + raise AttributeError(name) diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/werkzeug/debug/__init__.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/werkzeug/debug/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..17cd4b25a9d2826329f7f2711f45eee4aebd9c82 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/werkzeug/debug/__init__.py @@ -0,0 +1,574 @@ +from __future__ import annotations + +import getpass +import hashlib +import json +import os +import pkgutil +import re +import sys +import time +import typing as t +import uuid +from contextlib import ExitStack +from io import BytesIO +from itertools import chain +from multiprocessing import Value +from os.path import basename +from os.path import join +from zlib import adler32 + +from .._internal import _log +from ..exceptions import NotFound +from ..exceptions import SecurityError +from ..http import parse_cookie +from ..sansio.utils import host_is_trusted +from ..security import gen_salt +from ..utils import send_file +from ..wrappers.request import Request +from ..wrappers.response import Response +from .console import Console +from .tbtools import DebugFrameSummary +from .tbtools import DebugTraceback +from .tbtools import render_console_html + +if t.TYPE_CHECKING: + from _typeshed.wsgi import StartResponse + from _typeshed.wsgi import WSGIApplication + from _typeshed.wsgi import WSGIEnvironment + +# A week +PIN_TIME = 60 * 60 * 24 * 7 + + +def hash_pin(pin: str) -> str: + return hashlib.sha1(f"{pin} added salt".encode("utf-8", "replace")).hexdigest()[:12] + + +_machine_id: str | bytes | None = None + + +def get_machine_id() -> str | bytes | None: + global _machine_id + + if _machine_id is not None: + return _machine_id + + def _generate() -> str | bytes | None: + linux = b"" + + # machine-id is stable across boots, boot_id is not. + for filename in "/etc/machine-id", "/proc/sys/kernel/random/boot_id": + try: + with open(filename, "rb") as f: + value = f.readline().strip() + except OSError: + continue + + if value: + linux += value + break + + # Containers share the same machine id, add some cgroup + # information. This is used outside containers too but should be + # relatively stable across boots. + try: + with open("/proc/self/cgroup", "rb") as f: + linux += f.readline().strip().rpartition(b"/")[2] + except OSError: + pass + + if linux: + return linux + + # On OS X, use ioreg to get the computer's serial number. + try: + # subprocess may not be available, e.g. Google App Engine + # https://github.com/pallets/werkzeug/issues/925 + from subprocess import PIPE + from subprocess import Popen + + dump = Popen( + ["ioreg", "-c", "IOPlatformExpertDevice", "-d", "2"], stdout=PIPE + ).communicate()[0] + match = re.search(b'"serial-number" = <([^>]+)', dump) + + if match is not None: + return match.group(1) + except (OSError, ImportError): + pass + + # On Windows, use winreg to get the machine guid. + if sys.platform == "win32": + import winreg + + try: + with winreg.OpenKey( + winreg.HKEY_LOCAL_MACHINE, + "SOFTWARE\\Microsoft\\Cryptography", + 0, + winreg.KEY_READ | winreg.KEY_WOW64_64KEY, + ) as rk: + guid: str | bytes + guid_type: int + guid, guid_type = winreg.QueryValueEx(rk, "MachineGuid") + + if guid_type == winreg.REG_SZ: + return guid.encode() + + return guid + except OSError: + pass + + return None + + _machine_id = _generate() + return _machine_id + + +class _ConsoleFrame: + """Helper class so that we can reuse the frame console code for the + standalone console. + """ + + def __init__(self, namespace: dict[str, t.Any]): + self.console = Console(namespace) + self.id = 0 + + def eval(self, code: str) -> t.Any: + return self.console.eval(code) + + +def get_pin_and_cookie_name( + app: WSGIApplication, +) -> tuple[str, str] | tuple[None, None]: + """Given an application object this returns a semi-stable 9 digit pin + code and a random key. The hope is that this is stable between + restarts to not make debugging particularly frustrating. If the pin + was forcefully disabled this returns `None`. + + Second item in the resulting tuple is the cookie name for remembering. + """ + pin = os.environ.get("WERKZEUG_DEBUG_PIN") + rv = None + num = None + + # Pin was explicitly disabled + if pin == "off": + return None, None + + # Pin was provided explicitly + if pin is not None and pin.replace("-", "").isdecimal(): + # If there are separators in the pin, return it directly + if "-" in pin: + rv = pin + else: + num = pin + + modname = getattr(app, "__module__", t.cast(object, app).__class__.__module__) + username: str | None + + try: + # getuser imports the pwd module, which does not exist in Google + # App Engine. It may also raise a KeyError if the UID does not + # have a username, such as in Docker. + username = getpass.getuser() + # Python >= 3.13 only raises OSError + except (ImportError, KeyError, OSError): + username = None + + mod = sys.modules.get(modname) + + # This information only exists to make the cookie unique on the + # computer, not as a security feature. + probably_public_bits = [ + username, + modname, + getattr(app, "__name__", type(app).__name__), + getattr(mod, "__file__", None), + ] + + # This information is here to make it harder for an attacker to + # guess the cookie name. They are unlikely to be contained anywhere + # within the unauthenticated debug page. + private_bits = [str(uuid.getnode()), get_machine_id()] + + h = hashlib.sha1() + for bit in chain(probably_public_bits, private_bits): + if not bit: + continue + if isinstance(bit, str): + bit = bit.encode() + h.update(bit) + h.update(b"cookiesalt") + + cookie_name = f"__wzd{h.hexdigest()[:20]}" + + # If we need to generate a pin we salt it a bit more so that we don't + # end up with the same value and generate out 9 digits + if num is None: + h.update(b"pinsalt") + num = f"{int(h.hexdigest(), 16):09d}"[:9] + + # Format the pincode in groups of digits for easier remembering if + # we don't have a result yet. + if rv is None: + for group_size in 5, 4, 3: + if len(num) % group_size == 0: + rv = "-".join( + num[x : x + group_size].rjust(group_size, "0") + for x in range(0, len(num), group_size) + ) + break + else: + rv = num + + return rv, cookie_name + + +class DebuggedApplication: + """Enables debugging support for a given application:: + + from werkzeug.debug import DebuggedApplication + from myapp import app + app = DebuggedApplication(app, evalex=True) + + The ``evalex`` argument allows evaluating expressions in any frame + of a traceback. This works by preserving each frame with its local + state. Some state, such as context globals, cannot be restored with + the frame by default. When ``evalex`` is enabled, + ``environ["werkzeug.debug.preserve_context"]`` will be a callable + that takes a context manager, and can be called multiple times. + Each context manager will be entered before evaluating code in the + frame, then exited again, so they can perform setup and cleanup for + each call. + + :param app: the WSGI application to run debugged. + :param evalex: enable exception evaluation feature (interactive + debugging). This requires a non-forking server. + :param request_key: The key that points to the request object in this + environment. This parameter is ignored in current + versions. + :param console_path: the URL for a general purpose console. + :param console_init_func: the function that is executed before starting + the general purpose console. The return value + is used as initial namespace. + :param show_hidden_frames: by default hidden traceback frames are skipped. + You can show them by setting this parameter + to `True`. + :param pin_security: can be used to disable the pin based security system. + :param pin_logging: enables the logging of the pin system. + + .. versionchanged:: 2.2 + Added the ``werkzeug.debug.preserve_context`` environ key. + """ + + _pin: str | None + _pin_cookie: str + + def __init__( + self, + app: WSGIApplication, + evalex: bool = False, + request_key: str = "werkzeug.request", + console_path: str = "/console", + console_init_func: t.Callable[[], dict[str, t.Any]] | None = None, + show_hidden_frames: bool = False, + pin_security: bool = True, + pin_logging: bool = True, + ) -> None: + if not console_init_func: + console_init_func = None + self.app = app + self.evalex = evalex + self.frames: dict[int, DebugFrameSummary | _ConsoleFrame] = {} + self.frame_contexts: dict[int, list[t.ContextManager[None]]] = {} + self.request_key = request_key + self.console_path = console_path + self.console_init_func = console_init_func + self.show_hidden_frames = show_hidden_frames + self.secret = gen_salt(20) + self._failed_pin_auth = Value("B") + + self.pin_logging = pin_logging + if pin_security: + # Print out the pin for the debugger on standard out. + if os.environ.get("WERKZEUG_RUN_MAIN") == "true" and pin_logging: + _log("warning", " * Debugger is active!") + if self.pin is None: + _log("warning", " * Debugger PIN disabled. DEBUGGER UNSECURED!") + else: + _log("info", " * Debugger PIN: %s", self.pin) + else: + self.pin = None + + self.trusted_hosts: list[str] = [".localhost", "127.0.0.1"] + """List of domains to allow requests to the debugger from. A leading dot + allows all subdomains. This only allows ``".localhost"`` domains by + default. + + .. versionadded:: 3.0.3 + """ + + @property + def pin(self) -> str | None: + if not hasattr(self, "_pin"): + pin_cookie = get_pin_and_cookie_name(self.app) + self._pin, self._pin_cookie = pin_cookie # type: ignore + return self._pin + + @pin.setter + def pin(self, value: str | None) -> None: + if value is None: + # Set _pin to None explicitly to prevent regeneration by the getter + self._pin = None + else: + self._pin = value + + @property + def pin_cookie_name(self) -> str: + """The name of the pin cookie.""" + if not hasattr(self, "_pin_cookie"): + pin_cookie = get_pin_and_cookie_name(self.app) + self._pin, self._pin_cookie = pin_cookie # type: ignore + return self._pin_cookie + + def debug_application( + self, environ: WSGIEnvironment, start_response: StartResponse + ) -> t.Iterator[bytes]: + """Run the application and conserve the traceback frames.""" + contexts: list[t.ContextManager[t.Any]] = [] + + if self.evalex: + environ["werkzeug.debug.preserve_context"] = contexts.append + + app_iter = None + try: + app_iter = self.app(environ, start_response) + yield from app_iter + if hasattr(app_iter, "close"): + app_iter.close() + except Exception as e: + if hasattr(app_iter, "close"): + app_iter.close() # type: ignore + + tb = DebugTraceback(e, skip=1, hide=not self.show_hidden_frames) + + for frame in tb.all_frames: + self.frames[id(frame)] = frame + self.frame_contexts[id(frame)] = contexts + + is_trusted = bool(self.check_pin_trust(environ)) + html = tb.render_debugger_html( + evalex=self.evalex and self.check_host_trust(environ), + secret=self.secret, + evalex_trusted=is_trusted, + ) + response = Response(html, status=500, mimetype="text/html") + + try: + yield from response(environ, start_response) + except Exception: + # if we end up here there has been output but an error + # occurred. in that situation we can do nothing fancy any + # more, better log something into the error log and fall + # back gracefully. + environ["wsgi.errors"].write( + "Debugging middleware caught exception in streamed " + "response at a point where response headers were already " + "sent.\n" + ) + + environ["wsgi.errors"].write("".join(tb.render_traceback_text())) + + def execute_command( + self, + request: Request, + command: str, + frame: DebugFrameSummary | _ConsoleFrame, + ) -> Response: + """Execute a command in a console.""" + if not self.check_host_trust(request.environ): + return SecurityError() # type: ignore[return-value] + + contexts = self.frame_contexts.get(id(frame), []) + + with ExitStack() as exit_stack: + for cm in contexts: + exit_stack.enter_context(cm) + + return Response(frame.eval(command), mimetype="text/html") + + def display_console(self, request: Request) -> Response: + """Display a standalone shell.""" + if not self.check_host_trust(request.environ): + return SecurityError() # type: ignore[return-value] + + if 0 not in self.frames: + if self.console_init_func is None: + ns = {} + else: + ns = dict(self.console_init_func()) + ns.setdefault("app", self.app) + self.frames[0] = _ConsoleFrame(ns) + is_trusted = bool(self.check_pin_trust(request.environ)) + return Response( + render_console_html(secret=self.secret, evalex_trusted=is_trusted), + mimetype="text/html", + ) + + def get_resource(self, request: Request, filename: str) -> Response: + """Return a static resource from the shared folder.""" + path = join("shared", basename(filename)) + + try: + data = pkgutil.get_data(__package__, path) + except OSError: + return NotFound() # type: ignore[return-value] + else: + if data is None: + return NotFound() # type: ignore[return-value] + + etag = str(adler32(data) & 0xFFFFFFFF) + return send_file( + BytesIO(data), request.environ, download_name=filename, etag=etag + ) + + def check_pin_trust(self, environ: WSGIEnvironment) -> bool | None: + """Checks if the request passed the pin test. This returns `True` if the + request is trusted on a pin/cookie basis and returns `False` if not. + Additionally if the cookie's stored pin hash is wrong it will return + `None` so that appropriate action can be taken. + """ + if self.pin is None: + return True + + # If we failed too many times, then we're locked out. + if self._failed_pin_auth.value >= 10: + return False + + val = parse_cookie(environ).get(self.pin_cookie_name) + if not val or "|" not in val: + return False + ts_str, pin_hash = val.split("|", 1) + + try: + ts = int(ts_str) + except ValueError: + return False + + if pin_hash != hash_pin(self.pin): + return None + return (time.time() - PIN_TIME) < ts + + def check_host_trust(self, environ: WSGIEnvironment) -> bool: + return host_is_trusted(environ.get("HTTP_HOST"), self.trusted_hosts) + + def _fail_pin_auth(self) -> None: + with self._failed_pin_auth.get_lock(): + count = self._failed_pin_auth.value + self._failed_pin_auth.value = count + 1 + + time.sleep(5.0 if count > 5 else 0.5) + + def pin_auth(self, request: Request) -> Response: + """Authenticates with the pin.""" + if not self.check_host_trust(request.environ): + return SecurityError() # type: ignore[return-value] + + exhausted = False + auth = False + trust = self.check_pin_trust(request.environ) + pin = t.cast(str, self.pin) + + # If the trust return value is `None` it means that the cookie is + # set but the stored pin hash value is bad. This means that the + # pin was changed. In this case we count a bad auth and unset the + # cookie. This way it becomes harder to guess the cookie name + # instead of the pin as we still count up failures. + bad_cookie = False + if trust is None: + self._fail_pin_auth() + bad_cookie = True + + # If we're trusted, we're authenticated. + elif trust: + auth = True + + # If we failed too many times, then we're locked out. + elif self._failed_pin_auth.value >= 10: + exhausted = True + + # Otherwise go through pin based authentication + else: + entered_pin = request.args["pin"] + + if entered_pin.strip().replace("-", "") == pin.replace("-", ""): + self._failed_pin_auth.value = 0 + auth = True + else: + self._fail_pin_auth() + + rv = Response( + json.dumps({"auth": auth, "exhausted": exhausted}), + mimetype="application/json", + ) + if auth: + rv.set_cookie( + self.pin_cookie_name, + f"{int(time.time())}|{hash_pin(pin)}", + httponly=True, + samesite="Strict", + secure=request.is_secure, + ) + elif bad_cookie: + rv.delete_cookie(self.pin_cookie_name) + return rv + + def log_pin_request(self, request: Request) -> Response: + """Log the pin if needed.""" + if not self.check_host_trust(request.environ): + return SecurityError() # type: ignore[return-value] + + if self.pin_logging and self.pin is not None: + _log( + "info", " * To enable the debugger you need to enter the security pin:" + ) + _log("info", " * Debugger pin code: %s", self.pin) + return Response("") + + def __call__( + self, environ: WSGIEnvironment, start_response: StartResponse + ) -> t.Iterable[bytes]: + """Dispatch the requests.""" + # important: don't ever access a function here that reads the incoming + # form data! Otherwise the application won't have access to that data + # any more! + request = Request(environ) + response = self.debug_application + if request.args.get("__debugger__") == "yes": + cmd = request.args.get("cmd") + arg = request.args.get("f") + secret = request.args.get("s") + frame = self.frames.get(request.args.get("frm", type=int)) # type: ignore + if cmd == "resource" and arg: + response = self.get_resource(request, arg) # type: ignore + elif cmd == "pinauth" and secret == self.secret: + response = self.pin_auth(request) # type: ignore + elif cmd == "printpin" and secret == self.secret: + response = self.log_pin_request(request) # type: ignore + elif ( + self.evalex + and cmd is not None + and frame is not None + and self.secret == secret + and self.check_pin_trust(environ) + ): + response = self.execute_command(request, cmd, frame) # type: ignore + elif ( + self.evalex + and self.console_path is not None + and request.path == self.console_path + ): + response = self.display_console(request) # type: ignore + return response(environ, start_response) diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/werkzeug/debug/console.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/werkzeug/debug/console.py new file mode 100644 index 0000000000000000000000000000000000000000..4e40475a5351ddccc0ef72746a159a6a75da63c2 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/werkzeug/debug/console.py @@ -0,0 +1,219 @@ +from __future__ import annotations + +import code +import sys +import typing as t +from contextvars import ContextVar +from types import CodeType + +from markupsafe import escape + +from .repr import debug_repr +from .repr import dump +from .repr import helper + +_stream: ContextVar[HTMLStringO] = ContextVar("werkzeug.debug.console.stream") +_ipy: ContextVar[_InteractiveConsole] = ContextVar("werkzeug.debug.console.ipy") + + +class HTMLStringO: + """A StringO version that HTML escapes on write.""" + + def __init__(self) -> None: + self._buffer: list[str] = [] + + def isatty(self) -> bool: + return False + + def close(self) -> None: + pass + + def flush(self) -> None: + pass + + def seek(self, n: int, mode: int = 0) -> None: + pass + + def readline(self) -> str: + if len(self._buffer) == 0: + return "" + ret = self._buffer[0] + del self._buffer[0] + return ret + + def reset(self) -> str: + val = "".join(self._buffer) + del self._buffer[:] + return val + + def _write(self, x: str) -> None: + self._buffer.append(x) + + def write(self, x: str) -> None: + self._write(escape(x)) + + def writelines(self, x: t.Iterable[str]) -> None: + self._write(escape("".join(x))) + + +class ThreadedStream: + """Thread-local wrapper for sys.stdout for the interactive console.""" + + @staticmethod + def push() -> None: + if not isinstance(sys.stdout, ThreadedStream): + sys.stdout = t.cast(t.TextIO, ThreadedStream()) + + _stream.set(HTMLStringO()) + + @staticmethod + def fetch() -> str: + try: + stream = _stream.get() + except LookupError: + return "" + + return stream.reset() + + @staticmethod + def displayhook(obj: object) -> None: + try: + stream = _stream.get() + except LookupError: + return _displayhook(obj) # type: ignore + + # stream._write bypasses escaping as debug_repr is + # already generating HTML for us. + if obj is not None: + _ipy.get().locals["_"] = obj + stream._write(debug_repr(obj)) + + def __setattr__(self, name: str, value: t.Any) -> None: + raise AttributeError(f"read only attribute {name}") + + def __dir__(self) -> list[str]: + return dir(sys.__stdout__) + + def __getattribute__(self, name: str) -> t.Any: + try: + stream = _stream.get() + except LookupError: + stream = sys.__stdout__ # type: ignore[assignment] + + return getattr(stream, name) + + def __repr__(self) -> str: + return repr(sys.__stdout__) + + +# add the threaded stream as display hook +_displayhook = sys.displayhook +sys.displayhook = ThreadedStream.displayhook + + +class _ConsoleLoader: + def __init__(self) -> None: + self._storage: dict[int, str] = {} + + def register(self, code: CodeType, source: str) -> None: + self._storage[id(code)] = source + # register code objects of wrapped functions too. + for var in code.co_consts: + if isinstance(var, CodeType): + self._storage[id(var)] = source + + def get_source_by_code(self, code: CodeType) -> str | None: + try: + return self._storage[id(code)] + except KeyError: + return None + + +class _InteractiveConsole(code.InteractiveInterpreter): + locals: dict[str, t.Any] + + def __init__(self, globals: dict[str, t.Any], locals: dict[str, t.Any]) -> None: + self.loader = _ConsoleLoader() + locals = { + **globals, + **locals, + "dump": dump, + "help": helper, + "__loader__": self.loader, + } + super().__init__(locals) + original_compile = self.compile + + def compile(source: str, filename: str, symbol: str) -> CodeType | None: + code = original_compile(source, filename, symbol) + + if code is not None: + self.loader.register(code, source) + + return code + + self.compile = compile # type: ignore[assignment] + self.more = False + self.buffer: list[str] = [] + + def runsource(self, source: str, **kwargs: t.Any) -> str: # type: ignore + source = f"{source.rstrip()}\n" + ThreadedStream.push() + prompt = "... " if self.more else ">>> " + try: + source_to_eval = "".join(self.buffer + [source]) + if super().runsource(source_to_eval, "", "single"): + self.more = True + self.buffer.append(source) + else: + self.more = False + del self.buffer[:] + finally: + output = ThreadedStream.fetch() + return f"{prompt}{escape(source)}{output}" + + def runcode(self, code: CodeType) -> None: + try: + exec(code, self.locals) + except Exception: + self.showtraceback() + + def showtraceback(self) -> None: + from .tbtools import DebugTraceback + + exc = t.cast(BaseException, sys.exc_info()[1]) + te = DebugTraceback(exc, skip=1) + sys.stdout._write(te.render_traceback_html()) # type: ignore + + def showsyntaxerror(self, filename: str | None = None) -> None: + from .tbtools import DebugTraceback + + exc = t.cast(BaseException, sys.exc_info()[1]) + te = DebugTraceback(exc, skip=4) + sys.stdout._write(te.render_traceback_html()) # type: ignore + + def write(self, data: str) -> None: + sys.stdout.write(data) + + +class Console: + """An interactive console.""" + + def __init__( + self, + globals: dict[str, t.Any] | None = None, + locals: dict[str, t.Any] | None = None, + ) -> None: + if locals is None: + locals = {} + if globals is None: + globals = {} + self._ipy = _InteractiveConsole(globals, locals) + + def eval(self, code: str) -> str: + _ipy.set(self._ipy) + old_sys_stdout = sys.stdout + try: + return self._ipy.runsource(code) + finally: + sys.stdout = old_sys_stdout diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/werkzeug/debug/repr.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/werkzeug/debug/repr.py new file mode 100644 index 0000000000000000000000000000000000000000..2bbd9d5467f1c7adea105b038ab817ad6171ddad --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/werkzeug/debug/repr.py @@ -0,0 +1,282 @@ +"""Object representations for debugging purposes. Unlike the default +repr, these expose more information and produce HTML instead of ASCII. + +Together with the CSS and JavaScript of the debugger this gives a +colorful and more compact output. +""" + +from __future__ import annotations + +import codecs +import re +import sys +import typing as t +from collections import deque +from traceback import format_exception_only + +from markupsafe import escape + +missing = object() +_paragraph_re = re.compile(r"(?:\r\n|\r|\n){2,}") +RegexType = type(_paragraph_re) + +HELP_HTML = """\ +
+

%(title)s

+
%(text)s
+
\ +""" +OBJECT_DUMP_HTML = """\ +
+

%(title)s

+ %(repr)s + %(items)s
+
\ +""" + + +def debug_repr(obj: object) -> str: + """Creates a debug repr of an object as HTML string.""" + return DebugReprGenerator().repr(obj) + + +def dump(obj: object = missing) -> None: + """Print the object details to stdout._write (for the interactive + console of the web debugger. + """ + gen = DebugReprGenerator() + if obj is missing: + rv = gen.dump_locals(sys._getframe(1).f_locals) + else: + rv = gen.dump_object(obj) + sys.stdout._write(rv) # type: ignore + + +class _Helper: + """Displays an HTML version of the normal help, for the interactive + debugger only because it requires a patched sys.stdout. + """ + + def __repr__(self) -> str: + return "Type help(object) for help about object." + + def __call__(self, topic: t.Any | None = None) -> None: + if topic is None: + sys.stdout._write(f"{self!r}") # type: ignore + return + import pydoc + + pydoc.help(topic) + rv = sys.stdout.reset() # type: ignore + paragraphs = _paragraph_re.split(rv) + if len(paragraphs) > 1: + title = paragraphs[0] + text = "\n\n".join(paragraphs[1:]) + else: + title = "Help" + text = paragraphs[0] + sys.stdout._write(HELP_HTML % {"title": title, "text": text}) # type: ignore + + +helper = _Helper() + + +def _add_subclass_info(inner: str, obj: object, base: type | tuple[type, ...]) -> str: + if isinstance(base, tuple): + for cls in base: + if type(obj) is cls: + return inner + elif type(obj) is base: + return inner + module = "" + if obj.__class__.__module__ not in ("__builtin__", "exceptions"): + module = f'{obj.__class__.__module__}.' + return f"{module}{type(obj).__name__}({inner})" + + +def _sequence_repr_maker( + left: str, right: str, base: type, limit: int = 8 +) -> t.Callable[[DebugReprGenerator, t.Iterable[t.Any], bool], str]: + def proxy(self: DebugReprGenerator, obj: t.Iterable[t.Any], recursive: bool) -> str: + if recursive: + return _add_subclass_info(f"{left}...{right}", obj, base) + buf = [left] + have_extended_section = False + for idx, item in enumerate(obj): + if idx: + buf.append(", ") + if idx == limit: + buf.append('') + have_extended_section = True + buf.append(self.repr(item)) + if have_extended_section: + buf.append("") + buf.append(right) + return _add_subclass_info("".join(buf), obj, base) + + return proxy + + +class DebugReprGenerator: + def __init__(self) -> None: + self._stack: list[t.Any] = [] + + list_repr = _sequence_repr_maker("[", "]", list) + tuple_repr = _sequence_repr_maker("(", ")", tuple) + set_repr = _sequence_repr_maker("set([", "])", set) + frozenset_repr = _sequence_repr_maker("frozenset([", "])", frozenset) + deque_repr = _sequence_repr_maker( + 'collections.deque([', "])", deque + ) + + def regex_repr(self, obj: t.Pattern[t.AnyStr]) -> str: + pattern = repr(obj.pattern) + pattern = codecs.decode(pattern, "unicode-escape", "ignore") + pattern = f"r{pattern}" + return f're.compile({pattern})' + + def string_repr(self, obj: str | bytes, limit: int = 70) -> str: + buf = [''] + r = repr(obj) + + # shorten the repr when the hidden part would be at least 3 chars + if len(r) - limit > 2: + buf.extend( + ( + escape(r[:limit]), + '', + escape(r[limit:]), + "", + ) + ) + else: + buf.append(escape(r)) + + buf.append("") + out = "".join(buf) + + # if the repr looks like a standard string, add subclass info if needed + if r[0] in "'\"" or (r[0] == "b" and r[1] in "'\""): + return _add_subclass_info(out, obj, (bytes, str)) + + # otherwise, assume the repr distinguishes the subclass already + return out + + def dict_repr( + self, + d: dict[int, None] | dict[str, int] | dict[str | int, int], + recursive: bool, + limit: int = 5, + ) -> str: + if recursive: + return _add_subclass_info("{...}", d, dict) + buf = ["{"] + have_extended_section = False + for idx, (key, value) in enumerate(d.items()): + if idx: + buf.append(", ") + if idx == limit - 1: + buf.append('') + have_extended_section = True + buf.append( + f'{self.repr(key)}:' + f' {self.repr(value)}' + ) + if have_extended_section: + buf.append("") + buf.append("}") + return _add_subclass_info("".join(buf), d, dict) + + def object_repr(self, obj: t.Any) -> str: + r = repr(obj) + return f'{escape(r)}' + + def dispatch_repr(self, obj: t.Any, recursive: bool) -> str: + if obj is helper: + return f'{helper!r}' + if isinstance(obj, (int, float, complex)): + return f'{obj!r}' + if isinstance(obj, str) or isinstance(obj, bytes): + return self.string_repr(obj) + if isinstance(obj, RegexType): + return self.regex_repr(obj) + if isinstance(obj, list): + return self.list_repr(obj, recursive) + if isinstance(obj, tuple): + return self.tuple_repr(obj, recursive) + if isinstance(obj, set): + return self.set_repr(obj, recursive) + if isinstance(obj, frozenset): + return self.frozenset_repr(obj, recursive) + if isinstance(obj, dict): + return self.dict_repr(obj, recursive) + if isinstance(obj, deque): + return self.deque_repr(obj, recursive) + return self.object_repr(obj) + + def fallback_repr(self) -> str: + try: + info = "".join(format_exception_only(*sys.exc_info()[:2])) + except Exception: + info = "?" + return ( + '' + f"<broken repr ({escape(info.strip())})>" + ) + + def repr(self, obj: object) -> str: + recursive = False + for item in self._stack: + if item is obj: + recursive = True + break + self._stack.append(obj) + try: + try: + return self.dispatch_repr(obj, recursive) + except Exception: + return self.fallback_repr() + finally: + self._stack.pop() + + def dump_object(self, obj: object) -> str: + repr = None + items: list[tuple[str, str]] | None = None + + if isinstance(obj, dict): + title = "Contents of" + items = [] + for key, value in obj.items(): + if not isinstance(key, str): + items = None + break + items.append((key, self.repr(value))) + if items is None: + items = [] + repr = self.repr(obj) + for key in dir(obj): + try: + items.append((key, self.repr(getattr(obj, key)))) + except Exception: + pass + title = "Details for" + title += f" {object.__repr__(obj)[1:-1]}" + return self.render_object_dump(items, title, repr) + + def dump_locals(self, d: dict[str, t.Any]) -> str: + items = [(key, self.repr(value)) for key, value in d.items()] + return self.render_object_dump(items, "Local variables in frame") + + def render_object_dump( + self, items: list[tuple[str, str]], title: str, repr: str | None = None + ) -> str: + html_items = [] + for key, value in items: + html_items.append(f"{escape(key)}
{value}
") + if not html_items: + html_items.append("Nothing") + return OBJECT_DUMP_HTML % { + "title": escape(title), + "repr": f"
{repr if repr else ''}
", + "items": "\n".join(html_items), + } diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/werkzeug/debug/shared/ICON_LICENSE.md b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/werkzeug/debug/shared/ICON_LICENSE.md new file mode 100644 index 0000000000000000000000000000000000000000..3bdbfc739ea9c4d80d02f1a495cb0ee2f7be9b97 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/werkzeug/debug/shared/ICON_LICENSE.md @@ -0,0 +1,6 @@ +Silk icon set 1.3 by Mark James + +http://www.famfamfam.com/lab/icons/silk/ + +License: [CC-BY-2.5](https://creativecommons.org/licenses/by/2.5/) +or [CC-BY-3.0](https://creativecommons.org/licenses/by/3.0/) diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/werkzeug/debug/shared/debugger.js b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/werkzeug/debug/shared/debugger.js new file mode 100644 index 0000000000000000000000000000000000000000..809b14a6edaff688a619a7203e0619b9b4d101ff --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/werkzeug/debug/shared/debugger.js @@ -0,0 +1,344 @@ +docReady(() => { + if (!EVALEX_TRUSTED) { + initPinBox(); + } + // if we are in console mode, show the console. + if (CONSOLE_MODE && EVALEX) { + createInteractiveConsole(); + } + + const frames = document.querySelectorAll("div.traceback div.frame"); + if (EVALEX) { + addConsoleIconToFrames(frames); + } + addEventListenersToElements(document.querySelectorAll("div.detail"), "click", () => + document.querySelector("div.traceback").scrollIntoView(false) + ); + addToggleFrameTraceback(frames); + addToggleTraceTypesOnClick(document.querySelectorAll("h2.traceback")); + addInfoPrompt(document.querySelectorAll("span.nojavascript")); + wrapPlainTraceback(); +}); + +function addToggleFrameTraceback(frames) { + frames.forEach((frame) => { + frame.addEventListener("click", () => { + frame.getElementsByTagName("pre")[0].parentElement.classList.toggle("expanded"); + }); + }) +} + + +function wrapPlainTraceback() { + const plainTraceback = document.querySelector("div.plain textarea"); + const wrapper = document.createElement("pre"); + const textNode = document.createTextNode(plainTraceback.textContent); + wrapper.appendChild(textNode); + plainTraceback.replaceWith(wrapper); +} + +function makeDebugURL(args) { + const params = new URLSearchParams(args) + params.set("s", SECRET) + return `?__debugger__=yes&${params}` +} + +function initPinBox() { + document.querySelector(".pin-prompt form").addEventListener( + "submit", + function (event) { + event.preventDefault(); + const btn = this.btn; + btn.disabled = true; + + fetch( + makeDebugURL({cmd: "pinauth", pin: this.pin.value}) + ) + .then((res) => res.json()) + .then(({auth, exhausted}) => { + if (auth) { + EVALEX_TRUSTED = true; + fadeOut(document.getElementsByClassName("pin-prompt")[0]); + } else { + alert( + `Error: ${ + exhausted + ? "too many attempts. Restart server to retry." + : "incorrect pin" + }` + ); + } + }) + .catch((err) => { + alert("Error: Could not verify PIN. Network error?"); + console.error(err); + }) + .finally(() => (btn.disabled = false)); + }, + false + ); +} + +function promptForPin() { + if (!EVALEX_TRUSTED) { + fetch(makeDebugURL({cmd: "printpin"})); + const pinPrompt = document.getElementsByClassName("pin-prompt")[0]; + fadeIn(pinPrompt); + document.querySelector('.pin-prompt input[name="pin"]').focus(); + } +} + +/** + * Helper function for shell initialization + */ +function openShell(consoleNode, target, frameID) { + promptForPin(); + if (consoleNode) { + slideToggle(consoleNode); + return consoleNode; + } + let historyPos = 0; + const history = [""]; + const consoleElement = createConsole(); + const output = createConsoleOutput(); + const form = createConsoleInputForm(); + const command = createConsoleInput(); + + target.parentNode.appendChild(consoleElement); + consoleElement.append(output); + consoleElement.append(form); + form.append(command); + command.focus(); + slideToggle(consoleElement); + + form.addEventListener("submit", (e) => { + handleConsoleSubmit(e, command, frameID).then((consoleOutput) => { + output.append(consoleOutput); + command.focus(); + consoleElement.scrollTo(0, consoleElement.scrollHeight); + const old = history.pop(); + history.push(command.value); + if (typeof old !== "undefined") { + history.push(old); + } + historyPos = history.length - 1; + command.value = ""; + }); + }); + + command.addEventListener("keydown", (e) => { + if (e.key === "l" && e.ctrlKey) { + output.innerText = "--- screen cleared ---"; + } else if (e.key === "ArrowUp" || e.key === "ArrowDown") { + // Handle up arrow and down arrow. + if (e.key === "ArrowUp" && historyPos > 0) { + e.preventDefault(); + historyPos--; + } else if (e.key === "ArrowDown" && historyPos < history.length - 1) { + historyPos++; + } + command.value = history[historyPos]; + } + return false; + }); + + return consoleElement; +} + +function addEventListenersToElements(elements, event, listener) { + elements.forEach((el) => el.addEventListener(event, listener)); +} + +/** + * Add extra info + */ +function addInfoPrompt(elements) { + for (let i = 0; i < elements.length; i++) { + elements[i].innerHTML = + "

To switch between the interactive traceback and the plaintext " + + 'one, you can click on the "Traceback" headline. From the text ' + + "traceback you can also create a paste of it. " + + (!EVALEX + ? "" + : "For code execution mouse-over the frame you want to debug and " + + "click on the console icon on the right side." + + "

You can execute arbitrary Python code in the stack frames and " + + "there are some extra helpers available for introspection:" + + "

  • dump() shows all variables in the frame" + + "
  • dump(obj) dumps all that's known about the object
"); + elements[i].classList.remove("nojavascript"); + } +} + +function addConsoleIconToFrames(frames) { + for (let i = 0; i < frames.length; i++) { + let consoleNode = null; + const target = frames[i]; + const frameID = frames[i].id.substring(6); + + for (let j = 0; j < target.getElementsByTagName("pre").length; j++) { + const img = createIconForConsole(); + img.addEventListener("click", (e) => { + e.stopPropagation(); + consoleNode = openShell(consoleNode, target, frameID); + return false; + }); + target.getElementsByTagName("pre")[j].append(img); + } + } +} + +function slideToggle(target) { + target.classList.toggle("active"); +} + +/** + * toggle traceback types on click. + */ +function addToggleTraceTypesOnClick(elements) { + for (let i = 0; i < elements.length; i++) { + elements[i].addEventListener("click", () => { + document.querySelector("div.traceback").classList.toggle("hidden"); + document.querySelector("div.plain").classList.toggle("hidden"); + }); + elements[i].style.cursor = "pointer"; + document.querySelector("div.plain").classList.toggle("hidden"); + } +} + +function createConsole() { + const consoleNode = document.createElement("pre"); + consoleNode.classList.add("console"); + consoleNode.classList.add("active"); + return consoleNode; +} + +function createConsoleOutput() { + const output = document.createElement("div"); + output.classList.add("output"); + output.innerHTML = "[console ready]"; + return output; +} + +function createConsoleInputForm() { + const form = document.createElement("form"); + form.innerHTML = ">>> "; + return form; +} + +function createConsoleInput() { + const command = document.createElement("input"); + command.type = "text"; + command.setAttribute("autocomplete", "off"); + command.setAttribute("spellcheck", false); + command.setAttribute("autocapitalize", "off"); + command.setAttribute("autocorrect", "off"); + return command; +} + +function createIconForConsole() { + const img = document.createElement("img"); + img.setAttribute("src", makeDebugURL({cmd: "resource", f: "console.png"})); + img.setAttribute("title", "Open an interactive python shell in this frame"); + return img; +} + +function createExpansionButtonForConsole() { + const expansionButton = document.createElement("a"); + expansionButton.setAttribute("href", "#"); + expansionButton.setAttribute("class", "toggle"); + expansionButton.innerHTML = "  "; + return expansionButton; +} + +function createInteractiveConsole() { + const target = document.querySelector("div.console div.inner"); + while (target.firstChild) { + target.removeChild(target.firstChild); + } + openShell(null, target, 0); +} + +function handleConsoleSubmit(e, command, frameID) { + // Prevent page from refreshing. + e.preventDefault(); + + return new Promise((resolve) => { + fetch(makeDebugURL({cmd: command.value, frm: frameID})) + .then((res) => { + return res.text(); + }) + .then((data) => { + const tmp = document.createElement("div"); + tmp.innerHTML = data; + resolve(tmp); + + // Handle expandable span for long list outputs. + // Example to test: list(range(13)) + let wrapperAdded = false; + const wrapperSpan = document.createElement("span"); + const expansionButton = createExpansionButtonForConsole(); + + tmp.querySelectorAll("span.extended").forEach((spanToWrap) => { + const parentDiv = spanToWrap.parentNode; + if (!wrapperAdded) { + parentDiv.insertBefore(wrapperSpan, spanToWrap); + wrapperAdded = true; + } + parentDiv.removeChild(spanToWrap); + wrapperSpan.append(spanToWrap); + spanToWrap.hidden = true; + + expansionButton.addEventListener("click", (event) => { + event.preventDefault(); + spanToWrap.hidden = !spanToWrap.hidden; + expansionButton.classList.toggle("open"); + return false; + }); + }); + + // Add expansion button at end of wrapper. + if (wrapperAdded) { + wrapperSpan.append(expansionButton); + } + }) + .catch((err) => { + console.error(err); + }); + return false; + }); +} + +function fadeOut(element) { + element.style.opacity = 1; + + (function fade() { + element.style.opacity -= 0.1; + if (element.style.opacity < 0) { + element.style.display = "none"; + } else { + requestAnimationFrame(fade); + } + })(); +} + +function fadeIn(element, display) { + element.style.opacity = 0; + element.style.display = display || "block"; + + (function fade() { + let val = parseFloat(element.style.opacity) + 0.1; + if (val <= 1) { + element.style.opacity = val; + requestAnimationFrame(fade); + } + })(); +} + +function docReady(fn) { + if (document.readyState === "complete" || document.readyState === "interactive") { + setTimeout(fn, 1); + } else { + document.addEventListener("DOMContentLoaded", fn); + } +} diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/werkzeug/debug/shared/style.css b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/werkzeug/debug/shared/style.css new file mode 100644 index 0000000000000000000000000000000000000000..e9397ca0a1b6c26f30cb28fc81510a48fc46ede9 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/werkzeug/debug/shared/style.css @@ -0,0 +1,150 @@ +body, input { font-family: sans-serif; color: #000; text-align: center; + margin: 1em; padding: 0; font-size: 15px; } +h1, h2, h3 { font-weight: normal; } + +input { background-color: #fff; margin: 0; text-align: left; + outline: none !important; } +input[type="submit"] { padding: 3px 6px; } +a { color: #11557C; } +a:hover { color: #177199; } +pre, code, +textarea { font-family: monospace; font-size: 14px; } + +div.debugger { text-align: left; padding: 12px; margin: auto; + background-color: white; } +h1 { font-size: 36px; margin: 0 0 0.3em 0; } +div.detail { cursor: pointer; } +div.detail p { margin: 0 0 8px 13px; font-size: 14px; white-space: pre-wrap; + font-family: monospace; } +div.explanation { margin: 20px 13px; font-size: 15px; color: #555; } +div.footer { font-size: 13px; text-align: right; margin: 30px 0; + color: #86989B; } + +h2 { font-size: 16px; margin: 1.3em 0 0.0 0; padding: 9px; + background-color: #11557C; color: white; } +h2 em, h3 em { font-style: normal; color: #A5D6D9; font-weight: normal; } + +div.traceback, div.plain { border: 1px solid #ddd; margin: 0 0 1em 0; padding: 10px; } +div.plain p { margin: 0; } +div.plain textarea, +div.plain pre { margin: 10px 0 0 0; padding: 4px; + background-color: #E8EFF0; border: 1px solid #D3E7E9; } +div.plain textarea { width: 99%; height: 300px; } +div.traceback h3 { font-size: 1em; margin: 0 0 0.8em 0; } +div.traceback ul { list-style: none; margin: 0; padding: 0 0 0 1em; } +div.traceback h4 { font-size: 13px; font-weight: normal; margin: 0.7em 0 0.1em 0; } +div.traceback pre { margin: 0; padding: 5px 0 3px 15px; + background-color: #E8EFF0; border: 1px solid #D3E7E9; } +div.traceback .library .current { background: white; color: #555; } +div.traceback .expanded .current { background: #E8EFF0; color: black; } +div.traceback pre:hover { background-color: #DDECEE; color: black; cursor: pointer; } +div.traceback div.source.expanded pre + pre { border-top: none; } + +div.traceback span.ws { display: none; } +div.traceback pre.before, div.traceback pre.after { display: none; background: white; } +div.traceback div.source.expanded pre.before, +div.traceback div.source.expanded pre.after { + display: block; +} + +div.traceback div.source.expanded span.ws { + display: inline; +} + +div.traceback blockquote { margin: 1em 0 0 0; padding: 0; white-space: pre-line; } +div.traceback img { float: right; padding: 2px; margin: -3px 2px 0 0; display: none; } +div.traceback img:hover { background-color: #ddd; cursor: pointer; + border-color: #BFDDE0; } +div.traceback pre:hover img { display: block; } +div.traceback cite.filename { font-style: normal; color: #3B666B; } + +pre.console { border: 1px solid #ccc; background: white!important; + color: black; padding: 5px!important; + margin: 3px 0 0 0!important; cursor: default!important; + max-height: 400px; overflow: auto; } +pre.console form { color: #555; } +pre.console input { background-color: transparent; color: #555; + width: 90%; font-family: monospace; font-size: 14px; + border: none!important; } + +span.string { color: #30799B; } +span.number { color: #9C1A1C; } +span.help { color: #3A7734; } +span.object { color: #485F6E; } +span.extended { opacity: 0.5; } +span.extended:hover { opacity: 1; } +a.toggle { text-decoration: none; background-repeat: no-repeat; + background-position: center center; + background-image: url(?__debugger__=yes&cmd=resource&f=more.png); } +a.toggle:hover { background-color: #444; } +a.open { background-image: url(?__debugger__=yes&cmd=resource&f=less.png); } + +pre.console div.traceback, +pre.console div.box { margin: 5px 10px; white-space: normal; + border: 1px solid #11557C; padding: 10px; + font-family: sans-serif; } +pre.console div.box h3, +pre.console div.traceback h3 { margin: -10px -10px 10px -10px; padding: 5px; + background: #11557C; color: white; } + +pre.console div.traceback pre:hover { cursor: default; background: #E8EFF0; } +pre.console div.traceback pre.syntaxerror { background: inherit; border: none; + margin: 20px -10px -10px -10px; + padding: 10px; border-top: 1px solid #BFDDE0; + background: #E8EFF0; } +pre.console div.noframe-traceback pre.syntaxerror { margin-top: -10px; border: none; } + +pre.console div.box pre.repr { padding: 0; margin: 0; background-color: white; border: none; } +pre.console div.box table { margin-top: 6px; } +pre.console div.box pre { border: none; } +pre.console div.box pre.help { background-color: white; } +pre.console div.box pre.help:hover { cursor: default; } +pre.console table tr { vertical-align: top; } +div.console { border: 1px solid #ccc; padding: 4px; background-color: #fafafa; } + +div.traceback pre, div.console pre { + white-space: pre-wrap; /* css-3 should we be so lucky... */ + white-space: -moz-pre-wrap; /* Mozilla, since 1999 */ + white-space: -pre-wrap; /* Opera 4-6 ?? */ + white-space: -o-pre-wrap; /* Opera 7 ?? */ + word-wrap: break-word; /* Internet Explorer 5.5+ */ + _white-space: pre; /* IE only hack to re-specify in + addition to word-wrap */ +} + + +div.pin-prompt { + position: absolute; + display: none; + top: 0; + bottom: 0; + left: 0; + right: 0; + background: rgba(255, 255, 255, 0.8); +} + +div.pin-prompt .inner { + background: #eee; + padding: 10px 50px; + width: 350px; + margin: 10% auto 0 auto; + border: 1px solid #ccc; + border-radius: 2px; +} + +div.exc-divider { + margin: 0.7em 0 0 -1em; + padding: 0.5em; + background: #11557C; + color: #ddd; + border: 1px solid #ddd; +} + +.console.active { + max-height: 0!important; + display: none; +} + +.hidden { + display: none; +} diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/werkzeug/debug/tbtools.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/werkzeug/debug/tbtools.py new file mode 100644 index 0000000000000000000000000000000000000000..ca4acf60a83f5179faf89643304515deadae9ee3 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/werkzeug/debug/tbtools.py @@ -0,0 +1,449 @@ +from __future__ import annotations + +import itertools +import linecache +import os +import re +import sys +import sysconfig +import traceback +import typing as t + +from markupsafe import escape + +from ..utils import cached_property +from .console import Console + +HEADER = """\ + + + + %(title)s // Werkzeug Debugger + + + + + + +
+""" + +FOOTER = """\ + +
+ +
+
+

Console Locked

+

+ The console is locked and needs to be unlocked by entering the PIN. + You can find the PIN printed out on the standard output of your + shell that runs the server. +

+

PIN: + + +

+
+
+ + +""" + +PAGE_HTML = ( + HEADER + + """\ +

%(exception_type)s

+
+

%(exception)s

+
+

Traceback (most recent call last)

+%(summary)s +
+

+ This is the Copy/Paste friendly version of the traceback. +

+ +
+
+ The debugger caught an exception in your WSGI application. You can now + look at the traceback which led to the error. + If you enable JavaScript you can also use additional features such as code + execution (if the evalex feature is enabled), automatic pasting of the + exceptions and much more. +
+""" + + FOOTER + + """ + +""" +) + +CONSOLE_HTML = ( + HEADER + + """\ +

Interactive Console

+
+In this console you can execute Python expressions in the context of the +application. The initial namespace was created by the debugger automatically. +
+
The Console requires JavaScript.
+""" + + FOOTER +) + +SUMMARY_HTML = """\ +
+ %(title)s +
    %(frames)s
+ %(description)s +
+""" + +FRAME_HTML = """\ +
+

File "%(filename)s", + line %(lineno)s, + in %(function_name)s

+
%(lines)s
+
+""" + + +def _process_traceback( + exc: BaseException, + te: traceback.TracebackException | None = None, + *, + skip: int = 0, + hide: bool = True, +) -> traceback.TracebackException: + if te is None: + te = traceback.TracebackException.from_exception(exc, lookup_lines=False) + + # Get the frames the same way StackSummary.extract did, in order + # to match each frame with the FrameSummary to augment. + frame_gen = traceback.walk_tb(exc.__traceback__) + limit = getattr(sys, "tracebacklimit", None) + + if limit is not None: + if limit < 0: + limit = 0 + + frame_gen = itertools.islice(frame_gen, limit) + + if skip: + frame_gen = itertools.islice(frame_gen, skip, None) + del te.stack[:skip] + + new_stack: list[DebugFrameSummary] = [] + hidden = False + + # Match each frame with the FrameSummary that was generated. + # Hide frames using Paste's __traceback_hide__ rules. Replace + # all visible FrameSummary with DebugFrameSummary. + for (f, _), fs in zip(frame_gen, te.stack): + if hide: + hide_value = f.f_locals.get("__traceback_hide__", False) + + if hide_value in {"before", "before_and_this"}: + new_stack = [] + hidden = False + + if hide_value == "before_and_this": + continue + elif hide_value in {"reset", "reset_and_this"}: + hidden = False + + if hide_value == "reset_and_this": + continue + elif hide_value in {"after", "after_and_this"}: + hidden = True + + if hide_value == "after_and_this": + continue + elif hide_value or hidden: + continue + + frame_args: dict[str, t.Any] = { + "filename": fs.filename, + "lineno": fs.lineno, + "name": fs.name, + "locals": f.f_locals, + "globals": f.f_globals, + } + + if sys.version_info >= (3, 11): + frame_args["colno"] = fs.colno + frame_args["end_colno"] = fs.end_colno + + new_stack.append(DebugFrameSummary(**frame_args)) + + # The codeop module is used to compile code from the interactive + # debugger. Hide any codeop frames from the bottom of the traceback. + while new_stack: + module = new_stack[0].global_ns.get("__name__") + + if module is None: + module = new_stack[0].local_ns.get("__name__") + + if module == "codeop": + del new_stack[0] + else: + break + + te.stack[:] = new_stack + + if te.__context__: + context_exc = t.cast(BaseException, exc.__context__) + te.__context__ = _process_traceback(context_exc, te.__context__, hide=hide) + + if te.__cause__: + cause_exc = t.cast(BaseException, exc.__cause__) + te.__cause__ = _process_traceback(cause_exc, te.__cause__, hide=hide) + + return te + + +class DebugTraceback: + __slots__ = ("_te", "_cache_all_tracebacks", "_cache_all_frames") + + def __init__( + self, + exc: BaseException, + te: traceback.TracebackException | None = None, + *, + skip: int = 0, + hide: bool = True, + ) -> None: + self._te = _process_traceback(exc, te, skip=skip, hide=hide) + + def __str__(self) -> str: + return f"<{type(self).__name__} {self._te}>" + + @cached_property + def all_tracebacks( + self, + ) -> list[tuple[str | None, traceback.TracebackException]]: + out: list[tuple[str | None, traceback.TracebackException]] = [] + current: traceback.TracebackException | None = self._te + + while current is not None: + if current.__cause__ is not None: + chained_msg = ( + "The above exception was the direct cause of the" + " following exception" + ) + chained_exc = current.__cause__ + elif current.__context__ is not None and not current.__suppress_context__: + chained_msg = ( + "During handling of the above exception, another exception occurred" + ) + chained_exc = current.__context__ + else: + chained_msg = None + chained_exc = None + + out.append((chained_msg, current)) + current = chained_exc + + return out + + @cached_property + def all_frames(self) -> list[DebugFrameSummary]: + return [ + f # type: ignore[misc] + for _, te in self.all_tracebacks + for f in te.stack + ] + + def render_traceback_text(self) -> str: + return "".join(self._te.format()) + + def render_traceback_html(self, include_title: bool = True) -> str: + library_frames = [f.is_library for f in self.all_frames] + mark_library = 0 < sum(library_frames) < len(library_frames) + rows = [] + + if not library_frames: + classes = "traceback noframe-traceback" + else: + classes = "traceback" + + for msg, current in reversed(self.all_tracebacks): + row_parts = [] + + if msg is not None: + row_parts.append(f'
  • {msg}:
    ') + + for frame in current.stack: + frame = t.cast(DebugFrameSummary, frame) + info = f' title="{escape(frame.info)}"' if frame.info else "" + row_parts.append(f"{frame.render_html(mark_library)}") + + rows.append("\n".join(row_parts)) + + if sys.version_info < (3, 13): + exc_type_str = self._te.exc_type.__name__ + else: + exc_type_str = self._te.exc_type_str + + is_syntax_error = exc_type_str == "SyntaxError" + + if include_title: + if is_syntax_error: + title = "Syntax Error" + else: + title = "Traceback (most recent call last):" + else: + title = "" + + exc_full = escape("".join(self._te.format_exception_only())) + + if is_syntax_error: + description = f"
    {exc_full}
    " + else: + description = f"
    {exc_full}
    " + + return SUMMARY_HTML % { + "classes": classes, + "title": f"

    {title}

    ", + "frames": "\n".join(rows), + "description": description, + } + + def render_debugger_html( + self, evalex: bool, secret: str, evalex_trusted: bool + ) -> str: + exc_lines = list(self._te.format_exception_only()) + plaintext = "".join(self._te.format()) + + if sys.version_info < (3, 13): + exc_type_str = self._te.exc_type.__name__ + else: + exc_type_str = self._te.exc_type_str + + return PAGE_HTML % { + "evalex": "true" if evalex else "false", + "evalex_trusted": "true" if evalex_trusted else "false", + "console": "false", + "title": escape(exc_lines[0]), + "exception": escape("".join(exc_lines)), + "exception_type": escape(exc_type_str), + "summary": self.render_traceback_html(include_title=False), + "plaintext": escape(plaintext), + "plaintext_cs": re.sub("-{2,}", "-", plaintext), + "secret": secret, + } + + +class DebugFrameSummary(traceback.FrameSummary): + """A :class:`traceback.FrameSummary` that can evaluate code in the + frame's namespace. + """ + + __slots__ = ( + "local_ns", + "global_ns", + "_cache_info", + "_cache_is_library", + "_cache_console", + ) + + def __init__( + self, + *, + locals: dict[str, t.Any], + globals: dict[str, t.Any], + **kwargs: t.Any, + ) -> None: + super().__init__(locals=None, **kwargs) + self.local_ns = locals + self.global_ns = globals + + @cached_property + def info(self) -> str | None: + return self.local_ns.get("__traceback_info__") + + @cached_property + def is_library(self) -> bool: + return any( + self.filename.startswith((path, os.path.realpath(path))) + for path in sysconfig.get_paths().values() + ) + + @cached_property + def console(self) -> Console: + return Console(self.global_ns, self.local_ns) + + def eval(self, code: str) -> t.Any: + return self.console.eval(code) + + def render_html(self, mark_library: bool) -> str: + context = 5 + lines = linecache.getlines(self.filename) + line_idx = self.lineno - 1 # type: ignore[operator] + start_idx = max(0, line_idx - context) + stop_idx = min(len(lines), line_idx + context + 1) + rendered_lines = [] + + def render_line(line: str, cls: str) -> None: + line = line.expandtabs().rstrip() + stripped_line = line.strip() + prefix = len(line) - len(stripped_line) + colno = getattr(self, "colno", 0) + end_colno = getattr(self, "end_colno", 0) + + if cls == "current" and colno and end_colno: + arrow = ( + f'\n{" " * prefix}' + f"{' ' * (colno - prefix)}{'^' * (end_colno - colno)}" + ) + else: + arrow = "" + + rendered_lines.append( + f'
    {" " * prefix}'
    +                f"{escape(stripped_line) if stripped_line else ' '}"
    +                f"{arrow if arrow else ''}
    " + ) + + if line_idx < len(lines): + for line in lines[start_idx:line_idx]: + render_line(line, "before") + + render_line(lines[line_idx], "current") + + for line in lines[line_idx + 1 : stop_idx]: + render_line(line, "after") + + return FRAME_HTML % { + "id": id(self), + "filename": escape(self.filename), + "lineno": self.lineno, + "function_name": escape(self.name), + "lines": "\n".join(rendered_lines), + "library": "library" if mark_library and self.is_library else "", + } + + +def render_console_html(secret: str, evalex_trusted: bool) -> str: + return CONSOLE_HTML % { + "evalex": "true", + "evalex_trusted": "true" if evalex_trusted else "false", + "console": "true", + "title": "Console", + "secret": secret, + } diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/werkzeug/exceptions.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/werkzeug/exceptions.py new file mode 100644 index 0000000000000000000000000000000000000000..15f534e967993aa4fa8a966abc65e998f837fa91 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/werkzeug/exceptions.py @@ -0,0 +1,905 @@ +"""Implements a number of Python exceptions which can be raised from within +a view to trigger a standard HTTP non-200 response. + +Usage Example +------------- + +.. code-block:: python + + from werkzeug.wrappers.request import Request + from werkzeug.exceptions import HTTPException, NotFound + + def view(request): + raise NotFound() + + @Request.application + def application(request): + try: + return view(request) + except HTTPException as e: + return e + +As you can see from this example those exceptions are callable WSGI +applications. However, they are not Werkzeug response objects. You +can get a response object by calling ``get_response()`` on a HTTP +exception. + +Keep in mind that you may have to pass an environ (WSGI) or scope +(ASGI) to ``get_response()`` because some errors fetch additional +information relating to the request. + +If you want to hook in a different exception page to say, a 404 status +code, you can add a second except for a specific subclass of an error: + +.. code-block:: python + + @Request.application + def application(request): + try: + return view(request) + except NotFound as e: + return not_found(request) + except HTTPException as e: + return e + +""" + +from __future__ import annotations + +import typing as t +from datetime import datetime + +from markupsafe import escape +from markupsafe import Markup + +from ._internal import _get_environ + +if t.TYPE_CHECKING: + from _typeshed.wsgi import StartResponse + from _typeshed.wsgi import WSGIEnvironment + + from .datastructures import WWWAuthenticate + from .sansio.response import Response as SansIOResponse + from .wrappers.request import Request as WSGIRequest + from .wrappers.response import Response as WSGIResponse + + +class HTTPException(Exception): + """The base class for all HTTP exceptions. This exception can be called as a WSGI + application to render a default error page or you can catch the subclasses + of it independently and render nicer error messages. + + .. versionchanged:: 2.1 + Removed the ``wrap`` class method. + """ + + code: int | None = None + description: str | None = None + + def __init__( + self, + description: str | None = None, + response: SansIOResponse | None = None, + ) -> None: + super().__init__() + if description is not None: + self.description = description + self.response = response + + @property + def name(self) -> str: + """The status name.""" + from .http import HTTP_STATUS_CODES + + return HTTP_STATUS_CODES.get(self.code, "Unknown Error") # type: ignore + + def get_description( + self, + environ: WSGIEnvironment | None = None, + scope: dict[str, t.Any] | None = None, + ) -> str: + """Get the description.""" + if self.description is None: + description = "" + else: + description = self.description + + description = escape(description).replace("\n", Markup("
    ")) + return f"

    {description}

    " + + def get_body( + self, + environ: WSGIEnvironment | None = None, + scope: dict[str, t.Any] | None = None, + ) -> str: + """Get the HTML body.""" + return ( + "\n" + "\n" + f"{self.code} {escape(self.name)}\n" + f"

    {escape(self.name)}

    \n" + f"{self.get_description(environ)}\n" + ) + + def get_headers( + self, + environ: WSGIEnvironment | None = None, + scope: dict[str, t.Any] | None = None, + ) -> list[tuple[str, str]]: + """Get a list of headers.""" + return [("Content-Type", "text/html; charset=utf-8")] + + @t.overload + def get_response( + self, + environ: WSGIEnvironment | WSGIRequest | None = ..., + scope: None = None, + ) -> WSGIResponse: ... + @t.overload + def get_response( + self, + environ: None = None, + scope: dict[str, t.Any] = ..., + ) -> SansIOResponse: ... + def get_response( + self, + environ: WSGIEnvironment | WSGIRequest | None = None, + scope: dict[str, t.Any] | None = None, + ) -> WSGIResponse | SansIOResponse: + """Get a response object. + + :param environ: A WSGI environ dict or request object. If given, may be + used to customize the response based on the request. + :param scope: An ASGI scope dict. If given, may be used to customize the + response based on the request. + :return: A WSGI :class:`werkzeug.wrappers.Response` if called without + arguments or with ``environ``. A sans-IO + :class:`werkzeug.sansio.Response` for ASGI if called with + ``scope``. + """ + from .wrappers.response import Response + + if self.response is not None: + return self.response + if environ is not None: + environ = _get_environ(environ) + headers = self.get_headers(environ, scope) + return Response(self.get_body(environ, scope), self.code, headers) + + def __call__( + self, environ: WSGIEnvironment, start_response: StartResponse + ) -> t.Iterable[bytes]: + """Call the exception as WSGI application. + + :param environ: the WSGI environment. + :param start_response: the response callable provided by the WSGI + server. + """ + response = self.get_response(environ) + return response(environ, start_response) + + def __str__(self) -> str: + code = self.code if self.code is not None else "???" + return f"{code} {self.name}: {self.description}" + + def __repr__(self) -> str: + code = self.code if self.code is not None else "???" + return f"<{type(self).__name__} '{code}: {self.name}'>" + + +class BadRequest(HTTPException): + """*400* `Bad Request` + + Raise if the browser sends something to the application the application + or server cannot handle. + """ + + code = 400 + description = ( + "The browser (or proxy) sent a request that this server could not understand." + ) + + +class BadRequestKeyError(BadRequest, KeyError): + """An exception that is used to signal both a :exc:`KeyError` and a + :exc:`BadRequest`. Used by many of the datastructures. + """ + + _description = BadRequest.description + #: Show the KeyError along with the HTTP error message in the + #: response. This should be disabled in production, but can be + #: useful in a debug mode. + show_exception = False + + def __init__(self, arg: object | None = None, *args: t.Any, **kwargs: t.Any): + super().__init__(*args, **kwargs) + + if arg is None: + KeyError.__init__(self) + else: + KeyError.__init__(self, arg) + + @property + def description(self) -> str: + if self.show_exception: + return f"{self._description}\n{KeyError.__name__}: {KeyError.__str__(self)}" + + return self._description + + @description.setter + def description(self, value: str) -> None: + self._description = value + + +class ClientDisconnected(BadRequest): + """Internal exception that is raised if Werkzeug detects a disconnected + client. Since the client is already gone at that point attempting to + send the error message to the client might not work and might ultimately + result in another exception in the server. Mainly this is here so that + it is silenced by default as far as Werkzeug is concerned. + + Since disconnections cannot be reliably detected and are unspecified + by WSGI to a large extent this might or might not be raised if a client + is gone. + + .. versionadded:: 0.8 + """ + + +class SecurityError(BadRequest): + """Raised if something triggers a security error. This is otherwise + exactly like a bad request error. + + .. versionadded:: 0.9 + """ + + +class BadHost(BadRequest): + """Raised if the submitted host is badly formatted. + + .. versionadded:: 0.11.2 + """ + + +class Unauthorized(HTTPException): + """*401* ``Unauthorized`` + + Raise if the user is not authorized to access a resource. + + The ``www_authenticate`` argument should be used to set the + ``WWW-Authenticate`` header. This is used for HTTP basic auth and + other schemes. Use :class:`~werkzeug.datastructures.WWWAuthenticate` + to create correctly formatted values. Strictly speaking a 401 + response is invalid if it doesn't provide at least one value for + this header, although real clients typically don't care. + + :param description: Override the default message used for the body + of the response. + :param www-authenticate: A single value, or list of values, for the + WWW-Authenticate header(s). + + .. versionchanged:: 2.0 + Serialize multiple ``www_authenticate`` items into multiple + ``WWW-Authenticate`` headers, rather than joining them + into a single value, for better interoperability. + + .. versionchanged:: 0.15.3 + If the ``www_authenticate`` argument is not set, the + ``WWW-Authenticate`` header is not set. + + .. versionchanged:: 0.15.3 + The ``response`` argument was restored. + + .. versionchanged:: 0.15.1 + ``description`` was moved back as the first argument, restoring + its previous position. + + .. versionchanged:: 0.15.0 + ``www_authenticate`` was added as the first argument, ahead of + ``description``. + """ + + code = 401 + description = ( + "The server could not verify that you are authorized to access" + " the URL requested. You either supplied the wrong credentials" + " (e.g. a bad password), or your browser doesn't understand" + " how to supply the credentials required." + ) + + def __init__( + self, + description: str | None = None, + response: SansIOResponse | None = None, + www_authenticate: None | (WWWAuthenticate | t.Iterable[WWWAuthenticate]) = None, + ) -> None: + super().__init__(description, response) + + from .datastructures import WWWAuthenticate + + if isinstance(www_authenticate, WWWAuthenticate): + www_authenticate = (www_authenticate,) + + self.www_authenticate = www_authenticate + + def get_headers( + self, + environ: WSGIEnvironment | None = None, + scope: dict[str, t.Any] | None = None, + ) -> list[tuple[str, str]]: + headers = super().get_headers(environ, scope) + if self.www_authenticate: + headers.extend(("WWW-Authenticate", str(x)) for x in self.www_authenticate) + return headers + + +class Forbidden(HTTPException): + """*403* `Forbidden` + + Raise if the user doesn't have the permission for the requested resource + but was authenticated. + """ + + code = 403 + description = ( + "You don't have the permission to access the requested" + " resource. It is either read-protected or not readable by the" + " server." + ) + + +class NotFound(HTTPException): + """*404* `Not Found` + + Raise if a resource does not exist and never existed. + """ + + code = 404 + description = ( + "The requested URL was not found on the server. If you entered" + " the URL manually please check your spelling and try again." + ) + + +class MethodNotAllowed(HTTPException): + """*405* `Method Not Allowed` + + Raise if the server used a method the resource does not handle. For + example `POST` if the resource is view only. Especially useful for REST. + + The first argument for this exception should be a list of allowed methods. + Strictly speaking the response would be invalid if you don't provide valid + methods in the header which you can do with that list. + """ + + code = 405 + description = "The method is not allowed for the requested URL." + + def __init__( + self, + valid_methods: t.Iterable[str] | None = None, + description: str | None = None, + response: SansIOResponse | None = None, + ) -> None: + """Takes an optional list of valid http methods + starting with werkzeug 0.3 the list will be mandatory.""" + super().__init__(description=description, response=response) + self.valid_methods = valid_methods + + def get_headers( + self, + environ: WSGIEnvironment | None = None, + scope: dict[str, t.Any] | None = None, + ) -> list[tuple[str, str]]: + headers = super().get_headers(environ, scope) + if self.valid_methods: + headers.append(("Allow", ", ".join(self.valid_methods))) + return headers + + +class NotAcceptable(HTTPException): + """*406* `Not Acceptable` + + Raise if the server can't return any content conforming to the + `Accept` headers of the client. + """ + + code = 406 + description = ( + "The resource identified by the request is only capable of" + " generating response entities which have content" + " characteristics not acceptable according to the accept" + " headers sent in the request." + ) + + +class RequestTimeout(HTTPException): + """*408* `Request Timeout` + + Raise to signalize a timeout. + """ + + code = 408 + description = ( + "The server closed the network connection because the browser" + " didn't finish the request within the specified time." + ) + + +class Conflict(HTTPException): + """*409* `Conflict` + + Raise to signal that a request cannot be completed because it conflicts + with the current state on the server. + + .. versionadded:: 0.7 + """ + + code = 409 + description = ( + "A conflict happened while processing the request. The" + " resource might have been modified while the request was being" + " processed." + ) + + +class Gone(HTTPException): + """*410* `Gone` + + Raise if a resource existed previously and went away without new location. + """ + + code = 410 + description = ( + "The requested URL is no longer available on this server and" + " there is no forwarding address. If you followed a link from a" + " foreign page, please contact the author of this page." + ) + + +class LengthRequired(HTTPException): + """*411* `Length Required` + + Raise if the browser submitted data but no ``Content-Length`` header which + is required for the kind of processing the server does. + """ + + code = 411 + description = ( + "A request with this method requires a valid Content-" + "Length header." + ) + + +class PreconditionFailed(HTTPException): + """*412* `Precondition Failed` + + Status code used in combination with ``If-Match``, ``If-None-Match``, or + ``If-Unmodified-Since``. + """ + + code = 412 + description = ( + "The precondition on the request for the URL failed positive evaluation." + ) + + +class RequestEntityTooLarge(HTTPException): + """*413* `Request Entity Too Large` + + The status code one should return if the data submitted exceeded a given + limit. + """ + + code = 413 + description = "The data value transmitted exceeds the capacity limit." + + +class RequestURITooLarge(HTTPException): + """*414* `Request URI Too Large` + + Like *413* but for too long URLs. + """ + + code = 414 + description = ( + "The length of the requested URL exceeds the capacity limit for" + " this server. The request cannot be processed." + ) + + +class UnsupportedMediaType(HTTPException): + """*415* `Unsupported Media Type` + + The status code returned if the server is unable to handle the media type + the client transmitted. + """ + + code = 415 + description = ( + "The server does not support the media type transmitted in the request." + ) + + +class RequestedRangeNotSatisfiable(HTTPException): + """*416* `Requested Range Not Satisfiable` + + The client asked for an invalid part of the file. + + .. versionadded:: 0.7 + """ + + code = 416 + description = "The server cannot provide the requested range." + + def __init__( + self, + length: int | None = None, + units: str = "bytes", + description: str | None = None, + response: SansIOResponse | None = None, + ) -> None: + """Takes an optional `Content-Range` header value based on ``length`` + parameter. + """ + super().__init__(description=description, response=response) + self.length = length + self.units = units + + def get_headers( + self, + environ: WSGIEnvironment | None = None, + scope: dict[str, t.Any] | None = None, + ) -> list[tuple[str, str]]: + headers = super().get_headers(environ, scope) + if self.length is not None: + headers.append(("Content-Range", f"{self.units} */{self.length}")) + return headers + + +class ExpectationFailed(HTTPException): + """*417* `Expectation Failed` + + The server cannot meet the requirements of the Expect request-header. + + .. versionadded:: 0.7 + """ + + code = 417 + description = "The server could not meet the requirements of the Expect header" + + +class ImATeapot(HTTPException): + """*418* `I'm a teapot` + + The server should return this if it is a teapot and someone attempted + to brew coffee with it. + + .. versionadded:: 0.7 + """ + + code = 418 + description = "This server is a teapot, not a coffee machine" + + +class MisdirectedRequest(HTTPException): + """421 Misdirected Request + + Indicates that the request was directed to a server that is not able to + produce a response. + + .. versionadded:: 3.1 + """ + + code = 421 + description = "The server is not able to produce a response." + + +class UnprocessableEntity(HTTPException): + """*422* `Unprocessable Entity` + + Used if the request is well formed, but the instructions are otherwise + incorrect. + """ + + code = 422 + description = ( + "The request was well-formed but was unable to be followed due" + " to semantic errors." + ) + + +class Locked(HTTPException): + """*423* `Locked` + + Used if the resource that is being accessed is locked. + """ + + code = 423 + description = "The resource that is being accessed is locked." + + +class FailedDependency(HTTPException): + """*424* `Failed Dependency` + + Used if the method could not be performed on the resource + because the requested action depended on another action and that action failed. + """ + + code = 424 + description = ( + "The method could not be performed on the resource because the" + " requested action depended on another action and that action" + " failed." + ) + + +class PreconditionRequired(HTTPException): + """*428* `Precondition Required` + + The server requires this request to be conditional, typically to prevent + the lost update problem, which is a race condition between two or more + clients attempting to update a resource through PUT or DELETE. By requiring + each client to include a conditional header ("If-Match" or "If-Unmodified- + Since") with the proper value retained from a recent GET request, the + server ensures that each client has at least seen the previous revision of + the resource. + """ + + code = 428 + description = ( + "This request is required to be conditional; try using" + ' "If-Match" or "If-Unmodified-Since".' + ) + + +class _RetryAfter(HTTPException): + """Adds an optional ``retry_after`` parameter which will set the + ``Retry-After`` header. May be an :class:`int` number of seconds or + a :class:`~datetime.datetime`. + """ + + def __init__( + self, + description: str | None = None, + response: SansIOResponse | None = None, + retry_after: datetime | int | None = None, + ) -> None: + super().__init__(description, response) + self.retry_after = retry_after + + def get_headers( + self, + environ: WSGIEnvironment | None = None, + scope: dict[str, t.Any] | None = None, + ) -> list[tuple[str, str]]: + headers = super().get_headers(environ, scope) + + if self.retry_after: + if isinstance(self.retry_after, datetime): + from .http import http_date + + value = http_date(self.retry_after) + else: + value = str(self.retry_after) + + headers.append(("Retry-After", value)) + + return headers + + +class TooManyRequests(_RetryAfter): + """*429* `Too Many Requests` + + The server is limiting the rate at which this user receives + responses, and this request exceeds that rate. (The server may use + any convenient method to identify users and their request rates). + The server may include a "Retry-After" header to indicate how long + the user should wait before retrying. + + :param retry_after: If given, set the ``Retry-After`` header to this + value. May be an :class:`int` number of seconds or a + :class:`~datetime.datetime`. + + .. versionchanged:: 1.0 + Added ``retry_after`` parameter. + """ + + code = 429 + description = "This user has exceeded an allotted request count. Try again later." + + +class RequestHeaderFieldsTooLarge(HTTPException): + """*431* `Request Header Fields Too Large` + + The server refuses to process the request because the header fields are too + large. One or more individual fields may be too large, or the set of all + headers is too large. + """ + + code = 431 + description = "One or more header fields exceeds the maximum size." + + +class UnavailableForLegalReasons(HTTPException): + """*451* `Unavailable For Legal Reasons` + + This status code indicates that the server is denying access to the + resource as a consequence of a legal demand. + """ + + code = 451 + description = "Unavailable for legal reasons." + + +class InternalServerError(HTTPException): + """*500* `Internal Server Error` + + Raise if an internal server error occurred. This is a good fallback if an + unknown error occurred in the dispatcher. + + .. versionchanged:: 1.0.0 + Added the :attr:`original_exception` attribute. + """ + + code = 500 + description = ( + "The server encountered an internal error and was unable to" + " complete your request. Either the server is overloaded or" + " there is an error in the application." + ) + + def __init__( + self, + description: str | None = None, + response: SansIOResponse | None = None, + original_exception: BaseException | None = None, + ) -> None: + #: The original exception that caused this 500 error. Can be + #: used by frameworks to provide context when handling + #: unexpected errors. + self.original_exception = original_exception + super().__init__(description=description, response=response) + + +class NotImplemented(HTTPException): + """*501* `Not Implemented` + + Raise if the application does not support the action requested by the + browser. + """ + + code = 501 + description = "The server does not support the action requested by the browser." + + +class BadGateway(HTTPException): + """*502* `Bad Gateway` + + If you do proxying in your application you should return this status code + if you received an invalid response from the upstream server it accessed + in attempting to fulfill the request. + """ + + code = 502 + description = ( + "The proxy server received an invalid response from an upstream server." + ) + + +class ServiceUnavailable(_RetryAfter): + """*503* `Service Unavailable` + + Status code you should return if a service is temporarily + unavailable. + + :param retry_after: If given, set the ``Retry-After`` header to this + value. May be an :class:`int` number of seconds or a + :class:`~datetime.datetime`. + + .. versionchanged:: 1.0 + Added ``retry_after`` parameter. + """ + + code = 503 + description = ( + "The server is temporarily unable to service your request due" + " to maintenance downtime or capacity problems. Please try" + " again later." + ) + + +class GatewayTimeout(HTTPException): + """*504* `Gateway Timeout` + + Status code you should return if a connection to an upstream server + times out. + """ + + code = 504 + description = "The connection to an upstream server timed out." + + +class HTTPVersionNotSupported(HTTPException): + """*505* `HTTP Version Not Supported` + + The server does not support the HTTP protocol version used in the request. + """ + + code = 505 + description = ( + "The server does not support the HTTP protocol version used in the request." + ) + + +default_exceptions: dict[int, type[HTTPException]] = {} + + +def _find_exceptions() -> None: + for obj in globals().values(): + try: + is_http_exception = issubclass(obj, HTTPException) + except TypeError: + is_http_exception = False + if not is_http_exception or obj.code is None: + continue + old_obj = default_exceptions.get(obj.code, None) + if old_obj is not None and issubclass(obj, old_obj): + continue + default_exceptions[obj.code] = obj + + +_find_exceptions() +del _find_exceptions + + +class Aborter: + """When passed a dict of code -> exception items it can be used as + callable that raises exceptions. If the first argument to the + callable is an integer it will be looked up in the mapping, if it's + a WSGI application it will be raised in a proxy exception. + + The rest of the arguments are forwarded to the exception constructor. + """ + + def __init__( + self, + mapping: dict[int, type[HTTPException]] | None = None, + extra: dict[int, type[HTTPException]] | None = None, + ) -> None: + if mapping is None: + mapping = default_exceptions + self.mapping = dict(mapping) + if extra is not None: + self.mapping.update(extra) + + def __call__( + self, code: int | SansIOResponse, *args: t.Any, **kwargs: t.Any + ) -> t.NoReturn: + from .sansio.response import Response + + if isinstance(code, Response): + raise HTTPException(response=code) + + if code not in self.mapping: + raise LookupError(f"no exception for {code!r}") + + raise self.mapping[code](*args, **kwargs) + + +def abort(status: int | SansIOResponse, *args: t.Any, **kwargs: t.Any) -> t.NoReturn: + """Raises an :py:exc:`HTTPException` for the given status code or WSGI + application. + + If a status code is given, it will be looked up in the list of + exceptions and will raise that exception. If passed a WSGI application, + it will wrap it in a proxy WSGI exception and raise that:: + + abort(404) # 404 Not Found + abort(Response('Hello World')) + + """ + _aborter(status, *args, **kwargs) + + +_aborter: Aborter = Aborter() diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/werkzeug/formparser.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/werkzeug/formparser.py new file mode 100644 index 0000000000000000000000000000000000000000..0103414976e0ec04afdc90bc08224b4db4773bfc --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/werkzeug/formparser.py @@ -0,0 +1,430 @@ +from __future__ import annotations + +import typing as t +from io import BytesIO +from urllib.parse import parse_qsl + +from ._internal import _plain_int +from .datastructures import FileStorage +from .datastructures import Headers +from .datastructures import MultiDict +from .exceptions import RequestEntityTooLarge +from .http import parse_options_header +from .sansio.multipart import Data +from .sansio.multipart import Epilogue +from .sansio.multipart import Field +from .sansio.multipart import File +from .sansio.multipart import MultipartDecoder +from .sansio.multipart import NeedData +from .wsgi import get_content_length +from .wsgi import get_input_stream + +# there are some platforms where SpooledTemporaryFile is not available. +# In that case we need to provide a fallback. +try: + from tempfile import SpooledTemporaryFile +except ImportError: + from tempfile import TemporaryFile + + SpooledTemporaryFile = None # type: ignore + +if t.TYPE_CHECKING: + import typing as te + + from _typeshed.wsgi import WSGIEnvironment + + t_parse_result = tuple[ + t.IO[bytes], MultiDict[str, str], MultiDict[str, FileStorage] + ] + + class TStreamFactory(te.Protocol): + def __call__( + self, + total_content_length: int | None, + content_type: str | None, + filename: str | None, + content_length: int | None = None, + ) -> t.IO[bytes]: ... + + +F = t.TypeVar("F", bound=t.Callable[..., t.Any]) + + +def default_stream_factory( + total_content_length: int | None, + content_type: str | None, + filename: str | None, + content_length: int | None = None, +) -> t.IO[bytes]: + max_size = 1024 * 500 + + if SpooledTemporaryFile is not None: + return t.cast(t.IO[bytes], SpooledTemporaryFile(max_size=max_size, mode="rb+")) + elif total_content_length is None or total_content_length > max_size: + return t.cast(t.IO[bytes], TemporaryFile("rb+")) + + return BytesIO() + + +def parse_form_data( + environ: WSGIEnvironment, + stream_factory: TStreamFactory | None = None, + max_form_memory_size: int | None = None, + max_content_length: int | None = None, + cls: type[MultiDict[str, t.Any]] | None = None, + silent: bool = True, + *, + max_form_parts: int | None = None, +) -> t_parse_result: + """Parse the form data in the environ and return it as tuple in the form + ``(stream, form, files)``. You should only call this method if the + transport method is `POST`, `PUT`, or `PATCH`. + + If the mimetype of the data transmitted is `multipart/form-data` the + files multidict will be filled with `FileStorage` objects. If the + mimetype is unknown the input stream is wrapped and returned as first + argument, else the stream is empty. + + This is a shortcut for the common usage of :class:`FormDataParser`. + + :param environ: the WSGI environment to be used for parsing. + :param stream_factory: An optional callable that returns a new read and + writeable file descriptor. This callable works + the same as :meth:`Response._get_file_stream`. + :param max_form_memory_size: the maximum number of bytes to be accepted for + in-memory stored form data. If the data + exceeds the value specified an + :exc:`~exceptions.RequestEntityTooLarge` + exception is raised. + :param max_content_length: If this is provided and the transmitted data + is longer than this value an + :exc:`~exceptions.RequestEntityTooLarge` + exception is raised. + :param cls: an optional dict class to use. If this is not specified + or `None` the default :class:`MultiDict` is used. + :param silent: If set to False parsing errors will not be caught. + :param max_form_parts: The maximum number of multipart parts to be parsed. If this + is exceeded, a :exc:`~exceptions.RequestEntityTooLarge` exception is raised. + :return: A tuple in the form ``(stream, form, files)``. + + .. versionchanged:: 3.0 + The ``charset`` and ``errors`` parameters were removed. + + .. versionchanged:: 2.3 + Added the ``max_form_parts`` parameter. + + .. versionadded:: 0.5.1 + Added the ``silent`` parameter. + + .. versionadded:: 0.5 + Added the ``max_form_memory_size``, ``max_content_length``, and ``cls`` + parameters. + """ + return FormDataParser( + stream_factory=stream_factory, + max_form_memory_size=max_form_memory_size, + max_content_length=max_content_length, + max_form_parts=max_form_parts, + silent=silent, + cls=cls, + ).parse_from_environ(environ) + + +class FormDataParser: + """This class implements parsing of form data for Werkzeug. By itself + it can parse multipart and url encoded form data. It can be subclassed + and extended but for most mimetypes it is a better idea to use the + untouched stream and expose it as separate attributes on a request + object. + + :param stream_factory: An optional callable that returns a new read and + writeable file descriptor. This callable works + the same as :meth:`Response._get_file_stream`. + :param max_form_memory_size: the maximum number of bytes to be accepted for + in-memory stored form data. If the data + exceeds the value specified an + :exc:`~exceptions.RequestEntityTooLarge` + exception is raised. + :param max_content_length: If this is provided and the transmitted data + is longer than this value an + :exc:`~exceptions.RequestEntityTooLarge` + exception is raised. + :param cls: an optional dict class to use. If this is not specified + or `None` the default :class:`MultiDict` is used. + :param silent: If set to False parsing errors will not be caught. + :param max_form_parts: The maximum number of multipart parts to be parsed. If this + is exceeded, a :exc:`~exceptions.RequestEntityTooLarge` exception is raised. + + .. versionchanged:: 3.0 + The ``charset`` and ``errors`` parameters were removed. + + .. versionchanged:: 3.0 + The ``parse_functions`` attribute and ``get_parse_func`` methods were removed. + + .. versionchanged:: 2.2.3 + Added the ``max_form_parts`` parameter. + + .. versionadded:: 0.8 + """ + + def __init__( + self, + stream_factory: TStreamFactory | None = None, + max_form_memory_size: int | None = None, + max_content_length: int | None = None, + cls: type[MultiDict[str, t.Any]] | None = None, + silent: bool = True, + *, + max_form_parts: int | None = None, + ) -> None: + if stream_factory is None: + stream_factory = default_stream_factory + + self.stream_factory = stream_factory + self.max_form_memory_size = max_form_memory_size + self.max_content_length = max_content_length + self.max_form_parts = max_form_parts + + if cls is None: + cls = t.cast("type[MultiDict[str, t.Any]]", MultiDict) + + self.cls = cls + self.silent = silent + + def parse_from_environ(self, environ: WSGIEnvironment) -> t_parse_result: + """Parses the information from the environment as form data. + + :param environ: the WSGI environment to be used for parsing. + :return: A tuple in the form ``(stream, form, files)``. + """ + stream = get_input_stream(environ, max_content_length=self.max_content_length) + content_length = get_content_length(environ) + mimetype, options = parse_options_header(environ.get("CONTENT_TYPE")) + return self.parse( + stream, + content_length=content_length, + mimetype=mimetype, + options=options, + ) + + def parse( + self, + stream: t.IO[bytes], + mimetype: str, + content_length: int | None, + options: dict[str, str] | None = None, + ) -> t_parse_result: + """Parses the information from the given stream, mimetype, + content length and mimetype parameters. + + :param stream: an input stream + :param mimetype: the mimetype of the data + :param content_length: the content length of the incoming data + :param options: optional mimetype parameters (used for + the multipart boundary for instance) + :return: A tuple in the form ``(stream, form, files)``. + + .. versionchanged:: 3.0 + The invalid ``application/x-url-encoded`` content type is not + treated as ``application/x-www-form-urlencoded``. + """ + if mimetype == "multipart/form-data": + parse_func = self._parse_multipart + elif mimetype == "application/x-www-form-urlencoded": + parse_func = self._parse_urlencoded + else: + return stream, self.cls(), self.cls() + + if options is None: + options = {} + + try: + return parse_func(stream, mimetype, content_length, options) + except ValueError: + if not self.silent: + raise + + return stream, self.cls(), self.cls() + + def _parse_multipart( + self, + stream: t.IO[bytes], + mimetype: str, + content_length: int | None, + options: dict[str, str], + ) -> t_parse_result: + parser = MultiPartParser( + stream_factory=self.stream_factory, + max_form_memory_size=self.max_form_memory_size, + max_form_parts=self.max_form_parts, + cls=self.cls, + ) + boundary = options.get("boundary", "").encode("ascii") + + if not boundary: + raise ValueError("Missing boundary") + + form, files = parser.parse(stream, boundary, content_length) + return stream, form, files + + def _parse_urlencoded( + self, + stream: t.IO[bytes], + mimetype: str, + content_length: int | None, + options: dict[str, str], + ) -> t_parse_result: + if ( + self.max_form_memory_size is not None + and content_length is not None + and content_length > self.max_form_memory_size + ): + raise RequestEntityTooLarge() + + items = parse_qsl( + stream.read().decode(), + keep_blank_values=True, + errors="werkzeug.url_quote", + ) + return stream, self.cls(items), self.cls() + + +class MultiPartParser: + def __init__( + self, + stream_factory: TStreamFactory | None = None, + max_form_memory_size: int | None = None, + cls: type[MultiDict[str, t.Any]] | None = None, + buffer_size: int = 64 * 1024, + max_form_parts: int | None = None, + ) -> None: + self.max_form_memory_size = max_form_memory_size + self.max_form_parts = max_form_parts + + if stream_factory is None: + stream_factory = default_stream_factory + + self.stream_factory = stream_factory + + if cls is None: + cls = t.cast("type[MultiDict[str, t.Any]]", MultiDict) + + self.cls = cls + self.buffer_size = buffer_size + + def fail(self, message: str) -> te.NoReturn: + raise ValueError(message) + + def get_part_charset(self, headers: Headers) -> str: + # Figure out input charset for current part + content_type = headers.get("content-type") + + if content_type: + parameters = parse_options_header(content_type)[1] + ct_charset = parameters.get("charset", "").lower() + + # A safe list of encodings. Modern clients should only send ASCII or UTF-8. + # This list will not be extended further. + if ct_charset in {"ascii", "us-ascii", "utf-8", "iso-8859-1"}: + return ct_charset + + return "utf-8" + + def start_file_streaming( + self, event: File, total_content_length: int | None + ) -> t.IO[bytes]: + content_type = event.headers.get("content-type") + + try: + content_length = _plain_int(event.headers["content-length"]) + except (KeyError, ValueError): + content_length = 0 + + container = self.stream_factory( + total_content_length=total_content_length, + filename=event.filename, + content_type=content_type, + content_length=content_length, + ) + return container + + def parse( + self, stream: t.IO[bytes], boundary: bytes, content_length: int | None + ) -> tuple[MultiDict[str, str], MultiDict[str, FileStorage]]: + current_part: Field | File + field_size: int | None = None + container: t.IO[bytes] | list[bytes] + _write: t.Callable[[bytes], t.Any] + + parser = MultipartDecoder( + boundary, + max_form_memory_size=self.max_form_memory_size, + max_parts=self.max_form_parts, + ) + + fields = [] + files = [] + + for data in _chunk_iter(stream.read, self.buffer_size): + parser.receive_data(data) + event = parser.next_event() + while not isinstance(event, (Epilogue, NeedData)): + if isinstance(event, Field): + current_part = event + field_size = 0 + container = [] + _write = container.append + elif isinstance(event, File): + current_part = event + field_size = None + container = self.start_file_streaming(event, content_length) + _write = container.write + elif isinstance(event, Data): + if self.max_form_memory_size is not None and field_size is not None: + # Ensure that accumulated data events do not exceed limit. + # Also checked within single event in MultipartDecoder. + field_size += len(event.data) + + if field_size > self.max_form_memory_size: + raise RequestEntityTooLarge() + + _write(event.data) + if not event.more_data: + if isinstance(current_part, Field): + value = b"".join(container).decode( + self.get_part_charset(current_part.headers), "replace" + ) + fields.append((current_part.name, value)) + else: + container = t.cast(t.IO[bytes], container) + container.seek(0) + files.append( + ( + current_part.name, + FileStorage( + container, + current_part.filename, + current_part.name, + headers=current_part.headers, + ), + ) + ) + + event = parser.next_event() + + return self.cls(fields), self.cls(files) + + +def _chunk_iter(read: t.Callable[[int], bytes], size: int) -> t.Iterator[bytes | None]: + """Read data in chunks for multipart/form-data parsing. Stop if no data is read. + Yield ``None`` at the end to signal end of parsing. + """ + while True: + data = read(size) + + if not data: + break + + yield data + + yield None diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/werkzeug/http.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/werkzeug/http.py new file mode 100644 index 0000000000000000000000000000000000000000..aee4f59a8b7557b745f3bff247bc1063c62a5bf4 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/werkzeug/http.py @@ -0,0 +1,1405 @@ +from __future__ import annotations + +import email.utils +import re +import typing as t +import warnings +from datetime import date +from datetime import datetime +from datetime import time +from datetime import timedelta +from datetime import timezone +from enum import Enum +from hashlib import sha1 +from time import mktime +from time import struct_time +from urllib.parse import quote +from urllib.parse import unquote +from urllib.request import parse_http_list as _parse_list_header + +from ._internal import _dt_as_utc +from ._internal import _plain_int + +if t.TYPE_CHECKING: + from _typeshed.wsgi import WSGIEnvironment + +_token_chars = frozenset( + "!#$%&'*+-.0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ^_`abcdefghijklmnopqrstuvwxyz|~" +) +_etag_re = re.compile(r'([Ww]/)?(?:"(.*?)"|(.*?))(?:\s*,\s*|$)') +_entity_headers = frozenset( + [ + "allow", + "content-encoding", + "content-language", + "content-length", + "content-location", + "content-md5", + "content-range", + "content-type", + "expires", + "last-modified", + ] +) +_hop_by_hop_headers = frozenset( + [ + "connection", + "keep-alive", + "proxy-authenticate", + "proxy-authorization", + "te", + "trailer", + "transfer-encoding", + "upgrade", + ] +) +HTTP_STATUS_CODES = { + 100: "Continue", + 101: "Switching Protocols", + 102: "Processing", + 103: "Early Hints", # see RFC 8297 + 200: "OK", + 201: "Created", + 202: "Accepted", + 203: "Non Authoritative Information", + 204: "No Content", + 205: "Reset Content", + 206: "Partial Content", + 207: "Multi Status", + 208: "Already Reported", # see RFC 5842 + 226: "IM Used", # see RFC 3229 + 300: "Multiple Choices", + 301: "Moved Permanently", + 302: "Found", + 303: "See Other", + 304: "Not Modified", + 305: "Use Proxy", + 306: "Switch Proxy", # unused + 307: "Temporary Redirect", + 308: "Permanent Redirect", + 400: "Bad Request", + 401: "Unauthorized", + 402: "Payment Required", # unused + 403: "Forbidden", + 404: "Not Found", + 405: "Method Not Allowed", + 406: "Not Acceptable", + 407: "Proxy Authentication Required", + 408: "Request Timeout", + 409: "Conflict", + 410: "Gone", + 411: "Length Required", + 412: "Precondition Failed", + 413: "Request Entity Too Large", + 414: "Request URI Too Long", + 415: "Unsupported Media Type", + 416: "Requested Range Not Satisfiable", + 417: "Expectation Failed", + 418: "I'm a teapot", # see RFC 2324 + 421: "Misdirected Request", # see RFC 7540 + 422: "Unprocessable Entity", + 423: "Locked", + 424: "Failed Dependency", + 425: "Too Early", # see RFC 8470 + 426: "Upgrade Required", + 428: "Precondition Required", # see RFC 6585 + 429: "Too Many Requests", + 431: "Request Header Fields Too Large", + 449: "Retry With", # proprietary MS extension + 451: "Unavailable For Legal Reasons", + 500: "Internal Server Error", + 501: "Not Implemented", + 502: "Bad Gateway", + 503: "Service Unavailable", + 504: "Gateway Timeout", + 505: "HTTP Version Not Supported", + 506: "Variant Also Negotiates", # see RFC 2295 + 507: "Insufficient Storage", + 508: "Loop Detected", # see RFC 5842 + 510: "Not Extended", + 511: "Network Authentication Failed", +} + + +class COEP(Enum): + """Cross Origin Embedder Policies""" + + UNSAFE_NONE = "unsafe-none" + REQUIRE_CORP = "require-corp" + + +class COOP(Enum): + """Cross Origin Opener Policies""" + + UNSAFE_NONE = "unsafe-none" + SAME_ORIGIN_ALLOW_POPUPS = "same-origin-allow-popups" + SAME_ORIGIN = "same-origin" + + +def quote_header_value(value: t.Any, allow_token: bool = True) -> str: + """Add double quotes around a header value. If the header contains only ASCII token + characters, it will be returned unchanged. If the header contains ``"`` or ``\\`` + characters, they will be escaped with an additional ``\\`` character. + + This is the reverse of :func:`unquote_header_value`. + + :param value: The value to quote. Will be converted to a string. + :param allow_token: Disable to quote the value even if it only has token characters. + + .. versionchanged:: 3.0 + Passing bytes is not supported. + + .. versionchanged:: 3.0 + The ``extra_chars`` parameter is removed. + + .. versionchanged:: 2.3 + The value is quoted if it is the empty string. + + .. versionadded:: 0.5 + """ + value_str = str(value) + + if not value_str: + return '""' + + if allow_token: + token_chars = _token_chars + + if token_chars.issuperset(value_str): + return value_str + + value_str = value_str.replace("\\", "\\\\").replace('"', '\\"') + return f'"{value_str}"' + + +def unquote_header_value(value: str) -> str: + """Remove double quotes and decode slash-escaped ``"`` and ``\\`` characters in a + header value. + + This is the reverse of :func:`quote_header_value`. + + :param value: The header value to unquote. + + .. versionchanged:: 3.0 + The ``is_filename`` parameter is removed. + """ + if len(value) >= 2 and value[0] == value[-1] == '"': + value = value[1:-1] + return value.replace("\\\\", "\\").replace('\\"', '"') + + return value + + +def dump_options_header(header: str | None, options: t.Mapping[str, t.Any]) -> str: + """Produce a header value and ``key=value`` parameters separated by semicolons + ``;``. For example, the ``Content-Type`` header. + + .. code-block:: python + + dump_options_header("text/html", {"charset": "UTF-8"}) + 'text/html; charset=UTF-8' + + This is the reverse of :func:`parse_options_header`. + + If a value contains non-token characters, it will be quoted. + + If a value is ``None``, the parameter is skipped. + + In some keys for some headers, a UTF-8 value can be encoded using a special + ``key*=UTF-8''value`` form, where ``value`` is percent encoded. This function will + not produce that format automatically, but if a given key ends with an asterisk + ``*``, the value is assumed to have that form and will not be quoted further. + + :param header: The primary header value. + :param options: Parameters to encode as ``key=value`` pairs. + + .. versionchanged:: 2.3 + Keys with ``None`` values are skipped rather than treated as a bare key. + + .. versionchanged:: 2.2.3 + If a key ends with ``*``, its value will not be quoted. + """ + segments = [] + + if header is not None: + segments.append(header) + + for key, value in options.items(): + if value is None: + continue + + if key[-1] == "*": + segments.append(f"{key}={value}") + else: + segments.append(f"{key}={quote_header_value(value)}") + + return "; ".join(segments) + + +def dump_header(iterable: dict[str, t.Any] | t.Iterable[t.Any]) -> str: + """Produce a header value from a list of items or ``key=value`` pairs, separated by + commas ``,``. + + This is the reverse of :func:`parse_list_header`, :func:`parse_dict_header`, and + :func:`parse_set_header`. + + If a value contains non-token characters, it will be quoted. + + If a value is ``None``, the key is output alone. + + In some keys for some headers, a UTF-8 value can be encoded using a special + ``key*=UTF-8''value`` form, where ``value`` is percent encoded. This function will + not produce that format automatically, but if a given key ends with an asterisk + ``*``, the value is assumed to have that form and will not be quoted further. + + .. code-block:: python + + dump_header(["foo", "bar baz"]) + 'foo, "bar baz"' + + dump_header({"foo": "bar baz"}) + 'foo="bar baz"' + + :param iterable: The items to create a header from. + + .. versionchanged:: 3.0 + The ``allow_token`` parameter is removed. + + .. versionchanged:: 2.2.3 + If a key ends with ``*``, its value will not be quoted. + """ + if isinstance(iterable, dict): + items = [] + + for key, value in iterable.items(): + if value is None: + items.append(key) + elif key[-1] == "*": + items.append(f"{key}={value}") + else: + items.append(f"{key}={quote_header_value(value)}") + else: + items = [quote_header_value(x) for x in iterable] + + return ", ".join(items) + + +def dump_csp_header(header: ds.ContentSecurityPolicy) -> str: + """Dump a Content Security Policy header. + + These are structured into policies such as "default-src 'self'; + script-src 'self'". + + .. versionadded:: 1.0.0 + Support for Content Security Policy headers was added. + + """ + return "; ".join(f"{key} {value}" for key, value in header.items()) + + +def parse_list_header(value: str) -> list[str]: + """Parse a header value that consists of a list of comma separated items according + to `RFC 9110 `__. + + This extends :func:`urllib.request.parse_http_list` to remove surrounding quotes + from values. + + .. code-block:: python + + parse_list_header('token, "quoted value"') + ['token', 'quoted value'] + + This is the reverse of :func:`dump_header`. + + :param value: The header value to parse. + """ + result = [] + + for item in _parse_list_header(value): + if len(item) >= 2 and item[0] == item[-1] == '"': + item = item[1:-1] + + result.append(item) + + return result + + +def parse_dict_header(value: str) -> dict[str, str | None]: + """Parse a list header using :func:`parse_list_header`, then parse each item as a + ``key=value`` pair. + + .. code-block:: python + + parse_dict_header('a=b, c="d, e", f') + {"a": "b", "c": "d, e", "f": None} + + This is the reverse of :func:`dump_header`. + + If a key does not have a value, it is ``None``. + + This handles charsets for values as described in + `RFC 2231 `__. Only ASCII, UTF-8, + and ISO-8859-1 charsets are accepted, otherwise the value remains quoted. + + :param value: The header value to parse. + + .. versionchanged:: 3.0 + Passing bytes is not supported. + + .. versionchanged:: 3.0 + The ``cls`` argument is removed. + + .. versionchanged:: 2.3 + Added support for ``key*=charset''value`` encoded items. + + .. versionchanged:: 0.9 + The ``cls`` argument was added. + """ + result: dict[str, str | None] = {} + + for item in parse_list_header(value): + key, has_value, value = item.partition("=") + key = key.strip() + + if not key: + # =value is not valid + continue + + if not has_value: + result[key] = None + continue + + value = value.strip() + encoding: str | None = None + + if key[-1] == "*": + # key*=charset''value becomes key=value, where value is percent encoded + # adapted from parse_options_header, without the continuation handling + key = key[:-1] + match = _charset_value_re.match(value) + + if match: + # If there is a charset marker in the value, split it off. + encoding, value = match.groups() + encoding = encoding.lower() + + # A safe list of encodings. Modern clients should only send ASCII or UTF-8. + # This list will not be extended further. An invalid encoding will leave the + # value quoted. + if encoding in {"ascii", "us-ascii", "utf-8", "iso-8859-1"}: + # invalid bytes are replaced during unquoting + value = unquote(value, encoding=encoding) + + if len(value) >= 2 and value[0] == value[-1] == '"': + value = value[1:-1] + + result[key] = value + + return result + + +# https://httpwg.org/specs/rfc9110.html#parameter +_parameter_key_re = re.compile(r"([\w!#$%&'*+\-.^`|~]+)=", flags=re.ASCII) +_parameter_token_value_re = re.compile(r"[\w!#$%&'*+\-.^`|~]+", flags=re.ASCII) +# https://www.rfc-editor.org/rfc/rfc2231#section-4 +_charset_value_re = re.compile( + r""" + ([\w!#$%&*+\-.^`|~]*)' # charset part, could be empty + [\w!#$%&*+\-.^`|~]*' # don't care about language part, usually empty + ([\w!#$%&'*+\-.^`|~]+) # one or more token chars with percent encoding + """, + re.ASCII | re.VERBOSE, +) +# https://www.rfc-editor.org/rfc/rfc2231#section-3 +_continuation_re = re.compile(r"\*(\d+)$", re.ASCII) + + +def parse_options_header(value: str | None) -> tuple[str, dict[str, str]]: + """Parse a header that consists of a value with ``key=value`` parameters separated + by semicolons ``;``. For example, the ``Content-Type`` header. + + .. code-block:: python + + parse_options_header("text/html; charset=UTF-8") + ('text/html', {'charset': 'UTF-8'}) + + parse_options_header("") + ("", {}) + + This is the reverse of :func:`dump_options_header`. + + This parses valid parameter parts as described in + `RFC 9110 `__. Invalid parts are + skipped. + + This handles continuations and charsets as described in + `RFC 2231 `__, although not as + strictly as the RFC. Only ASCII, UTF-8, and ISO-8859-1 charsets are accepted, + otherwise the value remains quoted. + + Clients may not be consistent in how they handle a quote character within a quoted + value. The `HTML Standard `__ + replaces it with ``%22`` in multipart form data. + `RFC 9110 `__ uses backslash + escapes in HTTP headers. Both are decoded to the ``"`` character. + + Clients may not be consistent in how they handle non-ASCII characters. HTML + documents must declare ````, otherwise browsers may replace with + HTML character references, which can be decoded using :func:`html.unescape`. + + :param value: The header value to parse. + :return: ``(value, options)``, where ``options`` is a dict + + .. versionchanged:: 2.3 + Invalid parts, such as keys with no value, quoted keys, and incorrectly quoted + values, are discarded instead of treating as ``None``. + + .. versionchanged:: 2.3 + Only ASCII, UTF-8, and ISO-8859-1 are accepted for charset values. + + .. versionchanged:: 2.3 + Escaped quotes in quoted values, like ``%22`` and ``\\"``, are handled. + + .. versionchanged:: 2.2 + Option names are always converted to lowercase. + + .. versionchanged:: 2.2 + The ``multiple`` parameter was removed. + + .. versionchanged:: 0.15 + :rfc:`2231` parameter continuations are handled. + + .. versionadded:: 0.5 + """ + if value is None: + return "", {} + + value, _, rest = value.partition(";") + value = value.strip() + rest = rest.strip() + + if not value or not rest: + # empty (invalid) value, or value without options + return value, {} + + # Collect all valid key=value parts without processing the value. + parts: list[tuple[str, str]] = [] + + while True: + if (m := _parameter_key_re.match(rest)) is not None: + pk = m.group(1).lower() + rest = rest[m.end() :] + + # Value may be a token. + if (m := _parameter_token_value_re.match(rest)) is not None: + parts.append((pk, m.group())) + + # Value may be a quoted string, find the closing quote. + elif rest[:1] == '"': + pos = 1 + length = len(rest) + + while pos < length: + if rest[pos : pos + 2] in {"\\\\", '\\"'}: + # Consume escaped slashes and quotes. + pos += 2 + elif rest[pos] == '"': + # Stop at an unescaped quote. + parts.append((pk, rest[: pos + 1])) + rest = rest[pos + 1 :] + break + else: + # Consume any other character. + pos += 1 + + # Find the next section delimited by `;`, if any. + if (end := rest.find(";")) == -1: + break + + rest = rest[end + 1 :].lstrip() + + options: dict[str, str] = {} + encoding: str | None = None + continued_encoding: str | None = None + + # For each collected part, process optional charset and continuation, + # unquote quoted values. + for pk, pv in parts: + if pk[-1] == "*": + # key*=charset''value becomes key=value, where value is percent encoded + pk = pk[:-1] + match = _charset_value_re.match(pv) + + if match: + # If there is a valid charset marker in the value, split it off. + encoding, pv = match.groups() + # This might be the empty string, handled next. + encoding = encoding.lower() + + # No charset marker, or marker with empty charset value. + if not encoding: + encoding = continued_encoding + + # A safe list of encodings. Modern clients should only send ASCII or UTF-8. + # This list will not be extended further. An invalid encoding will leave the + # value quoted. + if encoding in {"ascii", "us-ascii", "utf-8", "iso-8859-1"}: + # Continuation parts don't require their own charset marker. This is + # looser than the RFC, it will persist across different keys and allows + # changing the charset during a continuation. But this implementation is + # much simpler than tracking the full state. + continued_encoding = encoding + # invalid bytes are replaced during unquoting + pv = unquote(pv, encoding=encoding) + + # Remove quotes. At this point the value cannot be empty or a single quote. + if pv[0] == pv[-1] == '"': + # HTTP headers use slash, multipart form data uses percent + pv = pv[1:-1].replace("\\\\", "\\").replace('\\"', '"').replace("%22", '"') + + match = _continuation_re.search(pk) + + if match: + # key*0=a; key*1=b becomes key=ab + pk = pk[: match.start()] + options[pk] = options.get(pk, "") + pv + else: + options[pk] = pv + + return value, options + + +_q_value_re = re.compile(r"-?\d+(\.\d+)?", re.ASCII) +_TAnyAccept = t.TypeVar("_TAnyAccept", bound="ds.Accept") + + +@t.overload +def parse_accept_header(value: str | None) -> ds.Accept: ... + + +@t.overload +def parse_accept_header(value: str | None, cls: type[_TAnyAccept]) -> _TAnyAccept: ... + + +def parse_accept_header( + value: str | None, cls: type[_TAnyAccept] | None = None +) -> _TAnyAccept: + """Parse an ``Accept`` header according to + `RFC 9110 `__. + + Returns an :class:`.Accept` instance, which can sort and inspect items based on + their quality parameter. When parsing ``Accept-Charset``, ``Accept-Encoding``, or + ``Accept-Language``, pass the appropriate :class:`.Accept` subclass. + + :param value: The header value to parse. + :param cls: The :class:`.Accept` class to wrap the result in. + :return: An instance of ``cls``. + + .. versionchanged:: 2.3 + Parse according to RFC 9110. Items with invalid ``q`` values are skipped. + """ + if cls is None: + cls = t.cast(type[_TAnyAccept], ds.Accept) + + if not value: + return cls(None) + + result = [] + + for item in parse_list_header(value): + item, options = parse_options_header(item) + + if "q" in options: + # pop q, remaining options are reconstructed + q_str = options.pop("q").strip() + + if _q_value_re.fullmatch(q_str) is None: + # ignore an invalid q + continue + + q = float(q_str) + + if q < 0 or q > 1: + # ignore an invalid q + continue + else: + q = 1 + + if options: + # reconstruct the media type with any options + item = dump_options_header(item, options) + + result.append((item, q)) + + return cls(result) + + +_TAnyCC = t.TypeVar("_TAnyCC", bound="ds.cache_control._CacheControl") + + +@t.overload +def parse_cache_control_header( + value: str | None, + on_update: t.Callable[[ds.cache_control._CacheControl], None] | None = None, +) -> ds.RequestCacheControl: ... + + +@t.overload +def parse_cache_control_header( + value: str | None, + on_update: t.Callable[[ds.cache_control._CacheControl], None] | None = None, + cls: type[_TAnyCC] = ..., +) -> _TAnyCC: ... + + +def parse_cache_control_header( + value: str | None, + on_update: t.Callable[[ds.cache_control._CacheControl], None] | None = None, + cls: type[_TAnyCC] | None = None, +) -> _TAnyCC: + """Parse a cache control header. The RFC differs between response and + request cache control, this method does not. It's your responsibility + to not use the wrong control statements. + + .. versionadded:: 0.5 + The `cls` was added. If not specified an immutable + :class:`~werkzeug.datastructures.RequestCacheControl` is returned. + + :param value: a cache control header to be parsed. + :param on_update: an optional callable that is called every time a value + on the :class:`~werkzeug.datastructures.CacheControl` + object is changed. + :param cls: the class for the returned object. By default + :class:`~werkzeug.datastructures.RequestCacheControl` is used. + :return: a `cls` object. + """ + if cls is None: + cls = t.cast("type[_TAnyCC]", ds.RequestCacheControl) + + if not value: + return cls((), on_update) + + return cls(parse_dict_header(value), on_update) + + +_TAnyCSP = t.TypeVar("_TAnyCSP", bound="ds.ContentSecurityPolicy") + + +@t.overload +def parse_csp_header( + value: str | None, + on_update: t.Callable[[ds.ContentSecurityPolicy], None] | None = None, +) -> ds.ContentSecurityPolicy: ... + + +@t.overload +def parse_csp_header( + value: str | None, + on_update: t.Callable[[ds.ContentSecurityPolicy], None] | None = None, + cls: type[_TAnyCSP] = ..., +) -> _TAnyCSP: ... + + +def parse_csp_header( + value: str | None, + on_update: t.Callable[[ds.ContentSecurityPolicy], None] | None = None, + cls: type[_TAnyCSP] | None = None, +) -> _TAnyCSP: + """Parse a Content Security Policy header. + + .. versionadded:: 1.0.0 + Support for Content Security Policy headers was added. + + :param value: a csp header to be parsed. + :param on_update: an optional callable that is called every time a value + on the object is changed. + :param cls: the class for the returned object. By default + :class:`~werkzeug.datastructures.ContentSecurityPolicy` is used. + :return: a `cls` object. + """ + if cls is None: + cls = t.cast("type[_TAnyCSP]", ds.ContentSecurityPolicy) + + if value is None: + return cls((), on_update) + + items = [] + + for policy in value.split(";"): + policy = policy.strip() + + # Ignore badly formatted policies (no space) + if " " in policy: + directive, value = policy.strip().split(" ", 1) + items.append((directive.strip(), value.strip())) + + return cls(items, on_update) + + +def parse_set_header( + value: str | None, + on_update: t.Callable[[ds.HeaderSet], None] | None = None, +) -> ds.HeaderSet: + """Parse a set-like header and return a + :class:`~werkzeug.datastructures.HeaderSet` object: + + >>> hs = parse_set_header('token, "quoted value"') + + The return value is an object that treats the items case-insensitively + and keeps the order of the items: + + >>> 'TOKEN' in hs + True + >>> hs.index('quoted value') + 1 + >>> hs + HeaderSet(['token', 'quoted value']) + + To create a header from the :class:`HeaderSet` again, use the + :func:`dump_header` function. + + :param value: a set header to be parsed. + :param on_update: an optional callable that is called every time a + value on the :class:`~werkzeug.datastructures.HeaderSet` + object is changed. + :return: a :class:`~werkzeug.datastructures.HeaderSet` + """ + if not value: + return ds.HeaderSet(None, on_update) + return ds.HeaderSet(parse_list_header(value), on_update) + + +def parse_if_range_header(value: str | None) -> ds.IfRange: + """Parses an if-range header which can be an etag or a date. Returns + a :class:`~werkzeug.datastructures.IfRange` object. + + .. versionchanged:: 2.0 + If the value represents a datetime, it is timezone-aware. + + .. versionadded:: 0.7 + """ + if not value: + return ds.IfRange() + date = parse_date(value) + if date is not None: + return ds.IfRange(date=date) + # drop weakness information + return ds.IfRange(unquote_etag(value)[0]) + + +def parse_range_header( + value: str | None, make_inclusive: bool = True +) -> ds.Range | None: + """Parses a range header into a :class:`~werkzeug.datastructures.Range` + object. If the header is missing or malformed `None` is returned. + `ranges` is a list of ``(start, stop)`` tuples where the ranges are + non-inclusive. + + .. versionadded:: 0.7 + """ + if not value or "=" not in value: + return None + + ranges = [] + last_end = 0 + units, rng = value.split("=", 1) + units = units.strip().lower() + + for item in rng.split(","): + item = item.strip() + if "-" not in item: + return None + if item.startswith("-"): + if last_end < 0: + return None + try: + begin = _plain_int(item) + except ValueError: + return None + end = None + last_end = -1 + elif "-" in item: + begin_str, end_str = item.split("-", 1) + begin_str = begin_str.strip() + end_str = end_str.strip() + + try: + begin = _plain_int(begin_str) + except ValueError: + return None + + if begin < last_end or last_end < 0: + return None + if end_str: + try: + end = _plain_int(end_str) + 1 + except ValueError: + return None + + if begin >= end: + return None + else: + end = None + last_end = end if end is not None else -1 + ranges.append((begin, end)) + + return ds.Range(units, ranges) + + +def parse_content_range_header( + value: str | None, + on_update: t.Callable[[ds.ContentRange], None] | None = None, +) -> ds.ContentRange | None: + """Parses a range header into a + :class:`~werkzeug.datastructures.ContentRange` object or `None` if + parsing is not possible. + + .. versionadded:: 0.7 + + :param value: a content range header to be parsed. + :param on_update: an optional callable that is called every time a value + on the :class:`~werkzeug.datastructures.ContentRange` + object is changed. + """ + if value is None: + return None + try: + units, rangedef = (value or "").strip().split(None, 1) + except ValueError: + return None + + if "/" not in rangedef: + return None + rng, length_str = rangedef.split("/", 1) + if length_str == "*": + length = None + else: + try: + length = _plain_int(length_str) + except ValueError: + return None + + if rng == "*": + if not is_byte_range_valid(None, None, length): + return None + + return ds.ContentRange(units, None, None, length, on_update=on_update) + elif "-" not in rng: + return None + + start_str, stop_str = rng.split("-", 1) + try: + start = _plain_int(start_str) + stop = _plain_int(stop_str) + 1 + except ValueError: + return None + + if is_byte_range_valid(start, stop, length): + return ds.ContentRange(units, start, stop, length, on_update=on_update) + + return None + + +def quote_etag(etag: str, weak: bool = False) -> str: + """Quote an etag. + + :param etag: the etag to quote. + :param weak: set to `True` to tag it "weak". + """ + if '"' in etag: + raise ValueError("invalid etag") + etag = f'"{etag}"' + if weak: + etag = f"W/{etag}" + return etag + + +@t.overload +def unquote_etag(etag: str) -> tuple[str, bool]: ... +@t.overload +def unquote_etag(etag: None) -> tuple[None, None]: ... +def unquote_etag( + etag: str | None, +) -> tuple[str, bool] | tuple[None, None]: + """Unquote a single etag: + + >>> unquote_etag('W/"bar"') + ('bar', True) + >>> unquote_etag('"bar"') + ('bar', False) + + :param etag: the etag identifier to unquote. + :return: a ``(etag, weak)`` tuple. + """ + if not etag: + return None, None + etag = etag.strip() + weak = False + if etag.startswith(("W/", "w/")): + weak = True + etag = etag[2:] + if etag[:1] == etag[-1:] == '"': + etag = etag[1:-1] + return etag, weak + + +def parse_etags(value: str | None) -> ds.ETags: + """Parse an etag header. + + :param value: the tag header to parse + :return: an :class:`~werkzeug.datastructures.ETags` object. + """ + if not value: + return ds.ETags() + strong = [] + weak = [] + end = len(value) + pos = 0 + while pos < end: + match = _etag_re.match(value, pos) + if match is None: + break + is_weak, quoted, raw = match.groups() + if raw == "*": + return ds.ETags(star_tag=True) + elif quoted: + raw = quoted + if is_weak: + weak.append(raw) + else: + strong.append(raw) + pos = match.end() + return ds.ETags(strong, weak) + + +def generate_etag(data: bytes) -> str: + """Generate an etag for some data. + + .. versionchanged:: 2.0 + Use SHA-1. MD5 may not be available in some environments. + """ + return sha1(data).hexdigest() + + +def parse_date(value: str | None) -> datetime | None: + """Parse an :rfc:`2822` date into a timezone-aware + :class:`datetime.datetime` object, or ``None`` if parsing fails. + + This is a wrapper for :func:`email.utils.parsedate_to_datetime`. It + returns ``None`` if parsing fails instead of raising an exception, + and always returns a timezone-aware datetime object. If the string + doesn't have timezone information, it is assumed to be UTC. + + :param value: A string with a supported date format. + + .. versionchanged:: 2.0 + Return a timezone-aware datetime object. Use + ``email.utils.parsedate_to_datetime``. + """ + if value is None: + return None + + try: + dt = email.utils.parsedate_to_datetime(value) + except (TypeError, ValueError): + return None + + if dt.tzinfo is None: + return dt.replace(tzinfo=timezone.utc) + + return dt + + +def http_date( + timestamp: datetime | date | int | float | struct_time | None = None, +) -> str: + """Format a datetime object or timestamp into an :rfc:`2822` date + string. + + This is a wrapper for :func:`email.utils.format_datetime`. It + assumes naive datetime objects are in UTC instead of raising an + exception. + + :param timestamp: The datetime or timestamp to format. Defaults to + the current time. + + .. versionchanged:: 2.0 + Use ``email.utils.format_datetime``. Accept ``date`` objects. + """ + if isinstance(timestamp, date): + if not isinstance(timestamp, datetime): + # Assume plain date is midnight UTC. + timestamp = datetime.combine(timestamp, time(), tzinfo=timezone.utc) + else: + # Ensure datetime is timezone-aware. + timestamp = _dt_as_utc(timestamp) + + return email.utils.format_datetime(timestamp, usegmt=True) + + if isinstance(timestamp, struct_time): + timestamp = mktime(timestamp) + + return email.utils.formatdate(timestamp, usegmt=True) + + +def parse_age(value: str | None = None) -> timedelta | None: + """Parses a base-10 integer count of seconds into a timedelta. + + If parsing fails, the return value is `None`. + + :param value: a string consisting of an integer represented in base-10 + :return: a :class:`datetime.timedelta` object or `None`. + """ + if not value: + return None + try: + seconds = int(value) + except ValueError: + return None + if seconds < 0: + return None + try: + return timedelta(seconds=seconds) + except OverflowError: + return None + + +def dump_age(age: timedelta | int | None = None) -> str | None: + """Formats the duration as a base-10 integer. + + :param age: should be an integer number of seconds, + a :class:`datetime.timedelta` object, or, + if the age is unknown, `None` (default). + """ + if age is None: + return None + if isinstance(age, timedelta): + age = int(age.total_seconds()) + else: + age = int(age) + + if age < 0: + raise ValueError("age cannot be negative") + + return str(age) + + +def is_resource_modified( + environ: WSGIEnvironment, + etag: str | None = None, + data: bytes | None = None, + last_modified: datetime | str | None = None, + ignore_if_range: bool = True, +) -> bool: + """Convenience method for conditional requests. + + :param environ: the WSGI environment of the request to be checked. + :param etag: the etag for the response for comparison. + :param data: or alternatively the data of the response to automatically + generate an etag using :func:`generate_etag`. + :param last_modified: an optional date of the last modification. + :param ignore_if_range: If `False`, `If-Range` header will be taken into + account. + :return: `True` if the resource was modified, otherwise `False`. + + .. versionchanged:: 2.0 + SHA-1 is used to generate an etag value for the data. MD5 may + not be available in some environments. + + .. versionchanged:: 1.0.0 + The check is run for methods other than ``GET`` and ``HEAD``. + """ + return _sansio_http.is_resource_modified( + http_range=environ.get("HTTP_RANGE"), + http_if_range=environ.get("HTTP_IF_RANGE"), + http_if_modified_since=environ.get("HTTP_IF_MODIFIED_SINCE"), + http_if_none_match=environ.get("HTTP_IF_NONE_MATCH"), + http_if_match=environ.get("HTTP_IF_MATCH"), + etag=etag, + data=data, + last_modified=last_modified, + ignore_if_range=ignore_if_range, + ) + + +def remove_entity_headers( + headers: ds.Headers | list[tuple[str, str]], + allowed: t.Iterable[str] = ("expires", "content-location"), +) -> None: + """Remove all entity headers from a list or :class:`Headers` object. This + operation works in-place. `Expires` and `Content-Location` headers are + by default not removed. The reason for this is :rfc:`2616` section + 10.3.5 which specifies some entity headers that should be sent. + + .. versionchanged:: 0.5 + added `allowed` parameter. + + :param headers: a list or :class:`Headers` object. + :param allowed: a list of headers that should still be allowed even though + they are entity headers. + """ + allowed = {x.lower() for x in allowed} + headers[:] = [ + (key, value) + for key, value in headers + if not is_entity_header(key) or key.lower() in allowed + ] + + +def remove_hop_by_hop_headers(headers: ds.Headers | list[tuple[str, str]]) -> None: + """Remove all HTTP/1.1 "Hop-by-Hop" headers from a list or + :class:`Headers` object. This operation works in-place. + + .. versionadded:: 0.5 + + :param headers: a list or :class:`Headers` object. + """ + headers[:] = [ + (key, value) for key, value in headers if not is_hop_by_hop_header(key) + ] + + +def is_entity_header(header: str) -> bool: + """Check if a header is an entity header. + + .. versionadded:: 0.5 + + :param header: the header to test. + :return: `True` if it's an entity header, `False` otherwise. + """ + return header.lower() in _entity_headers + + +def is_hop_by_hop_header(header: str) -> bool: + """Check if a header is an HTTP/1.1 "Hop-by-Hop" header. + + .. versionadded:: 0.5 + + :param header: the header to test. + :return: `True` if it's an HTTP/1.1 "Hop-by-Hop" header, `False` otherwise. + """ + return header.lower() in _hop_by_hop_headers + + +def parse_cookie( + header: WSGIEnvironment | str | None, + cls: type[ds.MultiDict[str, str]] | None = None, +) -> ds.MultiDict[str, str]: + """Parse a cookie from a string or WSGI environ. + + The same key can be provided multiple times, the values are stored + in-order. The default :class:`MultiDict` will have the first value + first, and all values can be retrieved with + :meth:`MultiDict.getlist`. + + :param header: The cookie header as a string, or a WSGI environ dict + with a ``HTTP_COOKIE`` key. + :param cls: A dict-like class to store the parsed cookies in. + Defaults to :class:`MultiDict`. + + .. versionchanged:: 3.0 + Passing bytes, and the ``charset`` and ``errors`` parameters, were removed. + + .. versionchanged:: 1.0 + Returns a :class:`MultiDict` instead of a ``TypeConversionDict``. + + .. versionchanged:: 0.5 + Returns a :class:`TypeConversionDict` instead of a regular dict. The ``cls`` + parameter was added. + """ + if isinstance(header, dict): + cookie = header.get("HTTP_COOKIE") + else: + cookie = header + + if cookie: + cookie = cookie.encode("latin1").decode() + + return _sansio_http.parse_cookie(cookie=cookie, cls=cls) + + +_cookie_no_quote_re = re.compile(r"[\w!#$%&'()*+\-./:<=>?@\[\]^`{|}~]*", re.A) +_cookie_slash_re = re.compile(rb"[\x00-\x19\",;\\\x7f-\xff]", re.A) +_cookie_slash_map = {b'"': b'\\"', b"\\": b"\\\\"} +_cookie_slash_map.update( + (v.to_bytes(1, "big"), b"\\%03o" % v) + for v in [*range(0x20), *b",;", *range(0x7F, 256)] +) + + +def dump_cookie( + key: str, + value: str = "", + max_age: timedelta | int | None = None, + expires: str | datetime | int | float | None = None, + path: str | None = "/", + domain: str | None = None, + secure: bool = False, + httponly: bool = False, + sync_expires: bool = True, + max_size: int = 4093, + samesite: str | None = None, + partitioned: bool = False, +) -> str: + """Create a Set-Cookie header without the ``Set-Cookie`` prefix. + + The return value is usually restricted to ascii as the vast majority + of values are properly escaped, but that is no guarantee. It's + tunneled through latin1 as required by :pep:`3333`. + + The return value is not ASCII safe if the key contains unicode + characters. This is technically against the specification but + happens in the wild. It's strongly recommended to not use + non-ASCII values for the keys. + + :param max_age: should be a number of seconds, or `None` (default) if + the cookie should last only as long as the client's + browser session. Additionally `timedelta` objects + are accepted, too. + :param expires: should be a `datetime` object or unix timestamp. + :param path: limits the cookie to a given path, per default it will + span the whole domain. + :param domain: Use this if you want to set a cross-domain cookie. For + example, ``domain="example.com"`` will set a cookie + that is readable by the domain ``www.example.com``, + ``foo.example.com`` etc. Otherwise, a cookie will only + be readable by the domain that set it. + :param secure: The cookie will only be available via HTTPS + :param httponly: disallow JavaScript to access the cookie. This is an + extension to the cookie standard and probably not + supported by all browsers. + :param charset: the encoding for string values. + :param sync_expires: automatically set expires if max_age is defined + but expires not. + :param max_size: Warn if the final header value exceeds this size. The + default, 4093, should be safely `supported by most browsers + `_. Set to 0 to disable this check. + :param samesite: Limits the scope of the cookie such that it will + only be attached to requests if those requests are same-site. + :param partitioned: Opts the cookie into partitioned storage. This + will also set secure to True + + .. _`cookie`: http://browsercookielimits.squawky.net/ + + .. versionchanged:: 3.1 + The ``partitioned`` parameter was added. + + .. versionchanged:: 3.0 + Passing bytes, and the ``charset`` parameter, were removed. + + .. versionchanged:: 2.3.3 + The ``path`` parameter is ``/`` by default. + + .. versionchanged:: 2.3.1 + The value allows more characters without quoting. + + .. versionchanged:: 2.3 + ``localhost`` and other names without a dot are allowed for the domain. A + leading dot is ignored. + + .. versionchanged:: 2.3 + The ``path`` parameter is ``None`` by default. + + .. versionchanged:: 1.0.0 + The string ``'None'`` is accepted for ``samesite``. + """ + if path is not None: + # safe = https://url.spec.whatwg.org/#url-path-segment-string + # as well as percent for things that are already quoted + # excluding semicolon since it's part of the header syntax + path = quote(path, safe="%!$&'()*+,/:=@") + + if domain: + domain = domain.partition(":")[0].lstrip(".").encode("idna").decode("ascii") + + if isinstance(max_age, timedelta): + max_age = int(max_age.total_seconds()) + + if expires is not None: + if not isinstance(expires, str): + expires = http_date(expires) + elif max_age is not None and sync_expires: + expires = http_date(datetime.now(tz=timezone.utc).timestamp() + max_age) + + if samesite is not None: + samesite = samesite.title() + + if samesite not in {"Strict", "Lax", "None"}: + raise ValueError("SameSite must be 'Strict', 'Lax', or 'None'.") + + if partitioned: + secure = True + + # Quote value if it contains characters not allowed by RFC 6265. Slash-escape with + # three octal digits, which matches http.cookies, although the RFC suggests base64. + if not _cookie_no_quote_re.fullmatch(value): + # Work with bytes here, since a UTF-8 character could be multiple bytes. + value = _cookie_slash_re.sub( + lambda m: _cookie_slash_map[m.group()], value.encode() + ).decode("ascii") + value = f'"{value}"' + + # Send a non-ASCII key as mojibake. Everything else should already be ASCII. + # TODO Remove encoding dance, it seems like clients accept UTF-8 keys + buf = [f"{key.encode().decode('latin1')}={value}"] + + for k, v in ( + ("Domain", domain), + ("Expires", expires), + ("Max-Age", max_age), + ("Secure", secure), + ("HttpOnly", httponly), + ("Path", path), + ("SameSite", samesite), + ("Partitioned", partitioned), + ): + if v is None or v is False: + continue + + if v is True: + buf.append(k) + continue + + buf.append(f"{k}={v}") + + rv = "; ".join(buf) + + # Warn if the final value of the cookie is larger than the limit. If the cookie is + # too large, then it may be silently ignored by the browser, which can be quite hard + # to debug. + cookie_size = len(rv) + + if max_size and cookie_size > max_size: + value_size = len(value) + warnings.warn( + f"The '{key}' cookie is too large: the value was {value_size} bytes but the" + f" header required {cookie_size - value_size} extra bytes. The final size" + f" was {cookie_size} bytes but the limit is {max_size} bytes. Browsers may" + " silently ignore cookies larger than this.", + stacklevel=2, + ) + + return rv + + +def is_byte_range_valid( + start: int | None, stop: int | None, length: int | None +) -> bool: + """Checks if a given byte content range is valid for the given length. + + .. versionadded:: 0.7 + """ + if (start is None) != (stop is None): + return False + elif start is None: + return length is None or length >= 0 + elif length is None: + return 0 <= start < stop # type: ignore + elif start >= stop: # type: ignore + return False + return 0 <= start < length + + +# circular dependencies +from . import datastructures as ds # noqa: E402 +from .sansio import http as _sansio_http # noqa: E402 diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/werkzeug/local.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/werkzeug/local.py new file mode 100644 index 0000000000000000000000000000000000000000..32c1aca80685f6eb9745ed6d73ae3e2ca660394c --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/werkzeug/local.py @@ -0,0 +1,653 @@ +from __future__ import annotations + +import copy +import math +import operator +import typing as t +from contextvars import ContextVar +from functools import partial +from functools import update_wrapper +from operator import attrgetter + +from .wsgi import ClosingIterator + +if t.TYPE_CHECKING: + from _typeshed.wsgi import StartResponse + from _typeshed.wsgi import WSGIApplication + from _typeshed.wsgi import WSGIEnvironment + +T = t.TypeVar("T") +F = t.TypeVar("F", bound=t.Callable[..., t.Any]) + + +def release_local(local: Local | LocalStack[t.Any]) -> None: + """Release the data for the current context in a :class:`Local` or + :class:`LocalStack` without using a :class:`LocalManager`. + + This should not be needed for modern use cases, and may be removed + in the future. + + .. versionadded:: 0.6.1 + """ + local.__release_local__() + + +class Local: + """Create a namespace of context-local data. This wraps a + :class:`ContextVar` containing a :class:`dict` value. + + This may incur a performance penalty compared to using individual + context vars, as it has to copy data to avoid mutating the dict + between nested contexts. + + :param context_var: The :class:`~contextvars.ContextVar` to use as + storage for this local. If not given, one will be created. + Context vars not created at the global scope may interfere with + garbage collection. + + .. versionchanged:: 2.0 + Uses ``ContextVar`` instead of a custom storage implementation. + """ + + __slots__ = ("__storage",) + + def __init__(self, context_var: ContextVar[dict[str, t.Any]] | None = None) -> None: + if context_var is None: + # A ContextVar not created at global scope interferes with + # Python's garbage collection. However, a local only makes + # sense defined at the global scope as well, in which case + # the GC issue doesn't seem relevant. + context_var = ContextVar(f"werkzeug.Local<{id(self)}>.storage") + + object.__setattr__(self, "_Local__storage", context_var) + + def __iter__(self) -> t.Iterator[tuple[str, t.Any]]: + return iter(self.__storage.get({}).items()) + + def __call__( + self, name: str, *, unbound_message: str | None = None + ) -> LocalProxy[t.Any]: + """Create a :class:`LocalProxy` that access an attribute on this + local namespace. + + :param name: Proxy this attribute. + :param unbound_message: The error message that the proxy will + show if the attribute isn't set. + """ + return LocalProxy(self, name, unbound_message=unbound_message) + + def __release_local__(self) -> None: + self.__storage.set({}) + + def __getattr__(self, name: str) -> t.Any: + values = self.__storage.get({}) + + if name in values: + return values[name] + + raise AttributeError(name) + + def __setattr__(self, name: str, value: t.Any) -> None: + values = self.__storage.get({}).copy() + values[name] = value + self.__storage.set(values) + + def __delattr__(self, name: str) -> None: + values = self.__storage.get({}) + + if name in values: + values = values.copy() + del values[name] + self.__storage.set(values) + else: + raise AttributeError(name) + + +class LocalStack(t.Generic[T]): + """Create a stack of context-local data. This wraps a + :class:`ContextVar` containing a :class:`list` value. + + This may incur a performance penalty compared to using individual + context vars, as it has to copy data to avoid mutating the list + between nested contexts. + + :param context_var: The :class:`~contextvars.ContextVar` to use as + storage for this local. If not given, one will be created. + Context vars not created at the global scope may interfere with + garbage collection. + + .. versionchanged:: 2.0 + Uses ``ContextVar`` instead of a custom storage implementation. + + .. versionadded:: 0.6.1 + """ + + __slots__ = ("_storage",) + + def __init__(self, context_var: ContextVar[list[T]] | None = None) -> None: + if context_var is None: + # A ContextVar not created at global scope interferes with + # Python's garbage collection. However, a local only makes + # sense defined at the global scope as well, in which case + # the GC issue doesn't seem relevant. + context_var = ContextVar(f"werkzeug.LocalStack<{id(self)}>.storage") + + self._storage = context_var + + def __release_local__(self) -> None: + self._storage.set([]) + + def push(self, obj: T) -> list[T]: + """Add a new item to the top of the stack.""" + stack = self._storage.get([]).copy() + stack.append(obj) + self._storage.set(stack) + return stack + + def pop(self) -> T | None: + """Remove the top item from the stack and return it. If the + stack is empty, return ``None``. + """ + stack = self._storage.get([]) + + if len(stack) == 0: + return None + + rv = stack[-1] + self._storage.set(stack[:-1]) + return rv + + @property + def top(self) -> T | None: + """The topmost item on the stack. If the stack is empty, + `None` is returned. + """ + stack = self._storage.get([]) + + if len(stack) == 0: + return None + + return stack[-1] + + def __call__( + self, name: str | None = None, *, unbound_message: str | None = None + ) -> LocalProxy[t.Any]: + """Create a :class:`LocalProxy` that accesses the top of this + local stack. + + :param name: If given, the proxy access this attribute of the + top item, rather than the item itself. + :param unbound_message: The error message that the proxy will + show if the stack is empty. + """ + return LocalProxy(self, name, unbound_message=unbound_message) + + +class LocalManager: + """Manage releasing the data for the current context in one or more + :class:`Local` and :class:`LocalStack` objects. + + This should not be needed for modern use cases, and may be removed + in the future. + + :param locals: A local or list of locals to manage. + + .. versionchanged:: 2.1 + The ``ident_func`` was removed. + + .. versionchanged:: 0.7 + The ``ident_func`` parameter was added. + + .. versionchanged:: 0.6.1 + The :func:`release_local` function can be used instead of a + manager. + """ + + __slots__ = ("locals",) + + def __init__( + self, + locals: None + | (Local | LocalStack[t.Any] | t.Iterable[Local | LocalStack[t.Any]]) = None, + ) -> None: + if locals is None: + self.locals = [] + elif isinstance(locals, Local): + self.locals = [locals] + else: + self.locals = list(locals) # type: ignore[arg-type] + + def cleanup(self) -> None: + """Release the data in the locals for this context. Call this at + the end of each request or use :meth:`make_middleware`. + """ + for local in self.locals: + release_local(local) + + def make_middleware(self, app: WSGIApplication) -> WSGIApplication: + """Wrap a WSGI application so that local data is released + automatically after the response has been sent for a request. + """ + + def application( + environ: WSGIEnvironment, start_response: StartResponse + ) -> t.Iterable[bytes]: + return ClosingIterator(app(environ, start_response), self.cleanup) + + return application + + def middleware(self, func: WSGIApplication) -> WSGIApplication: + """Like :meth:`make_middleware` but used as a decorator on the + WSGI application function. + + .. code-block:: python + + @manager.middleware + def application(environ, start_response): + ... + """ + return update_wrapper(self.make_middleware(func), func) + + def __repr__(self) -> str: + return f"<{type(self).__name__} storages: {len(self.locals)}>" + + +class _ProxyLookup: + """Descriptor that handles proxied attribute lookup for + :class:`LocalProxy`. + + :param f: The built-in function this attribute is accessed through. + Instead of looking up the special method, the function call + is redone on the object. + :param fallback: Return this function if the proxy is unbound + instead of raising a :exc:`RuntimeError`. + :param is_attr: This proxied name is an attribute, not a function. + Call the fallback immediately to get the value. + :param class_value: Value to return when accessed from the + ``LocalProxy`` class directly. Used for ``__doc__`` so building + docs still works. + """ + + __slots__ = ("bind_f", "fallback", "is_attr", "class_value", "name") + + def __init__( + self, + f: t.Callable[..., t.Any] | None = None, + fallback: t.Callable[[LocalProxy[t.Any]], t.Any] | None = None, + class_value: t.Any | None = None, + is_attr: bool = False, + ) -> None: + bind_f: t.Callable[[LocalProxy[t.Any], t.Any], t.Callable[..., t.Any]] | None + + if hasattr(f, "__get__"): + # A Python function, can be turned into a bound method. + + def bind_f( + instance: LocalProxy[t.Any], obj: t.Any + ) -> t.Callable[..., t.Any]: + return f.__get__(obj, type(obj)) # type: ignore + + elif f is not None: + # A C function, use partial to bind the first argument. + + def bind_f( + instance: LocalProxy[t.Any], obj: t.Any + ) -> t.Callable[..., t.Any]: + return partial(f, obj) + + else: + # Use getattr, which will produce a bound method. + bind_f = None + + self.bind_f = bind_f + self.fallback = fallback + self.class_value = class_value + self.is_attr = is_attr + + def __set_name__(self, owner: LocalProxy[t.Any], name: str) -> None: + self.name = name + + def __get__(self, instance: LocalProxy[t.Any], owner: type | None = None) -> t.Any: + if instance is None: + if self.class_value is not None: + return self.class_value + + return self + + try: + obj = instance._get_current_object() + except RuntimeError: + if self.fallback is None: + raise + + fallback = self.fallback.__get__(instance, owner) + + if self.is_attr: + # __class__ and __doc__ are attributes, not methods. + # Call the fallback to get the value. + return fallback() + + return fallback + + if self.bind_f is not None: + return self.bind_f(instance, obj) + + return getattr(obj, self.name) + + def __repr__(self) -> str: + return f"proxy {self.name}" + + def __call__( + self, instance: LocalProxy[t.Any], *args: t.Any, **kwargs: t.Any + ) -> t.Any: + """Support calling unbound methods from the class. For example, + this happens with ``copy.copy``, which does + ``type(x).__copy__(x)``. ``type(x)`` can't be proxied, so it + returns the proxy type and descriptor. + """ + return self.__get__(instance, type(instance))(*args, **kwargs) + + +class _ProxyIOp(_ProxyLookup): + """Look up an augmented assignment method on a proxied object. The + method is wrapped to return the proxy instead of the object. + """ + + __slots__ = () + + def __init__( + self, + f: t.Callable[..., t.Any] | None = None, + fallback: t.Callable[[LocalProxy[t.Any]], t.Any] | None = None, + ) -> None: + super().__init__(f, fallback) + + def bind_f(instance: LocalProxy[t.Any], obj: t.Any) -> t.Callable[..., t.Any]: + def i_op(self: t.Any, other: t.Any) -> LocalProxy[t.Any]: + f(self, other) # type: ignore + return instance + + return i_op.__get__(obj, type(obj)) # type: ignore + + self.bind_f = bind_f + + +def _l_to_r_op(op: F) -> F: + """Swap the argument order to turn an l-op into an r-op.""" + + def r_op(obj: t.Any, other: t.Any) -> t.Any: + return op(other, obj) + + return t.cast(F, r_op) + + +def _identity(o: T) -> T: + return o + + +class LocalProxy(t.Generic[T]): + """A proxy to the object bound to a context-local object. All + operations on the proxy are forwarded to the bound object. If no + object is bound, a ``RuntimeError`` is raised. + + :param local: The context-local object that provides the proxied + object. + :param name: Proxy this attribute from the proxied object. + :param unbound_message: The error message to show if the + context-local object is unbound. + + Proxy a :class:`~contextvars.ContextVar` to make it easier to + access. Pass a name to proxy that attribute. + + .. code-block:: python + + _request_var = ContextVar("request") + request = LocalProxy(_request_var) + session = LocalProxy(_request_var, "session") + + Proxy an attribute on a :class:`Local` namespace by calling the + local with the attribute name: + + .. code-block:: python + + data = Local() + user = data("user") + + Proxy the top item on a :class:`LocalStack` by calling the local. + Pass a name to proxy that attribute. + + .. code-block:: + + app_stack = LocalStack() + current_app = app_stack() + g = app_stack("g") + + Pass a function to proxy the return value from that function. This + was previously used to access attributes of local objects before + that was supported directly. + + .. code-block:: python + + session = LocalProxy(lambda: request.session) + + ``__repr__`` and ``__class__`` are proxied, so ``repr(x)`` and + ``isinstance(x, cls)`` will look like the proxied object. Use + ``issubclass(type(x), LocalProxy)`` to check if an object is a + proxy. + + .. code-block:: python + + repr(user) # + isinstance(user, User) # True + issubclass(type(user), LocalProxy) # True + + .. versionchanged:: 2.2.2 + ``__wrapped__`` is set when wrapping an object, not only when + wrapping a function, to prevent doctest from failing. + + .. versionchanged:: 2.2 + Can proxy a ``ContextVar`` or ``LocalStack`` directly. + + .. versionchanged:: 2.2 + The ``name`` parameter can be used with any proxied object, not + only ``Local``. + + .. versionchanged:: 2.2 + Added the ``unbound_message`` parameter. + + .. versionchanged:: 2.0 + Updated proxied attributes and methods to reflect the current + data model. + + .. versionchanged:: 0.6.1 + The class can be instantiated with a callable. + """ + + __slots__ = ("__wrapped", "_get_current_object") + + _get_current_object: t.Callable[[], T] + """Return the current object this proxy is bound to. If the proxy is + unbound, this raises a ``RuntimeError``. + + This should be used if you need to pass the object to something that + doesn't understand the proxy. It can also be useful for performance + if you are accessing the object multiple times in a function, rather + than going through the proxy multiple times. + """ + + def __init__( + self, + local: ContextVar[T] | Local | LocalStack[T] | t.Callable[[], T], + name: str | None = None, + *, + unbound_message: str | None = None, + ) -> None: + if name is None: + get_name = _identity + else: + get_name = attrgetter(name) # type: ignore[assignment] + + if unbound_message is None: + unbound_message = "object is not bound" + + if isinstance(local, Local): + if name is None: + raise TypeError("'name' is required when proxying a 'Local' object.") + + def _get_current_object() -> T: + try: + return get_name(local) # type: ignore[return-value] + except AttributeError: + raise RuntimeError(unbound_message) from None + + elif isinstance(local, LocalStack): + + def _get_current_object() -> T: + obj = local.top + + if obj is None: + raise RuntimeError(unbound_message) + + return get_name(obj) + + elif isinstance(local, ContextVar): + + def _get_current_object() -> T: + try: + obj = local.get() + except LookupError: + raise RuntimeError(unbound_message) from None + + return get_name(obj) + + elif callable(local): + + def _get_current_object() -> T: + return get_name(local()) + + else: + raise TypeError(f"Don't know how to proxy '{type(local)}'.") + + object.__setattr__(self, "_LocalProxy__wrapped", local) + object.__setattr__(self, "_get_current_object", _get_current_object) + + __doc__ = _ProxyLookup( + class_value=__doc__, fallback=lambda self: type(self).__doc__, is_attr=True + ) + __wrapped__ = _ProxyLookup( + fallback=lambda self: self._LocalProxy__wrapped, # type: ignore[attr-defined] + is_attr=True, + ) + # __del__ should only delete the proxy + __repr__ = _ProxyLookup( + repr, fallback=lambda self: f"<{type(self).__name__} unbound>" + ) + __str__ = _ProxyLookup(str) + __bytes__ = _ProxyLookup(bytes) + __format__ = _ProxyLookup() + __lt__ = _ProxyLookup(operator.lt) + __le__ = _ProxyLookup(operator.le) + __eq__ = _ProxyLookup(operator.eq) + __ne__ = _ProxyLookup(operator.ne) + __gt__ = _ProxyLookup(operator.gt) + __ge__ = _ProxyLookup(operator.ge) + __hash__ = _ProxyLookup(hash) + __bool__ = _ProxyLookup(bool, fallback=lambda self: False) + __getattr__ = _ProxyLookup(getattr) + # __getattribute__ triggered through __getattr__ + __setattr__ = _ProxyLookup(setattr) + __delattr__ = _ProxyLookup(delattr) + __dir__ = _ProxyLookup(dir, fallback=lambda self: []) + # __get__ (proxying descriptor not supported) + # __set__ (descriptor) + # __delete__ (descriptor) + # __set_name__ (descriptor) + # __objclass__ (descriptor) + # __slots__ used by proxy itself + # __dict__ (__getattr__) + # __weakref__ (__getattr__) + # __init_subclass__ (proxying metaclass not supported) + # __prepare__ (metaclass) + __class__ = _ProxyLookup(fallback=lambda self: type(self), is_attr=True) + __instancecheck__ = _ProxyLookup(lambda self, other: isinstance(other, self)) + __subclasscheck__ = _ProxyLookup(lambda self, other: issubclass(other, self)) + # __class_getitem__ triggered through __getitem__ + __call__ = _ProxyLookup(lambda self, *args, **kwargs: self(*args, **kwargs)) + __len__ = _ProxyLookup(len) + __length_hint__ = _ProxyLookup(operator.length_hint) + __getitem__ = _ProxyLookup(operator.getitem) + __setitem__ = _ProxyLookup(operator.setitem) + __delitem__ = _ProxyLookup(operator.delitem) + # __missing__ triggered through __getitem__ + __iter__ = _ProxyLookup(iter) + __next__ = _ProxyLookup(next) + __reversed__ = _ProxyLookup(reversed) + __contains__ = _ProxyLookup(operator.contains) + __add__ = _ProxyLookup(operator.add) + __sub__ = _ProxyLookup(operator.sub) + __mul__ = _ProxyLookup(operator.mul) + __matmul__ = _ProxyLookup(operator.matmul) + __truediv__ = _ProxyLookup(operator.truediv) + __floordiv__ = _ProxyLookup(operator.floordiv) + __mod__ = _ProxyLookup(operator.mod) + __divmod__ = _ProxyLookup(divmod) + __pow__ = _ProxyLookup(pow) + __lshift__ = _ProxyLookup(operator.lshift) + __rshift__ = _ProxyLookup(operator.rshift) + __and__ = _ProxyLookup(operator.and_) + __xor__ = _ProxyLookup(operator.xor) + __or__ = _ProxyLookup(operator.or_) + __radd__ = _ProxyLookup(_l_to_r_op(operator.add)) + __rsub__ = _ProxyLookup(_l_to_r_op(operator.sub)) + __rmul__ = _ProxyLookup(_l_to_r_op(operator.mul)) + __rmatmul__ = _ProxyLookup(_l_to_r_op(operator.matmul)) + __rtruediv__ = _ProxyLookup(_l_to_r_op(operator.truediv)) + __rfloordiv__ = _ProxyLookup(_l_to_r_op(operator.floordiv)) + __rmod__ = _ProxyLookup(_l_to_r_op(operator.mod)) + __rdivmod__ = _ProxyLookup(_l_to_r_op(divmod)) + __rpow__ = _ProxyLookup(_l_to_r_op(pow)) + __rlshift__ = _ProxyLookup(_l_to_r_op(operator.lshift)) + __rrshift__ = _ProxyLookup(_l_to_r_op(operator.rshift)) + __rand__ = _ProxyLookup(_l_to_r_op(operator.and_)) + __rxor__ = _ProxyLookup(_l_to_r_op(operator.xor)) + __ror__ = _ProxyLookup(_l_to_r_op(operator.or_)) + __iadd__ = _ProxyIOp(operator.iadd) + __isub__ = _ProxyIOp(operator.isub) + __imul__ = _ProxyIOp(operator.imul) + __imatmul__ = _ProxyIOp(operator.imatmul) + __itruediv__ = _ProxyIOp(operator.itruediv) + __ifloordiv__ = _ProxyIOp(operator.ifloordiv) + __imod__ = _ProxyIOp(operator.imod) + __ipow__ = _ProxyIOp(operator.ipow) + __ilshift__ = _ProxyIOp(operator.ilshift) + __irshift__ = _ProxyIOp(operator.irshift) + __iand__ = _ProxyIOp(operator.iand) + __ixor__ = _ProxyIOp(operator.ixor) + __ior__ = _ProxyIOp(operator.ior) + __neg__ = _ProxyLookup(operator.neg) + __pos__ = _ProxyLookup(operator.pos) + __abs__ = _ProxyLookup(abs) + __invert__ = _ProxyLookup(operator.invert) + __complex__ = _ProxyLookup(complex) + __int__ = _ProxyLookup(int) + __float__ = _ProxyLookup(float) + __index__ = _ProxyLookup(operator.index) + __round__ = _ProxyLookup(round) + __trunc__ = _ProxyLookup(math.trunc) + __floor__ = _ProxyLookup(math.floor) + __ceil__ = _ProxyLookup(math.ceil) + __enter__ = _ProxyLookup() + __exit__ = _ProxyLookup() + __await__ = _ProxyLookup() + __aiter__ = _ProxyLookup() + __anext__ = _ProxyLookup() + __aenter__ = _ProxyLookup() + __aexit__ = _ProxyLookup() + __copy__ = _ProxyLookup(copy.copy) + __deepcopy__ = _ProxyLookup(copy.deepcopy) + # __getnewargs_ex__ (pickle through proxy not supported) + # __getnewargs__ (pickle) + # __getstate__ (pickle) + # __setstate__ (pickle) + # __reduce__ (pickle) + # __reduce_ex__ (pickle) diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/werkzeug/middleware/__init__.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/werkzeug/middleware/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/werkzeug/middleware/dispatcher.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/werkzeug/middleware/dispatcher.py new file mode 100644 index 0000000000000000000000000000000000000000..e11bacc527b2c2ce82ff62ea0d4a9c3ef5514b12 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/werkzeug/middleware/dispatcher.py @@ -0,0 +1,81 @@ +""" +Application Dispatcher +====================== + +This middleware creates a single WSGI application that dispatches to +multiple other WSGI applications mounted at different URL paths. + +A common example is writing a Single Page Application, where you have a +backend API and a frontend written in JavaScript that does the routing +in the browser rather than requesting different pages from the server. +The frontend is a single HTML and JS file that should be served for any +path besides "/api". + +This example dispatches to an API app under "/api", an admin app +under "/admin", and an app that serves frontend files for all other +requests:: + + app = DispatcherMiddleware(serve_frontend, { + '/api': api_app, + '/admin': admin_app, + }) + +In production, you might instead handle this at the HTTP server level, +serving files or proxying to application servers based on location. The +API and admin apps would each be deployed with a separate WSGI server, +and the static files would be served directly by the HTTP server. + +.. autoclass:: DispatcherMiddleware + +:copyright: 2007 Pallets +:license: BSD-3-Clause +""" + +from __future__ import annotations + +import typing as t + +if t.TYPE_CHECKING: + from _typeshed.wsgi import StartResponse + from _typeshed.wsgi import WSGIApplication + from _typeshed.wsgi import WSGIEnvironment + + +class DispatcherMiddleware: + """Combine multiple applications as a single WSGI application. + Requests are dispatched to an application based on the path it is + mounted under. + + :param app: The WSGI application to dispatch to if the request + doesn't match a mounted path. + :param mounts: Maps path prefixes to applications for dispatching. + """ + + def __init__( + self, + app: WSGIApplication, + mounts: dict[str, WSGIApplication] | None = None, + ) -> None: + self.app = app + self.mounts = mounts or {} + + def __call__( + self, environ: WSGIEnvironment, start_response: StartResponse + ) -> t.Iterable[bytes]: + script = environ.get("PATH_INFO", "") + path_info = "" + + while "/" in script: + if script in self.mounts: + app = self.mounts[script] + break + + script, last_item = script.rsplit("/", 1) + path_info = f"/{last_item}{path_info}" + else: + app = self.mounts.get(script, self.app) + + original_script_name = environ.get("SCRIPT_NAME", "") + environ["SCRIPT_NAME"] = original_script_name + script + environ["PATH_INFO"] = path_info + return app(environ, start_response) diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/werkzeug/middleware/http_proxy.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/werkzeug/middleware/http_proxy.py new file mode 100644 index 0000000000000000000000000000000000000000..5e239156aa1aef21a9ca762281ecb1185d70ed20 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/werkzeug/middleware/http_proxy.py @@ -0,0 +1,236 @@ +""" +Basic HTTP Proxy +================ + +.. autoclass:: ProxyMiddleware + +:copyright: 2007 Pallets +:license: BSD-3-Clause +""" + +from __future__ import annotations + +import typing as t +from http import client +from urllib.parse import quote +from urllib.parse import urlsplit + +from ..datastructures import EnvironHeaders +from ..http import is_hop_by_hop_header +from ..wsgi import get_input_stream + +if t.TYPE_CHECKING: + from _typeshed.wsgi import StartResponse + from _typeshed.wsgi import WSGIApplication + from _typeshed.wsgi import WSGIEnvironment + + +class ProxyMiddleware: + """Proxy requests under a path to an external server, routing other + requests to the app. + + This middleware can only proxy HTTP requests, as HTTP is the only + protocol handled by the WSGI server. Other protocols, such as + WebSocket requests, cannot be proxied at this layer. This should + only be used for development, in production a real proxy server + should be used. + + The middleware takes a dict mapping a path prefix to a dict + describing the host to be proxied to:: + + app = ProxyMiddleware(app, { + "/static/": { + "target": "http://127.0.0.1:5001/", + } + }) + + Each host has the following options: + + ``target``: + The target URL to dispatch to. This is required. + ``remove_prefix``: + Whether to remove the prefix from the URL before dispatching it + to the target. The default is ``False``. + ``host``: + ``""`` (default): + The host header is automatically rewritten to the URL of the + target. + ``None``: + The host header is unmodified from the client request. + Any other value: + The host header is overwritten with the value. + ``headers``: + A dictionary of headers to be sent with the request to the + target. The default is ``{}``. + ``ssl_context``: + A :class:`ssl.SSLContext` defining how to verify requests if the + target is HTTPS. The default is ``None``. + + In the example above, everything under ``"/static/"`` is proxied to + the server on port 5001. The host header is rewritten to the target, + and the ``"/static/"`` prefix is removed from the URLs. + + :param app: The WSGI application to wrap. + :param targets: Proxy target configurations. See description above. + :param chunk_size: Size of chunks to read from input stream and + write to target. + :param timeout: Seconds before an operation to a target fails. + + .. versionadded:: 0.14 + """ + + def __init__( + self, + app: WSGIApplication, + targets: t.Mapping[str, dict[str, t.Any]], + chunk_size: int = 2 << 13, + timeout: int = 10, + ) -> None: + def _set_defaults(opts: dict[str, t.Any]) -> dict[str, t.Any]: + opts.setdefault("remove_prefix", False) + opts.setdefault("host", "") + opts.setdefault("headers", {}) + opts.setdefault("ssl_context", None) + return opts + + self.app = app + self.targets = { + f"/{k.strip('/')}/": _set_defaults(v) for k, v in targets.items() + } + self.chunk_size = chunk_size + self.timeout = timeout + + def proxy_to( + self, opts: dict[str, t.Any], path: str, prefix: str + ) -> WSGIApplication: + target = urlsplit(opts["target"]) + # socket can handle unicode host, but header must be ascii + host = target.hostname.encode("idna").decode("ascii") + + def application( + environ: WSGIEnvironment, start_response: StartResponse + ) -> t.Iterable[bytes]: + headers = list(EnvironHeaders(environ).items()) + headers[:] = [ + (k, v) + for k, v in headers + if not is_hop_by_hop_header(k) + and k.lower() not in ("content-length", "host") + ] + headers.append(("Connection", "close")) + + if opts["host"] == "": + headers.append(("Host", host)) + elif opts["host"] is None: + headers.append(("Host", environ["HTTP_HOST"])) + else: + headers.append(("Host", opts["host"])) + + headers.extend(opts["headers"].items()) + remote_path = path + + if opts["remove_prefix"]: + remote_path = remote_path[len(prefix) :].lstrip("/") + remote_path = f"{target.path.rstrip('/')}/{remote_path}" + + content_length = environ.get("CONTENT_LENGTH") + chunked = False + + if content_length not in ("", None): + headers.append(("Content-Length", content_length)) # type: ignore + elif content_length is not None: + headers.append(("Transfer-Encoding", "chunked")) + chunked = True + + try: + if target.scheme == "http": + con = client.HTTPConnection( + host, target.port or 80, timeout=self.timeout + ) + elif target.scheme == "https": + con = client.HTTPSConnection( + host, + target.port or 443, + timeout=self.timeout, + context=opts["ssl_context"], + ) + else: + raise RuntimeError( + "Target scheme must be 'http' or 'https', got" + f" {target.scheme!r}." + ) + + con.connect() + # safe = https://url.spec.whatwg.org/#url-path-segment-string + # as well as percent for things that are already quoted + remote_url = quote(remote_path, safe="!$&'()*+,/:;=@%") + querystring = environ["QUERY_STRING"] + + if querystring: + remote_url = f"{remote_url}?{querystring}" + + con.putrequest(environ["REQUEST_METHOD"], remote_url, skip_host=True) + + for k, v in headers: + if k.lower() == "connection": + v = "close" + + con.putheader(k, v) + + con.endheaders() + stream = get_input_stream(environ) + + while True: + data = stream.read(self.chunk_size) + + if not data: + break + + if chunked: + con.send(b"%x\r\n%s\r\n" % (len(data), data)) + else: + con.send(data) + + resp = con.getresponse() + except OSError: + from ..exceptions import BadGateway + + return BadGateway()(environ, start_response) + + start_response( + f"{resp.status} {resp.reason}", + [ + (k.title(), v) + for k, v in resp.getheaders() + if not is_hop_by_hop_header(k) + ], + ) + + def read() -> t.Iterator[bytes]: + while True: + try: + data = resp.read(self.chunk_size) + except OSError: + break + + if not data: + break + + yield data + + return read() + + return application + + def __call__( + self, environ: WSGIEnvironment, start_response: StartResponse + ) -> t.Iterable[bytes]: + path = environ["PATH_INFO"] + app = self.app + + for prefix, opts in self.targets.items(): + if path.startswith(prefix): + app = self.proxy_to(opts, path, prefix) + break + + return app(environ, start_response) diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/werkzeug/middleware/lint.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/werkzeug/middleware/lint.py new file mode 100644 index 0000000000000000000000000000000000000000..3714271b1cb8894be598eb165f93d9315f130422 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/werkzeug/middleware/lint.py @@ -0,0 +1,439 @@ +""" +WSGI Protocol Linter +==================== + +This module provides a middleware that performs sanity checks on the +behavior of the WSGI server and application. It checks that the +:pep:`3333` WSGI spec is properly implemented. It also warns on some +common HTTP errors such as non-empty responses for 304 status codes. + +.. autoclass:: LintMiddleware + +:copyright: 2007 Pallets +:license: BSD-3-Clause +""" + +from __future__ import annotations + +import typing as t +from types import TracebackType +from urllib.parse import urlparse +from warnings import warn + +from ..datastructures import Headers +from ..http import is_entity_header +from ..wsgi import FileWrapper + +if t.TYPE_CHECKING: + from _typeshed.wsgi import StartResponse + from _typeshed.wsgi import WSGIApplication + from _typeshed.wsgi import WSGIEnvironment + + +class WSGIWarning(Warning): + """Warning class for WSGI warnings.""" + + +class HTTPWarning(Warning): + """Warning class for HTTP warnings.""" + + +def check_type(context: str, obj: object, need: type = str) -> None: + if type(obj) is not need: + warn( + f"{context!r} requires {need.__name__!r}, got {type(obj).__name__!r}.", + WSGIWarning, + stacklevel=3, + ) + + +class InputStream: + def __init__(self, stream: t.IO[bytes]) -> None: + self._stream = stream + + def read(self, *args: t.Any) -> bytes: + if len(args) == 0: + warn( + "WSGI does not guarantee an EOF marker on the input stream, thus making" + " calls to 'wsgi.input.read()' unsafe. Conforming servers may never" + " return from this call.", + WSGIWarning, + stacklevel=2, + ) + elif len(args) != 1: + warn( + "Too many parameters passed to 'wsgi.input.read()'.", + WSGIWarning, + stacklevel=2, + ) + return self._stream.read(*args) + + def readline(self, *args: t.Any) -> bytes: + if len(args) == 0: + warn( + "Calls to 'wsgi.input.readline()' without arguments are unsafe. Use" + " 'wsgi.input.read()' instead.", + WSGIWarning, + stacklevel=2, + ) + elif len(args) == 1: + warn( + "'wsgi.input.readline()' was called with a size hint. WSGI does not" + " support this, although it's available on all major servers.", + WSGIWarning, + stacklevel=2, + ) + else: + raise TypeError("Too many arguments passed to 'wsgi.input.readline()'.") + return self._stream.readline(*args) + + def __iter__(self) -> t.Iterator[bytes]: + try: + return iter(self._stream) + except TypeError: + warn("'wsgi.input' is not iterable.", WSGIWarning, stacklevel=2) + return iter(()) + + def close(self) -> None: + warn("The application closed the input stream!", WSGIWarning, stacklevel=2) + self._stream.close() + + +class ErrorStream: + def __init__(self, stream: t.IO[str]) -> None: + self._stream = stream + + def write(self, s: str) -> None: + check_type("wsgi.error.write()", s, str) + self._stream.write(s) + + def flush(self) -> None: + self._stream.flush() + + def writelines(self, seq: t.Iterable[str]) -> None: + for line in seq: + self.write(line) + + def close(self) -> None: + warn("The application closed the error stream!", WSGIWarning, stacklevel=2) + self._stream.close() + + +class GuardedWrite: + def __init__(self, write: t.Callable[[bytes], object], chunks: list[int]) -> None: + self._write = write + self._chunks = chunks + + def __call__(self, s: bytes) -> None: + check_type("write()", s, bytes) + self._write(s) + self._chunks.append(len(s)) + + +class GuardedIterator: + def __init__( + self, + iterator: t.Iterable[bytes], + headers_set: tuple[int, Headers], + chunks: list[int], + ) -> None: + self._iterator = iterator + self._next = iter(iterator).__next__ + self.closed = False + self.headers_set = headers_set + self.chunks = chunks + + def __iter__(self) -> GuardedIterator: + return self + + def __next__(self) -> bytes: + if self.closed: + warn("Iterated over closed 'app_iter'.", WSGIWarning, stacklevel=2) + + rv = self._next() + + if not self.headers_set: + warn( + "The application returned before it started the response.", + WSGIWarning, + stacklevel=2, + ) + + check_type("application iterator items", rv, bytes) + self.chunks.append(len(rv)) + return rv + + def close(self) -> None: + self.closed = True + + if hasattr(self._iterator, "close"): + self._iterator.close() + + if self.headers_set: + status_code, headers = self.headers_set + bytes_sent = sum(self.chunks) + content_length = headers.get("content-length", type=int) + + if status_code == 304: + for key, _value in headers: + key = key.lower() + if key not in ("expires", "content-location") and is_entity_header( + key + ): + warn( + f"Entity header {key!r} found in 304 response.", + HTTPWarning, + stacklevel=2, + ) + if bytes_sent: + warn( + "304 responses must not have a body.", + HTTPWarning, + stacklevel=2, + ) + elif 100 <= status_code < 200 or status_code == 204: + if content_length != 0: + warn( + f"{status_code} responses must have an empty content length.", + HTTPWarning, + stacklevel=2, + ) + if bytes_sent: + warn( + f"{status_code} responses must not have a body.", + HTTPWarning, + stacklevel=2, + ) + elif content_length is not None and content_length != bytes_sent: + warn( + "Content-Length and the number of bytes sent to the" + " client do not match.", + WSGIWarning, + stacklevel=2, + ) + + def __del__(self) -> None: + if not self.closed: + try: + warn( + "Iterator was garbage collected before it was closed.", + WSGIWarning, + stacklevel=2, + ) + except Exception: + pass + + +class LintMiddleware: + """Warns about common errors in the WSGI and HTTP behavior of the + server and wrapped application. Some of the issues it checks are: + + - invalid status codes + - non-bytes sent to the WSGI server + - strings returned from the WSGI application + - non-empty conditional responses + - unquoted etags + - relative URLs in the Location header + - unsafe calls to wsgi.input + - unclosed iterators + + Error information is emitted using the :mod:`warnings` module. + + :param app: The WSGI application to wrap. + + .. code-block:: python + + from werkzeug.middleware.lint import LintMiddleware + app = LintMiddleware(app) + """ + + def __init__(self, app: WSGIApplication) -> None: + self.app = app + + def check_environ(self, environ: WSGIEnvironment) -> None: + if type(environ) is not dict: # noqa: E721 + warn( + "WSGI environment is not a standard Python dict.", + WSGIWarning, + stacklevel=4, + ) + for key in ( + "REQUEST_METHOD", + "SERVER_NAME", + "SERVER_PORT", + "wsgi.version", + "wsgi.input", + "wsgi.errors", + "wsgi.multithread", + "wsgi.multiprocess", + "wsgi.run_once", + ): + if key not in environ: + warn( + f"Required environment key {key!r} not found", + WSGIWarning, + stacklevel=3, + ) + if environ["wsgi.version"] != (1, 0): + warn("Environ is not a WSGI 1.0 environ.", WSGIWarning, stacklevel=3) + + script_name = environ.get("SCRIPT_NAME", "") + path_info = environ.get("PATH_INFO", "") + + if script_name and script_name[0] != "/": + warn( + f"'SCRIPT_NAME' does not start with a slash: {script_name!r}", + WSGIWarning, + stacklevel=3, + ) + + if path_info and path_info[0] != "/": + warn( + f"'PATH_INFO' does not start with a slash: {path_info!r}", + WSGIWarning, + stacklevel=3, + ) + + def check_start_response( + self, + status: str, + headers: list[tuple[str, str]], + exc_info: None | (tuple[type[BaseException], BaseException, TracebackType]), + ) -> tuple[int, Headers]: + check_type("status", status, str) + status_code_str = status.split(None, 1)[0] + + if len(status_code_str) != 3 or not status_code_str.isdecimal(): + warn("Status code must be three digits.", WSGIWarning, stacklevel=3) + + if len(status) < 4 or status[3] != " ": + warn( + f"Invalid value for status {status!r}. Valid status strings are three" + " digits, a space and a status explanation.", + WSGIWarning, + stacklevel=3, + ) + + status_code = int(status_code_str) + + if status_code < 100: + warn("Status code < 100 detected.", WSGIWarning, stacklevel=3) + + if type(headers) is not list: # noqa: E721 + warn("Header list is not a list.", WSGIWarning, stacklevel=3) + + for item in headers: + if type(item) is not tuple or len(item) != 2: + warn("Header items must be 2-item tuples.", WSGIWarning, stacklevel=3) + name, value = item + if type(name) is not str or type(value) is not str: # noqa: E721 + warn( + "Header keys and values must be strings.", WSGIWarning, stacklevel=3 + ) + if name.lower() == "status": + warn( + "The status header is not supported due to" + " conflicts with the CGI spec.", + WSGIWarning, + stacklevel=3, + ) + + if exc_info is not None and not isinstance(exc_info, tuple): + warn("Invalid value for exc_info.", WSGIWarning, stacklevel=3) + + headers_obj = Headers(headers) + self.check_headers(headers_obj) + + return status_code, headers_obj + + def check_headers(self, headers: Headers) -> None: + etag = headers.get("etag") + + if etag is not None: + if etag.startswith(("W/", "w/")): + if etag.startswith("w/"): + warn( + "Weak etag indicator should be upper case.", + HTTPWarning, + stacklevel=4, + ) + + etag = etag[2:] + + if not (etag[:1] == etag[-1:] == '"'): + warn("Unquoted etag emitted.", HTTPWarning, stacklevel=4) + + location = headers.get("location") + + if location is not None: + if not urlparse(location).netloc: + warn( + "Absolute URLs required for location header.", + HTTPWarning, + stacklevel=4, + ) + + def check_iterator(self, app_iter: t.Iterable[bytes]) -> None: + if isinstance(app_iter, str): + warn( + "The application returned a string. The response will send one" + " character at a time to the client, which will kill performance." + " Return a list or iterable instead.", + WSGIWarning, + stacklevel=3, + ) + + def __call__(self, *args: t.Any, **kwargs: t.Any) -> t.Iterable[bytes]: + if len(args) != 2: + warn("A WSGI app takes two arguments.", WSGIWarning, stacklevel=2) + + if kwargs: + warn( + "A WSGI app does not take keyword arguments.", WSGIWarning, stacklevel=2 + ) + + environ: WSGIEnvironment = args[0] + start_response: StartResponse = args[1] + + self.check_environ(environ) + environ["wsgi.input"] = InputStream(environ["wsgi.input"]) + environ["wsgi.errors"] = ErrorStream(environ["wsgi.errors"]) + + # Hook our own file wrapper in so that applications will always + # iterate to the end and we can check the content length. + environ["wsgi.file_wrapper"] = FileWrapper + + headers_set: list[t.Any] = [] + chunks: list[int] = [] + + def checking_start_response( + *args: t.Any, **kwargs: t.Any + ) -> t.Callable[[bytes], None]: + if len(args) not in {2, 3}: + warn( + f"Invalid number of arguments: {len(args)}, expected 2 or 3.", + WSGIWarning, + stacklevel=2, + ) + + if kwargs: + warn( + "'start_response' does not take keyword arguments.", + WSGIWarning, + stacklevel=2, + ) + + status: str = args[0] + headers: list[tuple[str, str]] = args[1] + exc_info: ( + None | (tuple[type[BaseException], BaseException, TracebackType]) + ) = args[2] if len(args) == 3 else None + + headers_set[:] = self.check_start_response(status, headers, exc_info) + return GuardedWrite(start_response(status, headers, exc_info), chunks) + + app_iter = self.app(environ, t.cast("StartResponse", checking_start_response)) + self.check_iterator(app_iter) + return GuardedIterator( + app_iter, t.cast(tuple[int, Headers], headers_set), chunks + ) diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/werkzeug/middleware/profiler.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/werkzeug/middleware/profiler.py new file mode 100644 index 0000000000000000000000000000000000000000..112b877761c00ab34fd95dbb8ba938b91eb34c79 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/werkzeug/middleware/profiler.py @@ -0,0 +1,155 @@ +""" +Application Profiler +==================== + +This module provides a middleware that profiles each request with the +:mod:`cProfile` module. This can help identify bottlenecks in your code +that may be slowing down your application. + +.. autoclass:: ProfilerMiddleware + +:copyright: 2007 Pallets +:license: BSD-3-Clause +""" + +from __future__ import annotations + +import os.path +import sys +import time +import typing as t +from pstats import Stats + +try: + from cProfile import Profile +except ImportError: + from profile import Profile # type: ignore + +if t.TYPE_CHECKING: + from _typeshed.wsgi import StartResponse + from _typeshed.wsgi import WSGIApplication + from _typeshed.wsgi import WSGIEnvironment + + +class ProfilerMiddleware: + """Wrap a WSGI application and profile the execution of each + request. Responses are buffered so that timings are more exact. + + If ``stream`` is given, :class:`pstats.Stats` are written to it + after each request. If ``profile_dir`` is given, :mod:`cProfile` + data files are saved to that directory, one file per request. + + The filename can be customized by passing ``filename_format``. If + it is a string, it will be formatted using :meth:`str.format` with + the following fields available: + + - ``{method}`` - The request method; GET, POST, etc. + - ``{path}`` - The request path or 'root' should one not exist. + - ``{elapsed}`` - The elapsed time of the request in milliseconds. + - ``{time}`` - The time of the request. + + If it is a callable, it will be called with the WSGI ``environ`` and + be expected to return a filename string. The ``environ`` dictionary + will also have the ``"werkzeug.profiler"`` key populated with a + dictionary containing the following fields (more may be added in the + future): + - ``{elapsed}`` - The elapsed time of the request in milliseconds. + - ``{time}`` - The time of the request. + + :param app: The WSGI application to wrap. + :param stream: Write stats to this stream. Disable with ``None``. + :param sort_by: A tuple of columns to sort stats by. See + :meth:`pstats.Stats.sort_stats`. + :param restrictions: A tuple of restrictions to filter stats by. See + :meth:`pstats.Stats.print_stats`. + :param profile_dir: Save profile data files to this directory. + :param filename_format: Format string for profile data file names, + or a callable returning a name. See explanation above. + + .. code-block:: python + + from werkzeug.middleware.profiler import ProfilerMiddleware + app = ProfilerMiddleware(app) + + .. versionchanged:: 3.0 + Added the ``"werkzeug.profiler"`` key to the ``filename_format(environ)`` + parameter with the ``elapsed`` and ``time`` fields. + + .. versionchanged:: 0.15 + Stats are written even if ``profile_dir`` is given, and can be + disable by passing ``stream=None``. + + .. versionadded:: 0.15 + Added ``filename_format``. + + .. versionadded:: 0.9 + Added ``restrictions`` and ``profile_dir``. + """ + + def __init__( + self, + app: WSGIApplication, + stream: t.IO[str] | None = sys.stdout, + sort_by: t.Iterable[str] = ("time", "calls"), + restrictions: t.Iterable[str | int | float] = (), + profile_dir: str | None = None, + filename_format: str = "{method}.{path}.{elapsed:.0f}ms.{time:.0f}.prof", + ) -> None: + self._app = app + self._stream = stream + self._sort_by = sort_by + self._restrictions = restrictions + self._profile_dir = profile_dir + self._filename_format = filename_format + + def __call__( + self, environ: WSGIEnvironment, start_response: StartResponse + ) -> t.Iterable[bytes]: + response_body: list[bytes] = [] + + def catching_start_response(status, headers, exc_info=None): # type: ignore + start_response(status, headers, exc_info) + return response_body.append + + def runapp() -> None: + app_iter = self._app( + environ, t.cast("StartResponse", catching_start_response) + ) + response_body.extend(app_iter) + + if hasattr(app_iter, "close"): + app_iter.close() + + profile = Profile() + start = time.time() + profile.runcall(runapp) + body = b"".join(response_body) + elapsed = time.time() - start + + if self._profile_dir is not None: + if callable(self._filename_format): + environ["werkzeug.profiler"] = { + "elapsed": elapsed * 1000.0, + "time": time.time(), + } + filename = self._filename_format(environ) + else: + filename = self._filename_format.format( + method=environ["REQUEST_METHOD"], + path=environ["PATH_INFO"].strip("/").replace("/", ".") or "root", + elapsed=elapsed * 1000.0, + time=time.time(), + ) + filename = os.path.join(self._profile_dir, filename) + profile.dump_stats(filename) + + if self._stream is not None: + stats = Stats(profile, stream=self._stream) + stats.sort_stats(*self._sort_by) + print("-" * 80, file=self._stream) + path_info = environ.get("PATH_INFO", "") + print(f"PATH: {path_info!r}", file=self._stream) + stats.print_stats(*self._restrictions) + print(f"{'-' * 80}\n", file=self._stream) + + return [body] diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/werkzeug/middleware/proxy_fix.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/werkzeug/middleware/proxy_fix.py new file mode 100644 index 0000000000000000000000000000000000000000..cbf4e0bae0c1077f0f3db8e776efd655ab799596 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/werkzeug/middleware/proxy_fix.py @@ -0,0 +1,183 @@ +""" +X-Forwarded-For Proxy Fix +========================= + +This module provides a middleware that adjusts the WSGI environ based on +``X-Forwarded-`` headers that proxies in front of an application may +set. + +When an application is running behind a proxy server, WSGI may see the +request as coming from that server rather than the real client. Proxies +set various headers to track where the request actually came from. + +This middleware should only be used if the application is actually +behind such a proxy, and should be configured with the number of proxies +that are chained in front of it. Not all proxies set all the headers. +Since incoming headers can be faked, you must set how many proxies are +setting each header so the middleware knows what to trust. + +.. autoclass:: ProxyFix + +:copyright: 2007 Pallets +:license: BSD-3-Clause +""" + +from __future__ import annotations + +import typing as t + +from ..http import parse_list_header + +if t.TYPE_CHECKING: + from _typeshed.wsgi import StartResponse + from _typeshed.wsgi import WSGIApplication + from _typeshed.wsgi import WSGIEnvironment + + +class ProxyFix: + """Adjust the WSGI environ based on ``X-Forwarded-`` that proxies in + front of the application may set. + + - ``X-Forwarded-For`` sets ``REMOTE_ADDR``. + - ``X-Forwarded-Proto`` sets ``wsgi.url_scheme``. + - ``X-Forwarded-Host`` sets ``HTTP_HOST``, ``SERVER_NAME``, and + ``SERVER_PORT``. + - ``X-Forwarded-Port`` sets ``HTTP_HOST`` and ``SERVER_PORT``. + - ``X-Forwarded-Prefix`` sets ``SCRIPT_NAME``. + + You must tell the middleware how many proxies set each header so it + knows what values to trust. It is a security issue to trust values + that came from the client rather than a proxy. + + The original values of the headers are stored in the WSGI + environ as ``werkzeug.proxy_fix.orig``, a dict. + + :param app: The WSGI application to wrap. + :param x_for: Number of values to trust for ``X-Forwarded-For``. + :param x_proto: Number of values to trust for ``X-Forwarded-Proto``. + :param x_host: Number of values to trust for ``X-Forwarded-Host``. + :param x_port: Number of values to trust for ``X-Forwarded-Port``. + :param x_prefix: Number of values to trust for + ``X-Forwarded-Prefix``. + + .. code-block:: python + + from werkzeug.middleware.proxy_fix import ProxyFix + # App is behind one proxy that sets the -For and -Host headers. + app = ProxyFix(app, x_for=1, x_host=1) + + .. versionchanged:: 1.0 + The ``num_proxies`` argument and attribute; the ``get_remote_addr`` method; and + the environ keys ``orig_remote_addr``, ``orig_wsgi_url_scheme``, and + ``orig_http_host`` were removed. + + .. versionchanged:: 0.15 + All headers support multiple values. Each header is configured with a separate + number of trusted proxies. + + .. versionchanged:: 0.15 + Original WSGI environ values are stored in the ``werkzeug.proxy_fix.orig`` dict. + + .. versionchanged:: 0.15 + Support ``X-Forwarded-Port`` and ``X-Forwarded-Prefix``. + + .. versionchanged:: 0.15 + ``X-Forwarded-Host`` and ``X-Forwarded-Port`` modify + ``SERVER_NAME`` and ``SERVER_PORT``. + """ + + def __init__( + self, + app: WSGIApplication, + x_for: int = 1, + x_proto: int = 1, + x_host: int = 0, + x_port: int = 0, + x_prefix: int = 0, + ) -> None: + self.app = app + self.x_for = x_for + self.x_proto = x_proto + self.x_host = x_host + self.x_port = x_port + self.x_prefix = x_prefix + + def _get_real_value(self, trusted: int, value: str | None) -> str | None: + """Get the real value from a list header based on the configured + number of trusted proxies. + + :param trusted: Number of values to trust in the header. + :param value: Comma separated list header value to parse. + :return: The real value, or ``None`` if there are fewer values + than the number of trusted proxies. + + .. versionchanged:: 1.0 + Renamed from ``_get_trusted_comma``. + + .. versionadded:: 0.15 + """ + if not (trusted and value): + return None + values = parse_list_header(value) + if len(values) >= trusted: + return values[-trusted] + return None + + def __call__( + self, environ: WSGIEnvironment, start_response: StartResponse + ) -> t.Iterable[bytes]: + """Modify the WSGI environ based on the various ``Forwarded`` + headers before calling the wrapped application. Store the + original environ values in ``werkzeug.proxy_fix.orig_{key}``. + """ + environ_get = environ.get + orig_remote_addr = environ_get("REMOTE_ADDR") + orig_wsgi_url_scheme = environ_get("wsgi.url_scheme") + orig_http_host = environ_get("HTTP_HOST") + environ.update( + { + "werkzeug.proxy_fix.orig": { + "REMOTE_ADDR": orig_remote_addr, + "wsgi.url_scheme": orig_wsgi_url_scheme, + "HTTP_HOST": orig_http_host, + "SERVER_NAME": environ_get("SERVER_NAME"), + "SERVER_PORT": environ_get("SERVER_PORT"), + "SCRIPT_NAME": environ_get("SCRIPT_NAME"), + } + } + ) + + x_for = self._get_real_value(self.x_for, environ_get("HTTP_X_FORWARDED_FOR")) + if x_for: + environ["REMOTE_ADDR"] = x_for + + x_proto = self._get_real_value( + self.x_proto, environ_get("HTTP_X_FORWARDED_PROTO") + ) + if x_proto: + environ["wsgi.url_scheme"] = x_proto + + x_host = self._get_real_value(self.x_host, environ_get("HTTP_X_FORWARDED_HOST")) + if x_host: + environ["HTTP_HOST"] = environ["SERVER_NAME"] = x_host + # "]" to check for IPv6 address without port + if ":" in x_host and not x_host.endswith("]"): + environ["SERVER_NAME"], environ["SERVER_PORT"] = x_host.rsplit(":", 1) + + x_port = self._get_real_value(self.x_port, environ_get("HTTP_X_FORWARDED_PORT")) + if x_port: + host = environ.get("HTTP_HOST") + if host: + # "]" to check for IPv6 address without port + if ":" in host and not host.endswith("]"): + host = host.rsplit(":", 1)[0] + environ["HTTP_HOST"] = f"{host}:{x_port}" + environ["SERVER_PORT"] = x_port + + x_prefix = self._get_real_value( + self.x_prefix, environ_get("HTTP_X_FORWARDED_PREFIX") + ) + if x_prefix: + environ["SCRIPT_NAME"] = x_prefix + + return self.app(environ, start_response) diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/werkzeug/middleware/shared_data.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/werkzeug/middleware/shared_data.py new file mode 100644 index 0000000000000000000000000000000000000000..c7c06df5a4f0bfeb6f94785804245df0e2c645ee --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/werkzeug/middleware/shared_data.py @@ -0,0 +1,283 @@ +""" +Serve Shared Static Files +========================= + +.. autoclass:: SharedDataMiddleware + :members: is_allowed + +:copyright: 2007 Pallets +:license: BSD-3-Clause +""" + +from __future__ import annotations + +import collections.abc as cabc +import importlib.util +import mimetypes +import os +import posixpath +import typing as t +from datetime import datetime +from datetime import timezone +from io import BytesIO +from time import time +from zlib import adler32 + +from ..http import http_date +from ..http import is_resource_modified +from ..security import safe_join +from ..utils import get_content_type +from ..wsgi import get_path_info +from ..wsgi import wrap_file + +_TOpener = t.Callable[[], tuple[t.IO[bytes], datetime, int]] +_TLoader = t.Callable[[t.Optional[str]], tuple[t.Optional[str], t.Optional[_TOpener]]] + +if t.TYPE_CHECKING: + from _typeshed.wsgi import StartResponse + from _typeshed.wsgi import WSGIApplication + from _typeshed.wsgi import WSGIEnvironment + + +class SharedDataMiddleware: + """A WSGI middleware which provides static content for development + environments or simple server setups. Its usage is quite simple:: + + import os + from werkzeug.middleware.shared_data import SharedDataMiddleware + + app = SharedDataMiddleware(app, { + '/shared': os.path.join(os.path.dirname(__file__), 'shared') + }) + + The contents of the folder ``./shared`` will now be available on + ``http://example.com/shared/``. This is pretty useful during development + because a standalone media server is not required. Files can also be + mounted on the root folder and still continue to use the application because + the shared data middleware forwards all unhandled requests to the + application, even if the requests are below one of the shared folders. + + If `pkg_resources` is available you can also tell the middleware to serve + files from package data:: + + app = SharedDataMiddleware(app, { + '/static': ('myapplication', 'static') + }) + + This will then serve the ``static`` folder in the `myapplication` + Python package. + + The optional `disallow` parameter can be a list of :func:`~fnmatch.fnmatch` + rules for files that are not accessible from the web. If `cache` is set to + `False` no caching headers are sent. + + Currently the middleware does not support non-ASCII filenames. If the + encoding on the file system happens to match the encoding of the URI it may + work but this could also be by accident. We strongly suggest using ASCII + only file names for static files. + + The middleware will guess the mimetype using the Python `mimetype` + module. If it's unable to figure out the charset it will fall back + to `fallback_mimetype`. + + :param app: the application to wrap. If you don't want to wrap an + application you can pass it :exc:`NotFound`. + :param exports: a list or dict of exported files and folders. + :param disallow: a list of :func:`~fnmatch.fnmatch` rules. + :param cache: enable or disable caching headers. + :param cache_timeout: the cache timeout in seconds for the headers. + :param fallback_mimetype: The fallback mimetype for unknown files. + + .. versionchanged:: 1.0 + The default ``fallback_mimetype`` is + ``application/octet-stream``. If a filename looks like a text + mimetype, the ``utf-8`` charset is added to it. + + .. versionadded:: 0.6 + Added ``fallback_mimetype``. + + .. versionchanged:: 0.5 + Added ``cache_timeout``. + """ + + def __init__( + self, + app: WSGIApplication, + exports: ( + cabc.Mapping[str, str | tuple[str, str]] + | t.Iterable[tuple[str, str | tuple[str, str]]] + ), + disallow: None = None, + cache: bool = True, + cache_timeout: int = 60 * 60 * 12, + fallback_mimetype: str = "application/octet-stream", + ) -> None: + self.app = app + self.exports: list[tuple[str, _TLoader]] = [] + self.cache = cache + self.cache_timeout = cache_timeout + + if isinstance(exports, cabc.Mapping): + exports = exports.items() + + for key, value in exports: + if isinstance(value, tuple): + loader = self.get_package_loader(*value) + elif isinstance(value, str): + if os.path.isfile(value): + loader = self.get_file_loader(value) + else: + loader = self.get_directory_loader(value) + else: + raise TypeError(f"unknown def {value!r}") + + self.exports.append((key, loader)) + + if disallow is not None: + from fnmatch import fnmatch + + self.is_allowed = lambda x: not fnmatch(x, disallow) + + self.fallback_mimetype = fallback_mimetype + + def is_allowed(self, filename: str) -> bool: + """Subclasses can override this method to disallow the access to + certain files. However by providing `disallow` in the constructor + this method is overwritten. + """ + return True + + def _opener(self, filename: str) -> _TOpener: + return lambda: ( + open(filename, "rb"), + datetime.fromtimestamp(os.path.getmtime(filename), tz=timezone.utc), + int(os.path.getsize(filename)), + ) + + def get_file_loader(self, filename: str) -> _TLoader: + return lambda x: (os.path.basename(filename), self._opener(filename)) + + def get_package_loader(self, package: str, package_path: str) -> _TLoader: + load_time = datetime.now(timezone.utc) + spec = importlib.util.find_spec(package) + reader = spec.loader.get_resource_reader(package) # type: ignore[union-attr] + + def loader( + path: str | None, + ) -> tuple[str | None, _TOpener | None]: + if path is None: + return None, None + + path = safe_join(package_path, path) + + if path is None: + return None, None + + basename = posixpath.basename(path) + + try: + resource = reader.open_resource(path) + except OSError: + return None, None + + if isinstance(resource, BytesIO): + return ( + basename, + lambda: (resource, load_time, len(resource.getvalue())), + ) + + return ( + basename, + lambda: ( + resource, + datetime.fromtimestamp( + os.path.getmtime(resource.name), tz=timezone.utc + ), + os.path.getsize(resource.name), + ), + ) + + return loader + + def get_directory_loader(self, directory: str) -> _TLoader: + def loader( + path: str | None, + ) -> tuple[str | None, _TOpener | None]: + if path is not None: + path = safe_join(directory, path) + + if path is None: + return None, None + else: + path = directory + + if os.path.isfile(path): + return os.path.basename(path), self._opener(path) + + return None, None + + return loader + + def generate_etag(self, mtime: datetime, file_size: int, real_filename: str) -> str: + fn_str = os.fsencode(real_filename) + timestamp = mtime.timestamp() + checksum = adler32(fn_str) & 0xFFFFFFFF + return f"wzsdm-{timestamp}-{file_size}-{checksum}" + + def __call__( + self, environ: WSGIEnvironment, start_response: StartResponse + ) -> t.Iterable[bytes]: + path = get_path_info(environ) + file_loader = None + + for search_path, loader in self.exports: + if search_path == path: + real_filename, file_loader = loader(None) + + if file_loader is not None: + break + + if not search_path.endswith("/"): + search_path += "/" + + if path.startswith(search_path): + real_filename, file_loader = loader(path[len(search_path) :]) + + if file_loader is not None: + break + + if file_loader is None or not self.is_allowed(real_filename): # type: ignore + return self.app(environ, start_response) + + guessed_type = mimetypes.guess_type(real_filename) # type: ignore + mime_type = get_content_type(guessed_type[0] or self.fallback_mimetype, "utf-8") + f, mtime, file_size = file_loader() + + headers = [("Date", http_date())] + + if self.cache: + timeout = self.cache_timeout + etag = self.generate_etag(mtime, file_size, real_filename) # type: ignore + headers += [ + ("Etag", f'"{etag}"'), + ("Cache-Control", f"max-age={timeout}, public"), + ] + + if not is_resource_modified(environ, etag, last_modified=mtime): + f.close() + start_response("304 Not Modified", headers) + return [] + + headers.append(("Expires", http_date(time() + timeout))) + else: + headers.append(("Cache-Control", "public")) + + headers.extend( + ( + ("Content-Type", mime_type), + ("Content-Length", str(file_size)), + ("Last-Modified", http_date(mtime)), + ) + ) + start_response("200 OK", headers) + return wrap_file(environ, f) diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/werkzeug/py.typed b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/werkzeug/py.typed new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/werkzeug/routing/__init__.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/werkzeug/routing/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..62adc48fb03b5500e1e28f6887cc6ed582beb387 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/werkzeug/routing/__init__.py @@ -0,0 +1,134 @@ +"""When it comes to combining multiple controller or view functions +(however you want to call them) you need a dispatcher. A simple way +would be applying regular expression tests on the ``PATH_INFO`` and +calling registered callback functions that return the value then. + +This module implements a much more powerful system than simple regular +expression matching because it can also convert values in the URLs and +build URLs. + +Here a simple example that creates a URL map for an application with +two subdomains (www and kb) and some URL rules: + +.. code-block:: python + + m = Map([ + # Static URLs + Rule('/', endpoint='static/index'), + Rule('/about', endpoint='static/about'), + Rule('/help', endpoint='static/help'), + # Knowledge Base + Subdomain('kb', [ + Rule('/', endpoint='kb/index'), + Rule('/browse/', endpoint='kb/browse'), + Rule('/browse//', endpoint='kb/browse'), + Rule('/browse//', endpoint='kb/browse') + ]) + ], default_subdomain='www') + +If the application doesn't use subdomains it's perfectly fine to not set +the default subdomain and not use the `Subdomain` rule factory. The +endpoint in the rules can be anything, for example import paths or +unique identifiers. The WSGI application can use those endpoints to get the +handler for that URL. It doesn't have to be a string at all but it's +recommended. + +Now it's possible to create a URL adapter for one of the subdomains and +build URLs: + +.. code-block:: python + + c = m.bind('example.com') + + c.build("kb/browse", dict(id=42)) + 'http://kb.example.com/browse/42/' + + c.build("kb/browse", dict()) + 'http://kb.example.com/browse/' + + c.build("kb/browse", dict(id=42, page=3)) + 'http://kb.example.com/browse/42/3' + + c.build("static/about") + '/about' + + c.build("static/index", force_external=True) + 'http://www.example.com/' + + c = m.bind('example.com', subdomain='kb') + + c.build("static/about") + 'http://www.example.com/about' + +The first argument to bind is the server name *without* the subdomain. +Per default it will assume that the script is mounted on the root, but +often that's not the case so you can provide the real mount point as +second argument: + +.. code-block:: python + + c = m.bind('example.com', '/applications/example') + +The third argument can be the subdomain, if not given the default +subdomain is used. For more details about binding have a look at the +documentation of the `MapAdapter`. + +And here is how you can match URLs: + +.. code-block:: python + + c = m.bind('example.com') + + c.match("/") + ('static/index', {}) + + c.match("/about") + ('static/about', {}) + + c = m.bind('example.com', '/', 'kb') + + c.match("/") + ('kb/index', {}) + + c.match("/browse/42/23") + ('kb/browse', {'id': 42, 'page': 23}) + +If matching fails you get a ``NotFound`` exception, if the rule thinks +it's a good idea to redirect (for example because the URL was defined +to have a slash at the end but the request was missing that slash) it +will raise a ``RequestRedirect`` exception. Both are subclasses of +``HTTPException`` so you can use those errors as responses in the +application. + +If matching succeeded but the URL rule was incompatible to the given +method (for example there were only rules for ``GET`` and ``HEAD`` but +routing tried to match a ``POST`` request) a ``MethodNotAllowed`` +exception is raised. +""" + +from .converters import AnyConverter as AnyConverter +from .converters import BaseConverter as BaseConverter +from .converters import FloatConverter as FloatConverter +from .converters import IntegerConverter as IntegerConverter +from .converters import PathConverter as PathConverter +from .converters import UnicodeConverter as UnicodeConverter +from .converters import UUIDConverter as UUIDConverter +from .converters import ValidationError as ValidationError +from .exceptions import BuildError as BuildError +from .exceptions import NoMatch as NoMatch +from .exceptions import RequestAliasRedirect as RequestAliasRedirect +from .exceptions import RequestPath as RequestPath +from .exceptions import RequestRedirect as RequestRedirect +from .exceptions import RoutingException as RoutingException +from .exceptions import WebsocketMismatch as WebsocketMismatch +from .map import Map as Map +from .map import MapAdapter as MapAdapter +from .matcher import StateMachineMatcher as StateMachineMatcher +from .rules import EndpointPrefix as EndpointPrefix +from .rules import parse_converter_args as parse_converter_args +from .rules import Rule as Rule +from .rules import RuleFactory as RuleFactory +from .rules import RuleTemplate as RuleTemplate +from .rules import RuleTemplateFactory as RuleTemplateFactory +from .rules import Subdomain as Subdomain +from .rules import Submount as Submount diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/werkzeug/routing/converters.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/werkzeug/routing/converters.py new file mode 100644 index 0000000000000000000000000000000000000000..6016a975edf0f2e830728d906f268cab336b8c0e --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/werkzeug/routing/converters.py @@ -0,0 +1,261 @@ +from __future__ import annotations + +import re +import typing as t +import uuid +from urllib.parse import quote + +if t.TYPE_CHECKING: + from .map import Map + + +class ValidationError(ValueError): + """Validation error. If a rule converter raises this exception the rule + does not match the current URL and the next URL is tried. + """ + + +class BaseConverter: + """Base class for all converters. + + .. versionchanged:: 2.3 + ``part_isolating`` defaults to ``False`` if ``regex`` contains a ``/``. + """ + + regex = "[^/]+" + weight = 100 + part_isolating = True + + def __init_subclass__(cls, **kwargs: t.Any) -> None: + super().__init_subclass__(**kwargs) + + # If the converter isn't inheriting its regex, disable part_isolating by default + # if the regex contains a / character. + if "regex" in cls.__dict__ and "part_isolating" not in cls.__dict__: + cls.part_isolating = "/" not in cls.regex + + def __init__(self, map: Map, *args: t.Any, **kwargs: t.Any) -> None: + self.map = map + + def to_python(self, value: str) -> t.Any: + return value + + def to_url(self, value: t.Any) -> str: + # safe = https://url.spec.whatwg.org/#url-path-segment-string + return quote(str(value), safe="!$&'()*+,/:;=@") + + +class UnicodeConverter(BaseConverter): + """This converter is the default converter and accepts any string but + only one path segment. Thus the string can not include a slash. + + This is the default validator. + + Example:: + + Rule('/pages/'), + Rule('/') + + :param map: the :class:`Map`. + :param minlength: the minimum length of the string. Must be greater + or equal 1. + :param maxlength: the maximum length of the string. + :param length: the exact length of the string. + """ + + def __init__( + self, + map: Map, + minlength: int = 1, + maxlength: int | None = None, + length: int | None = None, + ) -> None: + super().__init__(map) + if length is not None: + length_regex = f"{{{int(length)}}}" + else: + if maxlength is None: + maxlength_value = "" + else: + maxlength_value = str(int(maxlength)) + length_regex = f"{{{int(minlength)},{maxlength_value}}}" + self.regex = f"[^/]{length_regex}" + + +class AnyConverter(BaseConverter): + """Matches one of the items provided. Items can either be Python + identifiers or strings:: + + Rule('/') + + :param map: the :class:`Map`. + :param items: this function accepts the possible items as positional + arguments. + + .. versionchanged:: 2.2 + Value is validated when building a URL. + """ + + def __init__(self, map: Map, *items: str) -> None: + super().__init__(map) + self.items = set(items) + self.regex = f"(?:{'|'.join([re.escape(x) for x in items])})" + + def to_url(self, value: t.Any) -> str: + if value in self.items: + return str(value) + + valid_values = ", ".join(f"'{item}'" for item in sorted(self.items)) + raise ValueError(f"'{value}' is not one of {valid_values}") + + +class PathConverter(BaseConverter): + """Like the default :class:`UnicodeConverter`, but it also matches + slashes. This is useful for wikis and similar applications:: + + Rule('/') + Rule('//edit') + + :param map: the :class:`Map`. + """ + + part_isolating = False + regex = "[^/].*?" + weight = 200 + + +class NumberConverter(BaseConverter): + """Baseclass for `IntegerConverter` and `FloatConverter`. + + :internal: + """ + + weight = 50 + num_convert: t.Callable[[t.Any], t.Any] = int + + def __init__( + self, + map: Map, + fixed_digits: int = 0, + min: int | None = None, + max: int | None = None, + signed: bool = False, + ) -> None: + if signed: + self.regex = self.signed_regex + super().__init__(map) + self.fixed_digits = fixed_digits + self.min = min + self.max = max + self.signed = signed + + def to_python(self, value: str) -> t.Any: + if self.fixed_digits and len(value) != self.fixed_digits: + raise ValidationError() + value_num = self.num_convert(value) + if (self.min is not None and value_num < self.min) or ( + self.max is not None and value_num > self.max + ): + raise ValidationError() + return value_num + + def to_url(self, value: t.Any) -> str: + value_str = str(self.num_convert(value)) + if self.fixed_digits: + value_str = value_str.zfill(self.fixed_digits) + return value_str + + @property + def signed_regex(self) -> str: + return f"-?{self.regex}" + + +class IntegerConverter(NumberConverter): + """This converter only accepts integer values:: + + Rule("/page/") + + By default it only accepts unsigned, positive values. The ``signed`` + parameter will enable signed, negative values. :: + + Rule("/page/") + + :param map: The :class:`Map`. + :param fixed_digits: The number of fixed digits in the URL. If you + set this to ``4`` for example, the rule will only match if the + URL looks like ``/0001/``. The default is variable length. + :param min: The minimal value. + :param max: The maximal value. + :param signed: Allow signed (negative) values. + + .. versionadded:: 0.15 + The ``signed`` parameter. + """ + + regex = r"\d+" + + +class FloatConverter(NumberConverter): + """This converter only accepts floating point values:: + + Rule("/probability/") + + By default it only accepts unsigned, positive values. The ``signed`` + parameter will enable signed, negative values. :: + + Rule("/offset/") + + :param map: The :class:`Map`. + :param min: The minimal value. + :param max: The maximal value. + :param signed: Allow signed (negative) values. + + .. versionadded:: 0.15 + The ``signed`` parameter. + """ + + regex = r"\d+\.\d+" + num_convert = float + + def __init__( + self, + map: Map, + min: float | None = None, + max: float | None = None, + signed: bool = False, + ) -> None: + super().__init__(map, min=min, max=max, signed=signed) # type: ignore + + +class UUIDConverter(BaseConverter): + """This converter only accepts UUID strings:: + + Rule('/object/') + + .. versionadded:: 0.10 + + :param map: the :class:`Map`. + """ + + regex = ( + r"[A-Fa-f0-9]{8}-[A-Fa-f0-9]{4}-" + r"[A-Fa-f0-9]{4}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{12}" + ) + + def to_python(self, value: str) -> uuid.UUID: + return uuid.UUID(value) + + def to_url(self, value: uuid.UUID) -> str: + return str(value) + + +#: the default converter mapping for the map. +DEFAULT_CONVERTERS: t.Mapping[str, type[BaseConverter]] = { + "default": UnicodeConverter, + "string": UnicodeConverter, + "any": AnyConverter, + "path": PathConverter, + "int": IntegerConverter, + "float": FloatConverter, + "uuid": UUIDConverter, +} diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/werkzeug/routing/exceptions.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/werkzeug/routing/exceptions.py new file mode 100644 index 0000000000000000000000000000000000000000..eeabd4ed12f6828778c55588e6ddccd0b1f9240c --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/werkzeug/routing/exceptions.py @@ -0,0 +1,152 @@ +from __future__ import annotations + +import difflib +import typing as t + +from ..exceptions import BadRequest +from ..exceptions import HTTPException +from ..utils import cached_property +from ..utils import redirect + +if t.TYPE_CHECKING: + from _typeshed.wsgi import WSGIEnvironment + + from ..wrappers.request import Request + from ..wrappers.response import Response + from .map import MapAdapter + from .rules import Rule + + +class RoutingException(Exception): + """Special exceptions that require the application to redirect, notifying + about missing urls, etc. + + :internal: + """ + + +class RequestRedirect(HTTPException, RoutingException): + """Raise if the map requests a redirect. This is for example the case if + `strict_slashes` are activated and an url that requires a trailing slash. + + The attribute `new_url` contains the absolute destination url. + """ + + code = 308 + + def __init__(self, new_url: str) -> None: + super().__init__(new_url) + self.new_url = new_url + + def get_response( + self, + environ: WSGIEnvironment | Request | None = None, + scope: dict[str, t.Any] | None = None, + ) -> Response: + return redirect(self.new_url, self.code) + + +class RequestPath(RoutingException): + """Internal exception.""" + + __slots__ = ("path_info",) + + def __init__(self, path_info: str) -> None: + super().__init__() + self.path_info = path_info + + +class RequestAliasRedirect(RoutingException): # noqa: B903 + """This rule is an alias and wants to redirect to the canonical URL.""" + + def __init__(self, matched_values: t.Mapping[str, t.Any], endpoint: t.Any) -> None: + super().__init__() + self.matched_values = matched_values + self.endpoint = endpoint + + +class BuildError(RoutingException, LookupError): + """Raised if the build system cannot find a URL for an endpoint with the + values provided. + """ + + def __init__( + self, + endpoint: t.Any, + values: t.Mapping[str, t.Any], + method: str | None, + adapter: MapAdapter | None = None, + ) -> None: + super().__init__(endpoint, values, method) + self.endpoint = endpoint + self.values = values + self.method = method + self.adapter = adapter + + @cached_property + def suggested(self) -> Rule | None: + return self.closest_rule(self.adapter) + + def closest_rule(self, adapter: MapAdapter | None) -> Rule | None: + def _score_rule(rule: Rule) -> float: + return sum( + [ + 0.98 + * difflib.SequenceMatcher( + # endpoints can be any type, compare as strings + None, + str(rule.endpoint), + str(self.endpoint), + ).ratio(), + 0.01 * bool(set(self.values or ()).issubset(rule.arguments)), + 0.01 * bool(rule.methods and self.method in rule.methods), + ] + ) + + if adapter and adapter.map._rules: + return max(adapter.map._rules, key=_score_rule) + + return None + + def __str__(self) -> str: + message = [f"Could not build url for endpoint {self.endpoint!r}"] + if self.method: + message.append(f" ({self.method!r})") + if self.values: + message.append(f" with values {sorted(self.values)!r}") + message.append(".") + if self.suggested: + if self.endpoint == self.suggested.endpoint: + if ( + self.method + and self.suggested.methods is not None + and self.method not in self.suggested.methods + ): + message.append( + " Did you mean to use methods" + f" {sorted(self.suggested.methods)!r}?" + ) + missing_values = self.suggested.arguments.union( + set(self.suggested.defaults or ()) + ) - set(self.values.keys()) + if missing_values: + message.append( + f" Did you forget to specify values {sorted(missing_values)!r}?" + ) + else: + message.append(f" Did you mean {self.suggested.endpoint!r} instead?") + return "".join(message) + + +class WebsocketMismatch(BadRequest): + """The only matched rule is either a WebSocket and the request is + HTTP, or the rule is HTTP and the request is a WebSocket. + """ + + +class NoMatch(Exception): + __slots__ = ("have_match_for", "websocket_mismatch") + + def __init__(self, have_match_for: set[str], websocket_mismatch: bool) -> None: + self.have_match_for = have_match_for + self.websocket_mismatch = websocket_mismatch diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/werkzeug/routing/map.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/werkzeug/routing/map.py new file mode 100644 index 0000000000000000000000000000000000000000..c86f95a3b38fb3320ea7f1995faafe6b22aa22bc --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/werkzeug/routing/map.py @@ -0,0 +1,928 @@ +from __future__ import annotations + +import typing as t +import warnings +from pprint import pformat +from threading import Lock +from urllib.parse import quote +from urllib.parse import urljoin +from urllib.parse import urlunsplit + +from .._internal import _get_environ +from .._internal import _wsgi_decoding_dance +from ..datastructures import ImmutableDict +from ..datastructures import MultiDict +from ..exceptions import BadHost +from ..exceptions import HTTPException +from ..exceptions import MethodNotAllowed +from ..exceptions import NotFound +from ..urls import _urlencode +from ..wsgi import get_host +from .converters import DEFAULT_CONVERTERS +from .exceptions import BuildError +from .exceptions import NoMatch +from .exceptions import RequestAliasRedirect +from .exceptions import RequestPath +from .exceptions import RequestRedirect +from .exceptions import WebsocketMismatch +from .matcher import StateMachineMatcher +from .rules import _simple_rule_re +from .rules import Rule + +if t.TYPE_CHECKING: + from _typeshed.wsgi import WSGIApplication + from _typeshed.wsgi import WSGIEnvironment + + from ..wrappers.request import Request + from .converters import BaseConverter + from .rules import RuleFactory + + +class Map: + """The map class stores all the URL rules and some configuration + parameters. Some of the configuration values are only stored on the + `Map` instance since those affect all rules, others are just defaults + and can be overridden for each rule. Note that you have to specify all + arguments besides the `rules` as keyword arguments! + + :param rules: sequence of url rules for this map. + :param default_subdomain: The default subdomain for rules without a + subdomain defined. + :param strict_slashes: If a rule ends with a slash but the matched + URL does not, redirect to the URL with a trailing slash. + :param merge_slashes: Merge consecutive slashes when matching or + building URLs. Matches will redirect to the normalized URL. + Slashes in variable parts are not merged. + :param redirect_defaults: This will redirect to the default rule if it + wasn't visited that way. This helps creating + unique URLs. + :param converters: A dict of converters that adds additional converters + to the list of converters. If you redefine one + converter this will override the original one. + :param sort_parameters: If set to `True` the url parameters are sorted. + See `url_encode` for more details. + :param sort_key: The sort key function for `url_encode`. + :param host_matching: if set to `True` it enables the host matching + feature and disables the subdomain one. If + enabled the `host` parameter to rules is used + instead of the `subdomain` one. + + .. versionchanged:: 3.0 + The ``charset`` and ``encoding_errors`` parameters were removed. + + .. versionchanged:: 1.0 + If ``url_scheme`` is ``ws`` or ``wss``, only WebSocket rules will match. + + .. versionchanged:: 1.0 + The ``merge_slashes`` parameter was added. + + .. versionchanged:: 0.7 + The ``encoding_errors`` and ``host_matching`` parameters were added. + + .. versionchanged:: 0.5 + The ``sort_parameters`` and ``sort_key`` parameters were added. + """ + + #: A dict of default converters to be used. + default_converters = ImmutableDict(DEFAULT_CONVERTERS) + + #: The type of lock to use when updating. + #: + #: .. versionadded:: 1.0 + lock_class = Lock + + def __init__( + self, + rules: t.Iterable[RuleFactory] | None = None, + default_subdomain: str = "", + strict_slashes: bool = True, + merge_slashes: bool = True, + redirect_defaults: bool = True, + converters: t.Mapping[str, type[BaseConverter]] | None = None, + sort_parameters: bool = False, + sort_key: t.Callable[[t.Any], t.Any] | None = None, + host_matching: bool = False, + ) -> None: + self._matcher = StateMachineMatcher(merge_slashes) + self._rules_by_endpoint: dict[t.Any, list[Rule]] = {} + self._remap = True + self._remap_lock = self.lock_class() + + self.default_subdomain = default_subdomain + self.strict_slashes = strict_slashes + self.redirect_defaults = redirect_defaults + self.host_matching = host_matching + + self.converters = self.default_converters.copy() + if converters: + self.converters.update(converters) + + self.sort_parameters = sort_parameters + self.sort_key = sort_key + + for rulefactory in rules or (): + self.add(rulefactory) + + @property + def merge_slashes(self) -> bool: + return self._matcher.merge_slashes + + @merge_slashes.setter + def merge_slashes(self, value: bool) -> None: + self._matcher.merge_slashes = value + + def is_endpoint_expecting(self, endpoint: t.Any, *arguments: str) -> bool: + """Iterate over all rules and check if the endpoint expects + the arguments provided. This is for example useful if you have + some URLs that expect a language code and others that do not and + you want to wrap the builder a bit so that the current language + code is automatically added if not provided but endpoints expect + it. + + :param endpoint: the endpoint to check. + :param arguments: this function accepts one or more arguments + as positional arguments. Each one of them is + checked. + """ + self.update() + arguments_set = set(arguments) + for rule in self._rules_by_endpoint[endpoint]: + if arguments_set.issubset(rule.arguments): + return True + return False + + @property + def _rules(self) -> list[Rule]: + return [rule for rules in self._rules_by_endpoint.values() for rule in rules] + + def iter_rules(self, endpoint: t.Any | None = None) -> t.Iterator[Rule]: + """Iterate over all rules or the rules of an endpoint. + + :param endpoint: if provided only the rules for that endpoint + are returned. + :return: an iterator + """ + self.update() + if endpoint is not None: + return iter(self._rules_by_endpoint[endpoint]) + return iter(self._rules) + + def add(self, rulefactory: RuleFactory) -> None: + """Add a new rule or factory to the map and bind it. Requires that the + rule is not bound to another map. + + :param rulefactory: a :class:`Rule` or :class:`RuleFactory` + """ + for rule in rulefactory.get_rules(self): + rule.bind(self) + if not rule.build_only: + self._matcher.add(rule) + self._rules_by_endpoint.setdefault(rule.endpoint, []).append(rule) + self._remap = True + + def bind( + self, + server_name: str, + script_name: str | None = None, + subdomain: str | None = None, + url_scheme: str = "http", + default_method: str = "GET", + path_info: str | None = None, + query_args: t.Mapping[str, t.Any] | str | None = None, + ) -> MapAdapter: + """Return a new :class:`MapAdapter` with the details specified to the + call. Note that `script_name` will default to ``'/'`` if not further + specified or `None`. The `server_name` at least is a requirement + because the HTTP RFC requires absolute URLs for redirects and so all + redirect exceptions raised by Werkzeug will contain the full canonical + URL. + + If no path_info is passed to :meth:`match` it will use the default path + info passed to bind. While this doesn't really make sense for + manual bind calls, it's useful if you bind a map to a WSGI + environment which already contains the path info. + + `subdomain` will default to the `default_subdomain` for this map if + no defined. If there is no `default_subdomain` you cannot use the + subdomain feature. + + .. versionchanged:: 1.0 + If ``url_scheme`` is ``ws`` or ``wss``, only WebSocket rules + will match. + + .. versionchanged:: 0.15 + ``path_info`` defaults to ``'/'`` if ``None``. + + .. versionchanged:: 0.8 + ``query_args`` can be a string. + + .. versionchanged:: 0.7 + Added ``query_args``. + """ + server_name = server_name.lower() + if self.host_matching: + if subdomain is not None: + raise RuntimeError("host matching enabled and a subdomain was provided") + elif subdomain is None: + subdomain = self.default_subdomain + if script_name is None: + script_name = "/" + if path_info is None: + path_info = "/" + + # Port isn't part of IDNA, and might push a name over the 63 octet limit. + server_name, port_sep, port = server_name.partition(":") + + try: + server_name = server_name.encode("idna").decode("ascii") + except UnicodeError as e: + raise BadHost() from e + + return MapAdapter( + self, + f"{server_name}{port_sep}{port}", + script_name, + subdomain, + url_scheme, + path_info, + default_method, + query_args, + ) + + def bind_to_environ( + self, + environ: WSGIEnvironment | Request, + server_name: str | None = None, + subdomain: str | None = None, + ) -> MapAdapter: + """Like :meth:`bind` but you can pass it an WSGI environment and it + will fetch the information from that dictionary. Note that because of + limitations in the protocol there is no way to get the current + subdomain and real `server_name` from the environment. If you don't + provide it, Werkzeug will use `SERVER_NAME` and `SERVER_PORT` (or + `HTTP_HOST` if provided) as used `server_name` with disabled subdomain + feature. + + If `subdomain` is `None` but an environment and a server name is + provided it will calculate the current subdomain automatically. + Example: `server_name` is ``'example.com'`` and the `SERVER_NAME` + in the wsgi `environ` is ``'staging.dev.example.com'`` the calculated + subdomain will be ``'staging.dev'``. + + If the object passed as environ has an environ attribute, the value of + this attribute is used instead. This allows you to pass request + objects. Additionally `PATH_INFO` added as a default of the + :class:`MapAdapter` so that you don't have to pass the path info to + the match method. + + .. versionchanged:: 1.0.0 + If the passed server name specifies port 443, it will match + if the incoming scheme is ``https`` without a port. + + .. versionchanged:: 1.0.0 + A warning is shown when the passed server name does not + match the incoming WSGI server name. + + .. versionchanged:: 0.8 + This will no longer raise a ValueError when an unexpected server + name was passed. + + .. versionchanged:: 0.5 + previously this method accepted a bogus `calculate_subdomain` + parameter that did not have any effect. It was removed because + of that. + + :param environ: a WSGI environment. + :param server_name: an optional server name hint (see above). + :param subdomain: optionally the current subdomain (see above). + """ + env = _get_environ(environ) + wsgi_server_name = get_host(env).lower() + scheme = env["wsgi.url_scheme"] + upgrade = any( + v.strip() == "upgrade" + for v in env.get("HTTP_CONNECTION", "").lower().split(",") + ) + + if upgrade and env.get("HTTP_UPGRADE", "").lower() == "websocket": + scheme = "wss" if scheme == "https" else "ws" + + if server_name is None: + server_name = wsgi_server_name + else: + server_name = server_name.lower() + + # strip standard port to match get_host() + if scheme in {"http", "ws"} and server_name.endswith(":80"): + server_name = server_name[:-3] + elif scheme in {"https", "wss"} and server_name.endswith(":443"): + server_name = server_name[:-4] + + if subdomain is None and not self.host_matching: + cur_server_name = wsgi_server_name.split(".") + real_server_name = server_name.split(".") + offset = -len(real_server_name) + + if cur_server_name[offset:] != real_server_name: + # This can happen even with valid configs if the server was + # accessed directly by IP address under some situations. + # Instead of raising an exception like in Werkzeug 0.7 or + # earlier we go by an invalid subdomain which will result + # in a 404 error on matching. + warnings.warn( + f"Current server name {wsgi_server_name!r} doesn't match configured" + f" server name {server_name!r}", + stacklevel=2, + ) + subdomain = "" + else: + subdomain = ".".join(filter(None, cur_server_name[:offset])) + + def _get_wsgi_string(name: str) -> str | None: + val = env.get(name) + if val is not None: + return _wsgi_decoding_dance(val) + return None + + script_name = _get_wsgi_string("SCRIPT_NAME") + path_info = _get_wsgi_string("PATH_INFO") + query_args = _get_wsgi_string("QUERY_STRING") + return Map.bind( + self, + server_name, + script_name, + subdomain, + scheme, + env["REQUEST_METHOD"], + path_info, + query_args=query_args, + ) + + def update(self) -> None: + """Called before matching and building to keep the compiled rules + in the correct order after things changed. + """ + if not self._remap: + return + + with self._remap_lock: + if not self._remap: + return + + self._matcher.update() + for rules in self._rules_by_endpoint.values(): + rules.sort(key=lambda x: x.build_compare_key()) + self._remap = False + + def __repr__(self) -> str: + rules = self.iter_rules() + return f"{type(self).__name__}({pformat(list(rules))})" + + +class MapAdapter: + """Returned by :meth:`Map.bind` or :meth:`Map.bind_to_environ` and does + the URL matching and building based on runtime information. + """ + + def __init__( + self, + map: Map, + server_name: str, + script_name: str, + subdomain: str | None, + url_scheme: str, + path_info: str, + default_method: str, + query_args: t.Mapping[str, t.Any] | str | None = None, + ): + self.map = map + self.server_name = server_name + + if not script_name.endswith("/"): + script_name += "/" + + self.script_name = script_name + self.subdomain = subdomain + self.url_scheme = url_scheme + self.path_info = path_info + self.default_method = default_method + self.query_args = query_args + self.websocket = self.url_scheme in {"ws", "wss"} + + def dispatch( + self, + view_func: t.Callable[[str, t.Mapping[str, t.Any]], WSGIApplication], + path_info: str | None = None, + method: str | None = None, + catch_http_exceptions: bool = False, + ) -> WSGIApplication: + """Does the complete dispatching process. `view_func` is called with + the endpoint and a dict with the values for the view. It should + look up the view function, call it, and return a response object + or WSGI application. http exceptions are not caught by default + so that applications can display nicer error messages by just + catching them by hand. If you want to stick with the default + error messages you can pass it ``catch_http_exceptions=True`` and + it will catch the http exceptions. + + Here a small example for the dispatch usage:: + + from werkzeug.wrappers import Request, Response + from werkzeug.wsgi import responder + from werkzeug.routing import Map, Rule + + def on_index(request): + return Response('Hello from the index') + + url_map = Map([Rule('/', endpoint='index')]) + views = {'index': on_index} + + @responder + def application(environ, start_response): + request = Request(environ) + urls = url_map.bind_to_environ(environ) + return urls.dispatch(lambda e, v: views[e](request, **v), + catch_http_exceptions=True) + + Keep in mind that this method might return exception objects, too, so + use :class:`Response.force_type` to get a response object. + + :param view_func: a function that is called with the endpoint as + first argument and the value dict as second. Has + to dispatch to the actual view function with this + information. (see above) + :param path_info: the path info to use for matching. Overrides the + path info specified on binding. + :param method: the HTTP method used for matching. Overrides the + method specified on binding. + :param catch_http_exceptions: set to `True` to catch any of the + werkzeug :class:`HTTPException`\\s. + """ + try: + try: + endpoint, args = self.match(path_info, method) + except RequestRedirect as e: + return e + return view_func(endpoint, args) + except HTTPException as e: + if catch_http_exceptions: + return e + raise + + @t.overload + def match( + self, + path_info: str | None = None, + method: str | None = None, + return_rule: t.Literal[False] = False, + query_args: t.Mapping[str, t.Any] | str | None = None, + websocket: bool | None = None, + ) -> tuple[t.Any, t.Mapping[str, t.Any]]: ... + + @t.overload + def match( + self, + path_info: str | None = None, + method: str | None = None, + return_rule: t.Literal[True] = True, + query_args: t.Mapping[str, t.Any] | str | None = None, + websocket: bool | None = None, + ) -> tuple[Rule, t.Mapping[str, t.Any]]: ... + + def match( + self, + path_info: str | None = None, + method: str | None = None, + return_rule: bool = False, + query_args: t.Mapping[str, t.Any] | str | None = None, + websocket: bool | None = None, + ) -> tuple[t.Any | Rule, t.Mapping[str, t.Any]]: + """The usage is simple: you just pass the match method the current + path info as well as the method (which defaults to `GET`). The + following things can then happen: + + - you receive a `NotFound` exception that indicates that no URL is + matching. A `NotFound` exception is also a WSGI application you + can call to get a default page not found page (happens to be the + same object as `werkzeug.exceptions.NotFound`) + + - you receive a `MethodNotAllowed` exception that indicates that there + is a match for this URL but not for the current request method. + This is useful for RESTful applications. + + - you receive a `RequestRedirect` exception with a `new_url` + attribute. This exception is used to notify you about a request + Werkzeug requests from your WSGI application. This is for example the + case if you request ``/foo`` although the correct URL is ``/foo/`` + You can use the `RequestRedirect` instance as response-like object + similar to all other subclasses of `HTTPException`. + + - you receive a ``WebsocketMismatch`` exception if the only + match is a WebSocket rule but the bind is an HTTP request, or + if the match is an HTTP rule but the bind is a WebSocket + request. + + - you get a tuple in the form ``(endpoint, arguments)`` if there is + a match (unless `return_rule` is True, in which case you get a tuple + in the form ``(rule, arguments)``) + + If the path info is not passed to the match method the default path + info of the map is used (defaults to the root URL if not defined + explicitly). + + All of the exceptions raised are subclasses of `HTTPException` so they + can be used as WSGI responses. They will all render generic error or + redirect pages. + + Here is a small example for matching: + + >>> m = Map([ + ... Rule('/', endpoint='index'), + ... Rule('/downloads/', endpoint='downloads/index'), + ... Rule('/downloads/', endpoint='downloads/show') + ... ]) + >>> urls = m.bind("example.com", "/") + >>> urls.match("/", "GET") + ('index', {}) + >>> urls.match("/downloads/42") + ('downloads/show', {'id': 42}) + + And here is what happens on redirect and missing URLs: + + >>> urls.match("/downloads") + Traceback (most recent call last): + ... + RequestRedirect: http://example.com/downloads/ + >>> urls.match("/missing") + Traceback (most recent call last): + ... + NotFound: 404 Not Found + + :param path_info: the path info to use for matching. Overrides the + path info specified on binding. + :param method: the HTTP method used for matching. Overrides the + method specified on binding. + :param return_rule: return the rule that matched instead of just the + endpoint (defaults to `False`). + :param query_args: optional query arguments that are used for + automatic redirects as string or dictionary. It's + currently not possible to use the query arguments + for URL matching. + :param websocket: Match WebSocket instead of HTTP requests. A + websocket request has a ``ws`` or ``wss`` + :attr:`url_scheme`. This overrides that detection. + + .. versionadded:: 1.0 + Added ``websocket``. + + .. versionchanged:: 0.8 + ``query_args`` can be a string. + + .. versionadded:: 0.7 + Added ``query_args``. + + .. versionadded:: 0.6 + Added ``return_rule``. + """ + self.map.update() + if path_info is None: + path_info = self.path_info + if query_args is None: + query_args = self.query_args or {} + method = (method or self.default_method).upper() + + if websocket is None: + websocket = self.websocket + + domain_part = self.server_name + + if not self.map.host_matching and self.subdomain is not None: + domain_part = self.subdomain + + path_part = f"/{path_info.lstrip('/')}" if path_info else "" + + try: + result = self.map._matcher.match(domain_part, path_part, method, websocket) + except RequestPath as e: + # safe = https://url.spec.whatwg.org/#url-path-segment-string + new_path = quote(e.path_info, safe="!$&'()*+,/:;=@") + raise RequestRedirect( + self.make_redirect_url(new_path, query_args) + ) from None + except RequestAliasRedirect as e: + raise RequestRedirect( + self.make_alias_redirect_url( + f"{domain_part}|{path_part}", + e.endpoint, + e.matched_values, + method, + query_args, + ) + ) from None + except NoMatch as e: + if e.have_match_for: + raise MethodNotAllowed(valid_methods=list(e.have_match_for)) from None + + if e.websocket_mismatch: + raise WebsocketMismatch() from None + + raise NotFound() from None + else: + rule, rv = result + + if self.map.redirect_defaults: + redirect_url = self.get_default_redirect(rule, method, rv, query_args) + if redirect_url is not None: + raise RequestRedirect(redirect_url) + + if rule.redirect_to is not None: + if isinstance(rule.redirect_to, str): + + def _handle_match(match: t.Match[str]) -> str: + value = rv[match.group(1)] + return rule._converters[match.group(1)].to_url(value) + + redirect_url = _simple_rule_re.sub(_handle_match, rule.redirect_to) + else: + redirect_url = rule.redirect_to(self, **rv) + + if self.subdomain: + netloc = f"{self.subdomain}.{self.server_name}" + else: + netloc = self.server_name + + raise RequestRedirect( + urljoin( + f"{self.url_scheme or 'http'}://{netloc}{self.script_name}", + redirect_url, + ) + ) + + if return_rule: + return rule, rv + else: + return rule.endpoint, rv + + def test(self, path_info: str | None = None, method: str | None = None) -> bool: + """Test if a rule would match. Works like `match` but returns `True` + if the URL matches, or `False` if it does not exist. + + :param path_info: the path info to use for matching. Overrides the + path info specified on binding. + :param method: the HTTP method used for matching. Overrides the + method specified on binding. + """ + try: + self.match(path_info, method) + except RequestRedirect: + pass + except HTTPException: + return False + return True + + def allowed_methods(self, path_info: str | None = None) -> t.Iterable[str]: + """Returns the valid methods that match for a given path. + + .. versionadded:: 0.7 + """ + try: + self.match(path_info, method="--") + except MethodNotAllowed as e: + return e.valid_methods # type: ignore + except HTTPException: + pass + return [] + + def get_host(self, domain_part: str | None) -> str: + """Figures out the full host name for the given domain part. The + domain part is a subdomain in case host matching is disabled or + a full host name. + """ + if self.map.host_matching: + if domain_part is None: + return self.server_name + + return domain_part + + if domain_part is None: + subdomain = self.subdomain + else: + subdomain = domain_part + + if subdomain: + return f"{subdomain}.{self.server_name}" + else: + return self.server_name + + def get_default_redirect( + self, + rule: Rule, + method: str, + values: t.MutableMapping[str, t.Any], + query_args: t.Mapping[str, t.Any] | str, + ) -> str | None: + """A helper that returns the URL to redirect to if it finds one. + This is used for default redirecting only. + + :internal: + """ + assert self.map.redirect_defaults + for r in self.map._rules_by_endpoint[rule.endpoint]: + # every rule that comes after this one, including ourself + # has a lower priority for the defaults. We order the ones + # with the highest priority up for building. + if r is rule: + break + if r.provides_defaults_for(rule) and r.suitable_for(values, method): + values.update(r.defaults) # type: ignore + domain_part, path = r.build(values) # type: ignore + return self.make_redirect_url(path, query_args, domain_part=domain_part) + return None + + def encode_query_args(self, query_args: t.Mapping[str, t.Any] | str) -> str: + if not isinstance(query_args, str): + return _urlencode(query_args) + return query_args + + def make_redirect_url( + self, + path_info: str, + query_args: t.Mapping[str, t.Any] | str | None = None, + domain_part: str | None = None, + ) -> str: + """Creates a redirect URL. + + :internal: + """ + if query_args is None: + query_args = self.query_args + + if query_args: + query_str = self.encode_query_args(query_args) + else: + query_str = None + + scheme = self.url_scheme or "http" + host = self.get_host(domain_part) + path = "/".join((self.script_name.strip("/"), path_info.lstrip("/"))) + return urlunsplit((scheme, host, path, query_str, None)) + + def make_alias_redirect_url( + self, + path: str, + endpoint: t.Any, + values: t.Mapping[str, t.Any], + method: str, + query_args: t.Mapping[str, t.Any] | str, + ) -> str: + """Internally called to make an alias redirect URL.""" + url = self.build( + endpoint, values, method, append_unknown=False, force_external=True + ) + if query_args: + url += f"?{self.encode_query_args(query_args)}" + assert url != path, "detected invalid alias setting. No canonical URL found" + return url + + def _partial_build( + self, + endpoint: t.Any, + values: t.Mapping[str, t.Any], + method: str | None, + append_unknown: bool, + ) -> tuple[str, str, bool] | None: + """Helper for :meth:`build`. Returns subdomain and path for the + rule that accepts this endpoint, values and method. + + :internal: + """ + # in case the method is none, try with the default method first + if method is None: + rv = self._partial_build( + endpoint, values, self.default_method, append_unknown + ) + if rv is not None: + return rv + + # Default method did not match or a specific method is passed. + # Check all for first match with matching host. If no matching + # host is found, go with first result. + first_match = None + + for rule in self.map._rules_by_endpoint.get(endpoint, ()): + if rule.suitable_for(values, method): + build_rv = rule.build(values, append_unknown) + + if build_rv is not None: + rv = (build_rv[0], build_rv[1], rule.websocket) + if self.map.host_matching: + if rv[0] == self.server_name: + return rv + elif first_match is None: + first_match = rv + else: + return rv + + return first_match + + def build( + self, + endpoint: t.Any, + values: t.Mapping[str, t.Any] | None = None, + method: str | None = None, + force_external: bool = False, + append_unknown: bool = True, + url_scheme: str | None = None, + ) -> str: + """Build a URL by filling in any variable slots in the endpoint's rule + with the provided values. + + This produces relative URLs (path only, no host) by default, which is + appropriate for most use cases. When using subdomain or host matching, + the URL will be absolute if the endpoint is not on the same host as the + current request. If you need an absolute URL no matter what, such as + when adding a link to an email, pass ``force_external=True``. + + Characters that are not allowed directly in URLs will be percent-encoded + using UTF-8. + + Additional values that don't match any rule parts are added to the query + (``?key=value``) part of the URL. + + If a rule is not found, an :exc:`.BuildError` is raised. Converters may + also raise exceptions when preparing a value. + + Unlike matching, building does not perform comprehensive validation of + the values, it's assumed that they are trusted and correct. It's also + possible to build a URL for one endpoint that will be matched by + another, or will not match. This is very unlikely to happen or to matter + in most applications, especially with testing. If you need a + stronger guarantee, you can use a helper to verify that + ``match(build(endpoint)) == endpoint``. + + :param endpoint: The endpoint for the rule to build. + :param values: Values for the variable parts of the rule, which will be + converted using the part's converter's + :meth:`~.BaseConverter.to_url` method. Keys that don't match + variable parts will be converted to a query string unless + ``append_unknown`` is disabled. + :param method: Further match the rule to build by this HTTP method, for + when there are multiple rules for the same endpoint that vary based + on method. + :param force_external: Always produce an absolute URL, for external use. + If ``scheme`` is not set, this produces a protocol-relative URL. + :param append_unknown: Convert values that don't match any rule parts + to a query string. Disable to ignore such values. + :param url_scheme: Scheme to use for absolute URLs. Defaults to + :attr:`url_scheme`. + + .. versionchanged:: 2.0 + Added the ``url_scheme`` parameter. + + .. versionadded:: 0.6 + Added the ``append_unknown`` parameter. + """ + self.map.update() + + if values: + if isinstance(values, MultiDict): + values = { + k: (v[0] if len(v) == 1 else v) + for k, v in dict.items(values) + if len(v) != 0 + } + else: # plain dict + values = {k: v for k, v in values.items() if v is not None} + else: + values = {} + + rv = self._partial_build(endpoint, values, method, append_unknown) + if rv is None: + raise BuildError(endpoint, values, method, self) + + domain_part, path, websocket = rv + host = self.get_host(domain_part) + + if url_scheme is None: + url_scheme = self.url_scheme + + # Always build WebSocket routes with the scheme (browsers + # require full URLs). If bound to a WebSocket, ensure that HTTP + # routes are built with an HTTP scheme. + secure = url_scheme in {"https", "wss"} + + if websocket: + force_external = True + url_scheme = "wss" if secure else "ws" + elif url_scheme: + url_scheme = "https" if secure else "http" + + # shortcut this. + if not force_external and ( + (self.map.host_matching and host == self.server_name) + or (not self.map.host_matching and domain_part == self.subdomain) + ): + return f"{self.script_name.rstrip('/')}/{path.lstrip('/')}" + + scheme = f"{url_scheme}:" if url_scheme else "" + return f"{scheme}//{host}{self.script_name[:-1]}/{path.lstrip('/')}" diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/werkzeug/routing/matcher.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/werkzeug/routing/matcher.py new file mode 100644 index 0000000000000000000000000000000000000000..1fd00efcae4958bca9ccba1cdb957c77835a3b08 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/werkzeug/routing/matcher.py @@ -0,0 +1,202 @@ +from __future__ import annotations + +import re +import typing as t +from dataclasses import dataclass +from dataclasses import field + +from .converters import ValidationError +from .exceptions import NoMatch +from .exceptions import RequestAliasRedirect +from .exceptions import RequestPath +from .rules import Rule +from .rules import RulePart + + +class SlashRequired(Exception): + pass + + +@dataclass +class State: + """A representation of a rule state. + + This includes the *rules* that correspond to the state and the + possible *static* and *dynamic* transitions to the next state. + """ + + dynamic: list[tuple[RulePart, State]] = field(default_factory=list) + rules: list[Rule] = field(default_factory=list) + static: dict[str, State] = field(default_factory=dict) + + +class StateMachineMatcher: + def __init__(self, merge_slashes: bool) -> None: + self._root = State() + self.merge_slashes = merge_slashes + + def add(self, rule: Rule) -> None: + state = self._root + for part in rule._parts: + if part.static: + state.static.setdefault(part.content, State()) + state = state.static[part.content] + else: + for test_part, new_state in state.dynamic: + if test_part == part: + state = new_state + break + else: + new_state = State() + state.dynamic.append((part, new_state)) + state = new_state + state.rules.append(rule) + + def update(self) -> None: + # For every state the dynamic transitions should be sorted by + # the weight of the transition + state = self._root + + def _update_state(state: State) -> None: + state.dynamic.sort(key=lambda entry: entry[0].weight) + for new_state in state.static.values(): + _update_state(new_state) + for _, new_state in state.dynamic: + _update_state(new_state) + + _update_state(state) + + def match( + self, domain: str, path: str, method: str, websocket: bool + ) -> tuple[Rule, t.MutableMapping[str, t.Any]]: + # To match to a rule we need to start at the root state and + # try to follow the transitions until we find a match, or find + # there is no transition to follow. + + have_match_for = set() + websocket_mismatch = False + + def _match( + state: State, parts: list[str], values: list[str] + ) -> tuple[Rule, list[str]] | None: + # This function is meant to be called recursively, and will attempt + # to match the head part to the state's transitions. + nonlocal have_match_for, websocket_mismatch + + # The base case is when all parts have been matched via + # transitions. Hence if there is a rule with methods & + # websocket that work return it and the dynamic values + # extracted. + if parts == []: + for rule in state.rules: + if rule.methods is not None and method not in rule.methods: + have_match_for.update(rule.methods) + elif rule.websocket != websocket: + websocket_mismatch = True + else: + return rule, values + + # Test if there is a match with this path with a + # trailing slash, if so raise an exception to report + # that matching is possible with an additional slash + if "" in state.static: + for rule in state.static[""].rules: + if websocket == rule.websocket and ( + rule.methods is None or method in rule.methods + ): + if rule.strict_slashes: + raise SlashRequired() + else: + return rule, values + return None + + part = parts[0] + # To match this part try the static transitions first + if part in state.static: + rv = _match(state.static[part], parts[1:], values) + if rv is not None: + return rv + # No match via the static transitions, so try the dynamic + # ones. + for test_part, new_state in state.dynamic: + target = part + remaining = parts[1:] + # A final part indicates a transition that always + # consumes the remaining parts i.e. transitions to a + # final state. + if test_part.final: + target = "/".join(parts) + remaining = [] + match = re.compile(test_part.content).match(target) + if match is not None: + if test_part.suffixed: + # If a part_isolating=False part has a slash suffix, remove the + # suffix from the match and check for the slash redirect next. + suffix = match.groups()[-1] + if suffix == "/": + remaining = [""] + + converter_groups = sorted( + match.groupdict().items(), key=lambda entry: entry[0] + ) + groups = [ + value + for key, value in converter_groups + if key[:11] == "__werkzeug_" + ] + rv = _match(new_state, remaining, values + groups) + if rv is not None: + return rv + + # If there is no match and the only part left is a + # trailing slash ("") consider rules that aren't + # strict-slashes as these should match if there is a final + # slash part. + if parts == [""]: + for rule in state.rules: + if rule.strict_slashes: + continue + if rule.methods is not None and method not in rule.methods: + have_match_for.update(rule.methods) + elif rule.websocket != websocket: + websocket_mismatch = True + else: + return rule, values + + return None + + try: + rv = _match(self._root, [domain, *path.split("/")], []) + except SlashRequired: + raise RequestPath(f"{path}/") from None + + if self.merge_slashes and rv is None: + # Try to match again, but with slashes merged + path = re.sub("/{2,}?", "/", path) + try: + rv = _match(self._root, [domain, *path.split("/")], []) + except SlashRequired: + raise RequestPath(f"{path}/") from None + if rv is None or rv[0].merge_slashes is False: + raise NoMatch(have_match_for, websocket_mismatch) + else: + raise RequestPath(f"{path}") + elif rv is not None: + rule, values = rv + + result = {} + for name, value in zip(rule._converters.keys(), values): + try: + value = rule._converters[name].to_python(value) + except ValidationError: + raise NoMatch(have_match_for, websocket_mismatch) from None + result[str(name)] = value + if rule.defaults: + result.update(rule.defaults) + + if rule.alias and rule.map.redirect_defaults: + raise RequestAliasRedirect(result, rule.endpoint) + + return rule, result + + raise NoMatch(have_match_for, websocket_mismatch) diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/werkzeug/routing/rules.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/werkzeug/routing/rules.py new file mode 100644 index 0000000000000000000000000000000000000000..9e483a54b284e6f7dcc0478a165634cc4794391d --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/werkzeug/routing/rules.py @@ -0,0 +1,928 @@ +from __future__ import annotations + +import ast +import re +import typing as t +from dataclasses import dataclass +from string import Template +from types import CodeType +from urllib.parse import quote + +from ..datastructures import iter_multi_items +from ..urls import _urlencode +from .converters import ValidationError + +if t.TYPE_CHECKING: + from .converters import BaseConverter + from .map import Map + + +class Weighting(t.NamedTuple): + number_static_weights: int + static_weights: list[tuple[int, int]] + number_argument_weights: int + argument_weights: list[int] + + +@dataclass +class RulePart: + """A part of a rule. + + Rules can be represented by parts as delimited by `/` with + instances of this class representing those parts. The *content* is + either the raw content if *static* or a regex string to match + against. The *weight* can be used to order parts when matching. + + """ + + content: str + final: bool + static: bool + suffixed: bool + weight: Weighting + + +_part_re = re.compile( + r""" + (?: + (?P/) # a slash + | + (?P[^[a-zA-Z_][a-zA-Z0-9_]*) # converter name + (?:\((?P.*?)\))? # converter arguments + : # variable delimiter + )? + (?P[a-zA-Z_][a-zA-Z0-9_]*) # variable name + > + ) + ) + """, + re.VERBOSE, +) + +_simple_rule_re = re.compile(r"<([^>]+)>") +_converter_args_re = re.compile( + r""" + \s* + ((?P\w+)\s*=\s*)? + (?P + True|False| + \d+.\d+| + \d+.| + \d+| + [\w\d_.]+| + [urUR]?(?P"[^"]*?"|'[^']*') + )\s*, + """, + re.VERBOSE, +) + + +_PYTHON_CONSTANTS = {"None": None, "True": True, "False": False} + + +def _find(value: str, target: str, pos: int) -> int: + """Find the *target* in *value* after *pos*. + + Returns the *value* length if *target* isn't found. + """ + try: + return value.index(target, pos) + except ValueError: + return len(value) + + +def _pythonize(value: str) -> None | bool | int | float | str: + if value in _PYTHON_CONSTANTS: + return _PYTHON_CONSTANTS[value] + for convert in int, float: + try: + return convert(value) + except ValueError: + pass + if value[:1] == value[-1:] and value[0] in "\"'": + value = value[1:-1] + return str(value) + + +def parse_converter_args(argstr: str) -> tuple[tuple[t.Any, ...], dict[str, t.Any]]: + argstr += "," + args = [] + kwargs = {} + position = 0 + + for item in _converter_args_re.finditer(argstr): + if item.start() != position: + raise ValueError( + f"Cannot parse converter argument '{argstr[position : item.start()]}'" + ) + + value = item.group("stringval") + if value is None: + value = item.group("value") + value = _pythonize(value) + if not item.group("name"): + args.append(value) + else: + name = item.group("name") + kwargs[name] = value + position = item.end() + + return tuple(args), kwargs + + +class RuleFactory: + """As soon as you have more complex URL setups it's a good idea to use rule + factories to avoid repetitive tasks. Some of them are builtin, others can + be added by subclassing `RuleFactory` and overriding `get_rules`. + """ + + def get_rules(self, map: Map) -> t.Iterable[Rule]: + """Subclasses of `RuleFactory` have to override this method and return + an iterable of rules.""" + raise NotImplementedError() + + +class Subdomain(RuleFactory): + """All URLs provided by this factory have the subdomain set to a + specific domain. For example if you want to use the subdomain for + the current language this can be a good setup:: + + url_map = Map([ + Rule('/', endpoint='#select_language'), + Subdomain('', [ + Rule('/', endpoint='index'), + Rule('/about', endpoint='about'), + Rule('/help', endpoint='help') + ]) + ]) + + All the rules except for the ``'#select_language'`` endpoint will now + listen on a two letter long subdomain that holds the language code + for the current request. + """ + + def __init__(self, subdomain: str, rules: t.Iterable[RuleFactory]) -> None: + self.subdomain = subdomain + self.rules = rules + + def get_rules(self, map: Map) -> t.Iterator[Rule]: + for rulefactory in self.rules: + for rule in rulefactory.get_rules(map): + rule = rule.empty() + rule.subdomain = self.subdomain + yield rule + + +class Submount(RuleFactory): + """Like `Subdomain` but prefixes the URL rule with a given string:: + + url_map = Map([ + Rule('/', endpoint='index'), + Submount('/blog', [ + Rule('/', endpoint='blog/index'), + Rule('/entry/', endpoint='blog/show') + ]) + ]) + + Now the rule ``'blog/show'`` matches ``/blog/entry/``. + """ + + def __init__(self, path: str, rules: t.Iterable[RuleFactory]) -> None: + self.path = path.rstrip("/") + self.rules = rules + + def get_rules(self, map: Map) -> t.Iterator[Rule]: + for rulefactory in self.rules: + for rule in rulefactory.get_rules(map): + rule = rule.empty() + rule.rule = self.path + rule.rule + yield rule + + +class EndpointPrefix(RuleFactory): + """Prefixes all endpoints (which must be strings for this factory) with + another string. This can be useful for sub applications:: + + url_map = Map([ + Rule('/', endpoint='index'), + EndpointPrefix('blog/', [Submount('/blog', [ + Rule('/', endpoint='index'), + Rule('/entry/', endpoint='show') + ])]) + ]) + """ + + def __init__(self, prefix: str, rules: t.Iterable[RuleFactory]) -> None: + self.prefix = prefix + self.rules = rules + + def get_rules(self, map: Map) -> t.Iterator[Rule]: + for rulefactory in self.rules: + for rule in rulefactory.get_rules(map): + rule = rule.empty() + rule.endpoint = self.prefix + rule.endpoint + yield rule + + +class RuleTemplate: + """Returns copies of the rules wrapped and expands string templates in + the endpoint, rule, defaults or subdomain sections. + + Here a small example for such a rule template:: + + from werkzeug.routing import Map, Rule, RuleTemplate + + resource = RuleTemplate([ + Rule('/$name/', endpoint='$name.list'), + Rule('/$name/', endpoint='$name.show') + ]) + + url_map = Map([resource(name='user'), resource(name='page')]) + + When a rule template is called the keyword arguments are used to + replace the placeholders in all the string parameters. + """ + + def __init__(self, rules: t.Iterable[Rule]) -> None: + self.rules = list(rules) + + def __call__(self, *args: t.Any, **kwargs: t.Any) -> RuleTemplateFactory: + return RuleTemplateFactory(self.rules, dict(*args, **kwargs)) + + +class RuleTemplateFactory(RuleFactory): + """A factory that fills in template variables into rules. Used by + `RuleTemplate` internally. + + :internal: + """ + + def __init__( + self, rules: t.Iterable[RuleFactory], context: dict[str, t.Any] + ) -> None: + self.rules = rules + self.context = context + + def get_rules(self, map: Map) -> t.Iterator[Rule]: + for rulefactory in self.rules: + for rule in rulefactory.get_rules(map): + new_defaults = subdomain = None + if rule.defaults: + new_defaults = {} + for key, value in rule.defaults.items(): + if isinstance(value, str): + value = Template(value).substitute(self.context) + new_defaults[key] = value + if rule.subdomain is not None: + subdomain = Template(rule.subdomain).substitute(self.context) + new_endpoint = rule.endpoint + if isinstance(new_endpoint, str): + new_endpoint = Template(new_endpoint).substitute(self.context) + yield Rule( + Template(rule.rule).substitute(self.context), + new_defaults, + subdomain, + rule.methods, + rule.build_only, + new_endpoint, + rule.strict_slashes, + ) + + +_ASTT = t.TypeVar("_ASTT", bound=ast.AST) + + +def _prefix_names(src: str, expected_type: type[_ASTT]) -> _ASTT: + """ast parse and prefix names with `.` to avoid collision with user vars""" + tree: ast.AST = ast.parse(src).body[0] + if isinstance(tree, ast.Expr): + tree = tree.value + if not isinstance(tree, expected_type): + raise TypeError( + f"AST node is of type {type(tree).__name__}, not {expected_type.__name__}" + ) + for node in ast.walk(tree): + if isinstance(node, ast.Name): + node.id = f".{node.id}" + return tree + + +_CALL_CONVERTER_CODE_FMT = "self._converters[{elem!r}].to_url()" +_IF_KWARGS_URL_ENCODE_CODE = """\ +if kwargs: + params = self._encode_query_vars(kwargs) + q = "?" if params else "" +else: + q = params = "" +""" +_IF_KWARGS_URL_ENCODE_AST = _prefix_names(_IF_KWARGS_URL_ENCODE_CODE, ast.If) +_URL_ENCODE_AST_NAMES = ( + _prefix_names("q", ast.Name), + _prefix_names("params", ast.Name), +) + + +class Rule(RuleFactory): + """A Rule represents one URL pattern. There are some options for `Rule` + that change the way it behaves and are passed to the `Rule` constructor. + Note that besides the rule-string all arguments *must* be keyword arguments + in order to not break the application on Werkzeug upgrades. + + `string` + Rule strings basically are just normal URL paths with placeholders in + the format ```` where the converter and the + arguments are optional. If no converter is defined the `default` + converter is used which means `string` in the normal configuration. + + URL rules that end with a slash are branch URLs, others are leaves. + If you have `strict_slashes` enabled (which is the default), all + branch URLs that are matched without a trailing slash will trigger a + redirect to the same URL with the missing slash appended. + + The converters are defined on the `Map`. + + `endpoint` + The endpoint for this rule. This can be anything. A reference to a + function, a string, a number etc. The preferred way is using a string + because the endpoint is used for URL generation. + + `defaults` + An optional dict with defaults for other rules with the same endpoint. + This is a bit tricky but useful if you want to have unique URLs:: + + url_map = Map([ + Rule('/all/', defaults={'page': 1}, endpoint='all_entries'), + Rule('/all/page/', endpoint='all_entries') + ]) + + If a user now visits ``http://example.com/all/page/1`` they will be + redirected to ``http://example.com/all/``. If `redirect_defaults` is + disabled on the `Map` instance this will only affect the URL + generation. + + `subdomain` + The subdomain rule string for this rule. If not specified the rule + only matches for the `default_subdomain` of the map. If the map is + not bound to a subdomain this feature is disabled. + + Can be useful if you want to have user profiles on different subdomains + and all subdomains are forwarded to your application:: + + url_map = Map([ + Rule('/', subdomain='', endpoint='user/homepage'), + Rule('/stats', subdomain='', endpoint='user/stats') + ]) + + `methods` + A sequence of http methods this rule applies to. If not specified, all + methods are allowed. For example this can be useful if you want different + endpoints for `POST` and `GET`. If methods are defined and the path + matches but the method matched against is not in this list or in the + list of another rule for that path the error raised is of the type + `MethodNotAllowed` rather than `NotFound`. If `GET` is present in the + list of methods and `HEAD` is not, `HEAD` is added automatically. + + `strict_slashes` + Override the `Map` setting for `strict_slashes` only for this rule. If + not specified the `Map` setting is used. + + `merge_slashes` + Override :attr:`Map.merge_slashes` for this rule. + + `build_only` + Set this to True and the rule will never match but will create a URL + that can be build. This is useful if you have resources on a subdomain + or folder that are not handled by the WSGI application (like static data) + + `redirect_to` + If given this must be either a string or callable. In case of a + callable it's called with the url adapter that triggered the match and + the values of the URL as keyword arguments and has to return the target + for the redirect, otherwise it has to be a string with placeholders in + rule syntax:: + + def foo_with_slug(adapter, id): + # ask the database for the slug for the old id. this of + # course has nothing to do with werkzeug. + return f'foo/{Foo.get_slug_for_id(id)}' + + url_map = Map([ + Rule('/foo/', endpoint='foo'), + Rule('/some/old/url/', redirect_to='foo/'), + Rule('/other/old/url/', redirect_to=foo_with_slug) + ]) + + When the rule is matched the routing system will raise a + `RequestRedirect` exception with the target for the redirect. + + Keep in mind that the URL will be joined against the URL root of the + script so don't use a leading slash on the target URL unless you + really mean root of that domain. + + `alias` + If enabled this rule serves as an alias for another rule with the same + endpoint and arguments. + + `host` + If provided and the URL map has host matching enabled this can be + used to provide a match rule for the whole host. This also means + that the subdomain feature is disabled. + + `websocket` + If ``True``, this rule is only matches for WebSocket (``ws://``, + ``wss://``) requests. By default, rules will only match for HTTP + requests. + + .. versionchanged:: 2.1 + Percent-encoded newlines (``%0a``), which are decoded by WSGI + servers, are considered when routing instead of terminating the + match early. + + .. versionadded:: 1.0 + Added ``websocket``. + + .. versionadded:: 1.0 + Added ``merge_slashes``. + + .. versionadded:: 0.7 + Added ``alias`` and ``host``. + + .. versionchanged:: 0.6.1 + ``HEAD`` is added to ``methods`` if ``GET`` is present. + """ + + def __init__( + self, + string: str, + defaults: t.Mapping[str, t.Any] | None = None, + subdomain: str | None = None, + methods: t.Iterable[str] | None = None, + build_only: bool = False, + endpoint: t.Any | None = None, + strict_slashes: bool | None = None, + merge_slashes: bool | None = None, + redirect_to: str | t.Callable[..., str] | None = None, + alias: bool = False, + host: str | None = None, + websocket: bool = False, + ) -> None: + if not string.startswith("/"): + raise ValueError(f"URL rule '{string}' must start with a slash.") + + self.rule = string + self.is_leaf = not string.endswith("/") + self.is_branch = string.endswith("/") + + self.map: Map = None # type: ignore + self.strict_slashes = strict_slashes + self.merge_slashes = merge_slashes + self.subdomain = subdomain + self.host = host + self.defaults = defaults + self.build_only = build_only + self.alias = alias + self.websocket = websocket + + if methods is not None: + if isinstance(methods, str): + raise TypeError("'methods' should be a list of strings.") + + methods = {x.upper() for x in methods} + + if "HEAD" not in methods and "GET" in methods: + methods.add("HEAD") + + if websocket and methods - {"GET", "HEAD", "OPTIONS"}: + raise ValueError( + "WebSocket rules can only use 'GET', 'HEAD', and 'OPTIONS' methods." + ) + + self.methods = methods + self.endpoint: t.Any = endpoint + self.redirect_to = redirect_to + + if defaults: + self.arguments = set(map(str, defaults)) + else: + self.arguments = set() + + self._converters: dict[str, BaseConverter] = {} + self._trace: list[tuple[bool, str]] = [] + self._parts: list[RulePart] = [] + + def empty(self) -> Rule: + """ + Return an unbound copy of this rule. + + This can be useful if want to reuse an already bound URL for another + map. See ``get_empty_kwargs`` to override what keyword arguments are + provided to the new copy. + """ + return type(self)(self.rule, **self.get_empty_kwargs()) + + def get_empty_kwargs(self) -> t.Mapping[str, t.Any]: + """ + Provides kwargs for instantiating empty copy with empty() + + Use this method to provide custom keyword arguments to the subclass of + ``Rule`` when calling ``some_rule.empty()``. Helpful when the subclass + has custom keyword arguments that are needed at instantiation. + + Must return a ``dict`` that will be provided as kwargs to the new + instance of ``Rule``, following the initial ``self.rule`` value which + is always provided as the first, required positional argument. + """ + defaults = None + if self.defaults: + defaults = dict(self.defaults) + return dict( + defaults=defaults, + subdomain=self.subdomain, + methods=self.methods, + build_only=self.build_only, + endpoint=self.endpoint, + strict_slashes=self.strict_slashes, + redirect_to=self.redirect_to, + alias=self.alias, + host=self.host, + ) + + def get_rules(self, map: Map) -> t.Iterator[Rule]: + yield self + + def refresh(self) -> None: + """Rebinds and refreshes the URL. Call this if you modified the + rule in place. + + :internal: + """ + self.bind(self.map, rebind=True) + + def bind(self, map: Map, rebind: bool = False) -> None: + """Bind the url to a map and create a regular expression based on + the information from the rule itself and the defaults from the map. + + :internal: + """ + if self.map is not None and not rebind: + raise RuntimeError(f"url rule {self!r} already bound to map {self.map!r}") + self.map = map + if self.strict_slashes is None: + self.strict_slashes = map.strict_slashes + if self.merge_slashes is None: + self.merge_slashes = map.merge_slashes + if self.subdomain is None: + self.subdomain = map.default_subdomain + self.compile() + + def get_converter( + self, + variable_name: str, + converter_name: str, + args: tuple[t.Any, ...], + kwargs: t.Mapping[str, t.Any], + ) -> BaseConverter: + """Looks up the converter for the given parameter. + + .. versionadded:: 0.9 + """ + if converter_name not in self.map.converters: + raise LookupError(f"the converter {converter_name!r} does not exist") + return self.map.converters[converter_name](self.map, *args, **kwargs) + + def _encode_query_vars(self, query_vars: t.Mapping[str, t.Any]) -> str: + items: t.Iterable[tuple[str, str]] = iter_multi_items(query_vars) + + if self.map.sort_parameters: + items = sorted(items, key=self.map.sort_key) + + return _urlencode(items) + + def _parse_rule(self, rule: str) -> t.Iterable[RulePart]: + content = "" + static = True + argument_weights = [] + static_weights: list[tuple[int, int]] = [] + final = False + convertor_number = 0 + + pos = 0 + while pos < len(rule): + match = _part_re.match(rule, pos) + if match is None: + raise ValueError(f"malformed url rule: {rule!r}") + + data = match.groupdict() + if data["static"] is not None: + static_weights.append((len(static_weights), -len(data["static"]))) + self._trace.append((False, data["static"])) + content += data["static"] if static else re.escape(data["static"]) + + if data["variable"] is not None: + if static: + # Switching content to represent regex, hence the need to escape + content = re.escape(content) + static = False + c_args, c_kwargs = parse_converter_args(data["arguments"] or "") + convobj = self.get_converter( + data["variable"], data["converter"] or "default", c_args, c_kwargs + ) + self._converters[data["variable"]] = convobj + self.arguments.add(data["variable"]) + if not convobj.part_isolating: + final = True + content += f"(?P<__werkzeug_{convertor_number}>{convobj.regex})" + convertor_number += 1 + argument_weights.append(convobj.weight) + self._trace.append((True, data["variable"])) + + if data["slash"] is not None: + self._trace.append((False, "/")) + if final: + content += "/" + else: + if not static: + content += r"\Z" + weight = Weighting( + -len(static_weights), + static_weights, + -len(argument_weights), + argument_weights, + ) + yield RulePart( + content=content, + final=final, + static=static, + suffixed=False, + weight=weight, + ) + content = "" + static = True + argument_weights = [] + static_weights = [] + final = False + convertor_number = 0 + + pos = match.end() + + suffixed = False + if final and content[-1] == "/": + # If a converter is part_isolating=False (matches slashes) and ends with a + # slash, augment the regex to support slash redirects. + suffixed = True + content = content[:-1] + "(? None: + """Compiles the regular expression and stores it.""" + assert self.map is not None, "rule not bound" + + if self.map.host_matching: + domain_rule = self.host or "" + else: + domain_rule = self.subdomain or "" + self._parts = [] + self._trace = [] + self._converters = {} + if domain_rule == "": + self._parts = [ + RulePart( + content="", + final=False, + static=True, + suffixed=False, + weight=Weighting(0, [], 0, []), + ) + ] + else: + self._parts.extend(self._parse_rule(domain_rule)) + self._trace.append((False, "|")) + rule = self.rule + if self.merge_slashes: + rule = re.sub("/{2,}?", "/", self.rule) + self._parts.extend(self._parse_rule(rule)) + + self._build: t.Callable[..., tuple[str, str]] + self._build = self._compile_builder(False).__get__(self, None) + self._build_unknown: t.Callable[..., tuple[str, str]] + self._build_unknown = self._compile_builder(True).__get__(self, None) + + @staticmethod + def _get_func_code(code: CodeType, name: str) -> t.Callable[..., tuple[str, str]]: + globs: dict[str, t.Any] = {} + locs: dict[str, t.Any] = {} + exec(code, globs, locs) + return locs[name] # type: ignore + + def _compile_builder( + self, append_unknown: bool = True + ) -> t.Callable[..., tuple[str, str]]: + defaults = self.defaults or {} + dom_ops: list[tuple[bool, str]] = [] + url_ops: list[tuple[bool, str]] = [] + + opl = dom_ops + for is_dynamic, data in self._trace: + if data == "|" and opl is dom_ops: + opl = url_ops + continue + # this seems like a silly case to ever come up but: + # if a default is given for a value that appears in the rule, + # resolve it to a constant ahead of time + if is_dynamic and data in defaults: + data = self._converters[data].to_url(defaults[data]) + opl.append((False, data)) + elif not is_dynamic: + # safe = https://url.spec.whatwg.org/#url-path-segment-string + opl.append((False, quote(data, safe="!$&'()*+,/:;=@"))) + else: + opl.append((True, data)) + + def _convert(elem: str) -> ast.Call: + ret = _prefix_names(_CALL_CONVERTER_CODE_FMT.format(elem=elem), ast.Call) + ret.args = [ast.Name(elem, ast.Load())] + return ret + + def _parts(ops: list[tuple[bool, str]]) -> list[ast.expr]: + parts: list[ast.expr] = [ + _convert(elem) if is_dynamic else ast.Constant(elem) + for is_dynamic, elem in ops + ] + parts = parts or [ast.Constant("")] + # constant fold + ret = [parts[0]] + for p in parts[1:]: + if isinstance(p, ast.Constant) and isinstance(ret[-1], ast.Constant): + ret[-1] = ast.Constant(ret[-1].value + p.value) # type: ignore[operator] + else: + ret.append(p) + return ret + + dom_parts = _parts(dom_ops) + url_parts = _parts(url_ops) + body: list[ast.stmt] + if not append_unknown: + body = [] + else: + body = [_IF_KWARGS_URL_ENCODE_AST] + url_parts.extend(_URL_ENCODE_AST_NAMES) + + def _join(parts: list[ast.expr]) -> ast.expr: + if len(parts) == 1: # shortcut + return parts[0] + return ast.JoinedStr(parts) + + body.append( + ast.Return(ast.Tuple([_join(dom_parts), _join(url_parts)], ast.Load())) + ) + + pargs = [ + elem + for is_dynamic, elem in dom_ops + url_ops + if is_dynamic and elem not in defaults + ] + kargs = [str(k) for k in defaults] + + func_ast = _prefix_names("def _(): pass", ast.FunctionDef) + func_ast.name = f"" + func_ast.args.args.append(ast.arg(".self", None)) + for arg in pargs + kargs: + func_ast.args.args.append(ast.arg(arg, None)) + func_ast.args.kwarg = ast.arg(".kwargs", None) + for _ in kargs: + func_ast.args.defaults.append(ast.Constant("")) + func_ast.body = body + + # Use `ast.parse` instead of `ast.Module` for better portability, since the + # signature of `ast.Module` can change. + module = ast.parse("") + module.body = [func_ast] + + # mark everything as on line 1, offset 0 + # less error-prone than `ast.fix_missing_locations` + # bad line numbers cause an assert to fail in debug builds + for node in ast.walk(module): + if "lineno" in node._attributes: + node.lineno = 1 # type: ignore[attr-defined] + if "end_lineno" in node._attributes: + node.end_lineno = node.lineno # type: ignore[attr-defined] + if "col_offset" in node._attributes: + node.col_offset = 0 # type: ignore[attr-defined] + if "end_col_offset" in node._attributes: + node.end_col_offset = node.col_offset # type: ignore[attr-defined] + + code = compile(module, "", "exec") + return self._get_func_code(code, func_ast.name) + + def build( + self, values: t.Mapping[str, t.Any], append_unknown: bool = True + ) -> tuple[str, str] | None: + """Assembles the relative url for that rule and the subdomain. + If building doesn't work for some reasons `None` is returned. + + :internal: + """ + try: + if append_unknown: + return self._build_unknown(**values) + else: + return self._build(**values) + except ValidationError: + return None + + def provides_defaults_for(self, rule: Rule) -> bool: + """Check if this rule has defaults for a given rule. + + :internal: + """ + return bool( + not self.build_only + and self.defaults + and self.endpoint == rule.endpoint + and self != rule + and self.arguments == rule.arguments + ) + + def suitable_for( + self, values: t.Mapping[str, t.Any], method: str | None = None + ) -> bool: + """Check if the dict of values has enough data for url generation. + + :internal: + """ + # if a method was given explicitly and that method is not supported + # by this rule, this rule is not suitable. + if ( + method is not None + and self.methods is not None + and method not in self.methods + ): + return False + + defaults = self.defaults or () + + # all arguments required must be either in the defaults dict or + # the value dictionary otherwise it's not suitable + for key in self.arguments: + if key not in defaults and key not in values: + return False + + # in case defaults are given we ensure that either the value was + # skipped or the value is the same as the default value. + if defaults: + for key, value in defaults.items(): + if key in values and value != values[key]: + return False + + return True + + def build_compare_key(self) -> tuple[int, int, int]: + """The build compare key for sorting. + + :internal: + """ + return (1 if self.alias else 0, -len(self.arguments), -len(self.defaults or ())) + + def __eq__(self, other: object) -> bool: + return isinstance(other, type(self)) and self._trace == other._trace + + __hash__ = None # type: ignore + + def __str__(self) -> str: + return self.rule + + def __repr__(self) -> str: + if self.map is None: + return f"<{type(self).__name__} (unbound)>" + parts = [] + for is_dynamic, data in self._trace: + if is_dynamic: + parts.append(f"<{data}>") + else: + parts.append(data) + parts_str = "".join(parts).lstrip("|") + methods = f" ({', '.join(self.methods)})" if self.methods is not None else "" + return f"<{type(self).__name__} {parts_str!r}{methods} -> {self.endpoint}>" diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/werkzeug/sansio/__init__.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/werkzeug/sansio/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/werkzeug/sansio/http.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/werkzeug/sansio/http.py new file mode 100644 index 0000000000000000000000000000000000000000..c68a57ffb06fdbcb4986be0f65d7eac711503d7e --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/werkzeug/sansio/http.py @@ -0,0 +1,170 @@ +from __future__ import annotations + +import re +import typing as t +from datetime import datetime + +from .._internal import _dt_as_utc +from ..http import generate_etag +from ..http import parse_date +from ..http import parse_etags +from ..http import parse_if_range_header +from ..http import unquote_etag + +_etag_re = re.compile(r'([Ww]/)?(?:"(.*?)"|(.*?))(?:\s*,\s*|$)') + + +def is_resource_modified( + http_range: str | None = None, + http_if_range: str | None = None, + http_if_modified_since: str | None = None, + http_if_none_match: str | None = None, + http_if_match: str | None = None, + etag: str | None = None, + data: bytes | None = None, + last_modified: datetime | str | None = None, + ignore_if_range: bool = True, +) -> bool: + """Convenience method for conditional requests. + :param http_range: Range HTTP header + :param http_if_range: If-Range HTTP header + :param http_if_modified_since: If-Modified-Since HTTP header + :param http_if_none_match: If-None-Match HTTP header + :param http_if_match: If-Match HTTP header + :param etag: the etag for the response for comparison. + :param data: or alternatively the data of the response to automatically + generate an etag using :func:`generate_etag`. + :param last_modified: an optional date of the last modification. + :param ignore_if_range: If `False`, `If-Range` header will be taken into + account. + :return: `True` if the resource was modified, otherwise `False`. + + .. versionadded:: 2.2 + """ + if etag is None and data is not None: + etag = generate_etag(data) + elif data is not None: + raise TypeError("both data and etag given") + + unmodified = False + if isinstance(last_modified, str): + last_modified = parse_date(last_modified) + + # HTTP doesn't use microsecond, remove it to avoid false positive + # comparisons. Mark naive datetimes as UTC. + if last_modified is not None: + last_modified = _dt_as_utc(last_modified.replace(microsecond=0)) + + if_range = None + if not ignore_if_range and http_range is not None: + # https://tools.ietf.org/html/rfc7233#section-3.2 + # A server MUST ignore an If-Range header field received in a request + # that does not contain a Range header field. + if_range = parse_if_range_header(http_if_range) + + if if_range is not None and if_range.date is not None: + modified_since: datetime | None = if_range.date + else: + modified_since = parse_date(http_if_modified_since) + + if modified_since and last_modified and last_modified <= modified_since: + unmodified = True + + if etag: + etag, _ = unquote_etag(etag) + + if if_range is not None and if_range.etag is not None: + unmodified = parse_etags(if_range.etag).contains(etag) + else: + if_none_match = parse_etags(http_if_none_match) + if if_none_match: + # https://tools.ietf.org/html/rfc7232#section-3.2 + # "A recipient MUST use the weak comparison function when comparing + # entity-tags for If-None-Match" + unmodified = if_none_match.contains_weak(etag) + + # https://tools.ietf.org/html/rfc7232#section-3.1 + # "Origin server MUST use the strong comparison function when + # comparing entity-tags for If-Match" + if_match = parse_etags(http_if_match) + if if_match: + unmodified = not if_match.is_strong(etag) + + return not unmodified + + +_cookie_re = re.compile( + r""" + ([^=;]*) + (?:\s*=\s* + ( + "(?:[^\\"]|\\.)*" + | + .*? + ) + )? + \s*;\s* + """, + flags=re.ASCII | re.VERBOSE, +) +_cookie_unslash_re = re.compile(rb"\\([0-3][0-7]{2}|.)") + + +def _cookie_unslash_replace(m: t.Match[bytes]) -> bytes: + v = m.group(1) + + if len(v) == 1: + return v + + return int(v, 8).to_bytes(1, "big") + + +def parse_cookie( + cookie: str | None = None, + cls: type[ds.MultiDict[str, str]] | None = None, +) -> ds.MultiDict[str, str]: + """Parse a cookie from a string. + + The same key can be provided multiple times, the values are stored + in-order. The default :class:`MultiDict` will have the first value + first, and all values can be retrieved with + :meth:`MultiDict.getlist`. + + :param cookie: The cookie header as a string. + :param cls: A dict-like class to store the parsed cookies in. + Defaults to :class:`MultiDict`. + + .. versionchanged:: 3.0 + Passing bytes, and the ``charset`` and ``errors`` parameters, were removed. + + .. versionadded:: 2.2 + """ + if cls is None: + cls = t.cast("type[ds.MultiDict[str, str]]", ds.MultiDict) + + if not cookie: + return cls() + + cookie = f"{cookie};" + out = [] + + for ck, cv in _cookie_re.findall(cookie): + ck = ck.strip() + cv = cv.strip() + + if not ck: + continue + + if len(cv) >= 2 and cv[0] == cv[-1] == '"': + # Work with bytes here, since a UTF-8 character could be multiple bytes. + cv = _cookie_unslash_re.sub( + _cookie_unslash_replace, cv[1:-1].encode() + ).decode(errors="replace") + + out.append((ck, cv)) + + return cls(out) + + +# circular dependencies +from .. import datastructures as ds # noqa: E402 diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/werkzeug/sansio/multipart.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/werkzeug/sansio/multipart.py new file mode 100644 index 0000000000000000000000000000000000000000..5a3844ebbe80d9043e9c57a210ce1b5b1ddcb392 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/werkzeug/sansio/multipart.py @@ -0,0 +1,329 @@ +from __future__ import annotations + +import re +import typing as t +from dataclasses import dataclass +from enum import auto +from enum import Enum + +from ..datastructures import Headers +from ..exceptions import RequestEntityTooLarge +from ..http import parse_options_header + + +class Event: + pass + + +@dataclass(frozen=True) +class Preamble(Event): + data: bytes + + +@dataclass(frozen=True) +class Field(Event): + name: str + headers: Headers + + +@dataclass(frozen=True) +class File(Event): + name: str + filename: str + headers: Headers + + +@dataclass(frozen=True) +class Data(Event): + data: bytes + more_data: bool + + +@dataclass(frozen=True) +class Epilogue(Event): + data: bytes + + +class NeedData(Event): + pass + + +NEED_DATA = NeedData() + + +class State(Enum): + PREAMBLE = auto() + PART = auto() + DATA = auto() + DATA_START = auto() + EPILOGUE = auto() + COMPLETE = auto() + + +# Multipart line breaks MUST be CRLF (\r\n) by RFC-7578, except that +# many implementations break this and either use CR or LF alone. +LINE_BREAK = b"(?:\r\n|\n|\r)" +BLANK_LINE_RE = re.compile(b"(?:\r\n\r\n|\r\r|\n\n)", re.MULTILINE) +LINE_BREAK_RE = re.compile(LINE_BREAK, re.MULTILINE) +# Header values can be continued via a space or tab after the linebreak, as +# per RFC2231 +HEADER_CONTINUATION_RE = re.compile(b"%s[ \t]" % LINE_BREAK, re.MULTILINE) +# This must be long enough to contain any line breaks plus any +# additional boundary markers (--) such that they will be found in a +# subsequent search +SEARCH_EXTRA_LENGTH = 8 + + +class MultipartDecoder: + """Decodes a multipart message as bytes into Python events. + + The part data is returned as available to allow the caller to save + the data from memory to disk, if desired. + + .. versionchanged:: 3.1.4 + Handle chunks that split a``\r\n`` sequence. + """ + + def __init__( + self, + boundary: bytes, + max_form_memory_size: int | None = None, + *, + max_parts: int | None = None, + ) -> None: + self.buffer = bytearray() + self.complete = False + self.max_form_memory_size = max_form_memory_size + self.max_parts = max_parts + self.state = State.PREAMBLE + self.boundary = boundary + + # Note in the below \h i.e. horizontal whitespace is used + # as [^\S\n\r] as \h isn't supported in python. + + # The preamble must end with a boundary where the boundary is + # prefixed by a line break, RFC2046. Except that many + # implementations including Werkzeug's tests omit the line + # break prefix. In addition the first boundary could be the + # epilogue boundary (for empty form-data) hence the matching + # group to understand if it is an epilogue boundary. + self.preamble_re = re.compile( + rb"%s?--%s(--[^\S\n\r]*%s?|[^\S\n\r]*%s)" + % (LINE_BREAK, re.escape(boundary), LINE_BREAK, LINE_BREAK), + re.MULTILINE, + ) + # A boundary must include a line break prefix and suffix, and + # may include trailing whitespace. In addition the boundary + # could be the epilogue boundary hence the matching group to + # understand if it is an epilogue boundary. + self.boundary_re = re.compile( + rb"%s--%s(--[^\S\n\r]*%s?|[^\S\n\r]*%s)" + % (LINE_BREAK, re.escape(boundary), LINE_BREAK, LINE_BREAK), + re.MULTILINE, + ) + self._search_position = 0 + self._parts_decoded = 0 + + def receive_data(self, data: bytes | None) -> None: + if data is None: + self.complete = True + elif ( + self.max_form_memory_size is not None + and len(self.buffer) + len(data) > self.max_form_memory_size + ): + # Ensure that data within single event does not exceed limit. + # Also checked across accumulated events in MultiPartParser. + raise RequestEntityTooLarge() + else: + self.buffer.extend(data) + + def next_event(self) -> Event: + event: Event = NEED_DATA + + if self.state == State.PREAMBLE: + match = self.preamble_re.search(self.buffer, self._search_position) + if match is not None: + if match.group(1).startswith(b"--"): + self.state = State.EPILOGUE + else: + self.state = State.PART + data = bytes(self.buffer[: match.start()]) + del self.buffer[: match.end()] + event = Preamble(data=data) + self._search_position = 0 + else: + # Update the search start position to be equal to the + # current buffer length (already searched) minus a + # safe buffer for part of the search target. + self._search_position = max( + 0, len(self.buffer) - len(self.boundary) - SEARCH_EXTRA_LENGTH + ) + + elif self.state == State.PART: + match = BLANK_LINE_RE.search(self.buffer, self._search_position) + if match is not None: + headers = self._parse_headers(self.buffer[: match.start()]) + # The final header ends with a single CRLF, however a + # blank line indicates the start of the + # body. Therefore the end is after the first CRLF. + headers_end = (match.start() + match.end()) // 2 + del self.buffer[:headers_end] + + if "content-disposition" not in headers: + raise ValueError("Missing Content-Disposition header") + + disposition, extra = parse_options_header( + headers["content-disposition"] + ) + name = t.cast(str, extra.get("name")) + filename = extra.get("filename") + if filename is not None: + event = File( + filename=filename, + headers=headers, + name=name, + ) + else: + event = Field( + headers=headers, + name=name, + ) + self.state = State.DATA_START + self._search_position = 0 + self._parts_decoded += 1 + + if self.max_parts is not None and self._parts_decoded > self.max_parts: + raise RequestEntityTooLarge() + else: + # Update the search start position to be equal to the + # current buffer length (already searched) minus a + # safe buffer for part of the search target. + self._search_position = max(0, len(self.buffer) - SEARCH_EXTRA_LENGTH) + + elif self.state == State.DATA_START: + data, del_index, more_data = self._parse_data(self.buffer, start=True) + del self.buffer[:del_index] + event = Data(data=data, more_data=more_data) + if more_data: + self.state = State.DATA + + elif self.state == State.DATA: + data, del_index, more_data = self._parse_data(self.buffer, start=False) + del self.buffer[:del_index] + if data or not more_data: + event = Data(data=data, more_data=more_data) + + elif self.state == State.EPILOGUE and self.complete: + event = Epilogue(data=bytes(self.buffer)) + del self.buffer[:] + self.state = State.COMPLETE + + if self.complete and isinstance(event, NeedData): + raise ValueError(f"Invalid form-data cannot parse beyond {self.state}") + + return event + + def _parse_headers(self, data: bytes | bytearray) -> Headers: + headers: list[tuple[str, str]] = [] + # Merge the continued headers into one line + data = HEADER_CONTINUATION_RE.sub(b" ", data) + # Now there is one header per line + for line in data.splitlines(): + line = line.strip() + + if line != b"": + name, _, value = line.decode().partition(":") + headers.append((name.strip(), value.strip())) + return Headers(headers) + + def _parse_data( + self, data: bytes | bytearray, *, start: bool + ) -> tuple[bytes, int, bool]: + # Body parts must start with CRLF (or CR or LF) + if start: + match = LINE_BREAK_RE.match(data) + data_start = t.cast(t.Match[bytes], match).end() + else: + data_start = 0 + + if self.buffer.find(b"--" + self.boundary) == -1: + # No complete boundary in the buffer, but there may be + # a partial boundary at the end. + data_end = del_index = self._last_partial_boundary_index(data) + more_data = True + else: + match = self.boundary_re.search(data) + if match is not None: + if match.group(1).startswith(b"--"): + self.state = State.EPILOGUE + else: + self.state = State.PART + data_end = match.start() + del_index = match.end() + else: + data_end = del_index = self._last_partial_boundary_index(data) + more_data = match is None + + return bytes(data[data_start:data_end]), del_index, more_data + + def _last_partial_boundary_index(self, data: bytes | bytearray) -> int: + # Find the last index following which a partial boundary + # could be present in the data. This will be the earliest + # position of a LR or a CR, unless that position is more + # than a complete boundary from the end in which case there + # is no partial boundary. + complete_boundary_index = len(data) - len(b"\r\n--" + self.boundary) + try: + last_nl = data.rindex(b"\n") + except ValueError: + last_nl = len(data) + else: + if last_nl < complete_boundary_index: + last_nl = len(data) + try: + last_cr = data.rindex(b"\r") + except ValueError: + last_cr = len(data) + else: + if last_cr < complete_boundary_index: + last_cr = len(data) + return min(last_nl, last_cr) + + +class MultipartEncoder: + def __init__(self, boundary: bytes) -> None: + self.boundary = boundary + self.state = State.PREAMBLE + + def send_event(self, event: Event) -> bytes: + if isinstance(event, Preamble) and self.state == State.PREAMBLE: + self.state = State.PART + return event.data + elif isinstance(event, (Field, File)) and self.state in { + State.PREAMBLE, + State.PART, + State.DATA, + }: + data = b"\r\n--" + self.boundary + b"\r\n" + data += b'Content-Disposition: form-data; name="%s"' % event.name.encode() + if isinstance(event, File): + data += b'; filename="%s"' % event.filename.encode() + data += b"\r\n" + for name, value in t.cast(Field, event).headers: + if name.lower() != "content-disposition": + data += f"{name}: {value}\r\n".encode() + self.state = State.DATA_START + return data + elif isinstance(event, Data) and self.state == State.DATA_START: + self.state = State.DATA + if len(event.data) > 0: + return b"\r\n" + event.data + else: + return event.data + elif isinstance(event, Data) and self.state == State.DATA: + return event.data + elif isinstance(event, Epilogue): + self.state = State.COMPLETE + return b"\r\n--" + self.boundary + b"--\r\n" + event.data + else: + raise ValueError(f"Cannot generate {event} in state: {self.state}") diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/werkzeug/sansio/request.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/werkzeug/sansio/request.py new file mode 100644 index 0000000000000000000000000000000000000000..8d5fbd8f8f2b9cb0c390dc846eab4eaaae5ad586 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/werkzeug/sansio/request.py @@ -0,0 +1,534 @@ +from __future__ import annotations + +import typing as t +from datetime import datetime +from urllib.parse import parse_qsl + +from ..datastructures import Accept +from ..datastructures import Authorization +from ..datastructures import CharsetAccept +from ..datastructures import ETags +from ..datastructures import Headers +from ..datastructures import HeaderSet +from ..datastructures import IfRange +from ..datastructures import ImmutableList +from ..datastructures import ImmutableMultiDict +from ..datastructures import LanguageAccept +from ..datastructures import MIMEAccept +from ..datastructures import MultiDict +from ..datastructures import Range +from ..datastructures import RequestCacheControl +from ..http import parse_accept_header +from ..http import parse_cache_control_header +from ..http import parse_date +from ..http import parse_etags +from ..http import parse_if_range_header +from ..http import parse_list_header +from ..http import parse_options_header +from ..http import parse_range_header +from ..http import parse_set_header +from ..user_agent import UserAgent +from ..utils import cached_property +from ..utils import header_property +from .http import parse_cookie +from .utils import get_content_length +from .utils import get_current_url +from .utils import get_host + + +class Request: + """Represents the non-IO parts of a HTTP request, including the + method, URL info, and headers. + + This class is not meant for general use. It should only be used when + implementing WSGI, ASGI, or another HTTP application spec. Werkzeug + provides a WSGI implementation at :cls:`werkzeug.wrappers.Request`. + + :param method: The method the request was made with, such as + ``GET``. + :param scheme: The URL scheme of the protocol the request used, such + as ``https`` or ``wss``. + :param server: The address of the server. ``(host, port)``, + ``(path, None)`` for unix sockets, or ``None`` if not known. + :param root_path: The prefix that the application is mounted under. + This is prepended to generated URLs, but is not part of route + matching. + :param path: The path part of the URL after ``root_path``. + :param query_string: The part of the URL after the "?". + :param headers: The headers received with the request. + :param remote_addr: The address of the client sending the request. + + .. versionchanged:: 3.0 + The ``charset``, ``url_charset``, and ``encoding_errors`` attributes + were removed. + + .. versionadded:: 2.0 + """ + + #: the class to use for `args` and `form`. The default is an + #: :class:`~werkzeug.datastructures.ImmutableMultiDict` which supports + #: multiple values per key. A :class:`~werkzeug.datastructures.ImmutableDict` + #: is faster but only remembers the last key. It is also + #: possible to use mutable structures, but this is not recommended. + #: + #: .. versionadded:: 0.6 + parameter_storage_class: type[MultiDict[str, t.Any]] = ImmutableMultiDict + + #: The type to be used for dict values from the incoming WSGI + #: environment. (For example for :attr:`cookies`.) By default an + #: :class:`~werkzeug.datastructures.ImmutableMultiDict` is used. + #: + #: .. versionchanged:: 1.0.0 + #: Changed to ``ImmutableMultiDict`` to support multiple values. + #: + #: .. versionadded:: 0.6 + dict_storage_class: type[MultiDict[str, t.Any]] = ImmutableMultiDict + + #: the type to be used for list values from the incoming WSGI environment. + #: By default an :class:`~werkzeug.datastructures.ImmutableList` is used + #: (for example for :attr:`access_list`). + #: + #: .. versionadded:: 0.6 + list_storage_class: type[list[t.Any]] = ImmutableList + + user_agent_class: type[UserAgent] = UserAgent + """The class used and returned by the :attr:`user_agent` property to + parse the header. Defaults to + :class:`~werkzeug.user_agent.UserAgent`, which does no parsing. An + extension can provide a subclass that uses a parser to provide other + data. + + .. versionadded:: 2.0 + """ + + #: Valid host names when handling requests. By default all hosts are + #: trusted, which means that whatever the client says the host is + #: will be accepted. + #: + #: Because ``Host`` and ``X-Forwarded-Host`` headers can be set to + #: any value by a malicious client, it is recommended to either set + #: this property or implement similar validation in the proxy (if + #: the application is being run behind one). + #: + #: .. versionadded:: 0.9 + trusted_hosts: list[str] | None = None + + def __init__( + self, + method: str, + scheme: str, + server: tuple[str, int | None] | None, + root_path: str, + path: str, + query_string: bytes, + headers: Headers, + remote_addr: str | None, + ) -> None: + #: The method the request was made with, such as ``GET``. + self.method = method.upper() + #: The URL scheme of the protocol the request used, such as + #: ``https`` or ``wss``. + self.scheme = scheme + #: The address of the server. ``(host, port)``, ``(path, None)`` + #: for unix sockets, or ``None`` if not known. + self.server = server + #: The prefix that the application is mounted under, without a + #: trailing slash. :attr:`path` comes after this. + self.root_path = root_path.rstrip("/") + #: The path part of the URL after :attr:`root_path`. This is the + #: path used for routing within the application. + self.path = "/" + path.lstrip("/") + #: The part of the URL after the "?". This is the raw value, use + #: :attr:`args` for the parsed values. + self.query_string = query_string + #: The headers received with the request. + self.headers = headers + #: The address of the client sending the request. + self.remote_addr = remote_addr + + def __repr__(self) -> str: + try: + url = self.url + except Exception as e: + url = f"(invalid URL: {e})" + + return f"<{type(self).__name__} {url!r} [{self.method}]>" + + @cached_property + def args(self) -> MultiDict[str, str]: + """The parsed URL parameters (the part in the URL after the question + mark). + + By default an + :class:`~werkzeug.datastructures.ImmutableMultiDict` + is returned from this function. This can be changed by setting + :attr:`parameter_storage_class` to a different type. This might + be necessary if the order of the form data is important. + + .. versionchanged:: 2.3 + Invalid bytes remain percent encoded. + """ + return self.parameter_storage_class( + parse_qsl( + self.query_string.decode(), + keep_blank_values=True, + errors="werkzeug.url_quote", + ) + ) + + @cached_property + def access_route(self) -> list[str]: + """If a forwarded header exists this is a list of all ip addresses + from the client ip to the last proxy server. + """ + if "X-Forwarded-For" in self.headers: + return self.list_storage_class( + parse_list_header(self.headers["X-Forwarded-For"]) + ) + elif self.remote_addr is not None: + return self.list_storage_class([self.remote_addr]) + return self.list_storage_class() + + @cached_property + def full_path(self) -> str: + """Requested path, including the query string.""" + return f"{self.path}?{self.query_string.decode()}" + + @property + def is_secure(self) -> bool: + """``True`` if the request was made with a secure protocol + (HTTPS or WSS). + """ + return self.scheme in {"https", "wss"} + + @cached_property + def url(self) -> str: + """The full request URL with the scheme, host, root path, path, + and query string.""" + return get_current_url( + self.scheme, self.host, self.root_path, self.path, self.query_string + ) + + @cached_property + def base_url(self) -> str: + """Like :attr:`url` but without the query string.""" + return get_current_url(self.scheme, self.host, self.root_path, self.path) + + @cached_property + def root_url(self) -> str: + """The request URL scheme, host, and root path. This is the root + that the application is accessed from. + """ + return get_current_url(self.scheme, self.host, self.root_path) + + @cached_property + def host_url(self) -> str: + """The request URL scheme and host only.""" + return get_current_url(self.scheme, self.host) + + @cached_property + def host(self) -> str: + """The host name the request was made to, including the port if + it's non-standard. Validated with :attr:`trusted_hosts`. + """ + return get_host( + self.scheme, self.headers.get("host"), self.server, self.trusted_hosts + ) + + @cached_property + def cookies(self) -> ImmutableMultiDict[str, str]: + """A :class:`dict` with the contents of all cookies transmitted with + the request.""" + wsgi_combined_cookie = ";".join(self.headers.getlist("Cookie")) + return parse_cookie( # type: ignore + wsgi_combined_cookie, cls=self.dict_storage_class + ) + + # Common Descriptors + + content_type = header_property[str]( + "Content-Type", + doc="""The Content-Type entity-header field indicates the media + type of the entity-body sent to the recipient or, in the case of + the HEAD method, the media type that would have been sent had + the request been a GET.""", + read_only=True, + ) + + @cached_property + def content_length(self) -> int | None: + """The Content-Length entity-header field indicates the size of the + entity-body in bytes or, in the case of the HEAD method, the size of + the entity-body that would have been sent had the request been a + GET. + """ + return get_content_length( + http_content_length=self.headers.get("Content-Length"), + http_transfer_encoding=self.headers.get("Transfer-Encoding"), + ) + + content_encoding = header_property[str]( + "Content-Encoding", + doc="""The Content-Encoding entity-header field is used as a + modifier to the media-type. When present, its value indicates + what additional content codings have been applied to the + entity-body, and thus what decoding mechanisms must be applied + in order to obtain the media-type referenced by the Content-Type + header field. + + .. versionadded:: 0.9""", + read_only=True, + ) + content_md5 = header_property[str]( + "Content-MD5", + doc="""The Content-MD5 entity-header field, as defined in + RFC 1864, is an MD5 digest of the entity-body for the purpose of + providing an end-to-end message integrity check (MIC) of the + entity-body. (Note: a MIC is good for detecting accidental + modification of the entity-body in transit, but is not proof + against malicious attacks.) + + .. versionadded:: 0.9""", + read_only=True, + ) + referrer = header_property[str]( + "Referer", + doc="""The Referer[sic] request-header field allows the client + to specify, for the server's benefit, the address (URI) of the + resource from which the Request-URI was obtained (the + "referrer", although the header field is misspelled).""", + read_only=True, + ) + date = header_property( + "Date", + None, + parse_date, + doc="""The Date general-header field represents the date and + time at which the message was originated, having the same + semantics as orig-date in RFC 822. + + .. versionchanged:: 2.0 + The datetime object is timezone-aware. + """, + read_only=True, + ) + max_forwards = header_property( + "Max-Forwards", + None, + int, + doc="""The Max-Forwards request-header field provides a + mechanism with the TRACE and OPTIONS methods to limit the number + of proxies or gateways that can forward the request to the next + inbound server.""", + read_only=True, + ) + + def _parse_content_type(self) -> None: + if not hasattr(self, "_parsed_content_type"): + self._parsed_content_type = parse_options_header( + self.headers.get("Content-Type", "") + ) + + @property + def mimetype(self) -> str: + """Like :attr:`content_type`, but without parameters (eg, without + charset, type etc.) and always lowercase. For example if the content + type is ``text/HTML; charset=utf-8`` the mimetype would be + ``'text/html'``. + """ + self._parse_content_type() + return self._parsed_content_type[0].lower() + + @property + def mimetype_params(self) -> dict[str, str]: + """The mimetype parameters as dict. For example if the content + type is ``text/html; charset=utf-8`` the params would be + ``{'charset': 'utf-8'}``. + """ + self._parse_content_type() + return self._parsed_content_type[1] + + @cached_property + def pragma(self) -> HeaderSet: + """The Pragma general-header field is used to include + implementation-specific directives that might apply to any recipient + along the request/response chain. All pragma directives specify + optional behavior from the viewpoint of the protocol; however, some + systems MAY require that behavior be consistent with the directives. + """ + return parse_set_header(self.headers.get("Pragma", "")) + + # Accept + + @cached_property + def accept_mimetypes(self) -> MIMEAccept: + """List of mimetypes this client supports as + :class:`~werkzeug.datastructures.MIMEAccept` object. + """ + return parse_accept_header(self.headers.get("Accept"), MIMEAccept) + + @cached_property + def accept_charsets(self) -> CharsetAccept: + """List of charsets this client supports as + :class:`~werkzeug.datastructures.CharsetAccept` object. + """ + return parse_accept_header(self.headers.get("Accept-Charset"), CharsetAccept) + + @cached_property + def accept_encodings(self) -> Accept: + """List of encodings this client accepts. Encodings in a HTTP term + are compression encodings such as gzip. For charsets have a look at + :attr:`accept_charset`. + """ + return parse_accept_header(self.headers.get("Accept-Encoding")) + + @cached_property + def accept_languages(self) -> LanguageAccept: + """List of languages this client accepts as + :class:`~werkzeug.datastructures.LanguageAccept` object. + + .. versionchanged 0.5 + In previous versions this was a regular + :class:`~werkzeug.datastructures.Accept` object. + """ + return parse_accept_header(self.headers.get("Accept-Language"), LanguageAccept) + + # ETag + + @cached_property + def cache_control(self) -> RequestCacheControl: + """A :class:`~werkzeug.datastructures.RequestCacheControl` object + for the incoming cache control headers. + """ + cache_control = self.headers.get("Cache-Control") + return parse_cache_control_header(cache_control, None, RequestCacheControl) + + @cached_property + def if_match(self) -> ETags: + """An object containing all the etags in the `If-Match` header. + + :rtype: :class:`~werkzeug.datastructures.ETags` + """ + return parse_etags(self.headers.get("If-Match")) + + @cached_property + def if_none_match(self) -> ETags: + """An object containing all the etags in the `If-None-Match` header. + + :rtype: :class:`~werkzeug.datastructures.ETags` + """ + return parse_etags(self.headers.get("If-None-Match")) + + @cached_property + def if_modified_since(self) -> datetime | None: + """The parsed `If-Modified-Since` header as a datetime object. + + .. versionchanged:: 2.0 + The datetime object is timezone-aware. + """ + return parse_date(self.headers.get("If-Modified-Since")) + + @cached_property + def if_unmodified_since(self) -> datetime | None: + """The parsed `If-Unmodified-Since` header as a datetime object. + + .. versionchanged:: 2.0 + The datetime object is timezone-aware. + """ + return parse_date(self.headers.get("If-Unmodified-Since")) + + @cached_property + def if_range(self) -> IfRange: + """The parsed ``If-Range`` header. + + .. versionchanged:: 2.0 + ``IfRange.date`` is timezone-aware. + + .. versionadded:: 0.7 + """ + return parse_if_range_header(self.headers.get("If-Range")) + + @cached_property + def range(self) -> Range | None: + """The parsed `Range` header. + + .. versionadded:: 0.7 + + :rtype: :class:`~werkzeug.datastructures.Range` + """ + return parse_range_header(self.headers.get("Range")) + + # User Agent + + @cached_property + def user_agent(self) -> UserAgent: + """The user agent. Use ``user_agent.string`` to get the header + value. Set :attr:`user_agent_class` to a subclass of + :class:`~werkzeug.user_agent.UserAgent` to provide parsing for + the other properties or other extended data. + + .. versionchanged:: 2.1 + The built-in parser was removed. Set ``user_agent_class`` to a ``UserAgent`` + subclass to parse data from the string. + """ + return self.user_agent_class(self.headers.get("User-Agent", "")) + + # Authorization + + @cached_property + def authorization(self) -> Authorization | None: + """The ``Authorization`` header parsed into an :class:`.Authorization` object. + ``None`` if the header is not present. + + .. versionchanged:: 2.3 + :class:`Authorization` is no longer a ``dict``. The ``token`` attribute + was added for auth schemes that use a token instead of parameters. + """ + return Authorization.from_header(self.headers.get("Authorization")) + + # CORS + + origin = header_property[str]( + "Origin", + doc=( + "The host that the request originated from. Set" + " :attr:`~CORSResponseMixin.access_control_allow_origin` on" + " the response to indicate which origins are allowed." + ), + read_only=True, + ) + + access_control_request_headers = header_property( + "Access-Control-Request-Headers", + load_func=parse_set_header, + doc=( + "Sent with a preflight request to indicate which headers" + " will be sent with the cross origin request. Set" + " :attr:`~CORSResponseMixin.access_control_allow_headers`" + " on the response to indicate which headers are allowed." + ), + read_only=True, + ) + + access_control_request_method = header_property[str]( + "Access-Control-Request-Method", + doc=( + "Sent with a preflight request to indicate which method" + " will be used for the cross origin request. Set" + " :attr:`~CORSResponseMixin.access_control_allow_methods`" + " on the response to indicate which methods are allowed." + ), + read_only=True, + ) + + @property + def is_json(self) -> bool: + """Check if the mimetype indicates JSON data, either + :mimetype:`application/json` or :mimetype:`application/*+json`. + """ + mt = self.mimetype + return ( + mt == "application/json" + or mt.startswith("application/") + and mt.endswith("+json") + ) diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/werkzeug/sansio/response.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/werkzeug/sansio/response.py new file mode 100644 index 0000000000000000000000000000000000000000..a52f963de2e0f697a588c36851982028c6bcb04a --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/werkzeug/sansio/response.py @@ -0,0 +1,763 @@ +from __future__ import annotations + +import typing as t +from datetime import datetime +from datetime import timedelta +from datetime import timezone +from http import HTTPStatus + +from ..datastructures import CallbackDict +from ..datastructures import ContentRange +from ..datastructures import ContentSecurityPolicy +from ..datastructures import Headers +from ..datastructures import HeaderSet +from ..datastructures import ResponseCacheControl +from ..datastructures import WWWAuthenticate +from ..http import COEP +from ..http import COOP +from ..http import dump_age +from ..http import dump_cookie +from ..http import dump_header +from ..http import dump_options_header +from ..http import http_date +from ..http import HTTP_STATUS_CODES +from ..http import parse_age +from ..http import parse_cache_control_header +from ..http import parse_content_range_header +from ..http import parse_csp_header +from ..http import parse_date +from ..http import parse_options_header +from ..http import parse_set_header +from ..http import quote_etag +from ..http import unquote_etag +from ..utils import get_content_type +from ..utils import header_property + +if t.TYPE_CHECKING: + from ..datastructures.cache_control import _CacheControl + + +def _set_property(name: str, doc: str | None = None) -> property: + def fget(self: Response) -> HeaderSet: + def on_update(header_set: HeaderSet) -> None: + if not header_set and name in self.headers: + del self.headers[name] + elif header_set: + self.headers[name] = header_set.to_header() + + return parse_set_header(self.headers.get(name), on_update) + + def fset( + self: Response, + value: None | (str | dict[str, str | int] | t.Iterable[str]), + ) -> None: + if not value: + del self.headers[name] + elif isinstance(value, str): + self.headers[name] = value + else: + self.headers[name] = dump_header(value) + + return property(fget, fset, doc=doc) + + +class Response: + """Represents the non-IO parts of an HTTP response, specifically the + status and headers but not the body. + + This class is not meant for general use. It should only be used when + implementing WSGI, ASGI, or another HTTP application spec. Werkzeug + provides a WSGI implementation at :cls:`werkzeug.wrappers.Response`. + + :param status: The status code for the response. Either an int, in + which case the default status message is added, or a string in + the form ``{code} {message}``, like ``404 Not Found``. Defaults + to 200. + :param headers: A :class:`~werkzeug.datastructures.Headers` object, + or a list of ``(key, value)`` tuples that will be converted to a + ``Headers`` object. + :param mimetype: The mime type (content type without charset or + other parameters) of the response. If the value starts with + ``text/`` (or matches some other special cases), the charset + will be added to create the ``content_type``. + :param content_type: The full content type of the response. + Overrides building the value from ``mimetype``. + + .. versionchanged:: 3.0 + The ``charset`` attribute was removed. + + .. versionadded:: 2.0 + """ + + #: the default status if none is provided. + default_status = 200 + + #: the default mimetype if none is provided. + default_mimetype: str | None = "text/plain" + + #: Warn if a cookie header exceeds this size. The default, 4093, should be + #: safely `supported by most browsers `_. A cookie larger than + #: this size will still be sent, but it may be ignored or handled + #: incorrectly by some browsers. Set to 0 to disable this check. + #: + #: .. versionadded:: 0.13 + #: + #: .. _`cookie`: http://browsercookielimits.squawky.net/ + max_cookie_size = 4093 + + # A :class:`Headers` object representing the response headers. + headers: Headers + + def __init__( + self, + status: int | str | HTTPStatus | None = None, + headers: t.Mapping[str, str | t.Iterable[str]] + | t.Iterable[tuple[str, str]] + | None = None, + mimetype: str | None = None, + content_type: str | None = None, + ) -> None: + if isinstance(headers, Headers): + self.headers = headers + elif not headers: + self.headers = Headers() + else: + self.headers = Headers(headers) + + if content_type is None: + if mimetype is None and "content-type" not in self.headers: + mimetype = self.default_mimetype + if mimetype is not None: + mimetype = get_content_type(mimetype, "utf-8") + content_type = mimetype + if content_type is not None: + self.headers["Content-Type"] = content_type + if status is None: + status = self.default_status + self.status = status + + def __repr__(self) -> str: + return f"<{type(self).__name__} [{self.status}]>" + + @property + def status_code(self) -> int: + """The HTTP status code as a number.""" + return self._status_code + + @status_code.setter + def status_code(self, code: int) -> None: + self.status = code + + @property + def status(self) -> str: + """The HTTP status code as a string.""" + return self._status + + @status.setter + def status(self, value: str | int | HTTPStatus) -> None: + self._status, self._status_code = self._clean_status(value) + + def _clean_status(self, value: str | int | HTTPStatus) -> tuple[str, int]: + if isinstance(value, (int, HTTPStatus)): + status_code = int(value) + else: + value = value.strip() + + if not value: + raise ValueError("Empty status argument") + + code_str, sep, _ = value.partition(" ") + + try: + status_code = int(code_str) + except ValueError: + # only message + return f"0 {value}", 0 + + if sep: + # code and message + return value, status_code + + # only code, look up message + try: + status = f"{status_code} {HTTP_STATUS_CODES[status_code].upper()}" + except KeyError: + status = f"{status_code} UNKNOWN" + + return status, status_code + + def set_cookie( + self, + key: str, + value: str = "", + max_age: timedelta | int | None = None, + expires: str | datetime | int | float | None = None, + path: str | None = "/", + domain: str | None = None, + secure: bool = False, + httponly: bool = False, + samesite: str | None = None, + partitioned: bool = False, + ) -> None: + """Sets a cookie. + + A warning is raised if the size of the cookie header exceeds + :attr:`max_cookie_size`, but the header will still be set. + + :param key: the key (name) of the cookie to be set. + :param value: the value of the cookie. + :param max_age: should be a number of seconds, or `None` (default) if + the cookie should last only as long as the client's + browser session. + :param expires: should be a `datetime` object or UNIX timestamp. + :param path: limits the cookie to a given path, per default it will + span the whole domain. + :param domain: if you want to set a cross-domain cookie. For example, + ``domain="example.com"`` will set a cookie that is + readable by the domain ``www.example.com``, + ``foo.example.com`` etc. Otherwise, a cookie will only + be readable by the domain that set it. + :param secure: If ``True``, the cookie will only be available + via HTTPS. + :param httponly: Disallow JavaScript access to the cookie. + :param samesite: Limit the scope of the cookie to only be + attached to requests that are "same-site". + :param partitioned: If ``True``, the cookie will be partitioned. + + .. versionchanged:: 3.1 + The ``partitioned`` parameter was added. + """ + self.headers.add( + "Set-Cookie", + dump_cookie( + key, + value=value, + max_age=max_age, + expires=expires, + path=path, + domain=domain, + secure=secure, + httponly=httponly, + max_size=self.max_cookie_size, + samesite=samesite, + partitioned=partitioned, + ), + ) + + def delete_cookie( + self, + key: str, + path: str | None = "/", + domain: str | None = None, + secure: bool = False, + httponly: bool = False, + samesite: str | None = None, + partitioned: bool = False, + ) -> None: + """Delete a cookie. Fails silently if key doesn't exist. + + :param key: the key (name) of the cookie to be deleted. + :param path: if the cookie that should be deleted was limited to a + path, the path has to be defined here. + :param domain: if the cookie that should be deleted was limited to a + domain, that domain has to be defined here. + :param secure: If ``True``, the cookie will only be available + via HTTPS. + :param httponly: Disallow JavaScript access to the cookie. + :param samesite: Limit the scope of the cookie to only be + attached to requests that are "same-site". + :param partitioned: If ``True``, the cookie will be partitioned. + """ + self.set_cookie( + key, + expires=0, + max_age=0, + path=path, + domain=domain, + secure=secure, + httponly=httponly, + samesite=samesite, + partitioned=partitioned, + ) + + @property + def is_json(self) -> bool: + """Check if the mimetype indicates JSON data, either + :mimetype:`application/json` or :mimetype:`application/*+json`. + """ + mt = self.mimetype + return mt is not None and ( + mt == "application/json" + or mt.startswith("application/") + and mt.endswith("+json") + ) + + # Common Descriptors + + @property + def mimetype(self) -> str | None: + """The mimetype (content type without charset etc.)""" + ct = self.headers.get("content-type") + + if ct: + return ct.split(";")[0].strip() + else: + return None + + @mimetype.setter + def mimetype(self, value: str) -> None: + self.headers["Content-Type"] = get_content_type(value, "utf-8") + + @property + def mimetype_params(self) -> dict[str, str]: + """The mimetype parameters as dict. For example if the + content type is ``text/html; charset=utf-8`` the params would be + ``{'charset': 'utf-8'}``. + + .. versionadded:: 0.5 + """ + + def on_update(d: CallbackDict[str, str]) -> None: + self.headers["Content-Type"] = dump_options_header(self.mimetype, d) + + d = parse_options_header(self.headers.get("content-type", ""))[1] + return CallbackDict(d, on_update) + + location = header_property[str]( + "Location", + doc="""The Location response-header field is used to redirect + the recipient to a location other than the Request-URI for + completion of the request or identification of a new + resource.""", + ) + age = header_property( + "Age", + None, + parse_age, + dump_age, # type: ignore + doc="""The Age response-header field conveys the sender's + estimate of the amount of time since the response (or its + revalidation) was generated at the origin server. + + Age values are non-negative decimal integers, representing time + in seconds.""", + ) + content_type = header_property[str]( + "Content-Type", + doc="""The Content-Type entity-header field indicates the media + type of the entity-body sent to the recipient or, in the case of + the HEAD method, the media type that would have been sent had + the request been a GET.""", + ) + content_length = header_property( + "Content-Length", + None, + int, + str, + doc="""The Content-Length entity-header field indicates the size + of the entity-body, in decimal number of OCTETs, sent to the + recipient or, in the case of the HEAD method, the size of the + entity-body that would have been sent had the request been a + GET.""", + ) + content_location = header_property[str]( + "Content-Location", + doc="""The Content-Location entity-header field MAY be used to + supply the resource location for the entity enclosed in the + message when that entity is accessible from a location separate + from the requested resource's URI.""", + ) + content_encoding = header_property[str]( + "Content-Encoding", + doc="""The Content-Encoding entity-header field is used as a + modifier to the media-type. When present, its value indicates + what additional content codings have been applied to the + entity-body, and thus what decoding mechanisms must be applied + in order to obtain the media-type referenced by the Content-Type + header field.""", + ) + content_md5 = header_property[str]( + "Content-MD5", + doc="""The Content-MD5 entity-header field, as defined in + RFC 1864, is an MD5 digest of the entity-body for the purpose of + providing an end-to-end message integrity check (MIC) of the + entity-body. (Note: a MIC is good for detecting accidental + modification of the entity-body in transit, but is not proof + against malicious attacks.)""", + ) + date = header_property( + "Date", + None, + parse_date, + http_date, + doc="""The Date general-header field represents the date and + time at which the message was originated, having the same + semantics as orig-date in RFC 822. + + .. versionchanged:: 2.0 + The datetime object is timezone-aware. + """, + ) + expires = header_property( + "Expires", + None, + parse_date, + http_date, + doc="""The Expires entity-header field gives the date/time after + which the response is considered stale. A stale cache entry may + not normally be returned by a cache. + + .. versionchanged:: 2.0 + The datetime object is timezone-aware. + """, + ) + last_modified = header_property( + "Last-Modified", + None, + parse_date, + http_date, + doc="""The Last-Modified entity-header field indicates the date + and time at which the origin server believes the variant was + last modified. + + .. versionchanged:: 2.0 + The datetime object is timezone-aware. + """, + ) + + @property + def retry_after(self) -> datetime | None: + """The Retry-After response-header field can be used with a + 503 (Service Unavailable) response to indicate how long the + service is expected to be unavailable to the requesting client. + + Time in seconds until expiration or date. + + .. versionchanged:: 2.0 + The datetime object is timezone-aware. + """ + value = self.headers.get("retry-after") + if value is None: + return None + + try: + seconds = int(value) + except ValueError: + return parse_date(value) + + return datetime.now(timezone.utc) + timedelta(seconds=seconds) + + @retry_after.setter + def retry_after(self, value: datetime | int | str | None) -> None: + if value is None: + if "retry-after" in self.headers: + del self.headers["retry-after"] + return + elif isinstance(value, datetime): + value = http_date(value) + else: + value = str(value) + self.headers["Retry-After"] = value + + vary = _set_property( + "Vary", + doc="""The Vary field value indicates the set of request-header + fields that fully determines, while the response is fresh, + whether a cache is permitted to use the response to reply to a + subsequent request without revalidation.""", + ) + content_language = _set_property( + "Content-Language", + doc="""The Content-Language entity-header field describes the + natural language(s) of the intended audience for the enclosed + entity. Note that this might not be equivalent to all the + languages used within the entity-body.""", + ) + allow = _set_property( + "Allow", + doc="""The Allow entity-header field lists the set of methods + supported by the resource identified by the Request-URI. The + purpose of this field is strictly to inform the recipient of + valid methods associated with the resource. An Allow header + field MUST be present in a 405 (Method Not Allowed) + response.""", + ) + + # ETag + + @property + def cache_control(self) -> ResponseCacheControl: + """The Cache-Control general-header field is used to specify + directives that MUST be obeyed by all caching mechanisms along the + request/response chain. + """ + + def on_update(cache_control: _CacheControl) -> None: + if not cache_control and "cache-control" in self.headers: + del self.headers["cache-control"] + elif cache_control: + self.headers["Cache-Control"] = cache_control.to_header() + + return parse_cache_control_header( + self.headers.get("cache-control"), on_update, ResponseCacheControl + ) + + def set_etag(self, etag: str, weak: bool = False) -> None: + """Set the etag, and override the old one if there was one.""" + self.headers["ETag"] = quote_etag(etag, weak) + + def get_etag(self) -> tuple[str, bool] | tuple[None, None]: + """Return a tuple in the form ``(etag, is_weak)``. If there is no + ETag the return value is ``(None, None)``. + """ + return unquote_etag(self.headers.get("ETag")) + + accept_ranges = header_property[str]( + "Accept-Ranges", + doc="""The `Accept-Ranges` header. Even though the name would + indicate that multiple values are supported, it must be one + string token only. + + The values ``'bytes'`` and ``'none'`` are common. + + .. versionadded:: 0.7""", + ) + + @property + def content_range(self) -> ContentRange: + """The ``Content-Range`` header as a + :class:`~werkzeug.datastructures.ContentRange` object. Available + even if the header is not set. + + .. versionadded:: 0.7 + """ + + def on_update(rng: ContentRange) -> None: + if not rng: + del self.headers["content-range"] + else: + self.headers["Content-Range"] = rng.to_header() + + rv = parse_content_range_header(self.headers.get("content-range"), on_update) + # always provide a content range object to make the descriptor + # more user friendly. It provides an unset() method that can be + # used to remove the header quickly. + if rv is None: + rv = ContentRange(None, None, None, on_update=on_update) + return rv + + @content_range.setter + def content_range(self, value: ContentRange | str | None) -> None: + if not value: + del self.headers["content-range"] + elif isinstance(value, str): + self.headers["Content-Range"] = value + else: + self.headers["Content-Range"] = value.to_header() + + # Authorization + + @property + def www_authenticate(self) -> WWWAuthenticate: + """The ``WWW-Authenticate`` header parsed into a :class:`.WWWAuthenticate` + object. Modifying the object will modify the header value. + + This header is not set by default. To set this header, assign an instance of + :class:`.WWWAuthenticate` to this attribute. + + .. code-block:: python + + response.www_authenticate = WWWAuthenticate( + "basic", {"realm": "Authentication Required"} + ) + + Multiple values for this header can be sent to give the client multiple options. + Assign a list to set multiple headers. However, modifying the items in the list + will not automatically update the header values, and accessing this attribute + will only ever return the first value. + + To unset this header, assign ``None`` or use ``del``. + + .. versionchanged:: 2.3 + This attribute can be assigned to set the header. A list can be assigned + to set multiple header values. Use ``del`` to unset the header. + + .. versionchanged:: 2.3 + :class:`WWWAuthenticate` is no longer a ``dict``. The ``token`` attribute + was added for auth challenges that use a token instead of parameters. + """ + value = WWWAuthenticate.from_header(self.headers.get("WWW-Authenticate")) + + if value is None: + value = WWWAuthenticate("basic") + + def on_update(value: WWWAuthenticate) -> None: + self.www_authenticate = value + + value._on_update = on_update + return value + + @www_authenticate.setter + def www_authenticate( + self, value: WWWAuthenticate | list[WWWAuthenticate] | None + ) -> None: + if not value: # None or empty list + del self.www_authenticate + elif isinstance(value, list): + # Clear any existing header by setting the first item. + self.headers.set("WWW-Authenticate", value[0].to_header()) + + for item in value[1:]: + # Add additional header lines for additional items. + self.headers.add("WWW-Authenticate", item.to_header()) + else: + self.headers.set("WWW-Authenticate", value.to_header()) + + def on_update(value: WWWAuthenticate) -> None: + self.www_authenticate = value + + # When setting a single value, allow updating it directly. + value._on_update = on_update + + @www_authenticate.deleter + def www_authenticate(self) -> None: + if "WWW-Authenticate" in self.headers: + del self.headers["WWW-Authenticate"] + + # CSP + + @property + def content_security_policy(self) -> ContentSecurityPolicy: + """The ``Content-Security-Policy`` header as a + :class:`~werkzeug.datastructures.ContentSecurityPolicy` object. Available + even if the header is not set. + + The Content-Security-Policy header adds an additional layer of + security to help detect and mitigate certain types of attacks. + """ + + def on_update(csp: ContentSecurityPolicy) -> None: + if not csp: + del self.headers["content-security-policy"] + else: + self.headers["Content-Security-Policy"] = csp.to_header() + + rv = parse_csp_header(self.headers.get("content-security-policy"), on_update) + if rv is None: + rv = ContentSecurityPolicy(None, on_update=on_update) + return rv + + @content_security_policy.setter + def content_security_policy( + self, value: ContentSecurityPolicy | str | None + ) -> None: + if not value: + del self.headers["content-security-policy"] + elif isinstance(value, str): + self.headers["Content-Security-Policy"] = value + else: + self.headers["Content-Security-Policy"] = value.to_header() + + @property + def content_security_policy_report_only(self) -> ContentSecurityPolicy: + """The ``Content-Security-policy-report-only`` header as a + :class:`~werkzeug.datastructures.ContentSecurityPolicy` object. Available + even if the header is not set. + + The Content-Security-Policy-Report-Only header adds a csp policy + that is not enforced but is reported thereby helping detect + certain types of attacks. + """ + + def on_update(csp: ContentSecurityPolicy) -> None: + if not csp: + del self.headers["content-security-policy-report-only"] + else: + self.headers["Content-Security-policy-report-only"] = csp.to_header() + + rv = parse_csp_header( + self.headers.get("content-security-policy-report-only"), on_update + ) + if rv is None: + rv = ContentSecurityPolicy(None, on_update=on_update) + return rv + + @content_security_policy_report_only.setter + def content_security_policy_report_only( + self, value: ContentSecurityPolicy | str | None + ) -> None: + if not value: + del self.headers["content-security-policy-report-only"] + elif isinstance(value, str): + self.headers["Content-Security-policy-report-only"] = value + else: + self.headers["Content-Security-policy-report-only"] = value.to_header() + + # CORS + + @property + def access_control_allow_credentials(self) -> bool: + """Whether credentials can be shared by the browser to + JavaScript code. As part of the preflight request it indicates + whether credentials can be used on the cross origin request. + """ + return "Access-Control-Allow-Credentials" in self.headers + + @access_control_allow_credentials.setter + def access_control_allow_credentials(self, value: bool | None) -> None: + if value is True: + self.headers["Access-Control-Allow-Credentials"] = "true" + else: + self.headers.pop("Access-Control-Allow-Credentials", None) + + access_control_allow_headers = header_property( + "Access-Control-Allow-Headers", + load_func=parse_set_header, + dump_func=dump_header, + doc="Which headers can be sent with the cross origin request.", + ) + + access_control_allow_methods = header_property( + "Access-Control-Allow-Methods", + load_func=parse_set_header, + dump_func=dump_header, + doc="Which methods can be used for the cross origin request.", + ) + + access_control_allow_origin = header_property[str]( + "Access-Control-Allow-Origin", + doc="The origin or '*' for any origin that may make cross origin requests.", + ) + + access_control_expose_headers = header_property( + "Access-Control-Expose-Headers", + load_func=parse_set_header, + dump_func=dump_header, + doc="Which headers can be shared by the browser to JavaScript code.", + ) + + access_control_max_age = header_property( + "Access-Control-Max-Age", + load_func=int, + dump_func=str, + doc="The maximum age in seconds the access control settings can be cached for.", + ) + + cross_origin_opener_policy = header_property[COOP]( + "Cross-Origin-Opener-Policy", + load_func=lambda value: COOP(value), + dump_func=lambda value: value.value, + default=COOP.UNSAFE_NONE, + doc="""Allows control over sharing of browsing context group with cross-origin + documents. Values must be a member of the :class:`werkzeug.http.COOP` enum.""", + ) + + cross_origin_embedder_policy = header_property[COEP]( + "Cross-Origin-Embedder-Policy", + load_func=lambda value: COEP(value), + dump_func=lambda value: value.value, + default=COEP.UNSAFE_NONE, + doc="""Prevents a document from loading any cross-origin resources that do not + explicitly grant the document permission. Values must be a member of the + :class:`werkzeug.http.COEP` enum.""", + ) diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/werkzeug/sansio/utils.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/werkzeug/sansio/utils.py new file mode 100644 index 0000000000000000000000000000000000000000..ff7ceda340ef2f9ec6bb04a9e14da633d579da9e --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/werkzeug/sansio/utils.py @@ -0,0 +1,167 @@ +from __future__ import annotations + +import typing as t +from urllib.parse import quote + +from .._internal import _plain_int +from ..exceptions import SecurityError +from ..urls import uri_to_iri + + +def host_is_trusted(hostname: str | None, trusted_list: t.Iterable[str]) -> bool: + """Check if a host matches a list of trusted names. + + :param hostname: The name to check. + :param trusted_list: A list of valid names to match. If a name + starts with a dot it will match all subdomains. + + .. versionadded:: 0.9 + """ + if not hostname: + return False + + try: + hostname = hostname.partition(":")[0].encode("idna").decode("ascii") + except UnicodeEncodeError: + return False + + if isinstance(trusted_list, str): + trusted_list = [trusted_list] + + for ref in trusted_list: + if ref.startswith("."): + ref = ref[1:] + suffix_match = True + else: + suffix_match = False + + try: + ref = ref.partition(":")[0].encode("idna").decode("ascii") + except UnicodeEncodeError: + return False + + if ref == hostname or (suffix_match and hostname.endswith(f".{ref}")): + return True + + return False + + +def get_host( + scheme: str, + host_header: str | None, + server: tuple[str, int | None] | None = None, + trusted_hosts: t.Iterable[str] | None = None, +) -> str: + """Return the host for the given parameters. + + This first checks the ``host_header``. If it's not present, then + ``server`` is used. The host will only contain the port if it is + different than the standard port for the protocol. + + Optionally, verify that the host is trusted using + :func:`host_is_trusted` and raise a + :exc:`~werkzeug.exceptions.SecurityError` if it is not. + + :param scheme: The protocol the request used, like ``"https"``. + :param host_header: The ``Host`` header value. + :param server: Address of the server. ``(host, port)``, or + ``(path, None)`` for unix sockets. + :param trusted_hosts: A list of trusted host names. + + :return: Host, with port if necessary. + :raise ~werkzeug.exceptions.SecurityError: If the host is not + trusted. + + .. versionchanged:: 3.1.3 + If ``SERVER_NAME`` is IPv6, it is wrapped in ``[]``. + """ + host = "" + + if host_header is not None: + host = host_header + elif server is not None: + host = server[0] + + # If SERVER_NAME is IPv6, wrap it in [] to match Host header. + # Check for : because domain or IPv4 can't have that. + if ":" in host and host[0] != "[": + host = f"[{host}]" + + if server[1] is not None: + host = f"{host}:{server[1]}" + + if scheme in {"http", "ws"} and host.endswith(":80"): + host = host[:-3] + elif scheme in {"https", "wss"} and host.endswith(":443"): + host = host[:-4] + + if trusted_hosts is not None: + if not host_is_trusted(host, trusted_hosts): + raise SecurityError(f"Host {host!r} is not trusted.") + + return host + + +def get_current_url( + scheme: str, + host: str, + root_path: str | None = None, + path: str | None = None, + query_string: bytes | None = None, +) -> str: + """Recreate the URL for a request. If an optional part isn't + provided, it and subsequent parts are not included in the URL. + + The URL is an IRI, not a URI, so it may contain Unicode characters. + Use :func:`~werkzeug.urls.iri_to_uri` to convert it to ASCII. + + :param scheme: The protocol the request used, like ``"https"``. + :param host: The host the request was made to. See :func:`get_host`. + :param root_path: Prefix that the application is mounted under. This + is prepended to ``path``. + :param path: The path part of the URL after ``root_path``. + :param query_string: The portion of the URL after the "?". + """ + url = [scheme, "://", host] + + if root_path is None: + url.append("/") + return uri_to_iri("".join(url)) + + # safe = https://url.spec.whatwg.org/#url-path-segment-string + # as well as percent for things that are already quoted + url.append(quote(root_path.rstrip("/"), safe="!$&'()*+,/:;=@%")) + url.append("/") + + if path is None: + return uri_to_iri("".join(url)) + + url.append(quote(path.lstrip("/"), safe="!$&'()*+,/:;=@%")) + + if query_string: + url.append("?") + url.append(quote(query_string, safe="!$&'()*+,/:;=?@%")) + + return uri_to_iri("".join(url)) + + +def get_content_length( + http_content_length: str | None = None, + http_transfer_encoding: str | None = None, +) -> int | None: + """Return the ``Content-Length`` header value as an int. If the header is not given + or the ``Transfer-Encoding`` header is ``chunked``, ``None`` is returned to indicate + a streaming request. If the value is not an integer, or negative, 0 is returned. + + :param http_content_length: The Content-Length HTTP header. + :param http_transfer_encoding: The Transfer-Encoding HTTP header. + + .. versionadded:: 2.2 + """ + if http_transfer_encoding == "chunked" or http_content_length is None: + return None + + try: + return max(0, _plain_int(http_content_length)) + except ValueError: + return 0 diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/werkzeug/security.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/werkzeug/security.py new file mode 100644 index 0000000000000000000000000000000000000000..9ae51176b9190e5df1a9bad0e5c0d988cf36b454 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/werkzeug/security.py @@ -0,0 +1,201 @@ +from __future__ import annotations + +import hashlib +import hmac +import os +import posixpath +import secrets + +SALT_CHARS = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789" +DEFAULT_PBKDF2_ITERATIONS = 1_000_000 + +_os_alt_seps: list[str] = list( + sep for sep in [os.sep, os.altsep] if sep is not None and sep != "/" +) +# https://chrisdenton.github.io/omnipath/Special%20Dos%20Device%20Names.html +_windows_device_files = { + "AUX", + "CON", + "CONIN$", + "CONOUT$", + *(f"COM{c}" for c in "123456789¹²³"), + *(f"LPT{c}" for c in "123456789¹²³"), + "NUL", + "PRN", +} + + +def gen_salt(length: int) -> str: + """Generate a random string of SALT_CHARS with specified ``length``.""" + if length <= 0: + raise ValueError("Salt length must be at least 1.") + + return "".join(secrets.choice(SALT_CHARS) for _ in range(length)) + + +def _hash_internal(method: str, salt: str, password: str) -> tuple[str, str]: + method, *args = method.split(":") + salt_bytes = salt.encode() + password_bytes = password.encode() + + if method == "scrypt": + if not args: + n = 2**15 + r = 8 + p = 1 + else: + try: + n, r, p = map(int, args) + except ValueError: + raise ValueError("'scrypt' takes 3 arguments.") from None + + maxmem = 132 * n * r * p # ideally 128, but some extra seems needed + return ( + hashlib.scrypt( + password_bytes, salt=salt_bytes, n=n, r=r, p=p, maxmem=maxmem + ).hex(), + f"scrypt:{n}:{r}:{p}", + ) + elif method == "pbkdf2": + len_args = len(args) + + if len_args == 0: + hash_name = "sha256" + iterations = DEFAULT_PBKDF2_ITERATIONS + elif len_args == 1: + hash_name = args[0] + iterations = DEFAULT_PBKDF2_ITERATIONS + elif len_args == 2: + hash_name = args[0] + iterations = int(args[1]) + else: + raise ValueError("'pbkdf2' takes 2 arguments.") + + return ( + hashlib.pbkdf2_hmac( + hash_name, password_bytes, salt_bytes, iterations + ).hex(), + f"pbkdf2:{hash_name}:{iterations}", + ) + else: + raise ValueError(f"Invalid hash method '{method}'.") + + +def generate_password_hash( + password: str, method: str = "scrypt", salt_length: int = 16 +) -> str: + """Securely hash a password for storage. A password can be compared to a stored hash + using :func:`check_password_hash`. + + The following methods are supported: + + - ``scrypt``, the default. The parameters are ``n``, ``r``, and ``p``, the default + is ``scrypt:32768:8:1``. See :func:`hashlib.scrypt`. + - ``pbkdf2``, less secure. The parameters are ``hash_method`` and ``iterations``, + the default is ``pbkdf2:sha256:600000``. See :func:`hashlib.pbkdf2_hmac`. + + Default parameters may be updated to reflect current guidelines, and methods may be + deprecated and removed if they are no longer considered secure. To migrate old + hashes, you may generate a new hash when checking an old hash, or you may contact + users with a link to reset their password. + + :param password: The plaintext password. + :param method: The key derivation function and parameters. + :param salt_length: The number of characters to generate for the salt. + + .. versionchanged:: 3.1 + The default iterations for pbkdf2 was increased to 1,000,000. + + .. versionchanged:: 2.3 + Scrypt support was added. + + .. versionchanged:: 2.3 + The default iterations for pbkdf2 was increased to 600,000. + + .. versionchanged:: 2.3 + All plain hashes are deprecated and will not be supported in Werkzeug 3.0. + """ + salt = gen_salt(salt_length) + h, actual_method = _hash_internal(method, salt, password) + return f"{actual_method}${salt}${h}" + + +def check_password_hash(pwhash: str, password: str) -> bool: + """Securely check that the given stored password hash, previously generated using + :func:`generate_password_hash`, matches the given password. + + Methods may be deprecated and removed if they are no longer considered secure. To + migrate old hashes, you may generate a new hash when checking an old hash, or you + may contact users with a link to reset their password. + + :param pwhash: The hashed password. + :param password: The plaintext password. + + .. versionchanged:: 2.3 + All plain hashes are deprecated and will not be supported in Werkzeug 3.0. + """ + try: + method, salt, hashval = pwhash.split("$", 2) + except ValueError: + return False + + return hmac.compare_digest(_hash_internal(method, salt, password)[0], hashval) + + +def safe_join(directory: str, *untrusted: str) -> str | None: + """Safely join zero or more untrusted path components to a trusted base + directory to avoid escaping the base directory. + + The untrusted path is assumed to be from/for a URL, such as for serving + files. Therefore, it should only use the forward slash ``/`` path separator, + and will be joined using that separator. On Windows, the backslash ``\\`` + separator is not allowed. + + :param directory: The trusted base directory. + :param untrusted: The untrusted path components relative to the + base directory. + :return: A safe path, otherwise ``None``. + + .. versionchanged:: 3.1.6 + Special device names in multi-segment paths are not allowed on Windows. + + .. versionchanged:: 3.1.5 + More special device names, regardless of extension or trailing spaces, + are not allowed on Windows. + + .. versionchanged:: 3.1.4 + Special device names are not allowed on Windows. + """ + if not directory: + # Ensure we end up with ./path if directory="" is given, + # otherwise the first untrusted part could become trusted. + directory = "." + + parts = [directory] + + for part in untrusted: + if not part: + continue + + part = posixpath.normpath(part) + + if ( + os.path.isabs(part) + # ntpath.isabs doesn't catch this + or part.startswith("/") + or part == ".." + or part.startswith("../") + or any(sep in part for sep in _os_alt_seps) + or ( + os.name == "nt" + and any( + p.partition(".")[0].strip().upper() in _windows_device_files + for p in part.split("/") + ) + ) + ): + return None + + parts.append(part) + + return posixpath.join(*parts) diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/werkzeug/serving.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/werkzeug/serving.py new file mode 100644 index 0000000000000000000000000000000000000000..8605cfd6dfb0cabbc3700059c8429ce74cbf977f --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/werkzeug/serving.py @@ -0,0 +1,1125 @@ +"""A WSGI and HTTP server for use **during development only**. This +server is convenient to use, but is not designed to be particularly +stable, secure, or efficient. Use a dedicate WSGI server and HTTP +server when deploying to production. + +It provides features like interactive debugging and code reloading. Use +``run_simple`` to start the server. Put this in a ``run.py`` script: + +.. code-block:: python + + from myapp import create_app + from werkzeug import run_simple +""" + +from __future__ import annotations + +import errno +import io +import os +import selectors +import socket +import socketserver +import sys +import typing as t +from datetime import datetime as dt +from datetime import timedelta +from datetime import timezone +from http.server import BaseHTTPRequestHandler +from http.server import HTTPServer +from urllib.parse import unquote +from urllib.parse import urlsplit + +from ._internal import _log +from ._internal import _wsgi_encoding_dance +from .exceptions import InternalServerError +from .urls import uri_to_iri + +try: + import ssl + + connection_dropped_errors: tuple[type[Exception], ...] = ( + ConnectionError, + socket.timeout, + ssl.SSLEOFError, + ) +except ImportError: + + class _SslDummy: + def __getattr__(self, name: str) -> t.Any: + raise RuntimeError( # noqa: B904 + "SSL is unavailable because this Python runtime was not" + " compiled with SSL/TLS support." + ) + + ssl = _SslDummy() # type: ignore + connection_dropped_errors = (ConnectionError, socket.timeout) + +_log_add_style = True + +if os.name == "nt": + try: + __import__("colorama") + except ImportError: + _log_add_style = False + +can_fork = hasattr(os, "fork") + +if can_fork: + ForkingMixIn = socketserver.ForkingMixIn +else: + + class ForkingMixIn: # type: ignore + pass + + +try: + af_unix = socket.AF_UNIX +except AttributeError: + af_unix = None # type: ignore + +LISTEN_QUEUE = 128 + +_TSSLContextArg = t.Optional[ + t.Union["ssl.SSLContext", tuple[str, t.Optional[str]], t.Literal["adhoc"]] +] + +if t.TYPE_CHECKING: + from _typeshed.wsgi import WSGIApplication + from _typeshed.wsgi import WSGIEnvironment + from cryptography.hazmat.primitives.asymmetric.rsa import ( + RSAPrivateKeyWithSerialization, + ) + from cryptography.x509 import Certificate + + +class DechunkedInput(io.RawIOBase): + """An input stream that handles Transfer-Encoding 'chunked'""" + + def __init__(self, rfile: t.IO[bytes]) -> None: + self._rfile = rfile + self._done = False + self._len = 0 + + def readable(self) -> bool: + return True + + def read_chunk_len(self) -> int: + try: + line = self._rfile.readline().decode("latin1") + _len = int(line.strip(), 16) + except ValueError as e: + raise OSError("Invalid chunk header") from e + if _len < 0: + raise OSError("Negative chunk length not allowed") + return _len + + def readinto(self, buf: bytearray) -> int: # type: ignore + read = 0 + while not self._done and read < len(buf): + if self._len == 0: + # This is the first chunk or we fully consumed the previous + # one. Read the next length of the next chunk + self._len = self.read_chunk_len() + + if self._len == 0: + # Found the final chunk of size 0. The stream is now exhausted, + # but there is still a final newline that should be consumed + self._done = True + + if self._len > 0: + # There is data (left) in this chunk, so append it to the + # buffer. If this operation fully consumes the chunk, this will + # reset self._len to 0. + n = min(len(buf), self._len) + + # If (read + chunk size) becomes more than len(buf), buf will + # grow beyond the original size and read more data than + # required. So only read as much data as can fit in buf. + if read + n > len(buf): + buf[read:] = self._rfile.read(len(buf) - read) + self._len -= len(buf) - read + read = len(buf) + else: + buf[read : read + n] = self._rfile.read(n) + self._len -= n + read += n + + if self._len == 0: + # Skip the terminating newline of a chunk that has been fully + # consumed. This also applies to the 0-sized final chunk + terminator = self._rfile.readline() + if terminator not in (b"\n", b"\r\n", b"\r"): + raise OSError("Missing chunk terminating newline") + + return read + + +class WSGIRequestHandler(BaseHTTPRequestHandler): + """A request handler that implements WSGI dispatching.""" + + server: BaseWSGIServer + + @property + def server_version(self) -> str: # type: ignore + return self.server._server_version + + def make_environ(self) -> WSGIEnvironment: + request_url = urlsplit(self.path) + url_scheme = "http" if self.server.ssl_context is None else "https" + + if not self.client_address: + self.client_address = ("", 0) + elif isinstance(self.client_address, str): + self.client_address = (self.client_address, 0) + + # If there was no scheme but the path started with two slashes, + # the first segment may have been incorrectly parsed as the + # netloc, prepend it to the path again. + if not request_url.scheme and request_url.netloc: + path_info = f"/{request_url.netloc}{request_url.path}" + else: + path_info = request_url.path + + path_info = unquote(path_info) + + environ: WSGIEnvironment = { + "wsgi.version": (1, 0), + "wsgi.url_scheme": url_scheme, + "wsgi.input": self.rfile, + "wsgi.errors": sys.stderr, + "wsgi.multithread": self.server.multithread, + "wsgi.multiprocess": self.server.multiprocess, + "wsgi.run_once": False, + "werkzeug.socket": self.connection, + "SERVER_SOFTWARE": self.server_version, + "REQUEST_METHOD": self.command, + "SCRIPT_NAME": "", + "PATH_INFO": _wsgi_encoding_dance(path_info), + "QUERY_STRING": _wsgi_encoding_dance(request_url.query), + # Non-standard, added by mod_wsgi, uWSGI + "REQUEST_URI": _wsgi_encoding_dance(self.path), + # Non-standard, added by gunicorn + "RAW_URI": _wsgi_encoding_dance(self.path), + "REMOTE_ADDR": self.address_string(), + "REMOTE_PORT": self.port_integer(), + "SERVER_NAME": self.server.server_address[0], + "SERVER_PORT": str(self.server.server_address[1]), + "SERVER_PROTOCOL": self.request_version, + } + + for key, value in self.headers.items(): + if "_" in key: + continue + + key = key.upper().replace("-", "_") + value = value.replace("\r\n", "") + if key not in ("CONTENT_TYPE", "CONTENT_LENGTH"): + key = f"HTTP_{key}" + if key in environ: + value = f"{environ[key]},{value}" + environ[key] = value + + if environ.get("HTTP_TRANSFER_ENCODING", "").strip().lower() == "chunked": + environ["wsgi.input_terminated"] = True + environ["wsgi.input"] = DechunkedInput(environ["wsgi.input"]) + + # Per RFC 2616, if the URL is absolute, use that as the host. + # We're using "has a scheme" to indicate an absolute URL. + if request_url.scheme and request_url.netloc: + environ["HTTP_HOST"] = request_url.netloc + + try: + # binary_form=False gives nicer information, but wouldn't be compatible with + # what Nginx or Apache could return. + peer_cert = self.connection.getpeercert(binary_form=True) + if peer_cert is not None: + # Nginx and Apache use PEM format. + environ["SSL_CLIENT_CERT"] = ssl.DER_cert_to_PEM_cert(peer_cert) + except ValueError: + # SSL handshake hasn't finished. + self.server.log("error", "Cannot fetch SSL peer certificate info") + except AttributeError: + # Not using TLS, the socket will not have getpeercert(). + pass + + return environ + + def run_wsgi(self) -> None: + if self.headers.get("Expect", "").lower().strip() == "100-continue": + self.wfile.write(b"HTTP/1.1 100 Continue\r\n\r\n") + + self.environ = environ = self.make_environ() + status_set: str | None = None + headers_set: list[tuple[str, str]] | None = None + status_sent: str | None = None + headers_sent: list[tuple[str, str]] | None = None + chunk_response: bool = False + + def write(data: bytes) -> None: + nonlocal status_sent, headers_sent, chunk_response + assert status_set is not None, "write() before start_response" + assert headers_set is not None, "write() before start_response" + if status_sent is None: + status_sent = status_set + headers_sent = headers_set + try: + code_str, msg = status_sent.split(None, 1) + except ValueError: + code_str, msg = status_sent, "" + code = int(code_str) + self.send_response(code, msg) + header_keys = set() + for key, value in headers_sent: + self.send_header(key, value) + header_keys.add(key.lower()) + + # Use chunked transfer encoding if there is no content + # length. Do not use for 1xx and 204 responses. 304 + # responses and HEAD requests are also excluded, which + # is the more conservative behavior and matches other + # parts of the code. + # https://httpwg.org/specs/rfc7230.html#rfc.section.3.3.1 + if ( + not ( + "content-length" in header_keys + or environ["REQUEST_METHOD"] == "HEAD" + or (100 <= code < 200) + or code in {204, 304} + ) + and self.protocol_version >= "HTTP/1.1" + ): + chunk_response = True + self.send_header("Transfer-Encoding", "chunked") + + # Always close the connection. This disables HTTP/1.1 + # keep-alive connections. They aren't handled well by + # Python's http.server because it doesn't know how to + # drain the stream before the next request line. + self.send_header("Connection", "close") + self.end_headers() + + assert isinstance(data, bytes), "applications must write bytes" + + if data: + if chunk_response: + self.wfile.write(hex(len(data))[2:].encode()) + self.wfile.write(b"\r\n") + + self.wfile.write(data) + + if chunk_response: + self.wfile.write(b"\r\n") + + self.wfile.flush() + + def start_response(status, headers, exc_info=None): # type: ignore + nonlocal status_set, headers_set + if exc_info: + try: + if headers_sent: + raise exc_info[1].with_traceback(exc_info[2]) + finally: + exc_info = None + elif headers_set: + raise AssertionError("Headers already set") + status_set = status + headers_set = headers + return write + + def execute(app: WSGIApplication) -> None: + application_iter = app(environ, start_response) + try: + for data in application_iter: + write(data) + if not headers_sent: + write(b"") + if chunk_response: + self.wfile.write(b"0\r\n\r\n") + finally: + # Check for any remaining data in the read socket, and discard it. This + # will read past request.max_content_length, but lets the client see a + # 413 response instead of a connection reset failure. If we supported + # keep-alive connections, this naive approach would break by reading the + # next request line. Since we know that write (above) closes every + # connection we can read everything. + selector = selectors.DefaultSelector() + selector.register(self.connection, selectors.EVENT_READ) + total_size = 0 + total_reads = 0 + + # A timeout of 0 tends to fail because a client needs a small amount of + # time to continue sending its data. + while selector.select(timeout=0.01): + # Only read 10MB into memory at a time. + data = self.rfile.read(10_000_000) + total_size += len(data) + total_reads += 1 + + # Stop reading on no data, >=10GB, or 1000 reads. If a client sends + # more than that, they'll get a connection reset failure. + if not data or total_size >= 10_000_000_000 or total_reads > 1000: + break + + selector.close() + + if hasattr(application_iter, "close"): + application_iter.close() + + try: + execute(self.server.app) + except connection_dropped_errors as e: + self.connection_dropped(e, environ) + except Exception as e: + if self.server.passthrough_errors: + raise + + if status_sent is not None and chunk_response: + self.close_connection = True + + try: + # if we haven't yet sent the headers but they are set + # we roll back to be able to set them again. + if status_sent is None: + status_set = None + headers_set = None + execute(InternalServerError()) + except Exception: + pass + + from .debug.tbtools import DebugTraceback + + msg = DebugTraceback(e).render_traceback_text() + self.server.log("error", f"Error on request:\n{msg}") + + def handle(self) -> None: + """Handles a request ignoring dropped connections.""" + try: + super().handle() + except (ConnectionError, socket.timeout) as e: + self.connection_dropped(e) + except Exception as e: + if self.server.ssl_context is not None and is_ssl_error(e): + self.log_error("SSL error occurred: %s", e) + else: + raise + + def connection_dropped( + self, error: BaseException, environ: WSGIEnvironment | None = None + ) -> None: + """Called if the connection was closed by the client. By default + nothing happens. + """ + + def __getattr__(self, name: str) -> t.Any: + # All HTTP methods are handled by run_wsgi. + if name.startswith("do_"): + return self.run_wsgi + + # All other attributes are forwarded to the base class. + return getattr(super(), name) + + def address_string(self) -> str: + if getattr(self, "environ", None): + return self.environ["REMOTE_ADDR"] # type: ignore + + if not self.client_address: + return "" + + return self.client_address[0] + + def port_integer(self) -> int: + return self.client_address[1] + + # Escape control characters. This is defined (but private) in Python 3.12. + _control_char_table = str.maketrans( + {c: rf"\x{c:02x}" for c in [*range(0x20), *range(0x7F, 0xA0)]} + ) + _control_char_table[ord("\\")] = r"\\" + + def log_request(self, code: int | str = "-", size: int | str = "-") -> None: + try: + path = uri_to_iri(self.path) + msg = f"{self.command} {path} {self.request_version}" + except AttributeError: + # path isn't set if the requestline was bad + msg = self.requestline + + # Escape control characters that may be in the decoded path. + msg = msg.translate(self._control_char_table) + code = str(code) + + if code[0] == "1": # 1xx - Informational + msg = _ansi_style(msg, "bold") + elif code == "200": # 2xx - Success + pass + elif code == "304": # 304 - Resource Not Modified + msg = _ansi_style(msg, "cyan") + elif code[0] == "3": # 3xx - Redirection + msg = _ansi_style(msg, "green") + elif code == "404": # 404 - Resource Not Found + msg = _ansi_style(msg, "yellow") + elif code[0] == "4": # 4xx - Client Error + msg = _ansi_style(msg, "bold", "red") + else: # 5xx, or any other response + msg = _ansi_style(msg, "bold", "magenta") + + self.log("info", '"%s" %s %s', msg, code, size) + + def log_error(self, format: str, *args: t.Any) -> None: + self.log("error", format, *args) + + def log_message(self, format: str, *args: t.Any) -> None: + self.log("info", format, *args) + + def log(self, type: str, message: str, *args: t.Any) -> None: + # an IPv6 scoped address contains "%" which breaks logging + address_string = self.address_string().replace("%", "%%") + _log( + type, + f"{address_string} - - [{self.log_date_time_string()}] {message}\n", + *args, + ) + + +def _ansi_style(value: str, *styles: str) -> str: + if not _log_add_style: + return value + + codes = { + "bold": 1, + "red": 31, + "green": 32, + "yellow": 33, + "magenta": 35, + "cyan": 36, + } + + for style in styles: + value = f"\x1b[{codes[style]}m{value}" + + return f"{value}\x1b[0m" + + +def generate_adhoc_ssl_pair( + cn: str | None = None, +) -> tuple[Certificate, RSAPrivateKeyWithSerialization]: + try: + from cryptography import x509 + from cryptography.hazmat.backends import default_backend + from cryptography.hazmat.primitives import hashes + from cryptography.hazmat.primitives.asymmetric import rsa + from cryptography.x509.oid import NameOID + except ImportError: + raise TypeError( + "Using ad-hoc certificates requires the cryptography library." + ) from None + + backend = default_backend() + pkey = rsa.generate_private_key( + public_exponent=65537, key_size=2048, backend=backend + ) + + # pretty damn sure that this is not actually accepted by anyone + if cn is None: + cn = "*" + + subject = x509.Name( + [ + x509.NameAttribute(NameOID.ORGANIZATION_NAME, "Dummy Certificate"), + x509.NameAttribute(NameOID.COMMON_NAME, cn), + ] + ) + + backend = default_backend() + cert = ( + x509.CertificateBuilder() + .subject_name(subject) + .issuer_name(subject) + .public_key(pkey.public_key()) + .serial_number(x509.random_serial_number()) + .not_valid_before(dt.now(timezone.utc)) + .not_valid_after(dt.now(timezone.utc) + timedelta(days=365)) + .add_extension(x509.ExtendedKeyUsage([x509.OID_SERVER_AUTH]), critical=False) + .add_extension( + x509.SubjectAlternativeName([x509.DNSName(cn), x509.DNSName(f"*.{cn}")]), + critical=False, + ) + .sign(pkey, hashes.SHA256(), backend) + ) + return cert, pkey + + +def make_ssl_devcert( + base_path: str, host: str | None = None, cn: str | None = None +) -> tuple[str, str]: + """Creates an SSL key for development. This should be used instead of + the ``'adhoc'`` key which generates a new cert on each server start. + It accepts a path for where it should store the key and cert and + either a host or CN. If a host is given it will use the CN + ``*.host/CN=host``. + + For more information see :func:`run_simple`. + + .. versionadded:: 0.9 + + :param base_path: the path to the certificate and key. The extension + ``.crt`` is added for the certificate, ``.key`` is + added for the key. + :param host: the name of the host. This can be used as an alternative + for the `cn`. + :param cn: the `CN` to use. + """ + + if host is not None: + cn = host + cert, pkey = generate_adhoc_ssl_pair(cn=cn) + + from cryptography.hazmat.primitives import serialization + + cert_file = f"{base_path}.crt" + pkey_file = f"{base_path}.key" + + with open(cert_file, "wb") as f: + f.write(cert.public_bytes(serialization.Encoding.PEM)) + with open(pkey_file, "wb") as f: + f.write( + pkey.private_bytes( + encoding=serialization.Encoding.PEM, + format=serialization.PrivateFormat.TraditionalOpenSSL, + encryption_algorithm=serialization.NoEncryption(), + ) + ) + + return cert_file, pkey_file + + +def generate_adhoc_ssl_context() -> ssl.SSLContext: + """Generates an adhoc SSL context for the development server.""" + import atexit + import tempfile + + cert, pkey = generate_adhoc_ssl_pair() + + from cryptography.hazmat.primitives import serialization + + cert_handle, cert_file = tempfile.mkstemp() + pkey_handle, pkey_file = tempfile.mkstemp() + atexit.register(os.remove, pkey_file) + atexit.register(os.remove, cert_file) + + os.write(cert_handle, cert.public_bytes(serialization.Encoding.PEM)) + os.write( + pkey_handle, + pkey.private_bytes( + encoding=serialization.Encoding.PEM, + format=serialization.PrivateFormat.TraditionalOpenSSL, + encryption_algorithm=serialization.NoEncryption(), + ), + ) + + os.close(cert_handle) + os.close(pkey_handle) + ctx = load_ssl_context(cert_file, pkey_file) + return ctx + + +def load_ssl_context( + cert_file: str, pkey_file: str | None = None, protocol: int | None = None +) -> ssl.SSLContext: + """Loads SSL context from cert/private key files and optional protocol. + Many parameters are directly taken from the API of + :py:class:`ssl.SSLContext`. + + :param cert_file: Path of the certificate to use. + :param pkey_file: Path of the private key to use. If not given, the key + will be obtained from the certificate file. + :param protocol: A ``PROTOCOL`` constant from the :mod:`ssl` module. + Defaults to :data:`ssl.PROTOCOL_TLS_SERVER`. + """ + if protocol is None: + protocol = ssl.PROTOCOL_TLS_SERVER + + ctx = ssl.SSLContext(protocol) + ctx.load_cert_chain(cert_file, pkey_file) + return ctx + + +def is_ssl_error(error: Exception | None = None) -> bool: + """Checks if the given error (or the current one) is an SSL error.""" + if error is None: + error = t.cast(Exception, sys.exc_info()[1]) + return isinstance(error, ssl.SSLError) + + +def select_address_family(host: str, port: int) -> socket.AddressFamily: + """Return ``AF_INET4``, ``AF_INET6``, or ``AF_UNIX`` depending on + the host and port.""" + if host.startswith("unix://"): + return socket.AF_UNIX + elif ":" in host and hasattr(socket, "AF_INET6"): + return socket.AF_INET6 + return socket.AF_INET + + +def get_sockaddr( + host: str, port: int, family: socket.AddressFamily +) -> tuple[str, int] | str: + """Return a fully qualified socket address that can be passed to + :func:`socket.bind`.""" + if family == af_unix: + # Absolute path avoids IDNA encoding error when path starts with dot. + return os.path.abspath(host.partition("://")[2]) + try: + res = socket.getaddrinfo( + host, port, family, socket.SOCK_STREAM, socket.IPPROTO_TCP + ) + except socket.gaierror: + return host, port + return res[0][4] # type: ignore + + +def get_interface_ip(family: socket.AddressFamily) -> str: + """Get the IP address of an external interface. Used when binding to + 0.0.0.0 or ::1 to show a more useful URL. + + :meta private: + """ + # arbitrary private address + host = "fd31:f903:5ab5:1::1" if family == socket.AF_INET6 else "10.253.155.219" + + with socket.socket(family, socket.SOCK_DGRAM) as s: + try: + s.connect((host, 58162)) + except OSError: + return "::1" if family == socket.AF_INET6 else "127.0.0.1" + + return s.getsockname()[0] # type: ignore + + +class BaseWSGIServer(HTTPServer): + """A WSGI server that that handles one request at a time. + + Use :func:`make_server` to create a server instance. + """ + + multithread = False + multiprocess = False + request_queue_size = LISTEN_QUEUE + allow_reuse_address = True + + def __init__( + self, + host: str, + port: int, + app: WSGIApplication, + handler: type[WSGIRequestHandler] | None = None, + passthrough_errors: bool = False, + ssl_context: _TSSLContextArg | None = None, + fd: int | None = None, + ) -> None: + if handler is None: + handler = WSGIRequestHandler + + # If the handler doesn't directly set a protocol version and + # thread or process workers are used, then allow chunked + # responses and keep-alive connections by enabling HTTP/1.1. + if "protocol_version" not in vars(handler) and ( + self.multithread or self.multiprocess + ): + handler.protocol_version = "HTTP/1.1" + + self.host = host + self.port = port + self.app = app + self.passthrough_errors = passthrough_errors + + self.address_family = address_family = select_address_family(host, port) + server_address = get_sockaddr(host, int(port), address_family) + + # Remove a leftover Unix socket file from a previous run. Don't + # remove a file that was set up by run_simple. + if address_family == af_unix and fd is None: + server_address = t.cast(str, server_address) + + if os.path.exists(server_address): + os.unlink(server_address) + + # Bind and activate will be handled manually, it should only + # happen if we're not using a socket that was already set up. + super().__init__( + server_address, # type: ignore[arg-type] + handler, + bind_and_activate=False, + ) + + if fd is None: + # No existing socket descriptor, do bind_and_activate=True. + try: + self.server_bind() + self.server_activate() + except OSError as e: + # Catch connection issues and show them without the traceback. Show + # extra instructions for address not found, and for macOS. + self.server_close() + print(e.strerror, file=sys.stderr) + + if e.errno == errno.EADDRINUSE: + print( + f"Port {port} is in use by another program. Either identify and" + " stop that program, or start the server with a different" + " port.", + file=sys.stderr, + ) + + if sys.platform == "darwin" and port == 5000: + print( + "On macOS, try searching for and disabling" + " 'AirPlay Receiver' in System Settings.", + file=sys.stderr, + ) + + sys.exit(1) + except BaseException: + self.server_close() + raise + else: + # TCPServer automatically opens a socket even if bind_and_activate is False. + # Close it to silence a ResourceWarning. + self.server_close() + + # Use the passed in socket directly. + self.socket = socket.fromfd(fd, address_family, socket.SOCK_STREAM) + self.server_address = self.socket.getsockname() + + if address_family != af_unix: + # If port was 0, this will record the bound port. + self.port = self.server_address[1] + + if ssl_context is not None: + if isinstance(ssl_context, tuple): + ssl_context = load_ssl_context(*ssl_context) + elif ssl_context == "adhoc": + ssl_context = generate_adhoc_ssl_context() + + self.socket = ssl_context.wrap_socket(self.socket, server_side=True) + self.ssl_context: ssl.SSLContext | None = ssl_context + else: + self.ssl_context = None + + import importlib.metadata + + self._server_version = f"Werkzeug/{importlib.metadata.version('werkzeug')}" + + def log(self, type: str, message: str, *args: t.Any) -> None: + _log(type, message, *args) + + def serve_forever(self, poll_interval: float = 0.5) -> None: + try: + super().serve_forever(poll_interval=poll_interval) + except KeyboardInterrupt: + pass + finally: + self.server_close() + + def handle_error( + self, request: t.Any, client_address: tuple[str, int] | str + ) -> None: + if self.passthrough_errors: + raise + + return super().handle_error(request, client_address) + + def log_startup(self) -> None: + """Show information about the address when starting the server.""" + dev_warning = ( + "WARNING: This is a development server. Do not use it in a production" + " deployment. Use a production WSGI server instead." + ) + dev_warning = _ansi_style(dev_warning, "bold", "red") + messages = [dev_warning] + + if self.address_family == af_unix: + messages.append(f" * Running on {self.host}") + else: + scheme = "http" if self.ssl_context is None else "https" + display_hostname = self.host + + if self.host in {"0.0.0.0", "::"}: + messages.append(f" * Running on all addresses ({self.host})") + + if self.host == "0.0.0.0": + localhost = "127.0.0.1" + display_hostname = get_interface_ip(socket.AF_INET) + else: + localhost = "[::1]" + display_hostname = get_interface_ip(socket.AF_INET6) + + messages.append(f" * Running on {scheme}://{localhost}:{self.port}") + + if ":" in display_hostname: + display_hostname = f"[{display_hostname}]" + + messages.append(f" * Running on {scheme}://{display_hostname}:{self.port}") + + _log("info", "\n".join(messages)) + + +class ThreadedWSGIServer(socketserver.ThreadingMixIn, BaseWSGIServer): + """A WSGI server that handles concurrent requests in separate + threads. + + Use :func:`make_server` to create a server instance. + """ + + multithread = True + daemon_threads = True + + +class ForkingWSGIServer(ForkingMixIn, BaseWSGIServer): + """A WSGI server that handles concurrent requests in separate forked + processes. + + Use :func:`make_server` to create a server instance. + """ + + multiprocess = True + + def __init__( + self, + host: str, + port: int, + app: WSGIApplication, + processes: int = 40, + handler: type[WSGIRequestHandler] | None = None, + passthrough_errors: bool = False, + ssl_context: _TSSLContextArg | None = None, + fd: int | None = None, + ) -> None: + if not can_fork: + raise ValueError("Your platform does not support forking.") + + super().__init__(host, port, app, handler, passthrough_errors, ssl_context, fd) + self.max_children = processes + + +def make_server( + host: str, + port: int, + app: WSGIApplication, + threaded: bool = False, + processes: int = 1, + request_handler: type[WSGIRequestHandler] | None = None, + passthrough_errors: bool = False, + ssl_context: _TSSLContextArg | None = None, + fd: int | None = None, +) -> BaseWSGIServer: + """Create an appropriate WSGI server instance based on the value of + ``threaded`` and ``processes``. + + This is called from :func:`run_simple`, but can be used separately + to have access to the server object, such as to run it in a separate + thread. + + See :func:`run_simple` for parameter docs. + """ + if threaded and processes > 1: + raise ValueError("Cannot have a multi-thread and multi-process server.") + + if threaded: + return ThreadedWSGIServer( + host, port, app, request_handler, passthrough_errors, ssl_context, fd=fd + ) + + if processes > 1: + return ForkingWSGIServer( + host, + port, + app, + processes, + request_handler, + passthrough_errors, + ssl_context, + fd=fd, + ) + + return BaseWSGIServer( + host, port, app, request_handler, passthrough_errors, ssl_context, fd=fd + ) + + +def is_running_from_reloader() -> bool: + """Check if the server is running as a subprocess within the + Werkzeug reloader. + + .. versionadded:: 0.10 + """ + return os.environ.get("WERKZEUG_RUN_MAIN") == "true" + + +def run_simple( + hostname: str, + port: int, + application: WSGIApplication, + use_reloader: bool = False, + use_debugger: bool = False, + use_evalex: bool = True, + extra_files: t.Iterable[str] | None = None, + exclude_patterns: t.Iterable[str] | None = None, + reloader_interval: int = 1, + reloader_type: str = "auto", + threaded: bool = False, + processes: int = 1, + request_handler: type[WSGIRequestHandler] | None = None, + static_files: dict[str, str | tuple[str, str]] | None = None, + passthrough_errors: bool = False, + ssl_context: _TSSLContextArg | None = None, +) -> None: + """Start a development server for a WSGI application. Various + optional features can be enabled. + + .. warning:: + + Do not use the development server when deploying to production. + It is intended for use only during local development. It is not + designed to be particularly efficient, stable, or secure. + + :param hostname: The host to bind to, for example ``'localhost'``. + Can be a domain, IPv4 or IPv6 address, or file path starting + with ``unix://`` for a Unix socket. + :param port: The port to bind to, for example ``8080``. Using ``0`` + tells the OS to pick a random free port. + :param application: The WSGI application to run. + :param use_reloader: Use a reloader process to restart the server + process when files are changed. + :param use_debugger: Use Werkzeug's debugger, which will show + formatted tracebacks on unhandled exceptions. + :param use_evalex: Make the debugger interactive. A Python terminal + can be opened for any frame in the traceback. Some protection is + provided by requiring a PIN, but this should never be enabled + on a publicly visible server. + :param extra_files: The reloader will watch these files for changes + in addition to Python modules. For example, watch a + configuration file. + :param exclude_patterns: The reloader will ignore changes to any + files matching these :mod:`fnmatch` patterns. For example, + ignore cache files. + :param reloader_interval: How often the reloader tries to check for + changes. + :param reloader_type: The reloader to use. The ``'stat'`` reloader + is built in, but may require significant CPU to watch files. The + ``'watchdog'`` reloader is much more efficient but requires + installing the ``watchdog`` package first. + :param threaded: Handle concurrent requests using threads. Cannot be + used with ``processes``. + :param processes: Handle concurrent requests using up to this number + of processes. Cannot be used with ``threaded``. + :param request_handler: Use a different + :class:`~BaseHTTPServer.BaseHTTPRequestHandler` subclass to + handle requests. + :param static_files: A dict mapping URL prefixes to directories to + serve static files from using + :class:`~werkzeug.middleware.SharedDataMiddleware`. + :param passthrough_errors: Don't catch unhandled exceptions at the + server level, let the server crash instead. If ``use_debugger`` + is enabled, the debugger will still catch such errors. + :param ssl_context: Configure TLS to serve over HTTPS. Can be an + :class:`ssl.SSLContext` object, a ``(cert_file, key_file)`` + tuple to create a typical context, or the string ``'adhoc'`` to + generate a temporary self-signed certificate. + + .. versionchanged:: 2.1 + Instructions are shown for dealing with an "address already in + use" error. + + .. versionchanged:: 2.1 + Running on ``0.0.0.0`` or ``::`` shows the loopback IP in + addition to a real IP. + + .. versionchanged:: 2.1 + The command-line interface was removed. + + .. versionchanged:: 2.0 + Running on ``0.0.0.0`` or ``::`` shows a real IP address that + was bound as well as a warning not to run the development server + in production. + + .. versionchanged:: 2.0 + The ``exclude_patterns`` parameter was added. + + .. versionchanged:: 0.15 + Bind to a Unix socket by passing a ``hostname`` that starts with + ``unix://``. + + .. versionchanged:: 0.10 + Improved the reloader and added support for changing the backend + through the ``reloader_type`` parameter. + + .. versionchanged:: 0.9 + A command-line interface was added. + + .. versionchanged:: 0.8 + ``ssl_context`` can be a tuple of paths to the certificate and + private key files. + + .. versionchanged:: 0.6 + The ``ssl_context`` parameter was added. + + .. versionchanged:: 0.5 + The ``static_files`` and ``passthrough_errors`` parameters were + added. + """ + if not isinstance(port, int): + raise TypeError("port must be an integer") + + if static_files: + from .middleware.shared_data import SharedDataMiddleware + + application = SharedDataMiddleware(application, static_files) + + if use_debugger: + from .debug import DebuggedApplication + + application = DebuggedApplication(application, evalex=use_evalex) + # Allow the specified hostname to use the debugger, in addition to + # localhost domains. + application.trusted_hosts.append(hostname) + + if not is_running_from_reloader(): + fd = None + else: + fd = int(os.environ["WERKZEUG_SERVER_FD"]) + + srv = make_server( + hostname, + port, + application, + threaded, + processes, + request_handler, + passthrough_errors, + ssl_context, + fd=fd, + ) + srv.socket.set_inheritable(True) + os.environ["WERKZEUG_SERVER_FD"] = str(srv.fileno()) + + if not is_running_from_reloader(): + srv.log_startup() + _log("info", _ansi_style("Press CTRL+C to quit", "yellow")) + + if use_reloader: + from ._reloader import run_with_reloader + + try: + run_with_reloader( + srv.serve_forever, + extra_files=extra_files, + exclude_patterns=exclude_patterns, + interval=reloader_interval, + reloader_type=reloader_type, + ) + finally: + srv.server_close() + else: + srv.serve_forever() diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/werkzeug/test.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/werkzeug/test.py new file mode 100644 index 0000000000000000000000000000000000000000..58b4ce7faf216dc3e401513f01855005cae9295a --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/werkzeug/test.py @@ -0,0 +1,1464 @@ +from __future__ import annotations + +import dataclasses +import mimetypes +import sys +import typing as t +from collections import defaultdict +from datetime import datetime +from io import BytesIO +from itertools import chain +from random import random +from tempfile import TemporaryFile +from time import time +from urllib.parse import unquote +from urllib.parse import urlsplit +from urllib.parse import urlunsplit + +from ._internal import _get_environ +from ._internal import _wsgi_decoding_dance +from ._internal import _wsgi_encoding_dance +from .datastructures import Authorization +from .datastructures import CallbackDict +from .datastructures import CombinedMultiDict +from .datastructures import EnvironHeaders +from .datastructures import FileMultiDict +from .datastructures import Headers +from .datastructures import MultiDict +from .http import dump_cookie +from .http import dump_options_header +from .http import parse_cookie +from .http import parse_date +from .http import parse_options_header +from .sansio.multipart import Data +from .sansio.multipart import Epilogue +from .sansio.multipart import Field +from .sansio.multipart import File +from .sansio.multipart import MultipartEncoder +from .sansio.multipart import Preamble +from .urls import _urlencode +from .urls import iri_to_uri +from .utils import cached_property +from .utils import get_content_type +from .wrappers.request import Request +from .wrappers.response import Response +from .wsgi import ClosingIterator +from .wsgi import get_current_url + +if t.TYPE_CHECKING: + import typing_extensions as te + from _typeshed.wsgi import WSGIApplication + from _typeshed.wsgi import WSGIEnvironment + + +def stream_encode_multipart( + data: t.Mapping[str, t.Any], + use_tempfile: bool = True, + threshold: int = 1024 * 500, + boundary: str | None = None, +) -> tuple[t.IO[bytes], int, str]: + """Encode a dict of values (either strings or file descriptors or + :class:`FileStorage` objects.) into a multipart encoded string stored + in a file descriptor. + + .. versionchanged:: 3.0 + The ``charset`` parameter was removed. + """ + if boundary is None: + boundary = f"---------------WerkzeugFormPart_{time()}{random()}" + + stream: t.IO[bytes] = BytesIO() + total_length = 0 + on_disk = False + write_binary: t.Callable[[bytes], int] + + if use_tempfile: + + def write_binary(s: bytes) -> int: + nonlocal stream, total_length, on_disk + + if on_disk: + return stream.write(s) + else: + length = len(s) + + if length + total_length <= threshold: + stream.write(s) + else: + new_stream = t.cast(t.IO[bytes], TemporaryFile("wb+")) + new_stream.write(stream.getvalue()) # type: ignore + new_stream.write(s) + stream = new_stream + on_disk = True + + total_length += length + return length + + else: + write_binary = stream.write + + encoder = MultipartEncoder(boundary.encode()) + write_binary(encoder.send_event(Preamble(data=b""))) + for key, value in _iter_data(data): + reader = getattr(value, "read", None) + if reader is not None: + filename = getattr(value, "filename", getattr(value, "name", None)) + content_type = getattr(value, "content_type", None) + if content_type is None: + content_type = ( + filename + and mimetypes.guess_type(filename)[0] + or "application/octet-stream" + ) + headers = value.headers + headers.update([("Content-Type", content_type)]) + if filename is None: + write_binary(encoder.send_event(Field(name=key, headers=headers))) + else: + write_binary( + encoder.send_event( + File(name=key, filename=filename, headers=headers) + ) + ) + while True: + chunk = reader(16384) + + if not chunk: + write_binary(encoder.send_event(Data(data=chunk, more_data=False))) + break + + write_binary(encoder.send_event(Data(data=chunk, more_data=True))) + else: + if not isinstance(value, str): + value = str(value) + write_binary(encoder.send_event(Field(name=key, headers=Headers()))) + write_binary(encoder.send_event(Data(data=value.encode(), more_data=False))) + + write_binary(encoder.send_event(Epilogue(data=b""))) + + length = stream.tell() + stream.seek(0) + return stream, length, boundary + + +def encode_multipart( + values: t.Mapping[str, t.Any], boundary: str | None = None +) -> tuple[str, bytes]: + """Like `stream_encode_multipart` but returns a tuple in the form + (``boundary``, ``data``) where data is bytes. + + .. versionchanged:: 3.0 + The ``charset`` parameter was removed. + """ + stream, length, boundary = stream_encode_multipart( + values, use_tempfile=False, boundary=boundary + ) + return boundary, stream.read() + + +def _iter_data(data: t.Mapping[str, t.Any]) -> t.Iterator[tuple[str, t.Any]]: + """Iterate over a mapping that might have a list of values, yielding + all key, value pairs. Almost like iter_multi_items but only allows + lists, not tuples, of values so tuples can be used for files. + """ + if isinstance(data, MultiDict): + yield from data.items(multi=True) + else: + for key, value in data.items(): + if isinstance(value, list): + for v in value: + yield key, v + else: + yield key, value + + +_TAnyMultiDict = t.TypeVar("_TAnyMultiDict", bound="MultiDict[t.Any, t.Any]") + + +class EnvironBuilder: + """This class can be used to conveniently create a WSGI environment + for testing purposes. It can be used to quickly create WSGI environments + or request objects from arbitrary data. + + The signature of this class is also used in some other places as of + Werkzeug 0.5 (:func:`create_environ`, :meth:`Response.from_values`, + :meth:`Client.open`). Because of this most of the functionality is + available through the constructor alone. + + Files and regular form data can be manipulated independently of each + other with the :attr:`form` and :attr:`files` attributes, but are + passed with the same argument to the constructor: `data`. + + `data` can be any of these values: + + - a `str` or `bytes` object: The object is converted into an + :attr:`input_stream`, the :attr:`content_length` is set and you have to + provide a :attr:`content_type`. + - a `dict` or :class:`MultiDict`: The keys have to be strings. The values + have to be either any of the following objects, or a list of any of the + following objects: + + - a :class:`file`-like object: These are converted into + :class:`FileStorage` objects automatically. + - a `tuple`: The :meth:`~FileMultiDict.add_file` method is called + with the key and the unpacked `tuple` items as positional + arguments. + - a `str`: The string is set as form data for the associated key. + - a file-like object: The object content is loaded in memory and then + handled like a regular `str` or a `bytes`. + + :param path: the path of the request. In the WSGI environment this will + end up as `PATH_INFO`. If the `query_string` is not defined + and there is a question mark in the `path` everything after + it is used as query string. + :param base_url: the base URL is a URL that is used to extract the WSGI + URL scheme, host (server name + server port) and the + script root (`SCRIPT_NAME`). + :param query_string: an optional string or dict with URL parameters. + :param method: the HTTP method to use, defaults to `GET`. + :param input_stream: an optional input stream. Do not specify this and + `data`. As soon as an input stream is set you can't + modify :attr:`args` and :attr:`files` unless you + set the :attr:`input_stream` to `None` again. + :param content_type: The content type for the request. As of 0.5 you + don't have to provide this when specifying files + and form data via `data`. + :param content_length: The content length for the request. You don't + have to specify this when providing data via + `data`. + :param errors_stream: an optional error stream that is used for + `wsgi.errors`. Defaults to :data:`stderr`. + :param multithread: controls `wsgi.multithread`. Defaults to `False`. + :param multiprocess: controls `wsgi.multiprocess`. Defaults to `False`. + :param run_once: controls `wsgi.run_once`. Defaults to `False`. + :param headers: an optional list or :class:`Headers` object of headers. + :param data: a string or dict of form data or a file-object. + See explanation above. + :param json: An object to be serialized and assigned to ``data``. + Defaults the content type to ``"application/json"``. + Serialized with the function assigned to :attr:`json_dumps`. + :param environ_base: an optional dict of environment defaults. + :param environ_overrides: an optional dict of environment overrides. + :param auth: An authorization object to use for the + ``Authorization`` header value. A ``(username, password)`` tuple + is a shortcut for ``Basic`` authorization. + + .. versionchanged:: 3.0 + The ``charset`` parameter was removed. + + .. versionchanged:: 2.1 + ``CONTENT_TYPE`` and ``CONTENT_LENGTH`` are not duplicated as + header keys in the environ. + + .. versionchanged:: 2.0 + ``REQUEST_URI`` and ``RAW_URI`` is the full raw URI including + the query string, not only the path. + + .. versionchanged:: 2.0 + The default :attr:`request_class` is ``Request`` instead of + ``BaseRequest``. + + .. versionadded:: 2.0 + Added the ``auth`` parameter. + + .. versionadded:: 0.15 + The ``json`` param and :meth:`json_dumps` method. + + .. versionadded:: 0.15 + The environ has keys ``REQUEST_URI`` and ``RAW_URI`` containing + the path before percent-decoding. This is not part of the WSGI + PEP, but many WSGI servers include it. + + .. versionchanged:: 0.6 + ``path`` and ``base_url`` can now be unicode strings that are + encoded with :func:`iri_to_uri`. + """ + + #: the server protocol to use. defaults to HTTP/1.1 + server_protocol = "HTTP/1.1" + + #: the wsgi version to use. defaults to (1, 0) + wsgi_version = (1, 0) + + #: The default request class used by :meth:`get_request`. + request_class = Request + + import json + + #: The serialization function used when ``json`` is passed. + json_dumps = staticmethod(json.dumps) + del json + + _args: MultiDict[str, str] | None + _query_string: str | None + _input_stream: t.IO[bytes] | None + _form: MultiDict[str, str] | None + _files: FileMultiDict | None + + def __init__( + self, + path: str = "/", + base_url: str | None = None, + query_string: t.Mapping[str, str] | str | None = None, + method: str = "GET", + input_stream: t.IO[bytes] | None = None, + content_type: str | None = None, + content_length: int | None = None, + errors_stream: t.IO[str] | None = None, + multithread: bool = False, + multiprocess: bool = False, + run_once: bool = False, + headers: Headers | t.Iterable[tuple[str, str]] | None = None, + data: None | (t.IO[bytes] | str | bytes | t.Mapping[str, t.Any]) = None, + environ_base: t.Mapping[str, t.Any] | None = None, + environ_overrides: t.Mapping[str, t.Any] | None = None, + mimetype: str | None = None, + json: t.Mapping[str, t.Any] | None = None, + auth: Authorization | tuple[str, str] | None = None, + ) -> None: + if query_string is not None and "?" in path: + raise ValueError("Query string is defined in the path and as an argument") + request_uri = urlsplit(path) + if query_string is None and "?" in path: + query_string = request_uri.query + + self.path = iri_to_uri(request_uri.path) + self.request_uri = path + if base_url is not None: + base_url = iri_to_uri(base_url) + self.base_url = base_url + if isinstance(query_string, str): + self.query_string = query_string + else: + if query_string is None: + query_string = MultiDict() + elif not isinstance(query_string, MultiDict): + query_string = MultiDict(query_string) + self.args = query_string + self.method = method + if headers is None: + headers = Headers() + elif not isinstance(headers, Headers): + headers = Headers(headers) + self.headers = headers + if content_type is not None: + self.content_type = content_type + if errors_stream is None: + errors_stream = sys.stderr + self.errors_stream = errors_stream + self.multithread = multithread + self.multiprocess = multiprocess + self.run_once = run_once + self.environ_base = environ_base + self.environ_overrides = environ_overrides + self.input_stream = input_stream + self.content_length = content_length + self.closed = False + + if auth is not None: + if isinstance(auth, tuple): + auth = Authorization( + "basic", {"username": auth[0], "password": auth[1]} + ) + + self.headers.set("Authorization", auth.to_header()) + + if json is not None: + if data is not None: + raise TypeError("can't provide both json and data") + + data = self.json_dumps(json) + + if self.content_type is None: + self.content_type = "application/json" + + if data: + if input_stream is not None: + raise TypeError("can't provide input stream and data") + if hasattr(data, "read"): + data = data.read() + if isinstance(data, str): + data = data.encode() + if isinstance(data, bytes): + self.input_stream = BytesIO(data) + if self.content_length is None: + self.content_length = len(data) + else: + for key, value in _iter_data(data): + if isinstance(value, (tuple, dict)) or hasattr(value, "read"): + self._add_file_from_data(key, value) + else: + self.form.setlistdefault(key).append(value) + + if mimetype is not None: + self.mimetype = mimetype + + @classmethod + def from_environ(cls, environ: WSGIEnvironment, **kwargs: t.Any) -> EnvironBuilder: + """Turn an environ dict back into a builder. Any extra kwargs + override the args extracted from the environ. + + .. versionchanged:: 2.0 + Path and query values are passed through the WSGI decoding + dance to avoid double encoding. + + .. versionadded:: 0.15 + """ + headers = Headers(EnvironHeaders(environ)) + out = { + "path": _wsgi_decoding_dance(environ["PATH_INFO"]), + "base_url": cls._make_base_url( + environ["wsgi.url_scheme"], + headers.pop("Host"), + _wsgi_decoding_dance(environ["SCRIPT_NAME"]), + ), + "query_string": _wsgi_decoding_dance(environ["QUERY_STRING"]), + "method": environ["REQUEST_METHOD"], + "input_stream": environ["wsgi.input"], + "content_type": headers.pop("Content-Type", None), + "content_length": headers.pop("Content-Length", None), + "errors_stream": environ["wsgi.errors"], + "multithread": environ["wsgi.multithread"], + "multiprocess": environ["wsgi.multiprocess"], + "run_once": environ["wsgi.run_once"], + "headers": headers, + } + out.update(kwargs) + return cls(**out) + + def _add_file_from_data( + self, + key: str, + value: (t.IO[bytes] | tuple[t.IO[bytes], str] | tuple[t.IO[bytes], str, str]), + ) -> None: + """Called in the EnvironBuilder to add files from the data dict.""" + if isinstance(value, tuple): + self.files.add_file(key, *value) + else: + self.files.add_file(key, value) + + @staticmethod + def _make_base_url(scheme: str, host: str, script_root: str) -> str: + return urlunsplit((scheme, host, script_root, "", "")).rstrip("/") + "/" + + @property + def base_url(self) -> str: + """The base URL is used to extract the URL scheme, host name, + port, and root path. + """ + return self._make_base_url(self.url_scheme, self.host, self.script_root) + + @base_url.setter + def base_url(self, value: str | None) -> None: + if value is None: + scheme = "http" + netloc = "localhost" + script_root = "" + else: + scheme, netloc, script_root, qs, anchor = urlsplit(value) + if qs or anchor: + raise ValueError("base url must not contain a query string or fragment") + self.script_root = script_root.rstrip("/") + self.host = netloc + self.url_scheme = scheme + + @property + def content_type(self) -> str | None: + """The content type for the request. Reflected from and to + the :attr:`headers`. Do not set if you set :attr:`files` or + :attr:`form` for auto detection. + """ + ct = self.headers.get("Content-Type") + if ct is None and not self._input_stream: + if self._files: + return "multipart/form-data" + if self._form: + return "application/x-www-form-urlencoded" + return None + return ct + + @content_type.setter + def content_type(self, value: str | None) -> None: + if value is None: + self.headers.pop("Content-Type", None) + else: + self.headers["Content-Type"] = value + + @property + def mimetype(self) -> str | None: + """The mimetype (content type without charset etc.) + + .. versionadded:: 0.14 + """ + ct = self.content_type + return ct.split(";")[0].strip() if ct else None + + @mimetype.setter + def mimetype(self, value: str) -> None: + self.content_type = get_content_type(value, "utf-8") + + @property + def mimetype_params(self) -> t.Mapping[str, str]: + """The mimetype parameters as dict. For example if the + content type is ``text/html; charset=utf-8`` the params would be + ``{'charset': 'utf-8'}``. + + .. versionadded:: 0.14 + """ + + def on_update(d: CallbackDict[str, str]) -> None: + self.headers["Content-Type"] = dump_options_header(self.mimetype, d) + + d = parse_options_header(self.headers.get("content-type", ""))[1] + return CallbackDict(d, on_update) + + @property + def content_length(self) -> int | None: + """The content length as integer. Reflected from and to the + :attr:`headers`. Do not set if you set :attr:`files` or + :attr:`form` for auto detection. + """ + return self.headers.get("Content-Length", type=int) + + @content_length.setter + def content_length(self, value: int | None) -> None: + if value is None: + self.headers.pop("Content-Length", None) + else: + self.headers["Content-Length"] = str(value) + + def _get_form(self, name: str, storage: type[_TAnyMultiDict]) -> _TAnyMultiDict: + """Common behavior for getting the :attr:`form` and + :attr:`files` properties. + + :param name: Name of the internal cached attribute. + :param storage: Storage class used for the data. + """ + if self.input_stream is not None: + raise AttributeError("an input stream is defined") + + rv = getattr(self, name) + + if rv is None: + rv = storage() + setattr(self, name, rv) + + return rv # type: ignore + + def _set_form(self, name: str, value: MultiDict[str, t.Any]) -> None: + """Common behavior for setting the :attr:`form` and + :attr:`files` properties. + + :param name: Name of the internal cached attribute. + :param value: Value to assign to the attribute. + """ + self._input_stream = None + setattr(self, name, value) + + @property + def form(self) -> MultiDict[str, str]: + """A :class:`MultiDict` of form values.""" + return self._get_form("_form", MultiDict) + + @form.setter + def form(self, value: MultiDict[str, str]) -> None: + self._set_form("_form", value) + + @property + def files(self) -> FileMultiDict: + """A :class:`FileMultiDict` of uploaded files. Use + :meth:`~FileMultiDict.add_file` to add new files. + """ + return self._get_form("_files", FileMultiDict) + + @files.setter + def files(self, value: FileMultiDict) -> None: + self._set_form("_files", value) + + @property + def input_stream(self) -> t.IO[bytes] | None: + """An optional input stream. This is mutually exclusive with + setting :attr:`form` and :attr:`files`, setting it will clear + those. Do not provide this if the method is not ``POST`` or + another method that has a body. + """ + return self._input_stream + + @input_stream.setter + def input_stream(self, value: t.IO[bytes] | None) -> None: + self._input_stream = value + self._form = None + self._files = None + + @property + def query_string(self) -> str: + """The query string. If you set this to a string + :attr:`args` will no longer be available. + """ + if self._query_string is None: + if self._args is not None: + return _urlencode(self._args) + return "" + return self._query_string + + @query_string.setter + def query_string(self, value: str | None) -> None: + self._query_string = value + self._args = None + + @property + def args(self) -> MultiDict[str, str]: + """The URL arguments as :class:`MultiDict`.""" + if self._query_string is not None: + raise AttributeError("a query string is defined") + if self._args is None: + self._args = MultiDict() + return self._args + + @args.setter + def args(self, value: MultiDict[str, str] | None) -> None: + self._query_string = None + self._args = value + + @property + def server_name(self) -> str: + """The server name (read-only, use :attr:`host` to set)""" + return self.host.split(":", 1)[0] + + @property + def server_port(self) -> int: + """The server port as integer (read-only, use :attr:`host` to set)""" + pieces = self.host.split(":", 1) + + if len(pieces) == 2: + try: + return int(pieces[1]) + except ValueError: + pass + + if self.url_scheme == "https": + return 443 + return 80 + + def __del__(self) -> None: + try: + self.close() + except Exception: + pass + + def close(self) -> None: + """Closes all files. If you put real :class:`file` objects into the + :attr:`files` dict you can call this method to automatically close + them all in one go. + """ + if self.closed: + return + try: + files = self.files.values() + except AttributeError: + files = () + for f in files: + try: + f.close() + except Exception: + pass + self.closed = True + + def get_environ(self) -> WSGIEnvironment: + """Return the built environ. + + .. versionchanged:: 0.15 + The content type and length headers are set based on + input stream detection. Previously this only set the WSGI + keys. + """ + input_stream = self.input_stream + content_length = self.content_length + + mimetype = self.mimetype + content_type = self.content_type + + if input_stream is not None: + start_pos = input_stream.tell() + input_stream.seek(0, 2) + end_pos = input_stream.tell() + input_stream.seek(start_pos) + content_length = end_pos - start_pos + elif mimetype == "multipart/form-data": + input_stream, content_length, boundary = stream_encode_multipart( + CombinedMultiDict([self.form, self.files]) + ) + content_type = f'{mimetype}; boundary="{boundary}"' + elif mimetype == "application/x-www-form-urlencoded": + form_encoded = _urlencode(self.form).encode("ascii") + content_length = len(form_encoded) + input_stream = BytesIO(form_encoded) + else: + input_stream = BytesIO() + + result: WSGIEnvironment = {} + if self.environ_base: + result.update(self.environ_base) + + def _path_encode(x: str) -> str: + return _wsgi_encoding_dance(unquote(x)) + + raw_uri = _wsgi_encoding_dance(self.request_uri) + result.update( + { + "REQUEST_METHOD": self.method, + "SCRIPT_NAME": _path_encode(self.script_root), + "PATH_INFO": _path_encode(self.path), + "QUERY_STRING": _wsgi_encoding_dance(self.query_string), + # Non-standard, added by mod_wsgi, uWSGI + "REQUEST_URI": raw_uri, + # Non-standard, added by gunicorn + "RAW_URI": raw_uri, + "SERVER_NAME": self.server_name, + "SERVER_PORT": str(self.server_port), + "HTTP_HOST": self.host, + "SERVER_PROTOCOL": self.server_protocol, + "wsgi.version": self.wsgi_version, + "wsgi.url_scheme": self.url_scheme, + "wsgi.input": input_stream, + "wsgi.errors": self.errors_stream, + "wsgi.multithread": self.multithread, + "wsgi.multiprocess": self.multiprocess, + "wsgi.run_once": self.run_once, + } + ) + + headers = self.headers.copy() + # Don't send these as headers, they're part of the environ. + headers.remove("Content-Type") + headers.remove("Content-Length") + + if content_type is not None: + result["CONTENT_TYPE"] = content_type + + if content_length is not None: + result["CONTENT_LENGTH"] = str(content_length) + + combined_headers = defaultdict(list) + + for key, value in headers.to_wsgi_list(): + combined_headers[f"HTTP_{key.upper().replace('-', '_')}"].append(value) + + for key, values in combined_headers.items(): + result[key] = ", ".join(values) + + if self.environ_overrides: + result.update(self.environ_overrides) + + return result + + def get_request(self, cls: type[Request] | None = None) -> Request: + """Returns a request with the data. If the request class is not + specified :attr:`request_class` is used. + + :param cls: The request wrapper to use. + """ + if cls is None: + cls = self.request_class + + return cls(self.get_environ()) + + +class ClientRedirectError(Exception): + """If a redirect loop is detected when using follow_redirects=True with + the :cls:`Client`, then this exception is raised. + """ + + +class Client: + """Simulate sending requests to a WSGI application without running a WSGI or HTTP + server. + + :param application: The WSGI application to make requests to. + :param response_wrapper: A :class:`.Response` class to wrap response data with. + Defaults to :class:`.TestResponse`. If it's not a subclass of ``TestResponse``, + one will be created. + :param use_cookies: Persist cookies from ``Set-Cookie`` response headers to the + ``Cookie`` header in subsequent requests. Domain and path matching is supported, + but other cookie parameters are ignored. + :param allow_subdomain_redirects: Allow requests to follow redirects to subdomains. + Enable this if the application handles subdomains and redirects between them. + + .. versionchanged:: 2.3 + Simplify cookie implementation, support domain and path matching. + + .. versionchanged:: 2.1 + All data is available as properties on the returned response object. The + response cannot be returned as a tuple. + + .. versionchanged:: 2.0 + ``response_wrapper`` is always a subclass of :class:``TestResponse``. + + .. versionchanged:: 0.5 + Added the ``use_cookies`` parameter. + """ + + def __init__( + self, + application: WSGIApplication, + response_wrapper: type[Response] | None = None, + use_cookies: bool = True, + allow_subdomain_redirects: bool = False, + ) -> None: + self.application = application + + if response_wrapper in {None, Response}: + response_wrapper = TestResponse + elif response_wrapper is not None and not issubclass( + response_wrapper, TestResponse + ): + response_wrapper = type( + "WrapperTestResponse", + (TestResponse, response_wrapper), + {}, + ) + + self.response_wrapper = t.cast(type["TestResponse"], response_wrapper) + + if use_cookies: + self._cookies: dict[tuple[str, str, str], Cookie] | None = {} + else: + self._cookies = None + + self.allow_subdomain_redirects = allow_subdomain_redirects + + def get_cookie( + self, key: str, domain: str = "localhost", path: str = "/" + ) -> Cookie | None: + """Return a :class:`.Cookie` if it exists. Cookies are uniquely identified by + ``(domain, path, key)``. + + :param key: The decoded form of the key for the cookie. + :param domain: The domain the cookie was set for. + :param path: The path the cookie was set for. + + .. versionadded:: 2.3 + """ + if self._cookies is None: + raise TypeError( + "Cookies are disabled. Create a client with 'use_cookies=True'." + ) + + return self._cookies.get((domain, path, key)) + + def set_cookie( + self, + key: str, + value: str = "", + *, + domain: str = "localhost", + origin_only: bool = True, + path: str = "/", + **kwargs: t.Any, + ) -> None: + """Set a cookie to be sent in subsequent requests. + + This is a convenience to skip making a test request to a route that would set + the cookie. To test the cookie, make a test request to a route that uses the + cookie value. + + The client uses ``domain``, ``origin_only``, and ``path`` to determine which + cookies to send with a request. It does not use other cookie parameters that + browsers use, since they're not applicable in tests. + + :param key: The key part of the cookie. + :param value: The value part of the cookie. + :param domain: Send this cookie with requests that match this domain. If + ``origin_only`` is true, it must be an exact match, otherwise it may be a + suffix match. + :param origin_only: Whether the domain must be an exact match to the request. + :param path: Send this cookie with requests that match this path either exactly + or as a prefix. + :param kwargs: Passed to :func:`.dump_cookie`. + + .. versionchanged:: 3.0 + The parameter ``server_name`` is removed. The first parameter is + ``key``. Use the ``domain`` and ``origin_only`` parameters instead. + + .. versionchanged:: 2.3 + The ``origin_only`` parameter was added. + + .. versionchanged:: 2.3 + The ``domain`` parameter defaults to ``localhost``. + """ + if self._cookies is None: + raise TypeError( + "Cookies are disabled. Create a client with 'use_cookies=True'." + ) + + cookie = Cookie._from_response_header( + domain, "/", dump_cookie(key, value, domain=domain, path=path, **kwargs) + ) + cookie.origin_only = origin_only + + if cookie._should_delete: + self._cookies.pop(cookie._storage_key, None) + else: + self._cookies[cookie._storage_key] = cookie + + def delete_cookie( + self, + key: str, + *, + domain: str = "localhost", + path: str = "/", + ) -> None: + """Delete a cookie if it exists. Cookies are uniquely identified by + ``(domain, path, key)``. + + :param key: The decoded form of the key for the cookie. + :param domain: The domain the cookie was set for. + :param path: The path the cookie was set for. + + .. versionchanged:: 3.0 + The ``server_name`` parameter is removed. The first parameter is + ``key``. Use the ``domain`` parameter instead. + + .. versionchanged:: 3.0 + The ``secure``, ``httponly`` and ``samesite`` parameters are removed. + + .. versionchanged:: 2.3 + The ``domain`` parameter defaults to ``localhost``. + """ + if self._cookies is None: + raise TypeError( + "Cookies are disabled. Create a client with 'use_cookies=True'." + ) + + self._cookies.pop((domain, path, key), None) + + def _add_cookies_to_wsgi(self, environ: WSGIEnvironment) -> None: + """If cookies are enabled, set the ``Cookie`` header in the environ to the + cookies that are applicable to the request host and path. + + :meta private: + + .. versionadded:: 2.3 + """ + if self._cookies is None: + return + + url = urlsplit(get_current_url(environ)) + server_name = url.hostname or "localhost" + value = "; ".join( + c._to_request_header() + for c in self._cookies.values() + if c._matches_request(server_name, url.path) + ) + + if value: + environ["HTTP_COOKIE"] = value + else: + environ.pop("HTTP_COOKIE", None) + + def _update_cookies_from_response( + self, server_name: str, path: str, headers: list[str] + ) -> None: + """If cookies are enabled, update the stored cookies from any ``Set-Cookie`` + headers in the response. + + :meta private: + + .. versionadded:: 2.3 + """ + if self._cookies is None: + return + + for header in headers: + cookie = Cookie._from_response_header(server_name, path, header) + + if cookie._should_delete: + self._cookies.pop(cookie._storage_key, None) + else: + self._cookies[cookie._storage_key] = cookie + + def run_wsgi_app( + self, environ: WSGIEnvironment, buffered: bool = False + ) -> tuple[t.Iterable[bytes], str, Headers]: + """Runs the wrapped WSGI app with the given environment. + + :meta private: + """ + self._add_cookies_to_wsgi(environ) + rv = run_wsgi_app(self.application, environ, buffered=buffered) + url = urlsplit(get_current_url(environ)) + self._update_cookies_from_response( + url.hostname or "localhost", url.path, rv[2].getlist("Set-Cookie") + ) + return rv + + def resolve_redirect( + self, response: TestResponse, buffered: bool = False + ) -> TestResponse: + """Perform a new request to the location given by the redirect + response to the previous request. + + :meta private: + """ + scheme, netloc, path, qs, anchor = urlsplit(response.location) + builder = EnvironBuilder.from_environ( + response.request.environ, path=path, query_string=qs + ) + + to_name_parts = netloc.split(":", 1)[0].split(".") + from_name_parts = builder.server_name.split(".") + + if to_name_parts != [""]: + # The new location has a host, use it for the base URL. + builder.url_scheme = scheme + builder.host = netloc + else: + # A local redirect with autocorrect_location_header=False + # doesn't have a host, so use the request's host. + to_name_parts = from_name_parts + + # Explain why a redirect to a different server name won't be followed. + if to_name_parts != from_name_parts: + if to_name_parts[-len(from_name_parts) :] == from_name_parts: + if not self.allow_subdomain_redirects: + raise RuntimeError("Following subdomain redirects is not enabled.") + else: + raise RuntimeError("Following external redirects is not supported.") + + path_parts = path.split("/") + root_parts = builder.script_root.split("/") + + if path_parts[: len(root_parts)] == root_parts: + # Strip the script root from the path. + builder.path = path[len(builder.script_root) :] + else: + # The new location is not under the script root, so use the + # whole path and clear the previous root. + builder.path = path + builder.script_root = "" + + # Only 307 and 308 preserve all of the original request. + if response.status_code not in {307, 308}: + # HEAD is preserved, everything else becomes GET. + if builder.method != "HEAD": + builder.method = "GET" + + # Clear the body and the headers that describe it. + + if builder.input_stream is not None: + builder.input_stream.close() + builder.input_stream = None + + builder.content_type = None + builder.content_length = None + builder.headers.pop("Transfer-Encoding", None) + + return self.open(builder, buffered=buffered) + + def open( + self, + *args: t.Any, + buffered: bool = False, + follow_redirects: bool = False, + **kwargs: t.Any, + ) -> TestResponse: + """Generate an environ dict from the given arguments, make a + request to the application using it, and return the response. + + :param args: Passed to :class:`EnvironBuilder` to create the + environ for the request. If a single arg is passed, it can + be an existing :class:`EnvironBuilder` or an environ dict. + :param buffered: Convert the iterator returned by the app into + a list. If the iterator has a ``close()`` method, it is + called automatically. + :param follow_redirects: Make additional requests to follow HTTP + redirects until a non-redirect status is returned. + :attr:`TestResponse.history` lists the intermediate + responses. + + .. versionchanged:: 2.1 + Removed the ``as_tuple`` parameter. + + .. versionchanged:: 2.0 + The request input stream is closed when calling + ``response.close()``. Input streams for redirects are + automatically closed. + + .. versionchanged:: 0.5 + If a dict is provided as file in the dict for the ``data`` + parameter the content type has to be called ``content_type`` + instead of ``mimetype``. This change was made for + consistency with :class:`werkzeug.FileWrapper`. + + .. versionchanged:: 0.5 + Added the ``follow_redirects`` parameter. + """ + request: Request | None = None + + if not kwargs and len(args) == 1: + arg = args[0] + + if isinstance(arg, EnvironBuilder): + request = arg.get_request() + elif isinstance(arg, dict): + request = EnvironBuilder.from_environ(arg).get_request() + elif isinstance(arg, Request): + request = arg + + if request is None: + builder = EnvironBuilder(*args, **kwargs) + + try: + request = builder.get_request() + finally: + builder.close() + + response_parts = self.run_wsgi_app(request.environ, buffered=buffered) + response = self.response_wrapper(*response_parts, request=request) + + redirects = set() + history: list[TestResponse] = [] + + if not follow_redirects: + return response + + while response.status_code in { + 301, + 302, + 303, + 305, + 307, + 308, + }: + # Exhaust intermediate response bodies to ensure middleware + # that returns an iterator runs any cleanup code. + if not buffered: + response.make_sequence() + response.close() + + new_redirect_entry = (response.location, response.status_code) + + if new_redirect_entry in redirects: + raise ClientRedirectError( + f"Loop detected: A {response.status_code} redirect" + f" to {response.location} was already made." + ) + + redirects.add(new_redirect_entry) + response.history = tuple(history) + history.append(response) + response = self.resolve_redirect(response, buffered=buffered) + else: + # This is the final request after redirects. + response.history = tuple(history) + # Close the input stream when closing the response, in case + # the input is an open temporary file. + response.call_on_close(request.input_stream.close) + return response + + def get(self, *args: t.Any, **kw: t.Any) -> TestResponse: + """Call :meth:`open` with ``method`` set to ``GET``.""" + kw["method"] = "GET" + return self.open(*args, **kw) + + def post(self, *args: t.Any, **kw: t.Any) -> TestResponse: + """Call :meth:`open` with ``method`` set to ``POST``.""" + kw["method"] = "POST" + return self.open(*args, **kw) + + def put(self, *args: t.Any, **kw: t.Any) -> TestResponse: + """Call :meth:`open` with ``method`` set to ``PUT``.""" + kw["method"] = "PUT" + return self.open(*args, **kw) + + def delete(self, *args: t.Any, **kw: t.Any) -> TestResponse: + """Call :meth:`open` with ``method`` set to ``DELETE``.""" + kw["method"] = "DELETE" + return self.open(*args, **kw) + + def patch(self, *args: t.Any, **kw: t.Any) -> TestResponse: + """Call :meth:`open` with ``method`` set to ``PATCH``.""" + kw["method"] = "PATCH" + return self.open(*args, **kw) + + def options(self, *args: t.Any, **kw: t.Any) -> TestResponse: + """Call :meth:`open` with ``method`` set to ``OPTIONS``.""" + kw["method"] = "OPTIONS" + return self.open(*args, **kw) + + def head(self, *args: t.Any, **kw: t.Any) -> TestResponse: + """Call :meth:`open` with ``method`` set to ``HEAD``.""" + kw["method"] = "HEAD" + return self.open(*args, **kw) + + def trace(self, *args: t.Any, **kw: t.Any) -> TestResponse: + """Call :meth:`open` with ``method`` set to ``TRACE``.""" + kw["method"] = "TRACE" + return self.open(*args, **kw) + + def __repr__(self) -> str: + return f"<{type(self).__name__} {self.application!r}>" + + +def create_environ(*args: t.Any, **kwargs: t.Any) -> WSGIEnvironment: + """Create a new WSGI environ dict based on the values passed. The first + parameter should be the path of the request which defaults to '/'. The + second one can either be an absolute path (in that case the host is + localhost:80) or a full path to the request with scheme, netloc port and + the path to the script. + + This accepts the same arguments as the :class:`EnvironBuilder` + constructor. + + .. versionchanged:: 0.5 + This function is now a thin wrapper over :class:`EnvironBuilder` which + was added in 0.5. The `headers`, `environ_base`, `environ_overrides` + and `charset` parameters were added. + """ + builder = EnvironBuilder(*args, **kwargs) + + try: + return builder.get_environ() + finally: + builder.close() + + +def run_wsgi_app( + app: WSGIApplication, environ: WSGIEnvironment, buffered: bool = False +) -> tuple[t.Iterable[bytes], str, Headers]: + """Return a tuple in the form (app_iter, status, headers) of the + application output. This works best if you pass it an application that + returns an iterator all the time. + + Sometimes applications may use the `write()` callable returned + by the `start_response` function. This tries to resolve such edge + cases automatically. But if you don't get the expected output you + should set `buffered` to `True` which enforces buffering. + + If passed an invalid WSGI application the behavior of this function is + undefined. Never pass non-conforming WSGI applications to this function. + + :param app: the application to execute. + :param buffered: set to `True` to enforce buffering. + :return: tuple in the form ``(app_iter, status, headers)`` + """ + # Copy environ to ensure any mutations by the app (ProxyFix, for + # example) don't affect subsequent requests (such as redirects). + environ = _get_environ(environ).copy() + status: str + response: tuple[str, list[tuple[str, str]]] | None = None + buffer: list[bytes] = [] + + def start_response(status, headers, exc_info=None): # type: ignore + nonlocal response + + if exc_info: + try: + raise exc_info[1].with_traceback(exc_info[2]) + finally: + exc_info = None + + response = (status, headers) + return buffer.append + + app_rv = app(environ, start_response) + close_func = getattr(app_rv, "close", None) + app_iter: t.Iterable[bytes] = iter(app_rv) + + # when buffering we emit the close call early and convert the + # application iterator into a regular list + if buffered: + try: + app_iter = list(app_iter) + finally: + if close_func is not None: + close_func() + + # otherwise we iterate the application iter until we have a response, chain + # the already received data with the already collected data and wrap it in + # a new `ClosingIterator` if we need to restore a `close` callable from the + # original return value. + else: + for item in app_iter: + buffer.append(item) + + if response is not None: + break + + if buffer: + app_iter = chain(buffer, app_iter) + + if close_func is not None and app_iter is not app_rv: + app_iter = ClosingIterator(app_iter, close_func) + + status, headers = response # type: ignore + return app_iter, status, Headers(headers) + + +class TestResponse(Response): + """:class:`~werkzeug.wrappers.Response` subclass that provides extra + information about requests made with the test :class:`Client`. + + Test client requests will always return an instance of this class. + If a custom response class is passed to the client, it is + subclassed along with this to support test information. + + If the test request included large files, or if the application is + serving a file, call :meth:`close` to close any open files and + prevent Python showing a ``ResourceWarning``. + + .. versionchanged:: 2.2 + Set the ``default_mimetype`` to None to prevent a mimetype being + assumed if missing. + + .. versionchanged:: 2.1 + Response instances cannot be treated as tuples. + + .. versionadded:: 2.0 + Test client methods always return instances of this class. + """ + + default_mimetype = None + # Don't assume a mimetype, instead use whatever the response provides + + request: Request + """A request object with the environ used to make the request that + resulted in this response. + """ + + history: tuple[TestResponse, ...] + """A list of intermediate responses. Populated when the test request + is made with ``follow_redirects`` enabled. + """ + + # Tell Pytest to ignore this, it's not a test class. + __test__ = False + + def __init__( + self, + response: t.Iterable[bytes], + status: str, + headers: Headers, + request: Request, + history: tuple[TestResponse] = (), # type: ignore + **kwargs: t.Any, + ) -> None: + super().__init__(response, status, headers, **kwargs) + self.request = request + self.history = history + self._compat_tuple = response, status, headers + + @cached_property + def text(self) -> str: + """The response data as text. A shortcut for + ``response.get_data(as_text=True)``. + + .. versionadded:: 2.1 + """ + return self.get_data(as_text=True) + + +@dataclasses.dataclass +class Cookie: + """A cookie key, value, and parameters. + + The class itself is not a public API. Its attributes are documented for inspection + with :meth:`.Client.get_cookie` only. + + .. versionadded:: 2.3 + """ + + key: str + """The cookie key, encoded as a client would see it.""" + + value: str + """The cookie key, encoded as a client would see it.""" + + decoded_key: str + """The cookie key, decoded as the application would set and see it.""" + + decoded_value: str + """The cookie value, decoded as the application would set and see it.""" + + expires: datetime | None + """The time at which the cookie is no longer valid.""" + + max_age: int | None + """The number of seconds from when the cookie was set at which it is + no longer valid. + """ + + domain: str + """The domain that the cookie was set for, or the request domain if not set.""" + + origin_only: bool + """Whether the cookie will be sent for exact domain matches only. This is ``True`` + if the ``Domain`` parameter was not present. + """ + + path: str + """The path that the cookie was set for.""" + + secure: bool | None + """The ``Secure`` parameter.""" + + http_only: bool | None + """The ``HttpOnly`` parameter.""" + + same_site: str | None + """The ``SameSite`` parameter.""" + + def _matches_request(self, server_name: str, path: str) -> bool: + return ( + server_name == self.domain + or ( + not self.origin_only + and server_name.endswith(self.domain) + and server_name[: -len(self.domain)].endswith(".") + ) + ) and ( + path == self.path + or ( + path.startswith(self.path) + and path[len(self.path) - self.path.endswith("/") :].startswith("/") + ) + ) + + def _to_request_header(self) -> str: + return f"{self.key}={self.value}" + + @classmethod + def _from_response_header(cls, server_name: str, path: str, header: str) -> te.Self: + header, _, parameters_str = header.partition(";") + key, _, value = header.partition("=") + decoded_key, decoded_value = next(parse_cookie(header).items()) # type: ignore[call-overload] + params = {} + + for item in parameters_str.split(";"): + k, sep, v = item.partition("=") + params[k.strip().lower()] = v.strip() if sep else None + + return cls( + key=key.strip(), + value=value.strip(), + decoded_key=decoded_key, + decoded_value=decoded_value, + expires=parse_date(params.get("expires")), + max_age=int(params["max-age"] or 0) if "max-age" in params else None, + domain=params.get("domain") or server_name, + origin_only="domain" not in params, + path=params.get("path") or path.rpartition("/")[0] or "/", + secure="secure" in params, + http_only="httponly" in params, + same_site=params.get("samesite"), + ) + + @property + def _storage_key(self) -> tuple[str, str, str]: + return self.domain, self.path, self.decoded_key + + @property + def _should_delete(self) -> bool: + return self.max_age == 0 or ( + self.expires is not None and self.expires.timestamp() == 0 + ) diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/werkzeug/testapp.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/werkzeug/testapp.py new file mode 100644 index 0000000000000000000000000000000000000000..cdf7fac1acb8266c011d842aec97d0ff2156d200 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/werkzeug/testapp.py @@ -0,0 +1,194 @@ +"""A small application that can be used to test a WSGI server and check +it for WSGI compliance. +""" + +from __future__ import annotations + +import importlib.metadata +import os +import sys +import typing as t +from textwrap import wrap + +from markupsafe import escape + +from .wrappers.request import Request +from .wrappers.response import Response + +TEMPLATE = """\ + + +WSGI Information + +
    +

    WSGI Information

    +

    + This page displays all available information about the WSGI server and + the underlying Python interpreter. +

    Python Interpreter

    + + + + + + +
    Python Version + %(python_version)s +
    Platform + %(platform)s [%(os)s] +
    API Version + %(api_version)s +
    Byteorder + %(byteorder)s +
    Werkzeug Version + %(werkzeug_version)s +
    +

    WSGI Environment

    + %(wsgi_env)s
    +

    Installed Eggs

    +

    + The following python packages were installed on the system as + Python eggs: +

      %(python_eggs)s
    +

    System Path

    +

    + The following paths are the current contents of the load path. The + following entries are looked up for Python packages. Note that not + all items in this path are folders. Gray and underlined items are + entries pointing to invalid resources or used by custom import hooks + such as the zip importer. +

    + Items with a bright background were expanded for display from a relative + path. If you encounter such paths in the output you might want to check + your setup as relative paths are usually problematic in multithreaded + environments. +

      %(sys_path)s
    +
    +""" + + +def iter_sys_path() -> t.Iterator[tuple[str, bool, bool]]: + if os.name == "posix": + + def strip(x: str) -> str: + prefix = os.path.expanduser("~") + if x.startswith(prefix): + x = f"~{x[len(prefix) :]}" + return x + + else: + + def strip(x: str) -> str: + return x + + cwd = os.path.abspath(os.getcwd()) + for item in sys.path: + path = os.path.join(cwd, item or os.path.curdir) + yield strip(os.path.normpath(path)), not os.path.isdir(path), path != item + + +@Request.application +def test_app(req: Request) -> Response: + """Simple test application that dumps the environment. You can use + it to check if Werkzeug is working properly: + + .. sourcecode:: pycon + + >>> from werkzeug.serving import run_simple + >>> from werkzeug.testapp import test_app + >>> run_simple('localhost', 3000, test_app) + * Running on http://localhost:3000/ + + The application displays important information from the WSGI environment, + the Python interpreter and the installed libraries. + """ + try: + import pkg_resources + except ImportError: + eggs: t.Iterable[t.Any] = () + else: + eggs = sorted( + pkg_resources.working_set, + key=lambda x: x.project_name.lower(), + ) + python_eggs = [] + for egg in eggs: + try: + version = egg.version + except (ValueError, AttributeError): + version = "unknown" + python_eggs.append( + f"
  • {escape(egg.project_name)} [{escape(version)}]" + ) + + wsgi_env = [] + sorted_environ = sorted(req.environ.items(), key=lambda x: repr(x[0]).lower()) + for key, value in sorted_environ: + value = "".join(wrap(str(escape(repr(value))))) + wsgi_env.append(f"{escape(key)}{value}") + + sys_path = [] + for item, virtual, expanded in iter_sys_path(): + css = [] + if virtual: + css.append("virtual") + if expanded: + css.append("exp") + class_str = f' class="{" ".join(css)}"' if css else "" + sys_path.append(f"{escape(item)}") + + context = { + "python_version": "
    ".join(escape(sys.version).splitlines()), + "platform": escape(sys.platform), + "os": escape(os.name), + "api_version": sys.api_version, + "byteorder": sys.byteorder, + "werkzeug_version": _get_werkzeug_version(), + "python_eggs": "\n".join(python_eggs), + "wsgi_env": "\n".join(wsgi_env), + "sys_path": "\n".join(sys_path), + } + return Response(TEMPLATE % context, mimetype="text/html") + + +_werkzeug_version = "" + + +def _get_werkzeug_version() -> str: + global _werkzeug_version + + if not _werkzeug_version: + _werkzeug_version = importlib.metadata.version("werkzeug") + + return _werkzeug_version + + +if __name__ == "__main__": + from .serving import run_simple + + run_simple("localhost", 5000, test_app, use_reloader=True) diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/werkzeug/urls.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/werkzeug/urls.py new file mode 100644 index 0000000000000000000000000000000000000000..5bffe392801e287f086b0505786d60740e75fd03 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/werkzeug/urls.py @@ -0,0 +1,203 @@ +from __future__ import annotations + +import codecs +import re +import typing as t +import urllib.parse +from urllib.parse import quote +from urllib.parse import unquote +from urllib.parse import urlencode +from urllib.parse import urlsplit +from urllib.parse import urlunsplit + +from .datastructures import iter_multi_items + + +def _codec_error_url_quote(e: UnicodeError) -> tuple[str, int]: + """Used in :func:`uri_to_iri` after unquoting to re-quote any + invalid bytes. + """ + # the docs state that UnicodeError does have these attributes, + # but mypy isn't picking them up + out = quote(e.object[e.start : e.end], safe="") # type: ignore + return out, e.end # type: ignore + + +codecs.register_error("werkzeug.url_quote", _codec_error_url_quote) + + +def _make_unquote_part(name: str, chars: str) -> t.Callable[[str], str]: + """Create a function that unquotes all percent encoded characters except those + given. This allows working with unquoted characters if possible while not changing + the meaning of a given part of a URL. + """ + choices = "|".join(f"{ord(c):02X}" for c in sorted(chars)) + pattern = re.compile(f"((?:%(?:{choices}))+)", re.I) + + def _unquote_partial(value: str) -> str: + parts = iter(pattern.split(value)) + out = [] + + for part in parts: + out.append(unquote(part, "utf-8", "werkzeug.url_quote")) + out.append(next(parts, "")) + + return "".join(out) + + _unquote_partial.__name__ = f"_unquote_{name}" + return _unquote_partial + + +# characters that should remain quoted in URL parts +# based on https://url.spec.whatwg.org/#percent-encoded-bytes +# always keep all controls, space, and % quoted +_always_unsafe = bytes((*range(0x21), 0x25, 0x7F)).decode() +_unquote_fragment = _make_unquote_part("fragment", _always_unsafe) +_unquote_query = _make_unquote_part("query", _always_unsafe + "&=+#") +_unquote_path = _make_unquote_part("path", _always_unsafe + "/?#") +_unquote_user = _make_unquote_part("user", _always_unsafe + ":@/?#") + + +def uri_to_iri(uri: str) -> str: + """Convert a URI to an IRI. All valid UTF-8 characters are unquoted, + leaving all reserved and invalid characters quoted. If the URL has + a domain, it is decoded from Punycode. + + >>> uri_to_iri("http://xn--n3h.net/p%C3%A5th?q=%C3%A8ry%DF") + 'http://\\u2603.net/p\\xe5th?q=\\xe8ry%DF' + + :param uri: The URI to convert. + + .. versionchanged:: 3.0 + Passing a tuple or bytes, and the ``charset`` and ``errors`` parameters, + are removed. + + .. versionchanged:: 2.3 + Which characters remain quoted is specific to each part of the URL. + + .. versionchanged:: 0.15 + All reserved and invalid characters remain quoted. Previously, + only some reserved characters were preserved, and invalid bytes + were replaced instead of left quoted. + + .. versionadded:: 0.6 + """ + parts = urlsplit(uri) + path = _unquote_path(parts.path) + query = _unquote_query(parts.query) + fragment = _unquote_fragment(parts.fragment) + + if parts.hostname: + netloc = _decode_idna(parts.hostname) + else: + netloc = "" + + if ":" in netloc: + netloc = f"[{netloc}]" + + if parts.port: + netloc = f"{netloc}:{parts.port}" + + if parts.username: + auth = _unquote_user(parts.username) + + if parts.password: + password = _unquote_user(parts.password) + auth = f"{auth}:{password}" + + netloc = f"{auth}@{netloc}" + + return urlunsplit((parts.scheme, netloc, path, query, fragment)) + + +def iri_to_uri(iri: str) -> str: + """Convert an IRI to a URI. All non-ASCII and unsafe characters are + quoted. If the URL has a domain, it is encoded to Punycode. + + >>> iri_to_uri('http://\\u2603.net/p\\xe5th?q=\\xe8ry%DF') + 'http://xn--n3h.net/p%C3%A5th?q=%C3%A8ry%DF' + + :param iri: The IRI to convert. + + .. versionchanged:: 3.0 + Passing a tuple or bytes, the ``charset`` and ``errors`` parameters, + and the ``safe_conversion`` parameter, are removed. + + .. versionchanged:: 2.3 + Which characters remain unquoted is specific to each part of the URL. + + .. versionchanged:: 0.15 + All reserved characters remain unquoted. Previously, only some reserved + characters were left unquoted. + + .. versionchanged:: 0.9.6 + The ``safe_conversion`` parameter was added. + + .. versionadded:: 0.6 + """ + parts = urlsplit(iri) + # safe = https://url.spec.whatwg.org/#url-path-segment-string + # as well as percent for things that are already quoted + path = quote(parts.path, safe="%!$&'()*+,/:;=@") + query = quote(parts.query, safe="%!$&'()*+,/:;=?@") + fragment = quote(parts.fragment, safe="%!#$&'()*+,/:;=?@") + + if parts.hostname: + netloc = parts.hostname.encode("idna").decode("ascii") + else: + netloc = "" + + if ":" in netloc: + netloc = f"[{netloc}]" + + if parts.port: + netloc = f"{netloc}:{parts.port}" + + if parts.username: + auth = quote(parts.username, safe="%!$&'()*+,;=") + + if parts.password: + password = quote(parts.password, safe="%!$&'()*+,;=") + auth = f"{auth}:{password}" + + netloc = f"{auth}@{netloc}" + + return urlunsplit((parts.scheme, netloc, path, query, fragment)) + + +# Python < 3.12 +# itms-services was worked around in previous iri_to_uri implementations, but +# we can tell Python directly that it needs to preserve the //. +if "itms-services" not in urllib.parse.uses_netloc: + urllib.parse.uses_netloc.append("itms-services") + + +def _decode_idna(domain: str) -> str: + try: + data = domain.encode("ascii") + except UnicodeEncodeError: + # If the domain is not ASCII, it's decoded already. + return domain + + try: + # Try decoding in one shot. + return data.decode("idna") + except UnicodeDecodeError: + pass + + # Decode each part separately, leaving invalid parts as punycode. + parts = [] + + for part in data.split(b"."): + try: + parts.append(part.decode("idna")) + except UnicodeDecodeError: + parts.append(part.decode("ascii")) + + return ".".join(parts) + + +def _urlencode(query: t.Mapping[str, str] | t.Iterable[tuple[str, str]]) -> str: + items = [x for x in iter_multi_items(query) if x[1] is not None] + # safe = https://url.spec.whatwg.org/#percent-encoded-bytes + return urlencode(items, safe="!$'()*,/:;?@") diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/werkzeug/user_agent.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/werkzeug/user_agent.py new file mode 100644 index 0000000000000000000000000000000000000000..17e5d3fdbf0560318981210c7c824fee10853d13 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/werkzeug/user_agent.py @@ -0,0 +1,47 @@ +from __future__ import annotations + + +class UserAgent: + """Represents a parsed user agent header value. + + The default implementation does no parsing, only the :attr:`string` + attribute is set. A subclass may parse the string to set the + common attributes or expose other information. Set + :attr:`werkzeug.wrappers.Request.user_agent_class` to use a + subclass. + + :param string: The header value to parse. + + .. versionadded:: 2.0 + This replaces the previous ``useragents`` module, but does not + provide a built-in parser. + """ + + platform: str | None = None + """The OS name, if it could be parsed from the string.""" + + browser: str | None = None + """The browser name, if it could be parsed from the string.""" + + version: str | None = None + """The browser version, if it could be parsed from the string.""" + + language: str | None = None + """The browser language, if it could be parsed from the string.""" + + def __init__(self, string: str) -> None: + self.string: str = string + """The original header value.""" + + def __repr__(self) -> str: + return f"<{type(self).__name__} {self.browser}/{self.version}>" + + def __str__(self) -> str: + return self.string + + def __bool__(self) -> bool: + return bool(self.browser) + + def to_header(self) -> str: + """Convert to a header value.""" + return self.string diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/werkzeug/utils.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/werkzeug/utils.py new file mode 100644 index 0000000000000000000000000000000000000000..0d4a700f0859e5224ed539ee1e3f951170619d51 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/werkzeug/utils.py @@ -0,0 +1,684 @@ +from __future__ import annotations + +import io +import mimetypes +import os +import pkgutil +import re +import sys +import typing as t +import unicodedata +from datetime import datetime +from time import time +from urllib.parse import quote +from zlib import adler32 + +from markupsafe import escape + +from ._internal import _DictAccessorProperty +from ._internal import _missing +from ._internal import _TAccessorValue +from .datastructures import Headers +from .exceptions import NotFound +from .exceptions import RequestedRangeNotSatisfiable +from .security import _windows_device_files +from .security import safe_join +from .wsgi import wrap_file + +if t.TYPE_CHECKING: + from _typeshed.wsgi import WSGIEnvironment + + from .wrappers.request import Request + from .wrappers.response import Response + +_T = t.TypeVar("_T") + +_entity_re = re.compile(r"&([^;]+);") +_filename_ascii_strip_re = re.compile(r"[^A-Za-z0-9_.-]") + + +class cached_property(property, t.Generic[_T]): + """A :func:`property` that is only evaluated once. Subsequent access + returns the cached value. Setting the property sets the cached + value. Deleting the property clears the cached value, accessing it + again will evaluate it again. + + .. code-block:: python + + class Example: + @cached_property + def value(self): + # calculate something important here + return 42 + + e = Example() + e.value # evaluates + e.value # uses cache + e.value = 16 # sets cache + del e.value # clears cache + + If the class defines ``__slots__``, it must add ``_cache_{name}`` as + a slot. Alternatively, it can add ``__dict__``, but that's usually + not desirable. + + .. versionchanged:: 2.1 + Works with ``__slots__``. + + .. versionchanged:: 2.0 + ``del obj.name`` clears the cached value. + """ + + def __init__( + self, + fget: t.Callable[[t.Any], _T], + name: str | None = None, + doc: str | None = None, + ) -> None: + super().__init__(fget, doc=doc) + self.__name__ = name or fget.__name__ + self.slot_name = f"_cache_{self.__name__}" + self.__module__ = fget.__module__ + + def __set__(self, obj: object, value: _T) -> None: + if hasattr(obj, "__dict__"): + obj.__dict__[self.__name__] = value + else: + setattr(obj, self.slot_name, value) + + def __get__(self, obj: object, type: type = None) -> _T: # type: ignore + if obj is None: + return self # type: ignore + + obj_dict = getattr(obj, "__dict__", None) + + if obj_dict is not None: + value: _T = obj_dict.get(self.__name__, _missing) + else: + value = getattr(obj, self.slot_name, _missing) # type: ignore[arg-type] + + if value is _missing: + value = self.fget(obj) # type: ignore + + if obj_dict is not None: + obj.__dict__[self.__name__] = value + else: + setattr(obj, self.slot_name, value) + + return value + + def __delete__(self, obj: object) -> None: + if hasattr(obj, "__dict__"): + del obj.__dict__[self.__name__] + else: + setattr(obj, self.slot_name, _missing) + + +class environ_property(_DictAccessorProperty[_TAccessorValue]): + """Maps request attributes to environment variables. This works not only + for the Werkzeug request object, but also any other class with an + environ attribute: + + >>> class Test(object): + ... environ = {'key': 'value'} + ... test = environ_property('key') + >>> var = Test() + >>> var.test + 'value' + + If you pass it a second value it's used as default if the key does not + exist, the third one can be a converter that takes a value and converts + it. If it raises :exc:`ValueError` or :exc:`TypeError` the default value + is used. If no default value is provided `None` is used. + + Per default the property is read only. You have to explicitly enable it + by passing ``read_only=False`` to the constructor. + """ + + read_only = True + + def lookup(self, obj: Request) -> WSGIEnvironment: + return obj.environ + + +class header_property(_DictAccessorProperty[_TAccessorValue]): + """Like `environ_property` but for headers.""" + + def lookup(self, obj: Request | Response) -> Headers: # type: ignore[override] + return obj.headers + + +# https://cgit.freedesktop.org/xdg/shared-mime-info/tree/freedesktop.org.xml.in +# https://www.iana.org/assignments/media-types/media-types.xhtml +# Types listed in the XDG mime info that have a charset in the IANA registration. +_charset_mimetypes = { + "application/ecmascript", + "application/javascript", + "application/sql", + "application/xml", + "application/xml-dtd", + "application/xml-external-parsed-entity", +} + + +def get_content_type(mimetype: str, charset: str) -> str: + """Returns the full content type string with charset for a mimetype. + + If the mimetype represents text, the charset parameter will be + appended, otherwise the mimetype is returned unchanged. + + :param mimetype: The mimetype to be used as content type. + :param charset: The charset to be appended for text mimetypes. + :return: The content type. + + .. versionchanged:: 0.15 + Any type that ends with ``+xml`` gets a charset, not just those + that start with ``application/``. Known text types such as + ``application/javascript`` are also given charsets. + """ + if ( + mimetype.startswith("text/") + or mimetype in _charset_mimetypes + or mimetype.endswith("+xml") + ): + mimetype += f"; charset={charset}" + + return mimetype + + +def secure_filename(filename: str) -> str: + r"""Pass it a filename and it will return a secure version of it. This + filename can then safely be stored on a regular file system and passed + to :func:`os.path.join`. The filename returned is an ASCII only string + for maximum portability. + + On windows systems the function also makes sure that the file is not + named after one of the special device files. + + >>> secure_filename("My cool movie.mov") + 'My_cool_movie.mov' + >>> secure_filename("../../../etc/passwd") + 'etc_passwd' + >>> secure_filename('i contain cool \xfcml\xe4uts.txt') + 'i_contain_cool_umlauts.txt' + + The function might return an empty filename. It's your responsibility + to ensure that the filename is unique and that you abort or + generate a random filename if the function returned an empty one. + + .. versionadded:: 0.5 + + :param filename: the filename to secure + """ + filename = unicodedata.normalize("NFKD", filename) + filename = filename.encode("ascii", "ignore").decode("ascii") + + for sep in os.sep, os.path.altsep: + if sep: + filename = filename.replace(sep, " ") + filename = str(_filename_ascii_strip_re.sub("", "_".join(filename.split()))).strip( + "._" + ) + + # on nt a couple of special files are present in each folder. We + # have to ensure that the target file is not such a filename. In + # this case we prepend an underline + if ( + os.name == "nt" + and filename + and filename.split(".")[0].upper() in _windows_device_files + ): + filename = f"_{filename}" + + return filename + + +def redirect( + location: str, code: int = 302, Response: type[Response] | None = None +) -> Response: + """Returns a response object (a WSGI application) that, if called, + redirects the client to the target location. Supported codes are + 301, 302, 303, 305, 307, and 308. 300 is not supported because + it's not a real redirect and 304 because it's the answer for a + request with a request with defined If-Modified-Since headers. + + .. versionadded:: 0.6 + The location can now be a unicode string that is encoded using + the :func:`iri_to_uri` function. + + .. versionadded:: 0.10 + The class used for the Response object can now be passed in. + + :param location: the location the response should redirect to. + :param code: the redirect status code. defaults to 302. + :param class Response: a Response class to use when instantiating a + response. The default is :class:`werkzeug.wrappers.Response` if + unspecified. + """ + if Response is None: + from .wrappers import Response + + html_location = escape(location) + response = Response( # type: ignore[misc] + "\n" + "\n" + "Redirecting...\n" + "

    Redirecting...

    \n" + "

    You should be redirected automatically to the target URL: " + f'{html_location}. If not, click the link.\n', + code, + mimetype="text/html", + ) + response.headers["Location"] = location + return response + + +def append_slash_redirect(environ: WSGIEnvironment, code: int = 308) -> Response: + """Redirect to the current URL with a slash appended. + + If the current URL is ``/user/42``, the redirect URL will be + ``42/``. When joined to the current URL during response + processing or by the browser, this will produce ``/user/42/``. + + The behavior is undefined if the path ends with a slash already. If + called unconditionally on a URL, it may produce a redirect loop. + + :param environ: Use the path and query from this WSGI environment + to produce the redirect URL. + :param code: the status code for the redirect. + + .. versionchanged:: 2.1 + Produce a relative URL that only modifies the last segment. + Relevant when the current path has multiple segments. + + .. versionchanged:: 2.1 + The default status code is 308 instead of 301. This preserves + the request method and body. + """ + tail = environ["PATH_INFO"].rpartition("/")[2] + + if not tail: + new_path = "./" + else: + new_path = f"{tail}/" + + query_string = environ.get("QUERY_STRING") + + if query_string: + new_path = f"{new_path}?{query_string}" + + return redirect(new_path, code) + + +def send_file( + path_or_file: os.PathLike[str] | str | t.IO[bytes], + environ: WSGIEnvironment, + mimetype: str | None = None, + as_attachment: bool = False, + download_name: str | None = None, + conditional: bool = True, + etag: bool | str = True, + last_modified: datetime | int | float | None = None, + max_age: None | (int | t.Callable[[str | None], int | None]) = None, + use_x_sendfile: bool = False, + response_class: type[Response] | None = None, + _root_path: os.PathLike[str] | str | None = None, +) -> Response: + """Send the contents of a file to the client. + + The first argument can be a file path or a file-like object. Paths + are preferred in most cases because Werkzeug can manage the file and + get extra information from the path. Passing a file-like object + requires that the file is opened in binary mode, and is mostly + useful when building a file in memory with :class:`io.BytesIO`. + + Never pass file paths provided by a user. The path is assumed to be + trusted, so a user could craft a path to access a file you didn't + intend. Use :func:`send_from_directory` to safely serve user-provided paths. + + If the WSGI server sets a ``file_wrapper`` in ``environ``, it is + used, otherwise Werkzeug's built-in wrapper is used. Alternatively, + if the HTTP server supports ``X-Sendfile``, ``use_x_sendfile=True`` + will tell the server to send the given path, which is much more + efficient than reading it in Python. + + :param path_or_file: The path to the file to send, relative to the + current working directory if a relative path is given. + Alternatively, a file-like object opened in binary mode. Make + sure the file pointer is seeked to the start of the data. + :param environ: The WSGI environ for the current request. + :param mimetype: The MIME type to send for the file. If not + provided, it will try to detect it from the file name. + :param as_attachment: Indicate to a browser that it should offer to + save the file instead of displaying it. + :param download_name: The default name browsers will use when saving + the file. Defaults to the passed file name. + :param conditional: Enable conditional and range responses based on + request headers. Requires passing a file path and ``environ``. + :param etag: Calculate an ETag for the file, which requires passing + a file path. Can also be a string to use instead. + :param last_modified: The last modified time to send for the file, + in seconds. If not provided, it will try to detect it from the + file path. + :param max_age: How long the client should cache the file, in + seconds. If set, ``Cache-Control`` will be ``public``, otherwise + it will be ``no-cache`` to prefer conditional caching. + :param use_x_sendfile: Set the ``X-Sendfile`` header to let the + server to efficiently send the file. Requires support from the + HTTP server. Requires passing a file path. + :param response_class: Build the response using this class. Defaults + to :class:`~werkzeug.wrappers.Response`. + :param _root_path: Do not use. For internal use only. Use + :func:`send_from_directory` to safely send files under a path. + + .. versionchanged:: 2.0.2 + ``send_file`` only sets a detected ``Content-Encoding`` if + ``as_attachment`` is disabled. + + .. versionadded:: 2.0 + Adapted from Flask's implementation. + + .. versionchanged:: 2.0 + ``download_name`` replaces Flask's ``attachment_filename`` + parameter. If ``as_attachment=False``, it is passed with + ``Content-Disposition: inline`` instead. + + .. versionchanged:: 2.0 + ``max_age`` replaces Flask's ``cache_timeout`` parameter. + ``conditional`` is enabled and ``max_age`` is not set by + default. + + .. versionchanged:: 2.0 + ``etag`` replaces Flask's ``add_etags`` parameter. It can be a + string to use instead of generating one. + + .. versionchanged:: 2.0 + If an encoding is returned when guessing ``mimetype`` from + ``download_name``, set the ``Content-Encoding`` header. + """ + if response_class is None: + from .wrappers import Response + + response_class = Response + + path: str | None = None + file: t.IO[bytes] | None = None + size: int | None = None + mtime: float | None = None + headers = Headers() + + if isinstance(path_or_file, (os.PathLike, str)) or hasattr( + path_or_file, "__fspath__" + ): + path_or_file = t.cast("t.Union[os.PathLike[str], str]", path_or_file) + + # Flask will pass app.root_path, allowing its send_file wrapper + # to not have to deal with paths. + if _root_path is not None: + path = os.path.join(_root_path, path_or_file) + else: + path = os.path.abspath(path_or_file) + + stat = os.stat(path) + size = stat.st_size + mtime = stat.st_mtime + else: + file = path_or_file + + if download_name is None and path is not None: + download_name = os.path.basename(path) + + if mimetype is None: + if download_name is None: + raise TypeError( + "Unable to detect the MIME type because a file name is" + " not available. Either set 'download_name', pass a" + " path instead of a file, or set 'mimetype'." + ) + + mimetype, encoding = mimetypes.guess_type(download_name) + + if mimetype is None: + mimetype = "application/octet-stream" + + # Don't send encoding for attachments, it causes browsers to + # save decompress tar.gz files. + if encoding is not None and not as_attachment: + headers.set("Content-Encoding", encoding) + + if download_name is not None: + try: + download_name.encode("ascii") + except UnicodeEncodeError: + simple = unicodedata.normalize("NFKD", download_name) + simple = simple.encode("ascii", "ignore").decode("ascii") + # safe = RFC 5987 attr-char + quoted = quote(download_name, safe="!#$&+-.^_`|~") + names = {"filename": simple, "filename*": f"UTF-8''{quoted}"} + else: + names = {"filename": download_name} + + value = "attachment" if as_attachment else "inline" + headers.set("Content-Disposition", value, **names) + elif as_attachment: + raise TypeError( + "No name provided for attachment. Either set" + " 'download_name' or pass a path instead of a file." + ) + + if use_x_sendfile and path is not None: + headers["X-Sendfile"] = path + data = None + else: + if file is None: + file = open(path, "rb") # type: ignore + elif isinstance(file, io.BytesIO): + size = file.getbuffer().nbytes + elif isinstance(file, io.TextIOBase): + raise ValueError("Files must be opened in binary mode or use BytesIO.") + + data = wrap_file(environ, file) + + rv = response_class( + data, mimetype=mimetype, headers=headers, direct_passthrough=True + ) + + if size is not None: + rv.content_length = size + + if last_modified is not None: + rv.last_modified = last_modified # type: ignore + elif mtime is not None: + rv.last_modified = mtime # type: ignore + + rv.cache_control.no_cache = True + + # Flask will pass app.get_send_file_max_age, allowing its send_file + # wrapper to not have to deal with paths. + if callable(max_age): + max_age = max_age(path) + + if max_age is not None: + if max_age > 0: + rv.cache_control.no_cache = None + rv.cache_control.public = True + + rv.cache_control.max_age = max_age + rv.expires = int(time() + max_age) # type: ignore + + if isinstance(etag, str): + rv.set_etag(etag) + elif etag and path is not None: + check = adler32(path.encode()) & 0xFFFFFFFF + rv.set_etag(f"{mtime}-{size}-{check}") + + if conditional: + try: + rv = rv.make_conditional(environ, accept_ranges=True, complete_length=size) + except RequestedRangeNotSatisfiable: + if file is not None: + file.close() + + raise + + # Some x-sendfile implementations incorrectly ignore the 304 + # status code and send the file anyway. + if rv.status_code == 304: + rv.headers.pop("x-sendfile", None) + + return rv + + +def send_from_directory( + directory: os.PathLike[str] | str, + path: os.PathLike[str] | str, + environ: WSGIEnvironment, + **kwargs: t.Any, +) -> Response: + """Send a file from within a directory using :func:`send_file`. + + This is a secure way to serve files from a folder, such as static + files or uploads. Uses :func:`~werkzeug.security.safe_join` to + ensure the path coming from the client is not maliciously crafted to + point outside the specified directory. + + If the final path does not point to an existing regular file, + returns a 404 :exc:`~werkzeug.exceptions.NotFound` error. + + :param directory: The directory that ``path`` must be located under. This *must not* + be a value provided by the client, otherwise it becomes insecure. + :param path: The path to the file to send, relative to ``directory``. This is the + part of the path provided by the client, which is checked for security. + :param environ: The WSGI environ for the current request. + :param kwargs: Arguments to pass to :func:`send_file`. + + .. versionadded:: 2.0 + Adapted from Flask's implementation. + """ + path_str = safe_join(os.fspath(directory), os.fspath(path)) + + if path_str is None: + raise NotFound() + + # Flask will pass app.root_path, allowing its send_from_directory + # wrapper to not have to deal with paths. + if "_root_path" in kwargs: + path_str = os.path.join(kwargs["_root_path"], path_str) + + if not os.path.isfile(path_str): + raise NotFound() + + return send_file(path_str, environ, **kwargs) + + +def import_string(import_name: str, silent: bool = False) -> t.Any: + """Imports an object based on a string. This is useful if you want to + use import paths as endpoints or something similar. An import path can + be specified either in dotted notation (``xml.sax.saxutils.escape``) + or with a colon as object delimiter (``xml.sax.saxutils:escape``). + + If `silent` is True the return value will be `None` if the import fails. + + :param import_name: the dotted name for the object to import. + :param silent: if set to `True` import errors are ignored and + `None` is returned instead. + :return: imported object + """ + import_name = import_name.replace(":", ".") + try: + try: + __import__(import_name) + except ImportError: + if "." not in import_name: + raise + else: + return sys.modules[import_name] + + module_name, obj_name = import_name.rsplit(".", 1) + module = __import__(module_name, globals(), locals(), [obj_name]) + try: + return getattr(module, obj_name) + except AttributeError as e: + raise ImportError(e) from None + + except ImportError as e: + if not silent: + raise ImportStringError(import_name, e).with_traceback( + sys.exc_info()[2] + ) from None + + return None + + +def find_modules( + import_path: str, include_packages: bool = False, recursive: bool = False +) -> t.Iterator[str]: + """Finds all the modules below a package. This can be useful to + automatically import all views / controllers so that their metaclasses / + function decorators have a chance to register themselves on the + application. + + Packages are not returned unless `include_packages` is `True`. This can + also recursively list modules but in that case it will import all the + packages to get the correct load path of that module. + + :param import_path: the dotted name for the package to find child modules. + :param include_packages: set to `True` if packages should be returned, too. + :param recursive: set to `True` if recursion should happen. + :return: generator + """ + module = import_string(import_path) + path = getattr(module, "__path__", None) + if path is None: + raise ValueError(f"{import_path!r} is not a package") + basename = f"{module.__name__}." + for _importer, modname, ispkg in pkgutil.iter_modules(path): + modname = basename + modname + if ispkg: + if include_packages: + yield modname + if recursive: + yield from find_modules(modname, include_packages, True) + else: + yield modname + + +class ImportStringError(ImportError): + """Provides information about a failed :func:`import_string` attempt.""" + + #: String in dotted notation that failed to be imported. + import_name: str + #: Wrapped exception. + exception: BaseException + + def __init__(self, import_name: str, exception: BaseException) -> None: + self.import_name = import_name + self.exception = exception + msg = import_name + name = "" + tracked = [] + for part in import_name.replace(":", ".").split("."): + name = f"{name}.{part}" if name else part + imported = import_string(name, silent=True) + if imported: + tracked.append((name, getattr(imported, "__file__", None))) + else: + track = [f"- {n!r} found in {i!r}." for n, i in tracked] + track.append(f"- {name!r} not found.") + track_str = "\n".join(track) + msg = ( + f"import_string() failed for {import_name!r}. Possible reasons" + f" are:\n\n" + "- missing __init__.py in a package;\n" + "- package or module path not included in sys.path;\n" + "- duplicated package or module name taking precedence in" + " sys.path;\n" + "- missing module, class, function or variable;\n\n" + f"Debugged import:\n\n{track_str}\n\n" + f"Original exception:\n\n{type(exception).__name__}: {exception}" + ) + break + + super().__init__(msg) + + def __repr__(self) -> str: + return f"<{type(self).__name__}({self.import_name!r}, {self.exception!r})>" diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/werkzeug/wrappers/__init__.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/werkzeug/wrappers/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..b36f228f2cef05a53bff1e07f241a6bd60576fac --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/werkzeug/wrappers/__init__.py @@ -0,0 +1,3 @@ +from .request import Request as Request +from .response import Response as Response +from .response import ResponseStream as ResponseStream diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/werkzeug/wrappers/request.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/werkzeug/wrappers/request.py new file mode 100644 index 0000000000000000000000000000000000000000..9f1eee118421ed35ded9646573eff88c16227bf2 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/werkzeug/wrappers/request.py @@ -0,0 +1,650 @@ +from __future__ import annotations + +import collections.abc as cabc +import functools +import json +import typing as t +from io import BytesIO + +from .._internal import _wsgi_decoding_dance +from ..datastructures import CombinedMultiDict +from ..datastructures import EnvironHeaders +from ..datastructures import FileStorage +from ..datastructures import ImmutableMultiDict +from ..datastructures import iter_multi_items +from ..datastructures import MultiDict +from ..exceptions import BadRequest +from ..exceptions import UnsupportedMediaType +from ..formparser import default_stream_factory +from ..formparser import FormDataParser +from ..sansio.request import Request as _SansIORequest +from ..utils import cached_property +from ..utils import environ_property +from ..wsgi import _get_server +from ..wsgi import get_input_stream + +if t.TYPE_CHECKING: + from _typeshed.wsgi import WSGIApplication + from _typeshed.wsgi import WSGIEnvironment + + +class Request(_SansIORequest): + """Represents an incoming WSGI HTTP request, with headers and body + taken from the WSGI environment. Has properties and methods for + using the functionality defined by various HTTP specs. The data in + requests object is read-only. + + Text data is assumed to use UTF-8 encoding, which should be true for + the vast majority of modern clients. Using an encoding set by the + client is unsafe in Python due to extra encodings it provides, such + as ``zip``. To change the assumed encoding, subclass and replace + :attr:`charset`. + + :param environ: The WSGI environ is generated by the WSGI server and + contains information about the server configuration and client + request. + :param populate_request: Add this request object to the WSGI environ + as ``environ['werkzeug.request']``. Can be useful when + debugging. + :param shallow: Makes reading from :attr:`stream` (and any method + that would read from it) raise a :exc:`RuntimeError`. Useful to + prevent consuming the form data in middleware, which would make + it unavailable to the final application. + + .. versionchanged:: 3.0 + The ``charset``, ``url_charset``, and ``encoding_errors`` parameters + were removed. + + .. versionchanged:: 2.1 + Old ``BaseRequest`` and mixin classes were removed. + + .. versionchanged:: 2.1 + Remove the ``disable_data_descriptor`` attribute. + + .. versionchanged:: 2.0 + Combine ``BaseRequest`` and mixins into a single ``Request`` + class. + + .. versionchanged:: 0.5 + Read-only mode is enforced with immutable classes for all data. + """ + + #: the maximum content length. This is forwarded to the form data + #: parsing function (:func:`parse_form_data`). When set and the + #: :attr:`form` or :attr:`files` attribute is accessed and the + #: parsing fails because more than the specified value is transmitted + #: a :exc:`~werkzeug.exceptions.RequestEntityTooLarge` exception is raised. + #: + #: .. versionadded:: 0.5 + max_content_length: int | None = None + + #: the maximum form field size. This is forwarded to the form data + #: parsing function (:func:`parse_form_data`). When set and the + #: :attr:`form` or :attr:`files` attribute is accessed and the + #: data in memory for post data is longer than the specified value a + #: :exc:`~werkzeug.exceptions.RequestEntityTooLarge` exception is raised. + #: + #: .. versionchanged:: 3.1 + #: Defaults to 500kB instead of unlimited. + #: + #: .. versionadded:: 0.5 + max_form_memory_size: int | None = 500_000 + + #: The maximum number of multipart parts to parse, passed to + #: :attr:`form_data_parser_class`. Parsing form data with more than this + #: many parts will raise :exc:`~.RequestEntityTooLarge`. + #: + #: .. versionadded:: 2.2.3 + max_form_parts = 1000 + + #: The form data parser that should be used. Can be replaced to customize + #: the form date parsing. + form_data_parser_class: type[FormDataParser] = FormDataParser + + #: The WSGI environment containing HTTP headers and information from + #: the WSGI server. + environ: WSGIEnvironment + + #: Set when creating the request object. If ``True``, reading from + #: the request body will cause a ``RuntimeException``. Useful to + #: prevent modifying the stream from middleware. + shallow: bool + + def __init__( + self, + environ: WSGIEnvironment, + populate_request: bool = True, + shallow: bool = False, + ) -> None: + super().__init__( + method=environ.get("REQUEST_METHOD", "GET"), + scheme=environ.get("wsgi.url_scheme", "http"), + server=_get_server(environ), + root_path=_wsgi_decoding_dance(environ.get("SCRIPT_NAME") or ""), + path=_wsgi_decoding_dance(environ.get("PATH_INFO") or ""), + query_string=environ.get("QUERY_STRING", "").encode("latin1"), + headers=EnvironHeaders(environ), + remote_addr=environ.get("REMOTE_ADDR"), + ) + self.environ = environ + self.shallow = shallow + + if populate_request and not shallow: + self.environ["werkzeug.request"] = self + + @classmethod + def from_values(cls, *args: t.Any, **kwargs: t.Any) -> Request: + """Create a new request object based on the values provided. If + environ is given missing values are filled from there. This method is + useful for small scripts when you need to simulate a request from an URL. + Do not use this method for unittesting, there is a full featured client + object (:class:`Client`) that allows to create multipart requests, + support for cookies etc. + + This accepts the same options as the + :class:`~werkzeug.test.EnvironBuilder`. + + .. versionchanged:: 0.5 + This method now accepts the same arguments as + :class:`~werkzeug.test.EnvironBuilder`. Because of this the + `environ` parameter is now called `environ_overrides`. + + :return: request object + """ + from ..test import EnvironBuilder + + builder = EnvironBuilder(*args, **kwargs) + try: + return builder.get_request(cls) + finally: + builder.close() + + @classmethod + def application(cls, f: t.Callable[[Request], WSGIApplication]) -> WSGIApplication: + """Decorate a function as responder that accepts the request as + the last argument. This works like the :func:`responder` + decorator but the function is passed the request object as the + last argument and the request object will be closed + automatically:: + + @Request.application + def my_wsgi_app(request): + return Response('Hello World!') + + As of Werkzeug 0.14 HTTP exceptions are automatically caught and + converted to responses instead of failing. + + :param f: the WSGI callable to decorate + :return: a new WSGI callable + """ + #: return a callable that wraps the -2nd argument with the request + #: and calls the function with all the arguments up to that one and + #: the request. The return value is then called with the latest + #: two arguments. This makes it possible to use this decorator for + #: both standalone WSGI functions as well as bound methods and + #: partially applied functions. + from ..exceptions import HTTPException + + @functools.wraps(f) + def application(*args: t.Any) -> cabc.Iterable[bytes]: + request = cls(args[-2]) + with request: + try: + resp = f(*args[:-2] + (request,)) + except HTTPException as e: + resp = t.cast("WSGIApplication", e.get_response(args[-2])) + return resp(*args[-2:]) + + return t.cast("WSGIApplication", application) + + def _get_file_stream( + self, + total_content_length: int | None, + content_type: str | None, + filename: str | None = None, + content_length: int | None = None, + ) -> t.IO[bytes]: + """Called to get a stream for the file upload. + + This must provide a file-like class with `read()`, `readline()` + and `seek()` methods that is both writeable and readable. + + The default implementation returns a temporary file if the total + content length is higher than 500KB. Because many browsers do not + provide a content length for the files only the total content + length matters. + + :param total_content_length: the total content length of all the + data in the request combined. This value + is guaranteed to be there. + :param content_type: the mimetype of the uploaded file. + :param filename: the filename of the uploaded file. May be `None`. + :param content_length: the length of this file. This value is usually + not provided because webbrowsers do not provide + this value. + """ + return default_stream_factory( + total_content_length=total_content_length, + filename=filename, + content_type=content_type, + content_length=content_length, + ) + + @property + def want_form_data_parsed(self) -> bool: + """``True`` if the request method carries content. By default + this is true if a ``Content-Type`` is sent. + + .. versionadded:: 0.8 + """ + return bool(self.environ.get("CONTENT_TYPE")) + + def make_form_data_parser(self) -> FormDataParser: + """Creates the form data parser. Instantiates the + :attr:`form_data_parser_class` with some parameters. + + .. versionadded:: 0.8 + """ + return self.form_data_parser_class( + stream_factory=self._get_file_stream, + max_form_memory_size=self.max_form_memory_size, + max_content_length=self.max_content_length, + max_form_parts=self.max_form_parts, + cls=self.parameter_storage_class, + ) + + def _load_form_data(self) -> None: + """Method used internally to retrieve submitted data. After calling + this sets `form` and `files` on the request object to multi dicts + filled with the incoming form data. As a matter of fact the input + stream will be empty afterwards. You can also call this method to + force the parsing of the form data. + + .. versionadded:: 0.8 + """ + # abort early if we have already consumed the stream + if "form" in self.__dict__: + return + + if self.want_form_data_parsed: + parser = self.make_form_data_parser() + data = parser.parse( + self._get_stream_for_parsing(), + self.mimetype, + self.content_length, + self.mimetype_params, + ) + else: + data = ( + self.stream, + self.parameter_storage_class(), + self.parameter_storage_class(), + ) + + # inject the values into the instance dict so that we bypass + # our cached_property non-data descriptor. + d = self.__dict__ + d["stream"], d["form"], d["files"] = data + + def _get_stream_for_parsing(self) -> t.IO[bytes]: + """This is the same as accessing :attr:`stream` with the difference + that if it finds cached data from calling :meth:`get_data` first it + will create a new stream out of the cached data. + + .. versionadded:: 0.9.3 + """ + cached_data = getattr(self, "_cached_data", None) + if cached_data is not None: + return BytesIO(cached_data) + return self.stream + + def close(self) -> None: + """Closes associated resources of this request object. This + closes all file handles explicitly. You can also use the request + object in a with statement which will automatically close it. + + .. versionadded:: 0.9 + """ + files = self.__dict__.get("files") + for _key, value in iter_multi_items(files or ()): + value.close() + + def __enter__(self) -> Request: + return self + + def __exit__(self, exc_type, exc_value, tb) -> None: # type: ignore + self.close() + + @cached_property + def stream(self) -> t.IO[bytes]: + """The WSGI input stream, with safety checks. This stream can only be consumed + once. + + Use :meth:`get_data` to get the full data as bytes or text. The :attr:`data` + attribute will contain the full bytes only if they do not represent form data. + The :attr:`form` attribute will contain the parsed form data in that case. + + Unlike :attr:`input_stream`, this stream guards against infinite streams or + reading past :attr:`content_length` or :attr:`max_content_length`. + + If ``max_content_length`` is set, it can be enforced on streams if + ``wsgi.input_terminated`` is set. Otherwise, an empty stream is returned. + + If the limit is reached before the underlying stream is exhausted (such as a + file that is too large, or an infinite stream), the remaining contents of the + stream cannot be read safely. Depending on how the server handles this, clients + may show a "connection reset" failure instead of seeing the 413 response. + + .. versionchanged:: 2.3 + Check ``max_content_length`` preemptively and while reading. + + .. versionchanged:: 0.9 + The stream is always set (but may be consumed) even if form parsing was + accessed first. + """ + if self.shallow: + raise RuntimeError( + "This request was created with 'shallow=True', reading" + " from the input stream is disabled." + ) + + return get_input_stream( + self.environ, max_content_length=self.max_content_length + ) + + input_stream = environ_property[t.IO[bytes]]( + "wsgi.input", + doc="""The raw WSGI input stream, without any safety checks. + + This is dangerous to use. It does not guard against infinite streams or reading + past :attr:`content_length` or :attr:`max_content_length`. + + Use :attr:`stream` instead. + """, + ) + + @cached_property + def data(self) -> bytes: + """The raw data read from :attr:`stream`. Will be empty if the request + represents form data. + + To get the raw data even if it represents form data, use :meth:`get_data`. + """ + return self.get_data(parse_form_data=True) + + @t.overload + def get_data( + self, + cache: bool = True, + as_text: t.Literal[False] = False, + parse_form_data: bool = False, + ) -> bytes: ... + + @t.overload + def get_data( + self, + cache: bool = True, + as_text: t.Literal[True] = ..., + parse_form_data: bool = False, + ) -> str: ... + + def get_data( + self, cache: bool = True, as_text: bool = False, parse_form_data: bool = False + ) -> bytes | str: + """This reads the buffered incoming data from the client into one + bytes object. By default this is cached but that behavior can be + changed by setting `cache` to `False`. + + Usually it's a bad idea to call this method without checking the + content length first as a client could send dozens of megabytes or more + to cause memory problems on the server. + + Note that if the form data was already parsed this method will not + return anything as form data parsing does not cache the data like + this method does. To implicitly invoke form data parsing function + set `parse_form_data` to `True`. When this is done the return value + of this method will be an empty string if the form parser handles + the data. This generally is not necessary as if the whole data is + cached (which is the default) the form parser will used the cached + data to parse the form data. Please be generally aware of checking + the content length first in any case before calling this method + to avoid exhausting server memory. + + If `as_text` is set to `True` the return value will be a decoded + string. + + .. versionadded:: 0.9 + """ + rv = getattr(self, "_cached_data", None) + if rv is None: + if parse_form_data: + self._load_form_data() + rv = self.stream.read() + if cache: + self._cached_data = rv + if as_text: + rv = rv.decode(errors="replace") + return rv + + @cached_property + def form(self) -> ImmutableMultiDict[str, str]: + """The form parameters. By default an + :class:`~werkzeug.datastructures.ImmutableMultiDict` + is returned from this function. This can be changed by setting + :attr:`parameter_storage_class` to a different type. This might + be necessary if the order of the form data is important. + + Please keep in mind that file uploads will not end up here, but instead + in the :attr:`files` attribute. + + .. versionchanged:: 0.9 + + Previous to Werkzeug 0.9 this would only contain form data for POST + and PUT requests. + """ + self._load_form_data() + return self.form + + @cached_property + def values(self) -> CombinedMultiDict[str, str]: + """A :class:`werkzeug.datastructures.CombinedMultiDict` that + combines :attr:`args` and :attr:`form`. + + For GET requests, only ``args`` are present, not ``form``. + + .. versionchanged:: 2.0 + For GET requests, only ``args`` are present, not ``form``. + """ + sources = [self.args] + + if self.method != "GET": + # GET requests can have a body, and some caching proxies + # might not treat that differently than a normal GET + # request, allowing form data to "invisibly" affect the + # cache without indication in the query string / URL. + sources.append(self.form) + + args = [] + + for d in sources: + if not isinstance(d, MultiDict): + d = MultiDict(d) + + args.append(d) + + return CombinedMultiDict(args) + + @cached_property + def files(self) -> ImmutableMultiDict[str, FileStorage]: + """:class:`~werkzeug.datastructures.MultiDict` object containing + all uploaded files. Each key in :attr:`files` is the name from the + ````. Each value in :attr:`files` is a + Werkzeug :class:`~werkzeug.datastructures.FileStorage` object. + + It basically behaves like a standard file object you know from Python, + with the difference that it also has a + :meth:`~werkzeug.datastructures.FileStorage.save` function that can + store the file on the filesystem. + + Note that :attr:`files` will only contain data if the request method was + POST, PUT or PATCH and the ``

    `` that posted to the request had + ``enctype="multipart/form-data"``. It will be empty otherwise. + + See the :class:`~werkzeug.datastructures.MultiDict` / + :class:`~werkzeug.datastructures.FileStorage` documentation for + more details about the used data structure. + """ + self._load_form_data() + return self.files + + @property + def script_root(self) -> str: + """Alias for :attr:`self.root_path`. ``environ["SCRIPT_NAME"]`` + without a trailing slash. + """ + return self.root_path + + @cached_property + def url_root(self) -> str: + """Alias for :attr:`root_url`. The URL with scheme, host, and + root path. For example, ``https://example.com/app/``. + """ + return self.root_url + + remote_user = environ_property[str]( + "REMOTE_USER", + doc="""If the server supports user authentication, and the + script is protected, this attribute contains the username the + user has authenticated as.""", + ) + is_multithread = environ_property[bool]( + "wsgi.multithread", + doc="""boolean that is `True` if the application is served by a + multithreaded WSGI server.""", + ) + is_multiprocess = environ_property[bool]( + "wsgi.multiprocess", + doc="""boolean that is `True` if the application is served by a + WSGI server that spawns multiple processes.""", + ) + is_run_once = environ_property[bool]( + "wsgi.run_once", + doc="""boolean that is `True` if the application will be + executed only once in a process lifetime. This is the case for + CGI for example, but it's not guaranteed that the execution only + happens one time.""", + ) + + # JSON + + #: A module or other object that has ``dumps`` and ``loads`` + #: functions that match the API of the built-in :mod:`json` module. + json_module = json + + @property + def json(self) -> t.Any: + """The parsed JSON data if :attr:`mimetype` indicates JSON + (:mimetype:`application/json`, see :attr:`is_json`). + + Calls :meth:`get_json` with default arguments. + + If the request content type is not ``application/json``, this + will raise a 415 Unsupported Media Type error. + + .. versionchanged:: 2.3 + Raise a 415 error instead of 400. + + .. versionchanged:: 2.1 + Raise a 400 error if the content type is incorrect. + """ + return self.get_json() + + # Cached values for ``(silent=False, silent=True)``. Initialized + # with sentinel values. + _cached_json: tuple[t.Any, t.Any] = (Ellipsis, Ellipsis) + + @t.overload + def get_json( + self, force: bool = ..., silent: t.Literal[False] = ..., cache: bool = ... + ) -> t.Any: ... + + @t.overload + def get_json( + self, force: bool = ..., silent: bool = ..., cache: bool = ... + ) -> t.Any | None: ... + + def get_json( + self, force: bool = False, silent: bool = False, cache: bool = True + ) -> t.Any | None: + """Parse :attr:`data` as JSON. + + If the mimetype does not indicate JSON + (:mimetype:`application/json`, see :attr:`is_json`), or parsing + fails, :meth:`on_json_loading_failed` is called and + its return value is used as the return value. By default this + raises a 415 Unsupported Media Type resp. + + :param force: Ignore the mimetype and always try to parse JSON. + :param silent: Silence mimetype and parsing errors, and + return ``None`` instead. + :param cache: Store the parsed JSON to return for subsequent + calls. + + .. versionchanged:: 2.3 + Raise a 415 error instead of 400. + + .. versionchanged:: 2.1 + Raise a 400 error if the content type is incorrect. + """ + if cache and self._cached_json[silent] is not Ellipsis: + return self._cached_json[silent] + + if not (force or self.is_json): + if not silent: + return self.on_json_loading_failed(None) + else: + return None + + data = self.get_data(cache=cache) + + try: + rv = self.json_module.loads(data) + except ValueError as e: + if silent: + rv = None + + if cache: + normal_rv, _ = self._cached_json + self._cached_json = (normal_rv, rv) + else: + rv = self.on_json_loading_failed(e) + + if cache: + _, silent_rv = self._cached_json + self._cached_json = (rv, silent_rv) + else: + if cache: + self._cached_json = (rv, rv) + + return rv + + def on_json_loading_failed(self, e: ValueError | None) -> t.Any: + """Called if :meth:`get_json` fails and isn't silenced. + + If this method returns a value, it is used as the return value + for :meth:`get_json`. The default implementation raises + :exc:`~werkzeug.exceptions.BadRequest`. + + :param e: If parsing failed, this is the exception. It will be + ``None`` if the content type wasn't ``application/json``. + + .. versionchanged:: 2.3 + Raise a 415 error instead of 400. + """ + if e is not None: + raise BadRequest(f"Failed to decode JSON object: {e}") + + raise UnsupportedMediaType( + "Did not attempt to load JSON data because the request" + " Content-Type was not 'application/json'." + ) diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/werkzeug/wrappers/response.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/werkzeug/wrappers/response.py new file mode 100644 index 0000000000000000000000000000000000000000..e05fa8a129bfdfef65e53942a5e0cb027419da4a --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/werkzeug/wrappers/response.py @@ -0,0 +1,831 @@ +from __future__ import annotations + +import json +import typing as t +from http import HTTPStatus +from urllib.parse import urljoin + +from .._internal import _get_environ +from ..datastructures import Headers +from ..http import generate_etag +from ..http import http_date +from ..http import is_resource_modified +from ..http import parse_etags +from ..http import parse_range_header +from ..http import remove_entity_headers +from ..sansio.response import Response as _SansIOResponse +from ..urls import iri_to_uri +from ..utils import cached_property +from ..wsgi import _RangeWrapper +from ..wsgi import ClosingIterator +from ..wsgi import get_current_url + +if t.TYPE_CHECKING: + from _typeshed.wsgi import StartResponse + from _typeshed.wsgi import WSGIApplication + from _typeshed.wsgi import WSGIEnvironment + + from .request import Request + + +def _iter_encoded(iterable: t.Iterable[str | bytes]) -> t.Iterator[bytes]: + for item in iterable: + if isinstance(item, str): + yield item.encode() + else: + yield item + + +class Response(_SansIOResponse): + """Represents an outgoing WSGI HTTP response with body, status, and + headers. Has properties and methods for using the functionality + defined by various HTTP specs. + + The response body is flexible to support different use cases. The + simple form is passing bytes, or a string which will be encoded as + UTF-8. Passing an iterable of bytes or strings makes this a + streaming response. A generator is particularly useful for building + a CSV file in memory or using SSE (Server Sent Events). A file-like + object is also iterable, although the + :func:`~werkzeug.utils.send_file` helper should be used in that + case. + + The response object is itself a WSGI application callable. When + called (:meth:`__call__`) with ``environ`` and ``start_response``, + it will pass its status and headers to ``start_response`` then + return its body as an iterable. + + .. code-block:: python + + from werkzeug.wrappers.response import Response + + def index(): + return Response("Hello, World!") + + def application(environ, start_response): + path = environ.get("PATH_INFO") or "/" + + if path == "/": + response = index() + else: + response = Response("Not Found", status=404) + + return response(environ, start_response) + + :param response: The data for the body of the response. A string or + bytes, or tuple or list of strings or bytes, for a fixed-length + response, or any other iterable of strings or bytes for a + streaming response. Defaults to an empty body. + :param status: The status code for the response. Either an int, in + which case the default status message is added, or a string in + the form ``{code} {message}``, like ``404 Not Found``. Defaults + to 200. + :param headers: A :class:`~werkzeug.datastructures.Headers` object, + or a list of ``(key, value)`` tuples that will be converted to a + ``Headers`` object. + :param mimetype: The mime type (content type without charset or + other parameters) of the response. If the value starts with + ``text/`` (or matches some other special cases), the charset + will be added to create the ``content_type``. + :param content_type: The full content type of the response. + Overrides building the value from ``mimetype``. + :param direct_passthrough: Pass the response body directly through + as the WSGI iterable. This can be used when the body is a binary + file or other iterator of bytes, to skip some unnecessary + checks. Use :func:`~werkzeug.utils.send_file` instead of setting + this manually. + + .. versionchanged:: 2.1 + Old ``BaseResponse`` and mixin classes were removed. + + .. versionchanged:: 2.0 + Combine ``BaseResponse`` and mixins into a single ``Response`` + class. + + .. versionchanged:: 0.5 + The ``direct_passthrough`` parameter was added. + """ + + #: if set to `False` accessing properties on the response object will + #: not try to consume the response iterator and convert it into a list. + #: + #: .. versionadded:: 0.6.2 + #: + #: That attribute was previously called `implicit_seqence_conversion`. + #: (Notice the typo). If you did use this feature, you have to adapt + #: your code to the name change. + implicit_sequence_conversion = True + + #: If a redirect ``Location`` header is a relative URL, make it an + #: absolute URL, including scheme and domain. + #: + #: .. versionchanged:: 2.1 + #: This is disabled by default, so responses will send relative + #: redirects. + #: + #: .. versionadded:: 0.8 + autocorrect_location_header = False + + #: Should this response object automatically set the content-length + #: header if possible? This is true by default. + #: + #: .. versionadded:: 0.8 + automatically_set_content_length = True + + #: The response body to send as the WSGI iterable. A list of strings + #: or bytes represents a fixed-length response, any other iterable + #: is a streaming response. Strings are encoded to bytes as UTF-8. + #: + #: Do not set to a plain string or bytes, that will cause sending + #: the response to be very inefficient as it will iterate one byte + #: at a time. + response: t.Iterable[str] | t.Iterable[bytes] + + def __init__( + self, + response: t.Iterable[bytes] | bytes | t.Iterable[str] | str | None = None, + status: int | str | HTTPStatus | None = None, + headers: t.Mapping[str, str | t.Iterable[str]] + | t.Iterable[tuple[str, str]] + | None = None, + mimetype: str | None = None, + content_type: str | None = None, + direct_passthrough: bool = False, + ) -> None: + super().__init__( + status=status, + headers=headers, + mimetype=mimetype, + content_type=content_type, + ) + + #: Pass the response body directly through as the WSGI iterable. + #: This can be used when the body is a binary file or other + #: iterator of bytes, to skip some unnecessary checks. Use + #: :func:`~werkzeug.utils.send_file` instead of setting this + #: manually. + self.direct_passthrough = direct_passthrough + self._on_close: list[t.Callable[[], t.Any]] = [] + + # we set the response after the headers so that if a class changes + # the charset attribute, the data is set in the correct charset. + if response is None: + self.response = [] + elif isinstance(response, (str, bytes, bytearray)): + self.set_data(response) + else: + self.response = response + + def call_on_close(self, func: t.Callable[[], t.Any]) -> t.Callable[[], t.Any]: + """Adds a function to the internal list of functions that should + be called as part of closing down the response. Since 0.7 this + function also returns the function that was passed so that this + can be used as a decorator. + + .. versionadded:: 0.6 + """ + self._on_close.append(func) + return func + + def __repr__(self) -> str: + if self.is_sequence: + body_info = f"{sum(map(len, self.iter_encoded()))} bytes" + else: + body_info = "streamed" if self.is_streamed else "likely-streamed" + return f"<{type(self).__name__} {body_info} [{self.status}]>" + + @classmethod + def force_type( + cls, response: Response, environ: WSGIEnvironment | None = None + ) -> Response: + """Enforce that the WSGI response is a response object of the current + type. Werkzeug will use the :class:`Response` internally in many + situations like the exceptions. If you call :meth:`get_response` on an + exception you will get back a regular :class:`Response` object, even + if you are using a custom subclass. + + This method can enforce a given response type, and it will also + convert arbitrary WSGI callables into response objects if an environ + is provided:: + + # convert a Werkzeug response object into an instance of the + # MyResponseClass subclass. + response = MyResponseClass.force_type(response) + + # convert any WSGI application into a response object + response = MyResponseClass.force_type(response, environ) + + This is especially useful if you want to post-process responses in + the main dispatcher and use functionality provided by your subclass. + + Keep in mind that this will modify response objects in place if + possible! + + :param response: a response object or wsgi application. + :param environ: a WSGI environment object. + :return: a response object. + """ + if not isinstance(response, Response): + if environ is None: + raise TypeError( + "cannot convert WSGI application into response" + " objects without an environ" + ) + + from ..test import run_wsgi_app + + response = Response(*run_wsgi_app(response, environ)) + + response.__class__ = cls + return response + + @classmethod + def from_app( + cls, app: WSGIApplication, environ: WSGIEnvironment, buffered: bool = False + ) -> Response: + """Create a new response object from an application output. This + works best if you pass it an application that returns a generator all + the time. Sometimes applications may use the `write()` callable + returned by the `start_response` function. This tries to resolve such + edge cases automatically. But if you don't get the expected output + you should set `buffered` to `True` which enforces buffering. + + :param app: the WSGI application to execute. + :param environ: the WSGI environment to execute against. + :param buffered: set to `True` to enforce buffering. + :return: a response object. + """ + from ..test import run_wsgi_app + + return cls(*run_wsgi_app(app, environ, buffered)) + + @t.overload + def get_data(self, as_text: t.Literal[False] = False) -> bytes: ... + + @t.overload + def get_data(self, as_text: t.Literal[True]) -> str: ... + + def get_data(self, as_text: bool = False) -> bytes | str: + """The string representation of the response body. Whenever you call + this property the response iterable is encoded and flattened. This + can lead to unwanted behavior if you stream big data. + + This behavior can be disabled by setting + :attr:`implicit_sequence_conversion` to `False`. + + If `as_text` is set to `True` the return value will be a decoded + string. + + .. versionadded:: 0.9 + """ + self._ensure_sequence() + rv = b"".join(self.iter_encoded()) + + if as_text: + return rv.decode() + + return rv + + def set_data(self, value: bytes | str) -> None: + """Sets a new string as response. The value must be a string or + bytes. If a string is set it's encoded to the charset of the + response (utf-8 by default). + + .. versionadded:: 0.9 + """ + if isinstance(value, str): + value = value.encode() + self.response = [value] + if self.automatically_set_content_length: + self.headers["Content-Length"] = str(len(value)) + + data = property( + get_data, + set_data, + doc="A descriptor that calls :meth:`get_data` and :meth:`set_data`.", + ) + + def calculate_content_length(self) -> int | None: + """Returns the content length if available or `None` otherwise.""" + try: + self._ensure_sequence() + except RuntimeError: + return None + return sum(len(x) for x in self.iter_encoded()) + + def _ensure_sequence(self, mutable: bool = False) -> None: + """This method can be called by methods that need a sequence. If + `mutable` is true, it will also ensure that the response sequence + is a standard Python list. + + .. versionadded:: 0.6 + """ + if self.is_sequence: + # if we need a mutable object, we ensure it's a list. + if mutable and not isinstance(self.response, list): + self.response = list(self.response) # type: ignore + return + if self.direct_passthrough: + raise RuntimeError( + "Attempted implicit sequence conversion but the" + " response object is in direct passthrough mode." + ) + if not self.implicit_sequence_conversion: + raise RuntimeError( + "The response object required the iterable to be a" + " sequence, but the implicit conversion was disabled." + " Call make_sequence() yourself." + ) + self.make_sequence() + + def make_sequence(self) -> None: + """Converts the response iterator in a list. By default this happens + automatically if required. If `implicit_sequence_conversion` is + disabled, this method is not automatically called and some properties + might raise exceptions. This also encodes all the items. + + .. versionadded:: 0.6 + """ + if not self.is_sequence: + # if we consume an iterable we have to ensure that the close + # method of the iterable is called if available when we tear + # down the response + close = getattr(self.response, "close", None) + self.response = list(self.iter_encoded()) + if close is not None: + self.call_on_close(close) + + def iter_encoded(self) -> t.Iterator[bytes]: + """Iter the response encoded with the encoding of the response. + If the response object is invoked as WSGI application the return + value of this method is used as application iterator unless + :attr:`direct_passthrough` was activated. + """ + # Encode in a separate function so that self.response is fetched + # early. This allows us to wrap the response with the return + # value from get_app_iter or iter_encoded. + return _iter_encoded(self.response) + + @property + def is_streamed(self) -> bool: + """If the response is streamed (the response is not an iterable with + a length information) this property is `True`. In this case streamed + means that there is no information about the number of iterations. + This is usually `True` if a generator is passed to the response object. + + This is useful for checking before applying some sort of post + filtering that should not take place for streamed responses. + """ + try: + len(self.response) # type: ignore + except (TypeError, AttributeError): + return True + return False + + @property + def is_sequence(self) -> bool: + """If the iterator is buffered, this property will be `True`. A + response object will consider an iterator to be buffered if the + response attribute is a list or tuple. + + .. versionadded:: 0.6 + """ + return isinstance(self.response, (tuple, list)) + + def close(self) -> None: + """Close the wrapped response if possible. You can also use the object + in a with statement which will automatically close it. + + .. versionadded:: 0.9 + Can now be used in a with statement. + """ + if hasattr(self.response, "close"): + self.response.close() + for func in self._on_close: + func() + + def __enter__(self) -> Response: + return self + + def __exit__(self, exc_type, exc_value, tb): # type: ignore + self.close() + + def freeze(self) -> None: + """Make the response object ready to be pickled. Does the + following: + + * Buffer the response into a list, ignoring + :attr:`implicity_sequence_conversion` and + :attr:`direct_passthrough`. + * Set the ``Content-Length`` header. + * Generate an ``ETag`` header if one is not already set. + + .. versionchanged:: 2.1 + Removed the ``no_etag`` parameter. + + .. versionchanged:: 2.0 + An ``ETag`` header is always added. + + .. versionchanged:: 0.6 + The ``Content-Length`` header is set. + """ + # Always freeze the encoded response body, ignore + # implicit_sequence_conversion and direct_passthrough. + self.response = list(self.iter_encoded()) + self.headers["Content-Length"] = str(sum(map(len, self.response))) + self.add_etag() + + def get_wsgi_headers(self, environ: WSGIEnvironment) -> Headers: + """This is automatically called right before the response is started + and returns headers modified for the given environment. It returns a + copy of the headers from the response with some modifications applied + if necessary. + + For example the location header (if present) is joined with the root + URL of the environment. Also the content length is automatically set + to zero here for certain status codes. + + .. versionchanged:: 0.6 + Previously that function was called `fix_headers` and modified + the response object in place. Also since 0.6, IRIs in location + and content-location headers are handled properly. + + Also starting with 0.6, Werkzeug will attempt to set the content + length if it is able to figure it out on its own. This is the + case if all the strings in the response iterable are already + encoded and the iterable is buffered. + + :param environ: the WSGI environment of the request. + :return: returns a new :class:`~werkzeug.datastructures.Headers` + object. + """ + headers = Headers(self.headers) + location: str | None = None + content_location: str | None = None + content_length: str | int | None = None + status = self.status_code + + # iterate over the headers to find all values in one go. Because + # get_wsgi_headers is used each response that gives us a tiny + # speedup. + for key, value in headers: + ikey = key.lower() + if ikey == "location": + location = value + elif ikey == "content-location": + content_location = value + elif ikey == "content-length": + content_length = value + + if location is not None: + location = iri_to_uri(location) + + if self.autocorrect_location_header: + # Make the location header an absolute URL. + current_url = get_current_url(environ, strip_querystring=True) + current_url = iri_to_uri(current_url) + location = urljoin(current_url, location) + + headers["Location"] = location + + # make sure the content location is a URL + if content_location is not None: + headers["Content-Location"] = iri_to_uri(content_location) + + if 100 <= status < 200 or status == 204: + # Per section 3.3.2 of RFC 7230, "a server MUST NOT send a + # Content-Length header field in any response with a status + # code of 1xx (Informational) or 204 (No Content)." + headers.remove("Content-Length") + elif status == 304: + remove_entity_headers(headers) + + # if we can determine the content length automatically, we + # should try to do that. But only if this does not involve + # flattening the iterator or encoding of strings in the + # response. We however should not do that if we have a 304 + # response. + if ( + self.automatically_set_content_length + and self.is_sequence + and content_length is None + and status not in (204, 304) + and not (100 <= status < 200) + ): + content_length = sum(len(x) for x in self.iter_encoded()) + headers["Content-Length"] = str(content_length) + + return headers + + def get_app_iter(self, environ: WSGIEnvironment) -> t.Iterable[bytes]: + """Returns the application iterator for the given environ. Depending + on the request method and the current status code the return value + might be an empty response rather than the one from the response. + + If the request method is `HEAD` or the status code is in a range + where the HTTP specification requires an empty response, an empty + iterable is returned. + + .. versionadded:: 0.6 + + :param environ: the WSGI environment of the request. + :return: a response iterable. + """ + status = self.status_code + if ( + environ["REQUEST_METHOD"] == "HEAD" + or 100 <= status < 200 + or status in (204, 304) + ): + iterable: t.Iterable[bytes] = () + elif self.direct_passthrough: + return self.response # type: ignore + else: + iterable = self.iter_encoded() + return ClosingIterator(iterable, self.close) + + def get_wsgi_response( + self, environ: WSGIEnvironment + ) -> tuple[t.Iterable[bytes], str, list[tuple[str, str]]]: + """Returns the final WSGI response as tuple. The first item in + the tuple is the application iterator, the second the status and + the third the list of headers. The response returned is created + specially for the given environment. For example if the request + method in the WSGI environment is ``'HEAD'`` the response will + be empty and only the headers and status code will be present. + + .. versionadded:: 0.6 + + :param environ: the WSGI environment of the request. + :return: an ``(app_iter, status, headers)`` tuple. + """ + headers = self.get_wsgi_headers(environ) + app_iter = self.get_app_iter(environ) + return app_iter, self.status, headers.to_wsgi_list() + + def __call__( + self, environ: WSGIEnvironment, start_response: StartResponse + ) -> t.Iterable[bytes]: + """Process this response as WSGI application. + + :param environ: the WSGI environment. + :param start_response: the response callable provided by the WSGI + server. + :return: an application iterator + """ + app_iter, status, headers = self.get_wsgi_response(environ) + start_response(status, headers) + return app_iter + + # JSON + + #: A module or other object that has ``dumps`` and ``loads`` + #: functions that match the API of the built-in :mod:`json` module. + json_module = json + + @property + def json(self) -> t.Any | None: + """The parsed JSON data if :attr:`mimetype` indicates JSON + (:mimetype:`application/json`, see :attr:`is_json`). + + Calls :meth:`get_json` with default arguments. + """ + return self.get_json() + + @t.overload + def get_json(self, force: bool = ..., silent: t.Literal[False] = ...) -> t.Any: ... + + @t.overload + def get_json(self, force: bool = ..., silent: bool = ...) -> t.Any | None: ... + + def get_json(self, force: bool = False, silent: bool = False) -> t.Any | None: + """Parse :attr:`data` as JSON. Useful during testing. + + If the mimetype does not indicate JSON + (:mimetype:`application/json`, see :attr:`is_json`), this + returns ``None``. + + Unlike :meth:`Request.get_json`, the result is not cached. + + :param force: Ignore the mimetype and always try to parse JSON. + :param silent: Silence parsing errors and return ``None`` + instead. + """ + if not (force or self.is_json): + return None + + data = self.get_data() + + try: + return self.json_module.loads(data) + except ValueError: + if not silent: + raise + + return None + + # Stream + + @cached_property + def stream(self) -> ResponseStream: + """The response iterable as write-only stream.""" + return ResponseStream(self) + + def _wrap_range_response(self, start: int, length: int) -> None: + """Wrap existing Response in case of Range Request context.""" + if self.status_code == 206: + self.response = _RangeWrapper(self.response, start, length) # type: ignore + + def _is_range_request_processable(self, environ: WSGIEnvironment) -> bool: + """Return ``True`` if `Range` header is present and if underlying + resource is considered unchanged when compared with `If-Range` header. + """ + return ( + "HTTP_IF_RANGE" not in environ + or not is_resource_modified( + environ, + self.headers.get("etag"), + None, + self.headers.get("last-modified"), + ignore_if_range=False, + ) + ) and "HTTP_RANGE" in environ + + def _process_range_request( + self, + environ: WSGIEnvironment, + complete_length: int | None, + accept_ranges: bool | str, + ) -> bool: + """Handle Range Request related headers (RFC7233). If `Accept-Ranges` + header is valid, and Range Request is processable, we set the headers + as described by the RFC, and wrap the underlying response in a + RangeWrapper. + + Returns ``True`` if Range Request can be fulfilled, ``False`` otherwise. + + :raises: :class:`~werkzeug.exceptions.RequestedRangeNotSatisfiable` + if `Range` header could not be parsed or satisfied. + + .. versionchanged:: 2.0 + Returns ``False`` if the length is 0. + """ + from ..exceptions import RequestedRangeNotSatisfiable + + if ( + not accept_ranges + or complete_length is None + or complete_length == 0 + or not self._is_range_request_processable(environ) + ): + return False + + if accept_ranges is True: + accept_ranges = "bytes" + + parsed_range = parse_range_header(environ.get("HTTP_RANGE")) + + if parsed_range is None: + raise RequestedRangeNotSatisfiable(complete_length) + + range_tuple = parsed_range.range_for_length(complete_length) + content_range_header = parsed_range.to_content_range_header(complete_length) + + if range_tuple is None or content_range_header is None: + raise RequestedRangeNotSatisfiable(complete_length) + + content_length = range_tuple[1] - range_tuple[0] + self.headers["Content-Length"] = str(content_length) + self.headers["Accept-Ranges"] = accept_ranges + self.content_range = content_range_header + self.status_code = 206 + self._wrap_range_response(range_tuple[0], content_length) + return True + + def make_conditional( + self, + request_or_environ: WSGIEnvironment | Request, + accept_ranges: bool | str = False, + complete_length: int | None = None, + ) -> Response: + """Make the response conditional to the request. This method works + best if an etag was defined for the response already. The `add_etag` + method can be used to do that. If called without etag just the date + header is set. + + This does nothing if the request method in the request or environ is + anything but GET or HEAD. + + For optimal performance when handling range requests, it's recommended + that your response data object implements `seekable`, `seek` and `tell` + methods as described by :py:class:`io.IOBase`. Objects returned by + :meth:`~werkzeug.wsgi.wrap_file` automatically implement those methods. + + It does not remove the body of the response because that's something + the :meth:`__call__` function does for us automatically. + + Returns self so that you can do ``return resp.make_conditional(req)`` + but modifies the object in-place. + + :param request_or_environ: a request object or WSGI environment to be + used to make the response conditional + against. + :param accept_ranges: This parameter dictates the value of + `Accept-Ranges` header. If ``False`` (default), + the header is not set. If ``True``, it will be set + to ``"bytes"``. If it's a string, it will use this + value. + :param complete_length: Will be used only in valid Range Requests. + It will set `Content-Range` complete length + value and compute `Content-Length` real value. + This parameter is mandatory for successful + Range Requests completion. + :raises: :class:`~werkzeug.exceptions.RequestedRangeNotSatisfiable` + if `Range` header could not be parsed or satisfied. + + .. versionchanged:: 2.0 + Range processing is skipped if length is 0 instead of + raising a 416 Range Not Satisfiable error. + """ + environ = _get_environ(request_or_environ) + if environ["REQUEST_METHOD"] in ("GET", "HEAD"): + # if the date is not in the headers, add it now. We however + # will not override an already existing header. Unfortunately + # this header will be overridden by many WSGI servers including + # wsgiref. + if "date" not in self.headers: + self.headers["Date"] = http_date() + is206 = self._process_range_request(environ, complete_length, accept_ranges) + if not is206 and not is_resource_modified( + environ, + self.headers.get("etag"), + None, + self.headers.get("last-modified"), + ): + if parse_etags(environ.get("HTTP_IF_MATCH")): + self.status_code = 412 + else: + self.status_code = 304 + if ( + self.automatically_set_content_length + and "content-length" not in self.headers + ): + length = self.calculate_content_length() + if length is not None: + self.headers["Content-Length"] = str(length) + return self + + def add_etag(self, overwrite: bool = False, weak: bool = False) -> None: + """Add an etag for the current response if there is none yet. + + .. versionchanged:: 2.0 + SHA-1 is used to generate the value. MD5 may not be + available in some environments. + """ + if overwrite or "etag" not in self.headers: + self.set_etag(generate_etag(self.get_data()), weak) + + +class ResponseStream: + """A file descriptor like object used by :meth:`Response.stream` to + represent the body of the stream. It directly pushes into the + response iterable of the response object. + """ + + mode = "wb+" + + def __init__(self, response: Response): + self.response = response + self.closed = False + + def write(self, value: bytes) -> int: + if self.closed: + raise ValueError("I/O operation on closed file") + self.response._ensure_sequence(mutable=True) + self.response.response.append(value) # type: ignore + self.response.headers.pop("Content-Length", None) + return len(value) + + def writelines(self, seq: t.Iterable[bytes]) -> None: + for item in seq: + self.write(item) + + def close(self) -> None: + self.closed = True + + def flush(self) -> None: + if self.closed: + raise ValueError("I/O operation on closed file") + + def isatty(self) -> bool: + if self.closed: + raise ValueError("I/O operation on closed file") + return False + + def tell(self) -> int: + self.response._ensure_sequence() + return sum(map(len, self.response.response)) + + @property + def encoding(self) -> str: + return "utf-8" diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/werkzeug/wsgi.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/werkzeug/wsgi.py new file mode 100644 index 0000000000000000000000000000000000000000..2d071c789e83e6d5999ae10074f7a2c5d827cbc6 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/werkzeug/wsgi.py @@ -0,0 +1,595 @@ +from __future__ import annotations + +import io +import typing as t +from functools import partial +from functools import update_wrapper + +from .exceptions import ClientDisconnected +from .exceptions import RequestEntityTooLarge +from .sansio import utils as _sansio_utils +from .sansio.utils import host_is_trusted # noqa: F401 # Imported as part of API + +if t.TYPE_CHECKING: + from _typeshed.wsgi import WSGIApplication + from _typeshed.wsgi import WSGIEnvironment + + +def responder(f: t.Callable[..., WSGIApplication]) -> WSGIApplication: + """Marks a function as responder. Decorate a function with it and it + will automatically call the return value as WSGI application. + + Example:: + + @responder + def application(environ, start_response): + return Response('Hello World!') + """ + return update_wrapper(lambda *a: f(*a)(*a[-2:]), f) + + +def get_current_url( + environ: WSGIEnvironment, + root_only: bool = False, + strip_querystring: bool = False, + host_only: bool = False, + trusted_hosts: t.Iterable[str] | None = None, +) -> str: + """Recreate the URL for a request from the parts in a WSGI + environment. + + The URL is an IRI, not a URI, so it may contain Unicode characters. + Use :func:`~werkzeug.urls.iri_to_uri` to convert it to ASCII. + + :param environ: The WSGI environment to get the URL parts from. + :param root_only: Only build the root path, don't include the + remaining path or query string. + :param strip_querystring: Don't include the query string. + :param host_only: Only build the scheme and host. + :param trusted_hosts: A list of trusted host names to validate the + host against. + """ + parts = { + "scheme": environ["wsgi.url_scheme"], + "host": get_host(environ, trusted_hosts), + } + + if not host_only: + parts["root_path"] = environ.get("SCRIPT_NAME", "") + + if not root_only: + parts["path"] = environ.get("PATH_INFO", "") + + if not strip_querystring: + parts["query_string"] = environ.get("QUERY_STRING", "").encode("latin1") + + return _sansio_utils.get_current_url(**parts) + + +def _get_server( + environ: WSGIEnvironment, +) -> tuple[str, int | None] | None: + name = environ.get("SERVER_NAME") + + if name is None: + return None + + try: + port: int | None = int(environ.get("SERVER_PORT", None)) # type: ignore[arg-type] + except (TypeError, ValueError): + # unix socket + port = None + + return name, port + + +def get_host( + environ: WSGIEnvironment, trusted_hosts: t.Iterable[str] | None = None +) -> str: + """Return the host for the given WSGI environment. + + The ``Host`` header is preferred, then ``SERVER_NAME`` if it's not + set. The returned host will only contain the port if it is different + than the standard port for the protocol. + + Optionally, verify that the host is trusted using + :func:`host_is_trusted` and raise a + :exc:`~werkzeug.exceptions.SecurityError` if it is not. + + :param environ: A WSGI environment dict. + :param trusted_hosts: A list of trusted host names. + + :return: Host, with port if necessary. + :raise ~werkzeug.exceptions.SecurityError: If the host is not + trusted. + """ + return _sansio_utils.get_host( + environ["wsgi.url_scheme"], + environ.get("HTTP_HOST"), + _get_server(environ), + trusted_hosts, + ) + + +def get_content_length(environ: WSGIEnvironment) -> int | None: + """Return the ``Content-Length`` header value as an int. If the header is not given + or the ``Transfer-Encoding`` header is ``chunked``, ``None`` is returned to indicate + a streaming request. If the value is not an integer, or negative, 0 is returned. + + :param environ: The WSGI environ to get the content length from. + + .. versionadded:: 0.9 + """ + return _sansio_utils.get_content_length( + http_content_length=environ.get("CONTENT_LENGTH"), + http_transfer_encoding=environ.get("HTTP_TRANSFER_ENCODING"), + ) + + +def get_input_stream( + environ: WSGIEnvironment, + safe_fallback: bool = True, + max_content_length: int | None = None, +) -> t.IO[bytes]: + """Return the WSGI input stream, wrapped so that it may be read safely without going + past the ``Content-Length`` header value or ``max_content_length``. + + If ``Content-Length`` exceeds ``max_content_length``, a + :exc:`RequestEntityTooLarge`` ``413 Content Too Large`` error is raised. + + If the WSGI server sets ``environ["wsgi.input_terminated"]``, it indicates that the + server handles terminating the stream, so it is safe to read directly. For example, + a server that knows how to handle chunked requests safely would set this. + + If ``max_content_length`` is set, it can be enforced on streams if + ``wsgi.input_terminated`` is set. Otherwise, an empty stream is returned unless the + user explicitly disables this safe fallback. + + If the limit is reached before the underlying stream is exhausted (such as a file + that is too large, or an infinite stream), the remaining contents of the stream + cannot be read safely. Depending on how the server handles this, clients may show a + "connection reset" failure instead of seeing the 413 response. + + :param environ: The WSGI environ containing the stream. + :param safe_fallback: Return an empty stream when ``Content-Length`` is not set. + Disabling this allows infinite streams, which can be a denial-of-service risk. + :param max_content_length: The maximum length that content-length or streaming + requests may not exceed. + + .. versionchanged:: 2.3.2 + ``max_content_length`` is only applied to streaming requests if the server sets + ``wsgi.input_terminated``. + + .. versionchanged:: 2.3 + Check ``max_content_length`` and raise an error if it is exceeded. + + .. versionadded:: 0.9 + """ + stream = t.cast(t.IO[bytes], environ["wsgi.input"]) + content_length = get_content_length(environ) + + if content_length is not None and max_content_length is not None: + if content_length > max_content_length: + raise RequestEntityTooLarge() + + # A WSGI server can set this to indicate that it terminates the input stream. In + # that case the stream is safe without wrapping, or can enforce a max length. + if "wsgi.input_terminated" in environ: + if max_content_length is not None: + # If this is moved above, it can cause the stream to hang if a read attempt + # is made when the client sends no data. For example, the development server + # does not handle buffering except for chunked encoding. + return t.cast( + t.IO[bytes], LimitedStream(stream, max_content_length, is_max=True) + ) + + return stream + + # No limit given, return an empty stream unless the user explicitly allows the + # potentially infinite stream. An infinite stream is dangerous if it's not expected, + # as it can tie up a worker indefinitely. + if content_length is None: + return io.BytesIO() if safe_fallback else stream + + return t.cast(t.IO[bytes], LimitedStream(stream, content_length)) + + +def get_path_info(environ: WSGIEnvironment) -> str: + """Return ``PATH_INFO`` from the WSGI environment. + + :param environ: WSGI environment to get the path from. + + .. versionchanged:: 3.0 + The ``charset`` and ``errors`` parameters were removed. + + .. versionadded:: 0.9 + """ + path: bytes = environ.get("PATH_INFO", "").encode("latin1") + return path.decode(errors="replace") + + +class ClosingIterator: + """The WSGI specification requires that all middlewares and gateways + respect the `close` callback of the iterable returned by the application. + Because it is useful to add another close action to a returned iterable + and adding a custom iterable is a boring task this class can be used for + that:: + + return ClosingIterator(app(environ, start_response), [cleanup_session, + cleanup_locals]) + + If there is just one close function it can be passed instead of the list. + + A closing iterator is not needed if the application uses response objects + and finishes the processing if the response is started:: + + try: + return response(environ, start_response) + finally: + cleanup_session() + cleanup_locals() + """ + + def __init__( + self, + iterable: t.Iterable[bytes], + callbacks: None + | (t.Callable[[], None] | t.Iterable[t.Callable[[], None]]) = None, + ) -> None: + iterator = iter(iterable) + self._next = t.cast(t.Callable[[], bytes], partial(next, iterator)) + if callbacks is None: + callbacks = [] + elif callable(callbacks): + callbacks = [callbacks] + else: + callbacks = list(callbacks) + iterable_close = getattr(iterable, "close", None) + if iterable_close: + callbacks.insert(0, iterable_close) + self._callbacks = callbacks + + def __iter__(self) -> ClosingIterator: + return self + + def __next__(self) -> bytes: + return self._next() + + def close(self) -> None: + for callback in self._callbacks: + callback() + + +def wrap_file( + environ: WSGIEnvironment, file: t.IO[bytes], buffer_size: int = 8192 +) -> t.Iterable[bytes]: + """Wraps a file. This uses the WSGI server's file wrapper if available + or otherwise the generic :class:`FileWrapper`. + + .. versionadded:: 0.5 + + If the file wrapper from the WSGI server is used it's important to not + iterate over it from inside the application but to pass it through + unchanged. If you want to pass out a file wrapper inside a response + object you have to set :attr:`Response.direct_passthrough` to `True`. + + More information about file wrappers are available in :pep:`333`. + + :param file: a :class:`file`-like object with a :meth:`~file.read` method. + :param buffer_size: number of bytes for one iteration. + """ + return environ.get("wsgi.file_wrapper", FileWrapper)( # type: ignore + file, buffer_size + ) + + +class FileWrapper: + """This class can be used to convert a :class:`file`-like object into + an iterable. It yields `buffer_size` blocks until the file is fully + read. + + You should not use this class directly but rather use the + :func:`wrap_file` function that uses the WSGI server's file wrapper + support if it's available. + + .. versionadded:: 0.5 + + If you're using this object together with a :class:`Response` you have + to use the `direct_passthrough` mode. + + :param file: a :class:`file`-like object with a :meth:`~file.read` method. + :param buffer_size: number of bytes for one iteration. + """ + + def __init__(self, file: t.IO[bytes], buffer_size: int = 8192) -> None: + self.file = file + self.buffer_size = buffer_size + + def close(self) -> None: + if hasattr(self.file, "close"): + self.file.close() + + def seekable(self) -> bool: + if hasattr(self.file, "seekable"): + return self.file.seekable() + if hasattr(self.file, "seek"): + return True + return False + + def seek(self, *args: t.Any) -> None: + if hasattr(self.file, "seek"): + self.file.seek(*args) + + def tell(self) -> int | None: + if hasattr(self.file, "tell"): + return self.file.tell() + return None + + def __iter__(self) -> FileWrapper: + return self + + def __next__(self) -> bytes: + data = self.file.read(self.buffer_size) + if data: + return data + raise StopIteration() + + +class _RangeWrapper: + # private for now, but should we make it public in the future ? + + """This class can be used to convert an iterable object into + an iterable that will only yield a piece of the underlying content. + It yields blocks until the underlying stream range is fully read. + The yielded blocks will have a size that can't exceed the original + iterator defined block size, but that can be smaller. + + If you're using this object together with a :class:`Response` you have + to use the `direct_passthrough` mode. + + :param iterable: an iterable object with a :meth:`__next__` method. + :param start_byte: byte from which read will start. + :param byte_range: how many bytes to read. + """ + + def __init__( + self, + iterable: t.Iterable[bytes] | t.IO[bytes], + start_byte: int = 0, + byte_range: int | None = None, + ): + self.iterable = iter(iterable) + self.byte_range = byte_range + self.start_byte = start_byte + self.end_byte = None + + if byte_range is not None: + self.end_byte = start_byte + byte_range + + self.read_length = 0 + self.seekable = hasattr(iterable, "seekable") and iterable.seekable() + self.end_reached = False + + def __iter__(self) -> _RangeWrapper: + return self + + def _next_chunk(self) -> bytes: + try: + chunk = next(self.iterable) + self.read_length += len(chunk) + return chunk + except StopIteration: + self.end_reached = True + raise + + def _first_iteration(self) -> tuple[bytes | None, int]: + chunk = None + if self.seekable: + self.iterable.seek(self.start_byte) # type: ignore + self.read_length = self.iterable.tell() # type: ignore + contextual_read_length = self.read_length + else: + while self.read_length <= self.start_byte: + chunk = self._next_chunk() + if chunk is not None: + chunk = chunk[self.start_byte - self.read_length :] + contextual_read_length = self.start_byte + return chunk, contextual_read_length + + def _next(self) -> bytes: + if self.end_reached: + raise StopIteration() + chunk = None + contextual_read_length = self.read_length + if self.read_length == 0: + chunk, contextual_read_length = self._first_iteration() + if chunk is None: + chunk = self._next_chunk() + if self.end_byte is not None and self.read_length >= self.end_byte: + self.end_reached = True + return chunk[: self.end_byte - contextual_read_length] + return chunk + + def __next__(self) -> bytes: + chunk = self._next() + if chunk: + return chunk + self.end_reached = True + raise StopIteration() + + def close(self) -> None: + if hasattr(self.iterable, "close"): + self.iterable.close() + + +class LimitedStream(io.RawIOBase): + """Wrap a stream so that it doesn't read more than a given limit. This is used to + limit ``wsgi.input`` to the ``Content-Length`` header value or + :attr:`.Request.max_content_length`. + + When attempting to read after the limit has been reached, :meth:`on_exhausted` is + called. When the limit is a maximum, this raises :exc:`.RequestEntityTooLarge`. + + If reading from the stream returns zero bytes or raises an error, + :meth:`on_disconnect` is called, which raises :exc:`.ClientDisconnected`. When the + limit is a maximum and zero bytes were read, no error is raised, since it may be the + end of the stream. + + If the limit is reached before the underlying stream is exhausted (such as a file + that is too large, or an infinite stream), the remaining contents of the stream + cannot be read safely. Depending on how the server handles this, clients may show a + "connection reset" failure instead of seeing the 413 response. + + :param stream: The stream to read from. Must be a readable binary IO object. + :param limit: The limit in bytes to not read past. Should be either the + ``Content-Length`` header value or ``request.max_content_length``. + :param is_max: Whether the given ``limit`` is ``request.max_content_length`` instead + of the ``Content-Length`` header value. This changes how exhausted and + disconnect events are handled. + + .. versionchanged:: 2.3 + Handle ``max_content_length`` differently than ``Content-Length``. + + .. versionchanged:: 2.3 + Implements ``io.RawIOBase`` rather than ``io.IOBase``. + """ + + def __init__(self, stream: t.IO[bytes], limit: int, is_max: bool = False) -> None: + self._stream = stream + self._pos = 0 + self.limit = limit + self._limit_is_max = is_max + + @property + def is_exhausted(self) -> bool: + """Whether the current stream position has reached the limit.""" + return self._pos >= self.limit + + def on_exhausted(self) -> None: + """Called when attempting to read after the limit has been reached. + + The default behavior is to do nothing, unless the limit is a maximum, in which + case it raises :exc:`.RequestEntityTooLarge`. + + .. versionchanged:: 2.3 + Raises ``RequestEntityTooLarge`` if the limit is a maximum. + + .. versionchanged:: 2.3 + Any return value is ignored. + """ + if self._limit_is_max: + raise RequestEntityTooLarge() + + def on_disconnect(self, error: Exception | None = None) -> None: + """Called when an attempted read receives zero bytes before the limit was + reached. This indicates that the client disconnected before sending the full + request body. + + The default behavior is to raise :exc:`.ClientDisconnected`, unless the limit is + a maximum and no error was raised. + + .. versionchanged:: 2.3 + Added the ``error`` parameter. Do nothing if the limit is a maximum and no + error was raised. + + .. versionchanged:: 2.3 + Any return value is ignored. + """ + if not self._limit_is_max or error is not None: + raise ClientDisconnected() + + # If the limit is a maximum, then we may have read zero bytes because the + # streaming body is complete. There's no way to distinguish that from the + # client disconnecting early. + + def exhaust(self) -> bytes: + """Exhaust the stream by reading until the limit is reached or the client + disconnects, returning the remaining data. + + .. versionchanged:: 2.3 + Return the remaining data. + + .. versionchanged:: 2.2.3 + Handle case where wrapped stream returns fewer bytes than requested. + """ + if not self.is_exhausted: + return self.readall() + + return b"" + + def readinto(self, b: bytearray) -> int | None: # type: ignore[override] + size = len(b) + remaining = self.limit - self._pos + + if remaining <= 0: + self.on_exhausted() + return 0 + + if hasattr(self._stream, "readinto"): + # Use stream.readinto if it's available. + if size <= remaining: + # The size fits in the remaining limit, use the buffer directly. + try: + out_size: int | None = self._stream.readinto(b) + except (OSError, ValueError) as e: + self.on_disconnect(error=e) + return 0 + else: + # Use a temp buffer with the remaining limit as the size. + temp_b = bytearray(remaining) + + try: + out_size = self._stream.readinto(temp_b) + except (OSError, ValueError) as e: + self.on_disconnect(error=e) + return 0 + + if out_size: + b[:out_size] = temp_b + else: + # WSGI requires that stream.read is available. + try: + data = self._stream.read(min(size, remaining)) + except (OSError, ValueError) as e: + self.on_disconnect(error=e) + return 0 + + out_size = len(data) + b[:out_size] = data + + if not out_size: + # Read zero bytes from the stream. + self.on_disconnect() + return 0 + + self._pos += out_size + return out_size + + def readall(self) -> bytes: + if self.is_exhausted: + self.on_exhausted() + return b"" + + out = bytearray() + + # The parent implementation uses "while True", which results in an extra read. + while not self.is_exhausted: + data = self.read(1024 * 64) + + # Stream may return empty before a max limit is reached. + if not data: + break + + out.extend(data) + + return bytes(out) + + def tell(self) -> int: + """Return the current stream position. + + .. versionadded:: 0.9 + """ + return self._pos + + def readable(self) -> bool: + return True diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wheel-0.46.3.dist-info/METADATA b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wheel-0.46.3.dist-info/METADATA new file mode 100644 index 0000000000000000000000000000000000000000..77936a9eb631d1aad5a9a9d12ce825c97392943e --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wheel-0.46.3.dist-info/METADATA @@ -0,0 +1,69 @@ +Metadata-Version: 2.4 +Name: wheel +Version: 0.46.3 +Summary: Command line tool for manipulating wheel files +Keywords: wheel,packaging +Author-email: Daniel Holth +Maintainer-email: Alex Grönholm +Requires-Python: >=3.9 +Description-Content-Type: text/x-rst +License-Expression: MIT +Classifier: Development Status :: 5 - Production/Stable +Classifier: Intended Audience :: Developers +Classifier: Topic :: System :: Archiving :: Packaging +Classifier: Programming Language :: Python +Classifier: Programming Language :: Python :: 3 :: Only +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 :: Python :: 3.13 +Classifier: Programming Language :: Python :: 3.14 +License-File: LICENSE.txt +Requires-Dist: packaging >= 24.0 +Requires-Dist: pytest >= 6.0.0 ; extra == "test" +Requires-Dist: setuptools >= 77 ; extra == "test" +Project-URL: Changelog, https://wheel.readthedocs.io/en/stable/news.html +Project-URL: Documentation, https://wheel.readthedocs.io/ +Project-URL: Issue Tracker, https://github.com/pypa/wheel/issues +Project-URL: Source, https://github.com/pypa/wheel +Provides-Extra: test + +wheel +===== + +This is a command line tool for manipulating Python wheel files, as defined in +`PEP 427`_. It contains the following functionality: + +* Convert ``.egg`` archives into ``.whl`` +* Unpack wheel archives +* Repack wheel archives +* Add or remove tags in existing wheel archives + +.. _PEP 427: https://www.python.org/dev/peps/pep-0427/ + +Historical note +--------------- + +This project used to contain the implementation of the setuptools_ ``bdist_wheel`` +command, but as of setuptools v70.1, it no longer needs ``wheel`` installed for that to +work. Thus, you should install this **only** if you intend to use the ``wheel`` command +line tool! + +.. _setuptools: https://pypi.org/project/setuptools/ + +Documentation +------------- + +The documentation_ can be found on Read The Docs. + +.. _documentation: https://wheel.readthedocs.io/ + +Code of Conduct +--------------- + +Everyone interacting in the wheel project's codebases, issue trackers, chat +rooms, and mailing lists is expected to follow the `PSF Code of Conduct`_. + +.. _PSF Code of Conduct: https://github.com/pypa/.github/blob/main/CODE_OF_CONDUCT.md + diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wheel-0.46.3.dist-info/RECORD b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wheel-0.46.3.dist-info/RECORD new file mode 100644 index 0000000000000000000000000000000000000000..07bb21070310d3bbc5f529e531eed08ac465eaae --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wheel-0.46.3.dist-info/RECORD @@ -0,0 +1,20 @@ +../../../bin/wheel,sha256=e7DoNAd48iKU4WQhIZMFczw-l_hkGba4WxIdW_c_lo8,497 +wheel/__init__.py,sha256=UweKvhe4SyP7zFyDoYo8BOuwTA6q3-_WpMmY2NNO54c,59 +wheel/__main__.py,sha256=_83wl9tyGU2cHiqfudpubGHdRL5uonPXnzeznznkxzs,512 +wheel/_bdist_wheel.py,sha256=bpmNa7_s-CYFkVgXf9ENAYTiJ01XBhRW4pxH1T8XYsI,21729 +wheel/_metadata.py,sha256=BP5jC9uC1hyicp7nL4FJ2LYixNFpEJIV_uMDY1KBZBg,6188 +wheel/_setuptools_logging.py,sha256=-5KC-lne0ilOUWIDfOkqapUWGMFZhuKYDIavIZiB5kM,781 +wheel/bdist_wheel.py,sha256=HrzYiSzMkh5ohAAhlQnYBS1p8qbr85X6F59xqxd9kBg,1102 +wheel/macosx_libfile.py,sha256=pL0wm88jRMl_4ASgGlNg_mz69Zmv5xm8JSkjLdwyvIQ,16712 +wheel/metadata.py,sha256=GknOO7JJiZMlcEe_fiD7nqnDTTLd0sX_-IgipM4L3-4,757 +wheel/wheelfile.py,sha256=m_g_7TNsEp-j-xnvSr5yDLEFb1nhyObueq9Q5_1_lBA,8720 +wheel/_commands/__init__.py,sha256=fCRAQZNDyj2JLrufdgPsBlaRS_t_j_aBUMpXj09KZ4E,4432 +wheel/_commands/convert.py,sha256=0wSJMU0m-6LY16Om8Wmmloy-hJWFZeOmI8hT-2Z7Qms,12743 +wheel/_commands/pack.py,sha256=o3iwjfRHl7N9ul-M2kHbewLJZnqBLAWf0tzUCwoiTMw,3078 +wheel/_commands/tags.py,sha256=Rv2ySVb8-qX3osKp3uJgxcIMXkjt43XUD0-zvC6KvnY,4775 +wheel/_commands/unpack.py,sha256=AjDSS23XYyCSFfifnMutinrpPv-DK_2wbNHkKAUFwgM,1016 +wheel-0.46.3.dist-info/entry_points.txt,sha256=JJdtSAGTvMLbIkTVZUAMvGKO39FtWfCVF8mp_NH6e4g,110 +wheel-0.46.3.dist-info/licenses/LICENSE.txt,sha256=MMI2GGeRCPPo6h0qZYx8pBe9_IkcmO8aifpP8MmChlQ,1107 +wheel-0.46.3.dist-info/WHEEL,sha256=G2gURzTEtmeR8nrdXUJfNiB3VYVxigPQ-bEQujpNiNs,82 +wheel-0.46.3.dist-info/METADATA,sha256=IpEKqXyonLzCCgGeJ_4xNgt5KaS9ZsoNMQ-ZpE9szTU,2410 +wheel-0.46.3.dist-info/RECORD,, diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wheel-0.46.3.dist-info/WHEEL b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wheel-0.46.3.dist-info/WHEEL new file mode 100644 index 0000000000000000000000000000000000000000..d8b9936dad9ab2513fa6979f411560d3b6b57e37 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wheel-0.46.3.dist-info/WHEEL @@ -0,0 +1,4 @@ +Wheel-Version: 1.0 +Generator: flit 3.12.0 +Root-Is-Purelib: true +Tag: py3-none-any diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wheel-0.46.3.dist-info/entry_points.txt b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wheel-0.46.3.dist-info/entry_points.txt new file mode 100644 index 0000000000000000000000000000000000000000..dcebd58811da1ee2758dd0f45c575704afdd61bd --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wheel-0.46.3.dist-info/entry_points.txt @@ -0,0 +1,6 @@ +[console_scripts] +wheel=wheel._commands:main + +[distutils.commands] +bdist_wheel=wheel.bdist_wheel:bdist_wheel + diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wheel-0.46.3.dist-info/licenses/LICENSE.txt b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wheel-0.46.3.dist-info/licenses/LICENSE.txt new file mode 100644 index 0000000000000000000000000000000000000000..a31470f14c5978d5fcc3bc173b8399b6c9a6443f --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wheel-0.46.3.dist-info/licenses/LICENSE.txt @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2012 Daniel Holth and contributors + +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/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wheel/__init__.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wheel/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..b5b076f05a69ac941356361db47159d6cc06c296 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wheel/__init__.py @@ -0,0 +1,3 @@ +from __future__ import annotations + +__version__ = "0.46.3" diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wheel/__main__.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wheel/__main__.py new file mode 100644 index 0000000000000000000000000000000000000000..3c7de5fb7fd2fcc1bbb60b5c3977e82c3aa2f898 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wheel/__main__.py @@ -0,0 +1,25 @@ +""" +Wheel command line tool (enables the ``python -m wheel`` syntax) +""" + +from __future__ import annotations + +import sys +from typing import NoReturn + + +def main() -> NoReturn: # needed for console script + if __package__ == "": + # To be able to run 'python wheel-0.9.whl/wheel': + import os.path + + path = os.path.dirname(os.path.dirname(__file__)) + sys.path[0:0] = [path] + + from ._commands import main as cli_main + + sys.exit(cli_main()) + + +if __name__ == "__main__": + main() diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wheel/_bdist_wheel.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wheel/_bdist_wheel.py new file mode 100644 index 0000000000000000000000000000000000000000..575fbfb35105eb82faee5a368781ecf818379354 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wheel/_bdist_wheel.py @@ -0,0 +1,616 @@ +""" +Create a wheel (.whl) distribution. + +A wheel is a built archive format. +""" + +from __future__ import annotations + +import logging +import os +import re +import shutil +import stat +import struct +import sys +import sysconfig +import warnings +from collections.abc import Iterable, Sequence +from email.generator import BytesGenerator, Generator +from email.policy import EmailPolicy +from glob import iglob +from shutil import rmtree +from typing import TYPE_CHECKING, Callable, Literal, cast +from zipfile import ZIP_DEFLATED, ZIP_STORED + +import setuptools +from packaging import tags +from packaging import version as _packaging_version +from setuptools import Command + +from . import __version__ as wheel_version +from ._metadata import pkginfo_to_metadata +from .wheelfile import WheelFile + +if TYPE_CHECKING: + import types + +# ensure Python logging is configured +try: + __import__("setuptools.logging") +except ImportError: + # setuptools < ?? + from . import _setuptools_logging + + _setuptools_logging.configure() + +log = logging.getLogger("wheel") + + +def safe_name(name: str) -> str: + """Convert an arbitrary string to a standard distribution name + Any runs of non-alphanumeric/. characters are replaced with a single '-'. + """ + return re.sub("[^A-Za-z0-9.]+", "-", name) + + +def safe_version(version: str) -> str: + """ + Convert an arbitrary string to a standard version string + """ + try: + # normalize the version + return str(_packaging_version.Version(version)) + except _packaging_version.InvalidVersion: + version = version.replace(" ", ".") + return re.sub("[^A-Za-z0-9.]+", "-", version) + + +setuptools_major_version = int(setuptools.__version__.split(".")[0]) + +PY_LIMITED_API_PATTERN = r"cp3\d" + + +def _is_32bit_interpreter() -> bool: + return struct.calcsize("P") == 4 + + +def python_tag() -> str: + return f"py{sys.version_info[0]}" + + +def get_platform(archive_root: str | None) -> str: + """Return our platform name 'win32', 'linux_x86_64'""" + result = sysconfig.get_platform() + if result.startswith("macosx") and archive_root is not None: + from .macosx_libfile import calculate_macosx_platform_tag + + result = calculate_macosx_platform_tag(archive_root, result) + elif _is_32bit_interpreter(): + if result == "linux-x86_64": + # pip pull request #3497 + result = "linux-i686" + elif result == "linux-aarch64": + # packaging pull request #234 + # TODO armv8l, packaging pull request #690 => this did not land + # in pip/packaging yet + result = "linux-armv7l" + + return result.replace("-", "_") + + +def get_flag( + var: str, fallback: bool, expected: bool = True, warn: bool = True +) -> bool: + """Use a fallback value for determining SOABI flags if the needed config + var is unset or unavailable.""" + val = sysconfig.get_config_var(var) + if val is None: + if warn: + warnings.warn( + f"Config variable '{var}' is unset, Python ABI tag may be incorrect", + RuntimeWarning, + stacklevel=2, + ) + return fallback + return val == expected + + +def get_abi_tag() -> str | None: + """Return the ABI tag based on SOABI (if available) or emulate SOABI (PyPy2).""" + soabi: str = sysconfig.get_config_var("SOABI") + impl = tags.interpreter_name() + if not soabi and impl in ("cp", "pp") and hasattr(sys, "maxunicode"): + d = "" + m = "" + u = "" + if get_flag("Py_DEBUG", hasattr(sys, "gettotalrefcount"), warn=(impl == "cp")): + d = "d" + + if get_flag( + "WITH_PYMALLOC", + impl == "cp", + warn=(impl == "cp" and sys.version_info < (3, 8)), + ) and sys.version_info < (3, 8): + m = "m" + + abi = f"{impl}{tags.interpreter_version()}{d}{m}{u}" + elif soabi and impl == "cp" and soabi.startswith("cpython"): + # non-Windows + abi = "cp" + soabi.split("-")[1] + elif soabi and impl == "cp" and soabi.startswith("cp"): + # Windows + abi = soabi.split("-")[0] + elif soabi and impl == "pp": + # we want something like pypy36-pp73 + abi = "-".join(soabi.split("-")[:2]) + abi = abi.replace(".", "_").replace("-", "_") + elif soabi and impl == "graalpy": + abi = "-".join(soabi.split("-")[:3]) + abi = abi.replace(".", "_").replace("-", "_") + elif soabi: + abi = soabi.replace(".", "_").replace("-", "_") + else: + abi = None + + return abi + + +def safer_name(name: str) -> str: + return safe_name(name).replace("-", "_") + + +def safer_version(version: str) -> str: + return safe_version(version).replace("-", "_") + + +def remove_readonly( + func: Callable[..., object], + path: str, + excinfo: tuple[type[Exception], Exception, types.TracebackType], +) -> None: + remove_readonly_exc(func, path, excinfo[1]) + + +def remove_readonly_exc(func: Callable[..., object], path: str, exc: Exception) -> None: + os.chmod(path, stat.S_IWRITE) + func(path) + + +class bdist_wheel(Command): + description = "create a wheel distribution" + + supported_compressions = { + "stored": ZIP_STORED, + "deflated": ZIP_DEFLATED, + } + + user_options = [ + ("bdist-dir=", "b", "temporary directory for creating the distribution"), + ( + "plat-name=", + "p", + "platform name to embed in generated filenames " + f"(default: {get_platform(None)})", + ), + ( + "keep-temp", + "k", + "keep the pseudo-installation tree around after " + "creating the distribution archive", + ), + ("dist-dir=", "d", "directory to put final built distributions in"), + ("skip-build", None, "skip rebuilding everything (for testing/debugging)"), + ( + "relative", + None, + "build the archive using relative paths (default: false)", + ), + ( + "owner=", + "u", + "Owner name used when creating a tar file [default: current user]", + ), + ( + "group=", + "g", + "Group name used when creating a tar file [default: current group]", + ), + ("universal", None, "make a universal wheel (default: false)"), + ( + "compression=", + None, + "zipfile compression (one of: {}) (default: 'deflated')".format( + ", ".join(supported_compressions) + ), + ), + ( + "python-tag=", + None, + f"Python implementation compatibility tag (default: '{python_tag()}')", + ), + ( + "build-number=", + None, + "Build number for this particular version. " + "As specified in PEP-0427, this must start with a digit. " + "[default: None]", + ), + ( + "py-limited-api=", + None, + "Python tag (cp32|cp33|cpNN) for abi3 wheel tag (default: false)", + ), + ] + + boolean_options = ["keep-temp", "skip-build", "relative", "universal"] + + def initialize_options(self): + self.bdist_dir: str = None + self.data_dir = None + self.plat_name: str | None = None + self.plat_tag = None + self.format = "zip" + self.keep_temp = False + self.dist_dir: str | None = None + self.egginfo_dir = None + self.root_is_pure: bool | None = None + self.skip_build = None + self.relative = False + self.owner = None + self.group = None + self.universal: bool = False + self.compression: str | int = "deflated" + self.python_tag: str = python_tag() + self.build_number: str | None = None + self.py_limited_api: str | Literal[False] = False + self.plat_name_supplied = False + + def finalize_options(self): + if self.bdist_dir is None: + bdist_base = self.get_finalized_command("bdist").bdist_base + self.bdist_dir = os.path.join(bdist_base, "wheel") + + egg_info = self.distribution.get_command_obj("egg_info") + egg_info.ensure_finalized() # needed for correct `wheel_dist_name` + + self.data_dir = self.wheel_dist_name + ".data" + self.plat_name_supplied = self.plat_name is not None + + try: + self.compression = self.supported_compressions[self.compression] + except KeyError: + raise ValueError(f"Unsupported compression: {self.compression}") from None + + need_options = ("dist_dir", "plat_name", "skip_build") + + self.set_undefined_options("bdist", *zip(need_options, need_options)) + + self.root_is_pure = not ( + self.distribution.has_ext_modules() or self.distribution.has_c_libraries() + ) + + if self.py_limited_api and not re.match( + PY_LIMITED_API_PATTERN, self.py_limited_api + ): + raise ValueError(f"py-limited-api must match '{PY_LIMITED_API_PATTERN}'") + + # Support legacy [wheel] section for setting universal + wheel = self.distribution.get_option_dict("wheel") + if "universal" in wheel: + # please don't define this in your global configs + log.warning( + "The [wheel] section is deprecated. Use [bdist_wheel] instead.", + ) + val = wheel["universal"][1].strip() + if val.lower() in ("1", "true", "yes"): + self.universal = True + + if self.build_number is not None and not self.build_number[:1].isdigit(): + raise ValueError("Build tag (build-number) must start with a digit.") + + @property + def wheel_dist_name(self): + """Return distribution full name with - replaced with _""" + components = ( + safer_name(self.distribution.get_name()), + safer_version(self.distribution.get_version()), + ) + if self.build_number: + components += (self.build_number,) + return "-".join(components) + + def get_tag(self) -> tuple[str, str, str]: + # bdist sets self.plat_name if unset, we should only use it for purepy + # wheels if the user supplied it. + if self.plat_name_supplied: + plat_name = cast(str, self.plat_name) + elif self.root_is_pure: + plat_name = "any" + else: + # macosx contains system version in platform name so need special handle + if self.plat_name and not self.plat_name.startswith("macosx"): + plat_name = self.plat_name + else: + # on macosx always limit the platform name to comply with any + # c-extension modules in bdist_dir, since the user can specify + # a higher MACOSX_DEPLOYMENT_TARGET via tools like CMake + + # on other platforms, and on macosx if there are no c-extension + # modules, use the default platform name. + plat_name = get_platform(self.bdist_dir) + + if _is_32bit_interpreter(): + if plat_name in ("linux-x86_64", "linux_x86_64"): + plat_name = "linux_i686" + if plat_name in ("linux-aarch64", "linux_aarch64"): + # TODO armv8l, packaging pull request #690 => this did not land + # in pip/packaging yet + plat_name = "linux_armv7l" + + plat_name = ( + plat_name.lower().replace("-", "_").replace(".", "_").replace(" ", "_") + ) + + if self.root_is_pure: + if self.universal: + impl = "py2.py3" + else: + impl = self.python_tag + tag = (impl, "none", plat_name) + else: + impl_name = tags.interpreter_name() + impl_ver = tags.interpreter_version() + impl = impl_name + impl_ver + # We don't work on CPython 3.1, 3.0. + if self.py_limited_api and (impl_name + impl_ver).startswith("cp3"): + impl = self.py_limited_api + abi_tag = "abi3" + else: + abi_tag = str(get_abi_tag()).lower() + tag = (impl, abi_tag, plat_name) + # issue gh-374: allow overriding plat_name + supported_tags = [ + (t.interpreter, t.abi, plat_name) for t in tags.sys_tags() + ] + assert tag in supported_tags, ( + f"would build wheel with unsupported tag {tag}" + ) + return tag + + def run(self): + build_scripts = self.reinitialize_command("build_scripts") + build_scripts.executable = "python" + build_scripts.force = True + + build_ext = self.reinitialize_command("build_ext") + build_ext.inplace = False + + if not self.skip_build: + self.run_command("build") + + install = self.reinitialize_command("install", reinit_subcommands=True) + install.root = self.bdist_dir + install.compile = False + install.skip_build = self.skip_build + install.warn_dir = False + + # A wheel without setuptools scripts is more cross-platform. + # Use the (undocumented) `no_ep` option to setuptools' + # install_scripts command to avoid creating entry point scripts. + install_scripts = self.reinitialize_command("install_scripts") + install_scripts.no_ep = True + + # Use a custom scheme for the archive, because we have to decide + # at installation time which scheme to use. + for key in ("headers", "scripts", "data", "purelib", "platlib"): + setattr(install, "install_" + key, os.path.join(self.data_dir, key)) + + basedir_observed = "" + + if os.name == "nt": + # win32 barfs if any of these are ''; could be '.'? + # (distutils.command.install:change_roots bug) + basedir_observed = os.path.normpath(os.path.join(self.data_dir, "..")) + self.install_libbase = self.install_lib = basedir_observed + + setattr( + install, + "install_purelib" if self.root_is_pure else "install_platlib", + basedir_observed, + ) + + log.info(f"installing to {self.bdist_dir}") + + self.run_command("install") + + impl_tag, abi_tag, plat_tag = self.get_tag() + archive_basename = f"{self.wheel_dist_name}-{impl_tag}-{abi_tag}-{plat_tag}" + if not self.relative: + archive_root = self.bdist_dir + else: + archive_root = os.path.join( + self.bdist_dir, self._ensure_relative(install.install_base) + ) + + self.set_undefined_options("install_egg_info", ("target", "egginfo_dir")) + distinfo_dirname = ( + f"{safer_name(self.distribution.get_name())}-" + f"{safer_version(self.distribution.get_version())}.dist-info" + ) + distinfo_dir = os.path.join(self.bdist_dir, distinfo_dirname) + self.egg2dist(self.egginfo_dir, distinfo_dir) + + self.write_wheelfile(distinfo_dir) + + # Make the archive + if not os.path.exists(self.dist_dir): + os.makedirs(self.dist_dir) + + wheel_path = os.path.join(self.dist_dir, archive_basename + ".whl") + with WheelFile(wheel_path, "w", self.compression) as wf: + wf.write_files(archive_root) + + # Add to 'Distribution.dist_files' so that the "upload" command works + getattr(self.distribution, "dist_files", []).append( + ( + "bdist_wheel", + "{}.{}".format(*sys.version_info[:2]), # like 3.7 + wheel_path, + ) + ) + + if not self.keep_temp: + log.info(f"removing {self.bdist_dir}") + if not self.dry_run: + if sys.version_info < (3, 12): + rmtree(self.bdist_dir, onerror=remove_readonly) + else: + rmtree(self.bdist_dir, onexc=remove_readonly_exc) + + def write_wheelfile( + self, wheelfile_base: str, generator: str = f"bdist_wheel ({wheel_version})" + ): + from email.message import Message + + msg = Message() + msg["Wheel-Version"] = "1.0" # of the spec + msg["Generator"] = generator + msg["Root-Is-Purelib"] = str(self.root_is_pure).lower() + if self.build_number is not None: + msg["Build"] = self.build_number + + # Doesn't work for bdist_wininst + impl_tag, abi_tag, plat_tag = self.get_tag() + for impl in impl_tag.split("."): + for abi in abi_tag.split("."): + for plat in plat_tag.split("."): + msg["Tag"] = "-".join((impl, abi, plat)) + + wheelfile_path = os.path.join(wheelfile_base, "WHEEL") + log.info(f"creating {wheelfile_path}") + with open(wheelfile_path, "wb") as f: + BytesGenerator(f, maxheaderlen=0).flatten(msg) + + def _ensure_relative(self, path: str) -> str: + # copied from dir_util, deleted + drive, path = os.path.splitdrive(path) + if path[0:1] == os.sep: + path = drive + path[1:] + return path + + @property + def license_paths(self) -> Iterable[str]: + if setuptools_major_version >= 57: + # Setuptools has resolved any patterns to actual file names + return self.distribution.metadata.license_files or () + + files: set[str] = set() + metadata = self.distribution.get_option_dict("metadata") + if setuptools_major_version >= 42: + # Setuptools recognizes the license_files option but does not do globbing + patterns = cast(Sequence[str], self.distribution.metadata.license_files) + else: + # Prior to those, wheel is entirely responsible for handling license files + if "license_files" in metadata: + patterns = metadata["license_files"][1].split() + else: + patterns = () + + if "license_file" in metadata: + warnings.warn( + 'The "license_file" option is deprecated. Use "license_files" instead.', + DeprecationWarning, + stacklevel=2, + ) + files.add(metadata["license_file"][1]) + + if not files and not patterns and not isinstance(patterns, list): + patterns = ("LICEN[CS]E*", "COPYING*", "NOTICE*", "AUTHORS*") + + for pattern in patterns: + for path in iglob(pattern): + if path.endswith("~"): + log.debug( + f'ignoring license file "{path}" as it looks like a backup' + ) + continue + + if path not in files and os.path.isfile(path): + log.info( + f'adding license file "{path}" (matched pattern "{pattern}")' + ) + files.add(path) + + return files + + def egg2dist(self, egginfo_path: str, distinfo_path: str): + """Convert an .egg-info directory into a .dist-info directory""" + + def adios(p: str) -> None: + """Appropriately delete directory, file or link.""" + if os.path.exists(p) and not os.path.islink(p) and os.path.isdir(p): + shutil.rmtree(p) + elif os.path.exists(p): + os.unlink(p) + + adios(distinfo_path) + + if not os.path.exists(egginfo_path): + # There is no egg-info. This is probably because the egg-info + # file/directory is not named matching the distribution name used + # to name the archive file. Check for this case and report + # accordingly. + import glob + + pat = os.path.join(os.path.dirname(egginfo_path), "*.egg-info") + possible = glob.glob(pat) + err = f"Egg metadata expected at {egginfo_path} but not found" + if possible: + alt = os.path.basename(possible[0]) + err += f" ({alt} found - possible misnamed archive file?)" + + raise ValueError(err) + + if os.path.isfile(egginfo_path): + # .egg-info is a single file + pkg_info = pkginfo_to_metadata(egginfo_path, egginfo_path) + os.mkdir(distinfo_path) + else: + # .egg-info is a directory + pkginfo_path = os.path.join(egginfo_path, "PKG-INFO") + pkg_info = pkginfo_to_metadata(egginfo_path, pkginfo_path) + + # ignore common egg metadata that is useless to wheel + shutil.copytree( + egginfo_path, + distinfo_path, + ignore=lambda x, y: { + "PKG-INFO", + "requires.txt", + "SOURCES.txt", + "not-zip-safe", + }, + ) + + # delete dependency_links if it is only whitespace + dependency_links_path = os.path.join(distinfo_path, "dependency_links.txt") + with open(dependency_links_path, encoding="utf-8") as dependency_links_file: + dependency_links = dependency_links_file.read().strip() + if not dependency_links: + adios(dependency_links_path) + + pkg_info_path = os.path.join(distinfo_path, "METADATA") + serialization_policy = EmailPolicy( + utf8=True, + mangle_from_=False, + max_line_length=0, + ) + with open(pkg_info_path, "w", encoding="utf-8") as out: + Generator(out, policy=serialization_policy).flatten(pkg_info) + + for license_path in self.license_paths: + filename = os.path.basename(license_path) + shutil.copy(license_path, os.path.join(distinfo_path, filename)) + + adios(egginfo_path) diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wheel/_commands/__init__.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wheel/_commands/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..42f1d7ef309663498fd2b4d691aa71e14be34e63 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wheel/_commands/__init__.py @@ -0,0 +1,153 @@ +""" +Wheel command-line utility. +""" + +from __future__ import annotations + +import argparse +import os +import sys +from argparse import ArgumentTypeError + +from ..wheelfile import WheelError + + +def unpack_f(args: argparse.Namespace) -> None: + from .unpack import unpack + + unpack(args.wheelfile, args.dest) + + +def pack_f(args: argparse.Namespace) -> None: + from .pack import pack + + pack(args.directory, args.dest_dir, args.build_number) + + +def convert_f(args: argparse.Namespace) -> None: + from .convert import convert + + convert(args.files, args.dest_dir, args.verbose) + + +def tags_f(args: argparse.Namespace) -> None: + from .tags import tags + + names = ( + tags( + wheel, + args.python_tag, + args.abi_tag, + args.platform_tag, + args.build, + args.remove, + ) + for wheel in args.wheel + ) + + for name in names: + print(name) + + +def version_f(args: argparse.Namespace) -> None: + from .. import __version__ + + print(f"wheel {__version__}") + + +def parse_build_tag(build_tag: str) -> str: + if build_tag and not build_tag[0].isdigit(): + raise ArgumentTypeError("build tag must begin with a digit") + elif "-" in build_tag: + raise ArgumentTypeError("invalid character ('-') in build tag") + + return build_tag + + +TAGS_HELP = """\ +Make a new wheel with given tags. Any tags unspecified will remain the same. +Starting the tags with a "+" will append to the existing tags. Starting with a +"-" will remove a tag (use --option=-TAG syntax). Multiple tags can be +separated by ".". The original file will remain unless --remove is given. The +output filename(s) will be displayed on stdout for further processing. +""" + + +def parser() -> argparse.ArgumentParser: + p = argparse.ArgumentParser() + s = p.add_subparsers(help="commands") + + unpack_parser = s.add_parser("unpack", help="Unpack wheel") + unpack_parser.add_argument( + "--dest", "-d", help="Destination directory", default="." + ) + unpack_parser.add_argument("wheelfile", help="Wheel file") + unpack_parser.set_defaults(func=unpack_f) + + repack_parser = s.add_parser("pack", help="Repack wheel") + repack_parser.add_argument("directory", help="Root directory of the unpacked wheel") + repack_parser.add_argument( + "--dest-dir", + "-d", + default=os.path.curdir, + help="Directory to store the wheel (default %(default)s)", + ) + repack_parser.add_argument( + "--build-number", help="Build tag to use in the wheel name" + ) + repack_parser.set_defaults(func=pack_f) + + convert_parser = s.add_parser("convert", help="Convert egg or wininst to wheel") + convert_parser.add_argument("files", nargs="*", help="Files to convert") + convert_parser.add_argument( + "--dest-dir", + "-d", + default=os.path.curdir, + help="Directory to store wheels (default %(default)s)", + ) + convert_parser.add_argument("--verbose", "-v", action="store_true") + convert_parser.set_defaults(func=convert_f) + + tags_parser = s.add_parser( + "tags", help="Add or replace the tags on a wheel", description=TAGS_HELP + ) + tags_parser.add_argument("wheel", nargs="*", help="Existing wheel(s) to retag") + tags_parser.add_argument( + "--remove", + action="store_true", + help="Remove the original files, keeping only the renamed ones", + ) + tags_parser.add_argument( + "--python-tag", metavar="TAG", help="Specify an interpreter tag(s)" + ) + tags_parser.add_argument("--abi-tag", metavar="TAG", help="Specify an ABI tag(s)") + tags_parser.add_argument( + "--platform-tag", metavar="TAG", help="Specify a platform tag(s)" + ) + tags_parser.add_argument( + "--build", type=parse_build_tag, metavar="BUILD", help="Specify a build tag" + ) + tags_parser.set_defaults(func=tags_f) + + version_parser = s.add_parser("version", help="Print version and exit") + version_parser.set_defaults(func=version_f) + + help_parser = s.add_parser("help", help="Show this help") + help_parser.set_defaults(func=lambda args: p.print_help()) + + return p + + +def main() -> int: + p = parser() + args = p.parse_args() + if not hasattr(args, "func"): + p.print_help() + else: + try: + args.func(args) + return 0 + except WheelError as e: + print(e, file=sys.stderr) + + return 1 diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wheel/_commands/convert.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wheel/_commands/convert.py new file mode 100644 index 0000000000000000000000000000000000000000..cafd12c86cbc0a661e69b9243ec5525a95274c9e --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wheel/_commands/convert.py @@ -0,0 +1,337 @@ +from __future__ import annotations + +import os.path +import re +from abc import ABCMeta, abstractmethod +from collections import defaultdict +from collections.abc import Iterator +from email.message import Message +from email.parser import Parser +from email.policy import EmailPolicy +from glob import iglob +from pathlib import Path +from textwrap import dedent +from zipfile import ZipFile + +from packaging.tags import parse_tag + +from .. import __version__ +from .._metadata import generate_requirements +from ..wheelfile import WheelFile + +egg_filename_re = re.compile( + r""" + (?P.+?)-(?P.+?) + (-(?Ppy\d\.\d+) + (-(?P.+?))? + )?.egg$""", + re.VERBOSE, +) +egg_info_re = re.compile( + r""" + ^(?P.+?)-(?P.+?) + (-(?Ppy\d\.\d+) + )?.egg-info/""", + re.VERBOSE, +) +wininst_re = re.compile( + r"\.(?Pwin32|win-amd64)(?:-(?Ppy\d\.\d))?\.exe$" +) +pyd_re = re.compile(r"\.(?P[a-z0-9]+)-(?Pwin32|win_amd64)\.pyd$") +serialization_policy = EmailPolicy( + utf8=True, + mangle_from_=False, + max_line_length=0, +) +GENERATOR = f"wheel {__version__}" + + +def convert_requires(requires: str, metadata: Message) -> None: + extra: str | None = None + requirements: dict[str | None, list[str]] = defaultdict(list) + for line in requires.splitlines(): + line = line.strip() + if not line: + continue + + if line.startswith("[") and line.endswith("]"): + extra = line[1:-1] + continue + + requirements[extra].append(line) + + for key, value in generate_requirements(requirements): + metadata.add_header(key, value) + + +def convert_pkg_info(pkginfo: str, metadata: Message) -> None: + parsed_message = Parser().parsestr(pkginfo) + for key, value in parsed_message.items(): + key_lower = key.lower() + if value == "UNKNOWN": + continue + + if key_lower == "description": + description_lines = value.splitlines() + if description_lines: + value = "\n".join( + ( + description_lines[0].lstrip(), + dedent("\n".join(description_lines[1:])), + "\n", + ) + ) + else: + value = "\n" + + metadata.set_payload(value) + elif key_lower == "home-page": + metadata.add_header("Project-URL", f"Homepage, {value}") + elif key_lower == "download-url": + metadata.add_header("Project-URL", f"Download, {value}") + else: + metadata.add_header(key, value) + + metadata.replace_header("Metadata-Version", "2.4") + + +def normalize(name: str) -> str: + return re.sub(r"[-_.]+", "-", name).lower().replace("-", "_") + + +class ConvertSource(metaclass=ABCMeta): + name: str + version: str + pyver: str = "py2.py3" + abi: str = "none" + platform: str = "any" + metadata: Message + + @property + def dist_info_dir(self) -> str: + return f"{self.name}-{self.version}.dist-info" + + @abstractmethod + def generate_contents(self) -> Iterator[tuple[str, bytes]]: + pass + + +class EggFileSource(ConvertSource): + def __init__(self, path: Path): + if not (match := egg_filename_re.match(path.name)): + raise ValueError(f"Invalid egg file name: {path.name}") + + # Binary wheels are assumed to be for CPython + self.path = path + self.name = normalize(match.group("name")) + self.version = match.group("ver") + if pyver := match.group("pyver"): + self.pyver = pyver.replace(".", "") + if arch := match.group("arch"): + self.abi = self.pyver.replace("py", "cp") + self.platform = normalize(arch) + + self.metadata = Message() + + def generate_contents(self) -> Iterator[tuple[str, bytes]]: + with ZipFile(self.path, "r") as zip_file: + for filename in sorted(zip_file.namelist()): + # Skip pure directory entries + if filename.endswith("/"): + continue + + # Handle files in the egg-info directory specially, selectively moving + # them to the dist-info directory while converting as needed + if filename.startswith("EGG-INFO/"): + if filename == "EGG-INFO/requires.txt": + requires = zip_file.read(filename).decode("utf-8") + convert_requires(requires, self.metadata) + elif filename == "EGG-INFO/PKG-INFO": + pkginfo = zip_file.read(filename).decode("utf-8") + convert_pkg_info(pkginfo, self.metadata) + elif filename == "EGG-INFO/entry_points.txt": + yield ( + f"{self.dist_info_dir}/entry_points.txt", + zip_file.read(filename), + ) + + continue + + # For any other file, just pass it through + yield filename, zip_file.read(filename) + + +class EggDirectorySource(EggFileSource): + def generate_contents(self) -> Iterator[tuple[str, bytes]]: + for dirpath, _, filenames in os.walk(self.path): + for filename in sorted(filenames): + path = Path(dirpath, filename) + if path.parent.name == "EGG-INFO": + if path.name == "requires.txt": + requires = path.read_text("utf-8") + convert_requires(requires, self.metadata) + elif path.name == "PKG-INFO": + pkginfo = path.read_text("utf-8") + convert_pkg_info(pkginfo, self.metadata) + if name := self.metadata.get("Name"): + self.name = normalize(name) + + if version := self.metadata.get("Version"): + self.version = version + elif path.name == "entry_points.txt": + yield ( + f"{self.dist_info_dir}/entry_points.txt", + path.read_bytes(), + ) + + continue + + # For any other file, just pass it through + yield str(path.relative_to(self.path)), path.read_bytes() + + +class WininstFileSource(ConvertSource): + """ + Handles distributions created with ``bdist_wininst``. + + The egginfo filename has the format:: + + name-ver(-pyver)(-arch).egg-info + + The installer filename has the format:: + + name-ver.arch(-pyver).exe + + Some things to note: + + 1. The installer filename is not definitive. An installer can be renamed + and work perfectly well as an installer. So more reliable data should + be used whenever possible. + 2. The egg-info data should be preferred for the name and version, because + these come straight from the distutils metadata, and are mandatory. + 3. The pyver from the egg-info data should be ignored, as it is + constructed from the version of Python used to build the installer, + which is irrelevant - the installer filename is correct here (even to + the point that when it's not there, any version is implied). + 4. The architecture must be taken from the installer filename, as it is + not included in the egg-info data. + 5. Architecture-neutral installers still have an architecture because the + installer format itself (being executable) is architecture-specific. We + should therefore ignore the architecture if the content is pure-python. + """ + + def __init__(self, path: Path): + self.path = path + self.metadata = Message() + + # Determine the initial architecture and Python version from the file name + # (if possible) + if match := wininst_re.search(path.name): + self.platform = normalize(match.group("platform")) + if pyver := match.group("pyver"): + self.pyver = pyver.replace(".", "") + + # Look for an .egg-info directory and any .pyd files for more precise info + egg_info_found = pyd_found = False + with ZipFile(self.path) as zip_file: + for filename in zip_file.namelist(): + prefix, filename = filename.split("/", 1) + if not egg_info_found and (match := egg_info_re.match(filename)): + egg_info_found = True + self.name = normalize(match.group("name")) + self.version = match.group("ver") + if pyver := match.group("pyver"): + self.pyver = pyver.replace(".", "") + elif not pyd_found and (match := pyd_re.search(filename)): + pyd_found = True + self.abi = match.group("abi") + self.platform = match.group("platform") + + if egg_info_found and pyd_found: + break + + def generate_contents(self) -> Iterator[tuple[str, bytes]]: + dist_info_dir = f"{self.name}-{self.version}.dist-info" + data_dir = f"{self.name}-{self.version}.data" + with ZipFile(self.path, "r") as zip_file: + for filename in sorted(zip_file.namelist()): + # Skip pure directory entries + if filename.endswith("/"): + continue + + # Handle files in the egg-info directory specially, selectively moving + # them to the dist-info directory while converting as needed + prefix, target_filename = filename.split("/", 1) + if egg_info_re.search(target_filename): + basename = target_filename.rsplit("/", 1)[-1] + if basename == "requires.txt": + requires = zip_file.read(filename).decode("utf-8") + convert_requires(requires, self.metadata) + elif basename == "PKG-INFO": + pkginfo = zip_file.read(filename).decode("utf-8") + convert_pkg_info(pkginfo, self.metadata) + elif basename == "entry_points.txt": + yield ( + f"{dist_info_dir}/entry_points.txt", + zip_file.read(filename), + ) + + continue + elif prefix == "SCRIPTS": + target_filename = f"{data_dir}/scripts/{target_filename}" + + # For any other file, just pass it through + yield target_filename, zip_file.read(filename) + + +def convert(files: list[str], dest_dir: str, verbose: bool) -> None: + for pat in files: + for archive in iglob(pat): + path = Path(archive) + if path.suffix == ".egg": + if path.is_dir(): + source: ConvertSource = EggDirectorySource(path) + else: + source = EggFileSource(path) + else: + source = WininstFileSource(path) + + if verbose: + print(f"{archive}...", flush=True, end="") + + dest_path = Path(dest_dir) / ( + f"{source.name}-{source.version}-{source.pyver}-{source.abi}" + f"-{source.platform}.whl" + ) + with WheelFile(dest_path, "w") as wheelfile: + for name_or_zinfo, contents in source.generate_contents(): + wheelfile.writestr(name_or_zinfo, contents) + + # Write the METADATA file + wheelfile.writestr( + f"{source.dist_info_dir}/METADATA", + source.metadata.as_string(policy=serialization_policy).encode( + "utf-8" + ), + ) + + # Write the WHEEL file + wheel_message = Message() + wheel_message.add_header("Wheel-Version", "1.0") + wheel_message.add_header("Generator", GENERATOR) + wheel_message.add_header( + "Root-Is-Purelib", str(source.platform == "any").lower() + ) + tags = parse_tag(f"{source.pyver}-{source.abi}-{source.platform}") + for tag in sorted(tags, key=lambda tag: tag.interpreter): + wheel_message.add_header("Tag", str(tag)) + + wheelfile.writestr( + f"{source.dist_info_dir}/WHEEL", + wheel_message.as_string(policy=serialization_policy).encode( + "utf-8" + ), + ) + + if verbose: + print("OK") diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wheel/_commands/pack.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wheel/_commands/pack.py new file mode 100644 index 0000000000000000000000000000000000000000..1321ce9308a68f00cf2f839d4ba02869c16ec26f --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wheel/_commands/pack.py @@ -0,0 +1,84 @@ +from __future__ import annotations + +import email.policy +import os.path +import re +from email.generator import BytesGenerator +from email.parser import BytesParser + +from ..wheelfile import WheelError, WheelFile + +DIST_INFO_RE = re.compile(r"^(?P(?P.+?)-(?P\d.*?))\.dist-info$") + + +def pack(directory: str, dest_dir: str, build_number: str | None) -> None: + """Repack a previously unpacked wheel directory into a new wheel file. + + The .dist-info/WHEEL file must contain one or more tags so that the target + wheel file name can be determined. + + :param directory: The unpacked wheel directory + :param dest_dir: Destination directory (defaults to the current directory) + """ + # Find the .dist-info directory + dist_info_dirs = [ + fn + for fn in os.listdir(directory) + if os.path.isdir(os.path.join(directory, fn)) and DIST_INFO_RE.match(fn) + ] + if len(dist_info_dirs) > 1: + raise WheelError(f"Multiple .dist-info directories found in {directory}") + elif not dist_info_dirs: + raise WheelError(f"No .dist-info directories found in {directory}") + + # Determine the target wheel filename + dist_info_dir = dist_info_dirs[0] + name_version = DIST_INFO_RE.match(dist_info_dir).group("namever") + + # Read the tags and the existing build number from .dist-info/WHEEL + wheel_file_path = os.path.join(directory, dist_info_dir, "WHEEL") + with open(wheel_file_path, "rb") as f: + info = BytesParser(policy=email.policy.compat32).parse(f) + tags: list[str] = info.get_all("Tag", []) + existing_build_number = info.get("Build") + + if not tags: + raise WheelError( + f"No tags present in {dist_info_dir}/WHEEL; cannot determine target " + f"wheel filename" + ) + + # Set the wheel file name and add/replace/remove the Build tag in .dist-info/WHEEL + build_number = build_number if build_number is not None else existing_build_number + if build_number is not None: + del info["Build"] + if build_number: + info["Build"] = build_number + name_version += "-" + build_number + + if build_number != existing_build_number: + with open(wheel_file_path, "wb") as f: + BytesGenerator(f, maxheaderlen=0).flatten(info) + + # Reassemble the tags for the wheel file + tagline = compute_tagline(tags) + + # Repack the wheel + wheel_path = os.path.join(dest_dir, f"{name_version}-{tagline}.whl") + with WheelFile(wheel_path, "w") as wf: + print(f"Repacking wheel as {wheel_path}...", end="", flush=True) + wf.write_files(directory) + + print("OK") + + +def compute_tagline(tags: list[str]) -> str: + """Compute a tagline from a list of tags. + + :param tags: A list of tags + :return: A tagline + """ + impls = sorted({tag.split("-")[0] for tag in tags}) + abivers = sorted({tag.split("-")[1] for tag in tags}) + platforms = sorted({tag.split("-")[2] for tag in tags}) + return "-".join([".".join(impls), ".".join(abivers), ".".join(platforms)]) diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wheel/_commands/tags.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wheel/_commands/tags.py new file mode 100644 index 0000000000000000000000000000000000000000..cec896b55b726d29a53f10e06d06b79e645b2e94 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wheel/_commands/tags.py @@ -0,0 +1,140 @@ +from __future__ import annotations + +import email.policy +import itertools +import os +from collections.abc import Iterable +from email.parser import BytesParser + +from ..wheelfile import WheelFile + + +def _compute_tags(original_tags: Iterable[str], new_tags: str | None) -> set[str]: + """Add or replace tags. Supports dot-separated tags""" + if new_tags is None: + return set(original_tags) + + if new_tags.startswith("+"): + return {*original_tags, *new_tags[1:].split(".")} + + if new_tags.startswith("-"): + return set(original_tags) - set(new_tags[1:].split(".")) + + return set(new_tags.split(".")) + + +def tags( + wheel: str, + python_tags: str | None = None, + abi_tags: str | None = None, + platform_tags: str | None = None, + build_tag: str | None = None, + remove: bool = False, +) -> str: + """Change the tags on a wheel file. + + The tags are left unchanged if they are not specified. To specify "none", + use ["none"]. To append to the previous tags, a tag should start with a + "+". If a tag starts with "-", it will be removed from existing tags. + Processing is done left to right. + + :param wheel: The paths to the wheels + :param python_tags: The Python tags to set + :param abi_tags: The ABI tags to set + :param platform_tags: The platform tags to set + :param build_tag: The build tag to set + :param remove: Remove the original wheel + """ + with WheelFile(wheel, "r") as f: + assert f.filename, f"{f.filename} must be available" + + wheel_info = f.read(f.dist_info_path + "/WHEEL") + info = BytesParser(policy=email.policy.compat32).parsebytes(wheel_info) + + original_wheel_name = os.path.basename(f.filename) + namever = f.parsed_filename.group("namever") + build = f.parsed_filename.group("build") + original_python_tags = f.parsed_filename.group("pyver").split(".") + original_abi_tags = f.parsed_filename.group("abi").split(".") + original_plat_tags = f.parsed_filename.group("plat").split(".") + + tags: list[str] = info.get_all("Tag", []) + existing_build_tag = info.get("Build") + + impls = {tag.split("-")[0] for tag in tags} + abivers = {tag.split("-")[1] for tag in tags} + platforms = {tag.split("-")[2] for tag in tags} + + if impls != set(original_python_tags): + msg = f"Wheel internal tags {impls!r} != filename tags {original_python_tags!r}" + raise AssertionError(msg) + + if abivers != set(original_abi_tags): + msg = f"Wheel internal tags {abivers!r} != filename tags {original_abi_tags!r}" + raise AssertionError(msg) + + if platforms != set(original_plat_tags): + msg = ( + f"Wheel internal tags {platforms!r} != filename tags {original_plat_tags!r}" + ) + raise AssertionError(msg) + + if existing_build_tag != build: + msg = ( + f"Incorrect filename '{build}' " + f"& *.dist-info/WHEEL '{existing_build_tag}' build numbers" + ) + raise AssertionError(msg) + + # Start changing as needed + if build_tag is not None: + build = build_tag + + final_python_tags = sorted(_compute_tags(original_python_tags, python_tags)) + final_abi_tags = sorted(_compute_tags(original_abi_tags, abi_tags)) + final_plat_tags = sorted(_compute_tags(original_plat_tags, platform_tags)) + + final_tags = [ + namever, + ".".join(final_python_tags), + ".".join(final_abi_tags), + ".".join(final_plat_tags), + ] + if build: + final_tags.insert(1, build) + + final_wheel_name = "-".join(final_tags) + ".whl" + + if original_wheel_name != final_wheel_name: + del info["Tag"], info["Build"] + for a, b, c in itertools.product( + final_python_tags, final_abi_tags, final_plat_tags + ): + info["Tag"] = f"{a}-{b}-{c}" + if build: + info["Build"] = build + + original_wheel_path = os.path.join( + os.path.dirname(f.filename), original_wheel_name + ) + final_wheel_path = os.path.join(os.path.dirname(f.filename), final_wheel_name) + + with ( + WheelFile(original_wheel_path, "r") as fin, + WheelFile(final_wheel_path, "w") as fout, + ): + fout.comment = fin.comment # preserve the comment + for item in fin.infolist(): + if item.is_dir(): + continue + if item.filename == f.dist_info_path + "/RECORD": + continue + if item.filename == f.dist_info_path + "/WHEEL": + fout.writestr(item, info.as_bytes()) + else: + fout.writestr(item, fin.read(item)) + + if remove: + os.remove(original_wheel_path) + + return final_wheel_name diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wheel/_commands/unpack.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wheel/_commands/unpack.py new file mode 100644 index 0000000000000000000000000000000000000000..83dc7423f8171a3b6ffd6641475af037b7c59495 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wheel/_commands/unpack.py @@ -0,0 +1,30 @@ +from __future__ import annotations + +from pathlib import Path + +from ..wheelfile import WheelFile + + +def unpack(path: str, dest: str = ".") -> None: + """Unpack a wheel. + + Wheel content will be unpacked to {dest}/{name}-{ver}, where {name} + is the package name and {ver} its version. + + :param path: The path to the wheel. + :param dest: Destination directory (default to current directory). + """ + with WheelFile(path) as wf: + namever = wf.parsed_filename.group("namever") + destination = Path(dest) / namever + print(f"Unpacking to: {destination}...", end="", flush=True) + for zinfo in wf.filelist: + target_path = Path(wf.extract(zinfo, destination)) + + # Set permissions to the same values as they were set in the archive + # We have to do this manually due to + # https://github.com/python/cpython/issues/59999 + permissions = zinfo.external_attr >> 16 & 0o777 + target_path.chmod(permissions) + + print("OK") diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wheel/_metadata.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wheel/_metadata.py new file mode 100644 index 0000000000000000000000000000000000000000..e17a7b924526b9fcad83fc44996f17695dea0161 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wheel/_metadata.py @@ -0,0 +1,184 @@ +""" +Tools for converting old- to new-style metadata. +""" + +from __future__ import annotations + +import functools +import itertools +import os.path +import re +import textwrap +from collections.abc import Generator, Iterable, Iterator +from email.message import Message +from email.parser import Parser +from typing import Literal + +from packaging.requirements import Requirement + + +def _nonblank(str: str) -> bool | Literal[""]: + return str and not str.startswith("#") + + +@functools.singledispatch +def yield_lines(iterable: Iterable[str]) -> Iterator[str]: + r""" + Yield valid lines of a string or iterable. + >>> list(yield_lines('')) + [] + >>> list(yield_lines(['foo', 'bar'])) + ['foo', 'bar'] + >>> list(yield_lines('foo\nbar')) + ['foo', 'bar'] + >>> list(yield_lines('\nfoo\n#bar\nbaz #comment')) + ['foo', 'baz #comment'] + >>> list(yield_lines(['foo\nbar', 'baz', 'bing\n\n\n'])) + ['foo', 'bar', 'baz', 'bing'] + """ + return itertools.chain.from_iterable(map(yield_lines, iterable)) + + +@yield_lines.register(str) +def _(text: str) -> Iterator[str]: + return filter(_nonblank, map(str.strip, text.splitlines())) + + +def split_sections( + s: str | Iterator[str], +) -> Generator[tuple[str | None, list[str]], None, None]: + """Split a string or iterable thereof into (section, content) pairs + Each ``section`` is a stripped version of the section header ("[section]") + and each ``content`` is a list of stripped lines excluding blank lines and + comment-only lines. If there are any such lines before the first section + header, they're returned in a first ``section`` of ``None``. + """ + section = None + content: list[str] = [] + for line in yield_lines(s): + if line.startswith("["): + if line.endswith("]"): + if section or content: + yield section, content + section = line[1:-1].strip() + content = [] + else: + raise ValueError("Invalid section heading", line) + else: + content.append(line) + + # wrap up last segment + yield section, content + + +def safe_extra(extra: str) -> str: + """Convert an arbitrary string to a standard 'extra' name + Any runs of non-alphanumeric characters are replaced with a single '_', + and the result is always lowercased. + """ + return re.sub("[^A-Za-z0-9.-]+", "_", extra).lower() + + +def safe_name(name: str) -> str: + """Convert an arbitrary string to a standard distribution name + Any runs of non-alphanumeric/. characters are replaced with a single '-'. + """ + return re.sub("[^A-Za-z0-9.]+", "-", name) + + +def requires_to_requires_dist(requirement: Requirement) -> str: + """Return the version specifier for a requirement in PEP 345/566 fashion.""" + if requirement.url: + return " @ " + requirement.url + + requires_dist: list[str] = [] + for spec in requirement.specifier: + requires_dist.append(spec.operator + spec.version) + + if requires_dist: + return " " + ",".join(sorted(requires_dist)) + else: + return "" + + +def convert_requirements(requirements: list[str]) -> Iterator[str]: + """Yield Requires-Dist: strings for parsed requirements strings.""" + for req in requirements: + parsed_requirement = Requirement(req) + spec = requires_to_requires_dist(parsed_requirement) + extras = ",".join(sorted(safe_extra(e) for e in parsed_requirement.extras)) + if extras: + extras = f"[{extras}]" + + yield safe_name(parsed_requirement.name) + extras + spec + + +def generate_requirements( + extras_require: dict[str | None, list[str]], +) -> Iterator[tuple[str, str]]: + """ + Convert requirements from a setup()-style dictionary to + ('Requires-Dist', 'requirement') and ('Provides-Extra', 'extra') tuples. + + extras_require is a dictionary of {extra: [requirements]} as passed to setup(), + using the empty extra {'': [requirements]} to hold install_requires. + """ + for extra, depends in extras_require.items(): + condition = "" + extra = extra or "" + if ":" in extra: # setuptools extra:condition syntax + extra, condition = extra.split(":", 1) + + extra = safe_extra(extra) + if extra: + yield "Provides-Extra", extra + if condition: + condition = "(" + condition + ") and " + condition += f"extra == '{extra}'" + + if condition: + condition = " ; " + condition + + for new_req in convert_requirements(depends): + canonical_req = str(Requirement(new_req + condition)) + yield "Requires-Dist", canonical_req + + +def pkginfo_to_metadata(egg_info_path: str, pkginfo_path: str) -> Message: + """ + Convert .egg-info directory with PKG-INFO to the Metadata 2.1 format + """ + with open(pkginfo_path, encoding="utf-8") as headers: + pkg_info = Parser().parse(headers) + + pkg_info.replace_header("Metadata-Version", "2.1") + # Those will be regenerated from `requires.txt`. + del pkg_info["Provides-Extra"] + del pkg_info["Requires-Dist"] + requires_path = os.path.join(egg_info_path, "requires.txt") + if os.path.exists(requires_path): + with open(requires_path, encoding="utf-8") as requires_file: + requires = requires_file.read() + + parsed_requirements = sorted(split_sections(requires), key=lambda x: x[0] or "") + for extra, reqs in parsed_requirements: + for key, value in generate_requirements({extra: reqs}): + if (key, value) not in pkg_info.items(): + pkg_info[key] = value + + description = pkg_info["Description"] + if description: + description_lines = pkg_info["Description"].splitlines() + dedented_description = "\n".join( + # if the first line of long_description is blank, + # the first line here will be indented. + ( + description_lines[0].lstrip(), + textwrap.dedent("\n".join(description_lines[1:])), + "\n", + ) + ) + pkg_info.set_payload(dedented_description) + del pkg_info["Description"] + + return pkg_info diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wheel/_setuptools_logging.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wheel/_setuptools_logging.py new file mode 100644 index 0000000000000000000000000000000000000000..a1a2482ba29ac5290c8f7d7688452ec3faf59332 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wheel/_setuptools_logging.py @@ -0,0 +1,26 @@ +# copied from setuptools.logging, omitting monkeypatching +from __future__ import annotations + +import logging +import sys + + +def _not_warning(record: logging.LogRecord) -> bool: + return record.levelno < logging.WARNING + + +def configure() -> None: + """ + Configure logging to emit warning and above to stderr + and everything else to stdout. This behavior is provided + for compatibility with distutils.log but may change in + the future. + """ + err_handler = logging.StreamHandler() + err_handler.setLevel(logging.WARNING) + out_handler = logging.StreamHandler(sys.stdout) + out_handler.addFilter(_not_warning) + handlers = err_handler, out_handler + logging.basicConfig( + format="{message}", style="{", handlers=handlers, level=logging.DEBUG + ) diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wheel/bdist_wheel.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wheel/bdist_wheel.py new file mode 100644 index 0000000000000000000000000000000000000000..24199c246d44a6874ad991c2f3492ca30fc10f27 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wheel/bdist_wheel.py @@ -0,0 +1,26 @@ +from typing import TYPE_CHECKING +from warnings import warn + +warn( + "The 'wheel' package is no longer the canonical location of the 'bdist_wheel' " + "command, and will be removed in a future release. Please update to setuptools " + "v70.1 or later which contains an integrated version of this command.", + FutureWarning, + stacklevel=1, +) + +if TYPE_CHECKING: + from ._bdist_wheel import bdist_wheel as bdist_wheel +else: + try: + # Better integration/compatibility with setuptools: + # in the case new fixes or PEPs are implemented in setuptools + # there is no need to backport them to the deprecated code base. + # This is useful in the case of old packages in the ecosystem + # that are still used but have low maintenance. + from setuptools.command.bdist_wheel import bdist_wheel + except ImportError: + # Only used in the case of old setuptools versions. + # If the user wants to get the latest fixes/PEPs, + # they are encouraged to address the deprecation warning. + from ._bdist_wheel import bdist_wheel as bdist_wheel diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wheel/macosx_libfile.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wheel/macosx_libfile.py new file mode 100644 index 0000000000000000000000000000000000000000..06e51af299d0fe15f7618f803cfb8ff52d199cf7 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wheel/macosx_libfile.py @@ -0,0 +1,486 @@ +""" +IMPORTANT: DO NOT IMPORT THIS MODULE DIRECTLY. +THIS IS ONLY KEPT IN PLACE FOR BACKWARDS COMPATIBILITY WITH +setuptools.command.bdist_wheel. + +This module contains function to analyse dynamic library +headers to extract system information + +Currently only for MacOSX + +Library file on macosx system starts with Mach-O or Fat field. +This can be distinguish by first 32 bites and it is called magic number. +Proper value of magic number is with suffix _MAGIC. Suffix _CIGAM means +reversed bytes order. +Both fields can occur in two types: 32 and 64 bytes. + +FAT field inform that this library contains few version of library +(typically for different types version). It contains +information where Mach-O headers starts. + +Each section started with Mach-O header contains one library +(So if file starts with this field it contains only one version). + +After filed Mach-O there are section fields. +Each of them starts with two fields: +cmd - magic number for this command +cmdsize - total size occupied by this section information. + +In this case only sections LC_VERSION_MIN_MACOSX (for macosx 10.13 and earlier) +and LC_BUILD_VERSION (for macosx 10.14 and newer) are interesting, +because them contains information about minimal system version. + +Important remarks: +- For fat files this implementation looks for maximum number version. + It not check if it is 32 or 64 and do not compare it with currently built package. + So it is possible to false report higher version that needed. +- All structures signatures are taken form macosx header files. +- I think that binary format will be more stable than `otool` output. + and if apple introduce some changes both implementation will need to be updated. +- The system compile will set the deployment target no lower than + 11.0 for arm64 builds. For "Universal 2" builds use the x86_64 deployment + target when the arm64 target is 11.0. +""" + +from __future__ import annotations + +import ctypes +import os +import sys +from io import BufferedIOBase +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from typing import Union + + StrPath = Union[str, os.PathLike[str]] + +"""here the needed const and struct from mach-o header files""" + +FAT_MAGIC = 0xCAFEBABE +FAT_CIGAM = 0xBEBAFECA +FAT_MAGIC_64 = 0xCAFEBABF +FAT_CIGAM_64 = 0xBFBAFECA +MH_MAGIC = 0xFEEDFACE +MH_CIGAM = 0xCEFAEDFE +MH_MAGIC_64 = 0xFEEDFACF +MH_CIGAM_64 = 0xCFFAEDFE + +LC_VERSION_MIN_MACOSX = 0x24 +LC_BUILD_VERSION = 0x32 + +CPU_TYPE_ARM64 = 0x0100000C + +mach_header_fields = [ + ("magic", ctypes.c_uint32), + ("cputype", ctypes.c_int), + ("cpusubtype", ctypes.c_int), + ("filetype", ctypes.c_uint32), + ("ncmds", ctypes.c_uint32), + ("sizeofcmds", ctypes.c_uint32), + ("flags", ctypes.c_uint32), +] +""" +struct mach_header { + uint32_t magic; /* mach magic number identifier */ + cpu_type_t cputype; /* cpu specifier */ + cpu_subtype_t cpusubtype; /* machine specifier */ + uint32_t filetype; /* type of file */ + uint32_t ncmds; /* number of load commands */ + uint32_t sizeofcmds; /* the size of all the load commands */ + uint32_t flags; /* flags */ +}; +typedef integer_t cpu_type_t; +typedef integer_t cpu_subtype_t; +""" + +mach_header_fields_64 = mach_header_fields + [("reserved", ctypes.c_uint32)] +""" +struct mach_header_64 { + uint32_t magic; /* mach magic number identifier */ + cpu_type_t cputype; /* cpu specifier */ + cpu_subtype_t cpusubtype; /* machine specifier */ + uint32_t filetype; /* type of file */ + uint32_t ncmds; /* number of load commands */ + uint32_t sizeofcmds; /* the size of all the load commands */ + uint32_t flags; /* flags */ + uint32_t reserved; /* reserved */ +}; +""" + +fat_header_fields = [("magic", ctypes.c_uint32), ("nfat_arch", ctypes.c_uint32)] +""" +struct fat_header { + uint32_t magic; /* FAT_MAGIC or FAT_MAGIC_64 */ + uint32_t nfat_arch; /* number of structs that follow */ +}; +""" + +fat_arch_fields = [ + ("cputype", ctypes.c_int), + ("cpusubtype", ctypes.c_int), + ("offset", ctypes.c_uint32), + ("size", ctypes.c_uint32), + ("align", ctypes.c_uint32), +] +""" +struct fat_arch { + cpu_type_t cputype; /* cpu specifier (int) */ + cpu_subtype_t cpusubtype; /* machine specifier (int) */ + uint32_t offset; /* file offset to this object file */ + uint32_t size; /* size of this object file */ + uint32_t align; /* alignment as a power of 2 */ +}; +""" + +fat_arch_64_fields = [ + ("cputype", ctypes.c_int), + ("cpusubtype", ctypes.c_int), + ("offset", ctypes.c_uint64), + ("size", ctypes.c_uint64), + ("align", ctypes.c_uint32), + ("reserved", ctypes.c_uint32), +] +""" +struct fat_arch_64 { + cpu_type_t cputype; /* cpu specifier (int) */ + cpu_subtype_t cpusubtype; /* machine specifier (int) */ + uint64_t offset; /* file offset to this object file */ + uint64_t size; /* size of this object file */ + uint32_t align; /* alignment as a power of 2 */ + uint32_t reserved; /* reserved */ +}; +""" + +segment_base_fields = [("cmd", ctypes.c_uint32), ("cmdsize", ctypes.c_uint32)] +"""base for reading segment info""" + +segment_command_fields = [ + ("cmd", ctypes.c_uint32), + ("cmdsize", ctypes.c_uint32), + ("segname", ctypes.c_char * 16), + ("vmaddr", ctypes.c_uint32), + ("vmsize", ctypes.c_uint32), + ("fileoff", ctypes.c_uint32), + ("filesize", ctypes.c_uint32), + ("maxprot", ctypes.c_int), + ("initprot", ctypes.c_int), + ("nsects", ctypes.c_uint32), + ("flags", ctypes.c_uint32), +] +""" +struct segment_command { /* for 32-bit architectures */ + uint32_t cmd; /* LC_SEGMENT */ + uint32_t cmdsize; /* includes sizeof section structs */ + char segname[16]; /* segment name */ + uint32_t vmaddr; /* memory address of this segment */ + uint32_t vmsize; /* memory size of this segment */ + uint32_t fileoff; /* file offset of this segment */ + uint32_t filesize; /* amount to map from the file */ + vm_prot_t maxprot; /* maximum VM protection */ + vm_prot_t initprot; /* initial VM protection */ + uint32_t nsects; /* number of sections in segment */ + uint32_t flags; /* flags */ +}; +typedef int vm_prot_t; +""" + +segment_command_fields_64 = [ + ("cmd", ctypes.c_uint32), + ("cmdsize", ctypes.c_uint32), + ("segname", ctypes.c_char * 16), + ("vmaddr", ctypes.c_uint64), + ("vmsize", ctypes.c_uint64), + ("fileoff", ctypes.c_uint64), + ("filesize", ctypes.c_uint64), + ("maxprot", ctypes.c_int), + ("initprot", ctypes.c_int), + ("nsects", ctypes.c_uint32), + ("flags", ctypes.c_uint32), +] +""" +struct segment_command_64 { /* for 64-bit architectures */ + uint32_t cmd; /* LC_SEGMENT_64 */ + uint32_t cmdsize; /* includes sizeof section_64 structs */ + char segname[16]; /* segment name */ + uint64_t vmaddr; /* memory address of this segment */ + uint64_t vmsize; /* memory size of this segment */ + uint64_t fileoff; /* file offset of this segment */ + uint64_t filesize; /* amount to map from the file */ + vm_prot_t maxprot; /* maximum VM protection */ + vm_prot_t initprot; /* initial VM protection */ + uint32_t nsects; /* number of sections in segment */ + uint32_t flags; /* flags */ +}; +""" + +version_min_command_fields = segment_base_fields + [ + ("version", ctypes.c_uint32), + ("sdk", ctypes.c_uint32), +] +""" +struct version_min_command { + uint32_t cmd; /* LC_VERSION_MIN_MACOSX or + LC_VERSION_MIN_IPHONEOS or + LC_VERSION_MIN_WATCHOS or + LC_VERSION_MIN_TVOS */ + uint32_t cmdsize; /* sizeof(struct min_version_command) */ + uint32_t version; /* X.Y.Z is encoded in nibbles xxxx.yy.zz */ + uint32_t sdk; /* X.Y.Z is encoded in nibbles xxxx.yy.zz */ +}; +""" + +build_version_command_fields = segment_base_fields + [ + ("platform", ctypes.c_uint32), + ("minos", ctypes.c_uint32), + ("sdk", ctypes.c_uint32), + ("ntools", ctypes.c_uint32), +] +""" +struct build_version_command { + uint32_t cmd; /* LC_BUILD_VERSION */ + uint32_t cmdsize; /* sizeof(struct build_version_command) plus */ + /* ntools * sizeof(struct build_tool_version) */ + uint32_t platform; /* platform */ + uint32_t minos; /* X.Y.Z is encoded in nibbles xxxx.yy.zz */ + uint32_t sdk; /* X.Y.Z is encoded in nibbles xxxx.yy.zz */ + uint32_t ntools; /* number of tool entries following this */ +}; +""" + + +def swap32(x: int) -> int: + return ( + ((x << 24) & 0xFF000000) + | ((x << 8) & 0x00FF0000) + | ((x >> 8) & 0x0000FF00) + | ((x >> 24) & 0x000000FF) + ) + + +def get_base_class_and_magic_number( + lib_file: BufferedIOBase, + seek: int | None = None, +) -> tuple[type[ctypes.Structure], int]: + if seek is None: + seek = lib_file.tell() + else: + lib_file.seek(seek) + magic_number = ctypes.c_uint32.from_buffer_copy( + lib_file.read(ctypes.sizeof(ctypes.c_uint32)) + ).value + + # Handle wrong byte order + if magic_number in [FAT_CIGAM, FAT_CIGAM_64, MH_CIGAM, MH_CIGAM_64]: + if sys.byteorder == "little": + BaseClass = ctypes.BigEndianStructure + else: + BaseClass = ctypes.LittleEndianStructure + + magic_number = swap32(magic_number) + else: + BaseClass = ctypes.Structure + + lib_file.seek(seek) + return BaseClass, magic_number + + +def read_data(struct_class: type[ctypes.Structure], lib_file: BufferedIOBase): + return struct_class.from_buffer_copy(lib_file.read(ctypes.sizeof(struct_class))) + + +def extract_macosx_min_system_version(path_to_lib: str): + with open(path_to_lib, "rb") as lib_file: + BaseClass, magic_number = get_base_class_and_magic_number(lib_file, 0) + if magic_number not in [FAT_MAGIC, FAT_MAGIC_64, MH_MAGIC, MH_MAGIC_64]: + return + + if magic_number in [FAT_MAGIC, FAT_CIGAM_64]: + + class FatHeader(BaseClass): + _fields_ = fat_header_fields + + fat_header = read_data(FatHeader, lib_file) + if magic_number == FAT_MAGIC: + + class FatArch(BaseClass): + _fields_ = fat_arch_fields + + else: + + class FatArch(BaseClass): + _fields_ = fat_arch_64_fields + + fat_arch_list = [ + read_data(FatArch, lib_file) for _ in range(fat_header.nfat_arch) + ] + + versions_list: list[tuple[int, int, int]] = [] + for el in fat_arch_list: + try: + version = read_mach_header(lib_file, el.offset) + if version is not None: + if el.cputype == CPU_TYPE_ARM64 and len(fat_arch_list) != 1: + # Xcode will not set the deployment target below 11.0.0 + # for the arm64 architecture. Ignore the arm64 deployment + # in fat binaries when the target is 11.0.0, that way + # the other architectures can select a lower deployment + # target. + # This is safe because there is no arm64 variant for + # macOS 10.15 or earlier. + if version == (11, 0, 0): + continue + versions_list.append(version) + except ValueError: + pass + + if len(versions_list) > 0: + return max(versions_list) + else: + return None + + else: + try: + return read_mach_header(lib_file, 0) + except ValueError: + """when some error during read library files""" + return None + + +def read_mach_header( + lib_file: BufferedIOBase, + seek: int | None = None, +) -> tuple[int, int, int] | None: + """ + This function parses a Mach-O header and extracts + information about the minimal macOS version. + + :param lib_file: reference to opened library file with pointer + """ + base_class, magic_number = get_base_class_and_magic_number(lib_file, seek) + arch = "32" if magic_number == MH_MAGIC else "64" + + class SegmentBase(base_class): + _fields_ = segment_base_fields + + if arch == "32": + + class MachHeader(base_class): + _fields_ = mach_header_fields + + else: + + class MachHeader(base_class): + _fields_ = mach_header_fields_64 + + mach_header = read_data(MachHeader, lib_file) + for _i in range(mach_header.ncmds): + pos = lib_file.tell() + segment_base = read_data(SegmentBase, lib_file) + lib_file.seek(pos) + if segment_base.cmd == LC_VERSION_MIN_MACOSX: + + class VersionMinCommand(base_class): + _fields_ = version_min_command_fields + + version_info = read_data(VersionMinCommand, lib_file) + return parse_version(version_info.version) + elif segment_base.cmd == LC_BUILD_VERSION: + + class VersionBuild(base_class): + _fields_ = build_version_command_fields + + version_info = read_data(VersionBuild, lib_file) + return parse_version(version_info.minos) + else: + lib_file.seek(pos + segment_base.cmdsize) + continue + + +def parse_version(version: int) -> tuple[int, int, int]: + x = (version & 0xFFFF0000) >> 16 + y = (version & 0x0000FF00) >> 8 + z = version & 0x000000FF + return x, y, z + + +def calculate_macosx_platform_tag(archive_root: StrPath, platform_tag: str) -> str: + """ + Calculate proper macosx platform tag basing on files which are included to wheel + + Example platform tag `macosx-10.14-x86_64` + """ + prefix, base_version, suffix = platform_tag.split("-") + base_version = tuple(int(x) for x in base_version.split(".")) + base_version = base_version[:2] + if base_version[0] > 10: + base_version = (base_version[0], 0) + assert len(base_version) == 2 + if "MACOSX_DEPLOYMENT_TARGET" in os.environ: + deploy_target = tuple( + int(x) for x in os.environ["MACOSX_DEPLOYMENT_TARGET"].split(".") + ) + deploy_target = deploy_target[:2] + if deploy_target[0] > 10: + deploy_target = (deploy_target[0], 0) + if deploy_target < base_version: + sys.stderr.write( + "[WARNING] MACOSX_DEPLOYMENT_TARGET is set to a lower value ({}) than " + "the version on which the Python interpreter was compiled ({}), and " + "will be ignored.\n".format( + ".".join(str(x) for x in deploy_target), + ".".join(str(x) for x in base_version), + ) + ) + else: + base_version = deploy_target + + assert len(base_version) == 2 + start_version = base_version + versions_dict: dict[str, tuple[int, int]] = {} + for dirpath, _dirnames, filenames in os.walk(archive_root): + for filename in filenames: + if filename.endswith(".dylib") or filename.endswith(".so"): + lib_path = os.path.join(dirpath, filename) + min_ver = extract_macosx_min_system_version(lib_path) + if min_ver is not None: + min_ver = min_ver[0:2] + if min_ver[0] > 10: + min_ver = (min_ver[0], 0) + versions_dict[lib_path] = min_ver + + if len(versions_dict) > 0: + base_version = max(base_version, max(versions_dict.values())) + + # macosx platform tag do not support minor bugfix release + fin_base_version = "_".join([str(x) for x in base_version]) + if start_version < base_version: + problematic_files = [k for k, v in versions_dict.items() if v > start_version] + problematic_files = "\n".join(problematic_files) + if len(problematic_files) == 1: + files_form = "this file" + else: + files_form = "these files" + error_message = ( + "[WARNING] This wheel needs a higher macOS version than {} " + "To silence this warning, set MACOSX_DEPLOYMENT_TARGET to at least " + + fin_base_version + + " or recreate " + + files_form + + " with lower " + "MACOSX_DEPLOYMENT_TARGET: \n" + problematic_files + ) + + if "MACOSX_DEPLOYMENT_TARGET" in os.environ: + error_message = error_message.format( + "is set in MACOSX_DEPLOYMENT_TARGET variable." + ) + else: + error_message = error_message.format( + "the version your Python interpreter is compiled against." + ) + + sys.stderr.write(error_message) + + platform_tag = prefix + "_" + fin_base_version + "_" + suffix + return platform_tag diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wheel/metadata.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wheel/metadata.py new file mode 100644 index 0000000000000000000000000000000000000000..e27900a2565c859ff32b0e4bf497c2548e4912de --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wheel/metadata.py @@ -0,0 +1,17 @@ +from warnings import warn + +from ._metadata import convert_requirements as convert_requirements +from ._metadata import generate_requirements as generate_requirements +from ._metadata import pkginfo_to_metadata as pkginfo_to_metadata +from ._metadata import requires_to_requires_dist as requires_to_requires_dist +from ._metadata import safe_extra as safe_extra +from ._metadata import safe_name as safe_name +from ._metadata import split_sections as split_sections + +warn( + f"The {__name__!r} package has been made private and should no longer be imported. " + f"Please either copy the code or find an alternative library to import it from, as " + f"this warning will be removed in a future version of 'wheel'.", + DeprecationWarning, + stacklevel=2, +) diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wheel/wheelfile.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wheel/wheelfile.py new file mode 100644 index 0000000000000000000000000000000000000000..7b6fd71621b9a14274a17086edeb287db58d7fe0 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wheel/wheelfile.py @@ -0,0 +1,241 @@ +from __future__ import annotations + +__all__ = ["WHEEL_INFO_RE", "WheelFile", "WheelError"] + +import base64 +import csv +import hashlib +import logging +import os.path +import re +import stat +import time +from io import StringIO, TextIOWrapper +from typing import IO, TYPE_CHECKING, Literal +from zipfile import ZIP_DEFLATED, ZipFile, ZipInfo + +if TYPE_CHECKING: + from _typeshed import SizedBuffer, StrPath + + +# Non-greedy matching of an optional build number may be too clever (more +# invalid wheel filenames will match). Separate regex for .dist-info? +WHEEL_INFO_RE = re.compile( + r"""^(?P(?P[^\s-]+?)-(?P[^\s-]+?))(-(?P\d[^\s-]*))? + -(?P[^\s-]+?)-(?P[^\s-]+?)-(?P\S+)\.whl$""", + re.VERBOSE, +) +MINIMUM_TIMESTAMP = 315532800 # 1980-01-01 00:00:00 UTC + +log = logging.getLogger("wheel") + + +class WheelError(Exception): + pass + + +def urlsafe_b64encode(data: bytes) -> bytes: + """urlsafe_b64encode without padding""" + return base64.urlsafe_b64encode(data).rstrip(b"=") + + +def urlsafe_b64decode(data: bytes) -> bytes: + """urlsafe_b64decode without padding""" + pad = b"=" * (4 - (len(data) & 3)) + return base64.urlsafe_b64decode(data + pad) + + +def get_zipinfo_datetime( + timestamp: float | None = None, +) -> tuple[int, int, int, int, int]: + # Some applications need reproducible .whl files, but they can't do this without + # forcing the timestamp of the individual ZipInfo objects. See issue #143. + timestamp = int(os.environ.get("SOURCE_DATE_EPOCH", timestamp or time.time())) + timestamp = max(timestamp, MINIMUM_TIMESTAMP) + return time.gmtime(timestamp)[0:6] + + +class WheelFile(ZipFile): + """A ZipFile derivative class that also reads SHA-256 hashes from + .dist-info/RECORD and checks any read files against those. + """ + + _default_algorithm = hashlib.sha256 + + def __init__( + self, + file: StrPath, + mode: Literal["r", "w", "x", "a"] = "r", + compression: int = ZIP_DEFLATED, + ): + basename = os.path.basename(file) + self.parsed_filename = WHEEL_INFO_RE.match(basename) + if not basename.endswith(".whl") or self.parsed_filename is None: + raise WheelError(f"Bad wheel filename {basename!r}") + + ZipFile.__init__(self, file, mode, compression=compression, allowZip64=True) + + self.dist_info_path = "{}.dist-info".format( + self.parsed_filename.group("namever") + ) + self.record_path = self.dist_info_path + "/RECORD" + self._file_hashes: dict[str, tuple[None, None] | tuple[int, bytes]] = {} + self._file_sizes = {} + if mode == "r": + # Ignore RECORD and any embedded wheel signatures + self._file_hashes[self.record_path] = None, None + self._file_hashes[self.record_path + ".jws"] = None, None + self._file_hashes[self.record_path + ".p7s"] = None, None + + # Fill in the expected hashes by reading them from RECORD + try: + record = self.open(self.record_path) + except KeyError: + raise WheelError(f"Missing {self.record_path} file") from None + + with record: + for line in csv.reader( + TextIOWrapper(record, newline="", encoding="utf-8") + ): + path, hash_sum, size = line + if not hash_sum: + continue + + algorithm, hash_sum = hash_sum.split("=") + try: + hashlib.new(algorithm) + except ValueError: + raise WheelError( + f"Unsupported hash algorithm: {algorithm}" + ) from None + + if algorithm.lower() in {"md5", "sha1"}: + raise WheelError( + f"Weak hash algorithm ({algorithm}) is not permitted by " + f"PEP 427" + ) + + self._file_hashes[path] = ( + algorithm, + urlsafe_b64decode(hash_sum.encode("ascii")), + ) + + def open( + self, + name_or_info: str | ZipInfo, + mode: Literal["r", "w"] = "r", + pwd: bytes | None = None, + ) -> IO[bytes]: + def _update_crc(newdata: bytes) -> None: + eof = ef._eof + update_crc_orig(newdata) + running_hash.update(newdata) + if eof and running_hash.digest() != expected_hash: + raise WheelError(f"Hash mismatch for file '{ef_name}'") + + ef_name = ( + name_or_info.filename if isinstance(name_or_info, ZipInfo) else name_or_info + ) + if ( + mode == "r" + and not ef_name.endswith("/") + and ef_name not in self._file_hashes + ): + raise WheelError(f"No hash found for file '{ef_name}'") + + ef = ZipFile.open(self, name_or_info, mode, pwd) + if mode == "r" and not ef_name.endswith("/"): + algorithm, expected_hash = self._file_hashes[ef_name] + if expected_hash is not None: + # Monkey patch the _update_crc method to also check for the hash from + # RECORD + running_hash = hashlib.new(algorithm) + update_crc_orig, ef._update_crc = ef._update_crc, _update_crc + + return ef + + def write_files(self, base_dir: str) -> None: + log.info("creating %r and adding %r to it", self.filename, base_dir) + deferred: list[tuple[str, str]] = [] + for root, dirnames, filenames in os.walk(base_dir): + # Sort the directory names so that `os.walk` will walk them in a + # defined order on the next iteration. + dirnames.sort() + for name in sorted(filenames): + path = os.path.normpath(os.path.join(root, name)) + if os.path.isfile(path): + arcname = os.path.relpath(path, base_dir).replace(os.path.sep, "/") + if arcname == self.record_path: + pass + elif root.endswith(".dist-info"): + deferred.append((path, arcname)) + else: + self.write(path, arcname) + + deferred.sort() + for path, arcname in deferred: + self.write(path, arcname) + + def write( + self, + filename: str, + arcname: str | None = None, + compress_type: int | None = None, + ) -> None: + with open(filename, "rb") as f: + st = os.fstat(f.fileno()) + data = f.read() + + zinfo = ZipInfo( + arcname or filename, date_time=get_zipinfo_datetime(st.st_mtime) + ) + zinfo.external_attr = (stat.S_IMODE(st.st_mode) | stat.S_IFMT(st.st_mode)) << 16 + zinfo.compress_type = compress_type or self.compression + self.writestr(zinfo, data, compress_type) + + def writestr( + self, + zinfo_or_arcname: str | ZipInfo, + data: SizedBuffer | str, + compress_type: int | None = None, + ) -> None: + if isinstance(zinfo_or_arcname, str): + zinfo_or_arcname = ZipInfo( + zinfo_or_arcname, date_time=get_zipinfo_datetime() + ) + zinfo_or_arcname.compress_type = self.compression + zinfo_or_arcname.external_attr = (0o664 | stat.S_IFREG) << 16 + + if isinstance(data, str): + data = data.encode("utf-8") + + ZipFile.writestr(self, zinfo_or_arcname, data, compress_type) + fname = ( + zinfo_or_arcname.filename + if isinstance(zinfo_or_arcname, ZipInfo) + else zinfo_or_arcname + ) + log.info("adding %r", fname) + if fname != self.record_path: + hash_ = self._default_algorithm(data) + self._file_hashes[fname] = ( + hash_.name, + urlsafe_b64encode(hash_.digest()).decode("ascii"), + ) + self._file_sizes[fname] = len(data) + + def close(self) -> None: + # Write RECORD + if self.fp is not None and self.mode == "w" and self._file_hashes: + data = StringIO() + writer = csv.writer(data, delimiter=",", quotechar='"', lineterminator="\n") + writer.writerows( + ( + (fname, algorithm + "=" + hash_, self._file_sizes[fname]) + for fname, (algorithm, hash_) in self._file_hashes.items() + ) + ) + writer.writerow((format(self.record_path), "", "")) + self.writestr(self.record_path, data.getvalue()) + + ZipFile.close(self) diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wrapt-1.14.2.dist-info/INSTALLER b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wrapt-1.14.2.dist-info/INSTALLER new file mode 100644 index 0000000000000000000000000000000000000000..a1b589e38a32041e49332e5e81c2d363dc418d68 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wrapt-1.14.2.dist-info/INSTALLER @@ -0,0 +1 @@ +pip diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wrapt-1.14.2.dist-info/METADATA b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wrapt-1.14.2.dist-info/METADATA new file mode 100644 index 0000000000000000000000000000000000000000..31ff2c3e50c028bcfdaf0d33275dce3223b031d0 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wrapt-1.14.2.dist-info/METADATA @@ -0,0 +1,168 @@ +Metadata-Version: 2.4 +Name: wrapt +Version: 1.14.2 +Summary: Module for decorators, wrappers and monkey patching. +Home-page: https://github.com/GrahamDumpleton/wrapt +Author: Graham Dumpleton +Author-email: Graham.Dumpleton@gmail.com +License: BSD +Project-URL: Bug Tracker, https://github.com/GrahamDumpleton/wrapt/issues/ +Project-URL: Changelog, https://wrapt.readthedocs.io/en/latest/changes.html +Project-URL: Documentation, https://wrapt.readthedocs.io/ +Keywords: wrapper,proxy,decorator +Platform: any +Classifier: Development Status :: 5 - Production/Stable +Classifier: License :: OSI Approved :: BSD License +Classifier: Programming Language :: Python :: 3 +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 +Requires-Python: >=3.8 +Description-Content-Type: text/x-rst +License-File: LICENSE +Dynamic: license-file + +wrapt +===== + +|Actions| |PyPI| + +The aim of the **wrapt** module is to provide a transparent object proxy +for Python, which can be used as the basis for the construction of function +wrappers and decorator functions. + +The **wrapt** module focuses very much on correctness. It therefore goes +way beyond existing mechanisms such as ``functools.wraps()`` to ensure that +decorators preserve introspectability, signatures, type checking abilities +etc. The decorators that can be constructed using this module will work in +far more scenarios than typical decorators and provide more predictable and +consistent behaviour. + +To ensure that the overhead is as minimal as possible, a C extension module +is used for performance critical components. An automatic fallback to a +pure Python implementation is also provided where a target system does not +have a compiler to allow the C extension to be compiled. + +Documentation +------------- + +For further information on the **wrapt** module see: + +* http://wrapt.readthedocs.org/ + +Quick Start +----------- + +To implement your decorator you need to first define a wrapper function. +This will be called each time a decorated function is called. The wrapper +function needs to take four positional arguments: + +* ``wrapped`` - The wrapped function which in turns needs to be called by your wrapper function. +* ``instance`` - The object to which the wrapped function was bound when it was called. +* ``args`` - The list of positional arguments supplied when the decorated function was called. +* ``kwargs`` - The dictionary of keyword arguments supplied when the decorated function was called. + +The wrapper function would do whatever it needs to, but would usually in +turn call the wrapped function that is passed in via the ``wrapped`` +argument. + +The decorator ``@wrapt.decorator`` then needs to be applied to the wrapper +function to convert it into a decorator which can in turn be applied to +other functions. + +.. code-block:: python + + import wrapt + + @wrapt.decorator + def pass_through(wrapped, instance, args, kwargs): + return wrapped(*args, **kwargs) + + @pass_through + def function(): + pass + +If you wish to implement a decorator which accepts arguments, then wrap the +definition of the decorator in a function closure. Any arguments supplied +to the outer function when the decorator is applied, will be available to +the inner wrapper when the wrapped function is called. + +.. code-block:: python + + import wrapt + + def with_arguments(myarg1, myarg2): + @wrapt.decorator + def wrapper(wrapped, instance, args, kwargs): + return wrapped(*args, **kwargs) + return wrapper + + @with_arguments(1, 2) + def function(): + pass + +When applied to a normal function or static method, the wrapper function +when called will be passed ``None`` as the ``instance`` argument. + +When applied to an instance method, the wrapper function when called will +be passed the instance of the class the method is being called on as the +``instance`` argument. This will be the case even when the instance method +was called explicitly via the class and the instance passed as the first +argument. That is, the instance will never be passed as part of ``args``. + +When applied to a class method, the wrapper function when called will be +passed the class type as the ``instance`` argument. + +When applied to a class, the wrapper function when called will be passed +``None`` as the ``instance`` argument. The ``wrapped`` argument in this +case will be the class. + +The above rules can be summarised with the following example. + +.. code-block:: python + + import inspect + + @wrapt.decorator + def universal(wrapped, instance, args, kwargs): + if instance is None: + if inspect.isclass(wrapped): + # Decorator was applied to a class. + return wrapped(*args, **kwargs) + else: + # Decorator was applied to a function or staticmethod. + return wrapped(*args, **kwargs) + else: + if inspect.isclass(instance): + # Decorator was applied to a classmethod. + return wrapped(*args, **kwargs) + else: + # Decorator was applied to an instancemethod. + return wrapped(*args, **kwargs) + +Using these checks it is therefore possible to create a universal decorator +that can be applied in all situations. It is no longer necessary to create +different variants of decorators for normal functions and instance methods, +or use additional wrappers to convert a function decorator into one that +will work for instance methods. + +In all cases, the wrapped function passed to the wrapper function is called +in the same way, with ``args`` and ``kwargs`` being passed. The +``instance`` argument doesn't need to be used in calling the wrapped +function. + +Repository +---------- + +Full source code for the **wrapt** module, including documentation files +and unit tests, can be obtained from github. + +* https://github.com/GrahamDumpleton/wrapt + +.. |Actions| image:: https://img.shields.io/github/workflow/status/GrahamDumpleton/wrapt/Test/develop?logo=github&cacheSeconds=600 + :target: https://github.com/GrahamDumpleton/wrapt/actions +.. |PyPI| image:: https://img.shields.io/pypi/v/wrapt.svg?logo=python&cacheSeconds=3600 + :target: https://pypi.python.org/pypi/wrapt diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wrapt-1.14.2.dist-info/RECORD b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wrapt-1.14.2.dist-info/RECORD new file mode 100644 index 0000000000000000000000000000000000000000..d1432e78b3ab076fdce2bea29ce0f284441995e0 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wrapt-1.14.2.dist-info/RECORD @@ -0,0 +1,17 @@ +wrapt-1.14.2.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4 +wrapt-1.14.2.dist-info/METADATA,sha256=4KiBz7H6ww1g-EOIKDreiopNBsYKjtHXUKgxNwJD3PY,6473 +wrapt-1.14.2.dist-info/RECORD,, +wrapt-1.14.2.dist-info/WHEEL,sha256=YEyko93MSH4KMaRG6eOab49RUU6QVcyYoGlmjzyr8Qc,186 +wrapt-1.14.2.dist-info/licenses/LICENSE,sha256=d9KpFZz_4SRz9TmnGj50HzURfmG_0AXr1gw6F3jiwfE,1304 +wrapt-1.14.2.dist-info/top_level.txt,sha256=Jf7kcuXtwjUJMwOL0QzALDg2WiSiXiH9ThKMjN64DW0,6 +wrapt/__init__.py,sha256=dEsR9-8YVESvI4gxosTGF56ZUw07V2nOMSRcokY3tOM,1200 +wrapt/__pycache__/__init__.cpython-310.pyc,, +wrapt/__pycache__/arguments.cpython-310.pyc,, +wrapt/__pycache__/decorators.cpython-310.pyc,, +wrapt/__pycache__/importer.cpython-310.pyc,, +wrapt/__pycache__/wrappers.cpython-310.pyc,, +wrapt/_wrappers.cpython-310-x86_64-linux-gnu.so,sha256=2s5I4G-Y-271DgFt9-ylyflBqr95bMGK9OQ0HX7Z9QM,186656 +wrapt/arguments.py,sha256=RF0nTEdPzPIewJ-jnSY42i4JSzK3ctjPABV1SJxLymg,1746 +wrapt/decorators.py,sha256=gNy1PVq9NNVDAB9tujaAVhb0xtVKSSzqT-hdGFeWM34,21332 +wrapt/importer.py,sha256=yxFgVg6-lRTbSVJ2oZbw1TPCtB98fIF4A_qi_Dh2JRc,9981 +wrapt/wrappers.py,sha256=cckjgzvfj08P-8PWp2fkkJNVas-bn4NDypdPB5p9Lio,35521 diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wrapt-1.14.2.dist-info/WHEEL b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wrapt-1.14.2.dist-info/WHEEL new file mode 100644 index 0000000000000000000000000000000000000000..4b66e2eab6ce2489fc050e63c817e1edd30aa310 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wrapt-1.14.2.dist-info/WHEEL @@ -0,0 +1,7 @@ +Wheel-Version: 1.0 +Generator: setuptools (80.9.0) +Root-Is-Purelib: false +Tag: cp310-cp310-manylinux_2_5_x86_64 +Tag: cp310-cp310-manylinux1_x86_64 +Tag: cp310-cp310-manylinux_2_28_x86_64 + diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wrapt-1.14.2.dist-info/licenses/LICENSE b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wrapt-1.14.2.dist-info/licenses/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..1cc5117247e608d405a00083931d4202bb76e7cd --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wrapt-1.14.2.dist-info/licenses/LICENSE @@ -0,0 +1,24 @@ +Copyright (c) 2013-2022, Graham Dumpleton +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/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wrapt-1.14.2.dist-info/top_level.txt b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wrapt-1.14.2.dist-info/top_level.txt new file mode 100644 index 0000000000000000000000000000000000000000..ba11553ab9e90bd2fc2366e2d157f5bf947d80d5 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wrapt-1.14.2.dist-info/top_level.txt @@ -0,0 +1 @@ +wrapt diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wrapt/__init__.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wrapt/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..4f8c2acb4a7d051155c053de8e116c47f845f792 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wrapt/__init__.py @@ -0,0 +1,27 @@ +__version_info__ = ('1', '14', '2') +__version__ = '.'.join(__version_info__) + +from .wrappers import (ObjectProxy, CallableObjectProxy, FunctionWrapper, + BoundFunctionWrapper, WeakFunctionProxy, PartialCallableObjectProxy, + resolve_path, apply_patch, wrap_object, wrap_object_attribute, + function_wrapper, wrap_function_wrapper, patch_function_wrapper, + transient_function_wrapper) + +from .decorators import (adapter_factory, AdapterFactory, decorator, + synchronized) + +from .importer import (register_post_import_hook, when_imported, + notify_module_loaded, discover_post_import_hooks) + +# Import of inspect.getcallargs() included for backward compatibility. An +# implementation of this was previously bundled and made available here for +# Python <2.7. Avoid using this in future. + +from inspect import getcallargs + +# Variant of inspect.formatargspec() included here for forward compatibility. +# This is being done because Python 3.11 dropped inspect.formatargspec() but +# code for handling signature changing decorators relied on it. Exposing the +# bundled implementation here in case any user of wrapt was also needing it. + +from .arguments import formatargspec diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wrapt/arguments.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wrapt/arguments.py new file mode 100644 index 0000000000000000000000000000000000000000..032bc059e003c43b871d4dfe523ceb60881d2140 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wrapt/arguments.py @@ -0,0 +1,38 @@ +# The inspect.formatargspec() function was dropped in Python 3.11 but we need +# need it for when constructing signature changing decorators based on result of +# inspect.getargspec() or inspect.getfullargspec(). The code here implements +# inspect.formatargspec() base on Parameter and Signature from inspect module, +# which were added in Python 3.6. Thanks to Cyril Jouve for the implementation. + +try: + from inspect import Parameter, Signature +except ImportError: + from inspect import formatargspec +else: + def formatargspec(args, varargs=None, varkw=None, defaults=None, + kwonlyargs=(), kwonlydefaults={}, annotations={}): + if kwonlydefaults is None: + kwonlydefaults = {} + ndefaults = len(defaults) if defaults else 0 + parameters = [ + Parameter( + arg, + Parameter.POSITIONAL_OR_KEYWORD, + default=defaults[i] if i >= 0 else Parameter.empty, + annotation=annotations.get(arg, Parameter.empty), + ) for i, arg in enumerate(args, ndefaults - len(args)) + ] + if varargs: + parameters.append(Parameter(varargs, Parameter.VAR_POSITIONAL)) + parameters.extend( + Parameter( + kwonlyarg, + Parameter.KEYWORD_ONLY, + default=kwonlydefaults.get(kwonlyarg, Parameter.empty), + annotation=annotations.get(kwonlyarg, Parameter.empty), + ) for kwonlyarg in kwonlyargs + ) + if varkw: + parameters.append(Parameter(varkw, Parameter.VAR_KEYWORD)) + return_annotation = annotations.get('return', Signature.empty) + return str(Signature(parameters, return_annotation=return_annotation)) \ No newline at end of file diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wrapt/decorators.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wrapt/decorators.py new file mode 100644 index 0000000000000000000000000000000000000000..c3f2547295a815f8e0b377bfdc90b3838de84726 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wrapt/decorators.py @@ -0,0 +1,541 @@ +"""This module implements decorators for implementing other decorators +as well as some commonly used decorators. + +""" + +import sys + +PY2 = sys.version_info[0] == 2 + +if PY2: + string_types = basestring, + + def exec_(_code_, _globs_=None, _locs_=None): + """Execute code in a namespace.""" + if _globs_ is None: + frame = sys._getframe(1) + _globs_ = frame.f_globals + if _locs_ is None: + _locs_ = frame.f_locals + del frame + elif _locs_ is None: + _locs_ = _globs_ + exec("""exec _code_ in _globs_, _locs_""") + +else: + string_types = str, + + import builtins + + exec_ = getattr(builtins, "exec") + del builtins + +from functools import partial +from inspect import isclass +from threading import Lock, RLock + +from .arguments import formatargspec + +try: + from inspect import signature +except ImportError: + pass + +from .wrappers import (FunctionWrapper, BoundFunctionWrapper, ObjectProxy, + CallableObjectProxy) + +# Adapter wrapper for the wrapped function which will overlay certain +# properties from the adapter function onto the wrapped function so that +# functions such as inspect.getargspec(), inspect.getfullargspec(), +# inspect.signature() and inspect.getsource() return the correct results +# one would expect. + +class _AdapterFunctionCode(CallableObjectProxy): + + def __init__(self, wrapped_code, adapter_code): + super(_AdapterFunctionCode, self).__init__(wrapped_code) + self._self_adapter_code = adapter_code + + @property + def co_argcount(self): + return self._self_adapter_code.co_argcount + + @property + def co_code(self): + return self._self_adapter_code.co_code + + @property + def co_flags(self): + return self._self_adapter_code.co_flags + + @property + def co_kwonlyargcount(self): + return self._self_adapter_code.co_kwonlyargcount + + @property + def co_varnames(self): + return self._self_adapter_code.co_varnames + +class _AdapterFunctionSurrogate(CallableObjectProxy): + + def __init__(self, wrapped, adapter): + super(_AdapterFunctionSurrogate, self).__init__(wrapped) + self._self_adapter = adapter + + @property + def __code__(self): + return _AdapterFunctionCode(self.__wrapped__.__code__, + self._self_adapter.__code__) + + @property + def __defaults__(self): + return self._self_adapter.__defaults__ + + @property + def __kwdefaults__(self): + return self._self_adapter.__kwdefaults__ + + @property + def __signature__(self): + if 'signature' not in globals(): + return self._self_adapter.__signature__ + else: + return signature(self._self_adapter) + + if PY2: + func_code = __code__ + func_defaults = __defaults__ + +class _BoundAdapterWrapper(BoundFunctionWrapper): + + @property + def __func__(self): + return _AdapterFunctionSurrogate(self.__wrapped__.__func__, + self._self_parent._self_adapter) + + @property + def __signature__(self): + if 'signature' not in globals(): + return self.__wrapped__.__signature__ + else: + return signature(self._self_parent._self_adapter) + + if PY2: + im_func = __func__ + +class AdapterWrapper(FunctionWrapper): + + __bound_function_wrapper__ = _BoundAdapterWrapper + + def __init__(self, *args, **kwargs): + adapter = kwargs.pop('adapter') + super(AdapterWrapper, self).__init__(*args, **kwargs) + self._self_surrogate = _AdapterFunctionSurrogate( + self.__wrapped__, adapter) + self._self_adapter = adapter + + @property + def __code__(self): + return self._self_surrogate.__code__ + + @property + def __defaults__(self): + return self._self_surrogate.__defaults__ + + @property + def __kwdefaults__(self): + return self._self_surrogate.__kwdefaults__ + + if PY2: + func_code = __code__ + func_defaults = __defaults__ + + @property + def __signature__(self): + return self._self_surrogate.__signature__ + +class AdapterFactory(object): + def __call__(self, wrapped): + raise NotImplementedError() + +class DelegatedAdapterFactory(AdapterFactory): + def __init__(self, factory): + super(DelegatedAdapterFactory, self).__init__() + self.factory = factory + def __call__(self, wrapped): + return self.factory(wrapped) + +adapter_factory = DelegatedAdapterFactory + +# Decorator for creating other decorators. This decorator and the +# wrappers which they use are designed to properly preserve any name +# attributes, function signatures etc, in addition to the wrappers +# themselves acting like a transparent proxy for the original wrapped +# function so the wrapper is effectively indistinguishable from the +# original wrapped function. + +def decorator(wrapper=None, enabled=None, adapter=None, proxy=FunctionWrapper): + # The decorator should be supplied with a single positional argument + # which is the wrapper function to be used to implement the + # decorator. This may be preceded by a step whereby the keyword + # arguments are supplied to customise the behaviour of the + # decorator. The 'adapter' argument is used to optionally denote a + # separate function which is notionally used by an adapter + # decorator. In that case parts of the function '__code__' and + # '__defaults__' attributes are used from the adapter function + # rather than those of the wrapped function. This allows for the + # argument specification from inspect.getfullargspec() and similar + # functions to be overridden with a prototype for a different + # function than what was wrapped. The 'enabled' argument provides a + # way to enable/disable the use of the decorator. If the type of + # 'enabled' is a boolean, then it is evaluated immediately and the + # wrapper not even applied if it is False. If not a boolean, it will + # be evaluated when the wrapper is called for an unbound wrapper, + # and when binding occurs for a bound wrapper. When being evaluated, + # if 'enabled' is callable it will be called to obtain the value to + # be checked. If False, the wrapper will not be called and instead + # the original wrapped function will be called directly instead. + # The 'proxy' argument provides a way of passing a custom version of + # the FunctionWrapper class used in decorating the function. + + if wrapper is not None: + # Helper function for creating wrapper of the appropriate + # time when we need it down below. + + def _build(wrapped, wrapper, enabled=None, adapter=None): + if adapter: + if isinstance(adapter, AdapterFactory): + adapter = adapter(wrapped) + + if not callable(adapter): + ns = {} + + # Check if the signature argument specification has + # annotations. If it does then we need to remember + # it but also drop it when attempting to manufacture + # a standin adapter function. This is necessary else + # it will try and look up any types referenced in + # the annotations in the empty namespace we use, + # which will fail. + + annotations = {} + + if not isinstance(adapter, string_types): + if len(adapter) == 7: + annotations = adapter[-1] + adapter = adapter[:-1] + adapter = formatargspec(*adapter) + + exec_('def adapter{}: pass'.format(adapter), ns, ns) + adapter = ns['adapter'] + + # Override the annotations for the manufactured + # adapter function so they match the original + # adapter signature argument specification. + + if annotations: + adapter.__annotations__ = annotations + + return AdapterWrapper(wrapped=wrapped, wrapper=wrapper, + enabled=enabled, adapter=adapter) + + return proxy(wrapped=wrapped, wrapper=wrapper, enabled=enabled) + + # The wrapper has been provided so return the final decorator. + # The decorator is itself one of our function wrappers so we + # can determine when it is applied to functions, instance methods + # or class methods. This allows us to bind the instance or class + # method so the appropriate self or cls attribute is supplied + # when it is finally called. + + def _wrapper(wrapped, instance, args, kwargs): + # We first check for the case where the decorator was applied + # to a class type. + # + # @decorator + # class mydecoratorclass(object): + # def __init__(self, arg=None): + # self.arg = arg + # def __call__(self, wrapped, instance, args, kwargs): + # return wrapped(*args, **kwargs) + # + # @mydecoratorclass(arg=1) + # def function(): + # pass + # + # In this case an instance of the class is to be used as the + # decorator wrapper function. If args was empty at this point, + # then it means that there were optional keyword arguments + # supplied to be used when creating an instance of the class + # to be used as the wrapper function. + + if instance is None and isclass(wrapped) and not args: + # We still need to be passed the target function to be + # wrapped as yet, so we need to return a further function + # to be able to capture it. + + def _capture(target_wrapped): + # Now have the target function to be wrapped and need + # to create an instance of the class which is to act + # as the decorator wrapper function. Before we do that, + # we need to first check that use of the decorator + # hadn't been disabled by a simple boolean. If it was, + # the target function to be wrapped is returned instead. + + _enabled = enabled + if type(_enabled) is bool: + if not _enabled: + return target_wrapped + _enabled = None + + # Now create an instance of the class which is to act + # as the decorator wrapper function. Any arguments had + # to be supplied as keyword only arguments so that is + # all we pass when creating it. + + target_wrapper = wrapped(**kwargs) + + # Finally build the wrapper itself and return it. + + return _build(target_wrapped, target_wrapper, + _enabled, adapter) + + return _capture + + # We should always have the target function to be wrapped at + # this point as the first (and only) value in args. + + target_wrapped = args[0] + + # Need to now check that use of the decorator hadn't been + # disabled by a simple boolean. If it was, then target + # function to be wrapped is returned instead. + + _enabled = enabled + if type(_enabled) is bool: + if not _enabled: + return target_wrapped + _enabled = None + + # We now need to build the wrapper, but there are a couple of + # different cases we need to consider. + + if instance is None: + if isclass(wrapped): + # In this case the decorator was applied to a class + # type but optional keyword arguments were not supplied + # for initialising an instance of the class to be used + # as the decorator wrapper function. + # + # @decorator + # class mydecoratorclass(object): + # def __init__(self, arg=None): + # self.arg = arg + # def __call__(self, wrapped, instance, + # args, kwargs): + # return wrapped(*args, **kwargs) + # + # @mydecoratorclass + # def function(): + # pass + # + # We still need to create an instance of the class to + # be used as the decorator wrapper function, but no + # arguments are pass. + + target_wrapper = wrapped() + + else: + # In this case the decorator was applied to a normal + # function, or possibly a static method of a class. + # + # @decorator + # def mydecoratorfuntion(wrapped, instance, + # args, kwargs): + # return wrapped(*args, **kwargs) + # + # @mydecoratorfunction + # def function(): + # pass + # + # That normal function becomes the decorator wrapper + # function. + + target_wrapper = wrapper + + else: + if isclass(instance): + # In this case the decorator was applied to a class + # method. + # + # class myclass(object): + # @decorator + # @classmethod + # def decoratorclassmethod(cls, wrapped, + # instance, args, kwargs): + # return wrapped(*args, **kwargs) + # + # instance = myclass() + # + # @instance.decoratorclassmethod + # def function(): + # pass + # + # This one is a bit strange because binding was actually + # performed on the wrapper created by our decorator + # factory. We need to apply that binding to the decorator + # wrapper function that the decorator factory + # was applied to. + + target_wrapper = wrapper.__get__(None, instance) + + else: + # In this case the decorator was applied to an instance + # method. + # + # class myclass(object): + # @decorator + # def decoratorclassmethod(self, wrapped, + # instance, args, kwargs): + # return wrapped(*args, **kwargs) + # + # instance = myclass() + # + # @instance.decoratorclassmethod + # def function(): + # pass + # + # This one is a bit strange because binding was actually + # performed on the wrapper created by our decorator + # factory. We need to apply that binding to the decorator + # wrapper function that the decorator factory + # was applied to. + + target_wrapper = wrapper.__get__(instance, type(instance)) + + # Finally build the wrapper itself and return it. + + return _build(target_wrapped, target_wrapper, _enabled, adapter) + + # We first return our magic function wrapper here so we can + # determine in what context the decorator factory was used. In + # other words, it is itself a universal decorator. The decorator + # function is used as the adapter so that linters see a signature + # corresponding to the decorator and not the wrapper it is being + # applied to. + + return _build(wrapper, _wrapper, adapter=decorator) + + else: + # The wrapper still has not been provided, so we are just + # collecting the optional keyword arguments. Return the + # decorator again wrapped in a partial using the collected + # arguments. + + return partial(decorator, enabled=enabled, adapter=adapter, + proxy=proxy) + +# Decorator for implementing thread synchronization. It can be used as a +# decorator, in which case the synchronization context is determined by +# what type of function is wrapped, or it can also be used as a context +# manager, where the user needs to supply the correct synchronization +# context. It is also possible to supply an object which appears to be a +# synchronization primitive of some sort, by virtue of having release() +# and acquire() methods. In that case that will be used directly as the +# synchronization primitive without creating a separate lock against the +# derived or supplied context. + +def synchronized(wrapped): + # Determine if being passed an object which is a synchronization + # primitive. We can't check by type for Lock, RLock, Semaphore etc, + # as the means of creating them isn't the type. Therefore use the + # existence of acquire() and release() methods. This is more + # extensible anyway as it allows custom synchronization mechanisms. + + if hasattr(wrapped, 'acquire') and hasattr(wrapped, 'release'): + # We remember what the original lock is and then return a new + # decorator which accesses and locks it. When returning the new + # decorator we wrap it with an object proxy so we can override + # the context manager methods in case it is being used to wrap + # synchronized statements with a 'with' statement. + + lock = wrapped + + @decorator + def _synchronized(wrapped, instance, args, kwargs): + # Execute the wrapped function while the original supplied + # lock is held. + + with lock: + return wrapped(*args, **kwargs) + + class _PartialDecorator(CallableObjectProxy): + + def __enter__(self): + lock.acquire() + return lock + + def __exit__(self, *args): + lock.release() + + return _PartialDecorator(wrapped=_synchronized) + + # Following only apply when the lock is being created automatically + # based on the context of what was supplied. In this case we supply + # a final decorator, but need to use FunctionWrapper directly as we + # want to derive from it to add context manager methods in case it is + # being used to wrap synchronized statements with a 'with' statement. + + def _synchronized_lock(context): + # Attempt to retrieve the lock for the specific context. + + lock = vars(context).get('_synchronized_lock', None) + + if lock is None: + # There is no existing lock defined for the context we + # are dealing with so we need to create one. This needs + # to be done in a way to guarantee there is only one + # created, even if multiple threads try and create it at + # the same time. We can't always use the setdefault() + # method on the __dict__ for the context. This is the + # case where the context is a class, as __dict__ is + # actually a dictproxy. What we therefore do is use a + # meta lock on this wrapper itself, to control the + # creation and assignment of the lock attribute against + # the context. + + with synchronized._synchronized_meta_lock: + # We need to check again for whether the lock we want + # exists in case two threads were trying to create it + # at the same time and were competing to create the + # meta lock. + + lock = vars(context).get('_synchronized_lock', None) + + if lock is None: + lock = RLock() + setattr(context, '_synchronized_lock', lock) + + return lock + + def _synchronized_wrapper(wrapped, instance, args, kwargs): + # Execute the wrapped function while the lock for the + # desired context is held. If instance is None then the + # wrapped function is used as the context. + + with _synchronized_lock(instance if instance is not None else wrapped): + return wrapped(*args, **kwargs) + + class _FinalDecorator(FunctionWrapper): + + def __enter__(self): + self._self_lock = _synchronized_lock(self.__wrapped__) + self._self_lock.acquire() + return self._self_lock + + def __exit__(self, *args): + self._self_lock.release() + + return _FinalDecorator(wrapped=wrapped, wrapper=_synchronized_wrapper) + +synchronized._synchronized_meta_lock = Lock() diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wrapt/importer.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wrapt/importer.py new file mode 100644 index 0000000000000000000000000000000000000000..5c4d4cc66302362adfbb9da74f4b87f9cc158223 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wrapt/importer.py @@ -0,0 +1,286 @@ +"""This module implements a post import hook mechanism styled after what is +described in PEP-369. Note that it doesn't cope with modules being reloaded. + +""" + +import sys +import threading + +PY2 = sys.version_info[0] == 2 + +if PY2: + string_types = basestring, + find_spec = None +else: + string_types = str, + from importlib.util import find_spec + +from .decorators import synchronized + +# The dictionary registering any post import hooks to be triggered once +# the target module has been imported. Once a module has been imported +# and the hooks fired, the list of hooks recorded against the target +# module will be truncated but the list left in the dictionary. This +# acts as a flag to indicate that the module had already been imported. + +_post_import_hooks = {} +_post_import_hooks_init = False +_post_import_hooks_lock = threading.RLock() + +# Register a new post import hook for the target module name. This +# differs from the PEP-369 implementation in that it also allows the +# hook function to be specified as a string consisting of the name of +# the callback in the form 'module:function'. This will result in a +# proxy callback being registered which will defer loading of the +# specified module containing the callback function until required. + +def _create_import_hook_from_string(name): + def import_hook(module): + module_name, function = name.split(':') + attrs = function.split('.') + __import__(module_name) + callback = sys.modules[module_name] + for attr in attrs: + callback = getattr(callback, attr) + return callback(module) + return import_hook + +@synchronized(_post_import_hooks_lock) +def register_post_import_hook(hook, name): + # Create a deferred import hook if hook is a string name rather than + # a callable function. + + if isinstance(hook, string_types): + hook = _create_import_hook_from_string(hook) + + # Automatically install the import hook finder if it has not already + # been installed. + + global _post_import_hooks_init + + if not _post_import_hooks_init: + _post_import_hooks_init = True + sys.meta_path.insert(0, ImportHookFinder()) + + # Determine if any prior registration of a post import hook for + # the target modules has occurred and act appropriately. + + hooks = _post_import_hooks.get(name, None) + + if hooks is None: + # No prior registration of post import hooks for the target + # module. We need to check whether the module has already been + # imported. If it has we fire the hook immediately and add an + # empty list to the registry to indicate that the module has + # already been imported and hooks have fired. Otherwise add + # the post import hook to the registry. + + module = sys.modules.get(name, None) + + if module is not None: + _post_import_hooks[name] = [] + hook(module) + + else: + _post_import_hooks[name] = [hook] + + elif hooks == []: + # A prior registration of port import hooks for the target + # module was done and the hooks already fired. Fire the hook + # immediately. + + module = sys.modules[name] + hook(module) + + else: + # A prior registration of port import hooks for the target + # module was done but the module has not yet been imported. + + _post_import_hooks[name].append(hook) + +# Register post import hooks defined as package entry points. + +def _create_import_hook_from_entrypoint(entrypoint): + def import_hook(module): + __import__(entrypoint.module_name) + callback = sys.modules[entrypoint.module_name] + for attr in entrypoint.attrs: + callback = getattr(callback, attr) + return callback(module) + return import_hook + +def discover_post_import_hooks(group): + try: + import pkg_resources + except ImportError: + return + + for entrypoint in pkg_resources.iter_entry_points(group=group): + callback = _create_import_hook_from_entrypoint(entrypoint) + register_post_import_hook(callback, entrypoint.name) + +# Indicate that a module has been loaded. Any post import hooks which +# were registered against the target module will be invoked. If an +# exception is raised in any of the post import hooks, that will cause +# the import of the target module to fail. + +@synchronized(_post_import_hooks_lock) +def notify_module_loaded(module): + name = getattr(module, '__name__', None) + hooks = _post_import_hooks.get(name, None) + + if hooks: + _post_import_hooks[name] = [] + + for hook in hooks: + hook(module) + +# A custom module import finder. This intercepts attempts to import +# modules and watches out for attempts to import target modules of +# interest. When a module of interest is imported, then any post import +# hooks which are registered will be invoked. + +class _ImportHookLoader: + + def load_module(self, fullname): + module = sys.modules[fullname] + notify_module_loaded(module) + + return module + +class _ImportHookChainedLoader: + + def __init__(self, loader): + self.loader = loader + + if hasattr(loader, "load_module"): + self.load_module = self._load_module + if hasattr(loader, "create_module"): + self.create_module = self._create_module + if hasattr(loader, "exec_module"): + self.exec_module = self._exec_module + + def _load_module(self, fullname): + module = self.loader.load_module(fullname) + notify_module_loaded(module) + + return module + + # Python 3.4 introduced create_module() and exec_module() instead of + # load_module() alone. Splitting the two steps. + + def _create_module(self, spec): + return self.loader.create_module(spec) + + def _exec_module(self, module): + self.loader.exec_module(module) + notify_module_loaded(module) + +class ImportHookFinder: + + def __init__(self): + self.in_progress = {} + + @synchronized(_post_import_hooks_lock) + def find_module(self, fullname, path=None): + # If the module being imported is not one we have registered + # post import hooks for, we can return immediately. We will + # take no further part in the importing of this module. + + if not fullname in _post_import_hooks: + return None + + # When we are interested in a specific module, we will call back + # into the import system a second time to defer to the import + # finder that is supposed to handle the importing of the module. + # We set an in progress flag for the target module so that on + # the second time through we don't trigger another call back + # into the import system and cause a infinite loop. + + if fullname in self.in_progress: + return None + + self.in_progress[fullname] = True + + # Now call back into the import system again. + + try: + if not find_spec: + # For Python 2 we don't have much choice but to + # call back in to __import__(). This will + # actually cause the module to be imported. If no + # module could be found then ImportError will be + # raised. Otherwise we return a loader which + # returns the already loaded module and invokes + # the post import hooks. + + __import__(fullname) + + return _ImportHookLoader() + + else: + # For Python 3 we need to use find_spec().loader + # from the importlib.util module. It doesn't actually + # import the target module and only finds the + # loader. If a loader is found, we need to return + # our own loader which will then in turn call the + # real loader to import the module and invoke the + # post import hooks. + + loader = getattr(find_spec(fullname), "loader", None) + + if loader and not isinstance(loader, _ImportHookChainedLoader): + return _ImportHookChainedLoader(loader) + + finally: + del self.in_progress[fullname] + + def find_spec(self, fullname, path=None, target=None): + # Since Python 3.4, you are meant to implement find_spec() method + # instead of find_module() and since Python 3.10 you get deprecation + # warnings if you don't define find_spec(). + + # If the module being imported is not one we have registered + # post import hooks for, we can return immediately. We will + # take no further part in the importing of this module. + + if not fullname in _post_import_hooks: + return None + + # When we are interested in a specific module, we will call back + # into the import system a second time to defer to the import + # finder that is supposed to handle the importing of the module. + # We set an in progress flag for the target module so that on + # the second time through we don't trigger another call back + # into the import system and cause a infinite loop. + + if fullname in self.in_progress: + return None + + self.in_progress[fullname] = True + + # Now call back into the import system again. + + try: + # This should only be Python 3 so find_spec() should always + # exist so don't need to check. + + spec = find_spec(fullname) + loader = getattr(spec, "loader", None) + + if loader and not isinstance(loader, _ImportHookChainedLoader): + spec.loader = _ImportHookChainedLoader(loader) + + return spec + + finally: + del self.in_progress[fullname] + +# Decorator for marking that a function should be called as a post +# import hook when the target module is imported. + +def when_imported(name): + def register(hook): + register_post_import_hook(hook, name) + return hook + return register diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wrapt/wrappers.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wrapt/wrappers.py new file mode 100644 index 0000000000000000000000000000000000000000..2716cd1da1a5fbb4f260b5344b3ec6c37ea2c6b2 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wrapt/wrappers.py @@ -0,0 +1,986 @@ +import os +import sys +import functools +import operator +import weakref +import inspect + +PY2 = sys.version_info[0] == 2 + +if PY2: + string_types = basestring, +else: + string_types = str, + +def with_metaclass(meta, *bases): + """Create a base class with a metaclass.""" + return meta("NewBase", bases, {}) + +class _ObjectProxyMethods(object): + + # We use properties to override the values of __module__ and + # __doc__. If we add these in ObjectProxy, the derived class + # __dict__ will still be setup to have string variants of these + # attributes and the rules of descriptors means that they appear to + # take precedence over the properties in the base class. To avoid + # that, we copy the properties into the derived class type itself + # via a meta class. In that way the properties will always take + # precedence. + + @property + def __module__(self): + return self.__wrapped__.__module__ + + @__module__.setter + def __module__(self, value): + self.__wrapped__.__module__ = value + + @property + def __doc__(self): + return self.__wrapped__.__doc__ + + @__doc__.setter + def __doc__(self, value): + self.__wrapped__.__doc__ = value + + # We similar use a property for __dict__. We need __dict__ to be + # explicit to ensure that vars() works as expected. + + @property + def __dict__(self): + return self.__wrapped__.__dict__ + + # Need to also propagate the special __weakref__ attribute for case + # where decorating classes which will define this. If do not define + # it and use a function like inspect.getmembers() on a decorator + # class it will fail. This can't be in the derived classes. + + @property + def __weakref__(self): + return self.__wrapped__.__weakref__ + +class _ObjectProxyMetaType(type): + def __new__(cls, name, bases, dictionary): + # Copy our special properties into the class so that they + # always take precedence over attributes of the same name added + # during construction of a derived class. This is to save + # duplicating the implementation for them in all derived classes. + + dictionary.update(vars(_ObjectProxyMethods)) + + return type.__new__(cls, name, bases, dictionary) + +class ObjectProxy(with_metaclass(_ObjectProxyMetaType)): + + __slots__ = '__wrapped__' + + def __init__(self, wrapped): + object.__setattr__(self, '__wrapped__', wrapped) + + # Python 3.2+ has the __qualname__ attribute, but it does not + # allow it to be overridden using a property and it must instead + # be an actual string object instead. + + try: + object.__setattr__(self, '__qualname__', wrapped.__qualname__) + except AttributeError: + pass + + # Python 3.10 onwards also does not allow itself to be overridden + # using a property and it must instead be set explicitly. + + try: + object.__setattr__(self, '__annotations__', wrapped.__annotations__) + except AttributeError: + pass + + @property + def __name__(self): + return self.__wrapped__.__name__ + + @__name__.setter + def __name__(self, value): + self.__wrapped__.__name__ = value + + @property + def __class__(self): + return self.__wrapped__.__class__ + + @__class__.setter + def __class__(self, value): + self.__wrapped__.__class__ = value + + def __dir__(self): + return dir(self.__wrapped__) + + def __str__(self): + return str(self.__wrapped__) + + if not PY2: + def __bytes__(self): + return bytes(self.__wrapped__) + + def __repr__(self): + return '<{} at 0x{:x} for {} at 0x{:x}>'.format( + type(self).__name__, id(self), + type(self.__wrapped__).__name__, + id(self.__wrapped__)) + + def __reversed__(self): + return reversed(self.__wrapped__) + + if not PY2: + def __round__(self): + return round(self.__wrapped__) + + if sys.hexversion >= 0x03070000: + def __mro_entries__(self, bases): + return (self.__wrapped__,) + + def __lt__(self, other): + return self.__wrapped__ < other + + def __le__(self, other): + return self.__wrapped__ <= other + + def __eq__(self, other): + return self.__wrapped__ == other + + def __ne__(self, other): + return self.__wrapped__ != other + + def __gt__(self, other): + return self.__wrapped__ > other + + def __ge__(self, other): + return self.__wrapped__ >= other + + def __hash__(self): + return hash(self.__wrapped__) + + def __nonzero__(self): + return bool(self.__wrapped__) + + def __bool__(self): + return bool(self.__wrapped__) + + def __setattr__(self, name, value): + if name.startswith('_self_'): + object.__setattr__(self, name, value) + + elif name == '__wrapped__': + object.__setattr__(self, name, value) + try: + object.__delattr__(self, '__qualname__') + except AttributeError: + pass + try: + object.__setattr__(self, '__qualname__', value.__qualname__) + except AttributeError: + pass + try: + object.__delattr__(self, '__annotations__') + except AttributeError: + pass + try: + object.__setattr__(self, '__annotations__', value.__annotations__) + except AttributeError: + pass + + elif name == '__qualname__': + setattr(self.__wrapped__, name, value) + object.__setattr__(self, name, value) + + elif name == '__annotations__': + setattr(self.__wrapped__, name, value) + object.__setattr__(self, name, value) + + elif hasattr(type(self), name): + object.__setattr__(self, name, value) + + else: + setattr(self.__wrapped__, name, value) + + def __getattr__(self, name): + # If we are being to lookup '__wrapped__' then the + # '__init__()' method cannot have been called. + + if name == '__wrapped__': + raise ValueError('wrapper has not been initialised') + + return getattr(self.__wrapped__, name) + + def __delattr__(self, name): + if name.startswith('_self_'): + object.__delattr__(self, name) + + elif name == '__wrapped__': + raise TypeError('__wrapped__ must be an object') + + elif name == '__qualname__': + object.__delattr__(self, name) + delattr(self.__wrapped__, name) + + elif hasattr(type(self), name): + object.__delattr__(self, name) + + else: + delattr(self.__wrapped__, name) + + def __add__(self, other): + return self.__wrapped__ + other + + def __sub__(self, other): + return self.__wrapped__ - other + + def __mul__(self, other): + return self.__wrapped__ * other + + def __div__(self, other): + return operator.div(self.__wrapped__, other) + + def __truediv__(self, other): + return operator.truediv(self.__wrapped__, other) + + def __floordiv__(self, other): + return self.__wrapped__ // other + + def __mod__(self, other): + return self.__wrapped__ % other + + def __divmod__(self, other): + return divmod(self.__wrapped__, other) + + def __pow__(self, other, *args): + return pow(self.__wrapped__, other, *args) + + def __lshift__(self, other): + return self.__wrapped__ << other + + def __rshift__(self, other): + return self.__wrapped__ >> other + + def __and__(self, other): + return self.__wrapped__ & other + + def __xor__(self, other): + return self.__wrapped__ ^ other + + def __or__(self, other): + return self.__wrapped__ | other + + def __radd__(self, other): + return other + self.__wrapped__ + + def __rsub__(self, other): + return other - self.__wrapped__ + + def __rmul__(self, other): + return other * self.__wrapped__ + + def __rdiv__(self, other): + return operator.div(other, self.__wrapped__) + + def __rtruediv__(self, other): + return operator.truediv(other, self.__wrapped__) + + def __rfloordiv__(self, other): + return other // self.__wrapped__ + + def __rmod__(self, other): + return other % self.__wrapped__ + + def __rdivmod__(self, other): + return divmod(other, self.__wrapped__) + + def __rpow__(self, other, *args): + return pow(other, self.__wrapped__, *args) + + def __rlshift__(self, other): + return other << self.__wrapped__ + + def __rrshift__(self, other): + return other >> self.__wrapped__ + + def __rand__(self, other): + return other & self.__wrapped__ + + def __rxor__(self, other): + return other ^ self.__wrapped__ + + def __ror__(self, other): + return other | self.__wrapped__ + + def __iadd__(self, other): + self.__wrapped__ += other + return self + + def __isub__(self, other): + self.__wrapped__ -= other + return self + + def __imul__(self, other): + self.__wrapped__ *= other + return self + + def __idiv__(self, other): + self.__wrapped__ = operator.idiv(self.__wrapped__, other) + return self + + def __itruediv__(self, other): + self.__wrapped__ = operator.itruediv(self.__wrapped__, other) + return self + + def __ifloordiv__(self, other): + self.__wrapped__ //= other + return self + + def __imod__(self, other): + self.__wrapped__ %= other + return self + + def __ipow__(self, other): + self.__wrapped__ **= other + return self + + def __ilshift__(self, other): + self.__wrapped__ <<= other + return self + + def __irshift__(self, other): + self.__wrapped__ >>= other + return self + + def __iand__(self, other): + self.__wrapped__ &= other + return self + + def __ixor__(self, other): + self.__wrapped__ ^= other + return self + + def __ior__(self, other): + self.__wrapped__ |= other + return self + + def __neg__(self): + return -self.__wrapped__ + + def __pos__(self): + return +self.__wrapped__ + + def __abs__(self): + return abs(self.__wrapped__) + + def __invert__(self): + return ~self.__wrapped__ + + def __int__(self): + return int(self.__wrapped__) + + def __long__(self): + return long(self.__wrapped__) + + def __float__(self): + return float(self.__wrapped__) + + def __complex__(self): + return complex(self.__wrapped__) + + def __oct__(self): + return oct(self.__wrapped__) + + def __hex__(self): + return hex(self.__wrapped__) + + def __index__(self): + return operator.index(self.__wrapped__) + + def __len__(self): + return len(self.__wrapped__) + + def __contains__(self, value): + return value in self.__wrapped__ + + def __getitem__(self, key): + return self.__wrapped__[key] + + def __setitem__(self, key, value): + self.__wrapped__[key] = value + + def __delitem__(self, key): + del self.__wrapped__[key] + + def __getslice__(self, i, j): + return self.__wrapped__[i:j] + + def __setslice__(self, i, j, value): + self.__wrapped__[i:j] = value + + def __delslice__(self, i, j): + del self.__wrapped__[i:j] + + def __enter__(self): + return self.__wrapped__.__enter__() + + def __exit__(self, *args, **kwargs): + return self.__wrapped__.__exit__(*args, **kwargs) + + def __iter__(self): + return iter(self.__wrapped__) + + def __copy__(self): + raise NotImplementedError('object proxy must define __copy__()') + + def __deepcopy__(self, memo): + raise NotImplementedError('object proxy must define __deepcopy__()') + + def __reduce__(self): + raise NotImplementedError( + 'object proxy must define __reduce_ex__()') + + def __reduce_ex__(self, protocol): + raise NotImplementedError( + 'object proxy must define __reduce_ex__()') + +class CallableObjectProxy(ObjectProxy): + + def __call__(self, *args, **kwargs): + return self.__wrapped__(*args, **kwargs) + +class PartialCallableObjectProxy(ObjectProxy): + + def __init__(self, *args, **kwargs): + if len(args) < 1: + raise TypeError('partial type takes at least one argument') + + wrapped, args = args[0], args[1:] + + if not callable(wrapped): + raise TypeError('the first argument must be callable') + + super(PartialCallableObjectProxy, self).__init__(wrapped) + + self._self_args = args + self._self_kwargs = kwargs + + def __call__(self, *args, **kwargs): + _args = self._self_args + args + + _kwargs = dict(self._self_kwargs) + _kwargs.update(kwargs) + + return self.__wrapped__(*_args, **_kwargs) + +class _FunctionWrapperBase(ObjectProxy): + + __slots__ = ('_self_instance', '_self_wrapper', '_self_enabled', + '_self_binding', '_self_parent') + + def __init__(self, wrapped, instance, wrapper, enabled=None, + binding='function', parent=None): + + super(_FunctionWrapperBase, self).__init__(wrapped) + + object.__setattr__(self, '_self_instance', instance) + object.__setattr__(self, '_self_wrapper', wrapper) + object.__setattr__(self, '_self_enabled', enabled) + object.__setattr__(self, '_self_binding', binding) + object.__setattr__(self, '_self_parent', parent) + + def __get__(self, instance, owner): + # This method is actually doing double duty for both unbound and + # bound derived wrapper classes. It should possibly be broken up + # and the distinct functionality moved into the derived classes. + # Can't do that straight away due to some legacy code which is + # relying on it being here in this base class. + # + # The distinguishing attribute which determines whether we are + # being called in an unbound or bound wrapper is the parent + # attribute. If binding has never occurred, then the parent will + # be None. + # + # First therefore, is if we are called in an unbound wrapper. In + # this case we perform the binding. + # + # We have one special case to worry about here. This is where we + # are decorating a nested class. In this case the wrapped class + # would not have a __get__() method to call. In that case we + # simply return self. + # + # Note that we otherwise still do binding even if instance is + # None and accessing an unbound instance method from a class. + # This is because we need to be able to later detect that + # specific case as we will need to extract the instance from the + # first argument of those passed in. + + if self._self_parent is None: + if not inspect.isclass(self.__wrapped__): + descriptor = self.__wrapped__.__get__(instance, owner) + + return self.__bound_function_wrapper__(descriptor, instance, + self._self_wrapper, self._self_enabled, + self._self_binding, self) + + return self + + # Now we have the case of binding occurring a second time on what + # was already a bound function. In this case we would usually + # return ourselves again. This mirrors what Python does. + # + # The special case this time is where we were originally bound + # with an instance of None and we were likely an instance + # method. In that case we rebind against the original wrapped + # function from the parent again. + + if self._self_instance is None and self._self_binding == 'function': + descriptor = self._self_parent.__wrapped__.__get__( + instance, owner) + + return self._self_parent.__bound_function_wrapper__( + descriptor, instance, self._self_wrapper, + self._self_enabled, self._self_binding, + self._self_parent) + + return self + + def __call__(self, *args, **kwargs): + # If enabled has been specified, then evaluate it at this point + # and if the wrapper is not to be executed, then simply return + # the bound function rather than a bound wrapper for the bound + # function. When evaluating enabled, if it is callable we call + # it, otherwise we evaluate it as a boolean. + + if self._self_enabled is not None: + if callable(self._self_enabled): + if not self._self_enabled(): + return self.__wrapped__(*args, **kwargs) + elif not self._self_enabled: + return self.__wrapped__(*args, **kwargs) + + # This can occur where initial function wrapper was applied to + # a function that was already bound to an instance. In that case + # we want to extract the instance from the function and use it. + + if self._self_binding in ('function', 'classmethod'): + if self._self_instance is None: + instance = getattr(self.__wrapped__, '__self__', None) + if instance is not None: + return self._self_wrapper(self.__wrapped__, instance, + args, kwargs) + + # This is generally invoked when the wrapped function is being + # called as a normal function and is not bound to a class as an + # instance method. This is also invoked in the case where the + # wrapped function was a method, but this wrapper was in turn + # wrapped using the staticmethod decorator. + + return self._self_wrapper(self.__wrapped__, self._self_instance, + args, kwargs) + + def __set_name__(self, owner, name): + # This is a special method use to supply information to + # descriptors about what the name of variable in a class + # definition is. Not wanting to add this to ObjectProxy as not + # sure of broader implications of doing that. Thus restrict to + # FunctionWrapper used by decorators. + + if hasattr(self.__wrapped__, "__set_name__"): + self.__wrapped__.__set_name__(owner, name) + + def __instancecheck__(self, instance): + # This is a special method used by isinstance() to make checks + # instance of the `__wrapped__`. + return isinstance(instance, self.__wrapped__) + + def __subclasscheck__(self, subclass): + # This is a special method used by issubclass() to make checks + # about inheritance of classes. We need to upwrap any object + # proxy. Not wanting to add this to ObjectProxy as not sure of + # broader implications of doing that. Thus restrict to + # FunctionWrapper used by decorators. + + if hasattr(subclass, "__wrapped__"): + return issubclass(subclass.__wrapped__, self.__wrapped__) + else: + return issubclass(subclass, self.__wrapped__) + +class BoundFunctionWrapper(_FunctionWrapperBase): + + def __call__(self, *args, **kwargs): + # If enabled has been specified, then evaluate it at this point + # and if the wrapper is not to be executed, then simply return + # the bound function rather than a bound wrapper for the bound + # function. When evaluating enabled, if it is callable we call + # it, otherwise we evaluate it as a boolean. + + if self._self_enabled is not None: + if callable(self._self_enabled): + if not self._self_enabled(): + return self.__wrapped__(*args, **kwargs) + elif not self._self_enabled: + return self.__wrapped__(*args, **kwargs) + + # We need to do things different depending on whether we are + # likely wrapping an instance method vs a static method or class + # method. + + if self._self_binding == 'function': + if self._self_instance is None: + # This situation can occur where someone is calling the + # instancemethod via the class type and passing the instance + # as the first argument. We need to shift the args before + # making the call to the wrapper and effectively bind the + # instance to the wrapped function using a partial so the + # wrapper doesn't see anything as being different. + + if not args: + raise TypeError('missing 1 required positional argument') + + instance, args = args[0], args[1:] + wrapped = PartialCallableObjectProxy(self.__wrapped__, instance) + return self._self_wrapper(wrapped, instance, args, kwargs) + + return self._self_wrapper(self.__wrapped__, self._self_instance, + args, kwargs) + + else: + # As in this case we would be dealing with a classmethod or + # staticmethod, then _self_instance will only tell us whether + # when calling the classmethod or staticmethod they did it via an + # instance of the class it is bound to and not the case where + # done by the class type itself. We thus ignore _self_instance + # and use the __self__ attribute of the bound function instead. + # For a classmethod, this means instance will be the class type + # and for a staticmethod it will be None. This is probably the + # more useful thing we can pass through even though we loose + # knowledge of whether they were called on the instance vs the + # class type, as it reflects what they have available in the + # decoratored function. + + instance = getattr(self.__wrapped__, '__self__', None) + + return self._self_wrapper(self.__wrapped__, instance, args, + kwargs) + +class FunctionWrapper(_FunctionWrapperBase): + + __bound_function_wrapper__ = BoundFunctionWrapper + + def __init__(self, wrapped, wrapper, enabled=None): + # What it is we are wrapping here could be anything. We need to + # try and detect specific cases though. In particular, we need + # to detect when we are given something that is a method of a + # class. Further, we need to know when it is likely an instance + # method, as opposed to a class or static method. This can + # become problematic though as there isn't strictly a fool proof + # method of knowing. + # + # The situations we could encounter when wrapping a method are: + # + # 1. The wrapper is being applied as part of a decorator which + # is a part of the class definition. In this case what we are + # given is the raw unbound function, classmethod or staticmethod + # wrapper objects. + # + # The problem here is that we will not know we are being applied + # in the context of the class being set up. This becomes + # important later for the case of an instance method, because in + # that case we just see it as a raw function and can't + # distinguish it from wrapping a normal function outside of + # a class context. + # + # 2. The wrapper is being applied when performing monkey + # patching of the class type afterwards and the method to be + # wrapped was retrieved direct from the __dict__ of the class + # type. This is effectively the same as (1) above. + # + # 3. The wrapper is being applied when performing monkey + # patching of the class type afterwards and the method to be + # wrapped was retrieved from the class type. In this case + # binding will have been performed where the instance against + # which the method is bound will be None at that point. + # + # This case is a problem because we can no longer tell if the + # method was a static method, plus if using Python3, we cannot + # tell if it was an instance method as the concept of an + # unnbound method no longer exists. + # + # 4. The wrapper is being applied when performing monkey + # patching of an instance of a class. In this case binding will + # have been perfomed where the instance was not None. + # + # This case is a problem because we can no longer tell if the + # method was a static method. + # + # Overall, the best we can do is look at the original type of the + # object which was wrapped prior to any binding being done and + # see if it is an instance of classmethod or staticmethod. In + # the case where other decorators are between us and them, if + # they do not propagate the __class__ attribute so that the + # isinstance() checks works, then likely this will do the wrong + # thing where classmethod and staticmethod are used. + # + # Since it is likely to be very rare that anyone even puts + # decorators around classmethod and staticmethod, likelihood of + # that being an issue is very small, so we accept it and suggest + # that those other decorators be fixed. It is also only an issue + # if a decorator wants to actually do things with the arguments. + # + # As to not being able to identify static methods properly, we + # just hope that that isn't something people are going to want + # to wrap, or if they do suggest they do it the correct way by + # ensuring that it is decorated in the class definition itself, + # or patch it in the __dict__ of the class type. + # + # So to get the best outcome we can, whenever we aren't sure what + # it is, we label it as a 'function'. If it was already bound and + # that is rebound later, we assume that it will be an instance + # method and try an cope with the possibility that the 'self' + # argument it being passed as an explicit argument and shuffle + # the arguments around to extract 'self' for use as the instance. + + if isinstance(wrapped, classmethod): + binding = 'classmethod' + + elif isinstance(wrapped, staticmethod): + binding = 'staticmethod' + + elif hasattr(wrapped, '__self__'): + if inspect.isclass(wrapped.__self__): + binding = 'classmethod' + else: + binding = 'function' + + else: + binding = 'function' + + super(FunctionWrapper, self).__init__(wrapped, None, wrapper, + enabled, binding) + +try: + if not os.environ.get('WRAPT_DISABLE_EXTENSIONS'): + from ._wrappers import (ObjectProxy, CallableObjectProxy, + PartialCallableObjectProxy, FunctionWrapper, + BoundFunctionWrapper, _FunctionWrapperBase) +except ImportError: + pass + +# Helper functions for applying wrappers to existing functions. + +def resolve_path(module, name): + if isinstance(module, string_types): + __import__(module) + module = sys.modules[module] + + parent = module + + path = name.split('.') + attribute = path[0] + + # We can't just always use getattr() because in doing + # that on a class it will cause binding to occur which + # will complicate things later and cause some things not + # to work. For the case of a class we therefore access + # the __dict__ directly. To cope though with the wrong + # class being given to us, or a method being moved into + # a base class, we need to walk the class hierarchy to + # work out exactly which __dict__ the method was defined + # in, as accessing it from __dict__ will fail if it was + # not actually on the class given. Fallback to using + # getattr() if we can't find it. If it truly doesn't + # exist, then that will fail. + + def lookup_attribute(parent, attribute): + if inspect.isclass(parent): + for cls in inspect.getmro(parent): + if attribute in vars(cls): + return vars(cls)[attribute] + else: + return getattr(parent, attribute) + else: + return getattr(parent, attribute) + + original = lookup_attribute(parent, attribute) + + for attribute in path[1:]: + parent = original + original = lookup_attribute(parent, attribute) + + return (parent, attribute, original) + +def apply_patch(parent, attribute, replacement): + setattr(parent, attribute, replacement) + +def wrap_object(module, name, factory, args=(), kwargs={}): + (parent, attribute, original) = resolve_path(module, name) + wrapper = factory(original, *args, **kwargs) + apply_patch(parent, attribute, wrapper) + return wrapper + +# Function for applying a proxy object to an attribute of a class +# instance. The wrapper works by defining an attribute of the same name +# on the class which is a descriptor and which intercepts access to the +# instance attribute. Note that this cannot be used on attributes which +# are themselves defined by a property object. + +class AttributeWrapper(object): + + def __init__(self, attribute, factory, args, kwargs): + self.attribute = attribute + self.factory = factory + self.args = args + self.kwargs = kwargs + + def __get__(self, instance, owner): + value = instance.__dict__[self.attribute] + return self.factory(value, *self.args, **self.kwargs) + + def __set__(self, instance, value): + instance.__dict__[self.attribute] = value + + def __delete__(self, instance): + del instance.__dict__[self.attribute] + +def wrap_object_attribute(module, name, factory, args=(), kwargs={}): + path, attribute = name.rsplit('.', 1) + parent = resolve_path(module, path)[2] + wrapper = AttributeWrapper(attribute, factory, args, kwargs) + apply_patch(parent, attribute, wrapper) + return wrapper + +# Functions for creating a simple decorator using a FunctionWrapper, +# plus short cut functions for applying wrappers to functions. These are +# for use when doing monkey patching. For a more featured way of +# creating decorators see the decorator decorator instead. + +def function_wrapper(wrapper): + def _wrapper(wrapped, instance, args, kwargs): + target_wrapped = args[0] + if instance is None: + target_wrapper = wrapper + elif inspect.isclass(instance): + target_wrapper = wrapper.__get__(None, instance) + else: + target_wrapper = wrapper.__get__(instance, type(instance)) + return FunctionWrapper(target_wrapped, target_wrapper) + return FunctionWrapper(wrapper, _wrapper) + +def wrap_function_wrapper(module, name, wrapper): + return wrap_object(module, name, FunctionWrapper, (wrapper,)) + +def patch_function_wrapper(module, name): + def _wrapper(wrapper): + return wrap_object(module, name, FunctionWrapper, (wrapper,)) + return _wrapper + +def transient_function_wrapper(module, name): + def _decorator(wrapper): + def _wrapper(wrapped, instance, args, kwargs): + target_wrapped = args[0] + if instance is None: + target_wrapper = wrapper + elif inspect.isclass(instance): + target_wrapper = wrapper.__get__(None, instance) + else: + target_wrapper = wrapper.__get__(instance, type(instance)) + def _execute(wrapped, instance, args, kwargs): + (parent, attribute, original) = resolve_path(module, name) + replacement = FunctionWrapper(original, target_wrapper) + setattr(parent, attribute, replacement) + try: + return wrapped(*args, **kwargs) + finally: + setattr(parent, attribute, original) + return FunctionWrapper(target_wrapped, _execute) + return FunctionWrapper(wrapper, _wrapper) + return _decorator + +# A weak function proxy. This will work on instance methods, class +# methods, static methods and regular functions. Special treatment is +# needed for the method types because the bound method is effectively a +# transient object and applying a weak reference to one will immediately +# result in it being destroyed and the weakref callback called. The weak +# reference is therefore applied to the instance the method is bound to +# and the original function. The function is then rebound at the point +# of a call via the weak function proxy. + +def _weak_function_proxy_callback(ref, proxy, callback): + if proxy._self_expired: + return + + proxy._self_expired = True + + # This could raise an exception. We let it propagate back and let + # the weakref.proxy() deal with it, at which point it generally + # prints out a short error message direct to stderr and keeps going. + + if callback is not None: + callback(proxy) + +class WeakFunctionProxy(ObjectProxy): + + __slots__ = ('_self_expired', '_self_instance') + + def __init__(self, wrapped, callback=None): + # We need to determine if the wrapped function is actually a + # bound method. In the case of a bound method, we need to keep a + # reference to the original unbound function and the instance. + # This is necessary because if we hold a reference to the bound + # function, it will be the only reference and given it is a + # temporary object, it will almost immediately expire and + # the weakref callback triggered. So what is done is that we + # hold a reference to the instance and unbound function and + # when called bind the function to the instance once again and + # then call it. Note that we avoid using a nested function for + # the callback here so as not to cause any odd reference cycles. + + _callback = callback and functools.partial( + _weak_function_proxy_callback, proxy=self, + callback=callback) + + self._self_expired = False + + if isinstance(wrapped, _FunctionWrapperBase): + self._self_instance = weakref.ref(wrapped._self_instance, + _callback) + + if wrapped._self_parent is not None: + super(WeakFunctionProxy, self).__init__( + weakref.proxy(wrapped._self_parent, _callback)) + + else: + super(WeakFunctionProxy, self).__init__( + weakref.proxy(wrapped, _callback)) + + return + + try: + self._self_instance = weakref.ref(wrapped.__self__, _callback) + + super(WeakFunctionProxy, self).__init__( + weakref.proxy(wrapped.__func__, _callback)) + + except AttributeError: + self._self_instance = None + + super(WeakFunctionProxy, self).__init__( + weakref.proxy(wrapped, _callback)) + + def __call__(self, *args, **kwargs): + # We perform a boolean check here on the instance and wrapped + # function as that will trigger the reference error prior to + # calling if the reference had expired. + + instance = self._self_instance and self._self_instance() + function = self.__wrapped__ and self.__wrapped__ + + # If the wrapped function was originally a bound function, for + # which we retained a reference to the instance and the unbound + # function we need to rebind the function and then call it. If + # not just called the wrapped function. + + if instance is None: + return self.__wrapped__(*args, **kwargs) + + return function.__get__(instance, type(instance))(*args, **kwargs) diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wtforms-3.2.1.dist-info/INSTALLER b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wtforms-3.2.1.dist-info/INSTALLER new file mode 100644 index 0000000000000000000000000000000000000000..a1b589e38a32041e49332e5e81c2d363dc418d68 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wtforms-3.2.1.dist-info/INSTALLER @@ -0,0 +1 @@ +pip diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wtforms-3.2.1.dist-info/METADATA b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wtforms-3.2.1.dist-info/METADATA new file mode 100644 index 0000000000000000000000000000000000000000..fe8aec68bacdc37b5fb27592139defd5f4ce51ad --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wtforms-3.2.1.dist-info/METADATA @@ -0,0 +1,119 @@ +Metadata-Version: 2.3 +Name: WTForms +Version: 3.2.1 +Summary: Form validation and rendering for Python web development. +Project-URL: Documentation, https://wtforms.readthedocs.io +Project-URL: Changes, https://wtforms.readthedocs.io/changes +Project-URL: Source Code, https://github.com/pallets-eco/wtforms/ +Project-URL: Issue Tracker, https://github.com/pallets-eco/wtforms/issues +Project-URL: Chat, https://discord.gg/pallets +Maintainer: WTForms +License: Copyright 2008 WTForms + + 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. Neither the name of the copyright holder 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. +License-File: LICENSE.rst +Classifier: Development Status :: 5 - Production/Stable +Classifier: Environment :: Web Environment +Classifier: Intended Audience :: Developers +Classifier: License :: OSI Approved :: BSD License +Classifier: Operating System :: OS Independent +Classifier: Programming Language :: Python +Classifier: Topic :: Internet :: WWW/HTTP :: Dynamic Content +Requires-Python: >=3.9 +Requires-Dist: markupsafe +Provides-Extra: email +Requires-Dist: email-validator; extra == 'email' +Description-Content-Type: text/x-rst + +WTForms +======= + +WTForms is a flexible forms validation and rendering library for Python +web development. It can work with whatever web framework and template +engine you choose. It supports data validation, CSRF protection, +internationalization (I18N), and more. There are various community +libraries that provide closer integration with popular frameworks. + + +Installation +------------ + +Install and update using pip: + +.. code-block:: text + + pip install -U WTForms + + +Third-Party Library Integrations +-------------------------------- + +WTForms is designed to work with any web framework and template engine. +There are a number of community-provided libraries that make integrating +with frameworks even better. + +- `Flask-WTF`_ integrates with the Flask framework. It can + automatically load data from the request, uses Flask-Babel to + translate based on user-selected locale, provides full-application + CSRF, and more. +- `WTForms-Alchemy`_ provides rich support for generating forms from + SQLAlchemy models, including an expanded set of fields and + validators. +- `WTForms-SQLAlchemy`_ provides ORM-backed fields and form generation + from SQLAlchemy models. +- `WTForms-AppEngine`_ provides ORM-backed fields and form generation + from AppEnding db/ndb schema +- `WTForms-Django`_ provides ORM-backed fields and form generation + from Django models, as well as integration with Django's I18N + support. +- `WTForms-Bootstrap5`_ provides Bootstrap 5 favor renderer with + great customizability. +- `Starlette-WTF`_ integrates with Starlette and the FastAPI + framework, based on the features of Flask-WTF. +- `Bootstrap-Flask`_ Bootstrap-Flask is a collection of Jinja macros + for Bootstrap 4 & 5 and Flask using Flask-WTF. + +.. _Flask-WTF: https://flask-wtf.readthedocs.io/ +.. _WTForms-Alchemy: https://wtforms-alchemy.readthedocs.io/ +.. _WTForms-SQLAlchemy: https://github.com/pallets-eco/wtforms-sqlalchemy +.. _WTForms-AppEngine: https://github.com/pallets-eco/wtforms-appengine +.. _WTForms-Django: https://github.com/pallets-eco/wtforms-django +.. _WTForms-Bootstrap5: https://github.com/LaunchPlatform/wtforms-bootstrap5 +.. _Starlette-WTF: https://github.com/muicss/starlette-wtf +.. _Bootstrap-Flask: https://github.com/helloflask/bootstrap-flask + + +Links +----- + +- Documentation: https://wtforms.readthedocs.io/ +- Releases: https://pypi.org/project/WTForms/ +- Code: https://github.com/pallets-eco/wtforms +- Issue tracker: https://github.com/pallets-eco/wtforms/issues +- Discord Chat: https://discord.gg/F65P7Z9 +- Translation: https://hosted.weblate.org/projects/wtforms/wtforms/ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wtforms-3.2.1.dist-info/RECORD b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wtforms-3.2.1.dist-info/RECORD new file mode 100644 index 0000000000000000000000000000000000000000..bae243e2080419a47c29db8274ca8e2b73f1f479 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wtforms-3.2.1.dist-info/RECORD @@ -0,0 +1,109 @@ +wtforms-3.2.1.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4 +wtforms-3.2.1.dist-info/METADATA,sha256=oOzlfdk_oSeggHYC7BafQY4eyQKMeCOjXnKXRE998k0,5305 +wtforms-3.2.1.dist-info/RECORD,, +wtforms-3.2.1.dist-info/WHEEL,sha256=1yFddiXMmvYK7QYTqtRNtX66WJ0Mz8PYEiEUoOUUxRY,87 +wtforms-3.2.1.dist-info/licenses/LICENSE.rst,sha256=z0DWD_NPaytopT0iD4tmVntayN0RGbN7Yv0V6VGP5Zs,1475 +wtforms/__init__.py,sha256=aQn8cIuZR--RBgakKS49cqNvH2B-BP4Us5oyDpx9C5E,2408 +wtforms/__pycache__/__init__.cpython-310.pyc,, +wtforms/__pycache__/form.cpython-310.pyc,, +wtforms/__pycache__/i18n.cpython-310.pyc,, +wtforms/__pycache__/meta.cpython-310.pyc,, +wtforms/__pycache__/utils.cpython-310.pyc,, +wtforms/__pycache__/validators.cpython-310.pyc,, +wtforms/csrf/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +wtforms/csrf/__pycache__/__init__.cpython-310.pyc,, +wtforms/csrf/__pycache__/core.cpython-310.pyc,, +wtforms/csrf/__pycache__/session.cpython-310.pyc,, +wtforms/csrf/core.py,sha256=8Ka3ZATvo9I1WqreP1Y_i1r0t7m8Wcw5cKynVvJNXes,3097 +wtforms/csrf/session.py,sha256=4ajg5ooedVrZxxUOaeIj7WnLRSZVp9jpw_rf3oyeF5U,3092 +wtforms/fields/__init__.py,sha256=L3X1O4pOmLRmACTndbIwFFS2qFvO3oDfI3P6GslTScQ,2255 +wtforms/fields/__pycache__/__init__.cpython-310.pyc,, +wtforms/fields/__pycache__/choices.cpython-310.pyc,, +wtforms/fields/__pycache__/core.cpython-310.pyc,, +wtforms/fields/__pycache__/datetime.cpython-310.pyc,, +wtforms/fields/__pycache__/form.cpython-310.pyc,, +wtforms/fields/__pycache__/list.cpython-310.pyc,, +wtforms/fields/__pycache__/numeric.cpython-310.pyc,, +wtforms/fields/__pycache__/simple.cpython-310.pyc,, +wtforms/fields/choices.py,sha256=zAW-y1s1_sKjNT3qRwWuUKsUrojD9zIR6q5LwfGOwZc,6882 +wtforms/fields/core.py,sha256=a9OyjNpNUXMQq6e3m_9eWEKq1PKJshDmL2CEiH2BUX0,14385 +wtforms/fields/datetime.py,sha256=hImU4WDENQK7upIedBQJ1Y2N2-fwxZCkWOfeRYCibFE,5034 +wtforms/fields/form.py,sha256=_VreNaDy1ea_A7b3m4UdndYdcmJbyokDYYyZW_5jJOE,2897 +wtforms/fields/list.py,sha256=lfn89ankyMgJEgoxf50hplYAe7Zq_VvAp2k_FAMvUN0,6471 +wtforms/fields/numeric.py,sha256=Y39ODDk9eh6Nctb8gOx26u0ioiChIIUczpxAlK8Vyaw,6157 +wtforms/fields/simple.py,sha256=VBp8mRT5n3hRMH5ErgIjZtbqRr3jaRv2lZj4NMgs6XY,4075 +wtforms/form.py,sha256=DJOojlwLuswfhC1zsVSeprMbGqPAXed6fRxung131O4,12619 +wtforms/i18n.py,sha256=8AMTTSpQ5d-hONeVN8rt3RH0gRc3Mvl4zUum8Hyif88,1958 +wtforms/locale/README.md,sha256=Rb-tZdT5rErXDoe9lOmXl8Fj8ZCZPyE9fqpb0kQ2o8Y,1515 +wtforms/locale/ar/LC_MESSAGES/wtforms.mo,sha256=Wks5v3QGlNTRoIu1AKSmKHbatXQzQWYD4o4ieJdokQw,4393 +wtforms/locale/ar/LC_MESSAGES/wtforms.po,sha256=sQYvGsubsfzm1fr3qTuIyUxmkTZ0k7r6e_pzh7_gkzM,6919 +wtforms/locale/bg/LC_MESSAGES/wtforms.mo,sha256=vzeNlmzOzW7YsWfWPqI2Zt6Dgw0bd94QnLyRLhuRJy4,3932 +wtforms/locale/bg/LC_MESSAGES/wtforms.po,sha256=c70xbR04txPVUseRdnBsvg-KVUbUm1SOMMaSw73KHHA,6534 +wtforms/locale/ca/LC_MESSAGES/wtforms.mo,sha256=p0tFvBUip7wCRljw_SqFFeCV4cGNTlu5owphrsuK2Xo,3177 +wtforms/locale/ca/LC_MESSAGES/wtforms.po,sha256=2_ja11SMTPMUuE5Z6Z23sp2lzqv5ZnZGEjDXaOkD0gw,5693 +wtforms/locale/cs_CZ/LC_MESSAGES/wtforms.mo,sha256=eVPIUOfdIePaoCRPoMFHxi3EuuBya1xUU5jJMf8wi38,3398 +wtforms/locale/cs_CZ/LC_MESSAGES/wtforms.po,sha256=RZQgUiBLPdLZtMKd_WqJPTVT0-IDzstiXTgsOaNYW-A,5858 +wtforms/locale/cy/LC_MESSAGES/wtforms.mo,sha256=3gTVlrP7N9hNs9Avm_8dJhYUrMCKyk-VSEFdDEvEM1E,3142 +wtforms/locale/cy/LC_MESSAGES/wtforms.po,sha256=0ChyJkxdCuk7hDaHb7HYu_dfjUsdpW1QePW1zsmwY_o,5647 +wtforms/locale/de/LC_MESSAGES/wtforms.mo,sha256=Lx-Wgk5wbklVDo3PAweOtEyq0-qs50d8UYgwdxfFApQ,3175 +wtforms/locale/de/LC_MESSAGES/wtforms.po,sha256=FNpOXqoAMk5AlvYSWVLCEy4HLS0vQ9l7uBP1Eqx5eCo,5687 +wtforms/locale/de_CH/LC_MESSAGES/wtforms.mo,sha256=1yxa05bj0pdyt7he-x4f8ZV29pwrhh4c3oNNIXjClGs,3169 +wtforms/locale/de_CH/LC_MESSAGES/wtforms.po,sha256=m4nhUhZFBxsVc0TEq_pjM3KUPPhGYB9YamJzp0aI0Vs,5694 +wtforms/locale/el/LC_MESSAGES/wtforms.mo,sha256=Vj6ZE-q3kt_dx4BBDedDCjssbZVRRxnV0Gy1JBsjhBo,3951 +wtforms/locale/el/LC_MESSAGES/wtforms.po,sha256=3V1NhET6p8lwvHbedFDroEe3Fh4k2a0GzksRuB1cFyA,6583 +wtforms/locale/en/LC_MESSAGES/wtforms.mo,sha256=6MIjYtnt36bLr2EOGZCFJx_UntunQUCihf_hnWTNH9o,3323 +wtforms/locale/en/LC_MESSAGES/wtforms.po,sha256=Yn7Pb4rFmGxwp3emJW_aAqCBBZZw-E-JTGClfL78DY8,5046 +wtforms/locale/es/LC_MESSAGES/wtforms.mo,sha256=HQ1SSCbJtjyW8qtA4N96In6LcD3tg0vfG5hyI_KuDUg,3882 +wtforms/locale/es/LC_MESSAGES/wtforms.po,sha256=NtLOPMiz4pbRYup0jITAF7hNYtUDgojFK74l4EqJgzs,5857 +wtforms/locale/et/LC_MESSAGES/wtforms.mo,sha256=xk0veS0BiHnY-7GpFsIZrUC-0Z7UPaXV89WMiWAcLRs,3202 +wtforms/locale/et/LC_MESSAGES/wtforms.po,sha256=w-jnstN_c5s8NtzGwc-xv_16g8wfra6A6Yvdp8Wx2lk,5706 +wtforms/locale/fa/LC_MESSAGES/wtforms.mo,sha256=hrprM-rDJ1MWcRhUZFSn5jDsF9LIJsA0l_553y_qwhY,3796 +wtforms/locale/fa/LC_MESSAGES/wtforms.po,sha256=8ns8sQeTB9H-TeHJ2vSRGhZG4r9hF9aG4QQ1hwMAxvA,6377 +wtforms/locale/fi/LC_MESSAGES/wtforms.mo,sha256=GVCXedqhe-Botom4mMlRr1XKyR1iPnkxqCpUBC57hVw,3152 +wtforms/locale/fi/LC_MESSAGES/wtforms.po,sha256=rnS2nqVVQvaGqPtO4mxX5WAy1AwV8RZ9HEttWHR8ZnY,5661 +wtforms/locale/fr/LC_MESSAGES/wtforms.mo,sha256=ajwVOj920JIbkozJhf5lw63wGq4png3yEsajQ75UsJY,3961 +wtforms/locale/fr/LC_MESSAGES/wtforms.po,sha256=2BJf_hCqhEPGW8yqwv7wveVoP1EocQtRDcSkCZIO1yw,5995 +wtforms/locale/he/LC_MESSAGES/wtforms.mo,sha256=Kpd4x0_Y94JJl7J8AncB8cdmoW48cgKtrqMMpKvBGDA,3265 +wtforms/locale/he/LC_MESSAGES/wtforms.po,sha256=_17cvuiEz-Mbqp5dAa0BYh6pqv-x8JyFc1xFlgnsPZM,5853 +wtforms/locale/hu/LC_MESSAGES/wtforms.mo,sha256=oY_wtIcwQcAwf-6fLq_ZHLyxnj5IuVMzOiQzcgCwO6k,3275 +wtforms/locale/hu/LC_MESSAGES/wtforms.po,sha256=6JoOc56VMYQWEhekeFxdlHlr1qAeP31bFYuZhoYQpWM,5692 +wtforms/locale/it/LC_MESSAGES/wtforms.mo,sha256=gpaOYvoqzhZRYBvus5GOhFqiXba8xc7rgWSkGO9fwhc,3248 +wtforms/locale/it/LC_MESSAGES/wtforms.po,sha256=hBoipFIwf_iCrVEnUEw9KMLRPQdoY-cqHdhIDKYxdo0,5762 +wtforms/locale/ja/LC_MESSAGES/wtforms.mo,sha256=CPHCb9q7ZlSkSfjRvVghL1-SPz4wWBpJDYKOMgO_w80,3481 +wtforms/locale/ja/LC_MESSAGES/wtforms.po,sha256=1u2gjFZ_DVauUt4x-uTlzNOB5jrwqnA24iIsa_81xLQ,5925 +wtforms/locale/kk/LC_MESSAGES/wtforms.mo,sha256=hH-FF6mHH8AcMmQ2YpejeG5sh7xV9WzGr5IYKsT931c,4921 +wtforms/locale/kk/LC_MESSAGES/wtforms.po,sha256=nvWTHiY2xF2zqXm51IIpYGSo2KeJ5OXorZQLWHeB2B4,6898 +wtforms/locale/ko/LC_MESSAGES/wtforms.mo,sha256=qprPrphkxN_xv8nbQuPZtdTYMtfz_tLdddxO4KVMIMc,4291 +wtforms/locale/ko/LC_MESSAGES/wtforms.po,sha256=ztFv6iWLrACRPZrmuKHJ7Q6z2pwQ_QKd6wZJWu5Wl9o,6222 +wtforms/locale/nb/LC_MESSAGES/wtforms.mo,sha256=Gza9rzFM2f4OddYmbCfWbJoRq4h44XmwqgE6SaBGxwM,3080 +wtforms/locale/nb/LC_MESSAGES/wtforms.po,sha256=kczF9khVfrzaQQWGau54zPLemD1dOiMykzcrryPKwkU,5590 +wtforms/locale/nl/LC_MESSAGES/wtforms.mo,sha256=OuHmtAXr-XMlzXb7HAif9qwIuZZGpeuD6tzBy3m3YEY,3732 +wtforms/locale/nl/LC_MESSAGES/wtforms.po,sha256=RVF6zLUzoGXnt8S-GTukCh5cF1s52XG-wjfM3ow5FAo,5702 +wtforms/locale/pl/LC_MESSAGES/wtforms.mo,sha256=mgGAZqiFGPVAlKWaiWw2Y1dwIDYU0h91R_kMqMi2iQw,3428 +wtforms/locale/pl/LC_MESSAGES/wtforms.po,sha256=6CeRI1xqJW7hTsGhfPVMjcLk3470_dqPTHsZ8XKBqVc,5982 +wtforms/locale/pt/LC_MESSAGES/wtforms.mo,sha256=zJO_fssb4UthEuDKAbvePvbbRaqGziUSWcXx1W5MtWg,3892 +wtforms/locale/pt/LC_MESSAGES/wtforms.po,sha256=CVpaus2cfFEJz0hvUlvtQvs-pAzbaU6iI5ezwjFjA6A,5864 +wtforms/locale/ro/LC_MESSAGES/wtforms.mo,sha256=7bDI0iCHH7Zor2C562V44LsMdcxLpotDrNmlN4v97h8,4066 +wtforms/locale/ro/LC_MESSAGES/wtforms.po,sha256=JKyL8AqvI6GVE8fafuQLdfeVjxpL5JpMzYvkqc4HLFs,6398 +wtforms/locale/ru/LC_MESSAGES/wtforms.mo,sha256=3oZzAX1FhUq97FxblEYQRRKS1e8fEi8Mf4A96Ve-Xoo,4712 +wtforms/locale/ru/LC_MESSAGES/wtforms.po,sha256=nqKyMDRunEjnZqmD3-WS0u9sVjme-y6_mZbeYG7A-mM,7298 +wtforms/locale/sk/LC_MESSAGES/wtforms.mo,sha256=iThhdb0IqpjVIMWqgcQbl5-Hpw0Fu71tk8uOsjEcfdI,4054 +wtforms/locale/sk/LC_MESSAGES/wtforms.po,sha256=qg9Gz-k4cXgFj0y4RXyzbyU-jmzM8v7YbiK71junCZ8,6070 +wtforms/locale/sv/LC_MESSAGES/wtforms.mo,sha256=YsnbB0r1qZj7kOTKTYnIDB0xR-7NiKE0ZYBnH32YNjg,3818 +wtforms/locale/sv/LC_MESSAGES/wtforms.po,sha256=-RybPMmY47U8V6SMd6FEJlCc30UWEhYnVMBhf52Zbes,5787 +wtforms/locale/tr/LC_MESSAGES/wtforms.mo,sha256=QL-Cy032r0I4yVl7QflFXPrhy_Z3LXw0AkFgNlOmY1U,3885 +wtforms/locale/tr/LC_MESSAGES/wtforms.po,sha256=-d06BsM5zRIXYo7ZwyOkZY_holg3wDVFSfiP-dar35k,5854 +wtforms/locale/uk/LC_MESSAGES/wtforms.mo,sha256=17MF_xAnTQNjc7q5cUHI3lv9LRniNWEQ2q7MXXHJvR0,5187 +wtforms/locale/uk/LC_MESSAGES/wtforms.po,sha256=xoc7k-1MwCKntuTq0VvVsxzeGTGcKsq9wiQ00SPCKBM,7209 +wtforms/locale/wtforms.pot,sha256=g3_EOPz64hSjq7Ty4zvuoNx4U7LdoA4LoXtmqGIVqhk,4249 +wtforms/locale/zh/LC_MESSAGES/wtforms.mo,sha256=8lDDXliKMno8gBu1kuALzZFJvREJFBttptvfyYJesIQ,3296 +wtforms/locale/zh/LC_MESSAGES/wtforms.po,sha256=AGig61EOm-ir4sOhT0cpr5M10sntLaSng4BK5fvRqgY,5812 +wtforms/locale/zh_TW/LC_MESSAGES/wtforms.mo,sha256=9UZ69bwp4CBVQqBpmLuxCUvdleYqGRP-POOzp3qCDIM,3653 +wtforms/locale/zh_TW/LC_MESSAGES/wtforms.po,sha256=bslNzk1KhLiGhd3fQ9ifAmCTzjgAcTtG_z6K2Sii-Pk,5596 +wtforms/meta.py,sha256=SU8A6gDcd2wDkVzNmSGMLBBly_fMBTKVB7BD6GCfxYo,4097 +wtforms/utils.py,sha256=sAELlf-d7oXBqUbbLvRkefmvU-g6qHGVyPZzpFPWoSo,2399 +wtforms/validators.py,sha256=87C3JWB51wrENcx5I6Ap5gILgJbJWZUM7txxC3lANBg,21927 +wtforms/widgets/__init__.py,sha256=1sUdgvy1mW3g2IarCS7Ejvseh2GquBHGTSh_zz7q41s,1687 +wtforms/widgets/__pycache__/__init__.cpython-310.pyc,, +wtforms/widgets/__pycache__/core.cpython-310.pyc,, +wtforms/widgets/core.py,sha256=aalzXHzQqZkpuMZ892bGpDhNfo9Y9lufF-XdxXnhjUY,15509 diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wtforms-3.2.1.dist-info/WHEEL b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wtforms-3.2.1.dist-info/WHEEL new file mode 100644 index 0000000000000000000000000000000000000000..cdd68a497cdfa8d3f2b837225beacef711b85047 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wtforms-3.2.1.dist-info/WHEEL @@ -0,0 +1,4 @@ +Wheel-Version: 1.0 +Generator: hatchling 1.25.0 +Root-Is-Purelib: true +Tag: py3-none-any diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wtforms-3.2.1.dist-info/licenses/LICENSE.rst b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wtforms-3.2.1.dist-info/licenses/LICENSE.rst new file mode 100644 index 0000000000000000000000000000000000000000..30cbc2b394886e7f7d08a9cde1a30ae5ee0bd83f --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wtforms-3.2.1.dist-info/licenses/LICENSE.rst @@ -0,0 +1,28 @@ +Copyright 2008 WTForms + +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. Neither the name of the copyright holder 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. diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wtforms/__init__.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wtforms/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..358d67da54b955c24465b093ffdd83c282750e27 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wtforms/__init__.py @@ -0,0 +1,79 @@ +from wtforms import validators +from wtforms import widgets +from wtforms.fields.choices import RadioField +from wtforms.fields.choices import SelectField +from wtforms.fields.choices import SelectFieldBase +from wtforms.fields.choices import SelectMultipleField +from wtforms.fields.core import Field +from wtforms.fields.core import Flags +from wtforms.fields.core import Label +from wtforms.fields.datetime import DateField +from wtforms.fields.datetime import DateTimeField +from wtforms.fields.datetime import DateTimeLocalField +from wtforms.fields.datetime import MonthField +from wtforms.fields.datetime import TimeField +from wtforms.fields.datetime import WeekField +from wtforms.fields.form import FormField +from wtforms.fields.list import FieldList +from wtforms.fields.numeric import DecimalField +from wtforms.fields.numeric import DecimalRangeField +from wtforms.fields.numeric import FloatField +from wtforms.fields.numeric import IntegerField +from wtforms.fields.numeric import IntegerRangeField +from wtforms.fields.simple import BooleanField +from wtforms.fields.simple import ColorField +from wtforms.fields.simple import EmailField +from wtforms.fields.simple import FileField +from wtforms.fields.simple import HiddenField +from wtforms.fields.simple import MultipleFileField +from wtforms.fields.simple import PasswordField +from wtforms.fields.simple import SearchField +from wtforms.fields.simple import StringField +from wtforms.fields.simple import SubmitField +from wtforms.fields.simple import TelField +from wtforms.fields.simple import TextAreaField +from wtforms.fields.simple import URLField +from wtforms.form import Form +from wtforms.validators import ValidationError + +__version__ = "3.2.1" + +__all__ = [ + "validators", + "widgets", + "Form", + "ValidationError", + "SelectField", + "SelectMultipleField", + "SelectFieldBase", + "RadioField", + "Field", + "Flags", + "Label", + "DateTimeField", + "DateField", + "TimeField", + "MonthField", + "DateTimeLocalField", + "WeekField", + "FormField", + "FieldList", + "IntegerField", + "DecimalField", + "FloatField", + "IntegerRangeField", + "DecimalRangeField", + "BooleanField", + "TextAreaField", + "PasswordField", + "FileField", + "MultipleFileField", + "HiddenField", + "SearchField", + "SubmitField", + "StringField", + "TelField", + "URLField", + "EmailField", + "ColorField", +] diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wtforms/csrf/__init__.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wtforms/csrf/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wtforms/csrf/core.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wtforms/csrf/core.py new file mode 100644 index 0000000000000000000000000000000000000000..5172c77d13ba39fc729dd95968f40ef6df07b066 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wtforms/csrf/core.py @@ -0,0 +1,96 @@ +from wtforms.fields import HiddenField +from wtforms.validators import ValidationError + +__all__ = ("CSRFTokenField", "CSRF") + + +class CSRFTokenField(HiddenField): + """ + A subclass of HiddenField designed for sending the CSRF token that is used + for most CSRF protection schemes. + + Notably different from a normal field, this field always renders the + current token regardless of the submitted value, and also will not be + populated over to object data via populate_obj + """ + + current_token = None + + def __init__(self, *args, **kw): + self.csrf_impl = kw.pop("csrf_impl") + super().__init__(*args, **kw) + + def _value(self): + """ + We want to always return the current token on render, regardless of + whether a good or bad token was passed. + """ + return self.current_token + + def populate_obj(self, *args): + """ + Don't populate objects with the CSRF token + """ + pass + + def pre_validate(self, form): + """ + Handle validation of this token field. + """ + self.csrf_impl.validate_csrf_token(form, self) + + def process(self, *args, **kwargs): + super().process(*args, **kwargs) + self.current_token = self.csrf_impl.generate_csrf_token(self) + + +class CSRF: + field_class = CSRFTokenField + + def setup_form(self, form): + """ + Receive the form we're attached to and set up fields. + + The default implementation creates a single field of + type :attr:`field_class` with name taken from the + ``csrf_field_name`` of the class meta. + + :param form: + The form instance we're attaching to. + :return: + A sequence of `(field_name, unbound_field)` 2-tuples which + are unbound fields to be added to the form. + """ + meta = form.meta + field_name = meta.csrf_field_name + unbound_field = self.field_class(label="CSRF Token", csrf_impl=self) + return [(field_name, unbound_field)] + + def generate_csrf_token(self, csrf_token_field): + """ + Implementations must override this to provide a method with which one + can get a CSRF token for this form. + + A CSRF token is usually a string that is generated deterministically + based on some sort of user data, though it can be anything which you + can validate on a subsequent request. + + :param csrf_token_field: + The field which is being used for CSRF. + :return: + A generated CSRF string. + """ + raise NotImplementedError() + + def validate_csrf_token(self, form, field): + """ + Override this method to provide custom CSRF validation logic. + + The default CSRF validation logic simply checks if the recently + generated token equals the one we received as formdata. + + :param form: The form which has this CSRF token. + :param field: The CSRF token field. + """ + if field.current_token != field.data: + raise ValidationError(field.gettext("Invalid CSRF Token.")) diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wtforms/csrf/session.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wtforms/csrf/session.py new file mode 100644 index 0000000000000000000000000000000000000000..d7ddd5b958fe1c32d4b89435bda54e7d82615937 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wtforms/csrf/session.py @@ -0,0 +1,93 @@ +""" +A provided CSRF implementation which puts CSRF data in a session. + +This can be used fairly comfortably with many `request.session` type +objects, including the Werkzeug/Flask session store, Django sessions, and +potentially other similar objects which use a dict-like API for storing +session keys. + +The basic concept is a randomly generated value is stored in the user's +session, and an hmac-sha1 of it (along with an optional expiration time, +for extra security) is used as the value of the csrf_token. If this token +validates with the hmac of the random value + expiration time, and the +expiration time is not passed, the CSRF validation will pass. +""" + +import hmac +import os +from datetime import datetime +from datetime import timedelta +from hashlib import sha1 + +from ..validators import ValidationError +from .core import CSRF + +__all__ = ("SessionCSRF",) + + +class SessionCSRF(CSRF): + TIME_FORMAT = "%Y%m%d%H%M%S" + + def setup_form(self, form): + self.form_meta = form.meta + return super().setup_form(form) + + def generate_csrf_token(self, csrf_token_field): + meta = self.form_meta + if meta.csrf_secret is None: + raise Exception( + "must set `csrf_secret` on class Meta for SessionCSRF to work" + ) + if meta.csrf_context is None: + raise TypeError("Must provide a session-like object as csrf context") + + session = self.session + + if "csrf" not in session: + session["csrf"] = sha1(os.urandom(64)).hexdigest() + + if self.time_limit: + expires = (self.now() + self.time_limit).strftime(self.TIME_FORMAT) + csrf_build = "{}{}".format(session["csrf"], expires) + else: + expires = "" + csrf_build = session["csrf"] + + hmac_csrf = hmac.new( + meta.csrf_secret, csrf_build.encode("utf8"), digestmod=sha1 + ) + return f"{expires}##{hmac_csrf.hexdigest()}" + + def validate_csrf_token(self, form, field): + meta = self.form_meta + if not field.data or "##" not in field.data: + raise ValidationError(field.gettext("CSRF token missing.")) + + expires, hmac_csrf = field.data.split("##", 1) + + check_val = (self.session["csrf"] + expires).encode("utf8") + + hmac_compare = hmac.new(meta.csrf_secret, check_val, digestmod=sha1) + if hmac_compare.hexdigest() != hmac_csrf: + raise ValidationError(field.gettext("CSRF failed.")) + + if self.time_limit: + now_formatted = self.now().strftime(self.TIME_FORMAT) + if now_formatted > expires: + raise ValidationError(field.gettext("CSRF token expired.")) + + def now(self): + """ + Get the current time. Used for test mocking/overriding mainly. + """ + return datetime.now() + + @property + def time_limit(self): + return getattr(self.form_meta, "csrf_time_limit", timedelta(minutes=30)) + + @property + def session(self): + return getattr( + self.form_meta.csrf_context, "session", self.form_meta.csrf_context + ) diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wtforms/fields/__init__.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wtforms/fields/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..64fb6d391b38cbe5b59633c0507b844933bfe9b5 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wtforms/fields/__init__.py @@ -0,0 +1,71 @@ +from wtforms.fields.choices import RadioField +from wtforms.fields.choices import SelectField +from wtforms.fields.choices import SelectFieldBase +from wtforms.fields.choices import SelectMultipleField +from wtforms.fields.core import Field +from wtforms.fields.core import Flags +from wtforms.fields.core import Label +from wtforms.fields.datetime import DateField +from wtforms.fields.datetime import DateTimeField +from wtforms.fields.datetime import DateTimeLocalField +from wtforms.fields.datetime import MonthField +from wtforms.fields.datetime import TimeField +from wtforms.fields.datetime import WeekField +from wtforms.fields.form import FormField +from wtforms.fields.list import FieldList +from wtforms.fields.numeric import DecimalField +from wtforms.fields.numeric import DecimalRangeField +from wtforms.fields.numeric import FloatField +from wtforms.fields.numeric import IntegerField +from wtforms.fields.numeric import IntegerRangeField +from wtforms.fields.simple import BooleanField +from wtforms.fields.simple import ColorField +from wtforms.fields.simple import EmailField +from wtforms.fields.simple import FileField +from wtforms.fields.simple import HiddenField +from wtforms.fields.simple import MultipleFileField +from wtforms.fields.simple import PasswordField +from wtforms.fields.simple import SearchField +from wtforms.fields.simple import StringField +from wtforms.fields.simple import SubmitField +from wtforms.fields.simple import TelField +from wtforms.fields.simple import TextAreaField +from wtforms.fields.simple import URLField +from wtforms.utils import unset_value as _unset_value + +__all__ = [ + "Field", + "Flags", + "Label", + "SelectField", + "SelectMultipleField", + "SelectFieldBase", + "RadioField", + "DateTimeField", + "DateField", + "TimeField", + "MonthField", + "DateTimeLocalField", + "WeekField", + "FormField", + "IntegerField", + "DecimalField", + "FloatField", + "IntegerRangeField", + "DecimalRangeField", + "BooleanField", + "TextAreaField", + "PasswordField", + "FileField", + "MultipleFileField", + "HiddenField", + "SearchField", + "SubmitField", + "StringField", + "TelField", + "URLField", + "EmailField", + "ColorField", + "FieldList", + "_unset_value", +] diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wtforms/fields/choices.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wtforms/fields/choices.py new file mode 100644 index 0000000000000000000000000000000000000000..62ed4976360abf1ab5fcace870fc29adfa64789b --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wtforms/fields/choices.py @@ -0,0 +1,229 @@ +import itertools + +from wtforms import widgets +from wtforms.fields.core import Field +from wtforms.validators import ValidationError + +__all__ = ( + "SelectField", + "SelectMultipleField", + "RadioField", +) + + +class SelectFieldBase(Field): + option_widget = widgets.Option() + + """ + Base class for fields which can be iterated to produce options. + + This isn't a field, but an abstract base class for fields which want to + provide this functionality. + """ + + def __init__(self, label=None, validators=None, option_widget=None, **kwargs): + super().__init__(label, validators, **kwargs) + + if option_widget is not None: + self.option_widget = option_widget + + def iter_choices(self): + """ + Provides data for choice widget rendering. Must return a sequence or + iterable of (value, label, selected, render_kw) tuples. + """ + raise NotImplementedError() + + def has_groups(self): + return False + + def iter_groups(self): + raise NotImplementedError() + + def __iter__(self): + opts = dict( + widget=self.option_widget, + validators=self.validators, + name=self.name, + render_kw=self.render_kw, + _form=None, + _meta=self.meta, + ) + for i, choice in enumerate(self.iter_choices()): + if len(choice) == 4: + value, label, checked, render_kw = choice + else: + value, label, checked = choice + render_kw = {} + + opt = self._Option( + label=label, id="%s-%d" % (self.id, i), **opts, **render_kw + ) + opt.process(None, value) + opt.checked = checked + yield opt + + class _Option(Field): + checked = False + + def _value(self): + return str(self.data) + + +class SelectField(SelectFieldBase): + widget = widgets.Select() + + def __init__( + self, + label=None, + validators=None, + coerce=str, + choices=None, + validate_choice=True, + **kwargs, + ): + super().__init__(label, validators, **kwargs) + self.coerce = coerce + if callable(choices): + choices = choices() + if choices is not None: + self.choices = choices if isinstance(choices, dict) else list(choices) + else: + self.choices = None + self.validate_choice = validate_choice + + def iter_choices(self): + if not self.choices: + choices = [] + elif isinstance(self.choices, dict): + choices = list(itertools.chain.from_iterable(self.choices.values())) + else: + choices = self.choices + + return self._choices_generator(choices) + + def has_groups(self): + return isinstance(self.choices, dict) + + def iter_groups(self): + if isinstance(self.choices, dict): + for label, choices in self.choices.items(): + yield (label, self._choices_generator(choices)) + + def _choices_generator(self, choices): + if not choices: + _choices = [] + + elif isinstance(choices[0], (list, tuple)): + _choices = choices + + else: + _choices = zip(choices, choices) + + for value, label, *other_args in _choices: + selected = self.coerce(value) == self.data + render_kw = other_args[0] if len(other_args) else {} + yield (value, label, selected, render_kw) + + def process_data(self, value): + try: + # If value is None, don't coerce to a value + self.data = self.coerce(value) if value is not None else None + except (ValueError, TypeError): + self.data = None + + def process_formdata(self, valuelist): + if not valuelist: + return + + try: + self.data = self.coerce(valuelist[0]) + except ValueError as exc: + raise ValueError(self.gettext("Invalid Choice: could not coerce.")) from exc + + def pre_validate(self, form): + if not self.validate_choice: + return + + if self.choices is None: + raise TypeError(self.gettext("Choices cannot be None.")) + + for _, _, match, *_ in self.iter_choices(): + if match: + break + else: + raise ValidationError(self.gettext("Not a valid choice.")) + + +class SelectMultipleField(SelectField): + """ + No different from a normal select field, except this one can take (and + validate) multiple choices. You'll need to specify the HTML `size` + attribute to the select field when rendering. + """ + + widget = widgets.Select(multiple=True) + + def _choices_generator(self, choices): + if not choices: + _choices = [] + + elif isinstance(choices[0], (list, tuple)): + _choices = choices + + else: + _choices = zip(choices, choices) + + for value, label, *other_args in _choices: + selected = self.data is not None and self.coerce(value) in self.data + render_kw = other_args[0] if len(other_args) else {} + yield (value, label, selected, render_kw) + + def process_data(self, value): + try: + self.data = list(self.coerce(v) for v in value) + except (ValueError, TypeError): + self.data = None + + def process_formdata(self, valuelist): + try: + self.data = list(self.coerce(x) for x in valuelist) + except ValueError as exc: + raise ValueError( + self.gettext( + "Invalid choice(s): one or more data inputs could not be coerced." + ) + ) from exc + + def pre_validate(self, form): + if not self.validate_choice or not self.data: + return + + if self.choices is None: + raise TypeError(self.gettext("Choices cannot be None.")) + + acceptable = [self.coerce(choice[0]) for choice in self.iter_choices()] + if any(data not in acceptable for data in self.data): + unacceptable = [ + str(data) for data in set(self.data) if data not in acceptable + ] + raise ValidationError( + self.ngettext( + "'%(value)s' is not a valid choice for this field.", + "'%(value)s' are not valid choices for this field.", + len(unacceptable), + ) + % dict(value="', '".join(unacceptable)) + ) + + +class RadioField(SelectField): + """ + Like a SelectField, except displays a list of radio buttons. + + Iterating the field will produce subfields (each containing a label as + well) in order to allow custom rendering of the individual radio fields. + """ + + widget = widgets.ListWidget(prefix_label=False) + option_widget = widgets.RadioInput() diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wtforms/fields/core.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wtforms/fields/core.py new file mode 100644 index 0000000000000000000000000000000000000000..2155a89ea2ae065293da7395bf905d884cbb667b --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wtforms/fields/core.py @@ -0,0 +1,448 @@ +import inspect +import itertools + +from markupsafe import escape +from markupsafe import Markup + +from wtforms import widgets +from wtforms.i18n import DummyTranslations +from wtforms.utils import unset_value +from wtforms.validators import StopValidation +from wtforms.validators import ValidationError + + +class Field: + """ + Field base class + """ + + errors = tuple() + process_errors = tuple() + raw_data = None + validators = tuple() + widget = None + _formfield = True + _translations = DummyTranslations() + do_not_call_in_templates = True # Allow Django 1.4 traversal + + def __new__(cls, *args, **kwargs): + if "_form" in kwargs: + return super().__new__(cls) + else: + return UnboundField(cls, *args, **kwargs) + + def __init__( + self, + label=None, + validators=None, + filters=(), + description="", + id=None, + default=None, + widget=None, + render_kw=None, + name=None, + _form=None, + _prefix="", + _translations=None, + _meta=None, + ): + """ + Construct a new field. + + :param label: + The label of the field. + :param validators: + A sequence of validators to call when `validate` is called. + :param filters: + A sequence of callable which are run by :meth:`~Field.process` + to filter or transform the input data. For example + ``StringForm(filters=[str.strip, str.upper])``. + Note that filters are applied after processing the default and + incoming data, but before validation. + :param description: + A description for the field, typically used for help text. + :param id: + An id to use for the field. A reasonable default is set by the form, + and you shouldn't need to set this manually. + :param default: + The default value to assign to the field, if no form or object + input is provided. May be a callable. + :param widget: + If provided, overrides the widget used to render the field. + :param dict render_kw: + If provided, a dictionary which provides default keywords that + will be given to the widget at render time. + :param name: + The HTML name of this field. The default value is the Python + attribute name. + :param _form: + The form holding this field. It is passed by the form itself during + construction. You should never pass this value yourself. + :param _prefix: + The prefix to prepend to the form name of this field, passed by + the enclosing form during construction. + :param _translations: + A translations object providing message translations. Usually + passed by the enclosing form during construction. See + :doc:`I18n docs ` for information on message translations. + :param _meta: + If provided, this is the 'meta' instance from the form. You usually + don't pass this yourself. + + If `_form` isn't provided, an :class:`UnboundField` will be + returned instead. Call its :func:`bind` method with a form instance and + a name to construct the field. + """ + if _translations is not None: + self._translations = _translations + + if _meta is not None: + self.meta = _meta + elif _form is not None: + self.meta = _form.meta + else: + raise TypeError("Must provide one of _form or _meta") + + self.default = default + self.description = description + self.render_kw = render_kw + self.filters = filters + self.flags = Flags() + self.name = _prefix + name + self.short_name = name + self.type = type(self).__name__ + + self.check_validators(validators) + self.validators = validators or self.validators + + self.id = id or self.name + self.label = Label( + self.id, + label + if label is not None + else self.gettext(name.replace("_", " ").title()), + ) + + if widget is not None: + self.widget = widget + + for v in itertools.chain(self.validators, [self.widget]): + flags = getattr(v, "field_flags", {}) + + for k, v in flags.items(): + setattr(self.flags, k, v) + + def __str__(self): + """ + Returns a HTML representation of the field. For more powerful rendering, + see the `__call__` method. + """ + return self() + + def __html__(self): + """ + Returns a HTML representation of the field. For more powerful rendering, + see the :meth:`__call__` method. + """ + return self() + + def __call__(self, **kwargs): + """ + Render this field as HTML, using keyword args as additional attributes. + + This delegates rendering to + :meth:`meta.render_field ` + whose default behavior is to call the field's widget, passing any + keyword arguments from this call along to the widget. + + In all of the WTForms HTML widgets, keyword arguments are turned to + HTML attributes, though in theory a widget is free to do anything it + wants with the supplied keyword arguments, and widgets don't have to + even do anything related to HTML. + """ + return self.meta.render_field(self, kwargs) + + @classmethod + def check_validators(cls, validators): + if validators is not None: + for validator in validators: + if not callable(validator): + raise TypeError( + f"{validator} is not a valid validator because it is not " + "callable" + ) + + if inspect.isclass(validator): + raise TypeError( + f"{validator} is not a valid validator because it is a class, " + "it should be an instance" + ) + + def gettext(self, string): + """ + Get a translation for the given message. + + This proxies for the internal translations object. + + :param string: A string to be translated. + :return: A string which is the translated output. + """ + return self._translations.gettext(string) + + def ngettext(self, singular, plural, n): + """ + Get a translation for a message which can be pluralized. + + :param str singular: The singular form of the message. + :param str plural: The plural form of the message. + :param int n: The number of elements this message is referring to + """ + return self._translations.ngettext(singular, plural, n) + + def validate(self, form, extra_validators=()): + """ + Validates the field and returns True or False. `self.errors` will + contain any errors raised during validation. This is usually only + called by `Form.validate`. + + Subfields shouldn't override this, but rather override either + `pre_validate`, `post_validate` or both, depending on needs. + + :param form: The form the field belongs to. + :param extra_validators: A sequence of extra validators to run. + """ + self.errors = list(self.process_errors) + stop_validation = False + + # Check the type of extra_validators + self.check_validators(extra_validators) + + # Call pre_validate + try: + self.pre_validate(form) + except StopValidation as e: + if e.args and e.args[0]: + self.errors.append(e.args[0]) + stop_validation = True + except ValidationError as e: + self.errors.append(e.args[0]) + + # Run validators + if not stop_validation: + chain = itertools.chain(self.validators, extra_validators) + stop_validation = self._run_validation_chain(form, chain) + + # Call post_validate + try: + self.post_validate(form, stop_validation) + except ValidationError as e: + self.errors.append(e.args[0]) + + return len(self.errors) == 0 + + def _run_validation_chain(self, form, validators): + """ + Run a validation chain, stopping if any validator raises StopValidation. + + :param form: The Form instance this field belongs to. + :param validators: a sequence or iterable of validator callables. + :return: True if validation was stopped, False otherwise. + """ + for validator in validators: + try: + validator(form, self) + except StopValidation as e: + if e.args and e.args[0]: + self.errors.append(e.args[0]) + return True + except ValidationError as e: + self.errors.append(e.args[0]) + + return False + + def pre_validate(self, form): + """ + Override if you need field-level validation. Runs before any other + validators. + + :param form: The form the field belongs to. + """ + pass + + def post_validate(self, form, validation_stopped): + """ + Override if you need to run any field-level validation tasks after + normal validation. This shouldn't be needed in most cases. + + :param form: The form the field belongs to. + :param validation_stopped: + `True` if any validator raised StopValidation. + """ + pass + + def process(self, formdata, data=unset_value, extra_filters=None): + """ + Process incoming data, calling process_data, process_formdata as needed, + and run filters. + + If `data` is not provided, process_data will be called on the field's + default. + + Field subclasses usually won't override this, instead overriding the + process_formdata and process_data methods. Only override this for + special advanced processing, such as when a field encapsulates many + inputs. + + :param extra_filters: A sequence of extra filters to run. + """ + self.process_errors = [] + if data is unset_value: + try: + data = self.default() + except TypeError: + data = self.default + + self.object_data = data + + try: + self.process_data(data) + except ValueError as e: + self.process_errors.append(e.args[0]) + + if formdata is not None: + if self.name in formdata: + self.raw_data = formdata.getlist(self.name) + else: + self.raw_data = [] + + try: + self.process_formdata(self.raw_data) + except ValueError as e: + self.process_errors.append(e.args[0]) + + try: + for filter in itertools.chain(self.filters, extra_filters or []): + self.data = filter(self.data) + except ValueError as e: + self.process_errors.append(e.args[0]) + + def process_data(self, value): + """ + Process the Python data applied to this field and store the result. + + This will be called during form construction by the form's `kwargs` or + `obj` argument. + + :param value: The python object containing the value to process. + """ + self.data = value + + def process_formdata(self, valuelist): + """ + Process data received over the wire from a form. + + This will be called during form construction with data supplied + through the `formdata` argument. + + :param valuelist: A list of strings to process. + """ + if valuelist: + self.data = valuelist[0] + + def populate_obj(self, obj, name): + """ + Populates `obj.` with the field's data. + + :note: This is a destructive operation. If `obj.` already exists, + it will be overridden. Use with caution. + """ + setattr(obj, name, self.data) + + +class UnboundField: + _formfield = True + creation_counter = 0 + + def __init__(self, field_class, *args, name=None, **kwargs): + UnboundField.creation_counter += 1 + self.field_class = field_class + self.args = args + self.name = name + self.kwargs = kwargs + self.creation_counter = UnboundField.creation_counter + validators = kwargs.get("validators") + if validators: + self.field_class.check_validators(validators) + + def bind(self, form, name, prefix="", translations=None, **kwargs): + kw = dict( + self.kwargs, + name=name, + _form=form, + _prefix=prefix, + _translations=translations, + **kwargs, + ) + return self.field_class(*self.args, **kw) + + def __repr__(self): + return ( + "" + ) + + +class Flags: + """ + Holds a set of flags as attributes. + + Accessing a non-existing attribute returns None for its value. + """ + + def __getattr__(self, name): + if name.startswith("_"): + return super().__getattr__(name) + return None + + def __contains__(self, name): + return getattr(self, name) + + def __repr__(self): + flags = ( + f"{name}={getattr(self, name)}" + for name in dir(self) + if not name.startswith("_") + ) + flags = ", ".join(flags) + return f"" + + +class Label: + """ + An HTML form label. + """ + + def __init__(self, field_id, text): + self.field_id = field_id + self.text = text + + def __str__(self): + return self() + + def __html__(self): + return self() + + def __call__(self, text=None, **kwargs): + if "for_" in kwargs: + kwargs["for"] = kwargs.pop("for_") + else: + kwargs.setdefault("for", self.field_id) + + attributes = widgets.html_params(**kwargs) + text = escape(text or self.text) + return Markup(f"") + + def __repr__(self): + return f"Label({self.field_id!r}, {self.text!r})" diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wtforms/fields/datetime.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wtforms/fields/datetime.py new file mode 100644 index 0000000000000000000000000000000000000000..ac22951b1c38c393b9b95e655d473b90a56d6c70 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wtforms/fields/datetime.py @@ -0,0 +1,170 @@ +import datetime + +from wtforms import widgets +from wtforms.fields.core import Field +from wtforms.utils import clean_datetime_format_for_strptime + +__all__ = ( + "DateTimeField", + "DateField", + "TimeField", + "MonthField", + "DateTimeLocalField", + "WeekField", +) + + +class DateTimeField(Field): + """ + A text field which stores a :class:`datetime.datetime` matching one or + several formats. If ``format`` is a list, any input value matching any + format will be accepted, and the first format in the list will be used + to produce HTML values. + """ + + widget = widgets.DateTimeInput() + + def __init__( + self, label=None, validators=None, format="%Y-%m-%d %H:%M:%S", **kwargs + ): + super().__init__(label, validators, **kwargs) + self.format = format if isinstance(format, list) else [format] + self.strptime_format = clean_datetime_format_for_strptime(self.format) + + def _value(self): + if self.raw_data: + return " ".join(self.raw_data) + format = self.format[0] + return self.data and self.data.strftime(format) or "" + + def process_formdata(self, valuelist): + if not valuelist: + return + + date_str = " ".join(valuelist) + for format in self.strptime_format: + try: + self.data = datetime.datetime.strptime(date_str, format) + return + except ValueError: + self.data = None + + raise ValueError(self.gettext("Not a valid datetime value.")) + + +class DateField(DateTimeField): + """ + Same as :class:`~wtforms.fields.DateTimeField`, except stores a + :class:`datetime.date`. + """ + + widget = widgets.DateInput() + + def __init__(self, label=None, validators=None, format="%Y-%m-%d", **kwargs): + super().__init__(label, validators, format, **kwargs) + + def process_formdata(self, valuelist): + if not valuelist: + return + + date_str = " ".join(valuelist) + for format in self.strptime_format: + try: + self.data = datetime.datetime.strptime(date_str, format).date() + return + except ValueError: + self.data = None + + raise ValueError(self.gettext("Not a valid date value.")) + + +class TimeField(DateTimeField): + """ + Same as :class:`~wtforms.fields.DateTimeField`, except stores a + :class:`datetime.time`. + """ + + widget = widgets.TimeInput() + + def __init__(self, label=None, validators=None, format="%H:%M", **kwargs): + super().__init__(label, validators, format, **kwargs) + + def process_formdata(self, valuelist): + if not valuelist: + return + + time_str = " ".join(valuelist) + for format in self.strptime_format: + try: + self.data = datetime.datetime.strptime(time_str, format).time() + return + except ValueError: + self.data = None + + raise ValueError(self.gettext("Not a valid time value.")) + + +class MonthField(DateField): + """ + Same as :class:`~wtforms.fields.DateField`, except represents a month, + stores a :class:`datetime.date` with `day = 1`. + """ + + widget = widgets.MonthInput() + + def __init__(self, label=None, validators=None, format="%Y-%m", **kwargs): + super().__init__(label, validators, format, **kwargs) + + +class WeekField(DateField): + """ + Same as :class:`~wtforms.fields.DateField`, except represents a week, + stores a :class:`datetime.date` of the monday of the given week. + """ + + widget = widgets.WeekInput() + + def __init__(self, label=None, validators=None, format="%Y-W%W", **kwargs): + super().__init__(label, validators, format, **kwargs) + + def process_formdata(self, valuelist): + if not valuelist: + return + + time_str = " ".join(valuelist) + for format in self.strptime_format: + try: + if "%w" not in format: + # The '%w' week starting day is needed. This defaults it to monday + # like ISO 8601 indicates. + self.data = datetime.datetime.strptime( + f"{time_str}-1", f"{format}-%w" + ).date() + else: + self.data = datetime.datetime.strptime(time_str, format).date() + return + except ValueError: + self.data = None + + raise ValueError(self.gettext("Not a valid week value.")) + + +class DateTimeLocalField(DateTimeField): + """ + Same as :class:`~wtforms.fields.DateTimeField`, but represents an + ````. + """ + + widget = widgets.DateTimeLocalInput() + + def __init__(self, *args, **kwargs): + kwargs.setdefault( + "format", + [ + "%Y-%m-%d %H:%M:%S", + "%Y-%m-%dT%H:%M:%S", + "%Y-%m-%d %H:%M", + "%Y-%m-%dT%H:%M", + ], + ) + super().__init__(*args, **kwargs) diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wtforms/fields/form.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wtforms/fields/form.py new file mode 100644 index 0000000000000000000000000000000000000000..10fb30e7057d088c1a641283da4dd912417c51a6 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wtforms/fields/form.py @@ -0,0 +1,98 @@ +from wtforms.utils import unset_value + +from .. import widgets +from .core import Field + +__all__ = ("FormField",) + + +class FormField(Field): + """ + Encapsulate a form as a field in another form. + + :param form_class: + A subclass of Form that will be encapsulated. + :param separator: + A string which will be suffixed to this field's name to create the + prefix to enclosed fields. The default is fine for most uses. + """ + + widget = widgets.TableWidget() + + def __init__( + self, form_class, label=None, validators=None, separator="-", **kwargs + ): + super().__init__(label, validators, **kwargs) + self.form_class = form_class + self.separator = separator + self._obj = None + if self.filters: + raise TypeError( + "FormField cannot take filters, as the encapsulated" + " data is not mutable." + ) + if validators: + raise TypeError( + "FormField does not accept any validators. Instead," + " define them on the enclosed form." + ) + + def process(self, formdata, data=unset_value, extra_filters=None): + if extra_filters: + raise TypeError( + "FormField cannot take filters, as the encapsulated" + "data is not mutable." + ) + + if data is unset_value: + try: + data = self.default() + except TypeError: + data = self.default + self._obj = data + + self.object_data = data + + prefix = self.name + self.separator + if isinstance(data, dict): + self.form = self.form_class(formdata=formdata, prefix=prefix, **data) + else: + self.form = self.form_class(formdata=formdata, obj=data, prefix=prefix) + + def validate(self, form, extra_validators=()): + if extra_validators: + raise TypeError( + "FormField does not accept in-line validators, as it" + " gets errors from the enclosed form." + ) + return self.form.validate() + + def populate_obj(self, obj, name): + candidate = getattr(obj, name, None) + if candidate is None: + if self._obj is None: + raise TypeError( + "populate_obj: cannot find a value to populate from" + " the provided obj or input data/defaults" + ) + candidate = self._obj + + self.form.populate_obj(candidate) + setattr(obj, name, candidate) + + def __iter__(self): + return iter(self.form) + + def __getitem__(self, name): + return self.form[name] + + def __getattr__(self, name): + return getattr(self.form, name) + + @property + def data(self): + return self.form.data + + @property + def errors(self): + return self.form.errors diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wtforms/fields/list.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wtforms/fields/list.py new file mode 100644 index 0000000000000000000000000000000000000000..dabd8b40497cf1d3d92de9f16f5bff26f0903cf1 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wtforms/fields/list.py @@ -0,0 +1,202 @@ +import itertools + +from wtforms.utils import unset_value + +from .. import widgets +from .core import Field +from .core import UnboundField + +__all__ = ("FieldList",) + + +class FieldList(Field): + """ + Encapsulate an ordered list of multiple instances of the same field type, + keeping data as a list. + + >>> authors = FieldList(StringField('Name', [validators.DataRequired()])) + + :param unbound_field: + A partially-instantiated field definition, just like that would be + defined on a form directly. + :param min_entries: + if provided, always have at least this many entries on the field, + creating blank ones if the provided input does not specify a sufficient + amount. + :param max_entries: + accept no more than this many entries as input, even if more exist in + formdata. + :param separator: + A string which will be suffixed to this field's name to create the + prefix to enclosed list entries. The default is fine for most uses. + """ + + widget = widgets.ListWidget() + + def __init__( + self, + unbound_field, + label=None, + validators=None, + min_entries=0, + max_entries=None, + separator="-", + default=(), + **kwargs, + ): + super().__init__(label, validators, default=default, **kwargs) + if self.filters: + raise TypeError( + "FieldList does not accept any filters. Instead, define" + " them on the enclosed field." + ) + assert isinstance( + unbound_field, UnboundField + ), "Field must be unbound, not a field class" + self.unbound_field = unbound_field + self.min_entries = min_entries + self.max_entries = max_entries + self.last_index = -1 + self._prefix = kwargs.get("_prefix", "") + self._separator = separator + self._field_separator = unbound_field.kwargs.get("separator", "-") + + def process(self, formdata, data=unset_value, extra_filters=None): + if extra_filters: + raise TypeError( + "FieldList does not accept any filters. Instead, define" + " them on the enclosed field." + ) + + self.entries = [] + if data is unset_value or not data: + try: + data = self.default() + except TypeError: + data = self.default + + self.object_data = data + + if formdata: + indices = sorted(set(self._extract_indices(self.name, formdata))) + if self.max_entries: + indices = indices[: self.max_entries] + + idata = iter(data) + for index in indices: + try: + obj_data = next(idata) + except StopIteration: + obj_data = unset_value + self._add_entry(formdata, obj_data, index=index) + else: + for obj_data in data: + self._add_entry(formdata, obj_data) + + while len(self.entries) < self.min_entries: + self._add_entry(formdata) + + def _extract_indices(self, prefix, formdata): + """ + Yield indices of any keys with given prefix. + + formdata must be an object which will produce keys when iterated. For + example, if field 'foo' contains keys 'foo-0-bar', 'foo-1-baz', then + the numbers 0 and 1 will be yielded, but not necessarily in order. + """ + offset = len(prefix) + 1 + for k in formdata: + if k.startswith(prefix): + k = k[offset:].split(self._field_separator, 1)[0] + if k.isdigit(): + yield int(k) + + def validate(self, form, extra_validators=()): + """ + Validate this FieldList. + + Note that FieldList validation differs from normal field validation in + that FieldList validates all its enclosed fields first before running any + of its own validators. + """ + self.errors = [] + + # Run validators on all entries within + for subfield in self.entries: + subfield.validate(form) + self.errors.append(subfield.errors) + + if not any(x for x in self.errors): + self.errors = [] + + chain = itertools.chain(self.validators, extra_validators) + self._run_validation_chain(form, chain) + + return len(self.errors) == 0 + + def populate_obj(self, obj, name): + values = getattr(obj, name, None) + try: + ivalues = iter(values) + except TypeError: + ivalues = iter([]) + + candidates = itertools.chain(ivalues, itertools.repeat(None)) + _fake = type("_fake", (object,), {}) + output = [] + for field, data in zip(self.entries, candidates): + fake_obj = _fake() + fake_obj.data = data + field.populate_obj(fake_obj, "data") + output.append(fake_obj.data) + + setattr(obj, name, output) + + def _add_entry(self, formdata=None, data=unset_value, index=None): + assert ( + not self.max_entries or len(self.entries) < self.max_entries + ), "You cannot have more than max_entries entries in this FieldList" + if index is None: + index = self.last_index + 1 + self.last_index = index + name = f"{self.short_name}{self._separator}{index}" + id = f"{self.id}{self._separator}{index}" + field = self.unbound_field.bind( + form=None, + name=name, + prefix=self._prefix, + id=id, + _meta=self.meta, + translations=self._translations, + ) + field.process(formdata, data) + self.entries.append(field) + return field + + def append_entry(self, data=unset_value): + """ + Create a new entry with optional default data. + + Entries added in this way will *not* receive formdata however, and can + only receive object data. + """ + return self._add_entry(data=data) + + def pop_entry(self): + """Removes the last entry from the list and returns it.""" + entry = self.entries.pop() + self.last_index -= 1 + return entry + + def __iter__(self): + return iter(self.entries) + + def __len__(self): + return len(self.entries) + + def __getitem__(self, index): + return self.entries[index] + + @property + def data(self): + return [f.data for f in self.entries] diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wtforms/fields/numeric.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wtforms/fields/numeric.py new file mode 100644 index 0000000000000000000000000000000000000000..f9e5b26bbd08468dc2c61d51f24e537d47b7d15a --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wtforms/fields/numeric.py @@ -0,0 +1,213 @@ +import decimal + +from wtforms import widgets +from wtforms.fields.core import Field +from wtforms.utils import unset_value + +__all__ = ( + "IntegerField", + "DecimalField", + "FloatField", + "IntegerRangeField", + "DecimalRangeField", +) + + +class LocaleAwareNumberField(Field): + """ + Base class for implementing locale-aware number parsing. + + Locale-aware numbers require the 'babel' package to be present. + """ + + def __init__( + self, + label=None, + validators=None, + use_locale=False, + number_format=None, + **kwargs, + ): + super().__init__(label, validators, **kwargs) + self.use_locale = use_locale + if use_locale: + self.number_format = number_format + self.locale = kwargs["_form"].meta.locales[0] + self._init_babel() + + def _init_babel(self): + try: + from babel import numbers + + self.babel_numbers = numbers + except ImportError as exc: + raise ImportError( + "Using locale-aware decimals requires the babel library." + ) from exc + + def _parse_decimal(self, value): + return self.babel_numbers.parse_decimal(value, self.locale) + + def _format_decimal(self, value): + return self.babel_numbers.format_decimal(value, self.number_format, self.locale) + + +class IntegerField(Field): + """ + A text field, except all input is coerced to an integer. Erroneous input + is ignored and will not be accepted as a value. + """ + + widget = widgets.NumberInput() + + def __init__(self, label=None, validators=None, **kwargs): + super().__init__(label, validators, **kwargs) + + def _value(self): + if self.raw_data: + return self.raw_data[0] + if self.data is not None: + return str(self.data) + return "" + + def process_data(self, value): + if value is None or value is unset_value: + self.data = None + return + + try: + self.data = int(value) + except (ValueError, TypeError) as exc: + self.data = None + raise ValueError(self.gettext("Not a valid integer value.")) from exc + + def process_formdata(self, valuelist): + if not valuelist: + return + + try: + self.data = int(valuelist[0]) + except ValueError as exc: + self.data = None + raise ValueError(self.gettext("Not a valid integer value.")) from exc + + +class DecimalField(LocaleAwareNumberField): + """ + A text field which displays and coerces data of the `decimal.Decimal` type. + + :param places: + How many decimal places to quantize the value to for display on form. + If unset, use 2 decimal places. + If explicitely set to `None`, does not quantize value. + :param rounding: + How to round the value during quantize, for example + `decimal.ROUND_UP`. If unset, uses the rounding value from the + current thread's context. + :param use_locale: + If True, use locale-based number formatting. Locale-based number + formatting requires the 'babel' package. + :param number_format: + Optional number format for locale. If omitted, use the default decimal + format for the locale. + """ + + widget = widgets.NumberInput(step="any") + + def __init__( + self, label=None, validators=None, places=unset_value, rounding=None, **kwargs + ): + super().__init__(label, validators, **kwargs) + if self.use_locale and (places is not unset_value or rounding is not None): + raise TypeError( + "When using locale-aware numbers, 'places' and 'rounding' are ignored." + ) + + if places is unset_value: + places = 2 + self.places = places + self.rounding = rounding + + def _value(self): + if self.raw_data: + return self.raw_data[0] + + if self.data is None: + return "" + + if self.use_locale: + return str(self._format_decimal(self.data)) + + if self.places is None: + return str(self.data) + + if not hasattr(self.data, "quantize"): + # If for some reason, data is a float or int, then format + # as we would for floats using string formatting. + format = "%%0.%df" % self.places + return format % self.data + + exp = decimal.Decimal(".1") ** self.places + if self.rounding is None: + quantized = self.data.quantize(exp) + else: + quantized = self.data.quantize(exp, rounding=self.rounding) + return str(quantized) + + def process_formdata(self, valuelist): + if not valuelist: + return + + try: + if self.use_locale: + self.data = self._parse_decimal(valuelist[0]) + else: + self.data = decimal.Decimal(valuelist[0]) + except (decimal.InvalidOperation, ValueError) as exc: + self.data = None + raise ValueError(self.gettext("Not a valid decimal value.")) from exc + + +class FloatField(Field): + """ + A text field, except all input is coerced to an float. Erroneous input + is ignored and will not be accepted as a value. + """ + + widget = widgets.TextInput() + + def __init__(self, label=None, validators=None, **kwargs): + super().__init__(label, validators, **kwargs) + + def _value(self): + if self.raw_data: + return self.raw_data[0] + if self.data is not None: + return str(self.data) + return "" + + def process_formdata(self, valuelist): + if not valuelist: + return + + try: + self.data = float(valuelist[0]) + except ValueError as exc: + self.data = None + raise ValueError(self.gettext("Not a valid float value.")) from exc + + +class IntegerRangeField(IntegerField): + """ + Represents an ````. + """ + + widget = widgets.RangeInput() + + +class DecimalRangeField(DecimalField): + """ + Represents an ````. + """ + + widget = widgets.RangeInput(step="any") diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wtforms/fields/simple.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wtforms/fields/simple.py new file mode 100644 index 0000000000000000000000000000000000000000..910ff96eb3f68c473f040f3987a0d3ca7625abce --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wtforms/fields/simple.py @@ -0,0 +1,173 @@ +from .. import widgets +from .core import Field + +__all__ = ( + "BooleanField", + "TextAreaField", + "PasswordField", + "FileField", + "MultipleFileField", + "HiddenField", + "SearchField", + "SubmitField", + "StringField", + "TelField", + "URLField", + "EmailField", + "ColorField", +) + + +class BooleanField(Field): + """ + Represents an ````. Set the ``checked``-status by using the + ``default``-option. Any value for ``default``, e.g. ``default="checked"`` puts + ``checked`` into the html-element and sets the ``data`` to ``True`` + + :param false_values: + If provided, a sequence of strings each of which is an exact match + string of what is considered a "false" value. Defaults to the tuple + ``(False, "false", "")`` + """ + + widget = widgets.CheckboxInput() + false_values = (False, "false", "") + + def __init__(self, label=None, validators=None, false_values=None, **kwargs): + super().__init__(label, validators, **kwargs) + if false_values is not None: + self.false_values = false_values + + def process_data(self, value): + self.data = bool(value) + + def process_formdata(self, valuelist): + if not valuelist or valuelist[0] in self.false_values: + self.data = False + else: + self.data = True + + def _value(self): + if self.raw_data: + return str(self.raw_data[0]) + return "y" + + +class StringField(Field): + """ + This field is the base for most of the more complicated fields, and + represents an ````. + """ + + widget = widgets.TextInput() + + def process_formdata(self, valuelist): + if valuelist: + self.data = valuelist[0] + + def _value(self): + return str(self.data) if self.data is not None else "" + + +class TextAreaField(StringField): + """ + This field represents an HTML ``" + ) + + +class Select: + """ + Renders a select field. + + If `multiple` is True, then the `size` property should be specified on + rendering to make the field useful. + + The field must provide an `iter_choices()` method which the widget will + call on rendering; this method must yield tuples of + `(value, label, selected)` or `(value, label, selected, render_kw)`. + It also must provide a `has_groups()` method which tells whether choices + are divided into groups, and if they do, the field must have an + `iter_groups()` method that yields tuples of `(label, choices)`, where + `choices` is a iterable of `(value, label, selected)` tuples. + """ + + validation_attrs = ["required", "disabled"] + + def __init__(self, multiple=False): + self.multiple = multiple + + def __call__(self, field, **kwargs): + kwargs.setdefault("id", field.id) + if self.multiple: + kwargs["multiple"] = True + flags = getattr(field, "flags", {}) + for k in dir(flags): + if k in self.validation_attrs and k not in kwargs: + kwargs[k] = getattr(flags, k) + select_params = html_params(name=field.name, **kwargs) + html = [f"") + return Markup("".join(html)) + + @classmethod + def render_option(cls, value, label, selected, **kwargs): + if value is True: + # Handle the special case of a 'True' value. + value = str(value) + + options = dict(kwargs, value=value) + if selected: + options["selected"] = True + return Markup(f"") + + +class Option: + """ + Renders the individual option from a select field. + + This is just a convenience for various custom rendering situations, and an + option by itself does not constitute an entire field. + """ + + def __call__(self, field, **kwargs): + return Select.render_option( + field._value(), field.label.text, field.checked, **kwargs + ) + + +class SearchInput(Input): + """ + Renders an input with type "search". + """ + + input_type = "search" + validation_attrs = [ + "required", + "disabled", + "readonly", + "maxlength", + "minlength", + "pattern", + ] + + +class TelInput(Input): + """ + Renders an input with type "tel". + """ + + input_type = "tel" + validation_attrs = [ + "required", + "disabled", + "readonly", + "maxlength", + "minlength", + "pattern", + ] + + +class URLInput(Input): + """ + Renders an input with type "url". + """ + + input_type = "url" + validation_attrs = [ + "required", + "disabled", + "readonly", + "maxlength", + "minlength", + "pattern", + ] + + +class EmailInput(Input): + """ + Renders an input with type "email". + """ + + input_type = "email" + validation_attrs = [ + "required", + "disabled", + "readonly", + "maxlength", + "minlength", + "pattern", + ] + + +class DateTimeInput(Input): + """ + Renders an input with type "datetime". + """ + + input_type = "datetime" + validation_attrs = ["required", "disabled", "readonly", "max", "min", "step"] + + +class DateInput(Input): + """ + Renders an input with type "date". + """ + + input_type = "date" + validation_attrs = ["required", "disabled", "readonly", "max", "min", "step"] + + +class MonthInput(Input): + """ + Renders an input with type "month". + """ + + input_type = "month" + validation_attrs = ["required", "disabled", "readonly", "max", "min", "step"] + + +class WeekInput(Input): + """ + Renders an input with type "week". + """ + + input_type = "week" + validation_attrs = ["required", "disabled", "readonly", "max", "min", "step"] + + +class TimeInput(Input): + """ + Renders an input with type "time". + """ + + input_type = "time" + validation_attrs = ["required", "disabled", "readonly", "max", "min", "step"] + + +class DateTimeLocalInput(Input): + """ + Renders an input with type "datetime-local". + """ + + input_type = "datetime-local" + validation_attrs = ["required", "disabled", "readonly", "max", "min", "step"] + + +class NumberInput(Input): + """ + Renders an input with type "number". + """ + + input_type = "number" + validation_attrs = ["required", "disabled", "readonly", "max", "min", "step"] + + def __init__(self, step=None, min=None, max=None): + self.step = step + self.min = min + self.max = max + + def __call__(self, field, **kwargs): + if self.step is not None: + kwargs.setdefault("step", self.step) + if self.min is not None: + kwargs.setdefault("min", self.min) + if self.max is not None: + kwargs.setdefault("max", self.max) + return super().__call__(field, **kwargs) + + +class RangeInput(Input): + """ + Renders an input with type "range". + """ + + input_type = "range" + validation_attrs = ["disabled", "max", "min", "step"] + + def __init__(self, step=None): + self.step = step + + def __call__(self, field, **kwargs): + if self.step is not None: + kwargs.setdefault("step", self.step) + return super().__call__(field, **kwargs) + + +class ColorInput(Input): + """ + Renders an input with type "color". + """ + + input_type = "color" + validation_attrs = ["disabled"] diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wtforms_recaptcha-0.3.2.dist-info/DESCRIPTION.rst b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wtforms_recaptcha-0.3.2.dist-info/DESCRIPTION.rst new file mode 100644 index 0000000000000000000000000000000000000000..59e2748f75e8aae4ed32dc9f876ddaf1a03f2a1d --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wtforms_recaptcha-0.3.2.dist-info/DESCRIPTION.rst @@ -0,0 +1,84 @@ +================= +WTForms-reCaptcha +================= + +Overview +-------- +WTForms-reCaptcha is a convenient field for `WTForms `_ that transparently handles +reCaptcha display and validation via corresponding widget and validator classes. + +reCaptcha +--------- +| To get an idea about reCaptcha see the `docs `_. +| To start working with it, first get reCaptcha keys `here `_. + + +Installation +------------ +Get the distribution:: + + pip install wtforms-recaptcha + +or if you want the latest:: + + pip install hg+http://bitbucket.org/excieve/wtforms-recaptcha#egg=wtforms-recaptcha + +or get hg clone of the source code:: + + hg clone http://bitbucket.org/excieve/wtforms-recaptcha + cd wtforms-recaptcha + python setup.py install + + +Usage +----- +It is mostly the usual WTForms field that needs some extra data and parameters. +Here's a simple example:: + + from wtforms.form import Form + from wtfrecaptcha.fields import RecaptchaField + + + class CaptchaForm(Form): + captcha = RecaptchaField(public_key=RECAPTCHA_PUB_KEY, private_key=RECAPTCHA_PRIV_KEY, secure=True) + + + form = CaptchaForm(request.POST, captcha={'ip_address': request.META['REMOTE_ADDR']}) + if form.validate(): + print "Captcha response is correct" + else: + print form.errors['captcha'] + + +Some description of field's parameters: + +:public_key: + Public key generated by reCaptcha service +:private_key: + Private key generated by reCaptcha service +:secure: + True if it should be served via HTTPS, False otherwise. Default: *False*. +:http_proxy: + URL of HTTP proxy for API calls + +When form with RecaptchaField is instantiated with bound fields, it must include +*captcha* keyword parameter with dict that has 'ip_address' element. + + +Other details +------------- +Accessing field as a string will get the widget code with URLs that depend on +*secure* parameter passed to the field. + +HTTP errors and errors that are indepentent of user input are logged. +Others are handled as validation errors. + + +License +------- +| WTForms-reCaptcha is released under BSD license. +| Copyright (c) 2010-2012 Artem Gluvchynsky and contributors. + +See LICENSE for full licensing information. + + diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wtforms_recaptcha-0.3.2.dist-info/INSTALLER b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wtforms_recaptcha-0.3.2.dist-info/INSTALLER new file mode 100644 index 0000000000000000000000000000000000000000..a1b589e38a32041e49332e5e81c2d363dc418d68 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wtforms_recaptcha-0.3.2.dist-info/INSTALLER @@ -0,0 +1 @@ +pip diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wtforms_recaptcha-0.3.2.dist-info/METADATA b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wtforms_recaptcha-0.3.2.dist-info/METADATA new file mode 100644 index 0000000000000000000000000000000000000000..e2fcfed77e528d5896846e5a0c65495627cd7d5d --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wtforms_recaptcha-0.3.2.dist-info/METADATA @@ -0,0 +1,105 @@ +Metadata-Version: 2.0 +Name: wtforms-recaptcha +Version: 0.3.2 +Summary: Custom WTForms field that handles reCaptcha display and validation +Home-page: http://bitbucket.org/excieve/wtforms-recaptcha +Author: Artem Gluvchynsky +Author-email: excieve@gmail.com +License: BSD +Platform: any +Classifier: Development Status :: 4 - Beta +Classifier: Environment :: Web Environment +Classifier: Intended Audience :: Developers +Classifier: License :: OSI Approved :: BSD License +Classifier: Operating System :: OS Independent +Classifier: Programming Language :: Python +Classifier: Programming Language :: Python :: 2 +Classifier: Programming Language :: Python :: 3 +Classifier: Topic :: Internet :: WWW/HTTP :: Dynamic Content +Classifier: Topic :: Software Development :: Libraries :: Python Modules +Requires-Dist: WTForms (>=0.6.1) + +================= +WTForms-reCaptcha +================= + +Overview +-------- +WTForms-reCaptcha is a convenient field for `WTForms `_ that transparently handles +reCaptcha display and validation via corresponding widget and validator classes. + +reCaptcha +--------- +| To get an idea about reCaptcha see the `docs `_. +| To start working with it, first get reCaptcha keys `here `_. + + +Installation +------------ +Get the distribution:: + + pip install wtforms-recaptcha + +or if you want the latest:: + + pip install hg+http://bitbucket.org/excieve/wtforms-recaptcha#egg=wtforms-recaptcha + +or get hg clone of the source code:: + + hg clone http://bitbucket.org/excieve/wtforms-recaptcha + cd wtforms-recaptcha + python setup.py install + + +Usage +----- +It is mostly the usual WTForms field that needs some extra data and parameters. +Here's a simple example:: + + from wtforms.form import Form + from wtfrecaptcha.fields import RecaptchaField + + + class CaptchaForm(Form): + captcha = RecaptchaField(public_key=RECAPTCHA_PUB_KEY, private_key=RECAPTCHA_PRIV_KEY, secure=True) + + + form = CaptchaForm(request.POST, captcha={'ip_address': request.META['REMOTE_ADDR']}) + if form.validate(): + print "Captcha response is correct" + else: + print form.errors['captcha'] + + +Some description of field's parameters: + +:public_key: + Public key generated by reCaptcha service +:private_key: + Private key generated by reCaptcha service +:secure: + True if it should be served via HTTPS, False otherwise. Default: *False*. +:http_proxy: + URL of HTTP proxy for API calls + +When form with RecaptchaField is instantiated with bound fields, it must include +*captcha* keyword parameter with dict that has 'ip_address' element. + + +Other details +------------- +Accessing field as a string will get the widget code with URLs that depend on +*secure* parameter passed to the field. + +HTTP errors and errors that are indepentent of user input are logged. +Others are handled as validation errors. + + +License +------- +| WTForms-reCaptcha is released under BSD license. +| Copyright (c) 2010-2012 Artem Gluvchynsky and contributors. + +See LICENSE for full licensing information. + + diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wtforms_recaptcha-0.3.2.dist-info/RECORD b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wtforms_recaptcha-0.3.2.dist-info/RECORD new file mode 100644 index 0000000000000000000000000000000000000000..b4e72d20cf2add22ea85328e42f241af615fd999 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wtforms_recaptcha-0.3.2.dist-info/RECORD @@ -0,0 +1,15 @@ +wtforms_recaptcha-0.3.2.dist-info/DESCRIPTION.rst,sha256=wyCj9btmh_Mez5TQ_N6L9wSgBQ3pz5lw1TOVwcq7QOQ,2290 +wtforms_recaptcha-0.3.2.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4 +wtforms_recaptcha-0.3.2.dist-info/METADATA,sha256=9nI18uSCNOjby6iHSoVVENo7neuaYlsTBIl0mU3C3c0,3105 +wtforms_recaptcha-0.3.2.dist-info/RECORD,, +wtforms_recaptcha-0.3.2.dist-info/WHEEL,sha256=6lxp_S3wZGmTBtGMVmNNLyvKFcp7HqQw2Wn4YYk-Suo,110 +wtforms_recaptcha-0.3.2.dist-info/metadata.json,sha256=HvvYQM1riq68Tvc9DiJz5HS6N7FycBPzw0gT4ivtgDs,994 +wtforms_recaptcha-0.3.2.dist-info/top_level.txt,sha256=RcDj2YfAqmdCT_XrYyyTW-tEljA0WbmWI5-g9PVGVbc,13 +wtfrecaptcha/__init__.py,sha256=bqu4G7Is-8Were-hMi-SthEalL7QW-PAbKWGZ9pVB6U,22 +wtfrecaptcha/__pycache__/__init__.cpython-310.pyc,, +wtfrecaptcha/__pycache__/fields.cpython-310.pyc,, +wtfrecaptcha/__pycache__/validators.cpython-310.pyc,, +wtfrecaptcha/__pycache__/widgets.cpython-310.pyc,, +wtfrecaptcha/fields.py,sha256=6h8vPFByt1nX1uR-wrWxnBJLgdSIuw_0wutqTfxDPWc,2567 +wtfrecaptcha/validators.py,sha256=_p94e91zZf_vpCNNgR3bxYZ_dnivW_g-M4G_r_pH2VU,2746 +wtfrecaptcha/widgets.py,sha256=x6DoHFZCo0wJcCiaJ-2QN8U0eN_oQSl7xLedsj00TBE,870 diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wtforms_recaptcha-0.3.2.dist-info/WHEEL b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wtforms_recaptcha-0.3.2.dist-info/WHEEL new file mode 100644 index 0000000000000000000000000000000000000000..f19235cb62b0bdeb0a8c26b19d4d72f83e77cd28 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wtforms_recaptcha-0.3.2.dist-info/WHEEL @@ -0,0 +1,6 @@ +Wheel-Version: 1.0 +Generator: bdist_wheel (0.23.0) +Root-Is-Purelib: true +Tag: py2-none-any +Tag: py3-none-any + diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wtforms_recaptcha-0.3.2.dist-info/metadata.json b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wtforms_recaptcha-0.3.2.dist-info/metadata.json new file mode 100644 index 0000000000000000000000000000000000000000..9fc3ff5f82d034a38dcfc977d05023fa778893f6 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wtforms_recaptcha-0.3.2.dist-info/metadata.json @@ -0,0 +1 @@ +{"generator": "bdist_wheel (0.23.0)", "document_names": {"description": "DESCRIPTION.rst"}, "summary": "Custom WTForms field that handles reCaptcha display and validation", "run_requires": [{"requires": ["WTForms (>=0.6.1)"]}], "platform": "any", "test_requires": [{"requires": ["nose"]}], "classifiers": ["Development Status :: 4 - Beta", "Environment :: Web Environment", "Intended Audience :: Developers", "License :: OSI Approved :: BSD License", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 2", "Programming Language :: Python :: 3", "Topic :: Internet :: WWW/HTTP :: Dynamic Content", "Topic :: Software Development :: Libraries :: Python Modules"], "metadata_version": "2.0", "extras": [], "version": "0.3.2", "name": "wtforms-recaptcha", "license": "BSD", "contacts": [{"name": "Artem Gluvchynsky", "email": "excieve@gmail.com", "role": "author"}], "project_urls": {"Home": "http://bitbucket.org/excieve/wtforms-recaptcha"}} \ No newline at end of file diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wtforms_recaptcha-0.3.2.dist-info/top_level.txt b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wtforms_recaptcha-0.3.2.dist-info/top_level.txt new file mode 100644 index 0000000000000000000000000000000000000000..5e48b7f2580caf40a9e89bdad95564f009c133ed --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wtforms_recaptcha-0.3.2.dist-info/top_level.txt @@ -0,0 +1 @@ +wtfrecaptcha diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wtfrecaptcha/__init__.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wtfrecaptcha/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..73e3bb4f38bada34ca9359469effd05bb6767ac7 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wtfrecaptcha/__init__.py @@ -0,0 +1 @@ +__version__ = '0.3.2' diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wtfrecaptcha/fields.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wtfrecaptcha/fields.py new file mode 100644 index 0000000000000000000000000000000000000000..2bffe94b2e3ece88f36a56311f6f57eb9e93cf56 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wtfrecaptcha/fields.py @@ -0,0 +1,69 @@ +from wtforms.fields import Field +from wtforms.validators import Required + +from . import widgets +from . import validators as local_validators + + +class RecaptchaField(Field): + """Handles captcha field display and validation via reCaptcha""" + + widget = widgets.Recaptcha() + + def __init__(self, label='', validators=None, public_key=None, private_key=None, secure=False, http_proxy=None, **kwargs): + # Pretty useless without the Recaptcha validator but still + # user may want to subclass it, so keep it optional + validators = validators or [local_validators.Recaptcha()] + super(RecaptchaField, self).__init__(label, validators, **kwargs) + + if not public_key or not private_key: + raise ValueError('Both recaptcha public and private keys are required.') + + self.public_key = public_key + self.private_key = private_key + self.secure = secure + self.http_proxy = http_proxy + + self.ip_address = None + self.challenge = None + + def process(self, formdata, data={}): + """Handles multiple formdata fields that are required for reCaptcha. + Only response field is handled as raw_data as it is the only user input + """ + self.process_errors = [] + + if isinstance(data, dict): + self.ip_address = data.pop('ip_address', None) + + try: + self.process_data(data) + except ValueError as e: + self.process_errors.append(e.args[0]) + + if formdata is not None: + # Developer must supply ip_address directly so throw a + # non-validation exception if it's not present + if not self.ip_address: + raise ValueError('IP address is required.') + + try: + # These fields are coming from the outside so keep them + # inside the usual process + challenge = formdata.getlist('recaptcha_challenge_field') + if not challenge: + raise ValueError(self.gettext(u'Challenge data is required.')) + self.challenge = challenge[0] + + # Pass user input as the raw_data + self.raw_data = formdata.getlist('recaptcha_response_field') + self.process_formdata(self.raw_data) + except ValueError as e: + self.process_errors.append(e.args[0]) + + for filter in self.filters: + try: + self.data = filter(self.data) + except ValueError as e: + self.process_errors.append(e.args[0]) + diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wtfrecaptcha/validators.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wtfrecaptcha/validators.py new file mode 100644 index 0000000000000000000000000000000000000000..d2eafe9b0dc60e5e565fac5f90e9367b7f3a1c27 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wtfrecaptcha/validators.py @@ -0,0 +1,73 @@ +import logging +try: + from urllib.request import ProxyHandler, urlopen, build_opener, \ + install_opener + from urllib.parse import urlencode +except ImportError: + # Python 2.x compatible import + from urllib2 import ProxyHandler, urlopen, build_opener, install_opener + from urllib import urlencode + +from wtforms.validators import ValidationError + + +logger = logging.getLogger(__name__) + + +class Recaptcha(object): + """Validates captcha by using reCaptcha API""" + + # Mapping of response error codes + errors = { + 'invalid-site-public-key': u'Invalid public key', + 'invalid-site-private-key': u'Invalid private key', + 'invalid-request-cookie': u'Challenge is incorrect', + 'incorrect-captcha-sol': u'Incorrect captcha solution', + 'verify-params-incorrect': u'Incorrect parameters', + 'invalid-referrer': u'Incorrect domain', + 'recaptcha-not-reachable': u'Could not connect to reCaptcha' + } + + empty_error_text = u'This field is required' + internal_error_text = u'Internal error, please try again later' + + def _call_verify(self, params, proxy): + """Performs a call to reCaptcha API with given params""" + data = [] + if proxy: + proxy_handler = ProxyHandler({'http': proxy}) + opener = build_opener(proxy_handler) + install_opener(opener) + + try: + response = urlopen('http://www.google.com/recaptcha/api/verify', + data=urlencode(params).encode('utf-8')) + data = response.read().decode('utf-8').splitlines() + response.close() + except Exception as e: + logger.error(str(e)) + raise ValidationError(self.errors['recaptcha-not-reachable']) + + return data + + def __call__(self, form, field): + # Captcha challenge response is required + if not field.data: + raise ValidationError(field.gettext(self.empty_error_text)) + + # Construct params assuming all the data is present + params = (('privatekey', field.private_key), + ('remoteip', field.ip_address), + ('challenge', field.challenge), + ('response', field.data)) + + data = self._call_verify(params, field.http_proxy) + if data[0] == 'false': + # Show only incorrect solution to the user else show default message + if data[1] == 'incorrect-captcha-sol': + raise ValidationError(field.gettext(self.errors[data[1]])) + else: + # Log error message in case it wasn't triggered by user + logger.error(self.errors.get(data[1], data[1])) + raise ValidationError(field.gettext(self.internal_error_text)) + diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wtfrecaptcha/widgets.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wtfrecaptcha/widgets.py new file mode 100644 index 0000000000000000000000000000000000000000..dc9a36e6b5f469742d400e8aaa667b45014e5075 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/wtfrecaptcha/widgets.py @@ -0,0 +1,24 @@ +from wtforms.widgets import HTMLString + +# Template for the widget +RECAPTCHA_HTML = HTMLString(u""" +""") + +class Recaptcha(object): + """Recaptcha widget that displays HTML depending on security status""" + + def __call__(self, field, **kwargs): + html = RECAPTCHA_HTML % { + 'protocol': field.secure and 'https' or 'http', + 'public_key': field.public_key + } + return html diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/xgboost-3.2.0.dist-info/INSTALLER b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/xgboost-3.2.0.dist-info/INSTALLER new file mode 100644 index 0000000000000000000000000000000000000000..a1b589e38a32041e49332e5e81c2d363dc418d68 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/xgboost-3.2.0.dist-info/INSTALLER @@ -0,0 +1 @@ +pip diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/xgboost-3.2.0.dist-info/METADATA b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/xgboost-3.2.0.dist-info/METADATA new file mode 100644 index 0000000000000000000000000000000000000000..6287b63bf73e44f17ebf288efd7cd2b1b413b74e --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/xgboost-3.2.0.dist-info/METADATA @@ -0,0 +1,60 @@ +Metadata-Version: 2.4 +Name: xgboost +Version: 3.2.0 +Summary: XGBoost Python Package +Project-URL: documentation, https://xgboost.readthedocs.io/en/stable/ +Project-URL: repository, https://github.com/dmlc/xgboost +Author-email: Hyunsu Cho , Jiaming Yuan +License: Apache-2.0 +Classifier: Development Status :: 5 - Production/Stable +Classifier: License :: OSI Approved :: Apache Software License +Classifier: Operating System :: OS Independent +Classifier: Programming Language :: Python +Classifier: Programming Language :: Python :: 3 +Classifier: Programming Language :: Python :: 3.10 +Classifier: Programming Language :: Python :: 3.11 +Classifier: Programming Language :: Python :: 3.12 +Classifier: Programming Language :: Python :: 3.13 +Classifier: Programming Language :: Python :: 3.14 +Classifier: Typing :: Typed +Requires-Python: >=3.10 +Requires-Dist: numpy +Requires-Dist: nvidia-nccl-cu12; platform_system == 'Linux' +Requires-Dist: scipy +Provides-Extra: dask +Requires-Dist: dask; extra == 'dask' +Requires-Dist: distributed; extra == 'dask' +Requires-Dist: pandas; extra == 'dask' +Provides-Extra: pandas +Requires-Dist: pandas>=1.2; extra == 'pandas' +Provides-Extra: plotting +Requires-Dist: graphviz; extra == 'plotting' +Requires-Dist: matplotlib; extra == 'plotting' +Provides-Extra: pyspark +Requires-Dist: cloudpickle; extra == 'pyspark' +Requires-Dist: pyspark>=3.4; extra == 'pyspark' +Requires-Dist: scikit-learn; extra == 'pyspark' +Provides-Extra: scikit-learn +Requires-Dist: scikit-learn; extra == 'scikit-learn' +Description-Content-Type: text/x-rst + +====================== +XGBoost Python Package +====================== + +|PyPI version| + +Installation +============ + +From `PyPI `_ +--------------------------------------------------- + +For a stable version, install using ``pip``:: + + pip install xgboost + +.. |PyPI version| image:: https://badge.fury.io/py/xgboost.svg + :target: http://badge.fury.io/py/xgboost + +For building from source, see `build `_. diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/xgboost-3.2.0.dist-info/RECORD b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/xgboost-3.2.0.dist-info/RECORD new file mode 100644 index 0000000000000000000000000000000000000000..96cfe6c6226166729e650e9a6a22c9e309a15c4c --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/xgboost-3.2.0.dist-info/RECORD @@ -0,0 +1,112 @@ +xgboost-3.2.0.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4 +xgboost-3.2.0.dist-info/METADATA,sha256=iwKjxgl1aNySlYCvKmn4PyPY7GRba8nR5glFssN6DQs,2092 +xgboost-3.2.0.dist-info/RECORD,, +xgboost-3.2.0.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +xgboost-3.2.0.dist-info/WHEEL,sha256=4LQcpRv1Qa2a8oWMPjcNOswZKPV7o_Z_cr1g9Eiiq9s,105 +xgboost-3.2.0.dist-info/sboms/auditwheel.cdx.json,sha256=q3YMMnYMuVu5vnG6zkLm-zs22vQbJd3ahN5Rln6fjI4,1293 +xgboost.libs/libgomp-e985bcbb.so.1.0.0,sha256=pDkE5PopcwHUZA3BuzyKNIC0BvmeSY66mxkUtoqrYEo,253289 +xgboost/VERSION,sha256=M72vni1ry94uTmE-hl5AP4_iH8YhB400wwsL3H9o2QM,6 +xgboost/__init__.py,sha256=VnZMmYCsWUkxhe5F1Wgi1EkPEkdbdBgB8EBfPxnNGT8,1244 +xgboost/__pycache__/__init__.cpython-310.pyc,, +xgboost/__pycache__/_data_utils.cpython-310.pyc,, +xgboost/__pycache__/_typing.cpython-310.pyc,, +xgboost/__pycache__/callback.cpython-310.pyc,, +xgboost/__pycache__/collective.cpython-310.pyc,, +xgboost/__pycache__/compat.cpython-310.pyc,, +xgboost/__pycache__/config.cpython-310.pyc,, +xgboost/__pycache__/core.cpython-310.pyc,, +xgboost/__pycache__/data.cpython-310.pyc,, +xgboost/__pycache__/federated.cpython-310.pyc,, +xgboost/__pycache__/libpath.cpython-310.pyc,, +xgboost/__pycache__/objective.cpython-310.pyc,, +xgboost/__pycache__/plotting.cpython-310.pyc,, +xgboost/__pycache__/sklearn.cpython-310.pyc,, +xgboost/__pycache__/tracker.cpython-310.pyc,, +xgboost/__pycache__/training.cpython-310.pyc,, +xgboost/_data_utils.py,sha256=bBVEyA8Zovqe36hc49H-Xfl6FDB3kwjZAhIzwApcf6I,24893 +xgboost/_typing.py,sha256=3Mi4wIckdpGRGEAKFQwilbAgMHRgG9XcK9HPAsvsPN4,2964 +xgboost/callback.py,sha256=nhj4SouWmYOR0mXLmIXouqbH6xB0A31DUlraJ51kuEY,21213 +xgboost/collective.py,sha256=a3mK4cC2FdcrhyUUiHLKw8XrbJNhOvBcGIAql6luv_g,10068 +xgboost/compat.py,sha256=6CLnS29LErJ7CM6-mcbFo-hPvvqKWspKigP3U3OnrYg,7900 +xgboost/config.py,sha256=i12PHWrW-8LS2QSD4G0Mzn0Phunhv9U_qoF5mB-ZBIo,5046 +xgboost/core.py,sha256=xoP7PQ2w8CGWLuYZSTwibbrhuE5JxzhtFH22G8NNsr0,120510 +xgboost/dask/__init__.py,sha256=kEhdwsDnKsBZlSKjMmyFViDZXssFoITAgyn_V8Wk7t4,78506 +xgboost/dask/__pycache__/__init__.cpython-310.pyc,, +xgboost/dask/__pycache__/data.cpython-310.pyc,, +xgboost/dask/__pycache__/utils.cpython-310.pyc,, +xgboost/dask/data.py,sha256=tK1D4XG20qvLKrbIRI85Er1URjuHIeJoA7nSyFF253M,13789 +xgboost/dask/utils.py,sha256=M5KCURzpaCxS9na7kBM4OOgzcBk2XODnt_5UWNOoFlA,3537 +xgboost/data.py,sha256=fiePsp75qOI59CN8FivHAouCLuqKIQPU94uiTtdmwxc,54028 +xgboost/federated.py,sha256=aqQqM2QwYS9-otsFyu73dOJFvDD9m8sUpeC1kd1Mb_M,3054 +xgboost/lib/libxgboost.so,sha256=1QqSPtMV_xV3hgREqC1u5nqlf9vGj-oYn4dw0xhLdVo,236823337 +xgboost/libpath.py,sha256=iqWTr4JQA8-qWmx6LXuZnCD1bUR31Q_Ny_0_GQmgrh0,2921 +xgboost/objective.py,sha256=7Jw8oYRLTFgEKaoTGD2-z5ZkHeJLMPLMtStE94QQ0z4,2398 +xgboost/plotting.py,sha256=O7nU0IaXiO0Arm4yUezr85EhBb_-y_3SiM0Z_EqvTGo,10043 +xgboost/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +xgboost/sklearn.py,sha256=OjRHwEIBtH96OMIhVghbCjEFYhRgvAFUR8efxrzP8TY,88867 +xgboost/spark/__init__.py,sha256=1mUcqO-IJfbq8u9kZPpCULZd-asFZomnQMEF5eWqNxM,536 +xgboost/spark/__pycache__/__init__.cpython-310.pyc,, +xgboost/spark/__pycache__/core.cpython-310.pyc,, +xgboost/spark/__pycache__/data.cpython-310.pyc,, +xgboost/spark/__pycache__/estimator.cpython-310.pyc,, +xgboost/spark/__pycache__/params.cpython-310.pyc,, +xgboost/spark/__pycache__/summary.cpython-310.pyc,, +xgboost/spark/__pycache__/utils.cpython-310.pyc,, +xgboost/spark/core.py,sha256=-R4WZETD0WqaGxIQRyrE_UG7xRaS4cUMnV5SMl3YH8Q,71313 +xgboost/spark/data.py,sha256=SQMl5hfLVAsHwoCgVJfgjQTDP-S_vXlzuNQ1sbeTUsA,12460 +xgboost/spark/estimator.py,sha256=jgsD7-917mid5FrNbDpj1Wt2E4ixcKHOsS4xh0yjuvU,23952 +xgboost/spark/params.py,sha256=e9lzBO7mDuioGKHnNcYSaip17WuldtwD4G6czTpiFWg,3172 +xgboost/spark/summary.py,sha256=Xktbfd32OlMIHtwfyimgaKJVeu3MLDytL07pdp67sk8,1397 +xgboost/spark/utils.py,sha256=GUCZPsny93Rp433PBtu-9T-FX3e2btD6FL3ccXMxi2g,7112 +xgboost/testing/__init__.py,sha256=Y4O_9FLscOdoHE54bFraegUtakRliJyk5lvTSasNQ0w,22748 +xgboost/testing/__pycache__/__init__.cpython-310.pyc,, +xgboost/testing/__pycache__/basic_models.cpython-310.pyc,, +xgboost/testing/__pycache__/callbacks.cpython-310.pyc,, +xgboost/testing/__pycache__/collective.cpython-310.pyc,, +xgboost/testing/__pycache__/continuation.cpython-310.pyc,, +xgboost/testing/__pycache__/dask.cpython-310.pyc,, +xgboost/testing/__pycache__/data.cpython-310.pyc,, +xgboost/testing/__pycache__/data_iter.cpython-310.pyc,, +xgboost/testing/__pycache__/federated.cpython-310.pyc,, +xgboost/testing/__pycache__/interaction_constraints.cpython-310.pyc,, +xgboost/testing/__pycache__/intercept.cpython-310.pyc,, +xgboost/testing/__pycache__/metrics.cpython-310.pyc,, +xgboost/testing/__pycache__/monotone_constraints.cpython-310.pyc,, +xgboost/testing/__pycache__/multi_target.cpython-310.pyc,, +xgboost/testing/__pycache__/ordinal.cpython-310.pyc,, +xgboost/testing/__pycache__/params.cpython-310.pyc,, +xgboost/testing/__pycache__/parse_tree.cpython-310.pyc,, +xgboost/testing/__pycache__/plotting.cpython-310.pyc,, +xgboost/testing/__pycache__/predict.cpython-310.pyc,, +xgboost/testing/__pycache__/quantile_dmatrix.cpython-310.pyc,, +xgboost/testing/__pycache__/ranking.cpython-310.pyc,, +xgboost/testing/__pycache__/shared.cpython-310.pyc,, +xgboost/testing/__pycache__/updater.cpython-310.pyc,, +xgboost/testing/__pycache__/utils.cpython-310.pyc,, +xgboost/testing/__pycache__/with_skl.cpython-310.pyc,, +xgboost/testing/basic_models.py,sha256=H8SQMBMRr12fh6A_wuoB3EcgQMTjEbXw_XHczmLu-ak,2079 +xgboost/testing/callbacks.py,sha256=6m-ia_sesKcOprnYIsUFe0QHyNJ-G61vBjxICzZYHCg,5436 +xgboost/testing/collective.py,sha256=amgotLGyauZaUGCwe-5j5mejCysLjueuD8s6r3vZ3ps,481 +xgboost/testing/continuation.py,sha256=uz5Bj5nr_xlZ_MxiaA_C7qzSQyVH2FV0bMs6GExxitw,1919 +xgboost/testing/dask.py,sha256=608G3yr4rEe_CtVyi0Wv6a1jIEba_iMZf_DUcR_8x3g,12605 +xgboost/testing/data.py,sha256=szdia9_5zOLdEbRMQk1K74NIZUbUOe3oXixmpJKdxJM,34858 +xgboost/testing/data_iter.py,sha256=OfEINcveo3TSoevwl7IQrMLmzLgJB_YqWf5Pm71uRoE,4936 +xgboost/testing/federated.py,sha256=OF1Vi1Rod1lEkHVoH_0jMwndHvSe_E3LOrHCnqJALQc,5304 +xgboost/testing/interaction_constraints.py,sha256=nRwT7KokJ2MSJbChdtGBaJuP1UttwCD791v3liCVesk,2981 +xgboost/testing/intercept.py,sha256=Eujf_ESnOHuuKul4P-VIA_KYGLVupQD1MNdQpQeN7h4,8606 +xgboost/testing/metrics.py,sha256=lsVAk_-nJNVCwXjUhxNDbXp1tO_2LaOZ2LpEuvQOGuY,8704 +xgboost/testing/monotone_constraints.py,sha256=WOpUsCx4fZv4RR4WhxrWga0--ohEB52rOExj2f2R1Qc,2135 +xgboost/testing/multi_target.py,sha256=_Ez30c7VuvvYMcz6yQ7rp0yVcVdP8n85bMPuQX291sI,26242 +xgboost/testing/ordinal.py,sha256=FY4bcmcY5AaI5aR3amcGiGNnOej7vW_0RIUMq27KdCM,26891 +xgboost/testing/params.py,sha256=r-inxERqQfiTeeKzdiEVNs3bFo0T6pxuUzXDF0iVRVM,3358 +xgboost/testing/parse_tree.py,sha256=Kvsj3Xn-RnvMzqegZOoaUcZh6Ec4Bp7-JsPU2LfsDWQ,1108 +xgboost/testing/plotting.py,sha256=hlw2_AZ_moti9p5QEwRYsE4GpNgwANz67aL32HOvktc,957 +xgboost/testing/predict.py,sha256=54s9aQ_OsZWxv2SKRUHiK4LsmZSBYyHaKH2TZxQn84A,2868 +xgboost/testing/quantile_dmatrix.py,sha256=4HSJ7ZF9p_-MlNeMDCHEaPFnCJyRvbiHeK8Z9fz3Sx0,1953 +xgboost/testing/ranking.py,sha256=K-i5slCuP9SuCVe8eyAzbbaSHnA9lhddBiGwKoAegQ0,6412 +xgboost/testing/shared.py,sha256=9qMp5HpCCssyCMV1SHNTFed5w7oiW-dzXASY-fVjMSs,3137 +xgboost/testing/updater.py,sha256=WWn0Q4kF-5xlTswZWmM1Q8mrmPT_rwESLrjTY7EW8ik,20313 +xgboost/testing/utils.py,sha256=0Tl24rt8z1vtColgNbwZdB1RyZOWIYgsNFDKZAiiPD8,1387 +xgboost/testing/with_skl.py,sha256=Jhtvbz8YgX9kvnsj-2zsWA2kykHk03dWKCtfWJPSf-U,7150 +xgboost/tracker.py,sha256=UyBDmhmN7e9VKel_3ecxsfDGfBYu-K2gBY3TT1NDM1s,4539 +xgboost/training.py,sha256=PdGqlb4Q-E8HqNXI6KK0yzU_ylRoABu5bXnlhO412w4,21532 diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/xgboost-3.2.0.dist-info/REQUESTED b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/xgboost-3.2.0.dist-info/REQUESTED new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/xgboost-3.2.0.dist-info/WHEEL b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/xgboost-3.2.0.dist-info/WHEEL new file mode 100644 index 0000000000000000000000000000000000000000..6b1a195f8af08f19bc2b9704a2a4f2638f11f052 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/xgboost-3.2.0.dist-info/WHEEL @@ -0,0 +1,4 @@ +Wheel-Version: 1.0 +Generator: hatchling 1.28.0 +Root-Is-Purelib: true +Tag: py3-none-manylinux_2_28_x86_64 diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/xgboost-3.2.0.dist-info/sboms/auditwheel.cdx.json b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/xgboost-3.2.0.dist-info/sboms/auditwheel.cdx.json new file mode 100644 index 0000000000000000000000000000000000000000..76058441ea0586578613a0151079680e7ec6d26a --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/xgboost-3.2.0.dist-info/sboms/auditwheel.cdx.json @@ -0,0 +1 @@ +{"bomFormat": "CycloneDX", "specVersion": "1.4", "version": 1, "metadata": {"component": {"type": "library", "bom-ref": "pkg:pypi/xgboost@3.2.0?file_name=xgboost-3.2.0-py3-none-manylinux_2_28_x86_64.whl", "name": "xgboost", "version": "3.2.0", "purl": "pkg:pypi/xgboost@3.2.0?file_name=xgboost-3.2.0-py3-none-manylinux_2_28_x86_64.whl"}, "tools": [{"name": "auditwheel", "version": "6.6.0"}]}, "components": [{"type": "library", "bom-ref": "pkg:pypi/xgboost@3.2.0?file_name=xgboost-3.2.0-py3-none-manylinux_2_28_x86_64.whl", "name": "xgboost", "version": "3.2.0", "purl": "pkg:pypi/xgboost@3.2.0?file_name=xgboost-3.2.0-py3-none-manylinux_2_28_x86_64.whl"}, {"type": "library", "bom-ref": "pkg:rpm/almalinux/libgomp@8.5.0-28.el8_10.alma.1#c61017c9a24eb6e1e1a3cdc9becd004a6419cbda3d54b4848b98f240a4829571", "name": "libgomp", "version": "8.5.0-28.el8_10.alma.1", "purl": "pkg:rpm/almalinux/libgomp@8.5.0-28.el8_10.alma.1"}], "dependencies": [{"ref": "pkg:pypi/xgboost@3.2.0?file_name=xgboost-3.2.0-py3-none-manylinux_2_28_x86_64.whl", "dependsOn": ["pkg:rpm/almalinux/libgomp@8.5.0-28.el8_10.alma.1#c61017c9a24eb6e1e1a3cdc9becd004a6419cbda3d54b4848b98f240a4829571"]}, {"ref": "pkg:rpm/almalinux/libgomp@8.5.0-28.el8_10.alma.1#c61017c9a24eb6e1e1a3cdc9becd004a6419cbda3d54b4848b98f240a4829571"}]} \ No newline at end of file diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/xgboost/VERSION b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/xgboost/VERSION new file mode 100644 index 0000000000000000000000000000000000000000..944880fa15e85084780c290b929924d3f8b6085f --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/xgboost/VERSION @@ -0,0 +1 @@ +3.2.0 diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/xgboost/__init__.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/xgboost/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..7b8697f1d2d0ceed669c8b0452a5faa73f57c564 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/xgboost/__init__.py @@ -0,0 +1,65 @@ +"""XGBoost: eXtreme Gradient Boosting library. + +Contributors: https://github.com/dmlc/xgboost/blob/master/CONTRIBUTORS.md +""" + +from . import tracker # noqa +from . import collective +from .core import ( + Booster, + DataIter, + DMatrix, + ExtMemQuantileDMatrix, + QuantileDMatrix, + _py_version, + build_info, +) +from .tracker import RabitTracker # noqa +from .training import cv, train + +try: + from .config import config_context, get_config, set_config + from .plotting import plot_importance, plot_tree, to_graphviz + from .sklearn import ( + XGBClassifier, + XGBModel, + XGBRanker, + XGBRegressor, + XGBRFClassifier, + XGBRFRegressor, + ) +except ImportError: + pass + + +__version__ = _py_version() + + +__all__ = [ + # core + "DMatrix", + "QuantileDMatrix", + "ExtMemQuantileDMatrix", + "Booster", + "DataIter", + "train", + "cv", + # utilities + "RabitTracker", + "build_info", + "plot_importance", + "plot_tree", + "to_graphviz", + "set_config", + "get_config", + "config_context", + # sklearn + "XGBModel", + "XGBClassifier", + "XGBRegressor", + "XGBRanker", + "XGBRFClassifier", + "XGBRFRegressor", + # collective + "collective", +] diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/xgboost/_data_utils.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/xgboost/_data_utils.py new file mode 100644 index 0000000000000000000000000000000000000000..c8123032d1c22183c3d291809e9c9ece07604d24 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/xgboost/_data_utils.py @@ -0,0 +1,795 @@ +"""Helpers for interfacing array like objects.""" + +import copy +import ctypes +import json +from abc import ABC, abstractmethod +from functools import cache as fcache +from typing import ( + TYPE_CHECKING, + Any, + Callable, + Dict, + List, + Literal, + Optional, + Protocol, + Tuple, + Type, + TypeAlias, + TypedDict, + TypeGuard, + Union, + cast, + overload, +) + +import numpy as np + +from ._typing import ( + ArrowCatList, + CNumericPtr, + DataType, + FeatureTypes, + NumpyDType, + NumpyOrCupy, +) +from .compat import import_cupy, import_pyarrow, lazy_isinstance + +if TYPE_CHECKING: + import pandas as pd + import pyarrow as pa + + +# Used for accepting inputs for numpy and cupy arrays +class _ArrayLikeArg(Protocol): + @property + def __array_interface__(self) -> "ArrayInf": ... + + +class _CudaArrayLikeArg(Protocol): + @property + def __cuda_array_interface__(self) -> "CudaArrayInf": ... + + +ArrayInf = TypedDict( + "ArrayInf", + { + "data": Tuple[int, bool], + "typestr": str, + "version": Literal[3], + "strides": Optional[Tuple[int, ...]], + "shape": Tuple[int, ...], + "mask": Union["ArrayInf", None, _ArrayLikeArg], + }, +) + +CudaArrayInf = TypedDict( + "CudaArrayInf", + { + "data": Tuple[int, bool], + "typestr": str, + "version": Literal[3], + "strides": Optional[Tuple[int, ...]], + "shape": Tuple[int, ...], + "mask": Union["ArrayInf", None, _ArrayLikeArg], + "stream": int, + }, +) + +StringArray = TypedDict("StringArray", {"offsets": ArrayInf, "values": ArrayInf}) +CudaStringArray = TypedDict( + "CudaStringArray", {"offsets": CudaArrayInf, "values": CudaArrayInf} +) + + +def array_hasobject(data: DataType) -> bool: + """Whether the numpy array has object dtype.""" + return ( + hasattr(data, "dtype") + and hasattr(data.dtype, "hasobject") + and data.dtype.hasobject + ) + + +def cuda_array_interface_dict(data: _CudaArrayLikeArg) -> CudaArrayInf: + """Returns a dictionary storing the CUDA array interface.""" + if array_hasobject(data): + raise ValueError("Input data contains `object` dtype. Expecting numeric data.") + ainf = data.__cuda_array_interface__ + if "mask" in ainf: + ainf["mask"] = ainf["mask"].__cuda_array_interface__ # type: ignore + return ainf + + +def cuda_array_interface(data: _CudaArrayLikeArg) -> bytes: + """Make cuda array interface str.""" + interface = cuda_array_interface_dict(data) + interface_str = bytes(json.dumps(interface), "utf-8") + return interface_str + + +def from_array_interface(interface: ArrayInf, zero_copy: bool = False) -> NumpyOrCupy: + """Convert array interface to numpy or cupy array""" + + class Array: + """Wrapper type for communicating with numpy and cupy.""" + + _interface: Optional[ArrayInf] = None + + @property + def __array_interface__(self) -> Optional[ArrayInf]: + return self._interface + + @__array_interface__.setter + def __array_interface__(self, interface: ArrayInf) -> None: + self._interface = copy.copy(interface) + # Convert some fields to tuple as required by numpy + self._interface["shape"] = tuple(self._interface["shape"]) + self._interface["data"] = ( + self._interface["data"][0], + self._interface["data"][1], + ) + strides = self._interface.get("strides", None) + if strides is not None: + self._interface["strides"] = tuple(strides) + + @property + def __cuda_array_interface__(self) -> Optional[ArrayInf]: + return self.__array_interface__ + + @__cuda_array_interface__.setter + def __cuda_array_interface__(self, interface: ArrayInf) -> None: + self.__array_interface__ = interface + + @property + def shape(self) -> Tuple[int, ...]: + """Shape of the input array.""" + aif = self.__array_interface__ + assert aif is not None + return aif["shape"] + + @property + def size(self) -> np.signedinteger: + """Total size of the input array.""" + return np.prod(self.shape) + + arr = Array() + + # Cupy and numpy might run into issue when constructing an empty array from an array + # interface. we explicitly check for emptiness. + if "stream" in interface: + # CUDA stream is presented, this is a __cuda_array_interface__. + arr.__cuda_array_interface__ = interface + cp = import_cupy() + if arr.size == 0: + return cp.empty(shape=arr.shape, dtype=np.dtype(interface["typestr"])) + out = cp.array(arr, copy=not zero_copy) + else: + arr.__array_interface__ = interface + if arr.size == 0: + return np.empty(shape=arr.shape, dtype=np.dtype(interface["typestr"])) + out = np.array(arr, copy=not zero_copy) + + return out + + +# Default constant value for CUDA per-thread stream. +STREAM_PER_THREAD = 2 + + +# Typing is not strict as there are subtle differences between CUDA array interface and +# array interface. We handle them uniformly for now. +def make_array_interface( + ptr: Union[CNumericPtr, int], + shape: Tuple[int, ...], + dtype: Type[np.number], + is_cuda: bool, +) -> ArrayInf: + """Make an __(cuda)_array_interface__ from a pointer.""" + # Use an empty array to handle typestr and descr + if is_cuda: + empty = import_cupy().empty(shape=(0,), dtype=dtype) + array = empty.__cuda_array_interface__ # pylint: disable=no-member + else: + empty = np.empty(shape=(0,), dtype=dtype) + array = empty.__array_interface__ # pylint: disable=no-member + + if not isinstance(ptr, int): + addr = ctypes.cast(ptr, ctypes.c_void_p).value + else: + addr = ptr + length = int(np.prod(shape)) + # Handle empty dataset. + assert addr is not None or length == 0 + + if addr is None: + return array + + array["data"] = (addr, True) + if is_cuda and "stream" not in array: + array["stream"] = STREAM_PER_THREAD + array["shape"] = shape + array["strides"] = None + return array + + +def is_arrow_dict(data: Any) -> TypeGuard["pa.DictionaryArray"]: + """Is this an arrow dictionary array?""" + return lazy_isinstance(data, "pyarrow.lib", "DictionaryArray") + + +class DfCatAccessor(Protocol): + """Protocol for pandas cat accessor.""" + + @property + def categories( # pylint: disable=missing-function-docstring + self, + ) -> "pd.Index": ... + + @property + def codes(self) -> "pd.Series": ... # pylint: disable=missing-function-docstring + + @property + def dtype(self) -> np.dtype: ... # pylint: disable=missing-function-docstring + + @property + def values(self) -> np.ndarray: ... # pylint: disable=missing-function-docstring + + def to_arrow( # pylint: disable=missing-function-docstring + self, + ) -> Union["pa.StringArray", "pa.IntegerArray"]: ... + + @property + def __cuda_array_interface__(self) -> CudaArrayInf: ... + + @property + def _column(self) -> Any: ... + + +def _is_df_cat(data: Any) -> TypeGuard[DfCatAccessor]: + # Test pd.Series.cat, not pd.Series + return hasattr(data, "categories") and hasattr(data, "codes") + + +@fcache +def _arrow_npdtype() -> Dict[Any, Type[np.number]]: + import pyarrow as pa + + mapping: Dict[Any, Type[np.number]] = { + pa.int8(): np.int8, + pa.int16(): np.int16, + pa.int32(): np.int32, + pa.int64(): np.int64, + pa.uint8(): np.uint8, + pa.uint16(): np.uint16, + pa.uint32(): np.uint32, + pa.uint64(): np.uint64, + pa.float16(): np.float16, + pa.float32(): np.float32, + pa.float64(): np.float64, + } + + return mapping + + +@overload +def _arrow_buf_inf(address: int, typestr: str, size: int, stream: None) -> ArrayInf: ... + + +@overload +def _arrow_buf_inf( + address: int, typestr: str, size: int, stream: int +) -> CudaArrayInf: ... + + +def _arrow_buf_inf( + address: int, typestr: str, size: int, stream: Optional[int] +) -> Union[ArrayInf, CudaArrayInf]: + if stream is not None: + jcuaif: CudaArrayInf = { + "data": (address, True), + "typestr": typestr, + "version": 3, + "strides": None, + "shape": (size,), + "mask": None, + "stream": stream, + } + return jcuaif + + jaif: ArrayInf = { + "data": (address, True), + "typestr": typestr, + "version": 3, + "strides": None, + "shape": (size,), + "mask": None, + } + return jaif + + +def _arrow_cat_names_inf(cats: "pa.StringArray") -> Tuple[StringArray, Any]: + if not TYPE_CHECKING: + pa = import_pyarrow() + + # FIXME(jiamingy): Account for offset, need to find an implementation that returns + # offset > 0 + assert cats.offset == 0 + buffers: List[pa.Buffer] = cats.buffers() + mask, offset, data = buffers + assert offset.is_cpu + + off_len = len(cats) + 1 + + def get_n_bytes(typ: Type) -> int: + return off_len * (np.iinfo(typ).bits // 8) + + if offset.size == get_n_bytes(np.int64): + if not isinstance(cats, pa.LargeStringArray): + arrow_str_error = "Expecting a `pyarrow.Array`." + raise TypeError(arrow_str_error + f" Got: {type(cats)}.") + # Convert to 32bit integer, arrow recommends against the use of i64. Also, + # XGBoost cannot handle large number of categories (> 2**31). + i32cats = cats.cast(pa.string()) + mask, offset, data = i32cats.buffers() + + if offset.size != get_n_bytes(np.int32): + raise TypeError( + "Arrow dictionary type offsets is required to be 32-bit integer." + ) + + joffset = _arrow_buf_inf(offset.address, " ArrayInf: + """Helper for handling categorical codes.""" + if not TYPE_CHECKING: + pa = import_pyarrow() + if not isinstance(array, pa.Array): # pylint: disable=E0606 + raise TypeError(f"Invalid input type: {type(array)}") + + mask, data = array.buffers() + jdata = make_array_interface( + data.address, + shape=(len(array),), + dtype=_arrow_npdtype()[array.type], + is_cuda=not data.is_cpu, + ) + + if mask is not None: + jmask: Optional[ArrayInf] = { + "data": (mask.address, True), + "typestr": " Tuple[StringArray, ArrayInf, Tuple]: + """Get the array interface representation of a string-based category array.""" + jnames, cats_tmp = _arrow_cat_names_inf(cats) + jcodes = _arrow_array_inf(codes) + + return jnames, jcodes, (cats_tmp, None) + + +def _ensure_np_dtype( + data: DataType, dtype: Optional[NumpyDType] +) -> Tuple[np.ndarray, Optional[NumpyDType]]: + """Ensure the np array has correct type and is contiguous.""" + if array_hasobject(data) or data.dtype in [np.float16, np.bool_]: + dtype = np.float32 + data = data.astype(dtype, copy=False) + if not data.flags.aligned: + data = np.require(data, requirements="A") + return data, dtype + + +def _is_flatten(array: NumpyOrCupy) -> bool: + return len(array.shape) == 1 or array.shape[1] == 1 + + +def array_interface_dict(data: np.ndarray) -> ArrayInf: + """Returns an array interface from the input.""" + if array_hasobject(data): + raise ValueError("Input data contains `object` dtype. Expecting numeric data.") + ainf = data.__array_interface__ + if "mask" in ainf: + ainf["mask"] = ainf["mask"].__array_interface__ + return cast(ArrayInf, ainf) + + +def pd_cat_inf( # pylint: disable=too-many-locals + cats: DfCatAccessor, codes: "pd.Series" +) -> Tuple[Union[StringArray, ArrayInf], ArrayInf, Tuple]: + """Get the array interface representation of pandas category accessor.""" + # pandas uses -1 to represent missing values for categorical features + codes = codes.replace(-1, np.nan) + + def is_prim() -> bool: + dtype = cats.dtype + try: + return np.issubdtype(dtype, np.floating) or np.issubdtype(dtype, np.integer) + except TypeError: + return False + + if is_prim(): + # Numeric index type + name_values_num = cats.values + jarr_values = array_interface_dict(name_values_num) + code_values = codes.values + jarr_codes = array_interface_dict(code_values) + return jarr_values, jarr_codes, (name_values_num, code_values) + + def npstr_to_arrow_strarr(strarr: Any) -> Tuple[np.ndarray, str]: + """Convert a string-like array to an arrow string array.""" + if not isinstance(strarr, np.ndarray): + if hasattr(strarr, "to_numpy"): + strarr = strarr.to_numpy(dtype=object) + else: + strarr = np.asarray(strarr, dtype=object) + + lenarr = np.vectorize(len) + offsets = np.cumsum( + np.concatenate([np.array([0], dtype=np.int64), lenarr(strarr)]) + ) + if strarr.dtype.kind == "S": + str_list = [s.decode("utf-8") for s in strarr.tolist()] + else: + str_list = [str(s) for s in strarr.tolist()] + values = "".join(str_list) + assert "\0" not in values # arrow string array doesn't need null terminal + return offsets.astype(np.int32), values + + # String index type + name_offsets, name_values = npstr_to_arrow_strarr(cats.values) + name_offsets, _ = _ensure_np_dtype(name_offsets, np.int32) + joffsets = array_interface_dict(name_offsets) + bvalues = name_values.encode("utf-8") + + ptr = ctypes.c_void_p.from_buffer(ctypes.c_char_p(bvalues)).value + assert ptr is not None + + jvalues: ArrayInf = { + "data": (ptr, True), + "typestr": "|i1", + "shape": (len(name_values),), + "strides": None, + "version": 3, + "mask": None, + } + jnames: StringArray = {"offsets": joffsets, "values": jvalues} + + code_values = codes.values + jcodes = array_interface_dict(code_values) + + buf = ( + name_offsets, + name_values, + bvalues, + code_values, + ) # store temporary values + return jnames, jcodes, buf + + +def array_interface(data: np.ndarray) -> bytes: + """Make array interface str.""" + interface = array_interface_dict(data) + interface_str = bytes(json.dumps(interface), "utf-8") + return interface_str + + +def check_cudf_meta(data: _CudaArrayLikeArg, field: str) -> None: + "Make sure no missing value in meta data." + if ( + "mask" in data.__cuda_array_interface__ + and data.__cuda_array_interface__["mask"] is not None + ): + raise ValueError(f"Missing value is not allowed for: {field}") + + +class ArrowSchema(ctypes.Structure): + """The Schema type from arrow C array.""" + + _fields_ = [ + ("format", ctypes.c_char_p), + ("name", ctypes.c_char_p), + ("metadata", ctypes.c_char_p), + ("flags", ctypes.c_int64), + ("n_children", ctypes.c_int64), + ("children", ctypes.POINTER(ctypes.c_void_p)), + ("dictionary", ctypes.c_void_p), + ("release", ctypes.c_void_p), + ("private_data", ctypes.c_void_p), + ] + + +class ArrowArray(ctypes.Structure): + """The Array type from arrow C array.""" + + +ArrowArray._fields_ = [ # pylint: disable=protected-access + ("length", ctypes.c_int64), + ("null_count", ctypes.c_int64), + ("offset", ctypes.c_int64), + ("n_buffers", ctypes.c_int64), + ("n_children", ctypes.c_int64), + ("buffers", ctypes.POINTER(ctypes.c_void_p)), + ("children", ctypes.POINTER(ctypes.POINTER(ArrowArray))), + ("dictionary", ctypes.POINTER(ArrowArray)), + ("release", ctypes.c_void_p), + ("private_data", ctypes.c_void_p), +] + + +class ArrowDeviceArray(ctypes.Structure): + """The Array type from arrow C device array.""" + + _fields_ = [ + ("array", ArrowArray), + ("device_id", ctypes.c_int64), + ("device_type", ctypes.c_int32), + ("sync_event", ctypes.c_void_p), + ("reserved", ctypes.c_int64 * 3), + ] + + +PyCapsule_GetName = ctypes.pythonapi.PyCapsule_GetName +PyCapsule_GetName.restype = ctypes.c_char_p +PyCapsule_GetName.argtypes = [ctypes.py_object] + + +PyCapsule_GetPointer = ctypes.pythonapi.PyCapsule_GetPointer +PyCapsule_GetPointer.restype = ctypes.c_void_p +PyCapsule_GetPointer.argtypes = [ctypes.py_object, ctypes.c_char_p] + + +def wait_event(event_hdl: int) -> None: + """Wait for CUDA event exported by arrow.""" + # cuda-python is a dependency of cuDF. + from cuda.bindings import runtime as cudart + + event = ctypes.cast(event_hdl, ctypes.POINTER(ctypes.c_int64)) + (status,) = cudart.cudaStreamWaitEvent( + STREAM_PER_THREAD, + event.contents.value, + cudart.cudaEventWaitDefault, + ) + if status != cudart.cudaError_t.cudaSuccess: + _, msg = cudart.cudaGetErrorString(status) + raise ValueError(msg) + + +def cudf_cat_inf( # pylint: disable=too-many-locals + cats: DfCatAccessor, codes: "pd.Series" +) -> Tuple[Union[CudaArrayInf, CudaStringArray], ArrayInf, Tuple]: + """Obtain the cuda array interface for cuDF categories.""" + cp = import_cupy() + is_num_idx = cp.issubdtype(cats.dtype, cp.floating) or cp.issubdtype( + cats.dtype, cp.integer + ) + if is_num_idx: + cats_ainf = cuda_array_interface_dict(cats) + codes_ainf = cuda_array_interface_dict(codes) + return cats_ainf, codes_ainf, (cats, codes) + + # pylint: disable=protected-access + arrow_col = cats._column.to_pylibcudf(mode="read") + # Tuple[types.CapsuleType, types.CapsuleType] + schema, array = arrow_col.__arrow_c_device_array__() + + array_ptr = PyCapsule_GetPointer(array, PyCapsule_GetName(array)) + schema_ptr = PyCapsule_GetPointer(schema, PyCapsule_GetName(schema)) + + # Cast to arrow array + arrow_device_array = ctypes.cast( + array_ptr, ctypes.POINTER(ArrowDeviceArray) + ).contents + wait_event(arrow_device_array.sync_event) + assert arrow_device_array.device_type == 2 # 2 is CUDA + + arrow_array = arrow_device_array.array + mask, offset, data = ( + arrow_array.buffers[0], + arrow_array.buffers[1], + arrow_array.buffers[2], + ) + # Categories should not have missing values. + assert mask is None + assert arrow_array.n_children == 0 + assert arrow_array.n_buffers == 3 + assert arrow_array.offset == 0 + + # Cast to ArrowSchema + arrow_schema = ctypes.cast(schema_ptr, ctypes.POINTER(ArrowSchema)).contents + assert arrow_schema.format in (b"u", b"U", b"vu") # utf8, large utf8 + if arrow_schema.format in (b"u", b"vu"): + joffset: CudaArrayInf = _arrow_buf_inf( + offset, " None: + # The handle type is a bundle of the handle and the free call. Otherwise, we + # will have to import the `_lib` and the `_check_call` from the core module + # inside the __del__ method to avoid cyclic model dependency. + # Importing modules in __del__ can result in Python abort if __del__ is called + # during exception handling (interpreter is shutting down). + self._handle, self._free = handle + self._arrow_arrays = arrow_arrays + + def to_arrow(self) -> ArrowCatList: + """Get the categories in the dataset. The results are stored in a list of + (feature name, arrow array) pairs, with one array for each categorical + feature. If a feature is numerical, then the corresponding column in the list is + None. A value error will be raised if this container was created without the + `export_to_arrow` option. + + """ + if self._arrow_arrays is None: + raise ValueError( + "The `export_to_arrow` option of the `get_categories` method" + " is required." + ) + return self._arrow_arrays + + def empty(self) -> bool: + """Returns True if there's no category.""" + return self._handle.value is None + + def get_handle(self) -> int: + """Internal method for retrieving the handle.""" + assert self._handle.value + return self._handle.value + + def __del__(self) -> None: + if self._handle.value is None: + return + self._free() + + +def get_ref_categories( + feature_types: Optional[Union[FeatureTypes, Categories]], +) -> Tuple[Optional[FeatureTypes], Optional[Categories]]: + """Get the optional reference categories from the `feature_types`. This is used by + various `DMatrix` where the `feature_types` is reused for specifying the reference + categories. + + """ + if isinstance(feature_types, Categories): + ref_categories = feature_types + feature_types = None + else: + ref_categories = None + return feature_types, ref_categories + + +# Type schema for storing JSON-encoded array interface +AifType: TypeAlias = List[ + Union[ + # numeric column + Union[ArrayInf, CudaArrayInf], + # categorical column + Tuple[ + # (cuda) numeric index | (cuda) string index + Union[ArrayInf, CudaArrayInf, StringArray, CudaStringArray], + Union[ArrayInf, CudaArrayInf], # codes + ], + ] +] + + +class TransformedDf(ABC): + """Internal class for storing transformed dataframe. + + Parameters + ---------- + ref_categories : + Optional reference categories used for re-coding. + + aitfs : + Array interface for each column. + + """ + + def __init__( + self, + ref_categories: Optional[Categories], + aitfs: AifType, + temporary_buffers: List[Tuple], + ) -> None: + self.ref_categories = ref_categories + if ref_categories is not None and ref_categories.get_handle() is not None: + aif = ref_categories.get_handle() + self.ref_aif: Optional[int] = aif + else: + self.ref_aif = None + + self.aitfs = aitfs + self.temporary_buffers = temporary_buffers + + def array_interface(self) -> bytes: + """Return a byte string for JSON encoded array interface.""" + if self.ref_categories is not None: + ref_inf: dict = {"ref_categories": self.ref_aif, "columns": self.aitfs} + inf = bytes(json.dumps(ref_inf), "utf-8") + else: + inf = bytes(json.dumps(self.aitfs), "utf-8") + return inf + + @property + @abstractmethod + def shape(self) -> Tuple[int, int]: + """Return the shape of the dataframe.""" diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/xgboost/_typing.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/xgboost/_typing.py new file mode 100644 index 0000000000000000000000000000000000000000..c7e609dc8ff781ef9b195fdf7a108911c50eeb6c --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/xgboost/_typing.py @@ -0,0 +1,125 @@ +# pylint: disable=protected-access +"""Shared typing definition.""" + +import ctypes +import os +from typing import ( + TYPE_CHECKING, + Any, + AnyStr, + Callable, + Dict, + List, + Optional, + Sequence, + Tuple, + Type, + TypeAlias, + TypeVar, + Union, +) + +import numpy as np + +DataType = Any + +FeatureInfo = Sequence[str] +FeatureNames = FeatureInfo +FeatureTypes = FeatureInfo +BoosterParam = Union[List, Dict[str, Any]] # better be sequence + +ArrayLike = Any +if TYPE_CHECKING: + import pyarrow as pa + + PathLike = Union[str, os.PathLike[str]] +else: + PathLike = Union[str, os.PathLike] + +ArrowCatCol: TypeAlias = Optional[Union["pa.StringArray", "pa.NumericArray"]] +ArrowCatList: TypeAlias = List[Tuple[str, Optional[ArrowCatCol]]] + +CupyT = ArrayLike # maybe need a stub for cupy arrays +NumpyOrCupy = Union[np.ndarray, Any] +NumpyDType = Union[str, Type[np.number]] +PandasDType = Any # real type is pandas.core.dtypes.base.ExtensionDtype + +FloatCompatible = Union[float, np.float32, np.float64] + +# typing.SupportsInt is not suitable here since floating point values are convertible to +# integers as well. +Integer = Union[int, np.integer] +IterationRange = Tuple[Integer, Integer] + +# callables +FPreProcCallable = Callable + +# ctypes +# c_bst_ulong corresponds to bst_ulong defined in xgboost/c_api.h +c_bst_ulong = ctypes.c_uint64 # pylint: disable=C0103 + +ModelIn = Union[os.PathLike[AnyStr], bytearray, str] + +CTypeT = TypeVar( + "CTypeT", + ctypes.c_void_p, + ctypes.c_char_p, + ctypes.c_int, + ctypes.c_float, + ctypes.c_uint, + ctypes.c_size_t, +) + +# supported numeric types +CNumeric = Union[ + ctypes.c_float, + ctypes.c_double, + ctypes.c_uint, + ctypes.c_uint64, + ctypes.c_int32, + ctypes.c_int64, +] + +# c pointer types +if TYPE_CHECKING: + CStrPtr = ctypes._Pointer[ctypes.c_char] + + CStrPptr = ctypes._Pointer[ctypes.c_char_p] + + CFloatPtr = ctypes._Pointer[ctypes.c_float] + + CNumericPtr = Union[ + ctypes._Pointer[ctypes.c_float], + ctypes._Pointer[ctypes.c_double], + ctypes._Pointer[ctypes.c_uint], + ctypes._Pointer[ctypes.c_uint64], + ctypes._Pointer[ctypes.c_int32], + ctypes._Pointer[ctypes.c_int64], + ] +else: + CStrPtr = ctypes._Pointer + + CStrPptr = ctypes._Pointer + + CFloatPtr = ctypes._Pointer + + CNumericPtr = Union[ + ctypes._Pointer, + ctypes._Pointer, + ctypes._Pointer, + ctypes._Pointer, + ctypes._Pointer, + ctypes._Pointer, + ] + +# The second arg is actually Optional[List[cudf.Series]], skipped for easier type check. +# The cudf Series is the obtained cat codes, preserved in the `DataIter` to prevent it +# being freed. +TransformedData = Tuple[Any, Optional[FeatureNames], Optional[FeatureTypes]] + +# template parameter +_T = TypeVar("_T") +_F = TypeVar("_F", bound=Callable[..., Any]) + +_ScoreList = Union[List[float], List[Tuple[float, float]]] +EvalsLog: TypeAlias = Dict[str, Dict[str, _ScoreList]] diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/xgboost/callback.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/xgboost/callback.py new file mode 100644 index 0000000000000000000000000000000000000000..8deeab8b6f6672c8a1b7ef828d17947600a7a092 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/xgboost/callback.py @@ -0,0 +1,652 @@ +"""Callback library containing training routines. See :doc:`Callback Functions +` for a quick introduction. + +""" + +import collections +import os +import pickle +from abc import ABC +from typing import ( + Any, + Callable, + Dict, + List, + Optional, + Sequence, + Tuple, + TypeAlias, + TypeVar, + Union, + cast, +) + +import numpy + +from . import collective +from ._typing import EvalsLog, _ScoreList +from .core import ( + Booster, + DMatrix, + XGBoostError, + _deprecate_positional_args, + _parse_eval_str, +) + +__all__ = [ + "TrainingCallback", + "LearningRateScheduler", + "EarlyStopping", + "EvaluationMonitor", + "TrainingCheckPoint", + "CallbackContainer", +] + +_Score = Union[float, Tuple[float, float]] + +_Model = Any # real type is Union[Booster, CVPack]; need more work + + +# pylint: disable=unused-argument +class TrainingCallback(ABC): + """Interface for training callback. + + .. versionadded:: 1.3.0 + + """ + + EvalsLog: TypeAlias = EvalsLog + + def __init__(self) -> None: + pass + + def before_training(self, model: _Model) -> _Model: + """Run before training starts.""" + return model + + def after_training(self, model: _Model) -> _Model: + """Run after training is finished.""" + return model + + def before_iteration(self, model: _Model, epoch: int, evals_log: EvalsLog) -> bool: + """Run before each iteration. Returns True when training should stop. See + :py:meth:`after_iteration` for details. + + """ + return False + + def after_iteration(self, model: _Model, epoch: int, evals_log: EvalsLog) -> bool: + """Run after each iteration. Returns `True` when training should stop. + + Parameters + ---------- + + model : + Eeither a :py:class:`~xgboost.Booster` object or a CVPack if the cv function + in xgboost is being used. + epoch : + The current training iteration. + evals_log : + A dictionary containing the evaluation history: + + .. code-block:: python + + {"data_name": {"metric_name": [0.5, ...]}} + + """ + return False + + +def _aggcv(rlist: List[str]) -> List[Tuple[str, float, float]]: + # pylint: disable=invalid-name, too-many-locals + """Aggregate cross-validation results.""" + cvmap: Dict[Tuple[int, str], List[float]] = {} + idx = rlist[0].split()[0] + for line in rlist: + arr: List[str] = line.split() + assert idx == arr[0] + for metric_idx, it in enumerate(arr[1:]): + if not isinstance(it, str): + it = it.decode() + k, v = it.split(":") + if (metric_idx, k) not in cvmap: + cvmap[(metric_idx, k)] = [] + cvmap[(metric_idx, k)].append(float(v)) + msg = idx + results = [] + for (_, name), s in sorted(cvmap.items(), key=lambda x: x[0][0]): + as_arr = numpy.array(s) + if not isinstance(msg, str): + msg = msg.decode() + mean, std = numpy.mean(as_arr), numpy.std(as_arr) + results.extend([(name, mean, std)]) + return results + + +# allreduce type +_ART = TypeVar("_ART") + + +def _allreduce_metric(score: _ART) -> _ART: + """Helper function for computing customized metric in distributed + environment. Not strictly correct as many functions don't use mean value + as final result. + + """ + world = collective.get_world_size() + assert world != 0 + if world == 1: + return score + if isinstance(score, tuple): # has mean and stdv + raise ValueError( + "xgboost.cv function should not be used in distributed environment." + ) + arr = numpy.array([score]) + arr = collective.allreduce(arr, collective.Op.SUM) / world + return arr[0] + + +class CallbackContainer: + """A special internal callback for invoking a list of other callbacks. + + .. versionadded:: 1.3.0 + + """ + + def __init__( + self, + callbacks: Sequence[TrainingCallback], + metric: Optional[Callable] = None, + output_margin: bool = True, + is_cv: bool = False, + ) -> None: + self.callbacks = list(dict.fromkeys(callbacks)) + for cb in callbacks: + if not isinstance(cb, TrainingCallback): + raise TypeError("callback must be an instance of `TrainingCallback`.") + + msg = ( + "metric must be callable object for monitoring. For builtin metrics" + ", passing them in training parameter invokes monitor automatically." + ) + if metric is not None and not callable(metric): + raise TypeError(msg) + + self.metric = metric + self.history: EvalsLog = collections.OrderedDict() + self._output_margin = output_margin + self.is_cv = is_cv + + if self.is_cv: + self.aggregated_cv: Optional[list[tuple[str, float, float]]] = None + + def before_training(self, model: _Model) -> _Model: + """Function called before training.""" + for c in self.callbacks: + model = c.before_training(model=model) + msg = "before_training should return the model" + if self.is_cv: + assert isinstance(model.cvfolds, list), msg + else: + assert isinstance(model, Booster), msg + return model + + def after_training(self, model: _Model) -> _Model: + """Function called after training.""" + for c in self.callbacks: + model = c.after_training(model=model) + msg = "after_training should return the model" + if self.is_cv: + assert isinstance(model.cvfolds, list), msg + else: + assert isinstance(model, Booster), msg + + return model + + def before_iteration( + self, + model: _Model, + epoch: int, + dtrain: DMatrix, + evals: Optional[List[Tuple[DMatrix, str]]], + ) -> bool: + """Function called before training iteration.""" + return any( + c.before_iteration(model, epoch, self.history) for c in self.callbacks + ) + + def _update_history( + self, + score: Union[List[Tuple[str, float]], List[Tuple[str, float, float]]], + epoch: int, + ) -> None: + for d in score: + name: str = d[0] + s: float = d[1] + if self.is_cv: + std = float(cast(Tuple[str, float, float], d)[2]) + x: _Score = (s, std) + else: + x = s + splited_names = name.split("-") + data_name = splited_names[0] + metric_name = "-".join(splited_names[1:]) + x = _allreduce_metric(x) + if data_name not in self.history: + self.history[data_name] = collections.OrderedDict() + data_history = self.history[data_name] + if metric_name not in data_history: + data_history[metric_name] = cast(_ScoreList, []) + metric_history = data_history[metric_name] + if self.is_cv: + cast(List[Tuple[float, float]], metric_history).append( + cast(Tuple[float, float], x) + ) + else: + cast(List[float], metric_history).append(cast(float, x)) + + def after_iteration( + self, + model: _Model, + epoch: int, + dtrain: DMatrix, + evals: Optional[List[Tuple[DMatrix, str]]], + ) -> bool: + """Function called after training iteration.""" + if self.is_cv: + scores = model.eval(epoch, self.metric, self._output_margin) + scores = _aggcv(scores) + self.aggregated_cv = scores + self._update_history(scores, epoch) + else: + evals = [] if evals is None else evals + for _, name in evals: + assert name.find("-") == -1, "Dataset name should not contain `-`" + score: str = model.eval_set(evals, epoch, self.metric, self._output_margin) + metric_score = _parse_eval_str(score) + self._update_history(metric_score, epoch) + ret = any(c.after_iteration(model, epoch, self.history) for c in self.callbacks) + return ret + + +class LearningRateScheduler(TrainingCallback): + """Callback function for scheduling learning rate. + + .. versionadded:: 1.3.0 + + Parameters + ---------- + + learning_rates : + If it's a callable object, then it should accept an integer parameter + `epoch` and returns the corresponding learning rate. Otherwise it + should be a sequence like list or tuple with the same size of boosting + rounds. + + """ + + def __init__( + self, learning_rates: Union[Callable[[int], float], Sequence[float]] + ) -> None: + if not callable(learning_rates) and not isinstance( + learning_rates, collections.abc.Sequence + ): + raise TypeError( + "Invalid learning rates, expecting callable or sequence, got: " + f"{type(learning_rates)}" + ) + + if callable(learning_rates): + self.learning_rates = learning_rates + else: + self.learning_rates = lambda epoch: cast(Sequence, learning_rates)[epoch] + super().__init__() + + def after_iteration(self, model: _Model, epoch: int, evals_log: EvalsLog) -> bool: + model.set_param("learning_rate", self.learning_rates(epoch)) + return False + + +# pylint: disable=too-many-instance-attributes +class EarlyStopping(TrainingCallback): + """Callback function for early stopping + + .. versionadded:: 1.3.0 + + Parameters + ---------- + rounds : + Early stopping rounds. + metric_name : + Name of metric that is used for early stopping. + data_name : + Name of dataset that is used for early stopping. + maximize : + Whether to maximize evaluation metric. None means auto (discouraged). + save_best : + Whether training should return the best model or the last model. If set to + `True`, it will only keep the boosting rounds up to the detected best iteration, + discarding the ones that come after. This is only supported with tree methods + (not `gblinear`). Also, the `cv` function doesn't return a model, the parameter + is not applicable. + min_delta : + + .. versionadded:: 1.5.0 + + Minimum absolute change in score to be qualified as an improvement. + + Examples + -------- + + .. code-block:: python + + es = xgboost.callback.EarlyStopping( + rounds=2, + min_delta=1e-3, + save_best=True, + maximize=False, + data_name="validation_0", + metric_name="mlogloss", + ) + clf = xgboost.XGBClassifier(tree_method="hist", device="cuda", callbacks=[es]) + + X, y = load_digits(return_X_y=True) + clf.fit(X, y, eval_set=[(X, y)]) + """ + + # pylint: disable=too-many-arguments + @_deprecate_positional_args + def __init__( + self, + *, + rounds: int, + metric_name: Optional[str] = None, + data_name: Optional[str] = None, + maximize: Optional[bool] = None, + save_best: Optional[bool] = False, + min_delta: float = 0.0, + ) -> None: + self.data = data_name + self.metric_name = metric_name + self.rounds = rounds + self.save_best = save_best + self.maximize = maximize + self.stopping_history: EvalsLog = {} + self._min_delta = min_delta + if self._min_delta < 0: + raise ValueError("min_delta must be greater or equal to 0.") + + self.current_rounds: int = 0 + self.best_scores: dict = {} + self.starting_round: int = 0 + super().__init__() + + def before_training(self, model: _Model) -> _Model: + self.starting_round = model.num_boosted_rounds() + if not isinstance(model, Booster) and self.save_best: + raise ValueError( + "`save_best` is not applicable to the `cv` function as it doesn't" + " return a model." + ) + return model + + def _update_rounds( + self, *, score: _Score, name: str, metric: str, model: _Model, epoch: int + ) -> bool: + def get_s(value: _Score) -> float: + """get score if it's cross validation history.""" + return value[0] if isinstance(value, tuple) else value + + def maximize(new: _Score, best: _Score) -> bool: + """New score should be greater than the old one.""" + return numpy.greater(get_s(new) - self._min_delta, get_s(best)) + + def minimize(new: _Score, best: _Score) -> bool: + """New score should be lesser than the old one.""" + return numpy.greater(get_s(best) - self._min_delta, get_s(new)) + + if self.maximize is None: + # Just to be compatibility with old behavior before 1.3. We should let + # user to decide. + maximize_metrics = ( + "auc", + "aucpr", + "pre", + "pre@", + "map", + "ndcg", + "auc@", + "aucpr@", + "map@", + "ndcg@", + ) + if metric != "mape" and any(metric.startswith(x) for x in maximize_metrics): + self.maximize = True + else: + self.maximize = False + + if self.maximize: + improve_op = maximize + else: + improve_op = minimize + + if not self.stopping_history: # First round + self.current_rounds = 0 + self.stopping_history[name] = {} + self.stopping_history[name][metric] = cast(_ScoreList, [score]) + self.best_scores[name] = {} + self.best_scores[name][metric] = [score] + model.set_attr(best_score=str(get_s(score)), best_iteration=str(epoch)) + elif not improve_op(score, self.best_scores[name][metric][-1]): + # Not improved + self.stopping_history[name][metric].append(score) # type: ignore + self.current_rounds += 1 + else: # Improved + self.stopping_history[name][metric].append(score) # type: ignore + self.best_scores[name][metric].append(score) + record = self.stopping_history[name][metric][-1] + model.set_attr(best_score=str(get_s(record)), best_iteration=str(epoch)) + self.current_rounds = 0 # reset + + if self.current_rounds >= self.rounds: + # Should stop + return True + return False + + def after_iteration(self, model: _Model, epoch: int, evals_log: EvalsLog) -> bool: + epoch += self.starting_round # training continuation + msg = "Must have at least 1 validation dataset for early stopping." + if len(evals_log.keys()) < 1: + raise ValueError(msg) + + # Get data name + if self.data: + data_name = self.data + else: + # Use the last one as default. + data_name = list(evals_log.keys())[-1] + if data_name not in evals_log: + raise ValueError(f"No dataset named: {data_name}") + + if not isinstance(data_name, str): + raise TypeError( + f"The name of the dataset should be a string. Got: {type(data_name)}" + ) + data_log = evals_log[data_name] + + # Get metric name + if self.metric_name: + metric_name = self.metric_name + else: + # Use last metric by default. + metric_name = list(data_log.keys())[-1] + if metric_name not in data_log: + raise ValueError(f"No metric named: {metric_name}") + + # The latest score + score = data_log[metric_name][-1] + return self._update_rounds( + score=score, name=data_name, metric=metric_name, model=model, epoch=epoch + ) + + def after_training(self, model: _Model) -> _Model: + if not self.save_best: + return model + + try: + best_iteration = model.best_iteration + best_score = model.best_score + assert best_iteration is not None and best_score is not None + model = model[: best_iteration + 1] + model.best_iteration = best_iteration + model.best_score = best_score + except XGBoostError as e: + raise XGBoostError( + "`save_best` is not applicable to the current booster" + ) from e + + return model + + +class EvaluationMonitor(TrainingCallback): + """Print the evaluation result at each iteration. + + .. versionadded:: 1.3.0 + + Parameters + ---------- + + rank : + Which worker should be used for printing the result. + period : + How many epoches between printing. + show_stdv : + Used in cv to show standard deviation. Users should not specify it. + logger : + A callable used for logging evaluation result. + + """ + + def __init__( + self, + rank: int = 0, + period: int = 1, + show_stdv: bool = False, + logger: Callable[[str], None] = collective.communicator_print, + ): + self.printer_rank = rank + self.show_stdv = show_stdv + self.period = period + self._logger = logger + assert period > 0 + # last error message, useful when early stopping and period are used together. + self._latest: Optional[str] = None + super().__init__() + + def _fmt_metric( + self, data: str, metric: str, score: float, std: Optional[float] + ) -> str: + if std is not None and self.show_stdv: + msg = f"\t{data + '-' + metric}:{score:.5f}+{std:.5f}" + else: + msg = f"\t{data + '-' + metric}:{score:.5f}" + return msg + + def after_iteration(self, model: _Model, epoch: int, evals_log: EvalsLog) -> bool: + if not evals_log: + return False + + msg: str = f"[{epoch}]" + if collective.get_rank() == self.printer_rank: + for data, metric in evals_log.items(): + for metric_name, log in metric.items(): + stdv: Optional[float] = None + if isinstance(log[-1], tuple): + score = log[-1][0] + stdv = log[-1][1] + else: + score = log[-1] + msg += self._fmt_metric(data, metric_name, score, stdv) + msg += "\n" + + if (epoch % self.period) == 0 or self.period == 1: + self._logger(msg) + self._latest = None + else: + # There is skipped message + self._latest = msg + return False + + def after_training(self, model: _Model) -> _Model: + if collective.get_rank() == self.printer_rank and self._latest is not None: + self._logger(self._latest) + return model + + +class TrainingCheckPoint(TrainingCallback): + """Checkpointing operation. Users are encouraged to create their own callbacks for + checkpoint as XGBoost doesn't handle distributed file systems. When checkpointing on + distributed systems, be sure to know the rank of the worker to avoid multiple + workers checkpointing to the same place. + + .. versionadded:: 1.3.0 + + Since XGBoost 2.1.0, the default format is changed to UBJSON. + + Parameters + ---------- + + directory : + Output model directory. + name : + pattern of output model file. Models will be saved as name_0.ubj, name_1.ubj, + name_2.ubj .... + as_pickle : + When set to True, all training parameters will be saved in pickle format, + instead of saving only the model. + interval : + Interval of checkpointing. Checkpointing is slow so setting a larger number can + reduce performance hit. + + """ + + default_format = "ubj" + + def __init__( + self, + directory: Union[str, os.PathLike], + name: str = "model", + as_pickle: bool = False, + interval: int = 100, + ) -> None: + self._path = os.fspath(directory) + self._name = name + self._as_pickle = as_pickle + self._iterations = interval + self._epoch = 0 # counter for iterval + self._start = 0 # beginning iteration + super().__init__() + + def before_training(self, model: _Model) -> _Model: + self._start = model.num_boosted_rounds() + return model + + def after_iteration(self, model: _Model, epoch: int, evals_log: EvalsLog) -> bool: + if self._epoch == self._iterations: + path = os.path.join( + self._path, + self._name + + "_" + + (str(epoch + self._start)) + + (".pkl" if self._as_pickle else f".{self.default_format}"), + ) + self._epoch = 0 # reset counter + if collective.get_rank() == 0: + # checkpoint using the first worker + if self._as_pickle: + with open(path, "wb") as fd: + pickle.dump(model, fd) + else: + model.save_model(path) + self._epoch += 1 + return False diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/xgboost/collective.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/xgboost/collective.py new file mode 100644 index 0000000000000000000000000000000000000000..385276b87d2a468dd35b5e9d141876f0d31521e2 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/xgboost/collective.py @@ -0,0 +1,360 @@ +"""XGBoost collective communication related API.""" + +import ctypes +import logging +import os +import pickle +from dataclasses import dataclass +from enum import IntEnum, unique +from typing import Any, Dict, Optional, TypeAlias, Union + +import numpy as np + +from ._typing import _T +from .core import _LIB, _check_call, build_info, c_str, make_jcargs, py_str + +LOGGER = logging.getLogger("[xgboost.collective]") + + +_Conf: TypeAlias = Dict[str, Union[int, str]] +_ArgVals: TypeAlias = Optional[Union[int, str]] +_Args: TypeAlias = Dict[str, _ArgVals] + + +@dataclass +class Config: + """User configuration for the communicator context. This is used for easier + integration with distributed frameworks. Users of the collective module can pass the + parameters directly into tracker and the communicator. + + .. versionadded:: 3.0 + + Attributes + ---------- + retry : See `dmlc_retry` in :py:meth:`init`. + + timeout : + See `dmlc_timeout` in :py:meth:`init`. This is only used for communicators, not + the tracker. They are different parameters since the timeout for tracker limits + only the time for starting and finalizing the communication group, whereas the + timeout for communicators limits the time used for collective operations, like + :py:meth:`allreduce`. + + tracker_host_ip : See :py:class:`~xgboost.tracker.RabitTracker`. + + tracker_port : See :py:class:`~xgboost.tracker.RabitTracker`. + + tracker_timeout : See :py:class:`~xgboost.tracker.RabitTracker`. + + """ + + retry: Optional[int] = None + timeout: Optional[int] = None + + tracker_host_ip: Optional[str] = None + tracker_port: Optional[int] = None + tracker_timeout: Optional[int] = None + + def get_comm_config(self, args: _Conf) -> _Conf: + """Update the arguments for the communicator.""" + if self.retry is not None: + args["dmlc_retry"] = self.retry + if self.timeout is not None: + args["dmlc_timeout"] = self.timeout + return args + + +def init(**args: _ArgVals) -> None: + """Initialize the collective library with arguments. + + Parameters + ---------- + args : + Keyword arguments representing the parameters and their values. + + Accepted parameters: + - dmlc_communicator: The type of the communicator. + * rabit: Use Rabit. This is the default if the type is unspecified. + * federated: Use the gRPC interface for Federated Learning. + + Only applicable to the Rabit communicator: + - dmlc_tracker_uri: Hostname of the tracker. + - dmlc_tracker_port: Port number of the tracker. + - dmlc_task_id: ID of the current task, can be used to obtain deterministic + - dmlc_retry: The number of retry when handling network errors. + - dmlc_timeout: Timeout in seconds. + - dmlc_nccl_path: Path to load (dlopen) nccl for GPU-based communication. + + Only applicable to the Federated communicator: + - federated_server_address: Address of the federated server. + - federated_world_size: Number of federated workers. + - federated_rank: Rank of the current worker. + - federated_server_cert: Server certificate file path. Only needed for the SSL + mode. + - federated_client_key: Client key file path. Only needed for the SSL mode. + - federated_client_cert: Client certificate file path. Only needed for the SSL + mode. + + Use upper case for environment variables, use lower case for runtime + configuration. + + """ + _check_call(_LIB.XGCommunicatorInit(make_jcargs(**args))) + + +def finalize() -> None: + """Finalize the communicator.""" + _check_call(_LIB.XGCommunicatorFinalize()) + + +def get_rank() -> int: + """Get rank of current process. + + Returns + ------- + rank : int + Rank of current process. + """ + ret = _LIB.XGCommunicatorGetRank() + return ret + + +def get_world_size() -> int: + """Get total number workers. + + Returns + ------- + n : + Total number of process. + """ + ret = _LIB.XGCommunicatorGetWorldSize() + return ret + + +def is_distributed() -> bool: + """If the collective communicator is distributed.""" + is_dist = _LIB.XGCommunicatorIsDistributed() + return bool(is_dist) + + +def communicator_print(msg: Any) -> None: + """Print message to the communicator. + + This function can be used to communicate the information of + the progress to the communicator. + + Parameters + ---------- + msg : str + The message to be printed to the communicator. + """ + if not isinstance(msg, str): + msg = str(msg) + is_dist = _LIB.XGCommunicatorIsDistributed() + if is_dist != 0: + _check_call(_LIB.XGCommunicatorPrint(c_str(msg.strip()))) + else: + print(msg.strip(), flush=True) + + +def get_processor_name() -> str: + """Get the processor name. + + Returns + ------- + name : + The name of processor(host) + """ + name_str = ctypes.c_char_p() + _check_call(_LIB.XGCommunicatorGetProcessorName(ctypes.byref(name_str))) + value = name_str.value + return py_str(value) + + +def broadcast(data: _T, root: int) -> _T: + """Broadcast object from one node to all other nodes. + + Parameters + ---------- + data : any type that can be pickled + Input data, if current rank does not equal root, this can be None + root : int + Rank of the node to broadcast data from. + + Returns + ------- + object : int + the result of broadcast. + """ + rank = get_rank() + length = ctypes.c_ulong() + if root == rank: + assert data is not None, "need to pass in data when broadcasting" + s = pickle.dumps(data, protocol=pickle.HIGHEST_PROTOCOL) + length.value = len(s) + # Run first broadcast + _check_call( + _LIB.XGCommunicatorBroadcast( + ctypes.byref(length), ctypes.sizeof(ctypes.c_ulong), root + ) + ) + if root != rank: + dptr = (ctypes.c_char * length.value)() + # run second + _check_call( + _LIB.XGCommunicatorBroadcast( + ctypes.cast(dptr, ctypes.c_void_p), length.value, root + ) + ) + data = pickle.loads(dptr.raw) + del dptr + else: + _check_call( + _LIB.XGCommunicatorBroadcast( + ctypes.cast(ctypes.c_char_p(s), ctypes.c_void_p), length.value, root + ) + ) + del s + return data + + +# enumeration of dtypes +def _map_dtype(dtype: np.dtype) -> int: + dtype_map = { + np.dtype("float16"): 0, + np.dtype("float32"): 1, + np.dtype("float64"): 2, + np.dtype("int8"): 4, + np.dtype("int16"): 5, + np.dtype("int32"): 6, + np.dtype("int64"): 7, + np.dtype("uint8"): 8, + np.dtype("uint16"): 9, + np.dtype("uint32"): 10, + np.dtype("uint64"): 11, + } + try: + dtype_map.update({np.dtype("float128"): 3}) + except TypeError: # float128 doesn't exist on the system + pass + + if dtype not in dtype_map: + raise TypeError(f"data type {dtype} is not supported on the current platform.") + + return dtype_map[dtype] + + +@unique +class Op(IntEnum): + """Supported operations for allreduce.""" + + MAX = 0 + MIN = 1 + SUM = 2 + BITWISE_AND = 3 + BITWISE_OR = 4 + BITWISE_XOR = 5 + + +def allreduce(data: np.ndarray, op: Op) -> np.ndarray: + """Perform allreduce, return the result. + + Parameters + ---------- + data : + Input data. + op : + Reduction operator. + + Returns + ------- + result : + The result of allreduce, have same shape as data + + Notes + ----- + This function is not thread-safe. + """ + if not isinstance(data, np.ndarray): + raise TypeError("allreduce only takes in numpy.ndarray") + buf = data.ravel().copy() + _check_call( + _LIB.XGCommunicatorAllreduce( + buf.ctypes.data_as(ctypes.c_void_p), + buf.size, + _map_dtype(buf.dtype), + int(op), + ) + ) + return buf + + +def signal_error() -> None: + """Kill the process.""" + _check_call(_LIB.XGCommunicatorSignalError()) + + +def _find_nccl() -> Optional[str]: + from nvidia.nccl import lib + + # There are two versions of nvidia-nccl, one is from PyPI, another one from + # nvidia-pyindex. We support only the first one as the second one is too old (2.9.8 + # as of writing). + # + # nccl 2.28 doesn't have the __file__ attribute, we use the namespace path instead. + if lib.__file__ is not None: + dirname: Optional[str] = os.path.dirname(lib.__file__) + elif hasattr(lib, "__path__") and len(lib.__path__) > 0: + dirname = lib.__path__[0] + else: + dirname = None + if not dirname: + return None + + # Find the first shared object in the lib directory. + files = os.listdir(dirname) + if not files: + return None + + libname: Optional[str] = None + for name in files: + if name.startswith("libnccl.so"): + libname = name + break + + if libname is not None: + path = os.path.join(dirname, libname) + return path + return None + + +class CommunicatorContext: + """A context controlling collective communicator initialization and finalization.""" + + def __init__(self, **args: _ArgVals) -> None: + self.args = args + key = "dmlc_nccl_path" + if args.get(key, None) is not None: + return + + binfo = build_info() + if not binfo["USE_DLOPEN_NCCL"]: + return + + try: + # PyPI package of NCCL. + path = _find_nccl() + if path: + self.args[key] = path + except ImportError: + pass + + def __enter__(self) -> _Args: + init(**self.args) + assert is_distributed() + LOGGER.debug("-------------- communicator say hello ------------------") + return self.args + + def __exit__(self, *args: Any) -> None: + finalize() + LOGGER.debug("--------------- communicator say bye ------------------") diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/xgboost/compat.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/xgboost/compat.py new file mode 100644 index 0000000000000000000000000000000000000000..46322a2f5d74b49e5abc667623108312c547edb5 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/xgboost/compat.py @@ -0,0 +1,286 @@ +# pylint: disable=unused-import +"""For compatibility and optional dependencies.""" + +import functools +import importlib.util +import logging +import sys +import types +from typing import TYPE_CHECKING, Any, Sequence, TypeGuard, cast + +import numpy as np + +from ._typing import _T, DataType + +if TYPE_CHECKING: + import pandas as pd + import pyarrow as pa + +assert sys.version_info[0] == 3, "Python 2 is no longer supported." + + +def py_str(x: bytes | None) -> str: + """convert c string back to python string""" + assert x is not None # ctypes might return None + return x.decode("utf-8") # type: ignore + + +def lazy_isinstance(instance: Any, module: str, name: str) -> bool: + """Use string representation to identify a type.""" + + # Notice, we use .__class__ as opposed to type() in order + # to support object proxies such as weakref.proxy + cls = instance.__class__ + is_same_module = cls.__module__ == module + has_same_name = cls.__name__ == name + return is_same_module and has_same_name + + +# sklearn +try: + from sklearn import __version__ as _sklearn_version + from sklearn.base import BaseEstimator as XGBModelBase + from sklearn.base import ClassifierMixin as XGBClassifierBase + from sklearn.base import RegressorMixin as XGBRegressorBase + + try: + from sklearn.model_selection import StratifiedKFold as XGBStratifiedKFold + except ImportError: + from sklearn.cross_validation import StratifiedKFold as XGBStratifiedKFold + + # sklearn.utils Tags types can be imported unconditionally once + # xgboost's minimum scikit-learn version is 1.6 or higher + try: + from sklearn.utils import Tags as _sklearn_Tags + except ImportError: + _sklearn_Tags = object + + SKLEARN_INSTALLED = True + +except ImportError: + SKLEARN_INSTALLED = False + + # used for compatibility without sklearn + class XGBModelBase: # type: ignore[no-redef] + """Dummy class for sklearn.base.BaseEstimator.""" + + class XGBClassifierBase: # type: ignore[no-redef] + """Dummy class for sklearn.base.ClassifierMixin.""" + + class XGBRegressorBase: # type: ignore[no-redef] + """Dummy class for sklearn.base.RegressorMixin.""" + + XGBStratifiedKFold = None + + _sklearn_Tags = object + _sklearn_version = object + + +_logger = logging.getLogger(__name__) + + +@functools.cache +def is_cudf_available() -> bool: + """Check cuDF package available or not""" + if importlib.util.find_spec("cudf") is None: + return False + try: + import cudf + + return True + except ImportError: + _logger.exception("Importing cuDF failed, use DMatrix instead of QDM") + return False + + +@functools.cache +def is_cupy_available() -> bool: + """Check cupy package available or not""" + if importlib.util.find_spec("cupy") is None: + return False + try: + import cupy + + return True + except ImportError: + return False + + +@functools.cache +def import_cupy() -> types.ModuleType: + """Import cupy.""" + if not is_cupy_available(): + raise ImportError("`cupy` is required for handling CUDA buffer.") + + import cupy + + return cupy + + +@functools.cache +def is_pyarrow_available() -> bool: + """Check pyarrow package available or not""" + if importlib.util.find_spec("pyarrow") is None: + return False + return True + + +@functools.cache +def import_pyarrow() -> types.ModuleType: + """Import pyarrow with memory cache.""" + import pyarrow as pa + + return pa + + +@functools.cache +def import_pandas() -> types.ModuleType: + """Import pandas with memory cache.""" + import pandas as pd + + return pd + + +@functools.cache +def import_polars() -> types.ModuleType: + """Import polars with memory cache.""" + import polars as pl + + return pl + + +@functools.cache +def is_pandas_available() -> bool: + """Check the pandas package is available or not.""" + if importlib.util.find_spec("pandas") is None: + return False + return True + + +try: + import scipy.sparse as scipy_sparse + from scipy.sparse import csr_matrix as scipy_csr +except ImportError: + scipy_sparse = False + scipy_csr = object + + +def _is_polars_lazyframe(data: DataType) -> bool: + return lazy_isinstance(data, "polars.lazyframe.frame", "LazyFrame") + + +def _is_polars_series(data: DataType) -> bool: + return lazy_isinstance(data, "polars.series.series", "Series") + + +def _is_polars(data: DataType) -> bool: + lf = _is_polars_lazyframe(data) + df = lazy_isinstance(data, "polars.dataframe.frame", "DataFrame") + return lf or df + + +def _is_arrow(data: DataType) -> TypeGuard["pa.Table"]: + return lazy_isinstance(data, "pyarrow.lib", "Table") + + +def _is_cudf_df(data: DataType) -> bool: + return lazy_isinstance(data, "cudf.core.dataframe", "DataFrame") + + +def _is_cudf_ser(data: DataType) -> bool: + return lazy_isinstance(data, "cudf.core.series", "Series") + + +def _is_cudf_pandas(data: DataType) -> bool: + """Must go before both pandas and cudf checks.""" + return (_is_pandas_df(data) or _is_pandas_series(data)) and lazy_isinstance( + type(data), "cudf.pandas.fast_slow_proxy", "_FastSlowProxyMeta" + ) + + +def _is_pandas_df(data: DataType) -> TypeGuard["pd.DataFrame"]: + return lazy_isinstance(data, "pandas.core.frame", "DataFrame") or lazy_isinstance( + data, "pandas", "DataFrame" + ) + + +def _is_pandas_series(data: DataType) -> TypeGuard["pd.Series"]: + return lazy_isinstance(data, "pandas.core.series", "Series") or lazy_isinstance( + data, "pandas", "Series" + ) + + +def _is_modin_df(data: DataType) -> bool: + return lazy_isinstance(data, "modin.pandas.dataframe", "DataFrame") + + +def _is_modin_series(data: DataType) -> bool: + return lazy_isinstance(data, "modin.pandas.series", "Series") + + +def is_dataframe(data: DataType) -> bool: + """Whether the input is a dataframe. Currently supported dataframes: + + - pandas + - cudf + - cudf.pandas + - polars + - pyarrow + - modin + + + """ + return any( + p(data) + for p in ( + _is_polars, + _is_polars_series, + _is_arrow, + _is_cudf_df, + _is_cudf_ser, + _is_cudf_pandas, + _is_pandas_df, + _is_pandas_series, + _is_modin_df, + _is_modin_series, + ) + ) + + +def _is_cupy_alike(data: DataType) -> bool: + return hasattr(data, "__cuda_array_interface__") + + +def concat(value: Sequence[_T]) -> _T: # pylint: disable=too-many-return-statements + """Concatenate row-wise.""" + if isinstance(value[0], np.ndarray): + value_arr = cast(Sequence[np.ndarray], value) + return np.concatenate(value_arr, axis=0) + if scipy_sparse and isinstance(value[0], scipy_sparse.csr_matrix): + return scipy_sparse.vstack(value, format="csr") + if scipy_sparse and isinstance(value[0], scipy_sparse.csc_matrix): + return scipy_sparse.vstack(value, format="csc") + if scipy_sparse and isinstance(value[0], scipy_sparse.spmatrix): + # other sparse format will be converted to CSR. + return scipy_sparse.vstack(value, format="csr") + if _is_pandas_df(value[0]) or _is_pandas_series(value[0]): + from pandas import concat as pd_concat + + return pd_concat(value, axis=0) + if lazy_isinstance(value[0], "cudf.core.dataframe", "DataFrame") or lazy_isinstance( + value[0], "cudf.core.series", "Series" + ): + from cudf import concat as CUDF_concat + + return CUDF_concat(value, axis=0) + if _is_cupy_alike(value[0]): + import cupy + + # pylint: disable=c-extension-no-member,no-member + d = cupy.cuda.runtime.getDevice() + for v in value: + arr = cast(cupy.ndarray, v) + d_v = arr.device.id + assert d_v == d, "Concatenating arrays on different devices." + return cupy.concatenate(value, axis=0) + raise TypeError(f"Unknown type: {type(value[0])}") diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/xgboost/config.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/xgboost/config.py new file mode 100644 index 0000000000000000000000000000000000000000..c26241aa5b336349ba720bf3e2e87088c96fa6b1 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/xgboost/config.py @@ -0,0 +1,187 @@ +# pylint: disable=missing-function-docstring +"""Global configuration for XGBoost""" + +import ctypes +import json +from contextlib import contextmanager +from functools import wraps +from typing import Any, Callable, Dict, Iterator, Optional, cast + +from ._typing import _F +from .core import _LIB, _check_call, c_str, py_str + + +def config_doc( + *, + header: Optional[str] = None, + extra_note: Optional[str] = None, + parameters: Optional[str] = None, + returns: Optional[str] = None, + see_also: Optional[str] = None, +) -> Callable[[_F], _F]: + """Decorator to format docstring for config functions. + + Parameters + ---------- + header: str + An introducion to the function + extra_note: str + Additional notes + parameters: str + Parameters of the function + returns: str + Return value + see_also: str + Related functions + """ + + doc_template = """ + {header} + + Global configuration consists of a collection of parameters that can be applied in the + global scope. See :ref:`global_config` for the full list of parameters supported in + the global configuration. + + {extra_note} + + .. versionadded:: 1.4.0 + """ + + common_example = """ + Example + ------- + + .. code-block:: python + + import xgboost as xgb + + # Show all messages, including ones pertaining to debugging + xgb.set_config(verbosity=2) + + # Get current value of global configuration + # This is a dict containing all parameters in the global configuration, + # including 'verbosity' + config = xgb.get_config() + assert config['verbosity'] == 2 + + # Example of using the context manager xgb.config_context(). + # The context manager will restore the previous value of the global + # configuration upon exiting. + with xgb.config_context(verbosity=0): + # Suppress warning caused by model generated with XGBoost version < 1.0.0 + bst = xgb.Booster(model_file='./old_model.bin') + assert xgb.get_config()['verbosity'] == 2 # old value restored + + Nested configuration context is also supported: + + Example + ------- + + .. code-block:: python + + with xgb.config_context(verbosity=3): + assert xgb.get_config()["verbosity"] == 3 + with xgb.config_context(verbosity=2): + assert xgb.get_config()["verbosity"] == 2 + + xgb.set_config(verbosity=2) + assert xgb.get_config()["verbosity"] == 2 + with xgb.config_context(verbosity=3): + assert xgb.get_config()["verbosity"] == 3 + """ + + def none_to_str(value: Optional[str]) -> str: + return "" if value is None else value + + def config_doc_decorator(func: _F) -> _F: + func.__doc__ = ( + doc_template.format( + header=none_to_str(header), extra_note=none_to_str(extra_note) + ) + + none_to_str(parameters) + + none_to_str(returns) + + none_to_str(common_example) + + none_to_str(see_also) + ) + + @wraps(func) + def wrap(*args: Any, **kwargs: Any) -> Any: + return func(*args, **kwargs) + + return cast(_F, wrap) + + return config_doc_decorator + + +@config_doc( + header=""" + Set global configuration. + """, + parameters=""" + Parameters + ---------- + new_config: Dict[str, Any] + Keyword arguments representing the parameters and their values + """, +) +def set_config(**new_config: Any) -> None: + not_none = {} + for k, v in new_config.items(): + if v is not None: + not_none[k] = v + config = json.dumps(not_none) + _check_call(_LIB.XGBSetGlobalConfig(c_str(config))) + + +@config_doc( + header=""" + Get current values of the global configuration. + """, + returns=""" + Returns + ------- + args: Dict[str, Any] + The list of global parameters and their values + """, +) +def get_config() -> Dict[str, Any]: + config_str = ctypes.c_char_p() + _check_call(_LIB.XGBGetGlobalConfig(ctypes.byref(config_str))) + value = config_str.value + assert value + config = json.loads(py_str(value)) + return config + + +@contextmanager +@config_doc( + header=""" + Context manager for global XGBoost configuration. + """, + parameters=""" + Parameters + ---------- + new_config: Dict[str, Any] + Keyword arguments representing the parameters and their values + """, + extra_note=""" + .. note:: + + All settings, not just those presently modified, will be returned to their + previous values when the context manager is exited. This is not thread-safe. + """, + see_also=""" + See Also + -------- + set_config: Set global XGBoost configuration + get_config: Get current values of the global configuration + """, +) +def config_context(**new_config: Any) -> Iterator[None]: + old_config = get_config().copy() + set_config(**new_config) + + try: + yield + finally: + set_config(**old_config) diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/xgboost/core.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/xgboost/core.py new file mode 100644 index 0000000000000000000000000000000000000000..419c0dfcfb502a01a85953b0654de112c443c592 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/xgboost/core.py @@ -0,0 +1,3503 @@ +# pylint: disable=too-many-arguments, too-many-branches +# pylint: disable=too-many-lines, too-many-locals +"""Core XGBoost Library.""" + +import copy +import ctypes +import json +import os +import re +import sys +import warnings +import weakref +from abc import ABC, abstractmethod +from collections.abc import Mapping +from enum import IntEnum, unique +from functools import wraps +from inspect import Parameter, signature +from types import EllipsisType +from typing import ( + TYPE_CHECKING, + Any, + Callable, + Dict, + Generator, + Iterable, + List, + Optional, + Sequence, + Tuple, + Type, + TypeGuard, + TypeVar, + Union, + cast, + overload, +) + +import numpy as np +import scipy.sparse + +from ._data_utils import ( + Categories, + TransformedDf, + _ensure_np_dtype, + array_interface, + cuda_array_interface, + from_array_interface, + make_array_interface, +) +from ._typing import ( + _T, + ArrayLike, + ArrowCatList, + BoosterParam, + CFloatPtr, + CNumeric, + CNumericPtr, + CStrPptr, + CStrPtr, + CTypeT, + DataType, + FeatureInfo, + FeatureNames, + FeatureTypes, + Integer, + IterationRange, + ModelIn, + NumpyOrCupy, + PathLike, + TransformedData, + c_bst_ulong, +) +from .compat import ( + _is_cupy_alike, + import_polars, + import_pyarrow, + is_pandas_available, + is_pyarrow_available, + py_str, +) +from .libpath import find_lib_path +from .objective import Objective, TreeObjective, _grad_arrinf + +if TYPE_CHECKING: + from pandas import DataFrame as PdDataFrame + + +class XGBoostError(ValueError): + """Error thrown by xgboost trainer.""" + + +@overload +def from_pystr_to_cstr(data: str) -> bytes: ... + + +@overload +def from_pystr_to_cstr(data: List[str]) -> ctypes.Array: ... + + +def from_pystr_to_cstr(data: Union[str, List[str]]) -> Union[bytes, ctypes.Array]: + """Convert a Python str or list of Python str to C pointer + + Parameters + ---------- + data + str or list of str + """ + + if isinstance(data, str): + return bytes(data, "utf-8") + if isinstance(data, list): + data_as_bytes: List[bytes] = [bytes(d, "utf-8") for d in data] + pointers: ctypes.Array[ctypes.c_char_p] = ( + ctypes.c_char_p * len(data_as_bytes) + )(*data_as_bytes) + return pointers + raise TypeError() + + +def from_cstr_to_pystr(data: CStrPptr, length: c_bst_ulong) -> List[str]: + """Revert C pointer to Python str + + Parameters + ---------- + data : + pointer to data + length : + pointer to length of data + """ + res = [] + for i in range(length.value): + try: + res.append(str(cast(bytes, data[i]).decode("ascii"))) + except UnicodeDecodeError: + res.append(str(cast(bytes, data[i]).decode("utf-8"))) + return res + + +def make_jcargs(**kwargs: Any) -> bytes: + "Make JSON-based arguments for C functions." + return from_pystr_to_cstr(json.dumps(kwargs)) + + +def _parse_eval_str(result: str) -> List[Tuple[str, float]]: + """Parse an eval result string from the booster.""" + splited = result.split()[1:] + # split up `test-error:0.1234` + metric_score_str = [tuple(s.split(":")) for s in splited] + # convert to float + metric_score = [(n, float(s)) for n, s in metric_score_str] + return metric_score + + +IterRange = TypeVar("IterRange", Optional[Tuple[int, int]], Tuple[int, int]) + + +def _expect(expectations: Sequence[Type], got: Type) -> str: + """Translate input error into string. + + Parameters + ---------- + expectations : + a list of expected value. + got : + actual input + + Returns + ------- + msg: str + """ + msg = "Expecting " + for t in range(len(expectations) - 1): + msg += str(expectations[t]) + msg += " or " + msg += str(expectations[-1]) + msg += ". Got " + str(got) + return msg + + +def _log_callback(msg: bytes) -> None: + """Redirect logs from native library into Python console""" + smsg = py_str(msg) + if smsg.find("WARNING:") != -1: + # Stacklevel: + # 1: This line + # 2: XGBoost C functions like `_LIB.XGBoosterTrainOneIter`. + # 3: The Python function that calls the C function. + warnings.warn(smsg, UserWarning, stacklevel=3) + return + print(smsg) + + +def _get_log_callback_func() -> Callable: + """Wrap log_callback() method in ctypes callback type""" + c_callback = ctypes.CFUNCTYPE(None, ctypes.c_char_p) + return c_callback(_log_callback) + + +def _lib_version(lib: ctypes.CDLL) -> Tuple[int, int, int]: + """Get the XGBoost version from native shared object.""" + major = ctypes.c_int() + minor = ctypes.c_int() + patch = ctypes.c_int() + lib.XGBoostVersion(ctypes.byref(major), ctypes.byref(minor), ctypes.byref(patch)) + return major.value, minor.value, patch.value + + +def _py_version() -> str: + """Get the XGBoost version from Python version file.""" + VERSION_FILE = os.path.join(os.path.dirname(__file__), "VERSION") + with open(VERSION_FILE, encoding="ascii") as f: + return f.read().strip() + + +def _register_log_callback(lib: ctypes.CDLL) -> None: + lib.XGBGetLastError.restype = ctypes.c_char_p + lib.callback = _get_log_callback_func() # type: ignore + if lib.XGBRegisterLogCallback(lib.callback) != 0: + raise XGBoostError(lib.XGBGetLastError()) + + +def _parse_version(ver: str) -> Tuple[Tuple[int, int, int], str]: + """Avoid dependency on packaging (PEP 440).""" + # 2.0.0-dev, 2.0.0, 2.0.0.post1, or 2.0.0rc1 + if ver.find("post") != -1: + major, minor, patch = ver.split(".")[:-1] + postfix = ver.split(".")[-1] + elif "-dev" in ver: + major, minor, patch = ver.split("-")[0].split(".") + postfix = "dev" + else: + major, minor, patch = ver.split(".") + rc = patch.find("rc") + if rc != -1: + postfix = patch[rc:] + patch = patch[:rc] + else: + postfix = "" + + return (int(major), int(minor), int(patch)), postfix + + +def _load_lib() -> ctypes.CDLL: + """Load xgboost Library.""" + lib_paths = find_lib_path() + if not lib_paths: + # This happens only when building document. + return None # type: ignore + try: + pathBackup = os.environ["PATH"].split(os.pathsep) + except KeyError: + pathBackup = [] + lib_success = False + os_error_list = [] + for lib_path in lib_paths: + try: + # needed when the lib is linked with non-system-available + # dependencies + os.environ["PATH"] = os.pathsep.join( + pathBackup + [os.path.dirname(lib_path)] + ) + lib = ctypes.cdll.LoadLibrary(lib_path) + setattr(lib, "path", os.path.normpath(lib_path)) + lib_success = True + break + except OSError as e: + os_error_list.append(str(e)) + continue + finally: + os.environ["PATH"] = os.pathsep.join(pathBackup) + if not lib_success: + libname = os.path.basename(lib_paths[0]) + raise XGBoostError(f""" +XGBoost Library ({libname}) could not be loaded. +Likely causes: + * OpenMP runtime is not installed + - vcomp140.dll or libgomp-1.dll for Windows + - libomp.dylib for Mac OSX + - libgomp.so for Linux and other UNIX-like OSes + Mac OSX users: Run `brew install libomp` to install OpenMP runtime. + + * You are running 32-bit Python on a 64-bit OS + +Error message(s): {os_error_list} +""") + _register_log_callback(lib) + + libver = _lib_version(lib) + pyver, _ = _parse_version(_py_version()) + + # verify that we are loading the correct binary. + if pyver != libver: + pyver_str = ".".join((str(v) for v in pyver)) + libver_str = ".".join((str(v) for v in libver)) + msg = ( + "Mismatched version between the Python package and the native shared " + f"""object. Python package version: {pyver_str}. Shared object """ + f"""version: {libver_str}. Shared object is loaded from: {lib.path}. +Likely cause: + * XGBoost is first installed with anaconda then upgraded with pip. To fix it """ + "please remove one of the installations." + ) + raise ValueError(msg) + + return lib + + +# load the XGBoost library globally +_LIB = _load_lib() + + +def _check_call(ret: int) -> None: + """Check the return value of C API call + + This function will raise exception when error occurs. + Wrap every API call with this function + + Parameters + ---------- + ret : + return value from API calls + """ + if ret != 0: + raise XGBoostError(py_str(_LIB.XGBGetLastError())) + + +def _check_distributed_params(kwargs: Dict[str, Any]) -> None: + """Validate parameters in distributed environments.""" + device = kwargs.get("device", None) + if device and not isinstance(device, str): + msg = "Invalid type for the `device` parameter" + msg += _expect((str,), type(device)) + raise TypeError(msg) + + if device and device.find(":") != -1: + if device != "sycl:gpu": + raise ValueError( + "Distributed training doesn't support selecting device ordinal as GPUs" + " are managed by the distributed frameworks. use `device=cuda` or" + " `device=gpu` instead." + ) + + if kwargs.get("booster", None) == "gblinear": + raise NotImplementedError( + f"booster `{kwargs['booster']}` is not supported for distributed training." + ) + + +def _validate_feature_info( + feature_info: Sequence[str], n_features: int, is_column_split: bool, name: str +) -> List[str]: + if not isinstance(feature_info, (str, Sequence, Categories)): + raise TypeError( + f"Expecting a sequence of strings for {name}, got: {type(feature_info)}" + ) + feature_info = list(feature_info) + if len(feature_info) != n_features and n_features != 0 and not is_column_split: + msg = ( + f"{name} must have the same length as the number of data columns, ", + f"expected {n_features}, got {len(feature_info)}", + ) + raise ValueError(msg) + return feature_info + + +def build_info() -> dict: + """Build information of XGBoost. The returned value format is not stable. Also, + please note that build time dependency is not the same as runtime dependency. For + instance, it's possible to build XGBoost with older CUDA version but run it with the + lastest one. + + .. versionadded:: 1.6.0 + + """ + j_info = ctypes.c_char_p() + _check_call(_LIB.XGBuildInfo(ctypes.byref(j_info))) + assert j_info.value is not None + res = json.loads(j_info.value.decode()) # pylint: disable=no-member + res["libxgboost"] = _LIB.path + return res + + +def _numpy2ctypes_type(dtype: Type[np.number]) -> Type[CNumeric]: + _NUMPY_TO_CTYPES_MAPPING: Dict[Type[np.number], Type[CNumeric]] = { + np.float32: ctypes.c_float, + np.float64: ctypes.c_double, + np.uint32: ctypes.c_uint, + np.uint64: ctypes.c_uint64, + np.int32: ctypes.c_int32, + np.int64: ctypes.c_int64, + } + if np.intc is not np.int32: # Windows + _NUMPY_TO_CTYPES_MAPPING[np.intc] = _NUMPY_TO_CTYPES_MAPPING[np.int32] + if dtype not in _NUMPY_TO_CTYPES_MAPPING: + raise TypeError( + f"Supported types: {_NUMPY_TO_CTYPES_MAPPING.keys()}, got: {dtype}" + ) + return _NUMPY_TO_CTYPES_MAPPING[dtype] + + +def ctypes2numpy(cptr: CNumericPtr, length: int, dtype: Type[np.number]) -> np.ndarray: + """Convert a ctypes pointer array to a numpy array.""" + ctype: Type[CNumeric] = _numpy2ctypes_type(dtype) + if not isinstance(cptr, ctypes.POINTER(ctype)): + raise RuntimeError(f"expected {ctype} pointer") + res = np.zeros(length, dtype=dtype) + if not ctypes.memmove(res.ctypes.data, cptr, length * res.strides[0]): + raise RuntimeError("memmove failed") + return res + + +def ctypes2buffer(cptr: CStrPtr, length: int) -> bytearray: + """Convert ctypes pointer to buffer type.""" + if not isinstance(cptr, ctypes.POINTER(ctypes.c_char)): + raise RuntimeError("expected char pointer") + res = bytearray(length) + rptr = (ctypes.c_char * length).from_buffer(res) + if not ctypes.memmove(rptr, cptr, length): + raise RuntimeError("memmove failed") + return res + + +def c_str(string: str) -> ctypes.c_char_p: + """Convert a python string to cstring.""" + return ctypes.c_char_p(string.encode("utf-8")) + + +def c_array( + ctype: Type[CTypeT], values: ArrayLike +) -> Union[ctypes.Array, ctypes._Pointer]: + """Convert a python array to c array.""" + if isinstance(values, np.ndarray) and values.dtype.itemsize == ctypes.sizeof(ctype): + return values.ctypes.data_as(ctypes.POINTER(ctype)) + return (ctype * len(values))(*values) + + +def _prediction_output( + shape: CNumericPtr, dims: c_bst_ulong, predts: CFloatPtr, is_cuda: bool +) -> NumpyOrCupy: + arr_shape = tuple(ctypes2numpy(shape, dims.value, np.uint64).flatten()) + array = from_array_interface( + make_array_interface(predts, arr_shape, np.float32, is_cuda) + ) + return array + + +class DataIter(ABC): # pylint: disable=too-many-instance-attributes + """The interface for user defined data iterator. The iterator facilitates + distributed training, :py:class:`QuantileDMatrix`, and external memory support using + :py:class:`DMatrix` or :py:class:`ExtMemQuantileDMatrix`. Most of time, users don't + need to interact with this class directly. + + .. note:: + + The class caches some intermediate results using the `data` input (predictor + `X`) as key. Don't repeat the `X` for multiple batches with different meta data + (like `label`), make a copy if necessary. + + .. note:: + + When the input for each batch is a DataFrame, we assume categories are + consistently encoded for all batches. For example, given two dataframes for two + batches, this is invalid: + + .. code-block:: + + import pandas as pd + + x0 = pd.DataFrame({"a": [0, 1]}, dtype="category") + x1 = pd.DataFrame({"a": [1, 2]}, dtype="category") + + This is invalid because the `x0` has `[0, 1]` as categories while `x2` has `[1, + 2]`. They should share the same set of categories and encoding: + + .. code-block:: + + import numpy as np + + categories = np.array([0, 1, 2]) + x0["a"] = pd.Categorical.from_codes( + codes=np.array([0, 1]), categories=categories + ) + x1["a"] = pd.Categorical.from_codes( + codes=np.array([1, 2]), categories=categories + ) + + You can make sure the consistent encoding in your preprocessing step be careful + that the data is stored in formats that preserve the encoding when chunking the + data. + + Parameters + ---------- + cache_prefix : + Prefix to the cache files, only used in external memory. + + Note that using this class for external memory **will cache data + on disk** under the path passed here. + + release_data : + Whether the iterator should release the data during iteration. Set it to True if + the data transformation (converting data to np.float32 type) is memory + intensive. Otherwise, if the transformation is computation intensive then we can + keep the cache. + + on_host : + Whether the data should be cached on the host memory instead of the file system + when using GPU with external memory. When set to true (the default), the + "external memory" is the CPU (host) memory. See + :doc:`/tutorials/external_memory` for more info. + + .. versionadded:: 3.0.0 + + .. warning:: + + This is an experimental parameter and subject to change. + + min_cache_page_bytes : + The minimum number of bytes of each cached pages. Only used for on-host cache + with GPU-based :py:class:`ExtMemQuantileDMatrix`. When using GPU-based external + memory with the data cached in the host memory, XGBoost can concatenate the + pages internally to increase the batch size for the GPU. The default page size + is about 1/16 of the total device memory. Users can manually set the value based + on the actual hardware and datasets. Set this to 0 to disable page + concatenation. + + .. versionadded:: 3.0.0 + + .. warning:: + + This is an experimental parameter and subject to change. + + """ + + def __init__( + self, + cache_prefix: Optional[str] = None, + release_data: bool = True, + *, + on_host: bool = True, + min_cache_page_bytes: Optional[int] = None, + ) -> None: + self.cache_prefix = cache_prefix + self.on_host = on_host + self.min_cache_page_bytes = min_cache_page_bytes + + self._handle = _ProxyDMatrix() + self._exception: Optional[Exception] = None + self._enable_categorical = False + self._release = release_data + # Stage data in Python until reset or next is called to avoid data being free. + self._temporary_data: Optional[TransformedData] = None + self._data_ref: Optional[weakref.ReferenceType] = None + + def get_callbacks(self, enable_categorical: bool) -> Tuple[Callable, Callable]: + """Get callback functions for iterating in C. This is an internal function.""" + assert hasattr(self, "cache_prefix"), "__init__ is not called." + reset_callback = ctypes.CFUNCTYPE(None, ctypes.c_void_p)(self._reset_wrapper) + next_callback = ctypes.CFUNCTYPE( + ctypes.c_int, + ctypes.c_void_p, + )(self._next_wrapper) + self._enable_categorical = enable_categorical + return reset_callback, next_callback + + @property + def proxy(self) -> "_ProxyDMatrix": + """Handle of DMatrix proxy.""" + return self._handle + + def _handle_exception(self, fn: Callable, dft_ret: _T) -> _T: + if self._exception is not None: + return dft_ret + + try: + return fn() + except Exception as e: # pylint: disable=broad-except + # Defer the exception in order to return 0 and stop the iteration. + # Exception inside a ctype callback function has no effect except + # for printing to stderr (doesn't stop the execution). + tb = sys.exc_info()[2] + # On dask, the worker is restarted and somehow the information is + # lost. + self._exception = e.with_traceback(tb) + return dft_ret + + def reraise(self) -> None: + """Reraise the exception thrown during iteration.""" + self._temporary_data = None + if self._exception is not None: + # pylint 2.7.0 believes `self._exception` can be None even with `assert + # isinstace` + exc = self._exception + self._exception = None + raise exc # pylint: disable=raising-bad-type + + def __del__(self) -> None: + assert self._temporary_data is None + assert self._exception is None + + def _reset_wrapper(self, this: None) -> None: # pylint: disable=unused-argument + """A wrapper for user defined `reset` function.""" + # free the data + if self._release: + self._temporary_data = None + self._handle_exception(self.reset, None) + + def _next_wrapper(self, this: None) -> int: # pylint: disable=unused-argument + """A wrapper for user defined `next` function. + + `this` is not used in Python. ctypes can handle `self` of a Python + member function automatically when converting it to c function + pointer. + + """ + + @require_keyword_args(True) + def input_data( + *, + data: Any, + feature_names: Optional[FeatureNames] = None, + feature_types: Optional[FeatureTypes] = None, + **kwargs: Any, + ) -> None: + from .data import _proxy_transform, dispatch_proxy_set_data + + # Reduce the amount of transformation that's needed for QuantileDMatrix. + # + # To construct the QDM, one needs 4 iterations on CPU, or 2 iterations on + # GPU. If the QDM has only one batch of input (most of the cases), we can + # avoid transforming the data repeatly. + try: + ref = weakref.ref(data) + except TypeError: + ref = None + if ( + self._temporary_data is not None + and ref is not None + and ref is self._data_ref + ): + new, feature_names, feature_types = self._temporary_data + else: + new, feature_names, feature_types = _proxy_transform( + data, + feature_names, + feature_types, + self._enable_categorical, + ) + # Stage the data, meta info are copied inside C++ MetaInfo. + self._temporary_data = (new, feature_names, feature_types) + dispatch_proxy_set_data(self.proxy, new) + self.proxy.set_info( + feature_names=feature_names, + feature_types=feature_types, + **kwargs, + ) + self._data_ref = ref + + # Release the data before next batch is loaded. + if self._release: + self._temporary_data = None + # pylint: disable=not-callable + return self._handle_exception(lambda: int(self.next(input_data)), 0) + + @abstractmethod + def reset(self) -> None: + """Reset the data iterator. Prototype for user defined function.""" + raise NotImplementedError() + + @abstractmethod + def next(self, input_data: Callable) -> bool: + """Set the next batch of data. + + Parameters + ---------- + + input_data: + A function with same data fields like `data`, `label` with + `xgboost.DMatrix`. + + Returns + ------- + False if there's no more batch, otherwise True. + + """ + raise NotImplementedError() + + +# Notice for `require_keyword_args` +# Authors: Olivier Grisel +# Gael Varoquaux +# Andreas Mueller +# Lars Buitinck +# Alexandre Gramfort +# Nicolas Tresegnie +# Sylvain Marie +# License: BSD 3 clause +def require_keyword_args( + error: bool, +) -> Callable[[Callable[..., _T]], Callable[..., _T]]: + """Decorator for methods that issues warnings for positional arguments + + Using the keyword-only argument syntax in pep 3102, arguments after the + * will issue a warning or error when passed as a positional argument. + + Modified from sklearn utils.validation. + + Parameters + ---------- + error : + Whether to throw an error or raise a warning. + """ + + def throw_if(func: Callable[..., _T]) -> Callable[..., _T]: + """Throw an error/warning if there are positional arguments after the asterisk. + + Parameters + ---------- + f : + function to check arguments on. + + """ + sig = signature(func) + kwonly_args = [] + all_args = [] + + for name, param in sig.parameters.items(): + if param.kind == Parameter.POSITIONAL_OR_KEYWORD: + all_args.append(name) + elif param.kind == Parameter.KEYWORD_ONLY: + kwonly_args.append(name) + + @wraps(func) + def inner_f(*args: Any, **kwargs: Any) -> _T: + extra_args = len(args) - len(all_args) + if not all_args and extra_args > 0: # keyword argument only + raise TypeError("Keyword argument is required.") + + if extra_args > 0: + # ignore first 'self' argument for instance methods + args_msg = [ + f"{name}" + for name, _ in zip(kwonly_args[:extra_args], args[-extra_args:]) + ] + # pylint: disable=consider-using-f-string + msg = "Pass `{}` as keyword args.".format(", ".join(args_msg)) + if error: + raise TypeError(msg) + warnings.warn(msg, FutureWarning) + for k, arg in zip(sig.parameters, args): + kwargs[k] = arg + return func(**kwargs) + + return inner_f + + return throw_if + + +_deprecate_positional_args = require_keyword_args(False) + + +def _get_categories( + cfn: Callable[[ctypes.c_char_p], int], + feature_names: FeatureNames, + n_features: int, +) -> ArrowCatList: + if not is_pyarrow_available(): + raise ImportError( + "`pyarrow` is required for exporting categories to arrow arrays." + ) + + if not TYPE_CHECKING: + pa = import_pyarrow() + else: + import pyarrow as pa + + results: ArrowCatList = [] + + ret = ctypes.c_char_p() + _check_call(cfn(ret)) + if ret.value is None: + results = [(feature_names[i], None) for i in range(n_features)] + return results + + retstr = ret.value.decode() # pylint: disable=no-member + jcats = json.loads(retstr) + assert isinstance(jcats, list) and len(jcats) == n_features + + for fidx in range(n_features): + f_jcats = jcats[fidx] + if f_jcats is None: + # Numeric data + results.append((feature_names[fidx], None)) + continue + + if "offsets" not in f_jcats: + values = from_array_interface(f_jcats) + pa_values = pa.Array.from_pandas(values) + results.append((feature_names[fidx], pa_values)) + continue + + joffsets = f_jcats["offsets"] + jvalues = f_jcats["values"] + offsets = from_array_interface(joffsets) + values = from_array_interface(jvalues) + pa_offsets = pa.array(offsets).buffers() + pa_values = pa.array(values).buffers() + assert ( + pa_offsets[0] is None and pa_values[0] is None + ), "Should not have null mask." + pa_dict = pa.StringArray.from_buffers( + len(offsets) - 1, pa_offsets[1], pa_values[1] + ) + results.append((feature_names[fidx], pa_dict)) + + return results + + +@unique +class DataSplitMode(IntEnum): + """Supported data split mode for DMatrix.""" + + ROW = 0 + COL = 1 + + +class DMatrix: # pylint: disable=too-many-instance-attributes,too-many-public-methods + """Data Matrix used in XGBoost. + + DMatrix is an internal data structure that is used by XGBoost, which is optimized + for both memory efficiency and training speed. You can construct DMatrix from + multiple different sources of data. + + """ + + @_deprecate_positional_args + def __init__( + self, + data: DataType, + label: Optional[ArrayLike] = None, + *, + weight: Optional[ArrayLike] = None, + base_margin: Optional[ArrayLike] = None, + missing: Optional[float] = None, + silent: bool = False, + feature_names: Optional[FeatureNames] = None, + feature_types: Optional[Union[FeatureTypes, Categories]] = None, + nthread: Optional[int] = None, + group: Optional[ArrayLike] = None, + qid: Optional[ArrayLike] = None, + label_lower_bound: Optional[ArrayLike] = None, + label_upper_bound: Optional[ArrayLike] = None, + feature_weights: Optional[ArrayLike] = None, + enable_categorical: bool = False, + data_split_mode: DataSplitMode = DataSplitMode.ROW, + ) -> None: + """Parameters + ---------- + data : + Data source of DMatrix. See :ref:`py-data` for a list of supported input + types. + + Note that, if passing an iterator, it **will cache data on disk**, and note + that fields like ``label`` will be concatenated in-memory from multiple + calls to the iterator. + label : + Label of the training data. + weight : + Weight for each instance. + + .. note:: + + For ranking task, weights are per-group. In ranking task, one weight + is assigned to each group (not each data point). This is because we + only care about the relative ordering of data points within each group, + so it doesn't make sense to assign weights to individual data points. + + base_margin : + Global bias for each instance. See :doc:`/tutorials/intercept` for details. + missing : + Value in the input data which needs to be present as a missing value. If + None, defaults to np.nan. + silent : + Whether print messages during construction + feature_names : + Set names for features. + feature_types : + + Set types for features. If `data` is a DataFrame type and passing + `enable_categorical=True`, the types will be deduced automatically from the + column types. + + Otherwise, one can pass a list-like input with the same length as number of + columns in `data`, with the following possible values: + + - "c", which represents categorical columns. + - "q", which represents numeric columns. + - "int", which represents integer columns. + - "i", which represents boolean columns. + + Note that, while categorical types are treated differently from the rest for + model fitting purposes, the other types do not influence the generated + model, but have effects in other functionalities such as feature + importances. + + For categorical features, the input is assumed to be preprocessed and + encoded by the users. The encoding can be done via + :py:class:`sklearn.preprocessing.OrdinalEncoder` or pandas dataframe + `.cat.codes` method. This is useful when users want to specify categorical + features without having to construct a dataframe as input. + + .. versionadded:: 3.1.0 + + Alternatively, user can pass a :py:class:`~xgboost.core.Categories` object + returned from previous training as a reference for re-coding. One can obtain + the reference with the :py:meth:`.get_categories` from the previous training + DMatrix or the Booster. This feature is experimental. + + nthread : + Number of threads to use for loading data when parallelization is + applicable. If -1, uses maximum threads available on the system. + group : + Group size for all ranking group. + qid : + Query ID for data samples, used for ranking. + label_lower_bound : + Lower bound for survival training. + label_upper_bound : + Upper bound for survival training. + feature_weights : + Set feature weights for column sampling. + enable_categorical : + + .. versionadded:: 1.3.0 + + .. note:: This parameter is experimental + + Experimental support of specializing for categorical features. See + :doc:`/tutorials/categorical` for more info. + + If passing `True` and `data` is a data frame (from supported libraries such + as Pandas, Modin, polars, and cuDF), The DMatrix recognizes categorical + columns and automatically set the `feature_types` parameter. If `data` is + not a data frame, this argument is ignored. + + If passing `False` and `data` is a data frame with categorical columns, it + will result in an error. + + See notes in the :py:class:`DataIter` for consistency requirement when the + input is an iterator. + + .. versionchanged:: 3.1.0 + + XGBoost can remember the encoding of categories when the input is a + dataframe. + + """ + if group is not None and qid is not None: + raise ValueError("Either one of `group` or `qid` should be None.") + + self.missing = missing if missing is not None else np.nan + self.nthread = nthread if nthread is not None else -1 + self.silent = silent + + if isinstance(data, ctypes.c_void_p): + # Used for constructing DMatrix slice. + self.handle = data + return + + from .data import _is_iter, dispatch_data_backend + + if _is_iter(data): + self._init_from_iter(data, enable_categorical) + assert self.handle is not None + return + + handle, feature_names, feature_types = dispatch_data_backend( + data=data, + missing=self.missing, + threads=self.nthread, + feature_names=feature_names, + feature_types=feature_types, + enable_categorical=enable_categorical, + data_split_mode=data_split_mode, + ) + assert handle is not None + self.handle = handle + + self.set_info( + label=label, + weight=weight, + base_margin=base_margin, + group=group, + qid=qid, + label_lower_bound=label_lower_bound, + label_upper_bound=label_upper_bound, + feature_weights=feature_weights, + ) + + if feature_names is not None: + self.feature_names = feature_names + if feature_types is not None: + self.feature_types = feature_types + + def _init_from_iter(self, it: DataIter, enable_categorical: bool) -> None: + args = make_jcargs( + missing=self.missing, + nthread=self.nthread, + cache_prefix=it.cache_prefix if it.cache_prefix else "", + on_host=it.on_host, + min_cache_page_bytes=it.min_cache_page_bytes, + ) + handle = ctypes.c_void_p() + reset_callback, next_callback = it.get_callbacks(enable_categorical) + ret = _LIB.XGDMatrixCreateFromCallback( + None, + it.proxy.handle, + reset_callback, + next_callback, + args, + ctypes.byref(handle), + ) + it.reraise() + # delay check_call to throw intermediate exception first + _check_call(ret) + self.handle = handle + + def __del__(self) -> None: + if hasattr(self, "handle"): + assert self.handle is not None + _check_call(_LIB.XGDMatrixFree(self.handle)) + del self.handle + + @_deprecate_positional_args + def set_info( + self, + *, + label: Optional[ArrayLike] = None, + weight: Optional[ArrayLike] = None, + base_margin: Optional[ArrayLike] = None, + group: Optional[ArrayLike] = None, + qid: Optional[ArrayLike] = None, + label_lower_bound: Optional[ArrayLike] = None, + label_upper_bound: Optional[ArrayLike] = None, + feature_names: Optional[FeatureNames] = None, + feature_types: Optional[FeatureTypes] = None, + feature_weights: Optional[ArrayLike] = None, + ) -> None: + """Set meta info for DMatrix. See doc string for :py:obj:`xgboost.DMatrix`.""" + from .data import dispatch_meta_backend + + if label is not None: + self.set_label(label) + if weight is not None: + self.set_weight(weight) + if base_margin is not None: + self.set_base_margin(base_margin) + if group is not None: + self.set_group(group) + if qid is not None: + self.set_uint_info("qid", qid) + if label_lower_bound is not None: + self.set_float_info("label_lower_bound", label_lower_bound) + if label_upper_bound is not None: + self.set_float_info("label_upper_bound", label_upper_bound) + if feature_names is not None: + self.feature_names = feature_names + if feature_types is not None: + self.feature_types = feature_types + if feature_weights is not None: + dispatch_meta_backend( + matrix=self, data=feature_weights, name="feature_weights" + ) + + def _get_info(self, field: str) -> NumpyOrCupy: + """Get meta info.""" + c_sdata = ctypes.c_char_p() + _check_call( + _LIB.XGDMatrixGetInfoRef(self.handle, c_str(field), ctypes.byref(c_sdata)) + ) + assert c_sdata.value is not None + idata = json.loads(c_sdata.value) + data = from_array_interface(idata) + return data + + def get_float_info(self, field: str) -> NumpyOrCupy: + """Get float property from the DMatrix. + + Parameters + ---------- + field: str + The field name of the information. + + """ + return self._get_info(field) + + def get_uint_info(self, field: str) -> NumpyOrCupy: + """Get unsigned integer property from the DMatrix. + + Parameters + ---------- + field: str + The field name of the information. + + """ + return self._get_info(field) + + def set_float_info(self, field: str, data: ArrayLike) -> None: + """Set float type property into the DMatrix. + + Parameters + ---------- + field: str + The field name of the information + + data: numpy array + The array of data to be set + """ + from .data import dispatch_meta_backend + + dispatch_meta_backend(self, data, field, "float") + + def set_float_info_npy2d(self, field: str, data: ArrayLike) -> None: + """Set float type property into the DMatrix + for numpy 2d array input + + Parameters + ---------- + field: str + The field name of the information + + data: numpy array + The array of data to be set + """ + from .data import dispatch_meta_backend + + dispatch_meta_backend(self, data, field, "float") + + def set_uint_info(self, field: str, data: ArrayLike) -> None: + """Set uint type property into the DMatrix. + + Parameters + ---------- + field: str + The field name of the information + + data: numpy array + The array of data to be set + """ + from .data import dispatch_meta_backend + + dispatch_meta_backend(self, data, field, "uint32") + + def save_binary(self, fname: PathLike, silent: bool = True) -> None: + """Save DMatrix to an XGBoost buffer. Saved binary can be later loaded + by providing the path to :py:func:`xgboost.DMatrix` as input. + + Parameters + ---------- + fname : string or os.PathLike + Name of the output buffer file. + silent : bool (optional; default: True) + If set, the output is suppressed. + """ + fname = os.fspath(os.path.expanduser(fname)) + _check_call( + _LIB.XGDMatrixSaveBinary(self.handle, c_str(fname), ctypes.c_int(silent)) + ) + + def set_label(self, label: ArrayLike) -> None: + """Set label of dmatrix + + Parameters + ---------- + label: array like + The label information to be set into DMatrix + """ + from .data import dispatch_meta_backend + + dispatch_meta_backend(self, label, "label", "float") + + def set_weight(self, weight: ArrayLike) -> None: + """Set weight of each instance. + + Parameters + ---------- + weight : array like + Weight for each data point + + .. note:: For ranking task, weights are per-group. + + In ranking task, one weight is assigned to each group (not each + data point). This is because we only care about the relative + ordering of data points within each group, so it doesn't make + sense to assign weights to individual data points. + + """ + from .data import dispatch_meta_backend + + dispatch_meta_backend(self, weight, "weight", "float") + + def set_base_margin(self, margin: ArrayLike) -> None: + """Set base margin of booster to start from. + + This can be used to specify a prediction value of existing model to be + base_margin However, remember margin is needed, instead of transformed + prediction e.g. for logistic regression: need to put in value before + logistic transformation see also example/demo.py + + Parameters + ---------- + margin: array like + Prediction margin of each datapoint + + """ + from .data import dispatch_meta_backend + + dispatch_meta_backend(self, margin, "base_margin", "float") + + def set_group(self, group: ArrayLike) -> None: + """Set group size of DMatrix (used for ranking). + + Parameters + ---------- + group : array like + Group size of each group + """ + from .data import dispatch_meta_backend + + dispatch_meta_backend(self, group, "group", "uint32") + + def get_label(self) -> NumpyOrCupy: + """Get the label of the DMatrix.""" + return self._get_info("label") + + def get_weight(self) -> NumpyOrCupy: + """Get the weight of the DMatrix.""" + return self._get_info("weight") + + def get_base_margin(self) -> NumpyOrCupy: + """Get the base margin of the DMatrix.""" + return self._get_info("base_margin") + + def get_group(self) -> np.ndarray: + """Get the group of the DMatrix. + + Returns + ------- + group + """ + group_ptr = self._get_info("group_ptr") + return np.diff(group_ptr) + + def get_data(self) -> scipy.sparse.csr_matrix: + """Get the predictors from DMatrix as a CSR matrix. This getter is mostly for + testing purposes. If this is a quantized DMatrix then quantized values are + returned instead of input values. + + .. versionadded:: 1.7.0 + + """ + indptr = np.empty(self.num_row() + 1, dtype=np.uint64) + indices = np.empty(self.num_nonmissing(), dtype=np.uint32) + data = np.empty(self.num_nonmissing(), dtype=np.float32) + + c_indptr = indptr.ctypes.data_as(ctypes.POINTER(c_bst_ulong)) + c_indices = indices.ctypes.data_as(ctypes.POINTER(ctypes.c_uint32)) + c_data = data.ctypes.data_as(ctypes.POINTER(ctypes.c_float)) + config = from_pystr_to_cstr(json.dumps({})) + + _check_call( + _LIB.XGDMatrixGetDataAsCSR(self.handle, config, c_indptr, c_indices, c_data) + ) + ret = scipy.sparse.csr_matrix( + (data, indices, indptr), shape=(self.num_row(), self.num_col()) + ) + return ret + + def get_quantile_cut(self) -> Tuple[np.ndarray, np.ndarray]: + """Get quantile cuts for quantization. + + .. versionadded:: 2.0.0 + + """ + n_features = self.num_col() + + c_sindptr = ctypes.c_char_p() + c_sdata = ctypes.c_char_p() + config = make_jcargs() + _check_call( + _LIB.XGDMatrixGetQuantileCut( + self.handle, config, ctypes.byref(c_sindptr), ctypes.byref(c_sdata) + ) + ) + assert c_sindptr.value is not None + assert c_sdata.value is not None + + i_indptr = json.loads(c_sindptr.value) + indptr = from_array_interface(i_indptr) + assert indptr.size == n_features + 1 + assert indptr.dtype == np.uint64 + + i_data = json.loads(c_sdata.value) + data = from_array_interface(i_data) + assert data.size == indptr[-1] + assert data.dtype == np.float32 + return indptr, data + + def get_categories(self, export_to_arrow: bool = False) -> Categories: + """Get the categories in the dataset. + + .. versionadded:: 3.1.0 + + .. warning:: + + This function is experimental. + + Parameters + ---------- + export_to_arrow : + The returned container will contain a list of ``pyarrow`` arrays for the + categories. See the :py:meth:`~Categories.to_arrow` for more info. + + """ + fnames = self.feature_names + n_features = self.num_col() + if fnames is None: + fnames = [str(i) for i in range(n_features)] + + hdl = ctypes.c_void_p() + if export_to_arrow: + arrow_arrays = _get_categories( + lambda ret: _LIB.XGDMatrixGetCategoriesExportToArrow( + self.handle, None, ctypes.byref(hdl), ctypes.byref(ret) + ), + fnames, + n_features, + ) + else: + arrow_arrays = None + _check_call( + _LIB.XGDMatrixGetCategories(self.handle, None, ctypes.byref(hdl)) + ) + + return Categories( + (hdl, lambda: _check_call(_LIB.XGBCategoriesFree(hdl))), arrow_arrays + ) + + def num_row(self) -> int: + """Get the number of rows in the DMatrix.""" + ret = c_bst_ulong() + _check_call(_LIB.XGDMatrixNumRow(self.handle, ctypes.byref(ret))) + return ret.value + + def num_col(self) -> int: + """Get the number of columns (features) in the DMatrix.""" + ret = c_bst_ulong() + _check_call(_LIB.XGDMatrixNumCol(self.handle, ctypes.byref(ret))) + return ret.value + + def num_nonmissing(self) -> int: + """Get the number of non-missing values in the DMatrix. + + .. versionadded:: 1.7.0 + + """ + ret = c_bst_ulong() + _check_call(_LIB.XGDMatrixNumNonMissing(self.handle, ctypes.byref(ret))) + return ret.value + + def data_split_mode(self) -> DataSplitMode: + """Get the data split mode of the DMatrix. + + .. versionadded:: 2.1.0 + + """ + ret = c_bst_ulong() + _check_call(_LIB.XGDMatrixDataSplitMode(self.handle, ctypes.byref(ret))) + return DataSplitMode(ret.value) + + def slice( + self, rindex: Union[List[int], np.ndarray], allow_groups: bool = False + ) -> "DMatrix": + """Slice the DMatrix and return a new DMatrix that only contains `rindex`. + + Parameters + ---------- + rindex + List of indices to be selected. + allow_groups + Allow slicing of a matrix with a groups attribute + + Returns + ------- + res + A new DMatrix containing only selected indices. + """ + from .data import _maybe_np_slice + + handle = ctypes.c_void_p() + + rindex = _maybe_np_slice(rindex, dtype=np.int32) + _check_call( + _LIB.XGDMatrixSliceDMatrixEx( + self.handle, + c_array(ctypes.c_int, rindex), + c_bst_ulong(len(rindex)), + ctypes.byref(handle), + ctypes.c_int(1 if allow_groups else 0), + ) + ) + return DMatrix(handle) + + @property + def feature_names(self) -> Optional[FeatureNames]: + """Labels for features (column labels). + + Setting it to ``None`` resets existing feature names. + + """ + length = c_bst_ulong() + sarr = ctypes.POINTER(ctypes.c_char_p)() + _check_call( + _LIB.XGDMatrixGetStrFeatureInfo( + self.handle, + c_str("feature_name"), + ctypes.byref(length), + ctypes.byref(sarr), + ) + ) + feature_names = from_cstr_to_pystr(sarr, length) + if not feature_names: + return None + return feature_names + + @feature_names.setter + def feature_names(self, feature_names: Optional[FeatureNames]) -> None: + if feature_names is None: + _check_call( + _LIB.XGDMatrixSetStrFeatureInfo( + self.handle, c_str("feature_name"), None, c_bst_ulong(0) + ) + ) + return + + # validate feature name + feature_names = _validate_feature_info( + feature_names, + self.num_col(), + self.data_split_mode() == DataSplitMode.COL, + "feature names", + ) + if len(feature_names) != len(set(feature_names)): + values, counts = np.unique( + feature_names, + return_index=False, + return_inverse=False, + return_counts=True, + ) + duplicates = [name for name, cnt in zip(values, counts) if cnt > 1] + raise ValueError( + f"feature_names must be unique. Duplicates found: {duplicates}" + ) + + # prohibit the use symbols that may affect parsing. e.g. []< + if not all( + isinstance(f, str) and not any(x in f for x in ["[", "]", "<"]) + for f in feature_names + ): + raise ValueError( + "feature_names must be string, and may not contain [, ] or <" + ) + + feature_names_bytes = [bytes(f, encoding="utf-8") for f in feature_names] + c_feature_names = (ctypes.c_char_p * len(feature_names_bytes))( + *feature_names_bytes + ) + _check_call( + _LIB.XGDMatrixSetStrFeatureInfo( + self.handle, + c_str("feature_name"), + c_feature_names, + c_bst_ulong(len(feature_names)), + ) + ) + + @property + def feature_types(self) -> Optional[FeatureTypes]: + """Type of features (column types). + + This is for displaying the results and categorical data support. See + :py:class:`DMatrix` for details. + + Setting it to ``None`` resets existing feature types. + + """ + length = c_bst_ulong() + sarr = ctypes.POINTER(ctypes.c_char_p)() + _check_call( + _LIB.XGDMatrixGetStrFeatureInfo( + self.handle, + c_str("feature_type"), + ctypes.byref(length), + ctypes.byref(sarr), + ) + ) + res = from_cstr_to_pystr(sarr, length) + if not res: + return None + return res + + @feature_types.setter + def feature_types(self, feature_types: Optional[FeatureTypes]) -> None: + if feature_types is None: + # Reset + _check_call( + _LIB.XGDMatrixSetStrFeatureInfo( + self.handle, c_str("feature_type"), None, c_bst_ulong(0) + ) + ) + return + + feature_types = _validate_feature_info( + feature_types, + self.num_col(), + self.data_split_mode() == DataSplitMode.COL, + "feature types", + ) + + feature_types_bytes = [bytes(f, encoding="utf-8") for f in feature_types] + c_feature_types = (ctypes.c_char_p * len(feature_types_bytes))( + *feature_types_bytes + ) + _check_call( + _LIB.XGDMatrixSetStrFeatureInfo( + self.handle, + c_str("feature_type"), + c_feature_types, + c_bst_ulong(len(feature_types)), + ) + ) + + +class _ProxyDMatrix(DMatrix): + """A placeholder class when DMatrix cannot be constructed (QuantileDMatrix, + inplace_predict). + + """ + + def __init__(self) -> None: # pylint: disable=super-init-not-called + self.handle = ctypes.c_void_p() + _check_call(_LIB.XGProxyDMatrixCreate(ctypes.byref(self.handle))) + + def _ref_data_from_cuda_interface(self, data: DataType) -> None: + """Reference data from CUDA array interface.""" + arrinf = cuda_array_interface(data) + _check_call(_LIB.XGProxyDMatrixSetDataCudaArrayInterface(self.handle, arrinf)) + + def _ref_data_from_cuda_columnar(self, data: TransformedDf) -> None: + """Reference data from CUDA columnar format.""" + _check_call( + _LIB.XGProxyDMatrixSetDataCudaColumnar(self.handle, data.array_interface()) + ) + + def _ref_data_from_array(self, data: np.ndarray) -> None: + """Reference data from numpy array.""" + _check_call(_LIB.XGProxyDMatrixSetDataDense(self.handle, array_interface(data))) + + def _ref_data_from_columnar(self, data: TransformedDf) -> None: + """Reference data from a CPU DataFrame.""" + _check_call( + _LIB.XGProxyDMatrixSetDataColumnar(self.handle, data.array_interface()) + ) + + def _ref_data_from_csr(self, csr: scipy.sparse.csr_matrix) -> None: + """Reference data from scipy csr.""" + _LIB.XGProxyDMatrixSetDataCSR( + self.handle, + array_interface(csr.indptr), + array_interface(csr.indices), + array_interface(csr.data), + ctypes.c_size_t(csr.shape[1]), + ) + + +class _RefMixIn: + @property + def ref(self) -> Optional[weakref.ReferenceType]: + """Internal method for retrieving a reference to the training DMatrix.""" + if hasattr(self, "_ref"): + return self._ref + return None + + @ref.setter + def ref(self, ref: weakref.ReferenceType) -> None: + self._ref = ref + + +class QuantileDMatrix(DMatrix, _RefMixIn): + """A DMatrix variant that generates quantilized data directly from input for the + ``hist`` tree method. This DMatrix is primarily designed to save memory in training + by avoiding intermediate storage. Set ``max_bin`` to control the number of bins + during quantisation, which should be consistent with the training parameter + ``max_bin``. When ``QuantileDMatrix`` is used for validation/test dataset, ``ref`` + should be another ``QuantileDMatrix`` or ``DMatrix``, but not recommended as it + defeats the purpose of saving memory) constructed from training dataset. See + :py:obj:`xgboost.DMatrix` for documents on meta info. + + .. note:: + + Do not use ``QuantileDMatrix`` as validation/test dataset without supplying a + reference (the training dataset) ``QuantileDMatrix`` using ``ref`` as some + information may be lost in quantisation. + + .. versionadded:: 1.7.0 + + Examples + -------- + + .. code-block:: + + from sklearn.datasets import make_regression + from sklearn.model_selection import train_test_split + + X, y = make_regression() + X_train, X_test, y_train, y_test = train_test_split(X, y) + Xy_train = xgb.QuantileDMatrix(X_train, y_train) + # It's necessary to have the training DMatrix as a reference for valid + # quantiles. + Xy_test = xgb.QuantileDMatrix(X_test, y_test, ref=Xy_train) + + Parameters + ---------- + max_bin : + The number of histogram bin, should be consistent with the training parameter + ``max_bin``. + + ref : + The training dataset that provides quantile information, needed when creating + validation/test dataset with ``QuantileDMatrix``. Supplying the training DMatrix + as a reference means that the same quantisation applied to the training data is + applied to the validation/test data + + max_quantile_batches : + For GPU-based inputs from an iterator, XGBoost handles incoming batches with + multiple growing sub-streams. This parameter sets the maximum number of batches + before XGBoost can cut a sub-stream and create a new one. This can help bound + the memory usage. By default, XGBoost grows a sub-stream exponentially until + batches are exhausted. This option is only used for the training dataset and the + default is None (unbounded). Lastly, if the `data` is a single batch instead of + an iterator, this parameter has no effect. + + .. versionadded:: 3.0.0 + + .. warning:: + + This is an experimental parameter and subject to change. + + """ + + @_deprecate_positional_args + def __init__( # pylint: disable=super-init-not-called + self, + data: DataType, + label: Optional[ArrayLike] = None, + *, + weight: Optional[ArrayLike] = None, + base_margin: Optional[ArrayLike] = None, + missing: Optional[float] = None, + silent: bool = False, + feature_names: Optional[FeatureNames] = None, + feature_types: Optional[FeatureTypes] = None, + nthread: Optional[int] = None, + max_bin: Optional[int] = None, + ref: Optional[DMatrix] = None, + group: Optional[ArrayLike] = None, + qid: Optional[ArrayLike] = None, + label_lower_bound: Optional[ArrayLike] = None, + label_upper_bound: Optional[ArrayLike] = None, + feature_weights: Optional[ArrayLike] = None, + enable_categorical: bool = False, + max_quantile_batches: Optional[int] = None, + data_split_mode: DataSplitMode = DataSplitMode.ROW, + ) -> None: + self.max_bin = max_bin + self.missing = missing if missing is not None else np.nan + self.nthread = nthread if nthread is not None else -1 + self._silent = silent # unused, kept for compatibility + + if isinstance(data, ctypes.c_void_p): + self.handle = data + return + + if qid is not None and group is not None: + raise ValueError( + "Only one of the eval_qid or eval_group for each evaluation " + "dataset should be provided." + ) + if isinstance(data, DataIter): + if any( + info is not None + for info in ( + label, + weight, + base_margin, + feature_names, + feature_types, + group, + qid, + label_lower_bound, + label_upper_bound, + feature_weights, + ) + ): + raise ValueError( + "If data iterator is used as input, data like label should be " + "specified as batch argument." + ) + + self._init( + data, + ref=ref, + label=label, + weight=weight, + base_margin=base_margin, + group=group, + qid=qid, + label_lower_bound=label_lower_bound, + label_upper_bound=label_upper_bound, + feature_weights=feature_weights, + feature_names=feature_names, + feature_types=feature_types, + enable_categorical=enable_categorical, + max_quantile_blocks=max_quantile_batches, + ) + + def _init( + self, + data: DataType, + ref: Optional[DMatrix], + enable_categorical: bool, + max_quantile_blocks: Optional[int], + **meta: Any, + ) -> None: + from .data import ( + SingleBatchInternalIter, + _is_dlpack, + _is_iter, + _transform_dlpack, + ) + + if _is_dlpack(data): + # We specialize for dlpack because cupy will take the memory from it so + # it can't be transformed twice. + data = _transform_dlpack(data) + if _is_iter(data): + it = data + else: + it = SingleBatchInternalIter(data=data, **meta) + + handle = ctypes.c_void_p() + reset_callback, next_callback = it.get_callbacks(enable_categorical) + if it.cache_prefix is not None: + raise ValueError( + "QuantileDMatrix doesn't cache data, remove the cache_prefix " + "in iterator to fix this error." + ) + + config = make_jcargs( + nthread=self.nthread, + missing=self.missing, + max_bin=self.max_bin, + max_quantile_blocks=max_quantile_blocks, + ) + ret = _LIB.XGQuantileDMatrixCreateFromCallback( + None, + it.proxy.handle, + ref.handle if ref is not None else ref, + reset_callback, + next_callback, + config, + ctypes.byref(handle), + ) + it.reraise() + # delay check_call to throw intermediate exception first + _check_call(ret) + self.handle = handle + + if ref is not None: + self.ref = weakref.ref(ref) + + +class ExtMemQuantileDMatrix(DMatrix, _RefMixIn): + """The external memory version of the :py:class:`QuantileDMatrix`. + + See :doc:`/tutorials/external_memory` for explanation and usage examples, and + :py:class:`QuantileDMatrix` for parameter document. + + .. warning:: + + This is an experimental feature and subject to change. + + .. versionadded:: 3.0.0 + + """ + + @_deprecate_positional_args + def __init__( # pylint: disable=super-init-not-called + self, + data: DataIter, + *, + missing: Optional[float] = None, + nthread: Optional[int] = None, + max_bin: Optional[int] = None, + ref: Optional[DMatrix] = None, + enable_categorical: bool = False, + max_quantile_batches: Optional[int] = None, + cache_host_ratio: Optional[float] = None, + ) -> None: + """ + Parameters + ---------- + data : + A user-defined :py:class:`DataIter` for loading data. + + max_quantile_batches : + See :py:class:`QuantileDMatrix`. + + cache_host_ratio : + + .. versionadded:: 3.1.0 + + Used by the GPU implementation. For GPU-based inputs, XGBoost can split the + cache into host and device caches to reduce the data transfer overhead. This + parameter specifies the size of host cache compared to the size of the + entire cache: :math:`host / (host + device)`. + + See :ref:`extmem-adaptive-cache` for more info. + + """ + self.max_bin = max_bin + self.missing = missing if missing is not None else np.nan + self.nthread = nthread if nthread is not None else -1 + + self._init( + data, + ref, + enable_categorical=enable_categorical, + max_quantile_blocks=max_quantile_batches, + cache_host_ratio=( + None if cache_host_ratio is None else float(cache_host_ratio) + ), + ) + assert self.handle is not None + + def _init( + self, + it: DataIter, + ref: Optional[DMatrix], + *, + enable_categorical: bool, + max_quantile_blocks: Optional[int] = None, + cache_host_ratio: Optional[float] = None, + ) -> None: + args = make_jcargs( + missing=self.missing, + nthread=self.nthread, + cache_prefix=it.cache_prefix if it.cache_prefix else "", + on_host=it.on_host, + max_bin=self.max_bin, + min_cache_page_bytes=it.min_cache_page_bytes, + # It's called blocks internally due to block-based quantile sketching. + max_quantile_blocks=max_quantile_blocks, + cache_host_ratio=cache_host_ratio, + ) + handle = ctypes.c_void_p() + reset_callback, next_callback = it.get_callbacks(enable_categorical) + # We don't need the iter handle (hence None) in Python as reset,next callbacks + # are member functions, and ctypes can handle the `self` parameter + # automatically. + ret = _LIB.XGExtMemQuantileDMatrixCreateFromCallback( + None, # iter + it.proxy.handle, # proxy + ref.handle if ref is not None else ref, # ref + reset_callback, # reset + next_callback, # next + args, # config + ctypes.byref(handle), # out + ) + it.reraise() + # delay check_call to throw intermediate exception first + _check_call(ret) + self.handle = handle + + if ref is not None: + self.ref = weakref.ref(ref) + + +PlainObj = Callable[[np.ndarray, DMatrix], Tuple[np.ndarray, np.ndarray]] +Metric = Callable[[np.ndarray, DMatrix], Tuple[str, float]] + + +def _configure_metrics(params: BoosterParam) -> BoosterParam: + if ( + isinstance(params, dict) + and "eval_metric" in params + and isinstance(params["eval_metric"], list) + ): + eval_metrics = params["eval_metric"] + params.pop("eval_metric", None) + params_list = list(params.items()) + for eval_metric in eval_metrics: + params_list += [("eval_metric", eval_metric)] + return params_list + return params + + +class Booster: + # pylint: disable=too-many-public-methods + """A Booster of XGBoost. + + Booster is the model of xgboost, that contains low level routines for + training, prediction and evaluation. + """ + + def __init__( + self, + params: Optional[BoosterParam] = None, + cache: Optional[Sequence[DMatrix]] = None, + model_file: Optional[Union["Booster", bytearray, os.PathLike, str]] = None, + ) -> None: + """ + Parameters + ---------- + params : + Parameters for boosters. + cache : + List of cache items. + model_file : + Path to the model file if it's string or PathLike. + """ + cache = cache if cache is not None else [] + for d in cache: + if not isinstance(d, DMatrix): + raise TypeError(f"Invalid cache item: {type(d).__name__}", cache) + + dmats = c_array(ctypes.c_void_p, [d.handle for d in cache]) + self.handle: Optional[ctypes.c_void_p] = ctypes.c_void_p() + _check_call( + _LIB.XGBoosterCreate( + dmats, c_bst_ulong(len(cache)), ctypes.byref(self.handle) + ) + ) + for d in cache: + # Validate feature only after the feature names are saved into booster. + self._assign_dmatrix_features(d) + + if isinstance(model_file, Booster): + assert self.handle is not None + # We use the pickle interface for getting memory snapshot from + # another model, and load the snapshot with this booster. + state = model_file.__getstate__() + handle = state["handle"] + del state["handle"] + ptr = (ctypes.c_char * len(handle)).from_buffer(handle) + length = c_bst_ulong(len(handle)) + _check_call(_LIB.XGBoosterUnserializeFromBuffer(self.handle, ptr, length)) + self.__dict__.update(state) + elif isinstance(model_file, (str, os.PathLike, bytearray)): + self.load_model(model_file) + elif model_file is None: + pass + else: + raise TypeError("Unknown type:", model_file) + + params = params or {} + params_processed = _configure_metrics(params.copy()) + params_processed = self._configure_constraints(params_processed) + if isinstance(params_processed, list): + params_processed.append(("validate_parameters", True)) + else: + params_processed["validate_parameters"] = True + + self.set_param(params_processed or {}) + + def _transform_monotone_constrains( + self, value: Union[Dict[str, int], str, Tuple[int, ...]] + ) -> Union[Tuple[int, ...], str]: + if isinstance(value, str): + return value + if isinstance(value, tuple): + return value + + constrained_features = set(value.keys()) + feature_names = self.feature_names or [] + if not constrained_features.issubset(set(feature_names)): + raise ValueError( + "Constrained features are not a subset of training data feature names" + ) + + return tuple(value.get(name, 0) for name in feature_names) + + def _transform_interaction_constraints( + self, value: Union[Sequence[Sequence[str]], str] + ) -> Union[str, List[List[int]]]: + if isinstance(value, str): + return value + feature_idx_mapping = { + name: idx for idx, name in enumerate(self.feature_names or []) + } + + try: + result = [] + for constraint in value: + result.append( + [feature_idx_mapping[feature_name] for feature_name in constraint] + ) + return result + except KeyError as e: + raise ValueError( + "Constrained features are not a subset of training data feature names" + ) from e + + def _configure_constraints(self, params: BoosterParam) -> BoosterParam: + if isinstance(params, dict): + # we must use list in the internal code as there can be multiple metrics + # with the same parameter name `eval_metric` (same key for dictionary). + params = list(params.items()) + for idx, param in enumerate(params): + name, value = param + if value is None: + continue + + if name == "monotone_constraints": + params[idx] = (name, self._transform_monotone_constrains(value)) + elif name == "interaction_constraints": + params[idx] = (name, self._transform_interaction_constraints(value)) + + return params + + def __del__(self) -> None: + if hasattr(self, "handle") and self.handle is not None: + _check_call(_LIB.XGBoosterFree(self.handle)) + self.handle = None + + def __getstate__(self) -> Dict: + # can't pickle ctypes pointers, put model content in a bytearray + this = self.__dict__.copy() + handle = this["handle"] + if handle is not None: + length = c_bst_ulong() + cptr = ctypes.POINTER(ctypes.c_char)() + _check_call( + _LIB.XGBoosterSerializeToBuffer( + self.handle, ctypes.byref(length), ctypes.byref(cptr) + ) + ) + buf = ctypes2buffer(cptr, length.value) + this["handle"] = buf + return this + + def __setstate__(self, state: Dict) -> None: + # reconstruct the handle from raw data + handle = state["handle"] + if handle is not None: + buf = handle + dmats = c_array(ctypes.c_void_p, []) + handle = ctypes.c_void_p() + _check_call( + _LIB.XGBoosterCreate(dmats, c_bst_ulong(0), ctypes.byref(handle)) + ) + length = c_bst_ulong(len(buf)) + ptr = (ctypes.c_char * len(buf)).from_buffer(buf) + _check_call(_LIB.XGBoosterUnserializeFromBuffer(handle, ptr, length)) + state["handle"] = handle + self.__dict__.update(state) + + def __getitem__(self, val: Union[Integer, tuple, slice, EllipsisType]) -> "Booster": + """Get a slice of the tree-based model. Attributes like `best_iteration` and + `best_score` are removed in the resulting booster. + + .. versionadded:: 1.3.0 + + """ + # convert to slice for all other types + if isinstance(val, (np.integer, int)): + val = slice(int(val), int(val + 1)) + if isinstance(val, EllipsisType): + val = slice(0, 0) + if isinstance(val, tuple): + raise ValueError("Only supports slicing through 1 dimension.") + # All supported types are now slice + if not isinstance(val, slice): + msg = _expect((int, slice, np.integer, EllipsisType), type(val)) + raise TypeError(msg) + + if isinstance(val.start, EllipsisType) or val.start is None: + start = 0 + else: + start = val.start + if isinstance(val.stop, EllipsisType) or val.stop is None: + stop = 0 + else: + stop = val.stop + if stop < start: + raise ValueError("Invalid slice", val) + + step = val.step if val.step is not None else 1 + + c_start = ctypes.c_int(start) + c_stop = ctypes.c_int(stop) + c_step = ctypes.c_int(step) + + sliced_handle = ctypes.c_void_p() + status = _LIB.XGBoosterSlice( + self.handle, c_start, c_stop, c_step, ctypes.byref(sliced_handle) + ) + if status == -2: + raise IndexError("Layer index out of range") + _check_call(status) + + sliced = Booster() + _check_call(_LIB.XGBoosterFree(sliced.handle)) + sliced.handle = sliced_handle + return sliced + + def __iter__(self) -> Generator["Booster", None, None]: + """Iterator method for getting individual trees. + + .. versionadded:: 2.0.0 + + """ + for i in range(0, self.num_boosted_rounds()): + yield self[i] + + def save_config(self) -> str: + """Output internal parameter configuration of Booster as a JSON + string. + + .. versionadded:: 1.0.0 + + """ + json_string = ctypes.c_char_p() + length = c_bst_ulong() + _check_call( + _LIB.XGBoosterSaveJsonConfig( + self.handle, ctypes.byref(length), ctypes.byref(json_string) + ) + ) + assert json_string.value is not None + result = json_string.value.decode() # pylint: disable=no-member + return result + + def load_config(self, config: str) -> None: + """Load configuration returned by `save_config`. + + .. versionadded:: 1.0.0 + """ + assert isinstance(config, str) + _check_call(_LIB.XGBoosterLoadJsonConfig(self.handle, c_str(config))) + + def __copy__(self) -> "Booster": + return self.__deepcopy__(None) + + def __deepcopy__(self, _: Any) -> "Booster": + """Return a copy of booster.""" + return Booster(model_file=self) + + def copy(self) -> "Booster": + """Copy the booster object. + + Returns + ------- + booster : + A copied booster model + """ + return copy.copy(self) + + def reset(self) -> "Booster": + """Reset the booster object to release data caches used for training. + + .. versionadded:: 3.0.0 + + """ + _check_call(_LIB.XGBoosterReset(self.handle)) + return self + + def attr(self, key: str) -> Optional[str]: + """Get attribute string from the Booster. + + Parameters + ---------- + key : + The key to get attribute from. + + Returns + ------- + value : + The attribute value of the key, returns None if attribute do not exist. + """ + ret = ctypes.c_char_p() + success = ctypes.c_int() + _check_call( + _LIB.XGBoosterGetAttr( + self.handle, c_str(key), ctypes.byref(ret), ctypes.byref(success) + ) + ) + if success.value != 0: + value = ret.value + assert value + return py_str(value) + return None + + def attributes(self) -> Dict[str, Optional[str]]: + """Get attributes stored in the Booster as a dictionary. + + Returns + ------- + result : dictionary of attribute_name: attribute_value pairs of strings. + Returns an empty dict if there's no attributes. + """ + length = c_bst_ulong() + sarr = ctypes.POINTER(ctypes.c_char_p)() + _check_call( + _LIB.XGBoosterGetAttrNames( + self.handle, ctypes.byref(length), ctypes.byref(sarr) + ) + ) + attr_names = from_cstr_to_pystr(sarr, length) + return {n: self.attr(n) for n in attr_names} + + def set_attr(self, **kwargs: Optional[Any]) -> None: + """Set the attribute of the Booster. + + Parameters + ---------- + **kwargs + The attributes to set. Setting a value to None deletes an attribute. + """ + for key, value in kwargs.items(): + c_value = None + if value is not None: + c_value = c_str(str(value)) + _check_call(_LIB.XGBoosterSetAttr(self.handle, c_str(key), c_value)) + + def _get_feature_info(self, field: str) -> Optional[FeatureInfo]: + length = c_bst_ulong() + sarr = ctypes.POINTER(ctypes.c_char_p)() + if not hasattr(self, "handle") or self.handle is None: + return None + _check_call( + _LIB.XGBoosterGetStrFeatureInfo( + self.handle, + c_str(field), + ctypes.byref(length), + ctypes.byref(sarr), + ) + ) + feature_info = from_cstr_to_pystr(sarr, length) + return feature_info if feature_info else None + + def _set_feature_info(self, features: Optional[FeatureInfo], field: str) -> None: + if features is not None: + assert isinstance(features, list) + feature_info_bytes = [bytes(f, encoding="utf-8") for f in features] + c_feature_info = (ctypes.c_char_p * len(feature_info_bytes))( + *feature_info_bytes + ) + _check_call( + _LIB.XGBoosterSetStrFeatureInfo( + self.handle, + c_str(field), + c_feature_info, + c_bst_ulong(len(features)), + ) + ) + else: + _check_call( + _LIB.XGBoosterSetStrFeatureInfo( + self.handle, c_str(field), None, c_bst_ulong(0) + ) + ) + + @property + def feature_types(self) -> Optional[FeatureTypes]: + """Feature types for this booster. Can be directly set by input data or by + assignment. See :py:class:`DMatrix` for details. + + """ + return self._get_feature_info("feature_type") + + @feature_types.setter + def feature_types(self, features: Optional[FeatureTypes]) -> None: + self._set_feature_info(features, "feature_type") + + @property + def feature_names(self) -> Optional[FeatureNames]: + """Feature names for this booster. Can be directly set by input data or by + assignment. + + """ + return self._get_feature_info("feature_name") + + @feature_names.setter + def feature_names(self, features: Optional[FeatureNames]) -> None: + self._set_feature_info(features, "feature_name") + + def get_categories(self, export_to_arrow: bool = False) -> Categories: + """Same method as :py:meth:`DMatrix.get_categories`.""" + + fnames = self.feature_names + n_features = self.num_features() + if fnames is None: + fnames = [str(i) for i in range(n_features)] + + hdl = ctypes.c_void_p() + if export_to_arrow: + arrow_arrays = _get_categories( + lambda ret: _LIB.XGBoosterGetCategoriesExportToArrow( + self.handle, None, ctypes.byref(hdl), ctypes.byref(ret) + ), + fnames, + n_features, + ) + else: + arrow_arrays = None + _check_call( + _LIB.XGBoosterGetCategories(self.handle, None, ctypes.byref(hdl)) + ) + + return Categories( + (hdl, lambda: _check_call(_LIB.XGBCategoriesFree(hdl))), arrow_arrays + ) + + def set_param( + self, + params: Union[Dict, Iterable[Tuple[str, Any]], str], + value: Optional[str] = None, + ) -> None: + """Set parameters into the Booster. + + Parameters + ---------- + params : + list of key,value pairs, dict of key to value or simply str key + value : + value of the specified parameter, when params is str key + """ + if isinstance(params, Mapping): + params = params.items() + elif isinstance(params, str) and value is not None: + params = [(params, value)] + for key, val in cast(Iterable[Tuple[str, str]], params): + if isinstance(val, np.ndarray): + val = val.tolist() + elif hasattr(val, "__cuda_array_interface__") and hasattr(val, "tolist"): + val = val.tolist() + if val is not None: + _check_call( + _LIB.XGBoosterSetParam(self.handle, c_str(key), c_str(str(val))) + ) + + def update( + self, + dtrain: DMatrix, + iteration: int, + fobj: Optional[PlainObj] = None, + ) -> None: + """Update for one iteration, with objective function calculated + internally. + + .. warning:: + + This function should not be called directly by users. + + Parameters + ---------- + dtrain : + Training data. + iteration : + The current training iteration. + fobj : + Custom objective function. + + """ + if not isinstance(dtrain, DMatrix): + raise TypeError(f"Invalid training matrix: {type(dtrain).__name__}") + self._assign_dmatrix_features(dtrain) + + if fobj is None: + _check_call( + _LIB.XGBoosterUpdateOneIter( + self.handle, ctypes.c_int(iteration), dtrain.handle + ) + ) + return + + # Forward the gradient calculation to the boost method. + self.boost( + dtrain, + iteration=iteration, + fobj=fobj, + ) + + def boost( + self, + dtrain: DMatrix, + iteration: int, + *, + grad: Optional[NumpyOrCupy] = None, + hess: Optional[NumpyOrCupy] = None, + fobj: Optional[PlainObj] = None, + ) -> None: + """Boost the booster for one iteration with customized gradient statistics. + + .. warning:: + + Like :py:meth:`.update`, this function should not be called directly by + users. + + Parameters + ---------- + dtrain : + The training DMatrix. + iteration : + The current training iteration. + grad : + The first order of gradient. + hess : + The second order of gradient. + fobj : + A custom objective function. If gradient is None, then an objective function + is required. + + """ + self._assign_dmatrix_features(dtrain) + + if all(arg is not None for arg in (grad, hess, fobj)): + raise ValueError( + "Provide either the objective, or the gradient and hessian, not both." + ) + n_samples = dtrain.num_row() + + def train_one_iter(grad: NumpyOrCupy, hess: NumpyOrCupy) -> None: + _check_call( + _LIB.XGBoosterTrainOneIter( + self.handle, + dtrain.handle, + iteration, + _grad_arrinf(grad, n_samples), + _grad_arrinf(hess, n_samples), + ) + ) + + if grad is not None or hess is not None: + # Handle the case where gradient is directly provided for compatibility with + # XGBoost < 3.2 + train_one_iter(grad, hess) + return + + if fobj is None: + raise ValueError( + "Invalid input for the boost function. Either the gradient or " + "the objective should have a valid value." + ) + + y_pred = self.predict(dtrain, output_margin=True, training=True) + + vgrad: Optional[ArrayLike] + vhess: Optional[ArrayLike] + + if isinstance(fobj, TreeObjective): + # full gradient for leaf values + vgrad, vhess = fobj(iteration, y_pred, dtrain) + # Reduced gradient for split nodes + split_grad = fobj.split_grad(iteration, vgrad, vhess) + # Switch the role of gradient if there's no split gradient but the tree + # objective is used. + if split_grad is not None: + sgrad, shess = split_grad + else: + sgrad, shess = vgrad, vhess + vgrad, vhess = None, None + elif isinstance(fobj, Objective): + sgrad, shess = fobj(iteration, y_pred, dtrain) + vgrad, vhess = None, None + else: + # Plain callable + sgrad, shess = fobj(y_pred, dtrain) + vgrad, vhess = None, None + + if vgrad is None: + train_one_iter(sgrad, shess) + return + + _check_call( + _LIB.XGBoosterTrainOneIterWithSplitGrad( + self.handle, + dtrain.handle, + iteration, + _grad_arrinf(sgrad, n_samples), + _grad_arrinf(shess, n_samples), + _grad_arrinf(vgrad, n_samples), + _grad_arrinf(vhess, n_samples), + ) + ) + + def eval_set( + self, + evals: Sequence[Tuple[DMatrix, str]], + iteration: int = 0, + feval: Optional[Metric] = None, + output_margin: bool = True, + ) -> str: + """Evaluate a set of data. + + Parameters + ---------- + evals : + List of items to be evaluated. + iteration : + Current iteration. + feval : + Custom evaluation function. + + Returns + ------- + result: str + Evaluation result string. + """ + for d in evals: + if not isinstance(d[0], DMatrix): + raise TypeError(f"expected DMatrix, got {type(d[0]).__name__}") + if not isinstance(d[1], str): + raise TypeError(f"expected string, got {type(d[1]).__name__}") + self._assign_dmatrix_features(d[0]) + + dmats = c_array(ctypes.c_void_p, [d[0].handle for d in evals]) + evnames = c_array(ctypes.c_char_p, [c_str(d[1]) for d in evals]) + msg = ctypes.c_char_p() + _check_call( + _LIB.XGBoosterEvalOneIter( + self.handle, + ctypes.c_int(iteration), + dmats, + evnames, + c_bst_ulong(len(evals)), + ctypes.byref(msg), + ) + ) + assert msg.value is not None + res = msg.value.decode() # pylint: disable=no-member + if feval is not None: + for dmat, evname in evals: + feval_ret = feval( + self.predict(dmat, training=False, output_margin=output_margin), + dmat, + ) + if isinstance(feval_ret, list): + for name, val in feval_ret: + # pylint: disable=consider-using-f-string + res += "\t%s-%s:%f" % (evname, name, val) + else: + name, val = feval_ret + # pylint: disable=consider-using-f-string + res += "\t%s-%s:%f" % (evname, name, val) + return res + + def eval(self, data: DMatrix, name: str = "eval", iteration: int = 0) -> str: + """Evaluate the model on mat. + + Parameters + ---------- + data : + The dmatrix storing the input. + + name : + The name of the dataset. + + iteration : + The current iteration number. + + Returns + ------- + result: str + Evaluation result string. + """ + self._assign_dmatrix_features(data) + return self.eval_set([(data, name)], iteration) + + # pylint: disable=too-many-function-args + @_deprecate_positional_args + def predict( + self, + data: DMatrix, + *, + output_margin: bool = False, + pred_leaf: bool = False, + pred_contribs: bool = False, + approx_contribs: bool = False, + pred_interactions: bool = False, + validate_features: bool = True, + training: bool = False, + iteration_range: IterationRange = (0, 0), + strict_shape: bool = False, + ) -> np.ndarray: + """Predict with data. The full model will be used unless `iteration_range` is + specified, meaning user have to either slice the model or use the + ``best_iteration`` attribute to get prediction from best model returned from + early stopping. + + .. note:: + + See :doc:`Prediction ` for issues like thread safety and a + summary of outputs from this function. + + Parameters + ---------- + data : + The dmatrix storing the input. + + output_margin : + Whether to output the raw untransformed margin value. + + pred_leaf : + When this option is on, the output will be a matrix of (nsample, + ntrees) with each record indicating the predicted leaf index of + each sample in each tree. Note that the leaf index of a tree is + unique per tree, so you may find leaf 1 in both tree 1 and tree 0. + + pred_contribs : + When this is True the output will be a matrix of size (nsample, + nfeats + 1) with each record indicating the feature contributions + (SHAP values) for that prediction. The sum of all feature + contributions is equal to the raw untransformed margin value of the + prediction. Note the final column is the bias term. + + approx_contribs : + Approximate the contributions of each feature. Used when ``pred_contribs`` + or ``pred_interactions`` is set to True. Changing the default of this + parameter (False) is not recommended. + + pred_interactions : + When this is True the output will be a matrix of size (nsample, + nfeats + 1, nfeats + 1) indicating the SHAP interaction values for + each pair of features. The sum of each row (or column) of the + interaction values equals the corresponding SHAP value (from + pred_contribs), and the sum of the entire matrix equals the raw + untransformed margin value of the prediction. Note the last row and + column correspond to the bias term. + + validate_features : + When this is True, validate that the Booster's and data's + feature_names are identical. Otherwise, it is assumed that the + feature_names are the same. + + training : + Whether the prediction value is used for training. This can effect `dart` + booster, which performs dropouts during training iterations but use all + trees for inference. If you want to obtain result with dropouts, set this + parameter to `True`. Also, the parameter is set to true when obtaining + prediction for custom objective function. + + .. versionadded:: 1.0.0 + + iteration_range : + Specifies which layer of trees are used in prediction. For example, if a + random forest is trained with 100 rounds. Specifying `iteration_range=(10, + 20)`, then only the forests built during [10, 20) (half open set) rounds are + used in this prediction. + + .. versionadded:: 1.4.0 + + strict_shape : + When set to True, output shape is invariant to whether classification is + used. For both value and margin prediction, the output shape is (n_samples, + n_groups), n_groups == 1 when multi-class is not used. Default to False, in + which case the output shape can be (n_samples, ) if multi-class is not used. + + .. versionadded:: 1.4.0 + + Returns + ------- + prediction : numpy array + + """ + if not isinstance(data, DMatrix): + raise TypeError("Expecting data to be a DMatrix object, got: ", type(data)) + if validate_features: + fn = data.feature_names + self._validate_features(fn) + args = { + "type": 0, + "training": training, + "iteration_begin": int(iteration_range[0]), + "iteration_end": int(iteration_range[1]), + "strict_shape": strict_shape, + } + + def assign_type(t: int) -> None: + if args["type"] != 0: + raise ValueError("One type of prediction at a time.") + args["type"] = t + + if output_margin: + assign_type(1) + if pred_contribs: + assign_type(2 if not approx_contribs else 3) + if pred_interactions: + assign_type(4 if not approx_contribs else 5) + if pred_leaf: + assign_type(6) + preds = ctypes.POINTER(ctypes.c_float)() + shape = ctypes.POINTER(c_bst_ulong)() + dims = c_bst_ulong() + _check_call( + _LIB.XGBoosterPredictFromDMatrix( + self.handle, + data.handle, + from_pystr_to_cstr(json.dumps(args)), + ctypes.byref(shape), + ctypes.byref(dims), + ctypes.byref(preds), + ) + ) + return _prediction_output(shape, dims, preds, False) + + # pylint: disable=too-many-statements + @_deprecate_positional_args + def inplace_predict( + self, + data: DataType, + *, + iteration_range: IterationRange = (0, 0), + predict_type: str = "value", + missing: float = np.nan, + validate_features: bool = True, + base_margin: Any = None, + strict_shape: bool = False, + ) -> NumpyOrCupy: + """Run prediction in-place when possible, Unlike :py:meth:`predict` method, + inplace prediction does not cache the prediction result. + + Calling only ``inplace_predict`` in multiple threads is safe and lock + free. But the safety does not hold when used in conjunction with other + methods. E.g. you can't train the booster in one thread and perform + prediction in the other. + + .. note:: + + If the device ordinal of the input data doesn't match the one configured for + the booster, data will be copied to the booster device. + + .. code-block:: python + + booster.set_param({"device": "cuda:0"}) + booster.inplace_predict(cupy_array) + + booster.set_param({"device": "cpu"}) + booster.inplace_predict(numpy_array) + + .. versionadded:: 1.1.0 + + Parameters + ---------- + data : + The input data. + iteration_range : + See :py:meth:`predict` for details. + predict_type : + * `value` Output model prediction values. + * `margin` Output the raw untransformed margin value. + missing : + See :py:obj:`xgboost.DMatrix` for details. + validate_features: + See :py:meth:`xgboost.Booster.predict` for details. + base_margin: + See :py:obj:`xgboost.DMatrix` for details. + + .. versionadded:: 1.4.0 + + strict_shape: + See :py:meth:`xgboost.Booster.predict` for details. + + .. versionadded:: 1.4.0 + + Returns + ------- + prediction : numpy.ndarray/cupy.ndarray + The prediction result. When input data is on GPU, prediction result is + stored in a cupy array. + + """ + preds = ctypes.POINTER(ctypes.c_float)() + + # once caching is supported, we can pass id(data) as cache id. + args = make_jcargs( + type=1 if predict_type == "margin" else 0, + training=False, + iteration_begin=int(iteration_range[0]), + iteration_end=int(iteration_range[1]), + missing=missing, + strict_shape=strict_shape, + cache_id=0, + ) + shape = ctypes.POINTER(c_bst_ulong)() + dims = c_bst_ulong() + + if base_margin is not None: + proxy: Optional[_ProxyDMatrix] = _ProxyDMatrix() + assert proxy is not None + proxy.set_info(base_margin=base_margin) + p_handle = proxy.handle + else: + proxy = None + p_handle = ctypes.c_void_p() + assert proxy is None or isinstance(proxy, _ProxyDMatrix) + + from .data import ( + ArrowTransformed, + PandasTransformed, + _is_arrow, + _is_cudf_df, + _is_cudf_pandas, + _is_list, + _is_np_array_like, + _is_pandas_df, + _is_pandas_series, + _is_polars, + _is_polars_series, + _is_tuple, + _transform_arrow_table, + _transform_pandas_df, + _transform_polars_df, + ) + + if _is_cudf_pandas(data): + data = data._fsproxy_fast # pylint: disable=protected-access + + enable_categorical = True + if _is_arrow(data): + data, fns, _ = _transform_arrow_table(data, enable_categorical, None, None) + if _is_polars_series(data): + pl = import_polars() + data = pl.DataFrame({data.name: data}) + if _is_polars(data): + data, fns, _ = _transform_polars_df(data, enable_categorical, None, None) + if _is_pandas_series(data): + import pandas as pd + + data = pd.DataFrame(data) + if _is_pandas_df(data): + data, fns, _ = _transform_pandas_df(data, enable_categorical) + if validate_features: + self._validate_features(fns) + if _is_list(data) or _is_tuple(data): + data = np.array(data) + + if validate_features: + if not hasattr(data, "shape"): + raise TypeError( + "`shape` attribute is required when `validate_features` is True" + f", got: {type(data)}" + ) + if len(data.shape) != 1 and self.num_features() != data.shape[1]: + raise ValueError( + f"Feature shape mismatch, expected: {self.num_features()}, " + f"got {data.shape[1]}" + ) + + if _is_np_array_like(data): + data, _ = _ensure_np_dtype(data, data.dtype) + _check_call( + _LIB.XGBoosterPredictFromDense( + self.handle, + array_interface(data), + args, + p_handle, + ctypes.byref(shape), + ctypes.byref(dims), + ctypes.byref(preds), + ) + ) + return _prediction_output(shape, dims, preds, False) + if isinstance(data, (ArrowTransformed, PandasTransformed)): + _check_call( + _LIB.XGBoosterPredictFromColumnar( + self.handle, + data.array_interface(), + args, + p_handle, + ctypes.byref(shape), + ctypes.byref(dims), + ctypes.byref(preds), + ) + ) + return _prediction_output(shape, dims, preds, False) + if isinstance(data, scipy.sparse.csr_matrix): + from .data import transform_scipy_sparse + + data = transform_scipy_sparse(data, True) + _check_call( + _LIB.XGBoosterPredictFromCSR( + self.handle, + array_interface(data.indptr), + array_interface(data.indices), + array_interface(data.data), + c_bst_ulong(data.shape[1]), + args, + p_handle, + ctypes.byref(shape), + ctypes.byref(dims), + ctypes.byref(preds), + ) + ) + return _prediction_output(shape, dims, preds, False) + if _is_cupy_alike(data): + from .data import _transform_cupy_array + + data = _transform_cupy_array(data) + interface_str = cuda_array_interface(data) + _check_call( + _LIB.XGBoosterPredictFromCudaArray( + self.handle, + interface_str, + args, + p_handle, + ctypes.byref(shape), + ctypes.byref(dims), + ctypes.byref(preds), + ) + ) + return _prediction_output(shape, dims, preds, True) + if _is_cudf_df(data): + from .data import _transform_cudf_df + + df, fns, _ = _transform_cudf_df(data, None, None, enable_categorical) + if validate_features: + self._validate_features(fns) + _check_call( + _LIB.XGBoosterPredictFromCudaColumnar( + self.handle, + df.array_interface(), + args, + p_handle, + ctypes.byref(shape), + ctypes.byref(dims), + ctypes.byref(preds), + ) + ) + return _prediction_output(shape, dims, preds, True) + + raise TypeError( + "Data type:" + str(type(data)) + " not supported by inplace prediction." + ) + + def save_model(self, fname: PathLike) -> None: + """Save the model to a file. + + The model is saved in an XGBoost internal format which is universal among the + various XGBoost interfaces. Auxiliary attributes of the Python Booster object + (such as feature_names) are only saved when using JSON or UBJSON (default) + format. Also, parameters that are not part of the model (like metrics, + `max_depth`, etc) are not saved, see :doc:`Model IO ` + for more info. + + .. code-block:: python + + model.save_model("model.json") + # or + model.save_model("model.ubj") + + Parameters + ---------- + fname : + Output file name + + """ + if isinstance(fname, (str, os.PathLike)): # assume file name + fname = os.fspath(os.path.expanduser(fname)) + _check_call(_LIB.XGBoosterSaveModel(self.handle, c_str(fname))) + else: + raise TypeError("fname must be a string or os PathLike") + + def save_raw(self, raw_format: str = "ubj") -> bytearray: + """Save the model to a in memory buffer representation instead of file. + + The model is saved in an XGBoost internal format which is universal among the + various XGBoost interfaces. Auxiliary attributes of the Python Booster object + (such as feature_names) are only saved when using JSON or UBJSON (default) + format. Also, parameters that are not part of the model (like metrics, + `max_depth`, etc) are not saved, see :doc:`Model IO ` + for more info. + + Parameters + ---------- + raw_format : + Format of output buffer. Can be `json` or `ubj`. + + Returns + ------- + An in memory buffer representation of the model + + """ + length = c_bst_ulong() + cptr = ctypes.POINTER(ctypes.c_char)() + config = make_jcargs(format=raw_format) + _check_call( + _LIB.XGBoosterSaveModelToBuffer( + self.handle, config, ctypes.byref(length), ctypes.byref(cptr) + ) + ) + return ctypes2buffer(cptr, length.value) + + def load_model(self, fname: ModelIn) -> None: + """Load the model from a file or a bytearray. + + The model is saved in an XGBoost internal format which is universal among the + various XGBoost interfaces. Auxiliary attributes of the Python Booster object + (such as feature_names) are only saved when using JSON or UBJSON (default) + format. Also, parameters that are not part of the model (like metrics, + `max_depth`, etc) are not saved, see :doc:`Model IO ` + for more info. + + .. code-block:: python + + model.save_model("model.json") + model.load_model("model.json") + + # or + model.save_model("model.ubj") + model.load_model("model.ubj") + + # or + buf = model.save_raw() + model.load_model(buf) + + Parameters + ---------- + fname : + Input file name or memory buffer(see also save_raw) + + """ + + def is_pathlike(path: ModelIn) -> TypeGuard[os.PathLike[str]]: + return isinstance(path, os.PathLike) + + if isinstance(fname, str) or is_pathlike(fname): + # assume file name, cannot use os.path.exist to check, file can be from URL. + fname = os.fspath(os.path.expanduser(fname)) + _check_call(_LIB.XGBoosterLoadModel(self.handle, c_str(fname))) + elif isinstance(fname, bytearray): + buf = fname + length = c_bst_ulong(len(buf)) + ptr = (ctypes.c_char * len(buf)).from_buffer(buf) + _check_call(_LIB.XGBoosterLoadModelFromBuffer(self.handle, ptr, length)) + else: + raise TypeError("Unknown file type: ", fname) + + @property + def best_iteration(self) -> int: + """The best iteration during training.""" + best = self.attr("best_iteration") + if best is not None: + return int(best) + + raise AttributeError( + "`best_iteration` is only defined when early stopping is used." + ) + + @best_iteration.setter + def best_iteration(self, iteration: int) -> None: + self.set_attr(best_iteration=iteration) + + @property + def best_score(self) -> float: + """The best evaluation score during training.""" + best = self.attr("best_score") + if best is not None: + return float(best) + + raise AttributeError( + "`best_score` is only defined when early stopping is used." + ) + + @best_score.setter + def best_score(self, score: int) -> None: + self.set_attr(best_score=score) + + def num_boosted_rounds(self) -> int: + """Get number of boosted rounds. For gblinear this is reset to 0 after + serializing the model. + + """ + rounds = ctypes.c_int() + assert self.handle is not None + _check_call(_LIB.XGBoosterBoostedRounds(self.handle, ctypes.byref(rounds))) + return rounds.value + + def num_features(self) -> int: + """Number of features in booster.""" + features = c_bst_ulong() + assert self.handle is not None + _check_call(_LIB.XGBoosterGetNumFeature(self.handle, ctypes.byref(features))) + return features.value + + def dump_model( + self, + fout: PathLike, + fmap: PathLike = "", + with_stats: bool = False, + dump_format: str = "text", + ) -> None: + """Dump model into a text or JSON file. Unlike :py:meth:`save_model`, the + output format is primarily used for visualization or interpretation, + hence it's more human readable but cannot be loaded back to XGBoost. + + Parameters + ---------- + fout : + Output file name. + fmap : + Name of the file containing feature map names. + with_stats : + Controls whether the split statistics are output. + dump_format : + Format of model dump file. Can be 'text' or 'json'. + """ + if isinstance(fout, (str, os.PathLike)): + fout = os.fspath(os.path.expanduser(fout)) + # pylint: disable=consider-using-with + fout_obj = open(fout, "w", encoding="utf-8") + need_close = True + else: + fout_obj = fout + need_close = False + ret = self.get_dump(fmap, with_stats, dump_format) + if dump_format == "json": + fout_obj.write("[\n") + for i, val in enumerate(ret): + fout_obj.write(val) + if i < len(ret) - 1: + fout_obj.write(",\n") + fout_obj.write("\n]") + else: + for i, val in enumerate(ret): + fout_obj.write(f"booster[{i}]:\n") + fout_obj.write(val) + if need_close: + fout_obj.close() + + def get_dump( + self, + fmap: PathLike = "", + with_stats: bool = False, + dump_format: str = "text", + ) -> List[str]: + """Returns the model dump as a list of strings. Unlike :py:meth:`save_model`, + the output format is primarily used for visualization or interpretation, hence + it's more human readable but cannot be loaded back to XGBoost. + + Parameters + ---------- + fmap : + Name of the file containing feature map names. + with_stats : + Controls whether the split statistics should be included. + dump_format : + Format of model dump. Can be 'text', 'json' or 'dot'. + + """ + fmap = os.fspath(os.path.expanduser(fmap)) + length = c_bst_ulong() + sarr = ctypes.POINTER(ctypes.c_char_p)() + _check_call( + _LIB.XGBoosterDumpModelEx( + self.handle, + c_str(fmap), + ctypes.c_int(with_stats), + c_str(dump_format), + ctypes.byref(length), + ctypes.byref(sarr), + ) + ) + res = from_cstr_to_pystr(sarr, length) + return res + + def get_fscore(self, fmap: PathLike = "") -> Dict[str, Union[float, List[float]]]: + """Get feature importance of each feature. + + .. note:: Zero-importance features will not be included + + Keep in mind that this function does not include zero-importance feature, + i.e. those features that have not been used in any split conditions. + + Parameters + ---------- + fmap : + The name of feature map file + """ + + return self.get_score(fmap, importance_type="weight") + + def get_score( + self, fmap: PathLike = "", importance_type: str = "weight" + ) -> Dict[str, Union[float, List[float]]]: + """Get feature importance of each feature. + For tree model Importance type can be defined as: + + * 'weight': the number of times a feature is used to split the data across all + trees. + * 'gain': the average gain across all splits the feature is used in. + * 'cover': the average coverage across all splits the feature is used in. + * 'total_gain': the total gain across all splits the feature is used in. + * 'total_cover': the total coverage across all splits the feature is used in. + + .. note:: + + For linear model, only "weight" is defined and it's the normalized + coefficients without bias. + + .. note:: Zero-importance features will not be included + + Keep in mind that this function does not include zero-importance feature, + i.e. those features that have not been used in any split conditions. + + Parameters + ---------- + fmap : + The name of feature map file. + importance_type : + One of the importance types defined above. + + Returns + ------- + A map between feature names and their scores. When `gblinear` is used for + multi-class classification the scores for each feature is a list with length + `n_classes`, otherwise they're scalars. + """ + fmap = os.fspath(os.path.expanduser(fmap)) + features = ctypes.POINTER(ctypes.c_char_p)() + scores = ctypes.POINTER(ctypes.c_float)() + n_out_features = c_bst_ulong() + out_dim = c_bst_ulong() + shape = ctypes.POINTER(c_bst_ulong)() + + _check_call( + _LIB.XGBoosterFeatureScore( + self.handle, + make_jcargs(importance_type=importance_type, feature_map=fmap), + ctypes.byref(n_out_features), + ctypes.byref(features), + ctypes.byref(out_dim), + ctypes.byref(shape), + ctypes.byref(scores), + ) + ) + features_arr = from_cstr_to_pystr(features, n_out_features) + scores_arr = _prediction_output(shape, out_dim, scores, False) + + results: Dict[str, Union[float, List[float]]] = {} + if len(scores_arr.shape) > 1 and scores_arr.shape[1] > 1: + for feat, score in zip(features_arr, scores_arr): + results[feat] = [float(s) for s in score] + else: + for feat, score in zip(features_arr, scores_arr): + results[feat] = float(score) + return results + + # pylint: disable=too-many-statements + def trees_to_dataframe(self, fmap: PathLike = "") -> "PdDataFrame": + """Parse a boosted tree model text dump into a pandas DataFrame structure. + + This feature is only defined when the decision tree model is chosen as base + learner (`booster in {gbtree, dart}`). It is not defined for other base learner + types, such as linear learners (`booster=gblinear`). + + Parameters + ---------- + fmap : + The name of feature map file. + """ + # pylint: disable=too-many-locals + from pandas import DataFrame + + fmap = os.fspath(os.path.expanduser(fmap)) + if not is_pandas_available(): + raise ImportError( + ( + "pandas must be available to use this method." + "Install pandas before calling again." + ) + ) + booster = json.loads(self.save_config())["learner"]["gradient_booster"]["name"] + if booster not in {"gbtree", "dart"}: + raise ValueError(f"This method is not defined for Booster type {booster}") + + tree_ids = [] + node_ids = [] + fids = [] + splits: List[Union[float, str]] = [] + categories: List[Union[Optional[float], List[str]]] = [] + y_directs: List[Union[float, str]] = [] + n_directs: List[Union[float, str]] = [] + missings: List[Union[float, str]] = [] + gains = [] + covers = [] + + trees = self.get_dump(fmap, with_stats=True) + for i, tree in enumerate(trees): + for line in tree.split("\n"): + arr = line.split("[") + # Leaf node + if len(arr) == 1: + # Last element of line.split is an empty string + if arr == [""]: + continue + # parse string + parse = arr[0].split(":") + stats = re.split("=|,", parse[1]) + + # append to lists + tree_ids.append(i) + node_ids.append(int(re.findall(r"\b\d+\b", parse[0])[0])) + fids.append("Leaf") + splits.append(float("NAN")) + categories.append(float("NAN")) + y_directs.append(float("NAN")) + n_directs.append(float("NAN")) + missings.append(float("NAN")) + gains.append(float(stats[1])) + covers.append(float(stats[3])) + # Not a Leaf Node + else: + # parse string + fid = arr[1].split("]") + if fid[0].find("<") != -1: + # numerical + parse = fid[0].split("<") + splits.append(float(parse[1])) + categories.append(None) + elif fid[0].find(":{") != -1: + # categorical + parse = fid[0].split(":") + cats = parse[1][1:-1] # strip the {} + cats_split = cats.split(",") + splits.append(float("NAN")) + categories.append(cats_split if cats_split else None) + else: + raise ValueError("Failed to parse model text dump.") + stats = re.split("=|,", fid[1]) + + # append to lists + tree_ids.append(i) + node_ids.append(int(re.findall(r"\b\d+\b", arr[0])[0])) + fids.append(parse[0]) + str_i = str(i) + y_directs.append(str_i + "-" + stats[1]) + n_directs.append(str_i + "-" + stats[3]) + missings.append(str_i + "-" + stats[5]) + gains.append(float(stats[7])) + covers.append(float(stats[9])) + + ids = [str(t_id) + "-" + str(n_id) for t_id, n_id in zip(tree_ids, node_ids)] + df = DataFrame( + { + "Tree": tree_ids, + "Node": node_ids, + "ID": ids, + "Feature": fids, + "Split": splits, + "Yes": y_directs, + "No": n_directs, + "Missing": missings, + "Gain": gains, + "Cover": covers, + "Category": categories, + } + ) + + return df.sort_values(["Tree", "Node"]).reset_index(drop=True) + + def _assign_dmatrix_features(self, data: DMatrix) -> None: + if data.num_row() == 0: + return + + fn = data.feature_names + ft = data.feature_types + + if self.feature_names is None: + self.feature_names = fn + if self.feature_types is None: + self.feature_types = ft + + self._validate_features(fn) + + def _validate_features(self, feature_names: Optional[FeatureNames]) -> None: + if self.feature_names is None: + return + + if feature_names is None and self.feature_names is not None: + raise ValueError( + "data did not contain feature names, but the following fields are expected: " + + ", ".join(self.feature_names) + ) + + if self.feature_names != feature_names: + dat_missing = set(cast(FeatureNames, self.feature_names)) - set( + cast(FeatureNames, feature_names) + ) + my_missing = set(cast(FeatureNames, feature_names)) - set( + cast(FeatureNames, self.feature_names) + ) + + msg = "feature_names mismatch: {0} {1}" + + if dat_missing: + msg += ( + "\nexpected " + + ", ".join(str(s) for s in dat_missing) + + " in input data" + ) + + if my_missing: + msg += ( + "\ntraining data did not have the following fields: " + + ", ".join(str(s) for s in my_missing) + ) + + raise ValueError(msg.format(self.feature_names, feature_names)) + + def get_split_value_histogram( + self, + feature: str, + fmap: PathLike = "", + bins: Optional[int] = None, + as_pandas: bool = True, + ) -> Union[np.ndarray, "PdDataFrame"]: + """Get split value histogram of a feature + + Parameters + ---------- + feature : + The name of the feature. + fmap: + The name of feature map file. + bin : + The maximum number of bins. + Number of bins equals number of unique split values n_unique, + if bins == None or bins > n_unique. + as_pandas : + Return pd.DataFrame when pandas is installed. + If False or pandas is not installed, return numpy ndarray. + + Returns + ------- + a histogram of used splitting values for the specified feature + either as numpy array or pandas DataFrame. + """ + from .data import CAT_T + + xgdump = self.get_dump(fmap=fmap) + values = [] + # pylint: disable=consider-using-f-string + regexp = re.compile(r"\[{0}<([\d.Ee+-]+)\]".format(feature)) + for val in xgdump: + m = re.findall(regexp, val) + values.extend([float(x) for x in m]) + + n_unique = len(np.unique(values)) + bins = max(min(n_unique, bins) if bins is not None else n_unique, 1) + + nph = np.histogram(values, bins=bins) + nph_stacked = np.column_stack((nph[1][1:], nph[0])) + nph_stacked = nph_stacked[nph_stacked[:, 1] > 0] + + if nph_stacked.size == 0: + ft = self.feature_types + fn = self.feature_names + if fn is None: + # Let xgboost generate the feature names. + fn = [f"f{i}" for i in range(self.num_features())] + try: + index = fn.index(feature) + feature_t: Optional[str] = cast(List[str], ft)[index] + except (ValueError, AttributeError, TypeError): + # None.index: attr err, None[0]: type err, fn.index(-1): value err + feature_t = None + if feature_t == CAT_T: # categorical + raise ValueError( + "Split value historgam doesn't support categorical split." + ) + + if as_pandas and is_pandas_available(): + from pandas import DataFrame + + return DataFrame(nph_stacked, columns=["SplitValue", "Count"]) + if as_pandas and not is_pandas_available(): + warnings.warn( + "Returning histogram as ndarray" + " (as_pandas == True, but pandas is not installed).", + UserWarning, + ) + return nph_stacked diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/xgboost/dask/__init__.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/xgboost/dask/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..510cb10f464c2cd0d093b8726e96714395f6d72f --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/xgboost/dask/__init__.py @@ -0,0 +1,2217 @@ +# pylint: disable=too-many-arguments, too-many-locals +# pylint: disable=missing-class-docstring +# pylint: disable=too-many-lines +""" +Dask extensions for distributed training +---------------------------------------- + +See :doc:`Distributed XGBoost with Dask ` for simple tutorial. Also +:doc:`/python/dask-examples/index` for some examples. + +There are two sets of APIs in this module, one is the functional API including +``train`` and ``predict`` methods. Another is stateful Scikit-Learner wrapper +inherited from single-node Scikit-Learn interface. + +The implementation is heavily influenced by dask_xgboost: +https://github.com/dask/dask-xgboost + +Optional dask configuration +=========================== + +- **coll_cfg**: + Specify the scheduler address along with communicator configurations. This can be + used as a replacement of the existing global Dask configuration + `xgboost.scheduler_address` (see below). See :ref:`tracker-ip` for more info. The + `tracker_host_ip` should specify the IP address of the Dask scheduler node. + + .. versionadded:: 3.0.0 + + .. code-block:: python + + from xgboost import dask as dxgb + from xgboost.collective import Config + + coll_cfg = Config( + retry=1, timeout=20, tracker_host_ip="10.23.170.98", tracker_port=0 + ) + + clf = dxgb.DaskXGBClassifier(coll_cfg=coll_cfg) + # or + dxgb.train(client, {}, Xy, num_boost_round=10, coll_cfg=coll_cfg) + +- **xgboost.scheduler_address**: Specify the scheduler address + + .. versionadded:: 1.6.0 + + .. deprecated:: 3.0.0 + + .. code-block:: python + + dask.config.set({"xgboost.scheduler_address": "192.0.0.100"}) + # We can also specify the port. + dask.config.set({"xgboost.scheduler_address": "192.0.0.100:12345"}) + +""" + +import logging +from collections import defaultdict +from contextlib import contextmanager +from functools import partial, update_wrapper +from threading import Thread +from typing import ( + Any, + Awaitable, + Callable, + Dict, + Generator, + Iterable, + List, + Optional, + ParamSpec, + Sequence, + Set, + Tuple, + TypeAlias, + TypedDict, + TypeGuard, + TypeVar, + Union, +) + +import dask +import distributed +import numpy +from dask import array as da +from dask import bag as db +from dask import dataframe as dd +from dask.delayed import Delayed +from distributed import Future + +from .. import collective, config +from .._data_utils import Categories +from .._typing import FeatureNames, FeatureTypes, IterationRange +from ..callback import TrainingCallback +from ..collective import Config as CollConfig +from ..collective import _Args as CollArgs +from ..collective import _ArgVals as CollArgsVals +from ..compat import _is_cudf_df, _is_cudf_ser, _is_cupy_alike +from ..core import ( + Booster, + DMatrix, + Metric, + PlainObj, + XGBoostError, + _check_distributed_params, + _deprecate_positional_args, + _expect, +) +from ..sklearn import ( + XGBClassifier, + XGBClassifierBase, + XGBModel, + XGBRanker, + XGBRankerMixIn, + XGBRegressorBase, + _can_use_qdm, + _check_rf_callback, + _cls_predict_proba, + _objective_decorator, + _wrap_evaluation_matrices, + xgboost_model_doc, +) +from ..tracker import RabitTracker +from ..training import train as worker_train +from .data import _get_dmatrices, no_group_split +from .utils import _DASK_2024_12_1, _DASK_2025_3_0, get_address_from_user, get_n_threads + +_DaskCollection: TypeAlias = Union[da.Array, dd.DataFrame, dd.Series] +_DataT: TypeAlias = Union[da.Array, dd.DataFrame] # do not use series as predictor +TrainReturnT = TypedDict( + "TrainReturnT", + { + "booster": Booster, + "history": Dict, + }, +) + +__all__ = [ + "CommunicatorContext", + "DaskDMatrix", + "DaskQuantileDMatrix", + "DaskXGBRegressor", + "DaskXGBClassifier", + "DaskXGBRanker", + "DaskXGBRFRegressor", + "DaskXGBRFClassifier", + "train", + "predict", + "inplace_predict", +] + +# TODOs: +# - CV +# +# Note for developers: +# +# As of writing asyncio is still a new feature of Python and in depth documentation is +# rare. Best examples of various asyncio tricks are in dask (luckily). Classes like +# Client, Worker are awaitable. Some general rules for the implementation here: +# +# - Synchronous world is different from asynchronous one, and they don't mix well. +# - Write everything with async, then use distributed Client sync function to do the +# switch. +# - Use Any for type hint when the return value can be union of Awaitable and plain +# value. This is caused by Client.sync can return both types depending on +# context. Right now there's no good way to silent: +# +# await train(...) +# +# if train returns an Union type. + + +LOGGER = logging.getLogger("[xgboost.dask]") + + +def _try_start_tracker( + n_workers: int, + addrs: List[Union[Optional[str], Optional[Tuple[str, int]]]], + timeout: Optional[int], +) -> CollArgs: + env: CollArgs = {} + try: + if isinstance(addrs[0], tuple): + host_ip = addrs[0][0] + port = addrs[0][1] + rabit_tracker = RabitTracker( + n_workers=n_workers, + host_ip=host_ip, + port=port, + sortby="task", + timeout=0 if timeout is None else timeout, + ) + else: + addr = addrs[0] + assert isinstance(addr, str) or addr is None + rabit_tracker = RabitTracker( + n_workers=n_workers, + host_ip=addr, + sortby="task", + timeout=0 if timeout is None else timeout, + ) + + rabit_tracker.start() + # No timeout since we don't want to abort the training + thread = Thread(target=rabit_tracker.wait_for) + thread.daemon = True + thread.start() + env.update(rabit_tracker.worker_args()) + + except XGBoostError as e: + if len(addrs) < 2: + raise + LOGGER.warning( + "Failed to bind address '%s', trying to use '%s' instead. Error:\n %s", + str(addrs[0]), + str(addrs[1]), + str(e), + ) + env = _try_start_tracker(n_workers, addrs[1:], timeout) + + return env + + +def _start_tracker( + n_workers: int, + addr_from_dask: Optional[str], + addr_from_user: Optional[Tuple[str, int]], + timeout: Optional[int], +) -> CollArgs: + """Start Rabit tracker, recurse to try different addresses.""" + env = _try_start_tracker(n_workers, [addr_from_user, addr_from_dask], timeout) + return env + + +class CommunicatorContext(collective.CommunicatorContext): + """A context controlling collective communicator initialization and finalization.""" + + def __init__(self, **args: CollArgsVals) -> None: + super().__init__(**args) + + worker = distributed.get_worker() + # We use task ID for rank assignment which makes the RABIT rank consistent (but + # not the same as task ID is string and "10" is sorted before "2") with dask + # worker name. This outsources the rank assignment to dask and prevents + # non-deterministic issue. + self.args["DMLC_TASK_ID"] = f"[xgboost.dask-{worker.name}]:{worker.address}" + + +def _get_client(client: Optional["distributed.Client"]) -> "distributed.Client": + """Simple wrapper around testing None.""" + if not isinstance(client, (type(distributed.get_client()), type(None))): + raise TypeError( + _expect([type(distributed.get_client()), type(None)], type(client)) + ) + ret = distributed.get_client() if client is None else client + return ret + + +# From the implementation point of view, DaskDMatrix complicates a lots of +# things. A large portion of the code base is about syncing and extracting +# stuffs from DaskDMatrix. But having an independent data structure gives us a +# chance to perform some specialized optimizations, like building histogram +# index directly. + + +class DaskDMatrix: + # pylint: disable=too-many-instance-attributes + """DMatrix holding on references to Dask DataFrame or Dask Array. Constructing a + `DaskDMatrix` forces all lazy computation to be carried out. Wait for the input + data explicitly if you want to see actual computation of constructing `DaskDMatrix`. + + See doc for :py:obj:`xgboost.DMatrix` constructor for other parameters. DaskDMatrix + accepts only dask collection. + + .. note:: + + `DaskDMatrix` does not repartition or move data between workers. It's the + caller's responsibility to balance the data. + + .. note:: + + For aligning partitions with ranking query groups, use the + :py:class:`DaskXGBRanker` and its ``allow_group_split`` option. + + .. versionadded:: 1.0.0 + + Parameters + ---------- + client : + Specify the dask client used for training. Use default client returned from + dask if it's set to None. + + """ + + @_deprecate_positional_args + def __init__( + self, + client: Optional["distributed.Client"], + data: _DataT, + label: Optional[_DaskCollection] = None, + *, + weight: Optional[_DaskCollection] = None, + base_margin: Optional[_DaskCollection] = None, + missing: Optional[float] = None, + silent: bool = False, # pylint: disable=unused-argument + feature_names: Optional[FeatureNames] = None, + feature_types: Optional[FeatureTypes] = None, + group: Optional[_DaskCollection] = None, + qid: Optional[_DaskCollection] = None, + label_lower_bound: Optional[_DaskCollection] = None, + label_upper_bound: Optional[_DaskCollection] = None, + feature_weights: Optional[_DaskCollection] = None, + enable_categorical: bool = False, + ) -> None: + client = _get_client(client) + + self.feature_names = feature_names + self.feature_types = feature_types + if isinstance(feature_types, Categories): + raise TypeError( + "The Dask interface can handle categories from DataFrame automatically." + ) + self.missing = missing if missing is not None else numpy.nan + self.enable_categorical = enable_categorical + + if qid is not None and weight is not None: + raise NotImplementedError("per-group weight is not implemented.") + if group is not None: + raise NotImplementedError( + "group structure is not implemented, use qid instead." + ) + + if len(data.shape) != 2: + raise ValueError(f"Expecting 2 dimensional input, got: {data.shape}") + + if not isinstance(data, (dd.DataFrame, da.Array)): + raise TypeError(_expect((dd.DataFrame, da.Array), type(data))) + if not isinstance(label, (dd.DataFrame, da.Array, dd.Series, type(None))): + raise TypeError(_expect((dd.DataFrame, da.Array, dd.Series), type(label))) + + self._n_cols = data.shape[1] + assert isinstance(self._n_cols, int) + self.worker_map: Dict[str, List[Future]] = defaultdict(list) + self.is_quantile: bool = False + + self._init = client.sync( + self._map_local_data, + client=client, + data=data, + label=label, + weights=weight, + base_margin=base_margin, + qid=qid, + feature_weights=feature_weights, + label_lower_bound=label_lower_bound, + label_upper_bound=label_upper_bound, + ) + + def __await__(self) -> Generator[None, None, "DaskDMatrix"]: + return self._init.__await__() + + async def _map_local_data( + self, + *, + client: "distributed.Client", + data: _DataT, + label: Optional[_DaskCollection] = None, + weights: Optional[_DaskCollection] = None, + base_margin: Optional[_DaskCollection] = None, + qid: Optional[_DaskCollection] = None, + feature_weights: Optional[_DaskCollection] = None, + label_lower_bound: Optional[_DaskCollection] = None, + label_upper_bound: Optional[_DaskCollection] = None, + ) -> "DaskDMatrix": + """Obtain references to local data.""" + + def inconsistent( + left: List[Any], left_name: str, right: List[Any], right_name: str + ) -> str: + msg = ( + f"Partitions between {left_name} and {right_name} are not " + f"consistent: {len(left)} != {len(right)}. " + f"Please try to repartition/rechunk your data." + ) + return msg + + def to_futures(d: _DaskCollection) -> List[Future]: + """Breaking data into partitions.""" + d = client.persist(d) + if ( + hasattr(d.partitions, "shape") + and len(d.partitions.shape) > 1 + and d.partitions.shape[1] > 1 + ): + raise ValueError( + "Data should be" + " partitioned by row. To avoid this specify the number" + " of columns for your dask Array explicitly. e.g." + " chunks=(partition_size, -1])" + ) + return client.futures_of(d) + + def flatten_meta(meta: Optional[_DaskCollection]) -> Optional[List[Future]]: + if meta is not None: + meta_parts: List[Future] = to_futures(meta) + return meta_parts + return None + + X_parts = to_futures(data) + y_parts = flatten_meta(label) + w_parts = flatten_meta(weights) + margin_parts = flatten_meta(base_margin) + qid_parts = flatten_meta(qid) + ll_parts = flatten_meta(label_lower_bound) + lu_parts = flatten_meta(label_upper_bound) + + parts: Dict[str, List[Future]] = {"data": X_parts} + + def append_meta(m_parts: Optional[List[Future]], name: str) -> None: + if m_parts is not None: + assert len(X_parts) == len(m_parts), inconsistent( + X_parts, "X", m_parts, name + ) + parts[name] = m_parts + + append_meta(y_parts, "label") + append_meta(w_parts, "weight") + append_meta(margin_parts, "base_margin") + append_meta(qid_parts, "qid") + append_meta(ll_parts, "label_lower_bound") + append_meta(lu_parts, "label_upper_bound") + # At this point, `parts` looks like: + # [(x0, x1, ..), (y0, y1, ..), ..] in future form + + # turn into list of dictionaries. + packed_parts: List[Dict[str, Future]] = [] + for i in range(len(X_parts)): + part_dict: Dict[str, Future] = {} + for key, value in parts.items(): + part_dict[key] = value[i] + packed_parts.append(part_dict) + + # delay the zipped result + # pylint: disable=no-member + delayed_parts: List[Delayed] = list(map(dask.delayed, packed_parts)) + # At this point, the mental model should look like: + # [{"data": x0, "label": y0, ..}, {"data": x1, "label": y1, ..}, ..] + + # Convert delayed objects into futures and make sure they are realized + # + # This also makes partitions to align (co-locate) on workers (X_0, y_0 should be + # on the same worker). + fut_parts: List[Future] = client.compute(delayed_parts) + await distributed.wait(fut_parts) # async wait for parts to be computed + + for part in fut_parts: + # Each part is [{"data": x0, "label": y0, ..}, ...] in future form. + assert part.status == "finished", part.status + + # Preserving the partition order for prediction. + self.partition_order = {} + for i, part in enumerate(fut_parts): + self.partition_order[part.key] = i + + key_to_partition = {part.key: part for part in fut_parts} + who_has: Dict[str, Tuple[str, ...]] = await client.scheduler.who_has( + keys=[part.key for part in fut_parts] + ) + + worker_map: Dict[str, List[Future]] = defaultdict(list) + + for key, workers in who_has.items(): + worker_map[next(iter(workers))].append(key_to_partition[key]) + + self.worker_map = worker_map + + if feature_weights is None: + self.feature_weights = None + else: + self.feature_weights = await client.compute(feature_weights).result() + + return self + + def _create_fn_args(self, worker_addr: str) -> Dict[str, Any]: + """Create a dictionary of objects that can be pickled for function + arguments. + + """ + return { + "feature_names": self.feature_names, + "feature_types": self.feature_types, + "feature_weights": self.feature_weights, + "missing": self.missing, + "enable_categorical": self.enable_categorical, + "parts": self.worker_map.get(worker_addr, None), + "is_quantile": self.is_quantile, + } + + def num_col(self) -> int: + """Get the number of columns (features) in the DMatrix. + + Returns + ------- + number of columns + """ + return self._n_cols + + +_MapRetT = TypeVar("_MapRetT") +_P = ParamSpec("_P") + + +async def map_worker_partitions( + client: Optional["distributed.Client"], + func: Callable[_P, _MapRetT], + *refs: Any, + workers: Sequence[str], +) -> _MapRetT: + """Map a function onto partitions of each worker.""" + # Note for function purity: + # XGBoost is sensitive to data partition and uses random number generator. + client = _get_client(client) + futures = [] + for addr in workers: + args = [] + for ref in refs: + if isinstance(ref, DaskDMatrix): + # pylint: disable=protected-access + args.append(ref._create_fn_args(addr)) + else: + args.append(ref) + + def fn(_address: str, *args: _P.args, **kwargs: _P.kwargs) -> List[_MapRetT]: + worker = distributed.get_worker() + + if worker.address != _address: + raise ValueError( + f"Invalid worker address: {worker.address}, expecting {_address}. " + "This is likely caused by one of the workers died and Dask " + "re-scheduled a different one. Resilience is not yet supported." + ) + # Turn result into a list for bag construction + return [func(*args, **kwargs)] + + # XGBoost requires all workers running training tasks to be unique. Meaning, we + # can't run 2 training jobs on the same node. This at best leads to an error + # (NCCL unique check), at worst leads to extremely slow training performance + # without any warning. + # + # See disitributed.scheduler.decide_worker for `allow_other_workers`. In + # summary, the scheduler chooses a worker from the valid set that has the task + # dependencies. Each XGBoost's training task has all dependencies in a single + # worker. As a result, the right worker should be picked by the scheduler even + # if `allow_other_workers` is set to True. + # + # In addition, the scheduler only discards the valid set (the `workers` arg) if + # there's no candidate can be found. This is likely caused by killed workers. In + # that case, the check in `fn` should be able to stop the task. If we don't + # relax the constraint and prevent Dask from choosing an invalid worker, the + # task will simply hangs. We prefer a quick error here. + # + fut = client.submit( + update_wrapper(partial(fn, addr), fn), + *args, + pure=False, + workers=[addr], + allow_other_workers=True, + ) + futures.append(fut) + + def first_valid(results: Iterable[Optional[_MapRetT]]) -> Optional[_MapRetT]: + for v in results: + if v is not None: + return v + return None + + bag = db.from_delayed(futures) + fut = await bag.reduction(first_valid, first_valid) + result = await client.compute(fut).result() + + return result + + +class DaskQuantileDMatrix(DaskDMatrix): + """A dask version of :py:class:`QuantileDMatrix`. See :py:class:`DaskDMatrix` for + parameter documents. + + """ + + @_deprecate_positional_args + def __init__( + self, + client: Optional["distributed.Client"], + data: _DataT, + label: Optional[_DaskCollection] = None, + *, + weight: Optional[_DaskCollection] = None, + base_margin: Optional[_DaskCollection] = None, + missing: Optional[float] = None, + silent: bool = False, # disable=unused-argument + feature_names: Optional[FeatureNames] = None, + feature_types: Optional[Union[Any, List[Any]]] = None, + max_bin: Optional[int] = None, + ref: Optional[DaskDMatrix] = None, + group: Optional[_DaskCollection] = None, + qid: Optional[_DaskCollection] = None, + label_lower_bound: Optional[_DaskCollection] = None, + label_upper_bound: Optional[_DaskCollection] = None, + feature_weights: Optional[_DaskCollection] = None, + enable_categorical: bool = False, + max_quantile_batches: Optional[int] = None, + ) -> None: + super().__init__( + client=client, + data=data, + label=label, + weight=weight, + base_margin=base_margin, + group=group, + qid=qid, + label_lower_bound=label_lower_bound, + label_upper_bound=label_upper_bound, + missing=missing, + silent=silent, + feature_weights=feature_weights, + feature_names=feature_names, + feature_types=feature_types, + enable_categorical=enable_categorical, + ) + self.max_bin = max_bin + self.max_quantile_batches = max_quantile_batches + self.is_quantile = True + self._ref: Optional[int] = id(ref) if ref is not None else None + + def _create_fn_args(self, worker_addr: str) -> Dict[str, Any]: + args = super()._create_fn_args(worker_addr) + args["max_bin"] = self.max_bin + args["max_quantile_batches"] = self.max_quantile_batches + if self._ref is not None: + args["ref"] = self._ref + return args + + +async def _get_rabit_args( + client: "distributed.Client", + n_workers: int, + dconfig: Optional[Dict[str, Any]] = None, + coll_cfg: Optional[CollConfig] = None, +) -> Dict[str, Union[str, int]]: + """Get rabit context arguments from data distribution in DaskDMatrix.""" + # There are 3 possible different addresses: + # 1. Provided by user via dask.config + # 2. Guessed by xgboost `get_host_ip` function + # 3. From dask scheduler + # We try 1 and 3 if 1 is available, otherwise 2 and 3. + + # See if user config is available + coll_cfg = CollConfig() if coll_cfg is None else coll_cfg + host_ip: Optional[str] = None + port: int = 0 + host_ip, port = get_address_from_user(dconfig, coll_cfg) + + if host_ip is not None: + user_addr = (host_ip, port) + else: + user_addr = None + + # Try address from dask scheduler, this might not work, see + # https://github.com/dask/dask-xgboost/pull/40 + try: + sched_addr = distributed.comm.get_address_host(client.scheduler.address) + sched_addr = sched_addr.strip("/:") + except Exception: # pylint: disable=broad-except + sched_addr = None + + # We assume the scheduler is a fair process and run the tracker there. + env = await client.run_on_scheduler( + _start_tracker, n_workers, sched_addr, user_addr, coll_cfg.tracker_timeout + ) + env = coll_cfg.get_comm_config(env) + assert env is not None + return env + + +def _get_dask_config() -> Optional[Dict[str, Any]]: + return dask.config.get("xgboost", default=None) + + +# train and predict methods are supposed to be "functional", which meets the +# dask paradigm. But as a side effect, the `evals_result` in single-node API +# is no longer supported since it mutates the input parameter, and it's not +# intuitive to sync the mutation result. Therefore, a dictionary containing +# evaluation history is instead returned. + + +def _get_workers_from_data( + dtrain: DaskDMatrix, evals: Optional[Sequence[Tuple[DaskDMatrix, str]]] +) -> List[str]: + X_worker_map: Set[str] = set(dtrain.worker_map.keys()) + if evals: + for e in evals: + assert len(e) == 2 + assert isinstance(e[0], DaskDMatrix) and isinstance(e[1], str) + if e[0] is dtrain: + continue + worker_map = set(e[0].worker_map.keys()) + X_worker_map = X_worker_map.union(worker_map) + return list(X_worker_map) + + +async def _check_workers_are_alive( + workers: List[str], client: "distributed.Client" +) -> None: + info = await client.scheduler.identity() + current_workers = info["workers"].keys() + missing_workers = set(workers) - current_workers + if missing_workers: + raise RuntimeError(f"Missing required workers: {missing_workers}") + + +async def _train_async( + *, + client: "distributed.Client", + global_config: Dict[str, Any], + dconfig: Optional[Dict[str, Any]], + params: Dict[str, Any], + dtrain: DaskDMatrix, + num_boost_round: int, + evals: Optional[Sequence[Tuple[DaskDMatrix, str]]], + obj: Optional[PlainObj], + early_stopping_rounds: Optional[int], + verbose_eval: Union[int, bool], + xgb_model: Optional[Booster], + callbacks: Optional[Sequence[TrainingCallback]], + custom_metric: Optional[Metric], + coll_cfg: Optional[CollConfig], +) -> Optional[TrainReturnT]: + workers = _get_workers_from_data(dtrain, evals) + await _check_workers_are_alive(workers, client) + coll_args = await _get_rabit_args( + client, len(workers), dconfig=dconfig, coll_cfg=coll_cfg + ) + _check_distributed_params(params) + + # This function name is displayed in the Dask dashboard task status, let's make it + # clear that it's XGBoost training. + def do_train( # pylint: disable=too-many-positional-arguments + parameters: Dict, + coll_args: Dict[str, Union[str, int]], + train_id: int, + evals_name: List[str], + evals_id: List[int], + train_ref: dict, + *refs: dict, + ) -> Optional[TrainReturnT]: + worker = distributed.get_worker() + local_param = parameters.copy() + n_threads = get_n_threads(local_param, worker) + local_param.update({"nthread": n_threads, "n_jobs": n_threads}) + + local_history: TrainingCallback.EvalsLog = {} + global_config.update({"nthread": n_threads}) + + with CommunicatorContext(**coll_args), config.config_context(**global_config): + Xy, evals = _get_dmatrices( + train_ref, + train_id, + *refs, + evals_id=evals_id, + evals_name=evals_name, + n_threads=n_threads, + # We need the model for reference categories. + model=xgb_model, + ) + + booster = worker_train( + params=local_param, + dtrain=Xy, + num_boost_round=num_boost_round, + evals_result=local_history, + evals=evals if len(evals) != 0 else None, + obj=obj, + custom_metric=custom_metric, + early_stopping_rounds=early_stopping_rounds, + verbose_eval=verbose_eval, + xgb_model=xgb_model, + callbacks=callbacks, + ) + # Don't return the boosters from empty workers. It's quite difficult to + # guarantee everything is in sync in the present of empty workers, especially + # with complex objectives like quantile. + if Xy.num_row() != 0: + ret: Optional[TrainReturnT] = { + "booster": booster, + "history": local_history, + } + else: + ret = None + return ret + + async with distributed.MultiLock(workers, client): + if evals is not None: + evals_data = [d for d, n in evals] + evals_name = [n for d, n in evals] + evals_id = [id(d) for d in evals_data] + else: + evals_data = [] + evals_name = [] + evals_id = [] + + result = await map_worker_partitions( + client, + do_train, + # extra function parameters + params, + coll_args, + id(dtrain), + evals_name, + evals_id, + *([dtrain] + evals_data), + # workers to be used for training + workers=workers, + ) + return result + + +@_deprecate_positional_args +def train( # pylint: disable=unused-argument + client: "distributed.Client", + params: Dict[str, Any], + dtrain: DaskDMatrix, + num_boost_round: int = 10, + *, + evals: Optional[Sequence[Tuple[DaskDMatrix, str]]] = None, + obj: Optional[PlainObj] = None, + early_stopping_rounds: Optional[int] = None, + xgb_model: Optional[Booster] = None, + verbose_eval: Union[int, bool] = True, + callbacks: Optional[Sequence[TrainingCallback]] = None, + custom_metric: Optional[Metric] = None, + coll_cfg: Optional[CollConfig] = None, +) -> Any: + """Train XGBoost model. + + .. versionadded:: 1.0.0 + + .. note:: + + Other parameters are the same as :py:func:`xgboost.train` except for + `evals_result`, which is returned as part of function return value instead of + argument. + + Parameters + ---------- + client : + Specify the dask client used for training. Use default client returned from + dask if it's set to None. + + coll_cfg : + Configuration for the communicator used during training. See + :py:class:`~xgboost.collective.Config`. + + Returns + ------- + results: dict + A dictionary containing trained booster and evaluation history. `history` field + is the same as `eval_result` from `xgboost.train`. + + .. code-block:: python + + {'booster': xgboost.Booster, + 'history': {'train': {'logloss': ['0.48253', '0.35953']}, + 'eval': {'logloss': ['0.480385', '0.357756']}}} + + """ + client = _get_client(client) + return client.sync( + _train_async, + global_config=config.get_config(), + dconfig=_get_dask_config(), + **locals(), + ) + + +def _can_output_df(is_df: bool, output_shape: Tuple) -> bool: + return is_df and len(output_shape) <= 2 + + +def _maybe_dataframe( + data: Any, prediction: Any, columns: List[int], is_df: bool +) -> Any: + """Return dataframe for prediction when applicable.""" + if _can_output_df(is_df, prediction.shape): + # Need to preserve the index for dataframe. + # See issue: https://github.com/dmlc/xgboost/issues/6939 + # In older versions of dask, the partition is actually a numpy array when input + # is dataframe. + index = getattr(data, "index", None) + if _is_cudf_df(data): + import cudf + + if prediction.size == 0: + return cudf.DataFrame({}, columns=columns, dtype=numpy.float32) + + prediction = cudf.DataFrame( + prediction, columns=columns, dtype=numpy.float32, index=index + ) + else: + import pandas as pd + + if prediction.size == 0: + return pd.DataFrame( + {}, columns=columns, dtype=numpy.float32, index=index + ) + + prediction = pd.DataFrame( + prediction, columns=columns, dtype=numpy.float32, index=index + ) + return prediction + + +async def _direct_predict_impl( # pylint: disable=too-many-branches + *, + mapped_predict: Callable, + booster: "distributed.Future", + data: _DataT, + base_margin: Optional[_DaskCollection], + output_shape: Tuple[int, ...], + meta: Dict[int, str], +) -> _DaskCollection: + columns = tuple(meta.keys()) + if len(output_shape) >= 3 and isinstance(data, dd.DataFrame): + # Without this check, dask will finish the prediction silently even if output + # dimension is greater than 3. But during map_partitions, dask passes a + # `dd.DataFrame` as local input to xgboost, which is converted to csr_matrix by + # `_convert_unknown_data` since dd.DataFrame is not known to xgboost native + # binding. + raise ValueError( + "Use `da.Array` or `DaskDMatrix` when output has more than 2 dimensions." + ) + if _can_output_df(isinstance(data, dd.DataFrame), output_shape): + if base_margin is not None and isinstance(base_margin, da.Array): + # Easier for map_partitions + base_margin_df: Optional[Union[dd.DataFrame, dd.Series]] = ( + base_margin.to_dask_dataframe() + ) + else: + base_margin_df = base_margin + predictions = dd.map_partitions( + mapped_predict, + booster, + data, + True, + columns, + base_margin_df, + meta=dd.utils.make_meta(meta), + ) + # classification can return a dataframe, drop 1 dim when it's reg/binary + if len(output_shape) == 1: + predictions = predictions.iloc[:, 0] + else: + if base_margin is not None and isinstance( + base_margin, (dd.Series, dd.DataFrame) + ): + # Easier for map_blocks + base_margin_array: Optional[da.Array] = base_margin.to_dask_array() + else: + base_margin_array = base_margin + # Input data is 2-dim array, output can be 1(reg, binary)/2(multi-class, + # contrib)/3(contrib, interaction)/4(interaction) dims. + if len(output_shape) == 1: + drop_axis: Union[int, List[int]] = [1] # drop from 2 to 1 dim. + new_axis: Union[int, List[int]] = [] + else: + drop_axis = [] + if isinstance(data, dd.DataFrame): + new_axis = list(range(len(output_shape) - 2)) + else: + new_axis = [i + 2 for i in range(len(output_shape) - 2)] + if len(output_shape) == 2: + # Somehow dask fail to infer output shape change for 2-dim prediction, and + # `chunks = (None, output_shape[1])` doesn't work due to None is not + # supported in map_blocks. + + # data must be an array here as dataframe + 2-dim output predict will return + # a dataframe instead. + chunks: Optional[List[Tuple]] = list(data.chunks) + assert isinstance(chunks, list) + chunks[1] = (output_shape[1],) + else: + chunks = None + predictions = da.map_blocks( + mapped_predict, + booster, + data, + False, + columns, + base_margin_array, + chunks=chunks, + drop_axis=drop_axis, + new_axis=new_axis, + dtype=numpy.float32, + ) + return predictions + + +def _infer_predict_output( + booster: Booster, features: int, is_df: bool, inplace: bool, **kwargs: Any +) -> Tuple[Tuple[int, ...], Dict[int, str]]: + """Create a dummy test sample to infer output shape for prediction.""" + assert isinstance(features, int) + rng = numpy.random.RandomState(1994) + test_sample = rng.randn(1, features) + if inplace: + kwargs = kwargs.copy() + if kwargs.pop("predict_type") == "margin": + kwargs["output_margin"] = True + m = DMatrix(test_sample, enable_categorical=True) + # generated DMatrix doesn't have feature name, so no validation. + test_predt = booster.predict(m, validate_features=False, **kwargs) + n_columns = test_predt.shape[1] if len(test_predt.shape) > 1 else 1 + meta: Dict[int, str] = {} + if _can_output_df(is_df, test_predt.shape): + for i in range(n_columns): + meta[i] = "f4" + return test_predt.shape, meta + + +async def _get_model_future( + client: "distributed.Client", model: Union[Booster, Dict, "distributed.Future"] +) -> "distributed.Future": + # See https://github.com/dask/dask/issues/11179#issuecomment-2168094529 for the use + # of hash. + # https://github.com/dask/distributed/pull/8796 Don't use broadcast in the `scatter` + # call, otherwise, the predict function might hang. + if isinstance(model, Booster): + booster = await client.scatter(model, hash=False) + elif isinstance(model, dict): + booster = await client.scatter(model["booster"], hash=False) + elif isinstance(model, distributed.Future): + booster = model + t = booster.type + if t is not Booster: + raise TypeError( + f"Underlying type of model future should be `Booster`, got {t}" + ) + else: + raise TypeError(_expect([Booster, dict, distributed.Future], type(model))) + return booster + + +# pylint: disable=too-many-statements +async def _predict_async( + client: "distributed.Client", + global_config: Dict[str, Any], + model: Union[Booster, Dict, "distributed.Future"], + data: _DataT, + *, + output_margin: bool, + missing: float, + pred_leaf: bool, + pred_contribs: bool, + approx_contribs: bool, + pred_interactions: bool, + validate_features: bool, + iteration_range: IterationRange, + strict_shape: bool, +) -> _DaskCollection: + _booster = await _get_model_future(client, model) + if not isinstance(data, (DaskDMatrix, da.Array, dd.DataFrame)): + raise TypeError(_expect([DaskDMatrix, da.Array, dd.DataFrame], type(data))) + + def mapped_predict( + booster: Booster, partition: Any, is_df: bool, columns: List[int], _: Any + ) -> Any: + with config.config_context(**global_config): + m = DMatrix( + data=partition, + missing=missing, + enable_categorical=True, + ) + predt = booster.predict( + data=m, + output_margin=output_margin, + pred_leaf=pred_leaf, + pred_contribs=pred_contribs, + approx_contribs=approx_contribs, + pred_interactions=pred_interactions, + validate_features=validate_features, + iteration_range=iteration_range, + strict_shape=strict_shape, + ) + predt = _maybe_dataframe(partition, predt, columns, is_df) + return predt + + # Predict on dask collection directly. + if isinstance(data, (da.Array, dd.DataFrame)): + _output_shape, meta = await client.compute( + client.submit( + _infer_predict_output, + _booster, + features=data.shape[1], + is_df=isinstance(data, dd.DataFrame), + inplace=False, + output_margin=output_margin, + pred_leaf=pred_leaf, + pred_contribs=pred_contribs, + approx_contribs=approx_contribs, + pred_interactions=pred_interactions, + strict_shape=strict_shape, + ) + ) + return await _direct_predict_impl( + mapped_predict=mapped_predict, + booster=_booster, + data=data, + base_margin=None, + output_shape=_output_shape, + meta=meta, + ) + + output_shape, _ = await client.compute( + client.submit( + _infer_predict_output, + booster=_booster, + features=data.num_col(), + is_df=False, + inplace=False, + output_margin=output_margin, + pred_leaf=pred_leaf, + pred_contribs=pred_contribs, + approx_contribs=approx_contribs, + pred_interactions=pred_interactions, + strict_shape=strict_shape, + ) + ) + # Prediction on dask DMatrix. + partition_order = data.partition_order + feature_names = data.feature_names + feature_types = data.feature_types + missing = data.missing + + def dispatched_predict(booster: Booster, part: Dict[str, Any]) -> numpy.ndarray: + data = part["data"] + base_margin = part.get("base_margin", None) + with config.config_context(**global_config): + m = DMatrix( + data, + missing=missing, + base_margin=base_margin, + feature_names=feature_names, + feature_types=feature_types, + enable_categorical=True, + ) + predt = booster.predict( + m, + output_margin=output_margin, + pred_leaf=pred_leaf, + pred_contribs=pred_contribs, + approx_contribs=approx_contribs, + pred_interactions=pred_interactions, + validate_features=validate_features, + iteration_range=iteration_range, + strict_shape=strict_shape, + ) + return predt + + all_parts = [] + all_orders = [] + all_shapes = [] + all_workers: List[str] = [] + workers_address = list(data.worker_map.keys()) + for worker_addr in workers_address: + list_of_parts = data.worker_map[worker_addr] + all_parts.extend(list_of_parts) + all_workers.extend(len(list_of_parts) * [worker_addr]) + all_orders.extend([partition_order[part.key] for part in list_of_parts]) + for w, part in zip(all_workers, all_parts): + s = client.submit(lambda part: part["data"].shape[0], part, workers=[w]) + all_shapes.append(s) + + parts_with_order = list(zip(all_parts, all_shapes, all_orders, all_workers)) + parts_with_order = sorted(parts_with_order, key=lambda p: p[2]) + all_parts = [part for part, shape, order, w in parts_with_order] + all_shapes = [shape for part, shape, order, w in parts_with_order] + all_workers = [w for part, shape, order, w in parts_with_order] + + futures = [] + for w, part in zip(all_workers, all_parts): + f = client.submit(dispatched_predict, _booster, part, workers=[w]) + futures.append(f) + + # Constructing a dask array from list of numpy arrays + # See https://docs.dask.org/en/latest/array-creation.html + arrays = [] + all_shapes = await client.gather(all_shapes) + for i, rows in enumerate(all_shapes): + arrays.append( + da.from_delayed( + futures[i], shape=(rows,) + output_shape[1:], dtype=numpy.float32 + ) + ) + predictions = da.concatenate(arrays, axis=0) + return predictions + + +@_deprecate_positional_args +def predict( # pylint: disable=unused-argument + client: Optional["distributed.Client"], + model: Union[TrainReturnT, Booster, "distributed.Future"], + data: Union[DaskDMatrix, _DataT], + *, + output_margin: bool = False, + missing: float = numpy.nan, + pred_leaf: bool = False, + pred_contribs: bool = False, + approx_contribs: bool = False, + pred_interactions: bool = False, + validate_features: bool = True, + iteration_range: IterationRange = (0, 0), + strict_shape: bool = False, +) -> Any: + """Run prediction with a trained booster. + + .. note:: + + Using ``inplace_predict`` might be faster when some features are not needed. + See :py:meth:`xgboost.Booster.predict` for details on various parameters. When + output has more than 2 dimensions (shap value, leaf with strict_shape), input + should be ``da.Array`` or ``DaskDMatrix``. + + .. versionadded:: 1.0.0 + + Parameters + ---------- + client: + Specify the dask client used for training. Use default client + returned from dask if it's set to None. + model: + The trained model. It can be a distributed.Future so user can + pre-scatter it onto all workers. + data: + Input data used for prediction. When input is a dataframe object, + prediction output is a series. + missing: + Used when input data is not DaskDMatrix. Specify the value + considered as missing. + + Returns + ------- + prediction: dask.array.Array/dask.dataframe.Series + When input data is ``dask.array.Array`` or ``DaskDMatrix``, the return value is + an array, when input data is ``dask.dataframe.DataFrame``, return value can be + ``dask.dataframe.Series``, ``dask.dataframe.DataFrame``, depending on the output + shape. + + """ + client = _get_client(client) + return client.sync(_predict_async, global_config=config.get_config(), **locals()) + + +async def _inplace_predict_async( # pylint: disable=too-many-branches + *, + client: "distributed.Client", + global_config: Dict[str, Any], + model: Union[Booster, Dict, "distributed.Future"], + data: _DataT, + iteration_range: IterationRange, + predict_type: str, + missing: float, + validate_features: bool, + base_margin: Optional[_DaskCollection], + strict_shape: bool, +) -> _DaskCollection: + client = _get_client(client) + booster = await _get_model_future(client, model) + if not isinstance(data, (da.Array, dd.DataFrame)): + raise TypeError(_expect([da.Array, dd.DataFrame], type(data))) + if base_margin is not None and not isinstance( + data, (da.Array, dd.DataFrame, dd.Series) + ): + raise TypeError(_expect([da.Array, dd.DataFrame, dd.Series], type(base_margin))) + + def mapped_predict( + booster: Booster, + partition: Any, + is_df: bool, + columns: List[int], + base_margin: Any, + ) -> Any: + with config.config_context(**global_config): + prediction = booster.inplace_predict( + partition, + iteration_range=iteration_range, + predict_type=predict_type, + missing=missing, + base_margin=base_margin, + validate_features=validate_features, + strict_shape=strict_shape, + ) + prediction = _maybe_dataframe(partition, prediction, columns, is_df) + return prediction + + # await turns future into value. + shape, meta = await client.compute( + client.submit( + _infer_predict_output, + booster, + features=data.shape[1], + is_df=isinstance(data, dd.DataFrame), + inplace=True, + predict_type=predict_type, + iteration_range=iteration_range, + strict_shape=strict_shape, + ) + ) + return await _direct_predict_impl( + mapped_predict=mapped_predict, + booster=booster, + data=data, + base_margin=base_margin, + output_shape=shape, + meta=meta, + ) + + +@_deprecate_positional_args +def inplace_predict( # pylint: disable=unused-argument + client: Optional["distributed.Client"], + model: Union[TrainReturnT, Booster, "distributed.Future"], + data: _DataT, + *, + iteration_range: IterationRange = (0, 0), + predict_type: str = "value", + missing: float = numpy.nan, + validate_features: bool = True, + base_margin: Optional[_DaskCollection] = None, + strict_shape: bool = False, +) -> Any: + """Inplace prediction. See doc in :py:meth:`xgboost.Booster.inplace_predict` for + details. + + .. versionadded:: 1.1.0 + + Parameters + ---------- + client: + Specify the dask client used for training. Use default client + returned from dask if it's set to None. + model: + See :py:func:`xgboost.dask.predict` for details. + data : + dask collection. + iteration_range: + See :py:meth:`xgboost.Booster.predict` for details. + predict_type: + See :py:meth:`xgboost.Booster.inplace_predict` for details. + missing: + Value in the input data which needs to be present as a missing + value. If None, defaults to np.nan. + base_margin: + See :py:obj:`xgboost.DMatrix` for details. + + .. versionadded:: 1.4.0 + + strict_shape: + See :py:meth:`xgboost.Booster.predict` for details. + + .. versionadded:: 1.4.0 + + Returns + ------- + prediction : + When input data is ``dask.array.Array``, the return value is an array, when + input data is ``dask.dataframe.DataFrame``, return value can be + ``dask.dataframe.Series``, ``dask.dataframe.DataFrame``, depending on the output + shape. + + """ + client = _get_client(client) + # When used in asynchronous environment, the `client` object should have + # `asynchronous` attribute as True. When invoked by the skl interface, it's + # responsible for setting up the client. + return client.sync( + _inplace_predict_async, global_config=config.get_config(), **locals() + ) + + +async def _async_wrap_evaluation_matrices( + client: Optional["distributed.Client"], + device: Optional[str], + tree_method: Optional[str], + max_bin: Optional[int], + **kwargs: Any, +) -> Tuple[DaskDMatrix, Optional[List[Tuple[DaskDMatrix, str]]]]: + """A switch function for async environment.""" + + def _dispatch(ref: Optional[DaskDMatrix], **kwargs: Any) -> DaskDMatrix: + if _can_use_qdm(tree_method, device): + return DaskQuantileDMatrix( + client=client, ref=ref, max_bin=max_bin, **kwargs + ) + return DaskDMatrix(client=client, **kwargs) + + train_dmatrix, evals = _wrap_evaluation_matrices(create_dmatrix=_dispatch, **kwargs) + train_dmatrix = await train_dmatrix + if evals is None: + return train_dmatrix, evals + awaited = [] + for e in evals: + if e[0] is train_dmatrix: # already awaited + awaited.append(e) + continue + awaited.append((await e[0], e[1])) + return train_dmatrix, awaited + + +@contextmanager +def _set_worker_client( + model: "DaskScikitLearnBase", client: "distributed.Client" +) -> Generator: + """Temporarily set the client for sklearn model.""" + try: + model.client = client + yield model + finally: + model.client = None # type: ignore + + +class DaskScikitLearnBase(XGBModel): + """Base class for implementing scikit-learn interface with Dask""" + + _client = None + + def __init__(self, *, coll_cfg: Optional[CollConfig] = None, **kwargs: Any) -> None: + super().__init__(**kwargs) + + self.coll_cfg = coll_cfg + + async def _predict_async( + self, + data: _DataT, + *, + output_margin: bool, + validate_features: bool, + base_margin: Optional[_DaskCollection], + iteration_range: Optional[IterationRange], + ) -> Any: + iteration_range = self._get_iteration_range(iteration_range) + # Dask doesn't support gblinear and accepts only Dask collection types (array + # and dataframe). We can perform inplace predict. + assert self._can_use_inplace_predict() + predts = await inplace_predict( + client=self.client, + model=self.get_booster(), + data=data, + iteration_range=iteration_range, + predict_type="margin" if output_margin else "value", + missing=self.missing, + base_margin=base_margin, + validate_features=validate_features, + ) + if isinstance(predts, dd.DataFrame): + predts = predts.to_dask_array() + # Make sure the booster is part of the task graph implicitly + # only needed for certain versions of dask. + if _DASK_2024_12_1() and not _DASK_2025_3_0(): + # Fixes this issue for dask>=2024.1.1,<2025.3.0 + # Dask==2025.3.0 fails with: + # RuntimeError: Attempting to use an asynchronous + # Client in a synchronous context of `dask.compute` + # + # Dask==2025.4.0 fails with: + # TypeError: Value type is not supported for data + # iterator: + predts = predts.persist() + return predts + + @_deprecate_positional_args + def predict( + self, + X: _DataT, + *, + output_margin: bool = False, + validate_features: bool = True, + base_margin: Optional[_DaskCollection] = None, + iteration_range: Optional[IterationRange] = None, + ) -> Any: + return self.client.sync( + self._predict_async, + X, + output_margin=output_margin, + validate_features=validate_features, + base_margin=base_margin, + iteration_range=iteration_range, + ) + + async def _apply_async( + self, + X: _DataT, + iteration_range: Optional[IterationRange] = None, + ) -> Any: + iteration_range = self._get_iteration_range(iteration_range) + test_dmatrix: DaskDMatrix = await DaskDMatrix( + self.client, + data=X, + missing=self.missing, + feature_types=self.feature_types, + ) + predts = await predict( + self.client, + model=self.get_booster(), + data=test_dmatrix, + pred_leaf=True, + iteration_range=iteration_range, + ) + return predts + + def apply( + self, + X: _DataT, + iteration_range: Optional[IterationRange] = None, + ) -> Any: + return self.client.sync(self._apply_async, X, iteration_range=iteration_range) + + def __await__(self) -> Awaitable[Any]: + # Generate a coroutine wrapper to make this class awaitable. + async def _() -> Awaitable[Any]: + return self + + return self._client_sync(_).__await__() + + def __getstate__(self) -> Dict: + this = self.__dict__.copy() + if "_client" in this: + del this["_client"] + return this + + @property + def client(self) -> "distributed.Client": + """The dask client used in this model. The `Client` object can not be + serialized for transmission, so if task is launched from a worker instead of + directly from the client process, this attribute needs to be set at that worker. + + """ + + client = _get_client(self._client) + return client + + @client.setter + def client(self, clt: "distributed.Client") -> None: + # calling `worker_client' doesn't return the correct `asynchronous` attribute, + # so we have to pass it ourselves. + self._asynchronous = clt.asynchronous if clt is not None else False + self._client = clt + + def _client_sync(self, func: Callable, **kwargs: Any) -> Any: + """Get the correct client, when method is invoked inside a worker we + should use `worker_client' instead of default client. + + """ + + if self._client is None: + asynchronous = getattr(self, "_asynchronous", False) + try: + distributed.get_worker() + in_worker = True + except ValueError: + in_worker = False + if in_worker: + with distributed.worker_client() as client: + with _set_worker_client(self, client) as this: + ret = this.client.sync( + func, **kwargs, asynchronous=asynchronous + ) + return ret + return ret + + return self.client.sync(func, **kwargs, asynchronous=self.client.asynchronous) + + +@xgboost_model_doc( + """Implementation of the Scikit-Learn API for XGBoost.""", ["estimators", "model"] +) +class DaskXGBRegressor(XGBRegressorBase, DaskScikitLearnBase): + """dummy doc string to workaround pylint, replaced by the decorator.""" + + async def _fit_async( + self, + X: _DataT, + y: _DaskCollection, + *, + sample_weight: Optional[_DaskCollection], + base_margin: Optional[_DaskCollection], + eval_set: Optional[Sequence[Tuple[_DaskCollection, _DaskCollection]]], + sample_weight_eval_set: Optional[Sequence[_DaskCollection]], + base_margin_eval_set: Optional[Sequence[_DaskCollection]], + verbose: Union[int, bool], + xgb_model: Optional[Union[Booster, XGBModel]], + feature_weights: Optional[_DaskCollection], + ) -> _DaskCollection: + params = self.get_xgb_params() + model, metric, params, feature_weights = self._configure_fit( + xgb_model, params, feature_weights + ) + + dtrain, evals = await _async_wrap_evaluation_matrices( + client=self.client, + device=self.device, + tree_method=self.tree_method, + max_bin=self.max_bin, + X=X, + y=y, + group=None, + qid=None, + sample_weight=sample_weight, + base_margin=base_margin, + feature_weights=feature_weights, + eval_set=eval_set, + sample_weight_eval_set=sample_weight_eval_set, + base_margin_eval_set=base_margin_eval_set, + eval_group=None, + eval_qid=None, + missing=self.missing, + enable_categorical=self.enable_categorical, + feature_types=self.feature_types, + ) + + if callable(self.objective): + obj: Optional[Callable] = _objective_decorator(self.objective) + else: + obj = None + results = await self.client.sync( + _train_async, + asynchronous=True, + client=self.client, + global_config=config.get_config(), + dconfig=_get_dask_config(), + params=params, + dtrain=dtrain, + num_boost_round=self.get_num_boosting_rounds(), + evals=evals, + obj=obj, + custom_metric=metric, + verbose_eval=verbose, + early_stopping_rounds=self.early_stopping_rounds, + callbacks=self.callbacks, + coll_cfg=self.coll_cfg, + xgb_model=model, + ) + self._Booster = results["booster"] + self._set_evaluation_result(results["history"]) + return self + + # pylint: disable=missing-docstring, disable=unused-argument + @_deprecate_positional_args + def fit( + self, + X: _DataT, + y: _DaskCollection, + *, + sample_weight: Optional[_DaskCollection] = None, + base_margin: Optional[_DaskCollection] = None, + eval_set: Optional[Sequence[Tuple[_DaskCollection, _DaskCollection]]] = None, + verbose: Optional[Union[int, bool]] = True, + xgb_model: Optional[Union[Booster, str, XGBModel]] = None, + sample_weight_eval_set: Optional[Sequence[_DaskCollection]] = None, + base_margin_eval_set: Optional[Sequence[_DaskCollection]] = None, + feature_weights: Optional[_DaskCollection] = None, + ) -> "DaskXGBRegressor": + args = {k: v for k, v in locals().items() if k not in ("self", "__class__")} + return self._client_sync(self._fit_async, **args) + + +@xgboost_model_doc( + "Implementation of the scikit-learn API for XGBoost classification.", + ["estimators", "model"], +) +class DaskXGBClassifier(XGBClassifierBase, DaskScikitLearnBase): + # pylint: disable=missing-class-docstring + async def _fit_async( + self, + X: _DataT, + y: _DaskCollection, + *, + sample_weight: Optional[_DaskCollection], + base_margin: Optional[_DaskCollection], + eval_set: Optional[Sequence[Tuple[_DaskCollection, _DaskCollection]]], + sample_weight_eval_set: Optional[Sequence[_DaskCollection]], + base_margin_eval_set: Optional[Sequence[_DaskCollection]], + verbose: Union[int, bool], + xgb_model: Optional[Union[Booster, XGBModel]], + feature_weights: Optional[_DaskCollection], + ) -> "DaskXGBClassifier": + params = self.get_xgb_params() + model, metric, params, feature_weights = self._configure_fit( + xgb_model, params, feature_weights + ) + + dtrain, evals = await _async_wrap_evaluation_matrices( + self.client, + device=self.device, + tree_method=self.tree_method, + max_bin=self.max_bin, + X=X, + y=y, + group=None, + qid=None, + sample_weight=sample_weight, + base_margin=base_margin, + feature_weights=feature_weights, + eval_set=eval_set, + sample_weight_eval_set=sample_weight_eval_set, + base_margin_eval_set=base_margin_eval_set, + eval_group=None, + eval_qid=None, + missing=self.missing, + enable_categorical=self.enable_categorical, + feature_types=self.feature_types, + ) + + # pylint: disable=attribute-defined-outside-init + if isinstance(y, da.Array): + self.classes_ = await self.client.compute(da.unique(y)) + else: + self.classes_ = await self.client.compute(y.drop_duplicates()) + if _is_cudf_ser(self.classes_): + self.classes_ = self.classes_.to_cupy() + if _is_cupy_alike(self.classes_): + self.classes_ = self.classes_.get() + self.classes_ = numpy.array(self.classes_) + self.n_classes_ = len(self.classes_) + + if self.n_classes_ > 2: + params["objective"] = "multi:softprob" + params["num_class"] = self.n_classes_ + else: + params["objective"] = "binary:logistic" + + if callable(self.objective): + obj: Optional[Callable] = _objective_decorator(self.objective) + else: + obj = None + results = await self.client.sync( + _train_async, + asynchronous=True, + client=self.client, + global_config=config.get_config(), + dconfig=_get_dask_config(), + params=params, + dtrain=dtrain, + num_boost_round=self.get_num_boosting_rounds(), + evals=evals, + obj=obj, + custom_metric=metric, + verbose_eval=verbose, + early_stopping_rounds=self.early_stopping_rounds, + callbacks=self.callbacks, + coll_cfg=self.coll_cfg, + xgb_model=model, + ) + self._Booster = results["booster"] + if not callable(self.objective): + self.objective = params["objective"] + self._set_evaluation_result(results["history"]) + return self + + # pylint: disable=unused-argument + def fit( + self, + X: _DataT, + y: _DaskCollection, + *, + sample_weight: Optional[_DaskCollection] = None, + base_margin: Optional[_DaskCollection] = None, + eval_set: Optional[Sequence[Tuple[_DaskCollection, _DaskCollection]]] = None, + verbose: Optional[Union[int, bool]] = True, + xgb_model: Optional[Union[Booster, str, XGBModel]] = None, + sample_weight_eval_set: Optional[Sequence[_DaskCollection]] = None, + base_margin_eval_set: Optional[Sequence[_DaskCollection]] = None, + feature_weights: Optional[_DaskCollection] = None, + ) -> "DaskXGBClassifier": + args = {k: v for k, v in locals().items() if k not in ("self", "__class__")} + return self._client_sync(self._fit_async, **args) + + async def _predict_proba_async( + self, + X: _DataT, + validate_features: bool, + base_margin: Optional[_DaskCollection], + iteration_range: Optional[IterationRange], + ) -> _DaskCollection: + if self.objective == "multi:softmax": + raise ValueError( + "multi:softmax doesn't support `predict_proba`. " + "Switch to `multi:softproba` instead" + ) + predts = await super()._predict_async( + data=X, + output_margin=False, + validate_features=validate_features, + base_margin=base_margin, + iteration_range=iteration_range, + ) + vstack = update_wrapper( + partial(da.vstack, allow_unknown_chunksizes=True), da.vstack + ) + return _cls_predict_proba(getattr(self, "n_classes_", 0), predts, vstack) + + # pylint: disable=missing-function-docstring + def predict_proba( + self, + X: _DaskCollection, + validate_features: bool = True, + base_margin: Optional[_DaskCollection] = None, + iteration_range: Optional[IterationRange] = None, + ) -> Any: + return self._client_sync( + self._predict_proba_async, + X=X, + validate_features=validate_features, + base_margin=base_margin, + iteration_range=iteration_range, + ) + + predict_proba.__doc__ = XGBClassifier.predict_proba.__doc__ + + async def _predict_async( + self, + data: _DataT, + *, + output_margin: bool, + validate_features: bool, + base_margin: Optional[_DaskCollection], + iteration_range: Optional[IterationRange], + ) -> _DaskCollection: + pred_probs = await super()._predict_async( + data, + output_margin=output_margin, + validate_features=validate_features, + base_margin=base_margin, + iteration_range=iteration_range, + ) + if output_margin: + return pred_probs + + if len(pred_probs.shape) == 1: + preds = (pred_probs > 0.5).astype(int) + else: + assert len(pred_probs.shape) == 2 + assert isinstance(pred_probs, da.Array) + # when using da.argmax directly, dask will construct a numpy based return + # array, which runs into error when computing GPU based prediction. + + def _argmax(x: Any) -> Any: + return x.argmax(axis=1) + + preds = da.map_blocks(_argmax, pred_probs, drop_axis=1) + return preds + + +@xgboost_model_doc( + """Implementation of the Scikit-Learn API for XGBoost Ranking. + + .. versionadded:: 1.4.0 + +""", + ["estimators", "model"], + extra_parameters=""" + allow_group_split : + + .. versionadded:: 3.0.0 + + Whether a query group can be split among multiple workers. When set to `False`, + inputs must be Dask dataframes or series. If you have many small query groups, + this can significantly increase the fragmentation of the data, and the internal + DMatrix construction can take longer. + +""", + end_note=""" + .. note:: + + For the dask implementation, group is not supported, use qid instead. +""", +) +class DaskXGBRanker(XGBRankerMixIn, DaskScikitLearnBase): + @_deprecate_positional_args + def __init__( + self, + *, + objective: str = "rank:ndcg", + allow_group_split: bool = False, + coll_cfg: Optional[CollConfig] = None, + **kwargs: Any, + ) -> None: + if callable(objective): + raise ValueError("Custom objective function not supported by XGBRanker.") + self.allow_group_split = allow_group_split + super().__init__(objective=objective, coll_cfg=coll_cfg, **kwargs) + + def _wrapper_params(self) -> Set[str]: + params = super()._wrapper_params() + params.add("allow_group_split") + return params + + async def _fit_async( + self, + X: _DataT, + y: _DaskCollection, + *, + qid: Optional[_DaskCollection], + sample_weight: Optional[_DaskCollection], + base_margin: Optional[_DaskCollection], + eval_set: Optional[Sequence[Tuple[_DaskCollection, _DaskCollection]]], + sample_weight_eval_set: Optional[Sequence[_DaskCollection]], + base_margin_eval_set: Optional[Sequence[_DaskCollection]], + eval_qid: Optional[Sequence[_DaskCollection]], + verbose: Union[int, bool], + xgb_model: Optional[Union[XGBModel, Booster]], + feature_weights: Optional[_DaskCollection], + ) -> "DaskXGBRanker": + params = self.get_xgb_params() + model, metric, params, feature_weights = self._configure_fit( + xgb_model, params, feature_weights + ) + dtrain, evals = await _async_wrap_evaluation_matrices( + self.client, + device=self.device, + tree_method=self.tree_method, + max_bin=self.max_bin, + X=X, + y=y, + group=None, + qid=qid, + sample_weight=sample_weight, + base_margin=base_margin, + feature_weights=feature_weights, + eval_set=eval_set, + sample_weight_eval_set=sample_weight_eval_set, + base_margin_eval_set=base_margin_eval_set, + eval_group=None, + eval_qid=eval_qid, + missing=self.missing, + enable_categorical=self.enable_categorical, + feature_types=self.feature_types, + ) + results = await self.client.sync( + _train_async, + asynchronous=True, + client=self.client, + global_config=config.get_config(), + dconfig=_get_dask_config(), + params=params, + dtrain=dtrain, + num_boost_round=self.get_num_boosting_rounds(), + evals=evals, + obj=None, + custom_metric=metric, + verbose_eval=verbose, + early_stopping_rounds=self.early_stopping_rounds, + callbacks=self.callbacks, + xgb_model=model, + coll_cfg=self.coll_cfg, + ) + self._Booster = results["booster"] + self.evals_result_ = results["history"] + return self + + # pylint: disable=unused-argument, arguments-differ + @_deprecate_positional_args + def fit( + self, + X: _DataT, + y: _DaskCollection, + *, + group: Optional[_DaskCollection] = None, + qid: Optional[_DaskCollection] = None, + sample_weight: Optional[_DaskCollection] = None, + base_margin: Optional[_DaskCollection] = None, + eval_set: Optional[Sequence[Tuple[_DaskCollection, _DaskCollection]]] = None, + eval_group: Optional[Sequence[_DaskCollection]] = None, + eval_qid: Optional[Sequence[_DaskCollection]] = None, + verbose: Optional[Union[int, bool]] = False, + xgb_model: Optional[Union[XGBModel, str, Booster]] = None, + sample_weight_eval_set: Optional[Sequence[_DaskCollection]] = None, + base_margin_eval_set: Optional[Sequence[_DaskCollection]] = None, + feature_weights: Optional[_DaskCollection] = None, + ) -> "DaskXGBRanker": + msg = "Use the `qid` instead of the `group` with the dask interface." + if not (group is None and eval_group is None): + raise ValueError(msg) + if qid is None: + raise ValueError("`qid` is required for ranking.") + + def check_df(X: _DaskCollection) -> TypeGuard[dd.DataFrame]: + if not isinstance(X, dd.DataFrame): + raise TypeError( + "When `allow_group_split` is set to False, X is required to be" + " a dataframe." + ) + return True + + def check_ser( + qid: Optional[_DaskCollection], name: str + ) -> TypeGuard[Optional[dd.Series]]: + if not isinstance(qid, dd.Series) and qid is not None: + raise TypeError( + f"When `allow_group_split` is set to False, {name} is required to " + "be a series." + ) + return True + + if not self.allow_group_split: + assert ( + check_df(X) + and check_ser(qid, "qid") + and check_ser(y, "y") + and check_ser(sample_weight, "sample_weight") + and check_ser(base_margin, "base_margin") + ) + assert qid is not None and y is not None + X_id = id(X) + X, qid, y, sample_weight, base_margin = no_group_split( + self.device, + X, + qid, + y=y, + sample_weight=sample_weight, + base_margin=base_margin, + ) + + if eval_set is not None: + new_eval_set = [] + new_eval_qid = [] + new_sample_weight_eval_set = [] + new_base_margin_eval_set = [] + assert eval_qid + for i, (Xe, ye) in enumerate(eval_set): + we = sample_weight_eval_set[i] if sample_weight_eval_set else None + be = base_margin_eval_set[i] if base_margin_eval_set else None + assert check_df(Xe) + assert eval_qid + qe = eval_qid[i] + assert ( + eval_qid + and check_ser(qe, "qid") + and check_ser(ye, "y") + and check_ser(we, "sample_weight") + and check_ser(be, "base_margin") + ) + assert qe is not None and ye is not None + if id(Xe) != X_id: + Xe, qe, ye, we, be = no_group_split( + self.device, Xe, qe, ye, we, be + ) + else: + Xe, qe, ye, we, be = X, qid, y, sample_weight, base_margin + + new_eval_set.append((Xe, ye)) + new_eval_qid.append(qe) + + if we is not None: + new_sample_weight_eval_set.append(we) + if be is not None: + new_base_margin_eval_set.append(be) + + eval_set = new_eval_set + eval_qid = new_eval_qid + sample_weight_eval_set = ( + new_sample_weight_eval_set if new_sample_weight_eval_set else None + ) + base_margin_eval_set = ( + new_base_margin_eval_set if new_base_margin_eval_set else None + ) + + return self._client_sync( + self._fit_async, + X=X, + y=y, + qid=qid, + sample_weight=sample_weight, + base_margin=base_margin, + eval_set=eval_set, + eval_qid=eval_qid, + verbose=verbose, + xgb_model=xgb_model, + sample_weight_eval_set=sample_weight_eval_set, + base_margin_eval_set=base_margin_eval_set, + feature_weights=feature_weights, + ) + + # FIXME(trivialfis): arguments differ due to additional parameters like group and + # qid. + fit.__doc__ = XGBRanker.fit.__doc__ + + +@xgboost_model_doc( + """Implementation of the Scikit-Learn API for XGBoost Random Forest Regressor. + + .. versionadded:: 1.4.0 + +""", + ["model", "objective"], + extra_parameters=""" + n_estimators : int + Number of trees in random forest to fit. +""", +) +class DaskXGBRFRegressor(DaskXGBRegressor): + @_deprecate_positional_args + def __init__( + self, + *, + learning_rate: Optional[float] = 1, + subsample: Optional[float] = 0.8, + colsample_bynode: Optional[float] = 0.8, + reg_lambda: Optional[float] = 1e-5, + coll_cfg: Optional[CollConfig] = None, + **kwargs: Any, + ) -> None: + super().__init__( + learning_rate=learning_rate, + subsample=subsample, + colsample_bynode=colsample_bynode, + reg_lambda=reg_lambda, + coll_cfg=coll_cfg, + **kwargs, + ) + + def get_xgb_params(self) -> Dict[str, Any]: + params = super().get_xgb_params() + params["num_parallel_tree"] = self.n_estimators + return params + + def get_num_boosting_rounds(self) -> int: + return 1 + + # pylint: disable=unused-argument + def fit( + self, + X: _DataT, + y: _DaskCollection, + *, + sample_weight: Optional[_DaskCollection] = None, + base_margin: Optional[_DaskCollection] = None, + eval_set: Optional[Sequence[Tuple[_DaskCollection, _DaskCollection]]] = None, + verbose: Optional[Union[int, bool]] = True, + xgb_model: Optional[Union[Booster, str, XGBModel]] = None, + sample_weight_eval_set: Optional[Sequence[_DaskCollection]] = None, + base_margin_eval_set: Optional[Sequence[_DaskCollection]] = None, + feature_weights: Optional[_DaskCollection] = None, + ) -> "DaskXGBRFRegressor": + args = {k: v for k, v in locals().items() if k not in ("self", "__class__")} + _check_rf_callback(self.early_stopping_rounds, self.callbacks) + super().fit(**args) + return self + + +@xgboost_model_doc( + """Implementation of the Scikit-Learn API for XGBoost Random Forest Classifier. + + .. versionadded:: 1.4.0 + +""", + ["model", "objective"], + extra_parameters=""" + n_estimators : int + Number of trees in random forest to fit. +""", +) +class DaskXGBRFClassifier(DaskXGBClassifier): + @_deprecate_positional_args + def __init__( + self, + *, + learning_rate: Optional[float] = 1, + subsample: Optional[float] = 0.8, + colsample_bynode: Optional[float] = 0.8, + reg_lambda: Optional[float] = 1e-5, + coll_cfg: Optional[CollConfig] = None, + **kwargs: Any, + ) -> None: + super().__init__( + learning_rate=learning_rate, + subsample=subsample, + colsample_bynode=colsample_bynode, + reg_lambda=reg_lambda, + coll_cfg=coll_cfg, + **kwargs, + ) + + def get_xgb_params(self) -> Dict[str, Any]: + params = super().get_xgb_params() + params["num_parallel_tree"] = self.n_estimators + return params + + def get_num_boosting_rounds(self) -> int: + return 1 + + # pylint: disable=unused-argument + def fit( + self, + X: _DataT, + y: _DaskCollection, + *, + sample_weight: Optional[_DaskCollection] = None, + base_margin: Optional[_DaskCollection] = None, + eval_set: Optional[Sequence[Tuple[_DaskCollection, _DaskCollection]]] = None, + verbose: Optional[Union[int, bool]] = True, + xgb_model: Optional[Union[Booster, str, XGBModel]] = None, + sample_weight_eval_set: Optional[Sequence[_DaskCollection]] = None, + base_margin_eval_set: Optional[Sequence[_DaskCollection]] = None, + feature_weights: Optional[_DaskCollection] = None, + ) -> "DaskXGBRFClassifier": + args = {k: v for k, v in locals().items() if k not in ("self", "__class__")} + _check_rf_callback(self.early_stopping_rounds, self.callbacks) + super().fit(**args) + return self diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/xgboost/dask/data.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/xgboost/dask/data.py new file mode 100644 index 0000000000000000000000000000000000000000..a216b2ebe14f311c1088f731726c096d976c57f1 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/xgboost/dask/data.py @@ -0,0 +1,461 @@ +# pylint: disable=too-many-arguments +"""Copyright 2019-2025, XGBoost contributors""" + +import logging +from collections.abc import Sequence +from typing import ( + Any, + Callable, + Dict, + List, + Optional, + Tuple, + TypeVar, + Union, + cast, + overload, +) + +import dask +import distributed +import numpy as np +import pandas as pd +from dask import dataframe as dd + +from .. import collective as coll +from .._data_utils import Categories +from .._typing import FeatureNames, FeatureTypes +from ..compat import concat, import_cupy +from ..core import Booster, DataIter, DMatrix, QuantileDMatrix +from ..data import is_on_cuda +from ..sklearn import get_model_categories, pick_ref_categories +from ..training import _RefError + +LOGGER = logging.getLogger("[xgboost.dask]") + +_DataParts = List[Dict[str, Any]] + + +meta = [ + "label", + "weight", + "base_margin", + "qid", + "label_lower_bound", + "label_upper_bound", +] + + +class DaskPartitionIter(DataIter): # pylint: disable=R0902 + """A data iterator for the `DaskQuantileDMatrix`.""" + + def __init__( + self, + data: List[Any], + feature_names: Optional[FeatureNames] = None, + feature_types: Optional[Union[FeatureTypes, Categories]] = None, + feature_weights: Optional[Any] = None, + **kwargs: Optional[List[Any]], + ) -> None: + types = (Sequence, type(None)) + # Samples + self._data = data + for k in meta: + setattr(self, k, kwargs.get(k, None)) + assert isinstance(getattr(self, k), types) + + # Feature info + self._feature_names = feature_names + self._feature_types = feature_types + self._feature_weights = feature_weights + + assert isinstance(self._data, Sequence) + + self._iter = 0 # set iterator to 0 + super().__init__(release_data=True) + + def _get(self, attr: str) -> Optional[Any]: + if getattr(self, attr) is not None: + return getattr(self, attr)[self._iter] + return None + + def data(self) -> Any: + """Utility function for obtaining current batch of data.""" + return self._data[self._iter] + + def reset(self) -> None: + """Reset the iterator""" + self._iter = 0 + + def next(self, input_data: Callable) -> bool: + """Yield next batch of data""" + if self._iter == len(self._data): + # Return False when there's no more batch. + return False + + kwargs = {k: self._get(k) for k in meta} + input_data( + data=self.data(), + group=None, + feature_names=self._feature_names, + feature_types=self._feature_types, + feature_weights=self._feature_weights, + **kwargs, + ) + self._iter += 1 + return True + + +@overload +def _add_column(df: dd.DataFrame, col: dd.Series) -> Tuple[dd.DataFrame, str]: ... + + +@overload +def _add_column(df: dd.DataFrame, col: None) -> Tuple[dd.DataFrame, None]: ... + + +def _add_column( + df: dd.DataFrame, col: Optional[dd.Series] +) -> Tuple[dd.DataFrame, Optional[str]]: + if col is None: + return df, col + + trails = 0 + uid = f"{col.name}_{trails}" + while uid in df.columns: + trails += 1 + uid = f"{col.name}_{trails}" + + df = df.assign(**{uid: col}) + return df, uid + + +def no_group_split( # pylint: disable=too-many-positional-arguments + device: str | None, + df: dd.DataFrame, + qid: dd.Series, + y: dd.Series, + sample_weight: Optional[dd.Series], + base_margin: Optional[dd.Series], +) -> Tuple[ + dd.DataFrame, dd.Series, dd.Series, Optional[dd.Series], Optional[dd.Series] +]: + """A function to prevent query group from being scattered to different + workers. Please see the tutorial in the document for the implication for not having + partition boundary based on query groups. + + """ + + df, qid_uid = _add_column(df, qid) + df, y_uid = _add_column(df, y) + df, w_uid = _add_column(df, sample_weight) + df, bm_uid = _add_column(df, base_margin) + + # `tasks` shuffle is required as of rapids 24.12 + shuffle = "p2p" if device is None or device == "cpu" else "tasks" + with dask.config.set({"dataframe.shuffle.method": shuffle}): + df = df.persist() + # Encode the QID to make it dense. + df[qid_uid] = df[qid_uid].astype("category").cat.as_known().cat.codes + # The shuffle here is costly. + df = df.sort_values(by=qid_uid) + cnt = df.groupby(qid_uid)[qid_uid].count() + div = cnt.index.compute().values.tolist() + div = sorted(div) + div = tuple(div + [div[-1] + 1]) + + df = df.set_index( + qid_uid, + drop=False, + divisions=div, + ).persist() + + qid = df[qid_uid] + y = df[y_uid] + sample_weight, base_margin = ( + cast(dd.Series, df[uid]) if uid is not None else None for uid in (w_uid, bm_uid) + ) + + uids = [uid for uid in [qid_uid, y_uid, w_uid, bm_uid] if uid is not None] + df = df.drop(uids, axis=1).persist() + return df, qid, y, sample_weight, base_margin + + +def sort_data_by_qid(**kwargs: List[Any]) -> Dict[str, List[Any]]: + """Sort worker-local data by query ID for learning to rank tasks.""" + data_parts = kwargs.get("data") + assert data_parts is not None + n_parts = len(data_parts) + + if is_on_cuda(data_parts[0]): + from cudf import DataFrame + else: + from pandas import DataFrame + + def get_dict(i: int) -> Dict[str, list]: + """Return a dictionary containing all the meta info and all partitions.""" + + def _get(attr: Optional[List[Any]]) -> Optional[list]: + if attr is not None: + return attr[i] + return None + + data_opt = {name: _get(kwargs.get(name, None)) for name in meta} + # Filter out None values. + data = {k: v for k, v in data_opt.items() if v is not None} + return data + + def map_fn(i: int) -> pd.DataFrame: + data = get_dict(i) + return DataFrame(data) + + meta_parts = [map_fn(i) for i in range(n_parts)] + dfq = concat(meta_parts) + if dfq.qid.is_monotonic_increasing: + return kwargs + + LOGGER.warning( + "[r%d]: Sorting data with %d partitions for ranking. " + "This is a costly operation and will increase the memory usage significantly. " + "To avoid this warning, sort the data based on qid before passing it into " + "XGBoost. Alternatively, you can use set the `allow_group_split` to False.", + coll.get_rank(), + n_parts, + ) + # I tried to construct a new dask DF to perform the sort, but it's quite difficult + # to get the partition alignment right. Along with the still maturing shuffle + # implementation and GPU compatibility, a simple concat is used. + # + # In case it might become useful one day, I managed to get a CPU version working, + # albeit qutie slow (much slower than concatenated sort). The implementation merges + # everything into a single Dask DF and runs `DF.sort_values`, then retrieve the + # individual X,y,qid, ... from calculated partition values `client.compute([p for p + # in df.partitions])`. It was to avoid creating mismatched partitions. + dfx = concat(data_parts) + + if is_on_cuda(dfq): + cp = import_cupy() + sorted_idx = cp.argsort(dfq.qid) + else: + sorted_idx = np.argsort(dfq.qid) + dfq = dfq.iloc[sorted_idx, :] + + if hasattr(dfx, "iloc"): + dfx = dfx.iloc[sorted_idx, :] + else: + dfx = dfx[sorted_idx, :] + + kwargs.update({"data": [dfx]}) + for i, c in enumerate(dfq.columns): + assert c in kwargs + kwargs.update({c: [dfq[c]]}) + + return kwargs + + +def _get_worker_parts(list_of_parts: _DataParts) -> Dict[str, List[Any]]: + """Convert list of dictionaries into a dictionary of lists.""" + assert isinstance(list_of_parts, list) + result: Dict[str, List[Any]] = {} + + def append(i: int, name: str) -> None: + if name in list_of_parts[i]: + part = list_of_parts[i][name] + else: + part = None + if part is not None: + if name not in result: + result[name] = [] + result[name].append(part) + + for i, _ in enumerate(list_of_parts): + append(i, "data") + for k in meta: + append(i, k) + + qid = result.get("qid", None) + if qid is not None: + result = sort_data_by_qid(**result) + return result + + +def _extract_data( + parts: _DataParts, + model: Optional[Booster], + feature_types: Optional[FeatureTypes], + xy_cats: Optional[Categories], +) -> Tuple[Dict[str, List[Any]], Optional[Union[FeatureTypes, Categories]]]: + unzipped_dict = _get_worker_parts(parts) + X = unzipped_dict["data"][0] + _, model_cats = get_model_categories(X, model, feature_types) + model_cats = pick_ref_categories(X, model_cats, xy_cats) + return unzipped_dict, model_cats + + +def _get_is_cuda(parts: Optional[_DataParts]) -> bool: + if parts is not None: + is_cuda = is_on_cuda(parts[0].get("data")) + else: + is_cuda = False + + is_cuda = bool(coll.allreduce(np.array([is_cuda], dtype=np.int32), coll.Op.MAX)[0]) + return is_cuda + + +def _make_empty(is_cuda: bool) -> np.ndarray: + if is_cuda: + cp = import_cupy() + empty = cp.empty((0, 0)) + else: + empty = np.empty((0, 0)) + return empty + + +def _warn_empty() -> None: + worker = distributed.get_worker() + LOGGER.warning("Worker %s has an empty DMatrix.", worker.address) + + +def _create_quantile_dmatrix( + *, + feature_names: Optional[FeatureNames], + feature_types: Optional[FeatureTypes], + feature_weights: Optional[Any], + missing: float, + nthread: int, + parts: Optional[_DataParts], + max_bin: int, + enable_categorical: bool, + max_quantile_batches: Optional[int], + ref: Optional[DMatrix] = None, + model: Optional[Booster], + Xy_cats: Optional[Categories], +) -> QuantileDMatrix: + is_cuda = _get_is_cuda(parts) + if parts is None: + _warn_empty() + return QuantileDMatrix( + _make_empty(is_cuda), + feature_names=feature_names, + feature_types=feature_types, + max_bin=max_bin, + ref=ref, + enable_categorical=enable_categorical, + max_quantile_batches=max_quantile_batches, + ) + + unzipped_dict, model_cats = _extract_data(parts, model, feature_types, Xy_cats) + + return QuantileDMatrix( + DaskPartitionIter( + **unzipped_dict, + feature_types=model_cats, + feature_names=feature_names, + feature_weights=feature_weights, + ), + missing=missing, + nthread=nthread, + max_bin=max_bin, + ref=ref, + enable_categorical=enable_categorical, + max_quantile_batches=max_quantile_batches, + ) + + +def _create_dmatrix( # pylint: disable=too-many-locals + *, + feature_names: Optional[FeatureNames], + feature_types: Optional[FeatureTypes], + feature_weights: Optional[Any], + missing: float, + nthread: int, + enable_categorical: bool, + parts: Optional[_DataParts], + model: Optional[Booster], + Xy_cats: Optional[Categories], +) -> DMatrix: + """Get data that local to worker from DaskDMatrix. + + Returns + ------- + A DMatrix object. + + """ + is_cuda = _get_is_cuda(parts) + if parts is None: + _warn_empty() + return DMatrix( + _make_empty(is_cuda), + feature_names=feature_names, + feature_types=feature_types, + enable_categorical=enable_categorical, + ) + + T = TypeVar("T") + + def concat_or_none(data: Sequence[Optional[T]]) -> Optional[T]: + if any(part is None for part in data): + return None + return concat(data) + + unzipped_dict, model_cats = _extract_data(parts, model, feature_types, Xy_cats) + + concated_dict: Dict[str, Any] = {} + for key, value in unzipped_dict.items(): + v = concat_or_none(value) + concated_dict[key] = v + + return DMatrix( + **concated_dict, + missing=missing, + feature_names=feature_names, + feature_types=model_cats, + nthread=nthread, + enable_categorical=enable_categorical, + feature_weights=feature_weights, + ) + + +def _dmatrix_from_list_of_parts(is_quantile: bool, **kwargs: Any) -> DMatrix: + if is_quantile: + return _create_quantile_dmatrix(**kwargs) + return _create_dmatrix(**kwargs) + + +def _get_dmatrices( + train_ref: dict, + train_id: int, + *refs: dict, + evals_id: Sequence[int], + evals_name: Sequence[str], + n_threads: int, + model: Optional[Booster], +) -> Tuple[DMatrix, List[Tuple[DMatrix, str]]]: + # Create the training DMatrix + Xy = _dmatrix_from_list_of_parts( + **train_ref, nthread=n_threads, model=model, Xy_cats=None + ) + + # Create evaluation DMatrices + evals: List[Tuple[DMatrix, str]] = [] + Xy_cats = Xy.get_categories() + + for i, ref in enumerate(refs): + # Same DMatrix as the training + if evals_id[i] == train_id: + evals.append((Xy, evals_name[i])) + continue + # Check whether the training DMatrix has been used as a reference. + if ref.get("ref", None) is not None: + if ref["ref"] != train_id: + raise ValueError(_RefError) + del ref["ref"] # Avoid duplicated parameter in the next fn call. + eval_xy = _dmatrix_from_list_of_parts( + **ref, nthread=n_threads, ref=Xy, Xy_cats=Xy_cats, model=model + ) + else: + eval_xy = _dmatrix_from_list_of_parts( + **ref, nthread=n_threads, Xy_cats=Xy_cats, model=model + ) + evals.append((eval_xy, evals_name[i])) + return Xy, evals diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/xgboost/dask/utils.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/xgboost/dask/utils.py new file mode 100644 index 0000000000000000000000000000000000000000..e9a004f6e8d1bab2dfda56b27d3cc2b335ad7f70 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/xgboost/dask/utils.py @@ -0,0 +1,118 @@ +"""Utilities for the XGBoost Dask interface.""" + +import logging +import warnings +from functools import cache as fcache +from typing import Any, Dict, Optional, Tuple + +import dask +import distributed +from packaging.version import Version +from packaging.version import parse as parse_version + +from ..collective import Config + +LOGGER = logging.getLogger("[xgboost.dask]") + + +def get_n_threads(local_param: Dict[str, Any], worker: "distributed.Worker") -> int: + """Get the number of threads from a worker and the user-supplied parameters.""" + # dask worker nthreads, "state" is available in 2022.6.1 + dwnt = worker.state.nthreads if hasattr(worker, "state") else worker.nthreads + n_threads = None + for p in ["nthread", "n_jobs"]: + if local_param.get(p, None) is not None and local_param.get(p, dwnt) != dwnt: + LOGGER.info("Overriding `nthreads` defined in dask worker.") + n_threads = local_param[p] + break + if n_threads == 0 or n_threads is None: + n_threads = dwnt + return n_threads + + +def get_address_from_user( + dconfig: Optional[Dict[str, Any]], coll_cfg: Config +) -> Tuple[Optional[str], int]: + """Get the tracker address from the optional user configuration. + + Parameters + ---------- + dconfig : + Dask global configuration. + + coll_cfg : + Collective configuration. + + Returns + ------- + The IP address along with the port number. + + """ + + valid_config = ["scheduler_address"] + + host_ip = None + port = 0 + + if dconfig is not None: + for k in dconfig: + if k not in valid_config: + raise ValueError(f"Unknown configuration: {k}") + warnings.warn( + ( + "Use `coll_cfg` instead of the Dask global configuration store" + f" for the XGBoost tracker configuration: {k}." + ), + FutureWarning, + ) + else: + dconfig = {} + + host_ip = dconfig.get("scheduler_address", None) + if host_ip is not None and host_ip.startswith("[") and host_ip.endswith("]"): + # convert dask bracket format to proper IPv6 address. + host_ip = host_ip[1:-1] + if host_ip is not None: + try: + host_ip, port = distributed.comm.get_address_host_port(host_ip) + except ValueError: + pass + + if coll_cfg is None: + coll_cfg = Config() + if coll_cfg.tracker_host_ip is not None: + if host_ip is not None and coll_cfg.tracker_host_ip != host_ip: + raise ValueError( + "Conflicting host IP addresses from the dask configuration and the " + f"collective configuration: {host_ip} v.s. {coll_cfg.tracker_host_ip}." + ) + host_ip = coll_cfg.tracker_host_ip + if coll_cfg.tracker_port is not None: + if ( + port != 0 + and port is not None + and coll_cfg.tracker_port != 0 + and port != coll_cfg.tracker_port + ): + raise ValueError( + "Conflicting ports from the dask configuration and the " + f"collective configuration: {port} v.s. {coll_cfg.tracker_port}." + ) + port = coll_cfg.tracker_port + + return host_ip, port + + +@fcache +def _DASK_VERSION() -> Version: + return parse_version(dask.__version__) + + +@fcache +def _DASK_2024_12_1() -> bool: + return _DASK_VERSION() >= parse_version("2024.12.1") + + +@fcache +def _DASK_2025_3_0() -> bool: + return _DASK_VERSION() >= parse_version("2025.3.0") diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/xgboost/data.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/xgboost/data.py new file mode 100644 index 0000000000000000000000000000000000000000..3bfcce91f7af071c2816ddb6e6945354bf5b00b2 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/xgboost/data.py @@ -0,0 +1,1752 @@ +# pylint: disable=too-many-arguments, too-many-branches, too-many-lines +# pylint: disable=too-many-return-statements +"""Data dispatching for DMatrix.""" + +import ctypes +import functools +import json +import os +import warnings +from typing import ( + TYPE_CHECKING, + Any, + Callable, + Dict, + List, + Optional, + Sequence, + Tuple, + TypeAlias, + TypeGuard, + Union, +) + +import numpy as np + +from ._data_utils import ( + AifType, + Categories, + DfCatAccessor, + TransformedDf, + _arrow_array_inf, + _ensure_np_dtype, + _is_df_cat, + array_hasobject, + array_interface, + array_interface_dict, + arrow_cat_inf, + check_cudf_meta, + cuda_array_interface, + cuda_array_interface_dict, + cudf_cat_inf, + get_ref_categories, + is_arrow_dict, + pd_cat_inf, +) +from ._typing import ( + CupyT, + DataType, + FeatureNames, + FeatureTypes, + FloatCompatible, + NumpyDType, + PandasDType, + PathLike, + TransformedData, + c_bst_ulong, +) +from .compat import ( + _is_arrow, + _is_cudf_df, + _is_cudf_pandas, + _is_cudf_ser, + _is_cupy_alike, + _is_modin_df, + _is_modin_series, + _is_pandas_df, + _is_pandas_series, + _is_polars, + _is_polars_lazyframe, + _is_polars_series, + import_pandas, + import_polars, + import_pyarrow, + is_pyarrow_available, + lazy_isinstance, +) +from .core import ( + _LIB, + DataIter, + DataSplitMode, + DMatrix, + _check_call, + _ProxyDMatrix, + c_str, + make_jcargs, +) + +if TYPE_CHECKING: + import pyarrow as pa + from pandas import DataFrame as PdDataFrame + from pandas import Series as PdSeries + + +DispatchedDataBackendReturnType: TypeAlias = Tuple[ + ctypes.c_void_p, Optional[FeatureNames], Optional[FeatureTypes] +] + +CAT_T = "c" + +# meta info that can be a matrix instead of vector. +_matrix_meta = {"base_margin", "label"} + + +def _warn_unused_missing(data: DataType, missing: Optional[FloatCompatible]) -> None: + if (missing is not None) and (not np.isnan(missing)): + warnings.warn( + "`missing` is not used for current input data type:" + str(type(data)), + UserWarning, + ) + + +def _check_data_shape(data: DataType) -> None: + if hasattr(data, "shape") and len(data.shape) != 2: + raise ValueError("Please reshape the input data into 2-dimensional matrix.") + + +def is_scipy_csr(data: DataType) -> bool: + """Predicate for scipy CSR input.""" + is_array = False + is_matrix = False + try: + from scipy.sparse import csr_array + + is_array = isinstance(data, csr_array) + except ImportError: + pass + try: + from scipy.sparse import csr_matrix + + is_matrix = isinstance(data, csr_matrix) + except ImportError: + pass + return is_array or is_matrix + + +def transform_scipy_sparse(data: DataType, is_csr: bool) -> DataType: + """Ensure correct data alignment and data type for scipy sparse inputs. Input should + be either csr or csc matrix. + + """ + from scipy.sparse import csc_matrix, csr_matrix + + if len(data.indices) != len(data.data): + raise ValueError(f"length mismatch: {len(data.indices)} vs {len(data.data)}") + + indptr, _ = _ensure_np_dtype(data.indptr, data.indptr.dtype) + indices, _ = _ensure_np_dtype(data.indices, data.indices.dtype) + values, _ = _ensure_np_dtype(data.data, data.data.dtype) + if ( + indptr is not data.indptr + or indices is not data.indices + or values is not data.data + ): + if is_csr: + data = csr_matrix((values, indices, indptr), shape=data.shape) + else: + data = csc_matrix((values, indices, indptr), shape=data.shape) + return data + + +def _from_scipy_csr( + *, + data: DataType, + missing: FloatCompatible, + nthread: int, + feature_names: Optional[FeatureNames], + feature_types: Optional[FeatureTypes], + data_split_mode: DataSplitMode = DataSplitMode.ROW, +) -> DispatchedDataBackendReturnType: + """Initialize data from a CSR matrix.""" + + handle = ctypes.c_void_p() + data = transform_scipy_sparse(data, True) + _check_call( + _LIB.XGDMatrixCreateFromCSR( + array_interface(data.indptr), + array_interface(data.indices), + array_interface(data.data), + c_bst_ulong(data.shape[1]), + make_jcargs( + missing=float(missing), + nthread=int(nthread), + data_split_mode=int(data_split_mode), + ), + ctypes.byref(handle), + ) + ) + return handle, feature_names, feature_types + + +def is_scipy_csc(data: DataType) -> bool: + """Predicate for scipy CSC input.""" + is_array = False + is_matrix = False + try: + from scipy.sparse import csc_array + + is_array = isinstance(data, csc_array) + except ImportError: + pass + try: + from scipy.sparse import csc_matrix + + is_matrix = isinstance(data, csc_matrix) + except ImportError: + pass + return is_array or is_matrix + + +def _from_scipy_csc( + *, + data: DataType, + missing: FloatCompatible, + nthread: int, + feature_names: Optional[FeatureNames], + feature_types: Optional[FeatureTypes], + data_split_mode: DataSplitMode = DataSplitMode.ROW, +) -> DispatchedDataBackendReturnType: + """Initialize data from a CSC matrix.""" + handle = ctypes.c_void_p() + transform_scipy_sparse(data, False) + _check_call( + _LIB.XGDMatrixCreateFromCSC( + array_interface(data.indptr), + array_interface(data.indices), + array_interface(data.data), + c_bst_ulong(data.shape[0]), + make_jcargs( + missing=float(missing), + nthread=int(nthread), + data_split_mode=int(data_split_mode), + ), + ctypes.byref(handle), + ) + ) + return handle, feature_names, feature_types + + +def is_scipy_coo(data: DataType) -> bool: + """Predicate for scipy COO input.""" + is_array = False + is_matrix = False + try: + from scipy.sparse import coo_array + + is_array = isinstance(data, coo_array) + except ImportError: + pass + try: + from scipy.sparse import coo_matrix + + is_matrix = isinstance(data, coo_matrix) + except ImportError: + pass + return is_array or is_matrix + + +def _is_np_array_like(data: DataType) -> TypeGuard[np.ndarray]: + return hasattr(data, "__array_interface__") + + +def _maybe_np_slice(data: DataType, dtype: Optional[NumpyDType]) -> np.ndarray: + """Handle numpy slice. This can be removed if we use __array_interface__.""" + try: + if not data.flags.c_contiguous: + data = np.array(data, copy=True, dtype=dtype) + else: + data = np.asarray(data, dtype=dtype) + except AttributeError: + data = np.asarray(data, dtype=dtype) + data, dtype = _ensure_np_dtype(data, dtype) + return data + + +def _from_numpy_array( + *, + data: np.ndarray, + missing: FloatCompatible, + nthread: int, + feature_names: Optional[FeatureNames], + feature_types: Optional[FeatureTypes], + data_split_mode: DataSplitMode = DataSplitMode.ROW, +) -> DispatchedDataBackendReturnType: + """Initialize data from a 2-D numpy matrix.""" + _check_data_shape(data) + data, _ = _ensure_np_dtype(data, data.dtype) + handle = ctypes.c_void_p() + _check_call( + _LIB.XGDMatrixCreateFromDense( + array_interface(data), + make_jcargs( + missing=float(missing), + nthread=int(nthread), + data_split_mode=int(data_split_mode), + ), + ctypes.byref(handle), + ) + ) + return handle, feature_names, feature_types + + +_pandas_dtype_mapper = { + "int8": "int", + "int16": "int", + "int32": "int", + "int64": "int", + "uint8": "int", + "uint16": "int", + "uint32": "int", + "uint64": "int", + "float16": "float", + "float32": "float", + "float64": "float", + "bool": "i", +} + +# nullable types +pandas_nullable_mapper = { + "Int8": "int", + "Int16": "int", + "Int32": "int", + "Int64": "int", + "UInt8": "int", + "UInt16": "int", + "UInt32": "int", + "UInt64": "int", + "Float32": "float", + "Float64": "float", + "boolean": "i", +} + +pandas_pyarrow_mapper = { + "int8[pyarrow]": "int", + "int16[pyarrow]": "int", + "int32[pyarrow]": "int", + "int64[pyarrow]": "int", + "uint8[pyarrow]": "int", + "uint16[pyarrow]": "int", + "uint32[pyarrow]": "int", + "uint64[pyarrow]": "int", + "float[pyarrow]": "float", + "float32[pyarrow]": "float", + "double[pyarrow]": "float", + "float64[pyarrow]": "float", + "bool[pyarrow]": "i", +} + +_pandas_dtype_mapper.update(pandas_nullable_mapper) +_pandas_dtype_mapper.update(pandas_pyarrow_mapper) + + +_ENABLE_CAT_ERR = ( + "When categorical type is supplied, the experimental DMatrix parameter" + "`enable_categorical` must be set to `True`." +) + + +def _invalid_dataframe_dtype(data: DataType) -> None: + # pandas series has `dtypes` but it's just a single object + # cudf series doesn't have `dtypes`. + if hasattr(data, "dtypes") and hasattr(data.dtypes, "__iter__"): + bad_fields = [ + f"{data.columns[i]}: {dtype}" + for i, dtype in enumerate(data.dtypes) + if dtype.name not in _pandas_dtype_mapper + ] + err = " Invalid columns:" + ", ".join(bad_fields) + else: + err = "" + + type_err = "DataFrame.dtypes for data must be int, float, bool or category." + msg = f"""{type_err} {_ENABLE_CAT_ERR} {err}""" + raise ValueError(msg) + + +def pandas_feature_info( + data: "PdDataFrame", + meta: Optional[str], + feature_names: Optional[FeatureNames], + feature_types: Optional[FeatureTypes], + enable_categorical: bool, +) -> Tuple[Optional[FeatureNames], Optional[FeatureTypes]]: + """Handle feature info for pandas dataframe.""" + pd = import_pandas() + + # handle feature names + if feature_names is None and meta is None: + if isinstance(data.columns, pd.MultiIndex): + feature_names = [" ".join([str(x) for x in i]) for i in data.columns] + else: + feature_names = list(data.columns.map(str)) + + # handle feature types and dtype validation + new_feature_types = [] + need_sparse_extension_warn = True + for dtype in data.dtypes: + if is_pd_sparse_dtype(dtype): + new_feature_types.append(_pandas_dtype_mapper[dtype.subtype.name]) + if need_sparse_extension_warn: + warnings.warn("Sparse arrays from pandas are converted into dense.") + need_sparse_extension_warn = False + elif ( + is_pd_cat_dtype(dtype) or is_pa_ext_categorical_dtype(dtype) + ) and enable_categorical: + new_feature_types.append(CAT_T) + else: + try: + new_feature_types.append(_pandas_dtype_mapper[dtype.name]) + except KeyError: + _invalid_dataframe_dtype(data) + + if feature_types is None and meta is None: + feature_types = new_feature_types + + return feature_names, feature_types + + +def is_nullable_dtype(dtype: PandasDType) -> bool: + """Whether dtype is a pandas nullable type.""" + + from pandas.api.extensions import ExtensionDtype + + if not isinstance(dtype, ExtensionDtype): + return False + + from pandas.api.types import is_bool_dtype, is_float_dtype, is_integer_dtype + + is_int = is_integer_dtype(dtype) and dtype.name in pandas_nullable_mapper + # np.bool has alias `bool`, while pd.BooleanDtype has `boolean`. + is_bool = is_bool_dtype(dtype) and dtype.name == "boolean" + is_float = is_float_dtype(dtype) and dtype.name in pandas_nullable_mapper + return is_int or is_bool or is_float or is_pd_cat_dtype(dtype) + + +def is_pa_ext_dtype(dtype: Any) -> bool: + """Return whether dtype is a pyarrow extension type for pandas""" + return hasattr(dtype, "pyarrow_dtype") + + +def is_pa_ext_categorical_dtype(dtype: Any) -> bool: + """Check whether dtype is a dictionary type.""" + return lazy_isinstance( + getattr(dtype, "pyarrow_dtype", None), "pyarrow.lib", "DictionaryType" + ) + + +@functools.cache +def _lazy_load_pd_is_cat() -> Callable[[PandasDType], bool]: + pd = import_pandas() + + if hasattr(pd.util, "version") and hasattr(pd.util.version, "Version"): + Version = pd.util.version.Version + if Version(pd.__version__) >= Version("2.1.0"): + from pandas import CategoricalDtype + + def pd_is_cat_210(dtype: PandasDType) -> bool: + return isinstance(dtype, CategoricalDtype) + + return pd_is_cat_210 + from pandas.api.types import is_categorical_dtype # type: ignore + + return is_categorical_dtype + + +def is_pd_cat_dtype(dtype: PandasDType) -> bool: + """Wrapper for testing pandas category type.""" + is_cat = _lazy_load_pd_is_cat() + return is_cat(dtype) + + +@functools.cache +def _lazy_load_pd_is_sparse() -> Callable[[PandasDType], bool]: + pd = import_pandas() + + if hasattr(pd.util, "version") and hasattr(pd.util.version, "Version"): + Version = pd.util.version.Version + if Version(pd.__version__) >= Version("2.1.0"): + from pandas import SparseDtype + + def pd_is_sparse_210(dtype: PandasDType) -> bool: + return isinstance(dtype, SparseDtype) + + return pd_is_sparse_210 + + from pandas.api.types import is_sparse # type: ignore + + return is_sparse + + +def is_pd_sparse_dtype(dtype: PandasDType) -> bool: + """Wrapper for testing pandas sparse type.""" + is_sparse = _lazy_load_pd_is_sparse() + + return is_sparse(dtype) + + +def pandas_pa_type(ser: Any) -> np.ndarray: + """Handle pandas pyarrow extention.""" + pd = import_pandas() + + if TYPE_CHECKING: + import pyarrow as pa + else: + pa = import_pyarrow() + + # No copy, callstack: + # pandas.core.internals.managers.SingleBlockManager.array_values() + # pandas.core.internals.blocks.EABackedBlock.values + d_array: pd.arrays.ArrowExtensionArray = ser.array # type: ignore + # no copy in __arrow_array__ + # ArrowExtensionArray._data is a chunked array + aa: "pa.ChunkedArray" = d_array.__arrow_array__() + # combine_chunks takes the most significant amount of time + chunk: "pa.Array" = aa.combine_chunks() + # When there's null value, we have to use copy + zero_copy = chunk.null_count == 0 and not pa.types.is_boolean(chunk.type) + # Alternately, we can use chunk.buffers(), which returns a list of buffers and + # we need to concatenate them ourselves. + # FIXME(jiamingy): Is there a better way to access the arrow buffer along with + # its mask? + # Buffers from chunk.buffers() have the address attribute, but don't expose the + # mask. + arr: np.ndarray = chunk.to_numpy(zero_copy_only=zero_copy, writable=False) + arr, _ = _ensure_np_dtype(arr, arr.dtype) + return arr + + +@functools.cache +def _lazy_has_npdtypes() -> bool: + return np.lib.NumpyVersion(np.__version__) > np.lib.NumpyVersion("1.25.0") + + +@functools.cache +def _lazy_load_pd_floats() -> tuple: + from pandas import Float32Dtype, Float64Dtype + + return Float32Dtype, Float64Dtype + + +def pandas_transform_data( + data: "PdDataFrame", +) -> List[Union[np.ndarray, DfCatAccessor]]: + """Handle categorical dtype and extension types from pandas.""" + Float32Dtype, Float64Dtype = _lazy_load_pd_floats() + + result: List[Union[np.ndarray, DfCatAccessor]] = [] + np_dtypes = _lazy_has_npdtypes() + + def cat_codes(ser: "PdSeries") -> DfCatAccessor: + return ser.cat + + def nu_type(ser: "PdSeries") -> np.ndarray: + # Avoid conversion when possible + if isinstance(dtype, Float32Dtype): + res_dtype: NumpyDType = np.float32 + elif isinstance(dtype, Float64Dtype): + res_dtype = np.float64 + else: + res_dtype = np.float32 + return _ensure_np_dtype( + ser.to_numpy(dtype=res_dtype, na_value=np.nan), res_dtype + )[0] + + def oth_type(ser: "PdSeries") -> np.ndarray: + # The dtypes module is added in 1.25. + npdtypes = np_dtypes and isinstance( + ser.dtype, + ( + # pylint: disable=no-member + np.dtypes.Float32DType, # type: ignore + # pylint: disable=no-member + np.dtypes.Float64DType, # type: ignore + ), + ) + + if npdtypes or dtype in {np.float32, np.float64}: + array = ser.to_numpy() + else: + # Specifying the dtype can significantly slow down the conversion (about + # 15% slow down for dense inplace-predict) + array = ser.to_numpy(dtype=np.float32, na_value=np.nan) + return _ensure_np_dtype(array, array.dtype)[0] + + for col, dtype in zip(data.columns, data.dtypes): + if is_pa_ext_categorical_dtype(dtype): + raise ValueError( + "pyarrow dictionary type is not supported. Use pandas category instead." + ) + if is_pd_cat_dtype(dtype): + result.append(cat_codes(data[col])) + elif is_pa_ext_dtype(dtype): + result.append(pandas_pa_type(data[col])) + elif is_nullable_dtype(dtype): + result.append(nu_type(data[col])) + elif is_pd_sparse_dtype(dtype): + arr = data[col].values + arr = arr.to_dense() + if _is_np_array_like(arr): + arr, _ = _ensure_np_dtype(arr, arr.dtype) + result.append(arr) + else: + result.append(oth_type(data[col])) + + # FIXME(jiamingy): Investigate the possibility of using dataframe protocol or arrow + # IPC format for pandas so that we can apply the data transformation inside XGBoost + # for better memory efficiency. + return result + + +class PandasTransformed(TransformedDf): + """A storage class for transformed pandas DataFrame.""" + + def __init__( + self, + columns: List[Union[np.ndarray, DfCatAccessor]], + ref_categories: Optional[Categories], + ) -> None: + self.columns = columns + + aitfs: AifType = [] + temporary_buffers = [] + + # Get the array interface representation for each column. + for col in self.columns: + if _is_df_cat(col): + # Categorical column + jnames, jcodes, buf = pd_cat_inf(col.categories, col.codes) + temporary_buffers.append(buf) + aitfs.append((jnames, jcodes)) + else: + assert isinstance(col, np.ndarray) + inf = array_interface_dict(col) + # Numeric column + aitfs.append(inf) + + super().__init__( + ref_categories=ref_categories, + aitfs=aitfs, + temporary_buffers=temporary_buffers, + ) + + @property + def shape(self) -> Tuple[int, int]: + """Return shape of the transformed DataFrame.""" + if is_arrow_dict(self.columns[0]): + # When input is arrow. + n_samples = len(self.columns[0].indices) + elif _is_df_cat(self.columns[0]): + # When input is pandas. + n_samples = self.columns[0].codes.shape[0] + else: + # Anything else, TypeGuard is ignored by mypy 1.15.0 for some reason + n_samples = self.columns[0].shape[0] # type: ignore + return n_samples, len(self.columns) + + +def _transform_pandas_df( + data: "PdDataFrame", + enable_categorical: bool, + feature_names: Optional[FeatureNames] = None, + feature_types: Optional[Union[FeatureTypes, Categories]] = None, + meta: Optional[str] = None, +) -> Tuple[PandasTransformed, Optional[FeatureNames], Optional[FeatureTypes]]: + if meta and len(data.columns) > 1 and meta not in _matrix_meta: + raise ValueError(f"DataFrame for {meta} cannot have multiple columns") + + feature_types, ref_categories = get_ref_categories(feature_types) + feature_names, feature_types = pandas_feature_info( + data, meta, feature_names, feature_types, enable_categorical + ) + + arrays = pandas_transform_data(data) + return ( + PandasTransformed(arrays, ref_categories=ref_categories), + feature_names, + feature_types, + ) + + +def _meta_from_pandas_df( + data: DataType, + name: str, + dtype: Optional[NumpyDType], + handle: ctypes.c_void_p, +) -> None: + data, _, _ = _transform_pandas_df(data, False, meta=name) + if len(data.columns) == 1: + array = data.columns[0] + else: + array = np.stack(data.columns).T + + array, dtype = _ensure_np_dtype(array, dtype) + _meta_from_numpy(array, name, dtype, handle) + + +def _from_pandas_df( + *, + data: "PdDataFrame", + enable_categorical: bool, + missing: FloatCompatible, + nthread: int, + feature_names: Optional[FeatureNames], + feature_types: Optional[Union[FeatureTypes, Categories]], + data_split_mode: DataSplitMode = DataSplitMode.ROW, +) -> DispatchedDataBackendReturnType: + df, feature_names, feature_types = _transform_pandas_df( + data, enable_categorical, feature_names, feature_types + ) + + handle = ctypes.c_void_p() + _check_call( + _LIB.XGDMatrixCreateFromColumnar( + df.array_interface(), + make_jcargs( + nthread=nthread, missing=missing, data_split_mode=data_split_mode + ), + ctypes.byref(handle), + ) + ) + return handle, feature_names, feature_types + + +def _meta_from_pandas_series( + data: DataType, name: str, dtype: Optional[NumpyDType], handle: ctypes.c_void_p +) -> None: + """Help transform pandas series for meta data like labels""" + if is_pd_sparse_dtype(data.dtype): + data = data.values.to_dense().astype(np.float32) + elif is_pa_ext_dtype(data.dtype): + data = pandas_pa_type(data) + else: + data = data.to_numpy(np.float32, na_value=np.nan) + + if is_pd_sparse_dtype(getattr(data, "dtype", data)): + data = data.to_dense() # type: ignore + assert len(data.shape) == 1 or data.shape[1] == 0 or data.shape[1] == 1 + _meta_from_numpy(data, name, dtype, handle) + + +def _from_pandas_series( + *, + data: DataType, + missing: FloatCompatible, + nthread: int, + enable_categorical: bool, + feature_names: Optional[FeatureNames], + feature_types: Optional[FeatureTypes], +) -> DispatchedDataBackendReturnType: + if (data.dtype.name not in _pandas_dtype_mapper) and not ( + is_pd_cat_dtype(data.dtype) and enable_categorical + ): + _invalid_dataframe_dtype(data) + if enable_categorical and is_pd_cat_dtype(data.dtype): + data = data.cat.codes + return _from_numpy_array( + data=data.values.reshape(data.shape[0], 1).astype("float"), + missing=missing, + nthread=nthread, + feature_names=feature_names, + feature_types=feature_types, + ) + + +class ArrowTransformed(TransformedDf): + """A storage class for transformed arrow table.""" + + def __init__( + self, + columns: List[Union["pa.NumericArray", "pa.DictionaryArray"]], + ref_categories: Optional[Categories] = None, + ) -> None: + self.columns = columns + + if TYPE_CHECKING: + import pyarrow as pa + else: + pa = import_pyarrow() + + aitfs: AifType = [] + temporary_buffers = [] + + def push_series(col: Union["pa.NumericArray", "pa.DictionaryArray"]) -> None: + if isinstance(col, pa.DictionaryArray): + cats = col.dictionary + codes = col.indices + if not isinstance(cats, (pa.StringArray, pa.LargeStringArray)): + raise TypeError( + "Only string-based categorical index is supported for arrow." + ) + jnames, jcodes, buf = arrow_cat_inf(cats, codes) + temporary_buffers.append(buf) + aitfs.append((jnames, jcodes)) + else: + jdata = _arrow_array_inf(col) + aitfs.append(jdata) + + for col in self.columns: + push_series(col) + + super().__init__( + ref_categories=ref_categories, + aitfs=aitfs, + temporary_buffers=temporary_buffers, + ) + + @property + def shape(self) -> Tuple[int, int]: + """Return shape of the transformed DataFrame.""" + return len(self.columns[0]), len(self.columns) + + +def _transform_arrow_table( + data: "pa.Table", + enable_categorical: bool, + feature_names: Optional[FeatureNames], + feature_types: Optional[Union[FeatureTypes, Categories]], +) -> Tuple[ArrowTransformed, Optional[FeatureNames], Optional[FeatureTypes]]: + if TYPE_CHECKING: + import pyarrow as pa + else: + pa = import_pyarrow() + + t_names, t_types = _arrow_feature_info(data) + feature_types, ref_categories = get_ref_categories(feature_types) + + if feature_names is None: + feature_names = t_names + if feature_types is None: + feature_types = t_types + + columns = [] + for cname in feature_names: + col0 = data.column(cname) + col: Union["pa.NumericArray", "pa.DictionaryArray"] = col0.combine_chunks() + if isinstance(col, pa.BooleanArray): + col = col.cast(pa.int8()) # bit-compressed array, not supported. + if is_arrow_dict(col) and not enable_categorical: + # None because the function doesn't know how to get the type info from arrow + # table. + _invalid_dataframe_dtype(None) + columns.append(col) + + df_t = ArrowTransformed(columns, ref_categories=ref_categories) + return df_t, feature_names, feature_types + + +def _from_arrow_table( # pylint: disable=too-many-positional-arguments + data: DataType, + enable_categorical: bool, + missing: FloatCompatible, + n_threads: int, + feature_names: Optional[FeatureNames], + feature_types: Optional[Union[FeatureTypes, Categories]], + data_split_mode: DataSplitMode = DataSplitMode.ROW, +) -> DispatchedDataBackendReturnType: + df_t, feature_names, feature_types = _transform_arrow_table( + data, enable_categorical, feature_names, feature_types + ) + handle = ctypes.c_void_p() + _check_call( + _LIB.XGDMatrixCreateFromColumnar( + df_t.array_interface(), + make_jcargs( + nthread=n_threads, missing=missing, data_split_mode=data_split_mode + ), + ctypes.byref(handle), + ) + ) + return handle, feature_names, feature_types + + +@functools.cache +def _arrow_dtype() -> Dict[DataType, str]: + import pyarrow as pa + + mapping = { + pa.int8(): "int", + pa.int16(): "int", + pa.int32(): "int", + pa.int64(): "int", + pa.uint8(): "int", + pa.uint16(): "int", + pa.uint32(): "int", + pa.uint64(): "int", + pa.float16(): "float", + pa.float32(): "float", + pa.float64(): "float", + pa.bool_(): "i", + } + + return mapping + + +def _arrow_feature_info(data: DataType) -> Tuple[List[str], List]: + if TYPE_CHECKING: + import pyarrow as pa + else: + pa = import_pyarrow() + + table: "pa.Table" = data + names = table.column_names + + def map_type(name: str) -> str: + col = table.column(name) + if isinstance(col.type, pa.DictionaryType): + return CAT_T # pylint: disable=unreachable + + return _arrow_dtype()[col.type] + + types = list(map(map_type, names)) + return names, types + + +def _meta_from_arrow_table( + data: DataType, + name: str, + dtype: Optional[NumpyDType], + handle: ctypes.c_void_p, +) -> None: + table: "pa.Table" = data + _meta_from_pandas_df(table.to_pandas(), name=name, dtype=dtype, handle=handle) + + +def _check_pyarrow_for_polars() -> None: + if not is_pyarrow_available(): + raise ImportError("`pyarrow` is required for polars.") + + +def _transform_polars_df( + data: DataType, + enable_categorical: bool, + feature_names: Optional[FeatureNames], + feature_types: Optional[Union[FeatureTypes, Categories]], +) -> Tuple[ArrowTransformed, Optional[FeatureNames], Optional[FeatureTypes]]: + if _is_polars_lazyframe(data): + df = data.collect() + warnings.warn( + "Using the default parameters for the polars `LazyFrame.collect`. Consider" + " passing a realized `DataFrame` or `Series` instead.", + UserWarning, + ) + else: + df = data + + _check_pyarrow_for_polars() + table = df.to_arrow() + return _transform_arrow_table( + table, enable_categorical, feature_names, feature_types + ) + + +def _from_polars_df( # pylint: disable=too-many-positional-arguments + data: DataType, + enable_categorical: bool, + missing: FloatCompatible, + n_threads: int, + feature_names: Optional[FeatureNames], + feature_types: Optional[Union[FeatureTypes, Categories]], + data_split_mode: DataSplitMode = DataSplitMode.ROW, +) -> DispatchedDataBackendReturnType: + df_t, feature_names, feature_types = _transform_polars_df( + data, enable_categorical, feature_names, feature_types + ) + handle = ctypes.c_void_p() + _check_call( + _LIB.XGDMatrixCreateFromColumnar( + df_t.array_interface(), + make_jcargs( + nthread=n_threads, missing=missing, data_split_mode=data_split_mode + ), + ctypes.byref(handle), + ) + ) + return handle, feature_names, feature_types + + +@functools.cache +def _lazy_load_cudf_is_cat() -> Callable[[Any], bool]: + try: + from cudf import CategoricalDtype + + def is_categorical_dtype(dtype: Any) -> bool: + return isinstance(dtype, CategoricalDtype) + + except ImportError: + try: + from cudf.api.types import is_categorical_dtype # type: ignore + except ImportError: + from cudf.utils.dtypes import is_categorical_dtype # type: ignore + + return is_categorical_dtype + + +@functools.cache +def _lazy_load_cudf_is_bool() -> Callable[[Any], bool]: + from cudf.api.types import is_bool_dtype + + return is_bool_dtype + + +class CudfTransformed(TransformedDf): + """A storage class for transformed cuDF dataframe.""" + + def __init__( + self, + columns: List[Union["PdSeries", DfCatAccessor]], + ref_categories: Optional[Categories], + ) -> None: + self.columns = columns + # Buffers for temporary data that cannot be freed until the data is consumed by + # the DMatrix or the booster. + + aitfs: AifType = [] + temporary_buffers = [] + + def push_series(ser: Any) -> None: + if _is_df_cat(ser): + cats, codes = ser.categories, ser.codes + cats_ainf, codes_ainf, buf = cudf_cat_inf(cats, codes) + temporary_buffers.append(buf) + aitfs.append((cats_ainf, codes_ainf)) + else: + # numeric column + ainf = cuda_array_interface_dict(ser) + aitfs.append(ainf) + + for col in self.columns: + push_series(col) + + super().__init__( + ref_categories=ref_categories, + aitfs=aitfs, + temporary_buffers=temporary_buffers, + ) + + @property + def shape(self) -> Tuple[int, int]: + """Return shape of the transformed DataFrame.""" + if _is_df_cat(self.columns[0]): + n_samples = self.columns[0].codes.shape[0] + else: + n_samples = self.columns[0].shape[0] # type: ignore + return n_samples, len(self.columns) + + +def _transform_cudf_df( + data: DataType, + feature_names: Optional[FeatureNames], + feature_types: Optional[Union[FeatureTypes, Categories]], + enable_categorical: bool, +) -> Tuple[ + CudfTransformed, + Optional[FeatureNames], + Optional[FeatureTypes], +]: + is_bool_dtype = _lazy_load_cudf_is_bool() + + is_categorical_dtype = _lazy_load_cudf_is_cat() + # Work around https://github.com/dmlc/xgboost/issues/10181 + if _is_cudf_ser(data): + if is_bool_dtype(data.dtype): + data = data.astype(np.uint8) + dtypes = [data.dtype] + else: + data = data.astype( + {col: np.uint8 for col in data.select_dtypes(include="bool")} + ) + dtypes = data.dtypes + + if not all( + dtype.name in _pandas_dtype_mapper + or (is_categorical_dtype(dtype) and enable_categorical) + for dtype in dtypes + ): + _invalid_dataframe_dtype(data) + + # handle feature names + if feature_names is None: + if _is_cudf_ser(data): + feature_names = [data.name] + elif lazy_isinstance(data.columns, "cudf.core.multiindex", "MultiIndex"): + feature_names = [" ".join([str(x) for x in i]) for i in data.columns] + else: + feature_names = list(data.columns.map(str)) + + # handle feature types + feature_types, ref_categories = get_ref_categories(feature_types) + if feature_types is None: + feature_types = [] + for dtype in dtypes: + if is_categorical_dtype(dtype) and enable_categorical: + feature_types.append(CAT_T) + else: + feature_types.append(_pandas_dtype_mapper[dtype.name]) + + # handle categorical data + result = [] + if _is_cudf_ser(data): + # unlike pandas, cuDF uses NA for missing data. + if is_categorical_dtype(data.dtype) and enable_categorical: + result.append(data.cat) + elif enable_categorical: + raise ValueError(_ENABLE_CAT_ERR) + else: + result.append(data) + else: + for col, dtype in zip(data.columns, data.dtypes): + series = data[col] + if is_categorical_dtype(dtype) and enable_categorical: + result.append(series.cat) + elif is_categorical_dtype(dtype): + raise ValueError(_ENABLE_CAT_ERR) + else: + result.append(series) + + return ( + CudfTransformed(result, ref_categories=ref_categories), + feature_names, + feature_types, + ) + + +def _from_cudf_df( + *, + data: DataType, + missing: FloatCompatible, + nthread: int, + feature_names: Optional[FeatureNames], + feature_types: Optional[Union[FeatureTypes, Categories]], + enable_categorical: bool, +) -> DispatchedDataBackendReturnType: + df, feature_names, feature_types = _transform_cudf_df( + data, feature_names, feature_types, enable_categorical + ) + handle = ctypes.c_void_p() + _check_call( + _LIB.XGDMatrixCreateFromCudaColumnar( + df.array_interface(), + make_jcargs(nthread=nthread, missing=missing), + ctypes.byref(handle), + ) + ) + return handle, feature_names, feature_types + + +def _transform_cupy_array(data: DataType) -> CupyT: + import cupy + + if not hasattr(data, "__cuda_array_interface__") and hasattr(data, "__array__"): + data = cupy.array(data, copy=False) + if array_hasobject(data) or data.dtype in [cupy.bool_]: + data = data.astype(cupy.float32, copy=False) + return data + + +def _from_cupy_array( + data: DataType, + missing: FloatCompatible, + nthread: int, + feature_names: Optional[FeatureNames], + feature_types: Optional[FeatureTypes], +) -> DispatchedDataBackendReturnType: + """Initialize DMatrix from cupy ndarray.""" + data = _transform_cupy_array(data) + interface_str = cuda_array_interface(data) + handle = ctypes.c_void_p() + config = bytes(json.dumps({"missing": missing, "nthread": nthread}), "utf-8") + _check_call( + _LIB.XGDMatrixCreateFromCudaArrayInterface( + interface_str, config, ctypes.byref(handle) + ) + ) + return handle, feature_names, feature_types + + +def _is_cupy_csr(data: DataType) -> bool: + try: + import cupyx + except ImportError: + return False + return isinstance(data, cupyx.scipy.sparse.csr_matrix) + + +def _is_cupy_csc(data: DataType) -> bool: + try: + import cupyx + except ImportError: + return False + return isinstance(data, cupyx.scipy.sparse.csc_matrix) + + +def _is_dlpack(data: DataType) -> bool: + return "PyCapsule" in str(type(data)) and "dltensor" in str(data) + + +def _transform_dlpack(data: DataType) -> bool: + from cupy import from_dlpack # pylint: disable=E0401 + + assert "used_dltensor" not in str(data) + data = from_dlpack(data) + return data + + +def _from_dlpack( + data: DataType, + missing: FloatCompatible, + nthread: int, + feature_names: Optional[FeatureNames], + feature_types: Optional[FeatureTypes], +) -> DispatchedDataBackendReturnType: + data = _transform_dlpack(data) + return _from_cupy_array(data, missing, nthread, feature_names, feature_types) + + +def _is_uri(data: DataType) -> TypeGuard[PathLike]: + return isinstance(data, (str, os.PathLike)) + + +def _from_uri( + data: PathLike, + missing: Optional[FloatCompatible], + feature_names: Optional[FeatureNames], + feature_types: Optional[FeatureTypes], + data_split_mode: DataSplitMode = DataSplitMode.ROW, +) -> DispatchedDataBackendReturnType: + _warn_unused_missing(data, missing) + handle = ctypes.c_void_p() + data = os.fspath(os.path.expanduser(data)) + config = make_jcargs(uri=str(data), data_split_mode=int(data_split_mode)) + _check_call(_LIB.XGDMatrixCreateFromURI(config, ctypes.byref(handle))) + return handle, feature_names, feature_types + + +def _is_list(data: DataType) -> TypeGuard[list]: + return isinstance(data, list) + + +def _from_list( + *, + data: Sequence, + missing: FloatCompatible, + n_threads: int, + feature_names: Optional[FeatureNames], + feature_types: Optional[FeatureTypes], + data_split_mode: DataSplitMode = DataSplitMode.ROW, +) -> DispatchedDataBackendReturnType: + array = np.array(data) + _check_data_shape(data) + return _from_numpy_array( + data=array, + missing=missing, + nthread=n_threads, + feature_names=feature_names, + feature_types=feature_types, + data_split_mode=data_split_mode, + ) + + +def _is_tuple(data: DataType) -> TypeGuard[tuple]: + return isinstance(data, tuple) + + +def _from_tuple( + *, + data: Sequence, + missing: FloatCompatible, + n_threads: int, + feature_names: Optional[FeatureNames], + feature_types: Optional[FeatureTypes], + data_split_mode: DataSplitMode = DataSplitMode.ROW, +) -> DispatchedDataBackendReturnType: + return _from_list( + data=data, + missing=missing, + n_threads=n_threads, + feature_names=feature_names, + feature_types=feature_types, + data_split_mode=data_split_mode, + ) + + +def _is_iter(data: DataType) -> TypeGuard[DataIter]: + return isinstance(data, DataIter) + + +def _has_array_protocol(data: DataType) -> bool: + return hasattr(data, "__array__") + + +def _convert_unknown_data(data: DataType) -> DataType: + warnings.warn( + f"Unknown data type: {type(data)}, trying to convert it to csr_matrix", + UserWarning, + ) + try: + import scipy.sparse + except ImportError: + return None + + try: + data = scipy.sparse.csr_matrix(data) + except Exception: # pylint: disable=broad-except + return None + + return data + + +def dispatch_data_backend( + *, + data: DataType, + missing: FloatCompatible, # Or Optional[Float] + threads: int, + feature_names: Optional[FeatureNames], + feature_types: Optional[Union[FeatureTypes, Categories]], + enable_categorical: bool = False, + data_split_mode: DataSplitMode = DataSplitMode.ROW, +) -> DispatchedDataBackendReturnType: + """Dispatch data for DMatrix.""" + + def check_cats( + feature_types: Optional[Union[FeatureTypes, Categories]], + ) -> TypeGuard[Optional[FeatureTypes]]: + if isinstance(feature_types, Categories): + raise ValueError( + "Reference category is only supported by DataFrame inputs." + ) + return True + + if ( + not _is_cudf_ser(data) + and not _is_pandas_series(data) + and not _is_polars_series(data) + ): + _check_data_shape(data) + if is_scipy_csr(data): + assert check_cats(feature_types) + return _from_scipy_csr( + data=data, + missing=missing, + nthread=threads, + feature_names=feature_names, + feature_types=feature_types, + data_split_mode=data_split_mode, + ) + if is_scipy_csc(data): + assert check_cats(feature_types) + return _from_scipy_csc( + data=data, + missing=missing, + nthread=threads, + feature_names=feature_names, + feature_types=feature_types, + data_split_mode=data_split_mode, + ) + if is_scipy_coo(data): + assert check_cats(feature_types) + return _from_scipy_csr( + data=data.tocsr(), + missing=missing, + nthread=threads, + feature_names=feature_names, + feature_types=feature_types, + data_split_mode=data_split_mode, + ) + if _is_np_array_like(data): + assert check_cats(feature_types) + return _from_numpy_array( + data=data, + missing=missing, + nthread=threads, + feature_names=feature_names, + feature_types=feature_types, + data_split_mode=data_split_mode, + ) + if _is_uri(data): + assert check_cats(feature_types) + return _from_uri(data, missing, feature_names, feature_types, data_split_mode) + if _is_list(data): + assert check_cats(feature_types) + return _from_list( + data=data, + missing=missing, + n_threads=threads, + feature_names=feature_names, + feature_types=feature_types, + data_split_mode=data_split_mode, + ) + if _is_tuple(data): + assert check_cats(feature_types) + return _from_tuple( + data=data, + missing=missing, + n_threads=threads, + feature_names=feature_names, + feature_types=feature_types, + data_split_mode=data_split_mode, + ) + if _is_polars_series(data): + pl = import_polars() + + data = pl.DataFrame({data.name: data}) + if _is_polars(data): + return _from_polars_df( + data, + enable_categorical, + missing=missing, + n_threads=threads, + feature_names=feature_names, + feature_types=feature_types, + data_split_mode=data_split_mode, + ) + if _is_arrow(data): + return _from_arrow_table( + data, + enable_categorical, + missing=missing, + n_threads=threads, + feature_names=feature_names, + feature_types=feature_types, + data_split_mode=data_split_mode, + ) + if _is_cudf_pandas(data): + data = data._fsproxy_fast # pylint: disable=protected-access + if _is_pandas_series(data): + pd = import_pandas() + + data = pd.DataFrame(data) + if _is_pandas_df(data): + return _from_pandas_df( + data=data, + enable_categorical=enable_categorical, + missing=missing, + nthread=threads, + feature_names=feature_names, + feature_types=feature_types, + data_split_mode=data_split_mode, + ) + if _is_cudf_df(data) or _is_cudf_ser(data): + return _from_cudf_df( + data=data, + missing=missing, + nthread=threads, + feature_names=feature_names, + feature_types=feature_types, + enable_categorical=enable_categorical, + ) + if _is_cupy_alike(data): + assert check_cats(feature_types) + return _from_cupy_array(data, missing, threads, feature_names, feature_types) + if _is_cupy_csr(data): + raise TypeError("cupyx CSR is not supported yet.") + if _is_cupy_csc(data): + raise TypeError("cupyx CSC is not supported yet.") + if _is_dlpack(data): + assert check_cats(feature_types) + return _from_dlpack(data, missing, threads, feature_names, feature_types) + if _is_modin_series(data): + pd = import_pandas() + + data = pd.DataFrame(data) + if _is_modin_df(data): + return _from_pandas_df( + data=data, + enable_categorical=enable_categorical, + missing=missing, + nthread=threads, + feature_names=feature_names, + feature_types=feature_types, + ) + + if _has_array_protocol(data): + assert check_cats(feature_types) + array = np.asarray(data) + return _from_numpy_array( + data=array, + missing=missing, + nthread=threads, + feature_names=feature_names, + feature_types=feature_types, + ) + + converted = _convert_unknown_data(data) + if converted is not None: + assert check_cats(feature_types) + return _from_scipy_csr( + data=converted, + missing=missing, + nthread=threads, + feature_names=feature_names, + feature_types=feature_types, + ) + + raise TypeError("Not supported type for data." + str(type(data))) + + +def _validate_meta_shape(data: DataType, name: str) -> None: + if hasattr(data, "shape"): + msg = f"Invalid shape: {data.shape} for {name}" + if name in _matrix_meta: + if len(data.shape) > 2: + raise ValueError(msg) + return + + if len(data.shape) > 2 or ( + len(data.shape) == 2 and (data.shape[1] != 0 and data.shape[1] != 1) + ): + raise ValueError(f"Invalid shape: {data.shape} for {name}") + + +def _meta_from_numpy( + data: np.ndarray, + field: str, + dtype: Optional[NumpyDType], + handle: ctypes.c_void_p, +) -> None: + data, dtype = _ensure_np_dtype(data, dtype) + interface = data.__array_interface__ + if interface.get("mask", None) is not None: + raise ValueError("Masked array is not supported.") + interface_str = array_interface(data) + _check_call(_LIB.XGDMatrixSetInfoFromInterface(handle, c_str(field), interface_str)) + + +def _meta_from_list( + data: Sequence, field: str, dtype: Optional[NumpyDType], handle: ctypes.c_void_p +) -> None: + data_np = np.array(data) + _meta_from_numpy(data_np, field, dtype, handle) + + +def _meta_from_tuple( + data: Sequence, field: str, dtype: Optional[NumpyDType], handle: ctypes.c_void_p +) -> None: + return _meta_from_list(data, field, dtype, handle) + + +def _meta_from_cudf_df(data: DataType, field: str, handle: ctypes.c_void_p) -> None: + if field not in _matrix_meta: + _meta_from_cudf_series(data.iloc[:, 0], field, handle) + else: + data = data.values + interface = cuda_array_interface(data) + _check_call(_LIB.XGDMatrixSetInfoFromInterface(handle, c_str(field), interface)) + + +def _meta_from_cudf_series(data: DataType, field: str, handle: ctypes.c_void_p) -> None: + check_cudf_meta(data, field) + inf = cuda_array_interface(data) + _check_call(_LIB.XGDMatrixSetInfoFromInterface(handle, c_str(field), inf)) + + +def _meta_from_cupy_array(data: DataType, field: str, handle: ctypes.c_void_p) -> None: + data = _transform_cupy_array(data) + inf = cuda_array_interface(data) + _check_call(_LIB.XGDMatrixSetInfoFromInterface(handle, c_str(field), inf)) + + +def dispatch_meta_backend( + matrix: DMatrix, data: DataType, name: str, dtype: Optional[NumpyDType] = None +) -> None: + """Dispatch for meta info.""" + handle = matrix.handle + assert handle is not None + _validate_meta_shape(data, name) + if data is None: + return + if _is_list(data): + _meta_from_list(data, name, dtype, handle) + return + if _is_tuple(data): + _meta_from_tuple(data, name, dtype, handle) + return + if _is_np_array_like(data): + _meta_from_numpy(data, name, dtype, handle) + return + if _is_arrow(data): + _meta_from_arrow_table(data, name, dtype, handle) + return + if _is_cudf_pandas(data): + data = data._fsproxy_fast # pylint: disable=protected-access + if _is_polars(data): + if _is_polars_lazyframe(data): + data = data.collect() + _check_pyarrow_for_polars() + _meta_from_arrow_table(data.to_arrow(), name, dtype, handle) + return + if _is_pandas_df(data): + _meta_from_pandas_df(data, name, dtype=dtype, handle=handle) + return + if _is_pandas_series(data): + _meta_from_pandas_series(data, name, dtype, handle) + return + if _is_dlpack(data): + data = _transform_dlpack(data) + _meta_from_cupy_array(data, name, handle) + return + if _is_cudf_ser(data): + _meta_from_cudf_series(data, name, handle) + return + if _is_cudf_df(data): + _meta_from_cudf_df(data, name, handle) + return + if _is_cupy_alike(data): + _meta_from_cupy_array(data, name, handle) + return + if _is_modin_df(data): + _meta_from_pandas_df(data, name, dtype=dtype, handle=handle) + return + if _is_modin_series(data): + data = data.values.astype("float") + assert len(data.shape) == 1 or data.shape[1] == 0 or data.shape[1] == 1 + _meta_from_numpy(data, name, dtype, handle) + return + if _has_array_protocol(data): + # pyarrow goes here. + array = np.asarray(data) + _meta_from_numpy(array, name, dtype, handle) + return + raise TypeError("Unsupported type for " + name, str(type(data))) + + +class SingleBatchInternalIter(DataIter): # pylint: disable=R0902 + """An iterator for single batch data to help creating device DMatrix. + Transforming input directly to histogram with normal single batch data API + can not access weight for sketching. So this iterator acts as a staging + area for meta info. + + """ + + def __init__(self, **kwargs: Any) -> None: + self.kwargs = kwargs + self.it = 0 + + # This does not necessarily increase memory usage as the data transformation + # might use memory. + super().__init__(release_data=False) + + def next(self, input_data: Callable) -> bool: + if self.it == 1: + return False + self.it += 1 + input_data(**self.kwargs) + return True + + def reset(self) -> None: + self.it = 0 + + +def _proxy_transform( + data: DataType, + feature_names: Optional[FeatureNames], + feature_types: Optional[FeatureTypes], + enable_categorical: bool, +) -> TransformedData: + if _is_cudf_pandas(data): + data = data._fsproxy_fast # pylint: disable=protected-access + if _is_cudf_df(data) or _is_cudf_ser(data): + return _transform_cudf_df( + data, feature_names, feature_types, enable_categorical + ) + if _is_cupy_alike(data): + data = _transform_cupy_array(data) + return data, feature_names, feature_types + if _is_dlpack(data): + return _transform_dlpack(data), feature_names, feature_types + if _is_list(data) or _is_tuple(data): + data = np.array(data) + if _is_np_array_like(data): + data, _ = _ensure_np_dtype(data, data.dtype) + return data, feature_names, feature_types + if is_scipy_csr(data): + data = transform_scipy_sparse(data, True) + return data, feature_names, feature_types + if is_scipy_csc(data): + data = transform_scipy_sparse(data.tocsr(), True) + return data, feature_names, feature_types + if is_scipy_coo(data): + data = transform_scipy_sparse(data.tocsr(), True) + return data, feature_names, feature_types + if _is_polars(data): + df_pl, feature_names, feature_types = _transform_polars_df( + data, enable_categorical, feature_names, feature_types + ) + return df_pl, feature_names, feature_types + if _is_pandas_series(data): + pd = import_pandas() + + data = pd.DataFrame(data) + if _is_arrow(data): + df_pa, feature_names, feature_types = _transform_arrow_table( + data, enable_categorical, feature_names, feature_types + ) + return df_pa, feature_names, feature_types + if _is_pandas_df(data): + df, feature_names, feature_types = _transform_pandas_df( + data, enable_categorical, feature_names, feature_types + ) + return df, feature_names, feature_types + raise TypeError("Value type is not supported for data iterator:" + str(type(data))) + + +def is_on_cuda(data: Any) -> bool: + """Whether the data is a CUDA-based data structure.""" + return any( + p(data) + for p in ( + _is_cudf_df, + _is_cudf_ser, + _is_cudf_pandas, + _is_cupy_alike, + _is_dlpack, + ) + ) + + +def dispatch_proxy_set_data( + proxy: _ProxyDMatrix, + data: DataType, +) -> None: + """Dispatch for QuantileDMatrix.""" + if ( + not _is_cudf_ser(data) + and not _is_pandas_series(data) + and not _is_polars_series(data) + ): + _check_data_shape(data) + + if isinstance(data, CudfTransformed): + # pylint: disable=W0212 + proxy._ref_data_from_cuda_columnar(data) + return + if _is_cupy_alike(data): + proxy._ref_data_from_cuda_interface(data) # pylint: disable=W0212 + return + if _is_dlpack(data): + data = _transform_dlpack(data) + proxy._ref_data_from_cuda_interface(data) # pylint: disable=W0212 + return + # Host + if isinstance(data, (ArrowTransformed, PandasTransformed)): + proxy._ref_data_from_columnar(data) # pylint: disable=W0212 + return + if _is_np_array_like(data): + _check_data_shape(data) + proxy._ref_data_from_array(data) # pylint: disable=W0212 + return + if is_scipy_csr(data): + proxy._ref_data_from_csr(data) # pylint: disable=W0212 + return + + err = TypeError("Value type is not supported for data iterator:" + str(type(data))) + raise err diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/xgboost/federated.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/xgboost/federated.py new file mode 100644 index 0000000000000000000000000000000000000000..e903d475cfc6edeea8b79af048b9eeca404f48c5 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/xgboost/federated.py @@ -0,0 +1,109 @@ +"""XGBoost Experimental Federated Learning related API.""" + +import ctypes +from threading import Thread +from typing import Any, Dict, Optional + +from .core import _LIB, _check_call, _deprecate_positional_args, make_jcargs +from .tracker import RabitTracker + + +class FederatedTracker(RabitTracker): + """Tracker for federated training. + + Parameters + ---------- + n_workers : + The number of federated workers. + + port : + The port to listen on. + + secure : + Whether this is a secure instance. If True, then the following arguments for SSL + must be provided. + + server_key_path : + Path to the server private key file. + + server_cert_path : + Path to the server certificate file. + + client_cert_path : + Path to the client certificate file. + + """ + + @_deprecate_positional_args + def __init__( # pylint: disable=R0913, W0231 + self, + n_workers: int, + port: int, + *, + secure: bool, + server_key_path: Optional[str] = None, + server_cert_path: Optional[str] = None, + client_cert_path: Optional[str] = None, + timeout: int = 300, + ) -> None: + handle = ctypes.c_void_p() + args = make_jcargs( + n_workers=n_workers, + port=port, + dmlc_communicator="federated", + federated_secure=secure, + server_key_path=server_key_path, + server_cert_path=server_cert_path, + client_cert_path=client_cert_path, + timeout=int(timeout), + ) + _check_call(_LIB.XGTrackerCreate(args, ctypes.byref(handle))) + self.handle = handle + + +@_deprecate_positional_args +def run_federated_server( # pylint: disable=too-many-arguments + n_workers: int, + port: int, + *, + server_key_path: Optional[str] = None, + server_cert_path: Optional[str] = None, + client_cert_path: Optional[str] = None, + blocking: bool = True, + timeout: int = 300, +) -> Optional[Dict[str, Any]]: + """See :py:class:`~xgboost.federated.FederatedTracker` for more info. + + Parameters + ---------- + blocking : + Block the server until the training is finished. If set to False, the function + launches an additional thread and returns the worker arguments. The default is + True and a higher level framework is responsible for setting worker parameters. + + """ + args: Dict[str, Any] = {"n_workers": n_workers} + secure = all( + path is not None + for path in [server_key_path, server_cert_path, client_cert_path] + ) + tracker = FederatedTracker( + n_workers=n_workers, + port=port, + secure=secure, + timeout=timeout, + server_key_path=server_key_path, + server_cert_path=server_cert_path, + client_cert_path=client_cert_path, + ) + tracker.start() + + if blocking: + tracker.wait_for() + return None + + thread = Thread(target=tracker.wait_for) + thread.daemon = True + thread.start() + args.update(tracker.worker_args()) + return args diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/xgboost/libpath.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/xgboost/libpath.py new file mode 100644 index 0000000000000000000000000000000000000000..097c76830ac0a93d0629063155e987df333e6333 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/xgboost/libpath.py @@ -0,0 +1,78 @@ +# coding: utf-8 +"""Find the path to xgboost dynamic library files.""" + +import os +import platform +import sys +from typing import List + + +class XGBoostLibraryNotFound(Exception): + """Error thrown by when xgboost is not found""" + + +def is_sphinx_build() -> bool: + """`XGBOOST_BUILD_DOC` is used by the sphinx conf.py to skip building the C++ code.""" + return bool(os.environ.get("XGBOOST_BUILD_DOC", False)) + + +def find_lib_path() -> List[str]: + """Find the path to xgboost dynamic library files. + + Returns + ------- + lib_path + List of all found library path to xgboost + """ + curr_path = os.path.dirname(os.path.abspath(os.path.expanduser(__file__))) + dll_path = [ + # normal, after installation `lib` is copied into Python package tree. + os.path.join(curr_path, "lib"), + # editable installation, no copying is performed. + os.path.join(curr_path, os.path.pardir, os.path.pardir, "lib"), + # use libxgboost from a system prefix, if available. This should be the last + # option. + os.path.join(sys.base_prefix, "lib"), + ] + + if sys.platform == "win32": + # On Windows, Conda may install libs in different paths + dll_path.extend( + [ + os.path.join(sys.base_prefix, "bin"), + os.path.join(sys.base_prefix, "Library"), + os.path.join(sys.base_prefix, "Library", "bin"), + os.path.join(sys.base_prefix, "Library", "lib"), + os.path.join(sys.base_prefix, "Library", "mingw-w64"), + os.path.join(sys.base_prefix, "Library", "mingw-w64", "bin"), + os.path.join(sys.base_prefix, "Library", "mingw-w64", "lib"), + ] + ) + dll_path = [os.path.join(p, "xgboost.dll") for p in dll_path] + elif sys.platform.startswith(("linux", "freebsd", "emscripten")): + dll_path = [os.path.join(p, "libxgboost.so") for p in dll_path] + elif sys.platform == "darwin": + dll_path = [os.path.join(p, "libxgboost.dylib") for p in dll_path] + elif sys.platform == "cygwin": + dll_path = [os.path.join(p, "cygxgboost.dll") for p in dll_path] + if platform.system() == "OS400": + dll_path = [os.path.join(p, "libxgboost.so") for p in dll_path] + + lib_path = [p for p in dll_path if os.path.exists(p) and os.path.isfile(p)] + + if not lib_path and not is_sphinx_build(): + link = "https://xgboost.readthedocs.io/en/stable/install.html" + msg = ( + "Cannot find XGBoost Library in the candidate path. " + + "List of candidates:\n- " + + ("\n- ".join(dll_path)) + + "\nXGBoost Python package path: " + + curr_path + + "\nsys.base_prefix: " + + sys.base_prefix + + "\nSee: " + + link + + " for installing XGBoost." + ) + raise XGBoostLibraryNotFound(msg) + return lib_path diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/xgboost/objective.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/xgboost/objective.py new file mode 100644 index 0000000000000000000000000000000000000000..8da01068009e7dce129f800411f0c6439ac8a58f --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/xgboost/objective.py @@ -0,0 +1,92 @@ +"""Experimental support for a new objective interface with target dimension +reduction. + +.. warning:: + + Do not use this module unless you want to participate in development. + +.. versionadded:: 3.2.0 + +""" + +import warnings +from abc import ABC, abstractmethod +from typing import TYPE_CHECKING, Tuple + +import numpy as np + +from ._data_utils import ( + _ensure_np_dtype, + _is_flatten, + array_interface, + cuda_array_interface, +) +from ._typing import ArrayLike, NumpyOrCupy +from .compat import _is_cupy_alike + +if TYPE_CHECKING: + from .core import DMatrix + + +class Objective(ABC): + """Base class for custom objective functions. + + .. warning:: + + Do not use this class unless you want to participate in development. + + .. versionadded:: 3.2.0 + + """ + + @abstractmethod + def __call__( + self, iteration: int, y_pred: ArrayLike, dtrain: "DMatrix" + ) -> Tuple[ArrayLike, ArrayLike]: ... + + +class TreeObjective(Objective): + """Base class for tree-specific custom objective functions. + + .. warning:: + + Do not use this class unless you want to participate in development. + + .. versionadded:: 3.2.0 + + """ + + # pylint: disable=unused-argument + def split_grad( + self, iteration: int, grad: ArrayLike, hess: ArrayLike + ) -> Tuple[ArrayLike, ArrayLike] | None: + """Provide a different gradient type for finding tree structures.""" + return None + + +def _grad_arrinf(array: NumpyOrCupy, n_samples: int) -> bytes: + # Can we check for __array_interface__ instead of a specific type instead? + msg = ( + "Expecting `np.ndarray` or `cupy.ndarray` for gradient and hessian." + f" Got: {type(array)}" + ) + if not isinstance(array, np.ndarray) and not _is_cupy_alike(array): + raise TypeError(msg) + + if array.shape[0] != n_samples and _is_flatten(array): + warnings.warn( + "Since 2.1.0, the shape of the gradient and hessian is required to" + " be (n_samples, n_targets) or (n_samples, n_classes).", + FutureWarning, + ) + array = array.reshape(n_samples, array.size // n_samples) + + if isinstance(array, np.ndarray): + array, _ = _ensure_np_dtype(array, array.dtype) + interface = array_interface(array) + elif _is_cupy_alike(array): + interface = cuda_array_interface(array) + else: + raise TypeError(msg) + + return interface diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/xgboost/plotting.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/xgboost/plotting.py new file mode 100644 index 0000000000000000000000000000000000000000..8921c00fc7ec0ee9b0807d851db43a5d7fd76604 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/xgboost/plotting.py @@ -0,0 +1,360 @@ +# pylint: disable=too-many-locals, too-many-arguments +# pylint: disable=too-many-branches +"""Plotting Library.""" + +import json +import warnings +from io import BytesIO +from typing import Any, Optional, Union + +import numpy as np + +from ._typing import PathLike +from .core import Booster, _deprecate_positional_args +from .sklearn import XGBModel + +Axes = Any # real type is matplotlib.axes.Axes +GraphvizSource = Any # real type is graphviz.Source + + +@_deprecate_positional_args +def plot_importance( + booster: Union[XGBModel, Booster, dict], + *, + ax: Optional[Axes] = None, + height: float = 0.2, + xlim: Optional[tuple] = None, + ylim: Optional[tuple] = None, + title: str = "Feature importance", + xlabel: str = "Importance score", + ylabel: str = "Features", + fmap: PathLike = "", + importance_type: str = "weight", + max_num_features: Optional[int] = None, + grid: bool = True, + show_values: bool = True, + values_format: str = "{v}", + **kwargs: Any, +) -> Axes: + """Plot importance based on fitted trees. + + Parameters + ---------- + booster : + Booster or XGBModel instance, or dict taken by Booster.get_fscore() + ax : matplotlib Axes + Target axes instance. If None, new figure and axes will be created. + grid : + Turn the axes grids on or off. Default is True (On). + importance_type : + How the importance is calculated: either "weight", "gain", or "cover" + + * "weight" is the number of times a feature appears in a tree + * "gain" is the average gain of splits which use the feature + * "cover" is the average coverage of splits which use the feature + where coverage is defined as the number of samples affected by the split + max_num_features : + Maximum number of top features displayed on plot. If None, all features will be + displayed. + height : + Bar height, passed to ax.barh() + xlim : + Tuple passed to axes.xlim() + ylim : + Tuple passed to axes.ylim() + title : + Axes title. To disable, pass None. + xlabel : + X axis title label. To disable, pass None. + ylabel : + Y axis title label. To disable, pass None. + fmap : + The name of feature map file. + show_values : + Show values on plot. To disable, pass False. + values_format : + Format string for values. "v" will be replaced by the value of the feature + importance. e.g. Pass "{v:.2f}" in order to limit the number of digits after + the decimal point to two, for each value printed on the graph. + kwargs : + Other keywords passed to ax.barh() + + Returns + ------- + ax : matplotlib Axes + """ + try: + import matplotlib.pyplot as plt + except ImportError as e: + raise ImportError("You must install matplotlib to plot importance") from e + + if isinstance(booster, XGBModel): + importance = booster.get_booster().get_score( + importance_type=importance_type, fmap=fmap + ) + elif isinstance(booster, Booster): + importance = booster.get_score(importance_type=importance_type, fmap=fmap) + elif isinstance(booster, dict): + importance = booster + else: + raise ValueError("tree must be Booster, XGBModel or dict instance") + + if not importance: + raise ValueError( + "Booster.get_score() results in empty. " + + "This maybe caused by having all trees as decision dumps." + ) + + tuples = [(k, importance[k]) for k in importance] + if max_num_features is not None: + # pylint: disable=invalid-unary-operand-type + tuples = sorted(tuples, key=lambda _x: _x[1])[-max_num_features:] + else: + tuples = sorted(tuples, key=lambda _x: _x[1]) + labels, values = zip(*tuples) + + if ax is None: + _, ax = plt.subplots(1, 1) + + ylocs = np.arange(len(values)) + ax.barh(ylocs, values, align="center", height=height, **kwargs) + + if show_values is True: + for x, y in zip(values, ylocs): + ax.text(x + 1, float(y), values_format.format(v=x), va="center") + + ax.set_yticks(ylocs) + ax.set_yticklabels(labels) + + if xlim is not None: + if not isinstance(xlim, tuple) or len(xlim) != 2: + raise ValueError("xlim must be a tuple of 2 elements") + else: + xlim = (0, max(values) * 1.1) + ax.set_xlim(xlim) + + if ylim is not None: + if not isinstance(ylim, tuple) or len(ylim) != 2: + raise ValueError("ylim must be a tuple of 2 elements") + else: + ylim = (-1, len(values)) + ax.set_ylim(ylim) + + if title is not None: + ax.set_title(title) + if xlabel is not None: + ax.set_xlabel(xlabel) + if ylabel is not None: + ax.set_ylabel(ylabel) + ax.grid(grid) + return ax + + +@_deprecate_positional_args +def to_graphviz( + booster: Union[Booster, XGBModel], + *, + fmap: PathLike = "", + num_trees: Optional[int] = None, + rankdir: Optional[str] = None, + yes_color: Optional[str] = None, + no_color: Optional[str] = None, + condition_node_params: Optional[dict] = None, + leaf_node_params: Optional[dict] = None, + with_stats: bool = False, + tree_idx: int = 0, + **kwargs: Any, +) -> GraphvizSource: + """Convert specified tree to graphviz instance. IPython can automatically plot + the returned graphviz instance. Otherwise, you should call .render() method + of the returned graphviz instance. + + Parameters + ---------- + booster : + Booster or XGBModel instance + fmap : + The name of feature map file + num_trees : + + .. deprecated:: 3.0 + + Specify the ordinal number of target tree + + rankdir : + Passed to graphviz via graph_attr + yes_color : + Edge color when meets the node condition. + no_color : + Edge color when doesn't meet the node condition. + condition_node_params : + Condition node configuration for for graphviz. Example: + + .. code-block:: python + + {'shape': 'box', + 'style': 'filled,rounded', + 'fillcolor': '#78bceb'} + + leaf_node_params : + Leaf node configuration for graphviz. Example: + + .. code-block:: python + + {'shape': 'box', + 'style': 'filled', + 'fillcolor': '#e48038'} + + with_stats : + + .. versionadded:: 3.0 + + Controls whether the split statistics should be included. + + tree_idx : + + .. versionadded:: 3.0 + + Specify the ordinal index of target tree. + + kwargs : + Other keywords passed to graphviz graph_attr, e.g. ``graph [ {key} = {value} ]`` + + Returns + ------- + graph: graphviz.Source + + """ + try: + from graphviz import Source + except ImportError as e: + raise ImportError("You must install graphviz to plot tree") from e + if isinstance(booster, XGBModel): + booster = booster.get_booster() + + # squash everything back into kwargs again for compatibility + parameters = "dot" + extra = {} + for key, value in kwargs.items(): + extra[key] = value + + if rankdir is not None: + kwargs["graph_attrs"] = {} + kwargs["graph_attrs"]["rankdir"] = rankdir + for key, value in extra.items(): + if kwargs.get("graph_attrs", None) is not None: + kwargs["graph_attrs"][key] = value + else: + kwargs["graph_attrs"] = {} + del kwargs[key] + + if yes_color is not None or no_color is not None: + kwargs["edge"] = {} + if yes_color is not None: + kwargs["edge"]["yes_color"] = yes_color + if no_color is not None: + kwargs["edge"]["no_color"] = no_color + + if condition_node_params is not None: + kwargs["condition_node_params"] = condition_node_params + if leaf_node_params is not None: + kwargs["leaf_node_params"] = leaf_node_params + + if kwargs: + parameters += ":" + parameters += json.dumps(kwargs) + + if num_trees is not None: + warnings.warn( + "The `num_trees` parameter is deprecated, use `tree_idx` insetad. ", + FutureWarning, + ) + if tree_idx not in (0, num_trees): + raise ValueError( + "Both `num_trees` and `tree_idx` are used, prefer `tree_idx` instead." + ) + tree_idx = num_trees + + tree = booster.get_dump(fmap=fmap, dump_format=parameters, with_stats=with_stats)[ + tree_idx + ] + g = Source(tree) + return g + + +@_deprecate_positional_args +def plot_tree( + booster: Union[Booster, XGBModel], + *, + fmap: PathLike = "", + num_trees: Optional[int] = None, + rankdir: Optional[str] = None, + ax: Optional[Axes] = None, + with_stats: bool = False, + tree_idx: int = 0, + **kwargs: Any, +) -> Axes: + """Plot specified tree. + + Parameters + ---------- + booster : + Booster or XGBModel instance + fmap: str (optional) + The name of feature map file + num_trees : + + .. deprecated:: 3.0 + + rankdir : str, default "TB" + Passed to graphviz via graph_attr + ax : matplotlib Axes, default None + Target axes instance. If None, new figure and axes will be created. + + with_stats : + + .. versionadded:: 3.0 + + See :py:func:`to_graphviz`. + + tree_idx : + + .. versionadded:: 3.0 + + See :py:func:`to_graphviz`. + + kwargs : + Other keywords passed to :py:func:`to_graphviz` + + Returns + ------- + ax : matplotlib Axes + + """ + try: + from matplotlib import image + from matplotlib import pyplot as plt + except ImportError as e: + raise ImportError("You must install matplotlib to plot tree") from e + + if ax is None: + _, ax = plt.subplots(1, 1) + + g = to_graphviz( + booster, + fmap=fmap, + num_trees=num_trees, + rankdir=rankdir, + with_stats=with_stats, + tree_idx=tree_idx, + **kwargs, + ) + + s = BytesIO() + s.write(g.pipe(format="png")) + s.seek(0) + img = image.imread(s) + + ax.imshow(img) + ax.axis("off") + return ax diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/xgboost/py.typed b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/xgboost/py.typed new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/xgboost/sklearn.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/xgboost/sklearn.py new file mode 100644 index 0000000000000000000000000000000000000000..8349163f5db8e381f94d094b317863db3955f80a --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/xgboost/sklearn.py @@ -0,0 +1,2391 @@ +# pylint: disable=too-many-arguments, too-many-locals, fixme, too-many-lines +"""Scikit-Learn Wrapper interface for XGBoost.""" + +import collections +import copy +import json +import os +import warnings +from concurrent.futures import ThreadPoolExecutor +from inspect import signature +from typing import ( + Any, + Callable, + Dict, + List, + Optional, + Protocol, + Sequence, + Set, + Tuple, + Type, + TypeVar, + Union, + cast, +) + +import numpy as np +from scipy.special import softmax + +from ._data_utils import Categories +from ._typing import ( + ArrayLike, + EvalsLog, + FeatureNames, + FeatureTypes, + IterationRange, + ModelIn, +) +from .callback import TrainingCallback + +# Do not use class names on scikit-learn directly. Re-define the classes on +# .compat to guarantee the behavior without scikit-learn +from .compat import ( + SKLEARN_INSTALLED, + XGBClassifierBase, + XGBModelBase, + XGBRegressorBase, + _sklearn_Tags, + _sklearn_version, + import_cupy, + is_dataframe, +) +from .config import config_context +from .core import ( + Booster, + DMatrix, + Metric, + PlainObj, + QuantileDMatrix, + XGBoostError, + _deprecate_positional_args, + _parse_eval_str, + _parse_version, + _py_version, +) +from .data import ( + CAT_T, + _is_cudf_df, + _is_cudf_ser, + _is_cupy_alike, + _is_pandas_df, + _is_polars_lazyframe, +) +from .training import train + + +class XGBRankerMixIn: + """MixIn for ranking, defines the _estimator_type usually defined in scikit-learn + base classes. + + """ + + _estimator_type = "ranker" + + +def _check_rf_callback( + early_stopping_rounds: Optional[int], + callbacks: Optional[Sequence[TrainingCallback]], +) -> None: + if early_stopping_rounds is not None or callbacks is not None: + raise NotImplementedError( + "`early_stopping_rounds` and `callbacks` are not implemented for" + " the sklearn random forest estimator interface." + ) + + +def _can_use_qdm(tree_method: Optional[str], device: Optional[str]) -> bool: + not_sycl = (device is None) or (not device.startswith("sycl")) + return tree_method in ("hist", None, "auto") and not_sycl + + +class _SklObjWProto(Protocol): + def __call__( + self, + y_true: ArrayLike, + y_pred: ArrayLike, + sample_weight: Optional[ArrayLike] = None, + ) -> Tuple[ArrayLike, ArrayLike]: ... + + +_SklObjProto = Callable[[ArrayLike, ArrayLike], Tuple[np.ndarray, np.ndarray]] +SklObjective = Optional[Union[str, _SklObjWProto, _SklObjProto]] + + +def _objective_decorator(func: Union[_SklObjWProto, _SklObjProto]) -> PlainObj: + """Decorate an objective function + + Converts an objective function using the typical sklearn metrics + signature so that it is usable with ``xgboost.training.train`` + + Parameters + ---------- + func: + Expects a callable with signature ``func(y_true, y_pred)``: + + y_true: array_like of shape [n_samples] + The target values + y_pred: array_like of shape [n_samples] + The predicted values + sample_weight : + Optional sample weight, None or a ndarray. + + Returns + ------- + new_func: + The new objective function as expected by ``xgboost.training.train``. + The signature is ``new_func(preds, dmatrix)``: + + preds: array_like, shape [n_samples] + The predicted values + dmatrix: ``DMatrix`` + The training set from which the labels will be extracted using + ``dmatrix.get_label()`` + """ + + parameters = signature(func).parameters + supports_sw = "sample_weight" in parameters + + def inner(preds: np.ndarray, dmatrix: DMatrix) -> Tuple[np.ndarray, np.ndarray]: + """Internal function.""" + sample_weight = dmatrix.get_weight() + labels = dmatrix.get_label() + + if sample_weight.size > 0 and not supports_sw: + raise ValueError( + "Custom objective doesn't have the `sample_weight` parameter while" + " sample_weight is used." + ) + if sample_weight.size > 0: + fnw = cast(_SklObjWProto, func) + return fnw(labels, preds, sample_weight=sample_weight) + + fn = cast(_SklObjProto, func) + return fn(labels, preds) + + return inner + + +def _metric_decorator(func: Callable) -> Metric: + """Decorate a metric function from sklearn. + + Converts an metric function that uses the typical sklearn metric signature so that + it is compatible with :py:func:`train` + + """ + + def inner(y_score: np.ndarray, dmatrix: DMatrix) -> Tuple[str, float]: + y_true = dmatrix.get_label() + weight = dmatrix.get_weight() + if weight.size == 0: + return func.__name__, func(y_true, y_score) + return func.__name__, func(y_true, y_score, sample_weight=weight) + + return inner + + +def ltr_metric_decorator(func: Callable, n_jobs: Optional[int]) -> Metric: + """Decorate a learning to rank metric.""" + + def inner(y_score: np.ndarray, dmatrix: DMatrix) -> Tuple[str, float]: + y_true = dmatrix.get_label() + group_ptr = dmatrix.get_uint_info("group_ptr") + if group_ptr.size < 2: + raise ValueError( + "Invalid `group_ptr`. Likely caused by invalid qid or group." + ) + scores = np.empty(group_ptr.size - 1) + futures = [] + weight = dmatrix.get_group() + no_weight = weight.size == 0 + + def task(i: int) -> float: + begin = group_ptr[i - 1] + end = group_ptr[i] + gy = y_true[begin:end] + gp = y_score[begin:end] + if gy.size == 1: + # Maybe there's a better default? 1.0 because many ranking score + # functions have output in range [0, 1]. + return 1.0 + return func(gy, gp) + + workers = n_jobs if n_jobs is not None else os.cpu_count() + with ThreadPoolExecutor(max_workers=workers) as executor: + for i in range(1, group_ptr.size): + f = executor.submit(task, i) + futures.append(f) + + for i, f in enumerate(futures): + scores[i] = f.result() + + if no_weight: + return func.__name__, scores.mean() + + return func.__name__, np.average(scores, weights=weight) + + return inner + + +__estimator_doc = f""" + n_estimators : {Optional[int]} + Number of gradient boosted trees. Equivalent to number of boosting + rounds. +""" + +__model_doc = f""" + max_depth : {Optional[int]} + + Maximum tree depth for base learners. + + max_leaves : {Optional[int]} + + Maximum number of leaves; 0 indicates no limit. + + max_bin : {Optional[int]} + + If using histogram-based algorithm, maximum number of bins per feature + + grow_policy : {Optional[str]} + + Tree growing policy. + + - depthwise: Favors splitting at nodes closest to the node, + - lossguide: Favors splitting at nodes with highest loss change. + + learning_rate : {Optional[float]} + + Boosting learning rate (xgb's "eta") + + verbosity : {Optional[int]} + + The degree of verbosity. Valid values are 0 (silent) - 3 (debug). + + objective : {SklObjective} + + Specify the learning task and the corresponding learning objective or a custom + objective function to be used. + + For custom objective, see :doc:`/tutorials/custom_metric_obj` and + :ref:`custom-obj-metric` for more information, along with the end note for + function signatures. + + booster: {Optional[str]} + + Specify which booster to use: ``gbtree``, ``gblinear`` or ``dart``. + + tree_method : {Optional[str]} + + Specify which tree method to use. Default to auto. If this parameter is set to + default, XGBoost will choose the most conservative option available. It's + recommended to study this option from the parameters document :doc:`tree method + ` + + n_jobs : {Optional[int]} + + Number of parallel threads used to run xgboost. When used with other + Scikit-Learn algorithms like grid search, you may choose which algorithm to + parallelize and balance the threads. Creating thread contention will + significantly slow down both algorithms. + + gamma : {Optional[float]} + + (min_split_loss) Minimum loss reduction required to make a further partition on + a leaf node of the tree. + + min_child_weight : {Optional[float]} + + Minimum sum of instance weight(hessian) needed in a child. + + max_delta_step : {Optional[float]} + + Maximum delta step we allow each tree's weight estimation to be. + + subsample : {Optional[float]} + + Subsample ratio of the training instance. + + sampling_method : {Optional[str]} + + Sampling method. Used only by the GPU version of ``hist`` tree method. + + - ``uniform``: Select random training instances uniformly. + - ``gradient_based``: Select random training instances with higher probability + when the gradient and hessian are larger. (cf. CatBoost) + + colsample_bytree : {Optional[float]} + + Subsample ratio of columns when constructing each tree. + + colsample_bylevel : {Optional[float]} + + Subsample ratio of columns for each level. + + colsample_bynode : {Optional[float]} + + Subsample ratio of columns for each split. + + reg_alpha : {Optional[float]} + + L1 regularization term on weights (xgb's alpha). + + reg_lambda : {Optional[float]} + + L2 regularization term on weights (xgb's lambda). + + scale_pos_weight : {Optional[float]} + Balancing of positive and negative weights. + + base_score : {Optional[Union[float, List[float]]]} + + The initial prediction score of all instances, global bias. + + random_state : {Optional[Union[np.random.RandomState, np.random.Generator, int]]} + + Random number seed. + + .. note:: + + Using gblinear booster with shotgun updater is nondeterministic as + it uses Hogwild algorithm. + + missing : float + + Value in the data which needs to be present as a missing value. Default to + :py:data:`numpy.nan`. + + num_parallel_tree: {Optional[int]} + + Used for boosting random forest. + + monotone_constraints : {Optional[Union[Dict[str, int], str]]} + + Constraint of variable monotonicity. See :doc:`tutorial ` + for more information. + + interaction_constraints : {Optional[Union[str, List[Tuple[str]]]]} + + Constraints for interaction representing permitted interactions. The + constraints must be specified in the form of a nested list, e.g. ``[[0, 1], [2, + 3, 4]]``, where each inner list is a group of indices of features that are + allowed to interact with each other. See :doc:`tutorial + ` for more information + + importance_type: {Optional[str]} + + The feature importance type for the feature_importances\\_ property: + + * For tree model, it's either "gain", "weight", "cover", "total_gain" or + "total_cover". + * For linear model, only "weight" is defined and it's the normalized + coefficients without bias. + + device : {Optional[str]} + + .. versionadded:: 2.0.0 + + Device ordinal, available options are `cpu`, `cuda`, and `gpu`. + + validate_parameters : {Optional[bool]} + + Give warnings for unknown parameter. + + enable_categorical : bool + + See the same parameter of :py:class:`DMatrix` for details. + + feature_types : {Optional[FeatureTypes]} + + .. versionadded:: 1.7.0 + + Used for specifying feature types without constructing a dataframe. See + the :py:class:`DMatrix` for details. + + feature_weights : Optional[ArrayLike] + + Weight for each feature, defines the probability of each feature being selected + when colsample is being used. All values must be greater than 0, otherwise a + `ValueError` is thrown. + + max_cat_to_onehot : Optional[int] + + .. versionadded:: 1.6.0 + + .. note:: This parameter is experimental + + A threshold for deciding whether XGBoost should use one-hot encoding based split + for categorical data. When number of categories is lesser than the threshold + then one-hot encoding is chosen, otherwise the categories will be partitioned + into children nodes. Also, `enable_categorical` needs to be set to have + categorical feature support. See :doc:`Categorical Data + ` and :ref:`cat-param` for details. + + max_cat_threshold : {Optional[int]} + + .. versionadded:: 1.7.0 + + .. note:: This parameter is experimental + + Maximum number of categories considered for each split. Used only by + partition-based splits for preventing over-fitting. Also, `enable_categorical` + needs to be set to have categorical feature support. See :doc:`Categorical Data + ` and :ref:`cat-param` for details. + + multi_strategy : {Optional[str]} + + .. versionadded:: 2.0.0 + + .. note:: This parameter is working-in-progress. + + The strategy used for training multi-target models, including multi-target + regression and multi-class classification. See :doc:`/tutorials/multioutput` for + more information. + + - ``one_output_per_tree``: One model for each target. + - ``multi_output_tree``: Use multi-target trees. + + eval_metric : {Optional[Union[str, List[Union[str, Callable]], Callable]]} + + .. versionadded:: 1.6.0 + + Metric used for monitoring the training result and early stopping. It can be a + string or list of strings as names of predefined metric in XGBoost (See + :doc:`/parameter`), one of the metrics in :py:mod:`sklearn.metrics`, or any + other user defined metric that looks like `sklearn.metrics`. + + If custom objective is also provided, then custom metric should implement the + corresponding reverse link function. + + Unlike the `scoring` parameter commonly used in scikit-learn, when a callable + object is provided, it's assumed to be a cost function and by default XGBoost + will minimize the result during early stopping. + + For advanced usage on Early stopping like directly choosing to maximize instead + of minimize, see :py:obj:`xgboost.callback.EarlyStopping`. + + See :doc:`/tutorials/custom_metric_obj` and :ref:`custom-obj-metric` for more + information. + + .. code-block:: python + + from sklearn.datasets import load_diabetes + from sklearn.metrics import mean_absolute_error + X, y = load_diabetes(return_X_y=True) + reg = xgb.XGBRegressor( + tree_method="hist", + eval_metric=mean_absolute_error, + ) + reg.fit(X, y, eval_set=[(X, y)]) + + early_stopping_rounds : {Optional[int]} + + .. versionadded:: 1.6.0 + + - Activates early stopping. Validation metric needs to improve at least once in + every **early_stopping_rounds** round(s) to continue training. Requires at + least one item in **eval_set** in :py:meth:`fit`. + + - If early stopping occurs, the model will have two additional attributes: + :py:attr:`best_score` and :py:attr:`best_iteration`. These are used by the + :py:meth:`predict` and :py:meth:`apply` methods to determine the optimal + number of trees during inference. If users want to access the full model + (including trees built after early stopping), they can specify the + `iteration_range` in these inference methods. In addition, other utilities + like model plotting can also use the entire model. + + - If you prefer to discard the trees after `best_iteration`, consider using the + callback function :py:class:`xgboost.callback.EarlyStopping`. + + - If there's more than one item in **eval_set**, the last entry will be used for + early stopping. If there's more than one metric in **eval_metric**, the last + metric will be used for early stopping. + + callbacks : {Optional[List[TrainingCallback]]} + + List of callback functions that are applied at end of each iteration. + It is possible to use predefined callbacks by using + :ref:`Callback API `. + + .. note:: + + States in callback are not preserved during training, which means callback + objects can not be reused for multiple training sessions without + reinitialization or deepcopy. + + .. code-block:: python + + for params in parameters_grid: + # be sure to (re)initialize the callbacks before each run + callbacks = [xgb.callback.LearningRateScheduler(custom_rates)] + reg = xgboost.XGBRegressor(**params, callbacks=callbacks) + reg.fit(X, y) + + kwargs : {Optional[Any]} + + Keyword arguments for XGBoost Booster object. Full documentation of parameters + can be found :doc:`here `. + Attempting to set a parameter via the constructor args and \\*\\*kwargs + dict simultaneously will result in a TypeError. + + .. note:: \\*\\*kwargs unsupported by scikit-learn + + \\*\\*kwargs is unsupported by scikit-learn. We do not guarantee + that parameters passed via this argument will interact properly + with scikit-learn. +""" + +__custom_obj_note = """ + .. note:: Custom objective function + + A custom objective function can be provided for the ``objective`` + parameter. In this case, it should have the signature ``objective(y_true, + y_pred) -> [grad, hess]`` or ``objective(y_true, y_pred, *, sample_weight) + -> [grad, hess]``: + + y_true: array_like of shape [n_samples] + The target values + y_pred: array_like of shape [n_samples] + The predicted values + sample_weight : + Optional sample weights. + + grad: array_like of shape [n_samples] + The value of the gradient for each sample point. + hess: array_like of shape [n_samples] + The value of the second derivative for each sample point + + Note that, if the custom objective produces negative values for + the Hessian, these will be clipped. If the objective is non-convex, + one might also consider using the expected Hessian (Fisher + information) instead. +""" + +TDoc = TypeVar("TDoc", bound=Type) + + +def xgboost_model_doc( + header: str, + items: List[str], + extra_parameters: Optional[str] = None, + end_note: Optional[str] = None, +) -> Callable[[TDoc], TDoc]: + """Obtain documentation for Scikit-Learn wrappers + + Parameters + ---------- + header: str + An introducion to the class. + items : list + A list of common doc items. Available items are: + - estimators: the meaning of n_estimators + - model: All the other parameters + - objective: note for customized objective + extra_parameters: str + Document for class specific parameters, placed at the head. + end_note: str + Extra notes put to the end.""" + + def get_doc(item: str) -> str: + """Return selected item""" + __doc = { + "estimators": __estimator_doc, + "model": __model_doc, + "objective": __custom_obj_note, + } + return __doc[item] + + def adddoc(cls: TDoc) -> TDoc: + doc = [""" +Parameters +---------- +"""] + if extra_parameters: + doc.append(extra_parameters) + doc.extend([get_doc(i) for i in items]) + if end_note: + doc.append(end_note) + full_doc = [ + header + "\nSee :doc:`/python/sklearn_estimator` for more information.\n" + ] + full_doc.extend(doc) + cls.__doc__ = "".join(full_doc) + return cls + + return adddoc + + +def get_model_categories( + X: ArrayLike, + model: Optional[Union[Booster, str]], + feature_types: Optional[FeatureTypes], +) -> Tuple[Optional[Union[Booster, str]], Optional[Union[FeatureTypes, Categories]]]: + """Extract the optional reference categories from the booster. Used for training + continuation. The result should be passed to the :py:func:`pick_ref_categories`. + + """ + # Skip if it's not a dataframe as there's no new encoding to be recoded. + # + # This function helps override the `feature_types` parameter. The `feature_types` + # from user is not useful when input is a dataframe as the real feature type should + # be encoded into the DF. + if model is None or not is_dataframe(X): + return model, feature_types + + if isinstance(model, str): + model = Booster(model_file=model) + + categories = model.get_categories() + if not categories.empty(): + # override the `feature_types`. + return model, categories + # Convert empty into None. + return model, feature_types + + +def pick_ref_categories( + X: Any, + model_cats: Optional[Union[FeatureTypes, Categories]], + Xy_cats: Optional[Categories], +) -> Optional[Union[FeatureTypes, Categories]]: + """Use the reference categories from the model. If none, then use the reference + categories from the training DMatrix. + + Parameters + ---------- + X : + Input feature matrix. + + model_cats : + Optional categories stored in the previous model (training continuation). This + should come from the :py:func:`get_model_categories`. + + Xy_cats : + Optional categories from the training DMatrix. Used for re-coding the validation + dataset. + + """ + categories: Optional[Categories] = None + if not isinstance(model_cats, Categories) and is_dataframe(X): + categories = Xy_cats + if categories is not None and not categories.empty(): + model_cats = categories + + return model_cats + + +def _wrap_evaluation_matrices( + *, + missing: float, + X: Any, + y: Any, + group: Optional[Any], + qid: Optional[Any], + sample_weight: Optional[Any], + base_margin: Optional[Any], + feature_weights: Optional[ArrayLike], + eval_set: Optional[Sequence[Tuple[Any, Any]]], + sample_weight_eval_set: Optional[Sequence[Any]], + base_margin_eval_set: Optional[Sequence[Any]], + eval_group: Optional[Sequence[Any]], + eval_qid: Optional[Sequence[Any]], + create_dmatrix: Callable, + enable_categorical: bool, + feature_types: Optional[Union[FeatureTypes, Categories]], +) -> Tuple[Any, List[Tuple[Any, str]]]: + """Convert array_like evaluation matrices into DMatrix. Perform sanity checks on the + way. + + """ + # Feature_types contains the optional reference categories from the booster object. + train_dmatrix = create_dmatrix( + data=X, + label=y, + group=group, + qid=qid, + weight=sample_weight, + base_margin=base_margin, + feature_weights=feature_weights, + missing=missing, + enable_categorical=enable_categorical, + feature_types=feature_types, + ref=None, + ) + + n_validation = 0 if eval_set is None else len(eval_set) + if hasattr(train_dmatrix, "get_categories"): + Xy_cats = train_dmatrix.get_categories() + else: + Xy_cats = None + + def validate_or_none(meta: Optional[Sequence], name: str) -> Sequence: + if meta is None: + return [None] * n_validation + if len(meta) != n_validation: + raise ValueError( + f"{name}'s length does not equal `eval_set`'s length, " + + f"expecting {n_validation}, got {len(meta)}" + ) + return meta + + if eval_set is not None: + sample_weight_eval_set = validate_or_none( + sample_weight_eval_set, "sample_weight_eval_set" + ) + base_margin_eval_set = validate_or_none( + base_margin_eval_set, "base_margin_eval_set" + ) + eval_group = validate_or_none(eval_group, "eval_group") + eval_qid = validate_or_none(eval_qid, "eval_qid") + + evals = [] + for i, (valid_X, valid_y) in enumerate(eval_set): + # Skip the entry if it's the training DMatrix. + if all( + ( + valid_X is X, + valid_y is y, + sample_weight_eval_set[i] is sample_weight, + base_margin_eval_set[i] is base_margin, + eval_group[i] is group, + eval_qid[i] is qid, + ) + ): + evals.append(train_dmatrix) + continue + + feature_types = pick_ref_categories(valid_X, feature_types, Xy_cats) + m = create_dmatrix( + data=valid_X, + label=valid_y, + weight=sample_weight_eval_set[i], + group=eval_group[i], + qid=eval_qid[i], + base_margin=base_margin_eval_set[i], + missing=missing, + enable_categorical=enable_categorical, + feature_types=feature_types, + ref=train_dmatrix, + ) + evals.append(m) + + nevals = len(evals) + eval_names = [f"validation_{i}" for i in range(nevals)] + evals = list(zip(evals, eval_names)) + else: + if any( + meta is not None + for meta in [ + sample_weight_eval_set, + base_margin_eval_set, + eval_group, + eval_qid, + ] + ): + raise ValueError( + "`eval_set` is not set but one of the other evaluation meta info is " + "not None." + ) + evals = [] + + return train_dmatrix, evals + + +DEFAULT_N_ESTIMATORS = 100 + + +@xgboost_model_doc( + """Implementation of the Scikit-Learn API for XGBoost.""", + ["estimators", "model", "objective"], +) +class XGBModel(XGBModelBase): + # pylint: disable=too-many-arguments, too-many-instance-attributes, missing-docstring + @_deprecate_positional_args + def __init__( + self, + *, + max_depth: Optional[int] = None, + max_leaves: Optional[int] = None, + max_bin: Optional[int] = None, + grow_policy: Optional[str] = None, + learning_rate: Optional[float] = None, + n_estimators: Optional[int] = None, + verbosity: Optional[int] = None, + objective: SklObjective = None, + booster: Optional[str] = None, + tree_method: Optional[str] = None, + n_jobs: Optional[int] = None, + gamma: Optional[float] = None, + min_child_weight: Optional[float] = None, + max_delta_step: Optional[float] = None, + subsample: Optional[float] = None, + sampling_method: Optional[str] = None, + colsample_bytree: Optional[float] = None, + colsample_bylevel: Optional[float] = None, + colsample_bynode: Optional[float] = None, + reg_alpha: Optional[float] = None, + reg_lambda: Optional[float] = None, + scale_pos_weight: Optional[float] = None, + base_score: Optional[Union[float, List[float]]] = None, + random_state: Optional[ + Union[np.random.RandomState, np.random.Generator, int] + ] = None, + missing: float = np.nan, + num_parallel_tree: Optional[int] = None, + monotone_constraints: Optional[Union[Dict[str, int], str]] = None, + interaction_constraints: Optional[Union[str, Sequence[Sequence[str]]]] = None, + importance_type: Optional[str] = None, + device: Optional[str] = None, + validate_parameters: Optional[bool] = None, + enable_categorical: bool = False, + feature_types: Optional[FeatureTypes] = None, + feature_weights: Optional[ArrayLike] = None, + max_cat_to_onehot: Optional[int] = None, + max_cat_threshold: Optional[int] = None, + multi_strategy: Optional[str] = None, + eval_metric: Optional[Union[str, List[Union[str, Callable]], Callable]] = None, + early_stopping_rounds: Optional[int] = None, + callbacks: Optional[List[TrainingCallback]] = None, + **kwargs: Any, + ) -> None: + if not SKLEARN_INSTALLED: + raise ImportError( + "sklearn needs to be installed in order to use this module" + ) + self.n_estimators = n_estimators + self.objective = objective + + self.max_depth = max_depth + self.max_leaves = max_leaves + self.max_bin = max_bin + self.grow_policy = grow_policy + self.learning_rate = learning_rate + self.verbosity = verbosity + self.booster = booster + self.tree_method = tree_method + self.gamma = gamma + self.min_child_weight = min_child_weight + self.max_delta_step = max_delta_step + self.subsample = subsample + self.sampling_method = sampling_method + self.colsample_bytree = colsample_bytree + self.colsample_bylevel = colsample_bylevel + self.colsample_bynode = colsample_bynode + self.reg_alpha = reg_alpha + self.reg_lambda = reg_lambda + self.scale_pos_weight = scale_pos_weight + self.base_score = base_score + self.missing = missing + self.num_parallel_tree = num_parallel_tree + self.random_state = random_state + self.n_jobs = n_jobs + self.monotone_constraints = monotone_constraints + self.interaction_constraints = interaction_constraints + self.importance_type = importance_type + self.device = device + self.validate_parameters = validate_parameters + self.enable_categorical = enable_categorical + self.feature_types = feature_types + if isinstance(self.feature_types, Categories): + raise TypeError( + "If you are training with a prior model (training continuation), " + "The scikit-learn interface can automatically reuse the categories from" + " that model." + ) + self.feature_weights = feature_weights + self.max_cat_to_onehot = max_cat_to_onehot + self.max_cat_threshold = max_cat_threshold + self.multi_strategy = multi_strategy + self.eval_metric = eval_metric + self.early_stopping_rounds = early_stopping_rounds + self.callbacks = callbacks + if kwargs: + self.kwargs = kwargs + + def _more_tags(self) -> Dict[str, bool]: + """Tags used for scikit-learn data validation.""" + tags = {"allow_nan": True, "no_validation": True, "sparse": True} + if hasattr(self, "kwargs") and self.kwargs.get("updater") == "shotgun": + tags["non_deterministic"] = True + + tags["categorical"] = self.enable_categorical + tags["string"] = self.enable_categorical + return tags + + @staticmethod + def _update_sklearn_tags_from_dict( + *, + tags: _sklearn_Tags, + tags_dict: Dict[str, bool], + ) -> _sklearn_Tags: + """Update ``sklearn.utils.Tags`` inherited from ``scikit-learn`` base classes. + + ``scikit-learn`` 1.6 introduced a dataclass-based interface for estimator tags. + ref: https://github.com/scikit-learn/scikit-learn/pull/29677 + + This method handles updating that instance based on the values in + ``self._more_tags()``. + + """ + tags.non_deterministic = tags_dict.get("non_deterministic", False) + tags.no_validation = tags_dict["no_validation"] + tags.input_tags.allow_nan = tags_dict["allow_nan"] + tags.input_tags.sparse = tags_dict["sparse"] + tags.input_tags.categorical = tags_dict["categorical"] + return tags + + def __sklearn_tags__(self) -> _sklearn_Tags: + # XGBModelBase.__sklearn_tags__() cannot be called unconditionally, + # because that method isn't defined for scikit-learn<1.6 + if not hasattr(XGBModelBase, "__sklearn_tags__"): + err_msg = ( + "__sklearn_tags__() should not be called when using scikit-learn<1.6. " + f"Detected version: {_sklearn_version}" + ) + raise AttributeError(err_msg) + + # take whatever tags are provided by BaseEstimator, then modify + # them with XGBoost-specific values + return self._update_sklearn_tags_from_dict( + tags=super().__sklearn_tags__(), # pylint: disable=no-member + tags_dict=self._more_tags(), + ) + + def __sklearn_is_fitted__(self) -> bool: + return hasattr(self, "_Booster") + + @property + def _doc_link_module(self) -> str: + return "xgboost" + + @property + def _doc_link_template(self) -> str: + ver = _py_version() + (major, minor, _), post = _parse_version(ver) + + if post == "dev": + rel = "latest" + else: + # RTD tracks the release branch. We don't have independent branches for + # patch releases. + rel = f"release_{major}.{minor}.0" + + module = self.__class__.__module__ + # All sklearn estimators are forwarded to the top level module in both source + # code and sphinx api doc. + if module == "xgboost.sklearn": + module = module.split(".")[0] + name = self.__class__.__name__ + + base = "https://xgboost.readthedocs.io/en" + return f"{base}/{rel}/python/python_api.html#{module}.{name}" + + def _wrapper_params(self) -> Set[str]: + wrapper_specific = { + "importance_type", + "kwargs", + "missing", + "n_estimators", + "enable_categorical", + "early_stopping_rounds", + "callbacks", + "feature_types", + "feature_weights", + } + return wrapper_specific + + def get_booster(self) -> Booster: + """Get the underlying xgboost Booster of this model. + + This will raise an exception when fit was not called + + Returns + ------- + booster : a xgboost booster of underlying model + """ + if not self.__sklearn_is_fitted__(): + from sklearn.exceptions import NotFittedError + + raise NotFittedError("need to call fit or load_model beforehand") + return self._Booster + + def set_params(self, **params: Any) -> "XGBModel": + """Set the parameters of this estimator. Modification of the sklearn method to + allow unknown kwargs. This allows using the full range of xgboost + parameters that are not defined as member variables in sklearn grid + search. + + Returns + ------- + self + + """ + if not params: + # Simple optimization to gain speed (inspect is slow) + return self + + # this concatenates kwargs into parameters, enabling `get_params` for + # obtaining parameters from keyword parameters. + for key, value in params.items(): + if hasattr(self, key): + setattr(self, key, value) + else: + if not hasattr(self, "kwargs"): + self.kwargs = {} + self.kwargs[key] = value + + if self.__sklearn_is_fitted__(): + parameters = self.get_xgb_params() + self.get_booster().set_param(parameters) + + return self + + def get_params(self, deep: bool = True) -> Dict[str, Any]: + # pylint: disable=attribute-defined-outside-init + """Get parameters.""" + # Based on: https://stackoverflow.com/questions/59248211 + # The basic flow in `get_params` is: + # 0. Return parameters in subclass (self.__class__) first, by using inspect. + # 1. Return parameters in all parent classes (especially `XGBModel`). + # 2. Return whatever in `**kwargs`. + # 3. Merge them. + # + # This needs to accommodate being called recursively in the following + # inheritance graphs (and similar for classification and ranking): + # + # XGBRFRegressor -> XGBRegressor -> XGBModel -> BaseEstimator + # XGBRegressor -> XGBModel -> BaseEstimator + # XGBModel -> BaseEstimator + # + params = super().get_params(deep) # pylint: disable=no-member + cp = copy.copy(self) + # If the immediate parent defines get_params(), use that. + if callable(getattr(cp.__class__.__bases__[0], "get_params", None)): + cp.__class__ = cp.__class__.__bases__[0] + # Otherwise, skip it and assume the next class will have it. + # This is here primarily for cases where the first class in MRO is a scikit-learn mixin. + else: + cp.__class__ = cp.__class__.__bases__[1] + params.update(cp.__class__.get_params(cp, deep)) + # if kwargs is a dict, update params accordingly + if hasattr(self, "kwargs") and isinstance(self.kwargs, dict): + params.update(self.kwargs) + if isinstance(params["random_state"], np.random.RandomState): + params["random_state"] = params["random_state"].randint( + np.iinfo(np.int32).max + ) + elif isinstance(params["random_state"], np.random.Generator): + params["random_state"] = int( + params["random_state"].integers(np.iinfo(np.int32).max) + ) + + return params + + def get_xgb_params(self) -> Dict[str, Any]: + """Get xgboost specific parameters.""" + params: Dict[str, Any] = self.get_params() + + # Parameters that should not go into native learner. + wrapper_specific = self._wrapper_params() + filtered = {} + for k, v in params.items(): + if k not in wrapper_specific and not callable(v): + filtered[k] = v + + return filtered + + def get_num_boosting_rounds(self) -> int: + """Gets the number of xgboost boosting rounds.""" + return DEFAULT_N_ESTIMATORS if self.n_estimators is None else self.n_estimators + + def _get_type(self) -> str: + if hasattr(self, "_estimator_type"): # scikit-learn <1.8 + return self._estimator_type # pylint: disable=no-member + if hasattr(XGBModelBase, "__sklearn_tags__"): # scikit-learn 1.8+ + return self.__sklearn_tags__().estimator_type + raise TypeError( + "`_estimator_type` undefined. " + "Please use appropriate mixin to define estimator type." + ) + + def save_model(self, fname: Union[str, os.PathLike]) -> None: + meta: Dict[str, Any] = {} + # For validation. + meta["_estimator_type"] = self._get_type() + meta_str = json.dumps(meta) + self.get_booster().set_attr(scikit_learn=meta_str) + self.get_booster().save_model(fname) + self.get_booster().set_attr(scikit_learn=None) + + save_model.__doc__ = f"""{Booster.save_model.__doc__}""" + + def load_model(self, fname: ModelIn) -> None: + # pylint: disable=attribute-defined-outside-init + if not self.__sklearn_is_fitted__(): + self._Booster = Booster({"n_jobs": self.n_jobs}) + self.get_booster().load_model(fname) + + meta_str = self.get_booster().attr("scikit_learn") + if meta_str is not None: + meta = json.loads(meta_str) + t = meta.get("_estimator_type", None) + if t is not None and t != self._get_type(): + raise TypeError( + "Loading an estimator with different type. Expecting: " + f"{self._get_type()}, got: {t}" + ) + + self.get_booster().set_attr(scikit_learn=None) + config = json.loads(self.get_booster().save_config()) + self._load_model_attributes(config) + + load_model.__doc__ = f"""{Booster.load_model.__doc__}""" + + def _load_model_attributes(self, config: dict) -> None: + """Load model attributes without hyper-parameters.""" + from sklearn.base import is_classifier + + booster = self.get_booster() + + self.objective = config["learner"]["objective"]["name"] + self.booster = config["learner"]["gradient_booster"]["name"] + self.base_score = json.loads( + config["learner"]["learner_model_param"]["base_score"] + ) + self.feature_types = booster.feature_types + self.enable_categorical = self.feature_types is not None and any( + ft == CAT_T for ft in self.feature_types + ) + + if is_classifier(self): + self.n_classes_ = int(config["learner"]["learner_model_param"]["num_class"]) + # binary classification is treated as regression in XGBoost. + self.n_classes_ = 2 if self.n_classes_ < 2 else self.n_classes_ + + # pylint: disable=too-many-branches + def _configure_fit( + self, + booster: Optional[Union[Booster, "XGBModel", str]], + params: Dict[str, Any], + feature_weights: Optional[ArrayLike], + ) -> Tuple[ + Optional[Union[Booster, str, "XGBModel"]], + Optional[Metric], + Dict[str, Any], + Optional[ArrayLike], + ]: + """Configure parameters for :py:meth:`fit`.""" + if isinstance(booster, XGBModel): + model: Optional[Union[Booster, str]] = booster.get_booster() + else: + model = booster + + def _deprecated(parameter: str) -> None: + warnings.warn( + f"`{parameter}` in `fit` method is deprecated for better compatibility " + f"with scikit-learn, use `{parameter}` in constructor or`set_params` " + "instead.", + UserWarning, + ) + + def _duplicated(parameter: str) -> None: + raise ValueError( + f"2 different `{parameter}` are provided. Use the one in constructor " + "or `set_params` instead." + ) + + # - configure callable evaluation metric + metric: Optional[Metric] = None + + def custom_metric(m: Callable) -> Metric: + if self._get_type() == "ranker": + wrapped = ltr_metric_decorator(m, self.n_jobs) + else: + wrapped = _metric_decorator(m) + return wrapped + + def invalid_type(m: Any) -> None: + msg = f"Invalid type for the `eval_metric`: {type(m)}" + raise TypeError(msg) + + if self.eval_metric is not None: + if callable(self.eval_metric): + metric = custom_metric(self.eval_metric) + elif isinstance(self.eval_metric, str): + params.update({"eval_metric": self.eval_metric}) + else: + # A sequence of metrics + if not isinstance(self.eval_metric, collections.abc.Sequence): + invalid_type(self.eval_metric) + # Could be a list of strings or callables + builtin_metrics: List[str] = [] + for m in self.eval_metric: + if callable(m): + if metric is not None: + raise NotImplementedError( + "Using multiple custom metrics is not yet supported." + ) + metric = custom_metric(m) + elif isinstance(m, str): + builtin_metrics.append(m) + else: + invalid_type(m) + if builtin_metrics: + params.update({"eval_metric": builtin_metrics}) + + if feature_weights is not None: + _deprecated("feature_weights") + if feature_weights is not None and self.feature_weights is not None: + _duplicated("feature_weights") + feature_weights = ( + self.feature_weights + if self.feature_weights is not None + else feature_weights + ) + + tree_method = params.get("tree_method", None) + if self.enable_categorical and tree_method == "exact": + raise ValueError( + "Experimental support for categorical data is not implemented for" + " current tree method yet." + ) + return model, metric, params, feature_weights + + def _create_dmatrix(self, ref: Optional[DMatrix], **kwargs: Any) -> DMatrix: + # Use `QuantileDMatrix` to save memory. + if _can_use_qdm(self.tree_method, self.device) and self.booster != "gblinear": + try: + return QuantileDMatrix( + **kwargs, ref=ref, nthread=self.n_jobs, max_bin=self.max_bin + ) + except TypeError: # `QuantileDMatrix` supports lesser types than DMatrix + pass + return DMatrix(**kwargs, nthread=self.n_jobs) + + def _set_evaluation_result(self, evals_result: EvalsLog) -> None: + if evals_result: + self.evals_result_ = cast(Dict[str, Dict[str, List[float]]], evals_result) + + @_deprecate_positional_args + def fit( + self, + X: ArrayLike, + y: ArrayLike, + *, + sample_weight: Optional[ArrayLike] = None, + base_margin: Optional[ArrayLike] = None, + eval_set: Optional[Sequence[Tuple[ArrayLike, ArrayLike]]] = None, + verbose: Optional[Union[bool, int]] = True, + xgb_model: Optional[Union[Booster, str, "XGBModel"]] = None, + sample_weight_eval_set: Optional[Sequence[ArrayLike]] = None, + base_margin_eval_set: Optional[Sequence[ArrayLike]] = None, + feature_weights: Optional[ArrayLike] = None, + ) -> "XGBModel": + # pylint: disable=attribute-defined-outside-init + """Fit gradient boosting model. + + Note that calling ``fit()`` multiple times will cause the model object to be + re-fit from scratch. To resume training from a previous checkpoint, explicitly + pass ``xgb_model`` argument. + + Parameters + ---------- + X : + Input feature matrix. See :ref:`py-data` for a list of supported types. + + When the ``tree_method`` is set to ``hist``, internally, the + :py:class:`QuantileDMatrix` will be used instead of the :py:class:`DMatrix` + for conserving memory. However, this has performance implications when the + device of input data is not matched with algorithm. For instance, if the + input is a numpy array on CPU but ``cuda`` is used for training, then the + data is first processed on CPU then transferred to GPU. + y : + Labels + sample_weight : + instance weights + base_margin : + Global bias for each instance. See :doc:`/tutorials/intercept` for details. + eval_set : + A list of (X, y) tuple pairs to use as validation sets, for which + metrics will be computed. + Validation metrics will help us track the performance of the model. + + verbose : + If `verbose` is True and an evaluation set is used, the evaluation metric + measured on the validation set is printed to stdout at each boosting stage. + If `verbose` is an integer, the evaluation metric is printed at each + `verbose` boosting stage. The last boosting stage / the boosting stage found + by using `early_stopping_rounds` is also printed. + xgb_model : + file name of stored XGBoost model or 'Booster' instance XGBoost model to be + loaded before training (allows training continuation). + sample_weight_eval_set : + A list of the form [L_1, L_2, ..., L_n], where each L_i is an array like + object storing instance weights for the i-th validation set. + base_margin_eval_set : + A list of the form [M_1, M_2, ..., M_n], where each M_i is an array like + object storing base margin for the i-th validation set. + feature_weights : + + .. deprecated:: 3.0.0 + + Use `feature_weights` in :py:meth:`__init__` or :py:meth:`set_params` + instead. + + """ + with config_context(verbosity=self.verbosity): + params = self.get_xgb_params() + model, metric, params, feature_weights = self._configure_fit( + xgb_model, params, feature_weights + ) + model, feature_types = get_model_categories(X, model, self.feature_types) + + evals_result: EvalsLog = {} + train_dmatrix, evals = _wrap_evaluation_matrices( + missing=self.missing, + X=X, + y=y, + group=None, + qid=None, + sample_weight=sample_weight, + base_margin=base_margin, + feature_weights=feature_weights, + eval_set=eval_set, + sample_weight_eval_set=sample_weight_eval_set, + base_margin_eval_set=base_margin_eval_set, + eval_group=None, + eval_qid=None, + create_dmatrix=self._create_dmatrix, + enable_categorical=self.enable_categorical, + feature_types=feature_types, + ) + + if callable(self.objective): + obj: Optional[PlainObj] = _objective_decorator(self.objective) + params["objective"] = "reg:squarederror" + else: + obj = None + + self._Booster = train( + params, + train_dmatrix, + self.get_num_boosting_rounds(), + evals=evals, + early_stopping_rounds=self.early_stopping_rounds, + evals_result=evals_result, + obj=obj, + custom_metric=metric, + verbose_eval=verbose, + xgb_model=model, + callbacks=self.callbacks, + ) + + self._set_evaluation_result(evals_result) + return self + + def _can_use_inplace_predict(self) -> bool: + return self.booster != "gblinear" + + def _get_iteration_range( + self, iteration_range: Optional[IterationRange] + ) -> IterationRange: + if iteration_range is None or iteration_range[1] == 0: + # Use best_iteration if defined. + try: + iteration_range = (0, self.best_iteration + 1) + except AttributeError: + iteration_range = (0, 0) + if self.booster == "gblinear": + iteration_range = (0, 0) + return iteration_range + + @_deprecate_positional_args + def predict( + self, + X: ArrayLike, + *, + output_margin: bool = False, + validate_features: bool = True, + base_margin: Optional[ArrayLike] = None, + iteration_range: Optional[IterationRange] = None, + ) -> ArrayLike: + """Predict with `X`. If the model is trained with early stopping, then + :py:attr:`best_iteration` is used automatically. The estimator uses + `inplace_predict` by default and falls back to using :py:class:`DMatrix` if + devices between the data and the estimator don't match. + + .. note:: This function is only thread safe for `gbtree` and `dart`. + + Parameters + ---------- + X : + Data to predict with. See :ref:`py-data` for a list of supported types. + output_margin : + Whether to output the raw untransformed margin value. + validate_features : + When this is True, validate that the Booster's and data's feature_names are + identical. Otherwise, it is assumed that the feature_names are the same. + base_margin : + Global bias for each instance. See :doc:`/tutorials/intercept` for details. + iteration_range : + Specifies which layer of trees are used in prediction. For example, if a + random forest is trained with 100 rounds. Specifying ``iteration_range=(10, + 20)``, then only the forests built during [10, 20) (half open set) rounds + are used in this prediction. + + .. versionadded:: 1.4.0 + + Returns + ------- + prediction + + """ + with config_context(verbosity=self.verbosity): + iteration_range = self._get_iteration_range(iteration_range) + if self._can_use_inplace_predict(): + try: + predts = self.get_booster().inplace_predict( + data=X, + iteration_range=iteration_range, + predict_type="margin" if output_margin else "value", + missing=self.missing, + base_margin=base_margin, + validate_features=validate_features, + ) + if _is_cupy_alike(predts): + cp = import_cupy() + + predts = cp.asnumpy(predts) # ensure numpy array is used. + return predts + except TypeError: + # coo, csc, dt + pass + + test = DMatrix( + X, + base_margin=base_margin, + missing=self.missing, + nthread=self.n_jobs, + feature_types=self.feature_types, + enable_categorical=self.enable_categorical, + ) + return self.get_booster().predict( + data=test, + iteration_range=iteration_range, + output_margin=output_margin, + validate_features=validate_features, + ) + + def apply( + self, + X: ArrayLike, + iteration_range: Optional[IterationRange] = None, + ) -> np.ndarray: + """Return the predicted leaf every tree for each sample. If the model is trained + with early stopping, then :py:attr:`best_iteration` is used automatically. + + Parameters + ---------- + X : + Input features matrix. See :ref:`py-data` for a list of supported types. + + iteration_range : + See :py:meth:`predict`. + + Returns + ------- + X_leaves : array_like, shape=[n_samples, n_trees] + For each datapoint x in X and for each tree, return the index of the + leaf x ends up in. Leaves are numbered within + ``[0; 2**(self.max_depth+1))``, possibly with gaps in the numbering. + + """ + with config_context(verbosity=self.verbosity): + iteration_range = self._get_iteration_range(iteration_range) + test_dmatrix = DMatrix( + X, + missing=self.missing, + feature_types=self.feature_types, + nthread=self.n_jobs, + enable_categorical=self.enable_categorical, + ) + return self.get_booster().predict( + test_dmatrix, pred_leaf=True, iteration_range=iteration_range + ) + + def evals_result(self) -> Dict[str, Dict[str, List[float]]]: + """Return the evaluation results. + + If **eval_set** is passed to the :py:meth:`fit` function, you can call + ``evals_result()`` to get evaluation results for all passed **eval_sets**. When + **eval_metric** is also passed to the :py:meth:`fit` function, the + **evals_result** will contain the **eval_metrics** passed to the :py:meth:`fit` + function. + + The returned evaluation result is a dictionary: + + .. code-block:: python + + {'validation_0': {'logloss': ['0.604835', '0.531479']}, + 'validation_1': {'logloss': ['0.41965', '0.17686']}} + + Returns + ------- + evals_result + + """ + if getattr(self, "evals_result_", None) is not None: + evals_result = self.evals_result_ + else: + raise XGBoostError( + "No evaluation result, `eval_set` is not used during training." + ) + + return evals_result + + @property + def n_features_in_(self) -> int: + """Number of features seen during :py:meth:`fit`.""" + booster = self.get_booster() + return booster.num_features() + + @property + def feature_names_in_(self) -> np.ndarray: + """Names of features seen during :py:meth:`fit`. Defined only when `X` has + feature names that are all strings. + + """ + feature_names = self.get_booster().feature_names + if feature_names is None: + raise AttributeError( + "`feature_names_in_` is defined only when `X` has feature names that " + "are all strings." + ) + return np.array(feature_names) + + @property + def best_score(self) -> float: + """The best score obtained by early stopping.""" + return self.get_booster().best_score + + @property + def best_iteration(self) -> int: + """The best iteration obtained by early stopping. This attribute is 0-based, + for instance if the best iteration is the first round, then best_iteration is 0. + + """ + return self.get_booster().best_iteration + + @property + def feature_importances_(self) -> np.ndarray: + """Feature importances property, return depends on `importance_type` + parameter. When model trained with multi-class/multi-label/multi-target dataset, + the feature importance is "averaged" over all targets. The "average" is defined + based on the importance type. For instance, if the importance type is + "total_gain", then the score is sum of loss change for each split from all + trees. + + Returns + ------- + feature_importances_ : array of shape ``[n_features]`` except for multi-class + linear model, which returns an array with shape `(n_features, n_classes)` + + """ + b: Booster = self.get_booster() + + def dft() -> str: + return "weight" if self.booster == "gblinear" else "gain" + + score = b.get_score( + importance_type=self.importance_type if self.importance_type else dft() + ) + if b.feature_names is None: + feature_names: FeatureNames = [f"f{i}" for i in range(self.n_features_in_)] + else: + feature_names = b.feature_names + # gblinear returns all features so the `get` in next line is only for gbtree. + all_features = [score.get(f, 0.0) for f in feature_names] + all_features_arr = np.array(all_features, dtype=np.float32) + total = all_features_arr.sum() + if total == 0: + return all_features_arr + return all_features_arr / total + + @property + def coef_(self) -> np.ndarray: + """ + Coefficients property + + .. note:: Coefficients are defined only for linear learners + + Coefficients are only defined when the linear model is chosen as + base learner (`booster=gblinear`). It is not defined for other base + learner types, such as tree learners (`booster=gbtree`). + + Returns + ------- + coef_ : array of shape ``[n_features]`` or ``[n_classes, n_features]`` + """ + if self.get_xgb_params()["booster"] != "gblinear": + raise AttributeError( + f"Coefficients are not defined for Booster type {self.booster}" + ) + b = self.get_booster() + coef = np.array(json.loads(b.get_dump(dump_format="json")[0])["weight"]) + # Logic for multiclass classification + n_classes = getattr(self, "n_classes_", None) + if n_classes is not None: + if n_classes > 2: + assert len(coef.shape) == 1 + assert coef.shape[0] % n_classes == 0 + coef = coef.reshape((n_classes, -1)) + return coef + + @property + def intercept_(self) -> np.ndarray: + """Intercept (bias) property + + For tree-based model, the returned value is the `base_score`. + + Returns + ------- + intercept_ : array of shape ``(1,)`` or ``[n_classes]`` + + """ + booster_config = self.get_xgb_params()["booster"] + b = self.get_booster() + if booster_config != "gblinear": # gbtree, dart + config = json.loads(b.save_config()) + intercept = json.loads( + config["learner"]["learner_model_param"]["base_score"] + ) + return np.array(intercept, dtype=np.float32) + + return np.array( + json.loads(b.get_dump(dump_format="json")[0])["bias"], dtype=np.float32 + ) + + +PredtT = TypeVar("PredtT", bound=np.ndarray) + + +def _cls_predict_proba(n_classes: int, prediction: PredtT, vstack: Callable) -> PredtT: + assert len(prediction.shape) <= 2 + if len(prediction.shape) == 2 and prediction.shape[1] == n_classes: + # multi-class + return prediction + if ( + len(prediction.shape) == 2 + and n_classes == 2 + and prediction.shape[1] >= n_classes + ): + # multi-label + return prediction + # binary logistic function + classone_probs = prediction + classzero_probs = 1.0 - classone_probs + return vstack((classzero_probs, classone_probs)).transpose() + + +@xgboost_model_doc( + "Implementation of the scikit-learn API for XGBoost classification.", + ["model", "objective"], + extra_parameters=""" + n_estimators : Optional[int] + Number of boosting rounds. +""", +) +class XGBClassifier(XGBClassifierBase, XGBModel): + # pylint: disable=missing-docstring,too-many-instance-attributes + @_deprecate_positional_args + def __init__( + self, + *, + objective: SklObjective = "binary:logistic", + **kwargs: Any, + ) -> None: + super().__init__(objective=objective, **kwargs) + + def _more_tags(self) -> Dict[str, bool]: + tags = super()._more_tags() + tags["multilabel"] = True + return tags + + def __sklearn_tags__(self) -> _sklearn_Tags: + tags = super().__sklearn_tags__() + tags_dict = self._more_tags() + tags.classifier_tags.multi_label = tags_dict["multilabel"] + return tags + + @_deprecate_positional_args + def fit( + self, + X: ArrayLike, + y: ArrayLike, + *, + sample_weight: Optional[ArrayLike] = None, + base_margin: Optional[ArrayLike] = None, + eval_set: Optional[Sequence[Tuple[ArrayLike, ArrayLike]]] = None, + verbose: Optional[Union[bool, int]] = True, + xgb_model: Optional[Union[Booster, str, XGBModel]] = None, + sample_weight_eval_set: Optional[Sequence[ArrayLike]] = None, + base_margin_eval_set: Optional[Sequence[ArrayLike]] = None, + feature_weights: Optional[ArrayLike] = None, + ) -> "XGBClassifier": + # pylint: disable = attribute-defined-outside-init,too-many-statements + with config_context(verbosity=self.verbosity): + # We keep the n_classes_ as a simple member instead of loading it from + # booster in a Python property. This way we can have efficient and + # thread-safe prediction. + if _is_polars_lazyframe(y): + y = y.collect() + if _is_cudf_df(y) or _is_cudf_ser(y): + cp = import_cupy() + + classes = cp.unique(y.values) + self.n_classes_ = len(classes) + expected_classes = cp.array(self.classes_) + elif _is_cupy_alike(y): + cp = import_cupy() + + classes = cp.unique(y) + self.n_classes_ = len(classes) + expected_classes = cp.array(self.classes_) + else: + classes = np.unique(np.asarray(y)) + self.n_classes_ = len(classes) + expected_classes = self.classes_ + if ( + classes.shape != expected_classes.shape + or not (classes == expected_classes).all() + ): + raise ValueError( + f"Invalid classes inferred from unique values of `y`. " + f"Expected: {expected_classes}, got {classes}" + ) + + params = self.get_xgb_params() + + if callable(self.objective): + obj: Optional[PlainObj] = _objective_decorator(self.objective) + # Use default value. Is it really not used ? + params["objective"] = "binary:logistic" + else: + obj = None + + if self.n_classes_ > 2: + # Switch to using a multiclass objective in the underlying XGB instance + if params.get("objective", None) != "multi:softmax": + params["objective"] = "multi:softprob" + params["num_class"] = self.n_classes_ + + model, metric, params, feature_weights = self._configure_fit( + xgb_model, params, feature_weights + ) + model, feature_types = get_model_categories(X, model, self.feature_types) + + evals_result: EvalsLog = {} + train_dmatrix, evals = _wrap_evaluation_matrices( + missing=self.missing, + X=X, + y=y, + group=None, + qid=None, + sample_weight=sample_weight, + base_margin=base_margin, + feature_weights=feature_weights, + eval_set=eval_set, + sample_weight_eval_set=sample_weight_eval_set, + base_margin_eval_set=base_margin_eval_set, + eval_group=None, + eval_qid=None, + create_dmatrix=self._create_dmatrix, + enable_categorical=self.enable_categorical, + feature_types=feature_types, + ) + + self._Booster = train( + params, + train_dmatrix, + self.get_num_boosting_rounds(), + evals=evals, + early_stopping_rounds=self.early_stopping_rounds, + evals_result=evals_result, + obj=obj, + custom_metric=metric, + verbose_eval=verbose, + xgb_model=model, + callbacks=self.callbacks, + ) + + if not callable(self.objective): + self.objective = params["objective"] + + self._set_evaluation_result(evals_result) + return self + + assert XGBModel.fit.__doc__ is not None + fit.__doc__ = XGBModel.fit.__doc__.replace( + "Fit gradient boosting model", "Fit gradient boosting classifier", 1 + ) + + @_deprecate_positional_args + def predict( + self, + X: ArrayLike, + *, + output_margin: bool = False, + validate_features: bool = True, + base_margin: Optional[ArrayLike] = None, + iteration_range: Optional[IterationRange] = None, + ) -> ArrayLike: + with config_context(verbosity=self.verbosity): + class_probs = super().predict( + X=X, + output_margin=output_margin, + validate_features=validate_features, + base_margin=base_margin, + iteration_range=iteration_range, + ) + if output_margin: + # If output_margin is active, simply return the scores + return class_probs + + if len(class_probs.shape) > 1 and self.n_classes_ != 2: + # multi-class, turns softprob into softmax + column_indexes: np.ndarray = np.argmax(class_probs, axis=1) + elif len(class_probs.shape) > 1 and class_probs.shape[1] != 1: + # multi-label + column_indexes = np.zeros(class_probs.shape) + column_indexes[class_probs > 0.5] = 1 + elif self.objective == "multi:softmax": + return class_probs.astype(np.int32) + else: + # turns soft logit into class label + column_indexes = np.repeat(0, class_probs.shape[0]) + column_indexes[class_probs > 0.5] = 1 + + return column_indexes + + def predict_proba( + self, + X: ArrayLike, + validate_features: bool = True, + base_margin: Optional[ArrayLike] = None, + iteration_range: Optional[IterationRange] = None, + ) -> np.ndarray: + """Predict the probability of each `X` example being of a given class. If the + model is trained with early stopping, then :py:attr:`best_iteration` is used + automatically. The estimator uses `inplace_predict` by default and falls back to + using :py:class:`DMatrix` if devices between the data and the estimator don't + match. + + .. note:: This function is only thread safe for `gbtree` and `dart`. + + Parameters + ---------- + X : + Feature matrix. See :ref:`py-data` for a list of supported types. + validate_features : + When this is True, validate that the Booster's and data's feature_names are + identical. Otherwise, it is assumed that the feature_names are the same. + base_margin : + Global bias for each instance. See :doc:`/tutorials/intercept` for details. + iteration_range : + Specifies which layer of trees are used in prediction. For example, if a + random forest is trained with 100 rounds. Specifying `iteration_range=(10, + 20)`, then only the forests built during [10, 20) (half open set) rounds are + used in this prediction. + + Returns + ------- + prediction : + a numpy array of shape array-like of shape (n_samples, n_classes) with the + probability of each data example being of a given class. + + """ + # custom obj: Do nothing as we don't know what to do. + # softprob: Do nothing, output is proba. + # softmax: Use softmax from scipy + # binary:logistic: Expand the prob vector into 2-class matrix after predict. + # binary:logitraw: Unsupported by predict_proba() + if self.objective == "multi:softmax": + raw_predt = super().predict( + X=X, + validate_features=validate_features, + base_margin=base_margin, + iteration_range=iteration_range, + output_margin=True, + ) + class_prob = softmax(raw_predt, axis=1) + return class_prob + class_probs = super().predict( + X=X, + validate_features=validate_features, + base_margin=base_margin, + iteration_range=iteration_range, + ) + return _cls_predict_proba(self.n_classes_, class_probs, np.vstack) + + @property + def classes_(self) -> np.ndarray: + return np.arange(self.n_classes_) + + +@xgboost_model_doc( + "scikit-learn API for XGBoost random forest classification.", + ["model", "objective"], + extra_parameters=""" + n_estimators : Optional[int] + Number of trees in random forest to fit. +""", +) +class XGBRFClassifier(XGBClassifier): + # pylint: disable=missing-docstring + @_deprecate_positional_args + def __init__( + self, + *, + learning_rate: float = 1.0, + subsample: float = 0.8, + colsample_bynode: float = 0.8, + reg_lambda: float = 1e-5, + **kwargs: Any, + ): + super().__init__( + learning_rate=learning_rate, + subsample=subsample, + colsample_bynode=colsample_bynode, + reg_lambda=reg_lambda, + **kwargs, + ) + _check_rf_callback(self.early_stopping_rounds, self.callbacks) + + def get_xgb_params(self) -> Dict[str, Any]: + params = super().get_xgb_params() + params["num_parallel_tree"] = super().get_num_boosting_rounds() + return params + + def get_num_boosting_rounds(self) -> int: + return 1 + + # pylint: disable=unused-argument + @_deprecate_positional_args + def fit( + self, + X: ArrayLike, + y: ArrayLike, + *, + sample_weight: Optional[ArrayLike] = None, + base_margin: Optional[ArrayLike] = None, + eval_set: Optional[Sequence[Tuple[ArrayLike, ArrayLike]]] = None, + verbose: Optional[Union[bool, int]] = True, + xgb_model: Optional[Union[Booster, str, XGBModel]] = None, + sample_weight_eval_set: Optional[Sequence[ArrayLike]] = None, + base_margin_eval_set: Optional[Sequence[ArrayLike]] = None, + feature_weights: Optional[ArrayLike] = None, + ) -> "XGBRFClassifier": + args = {k: v for k, v in locals().items() if k not in ("self", "__class__")} + _check_rf_callback(self.early_stopping_rounds, self.callbacks) + super().fit(**args) + return self + + +@xgboost_model_doc( + "Implementation of the scikit-learn API for XGBoost regression.", + ["estimators", "model", "objective"], +) +class XGBRegressor(XGBRegressorBase, XGBModel): + # pylint: disable=missing-docstring + @_deprecate_positional_args + def __init__( + self, *, objective: SklObjective = "reg:squarederror", **kwargs: Any + ) -> None: + super().__init__(objective=objective, **kwargs) + + def _more_tags(self) -> Dict[str, bool]: + tags = super()._more_tags() + tags["multioutput"] = True + tags["multioutput_only"] = False + return tags + + def __sklearn_tags__(self) -> _sklearn_Tags: + tags = super().__sklearn_tags__() + tags_dict = self._more_tags() + tags.target_tags.multi_output = tags_dict["multioutput"] + tags.target_tags.single_output = not tags_dict["multioutput_only"] + return tags + + +@xgboost_model_doc( + "scikit-learn API for XGBoost random forest regression.", + ["model", "objective"], + extra_parameters=""" + n_estimators : Optional[int] + Number of trees in random forest to fit. +""", +) +class XGBRFRegressor(XGBRegressor): + # pylint: disable=missing-docstring + @_deprecate_positional_args + def __init__( + self, + *, + learning_rate: float = 1.0, + subsample: float = 0.8, + colsample_bynode: float = 0.8, + reg_lambda: float = 1e-5, + **kwargs: Any, + ) -> None: + super().__init__( + learning_rate=learning_rate, + subsample=subsample, + colsample_bynode=colsample_bynode, + reg_lambda=reg_lambda, + **kwargs, + ) + _check_rf_callback(self.early_stopping_rounds, self.callbacks) + + def get_xgb_params(self) -> Dict[str, Any]: + params = super().get_xgb_params() + params["num_parallel_tree"] = super().get_num_boosting_rounds() + return params + + def get_num_boosting_rounds(self) -> int: + return 1 + + # pylint: disable=unused-argument + @_deprecate_positional_args + def fit( + self, + X: ArrayLike, + y: ArrayLike, + *, + sample_weight: Optional[ArrayLike] = None, + base_margin: Optional[ArrayLike] = None, + eval_set: Optional[Sequence[Tuple[ArrayLike, ArrayLike]]] = None, + verbose: Optional[Union[bool, int]] = True, + xgb_model: Optional[Union[Booster, str, XGBModel]] = None, + sample_weight_eval_set: Optional[Sequence[ArrayLike]] = None, + base_margin_eval_set: Optional[Sequence[ArrayLike]] = None, + feature_weights: Optional[ArrayLike] = None, + ) -> "XGBRFRegressor": + args = {k: v for k, v in locals().items() if k not in ("self", "__class__")} + _check_rf_callback(self.early_stopping_rounds, self.callbacks) + super().fit(**args) + return self + + +def _get_qid( + X: ArrayLike, qid: Optional[ArrayLike] +) -> Tuple[ArrayLike, Optional[ArrayLike]]: + """Get the special qid column from X if exists.""" + if (_is_pandas_df(X) or _is_cudf_df(X)) and hasattr(X, "qid"): + if qid is not None: + raise ValueError( + "Found both the special column `qid` in `X` and the `qid` from the" + "`fit` method. Please remove one of them." + ) + q_x = X.qid + X = X.drop("qid", axis=1) + return X, q_x + return X, qid + + +@xgboost_model_doc( + """Implementation of the Scikit-Learn API for XGBoost Ranking. + +See :doc:`Learning to Rank ` for an introducion. + + """, + ["estimators", "model"], + end_note=""" + .. note:: + + A custom objective function is currently not supported by XGBRanker. + + .. note:: + + Query group information is only required for ranking training but not + prediction. Multiple groups can be predicted on a single call to + :py:meth:`predict`. + + When fitting the model with the `group` parameter, your data need to be sorted + by the query group first. `group` is an array that contains the size of each + query group. + + Similarly, when fitting the model with the `qid` parameter, the data should be + sorted according to query index and `qid` is an array that contains the query + index for each training sample. + + For example, if your original data look like: + + +-------+-----------+---------------+ + | qid | label | features | + +-------+-----------+---------------+ + | 1 | 0 | x_1 | + +-------+-----------+---------------+ + | 1 | 1 | x_2 | + +-------+-----------+---------------+ + | 1 | 0 | x_3 | + +-------+-----------+---------------+ + | 2 | 0 | x_4 | + +-------+-----------+---------------+ + | 2 | 1 | x_5 | + +-------+-----------+---------------+ + | 2 | 1 | x_6 | + +-------+-----------+---------------+ + | 2 | 1 | x_7 | + +-------+-----------+---------------+ + + then :py:meth:`fit` method can be called with either `group` array as ``[3, 4]`` + or with `qid` as ``[1, 1, 1, 2, 2, 2, 2]``, that is the qid column. Also, the + `qid` can be a special column of input `X` instead of a separated parameter, see + :py:meth:`fit` for more info.""", +) +class XGBRanker(XGBRankerMixIn, XGBModel): + # pylint: disable=missing-docstring,too-many-arguments + @_deprecate_positional_args + def __init__(self, *, objective: str = "rank:ndcg", **kwargs: Any): + super().__init__(objective=objective, **kwargs) + if callable(self.objective): + raise ValueError("custom objective function not supported by XGBRanker") + if "rank:" not in objective: + raise ValueError("please use XGBRanker for ranking task") + + def _create_ltr_dmatrix( + self, ref: Optional[DMatrix], data: ArrayLike, qid: ArrayLike, **kwargs: Any + ) -> DMatrix: + data, qid = _get_qid(data, qid) + + if kwargs.get("group", None) is None and qid is None: + raise ValueError("Either `group` or `qid` is required for ranking task") + + return super()._create_dmatrix(ref=ref, data=data, qid=qid, **kwargs) + + @_deprecate_positional_args + def fit( + self, + X: ArrayLike, + y: ArrayLike, + *, + group: Optional[ArrayLike] = None, + qid: Optional[ArrayLike] = None, + sample_weight: Optional[ArrayLike] = None, + base_margin: Optional[ArrayLike] = None, + eval_set: Optional[Sequence[Tuple[ArrayLike, ArrayLike]]] = None, + eval_group: Optional[Sequence[ArrayLike]] = None, + eval_qid: Optional[Sequence[ArrayLike]] = None, + verbose: Optional[Union[bool, int]] = False, + xgb_model: Optional[Union[Booster, str, XGBModel]] = None, + sample_weight_eval_set: Optional[Sequence[ArrayLike]] = None, + base_margin_eval_set: Optional[Sequence[ArrayLike]] = None, + feature_weights: Optional[ArrayLike] = None, + ) -> "XGBRanker": + # pylint: disable = attribute-defined-outside-init,arguments-differ + """Fit gradient boosting ranker + + Note that calling ``fit()`` multiple times will cause the model object to be + re-fit from scratch. To resume training from a previous checkpoint, explicitly + pass ``xgb_model`` argument. + + Parameters + ---------- + X : + Feature matrix. See :ref:`py-data` for a list of supported types. + + When this is a :py:class:`pandas.DataFrame` or a :py:class:`cudf.DataFrame`, + it may contain a special column called ``qid`` for specifying the query + index. Using a special column is the same as using the `qid` parameter, + except for being compatible with sklearn utility functions like + :py:func:`sklearn.model_selection.cross_validation`. The same convention + applies to the :py:meth:`XGBRanker.score` and :py:meth:`XGBRanker.predict`. + + +-----+----------------+----------------+ + | qid | feat_0 | feat_1 | + +-----+----------------+----------------+ + | 0 | :math:`x_{00}` | :math:`x_{01}` | + +-----+----------------+----------------+ + | 1 | :math:`x_{10}` | :math:`x_{11}` | + +-----+----------------+----------------+ + | 1 | :math:`x_{20}` | :math:`x_{21}` | + +-----+----------------+----------------+ + + When the ``tree_method`` is set to ``hist``, internally, the + :py:class:`QuantileDMatrix` will be used instead of the :py:class:`DMatrix` + for conserving memory. However, this has performance implications when the + device of input data is not matched with algorithm. For instance, if the + input is a numpy array on CPU but ``cuda`` is used for training, then the + data is first processed on CPU then transferred to GPU. + y : + Labels + group : + Size of each query group of training data. Should have as many elements as + the query groups in the training data. If this is set to None, then user + must provide qid. + qid : + Query ID for each training sample. Should have the size of n_samples. If + this is set to None, then user must provide group or a special column in X. + sample_weight : + Query group weights + + .. note:: Weights are per-group for ranking tasks + + In ranking task, one weight is assigned to each query group/id (not each + data point). This is because we only care about the relative ordering of + data points within each group, so it doesn't make sense to assign + weights to individual data points. + + base_margin : + Global bias for each instance. See :doc:`/tutorials/intercept` for details. + eval_set : + A list of (X, y) tuple pairs to use as validation sets, for which + metrics will be computed. + Validation metrics will help us track the performance of the model. + eval_group : + A list in which ``eval_group[i]`` is the list containing the sizes of all + query groups in the ``i``-th pair in **eval_set**. + eval_qid : + A list in which ``eval_qid[i]`` is the array containing query ID of ``i``-th + pair in **eval_set**. The special column convention in `X` applies to + validation datasets as well. + + verbose : + If `verbose` is True and an evaluation set is used, the evaluation metric + measured on the validation set is printed to stdout at each boosting stage. + If `verbose` is an integer, the evaluation metric is printed at each + `verbose` boosting stage. The last boosting stage / the boosting stage found + by using `early_stopping_rounds` is also printed. + xgb_model : + file name of stored XGBoost model or 'Booster' instance XGBoost model to be + loaded before training (allows training continuation). + sample_weight_eval_set : + A list of the form [L_1, L_2, ..., L_n], where each L_i is a list of + group weights on the i-th validation set. + + .. note:: Weights are per-group for ranking tasks + + In ranking task, one weight is assigned to each query group (not each + data point). This is because we only care about the relative ordering of + data points within each group, so it doesn't make sense to assign + weights to individual data points. + base_margin_eval_set : + A list of the form [M_1, M_2, ..., M_n], where each M_i is an array like + object storing base margin for the i-th validation set. + feature_weights : + Weight for each feature, defines the probability of each feature being + selected when colsample is being used. All values must be greater than 0, + otherwise a `ValueError` is thrown. + + """ + with config_context(verbosity=self.verbosity): + params = self.get_xgb_params() + + model, metric, params, feature_weights = self._configure_fit( + xgb_model, params, feature_weights + ) + model, feature_types = get_model_categories(X, model, self.feature_types) + + evals_result: EvalsLog = {} + train_dmatrix, evals = _wrap_evaluation_matrices( + missing=self.missing, + X=X, + y=y, + group=group, + qid=qid, + sample_weight=sample_weight, + base_margin=base_margin, + feature_weights=feature_weights, + eval_set=eval_set, + sample_weight_eval_set=sample_weight_eval_set, + base_margin_eval_set=base_margin_eval_set, + eval_group=eval_group, + eval_qid=eval_qid, + create_dmatrix=self._create_ltr_dmatrix, + enable_categorical=self.enable_categorical, + feature_types=feature_types, + ) + + self._Booster = train( + params, + train_dmatrix, + num_boost_round=self.get_num_boosting_rounds(), + early_stopping_rounds=self.early_stopping_rounds, + evals=evals, + evals_result=evals_result, + custom_metric=metric, + verbose_eval=verbose, + xgb_model=model, + callbacks=self.callbacks, + ) + + self.objective = params["objective"] + + self._set_evaluation_result(evals_result) + return self + + @_deprecate_positional_args + def predict( + self, + X: ArrayLike, + *, + output_margin: bool = False, + validate_features: bool = True, + base_margin: Optional[ArrayLike] = None, + iteration_range: Optional[IterationRange] = None, + ) -> ArrayLike: + X, _ = _get_qid(X, None) + return super().predict( + X, + output_margin=output_margin, + validate_features=validate_features, + base_margin=base_margin, + iteration_range=iteration_range, + ) + + def apply( + self, + X: ArrayLike, + iteration_range: Optional[IterationRange] = None, + ) -> ArrayLike: + X, _ = _get_qid(X, None) + return super().apply(X, iteration_range) + + def score(self, X: ArrayLike, y: ArrayLike) -> float: + """Evaluate score for data using the last evaluation metric. If the model is + trained with early stopping, then :py:attr:`best_iteration` is used + automatically. + + Parameters + ---------- + X : Union[pd.DataFrame, cudf.DataFrame] + Feature matrix. A DataFrame with a special `qid` column. + + y : + Labels + + Returns + ------- + score : + The result of the first evaluation metric for the ranker. + + """ + X, qid = _get_qid(X, None) + # fixme(jiamingy): base margin and group weight is not yet supported. We might + # need to make extra special fields in the dataframe. + Xyq = DMatrix( + X, + y, + qid=qid, + missing=self.missing, + enable_categorical=self.enable_categorical, + nthread=self.n_jobs, + feature_types=self.feature_types, + ) + if callable(self.eval_metric): + metric = ltr_metric_decorator(self.eval_metric, self.n_jobs) + result_str = self.get_booster().eval_set([(Xyq, "eval")], feval=metric) + else: + result_str = self.get_booster().eval(Xyq) + + metric_score = _parse_eval_str(result_str) + return metric_score[-1][1] diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/xgboost/spark/__init__.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/xgboost/spark/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..224f87d0399a5e23b4b32da1fa4d2ece75de7689 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/xgboost/spark/__init__.py @@ -0,0 +1,24 @@ +"""PySpark XGBoost integration interface""" + +try: + import pyspark +except ImportError as e: + raise ImportError("pyspark package needs to be installed to use this module") from e + +from .estimator import ( + SparkXGBClassifier, + SparkXGBClassifierModel, + SparkXGBRanker, + SparkXGBRankerModel, + SparkXGBRegressor, + SparkXGBRegressorModel, +) + +__all__ = [ + "SparkXGBClassifier", + "SparkXGBClassifierModel", + "SparkXGBRegressor", + "SparkXGBRegressorModel", + "SparkXGBRanker", + "SparkXGBRankerModel", +] diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/xgboost/spark/core.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/xgboost/spark/core.py new file mode 100644 index 0000000000000000000000000000000000000000..357ac931941cfb31807ac211e16ab2c6e69192d8 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/xgboost/spark/core.py @@ -0,0 +1,1804 @@ +"""XGBoost pyspark integration submodule for core code.""" + +import base64 + +# pylint: disable=fixme, protected-access, no-member +# pylint: disable=too-many-lines, too-many-branches +import json +import logging +import os +from collections import namedtuple +from dataclasses import asdict +from typing import ( + Any, + Callable, + Dict, + Iterator, + List, + Optional, + Tuple, + Type, + Union, + cast, +) + +import numpy as np +import pandas as pd +from pyspark import RDD, SparkConf, SparkContext, cloudpickle +from pyspark.ml import Estimator, Model +from pyspark.ml.functions import array_to_vector, vector_to_array +from pyspark.ml.linalg import VectorUDT +from pyspark.ml.param import Param, Params, TypeConverters +from pyspark.ml.param.shared import ( + HasFeaturesCol, + HasLabelCol, + HasPredictionCol, + HasProbabilityCol, + HasRawPredictionCol, + HasValidationIndicatorCol, + HasWeightCol, +) +from pyspark.ml.util import ( + DefaultParamsReader, + DefaultParamsWriter, + MLReadable, + MLReader, + MLWritable, + MLWriter, +) +from pyspark.resource import ResourceProfileBuilder, TaskResourceRequests +from pyspark.sql import Column, DataFrame +from pyspark.sql.functions import col, countDistinct, pandas_udf, rand, struct +from pyspark.sql.types import ( + ArrayType, + BooleanType, + DoubleType, + FloatType, + IntegerType, + IntegralType, + LongType, + ShortType, +) +from scipy.special import expit, softmax # pylint: disable=no-name-in-module + +from .._typing import ArrayLike +from ..collective import Config +from ..compat import import_cupy, is_cudf_available, is_cupy_available +from ..config import config_context, get_config +from ..core import Booster, _check_distributed_params, _py_version +from ..sklearn import DEFAULT_N_ESTIMATORS, XGBClassifier, XGBModel, _can_use_qdm +from ..training import train as worker_train +from .data import ( + _read_csr_matrix_from_unwrapped_spark_vec, + alias, + create_dmatrix_from_partitions, + pred_contribs, + stack_series, +) +from .params import ( + HasArbitraryParamsDict, + HasBaseMarginCol, + HasContribPredictionCol, + HasEnableSparseDataOptim, + HasFeaturesCols, + HasQueryIdCol, +) +from .summary import XGBoostTrainingSummary +from .utils import ( + CommunicatorContext, + _get_default_params_from_func, + _get_gpu_id, + _get_host_ip, + _get_max_num_concurrent_tasks, + _get_rabit_args, + _get_spark_session, + _is_local, + _is_standalone_or_localcluster, + deserialize_booster, + deserialize_xgb_model, + get_class_name, + get_logger, + get_logger_level, + serialize_booster, + use_cuda, +) + +# Put pyspark specific params here, they won't be passed to XGBoost. +# like `validationIndicatorCol`, `base_margin_col` +_pyspark_specific_params = [ + "featuresCol", + "labelCol", + "weightCol", + "rawPredictionCol", + "predictionCol", + "probabilityCol", + "validationIndicatorCol", + "base_margin_col", + "arbitrary_params_dict", + "force_repartition", + "num_workers", + "feature_names", + "features_cols", + "enable_sparse_data_optim", + "qid_col", + "repartition_random_shuffle", + "pred_contrib_col", + "launch_tracker_on_driver", + "coll_cfg", +] + +_non_booster_params = ["missing", "n_estimators", "feature_types", "feature_weights"] + +_pyspark_param_alias_map = { + "features_col": "featuresCol", + "label_col": "labelCol", + "weight_col": "weightCol", + "raw_prediction_col": "rawPredictionCol", + "prediction_col": "predictionCol", + "probability_col": "probabilityCol", + "validation_indicator_col": "validationIndicatorCol", +} + +_inverse_pyspark_param_alias_map = {v: k for k, v in _pyspark_param_alias_map.items()} + +_unsupported_xgb_params = [ + "enable_categorical", # Use feature_types param to specify categorical feature instead + "n_jobs", # Do not allow user to set it, will use `spark.task.cpus` value instead. + "nthread", # Ditto +] + +_unsupported_fit_params = { + "sample_weight", # Supported by spark param weightCol + "eval_set", # Supported by spark param validation_indicator_col + "sample_weight_eval_set", # Supported by spark param weight_col + validation_indicator_col + "base_margin", # Supported by spark param base_margin_col + "base_margin_eval_set", # Supported by spark param base_margin_col + validation_indicator_col + "group", # Use spark param `qid_col` instead + "qid", # Use spark param `qid_col` instead + "eval_group", # Use spark param `qid_col` instead + "eval_qid", # Use spark param `qid_col` instead +} + +_unsupported_train_params = { + "evals", # Supported by spark param validation_indicator_col + "evals_result", # Won't support yet+ +} + +_unsupported_predict_params = { + # for classification, we can use rawPrediction as margin + "output_margin", + "validate_features", # TODO + "base_margin", # Use pyspark base_margin_col param instead. +} + +# TODO: supply hint message for all other unsupported params. +_unsupported_params_hint_message = { + "enable_categorical": "`xgboost.spark` estimators do not have 'enable_categorical' param, " + "but you can set `feature_types` param and mark categorical features with 'c' string." +} + +# Global prediction names +Pred = namedtuple( + "Pred", ("prediction", "raw_prediction", "probability", "pred_contrib") +) +pred = Pred("prediction", "rawPrediction", "probability", "predContrib") + +_INIT_BOOSTER_SAVE_PATH = "init_booster.json" + +_LOG_TAG = "XGBoost-PySpark" + + +class _SparkXGBParams( + HasFeaturesCol, + HasLabelCol, + HasWeightCol, + HasPredictionCol, + HasValidationIndicatorCol, + HasArbitraryParamsDict, + HasBaseMarginCol, + HasFeaturesCols, + HasEnableSparseDataOptim, + HasQueryIdCol, + HasContribPredictionCol, +): + num_workers = Param( + Params._dummy(), + "num_workers", + "The number of XGBoost workers. Each XGBoost worker corresponds to one spark task.", + TypeConverters.toInt, + ) + device = Param( + Params._dummy(), + "device", + ( + "The device type for XGBoost executors. Available options are `cpu`,`cuda`" + " and `gpu`. Set `device` to `cuda` or `gpu` if the executors are running " + "on GPU instances. Currently, only one GPU per task is supported." + ), + TypeConverters.toString, + ) + force_repartition = Param( + Params._dummy(), + "force_repartition", + "A boolean variable. Set force_repartition=true if you " + + "want to force the input dataset to be repartitioned before XGBoost training." + + "Note: The auto repartitioning judgement is not fully accurate, so it is recommended" + + "to have force_repartition be True.", + TypeConverters.toBoolean, + ) + repartition_random_shuffle = Param( + Params._dummy(), + "repartition_random_shuffle", + "A boolean variable. Set repartition_random_shuffle=true if you want to random shuffle " + "dataset when repartitioning is required. By default is True.", + TypeConverters.toBoolean, + ) + feature_names = Param( + Params._dummy(), + "feature_names", + "A list of str to specify feature names.", + TypeConverters.toList, + ) + launch_tracker_on_driver = Param( + Params._dummy(), + "launch_tracker_on_driver", + "A boolean variable. Set launch_tracker_on_driver to true if you want the tracker to be " + "launched on the driver side; otherwise, it will be launched on the executor side.", + TypeConverters.toBoolean, + ) + coll_cfg = Param( + Params._dummy(), + "coll_cfg", + "xgboost.collective.Config. The collective configuration.", + TypeConverters.identity, + ) + + def set_coll_cfg(self, value: Config) -> "_SparkXGBParams": + """Set collective configuration""" + assert isinstance(value, Config) + self.set(self.coll_cfg, value) + return self + + def set_device(self, value: str) -> "_SparkXGBParams": + """Set device, optional value: cpu, cuda, gpu""" + _check_distributed_params({"device": value}) + assert value in ("cpu", "cuda", "gpu") + self.set(self.device, value) + return self + + @classmethod + def _xgb_cls(cls) -> Type[XGBModel]: + """ + Subclasses should override this method and + returns an xgboost.XGBModel subclass + """ + raise NotImplementedError() + + # Parameters for xgboost.XGBModel() + @classmethod + def _get_xgb_params_default(cls) -> Dict[str, Any]: + """Get the xgboost.sklearn.XGBModel default parameters and filter out some""" + xgb_model_default = cls._xgb_cls()() + params_dict = xgb_model_default.get_params() + filtered_params_dict = { + k: params_dict[k] for k in params_dict if k not in _unsupported_xgb_params + } + filtered_params_dict["n_estimators"] = DEFAULT_N_ESTIMATORS + return filtered_params_dict + + def _set_xgb_params_default(self) -> None: + """Set xgboost parameters into spark parameters""" + filtered_params_dict = self._get_xgb_params_default() + self._setDefault(**filtered_params_dict) + + def _gen_xgb_params_dict( + self, gen_xgb_sklearn_estimator_param: bool = False + ) -> Dict[str, Any]: + """Generate the xgboost parameters which will be passed into xgboost library""" + xgb_params = {} + non_xgb_params = ( + set(_pyspark_specific_params) + | self._get_fit_params_default().keys() + | self._get_predict_params_default().keys() + ) + if not gen_xgb_sklearn_estimator_param: + non_xgb_params |= set(_non_booster_params) + for param in self.extractParamMap(): + if param.name not in non_xgb_params: + xgb_params[param.name] = self.getOrDefault(param) + + arbitrary_params_dict = self.getOrDefault( + self.getParam("arbitrary_params_dict") + ) + xgb_params.update(arbitrary_params_dict) + return xgb_params + + # Parameters for xgboost.XGBModel().fit() + @classmethod + def _get_fit_params_default(cls) -> Dict[str, Any]: + """Get the xgboost.XGBModel().fit() parameters""" + fit_params = _get_default_params_from_func( + cls._xgb_cls().fit, _unsupported_fit_params + ) + return fit_params + + def _set_fit_params_default(self) -> None: + """Get the xgboost.XGBModel().fit() parameters and set them to spark parameters""" + filtered_params_dict = self._get_fit_params_default() + self._setDefault(**filtered_params_dict) + + def _gen_fit_params_dict(self) -> Dict[str, Any]: + """Generate the fit parameters which will be passed into fit function""" + fit_params_keys = self._get_fit_params_default().keys() + fit_params = {} + for param in self.extractParamMap(): + if param.name in fit_params_keys: + fit_params[param.name] = self.getOrDefault(param) + return fit_params + + @classmethod + def _get_predict_params_default(cls) -> Dict[str, Any]: + """Get the parameters from xgboost.XGBModel().predict()""" + predict_params = _get_default_params_from_func( + cls._xgb_cls().predict, _unsupported_predict_params + ) + return predict_params + + def _set_predict_params_default(self) -> None: + """Get the parameters from xgboost.XGBModel().predict() and + set them into spark parameters""" + filtered_params_dict = self._get_predict_params_default() + self._setDefault(**filtered_params_dict) + + def _gen_predict_params_dict(self) -> Dict[str, Any]: + """Generate predict parameters which will be passed into xgboost.XGBModel().predict()""" + predict_params_keys = self._get_predict_params_default().keys() + predict_params = {} + for param in self.extractParamMap(): + if param.name in predict_params_keys: + predict_params[param.name] = self.getOrDefault(param) + return predict_params + + def _validate_gpu_params( + self, spark_version: str, conf: SparkConf, is_local: bool = False + ) -> None: + """Validate the gpu parameters and gpu configurations""" + + if self._run_on_gpu(): + if is_local: + # Supporting GPU training in Spark local mode is just for debugging + # purposes, so it's okay for printing the below warning instead of + # checking the real gpu numbers and raising the exception. + get_logger(self.__class__.__name__).warning( + "You have enabled GPU in spark local mode. Please make sure your" + " local node has at least %d GPUs", + self.getOrDefault(self.num_workers), + ) + else: + executor_gpus = conf.get("spark.executor.resource.gpu.amount") + if executor_gpus is None: + raise ValueError( + "The `spark.executor.resource.gpu.amount` is required for training" + " on GPU." + ) + gpu_per_task = conf.get("spark.task.resource.gpu.amount") + if gpu_per_task is not None and float(gpu_per_task) > 1.0: + get_logger(self.__class__.__name__).warning( + "The configuration assigns %s GPUs to each Spark task, but each " + "XGBoost training task only utilizes 1 GPU, which will lead to " + "unnecessary GPU waste", + gpu_per_task, + ) + # For 3.5.1+, Spark supports task stage-level scheduling for + # Yarn/K8s/Standalone/Local cluster + # From 3.4.0 ~ 3.5.0, Spark only supports task stage-level scheduing for + # Standalone/Local cluster + # For spark below 3.4.0, Task stage-level scheduling is not supported. + # + # With stage-level scheduling, spark.task.resource.gpu.amount is not required + # to be set explicitly. Or else, spark.task.resource.gpu.amount is a must-have and + # must be set to 1.0 + if spark_version < "3.4.0" or ( + "3.4.0" <= spark_version < "3.5.1" + and not _is_standalone_or_localcluster(conf) + ): + if gpu_per_task is not None: + if float(gpu_per_task) < 1.0: + raise ValueError( + "XGBoost doesn't support GPU fractional configurations. Please set " + "`spark.task.resource.gpu.amount=spark.executor.resource.gpu." + "amount`. To enable GPU fractional configurations, you can try " + "standalone/localcluster with spark 3.4.0+ and" + "YARN/K8S with spark 3.5.1+" + ) + else: + raise ValueError( + "The `spark.task.resource.gpu.amount` is required for training" + " on GPU." + ) + + def _validate_params(self) -> None: + # pylint: disable=too-many-branches + init_model = self.getOrDefault("xgb_model") + if init_model is not None and not isinstance(init_model, Booster): + raise ValueError( + "The xgb_model param must be set with a `xgboost.core.Booster` " + "instance." + ) + + if self.getOrDefault(self.num_workers) < 1: + raise ValueError( + f"Number of workers was {self.getOrDefault(self.num_workers)}." + f"It cannot be less than 1 [Default is 1]" + ) + + tree_method = self.getOrDefault(self.getParam("tree_method")) + if tree_method == "exact": + raise ValueError( + "The `exact` tree method is not supported for distributed systems." + ) + + if self.getOrDefault("objective") is not None: + if not isinstance(self.getOrDefault("objective"), str): + raise ValueError("Only string type 'objective' param is allowed.") + + eval_metric = "eval_metric" + if self.getOrDefault(eval_metric) is not None: + if not ( + isinstance(self.getOrDefault(eval_metric), str) + or ( + isinstance(self.getOrDefault(eval_metric), List) + and all( + isinstance(metric, str) + for metric in self.getOrDefault(eval_metric) + ) + ) + ): + raise ValueError( + "Only string type or list of string type 'eval_metric' param is allowed." + ) + + if self.getOrDefault("early_stopping_rounds") is not None: + if not self._col_is_defined_not_empty(self.validationIndicatorCol): + raise ValueError( + "If 'early_stopping_rounds' param is set, you need to set " + "'validation_indicator_col' param as well." + ) + + if self.getOrDefault(self.enable_sparse_data_optim): + if self.getOrDefault("missing") != 0.0: + # If DMatrix is constructed from csr / csc matrix, then inactive elements + # in csr / csc matrix are regarded as missing value, but, in pyspark, we + # are hard to control elements to be active or inactive in sparse vector column, + # some spark transformers such as VectorAssembler might compress vectors + # to be dense or sparse format automatically, and when a spark ML vector object + # is compressed to sparse vector, then all zero value elements become inactive. + # So we force setting missing param to be 0 when enable_sparse_data_optim config + # is True. + raise ValueError( + "If enable_sparse_data_optim is True, missing param != 0 is not supported." + ) + if self.getOrDefault(self.features_cols): + raise ValueError( + "If enable_sparse_data_optim is True, you cannot set multiple feature columns " + "but you should set one feature column with values of " + "`pyspark.ml.linalg.Vector` type." + ) + + ss = _get_spark_session() + sc = ss.sparkContext + self._validate_gpu_params(ss.version, sc.getConf(), _is_local(sc)) + + def _run_on_gpu(self) -> bool: + """If train or transform on the gpu according to the parameters""" + + return use_cuda(self.getOrDefault(self.device)) + + def _col_is_defined_not_empty(self, param: "Param[str]") -> bool: + return self.isDefined(param) and self.getOrDefault(param) not in (None, "") + + +def _validate_and_convert_feature_col_as_float_col_list( + dataset: DataFrame, features_col_names: List[str] +) -> List[Column]: + """Values in feature columns must be integral types or float/double types""" + feature_cols = [] + for c in features_col_names: + if isinstance(dataset.schema[c].dataType, DoubleType): + feature_cols.append(col(c).cast(FloatType()).alias(c)) + elif isinstance(dataset.schema[c].dataType, (FloatType, IntegralType)): + feature_cols.append(col(c)) + else: + raise ValueError( + "Values in feature columns must be integral types or float/double types." + ) + return feature_cols + + +def _validate_and_convert_feature_col_as_array_col( + dataset: DataFrame, features_col_name: str +) -> Column: + """It handles + 1. Convert vector type to array type + 2. Cast to Array(Float32)""" + features_col_datatype = dataset.schema[features_col_name].dataType + features_col = col(features_col_name) + if isinstance(features_col_datatype, ArrayType): + if not isinstance( + features_col_datatype.elementType, + (DoubleType, FloatType, LongType, IntegerType, ShortType), + ): + raise ValueError( + "If feature column is array type, its elements must be number type, " + f"got {features_col_datatype.elementType}." + ) + features_array_col = features_col.cast(ArrayType(FloatType())).alias(alias.data) + elif isinstance(features_col_datatype, VectorUDT): + features_array_col = vector_to_array(features_col, dtype="float32").alias( + alias.data + ) + else: + raise ValueError( + "feature column must be array type or `pyspark.ml.linalg.Vector` type, " + "if you want to use multiple numetric columns as features, please use " + "`pyspark.ml.transform.VectorAssembler` to assemble them into a vector " + "type column first." + ) + return features_array_col + + +def _get_unwrap_udt_fn() -> Callable[[Union[Column, str]], Column]: + try: + from pyspark.sql.functions import unwrap_udt + + return unwrap_udt + except ImportError: + pass + + try: + from pyspark.databricks.sql.functions import unwrap_udt as databricks_unwrap_udt + + return databricks_unwrap_udt + except ImportError as exc: + raise RuntimeError( + "Cannot import pyspark `unwrap_udt` function. Please install pyspark>=3.4 " + "or run on Databricks Runtime." + ) from exc + + +def _get_unwrapped_vec_cols(feature_col: Column) -> List[Column]: + unwrap_udt = _get_unwrap_udt_fn() + features_unwrapped_vec_col = unwrap_udt(feature_col) + + # After a `pyspark.ml.linalg.VectorUDT` type column being unwrapped, it becomes + # a pyspark struct type column, the struct fields are: + # - `type`: byte + # - `size`: int + # - `indices`: array + # - `values`: array + # For sparse vector, `type` field is 0, `size` field means vector length, + # `indices` field is the array of active element indices, `values` field + # is the array of active element values. + # For dense vector, `type` field is 1, `size` and `indices` fields are None, + # `values` field is the array of the vector element values. + return [ + features_unwrapped_vec_col.type.alias("featureVectorType"), + features_unwrapped_vec_col.size.alias("featureVectorSize"), + features_unwrapped_vec_col.indices.alias("featureVectorIndices"), + # Note: the value field is double array type, cast it to float32 array type + # for speedup following repartitioning. + features_unwrapped_vec_col.values.cast(ArrayType(FloatType())).alias( + "featureVectorValues" + ), + ] + + +FeatureProp = namedtuple( + "FeatureProp", + ("enable_sparse_data_optim", "has_validation_col", "features_cols_names"), +) + +_MODEL_CHUNK_SIZE = 4096 * 1024 + + +class _SparkXGBEstimator(Estimator, _SparkXGBParams, MLReadable, MLWritable): + _input_kwargs: Dict[str, Any] + + def __init__(self) -> None: + super().__init__() + self._set_xgb_params_default() + self._set_fit_params_default() + self._set_predict_params_default() + # Note: The default value for arbitrary_params_dict must always be empty dict. + # For additional settings added into "arbitrary_params_dict" by default, + # they are added in `setParams`. + self._setDefault( + num_workers=1, + device="cpu", + force_repartition=False, + repartition_random_shuffle=False, + feature_names=None, + feature_types=None, + feature_weights=None, + arbitrary_params_dict={}, + launch_tracker_on_driver=True, + ) + + self.logger = get_logger(self.__class__.__name__) + + def setParams(self, **kwargs: Any) -> None: + """ + Set params for the estimator. + """ + _extra_params = {} + if "arbitrary_params_dict" in kwargs: + raise ValueError("Invalid param name: 'arbitrary_params_dict'.") + + for k, v in kwargs.items(): + # We're not allowing user use features_cols directly. + if k == self.features_cols.name: + raise ValueError( + f"Unsupported param '{k}' please use features_col instead." + ) + if k in _inverse_pyspark_param_alias_map: + raise ValueError( + f"Please use param name {_inverse_pyspark_param_alias_map[k]} instead." + ) + if k in _pyspark_param_alias_map: + if k == _inverse_pyspark_param_alias_map[ + self.featuresCol.name + ] and isinstance(v, list): + real_k = self.features_cols.name + k = real_k + else: + real_k = _pyspark_param_alias_map[k] + k = real_k + + if self.hasParam(k): + if k == "features_col" and isinstance(v, list): + self._set(**{"features_cols": v}) + else: + self._set(**{str(k): v}) + else: + if ( + k in _unsupported_xgb_params + or k in _unsupported_fit_params + or k in _unsupported_predict_params + or k in _unsupported_train_params + ): + err_msg = _unsupported_params_hint_message.get( + k, f"Unsupported param '{k}'." + ) + raise ValueError(err_msg) + _extra_params[k] = v + + _check_distributed_params(kwargs) + _existing_extra_params = self.getOrDefault(self.arbitrary_params_dict) + self._set(arbitrary_params_dict={**_existing_extra_params, **_extra_params}) + + @classmethod + def _pyspark_model_cls(cls) -> Type["_SparkXGBModel"]: + """ + Subclasses should override this method and + returns a _SparkXGBModel subclass + """ + raise NotImplementedError() + + def _create_pyspark_model( + self, xgb_model: XGBModel, training_summary: XGBoostTrainingSummary + ) -> "_SparkXGBModel": + return self._pyspark_model_cls()(xgb_model, training_summary) + + def _convert_to_sklearn_model(self, booster: bytearray, config: str) -> XGBModel: + xgb_sklearn_params = self._gen_xgb_params_dict( + gen_xgb_sklearn_estimator_param=True + ) + sklearn_model = self._xgb_cls()(**xgb_sklearn_params) + sklearn_model.load_model(booster) + sklearn_model._Booster.load_config(config) + return sklearn_model + + def _repartition_needed(self, dataset: DataFrame) -> bool: + """ + We repartition the dataset if the number of workers is not equal to the number of + partitions.""" + if self.getOrDefault(self.force_repartition): + return True + num_workers = self.getOrDefault(self.num_workers) + num_partitions = dataset.rdd.getNumPartitions() + return not num_workers == num_partitions + + def _get_distributed_train_params(self, dataset: DataFrame) -> Dict[str, Any]: + """ + This just gets the configuration params for distributed xgboost + """ + params = self._gen_xgb_params_dict() + fit_params = self._gen_fit_params_dict() + verbose_eval = fit_params.pop("verbose", None) + + params.update(fit_params) + params["verbose_eval"] = verbose_eval + classification = self._xgb_cls() == XGBClassifier + if classification: + num_classes = int( + dataset.select(countDistinct(alias.label)).collect()[0][0] + ) + if num_classes <= 2: + params["objective"] = "binary:logistic" + else: + params["objective"] = "multi:softprob" + params["num_class"] = num_classes + else: + # use user specified objective or default objective. + # e.g., the default objective for Regressor is 'reg:squarederror' + params["objective"] = self.getOrDefault("objective") + + # TODO: support "num_parallel_tree" for random forest + params["num_boost_round"] = self.getOrDefault("n_estimators") + + return params + + @classmethod + def _get_xgb_train_call_args( + cls, train_params: Dict[str, Any] + ) -> Tuple[Dict[str, Any], Dict[str, Any]]: + xgb_train_default_args = _get_default_params_from_func( + worker_train, _unsupported_train_params + ) + booster_params, kwargs_params = {}, {} + for key, value in train_params.items(): + if key in xgb_train_default_args: + kwargs_params[key] = value + else: + booster_params[key] = value + + booster_params = { + k: v for k, v in booster_params.items() if k not in _non_booster_params + } + return booster_params, kwargs_params + + def _prepare_input_columns_and_feature_prop( + self, dataset: DataFrame + ) -> Tuple[List[Column], FeatureProp]: + label_col = col(self.getOrDefault(self.labelCol)).alias(alias.label) + + select_cols = [label_col] + features_cols_names = None + enable_sparse_data_optim = self.getOrDefault(self.enable_sparse_data_optim) + if enable_sparse_data_optim: + features_col_name = self.getOrDefault(self.featuresCol) + features_col_datatype = dataset.schema[features_col_name].dataType + if not isinstance(features_col_datatype, VectorUDT): + raise ValueError( + "If enable_sparse_data_optim is True, the feature column values must be " + "`pyspark.ml.linalg.Vector` type." + ) + select_cols.extend(_get_unwrapped_vec_cols(col(features_col_name))) + else: + if self.getOrDefault(self.features_cols): + features_cols_names = self.getOrDefault(self.features_cols) + features_cols = _validate_and_convert_feature_col_as_float_col_list( + dataset, features_cols_names + ) + select_cols.extend(features_cols) + else: + features_array_col = _validate_and_convert_feature_col_as_array_col( + dataset, self.getOrDefault(self.featuresCol) + ) + select_cols.append(features_array_col) + + if self._col_is_defined_not_empty(self.weightCol): + select_cols.append( + col(self.getOrDefault(self.weightCol)).alias(alias.weight) + ) + + has_validation_col = False + if self._col_is_defined_not_empty(self.validationIndicatorCol): + select_cols.append( + col(self.getOrDefault(self.validationIndicatorCol)).alias(alias.valid) + ) + # In some cases, see https://issues.apache.org/jira/browse/SPARK-40407, + # the df.repartition can result in some reducer partitions without data, + # which will cause exception or hanging issue when creating DMatrix. + has_validation_col = True + + if self._col_is_defined_not_empty(self.base_margin_col): + select_cols.append( + col(self.getOrDefault(self.base_margin_col)).alias(alias.margin) + ) + + if self._col_is_defined_not_empty(self.qid_col): + select_cols.append(col(self.getOrDefault(self.qid_col)).alias(alias.qid)) + + feature_prop = FeatureProp( + enable_sparse_data_optim, has_validation_col, features_cols_names + ) + return select_cols, feature_prop + + def _prepare_input(self, dataset: DataFrame) -> Tuple[DataFrame, FeatureProp]: + """Prepare the input including column pruning, repartition and so on""" + + select_cols, feature_prop = self._prepare_input_columns_and_feature_prop( + dataset + ) + + dataset = dataset.select(*select_cols) + + num_workers = self.getOrDefault(self.num_workers) + sc = _get_spark_session().sparkContext + max_concurrent_tasks = _get_max_num_concurrent_tasks(sc) + + if feature_prop.has_validation_col: + dtype = dataset.schema[alias.valid].dataType + if not isinstance(dtype, BooleanType): + raise TypeError("The validation indicator must be boolean type.") + + if num_workers > max_concurrent_tasks: + get_logger(self.__class__.__name__).warning( + "The num_workers %s set for xgboost distributed " + "training is greater than current max number of concurrent " + "spark task slots, you need wait until more task slots available " + "or you need increase spark cluster workers.", + num_workers, + ) + + if self._repartition_needed(dataset): + if self._col_is_defined_not_empty(self.qid_col): + # For ranking problem, we need to try best the put the instances with + # same group into the same partition + dataset = dataset.repartitionByRange(num_workers, alias.qid) + else: + # If validationIndicatorCol defined, and if user unionise train and validation + # dataset, users must set force_repartition to true to force repartition. + # Or else some partitions might contain only train or validation dataset. + if self.getOrDefault(self.repartition_random_shuffle): + # In some cases, spark round-robin repartition might cause data skew + # use random shuffle can address it. + dataset = dataset.repartition(num_workers, rand(1)) + else: + dataset = dataset.repartition(num_workers) + + if self._col_is_defined_not_empty(self.qid_col): + # XGBoost requires qid to be sorted for each partition + dataset = dataset.sortWithinPartitions(alias.qid, ascending=True) + + return dataset, feature_prop + + def _get_xgb_parameters( + self, dataset: DataFrame + ) -> Tuple[Dict[str, Any], Dict[str, Any], Dict[str, Any]]: + train_params = self._get_distributed_train_params(dataset) + booster_params, train_call_kwargs_params = self._get_xgb_train_call_args( + train_params + ) + cpu_per_task = int( + _get_spark_session().sparkContext.getConf().get("spark.task.cpus", "1") + ) + + dmatrix_kwargs = { + "nthread": cpu_per_task, + "feature_types": self.getOrDefault("feature_types"), + "feature_names": self.getOrDefault("feature_names"), + "feature_weights": self.getOrDefault("feature_weights"), + "missing": float(self.getOrDefault("missing")), + } + if dmatrix_kwargs["feature_types"] is not None: + dmatrix_kwargs["enable_categorical"] = True + booster_params["nthread"] = cpu_per_task + + # Remove the parameters whose value is None + booster_params = {k: v for k, v in booster_params.items() if v is not None} + train_call_kwargs_params = { + k: v for k, v in train_call_kwargs_params.items() if v is not None + } + dmatrix_kwargs = {k: v for k, v in dmatrix_kwargs.items() if v is not None} + + return booster_params, train_call_kwargs_params, dmatrix_kwargs + + def _skip_stage_level_scheduling(self, spark_version: str, conf: SparkConf) -> bool: + # pylint: disable=too-many-return-statements + """Check if stage-level scheduling is not needed, + return true to skip stage-level scheduling""" + + if self._run_on_gpu(): + if spark_version < "3.4.0": + self.logger.info( + "Stage-level scheduling in xgboost requires spark version 3.4.0+" + ) + return True + + if ( + "3.4.0" <= spark_version < "3.5.1" + and not _is_standalone_or_localcluster(conf) + ): + self.logger.info( + "For %s, Stage-level scheduling in xgboost requires spark standalone " + "or local-cluster mode", + spark_version, + ) + return True + + executor_cores = conf.get("spark.executor.cores") + executor_gpus = conf.get("spark.executor.resource.gpu.amount") + if executor_cores is None or executor_gpus is None: + self.logger.info( + "Stage-level scheduling in xgboost requires spark.executor.cores, " + "spark.executor.resource.gpu.amount to be set." + ) + return True + + if int(executor_cores) == 1: + # there will be only 1 task running at any time. + self.logger.info( + "Stage-level scheduling in xgboost requires spark.executor.cores > 1 " + ) + return True + + if int(executor_gpus) > 1: + # For spark.executor.resource.gpu.amount > 1, we suppose user knows how to configure + # to make xgboost run successfully. + # + self.logger.info( + "Stage-level scheduling in xgboost will not work " + "when spark.executor.resource.gpu.amount>1" + ) + return True + + task_gpu_amount = conf.get("spark.task.resource.gpu.amount") + + if task_gpu_amount is None: + # The ETL tasks will not grab a gpu when spark.task.resource.gpu.amount is not set, + # but with stage-level scheduling, we can make training task grab the gpu. + return False + + if float(task_gpu_amount) == float(executor_gpus): + # spark.executor.resource.gpu.amount=spark.task.resource.gpu.amount " + # results in only 1 task running at a time, which may cause perf issue. + return True + + # We can enable stage-level scheduling + return False + + # CPU training doesn't require stage-level scheduling + return True + + def _try_stage_level_scheduling(self, rdd: RDD) -> RDD: + """Try to enable stage-level scheduling""" + ss = _get_spark_session() + conf = ss.sparkContext.getConf() + if _is_local(ss.sparkContext) or self._skip_stage_level_scheduling( + ss.version, conf + ): + return rdd + + # executor_cores will not be None + executor_cores = conf.get("spark.executor.cores") + assert executor_cores is not None + + # Spark-rapids is a project to leverage GPUs to accelerate spark SQL. + # If spark-rapids is enabled, to avoid GPU OOM, we don't allow other + # ETL gpu tasks running alongside training tasks. + spark_plugins = ss.conf.get("spark.plugins", " ") + assert spark_plugins is not None + spark_rapids_sql_enabled = ss.conf.get("spark.rapids.sql.enabled", "true") + assert spark_rapids_sql_enabled is not None + + task_cores = ( + int(executor_cores) + if "com.nvidia.spark.SQLPlugin" in spark_plugins + and "true" == spark_rapids_sql_enabled.lower() + else (int(executor_cores) // 2) + 1 + ) + + # Each training task requires cpu cores > total executor cores//2 + 1 which can + # make sure the tasks be sent to different executors. + # + # Please note that we can't use GPU to limit the concurrent tasks because of + # https://issues.apache.org/jira/browse/SPARK-45527. + + task_gpus = 1.0 + treqs = TaskResourceRequests().cpus(task_cores).resource("gpu", task_gpus) + rp = ResourceProfileBuilder().require(treqs).build + + self.logger.info( + "XGBoost training tasks require the resource(cores=%s, gpu=%s).", + task_cores, + task_gpus, + ) + return rdd.withResources(rp) + + def _get_tracker_args(self) -> Tuple[bool, Dict[str, Any]]: + """Start the tracker and return the tracker envs on the driver side""" + launch_tracker_on_driver = self.getOrDefault(self.launch_tracker_on_driver) + rabit_args = {} + if launch_tracker_on_driver: + conf = Config() + if self.isDefined(self.coll_cfg): + conf = self.getOrDefault(self.coll_cfg) + assert isinstance(conf, Config) + + if conf.tracker_host_ip is None: + conf.tracker_host_ip = ( + _get_spark_session().sparkContext.getConf().get("spark.driver.host") + ) + num_workers = self.getOrDefault(self.num_workers) + rabit_args.update(_get_rabit_args(conf, num_workers)) + else: + if self.isDefined(self.coll_cfg): + conf = self.getOrDefault(self.coll_cfg) + assert isinstance(conf, Config) + if conf.tracker_host_ip is not None: + raise ValueError( + f"You must enable launch_tracker_on_driver to use " + f"tracker host: {conf.tracker_host_ip}" + ) + return launch_tracker_on_driver, rabit_args + + def _fit(self, dataset: DataFrame) -> "_SparkXGBModel": + # pylint: disable=too-many-statements, too-many-locals + self._validate_params() + + dataset, feature_prop = self._prepare_input(dataset) + + ( + booster_params, + train_call_kwargs_params, + dmatrix_kwargs, + ) = self._get_xgb_parameters(dataset) + + run_on_gpu = self._run_on_gpu() + + is_local = _is_local(_get_spark_session().sparkContext) + + num_workers = self.getOrDefault(self.num_workers) + + launch_tracker_on_driver, rabit_args = self._get_tracker_args() + conf: Optional[Config] = ( + self.getOrDefault(self.coll_cfg) if self.isSet(self.coll_cfg) else None + ) + + log_level = get_logger_level(_LOG_TAG) + + use_rmm = get_config()["use_rmm"] + + def _train_booster( + pandas_df_iter: Iterator[pd.DataFrame], + ) -> Iterator[pd.DataFrame]: + """Takes in an RDD partition and outputs a booster for that partition after + going through the Rabit Ring protocol + + """ + from pyspark import BarrierTaskContext + + context = BarrierTaskContext.get() + context.barrier() + + dev_ordinal = None + use_qdm = _can_use_qdm( + booster_params.get("tree_method", None), + booster_params.get("device", None), + ) + verbosity = booster_params.get("verbosity", 1) + msg = "Training on CPUs" + if run_on_gpu: + dev_ordinal = ( + context.partitionId() if is_local else _get_gpu_id(context) + ) + booster_params["device"] = "cuda:" + str(dev_ordinal) + # If cuDF is not installed, then using DMatrix instead of QDM, + # because without cuDF, DMatrix performs better than QDM. + # Note: Checking `is_cudf_available` in spark worker side because + # spark worker might has different python environment with driver side. + use_qdm = use_qdm and is_cudf_available() + msg = ( + f"Leveraging {booster_params['device']} to train with " + f"QDM: {'on' if use_qdm else 'off'}" + ) + + if use_qdm and (booster_params.get("max_bin", None) is not None): + dmatrix_kwargs["max_bin"] = booster_params["max_bin"] + _rabit_args = rabit_args + if context.partitionId() == 0: + if not launch_tracker_on_driver: + _conf = conf if conf is not None else Config() + _conf.tracker_host_ip = _get_host_ip(context) + _rabit_args = _get_rabit_args(_conf, num_workers) + get_logger(_LOG_TAG, log_level).info(msg) + + worker_message: Dict[str, Any] = { + "use_qdm": use_qdm, + } + + if not launch_tracker_on_driver: + worker_message["rabit_msg"] = _rabit_args + + messages = context.allGather(message=json.dumps(worker_message)) + if len(set(json.loads(x)["use_qdm"] for x in messages)) != 1: + raise RuntimeError("The workers' cudf environments are in-consistent ") + + if not launch_tracker_on_driver: + _rabit_args = json.loads(messages[0])["rabit_msg"] + + evals_result: Dict[str, Any] = {} + with config_context( + verbosity=verbosity, use_rmm=use_rmm + ), CommunicatorContext(context, **_rabit_args): + dtrain, dvalid = create_dmatrix_from_partitions( + iterator=pandas_df_iter, + feature_cols=feature_prop.features_cols_names, + dev_ordinal=dev_ordinal, + use_qdm=use_qdm, + kwargs=dmatrix_kwargs, + enable_sparse_data_optim=feature_prop.enable_sparse_data_optim, + has_validation_col=feature_prop.has_validation_col, + ) + if dvalid is not None: + dval = [(dtrain, "training"), (dvalid, "validation")] + else: + dval = [(dtrain, "training")] + booster = worker_train( + params=booster_params, + dtrain=dtrain, + evals=dval, + evals_result=evals_result, + **train_call_kwargs_params, + ) + context.barrier() + + if context.partitionId() == 0: + yield pd.DataFrame({"data": [json.dumps(dict(evals_result))]}) + config = booster.save_config() + yield pd.DataFrame({"data": [config]}) + booster_json = booster.save_raw("json").decode("utf-8") + + for offset in range(0, len(booster_json), _MODEL_CHUNK_SIZE): + booster_chunk = booster_json[offset : offset + _MODEL_CHUNK_SIZE] + yield pd.DataFrame({"data": [booster_chunk]}) + + def _run_job() -> Tuple[str, str, str]: + rdd = ( + dataset.mapInPandas( + _train_booster, # type: ignore + schema="data string", + ) + .rdd.barrier() + .mapPartitions(lambda x: x) + ) + rdd_with_resource = self._try_stage_level_scheduling(rdd) + ret = rdd_with_resource.collect() + data = [v[0] for v in ret] + return data[0], data[1], "".join(data[2:]) + + get_logger(_LOG_TAG).info( + "Running xgboost-%s on %s workers with" + "\n\tbooster params: %s" + "\n\ttrain_call_kwargs_params: %s" + "\n\tdmatrix_kwargs: %s", + _py_version(), + num_workers, + booster_params, + train_call_kwargs_params, + dmatrix_kwargs, + ) + evals_result, config, booster = _run_job() + get_logger(_LOG_TAG).info("Finished xgboost training!") + + result_xgb_model = self._convert_to_sklearn_model( + bytearray(booster, "utf-8"), config + ) + training_summary = XGBoostTrainingSummary.from_metrics(json.loads(evals_result)) + spark_model = self._create_pyspark_model(result_xgb_model, training_summary) + # According to pyspark ML convention, the model uid should be the same + # with estimator uid. + spark_model._resetUid(self.uid) + return self._copyValues(spark_model) + + def write(self) -> "SparkXGBWriter": + """ + Return the writer for saving the estimator. + """ + return SparkXGBWriter(self) + + @classmethod + def read(cls) -> "SparkXGBReader": + """ + Return the reader for loading the estimator. + """ + return SparkXGBReader(cls) + + +class _SparkXGBModel(Model, _SparkXGBParams, MLReadable, MLWritable): + def __init__( + self, + xgb_sklearn_model: Optional[XGBModel] = None, + training_summary: Optional[XGBoostTrainingSummary] = None, + ) -> None: + super().__init__() + self._xgb_sklearn_model = xgb_sklearn_model + self.training_summary = training_summary + + @classmethod + def _xgb_cls(cls) -> Type[XGBModel]: + raise NotImplementedError() + + def get_booster(self) -> Booster: + """ + Return the `xgboost.core.Booster` instance. + """ + assert self._xgb_sklearn_model is not None + return self._xgb_sklearn_model.get_booster() + + def get_feature_importances( + self, importance_type: str = "weight" + ) -> Dict[str, Union[float, List[float]]]: + """Get feature importance of each feature. + Importance type can be defined as: + + * 'weight': the number of times a feature is used to split the data across all trees. + * 'gain': the average gain across all splits the feature is used in. + * 'cover': the average coverage across all splits the feature is used in. + * 'total_gain': the total gain across all splits the feature is used in. + * 'total_cover': the total coverage across all splits the feature is used in. + + Parameters + ---------- + importance_type: str, default 'weight' + One of the importance types defined above. + """ + return self.get_booster().get_score(importance_type=importance_type) + + def write(self) -> "SparkXGBModelWriter": + """ + Return the writer for saving the model. + """ + return SparkXGBModelWriter(self) + + @classmethod + def read(cls) -> "SparkXGBModelReader": + """ + Return the reader for loading the model. + """ + return SparkXGBModelReader(cls) + + def _get_feature_col( + self, dataset: DataFrame + ) -> Tuple[List[Column], Optional[List[str]]]: + """XGBoost model trained with features_cols parameter can also predict + vector or array feature type. But first we need to check features_cols + and then featuresCol + """ + if self.getOrDefault(self.enable_sparse_data_optim): + feature_col_names = None + features_col = _get_unwrapped_vec_cols( + col(self.getOrDefault(self.featuresCol)) + ) + return features_col, feature_col_names + + feature_col_names = self.getOrDefault(self.features_cols) + features_col = [] + if feature_col_names and set(feature_col_names).issubset(set(dataset.columns)): + # The model is trained with features_cols and the predicted dataset + # also contains all the columns specified by features_cols. + features_col = _validate_and_convert_feature_col_as_float_col_list( + dataset, feature_col_names + ) + else: + # 1. The model was trained by features_cols, but the dataset doesn't contain + # all the columns specified by features_cols, so we need to check if + # the dataframe has the featuresCol + # 2. The model was trained by featuresCol, and the predicted dataset must contain + # featuresCol column. + feature_col_names = None + features_col.append( + _validate_and_convert_feature_col_as_array_col( + dataset, self.getOrDefault(self.featuresCol) + ) + ) + return features_col, feature_col_names + + def _get_pred_contrib_col_name(self) -> Optional[str]: + """Return the pred_contrib_col col name""" + pred_contrib_col_name = None + if self._col_is_defined_not_empty(self.pred_contrib_col): + pred_contrib_col_name = self.getOrDefault(self.pred_contrib_col) + + return pred_contrib_col_name + + def _out_schema(self) -> Tuple[bool, str]: + """Return the bool to indicate if it's a single prediction, true is single prediction, + and the returned type of the user-defined function. The value must + be a DDL-formatted type string.""" + + if self._get_pred_contrib_col_name() is not None: + return False, f"{pred.prediction} double, {pred.pred_contrib} array" + + return True, "double" + + def _get_predict_func(self) -> Callable: + """Return the true prediction function which will be running on the executor side""" + + predict_params = self._gen_predict_params_dict() + pred_contrib_col_name = self._get_pred_contrib_col_name() + + def _predict( + model: XGBModel, X: ArrayLike, base_margin: Optional[ArrayLike] + ) -> Union[pd.DataFrame, pd.Series]: + data = {} + preds = model.predict( + X, + base_margin=base_margin, + validate_features=False, + **predict_params, + ) + data[pred.prediction] = pd.Series(preds) + + if pred_contrib_col_name is not None: + contribs = pred_contribs(model, X, base_margin) + data[pred.pred_contrib] = pd.Series(list(contribs)) + return pd.DataFrame(data=data) + + return data[pred.prediction] + + return _predict + + def _post_transform(self, dataset: DataFrame, pred_col: Column) -> DataFrame: + """Post process of transform""" + prediction_col_name = self.getOrDefault(self.predictionCol) + single_pred, _ = self._out_schema() + + if single_pred: + if prediction_col_name: + dataset = dataset.withColumn(prediction_col_name, pred_col) + else: + pred_struct_col = "_prediction_struct" + dataset = dataset.withColumn(pred_struct_col, pred_col) + + if prediction_col_name: + dataset = dataset.withColumn( + prediction_col_name, getattr(col(pred_struct_col), pred.prediction) + ) + + pred_contrib_col_name = self._get_pred_contrib_col_name() + if pred_contrib_col_name is not None: + dataset = dataset.withColumn( + pred_contrib_col_name, + array_to_vector(getattr(col(pred_struct_col), pred.pred_contrib)), + ) + + dataset = dataset.drop(pred_struct_col) + return dataset + + def _run_on_gpu(self) -> bool: + """If gpu is used to do the prediction according to the parameters + and spark configurations""" + + use_gpu_by_params = super()._run_on_gpu() + + if _is_local(_get_spark_session().sparkContext): + # if it's local model, no need to check the spark configurations + return use_gpu_by_params + + gpu_per_task = ( + _get_spark_session() + .sparkContext.getConf() + .get("spark.task.resource.gpu.amount") + ) + + # User don't set gpu configurations, just use cpu + if gpu_per_task is None: + if use_gpu_by_params: + get_logger(_LOG_TAG).warning( + "Do the prediction on the CPUs since " + "no gpu configurations are set" + ) + return False + + # User already sets the gpu configurations. + return use_gpu_by_params + + def _transform(self, dataset: DataFrame) -> DataFrame: + # pylint: disable=too-many-statements, too-many-locals + # Save xgb_sklearn_model and predict_params to be local variable + # to avoid the `self` object to be pickled to remote. + xgb_sklearn_model = self._xgb_sklearn_model + + base_margin_col = None + if self._col_is_defined_not_empty(self.base_margin_col): + base_margin_col = col(self.getOrDefault(self.base_margin_col)).alias( + alias.margin + ) + has_base_margin = base_margin_col is not None + + features_col, feature_col_names = self._get_feature_col(dataset) + enable_sparse_data_optim = self.getOrDefault(self.enable_sparse_data_optim) + + predict_func = self._get_predict_func() + + _, schema = self._out_schema() + + is_local = _is_local(_get_spark_session().sparkContext) + run_on_gpu = self._run_on_gpu() + + log_level = get_logger_level(_LOG_TAG) + + @pandas_udf(schema) # type: ignore + def predict_udf(iterator: Iterator[pd.DataFrame]) -> Iterator[pd.Series]: + assert xgb_sklearn_model is not None + model = xgb_sklearn_model + + from pyspark import TaskContext + + context = TaskContext.get() + assert context is not None + + dev_ordinal = -1 + + msg = "Do the inference on the CPUs" + if run_on_gpu: + if is_cudf_available() and is_cupy_available(): + if is_local: + cp = import_cupy() + + total_gpus = cp.cuda.runtime.getDeviceCount() + if total_gpus > 0: + partition_id = context.partitionId() + # For transform local mode, default the dev_ordinal to + # (partition id) % gpus. + dev_ordinal = partition_id % total_gpus + else: + dev_ordinal = _get_gpu_id(context) + + if dev_ordinal >= 0: + device = "cuda:" + str(dev_ordinal) + msg = "Do the inference with device: " + device + model.set_params(device=device) + else: + msg = "Couldn't get the correct gpu id, fallback the inference on the CPUs" + else: + msg = "CUDF or Cupy is unavailable, fallback the inference on the CPUs" + + if context.partitionId() == 0: + get_logger(_LOG_TAG, log_level).info(msg) + + def to_gpu_if_possible(data: ArrayLike) -> ArrayLike: + """Move the data to gpu if possible""" + if dev_ordinal >= 0: + import cudf + import cupy as cp + + # We must set the device after import cudf, which will change the device id to 0 + # See https://github.com/rapidsai/cudf/issues/11386 + cp.cuda.runtime.setDevice(dev_ordinal) # pylint: disable=I1101 + df = cudf.DataFrame(data) + del data + return df + return data + + for data in iterator: + if enable_sparse_data_optim: + X = _read_csr_matrix_from_unwrapped_spark_vec(data) + else: + if feature_col_names is not None: + tmp: ArrayLike = data[feature_col_names] + else: + tmp = stack_series(data[alias.data]) + X = to_gpu_if_possible(tmp) + + if has_base_margin: + base_margin = to_gpu_if_possible(data[alias.margin]) + else: + base_margin = None + + yield predict_func(model, X, base_margin) + + if has_base_margin: + assert base_margin_col is not None + pred_col = predict_udf(struct(*features_col, base_margin_col)) + else: + pred_col = predict_udf(struct(*features_col)) + + return self._post_transform(dataset, pred_col) + + +class _ClassificationModel( # pylint: disable=abstract-method + _SparkXGBModel, HasProbabilityCol, HasRawPredictionCol, HasContribPredictionCol +): + """ + The model returned by :func:`xgboost.spark.SparkXGBClassifier.fit` + + .. Note:: This API is experimental. + """ + + def _out_schema(self) -> Tuple[bool, str]: + schema = ( + f"{pred.raw_prediction} array, {pred.prediction} double," + f" {pred.probability} array" + ) + if self._get_pred_contrib_col_name() is not None: + # We will force setting strict_shape to True when predicting contribs, + # So, it will also output 3-D shape result. + schema = f"{schema}, {pred.pred_contrib} array>" + + return False, schema + + def _get_predict_func(self) -> Callable: + predict_params = self._gen_predict_params_dict() + pred_contrib_col_name = self._get_pred_contrib_col_name() + + def transform_margin(margins: np.ndarray) -> Tuple[np.ndarray, np.ndarray]: + if margins.ndim == 1: + # binomial case + classone_probs = expit(margins) + classzero_probs = 1.0 - classone_probs + raw_preds = np.vstack((-margins, margins)).transpose() + class_probs = np.vstack((classzero_probs, classone_probs)).transpose() + else: + # multinomial case + raw_preds = margins + class_probs = softmax(raw_preds, axis=1) + return raw_preds, class_probs + + def _predict( + model: XGBModel, X: ArrayLike, base_margin: Optional[np.ndarray] + ) -> Union[pd.DataFrame, pd.Series]: + margins = model.predict( + X, + base_margin=base_margin, + output_margin=True, + validate_features=False, + **predict_params, + ) + raw_preds, class_probs = transform_margin(margins) + + # It seems that they use argmax of class probs, + # not of margin to get the prediction (Note: scala implementation) + preds = np.argmax(class_probs, axis=1) + result: Dict[str, pd.Series] = { + pred.raw_prediction: pd.Series(list(raw_preds)), + pred.prediction: pd.Series(preds), + pred.probability: pd.Series(list(class_probs)), + } + + if pred_contrib_col_name is not None: + contribs = pred_contribs(model, X, base_margin, strict_shape=True) + result[pred.pred_contrib] = pd.Series(list(contribs.tolist())) + + return pd.DataFrame(data=result) + + return _predict + + def _post_transform(self, dataset: DataFrame, pred_col: Column) -> DataFrame: + pred_struct_col = "_prediction_struct" + dataset = dataset.withColumn(pred_struct_col, pred_col) + + raw_prediction_col_name = self.getOrDefault(self.rawPredictionCol) + if raw_prediction_col_name: + dataset = dataset.withColumn( + raw_prediction_col_name, + array_to_vector(getattr(col(pred_struct_col), pred.raw_prediction)), + ) + + prediction_col_name = self.getOrDefault(self.predictionCol) + if prediction_col_name: + dataset = dataset.withColumn( + prediction_col_name, getattr(col(pred_struct_col), pred.prediction) + ) + + probability_col_name = self.getOrDefault(self.probabilityCol) + if probability_col_name: + dataset = dataset.withColumn( + probability_col_name, + array_to_vector(getattr(col(pred_struct_col), pred.probability)), + ) + + pred_contrib_col_name = self._get_pred_contrib_col_name() + if pred_contrib_col_name is not None: + dataset = dataset.withColumn( + pred_contrib_col_name, + getattr(col(pred_struct_col), pred.pred_contrib), + ) + + return dataset.drop(pred_struct_col) + + +class _SparkXGBSharedReadWrite: + @staticmethod + def saveMetadata( + instance: Union[_SparkXGBEstimator, _SparkXGBModel], + path: str, + sc: SparkContext, + logger: logging.Logger, + extraMetadata: Optional[Dict[str, Any]] = None, + ) -> None: + """ + Save the metadata of an xgboost.spark._SparkXGBEstimator or + xgboost.spark._SparkXGBModel. + """ + instance._validate_params() + skipParams = ["callbacks", "xgb_model", "coll_cfg"] + jsonParams = {} + for p, v in instance._paramMap.items(): # pylint: disable=protected-access + if p.name not in skipParams: + jsonParams[p.name] = v + + extraMetadata = extraMetadata or {} + callbacks = instance.getOrDefault("callbacks") + if callbacks is not None: + logger.warning( + "The callbacks parameter is saved using cloudpickle and it " + "is not a fully self-contained format. It may fail to load " + "with different versions of dependencies." + ) + serialized_callbacks = base64.encodebytes( + cloudpickle.dumps(callbacks) + ).decode("ascii") + extraMetadata["serialized_callbacks"] = serialized_callbacks + init_booster = instance.getOrDefault("xgb_model") + if init_booster is not None: + extraMetadata["init_booster"] = _INIT_BOOSTER_SAVE_PATH + + if instance.isDefined("coll_cfg"): + conf: Config = instance.getOrDefault("coll_cfg") + if conf is not None: + extraMetadata["coll_cfg"] = asdict(conf) + + DefaultParamsWriter.saveMetadata( + instance, path, sc, extraMetadata=extraMetadata, paramMap=jsonParams + ) + if init_booster is not None: + ser_init_booster = serialize_booster(init_booster) + save_path = os.path.join(path, _INIT_BOOSTER_SAVE_PATH) + _get_spark_session().createDataFrame( + [(ser_init_booster,)], ["init_booster"] + ).write.parquet(save_path) + + @staticmethod + def loadMetadataAndInstance( + pyspark_xgb_cls: Union[Type[_SparkXGBEstimator], Type[_SparkXGBModel]], + path: str, + sc: SparkContext, + logger: logging.Logger, + ) -> Tuple[Dict[str, Any], Union[_SparkXGBEstimator, _SparkXGBModel]]: + """ + Load the metadata and the instance of an xgboost.spark._SparkXGBEstimator or + xgboost.spark._SparkXGBModel. + + :return: a tuple of (metadata, instance) + """ + metadata = DefaultParamsReader.loadMetadata( + path, sc, expectedClassName=get_class_name(pyspark_xgb_cls) + ) + pyspark_xgb = pyspark_xgb_cls() + DefaultParamsReader.getAndSetParams(pyspark_xgb, metadata) + + if "serialized_callbacks" in metadata: + serialized_callbacks = metadata["serialized_callbacks"] + try: + callbacks = cloudpickle.loads( + base64.decodebytes(serialized_callbacks.encode("ascii")) + ) + pyspark_xgb.set(pyspark_xgb.callbacks, callbacks) # type: ignore + except Exception as e: # pylint: disable=W0703 + logger.warning( + f"Fails to load the callbacks param due to {e}. Please set the " + "callbacks param manually for the loaded estimator." + ) + if "coll_cfg" in metadata: + pyspark_xgb.set_coll_cfg(Config(**metadata["coll_cfg"])) + + if "init_booster" in metadata: + load_path = os.path.join(path, metadata["init_booster"]) + ser_init_booster = ( + _get_spark_session().read.parquet(load_path).collect()[0].init_booster + ) + init_booster = deserialize_booster(ser_init_booster) + pyspark_xgb.set(pyspark_xgb.xgb_model, init_booster) # type: ignore + + pyspark_xgb._resetUid(metadata["uid"]) # pylint: disable=protected-access + return metadata, pyspark_xgb + + +class SparkXGBWriter(MLWriter): + """ + Spark Xgboost estimator writer. + """ + + def __init__(self, instance: "_SparkXGBEstimator") -> None: + super().__init__() + self.instance = instance + self.logger = get_logger(self.__class__.__name__, level="WARN") + + def saveImpl(self, path: str) -> None: + """ + save model. + """ + _SparkXGBSharedReadWrite.saveMetadata(self.instance, path, self.sc, self.logger) + + +class SparkXGBReader(MLReader): + """ + Spark Xgboost estimator reader. + """ + + def __init__(self, cls: Type["_SparkXGBEstimator"]) -> None: + super().__init__() + self.cls = cls + self.logger = get_logger(self.__class__.__name__, level="WARN") + + def load(self, path: str) -> "_SparkXGBEstimator": + """ + load model. + """ + _, pyspark_xgb = _SparkXGBSharedReadWrite.loadMetadataAndInstance( + self.cls, path, self.sc, self.logger + ) + return cast("_SparkXGBEstimator", pyspark_xgb) + + +class SparkXGBModelWriter(MLWriter): + """ + Spark Xgboost model writer. + """ + + def __init__(self, instance: _SparkXGBModel) -> None: + super().__init__() + self.instance = instance + self.logger = get_logger(self.__class__.__name__, level="WARN") + + def saveImpl(self, path: str) -> None: + """ + Save metadata and model for a :py:class:`_SparkXGBModel` + - save metadata to path/metadata + - save model to path/model.json + """ + xgb_model = self.instance._xgb_sklearn_model + assert xgb_model is not None + _SparkXGBSharedReadWrite.saveMetadata(self.instance, path, self.sc, self.logger) + model_save_path = os.path.join(path, "model") + booster = xgb_model.get_booster().save_raw("json").decode("utf-8") + booster_chunks = [] + + for offset in range(0, len(booster), _MODEL_CHUNK_SIZE): + booster_chunks.append(booster[offset : offset + _MODEL_CHUNK_SIZE]) + + _get_spark_session().sparkContext.parallelize(booster_chunks, 1).saveAsTextFile( + model_save_path + ) + + +class SparkXGBModelReader(MLReader): + """ + Spark Xgboost model reader. + """ + + def __init__(self, cls: Type["_SparkXGBModel"]) -> None: + super().__init__() + self.cls = cls + self.logger = get_logger(self.__class__.__name__, level="WARN") + + def load(self, path: str) -> "_SparkXGBModel": + """ + Load metadata and model for a :py:class:`_SparkXGBModel` + + :return: SparkXGBRegressorModel or SparkXGBClassifierModel instance + """ + _, py_model = _SparkXGBSharedReadWrite.loadMetadataAndInstance( + self.cls, path, self.sc, self.logger + ) + py_model = cast("_SparkXGBModel", py_model) + + xgb_sklearn_params = py_model._gen_xgb_params_dict( + gen_xgb_sklearn_estimator_param=True + ) + model_load_path = os.path.join(path, "model") + + ser_xgb_model = "".join( + _get_spark_session().sparkContext.textFile(model_load_path).collect() + ) + + def create_xgb_model() -> "XGBModel": + return self.cls._xgb_cls()(**xgb_sklearn_params) + + xgb_model = deserialize_xgb_model(ser_xgb_model, create_xgb_model) + py_model._xgb_sklearn_model = xgb_model + return py_model diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/xgboost/spark/data.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/xgboost/spark/data.py new file mode 100644 index 0000000000000000000000000000000000000000..940e537a26fef98b5894a95dcdd0401478762cbb --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/xgboost/spark/data.py @@ -0,0 +1,365 @@ +# pylint: disable=protected-access +"""Utilities for processing spark partitions.""" + +from collections import defaultdict, namedtuple +from typing import Any, Callable, Dict, Iterator, List, Optional, Sequence, Tuple, Union + +import numpy as np +import pandas as pd +from scipy.sparse import csr_matrix + +from .._typing import ArrayLike +from ..compat import concat +from ..core import DataIter, DMatrix, QuantileDMatrix +from ..sklearn import XGBModel +from .utils import get_logger + + +def stack_series(series: pd.Series) -> np.ndarray: + """Stack a series of arrays.""" + array = series.to_numpy(copy=False) + array = np.stack(array) # type: ignore + return array + + +# Global constant for defining column alias shared between estimator and data +# processing procedures. +Alias = namedtuple("Alias", ("data", "label", "weight", "margin", "valid", "qid")) +alias = Alias("values", "label", "weight", "baseMargin", "validationIndicator", "qid") + + +def concat_or_none(seq: Optional[Sequence[np.ndarray]]) -> Optional[np.ndarray]: + """Concatenate the data if it's not None.""" + if seq: + return concat(seq) + return None + + +def cache_partitions( + iterator: Iterator[pd.DataFrame], append: Callable[[pd.DataFrame, str, bool], None] +) -> None: + """Extract partitions from pyspark iterator. `append` is a user defined function for + accepting new partition.""" + + def make_blob(part: pd.DataFrame, is_valid: bool) -> None: + append(part, alias.data, is_valid) + append(part, alias.label, is_valid) + append(part, alias.weight, is_valid) + append(part, alias.margin, is_valid) + append(part, alias.qid, is_valid) + + has_validation: Optional[bool] = None + + for part in iterator: + if has_validation is None: + has_validation = alias.valid in part.columns + if has_validation is True: + assert alias.valid in part.columns + + if has_validation: + train = part.loc[~part[alias.valid], :] + valid = part.loc[part[alias.valid], :] + else: + train, valid = part, None + + make_blob(train, False) + if valid is not None: + make_blob(valid, True) + + +class PartIter(DataIter): + """Iterator for creating Quantile DMatrix from partitions.""" + + def __init__( + self, data: Dict[str, List], device_id: Optional[int], **kwargs: Any + ) -> None: + self._iter = 0 + self._device_id = device_id + self._data = data + self._kwargs = kwargs + + super().__init__(release_data=True) + + def _fetch(self, data: Optional[Sequence[pd.DataFrame]]) -> Optional[pd.DataFrame]: + if not data: + return None + + if self._device_id is not None: + import cudf + import cupy as cp + + # We must set the device after import cudf, which will change the device id to 0 + # See https://github.com/rapidsai/cudf/issues/11386 + cp.cuda.runtime.setDevice(self._device_id) # pylint: disable=I1101 + return cudf.DataFrame(data[self._iter]) + + return data[self._iter] + + def next(self, input_data: Callable) -> bool: + if self._iter == len(self._data[alias.data]): + return False + input_data( + data=self._fetch(self._data[alias.data]), + label=self._fetch(self._data.get(alias.label, None)), + weight=self._fetch(self._data.get(alias.weight, None)), + base_margin=self._fetch(self._data.get(alias.margin, None)), + qid=self._fetch(self._data.get(alias.qid, None)), + **self._kwargs, + ) + self._iter += 1 + return True + + def reset(self) -> None: + self._iter = 0 + + +def _read_csr_matrix_from_unwrapped_spark_vec(part: pd.DataFrame) -> csr_matrix: + # variables for constructing csr_matrix + csr_indices_list, csr_indptr_list, csr_values_list = [], [0], [] + + n_features = 0 + + for vec_type, vec_size_, vec_indices, vec_values in zip( + part.featureVectorType, + part.featureVectorSize, + part.featureVectorIndices, + part.featureVectorValues, + ): + if vec_type == 0: + # sparse vector + vec_size = int(vec_size_) + csr_indices = vec_indices + csr_values = vec_values + else: + # dense vector + # Note: According to spark ML VectorUDT format, + # when type field is 1, the size field is also empty. + # we need to check the values field to get vector length. + vec_size = len(vec_values) + csr_indices = np.arange(vec_size, dtype=np.int32) + csr_values = vec_values + + if n_features == 0: + n_features = vec_size + assert n_features == vec_size + + csr_indices_list.append(csr_indices) + csr_indptr_list.append(csr_indptr_list[-1] + len(csr_indices)) + csr_values_list.append(csr_values) + + csr_indptr_arr = np.array(csr_indptr_list) + csr_indices_arr = np.concatenate(csr_indices_list) + csr_values_arr = np.concatenate(csr_values_list) + + return csr_matrix( + (csr_values_arr, csr_indices_arr, csr_indptr_arr), shape=(len(part), n_features) + ) + + +def make_qdm( + data: Dict[str, List[np.ndarray]], + dev_ordinal: Optional[int], + meta: Dict[str, Any], + ref: Optional[DMatrix], + params: Dict[str, Any], +) -> DMatrix: + """Handle empty partition for QuantileDMatrix.""" + if not data: + return QuantileDMatrix(np.empty((0, 0)), ref=ref) + it = PartIter(data, dev_ordinal, **meta) + m = QuantileDMatrix(it, **params, ref=ref) + return m + + +def create_dmatrix_from_partitions( # pylint: disable=too-many-arguments + *, + iterator: Iterator[pd.DataFrame], + feature_cols: Optional[Sequence[str]], + dev_ordinal: Optional[int], + use_qdm: bool, + kwargs: Dict[str, Any], # use dict to make sure this parameter is passed. + enable_sparse_data_optim: bool, + has_validation_col: bool, +) -> Tuple[DMatrix, Optional[DMatrix]]: + """Create DMatrix from spark data partitions. + + Parameters + ---------- + iterator : + Pyspark partition iterator. + feature_cols: + A sequence of feature names, used only when rapids plugin is enabled. + dev_ordinal: + Device ordinal, used when GPU is enabled. + use_qdm : + Whether QuantileDMatrix should be used instead of DMatrix. + kwargs : + Metainfo for DMatrix. + enable_sparse_data_optim : + Whether sparse data should be unwrapped + has_validation: + Whether there's validation data. + + Returns + ------- + Training DMatrix and an optional validation DMatrix. + """ + # pylint: disable=too-many-locals, too-many-statements + train_data: Dict[str, List[np.ndarray]] = defaultdict(list) + valid_data: Dict[str, List[np.ndarray]] = defaultdict(list) + + n_features: int = 0 + + def append_m(part: pd.DataFrame, name: str, is_valid: bool) -> None: + nonlocal n_features + if name == alias.data or name in part.columns: + if ( + name == alias.data + and feature_cols is not None + and part[feature_cols].shape[0] > 0 # guard against empty partition + ): + array: Optional[np.ndarray] = part[feature_cols] + elif part[name].shape[0] > 0: + array = part[name] + if name == alias.data: + # For the array/vector typed case. + array = stack_series(array) + else: + array = None + + if name == alias.data and array is not None: + if n_features == 0: + n_features = array.shape[1] + assert n_features == array.shape[1] + + if array is None: + return + + if is_valid: + valid_data[name].append(array) + else: + train_data[name].append(array) + + def append_m_sparse(part: pd.DataFrame, name: str, is_valid: bool) -> None: + nonlocal n_features + + if name == alias.data or name in part.columns: + if name == alias.data: + array = _read_csr_matrix_from_unwrapped_spark_vec(part) + if n_features == 0: + n_features = array.shape[1] + assert n_features == array.shape[1] + else: + array = part[name] + + if is_valid: + valid_data[name].append(array) + else: + train_data[name].append(array) + + def make(values: Dict[str, List[np.ndarray]], kwargs: Dict[str, Any]) -> DMatrix: + if len(values) == 0: + get_logger("XGBoostPySpark").warning( + "Detected an empty partition in the training data. Consider to enable" + " repartition_random_shuffle" + ) + # We must construct an empty DMatrix to bypass the AllReduce + return DMatrix(data=np.empty((0, 0)), **kwargs) + + data = concat_or_none(values[alias.data]) + label = concat_or_none(values.get(alias.label, None)) + weight = concat_or_none(values.get(alias.weight, None)) + margin = concat_or_none(values.get(alias.margin, None)) + qid = concat_or_none(values.get(alias.qid, None)) + return DMatrix( + data=data, label=label, weight=weight, base_margin=margin, qid=qid, **kwargs + ) + + if enable_sparse_data_optim: + append_fn = append_m_sparse + assert "missing" in kwargs and kwargs["missing"] == 0.0 + else: + append_fn = append_m + + def split_params() -> Tuple[Dict[str, Any], Dict[str, Union[int, float, bool]]]: + # FIXME(jiamingy): we really need a better way to bridge distributed frameworks + # to XGBoost native interface and prevent scattering parameters like this. + + # parameters that are not related to data. + non_data_keys = ( + "max_bin", + "missing", + "silent", + "nthread", + "enable_categorical", + ) + non_data_params = {} + meta = {} + for k, v in kwargs.items(): + if k in non_data_keys: + non_data_params[k] = v + else: + meta[k] = v + return meta, non_data_params + + meta, params = split_params() + + if feature_cols is not None and use_qdm: + cache_partitions(iterator, append_fn) + dtrain: DMatrix = make_qdm(train_data, dev_ordinal, meta, None, params) + elif feature_cols is not None and not use_qdm: + cache_partitions(iterator, append_fn) + dtrain = make(train_data, kwargs) + elif feature_cols is None and use_qdm: + cache_partitions(iterator, append_fn) + dtrain = make_qdm(train_data, dev_ordinal, meta, None, params) + else: + cache_partitions(iterator, append_fn) + dtrain = make(train_data, kwargs) + + # Using has_validation_col here to indicate if there is validation col + # instead of getting it from iterator, since the iterator may be empty + # in some special case. That is to say, we must ensure every worker + # construct DMatrix even there is no data since we need to ensure every + # worker do the AllReduce when constructing DMatrix, or else it may hang + # forever. + if has_validation_col: + if use_qdm: + dvalid: Optional[DMatrix] = make_qdm( + valid_data, dev_ordinal, meta, dtrain, params + ) + else: + dvalid = make(valid_data, kwargs) if has_validation_col else None + else: + dvalid = None + + if dvalid is not None: + assert dvalid.num_col() == dtrain.num_col() + + return dtrain, dvalid + + +def pred_contribs( + model: XGBModel, + data: ArrayLike, + base_margin: Optional[ArrayLike] = None, + strict_shape: bool = False, +) -> np.ndarray: + """Predict contributions with data with the full model.""" + iteration_range = model._get_iteration_range(None) + data_dmatrix = DMatrix( + data, + base_margin=base_margin, + missing=model.missing, + nthread=model.n_jobs, + feature_types=model.feature_types, + feature_weights=model.feature_weights, + enable_categorical=model.enable_categorical, + ) + return model.get_booster().predict( + data_dmatrix, + pred_contribs=True, + validate_features=False, + iteration_range=iteration_range, + strict_shape=strict_shape, + ) diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/xgboost/spark/estimator.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/xgboost/spark/estimator.py new file mode 100644 index 0000000000000000000000000000000000000000..aae4412a2fd635cc7cfeeef231d6eb1b2a686579 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/xgboost/spark/estimator.py @@ -0,0 +1,612 @@ +"""Xgboost pyspark integration submodule for estimator API.""" + +# pylint: disable=protected-access, no-member +# pylint: disable=unused-argument, too-many-locals + +from typing import Any, List, Optional, Type, Union + +import numpy as np +from pyspark import keyword_only +from pyspark.ml.param import Param, Params +from pyspark.ml.param.shared import HasProbabilityCol, HasRawPredictionCol + +from ..collective import Config +from ..sklearn import XGBClassifier, XGBRanker, XGBRegressor +from .core import ( # type: ignore + _ClassificationModel, + _SparkXGBEstimator, + _SparkXGBModel, +) +from .utils import get_class_name + + +def _set_pyspark_xgb_cls_param_attrs( + estimator: Type[_SparkXGBEstimator], model: Type[_SparkXGBModel] +) -> None: + """This function automatically infer to xgboost parameters and set them + into corresponding pyspark estimators and models""" + params_dict = estimator._get_xgb_params_default() + + def param_value_converter(v: Any) -> Any: + if isinstance(v, np.generic): + # convert numpy scalar values to corresponding python scalar values + return np.array(v).item() + if isinstance(v, dict): + return {k: param_value_converter(nv) for k, nv in v.items()} + if isinstance(v, list): + return [param_value_converter(nv) for nv in v] + return v + + def set_param_attrs(attr_name: str, param: Param) -> None: + param.typeConverter = param_value_converter + setattr(estimator, attr_name, param) + setattr(model, attr_name, param) + + for name in params_dict.keys(): + doc = ( + f"Refer to XGBoost doc of " + f"{get_class_name(estimator._xgb_cls())} for this param {name}" + ) + + param_obj: Param = Param(Params._dummy(), name=name, doc=doc) + set_param_attrs(name, param_obj) + + fit_params_dict = estimator._get_fit_params_default() + for name in fit_params_dict.keys(): + doc = ( + f"Refer to XGBoost doc of {get_class_name(estimator._xgb_cls())}" + f".fit() for this param {name}" + ) + if name == "callbacks": + doc += ( + "The callbacks can be arbitrary functions. It is saved using cloudpickle " + "which is not a fully self-contained format. It may fail to load with " + "different versions of dependencies." + ) + param_obj = Param(Params._dummy(), name=name, doc=doc) + set_param_attrs(name, param_obj) + + predict_params_dict = estimator._get_predict_params_default() + for name in predict_params_dict.keys(): + doc = ( + f"Refer to XGBoost doc of {get_class_name(estimator._xgb_cls())}" + f".predict() for this param {name}" + ) + param_obj = Param(Params._dummy(), name=name, doc=doc) + set_param_attrs(name, param_obj) + + +class SparkXGBRegressor(_SparkXGBEstimator): + """SparkXGBRegressor is a PySpark ML estimator. It implements the XGBoost regression + algorithm based on XGBoost python library, and it can be used in PySpark Pipeline + and PySpark ML meta algorithms like + - :py:class:`~pyspark.ml.tuning.CrossValidator`/ + - :py:class:`~pyspark.ml.tuning.TrainValidationSplit`/ + - :py:class:`~pyspark.ml.classification.OneVsRest` + + SparkXGBRegressor automatically supports most of the parameters in + :py:class:`xgboost.XGBRegressor` constructor and most of the parameters used in + :py:meth:`xgboost.XGBRegressor.fit` and :py:meth:`xgboost.XGBRegressor.predict` + method. + + To enable GPU support, set `device` to `cuda` or `gpu`. + + SparkXGBRegressor doesn't support setting `base_margin` explicitly as well, but + support another param called `base_margin_col`. see doc below for more details. + + SparkXGBRegressor doesn't support `validate_features` and `output_margin` param. + + SparkXGBRegressor doesn't support setting `nthread` xgboost param, instead, the + `nthread` param for each xgboost worker will be set equal to `spark.task.cpus` + config value. + + + Parameters + ---------- + + features_col: + When the value is string, it requires the features column name to be vector type. + When the value is a list of string, it requires all the feature columns to be numeric types. + label_col: + Label column name. Default to "label". + prediction_col: + Prediction column name. Default to "prediction" + pred_contrib_col: + Contribution prediction column name. + validation_indicator_col: + For params related to `xgboost.XGBRegressor` training with + evaluation dataset's supervision, + set :py:attr:`xgboost.spark.SparkXGBRegressor.validation_indicator_col` + parameter instead of setting the `eval_set` parameter in `xgboost.XGBRegressor` + fit method. + weight_col: + To specify the weight of the training and validation dataset, set + :py:attr:`xgboost.spark.SparkXGBRegressor.weight_col` parameter instead of setting + `sample_weight` and `sample_weight_eval_set` parameter in `xgboost.XGBRegressor` + fit method. + base_margin_col: + To specify the base margins of the training and validation + dataset, set :py:attr:`xgboost.spark.SparkXGBRegressor.base_margin_col` parameter + instead of setting `base_margin` and `base_margin_eval_set` in the + `xgboost.XGBRegressor` fit method. + + num_workers: + How many XGBoost workers to be used to train. + Each XGBoost worker corresponds to one spark task. + device: + + .. versionadded:: 2.0.0 + + Device for XGBoost workers, available options are `cpu`, `cuda`, and `gpu`. + + force_repartition: + Boolean value to specify if forcing the input dataset to be repartitioned + before XGBoost training. + repartition_random_shuffle: + Boolean value to specify if randomly shuffling the dataset when repartitioning is required. + enable_sparse_data_optim: + Boolean value to specify if enabling sparse data optimization, if True, + Xgboost DMatrix object will be constructed from sparse matrix instead of + dense matrix. + launch_tracker_on_driver: + Boolean value to indicate whether the tracker should be launched on the driver side or + the executor side. + coll_cfg: + The collective configuration. See :py:class:`~xgboost.collective.Config` + + kwargs: + A dictionary of xgboost parameters, please refer to + https://xgboost.readthedocs.io/en/stable/parameter.html + + Note + ---- + + The Parameters chart above contains parameters that need special handling. + For a full list of parameters, see entries with `Param(parent=...` below. + + This API is experimental. + + + Examples + -------- + + >>> from xgboost.spark import SparkXGBRegressor + >>> from pyspark.ml.linalg import Vectors + >>> df_train = spark.createDataFrame([ + ... (Vectors.dense(1.0, 2.0, 3.0), 0, False, 1.0), + ... (Vectors.sparse(3, {1: 1.0, 2: 5.5}), 1, False, 2.0), + ... (Vectors.dense(4.0, 5.0, 6.0), 2, True, 1.0), + ... (Vectors.sparse(3, {1: 6.0, 2: 7.5}), 3, True, 2.0), + ... ], ["features", "label", "isVal", "weight"]) + >>> df_test = spark.createDataFrame([ + ... (Vectors.dense(1.0, 2.0, 3.0), ), + ... (Vectors.sparse(3, {1: 1.0, 2: 5.5}), ) + ... ], ["features"]) + >>> xgb_regressor = SparkXGBRegressor(max_depth=5, missing=0.0, + ... validation_indicator_col='isVal', weight_col='weight', + ... early_stopping_rounds=1, eval_metric='rmse') + >>> xgb_reg_model = xgb_regressor.fit(df_train) + >>> xgb_reg_model.transform(df_test) + + """ + + @keyword_only + def __init__( # pylint:disable=too-many-arguments + self, + *, + features_col: Union[str, List[str]] = "features", + label_col: str = "label", + prediction_col: str = "prediction", + pred_contrib_col: Optional[str] = None, + validation_indicator_col: Optional[str] = None, + weight_col: Optional[str] = None, + base_margin_col: Optional[str] = None, + num_workers: int = 1, + device: Optional[str] = None, + force_repartition: bool = False, + repartition_random_shuffle: bool = False, + enable_sparse_data_optim: bool = False, + launch_tracker_on_driver: bool = True, + coll_cfg: Optional[Config] = None, + **kwargs: Any, + ) -> None: + super().__init__() + input_kwargs = self._input_kwargs + self.setParams(**input_kwargs) + + @classmethod + def _xgb_cls(cls) -> Type[XGBRegressor]: + return XGBRegressor + + @classmethod + def _pyspark_model_cls(cls) -> Type["SparkXGBRegressorModel"]: + return SparkXGBRegressorModel + + def _validate_params(self) -> None: + super()._validate_params() + if self.isDefined(self.qid_col): + raise ValueError( + "Spark Xgboost regressor estimator does not support `qid_col` param." + ) + + +class SparkXGBRegressorModel(_SparkXGBModel): + """ + The model returned by :func:`xgboost.spark.SparkXGBRegressor.fit` + + .. Note:: This API is experimental. + """ + + @classmethod + def _xgb_cls(cls) -> Type[XGBRegressor]: + return XGBRegressor + + +_set_pyspark_xgb_cls_param_attrs(SparkXGBRegressor, SparkXGBRegressorModel) + + +class SparkXGBClassifier(_SparkXGBEstimator, HasProbabilityCol, HasRawPredictionCol): + """SparkXGBClassifier is a PySpark ML estimator. It implements the XGBoost + classification algorithm based on XGBoost python library, and it can be used in + PySpark Pipeline and PySpark ML meta algorithms like + - :py:class:`~pyspark.ml.tuning.CrossValidator`/ + - :py:class:`~pyspark.ml.tuning.TrainValidationSplit`/ + - :py:class:`~pyspark.ml.classification.OneVsRest` + + SparkXGBClassifier automatically supports most of the parameters in + :py:class:`xgboost.XGBClassifier` constructor and most of the parameters used in + :py:meth:`xgboost.XGBClassifier.fit` and :py:meth:`xgboost.XGBClassifier.predict` + method. + + To enable GPU support, set `device` to `cuda` or `gpu`. + + SparkXGBClassifier doesn't support setting `base_margin` explicitly as well, but + support another param called `base_margin_col`. see doc below for more details. + + SparkXGBClassifier doesn't support setting `output_margin`, but we can get output + margin from the raw prediction column. See `raw_prediction_col` param doc below for + more details. + + SparkXGBClassifier doesn't support `validate_features` and `output_margin` param. + + SparkXGBClassifier doesn't support setting `nthread` xgboost param, instead, the + `nthread` param for each xgboost worker will be set equal to `spark.task.cpus` + config value. + + + Parameters + ---------- + + features_col: + When the value is string, it requires the features column name to be vector type. + When the value is a list of string, it requires all the feature columns to be numeric types. + label_col: + Label column name. Default to "label". + prediction_col: + Prediction column name. Default to "prediction" + probability_col: + Column name for predicted class conditional probabilities. Default to probabilityCol + raw_prediction_col: + The `output_margin=True` is implicitly supported by the + `rawPredictionCol` output column, which is always returned with the predicted margin + values. + pred_contrib_col: + Contribution prediction column name. + validation_indicator_col: + For params related to `xgboost.XGBClassifier` training with + evaluation dataset's supervision, + set :py:attr:`xgboost.spark.SparkXGBClassifier.validation_indicator_col` + parameter instead of setting the `eval_set` parameter in `xgboost.XGBClassifier` + fit method. + weight_col: + To specify the weight of the training and validation dataset, set + :py:attr:`xgboost.spark.SparkXGBClassifier.weight_col` parameter instead of setting + `sample_weight` and `sample_weight_eval_set` parameter in `xgboost.XGBClassifier` + fit method. + base_margin_col: + To specify the base margins of the training and validation + dataset, set :py:attr:`xgboost.spark.SparkXGBClassifier.base_margin_col` parameter + instead of setting `base_margin` and `base_margin_eval_set` in the + `xgboost.XGBClassifier` fit method. + + num_workers: + How many XGBoost workers to be used to train. + Each XGBoost worker corresponds to one spark task. + device: + + .. versionadded:: 2.0.0 + + Device for XGBoost workers, available options are `cpu`, `cuda`, and `gpu`. + + force_repartition: + Boolean value to specify if forcing the input dataset to be repartitioned + before XGBoost training. + repartition_random_shuffle: + Boolean value to specify if randomly shuffling the dataset when repartitioning is required. + enable_sparse_data_optim: + Boolean value to specify if enabling sparse data optimization, if True, + Xgboost DMatrix object will be constructed from sparse matrix instead of + dense matrix. + launch_tracker_on_driver: + Boolean value to indicate whether the tracker should be launched on the driver side or + the executor side. + coll_cfg: + The collective configuration. See :py:class:`~xgboost.collective.Config` + + kwargs: + A dictionary of xgboost parameters, please refer to + https://xgboost.readthedocs.io/en/stable/parameter.html + + Note + ---- + + The Parameters chart above contains parameters that need special handling. + For a full list of parameters, see entries with `Param(parent=...` below. + + This API is experimental. + + Examples + -------- + + >>> from xgboost.spark import SparkXGBClassifier + >>> from pyspark.ml.linalg import Vectors + >>> df_train = spark.createDataFrame([ + ... (Vectors.dense(1.0, 2.0, 3.0), 0, False, 1.0), + ... (Vectors.sparse(3, {1: 1.0, 2: 5.5}), 1, False, 2.0), + ... (Vectors.dense(4.0, 5.0, 6.0), 0, True, 1.0), + ... (Vectors.sparse(3, {1: 6.0, 2: 7.5}), 1, True, 2.0), + ... ], ["features", "label", "isVal", "weight"]) + >>> df_test = spark.createDataFrame([ + ... (Vectors.dense(1.0, 2.0, 3.0), ), + ... ], ["features"]) + >>> xgb_classifier = SparkXGBClassifier(max_depth=5, missing=0.0, + ... validation_indicator_col='isVal', weight_col='weight', + ... early_stopping_rounds=1, eval_metric='logloss') + >>> xgb_clf_model = xgb_classifier.fit(df_train) + >>> xgb_clf_model.transform(df_test).show() + + """ + + @keyword_only + def __init__( # pylint:disable=too-many-arguments + self, + *, + features_col: Union[str, List[str]] = "features", + label_col: str = "label", + prediction_col: str = "prediction", + probability_col: str = "probability", + raw_prediction_col: str = "rawPrediction", + pred_contrib_col: Optional[str] = None, + validation_indicator_col: Optional[str] = None, + weight_col: Optional[str] = None, + base_margin_col: Optional[str] = None, + num_workers: int = 1, + device: Optional[str] = None, + force_repartition: bool = False, + repartition_random_shuffle: bool = False, + enable_sparse_data_optim: bool = False, + launch_tracker_on_driver: bool = True, + coll_cfg: Optional[Config] = None, + **kwargs: Any, + ) -> None: + super().__init__() + # The default 'objective' param value comes from sklearn `XGBClassifier` ctor, + # but in pyspark we will automatically set objective param depending on + # binary or multinomial input dataset, and we need to remove the fixed default + # param value as well to avoid causing ambiguity. + input_kwargs = self._input_kwargs + self.setParams(**input_kwargs) + self._setDefault(objective=None) + + @classmethod + def _xgb_cls(cls) -> Type[XGBClassifier]: + return XGBClassifier + + @classmethod + def _pyspark_model_cls(cls) -> Type["SparkXGBClassifierModel"]: + return SparkXGBClassifierModel + + def _validate_params(self) -> None: + super()._validate_params() + if self.isDefined(self.qid_col): + raise ValueError( + "Spark Xgboost classifier estimator does not support `qid_col` param." + ) + if self.getOrDefault("objective"): # pylint: disable=no-member + raise ValueError( + "Setting custom 'objective' param is not allowed in 'SparkXGBClassifier'." + ) + + +class SparkXGBClassifierModel(_ClassificationModel): + """ + The model returned by :func:`xgboost.spark.SparkXGBClassifier.fit` + + .. Note:: This API is experimental. + """ + + @classmethod + def _xgb_cls(cls) -> Type[XGBClassifier]: + return XGBClassifier + + +_set_pyspark_xgb_cls_param_attrs(SparkXGBClassifier, SparkXGBClassifierModel) + + +class SparkXGBRanker(_SparkXGBEstimator): + """SparkXGBRanker is a PySpark ML estimator. It implements the XGBoost + ranking algorithm based on XGBoost python library, and it can be used in + PySpark Pipeline and PySpark ML meta algorithms like + :py:class:`~pyspark.ml.tuning.CrossValidator`/ + :py:class:`~pyspark.ml.tuning.TrainValidationSplit`/ + :py:class:`~pyspark.ml.classification.OneVsRest` + + SparkXGBRanker automatically supports most of the parameters in + :py:class:`xgboost.XGBRanker` constructor and most of the parameters used in + :py:meth:`xgboost.XGBRanker.fit` and :py:meth:`xgboost.XGBRanker.predict` method. + + To enable GPU support, set `device` to `cuda` or `gpu`. + + SparkXGBRanker doesn't support setting `base_margin` explicitly as well, but support + another param called `base_margin_col`. see doc below for more details. + + SparkXGBRanker doesn't support setting `output_margin`, but we can get output margin + from the raw prediction column. See `raw_prediction_col` param doc below for more + details. + + SparkXGBRanker doesn't support `validate_features` and `output_margin` param. + + SparkXGBRanker doesn't support setting `nthread` xgboost param, instead, the + `nthread` param for each xgboost worker will be set equal to `spark.task.cpus` + config value. + + + Parameters + ---------- + + features_col: + When the value is string, it requires the features column name to be vector type. + When the value is a list of string, it requires all the feature columns to be numeric types. + label_col: + Label column name. Default to "label". + prediction_col: + Prediction column name. Default to "prediction" + pred_contrib_col: + Contribution prediction column name. + validation_indicator_col: + For params related to `xgboost.XGBRanker` training with + evaluation dataset's supervision, + set :py:attr:`xgboost.spark.SparkXGBRanker.validation_indicator_col` + parameter instead of setting the `eval_set` parameter in :py:class:`xgboost.XGBRanker` + fit method. + weight_col: + To specify the weight of the training and validation dataset, set + :py:attr:`xgboost.spark.SparkXGBRanker.weight_col` parameter instead of setting + `sample_weight` and `sample_weight_eval_set` parameter in :py:class:`xgboost.XGBRanker` + fit method. + base_margin_col: + To specify the base margins of the training and validation + dataset, set :py:attr:`xgboost.spark.SparkXGBRanker.base_margin_col` parameter + instead of setting `base_margin` and `base_margin_eval_set` in the + :py:class:`xgboost.XGBRanker` fit method. + qid_col: + Query id column name. + num_workers: + How many XGBoost workers to be used to train. + Each XGBoost worker corresponds to one spark task. + device: + + .. versionadded:: 2.0.0 + + Device for XGBoost workers, available options are `cpu`, `cuda`, and `gpu`. + + force_repartition: + Boolean value to specify if forcing the input dataset to be repartitioned + before XGBoost training. + repartition_random_shuffle: + Boolean value to specify if randomly shuffling the dataset when repartitioning is required. + enable_sparse_data_optim: + Boolean value to specify if enabling sparse data optimization, if True, + Xgboost DMatrix object will be constructed from sparse matrix instead of + dense matrix. + launch_tracker_on_driver: + Boolean value to indicate whether the tracker should be launched on the driver side or + the executor side. + coll_cfg: + The collective configuration. See :py:class:`~xgboost.collective.Config` + + kwargs: + A dictionary of xgboost parameters, please refer to + https://xgboost.readthedocs.io/en/stable/parameter.html + + .. Note:: The Parameters chart above contains parameters that need special handling. + For a full list of parameters, see entries with `Param(parent=...` below. + + .. Note:: This API is experimental. + + Examples + -------- + + >>> from xgboost.spark import SparkXGBRanker + >>> from pyspark.ml.linalg import Vectors + >>> ranker = SparkXGBRanker(qid_col="qid") + >>> df_train = spark.createDataFrame( + ... [ + ... (Vectors.dense(1.0, 2.0, 3.0), 0, 0), + ... (Vectors.dense(4.0, 5.0, 6.0), 1, 0), + ... (Vectors.dense(9.0, 4.0, 8.0), 2, 0), + ... (Vectors.sparse(3, {1: 1.0, 2: 5.5}), 0, 1), + ... (Vectors.sparse(3, {1: 6.0, 2: 7.5}), 1, 1), + ... (Vectors.sparse(3, {1: 8.0, 2: 9.5}), 2, 1), + ... ], + ... ["features", "label", "qid"], + ... ) + >>> df_test = spark.createDataFrame( + ... [ + ... (Vectors.dense(1.5, 2.0, 3.0), 0), + ... (Vectors.dense(4.5, 5.0, 6.0), 0), + ... (Vectors.dense(9.0, 4.5, 8.0), 0), + ... (Vectors.sparse(3, {1: 1.0, 2: 6.0}), 1), + ... (Vectors.sparse(3, {1: 6.0, 2: 7.0}), 1), + ... (Vectors.sparse(3, {1: 8.0, 2: 10.5}), 1), + ... ], + ... ["features", "qid"], + ... ) + >>> model = ranker.fit(df_train) + >>> model.transform(df_test).show() + """ + + @keyword_only + def __init__( # pylint:disable=too-many-arguments + self, + *, + features_col: Union[str, List[str]] = "features", + label_col: str = "label", + prediction_col: str = "prediction", + pred_contrib_col: Optional[str] = None, + validation_indicator_col: Optional[str] = None, + weight_col: Optional[str] = None, + base_margin_col: Optional[str] = None, + qid_col: Optional[str] = None, + num_workers: int = 1, + device: Optional[str] = None, + force_repartition: bool = False, + repartition_random_shuffle: bool = False, + enable_sparse_data_optim: bool = False, + launch_tracker_on_driver: bool = True, + coll_cfg: Optional[Config] = None, + **kwargs: Any, + ) -> None: + super().__init__() + input_kwargs = self._input_kwargs + self.setParams(**input_kwargs) + + @classmethod + def _xgb_cls(cls) -> Type[XGBRanker]: + return XGBRanker + + @classmethod + def _pyspark_model_cls(cls) -> Type["SparkXGBRankerModel"]: + return SparkXGBRankerModel + + def _validate_params(self) -> None: + super()._validate_params() + if not self.isDefined(self.qid_col): + raise ValueError( + "Spark Xgboost ranker estimator requires setting `qid_col` param." + ) + + +class SparkXGBRankerModel(_SparkXGBModel): + """ + The model returned by :func:`xgboost.spark.SparkXGBRanker.fit` + + .. Note:: This API is experimental. + """ + + @classmethod + def _xgb_cls(cls) -> Type[XGBRanker]: + return XGBRanker + + +_set_pyspark_xgb_cls_param_attrs(SparkXGBRanker, SparkXGBRankerModel) diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/xgboost/spark/params.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/xgboost/spark/params.py new file mode 100644 index 0000000000000000000000000000000000000000..af2f4f9d658873fbb70099d87bb48fd8adc242b6 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/xgboost/spark/params.py @@ -0,0 +1,104 @@ +"""Xgboost pyspark integration submodule for params.""" + +from typing import Dict + +from pyspark.ml.param import TypeConverters +from pyspark.ml.param.shared import Param, Params + + +class HasArbitraryParamsDict(Params): + """ + This is a Params based class that is extended by _SparkXGBParams + and holds the variable to store the **kwargs parts of the XGBoost + input. + """ + + arbitrary_params_dict: "Param[Dict]" = Param( + Params._dummy(), + "arbitrary_params_dict", + "arbitrary_params_dict This parameter holds all of the additional parameters which are " + "not exposed as the XGBoost Spark estimator params but can be recognized by " + "underlying XGBoost library. It is stored as a dictionary.", + ) + + +class HasBaseMarginCol(Params): + """ + This is a Params based class that is extended by _SparkXGBParams + and holds the variable to store the base margin column part of XGboost. + """ + + base_margin_col = Param( + Params._dummy(), + "base_margin_col", + "This stores the name for the column of the base margin", + typeConverter=TypeConverters.toString, + ) + + +class HasFeaturesCols(Params): + """ + Mixin for param features_cols: a list of feature column names. + This parameter is taken effect only when GPU is enabled. + """ + + features_cols = Param( + Params._dummy(), + "features_cols", + "feature column names.", + typeConverter=TypeConverters.toListString, + ) + + def __init__(self) -> None: + super().__init__() + self._setDefault(features_cols=[]) + + +class HasEnableSparseDataOptim(Params): + """ + This is a Params based class that is extended by _SparkXGBParams + and holds the variable to store the boolean config of enabling sparse data optimization. + """ + + enable_sparse_data_optim = Param( + Params._dummy(), + "enable_sparse_data_optim", + "This stores the boolean config of enabling sparse data optimization, if enabled, " + "Xgboost DMatrix object will be constructed from sparse matrix instead of " + "dense matrix. This config is disabled by default. If most of examples in your " + "training dataset contains sparse features, we suggest to enable this config.", + typeConverter=TypeConverters.toBoolean, + ) + + def __init__(self) -> None: + super().__init__() + self._setDefault(enable_sparse_data_optim=False) + + +class HasQueryIdCol(Params): + """ + Mixin for param qid_col: query id column name. + """ + + qid_col = Param( + Params._dummy(), + "qid_col", + "query id column name", + typeConverter=TypeConverters.toString, + ) + + +class HasContribPredictionCol(Params): + """ + Mixin for param pred_contrib_col: contribution prediction column name. + + Output is a 3-dim array, with (rows, groups, columns + 1) for classification case. + Else, it can be a 2 dimension for regression case. + """ + + pred_contrib_col: "Param[str]" = Param( + Params._dummy(), + "pred_contrib_col", + "feature contributions to individual predictions.", + typeConverter=TypeConverters.toString, + ) diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/xgboost/spark/summary.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/xgboost/spark/summary.py new file mode 100644 index 0000000000000000000000000000000000000000..9ee7207396113dba2ecf4c468ab19a92f572f70d --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/xgboost/spark/summary.py @@ -0,0 +1,43 @@ +"""Xgboost training summary integration submodule.""" + +from dataclasses import dataclass, field +from typing import Dict, List + + +@dataclass +class XGBoostTrainingSummary: + """ + A class that holds the training and validation objective history + of an XGBoost model during its training process. + """ + + train_objective_history: Dict[str, List[float]] = field(default_factory=dict) + validation_objective_history: Dict[str, List[float]] = field(default_factory=dict) + + @staticmethod + def from_metrics( + metrics: Dict[str, Dict[str, List[float]]], + ) -> "XGBoostTrainingSummary": + """ + Create an XGBoostTrainingSummary instance from a nested dictionary of metrics. + + Parameters + ---------- + metrics : dict of str to dict of str to list of float + A dictionary containing training and validation metrics. + Example format: + { + "training": {"logloss": [0.1, 0.08]}, + "validation": {"logloss": [0.12, 0.1]} + } + + Returns + ------- + A new instance of XGBoostTrainingSummary. + + """ + train_objective_history = metrics.get("training", {}) + validation_objective_history = metrics.get("validation", {}) + return XGBoostTrainingSummary( + train_objective_history, validation_objective_history + ) diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/xgboost/spark/utils.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/xgboost/spark/utils.py new file mode 100644 index 0000000000000000000000000000000000000000..e0d3e094a805941a5e41f2046c11d2cf8bab528a --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/xgboost/spark/utils.py @@ -0,0 +1,212 @@ +"""Xgboost pyspark integration submodule for helper functions.""" + +# pylint: disable=fixme + +import inspect +import logging +import os +import sys +import uuid +from threading import Thread +from typing import Any, Callable, Dict, Optional, Set, Type, Union + +import pyspark +from pyspark import BarrierTaskContext, SparkConf, SparkContext, SparkFiles, TaskContext +from pyspark.sql.session import SparkSession + +from ..collective import CommunicatorContext as CCtx +from ..collective import Config +from ..collective import _Args as CollArgs +from ..collective import _ArgVals as CollArgsVals +from ..core import Booster +from ..sklearn import XGBModel +from ..tracker import RabitTracker + + +def get_class_name(cls: Type) -> str: + """Return the class name.""" + return f"{cls.__module__}.{cls.__name__}" + + +def _get_default_params_from_func( + func: Callable, unsupported_set: Set[str] +) -> Dict[str, Any]: + """Returns a dictionary of parameters and their default value of function fn. Only + the parameters with a default value will be included. + + """ + sig = inspect.signature(func) + filtered_params_dict = {} + for parameter in sig.parameters.values(): + # Remove parameters without a default value and those in the unsupported_set + if ( + parameter.default is not parameter.empty + and parameter.name not in unsupported_set + ): + filtered_params_dict[parameter.name] = parameter.default + return filtered_params_dict + + +class CommunicatorContext(CCtx): + """Context with PySpark specific task ID.""" + + def __init__(self, context: BarrierTaskContext, **args: CollArgsVals) -> None: + args["dmlc_task_id"] = str(context.partitionId()) + super().__init__(**args) + + +def _start_tracker(host: str, n_workers: int, port: int = 0) -> CollArgs: + """Start Rabit tracker with n_workers""" + args: CollArgs = {"n_workers": n_workers} + tracker = RabitTracker(n_workers=n_workers, host_ip=host, sortby="task", port=port) + tracker.start() + thread = Thread(target=tracker.wait_for) + thread.daemon = True + thread.start() + args.update(tracker.worker_args()) + return args + + +def _get_rabit_args(conf: Config, n_workers: int) -> CollArgs: + """Get rabit context arguments to send to each worker.""" + assert conf.tracker_host_ip is not None + port = 0 if conf.tracker_port is None else conf.tracker_port + env = _start_tracker(conf.tracker_host_ip, n_workers, port) + return env + + +def _get_host_ip(context: BarrierTaskContext) -> str: + """Gets the hostIP for Spark. This essentially gets the IP of the first worker.""" + task_ip_list = [info.address.split(":")[0] for info in context.getTaskInfos()] + return task_ip_list[0] + + +def _get_spark_session() -> SparkSession: + """Get or create spark session. Note: This function can only be invoked from driver + side. + + """ + if pyspark.TaskContext.get() is not None: + # This is a safety check. + raise RuntimeError( + "_get_spark_session should not be invoked from executor side." + ) + return SparkSession.builder.getOrCreate() + + +def get_logger(name: str, level: Optional[Union[str, int]] = None) -> logging.Logger: + """Gets a logger by name, or creates and configures it for the first time.""" + logger = logging.getLogger(name) + if level is not None: + logger.setLevel(level) + else: + # Default to info if not set. + if logger.level == logging.NOTSET: + logger.setLevel(logging.INFO) + # If the logger is configured, skip the configure + if not logger.handlers and not logging.getLogger().handlers: + handler = logging.StreamHandler(sys.stderr) + formatter = logging.Formatter( + "%(asctime)s %(levelname)s %(name)s: %(funcName)s %(message)s" + ) + handler.setFormatter(formatter) + logger.addHandler(handler) + return logger + + +def get_logger_level(name: str) -> Optional[int]: + """Get the logger level for the given log name""" + logger = logging.getLogger(name) + return None if logger.level == logging.NOTSET else logger.level + + +def _get_max_num_concurrent_tasks(spark_context: SparkContext) -> int: + """Gets the current max number of concurrent tasks.""" + # pylint: disable=protected-access + # spark 3.1 and above has a different API for fetching max concurrent tasks + if spark_context._jsc.sc().version() >= "3.1": + return spark_context._jsc.sc().maxNumConcurrentTasks( + spark_context._jsc.sc().resourceProfileManager().resourceProfileFromId(0) + ) + return spark_context._jsc.sc().maxNumConcurrentTasks() + + +def _is_local(spark_context: SparkContext) -> bool: + """Whether it is Spark local mode""" + # pylint: disable=protected-access + return spark_context._jsc.sc().isLocal() + + +def _is_standalone_or_localcluster(conf: SparkConf) -> bool: + master = conf.get("spark.master") + return master is not None and ( + master.startswith("spark://") or master.startswith("local-cluster") + ) + + +def _get_gpu_id(task_context: TaskContext) -> int: + """Get the gpu id from the task resources""" + if task_context is None: + # This is a safety check. + raise RuntimeError("_get_gpu_id should not be invoked from driver side.") + resources = task_context.resources() + if "gpu" not in resources: + raise RuntimeError( + "Couldn't get the gpu id, Please check the GPU resource configuration" + ) + # return the first gpu id. + return int(resources["gpu"].addresses[0].strip()) + + +def _get_or_create_tmp_dir() -> str: + root_dir = SparkFiles.getRootDirectory() + xgb_tmp_dir = os.path.join(root_dir, "xgboost-tmp") + if not os.path.exists(xgb_tmp_dir): + os.makedirs(xgb_tmp_dir) + return xgb_tmp_dir + + +def deserialize_xgb_model( + model: str, xgb_model_creator: Callable[[], XGBModel] +) -> XGBModel: + """ + Deserialize an xgboost.XGBModel instance from the input model. + """ + xgb_model = xgb_model_creator() + xgb_model.load_model(bytearray(model.encode("utf-8"))) + return xgb_model + + +def serialize_booster(booster: Booster) -> str: + """ + Serialize the input booster to a string. + + Parameters + ---------- + booster: + an xgboost.core.Booster instance + """ + # TODO: change to use string io + tmp_file_name = os.path.join(_get_or_create_tmp_dir(), f"{uuid.uuid4()}.json") + booster.save_model(tmp_file_name) + with open(tmp_file_name, encoding="utf-8") as f: + ser_model_string = f.read() + return ser_model_string + + +def deserialize_booster(model: str) -> Booster: + """ + Deserialize an xgboost.core.Booster from the input ser_model_string. + """ + booster = Booster() + # TODO: change to use string io + tmp_file_name = os.path.join(_get_or_create_tmp_dir(), f"{uuid.uuid4()}.json") + with open(tmp_file_name, "w", encoding="utf-8") as f: + f.write(model) + booster.load_model(tmp_file_name) + return booster + + +def use_cuda(device: Optional[str]) -> bool: + """Whether xgboost is using CUDA workers.""" + return device in ("cuda", "gpu") diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/xgboost/testing/__init__.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/xgboost/testing/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..2aeb7b44d6037d301f6084433e3ca92755cd0981 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/xgboost/testing/__init__.py @@ -0,0 +1,785 @@ +"""Utilities for defining Python tests. The module is private and subject to frequent +change without notice. + +""" + +# pylint: disable=missing-function-docstring +import importlib.util +import os +import platform +import queue +import socket +import sys +import threading +from contextlib import contextmanager +from io import StringIO +from platform import system +from typing import ( + Any, + Callable, + Dict, + Generator, + List, + Optional, + Set, + Tuple, + TypedDict, + TypeVar, + Union, +) + +import numpy as np +import pytest +from scipy import sparse + +import xgboost as xgb +from xgboost import RabitTracker +from xgboost.core import ArrayLike +from xgboost.sklearn import SklObjective + +from .._typing import PathLike +from .data import ( + IteratorForTest, + get_california_housing, + get_cancer, + get_digits, + get_sparse, + make_batches, + make_categorical, + make_sparse_regression, +) + +# Used to be defined in this top level module. +from .utils import non_decreasing, non_increasing # NOLINT + +hypothesis = pytest.importorskip("hypothesis") + +# pylint:disable=wrong-import-position,wrong-import-order +from hypothesis import strategies +from hypothesis.extra.numpy import arrays + +datasets = pytest.importorskip("sklearn.datasets") + +PytestSkip = TypedDict("PytestSkip", {"condition": bool, "reason": str}) + + +def has_ipv6() -> bool: + """Check whether IPv6 is enabled on this host.""" + # connection error in macos, still need some fixes. + if system() not in ("Linux", "Windows"): + return False + + if socket.has_ipv6: + try: + with socket.socket( + socket.AF_INET6, socket.SOCK_STREAM + ) as server, socket.socket(socket.AF_INET6, socket.SOCK_STREAM) as client: + server.bind(("::1", 0)) + port = server.getsockname()[1] + server.listen() + + client.connect(("::1", port)) + conn, _ = server.accept() + + client.sendall("abc".encode()) + msg = conn.recv(3).decode() + # if the code can be executed to this point, the message should be + # correct. + assert msg == "abc" + return True + except OSError: + pass + return False + + +def no_mod(name: str) -> PytestSkip: + spec = importlib.util.find_spec(name) + return {"condition": spec is None, "reason": f"{name} is not installed."} + + +def no_ipv6() -> PytestSkip: + """PyTest skip mark for IPv6.""" + return {"condition": not has_ipv6(), "reason": "IPv6 is required to be enabled."} + + +def not_linux() -> PytestSkip: + return {"condition": system() != "Linux", "reason": "Linux is required."} + + +def no_ubjson() -> PytestSkip: + return no_mod("ubjson") + + +def no_sklearn() -> PytestSkip: + return no_mod("sklearn") + + +def no_dask() -> PytestSkip: + return no_mod("dask") + + +def no_loky() -> PytestSkip: + return no_mod("loky") + + +def no_dask_ml() -> PytestSkip: + if sys.platform.startswith("win"): + return {"reason": "Unsupported platform.", "condition": True} + return no_mod("dask_ml") + + +def no_spark() -> PytestSkip: + if sys.platform.startswith("win") or sys.platform.startswith("darwin"): + return {"reason": "Unsupported platform.", "condition": True} + return no_mod("pyspark") + + +def no_pandas() -> PytestSkip: + return no_mod("pandas") + + +def no_arrow() -> PytestSkip: + return no_mod("pyarrow") + + +def no_polars() -> PytestSkip: + return no_mod("polars") + + +def no_modin() -> PytestSkip: + try: + import modin.pandas as md + + md.DataFrame([[1, 2.0, True], [2, 3.0, False]], columns=["a", "b", "c"]) + + except ImportError: + return {"reason": "Failed import modin.", "condition": True} + return {"reason": "Failed import modin.", "condition": True} + + +def no_matplotlib() -> PytestSkip: + reason = "Matplotlib is not installed." + try: + import matplotlib.pyplot as _ # noqa + + return {"condition": False, "reason": reason} + except ImportError: + return {"condition": True, "reason": reason} + + +def no_dask_cuda() -> PytestSkip: + return no_mod("dask_cuda") + + +def no_cudf() -> PytestSkip: + return no_mod("cudf") + + +def no_cupy() -> PytestSkip: + skip_cupy = no_mod("cupy") + if not skip_cupy["condition"] and system() == "Windows": + import cupy as cp + + # Cupy might run into issue on Windows due to missing compiler + try: + cp.array([1, 2, 3]).sum() + except Exception: # pylint: disable=broad-except + skip_cupy["condition"] = True + return skip_cupy + + +def no_dask_cudf() -> PytestSkip: + return no_mod("dask_cudf") + + +def no_graphviz() -> PytestSkip: + return no_mod("graphviz") + + +def no_rmm() -> PytestSkip: + return no_mod("rmm") + + +def no_multiple(*args: Any) -> PytestSkip: + condition = False + reason = "" + for arg in args: + condition = condition or arg["condition"] + if arg["condition"]: + reason = arg["reason"] + break + return {"condition": condition, "reason": reason} + + +def skip_win() -> PytestSkip: + return {"reason": "Unsupported platform.", "condition": is_windows()} + + +def make_regression( + n_samples: int, n_features: int, use_cupy: bool +) -> Tuple[ArrayLike, ArrayLike, ArrayLike]: + """Make a simple regression dataset.""" + X, y, w = make_batches(n_samples, n_features, 1, use_cupy) + return X[0], y[0], w[0] + + +def make_batches_sparse( + n_samples_per_batch: int, n_features: int, n_batches: int, sparsity: float +) -> Tuple[List[sparse.csr_matrix], List[np.ndarray], List[np.ndarray]]: + X = [] + y = [] + w = [] + rng = np.random.RandomState(1994) + for _ in range(n_batches): + _X = sparse.random( + n_samples_per_batch, + n_features, + 1.0 - sparsity, + format="csr", + dtype=np.float32, + random_state=rng, + ) + _y = rng.randn(n_samples_per_batch) + _w = rng.uniform(low=0, high=1, size=n_samples_per_batch) + X.append(_X) + y.append(_y) + w.append(_w) + return X, y, w + + +class TestDataset: + """Contains a dataset in numpy format as well as the relevant objective and metric.""" + + def __init__( + self, name: str, get_dataset: Callable, objective: str, metric: str + ) -> None: + self.name = name + self.objective = objective + self.metric = metric + self.X, self.y = get_dataset() + self.w: Optional[np.ndarray] = None + self.margin: Optional[np.ndarray] = None + + def set_params(self, params_in: Dict[str, Any]) -> Dict[str, Any]: + params_in["objective"] = self.objective + params_in["eval_metric"] = self.metric + if self.objective == "multi:softmax": + params_in["num_class"] = int(np.max(self.y) + 1) + return params_in + + def get_dmat(self) -> xgb.DMatrix: + return xgb.DMatrix( + self.X, + self.y, + weight=self.w, + base_margin=self.margin, + enable_categorical=True, + ) + + def get_device_dmat(self, max_bin: Optional[int]) -> xgb.QuantileDMatrix: + import cupy as cp + + w = None if self.w is None else cp.array(self.w) + X = cp.array(self.X, dtype=np.float32) + y = cp.array(self.y, dtype=np.float32) + return xgb.QuantileDMatrix( + X, y, weight=w, base_margin=self.margin, max_bin=max_bin + ) + + def get_external_dmat(self) -> xgb.DMatrix: + n_samples = self.X.shape[0] + n_batches = 10 + per_batch = n_samples // n_batches + 1 + + predictor = [] + response = [] + weight = [] + for i in range(n_batches): + beg = i * per_batch + end = min((i + 1) * per_batch, n_samples) + assert end != beg + X = self.X[beg:end, ...] + y = self.y[beg:end] + w = self.w[beg:end] if self.w is not None else None + predictor.append(X) + response.append(y) + if w is not None: + weight.append(w) + + it = IteratorForTest( + predictor, + response, + weight if weight else None, + cache="cache", + on_host=False, + ) + return xgb.DMatrix(it) + + def __repr__(self) -> str: + return self.name + + +def make_ltr( + n_samples: int, + n_features: int, + n_query_groups: int, + max_rel: int, + sort_qid: bool = True, +) -> Tuple[np.ndarray, np.ndarray, np.ndarray, np.ndarray]: + """Make a dataset for testing LTR.""" + rng = np.random.default_rng(1994) + X = rng.normal(0, 1.0, size=n_samples * n_features).reshape(n_samples, n_features) + y = np.sum(X, axis=1) + y -= y.min() + y = np.round(y / y.max() * max_rel).astype(np.int32) + + qid = rng.integers(0, n_query_groups, size=n_samples, dtype=np.int32) + w = rng.normal(0, 1.0, size=n_query_groups) + w -= np.min(w) + w /= np.max(w) + if sort_qid: + qid = np.sort(qid) + return X, y, qid, w + + +def _cat_sampled_from() -> strategies.SearchStrategy: + @strategies.composite + def _make_cat(draw: Callable) -> Tuple[int, int, int, float]: + n_samples = draw(strategies.integers(2, 512)) + n_features = draw(strategies.integers(1, 4)) + n_cats = draw(strategies.integers(1, 128)) + sparsity = draw( + strategies.floats( + min_value=0, + max_value=1, + allow_nan=False, + allow_infinity=False, + allow_subnormal=False, + ) + ) + return n_samples, n_features, n_cats, sparsity + + def _build(args: Tuple[int, int, int, float]) -> TestDataset: + n_samples = args[0] + n_features = args[1] + n_cats = args[2] + sparsity = args[3] + return TestDataset( + f"{n_samples}x{n_features}-{n_cats}-{sparsity}", + lambda: make_categorical( + n_samples, n_features, n_cats, onehot=False, sparsity=sparsity + ), + "reg:squarederror", + "rmse", + ) + + return _make_cat().map(_build) # pylint: disable=no-member + + +categorical_dataset_strategy: strategies.SearchStrategy = _cat_sampled_from() + +sparse_datasets_strategy = strategies.sampled_from( + [ + TestDataset( + "1e5x8-0.95-csr", + lambda: make_sparse_regression(int(1e5), 8, 0.95, False), + "reg:squarederror", + "rmse", + ), + TestDataset( + "1e5x8-0.5-csr", + lambda: make_sparse_regression(int(1e5), 8, 0.5, False), + "reg:squarederror", + "rmse", + ), + TestDataset( + "1e5x8-0.5-dense", + lambda: make_sparse_regression(int(1e5), 8, 0.5, True), + "reg:squarederror", + "rmse", + ), + TestDataset( + "1e5x8-0.05-csr", + lambda: make_sparse_regression(int(1e5), 8, 0.05, False), + "reg:squarederror", + "rmse", + ), + TestDataset( + "1e5x8-0.05-dense", + lambda: make_sparse_regression(int(1e5), 8, 0.05, True), + "reg:squarederror", + "rmse", + ), + ] +) + + +def make_datasets_with_margin( + unweighted_strategy: strategies.SearchStrategy, +) -> Callable[[], strategies.SearchStrategy[TestDataset]]: + """Factory function for creating strategies that generates datasets with weight and + base margin. + + """ + + @strategies.composite + def weight_margin(draw: Callable) -> TestDataset: + data: TestDataset = draw(unweighted_strategy) + if draw(strategies.booleans()): + data.w = draw( + arrays(np.float64, (len(data.y)), elements=strategies.floats(0.1, 2.0)) + ) + if draw(strategies.booleans()): + num_class = 1 + if data.objective == "multi:softmax": + num_class = int(np.max(data.y) + 1) + elif data.name.startswith("mtreg"): + num_class = data.y.shape[1] + + data.margin = draw( + arrays( + np.float64, + (data.y.shape[0] * num_class), + elements=strategies.floats(0.5, 1.0), + ) + ) + assert data.margin is not None + if num_class != 1: + data.margin = data.margin.reshape(data.y.shape[0], num_class) + + return data + + return weight_margin + + +# A strategy for drawing from a set of example datasets. May add random weights to the +# dataset +def make_dataset_strategy() -> strategies.SearchStrategy[TestDataset]: + _unweighted_datasets_strategy = strategies.sampled_from( + [ + TestDataset( + "calif_housing", get_california_housing, "reg:squarederror", "rmse" + ), + TestDataset( + "calif_housing-l1", get_california_housing, "reg:absoluteerror", "mae" + ), + TestDataset("cancer", get_cancer, "binary:logistic", "logloss"), + TestDataset("sparse", get_sparse, "reg:squarederror", "rmse"), + TestDataset("sparse-l1", get_sparse, "reg:absoluteerror", "mae"), + TestDataset( + "empty", + lambda: (np.empty((0, 100)), np.empty(0)), + "reg:squarederror", + "rmse", + ), + ] + ) + return make_datasets_with_margin(_unweighted_datasets_strategy)() + + +_unweighted_multi_datasets_strategy = strategies.sampled_from( + [ + TestDataset("digits", get_digits, "multi:softmax", "mlogloss"), + TestDataset( + "mtreg", + lambda: datasets.make_regression(n_samples=128, n_features=2, n_targets=3), + "reg:squarederror", + "rmse", + ), + TestDataset( + "mtreg-l1", + lambda: datasets.make_regression(n_samples=128, n_features=2, n_targets=3), + "reg:absoluteerror", + "mae", + ), + ] +) + +# A strategy for drawing from a set of multi-target/multi-class datasets. +multi_dataset_strategy = make_datasets_with_margin( + _unweighted_multi_datasets_strategy +)() + + +M = TypeVar("M", xgb.Booster, xgb.XGBModel) + + +def logregobj(preds: np.ndarray, dtrain: xgb.DMatrix) -> Tuple[np.ndarray, np.ndarray]: + """Binary regression custom objective.""" + labels = dtrain.get_label() + preds = 1.0 / (1.0 + np.exp(-preds)) + grad = preds - labels + hess = preds * (1.0 - preds) + return grad, hess + + +def eval_error_metric( + predt: np.ndarray, dtrain: xgb.DMatrix, rev_link: bool +) -> Tuple[str, np.float64]: + """Evaluation metric for xgb.train. + + Parameters + ---------- + rev_link : Whether the metric needs to apply the reverse link function (activation). + + """ + label = dtrain.get_label() + if rev_link: + predt = 1.0 / (1.0 + np.exp(-predt)) + assert (0.0 <= predt).all() and (predt <= 1.0).all() + r = np.zeros(predt.shape) + gt = predt > 0.5 + if predt.size == 0: + return "CustomErr", np.float64(0.0) + r[gt] = 1 - label[gt] + le = predt <= 0.5 + r[le] = label[le] + return "CustomErr", np.sum(r) + + +def eval_error_metric_skl( + y_true: np.ndarray, y_score: np.ndarray, rev_link: bool = False +) -> np.float64: + """Evaluation metric that looks like metrics provided by sklearn.""" + + if rev_link: + y_score = 1.0 / (1.0 + np.exp(-y_score)) + assert (0.0 <= y_score).all() and (y_score <= 1.0).all() + + r = np.zeros(y_score.shape) + gt = y_score > 0.5 + r[gt] = 1 - y_true[gt] + le = y_score <= 0.5 + r[le] = y_true[le] + return np.sum(r) + + +def root_mean_square(y_true: np.ndarray, y_score: np.ndarray) -> float: + err = y_score - y_true + rmse = np.sqrt(np.dot(err, err) / y_score.size) + return rmse + + +def softmax(x: np.ndarray) -> np.ndarray: + e = np.exp(x) + return e / np.sum(e) + + +def softprob_obj( + classes: int, use_cupy: bool = False, order: str = "C", gdtype: str = "float32" +) -> SklObjective: + """Custom softprob objective for testing. + + Parameters + ---------- + use_cupy : + Whether the objective should return cupy arrays. + order : + The order of gradient matrices. "C" or "F". + gdtype : + DType for gradient. Hessian is not set. This is for testing asymmetric types. + """ + if use_cupy: + import cupy as backend + else: + backend = np + + def objective( + labels: backend.ndarray, predt: backend.ndarray + ) -> Tuple[backend.ndarray, backend.ndarray]: + rows = labels.shape[0] + grad = backend.zeros((rows, classes), dtype=np.float32) + hess = backend.zeros((rows, classes), dtype=np.float32) + eps = 1e-6 + for r in range(predt.shape[0]): + target = labels[r] + p = softmax(predt[r, :]) + for c in range(predt.shape[1]): + assert target >= 0 or target <= classes + g = p[c] - 1.0 if c == target else p[c] + h = max((2.0 * p[c] * (1.0 - p[c])).item(), eps) + grad[r, c] = g + hess[r, c] = h + + grad = grad.reshape((rows, classes)) + hess = hess.reshape((rows, classes)) + grad = backend.require(grad, requirements=order, dtype=gdtype) + hess = backend.require(hess, requirements=order) + return grad, hess + + return objective + + +def ls_obj( + y_true: np.ndarray, y_pred: np.ndarray, sample_weight: Optional[np.ndarray] = None +) -> Tuple[np.ndarray, np.ndarray]: + """Least squared error.""" + grad = y_pred - y_true + hess = np.ones(grad.shape) + if sample_weight is not None: + grad *= sample_weight + hess *= sample_weight + return grad, hess + + +class DirectoryExcursion: + """Change directory. Change back and optionally cleaning up the directory when + exit. + + """ + + def __init__(self, path: PathLike, cleanup: bool = False): + self.path = path + self.curdir = os.path.normpath(os.path.abspath(os.path.curdir)) + self.cleanup = cleanup + self.files: Set[str] = set() + + def __enter__(self) -> None: + os.chdir(self.path) + if self.cleanup: + self.files = { + os.path.join(root, f) + for root, subdir, files in os.walk(os.path.expanduser(self.path)) + for f in files + } + + def __exit__(self, *args: Any) -> None: + os.chdir(self.curdir) + if self.cleanup: + files = { + os.path.join(root, f) + for root, subdir, files in os.walk(os.path.expanduser(self.path)) + for f in files + } + diff = files.difference(self.files) + for f in diff: + os.remove(f) + + +@contextmanager +def captured_output() -> Generator[Tuple[StringIO, StringIO], None, None]: + """Reassign stdout temporarily in order to test printed statements + Taken from: + https://stackoverflow.com/questions/4219717/how-to-assert-output-with-nosetest-unittest-in-python + + Also works for pytest. + + """ + new_out, new_err = StringIO(), StringIO() + old_out, old_err = sys.stdout, sys.stderr + try: + sys.stdout, sys.stderr = new_out, new_err + yield sys.stdout, sys.stderr + finally: + sys.stdout, sys.stderr = old_out, old_err + + +def timeout(sec: int, *args: Any, enable: bool = True, **kwargs: Any) -> Any: + """Make a pytest mark for the `pytest-timeout` package. + + Parameters + ---------- + sec : + Timeout seconds. + enable : + Control whether timeout should be applied, used for debugging. + + Returns + ------- + pytest.mark.timeout + """ + + if enable: + return pytest.mark.timeout(sec, *args, **kwargs) + return pytest.mark.timeout(None, *args, **kwargs) + + +def setup_rmm_pool(_: Any, pytestconfig: pytest.Config) -> None: + if pytestconfig.getoption("--use-rmm-pool"): + if no_rmm()["condition"]: + raise ImportError("The --use-rmm-pool option requires the RMM package") + if no_dask_cuda()["condition"]: + raise ImportError( + "The --use-rmm-pool option requires the dask_cuda package" + ) + import rmm + from dask_cuda.utils import get_n_gpus + + rmm.reinitialize( + pool_allocator=True, + initial_pool_size=1024 * 1024 * 1024, + devices=list(range(get_n_gpus())), + ) + + +def demo_dir(path: str) -> str: + """Look for the demo directory based on the test file name.""" + path = normpath(os.path.dirname(path)) + while True: + subdirs = [f.path for f in os.scandir(path) if f.is_dir()] + subdirs = [os.path.basename(d) for d in subdirs] + if "demo" in subdirs: + return os.path.join(path, "demo") + new_path = normpath(os.path.join(path, os.path.pardir)) + assert new_path != path + path = new_path + + +def normpath(path: str) -> str: + return os.path.normpath(os.path.abspath(path)) + + +def data_dir(path: str) -> str: + return os.path.join(demo_dir(path), "data") + + +def load_agaricus(path: str) -> Tuple[xgb.DMatrix, xgb.DMatrix]: + dpath = data_dir(path) + dtrain = xgb.DMatrix(os.path.join(dpath, "agaricus.txt.train?format=libsvm")) + dtest = xgb.DMatrix(os.path.join(dpath, "agaricus.txt.test?format=libsvm")) + return dtrain, dtest + + +def project_root(path: str) -> str: + return normpath(os.path.join(demo_dir(path), os.path.pardir)) + + +def run_with_rabit( + world_size: int, test_fn: Callable[..., Any], *args: Any, **kwargs: Any +) -> None: + exception_queue: queue.Queue = queue.Queue() + + def run_worker(rabit_env: Dict[str, Union[str, int]]) -> None: + try: + with xgb.collective.CommunicatorContext(**rabit_env): + test_fn(*args, **kwargs) + except Exception as e: # pylint: disable=broad-except + exception_queue.put(e) + + tracker = RabitTracker(host_ip="127.0.0.1", n_workers=world_size) + tracker.start() + + workers = [] + for _ in range(world_size): + worker = threading.Thread(target=run_worker, args=(tracker.worker_args(),)) + workers.append(worker) + worker.start() + for worker in workers: + worker.join() + assert exception_queue.empty(), f"Worker failed: {exception_queue.get()}" + + tracker.wait_for() + + +def column_split_feature_names( + feature_names: List[Union[str, int]], world_size: int +) -> List[str]: + """Get the global list of feature names from the local feature names.""" + return [ + f"{rank}.{feature}" for rank in range(world_size) for feature in feature_names + ] + + +def is_windows() -> bool: + """Check if the current platform is Windows.""" + return platform.system() == "Windows" diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/xgboost/testing/basic_models.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/xgboost/testing/basic_models.py new file mode 100644 index 0000000000000000000000000000000000000000..dae99d7380a92fafa12fd280d3ca21a91d6c1b3e --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/xgboost/testing/basic_models.py @@ -0,0 +1,81 @@ +"""Tests for basic features of the Booster.""" + +from typing import Tuple + +import numpy as np + +from xgboost import testing as tm + +from ..core import Booster, DMatrix +from ..training import cv, train +from .utils import Device + + +def run_custom_objective( # pylint: disable=too-many-locals + tree_method: str, + device: Device, + dtrain: DMatrix, + dtest: DMatrix, +) -> None: + """Tests custom objective and metric functions.""" + param = { + "max_depth": 2, + "eta": 1, + "objective": "reg:logistic", + "tree_method": tree_method, + "device": device, + } + watchlist = [(dtest, "eval"), (dtrain, "train")] + num_round = 10 + + def evalerror(preds: np.ndarray, dtrain: DMatrix) -> Tuple[str, np.float64]: + return tm.eval_error_metric(preds, dtrain, rev_link=True) + + # test custom_objective in training + bst = train( + param, + dtrain, + num_round, + evals=watchlist, + obj=tm.logregobj, + custom_metric=evalerror, + ) + assert isinstance(bst, Booster) + preds = bst.predict(dtest) + labels = dtest.get_label() + err = sum(1 for i in range(len(preds)) if int(preds[i] > 0.5) != labels[i]) / float( + len(preds) + ) + assert err < 0.1 + + # test custom_objective in cross-validation + cv( + param, + dtrain, + num_round, + nfold=5, + seed=0, + obj=tm.logregobj, + custom_metric=evalerror, + ) + + # test maximize parameter + def neg_evalerror(preds: np.ndarray, dtrain: DMatrix) -> Tuple[str, float]: + labels = dtrain.get_label() + preds = 1.0 / (1.0 + np.exp(-preds)) + return "error", float(sum(labels == (preds > 0.0))) / len(labels) + + bst2 = train( + param, + dtrain, + num_round, + evals=watchlist, + obj=tm.logregobj, + custom_metric=neg_evalerror, + maximize=True, + ) + preds2 = bst2.predict(dtest) + err2 = sum( + 1 for i in range(len(preds2)) if int(preds2[i] > 0.5) != labels[i] + ) / float(len(preds2)) + assert err == err2 diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/xgboost/testing/callbacks.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/xgboost/testing/callbacks.py new file mode 100644 index 0000000000000000000000000000000000000000..740b389cfde43bd604087aeef29d97292ae94fae --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/xgboost/testing/callbacks.py @@ -0,0 +1,188 @@ +# pylint: disable=too-many-locals +"""Tests for callback functions.""" + +import json +from itertools import product +from typing import Dict, List, Tuple + +from ..callback import LearningRateScheduler +from ..core import Booster, DMatrix +from ..training import cv, train +from .utils import Device + + +def run_eta_decay( + tree_method: str, dtrain: DMatrix, dtest: DMatrix, device: Device +) -> None: + """Test learning rate scheduler, used by both CPU and GPU tests.""" + scheduler = LearningRateScheduler + + watchlist = [(dtest, "eval"), (dtrain, "train")] + num_round = 4 + + # learning_rates as a list + # init eta with 0 to check whether learning_rates work + param = { + "max_depth": 2, + "eta": 0, + "objective": "binary:logistic", + "eval_metric": "error", + "tree_method": tree_method, + "device": device, + } + evals_result: Dict[str, Dict] = {} + bst = train( + param, + dtrain, + num_round, + evals=watchlist, + callbacks=[scheduler([0.8, 0.7, 0.6, 0.5])], + evals_result=evals_result, + ) + eval_errors_0 = list(map(float, evals_result["eval"]["error"])) + assert isinstance(bst, Booster) + # validation error should decrease, if eta > 0 + assert eval_errors_0[0] > eval_errors_0[-1] + + # init learning_rate with 0 to check whether learning_rates work + param = { + "max_depth": 2, + "learning_rate": 0, + "objective": "binary:logistic", + "eval_metric": "error", + "tree_method": tree_method, + "device": device, + } + evals_result = {} + + bst = train( + param, + dtrain, + num_round, + evals=watchlist, + callbacks=[scheduler([0.8, 0.7, 0.6, 0.5])], + evals_result=evals_result, + ) + eval_errors_1 = list(map(float, evals_result["eval"]["error"])) + assert isinstance(bst, Booster) + # validation error should decrease, if learning_rate > 0 + assert eval_errors_1[0] > eval_errors_1[-1] + + # check if learning_rates override default value of eta/learning_rate + param = { + "max_depth": 2, + "objective": "binary:logistic", + "eval_metric": "error", + "tree_method": tree_method, + "device": device, + } + evals_result = {} + bst = train( + param, + dtrain, + num_round, + evals=watchlist, + callbacks=[scheduler([0, 0, 0, 0])], + evals_result=evals_result, + ) + eval_errors_2 = list(map(float, evals_result["eval"]["error"])) + assert isinstance(bst, Booster) + # validation error should not decrease, if eta/learning_rate = 0 + assert eval_errors_2[0] == eval_errors_2[-1] + + # learning_rates as a customized decay function + def eta_decay(ithround: int, num_boost_round: int = num_round) -> float: + return num_boost_round / (ithround + 1) + + evals_result = {} + bst = train( + param, + dtrain, + num_round, + evals=watchlist, + callbacks=[scheduler(eta_decay)], + evals_result=evals_result, + ) + eval_errors_3 = list(map(float, evals_result["eval"]["error"])) + + assert isinstance(bst, Booster) + + assert eval_errors_3[0] == eval_errors_2[0] + + for i in range(1, len(eval_errors_0)): + assert eval_errors_3[i] != eval_errors_2[i] + + cv(param, dtrain, num_round, callbacks=[scheduler(eta_decay)]) + + +def tree_methods_objs() -> List[Tuple[str, str]]: + """Test parameters for the leaf output test.""" + return list( + product( + ["approx", "hist"], + [ + "binary:logistic", + "reg:absoluteerror", + "reg:quantileerror", + ], + ) + ) + + +def run_eta_decay_leaf_output( + tree_method: str, objective: str, dtrain: DMatrix, dtest: DMatrix, device: Device +) -> None: + """check decay has effect on leaf output.""" + num_round = 4 + scheduler = LearningRateScheduler + + watchlist = [(dtest, "eval"), (dtrain, "train")] + + param = { + "max_depth": 2, + "objective": objective, + "eval_metric": "error", + "tree_method": tree_method, + "device": device, + } + if objective == "reg:quantileerror": + param["quantile_alpha"] = 0.3 + + def eta_decay_0(i: int) -> float: + return num_round / (i + 1) + + bst0 = train( + param, + dtrain, + num_round, + evals=watchlist, + callbacks=[scheduler(eta_decay_0)], + ) + + def eta_decay_1(i: int) -> float: + if i > 1: + return 5.0 + return num_round / (i + 1) + + bst1 = train( + param, + dtrain, + num_round, + evals=watchlist, + callbacks=[scheduler(eta_decay_1)], + ) + bst_json0 = bst0.save_raw(raw_format="json") + bst_json1 = bst1.save_raw(raw_format="json") + + j0 = json.loads(bst_json0) + j1 = json.loads(bst_json1) + + tree_2th_0 = j0["learner"]["gradient_booster"]["model"]["trees"][2] + tree_2th_1 = j1["learner"]["gradient_booster"]["model"]["trees"][2] + assert tree_2th_0["base_weights"] == tree_2th_1["base_weights"] + assert tree_2th_0["split_conditions"] == tree_2th_1["split_conditions"] + + tree_3th_0 = j0["learner"]["gradient_booster"]["model"]["trees"][3] + tree_3th_1 = j1["learner"]["gradient_booster"]["model"]["trees"][3] + assert tree_3th_0["base_weights"] != tree_3th_1["base_weights"] + assert tree_3th_0["split_conditions"] != tree_3th_1["split_conditions"] diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/xgboost/testing/collective.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/xgboost/testing/collective.py new file mode 100644 index 0000000000000000000000000000000000000000..f3eaea0b52be1f67f079a5af5e7377ad936f3734 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/xgboost/testing/collective.py @@ -0,0 +1,15 @@ +"""Collective module related utilities.""" + +import socket + + +def get_avail_port() -> int: + """Returns a port that's available during the function call. It doesn't prevent the + port from being used after the function returns as we can't reserve the port. The + utility makes a test more likely to pass. + + """ + with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as server: + server.bind(("127.0.0.1", 0)) + port = server.getsockname()[1] + return port diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/xgboost/testing/continuation.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/xgboost/testing/continuation.py new file mode 100644 index 0000000000000000000000000000000000000000..16037e37b07378a011947749b9b9dc49e30b0efd --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/xgboost/testing/continuation.py @@ -0,0 +1,59 @@ +"""Tests for training continuation.""" + +import json +from typing import Any, Dict, TypeVar + +import numpy as np +import pytest + +import xgboost as xgb + + +# pylint: disable=too-many-locals +def run_training_continuation_model_output(device: str, tree_method: str) -> None: + """Run training continuation test.""" + datasets = pytest.importorskip("sklearn.datasets") + n_samples = 64 + n_features = 32 + X, y = datasets.make_regression(n_samples, n_features, random_state=1) + + dtrain = xgb.DMatrix(X, y) + params = { + "tree_method": tree_method, + "max_depth": "2", + "gamma": "0.1", + "alpha": "0.01", + "device": device, + } + bst_0 = xgb.train(params, dtrain, num_boost_round=64) + dump_0 = bst_0.get_dump(dump_format="json") + + bst_1 = xgb.train(params, dtrain, num_boost_round=32) + bst_1 = xgb.train(params, dtrain, num_boost_round=32, xgb_model=bst_1) + dump_1 = bst_1.get_dump(dump_format="json") + + T = TypeVar("T", Dict[str, Any], float, str, int, list) + + def recursive_compare(obj_0: T, obj_1: T) -> None: + if isinstance(obj_0, float): + assert np.isclose(obj_0, obj_1, atol=1e-6) + elif isinstance(obj_0, str): + assert obj_0 == obj_1 + elif isinstance(obj_0, int): + assert obj_0 == obj_1 + elif isinstance(obj_0, dict): + for i in range(len(obj_0.items())): + assert list(obj_0.keys())[i] == list(obj_1.keys())[i] + if list(obj_0.keys())[i] != "missing": + recursive_compare(list(obj_0.values()), list(obj_1.values())) + else: + for i, lhs in enumerate(obj_0): + rhs = obj_1[i] + recursive_compare(lhs, rhs) + + assert len(dump_0) == len(dump_1) + + for i, lhs in enumerate(dump_0): + obj_0 = json.loads(lhs) + obj_1 = json.loads(dump_1[i]) + recursive_compare(obj_0, obj_1) diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/xgboost/testing/dask.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/xgboost/testing/dask.py new file mode 100644 index 0000000000000000000000000000000000000000..79ca59e2b9bafa542fd3cf5d25bc101b74d26f01 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/xgboost/testing/dask.py @@ -0,0 +1,397 @@ +"""Tests for dask shared by different test modules.""" + +from typing import Any, List, Literal, Tuple, Type, cast + +import numpy as np +import pandas as pd +from dask import array as da +from dask import dataframe as dd +from distributed import Client, get_worker +from packaging.version import parse as parse_version +from sklearn.datasets import make_classification + +import xgboost as xgb +import xgboost.testing as tm +from xgboost.compat import concat +from xgboost.testing.updater import get_basescore + +from .. import dask as dxgb +from .._typing import EvalsLog +from ..dask import _get_rabit_args +from ..dask.utils import _DASK_VERSION +from .data import make_batches +from .data import make_categorical as make_cat_local +from .ordinal import make_recoded +from .utils import Device, assert_allclose + + +def check_init_estimation_clf( + tree_method: str, device: Literal["cpu", "cuda"], client: Client +) -> None: + """Test init estimation for classsifier.""" + X, y = make_classification(n_samples=4096 * 2, n_features=32, random_state=1994) + clf = xgb.XGBClassifier( + n_estimators=1, max_depth=1, tree_method=tree_method, device=device + ) + clf.fit(X, y) + base_score = get_basescore(clf) + + dx = da.from_array(X).rechunk(chunks=(32, None)) + dy = da.from_array(y).rechunk(chunks=(32,)) + dclf = dxgb.DaskXGBClassifier( + n_estimators=1, + max_depth=1, + tree_method=tree_method, + device=device, + ) + dclf.client = client + dclf.fit(dx, dy) + dbase_score = get_basescore(dclf) + np.testing.assert_allclose(base_score, dbase_score) + + +def check_init_estimation_reg( + tree_method: str, device: Literal["cpu", "cuda"], client: Client +) -> None: + """Test init estimation for regressor.""" + from sklearn.datasets import make_regression + + # pylint: disable=unbalanced-tuple-unpacking + X, y = make_regression(n_samples=4096 * 2, n_features=32, random_state=1994) + reg = xgb.XGBRegressor( + n_estimators=1, max_depth=1, tree_method=tree_method, device=device + ) + reg.fit(X, y) + base_score = get_basescore(reg) + + dx = da.from_array(X).rechunk(chunks=(32, None)) + dy = da.from_array(y).rechunk(chunks=(32,)) + dreg = dxgb.DaskXGBRegressor( + n_estimators=1, max_depth=1, tree_method=tree_method, device=device + ) + dreg.client = client + dreg.fit(dx, dy) + dbase_score = get_basescore(dreg) + np.testing.assert_allclose(base_score, dbase_score) + + +def check_init_estimation( + tree_method: str, device: Literal["cpu", "cuda"], client: Client +) -> None: + """Test init estimation.""" + check_init_estimation_reg(tree_method, device, client) + check_init_estimation_clf(tree_method, device, client) + + +def check_uneven_nan( + client: Client, tree_method: str, device: Literal["cpu", "cuda"], n_workers: int +) -> None: + """Issue #9271, not every worker has missing value.""" + assert n_workers >= 2 + + with client.as_current(): + clf = dxgb.DaskXGBClassifier(tree_method=tree_method, device=device) + X = pd.DataFrame({"a": range(10000), "b": range(10000, 0, -1)}) + y = pd.Series([*[0] * 5000, *[1] * 5000]) + + X.loc[:3000:1000, "a"] = np.nan + + client.wait_for_workers(n_workers=n_workers) + + clf.fit( + dd.from_pandas(X, npartitions=n_workers), + dd.from_pandas(y, npartitions=n_workers), + ) + + +def check_external_memory( # pylint: disable=too-many-locals + worker_id: int, + n_workers: int, + device: str, + comm_args: dict, + is_qdm: bool, +) -> None: + """Basic checks for distributed external memory.""" + n_samples_per_batch = 32 + n_features = 4 + n_batches = 16 + use_cupy = device != "cpu" + + n_threads = get_worker().state.nthreads + with xgb.collective.CommunicatorContext(dmlc_communicator="rabit", **comm_args): + it = tm.IteratorForTest( + *make_batches( + n_samples_per_batch, + n_features, + n_batches, + use_cupy=use_cupy, + random_state=worker_id, + ), + cache="cache", + ) + if is_qdm: + Xy: xgb.DMatrix = xgb.ExtMemQuantileDMatrix(it, nthread=n_threads) + else: + Xy = xgb.DMatrix(it, nthread=n_threads) + results: EvalsLog = {} + xgb.train( + {"tree_method": "hist", "nthread": n_threads, "device": device}, + Xy, + evals=[(Xy, "Train")], + num_boost_round=32, + evals_result=results, + ) + assert tm.non_increasing(cast(List[float], results["Train"]["rmse"])) + + lx, ly, lw = [], [], [] + for i in range(n_workers): + x, y, w = make_batches( + n_samples_per_batch, + n_features, + n_batches, + use_cupy=use_cupy, + random_state=i, + ) + lx.extend(x) + ly.extend(y) + lw.extend(w) + + X = concat(lx) + yconcat = concat(ly) + wconcat = concat(lw) + if is_qdm: + Xy = xgb.QuantileDMatrix(X, yconcat, weight=wconcat, nthread=n_threads) + else: + Xy = xgb.DMatrix(X, yconcat, weight=wconcat, nthread=n_threads) + + results_local: EvalsLog = {} + xgb.train( + {"tree_method": "hist", "nthread": n_threads, "device": device}, + Xy, + evals=[(Xy, "Train")], + num_boost_round=32, + evals_result=results_local, + ) + np.testing.assert_allclose( + results["Train"]["rmse"], results_local["Train"]["rmse"], rtol=1e-4 + ) + + +def get_rabit_args(client: Client, n_workers: int) -> Any: + """Get RABIT collective communicator arguments for tests.""" + return client.sync(_get_rabit_args, client, n_workers) + + +def get_client_workers(client: Client) -> List[str]: + "Get workers from a dask client." + kwargs = {"n_workers": -1} if _DASK_VERSION() >= parse_version("2025.4.0") else {} + workers = client.scheduler_info(**kwargs)["workers"] + return list(workers.keys()) + + +def make_ltr( # pylint: disable=too-many-locals,too-many-arguments + client: Client, + n_samples: int, + n_features: int, + *, + n_query_groups: int, + max_rel: int, + device: str, +) -> Tuple[dd.DataFrame, dd.Series, dd.Series]: + """Synthetic dataset for learning to rank.""" + workers = get_client_workers(client) + n_samples_per_worker = n_samples // len(workers) + + if device == "cpu": + from pandas import DataFrame as DF + else: + from cudf import DataFrame as DF + + def make(n: int, seed: int) -> pd.DataFrame: + rng = np.random.default_rng(seed) + X, y = make_classification( + n, n_features, n_informative=n_features, n_redundant=0, n_classes=max_rel + ) + qid = rng.integers(size=(n,), low=0, high=n_query_groups) + df = DF(X, columns=[f"f{i}" for i in range(n_features)]) + df["qid"] = qid + df["y"] = y + return df + + futures = [] + i = 0 + for k in range(0, n_samples, n_samples_per_worker): + fut = client.submit( + make, n=n_samples_per_worker, seed=k, workers=[workers[i % len(workers)]] + ) + futures.append(fut) + i += 1 + + last = n_samples - (n_samples_per_worker * len(workers)) + if last != 0: + fut = client.submit(make, n=last, seed=n_samples_per_worker * len(workers)) + futures.append(fut) + + meta = make(1, 0) + df = dd.from_delayed(futures, meta=meta) + assert isinstance(df, dd.DataFrame) + return df.drop(["qid", "y"], axis=1), df.y, df.qid + + +def check_no_group_split(client: Client, device: str) -> None: + """Test for the allow_group_split parameter.""" + X_tr, q_tr, y_tr = make_ltr( + client, 4096, 128, n_query_groups=4, max_rel=5, device=device + ) + X_va, q_va, y_va = make_ltr( + client, 1024, 128, n_query_groups=4, max_rel=5, device=device + ) + + ltr = dxgb.DaskXGBRanker( + allow_group_split=False, + n_estimators=36, + device=device, + objective="rank:pairwise", + ) + ltr.fit( + X_tr, + y_tr, + qid=q_tr, + eval_set=[(X_tr, y_tr), (X_va, y_va)], + eval_qid=[q_tr, q_va], + verbose=True, + ) + + assert ltr.n_features_in_ == 128 + assert X_tr.shape[1] == ltr.n_features_in_ # no change + ndcg = ltr.evals_result()["validation_0"]["ndcg@32"] + assert tm.non_decreasing(ndcg[:16], tolerance=1e-2), ndcg + np.testing.assert_allclose(ndcg[-1], 1.0, rtol=1e-2) + + +def make_categorical( # pylint: disable=too-many-locals, too-many-arguments + client: Client, + n_samples: int, + n_features: int, + n_categories: int, + *, + onehot: bool = False, + cat_dtype: np.typing.DTypeLike = np.int64, +) -> Tuple[dd.DataFrame, dd.Series]: + """Synthesize categorical data with dask.""" + workers = get_client_workers(client) + n_workers = len(workers) + dfs = [] + + def pack(**kwargs: Any) -> dd.DataFrame: + X, y = make_cat_local(**kwargs) + X["label"] = y + return X + + meta = pack( + n_samples=1, + n_features=n_features, + n_categories=n_categories, + onehot=False, + cat_dtype=cat_dtype, + ) + + for i, worker in enumerate(workers): + l_n_samples = min( + n_samples // n_workers, n_samples - i * (n_samples // n_workers) + ) + # make sure there's at least one sample for testing empty DMatrix + if n_samples == 1 and i == 0: + l_n_samples = 1 + future = client.submit( + pack, + n_samples=l_n_samples, + n_features=n_features, + n_categories=n_categories, + cat_dtype=cat_dtype, + onehot=False, + workers=[worker], + ) + dfs.append(future) + + df: dd.DataFrame = cast(dd.DataFrame, dd.from_delayed(dfs, meta=meta)) + y = df["label"] + X = df[df.columns.difference(["label"])] + + if onehot: + return dd.get_dummies(X), y + return X, y + + +# pylint: disable=too-many-locals +def run_recode(client: Client, device: Device) -> None: + """Run re-coding test with the Dask interface.""" + + def create_dmatrix( + DMatrixT: Type[dxgb.DaskDMatrix], *args: Any, **kwargs: Any + ) -> dxgb.DaskDMatrix: + if DMatrixT is dxgb.DaskQuantileDMatrix: + ref = kwargs.pop("ref", None) + return DMatrixT(*args, ref=ref, **kwargs) + + kwargs.pop("ref", None) + return DMatrixT(*args, **kwargs) + + def run(DMatrixT: Type[dxgb.DaskDMatrix]) -> None: + enc, reenc, y, _, _ = make_recoded(device, n_features=96) + to = get_client_workers(client) + + denc, dreenc, dy = ( + dd.from_pandas(enc, npartitions=8).persist(workers=to), + dd.from_pandas(reenc, npartitions=8).persist(workers=to), + da.from_array(y, chunks=(y.shape[0] // 8,)).persist(workers=to), + ) + + Xy = create_dmatrix(DMatrixT, client, denc, dy, enable_categorical=True) + Xy_valid = create_dmatrix( + DMatrixT, client, dreenc, dy, enable_categorical=True, ref=Xy + ) + # Base model + results = dxgb.train( + client, {"device": device}, Xy, evals=[(Xy_valid, "Valid")] + ) + + # Training continuation + Xy = create_dmatrix(DMatrixT, client, denc, dy, enable_categorical=True) + Xy_valid = create_dmatrix( + DMatrixT, client, dreenc, dy, enable_categorical=True, ref=Xy + ) + results_1 = dxgb.train( + client, + {"device": device}, + Xy, + evals=[(Xy_valid, "Valid")], + xgb_model=results["booster"], + ) + + # Reversed training continuation + Xy = create_dmatrix(DMatrixT, client, dreenc, dy, enable_categorical=True) + Xy_valid = create_dmatrix( + DMatrixT, client, denc, dy, enable_categorical=True, ref=Xy + ) + results_2 = dxgb.train( + client, + {"device": device}, + Xy, + evals=[(Xy_valid, "Valid")], + xgb_model=results["booster"], + ) + np.testing.assert_allclose( + results_1["history"]["Valid"]["rmse"], results_2["history"]["Valid"]["rmse"] + ) + + predt_0 = dxgb.inplace_predict(client, results, denc).compute() + predt_1 = dxgb.inplace_predict(client, results, dreenc).compute() + assert_allclose(device, predt_0, predt_1) + + predt_0 = dxgb.predict(client, results, Xy).compute() + predt_1 = dxgb.predict(client, results, Xy_valid).compute() + assert_allclose(device, predt_0, predt_1) + + for DMatrixT in [dxgb.DaskDMatrix, dxgb.DaskQuantileDMatrix]: + run(DMatrixT) diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/xgboost/testing/data.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/xgboost/testing/data.py new file mode 100644 index 0000000000000000000000000000000000000000..e6fdd7321f902c95afd06a330aa6a3a165c71bee --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/xgboost/testing/data.py @@ -0,0 +1,1161 @@ +# pylint: disable=too-many-lines +"""Utilities for data generation.""" + +import gc +import multiprocessing +import os +import string +import zipfile +from concurrent.futures import ThreadPoolExecutor +from dataclasses import dataclass +from typing import ( + TYPE_CHECKING, + Any, + Callable, + Dict, + Generator, + List, + NamedTuple, + Optional, + Sequence, + Set, + Tuple, + Type, + Union, +) +from urllib import request + +import numpy as np +import pytest +from numpy import typing as npt +from numpy.random import Generator as RNG +from scipy import sparse + +from ..compat import concat +from ..core import DataIter, DMatrix, QuantileDMatrix +from ..data import is_pd_cat_dtype, pandas_pyarrow_mapper +from ..sklearn import ArrayLike, XGBRanker +from ..training import train as train_fn + +if TYPE_CHECKING: + from pandas import DataFrame as DataFrameT +else: + DataFrameT = Any + +joblib = pytest.importorskip("joblib") +memory = joblib.Memory("./cachedir", verbose=0) + + +def np_dtypes( + n_samples: int, n_features: int +) -> Generator[Union[Tuple[np.ndarray, np.ndarray], Tuple[list, list]], None, None]: + """Enumerate all supported dtypes from numpy.""" + pd = pytest.importorskip("pandas") + + rng = np.random.RandomState(1994) + # Integer and float. + orig = rng.randint(low=0, high=127, size=n_samples * n_features).reshape( + n_samples, n_features + ) + dtypes = [ + np.int32, + np.int64, + np.byte, + np.short, + np.intc, + np.int_, + np.longlong, + np.uint32, + np.uint64, + np.ubyte, + np.ushort, + np.uintc, + np.uint, + np.ulonglong, + np.float16, + np.float32, + np.float64, + np.half, + np.single, + np.double, + ] + for dtype in dtypes: + X = np.array(orig, dtype=dtype) + yield orig, X + yield orig.tolist(), X.tolist() + + for dtype in dtypes: + X = np.array(orig, dtype=dtype) + df_orig = pd.DataFrame(orig) + df = pd.DataFrame(X) + yield df_orig, df + + # Boolean + orig = rng.binomial(1, 0.5, size=n_samples * n_features).reshape( + n_samples, n_features + ) + for dtype1 in [np.bool_, bool]: + X = np.array(orig, dtype=dtype1) + yield orig, X + + for dtype2 in [np.bool_, bool]: + X = np.array(orig, dtype=dtype2) + df_orig = pd.DataFrame(orig) + df = pd.DataFrame(X) + yield df_orig, df + + +def pd_dtypes() -> Generator: + """Enumerate all supported pandas extension types.""" + pd = pytest.importorskip("pandas") + + # Integer + dtypes = [ + pd.UInt8Dtype(), + pd.UInt16Dtype(), + pd.UInt32Dtype(), + pd.UInt64Dtype(), + pd.Int8Dtype(), + pd.Int16Dtype(), + pd.Int32Dtype(), + pd.Int64Dtype(), + ] + + Null: Union[float, None, Any] = np.nan + orig = pd.DataFrame( + {"f0": [1, 2, Null, 3], "f1": [4, 3, Null, 1]}, dtype=np.float32 + ) + for Null in (np.nan, None, pd.NA): + for dtype in dtypes: + df = pd.DataFrame( + {"f0": [1, 2, Null, 3], "f1": [4, 3, Null, 1]}, dtype=dtype + ) + yield orig, df + + # Float + Null = np.nan + dtypes = [pd.Float32Dtype(), pd.Float64Dtype()] + orig = pd.DataFrame( + {"f0": [1.0, 2.0, Null, 3.0], "f1": [3.0, 2.0, Null, 1.0]}, dtype=np.float32 + ) + for Null in (np.nan, None, pd.NA): + for dtype in dtypes: + df = pd.DataFrame( + {"f0": [1.0, 2.0, Null, 3.0], "f1": [3.0, 2.0, Null, 1.0]}, dtype=dtype + ) + yield orig, df + ser_orig = orig["f0"] + ser = df["f0"] + assert isinstance(ser, pd.Series) + assert isinstance(ser_orig, pd.Series) + yield ser_orig, ser + + # Categorical + orig = orig.astype("category") + for c in orig.columns: + orig[c] = orig[c].cat.rename_categories(int) + for Null in (np.nan, None, pd.NA): + df = pd.DataFrame( + {"f0": [1, 2, Null, 3], "f1": [3, 2, Null, 1]}, + dtype=pd.CategoricalDtype(), + ) + yield orig, df + + # Boolean + for Null in [None, pd.NA]: + data = {"f0": [True, False, Null, True], "f1": [False, True, Null, True]} + # pd.NA is not convertible to bool. + orig = pd.DataFrame(data, dtype=np.bool_ if Null is None else pd.BooleanDtype()) + df = pd.DataFrame(data, dtype=pd.BooleanDtype()) + yield orig, df + + +def pd_arrow_dtypes() -> Generator: + """Pandas DataFrame with pyarrow backed type.""" + pd = pytest.importorskip("pandas") + pa = pytest.importorskip("pyarrow") + + # Integer + dtypes = pandas_pyarrow_mapper + # Create a dictionary-backed dataframe, enable this when the roundtrip is + # implemented in pandas/pyarrow + # + # category = pd.ArrowDtype(pa.dictionary(pa.int32(), pa.int32(), ordered=True)) + # df = pd.DataFrame({"f0": [0, 2, Null, 3], "f1": [4, 3, Null, 1]}, dtype=category) + + # Error: + # >>> df.astype("category") + # Function 'dictionary_encode' has no kernel matching input types + # (array[dictionary]) + + # Error: + # pd_cat_df = pd.DataFrame( + # {"f0": [0, 2, Null, 3], "f1": [4, 3, Null, 1]}, + # dtype="category" + # ) + # pa_catcodes = ( + # df["f1"].array.__arrow_array__().combine_chunks().to_pandas().cat.codes + # ) + # pd_catcodes = pd_cat_df["f1"].cat.codes + # assert pd_catcodes.equals(pa_catcodes) + + for Null in (None, pd.NA, 0): + for dtype in dtypes: + if dtype.startswith("float16") or dtype.startswith("bool"): + continue + # Use np.nan is a baseline + orig_null = Null if not pd.isna(Null) and Null == 0 else np.nan + orig = pd.DataFrame( + {"f0": [1, 2, orig_null, 3], "f1": [4, 3, orig_null, 1]}, + dtype=np.float32, + ) + + df = pd.DataFrame( + {"f0": [1, 2, Null, 3], "f1": [4, 3, Null, 1]}, dtype=dtype + ) + yield orig, df + + # If Null is `False`, then there's no missing value. + for Null in (pd.NA, False): + orig = pd.DataFrame( + {"f0": [True, False, Null, True], "f1": [False, True, Null, True]}, + dtype=pd.BooleanDtype(), + ) + df = pd.DataFrame( + {"f0": [True, False, Null, True], "f1": [False, True, Null, True]}, + dtype=pd.ArrowDtype(pa.bool_()), + ) + yield orig, df + + +def check_inf(rng: RNG) -> None: + """Validate there's no inf in X.""" + X = rng.random(size=32).reshape(8, 4) + y = rng.random(size=8) + X[5, 2] = np.inf + + with pytest.raises(ValueError, match="Input data contains `inf`"): + QuantileDMatrix(X, y) + + with pytest.raises(ValueError, match="Input data contains `inf`"): + DMatrix(X, y) + + +@memory.cache +def get_california_housing() -> Tuple[np.ndarray, np.ndarray]: + """Synthesize a dataset similar to the sklearn California housing dataset. + + The real one can be obtained via: + + .. code-block:: + + import sklearn.datasets + + X, y = sklearn.datasets.fetch_california_housing(return_X_y=True) + + """ + n_samples = 20640 + rng = np.random.default_rng(2025) + + pd = pytest.importorskip("pandas") + + def mixture_2comp( + means: List[float], sigmas: List[float], weights: List[float] + ) -> np.ndarray: + l0 = rng.normal( + size=(int(n_samples * weights[0])), loc=means[0], scale=sigmas[0] + ) + l1 = rng.normal(size=(n_samples - l0.shape[0]), loc=means[1], scale=sigmas[1]) + return np.concatenate([l0, l1], axis=0) + + def norm(mean: float, std: float) -> np.ndarray: + return rng.normal(loc=mean, scale=std, size=(n_samples,)) + + df = pd.DataFrame( + { + "Longitude": mixture_2comp( + [-118.0703597, -121.85682825], + [0.7897320650373969, 0.7248398629412008], + [0.60402556, 0.39597444], + ), + "Latitude": mixture_2comp( + [37.84266317, 33.86030848], + [1.0643911549736087, 0.5049274656834589], + [0.44485062, 0.55514938], + ), + "MedInc": norm(mean=3.8706710029069766, std=1.8997756945748738), + "HouseAge": norm(mean=28.639486434108527, std=12.585252725724606), + "AveRooms": norm(mean=5.428999742190376, std=2.474113202333516), + "AveBedrms": norm(mean=1.096675149606208, std=0.47389937625774475), + "Population": norm(mean=1425.4767441860465, std=1132.434687757615), + "AveOccup": norm(mean=3.0706551594363742, std=10.385797959128219), + "MedHouseVal": norm(mean=2.068558169089147, std=1.1539282040412253), + } + ) + X = df[df.columns.difference(["MedHouseVal"])].to_numpy() + y = df["MedHouseVal"].to_numpy() + return X, y + + +@memory.cache +def get_digits() -> Tuple[np.ndarray, np.ndarray]: + """Fetch the digits dataset from sklearn.""" + datasets = pytest.importorskip("sklearn.datasets") + data = datasets.load_digits() + return data.data, data.target + + +@memory.cache +def get_cancer() -> Tuple[np.ndarray, np.ndarray]: + """Fetch the breast cancer dataset from sklearn.""" + datasets = pytest.importorskip("sklearn.datasets") + return datasets.load_breast_cancer(return_X_y=True) + + +@memory.cache +def get_sparse() -> Tuple[np.ndarray, np.ndarray]: + """Generate a sparse dataset.""" + datasets = pytest.importorskip("sklearn.datasets") + rng = np.random.RandomState(199) + n = 2000 + sparsity = 0.75 + X, y = datasets.make_regression(n, random_state=rng) + flag = rng.binomial(1, sparsity, X.shape) + for i in range(X.shape[0]): + for j in range(X.shape[1]): + if flag[i, j]: + X[i, j] = np.nan + return X, y + + +# pylint: disable=too-many-statements +@memory.cache +def get_ames_housing() -> Tuple[DataFrameT, np.ndarray]: + """Get a synthetic version of the amse housing dataset. + + The real one can be obtained via: + + .. code-block:: + + from sklearn import datasets + + datasets.fetch_openml(data_id=42165, as_frame=True, return_X_y=True) + + Number of samples: 1460 + Number of features: 20 + Number of categorical features: 10 + Number of numerical features: 10 + """ + if TYPE_CHECKING: + import pandas as pd + else: + pd = pytest.importorskip("pandas") + + rng = np.random.default_rng(1994) + n_samples = 1460 + df = pd.DataFrame() + + def synth_cat( + name_proba: Dict[Union[str, float], float], density: float + ) -> pd.Series: + n_nulls = int(n_samples * (1 - density)) + has_nan = np.abs(1.0 - density) > 1e-6 and n_nulls > 0 + if has_nan: + sparsity = 1.0 - density + name_proba[np.nan] = sparsity + + keys = list(name_proba.keys()) + p = list(name_proba.values()) + p[-1] += 1.0 - np.sum(p) # Fix floating point error + x = rng.choice(keys, size=n_samples, p=p) + + series = pd.Series( + x, + dtype=pd.CategoricalDtype( + # not NA + filter(lambda x: isinstance(x, str), keys) + ), + ) + return series + + df["BldgType"] = synth_cat( + { + "1Fam": 0.835616, + "2fmCon": 0.078082, + "Duplex": 0.035616, + "Twnhs": 0.029452, + "TwnhsE": 0.021233, + }, + 1.0, + ) + df["GarageFinish"] = synth_cat( + {"Unf": 0.414384, "RFn": 0.289041, "Fin": 0.241096}, 0.94452 + ) + df["LotConfig"] = synth_cat( + { + "Corner": 0.180137, + "CulDSac": 0.064384, + "FR2": 0.032192, + "FR3": 0.002740, + }, + 1.0, + ) + df["Functional"] = synth_cat( + { + "Typ": 0.931506, + "Min2": 0.023287, + "Min1": 0.021232, + "Mod": 0.010273, + "Maj1": 0.009589, + "Maj2": 0.003424, + "Sev": 0.000684, + }, + 1.0, + ) + df["MasVnrType"] = synth_cat( + { + "None": 0.591780, + "BrkFace": 0.304794, + "Stone": 0.087671, + "BrkCmn": 0.010273, + }, + 0.99452, + ) + df["HouseStyle"] = synth_cat( + { + "1Story": 0.497260, + "2Story": 0.304794, + "1.5Fin": 0.105479, + "SLvl": 0.044520, + "SFoyer": 0.025342, + "1.5Unf": 0.009589, + "2.5Unf": 0.007534, + "2.5Fin": 0.005479, + }, + 1.0, + ) + df["FireplaceQu"] = synth_cat( + { + "Gd": 0.260273, + "TA": 0.214383, + "Fa": 0.022602, + "Ex": 0.016438, + "Po": 0.013698, + }, + 0.527397, + ) + df["ExterCond"] = synth_cat( + { + "TA": 0.878082, + "Gd": 0.1, + "Fa": 0.019178, + "Ex": 0.002054, + "Po": 0.000684, + }, + 1.0, + ) + df["ExterQual"] = synth_cat( + { + "TA": 0.620547, + "Gd": 0.334246, + "Ex": 0.035616, + "Fa": 0.009589, + }, + 1.0, + ) + df["PoolQC"] = synth_cat( + { + "Gd": 0.002054, + "Ex": 0.001369, + "Fa": 0.001369, + }, + 0.004794, + ) + + # We focus on the cateogircal values here, for numerical features, simple normal + # distribution is used, which doesn't match the original data. + def synth_num(loc: float, std: float, density: float) -> pd.Series: + x = rng.normal(loc=loc, scale=std, size=n_samples) + n_nulls = int(n_samples * (1 - density)) + if np.abs(1.0 - density) > 1e-6 and n_nulls > 0: + null_idx = rng.choice(n_samples, size=n_nulls, replace=False) + x[null_idx] = np.nan + return pd.Series(x, dtype=np.float64) + + df["3SsnPorch"] = synth_num(3.4095890410958902, 29.31733055678188, 1.0) + df["Fireplaces"] = synth_num(0.613013698630137, 0.6446663863122295, 1.0) + df["BsmtHalfBath"] = synth_num(0.057534246575342465, 0.23875264627921178, 1.0) + df["HalfBath"] = synth_num(0.38287671232876713, 0.5028853810928914, 1.0) + df["GarageCars"] = synth_num(1.7671232876712328, 0.7473150101111095, 1.0) + df["TotRmsAbvGrd"] = synth_num(6.517808219178082, 1.6253932905840505, 1.0) + df["BsmtFinSF1"] = synth_num(443.6397260273973, 456.0980908409277, 1.0) + df["BsmtFinSF2"] = synth_num(46.54931506849315, 161.31927280654173, 1.0) + df["GrLivArea"] = synth_num(1515.463698630137, 525.4803834232025, 1.0) + df["ScreenPorch"] = synth_num(15.060958904109588, 55.757415281874174, 1.0) + + columns = list(df.columns) + rng.shuffle(columns) + df = df[columns] + + # linear interaction for testing purposes. + y = np.zeros(shape=(n_samples,)) + for c in df.columns: + if isinstance(df[c].dtype, pd.CategoricalDtype): + y += df[c].cat.codes.astype(np.float64) + else: + y += df[c].values + + # Shift and scale to match the original y. + y *= 79442.50288288662 / y.std() + y += 180921.19589041095 - y.mean() + + return df, y + + +@memory.cache +def get_mq2008( + dpath: str, +) -> Tuple[ + sparse.csr_matrix, + np.ndarray, + np.ndarray, + sparse.csr_matrix, + np.ndarray, + np.ndarray, + sparse.csr_matrix, + np.ndarray, + np.ndarray, +]: + """Fetch the mq2008 dataset.""" + datasets = pytest.importorskip("sklearn.datasets") + src = "https://s3-us-west-2.amazonaws.com/xgboost-examples/MQ2008.zip" + target = os.path.join(dpath, "MQ2008.zip") + if not os.path.exists(target): + request.urlretrieve(url=src, filename=target) + + with zipfile.ZipFile(target, "r") as f: + f.extractall(path=dpath) + + ( + x_train, + y_train, + qid_train, + x_test, + y_test, + qid_test, + x_valid, + y_valid, + qid_valid, + ) = datasets.load_svmlight_files( + ( + os.path.join(dpath, "MQ2008/Fold1/train.txt"), + os.path.join(dpath, "MQ2008/Fold1/test.txt"), + os.path.join(dpath, "MQ2008/Fold1/vali.txt"), + ), + query_id=True, + zero_based=False, + ) + + return ( + x_train, + y_train, + qid_train, + x_test, + y_test, + qid_test, + x_valid, + y_valid, + qid_valid, + ) + + +def make_batches( # pylint: disable=too-many-arguments,too-many-locals + n_samples_per_batch: int, + n_features: int, + n_batches: int, + use_cupy: bool = False, + *, + vary_size: bool = False, + random_state: int = 1994, +) -> Tuple[List[np.ndarray], List[np.ndarray], List[np.ndarray]]: + """Make batches of dense data.""" + X = [] + y = [] + w = [] + if use_cupy: + import cupy + + rng = cupy.random.RandomState(np.uint64(random_state)) + else: + rng = np.random.RandomState(random_state) + for i in range(n_batches): + n_samples = n_samples_per_batch + i * 10 if vary_size else n_samples_per_batch + _X = rng.randn(n_samples, n_features) + _y = rng.randn(n_samples) + _w = rng.uniform(low=0, high=1, size=n_samples) + X.append(_X) + y.append(_y) + w.append(_w) + return X, y, w + + +RelData = Tuple[sparse.csr_matrix, npt.NDArray[np.int32], npt.NDArray[np.int32]] + + +@dataclass +class ClickFold: + """A structure containing information about generated user-click data.""" + + X: sparse.csr_matrix + y: npt.NDArray[np.int32] + qid: npt.NDArray[np.int32] + score: npt.NDArray[np.float32] + click: npt.NDArray[np.int32] + pos: npt.NDArray[np.int64] + + +class RelDataCV(NamedTuple): + """Simple data struct for holding a train-test split of a learning to rank dataset.""" + + train: RelData + test: RelData + max_rel: int + + def is_binary(self) -> bool: + """Whether the label consists of binary relevance degree.""" + return self.max_rel == 1 + + +class PBM: + """Simulate click data with position bias model. There are other models available in + `ULTRA `_ like the cascading model. + + References + ---------- + Unbiased LambdaMART: An Unbiased Pairwise Learning-to-Rank Algorithm + + """ + + def __init__(self, eta: float) -> None: + # click probability for each relevance degree. (from 0 to 4) + self.click_prob = np.array([0.1, 0.16, 0.28, 0.52, 1.0]) + exam_prob = np.array( + [0.68, 0.61, 0.48, 0.34, 0.28, 0.20, 0.11, 0.10, 0.08, 0.06] + ) + # Observation probability, encoding positional bias for each position + self.exam_prob = np.power(exam_prob, eta) + + def sample_clicks_for_query( + self, labels: npt.NDArray[np.int32], position: npt.NDArray[np.int64] + ) -> npt.NDArray[np.int32]: + """Sample clicks for one query based on input relevance degree and position. + + Parameters + ---------- + + labels : + relevance_degree + + """ + labels = np.array(labels, copy=True) + + click_prob = np.zeros(labels.shape) + # minimum + labels[labels < 0] = 0 + # maximum + labels[labels >= len(self.click_prob)] = -1 + click_prob = self.click_prob[labels] + + exam_prob = np.zeros(labels.shape) + assert position.size == labels.size + ranks = np.array(position, copy=True) + # maximum + ranks[ranks >= self.exam_prob.size] = -1 + exam_prob = self.exam_prob[ranks] + + rng = np.random.default_rng(1994) + prob = rng.random(size=labels.shape[0], dtype=np.float32) + + clicks: npt.NDArray[np.int32] = np.zeros(labels.shape, dtype=np.int32) + clicks[prob < exam_prob * click_prob] = 1 + return clicks + + +def rlencode(x: npt.NDArray[np.int32]) -> Tuple[npt.NDArray, npt.NDArray, npt.NDArray]: + """Run length encoding using numpy, modified from: + https://gist.github.com/nvictus/66627b580c13068589957d6ab0919e66 + + """ + x = np.asarray(x) + n = x.size + starts = np.r_[0, np.flatnonzero(~np.isclose(x[1:], x[:-1], equal_nan=True)) + 1] + lengths = np.diff(np.r_[starts, n]) + values = x[starts] + indptr = np.append(starts, np.array([x.size])) + + return indptr, lengths, values + + +def init_rank_score( + X: sparse.csr_matrix, + y: npt.NDArray[np.int32], + qid: npt.NDArray[np.int32], + sample_rate: float = 0.1, +) -> npt.NDArray[np.float32]: + """We use XGBoost to generate the initial score instead of SVMRank for + simplicity. Sample rate is set to 0.1 by default so that we can test with small + datasets. + + """ + # random sample + rng = np.random.default_rng(1994) + n_samples = int(X.shape[0] * sample_rate) + index: npt.NDArray = np.arange(0, X.shape[0], dtype=np.uint64) + rng.shuffle(index) + index = index[:n_samples] + + X_train = X[index] + y_train = y[index] + qid_train = qid[index] + + # Sort training data based on query id, required by XGBoost. + sorted_idx = np.argsort(qid_train) + X_train = X_train[sorted_idx] + y_train = y_train[sorted_idx] + qid_train = qid_train[sorted_idx] + + ltr = XGBRanker(objective="rank:ndcg", tree_method="hist") + ltr.fit(X_train, y_train, qid=qid_train) + + # Use the original order of the data. + scores = ltr.predict(X) + return scores + + +def simulate_one_fold( + fold: Tuple[sparse.csr_matrix, npt.NDArray[np.int32], npt.NDArray[np.int32]], + scores_fold: npt.NDArray[np.float32], +) -> ClickFold: + """Simulate clicks for one fold.""" + X_fold, y_fold, qid_fold = fold + assert qid_fold.dtype == np.int32 + + qids = np.unique(qid_fold) + + position = np.empty((y_fold.size,), dtype=np.int64) + clicks = np.empty((y_fold.size,), dtype=np.int32) + pbm = PBM(eta=1.0) + + # Avoid grouping by qid as we want to preserve the original data partition by + # the dataset authors. + for q in qids: + qid_mask = q == qid_fold + qid_mask = qid_mask.reshape(qid_mask.shape[0]) + query_scores = scores_fold[qid_mask] + # Initial rank list, scores sorted to decreasing order + query_position = np.argsort(query_scores)[::-1] + position[qid_mask] = query_position + # get labels + relevance_degrees = y_fold[qid_mask] + query_clicks = pbm.sample_clicks_for_query(relevance_degrees, query_position) + clicks[qid_mask] = query_clicks + + assert X_fold.shape[0] == qid_fold.shape[0], (X_fold.shape, qid_fold.shape) + assert X_fold.shape[0] == clicks.shape[0], (X_fold.shape, clicks.shape) + + return ClickFold(X_fold, y_fold, qid_fold, scores_fold, clicks, position) + + +# pylint: disable=too-many-locals +def simulate_clicks(cv_data: RelDataCV) -> Tuple[ClickFold, Optional[ClickFold]]: + """Simulate click data using position biased model (PBM).""" + X, y, qid = list(zip(cv_data.train, cv_data.test)) + + # ptr to train-test split + indptr = np.array([0] + [v.shape[0] for v in X]) + indptr = np.cumsum(indptr) + + assert len(indptr) == 2 + 1 # train, test + X_full = sparse.vstack(X) + y_full = np.concatenate(y) + qid_full = np.concatenate(qid) + + # Obtain initial relevance score for click simulation + scores_full = init_rank_score(X_full, y_full, qid_full) + # partition it back to (train, test) tuple + scores = [scores_full[indptr[i - 1] : indptr[i]] for i in range(1, indptr.size)] + + X_lst, y_lst, q_lst, s_lst, c_lst, p_lst = [], [], [], [], [], [] + for i in range(indptr.size - 1): + fold = simulate_one_fold((X[i], y[i], qid[i]), scores[i]) + X_lst.append(fold.X) + y_lst.append(fold.y) + q_lst.append(fold.qid) + s_lst.append(fold.score) + c_lst.append(fold.click) + p_lst.append(fold.pos) + + scores_check_1 = [s_lst[i] for i in range(indptr.size - 1)] + for i in range(2): + assert (scores_check_1[i] == scores[i]).all() + + if len(X_lst) == 1: + train = ClickFold(X_lst[0], y_lst[0], q_lst[0], s_lst[0], c_lst[0], p_lst[0]) + test = None + else: + train, test = ( + ClickFold(X_lst[i], y_lst[i], q_lst[i], s_lst[i], c_lst[i], p_lst[i]) + for i in range(len(X_lst)) + ) + return train, test + + +def sort_ltr_samples( + X: sparse.csr_matrix, + y: npt.NDArray[np.int32], + qid: npt.NDArray[np.int32], + clicks: npt.NDArray[np.int32], + pos: npt.NDArray[np.int64], +) -> Tuple[ + sparse.csr_matrix, + npt.NDArray[np.int32], + npt.NDArray[np.int32], + npt.NDArray[np.int32], +]: + """Sort data based on query index and position.""" + sorted_idx = np.argsort(qid) + X = X[sorted_idx] + clicks = clicks[sorted_idx] + qid = qid[sorted_idx] + pos = pos[sorted_idx] + + indptr, _, _ = rlencode(qid) + + for i in range(1, indptr.size): + beg = indptr[i - 1] + end = indptr[i] + + assert beg < end, (beg, end) + assert np.unique(qid[beg:end]).size == 1, (beg, end) + + query_pos = pos[beg:end] + assert query_pos.min() == 0, query_pos.min() + assert query_pos.max() >= query_pos.size - 1, ( + query_pos.max(), + query_pos.size, + i, + np.unique(qid[beg:end]), + ) + sorted_idx = np.argsort(query_pos) + + X[beg:end] = X[beg:end][sorted_idx] + clicks[beg:end] = clicks[beg:end][sorted_idx] + y[beg:end] = y[beg:end][sorted_idx] + # not necessary + qid[beg:end] = qid[beg:end][sorted_idx] + + data = X, clicks, y, qid + + return data + + +def run_base_margin_info(DType: Callable, DMatrixT: Type[DMatrix], device: str) -> None: + """Run tests for base margin.""" + rng = np.random.default_rng() + X = DType(rng.normal(0, 1.0, size=100).astype(np.float32).reshape(50, 2)) + if hasattr(X, "iloc"): + y = X.iloc[:, 0] + else: + y = X[:, 0] + base_margin = X + # no error at set + Xy = DMatrixT(X, y, base_margin=base_margin) + # Error at train, caused by check in predictor. + with pytest.raises(ValueError, match=r".*base_margin.*"): + train_fn({"tree_method": "hist", "device": device}, Xy) + + if not hasattr(X, "iloc"): + # column major matrix + got = DType(Xy.get_base_margin().reshape(50, 2)) + assert (got == base_margin).all() + + assert base_margin.T.flags.c_contiguous is False + assert base_margin.T.flags.f_contiguous is True + Xy.set_info(base_margin=base_margin.T) + got = DType(Xy.get_base_margin().reshape(2, 50)) + assert (got == base_margin.T).all() + + # Row vs col vec. + base_margin = y + Xy.set_base_margin(base_margin) + bm_col = Xy.get_base_margin() + Xy.set_base_margin(base_margin.reshape(1, base_margin.size)) + bm_row = Xy.get_base_margin() + assert (bm_row == bm_col).all() + + # type + base_margin = base_margin.astype(np.float64) + Xy.set_base_margin(base_margin) + bm_f64 = Xy.get_base_margin() + assert (bm_f64 == bm_col).all() + + # too many dimensions + base_margin = X.reshape(2, 5, 2, 5) + with pytest.raises(ValueError, match=r".*base_margin.*"): + Xy.set_base_margin(base_margin) + + +# pylint: disable=too-many-locals +@memory.cache +def make_sparse_regression( + n_samples: int, n_features: int, sparsity: float, as_dense: bool +) -> Tuple[Union[sparse.csr_matrix], np.ndarray]: + """Make sparse matrix. + + Parameters + ---------- + + as_dense: + + Return the matrix as np.ndarray with missing values filled by NaN + + """ + if not hasattr(np.random, "default_rng"): + rng = np.random.RandomState(1994) + X = sparse.random( + m=n_samples, + n=n_features, + density=1.0 - sparsity, + random_state=rng, + format="csr", + ) + y = rng.normal(loc=0.0, scale=1.0, size=n_samples) + return X, y + + # Use multi-thread to speed up the generation, convenient if you use this function + # for benchmarking. + n_threads = min(multiprocessing.cpu_count(), n_features) + + def random_csc(t_id: int) -> sparse.csc_matrix: + rng = np.random.default_rng(1994 * t_id) + thread_size = n_features // n_threads + if t_id == n_threads - 1: + n_features_tloc = n_features - t_id * thread_size + else: + n_features_tloc = thread_size + + X = sparse.random( + m=n_samples, + n=n_features_tloc, + density=1.0 - sparsity, + random_state=rng, + ).tocsc() + y = np.zeros((n_samples, 1)) + + for i in range(X.shape[1]): + size = X.indptr[i + 1] - X.indptr[i] + if size != 0: + y += X[:, i].toarray() * rng.random((n_samples, 1)) * 0.2 + + return X, y + + futures = [] + with ThreadPoolExecutor(max_workers=n_threads) as executor: + for i in range(n_threads): + futures.append(executor.submit(random_csc, i)) + + X_results = [] + y_results = [] + for f in futures: + X, y = f.result() + X_results.append(X) + y_results.append(y) + + assert len(y_results) == n_threads + + csr: sparse.csr_matrix = sparse.hstack(X_results, format="csr") + y = np.asarray(y_results) + y = y.reshape((y.shape[0], y.shape[1])).T + y = np.sum(y, axis=1) + + assert csr.shape[0] == n_samples + assert csr.shape[1] == n_features + assert y.shape[0] == n_samples + + if as_dense: + arr = csr.toarray() + assert arr.shape[0] == n_samples + assert arr.shape[1] == n_features + arr[arr == 0] = np.nan + return arr, y + + return csr, y + + +def unique_random_strings(n_strings: int, seed: int) -> List[str]: + """Generate n unique strings.""" + name_len = 8 # hardcoded, should be more than enough + unique_strings: Set[str] = set() + rng = np.random.default_rng(seed) + + while len(unique_strings) < n_strings: + random_str = "".join( + rng.choice(list(string.ascii_letters), size=name_len, replace=True) + ) + unique_strings.add(random_str) + + return list(unique_strings) + + +# pylint: disable=too-many-arguments,too-many-locals,too-many-branches +def make_categorical( + n_samples: int, + n_features: int, + n_categories: int, + *, + onehot: bool, + sparsity: float = 0.0, + cat_ratio: float = 1.0, + shuffle: bool = False, + random_state: int = 1994, + cat_dtype: np.typing.DTypeLike = np.int64, + device: str = "cpu", +) -> Tuple[ArrayLike, np.ndarray]: + """Generate categorical features for test. + + Parameters + ---------- + n_categories: + Number of categories for categorical features. + onehot: + Should we apply one-hot encoding to the data? + sparsity: + The ratio of the amount of missing values over the number of all entries. + cat_ratio: + The ratio of features that are categorical. + shuffle: + Whether we should shuffle the columns. + cat_dtype : + The dtype for categorical features, might be string or numeric. + + Returns + ------- + X, y + """ + pd = pytest.importorskip("pandas") + + # Use different rngs for column and rows. We can change the `n_samples` without + # changing the column type. + rng = np.random.RandomState(random_state) + row_rng = np.random.RandomState(random_state + 1) + + df = pd.DataFrame() + for i in range(n_features): + choice = rng.binomial(1, cat_ratio, size=1)[0] + if choice == 1: + if np.issubdtype(cat_dtype, np.str_): + # we rely on using the feature index as the seed to generate the same + # categories for multiple calls to `make_categorical`. + categories = np.array(unique_random_strings(n_categories, i)) + c = row_rng.choice(categories, size=n_samples, replace=True) + else: + categories = np.arange(0, n_categories) + c = row_rng.randint(low=0, high=n_categories, size=n_samples) + + df[str(i)] = pd.Series(c, dtype="category") + df[str(i)] = df[str(i)].cat.set_categories(categories) + else: + num = row_rng.randint(low=0, high=n_categories, size=n_samples) + df[str(i)] = pd.Series(num, dtype=num.dtype) + + label = np.zeros(shape=(n_samples,)) + for col in df.columns: + if isinstance(df[col].dtype, pd.CategoricalDtype): + label += df[col].cat.codes + else: + label += df[col] + label += 1 + + if sparsity > 0.0: + for i in range(n_features): + index = row_rng.randint( + low=0, high=n_samples - 1, size=int(n_samples * sparsity) + ) + df.iloc[index, i] = np.nan + if is_pd_cat_dtype(df.dtypes.iloc[i]): + assert n_categories == np.unique(df.dtypes.iloc[i].categories).size + + assert df.shape[1] == n_features + if onehot: + df = pd.get_dummies(df) + + if shuffle: + columns = list(df.columns) + row_rng.shuffle(columns) + df = df[columns] + + if device != "cpu": + assert device in ["cuda", "gpu"] + import cudf + import cupy + + df = cudf.from_pandas(df) + label = cupy.array(label) + return df, label + + +class IteratorForTest(DataIter): + """Iterator for testing streaming DMatrix. (external memory, quantile)""" + + def __init__( # pylint: disable=too-many-arguments + self, + X: Sequence, + y: Sequence, + w: Optional[Sequence], + *, + cache: Optional[str], + on_host: bool = False, + min_cache_page_bytes: Optional[int] = None, + ) -> None: + assert len(X) == len(y) + self.X = X + self.y = y + self.w = w + self.it = 0 + super().__init__( + cache_prefix=cache, + on_host=on_host, + min_cache_page_bytes=min_cache_page_bytes, + ) + + def next(self, input_data: Callable) -> bool: + if self.it == len(self.X): + return False + + with pytest.raises(TypeError, match="Keyword argument"): + input_data(self.X[self.it], self.y[self.it], None) + + # Use copy to make sure the iterator doesn't hold a reference to the data. + input_data( + data=self.X[self.it].copy(), + label=self.y[self.it].copy(), + weight=self.w[self.it].copy() if self.w else None, + ) + gc.collect() # clear up the copy, see if XGBoost access freed memory. + self.it += 1 + return True + + def reset(self) -> None: + self.it = 0 + + def as_arrays( + self, + ) -> Tuple[Union[np.ndarray, sparse.csr_matrix], ArrayLike, Optional[ArrayLike]]: + """Return concatenated arrays.""" + X = concat(self.X) + y = concat(self.y) + if self.w: + w = np.concatenate(self.w, axis=0) + else: + w = None + return X, y, w diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/xgboost/testing/data_iter.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/xgboost/testing/data_iter.py new file mode 100644 index 0000000000000000000000000000000000000000..371578ed9ebf597d96118ed194c1b060a9811108 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/xgboost/testing/data_iter.py @@ -0,0 +1,174 @@ +"""Tests related to the `DataIter` interface.""" + +from typing import Callable, Optional + +import numpy as np + +from xgboost import testing as tm + +from ..compat import import_cupy +from ..core import DataIter, DMatrix, ExtMemQuantileDMatrix, QuantileDMatrix +from .utils import predictor_equal + + +def run_mixed_sparsity(device: str) -> None: + """Check QDM with mixed batches.""" + X_0, y_0, _ = tm.make_regression(128, 16, False) + if device.startswith("cuda"): + X_1, y_1 = tm.make_sparse_regression(256, 16, 0.1, True) + else: + X_1, y_1 = tm.make_sparse_regression(256, 16, 0.1, False) + X_2, y_2 = tm.make_sparse_regression(512, 16, 0.9, True) + X = [X_0, X_1, X_2] + y = [y_0, y_1, y_2] + + if device.startswith("cuda"): + cp = import_cupy() + + X = [cp.array(batch) for batch in X] + + it = tm.IteratorForTest(X, y, None, cache=None, on_host=False) + Xy_0 = QuantileDMatrix(it) + + X_1, y_1 = tm.make_sparse_regression(256, 16, 0.1, True) + X = [X_0, X_1, X_2] + y = [y_0, y_1, y_2] + X_arr = np.concatenate(X, axis=0) + y_arr = np.concatenate(y, axis=0) + Xy_1 = QuantileDMatrix(X_arr, y_arr) + + assert predictor_equal(Xy_0, Xy_1) + + +def check_invalid_cat_batches(device: str) -> None: + """Check error message for inconsistent feature types.""" + + class _InvalidCatIter(DataIter): + def __init__(self) -> None: + super().__init__(cache_prefix=None) + self._it = 0 + + def next(self, input_data: Callable) -> bool: + if self._it == 2: + return False + X, y = tm.make_categorical( + 64, + 12, + 4, + onehot=False, + sparsity=0.5, + cat_ratio=1.0 if self._it == 0 else 0.5, + ) + if device == "cuda": + import cudf + import cupy + + X = cudf.DataFrame(X) + y = cupy.array(y) + + input_data(data=X, label=y) + self._it += 1 + return True + + def reset(self) -> None: + self._it = 0 + + it = _InvalidCatIter() + import pytest + + with pytest.raises(ValueError, match="Inconsistent number of categories between"): + ExtMemQuantileDMatrix(it, enable_categorical=True) + + with pytest.raises(ValueError, match="Inconsistent number of categories between"): + QuantileDMatrix(it, enable_categorical=True) + + with pytest.raises(ValueError, match="Inconsistent feature types"): + DMatrix(it, enable_categorical=True) + + +def check_uneven_sizes(device: str) -> None: + """Tests for having irregular data shapes.""" + batches = [ + tm.make_regression(n_samples, 16, use_cupy=device == "cuda") + for n_samples in [512, 256, 1024] + ] + unzip = list(zip(*batches)) + it = tm.IteratorForTest(unzip[0], unzip[1], None, cache="cache", on_host=True) + + Xy = DMatrix(it) + assert Xy.num_col() == 16 + assert Xy.num_row() == sum(x.shape[0] for x in unzip[0]) + + Xy = ExtMemQuantileDMatrix(it) + assert Xy.num_col() == 16 + assert Xy.num_row() == sum(x.shape[0] for x in unzip[0]) + + +class CatIter(DataIter): # pylint: disable=too-many-instance-attributes + """An iterator for testing categorical features.""" + + def __init__( # pylint: disable=too-many-arguments,too-many-locals + self, + n_samples_per_batch: int, + n_features: int, + *, + n_batches: int, + n_cats: int, + sparsity: float, + cat_ratio: float, + onehot: bool, + device: str, + cache: Optional[str], + ) -> None: + super().__init__(cache_prefix=cache) + self.n_batches = n_batches + self.device = device + + n_samples = n_samples_per_batch * n_batches + cat, y = tm.make_categorical( + n_samples, + n_features, + n_categories=n_cats, + onehot=onehot, + cat_ratio=cat_ratio, + sparsity=sparsity, + ) + xs, ys = [], [] + + prev = 0 + for _ in range(n_batches): + n = min(n_samples_per_batch, n_samples - prev) + X = cat.iloc[prev : prev + n, :] + xs.append(X) + ys.append(y[prev : prev + n]) + prev += n_samples_per_batch + + self.xs = xs + self.ys = ys + + self.x = cat + self.y = y + + self._it = 0 + + def xy(self) -> tuple: + """Return the concatenated data.""" + return self.x, self.y + + def next(self, input_data: Callable) -> bool: + if self._it == self.n_batches: + return False + + X, y = self.xs[self._it], self.ys[self._it] + if self.device == "cuda": + import cudf + import cupy + + X = cudf.DataFrame(X) + y = cupy.array(y) + input_data(data=X, label=y) + self._it += 1 + return True + + def reset(self) -> None: + self._it = 0 diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/xgboost/testing/federated.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/xgboost/testing/federated.py new file mode 100644 index 0000000000000000000000000000000000000000..981a124b8a836d927f9871383b204b798a5b06f8 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/xgboost/testing/federated.py @@ -0,0 +1,155 @@ +# pylint: disable=unbalanced-tuple-unpacking, too-many-locals +"""Tests for federated learning.""" + +import multiprocessing +import os +import subprocess +import tempfile +import time +from typing import List, cast + +from sklearn.datasets import dump_svmlight_file, load_svmlight_file +from sklearn.model_selection import train_test_split + +import xgboost as xgb +import xgboost.federated +from xgboost import testing as tm + +from .._typing import EvalsLog +from ..collective import _Args as CollArgs + +SERVER_KEY = "server-key.pem" +SERVER_CERT = "server-cert.pem" +CLIENT_KEY = "client-key.pem" +CLIENT_CERT = "client-cert.pem" + + +def run_server(port: int, world_size: int, with_ssl: bool) -> None: + """Run federated server for test.""" + if with_ssl: + xgboost.federated.run_federated_server( + world_size, + port, + server_key_path=SERVER_KEY, + server_cert_path=SERVER_CERT, + client_cert_path=CLIENT_CERT, + ) + else: + xgboost.federated.run_federated_server(world_size, port) + + +def run_worker( + port: int, world_size: int, rank: int, with_ssl: bool, device: str +) -> None: + """Run federated client worker for test.""" + comm_env: CollArgs = { + "dmlc_communicator": "federated", + "federated_server_address": f"localhost:{port}", + "federated_world_size": world_size, + "federated_rank": rank, + } + if with_ssl: + comm_env["federated_server_cert_path"] = SERVER_CERT + comm_env["federated_client_key_path"] = CLIENT_KEY + comm_env["federated_client_cert_path"] = CLIENT_CERT + + cpu_count = os.cpu_count() + assert cpu_count is not None + n_threads = cpu_count // world_size + + # Always call this before using distributed module + with xgb.collective.CommunicatorContext(**comm_env): + # Load file, file will not be sharded in federated mode. + X, y = load_svmlight_file(f"agaricus.txt-{rank}.train") + dtrain = xgb.DMatrix(X, y) + X, y = load_svmlight_file(f"agaricus.txt-{rank}.test") + dtest = xgb.DMatrix(X, y) + + # Specify parameters via map, definition are same as c++ version + param = { + "max_depth": 2, + "eta": 1, + "objective": "binary:logistic", + "nthread": n_threads, + "tree_method": "hist", + "device": device, + } + + # Specify validations set to watch performance + watchlist = [(dtest, "eval"), (dtrain, "train")] + num_round = 20 + + # Run training, all the features in training API is available. + results: EvalsLog = {} + bst = xgb.train( + param, + dtrain, + num_round, + evals=watchlist, + early_stopping_rounds=2, + evals_result=results, + ) + assert tm.non_increasing(cast(List[float], results["train"]["logloss"])) + assert tm.non_increasing(cast(List[float], results["eval"]["logloss"])) + + # save the model, only ask process 0 to save the model. + if xgb.collective.get_rank() == 0: + with tempfile.TemporaryDirectory() as tmpdir: + bst.save_model(os.path.join(tmpdir, "model.json")) + xgb.collective.communicator_print("Finished training\n") + + +def run_federated(world_size: int, with_ssl: bool, use_gpu: bool) -> None: + """Launcher for clients and the server.""" + port = 9091 + + server = multiprocessing.Process( + target=run_server, args=(port, world_size, with_ssl) + ) + server.start() + time.sleep(1) + if not server.is_alive(): + raise ValueError("Error starting Federated Learning server") + + workers = [] + for rank in range(world_size): + device = f"cuda:{rank}" if use_gpu else "cpu" + worker = multiprocessing.Process( + target=run_worker, args=(port, world_size, rank, with_ssl, device) + ) + workers.append(worker) + worker.start() + for worker in workers: + worker.join() + server.terminate() + + +def run_federated_learning(with_ssl: bool, use_gpu: bool, test_path: str) -> None: + """Run federated learning tests.""" + n_workers = 2 + + if with_ssl: + command = "openssl req -x509 -newkey rsa:2048 -days 7 -nodes -keyout {part}-key.pem -out {part}-cert.pem -subj /C=US/CN=localhost" # pylint: disable=line-too-long + server_key = command.format(part="server").split() + subprocess.check_call(server_key) + client_key = command.format(part="client").split() + subprocess.check_call(client_key) + + train_path = os.path.join(tm.data_dir(test_path), "agaricus.txt.train") + test_path = os.path.join(tm.data_dir(test_path), "agaricus.txt.test") + + X_train, y_train = load_svmlight_file(train_path) + X_test, y_test = load_svmlight_file(test_path) + + X0, X1, y0, y1 = train_test_split(X_train, y_train, test_size=0.5) + X0_valid, X1_valid, y0_valid, y1_valid = train_test_split( + X_test, y_test, test_size=0.5 + ) + + dump_svmlight_file(X0, y0, "agaricus.txt-0.train") + dump_svmlight_file(X0_valid, y0_valid, "agaricus.txt-0.test") + + dump_svmlight_file(X1, y1, "agaricus.txt-1.train") + dump_svmlight_file(X1_valid, y1_valid, "agaricus.txt-1.test") + + run_federated(world_size=n_workers, with_ssl=with_ssl, use_gpu=use_gpu) diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/xgboost/testing/interaction_constraints.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/xgboost/testing/interaction_constraints.py new file mode 100644 index 0000000000000000000000000000000000000000..4e12a894e69592293a0dddc26b91fc71646f3a0d --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/xgboost/testing/interaction_constraints.py @@ -0,0 +1,88 @@ +"""Tests for interaction constraints.""" + +from typing import Optional, Sequence, Union + +import numpy as np + +from .._typing import FeatureNames +from ..core import DMatrix +from ..training import train +from .utils import Device + + +def run_interaction_constraints( # pylint: disable=too-many-locals + tree_method: str, + device: Device, + feature_names: Optional[FeatureNames] = None, + interaction_constraints: Union[str, Sequence] = "[[0, 1]]", +) -> None: + """Tests interaction constraints on a synthetic dataset.""" + x1 = np.random.normal(loc=1.0, scale=1.0, size=1000) + x2 = np.random.normal(loc=1.0, scale=1.0, size=1000) + x3 = np.random.choice([1, 2, 3], size=1000, replace=True) + y = ( + x1 + + x2 + + x3 + + x1 * x2 * x3 + + np.random.normal(loc=0.001, scale=1.0, size=1000) + + 3 * np.sin(x1) + ) + X = np.column_stack((x1, x2, x3)) + dtrain = DMatrix(X, label=y, feature_names=feature_names) + + params = { + "max_depth": 3, + "eta": 0.1, + "nthread": 2, + "interaction_constraints": interaction_constraints, + "tree_method": tree_method, + "device": device, + } + num_boost_round = 12 + # Fit a model that only allows interaction between x1 and x2 + bst = train(params, dtrain, num_boost_round, evals=[(dtrain, "train")]) + + # Set all observations to have the same x3 values then increment by the same amount + def f(x: int) -> np.ndarray: + tmat = DMatrix( + np.column_stack((x1, x2, np.repeat(x, 1000))), feature_names=feature_names + ) + return bst.predict(tmat) + + preds = [f(x) for x in [1, 2, 3]] + + # Check incrementing x3 has the same effect on all observations + # since x3 is constrained to be independent of x1 and x2 + # and all observations start off from the same x3 value + diff1 = preds[1] - preds[0] + assert np.all(np.abs(diff1 - diff1[0]) < 1e-4) + diff2 = preds[2] - preds[1] + assert np.all(np.abs(diff2 - diff2[0]) < 1e-4) + + +def training_accuracy(tree_method: str, dpath: str, device: Device) -> None: + """Test accuracy, reused by GPU tests.""" + from sklearn.metrics import accuracy_score + + dtrain = DMatrix(dpath + "agaricus.txt.train?indexing_mode=1&format=libsvm") + dtest = DMatrix(dpath + "agaricus.txt.test?indexing_mode=1&format=libsvm") + params = { + "eta": 1, + "max_depth": 6, + "objective": "binary:logistic", + "tree_method": tree_method, + "device": device, + "interaction_constraints": "[[1,2], [2,3,4]]", + } + num_boost_round = 5 + + params["grow_policy"] = "lossguide" + bst = train(params, dtrain, num_boost_round) + pred_dtest = bst.predict(dtest) < 0.5 + assert accuracy_score(dtest.get_label(), pred_dtest) < 0.1 + + params["grow_policy"] = "depthwise" + bst = train(params, dtrain, num_boost_round) + pred_dtest = bst.predict(dtest) < 0.5 + assert accuracy_score(dtest.get_label(), pred_dtest) < 0.1 diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/xgboost/testing/intercept.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/xgboost/testing/intercept.py new file mode 100644 index 0000000000000000000000000000000000000000..4496059eb84e41a2dd0de61561513e6e490ede11 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/xgboost/testing/intercept.py @@ -0,0 +1,260 @@ +"""Tests for estimating the intercept.""" + +import json +from typing import Dict, List, Optional + +import numpy as np +from scipy.special import softmax +from sklearn.datasets import ( + make_classification, + make_multilabel_classification, + make_regression, +) + +from ..core import Booster, DMatrix, QuantileDMatrix +from ..sklearn import XGBClassifier, XGBRegressor +from ..training import train +from .updater import get_basescore +from .utils import Device, non_increasing + + +# pylint: disable=too-many-statements +def run_init_estimation(tree_method: str, device: Device) -> None: + """Test for init estimation.""" + + def run_reg(X: np.ndarray, y: np.ndarray) -> None: # pylint: disable=invalid-name + reg = XGBRegressor( + tree_method=tree_method, max_depth=1, n_estimators=1, device=device + ) + reg.fit(X, y, eval_set=[(X, y)]) + base_score_0 = get_basescore(reg) + score_0 = reg.evals_result()["validation_0"]["rmse"][0] + + n_targets = 1 if y.ndim == 1 else y.shape[1] + intercept = np.full(shape=(n_targets,), fill_value=0.5, dtype=np.float32) + reg = XGBRegressor( + tree_method=tree_method, + device=device, + max_depth=1, + n_estimators=1, + base_score=intercept, + ) + reg.fit(X, y, eval_set=[(X, y)]) + base_score_1 = get_basescore(reg) + score_1 = reg.evals_result()["validation_0"]["rmse"][0] + assert not np.isclose(base_score_0, base_score_1).any() + assert score_0 < score_1 # should be better + + # pylint: disable=unbalanced-tuple-unpacking + X, y = make_regression(n_samples=4096, random_state=17) + run_reg(X, y) + # pylint: disable=unbalanced-tuple-unpacking + X, y = make_regression(n_samples=4096, n_targets=3, random_state=17) + run_reg(X, y) + + # pylint: disable=invalid-name + def run_clf( + X: np.ndarray, y: np.ndarray, w: Optional[np.ndarray] = None + ) -> List[float]: + clf = XGBClassifier( + tree_method=tree_method, max_depth=1, n_estimators=1, device=device + ) + if w is not None: + clf.fit( + X, y, sample_weight=w, eval_set=[(X, y)], sample_weight_eval_set=[w] + ) + else: + clf.fit(X, y, eval_set=[(X, y)]) + base_score_0 = get_basescore(clf) + if clf.n_classes_ == 2: + score_0 = clf.evals_result()["validation_0"]["logloss"][0] + else: + score_0 = clf.evals_result()["validation_0"]["mlogloss"][0] + + n_targets = 1 if y.ndim == 1 else y.shape[1] + intercept = np.full(shape=(n_targets,), fill_value=0.5, dtype=np.float32) + clf = XGBClassifier( + tree_method=tree_method, + max_depth=1, + n_estimators=1, + device=device, + base_score=intercept, + ) + if w is not None: + clf.fit( + X, y, sample_weight=w, eval_set=[(X, y)], sample_weight_eval_set=[w] + ) + else: + clf.fit(X, y, eval_set=[(X, y)]) + base_score_1 = get_basescore(clf) + if clf.n_classes_ == 2: + score_1 = clf.evals_result()["validation_0"]["logloss"][0] + else: + score_1 = clf.evals_result()["validation_0"]["mlogloss"][0] + assert not np.isclose(base_score_0, base_score_1).any() + assert score_0 < score_1 + 1e-4 # should be better + + return base_score_0 + + # pylint: disable=unbalanced-tuple-unpacking + X, y = make_classification(n_samples=4096, random_state=17) + run_clf(X, y) + X, y = make_multilabel_classification( + n_samples=4096, n_labels=3, n_classes=5, random_state=17 + ) + run_clf(X, y) + + # Extra tests for the classifier. + X, y = make_classification( + n_samples=4096, random_state=17, n_classes=5, n_informative=20, n_redundant=0 + ) + intercept = run_clf(X, y) + # un-transformed intercept sums to 0, as a convention. + np.testing.assert_allclose(np.sum(softmax(intercept)), 1.0) + np.testing.assert_allclose(np.sum(intercept), 0.0, atol=1e-6) + + assert np.all(softmax(intercept) > 0) + np_int = ( + np.histogram( + y, bins=np.concatenate([np.unique(y), np.array([np.finfo(np.float32).max])]) + )[0] + / y.shape[0] + ) + np.testing.assert_allclose(softmax(intercept), np_int, rtol=1e-6) + + rng = np.random.default_rng(1994) + w = rng.uniform(low=0, high=1, size=(y.shape[0],)) + intercept = run_clf(X, y, w) + np.testing.assert_allclose(np.sum(softmax(intercept)), 1.0) + assert np.all(softmax(intercept) > 0) + + +# pylint: disable=too-many-locals +def run_adaptive(tree_method: str, weighted: bool, device: Device) -> None: + """Test for adaptive trees.""" + rng = np.random.RandomState(1994) + from sklearn.utils import stats + + n_samples = 256 + X, y = make_regression( # pylint: disable=unbalanced-tuple-unpacking + n_samples, 16, random_state=rng + ) + if weighted: + w = rng.normal(size=n_samples) + w -= w.min() + Xy = DMatrix(X, y, weight=w) + + kwargs = {"percentile_rank": 50} + base_score = stats._weighted_percentile( # pylint: disable=protected-access + y, w, **kwargs + ) + else: + Xy = DMatrix(X, y) + base_score = np.median(y) + + # Check the base score is expected. + booster_0 = train( + { + "tree_method": tree_method, + "base_score": base_score, + "objective": "reg:absoluteerror", + "device": device, + }, + Xy, + num_boost_round=1, + ) + booster_1 = train( + { + "tree_method": tree_method, + "objective": "reg:absoluteerror", + "device": device, + }, + Xy, + num_boost_round=1, + ) + config_0 = json.loads(booster_0.save_config()) + config_1 = json.loads(booster_1.save_config()) + + assert get_basescore(config_0) == get_basescore(config_1) + + # check the base score is correctly serialized. + raw_booster = booster_1.save_raw(raw_format="ubj") + booster_2 = Booster(model_file=raw_booster) + config_2 = json.loads(booster_2.save_config()) + assert get_basescore(config_1) == get_basescore(config_2) + + # check we can override the base score. + booster_0 = train( + { + "tree_method": tree_method, + "base_score": base_score + 1.0, + "objective": "reg:absoluteerror", + "device": device, + }, + Xy, + num_boost_round=1, + ) + config_0 = json.loads(booster_0.save_config()) + np.testing.assert_allclose( + get_basescore(config_0), np.asarray(get_basescore(config_1)) + 1 + ) + + # check we can use subsampling. + evals_result: Dict[str, Dict[str, list]] = {} + train( + { + "tree_method": tree_method, + "device": device, + "objective": "reg:absoluteerror", + "subsample": 0.8, + "eta": 1.0, + }, + Xy, + num_boost_round=10, + evals=[(Xy, "Train")], + evals_result=evals_result, + ) + mae = evals_result["Train"]["mae"] + assert mae[-1] < 20.0 + assert non_increasing(mae) + + +def run_exp_family(device: Device) -> None: + """Exp family has a closed solution.""" + X, y = make_classification(n_samples=128, n_classes=2, weights=[0.8, 0.2]) + Xy = QuantileDMatrix(X, y) + clf = train( + {"objective": "binary:logistic", "device": device}, Xy, num_boost_round=1 + ) + reg = train({"objective": "reg:logistic", "device": device}, Xy, num_boost_round=1) + clf1 = train( + {"objective": "binary:logitraw", "device": device}, Xy, num_boost_round=1 + ) + # The base score stored in the booster model is un-transformed + np.testing.assert_allclose([get_basescore(m) for m in (reg, clf, clf1)], y.mean()) + + X, y = make_classification(weights=[0.8, 0.2], random_state=2025) + clf = train( + {"objective": "binary:logistic", "scale_pos_weight": 4.0, "device": device}, + QuantileDMatrix(X, y), + num_boost_round=1, + ) + score = get_basescore(clf) + np.testing.assert_allclose(score, 0.5, rtol=1e-3) + + +def run_logistic_degenerate(device: Device) -> None: + """Test https://github.com/dmlc/xgboost/issues/11499 .""" + + def run(v: float) -> None: + dtrain = DMatrix(np.asarray([[1.0], [1.0]]), label=[v, v]) + bst = train( + {"objective": "binary:logistic", "device": device}, + dtrain, + 1, + ) + intercept = get_basescore(bst) + assert intercept[0] == v + + run(0.0) + run(1.0) diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/xgboost/testing/metrics.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/xgboost/testing/metrics.py new file mode 100644 index 0000000000000000000000000000000000000000..f6e5033b4ba353f8db09531e8c675afd10f04f9b --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/xgboost/testing/metrics.py @@ -0,0 +1,270 @@ +"""Tests for evaluation metrics.""" + +from typing import Dict, List + +import numpy as np +import pytest + +from ..compat import concat +from ..core import DMatrix, QuantileDMatrix, _parse_eval_str +from ..sklearn import XGBClassifier, XGBRanker +from ..training import train +from .utils import Device + + +def check_precision_score( # pylint: disable=too-many-locals + tree_method: str, device: Device +) -> None: + """Test for precision with ranking and classification.""" + datasets = pytest.importorskip("sklearn.datasets") + + X, y = datasets.make_classification( + n_samples=1024, n_features=4, n_classes=2, random_state=2023 + ) + qid = np.zeros(shape=y.shape) # same group + + ltr = XGBRanker(n_estimators=2, tree_method=tree_method, device=device) + ltr.fit(X, y, qid=qid) + + # re-generate so that XGBoost doesn't evaluate the result to 1.0 + X, y = datasets.make_classification( + n_samples=512, n_features=4, n_classes=2, random_state=1994 + ) + + ltr.set_params(eval_metric="pre@32") + result = _parse_eval_str(ltr.get_booster().eval_set(evals=[(DMatrix(X, y), "Xy")])) + score_0 = result[1][1] + + X_list = [] + y_list = [] + n_query_groups = 3 + q_list: List[np.ndarray] = [] + for i in range(n_query_groups): + # same for all groups + X, y = datasets.make_classification( + n_samples=512, n_features=4, n_classes=2, random_state=1994 + ) + X_list.append(X) + y_list.append(y) + q = np.full(shape=y.shape, fill_value=i, dtype=np.uint64) + q_list.append(q) + + qid = concat(q_list) + X = concat(X_list) + y = concat(y_list) + + result = _parse_eval_str( + ltr.get_booster().eval_set(evals=[(DMatrix(X, y, qid=qid), "Xy")]) + ) + assert result[1][0].endswith("pre@32") + score_1 = result[1][1] + assert score_1 == score_0 + + +def check_quantile_error(tree_method: str, device: Device) -> None: + """Test for the `quantile` loss.""" + from sklearn.datasets import make_regression + from sklearn.metrics import mean_pinball_loss + + rng = np.random.RandomState(19) + # pylint: disable=unbalanced-tuple-unpacking + X, y = make_regression(128, 3, random_state=rng) + Xy = QuantileDMatrix(X, y) + evals_result: Dict[str, Dict] = {} + booster = train( + { + "tree_method": tree_method, + "eval_metric": "quantile", + "quantile_alpha": 0.3, + "device": device, + }, + Xy, + evals=[(Xy, "Train")], + evals_result=evals_result, + ) + predt = booster.inplace_predict(X) + loss = mean_pinball_loss(y, predt, alpha=0.3) + np.testing.assert_allclose(evals_result["Train"]["quantile"][-1], loss) + + alpha = [0.25, 0.5, 0.75] + booster = train( + { + "tree_method": tree_method, + "eval_metric": "quantile", + "quantile_alpha": alpha, + "objective": "reg:quantileerror", + "device": device, + }, + Xy, + evals=[(Xy, "Train")], + evals_result=evals_result, + ) + predt = booster.inplace_predict(X) + loss = np.mean( + [mean_pinball_loss(y, predt[:, i], alpha=alpha[i]) for i in range(3)] + ) + np.testing.assert_allclose(evals_result["Train"]["quantile"][-1], loss) + + +def run_roc_auc_binary(tree_method: str, n_samples: int, device: Device) -> None: + """TestROC AUC metric on a binary classification problem.""" + from sklearn.datasets import make_classification + from sklearn.metrics import roc_auc_score + + rng = np.random.RandomState(1994) + n_features = 10 + + X, y = make_classification( + n_samples, + n_features, + n_informative=n_features, + n_redundant=0, + random_state=rng, + ) + Xy = DMatrix(X, y) + booster = train( + { + "tree_method": tree_method, + "device": device, + "eval_metric": "auc", + "objective": "binary:logistic", + }, + Xy, + num_boost_round=1, + ) + score = booster.predict(Xy) + skl_auc = roc_auc_score(y, score) + auc = float(booster.eval(Xy).split(":")[1]) + np.testing.assert_allclose(skl_auc, auc, rtol=1e-6) + + X = rng.randn(*X.shape) + score = booster.predict(DMatrix(X)) + skl_auc = roc_auc_score(y, score) + auc = float(booster.eval(DMatrix(X, y)).split(":")[1]) + np.testing.assert_allclose(skl_auc, auc, rtol=1e-6) + + +def run_pr_auc_multi(tree_method: str, device: Device) -> None: + """Test for PR AUC metric on a multi-class classification problem.""" + from sklearn.datasets import make_classification + + X, y = make_classification(64, 16, n_informative=8, n_classes=3, random_state=1994) + clf = XGBClassifier( + tree_method=tree_method, n_estimators=1, eval_metric="aucpr", device=device + ) + clf.fit(X, y, eval_set=[(X, y)]) + evals_result = clf.evals_result()["validation_0"]["aucpr"][-1] + # No available implementation for comparison, just check that XGBoost converges + # to 1.0 + clf = XGBClassifier( + tree_method=tree_method, n_estimators=10, eval_metric="aucpr", device=device + ) + clf.fit(X, y, eval_set=[(X, y)]) + evals_result = clf.evals_result()["validation_0"]["aucpr"][-1] + np.testing.assert_allclose(1.0, evals_result, rtol=1e-2) + + +def run_roc_auc_multi( # pylint: disable=too-many-locals + tree_method: str, n_samples: int, weighted: bool, device: Device +) -> None: + """Test for ROC AUC metric on a multi-class classification problem.""" + from sklearn.datasets import make_classification + from sklearn.metrics import roc_auc_score + + rng = np.random.RandomState(1994) + n_features = 10 + n_classes = 4 + + X, y = make_classification( + n_samples, + n_features, + n_informative=n_features, + n_redundant=0, + n_classes=n_classes, + random_state=rng, + ) + if weighted: + weights = rng.randn(n_samples) + weights -= weights.min() + weights /= weights.max() + else: + weights = None + + Xy = DMatrix(X, y, weight=weights) + booster = train( + { + "tree_method": tree_method, + "eval_metric": "auc", + "objective": "multi:softprob", + "num_class": n_classes, + "device": device, + }, + Xy, + num_boost_round=1, + ) + score = booster.predict(Xy) + skl_auc = roc_auc_score( + y, score, average="weighted", sample_weight=weights, multi_class="ovr" + ) + auc = float(booster.eval(Xy).split(":")[1]) + np.testing.assert_allclose(skl_auc, auc, rtol=1e-6) + + X = rng.randn(*X.shape) + + score = booster.predict(DMatrix(X, weight=weights)) + skl_auc = roc_auc_score( + y, score, average="weighted", sample_weight=weights, multi_class="ovr" + ) + auc = float(booster.eval(DMatrix(X, y, weight=weights)).split(":")[1]) + np.testing.assert_allclose(skl_auc, auc, rtol=1e-5) + + +def run_pr_auc_ltr(tree_method: str, device: Device) -> None: + """Test for PR AUC metric on a ranking problem.""" + from sklearn.datasets import make_classification + + X, y = make_classification(128, 4, n_classes=2, random_state=1994) + ltr = XGBRanker( + tree_method=tree_method, + n_estimators=16, + objective="rank:pairwise", + eval_metric="aucpr", + device=device, + ) + groups = np.array([32, 32, 64]) + ltr.fit( + X, + y, + group=groups, + eval_set=[(X, y)], + eval_group=[groups], + ) + results = ltr.evals_result()["validation_0"]["aucpr"] + assert results[-1] >= 0.99 + + +def run_pr_auc_binary(tree_method: str, device: Device) -> None: + """Test for PR AUC metric on a binary classification problem.""" + from sklearn.datasets import make_classification + from sklearn.metrics import auc, precision_recall_curve + + X, y = make_classification(128, 4, n_classes=2, random_state=1994) + clf = XGBClassifier( + tree_method=tree_method, n_estimators=1, eval_metric="aucpr", device=device + ) + clf.fit(X, y, eval_set=[(X, y)]) + evals_result = clf.evals_result()["validation_0"]["aucpr"][-1] + + y_score = clf.predict_proba(X)[:, 1] # get the positive column + precision, recall, _ = precision_recall_curve(y, y_score) + prauc = auc(recall, precision) + # Interpolation results are slightly different from sklearn, but overall should + # be similar. + np.testing.assert_allclose(prauc, evals_result, rtol=1e-2) + + clf = XGBClassifier( + tree_method=tree_method, n_estimators=10, eval_metric="aucpr", device=device + ) + clf.fit(X, y, eval_set=[(X, y)]) + evals_result = clf.evals_result()["validation_0"]["aucpr"][-1] + np.testing.assert_allclose(0.99, evals_result, rtol=1e-2) diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/xgboost/testing/monotone_constraints.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/xgboost/testing/monotone_constraints.py new file mode 100644 index 0000000000000000000000000000000000000000..36db20b48e027ac7303602ea4bab9c0562c941ee --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/xgboost/testing/monotone_constraints.py @@ -0,0 +1,65 @@ +"""Helpers for testing monotone constraints.""" + +from typing import Optional + +import numpy as np + +from .._typing import FeatureNames +from ..core import Booster, DMatrix + + +def is_increasing(v: np.ndarray) -> bool: + """Whether is v increasing.""" + return np.count_nonzero(np.diff(v) < 0.0) == 0 + + +def is_decreasing(v: np.ndarray) -> bool: + """Whether is v decreasing.""" + return np.count_nonzero(np.diff(v) > 0.0) == 0 + + +def is_correctly_constrained( + learner: Booster, feature_names: Optional[FeatureNames] = None +) -> bool: + """Whether the monotone constraint is correctly applied.""" + n = 100 + variable_x = np.linspace(0, 1, n).reshape((n, 1)) + fixed_xs_values = np.linspace(0, 1, n) + + for i in range(n): + fixed_x = fixed_xs_values[i] * np.ones((n, 1)) + monotonically_increasing_x = np.column_stack((variable_x, fixed_x)) + monotonically_increasing_dset = DMatrix( + monotonically_increasing_x, feature_names=feature_names + ) + monotonically_increasing_y = learner.predict(monotonically_increasing_dset) + + monotonically_decreasing_x = np.column_stack((fixed_x, variable_x)) + monotonically_decreasing_dset = DMatrix( + monotonically_decreasing_x, feature_names=feature_names + ) + monotonically_decreasing_y = learner.predict(monotonically_decreasing_dset) + + if not ( + is_increasing(monotonically_increasing_y) + and is_decreasing(monotonically_decreasing_y) + ): + return False + + return True + + +NUMBER_OF_DPOINTS = 1000 +x1_positively_correlated_with_y = np.random.random(size=NUMBER_OF_DPOINTS) +x2_negatively_correlated_with_y = np.random.random(size=NUMBER_OF_DPOINTS) + +x = np.column_stack((x1_positively_correlated_with_y, x2_negatively_correlated_with_y)) +zs = np.random.normal(loc=0.0, scale=0.01, size=NUMBER_OF_DPOINTS) +y = ( + 5 * x1_positively_correlated_with_y + + np.sin(10 * np.pi * x1_positively_correlated_with_y) + - 5 * x2_negatively_correlated_with_y + - np.cos(10 * np.pi * x2_negatively_correlated_with_y) + + zs +) +training_dset = DMatrix(x, label=y) diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/xgboost/testing/multi_target.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/xgboost/testing/multi_target.py new file mode 100644 index 0000000000000000000000000000000000000000..e17218e806e15bf8e3e3b9cc24ecdc49abe277f4 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/xgboost/testing/multi_target.py @@ -0,0 +1,806 @@ +"""Tests for multi-target training.""" + +# pylint: disable=unbalanced-tuple-unpacking +from types import ModuleType +from typing import Any, Callable, Dict, List, Optional, Tuple + +import numpy as np +import pytest +from sklearn.datasets import ( + make_classification, + make_multilabel_classification, + make_regression, +) +from sklearn.metrics.pairwise import cosine_similarity + +import xgboost.testing as tm + +from .._typing import ArrayLike +from ..compat import import_cupy +from ..core import Booster, DMatrix, ExtMemQuantileDMatrix, QuantileDMatrix, build_info +from ..objective import Objective, TreeObjective +from ..sklearn import XGBClassifier +from ..training import train +from .data import IteratorForTest +from .updater import ResetStrategy, train_result +from .utils import Device, assert_allclose, non_increasing + + +def run_multiclass(device: Device, learning_rate: Optional[float]) -> None: + """Use vector leaf for multi-class models.""" + X, y = make_classification( + 128, n_features=12, n_informative=10, n_classes=4, random_state=2025 + ) + clf = XGBClassifier( + debug_synchronize=True, + multi_strategy="multi_output_tree", + callbacks=[ResetStrategy()], + n_estimators=10, + device=device, + learning_rate=learning_rate, + ) + clf.fit(X, y, eval_set=[(X, y)]) + assert clf.objective == "multi:softprob" + assert non_increasing(clf.evals_result()["validation_0"]["mlogloss"]) + if learning_rate is not None and abs(learning_rate - 1.0) < 1e-5: + assert clf.evals_result()["validation_0"]["mlogloss"][-1] < 0.045 + + proba = clf.predict_proba(X) + assert proba.shape == (y.shape[0], 4) + + +def run_multilabel(device: Device, learning_rate: Optional[float]) -> None: + """Use vector leaf for multi-label classification models.""" + X, y = make_multilabel_classification(128, random_state=2025) + clf = XGBClassifier( + debug_synchronize=True, + multi_strategy="multi_output_tree", + callbacks=[ResetStrategy()], + n_estimators=10, + device=device, + learning_rate=learning_rate, + ) + clf.fit(X, y, eval_set=[(X, y)]) + assert clf.objective == "binary:logistic" + assert non_increasing(clf.evals_result()["validation_0"]["logloss"]) + if learning_rate is not None and abs(learning_rate - 1.0) < 1e-5: + assert clf.evals_result()["validation_0"]["logloss"][-1] < 0.065 + + proba = clf.predict_proba(X) + assert proba.shape == y.shape + + +def run_quantile_loss(device: Device, weighted: bool) -> None: + """Check quantile regression for vector leaf.""" + params = { + "objective": "reg:quantileerror", + "device": device, + "quantile_alpha": [0.45, 0.5, 0.55], + "multi_strategy": "multi_output_tree", + } + n_samples = 2048 + X, y = make_regression(n_samples=n_samples, n_features=16, random_state=2026) + + def no_crossing_first_tree(weight: Optional[np.ndarray]) -> None: + """The first tree should not generate quantile crossing given sufficient amount + of samples for quantile interpolation. + + """ + Xy = QuantileDMatrix(X, y, weight=weight) + booster = train(params, Xy, evals=[(Xy, "Train")], num_boost_round=1) + y_predt = booster.predict(Xy) + assert y_predt.shape == (n_samples, 3) + assert (y_predt[:, 0] <= y_predt[:, 1]).all() + assert (y_predt[:, 1] <= y_predt[:, 2]).all() + + if not weighted: + weight = None + else: + # Test with weights. + rng = np.random.default_rng(2026) + weight = rng.uniform(0.0, 1.0, size=n_samples) + + no_crossing_first_tree(weight) + + Xy = QuantileDMatrix(X, y, weight=weight) + evals_result = train_result(params, Xy, num_rounds=10) + assert non_increasing(evals_result["train"]["quantile"]) + + +def run_absolute_error(device: Device) -> None: + """Test mean absolute error with vector leaf.""" + params = { + "objective": "reg:absoluteerror", + "device": device, + "multi_strategy": "multi_output_tree", + } + n_samples = 1024 + X, y = make_regression( + n_samples=n_samples, n_features=16, n_targets=3, random_state=2026 + ) + Xy = QuantileDMatrix(X, y) + evals_result: Dict[str, Dict] = {} + booster = train( + params, + Xy, + evals=[(Xy, "Train")], + verbose_eval=False, + evals_result=evals_result, + num_boost_round=16, + ) + predt = booster.predict(Xy) + # make sure different targets are used + assert np.abs((predt[:, 2] - predt[:, 1]).sum()) > 1000 + assert np.abs((predt[:, 1] - predt[:, 0]).sum()) > 1000 + assert non_increasing(evals_result["Train"]["mae"]) + assert evals_result["Train"]["mae"][-1] < 30.0 + + +def _array_impl(device: Device) -> ModuleType: + if device == "cuda": + nda = import_cupy() + else: + nda = np + return nda + + +class LsObj0(TreeObjective): + """Split grad is the same as value grad.""" + + def __init__(self, device: Device) -> None: + self.device = device + + def __call__( + self, iteration: int, y_pred: ArrayLike, dtrain: DMatrix + ) -> Tuple[ArrayLike, ArrayLike]: + nda = _array_impl(self.device) + + y_true = dtrain.get_label() + grad, hess = tm.ls_obj(y_true, y_pred, None) + return nda.array(grad), nda.array(hess) + + def split_grad( + self, iteration: int, grad: ArrayLike, hess: ArrayLike + ) -> Tuple[ArrayLike, ArrayLike]: + nda = _array_impl(self.device) + return nda.array(grad), nda.array(hess) + + +class LsObj1(Objective): + """No split grad.""" + + def __init__(self, device: Device) -> None: + self.device = device + + def __call__( + self, iteration: int, y_pred: ArrayLike, dtrain: DMatrix + ) -> Tuple[ArrayLike, ArrayLike]: + nda = _array_impl(self.device) + + y_true = dtrain.get_label() + grad, hess = tm.ls_obj(y_true, y_pred, None) + return nda.array(grad), nda.array(hess) + + +# Use mean gradient, should still converge. +class LsObj2(LsObj0): + """Use mean as split grad.""" + + def __init__(self, device: Device, check_used: bool): + self._chk = check_used + super().__init__(device=device) + + def split_grad( + self, iteration: int, grad: ArrayLike, hess: ArrayLike + ) -> Tuple[np.ndarray, np.ndarray]: + nda = _array_impl(self.device) + + if self._chk: + assert False + sgrad = nda.mean(grad, axis=1) + shess = nda.mean(hess, axis=1) + return sgrad, shess + + +def run_reduced_grad(device: Device) -> None: + """Basic test for using reduced gradient for tree splits.""" + X, y = make_regression( + n_samples=1024, n_features=16, random_state=1994, n_targets=5 + ) + Xy = QuantileDMatrix(X, y) + + def run_test( + obj: Optional[Objective], base_score: Optional[list[float]] = None + ) -> Booster: + evals_result: Dict[str, Dict] = {} + booster = train( + { + "debug_synchronize": True, + "device": device, + "multi_strategy": "multi_output_tree", + "learning_rate": 1, + "base_score": base_score, + }, + Xy, + evals=[(Xy, "Train")], + obj=obj, + num_boost_round=8, + evals_result=evals_result, + ) + assert non_increasing(evals_result["Train"]["rmse"]) + return booster + + booster_0 = run_test(LsObj0(device)) + booster_1 = run_test(LsObj1(device)) + np.testing.assert_allclose( + booster_0.inplace_predict(X), booster_1.inplace_predict(X) + ) + + booster_2 = run_test(LsObj0(device), [0.5] * y.shape[1]) + booster_3 = run_test(None, [0.5] * y.shape[1]) + np.testing.assert_allclose( + booster_2.inplace_predict(X), booster_3.inplace_predict(X) + ) + + run_test(LsObj2(device, False)) + with pytest.raises(AssertionError): + run_test(LsObj2(device, True)) + + +def run_with_iter(device: Device) -> None: # pylint: disable=too-many-locals + """Test vector leaf with external memory.""" + nda = _array_impl(device) + + n_batches = 4 + n_rounds = 8 + n_targets = 3 + intercept = [0.5] * n_targets + + params = { + "device": device, + "multi_strategy": "multi_output_tree", + "learning_rate": 1.0, + "base_score": intercept, + "debug_synchronize": True, + } + + Xs = [] + ys = [] + for i in range(n_batches): + X_i, y_i = make_regression( + n_samples=4096, n_features=8, random_state=(i + 1), n_targets=n_targets + ) + Xs.append(nda.asarray(X_i)) + ys.append(nda.asarray(y_i)) + it = IteratorForTest(Xs, ys, None, cache="cache", on_host=True) + Xy: DMatrix = ExtMemQuantileDMatrix( + it, cache_host_ratio=1.0 if device == "cuda" else None + ) + + evals_result_0: Dict[str, Dict] = {} + booster_0 = train( + params, + Xy, + num_boost_round=n_rounds, + evals=[(Xy, "Train")], + evals_result=evals_result_0, + ) + + it = IteratorForTest(Xs, ys, None, cache=None) + Xy = QuantileDMatrix(it) + evals_result_1: Dict[str, Dict] = {} + booster_1 = train( + params, + Xy, + num_boost_round=n_rounds, + evals=[(Xy, "Train")], + evals_result=evals_result_1, + ) + np.testing.assert_allclose( + evals_result_0["Train"]["rmse"], evals_result_1["Train"]["rmse"] + ) + assert non_increasing(evals_result_0["Train"]["rmse"]) + X, _, _ = it.as_arrays() + assert_allclose(device, booster_0.inplace_predict(X), booster_1.inplace_predict(X)) + + binfo = build_info() + tv = "THRUST_VERSION" + if device == "cuda" and tv in binfo and binfo[tv][0] < 3: + pytest.xfail("CCCL version too old.") + + it = IteratorForTest( + Xs, + ys, + None, + cache="cache", + on_host=True, + min_cache_page_bytes=X.shape[0] // n_batches * X.shape[1], + ) + Xy = ExtMemQuantileDMatrix(it, cache_host_ratio=1.0 if device == "cuda" else None) + + evals_result_2: Dict[str, Dict] = {} + booster_2 = train( + params, + Xy, + evals=[(Xy, "Train")], + obj=LsObj0(device), + num_boost_round=n_rounds, + evals_result=evals_result_2, + ) + np.testing.assert_allclose( + evals_result_0["Train"]["rmse"], evals_result_2["Train"]["rmse"] + ) + assert_allclose(device, booster_0.inplace_predict(X), booster_2.inplace_predict(X)) + + +def run_eta(device: Device) -> None: + """Test for learning rate.""" + X, y = make_regression(512, 16, random_state=2025, n_targets=3) + + def run(obj: Optional[Objective]) -> None: + params = { + "device": device, + "multi_strategy": "multi_output_tree", + "learning_rate": 1.0, + "debug_synchronize": True, + "base_score": 0.0, + } + Xy = QuantileDMatrix(X, y) + booster_0 = train(params, Xy, num_boost_round=1, obj=obj) + params["learning_rate"] = 0.1 + booster_1 = train(params, Xy, num_boost_round=1, obj=obj) + params["learning_rate"] = 2.0 + booster_2 = train(params, Xy, num_boost_round=1, obj=obj) + + predt_0 = booster_0.predict(Xy) + predt_1 = booster_1.predict(Xy) + predt_2 = booster_2.predict(Xy) + + np.testing.assert_allclose(predt_0, predt_1 * 10, rtol=1e-6) + np.testing.assert_allclose(predt_0 * 2, predt_2, rtol=1e-6) + + run(None) + run(LsObj0(device)) + + +def run_deterministic(device: Device) -> None: + """Check the vector leaf implementation is deterministic.""" + X, y = make_regression( + n_samples=int(2**16), n_features=64, random_state=1994, n_targets=5 + ) + + def run() -> Booster: + Xy = QuantileDMatrix(X, y) + params = { + "device": device, + "multi_strategy": "multi_output_tree", + "debug_synchronize": True, + } + return train(params, Xy, num_boost_round=16) + + booster_0 = run() + booster_1 = run() + raw_0 = booster_0.save_raw() + raw_1 = booster_1.save_raw() + assert raw_0 == raw_1 + + +def run_column_sampling(device: Device) -> None: + """Test column sampling with feature importance for multi-target trees.""" + n_features = 32 + X, y = make_regression( + n_samples=1024, n_features=n_features, random_state=1994, n_targets=3 + ) + # First half of features have weight, second half has 0 weight (not sampled). + feature_weights = np.zeros(shape=(n_features, 1), dtype=np.float32) + feature_weights[: n_features // 2] = 1.0 / (n_features / 2) + Xy = QuantileDMatrix(X, y, feature_weights=feature_weights) + + params = { + "device": device, + "multi_strategy": "multi_output_tree", + "debug_synchronize": True, + "colsample_bynode": 0.4, + } + booster = train(params, Xy, num_boost_round=16) + + # Test all importance types + for importance_type in ["weight", "gain", "total_gain", "cover", "total_cover"]: + scores: dict = booster.get_score(importance_type=importance_type) + assert len(scores) > 0, f"No scores for {importance_type}" + + # Sampled features (first half) should be in scores + for f in range(0, n_features // 2): + assert f"f{f}" in scores, f"f{f} not in {importance_type} scores" + + # Non-sampled features (second half) should NOT be in scores + for f in range(n_features // 2, n_features): + assert f"f{f}" not in scores + + for score in scores.values(): + assert isinstance(score, float) + assert score >= 0 + + # sklearn Coef + X, y = make_multilabel_classification(random_state=1994) + clf = XGBClassifier( + multi_strategy="multi_output_tree", + importance_type="weight", + device=device, + colsample_bynode=0.2, + ) + clf.fit(X, y, feature_weights=np.arange(0, X.shape[1])) + fi = clf.feature_importances_ + assert fi[0] == 0.0 + assert fi[-1] > fi[1] * 5 + + w = np.polynomial.Polynomial.fit(np.arange(0, X.shape[1]), fi, deg=1) + assert w.coef[1] > 0.03 + + +def run_grow_policy(device: Device, grow_policy: str) -> None: + """Test grow policy (depthwise and lossguide) for vector leaf.""" + X, y = make_regression( + n_samples=1024, n_features=16, random_state=1994, n_targets=3 + ) + Xy = QuantileDMatrix(X, y) + + params = { + "device": device, + "multi_strategy": "multi_output_tree", + "debug_synchronize": True, + "grow_policy": grow_policy, + } + + evals_result = train_result(params, Xy, num_rounds=10) + assert non_increasing(evals_result["train"]["rmse"]) + + +def run_mixed_strategy(device: Device) -> None: + """Test mixed multi_strategy with ResetStrategy callback.""" + X, y = make_classification( + n_samples=1024, n_informative=8, n_classes=3, random_state=1994 + ) + Xy = DMatrix(data=X, label=y) + + booster = train( + { + "num_parallel_tree": 4, + "num_class": 3, + "objective": "multi:softprob", + "multi_strategy": "multi_output_tree", + "device": device, + "debug_synchronize": True, + "base_score": 0, + }, + num_boost_round=16, + dtrain=Xy, + callbacks=[ResetStrategy()], + ) + + # Test model slicing - each boosting round should be iterable + assert len(list(booster)) == 16 + + # Test that sliced predictions sum to full prediction + predt = booster.predict(Xy, output_margin=True) + predt_sum = np.zeros(predt.shape) + for t in booster: + predt_sum += t.predict(Xy, output_margin=True) + np.testing.assert_allclose(predt, predt_sum, atol=1e-5) + + # Test feature importance works with mixed trees + for importance_type in ["weight", "gain", "total_gain", "cover", "total_cover"]: + scores = booster.get_score(importance_type=importance_type) + assert len(scores) > 0 + for score in scores.values(): + assert isinstance(score, float) + assert score >= 0 + + +def run_feature_importance_strategy_compare(device: Device) -> None: + """Different strategies produce similar feature importance ratios.""" + n_features = 16 + X, y = make_classification( + n_samples=2048, + n_features=n_features, + n_informative=10, + n_classes=4, + random_state=1994, + ) + Xy = DMatrix(data=X, label=y) + + base_params: Dict[str, Any] = { + "num_class": 4, + "objective": "multi:softprob", + "device": device, + "debug_synchronize": True, + "max_depth": 5, + } + + # Train models with different strategies + boosters = [ + train( + {**base_params, "multi_strategy": "multi_output_tree"}, + Xy, + num_boost_round=32, + ), + train( + {**base_params, "multi_strategy": "one_output_per_tree"}, + Xy, + num_boost_round=32, + ), + train( + {**base_params, "multi_strategy": "multi_output_tree"}, + Xy, + num_boost_round=32, + callbacks=[ResetStrategy()], + ), + ] + + def get_normalized_importance(booster: Booster, importance_type: str) -> np.ndarray: + """Get feature importance as normalized array (sums to 1).""" + scores = booster.get_score(importance_type=importance_type) + arr = np.array([scores.get(f"f{i}", 0.0) for i in range(n_features)]) + return arr / arr.sum() if arr.sum() > 0 else arr + + for importance_type in ["weight", "gain", "total_gain", "cover", "total_cover"]: + imps = [get_normalized_importance(b, importance_type) for b in boosters] + + # Check that importances are not exactly the same (different strategies) + assert not np.allclose(imps[0], imps[1]) + assert not np.allclose(imps[0], imps[2]) + + # Check that normalized importances are similar (correlated) + # All strategies should have reasonably similar importance patterns + assert cosine_similarity([imps[0]], [imps[1]])[0, 0] > 0.9 + assert cosine_similarity([imps[0]], [imps[2]])[0, 0] > 0.9 + assert cosine_similarity([imps[1]], [imps[2]])[0, 0] > 0.9 + + +# pylint: disable=too-many-arguments, too-many-locals +def _run_regression_objective_test( + device: Device, + objective: str, + metric: str, + X: np.ndarray, + y: np.ndarray, + *, + extra_params: Optional[Dict[str, Any]] = None, + check_pred_positive: bool = False, + check_pred_probability: bool = False, + check_pred_binary: bool = False, + strictly_non_increasing: bool = True, +) -> None: + params: Dict[str, Any] = { + "objective": objective, + "device": device, + "multi_strategy": "multi_output_tree", + } + if extra_params: + params.update(extra_params) + + n_samples = X.shape[0] + n_targets = y.shape[1] if y.ndim > 1 else 1 + + Xy = DMatrix(X, y) + evals_result: Dict[str, Dict] = {} + booster = train( + params, + Xy, + evals=[(Xy, "Train")], + verbose_eval=False, + evals_result=evals_result, + num_boost_round=16, + ) + predt = booster.predict(Xy) + assert predt.shape == (n_samples, n_targets) + + if check_pred_positive: + assert (predt > 0).all() + if check_pred_probability: + assert (predt > 0).all() and (predt < 1).all() + if check_pred_binary: + assert set(np.unique(predt)).issubset({0.0, 1.0}) + + metric_vals = evals_result["Train"][metric] + if strictly_non_increasing: + assert non_increasing(metric_vals) + else: + assert metric_vals[-1] < metric_vals[0] + + +def run_reg_squarederror(device: Device) -> None: + """Test squared error regression with vector leaf.""" + n_samples, n_targets = 1024, 3 + X, y = make_regression( + n_samples=n_samples, n_features=16, n_targets=n_targets, random_state=2026 + ) + _run_regression_objective_test(device, "reg:squarederror", "rmse", X, y) + + +def run_reg_logistic(device: Device) -> None: + """Test logistic regression for probability with vector leaf.""" + n_samples, n_targets = 1024, 3 + rng = np.random.default_rng(2026) + X = rng.standard_normal((n_samples, 16)) + y = rng.uniform(0.0, 1.0, (n_samples, n_targets)) # Labels in [0, 1] + _run_regression_objective_test( + device, "reg:logistic", "rmse", X, y, check_pred_probability=True + ) + + +def run_reg_gamma(device: Device) -> None: + """Test gamma regression with vector leaf.""" + n_samples, n_targets = 1024, 3 + rng = np.random.default_rng(2026) + X = rng.standard_normal((n_samples, 16)) + y = rng.gamma(2.0, 2.0, (n_samples, n_targets)) # Labels must be positive + _run_regression_objective_test( + device, "reg:gamma", "gamma-deviance", X, y, check_pred_positive=True + ) + + +def run_reg_squaredlogerror(device: Device) -> None: + """Test squared log error regression with vector leaf.""" + n_samples, n_targets = 1024, 3 + rng = np.random.default_rng(2026) + X = rng.standard_normal((n_samples, 16)) + y = np.abs(rng.standard_normal((n_samples, n_targets))) + 0.1 # Labels > -1 + _run_regression_objective_test(device, "reg:squaredlogerror", "rmsle", X, y) + + +def run_reg_pseudohubererror(device: Device) -> None: + """Test pseudo huber error regression with vector leaf.""" + n_samples, n_targets = 1024, 3 + X, y = make_regression( + n_samples=n_samples, n_features=16, n_targets=n_targets, random_state=2026 + ) + _run_regression_objective_test( + device, "reg:pseudohubererror", "mphe", X, y, extra_params={"huber_slope": 1.0} + ) + + +def run_binary_logitraw(device: Device) -> None: + """Test binary logitraw with vector leaf (multi-label classification).""" + n_samples = 1024 + X, y = make_multilabel_classification(n_samples, random_state=2026) + _run_regression_objective_test( + device, "binary:logitraw", "logloss", X, y, strictly_non_increasing=False + ) + + +def run_binary_hinge(device: Device) -> None: + """Test binary hinge loss with vector leaf (multi-label classification).""" + n_samples = 1024 + X, y = make_multilabel_classification(n_samples, random_state=2026) + _run_regression_objective_test( + device, + "binary:hinge", + "error", + X, + y, + check_pred_binary=True, + strictly_non_increasing=False, + ) + + +def run_count_poisson(device: Device) -> None: + """Test Poisson regression with vector leaf.""" + n_samples, n_targets = 1024, 3 + rng = np.random.default_rng(2026) + X = rng.standard_normal((n_samples, 16)) + y = rng.poisson(5, (n_samples, n_targets)).astype(np.float32) # Labels >= 0 + _run_regression_objective_test( + device, "count:poisson", "poisson-nloglik", X, y, check_pred_positive=True + ) + + +def run_reg_tweedie(device: Device) -> None: + """Test Tweedie regression with vector leaf.""" + n_samples, n_targets = 1024, 3 + rng = np.random.default_rng(2026) + X = rng.standard_normal((n_samples, 16)) + y = rng.gamma(2.0, 2.0, (n_samples, n_targets)) # Labels >= 0 + _run_regression_objective_test( + device, "reg:tweedie", "tweedie-nloglik@1.5", X, y, check_pred_positive=True + ) + + +def all_reg_objectives() -> List[Callable[[Device], None]]: + """List of obj tests.""" + objs: List[Callable[[Device], None]] = [ + run_reg_squarederror, + run_reg_logistic, + run_reg_gamma, + run_reg_squaredlogerror, + run_reg_pseudohubererror, + run_binary_logitraw, + run_binary_hinge, + run_count_poisson, + run_reg_tweedie, + ] + return objs + + +def _make_subsample_params(device: Device, sampling_method: str) -> dict: + params = { + "device": device, + "tree_method": "hist", + "multi_strategy": "multi_output_tree", + "subsample": 0.5, + "sampling_method": sampling_method, + "max_depth": 6, + "debug_synchronize": True, + "seed": 2026, + } + return params + + +def run_subsample(device: Device, sampling_method: str) -> None: + """Test row subsampling.""" + n_samples = 2048 + X, y = make_regression( + n_samples=n_samples, n_features=16, n_targets=3, random_state=2026 + ) + Xy = QuantileDMatrix(X, y) + + params = _make_subsample_params(device, sampling_method) + + evals_result = train_result(params, Xy, num_rounds=16) + # Training should converge with subsampling + assert non_increasing(evals_result["train"]["rmse"], tolerance=0.01) + + # Test with quantile regression + params = _make_subsample_params(device, sampling_method) + params["objective"] = "reg:quantileerror" + params["quantile_alpha"] = [0.25, 0.5, 0.75] + Xy_single = QuantileDMatrix(X, y[:, 0]) + evals_result_q = train_result(params, Xy_single, num_rounds=16) + assert non_increasing(evals_result_q["train"]["quantile"], tolerance=0.01) + + +def run_gradient_based_sampling_accuracy(device: Device) -> None: + """Test that gradient-based sampling provides better accuracy.""" + n_samples = 4096 + X, y = make_regression( + n_samples=n_samples, n_features=16, n_targets=3, random_state=2026 + ) + Xy = QuantileDMatrix(X, y) + + params_uniform = _make_subsample_params(device, "uniform") + + def run(obj: Callable | None) -> None: + # Train with uniform sampling + evals_uniform: Dict[str, Dict] = {} + train( + params_uniform, + Xy, + num_boost_round=32, + evals=[(Xy, "train")], + obj=obj, + verbose_eval=False, + evals_result=evals_uniform, + ) + + # Train with gradient-based sampling + params_grad = _make_subsample_params(device, "gradient_based") + evals_grad: Dict[str, Dict] = {} + train( + params_grad, + Xy, + num_boost_round=32, + evals=[(Xy, "train")], + obj=obj, + verbose_eval=False, + evals_result=evals_grad, + ) + + uniform_final = evals_uniform["train"]["rmse"][-1] + grad_final = evals_grad["train"]["rmse"][-1] + assert non_increasing(evals_uniform["train"]["rmse"]) + assert non_increasing(evals_grad["train"]["rmse"]) + if obj is None: + assert grad_final < uniform_final + + run(None) + run(LsObj2(device, False)) diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/xgboost/testing/ordinal.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/xgboost/testing/ordinal.py new file mode 100644 index 0000000000000000000000000000000000000000..6629868778f49ab0897467296ea440b0ac7813c6 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/xgboost/testing/ordinal.py @@ -0,0 +1,831 @@ +"""Tests for the ordinal re-coder.""" + +import itertools +import os +import tempfile +from concurrent.futures import ThreadPoolExecutor +from functools import cache as fcache +from typing import Any, Tuple, Type, TypeVar + +import numpy as np +import pytest + +from .._typing import EvalsLog +from ..core import DMatrix, ExtMemQuantileDMatrix, QuantileDMatrix +from ..data import _lazy_load_cudf_is_cat +from ..training import train +from .data import ( + IteratorForTest, + is_pd_cat_dtype, + make_batches, + make_categorical, + memory, +) +from .updater import get_basescore +from .utils import Device, assert_allclose, predictor_equal + + +@fcache +def get_df_impl(device: Device) -> Tuple[Type, Type]: + """Get data frame implementation based on the ]device.""" + if device == "cpu": + import pandas as pd + + Df = pd.DataFrame + Ser = pd.Series + else: + import cudf + + Df = cudf.DataFrame + Ser = cudf.Series + return Df, Ser + + +def asarray(device: Device, data: Any) -> np.ndarray: + """Wrapper to get an array.""" + if device == "cpu": + return np.asarray(data) + import cupy as cp + + return cp.asarray(data) + + +def comp_booster(device: Device, Xy: DMatrix, booster: str) -> None: + """Compare the results from DMatrix and Booster.""" + cats_dm = Xy.get_categories(export_to_arrow=True).to_arrow() + assert cats_dm is not None + + rng = np.random.default_rng(2025) + Xy.set_label(rng.normal(size=Xy.num_row())) + bst = train({"booster": booster, "device": device}, Xy, 1) + cats_bst = bst.get_categories(export_to_arrow=True).to_arrow() + assert cats_bst is not None + assert cats_dm == cats_bst + + +def run_cat_container(device: Device) -> None: + """Basic tests for the container class used by the DMatrix.""" + + def run_dispatch(device: Device, DMatrixT: Type) -> None: + Df, _ = get_df_impl(device) + # Basic test with a single feature + df = Df({"c": ["cdef", "abc"]}, dtype="category") + categories = df.c.cat.categories + + Xy = DMatrixT(df, enable_categorical=True) + assert Xy.feature_names == ["c"] + assert Xy.feature_types == ["c"] + results = Xy.get_categories(export_to_arrow=True).to_arrow() + assert results is not None + results_di = dict(results) + assert len(results_di["c"]) == len(categories) + for i in range(len(results_di["c"])): + assert str(results_di["c"][i]) == str(categories[i]), ( + results_di["c"][i], + categories[i], + ) + + # Test with missing values. + df = Df({"c": ["cdef", None, "abc", "abc"]}, dtype="category") + Xy = DMatrixT(df, enable_categorical=True) + + cats = Xy.get_categories(export_to_arrow=True).to_arrow() + assert cats is not None + cats_id = dict(cats) + ser = cats_id["c"].to_pandas() + assert ser.iloc[0] == "abc" + assert ser.iloc[1] == "cdef" + assert ser.size == 2 + + csr = Xy.get_data() + assert csr.data.size == 3 + assert_allclose(device, csr.data, np.array([1.0, 0.0, 0.0])) + assert_allclose(device, csr.indptr, np.array([0, 1, 1, 2, 3])) + assert_allclose(device, csr.indices, np.array([0, 0, 0])) + + comp_booster(device, Xy, "gbtree") + comp_booster(device, Xy, "dart") + + # Test with explicit null-terminated strings. + df = Df({"c": ["cdef", None, "abc", "abc\0"]}, dtype="category") + Xy = DMatrixT(df, enable_categorical=True) + + comp_booster(device, Xy, "gbtree") + comp_booster(device, Xy, "dart") + + with pytest.raises(ValueError, match="export_to_arrow"): + Xy.get_categories(export_to_arrow=False).to_arrow() + + for dm in (DMatrix, QuantileDMatrix): + run_dispatch(device, dm) + + +# pylint: disable=too-many-statements +def run_cat_container_mixed(device: Device) -> None: + """Run checks with mixed types.""" + import pandas as pd + + try: + is_cudf_cat = _lazy_load_cudf_is_cat() + except ImportError: + + def is_cudf_cat(_: Any) -> bool: + return False + + n_samples = int(2**10) + + def check(Xy: DMatrix, X: pd.DataFrame) -> None: + cats = Xy.get_categories(export_to_arrow=True).to_arrow() + assert cats is not None + cats_di = dict(cats) + + for fname in X.columns: + if is_pd_cat_dtype(X[fname].dtype) or is_cudf_cat(X[fname].dtype): + vf = cats_di[fname] + assert vf is not None + aw_list = sorted(vf.to_pylist()) + if is_cudf_cat(X[fname].dtype): + pd_list: list = X[fname].unique().to_arrow().to_pylist() + else: + pd_list = X[fname].unique().tolist() + if np.nan in pd_list: # pandas + pd_list.remove(np.nan) + if None in pd_list: # cudf + pd_list.remove(None) + pd_list = sorted(pd_list) + assert aw_list == pd_list + else: + assert cats_di[fname] is None + + if not hasattr(Xy, "ref"): # not quantile DMatrix. + assert not isinstance(Xy, QuantileDMatrix) + with tempfile.TemporaryDirectory() as tmpdir: + fname = os.path.join(tmpdir, "DMatrix.binary") + Xy.save_binary(fname) + + Xy_1 = DMatrix(fname) + cats_1 = Xy_1.get_categories(export_to_arrow=True).to_arrow() + assert cats_1 is not None + cats_1_di = dict(cats_1) + + for k, v_0 in cats_di.items(): + v_1 = cats_1_di[k] + if v_0 is None: + assert v_1 is None + else: + assert v_1 is not None + assert v_0.to_pylist() == v_1.to_pylist() + + comp_booster(device, Xy, "gbtree") + comp_booster(device, Xy, "dart") + + def run_dispatch(DMatrixT: Type) -> None: + # full str type + X, y = make_categorical( + n_samples, 16, 7, onehot=False, cat_dtype=np.str_, device=device + ) + Xy = DMatrixT(X, y, enable_categorical=True) + check(Xy, X) + + # str type, mixed with numerical features + X, y = make_categorical( + n_samples, + 16, + 7, + onehot=False, + cat_ratio=0.5, + cat_dtype=np.str_, + device=device, + ) + Xy = DMatrixT(X, y, enable_categorical=True) + check(Xy, X) + + # str type, mixed with numerical features and missing values + X, y = make_categorical( + n_samples, + 16, + 7, + onehot=False, + cat_ratio=0.5, + sparsity=0.5, + cat_dtype=np.str_, + device=device, + ) + Xy = DMatrixT(X, y, enable_categorical=True) + check(Xy, X) + + # int type + X, y = make_categorical( + n_samples, 16, 7, onehot=False, cat_dtype=np.int64, device=device + ) + Xy = DMatrixT(X, y, enable_categorical=True) + check(Xy, X) + + # int type, mixed with numerical features + X, y = make_categorical( + n_samples, + 16, + 7, + onehot=False, + cat_ratio=0.5, + cat_dtype=np.int64, + device=device, + ) + Xy = DMatrixT(X, y, enable_categorical=True) + check(Xy, X) + + # int type, mixed with numerical features and missing values + X, y = make_categorical( + n_samples, + 16, + 7, + onehot=False, + cat_ratio=0.5, + sparsity=0.5, + cat_dtype=np.int64, + device=device, + ) + Xy = DMatrixT(X, y, enable_categorical=True) + check(Xy, X) + + for dm in (DMatrix, QuantileDMatrix): + run_dispatch(dm) + + # No category + batches = make_batches( + n_samples_per_batch=128, n_features=4, n_batches=1, use_cupy=device == "cuda" + ) + X, y, w = map(lambda x: x[0], batches) + + for DMatrixT in (DMatrix, QuantileDMatrix): + Xy = DMatrixT(X, y, weight=w) + all_num = Xy.get_categories(export_to_arrow=True).to_arrow() + assert all_num is not None + for _, v in all_num: + assert v is None + + with pytest.raises(ValueError, match="export_to_arrow"): + Xy.get_categories(export_to_arrow=False).to_arrow() + + +def run_cat_container_iter(device: Device) -> None: + """Test the categories container for iterator-based inputs.""" + n_batches = 4 + n_features = 8 + n_samples_per_batch = 64 + n_cats = 5 + + X, y = [], [] + for _ in range(n_batches): + X_i, y_i = make_categorical( + n_samples_per_batch, + n_features, + n_cats, + onehot=False, + sparsity=0.5, + cat_dtype=np.int64, + device=device, + ) + X.append(X_i) + y.append(y_i) + + it = IteratorForTest(X, y, None, cache="cache", on_host=device == "cuda") + + Xy = ExtMemQuantileDMatrix(it, enable_categorical=True) + cats = Xy.get_categories(export_to_arrow=True).to_arrow() + assert cats is not None and len(cats) == n_features + cats_di = dict(cats) + for _, v in cats_di.items(): + assert v is not None + assert v.null_count == 0 + assert len(v) == n_cats + + +def _basic_example(device: Device) -> Tuple[Any, Any, np.ndarray, np.ndarray]: + Df, _ = get_df_impl(device) + + enc = Df({"c": ["cdef", "abc", "def"]}, dtype="category") + codes = enc.c.cat.codes # 1, 0, 2 + assert_allclose(device, asarray(device, codes), np.array([1, 0, 2])) + encoded = np.array([codes.iloc[2], codes.iloc[1]]) # def, abc + np.testing.assert_allclose(encoded, [2, 0]) + + reenc = Df({"c": ["def", "abc"]}, dtype="category") # same as `encoded` + codes = reenc.c.cat.codes + assert_allclose(device, codes, np.array([1, 0])) + + y = np.array([0, 1, 2]) + + return enc, reenc, encoded, y + + +def run_basic_predict(DMatrixT: Type, device: Device, tdevice: Device) -> None: + """Enable tests with mixed devices.""" + enc, reenc, encoded, y = _basic_example(device) + + Xy = DMatrixT(enc, y, enable_categorical=True) + booster = train({"device": tdevice}, Xy, num_boost_round=4) + + predt0 = booster.inplace_predict(reenc) + predt1 = booster.inplace_predict(encoded) + assert_allclose(device, predt0, predt1) + + fmat = DMatrixT(reenc, enable_categorical=True) + predt2 = booster.predict(fmat) + assert_allclose(device, predt0, predt2) + + +def run_cat_predict(device: Device) -> None: + """Basic tests for re-coding during prediction.""" + Df, _ = get_df_impl(device) + + for dm in (DMatrix, QuantileDMatrix): + run_basic_predict(dm, device, device) + + def run_mixed(DMatrixT: Type) -> None: + df = Df({"b": [2, 1, 3], "c": ["cdef", "abc", "def"]}, dtype="category") + y = np.array([0, 1, 2]) + + # used with the next df + b_codes = df.b.cat.codes + assert_allclose(device, asarray(device, b_codes), np.array([1, 0, 2])) + # pick codes of 3, 1 + b_encoded = np.array([b_codes.iloc[2], b_codes.iloc[1]]) + + c_codes = df.c.cat.codes + assert_allclose(device, asarray(device, c_codes), np.array([1, 0, 2])) + # pick codes of "def", "abc" + c_encoded = np.array([c_codes.iloc[2], c_codes.iloc[1]]) + encoded = np.stack([b_encoded, c_encoded], axis=1) + + Xy = DMatrixT(df, y, enable_categorical=True) + booster = train({"device": device}, Xy, num_boost_round=4) + + df = Df({"b": [3, 1], "c": ["def", "abc"]}, dtype="category") + predt0 = booster.inplace_predict(df) + predt1 = booster.inplace_predict(encoded) + assert_allclose(device, predt0, predt1) + + fmat = DMatrixT(df, enable_categorical=True) + predt2 = booster.predict(fmat) + assert_allclose(device, predt0, predt2) + + for dm in (DMatrix, QuantileDMatrix): + run_mixed(dm) + + +def run_cat_invalid(device: Device) -> None: + """Basic tests for invalid inputs.""" + Df, Ser = get_df_impl(device) + y = np.array([0, 1, 2]) + + def run_invalid(DMatrixT: Type) -> None: + df = Df({"b": [2, 1, 3], "c": ["cdef", "abc", "def"]}, dtype="category") + + Xy = DMatrixT(df, y, enable_categorical=True) + booster = train({"device": device}, Xy, num_boost_round=4) + df["b"] = df["b"].astype(np.int64) + with pytest.raises(ValueError, match="The data type doesn't match"): + booster.inplace_predict(df) + + Xy = DMatrixT(df, y, enable_categorical=True) + with pytest.raises(ValueError, match="The data type doesn't match"): + booster.predict(Xy) + + df = Df( + {"b": [2, 1, 3, 4], "c": ["cdef", "abc", "def", "bbc"]}, dtype="category" + ) + with pytest.raises(ValueError, match="Found a category not in the training"): + booster.inplace_predict(df) + + for dm in (DMatrix, QuantileDMatrix): + run_invalid(dm) + + df = Df({"b": [2, 1, 3], "c": ["cdef", "abc", "def"]}, dtype="category") + Xy = DMatrix(df, y, enable_categorical=True) + booster = train({"device": device}, Xy, num_boost_round=4) + df["c"] = Ser(asarray(device, [0, 1, 1]), dtype="category") + + msg = "index type must match between the training and test set" + + with pytest.raises(ValueError, match=msg): + booster.inplace_predict(df) + + with pytest.raises(ValueError, match=msg): + DMatrix(df, enable_categorical=True, feature_types=booster.get_categories()) + + with pytest.raises(ValueError, match=msg): + QuantileDMatrix( + df, enable_categorical=True, feature_types=booster.get_categories() + ) + + +def run_cat_thread_safety(device: Device) -> None: + """Basic tests for thread safety.""" + X, y = make_categorical(2048, 16, 112, onehot=False, cat_ratio=0.5, device=device) + Xy = QuantileDMatrix(X, y, enable_categorical=True) + booster = train({"device": device}, Xy, num_boost_round=10) + + def run_thread_safety(DMatrixT: Type) -> bool: + Xy = DMatrixT(X, enable_categorical=True) + predt0 = booster.predict(Xy) + predt1 = booster.inplace_predict(X) + assert_allclose(device, predt0, predt1) + return True + + futures = [] + n_cpus = os.cpu_count() + assert n_cpus is not None + for dm in (DMatrix, QuantileDMatrix): + with ThreadPoolExecutor(max_workers=max(n_cpus, 10)) as e: + for _ in range(32): + fut = e.submit(run_thread_safety, dm) + futures.append(fut) + + for f in futures: + assert f.result() + + +U = TypeVar("U", DMatrix, QuantileDMatrix) + + +def _make_dm(DMatrixT: Type[U], ref: DMatrix, *args: Any, **kwargs: Any) -> U: + if DMatrixT is QuantileDMatrix: + return DMatrixT(*args, ref=ref, enable_categorical=True, **kwargs) + return DMatrixT(*args, enable_categorical=True, **kwargs) + + +def _run_predt( + device: Device, + DMatrixT: Type, + pred_contribs: bool, + pred_interactions: bool, + pred_leaf: bool, +) -> None: + enc, reenc, encoded, y = _basic_example(device) + + Xy = DMatrixT(enc, y, enable_categorical=True) + booster = train({"device": device}, Xy, num_boost_round=4) + + predt_0 = booster.predict( + _make_dm(DMatrixT, ref=Xy, data=reenc), + pred_contribs=pred_contribs, + pred_interactions=pred_interactions, + pred_leaf=pred_leaf, + ) + predt_1 = booster.predict( + _make_dm(DMatrixT, ref=Xy, data=encoded.reshape(2, 1), feature_names=["c"]), + pred_contribs=pred_contribs, + pred_interactions=pred_interactions, + pred_leaf=pred_leaf, + ) + assert_allclose(device, predt_0, predt_1) + + +def run_cat_shap(device: Device) -> None: + """Basic tests for SHAP values.""" + + for dm in (DMatrix, QuantileDMatrix): + _run_predt( + device, dm, pred_contribs=True, pred_interactions=False, pred_leaf=False + ) + + for dm in (DMatrix, QuantileDMatrix): + _run_predt( + device, dm, pred_contribs=False, pred_interactions=True, pred_leaf=False + ) + + +def run_cat_leaf(device: Device) -> None: + """Basic tests for leaf prediction.""" + # QuantileDMatrix is not supported by leaf. + _run_predt( + device, DMatrix, pred_contribs=False, pred_interactions=False, pred_leaf=True + ) + + +# pylint: disable=too-many-locals +@memory.cache +def make_recoded(device: Device, *, n_features: int = 4096) -> Tuple: + """Synthesize a test dataset with changed encoding.""" + Df, _ = get_df_impl(device) + + import pandas as pd + + # Test large column numbers. XGBoost makes some specializations for slim datasets, + # make sure we cover all the cases. + n_samples = 1024 + + # Same between old and new, with 0 ("a") and 1 ("b") exchanged their position. + old_cats = ["a", "b", "c", "d"] + new_cats = ["b", "a", "c", "d"] + mapping = {0: 1, 1: 0} + + rng = np.random.default_rng(2025) + + col_numeric = rng.uniform(0, 1, size=(n_samples, n_features // 2)) + col_categorical = rng.integers( + low=0, high=4, size=(n_samples, n_features // 2), dtype=np.int32 + ) + + df = {} # avoid fragmentation warning from pandas + for c in range(n_features): + if c % 2 == 0: + col = col_numeric[:, c // 2] + else: + codes = col_categorical[:, c // 2] + col = pd.Categorical.from_codes( + categories=old_cats, + codes=codes, + ) + df[f"f{c}"] = col + + enc = Df(df) + y = rng.normal(size=n_samples) + + reenc = enc.copy() + for c in range(n_features): + if c % 2 == 0: + continue + + name = f"f{c}" + codes_ser = reenc[name].cat.codes + if hasattr(codes_ser, "to_pandas"): # cudf + codes_ser = codes_ser.to_pandas() + new_codes = codes_ser.replace(mapping) + reenc[name] = pd.Categorical.from_codes(categories=new_cats, codes=new_codes) + reenc = Df(reenc) + assert (reenc.iloc[:, 1].cat.codes != enc.iloc[:, 1].cat.codes).any() + return enc, reenc, y, col_numeric, col_categorical + + +def run_specified_cat( # pylint: disable=too-many-locals + device: Device, +) -> None: + """Run with manually specified category encoding.""" + import pandas as pd + + # Same between old and new, with 0 ("a") and 1 ("b") exchanged their position. + old_cats = ["a", "b", "c", "d"] + new_cats = ["b", "a", "c", "d"] + + col0 = np.arange(0, 9) + col1 = pd.Categorical.from_codes( + # b, b, c, d, a, c, c, d, a + categories=old_cats, + codes=[1, 1, 2, 3, 0, 2, 2, 3, 0], + ) + df = pd.DataFrame({"f0": col0, "f1": col1}) + Df, _ = get_df_impl(device) + df = Df(df) + rng = np.random.default_rng(2025) + y = rng.uniform(size=df.shape[0]) + + for dm in (DMatrix, QuantileDMatrix): + Xy = dm(df, y, enable_categorical=True) + booster = train({"device": device}, Xy) + predt0 = booster.predict(Xy) + predt1 = booster.inplace_predict(df) + assert_allclose(device, predt0, predt1) + + col1 = pd.Categorical.from_codes( + # b, b, c, d, a, c, c, d, a + categories=new_cats, + codes=[0, 0, 2, 3, 1, 2, 2, 3, 1], + ) + df1 = Df({"f0": col0, "f1": col1}) + predt2 = booster.inplace_predict(df1) + assert_allclose(device, predt0, predt2) + + enc, reenc, y, col_numeric, col_categorical = make_recoded(device) + + Xy = DMatrix(enc, y, enable_categorical=True) + booster = train({"device": device}, Xy) + + predt0 = booster.predict(Xy) + predt1 = booster.inplace_predict(enc) + assert_allclose(device, predt0, predt1) + + Xy = DMatrix(reenc, y, enable_categorical=True) + predt2 = booster.predict(Xy) + assert_allclose(device, predt0, predt2) + + array = np.empty(shape=(reenc.shape[0], reenc.shape[1])) + + array[:, enc.dtypes == "category"] = col_categorical + array[:, enc.dtypes != "category"] = col_numeric + + if device == "cuda": + import cupy as cp + + array = cp.array(array) + + predt3 = booster.inplace_predict(array) + assert_allclose(device, predt0, predt3) + + +def run_validation(device: Device) -> None: + """Check the validation dataset is using the correct encoding.""" + enc, reenc, y, _, _ = make_recoded(device) + + Xy = DMatrix(enc, y, enable_categorical=True) + Xy_valid = DMatrix(reenc, y, enable_categorical=True) + + evals_result: EvalsLog = {} + train( + {"device": device}, + Xy, + evals=[(Xy, "Train"), (Xy_valid, "Valid")], + evals_result=evals_result, + ) + + # Evaluation dataset should have the exact same performance as the training dataset. + assert_allclose( + device, evals_result["Train"]["rmse"], evals_result["Valid"]["rmse"] + ) + + +def run_recode_dmatrix(device: Device) -> None: + """Test re-coding inpput for DMatrix.""" + import pandas as pd + + Df, _ = get_df_impl(device) + + # String index + old_cats = ["a", "b", "c", "d"] + new_cats = ["b", "a", "c", "d"] + + col0 = np.arange(0, 9) + col1 = pd.Categorical.from_codes( + # b, b, c, d, a, c, c, d, a + categories=old_cats, + codes=[1, 1, 2, 3, 0, 2, 2, 3, 0], + ) + df = Df({"f0": col0, "f1": col1}) + + Xy = DMatrix(df, enable_categorical=True) + cats_0 = Xy.get_categories(export_to_arrow=True) + assert Xy.feature_types == ["int", "c"] + + col1 = pd.Categorical.from_codes( + # b, b, c, d, a, c, c, d, a + categories=new_cats, + codes=[0, 0, 2, 3, 1, 2, 2, 3, 1], + ) + df = Df({"f0": col0, "f1": col1}) + Xy = DMatrix(df, enable_categorical=True, feature_types=cats_0) + # feature_types is still correct + assert Xy.feature_names == ["f0", "f1"] + assert Xy.feature_types == ["int", "c"] + cats_1 = Xy.get_categories(export_to_arrow=True) + assert cats_0.to_arrow() == cats_1.to_arrow() + + # Numeric index + col0 = pd.Categorical.from_codes( + categories=[5, 6, 7, 8], + codes=[0, 0, 2, 3, 1, 2, 2, 3, 1], + ) + Df, _ = get_df_impl(device) + df = Df({"cat": col0}) + for DMatrixT in (DMatrix, QuantileDMatrix): + Xy = DMatrixT(df, enable_categorical=True) + cats_0 = Xy.get_categories(export_to_arrow=True) + assert cats_0 is not None + + Xy = DMatrixT(df, enable_categorical=True, feature_types=cats_0) + cats_1 = Xy.get_categories(export_to_arrow=True) + assert cats_1 is not None + + assert cats_0.to_arrow() == cats_1.to_arrow() + + # Recode + for DMatrixT in (DMatrix, QuantileDMatrix): + enc, reenc, y, _, _ = make_recoded(device) + Xy_0 = DMatrixT(enc, y, enable_categorical=True) + cats_0 = Xy_0.get_categories(export_to_arrow=True) + + assert cats_0 is not None + + Xy_1 = DMatrixT(reenc, y, feature_types=cats_0, enable_categorical=True) + cats_1 = Xy_1.get_categories(export_to_arrow=True) + assert cats_1 is not None + + assert cats_0.to_arrow() == cats_1.to_arrow() + assert predictor_equal(Xy_0, Xy_1) + + +def run_training_continuation(device: Device) -> None: + """Test re-coding for training continuation.""" + enc, reenc, y, _, _ = make_recoded(device) + + def check(Xy_0: DMatrix, Xy_1: DMatrix) -> None: + params = {"device": device} + + r = 2 + evals_result_0: EvalsLog = {} + booster_0 = train( + params, + Xy_0, + evals=[(Xy_1, "Valid")], + num_boost_round=r, + evals_result=evals_result_0, + ) + evals_result_1: EvalsLog = {} + booster_1 = train( + params, + Xy_1, + evals=[(Xy_1, "Valid")], + xgb_model=booster_0, + num_boost_round=r, + evals_result=evals_result_1, + ) + assert get_basescore(booster_0) == get_basescore(booster_1) + + evals_result_2: EvalsLog = {} + booster_2 = train( + params, + Xy_0, + evals=[(Xy_1, "Valid")], + num_boost_round=r * 2, + evals_result=evals_result_2, + ) + # Check evaluation results + eval_concat = evals_result_0["Valid"]["rmse"] + evals_result_1["Valid"]["rmse"] + eval_full = evals_result_2["Valid"]["rmse"] + np.testing.assert_allclose(eval_full, eval_concat) + + # Test inference + for a, b in itertools.product([enc, reenc], [enc, reenc]): + predt_0 = booster_1.inplace_predict(a) + predt_1 = booster_2.inplace_predict(b) + assert_allclose(device, predt_0, predt_1, rtol=1e-5) + + # With DMatrix + for a, b in itertools.product([Xy_0, Xy_1], [Xy_0, Xy_1]): + predt_0 = booster_1.predict(a) + predt_1 = booster_2.predict(b) + assert_allclose(device, predt_0, predt_1, rtol=1e-5) + + for Train, Valid in itertools.product( + [DMatrix, QuantileDMatrix], [DMatrix, QuantileDMatrix] + ): + Xy_0 = Train(enc, y, enable_categorical=True) + if Valid is QuantileDMatrix: + Xy_1 = Valid( + reenc, + y, + enable_categorical=True, + feature_types=Xy_0.get_categories(), + ref=Xy_0, + ) + else: + Xy_1 = Valid( + reenc, y, enable_categorical=True, feature_types=Xy_0.get_categories() + ) + check(Xy_0, Xy_1) + + +def run_update(device: Device) -> None: + """Test with individual updaters.""" + enc, reenc, y, _, _ = make_recoded(device) + Xy = DMatrix(enc, y, enable_categorical=True) + booster_0 = train({"device": device}, Xy, num_boost_round=4) + model_0 = booster_0.save_raw() + cats_0 = booster_0.get_categories() + + Xy_1 = DMatrix(reenc, y, feature_types=cats_0, enable_categorical=True) + + booster_1 = train( + { + "device": device, + "updater": "prune", + "process_type": "update", + }, + Xy_1, + num_boost_round=4, + xgb_model=booster_0, + ) + model_1 = booster_1.save_raw() + + assert model_0 == model_1 # also compares the cat container inside + + +def run_recode_dmatrix_predict(device: Device) -> None: + """Run prediction with re-coded DMatrix.""" + enc, reenc, y, _, _ = make_recoded(device) + + for DMatrixT in (DMatrix, QuantileDMatrix): + Xy = DMatrix(enc, y, enable_categorical=True) + booster = train({"device": device}, Xy, num_boost_round=4) + cats_0 = booster.get_categories() + + Xy_1 = _make_dm(DMatrixT, Xy, reenc, y, feature_types=cats_0) + Xy_2 = _make_dm(DMatrixT, Xy, reenc, y) + + predt_0 = booster.predict(Xy) + predt_1 = booster.predict(Xy_1) + predt_2 = booster.predict(Xy_2) + predt_3 = booster.inplace_predict(enc) + + for predt in (predt_1, predt_2, predt_3): + assert_allclose(device, predt_0, predt) diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/xgboost/testing/params.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/xgboost/testing/params.py new file mode 100644 index 0000000000000000000000000000000000000000..6b47f4a01a0c50b7c1a38cdf6a0e15cb350132e2 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/xgboost/testing/params.py @@ -0,0 +1,87 @@ +"""Strategies for updater tests.""" + +from typing import cast + +import pytest + +strategies = pytest.importorskip("hypothesis.strategies") + + +exact_parameter_strategy = strategies.fixed_dictionaries( + { + "nthread": strategies.integers(1, 4), + "max_depth": strategies.integers(1, 11), + "min_child_weight": strategies.floats(0.5, 2.0), + "alpha": strategies.floats(1e-5, 2.0), + "lambda": strategies.floats(1e-5, 2.0), + "eta": strategies.floats(0.01, 0.5), + "gamma": strategies.floats(1e-5, 2.0), + "seed": strategies.integers(0, 10), + # We cannot enable subsampling as the training loss can increase + # 'subsample': strategies.floats(0.5, 1.0), + "colsample_bytree": strategies.floats(0.5, 1.0), + "colsample_bylevel": strategies.floats(0.5, 1.0), + } +) + +hist_parameter_strategy = strategies.fixed_dictionaries( + { + "max_depth": strategies.integers(1, 11), + "max_leaves": strategies.integers(0, 1024), + "max_bin": strategies.integers(2, 512), + "grow_policy": strategies.sampled_from(["lossguide", "depthwise"]), + "min_child_weight": strategies.floats(0.5, 2.0), + # We cannot enable subsampling as the training loss can increase + # 'subsample': strategies.floats(0.5, 1.0), + "colsample_bytree": strategies.floats(0.5, 1.0), + "colsample_bylevel": strategies.floats(0.5, 1.0), + } +).filter( + lambda x: (cast(int, x["max_depth"]) > 0 or cast(int, x["max_leaves"]) > 0) + and (cast(int, x["max_depth"]) > 0 or x["grow_policy"] == "lossguide") +) + +hist_cache_strategy = strategies.fixed_dictionaries( + {"max_cached_hist_node": strategies.sampled_from([1, 4, 1024, 2**31])} +) + +hist_multi_parameter_strategy = strategies.fixed_dictionaries( + { + "max_depth": strategies.integers(1, 11), + "max_leaves": strategies.integers(0, 1024), + "max_bin": strategies.integers(2, 512), + "multi_strategy": strategies.sampled_from( + ["multi_output_tree", "one_output_per_tree"] + ), + "grow_policy": strategies.sampled_from(["lossguide", "depthwise"]), + "min_child_weight": strategies.floats(0.5, 2.0), + # We cannot enable subsampling as the training loss can increase + # 'subsample': strategies.floats(0.5, 1.0), + "colsample_bytree": strategies.floats(0.5, 1.0), + "colsample_bylevel": strategies.floats(0.5, 1.0), + } +).filter( + lambda x: (cast(int, x["max_depth"]) > 0 or cast(int, x["max_leaves"]) > 0) + and (cast(int, x["max_depth"]) > 0 or x["grow_policy"] == "lossguide") +) + +cat_parameter_strategy = strategies.fixed_dictionaries( + { + "max_cat_to_onehot": strategies.integers(1, 128), + "max_cat_threshold": strategies.integers(1, 128), + } +) + +lambdarank_parameter_strategy = strategies.fixed_dictionaries( + { + "lambdarank_unbiased": strategies.sampled_from([True, False]), + "lambdarank_pair_method": strategies.sampled_from(["topk", "mean"]), + "lambdarank_num_pair_per_sample": strategies.integers(1, 8), + "lambdarank_bias_norm": strategies.floats(0.5, 2.0), + "objective": strategies.sampled_from( + ["rank:ndcg", "rank:map", "rank:pairwise"] + ), + } +).filter( + lambda x: not (x["lambdarank_unbiased"] and x["lambdarank_pair_method"] == "mean") +) diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/xgboost/testing/parse_tree.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/xgboost/testing/parse_tree.py new file mode 100644 index 0000000000000000000000000000000000000000..15935fd512c81c81fdbf062701b47f4ab63f55f7 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/xgboost/testing/parse_tree.py @@ -0,0 +1,32 @@ +"""Tests for parsing trees.""" + +import pytest + +from ..core import DMatrix +from ..sklearn import XGBRegressor +from ..training import train +from .data import make_categorical +from .utils import Device + + +def run_tree_to_df_categorical(tree_method: str, device: Device) -> None: + """Tests tree_to_df with categorical features.""" + X, y = make_categorical(100, 10, 31, onehot=False) + Xy = DMatrix(X, y, enable_categorical=True) + booster = train( + {"tree_method": tree_method, "device": device}, Xy, num_boost_round=10 + ) + df = booster.trees_to_dataframe() + for _, x in df.iterrows(): + if x["Feature"] != "Leaf": + assert len(x["Category"]) >= 1 + + +def run_split_value_histograms(tree_method: str, device: Device) -> None: + """Tests split_value_histograms with categorical features.""" + X, y = make_categorical(1000, 10, 13, onehot=False) + reg = XGBRegressor(tree_method=tree_method, enable_categorical=True, device=device) + reg.fit(X, y) + + with pytest.raises(ValueError, match="doesn't"): + reg.get_booster().get_split_value_histogram("3", bins=5) diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/xgboost/testing/plotting.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/xgboost/testing/plotting.py new file mode 100644 index 0000000000000000000000000000000000000000..9966cf2c6c92df0939ad22ce9dde0e7e157a2503 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/xgboost/testing/plotting.py @@ -0,0 +1,29 @@ +"""Test plotting functions for XGBoost.""" + +import json + +from graphviz import Source +from matplotlib.axes import Axes + +from ..plotting import plot_tree, to_graphviz +from ..sklearn import XGBRegressor +from .data import make_categorical +from .utils import Device + + +def run_categorical(tree_method: str, device: Device) -> None: + """Tests plotting functions for categorical features.""" + X, y = make_categorical(1000, 31, 19, onehot=False) + reg = XGBRegressor( + enable_categorical=True, n_estimators=10, tree_method=tree_method, device=device + ) + reg.fit(X, y) + trees = reg.get_booster().get_dump(dump_format="json") + for tree in trees: + j_tree = json.loads(tree) + assert "leaf" in j_tree.keys() or isinstance(j_tree["split_condition"], list) + + graph = to_graphviz(reg, tree_idx=len(j_tree) - 1) + assert isinstance(graph, Source) + ax = plot_tree(reg, tree_idx=len(j_tree) - 1) + assert isinstance(ax, Axes) diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/xgboost/testing/predict.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/xgboost/testing/predict.py new file mode 100644 index 0000000000000000000000000000000000000000..9f2d42aeed039400adc2ab65d7beeb6fe84e049b --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/xgboost/testing/predict.py @@ -0,0 +1,96 @@ +"""Tests for inference.""" + +from typing import Type + +import numpy as np +from scipy.special import logit # pylint: disable=no-name-in-module + +from ..core import DMatrix +from ..training import train +from .shared import validate_leaf_output +from .updater import get_basescore +from .utils import Device + + +# pylint: disable=too-many-locals +def run_predict_leaf(device: Device, DMatrixT: Type[DMatrix]) -> np.ndarray: + """Run tests for leaf index prediction.""" + rows = 100 + cols = 4 + classes = 5 + num_parallel_tree = 4 + num_boost_round = 10 + rng = np.random.RandomState(1994) + X = rng.randn(rows, cols) + y = rng.randint(low=0, high=classes, size=rows) + + m = DMatrixT(X, y) + booster = train( + { + "num_parallel_tree": num_parallel_tree, + "num_class": classes, + "tree_method": "hist", + }, + m, + num_boost_round=num_boost_round, + ) + + booster.set_param({"device": device}) + empty = DMatrixT(np.ones(shape=(0, cols))) + empty_leaf = booster.predict(empty, pred_leaf=True) + assert empty_leaf.shape[0] == 0 + + leaf = booster.predict(m, pred_leaf=True, strict_shape=True) + assert leaf.shape[0] == rows + assert leaf.shape[1] == num_boost_round + assert leaf.shape[2] == classes + assert leaf.shape[3] == num_parallel_tree + + validate_leaf_output(leaf, num_parallel_tree) + + n_iters = np.int32(2) + sliced = booster.predict( + m, + pred_leaf=True, + iteration_range=(0, n_iters), + strict_shape=True, + ) + first = sliced[0, ...] + + assert np.prod(first.shape) == classes * num_parallel_tree * n_iters + + # When there's only 1 tree, the output is a 1 dim vector + booster = train({"tree_method": "hist"}, num_boost_round=1, dtrain=m) + booster.set_param({"device": device}) + assert booster.predict(m, pred_leaf=True).shape == (rows,) + + return leaf + + +def run_base_margin_vs_base_score(device: Device) -> None: + """Test for the relation between score and margin.""" + from sklearn.datasets import make_classification + + intercept = 0.5 + + X, y = make_classification(random_state=2025) + booster = train( + {"base_score": intercept, "objective": "binary:logistic", "device": device}, + dtrain=DMatrix(X, y), + num_boost_round=1, + ) + np.testing.assert_allclose(get_basescore(booster), intercept) + predt_0 = booster.predict(DMatrix(X, y)) + + margin = np.full(y.shape, fill_value=logit(intercept), dtype=np.float32) + Xy = DMatrix(X, y, base_margin=margin) + # 0.2 is a dummy value + booster = train( + {"base_score": 0.2, "objective": "binary:logistic", "device": device}, + dtrain=Xy, + num_boost_round=1, + ) + np.testing.assert_allclose(get_basescore(booster), 0.2) + predt_1 = booster.predict(Xy) + + np.testing.assert_allclose(predt_0, predt_1) diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/xgboost/testing/quantile_dmatrix.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/xgboost/testing/quantile_dmatrix.py new file mode 100644 index 0000000000000000000000000000000000000000..f5e861c5009814be99e113436dd5d51d7e12c6eb --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/xgboost/testing/quantile_dmatrix.py @@ -0,0 +1,68 @@ +"""QuantileDMatrix related tests.""" + +import numpy as np +import pytest +from sklearn.model_selection import train_test_split + +import xgboost as xgb + +from .data import make_batches, make_categorical + + +def check_ref_quantile_cut(device: str) -> None: + """Check obtaining the same cut values given a reference.""" + X, y, _ = ( + data[0] + for data in make_batches( + n_samples_per_batch=8192, + n_features=16, + n_batches=1, + use_cupy=device.startswith("cuda"), + ) + ) + + X_train, X_valid, y_train, y_valid = train_test_split(X, y) + Xy_train = xgb.QuantileDMatrix(X_train, y_train) + Xy_valid = xgb.QuantileDMatrix(X_valid, y_valid, ref=Xy_train) + + cut_train = Xy_train.get_quantile_cut() + cut_valid = Xy_valid.get_quantile_cut() + + np.testing.assert_allclose(cut_train[0], cut_valid[0]) + np.testing.assert_allclose(cut_train[1], cut_valid[1]) + + Xy_valid = xgb.QuantileDMatrix(X_valid, y_valid) + cut_valid = Xy_valid.get_quantile_cut() + assert not np.allclose(cut_train[1], cut_valid[1]) + + +def check_categorical_strings(device: str) -> None: + """Check string inputs.""" + if device == "cpu": + pd = pytest.importorskip("pandas") + else: + pd = pytest.importorskip("cudf") + + n_categories = 32 + X, y = make_categorical( + 1024, + 8, + n_categories, + onehot=False, + cat_dtype=np.str_, + cat_ratio=0.5, + shuffle=True, + ) + X = pd.DataFrame(X) + + Xy = xgb.QuantileDMatrix(X, y, enable_categorical=True) + assert Xy.num_col() == 8 + cuts = Xy.get_quantile_cut() + indptr = cuts[0] + values = cuts[1] + for i in range(1, len(indptr)): + f_idx = i - 1 + if isinstance(X[X.columns[f_idx]].dtype, pd.CategoricalDtype): + beg, end = indptr[f_idx], indptr[i] + col = values[beg:end] + np.testing.assert_allclose(col, np.arange(0, n_categories)) diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/xgboost/testing/ranking.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/xgboost/testing/ranking.py new file mode 100644 index 0000000000000000000000000000000000000000..050048b1e3020551eba554949e67e5173c660168 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/xgboost/testing/ranking.py @@ -0,0 +1,208 @@ +# pylint: disable=too-many-locals +"""Tests for learning to rank.""" + +from types import ModuleType +from typing import Any + +import numpy as np +import pytest + +import xgboost as xgb +from xgboost import testing as tm + +from .utils import Device + + +def run_ranking_qid_df(impl: ModuleType, tree_method: str, device: Device) -> None: + """Test ranking with qid packed into X.""" + import scipy.sparse + from sklearn.metrics import mean_squared_error + from sklearn.model_selection import StratifiedGroupKFold, cross_val_score + + X, y, q, _ = tm.make_ltr(n_samples=128, n_features=2, n_query_groups=8, max_rel=3) + + # pack qid into x using dataframe + df = impl.DataFrame(X) + df["qid"] = q + ranker = xgb.XGBRanker( + n_estimators=3, eval_metric="ndcg", tree_method=tree_method, device=device + ) + ranker.fit(df, y) + s = ranker.score(df, y) + assert s > 0.7 + + # works with validation datasets as well + valid_df = df.copy() + valid_df.iloc[0, 0] = 3.0 + ranker.fit(df, y, eval_set=[(valid_df, y)]) + + # same as passing qid directly + ranker = xgb.XGBRanker( + n_estimators=3, eval_metric="ndcg", tree_method=tree_method, device=device + ) + ranker.fit(X, y, qid=q) + s1 = ranker.score(df, y) + assert np.isclose(s, s1) + + # Works with standard sklearn cv + if device == "cpu": + # we need cuML for this. + kfold = StratifiedGroupKFold(shuffle=False) + results = cross_val_score(ranker, df, y, cv=kfold, groups=df.qid) + assert len(results) == 5 + + # Works with custom metric + def neg_mse(y_true: Any, y_pred: Any, **kwargs: Any) -> float: + if hasattr(y_true, "get"): + y_true = y_true.get() + return -float(mean_squared_error(y_true, y_pred, **kwargs)) + + ranker = xgb.XGBRanker( + n_estimators=3, + eval_metric=neg_mse, + tree_method=tree_method, + device=device, + disable_default_eval_metric=True, + ) + ranker.fit(df, y, eval_set=[(valid_df, y)]) + score = ranker.score(valid_df, y) + assert np.isclose(score, ranker.evals_result()["validation_0"]["neg_mse"][-1]) + + # Works with sparse data + if device == "cpu": + # no sparse with cuDF + X_csr = scipy.sparse.csr_matrix(X) + df = impl.DataFrame.sparse.from_spmatrix( + X_csr, columns=[str(i) for i in range(X.shape[1])] + ) + df["qid"] = q + ranker = xgb.XGBRanker( + n_estimators=3, + eval_metric="ndcg", + tree_method=tree_method, + device=device, + ) + ranker.fit(df, y) + s2 = ranker.score(df, y) + assert np.isclose(s2, s) + + with pytest.raises(ValueError, match="Either `group` or `qid`."): + ranker.fit(df, y, eval_set=[(X, y)]) + + +def run_ranking_categorical(device: str) -> None: + """Test LTR with categorical features.""" + from sklearn.model_selection import cross_val_score + + X, y = tm.make_categorical( + n_samples=512, n_features=10, n_categories=3, onehot=False + ) + rng = np.random.default_rng(1994) + qid = rng.choice(3, size=y.shape[0]) + qid = np.sort(qid) + X["qid"] = qid + + ltr = xgb.XGBRanker(enable_categorical=True, device=device) + ltr.fit(X, y) + score = ltr.score(X, y) + assert score > 0.9 + + ltr = xgb.XGBRanker(enable_categorical=True, device=device) + + # test using the score function inside sklearn. + scores = cross_val_score(ltr, X, y) + for s in scores: + assert s > 0.7 + + +def run_normalization(device: str) -> None: + """Test normalization.""" + X, y, qid, _ = tm.make_ltr(2048, 4, 64, 3) + # top-k + ltr = xgb.XGBRanker(objective="rank:pairwise", n_estimators=4, device=device) + ltr.fit(X, y, qid=qid, eval_set=[(X, y)], eval_qid=[qid]) + e0 = ltr.evals_result() + + ltr = xgb.XGBRanker( + objective="rank:pairwise", + n_estimators=4, + device=device, + lambdarank_normalization=False, + ) + ltr.fit(X, y, qid=qid, eval_set=[(X, y)], eval_qid=[qid]) + e1 = ltr.evals_result() + assert e1["validation_0"]["ndcg@32"][-1] > e0["validation_0"]["ndcg@32"][-1] + + # mean + ltr = xgb.XGBRanker( + objective="rank:pairwise", + n_estimators=4, + device=device, + lambdarank_pair_method="mean", + lambdarank_normalization=True, + ) + ltr.fit(X, y, qid=qid, eval_set=[(X, y)], eval_qid=[qid]) + e0 = ltr.evals_result() + + ltr = xgb.XGBRanker( + objective="rank:pairwise", + n_estimators=4, + device=device, + lambdarank_pair_method="mean", + lambdarank_normalization=False, + ) + ltr.fit(X, y, qid=qid, eval_set=[(X, y)], eval_qid=[qid]) + e1 = ltr.evals_result() + # no normalization since the number of pairs is 1. + assert e1["validation_0"]["ndcg"][-1] == e0["validation_0"]["ndcg"][-1] + + # mean + ltr = xgb.XGBRanker( + objective="rank:pairwise", + n_estimators=4, + device=device, + lambdarank_pair_method="mean", + lambdarank_normalization=True, + lambdarank_num_pair_per_sample=4, + ) + ltr.fit(X, y, qid=qid, eval_set=[(X, y)], eval_qid=[qid]) + e0 = ltr.evals_result() + + ltr = xgb.XGBRanker( + objective="rank:pairwise", + n_estimators=4, + device=device, + lambdarank_pair_method="mean", + lambdarank_normalization=False, + lambdarank_num_pair_per_sample=4, + ) + ltr.fit(X, y, qid=qid, eval_set=[(X, y)], eval_qid=[qid]) + e1 = ltr.evals_result() + assert e1["validation_0"]["ndcg"][-1] != e0["validation_0"]["ndcg"][-1] + + +def run_score_normalization(device: str, objective: str) -> None: + """Test normalization by score differences.""" + if objective == "rank:map": + # Binary relevance + X, y, qid, _ = tm.make_ltr(4096, 4, 64, max_rel=1) + else: + X, y, qid, _ = tm.make_ltr(4096, 4, 64, 3) + ltr = xgb.XGBRanker(objective=objective, n_estimators=4, device=device) + ltr.fit(X, y, qid=qid, eval_set=[(X, y)], eval_qid=[qid]) + e0 = ltr.evals_result() + + ltr = xgb.XGBRanker( + objective="rank:pairwise", + n_estimators=4, + device=device, + lambdarank_score_normalization=False, + ) + ltr.fit(X, y, qid=qid, eval_set=[(X, y)], eval_qid=[qid]) + e1 = ltr.evals_result() + + m0, m1 = ( + list(e0["validation_0"].values())[-1][-1], + list(e1["validation_0"].values())[-1][-1], + ) + assert m0 != m1 diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/xgboost/testing/shared.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/xgboost/testing/shared.py new file mode 100644 index 0000000000000000000000000000000000000000..fcdfe5a6e13822197f7b172e15d9f62a898acaee --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/xgboost/testing/shared.py @@ -0,0 +1,100 @@ +"""Testing code shared by other tests.""" + +import collections +import importlib.util +import json +import os +import tempfile +from typing import Any, Callable, Dict, Type + +import numpy as np + +import xgboost as xgb +from xgboost._typing import ArrayLike + + +def validate_leaf_output(leaf: np.ndarray, num_parallel_tree: int) -> None: + """Validate output for predict leaf tests.""" + for i in range(leaf.shape[0]): # n_samples + for j in range(leaf.shape[1]): # n_rounds + for k in range(leaf.shape[2]): # n_classes + tree_group = leaf[i, j, k, :] + assert tree_group.shape[0] == num_parallel_tree + # No sampling, all trees within forest are the same + assert np.all(tree_group == tree_group[0]) + + +def validate_data_initialization( + dmatrix: Type, model: Type[xgb.XGBModel], X: ArrayLike, y: ArrayLike +) -> None: + """Assert that we don't create duplicated DMatrix.""" + + old_init = dmatrix.__init__ + count = [0] + + def new_init(self: Any, **kwargs: Any) -> Callable: + count[0] += 1 + return old_init(self, **kwargs) + + dmatrix.__init__ = new_init + model(n_estimators=1).fit(X, y, eval_set=[(X, y)]) + + assert count[0] == 1 + count[0] = 0 # only 1 DMatrix is created. + + y_copy = y.copy() + model(n_estimators=1).fit(X, y, eval_set=[(X, y_copy)]) + assert count[0] == 2 # a different Python object is considered different + + dmatrix.__init__ = old_init + + +# pylint: disable=too-many-arguments,too-many-locals +def get_feature_weights( + *, + X: ArrayLike, + y: ArrayLike, + fw: np.ndarray, + parser_path: str, + tree_method: str, + model: Type[xgb.XGBModel] = xgb.XGBRegressor, +) -> np.ndarray: + """Get feature weights using the demo parser.""" + with tempfile.TemporaryDirectory() as tmpdir: + colsample_bynode = 0.5 + reg = model( + tree_method=tree_method, + colsample_bynode=colsample_bynode, + feature_weights=fw, + ) + + reg.fit(X, y) + model_path = os.path.join(tmpdir, "model.json") + reg.save_model(model_path) + with open(model_path, "r", encoding="utf-8") as fd: + model = json.load(fd) + + spec = importlib.util.spec_from_file_location("JsonParser", parser_path) + assert spec is not None + jsonm = importlib.util.module_from_spec(spec) + assert spec.loader is not None + spec.loader.exec_module(jsonm) + model = jsonm.Model(model) + splits: Dict[int, int] = {} + total_nodes = 0 + for tree in model.trees: + n_nodes = len(tree.nodes) + total_nodes += n_nodes + for n in range(n_nodes): + if tree.is_leaf(n): + continue + if splits.get(tree.split_index(n), None) is None: + splits[tree.split_index(n)] = 1 + else: + splits[tree.split_index(n)] += 1 + + od = collections.OrderedDict(sorted(splits.items())) + tuples = list(od.items()) + k, v = list(zip(*tuples)) + w = np.polyfit(k, v, deg=1) + return w diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/xgboost/testing/updater.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/xgboost/testing/updater.py new file mode 100644 index 0000000000000000000000000000000000000000..0a0f98cf3c26637cc729e83d853a6c390f5b187a --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/xgboost/testing/updater.py @@ -0,0 +1,683 @@ +"""Tests for updaters.""" + +import json +from functools import partial, update_wrapper +from string import ascii_lowercase +from typing import Any, Dict, List, Union, overload + +import numpy as np +import pytest +from sklearn.datasets import make_regression + +import xgboost.testing as tm + +from ..callback import TrainingCallback +from ..compat import import_cupy +from ..core import ( + Booster, + DataIter, + DMatrix, + ExtMemQuantileDMatrix, + QuantileDMatrix, +) +from ..data import is_pd_cat_dtype +from ..sklearn import XGBModel, XGBRegressor +from ..training import train +from .data import IteratorForTest, make_batches, make_categorical +from .data_iter import CatIter +from .utils import Device, assert_allclose, non_increasing + + +@overload +def get_basescore(model: XGBModel) -> List[float]: ... + + +@overload +def get_basescore(model: Booster) -> List[float]: ... + + +@overload +def get_basescore(model: Dict[str, Any]) -> List[float]: ... + + +def get_basescore( + model: Union[XGBModel, Booster, Dict], +) -> List[float]: + """Get base score from an XGBoost sklearn estimator.""" + if isinstance(model, XGBModel): + model = model.get_booster() + + if isinstance(model, dict): + jintercept = model["learner"]["learner_model_param"]["base_score"] + else: + jintercept = json.loads(model.save_config())["learner"]["learner_model_param"][ + "base_score" + ] + return json.loads(jintercept) + + +# pylint: disable=too-many-locals +def check_quantile_loss(tree_method: str, weighted: bool, device: Device) -> None: + """Test for quantile loss.""" + from sklearn.metrics import mean_pinball_loss + + from xgboost.sklearn import _metric_decorator + + n_samples = 4096 + n_features = 8 + n_estimators = 8 + + rng = np.random.RandomState(1994) + # pylint: disable=unbalanced-tuple-unpacking + X, y = make_regression( + n_samples=n_samples, + n_features=n_features, + random_state=rng, + ) + if weighted: + weight = rng.random(size=n_samples) + else: + weight = None + + Xy = QuantileDMatrix(X, y, weight=weight) + + alpha = np.array([0.1, 0.5]) + # non-zero base score can cause floating point difference with GPU predictor. + # multi-class has small difference than single target in the prediction kernel + base_score = np.zeros(shape=alpha.shape, dtype=np.float32) + evals_result: Dict[str, Dict] = {} + booster_multi = train( + { + "objective": "reg:quantileerror", + "tree_method": tree_method, + "device": device, + "quantile_alpha": alpha, + "base_score": base_score, + }, + Xy, + num_boost_round=n_estimators, + evals=[(Xy, "Train")], + evals_result=evals_result, + ) + predt_multi = booster_multi.predict(Xy, strict_shape=True) + + assert non_increasing(evals_result["Train"]["quantile"]) + assert evals_result["Train"]["quantile"][-1] < 20.0 + # check that there's a way to use custom metric and compare the results. + metrics = [ + _metric_decorator( + update_wrapper( + partial(mean_pinball_loss, sample_weight=weight, alpha=alpha[i]), + mean_pinball_loss, + ) + ) + for i in range(alpha.size) + ] + + predts = np.empty(predt_multi.shape) + for i in range(alpha.shape[0]): + a = alpha[i] + + booster_i = train( + { + "objective": "reg:quantileerror", + "tree_method": tree_method, + "device": device, + "quantile_alpha": a, + "base_score": base_score[i], + }, + Xy, + num_boost_round=n_estimators, + evals=[(Xy, "Train")], + custom_metric=metrics[i], + evals_result=evals_result, + ) + assert non_increasing(evals_result["Train"]["quantile"]) + assert evals_result["Train"]["quantile"][-1] < 30.0 + np.testing.assert_allclose( + np.array(evals_result["Train"]["quantile"]), + np.array(evals_result["Train"]["mean_pinball_loss"]), + atol=1e-6, + rtol=1e-6, + ) + predts[:, i] = booster_i.predict(Xy) + + for i in range(alpha.shape[0]): + np.testing.assert_allclose(predts[:, i], predt_multi[:, i]) + + +def check_quantile_loss_rf( + device: Device, tree_method: str, multi_strategy: str +) -> None: + """Test quantile loss with boosting random forest.""" + # pylint: disable=unbalanced-tuple-unpacking + X, y = make_regression(n_samples=2048, n_features=16, random_state=2026) + Xy = DMatrix(X, y) + + def run(params: Dict[str, Any], metric: str) -> None: + evals_result_0: Dict[str, Dict] = {} + params["num_parallel_tree"] = 2 + train( + params, + Xy, + num_boost_round=8, + evals=[(Xy, "Train")], + evals_result=evals_result_0, + ) + + evals_result_1: Dict[str, Dict] = {} + params["num_parallel_tree"] = 1 + train( + params, + Xy, + num_boost_round=8, + evals=[(Xy, "Train")], + evals_result=evals_result_1, + ) + # Without subsample, the result should be the same (barring floating point + # errors). + np.testing.assert_allclose( + evals_result_0["Train"][metric], evals_result_1["Train"][metric] + ) + assert non_increasing(evals_result_0["Train"][metric]) + + alpha = np.array([0.1, 0.5, 0.9]) + params = { + "objective": "reg:quantileerror", + "tree_method": tree_method, + "device": device, + "quantile_alpha": alpha, + "multi_strategy": multi_strategy, + } + run(params, "quantile") + + # Now test with MAE + params.pop("quantile_alpha") + params["objective"] = "reg:absoluteerror" + run(params, "mae") + + +def check_quantile_loss_extmem( + n_samples_per_batch: int, + n_features: int, + n_batches: int, + tree_method: str, + device: str, +) -> None: + """Check external memory with the quantile objective.""" + it = IteratorForTest( + *make_batches(n_samples_per_batch, n_features, n_batches, device != "cpu"), + cache="cache", + on_host=False, + ) + Xy_it = DMatrix(it) + params = { + "tree_method": tree_method, + "objective": "reg:quantileerror", + "device": device, + "quantile_alpha": [0.2, 0.8], + } + booster_it = train(params, Xy_it) + X, y, w = it.as_arrays() + Xy = DMatrix(X, y, weight=w) + booster = train(params, Xy) + + predt_it = booster_it.predict(Xy_it) + predt = booster.predict(Xy) + + np.testing.assert_allclose(predt, predt_it) + + +def check_extmem_qdm( # pylint: disable=too-many-arguments + n_samples_per_batch: int, + n_features: int, + *, + n_batches: int, + n_bins: int, + device: str, + on_host: bool, + is_cat: bool, +) -> None: + """Basic test for the `ExtMemQuantileDMatrix`.""" + + if is_cat: + it: DataIter = CatIter( + n_samples_per_batch=n_samples_per_batch, + n_features=n_features, + n_batches=n_batches, + n_cats=5, + sparsity=0.0, + cat_ratio=0.5, + onehot=False, + device=device, + cache="cache", + ) + else: + it = IteratorForTest( + *make_batches( + n_samples_per_batch, n_features, n_batches, use_cupy=device != "cpu" + ), + cache="cache", + on_host=on_host, + ) + + Xy_it = ExtMemQuantileDMatrix(it, max_bin=n_bins, enable_categorical=is_cat) + with pytest.raises(ValueError, match="Only the `hist`"): + booster_it = train( + {"device": device, "tree_method": "approx", "max_bin": n_bins}, + Xy_it, + num_boost_round=8, + ) + + booster_it = train({"device": device, "max_bin": n_bins}, Xy_it, num_boost_round=8) + if is_cat: + it = CatIter( + n_samples_per_batch=n_samples_per_batch, + n_features=n_features, + n_batches=n_batches, + n_cats=5, + sparsity=0.0, + cat_ratio=0.5, + onehot=False, + device=device, + cache=None, + ) + else: + it = IteratorForTest( + *make_batches( + n_samples_per_batch, n_features, n_batches, use_cupy=device != "cpu" + ), + cache=None, + ) + Xy = QuantileDMatrix(it, max_bin=n_bins, enable_categorical=is_cat) + booster = train({"device": device, "max_bin": n_bins}, Xy, num_boost_round=8) + + cut_it = Xy_it.get_quantile_cut() + cut = Xy.get_quantile_cut() + np.testing.assert_allclose(cut_it[0], cut[0]) + np.testing.assert_allclose(cut_it[1], cut[1]) + + predt_it = booster_it.predict(Xy_it) + predt = booster.predict(Xy) + np.testing.assert_allclose(predt_it, predt) + + +def check_cut( + n_entries: int, indptr: np.ndarray, data: np.ndarray, dtypes: Any +) -> None: + """Check the cut values.""" + assert data.shape[0] == indptr[-1] + assert data.shape[0] == n_entries + + assert indptr.dtype == np.uint64 + for i in range(1, indptr.size): + beg = int(indptr[i - 1]) + end = int(indptr[i]) + for j in range(beg + 1, end): + assert data[j] > data[j - 1] + if is_pd_cat_dtype(dtypes.iloc[i - 1]): + assert data[j] == data[j - 1] + 1 + + +def check_get_quantile_cut_device(tree_method: str, use_cupy: bool) -> None: + """Check with optional cupy.""" + import pandas as pd + + n_samples = 1024 + n_features = 14 + max_bin = 16 + dtypes = pd.Series([np.float32] * n_features) + + # numerical + X, y, w = tm.make_regression(n_samples, n_features, use_cupy=use_cupy) + # - qdm + Xyw: DMatrix = QuantileDMatrix(X, y, weight=w, max_bin=max_bin) + indptr, data = Xyw.get_quantile_cut() + check_cut((max_bin + 1) * n_features, indptr, data, dtypes) + # - dm + Xyw = DMatrix(X, y, weight=w) + train({"tree_method": tree_method, "max_bin": max_bin}, Xyw) + indptr, data = Xyw.get_quantile_cut() + check_cut((max_bin + 1) * n_features, indptr, data, dtypes) + # - ext mem + n_batches = 3 + n_samples_per_batch = 256 + it = IteratorForTest( + *make_batches(n_samples_per_batch, n_features, n_batches, use_cupy), + cache="cache", + on_host=False, + ) + Xy: DMatrix = DMatrix(it) + train({"tree_method": tree_method, "max_bin": max_bin}, Xyw) + indptr, data = Xyw.get_quantile_cut() + check_cut((max_bin + 1) * n_features, indptr, data, dtypes) + + # categorical + n_categories = 32 + X, y = make_categorical( + n_samples, n_features, n_categories, onehot=False, sparsity=0.8 + ) + if use_cupy: + import cudf + + cp = import_cupy() + + X = cudf.from_pandas(X) + y = cp.array(y) + # - qdm + Xy = QuantileDMatrix(X, y, max_bin=max_bin, enable_categorical=True) + indptr, data = Xy.get_quantile_cut() + check_cut(n_categories * n_features, indptr, data, X.dtypes) + # - dm + Xy = DMatrix(X, y, enable_categorical=True) + train({"tree_method": tree_method, "max_bin": max_bin}, Xy) + indptr, data = Xy.get_quantile_cut() + check_cut(n_categories * n_features, indptr, data, X.dtypes) + + # mixed + X, y = make_categorical( + n_samples, n_features, n_categories, onehot=False, sparsity=0.8, cat_ratio=0.5 + ) + n_cat_features = len([0 for dtype in X.dtypes if is_pd_cat_dtype(dtype)]) + n_num_features = n_features - n_cat_features + n_entries = n_categories * n_cat_features + (max_bin + 1) * n_num_features + # - qdm + Xy = QuantileDMatrix(X, y, max_bin=max_bin, enable_categorical=True) + indptr, data = Xy.get_quantile_cut() + check_cut(n_entries, indptr, data, X.dtypes) + # - dm + Xy = DMatrix(X, y, enable_categorical=True) + train({"tree_method": tree_method, "max_bin": max_bin}, Xy) + indptr, data = Xy.get_quantile_cut() + check_cut(n_entries, indptr, data, X.dtypes) + + +def check_get_quantile_cut(tree_method: str, device: str) -> None: + """Check the quantile cut getter.""" + + use_cupy = device.startswith("cuda") + check_get_quantile_cut_device(tree_method, False) + if use_cupy: + check_get_quantile_cut_device(tree_method, True) + + +USE_ONEHOT = np.iinfo(np.int32).max +USE_PART = 1 + + +def _create_dmatrix( # pylint: disable=too-many-arguments + n_samples: int, + n_features: int, + *, + n_cats: int, + device: str, + sparsity: float, + tree_method: str, + onehot: bool, + extmem: bool, + enable_categorical: bool, +) -> DMatrix: + n_batches = max(min(2, n_samples), 1) + it = CatIter( + n_samples // n_batches, + n_features, + n_batches=n_batches, + sparsity=sparsity, + cat_ratio=1.0, + n_cats=n_cats, + onehot=onehot, + device=device, + cache="cache" if extmem else None, + ) + if extmem: + if tree_method == "hist": + Xy: DMatrix = ExtMemQuantileDMatrix( + it, enable_categorical=enable_categorical + ) + elif tree_method == "approx": + Xy = DMatrix(it, enable_categorical=enable_categorical) + else: + raise ValueError(f"tree_method {tree_method} not supported.") + else: + cat, label = it.xy() + Xy = DMatrix(cat, label, enable_categorical=enable_categorical) + return Xy + + +def check_categorical_ohe( # pylint: disable=too-many-arguments + *, + rows: int, + cols: int, + rounds: int, + cats: int, + device: str, + tree_method: str, + extmem: bool, +) -> None: + "Test for one-hot encoding with categorical data." + + by_etl_results: Dict[str, Dict[str, List[float]]] = {} + by_builtin_results: Dict[str, Dict[str, List[float]]] = {} + + parameters: Dict[str, Any] = { + "tree_method": tree_method, + # Use one-hot exclusively + "max_cat_to_onehot": USE_ONEHOT, + "device": device, + } + + Xy_onehot = _create_dmatrix( + rows, + cols, + n_cats=cats, + device=device, + sparsity=0.0, + onehot=True, + tree_method=tree_method, + extmem=extmem, + enable_categorical=False, + ) + train( + parameters, + Xy_onehot, + num_boost_round=rounds, + evals=[(Xy_onehot, "Train")], + evals_result=by_etl_results, + ) + + Xy_cat = _create_dmatrix( + rows, + cols, + n_cats=cats, + device=device, + sparsity=0.0, + tree_method=tree_method, + onehot=False, + extmem=extmem, + enable_categorical=True, + ) + train( + parameters, + Xy_cat, + num_boost_round=rounds, + evals=[(Xy_cat, "Train")], + evals_result=by_builtin_results, + ) + + # There are guidelines on how to specify tolerance based on considering output + # as random variables. But in here the tree construction is extremely sensitive + # to floating point errors. An 1e-5 error in a histogram bin can lead to an + # entirely different tree. So even though the test is quite lenient, hypothesis + # can still pick up falsifying examples from time to time. + np.testing.assert_allclose( + np.array(by_etl_results["Train"]["rmse"]), + np.array(by_builtin_results["Train"]["rmse"]), + rtol=1e-3, + ) + assert non_increasing(by_builtin_results["Train"]["rmse"]) + + by_grouping: Dict[str, Dict[str, List[float]]] = {} + # switch to partition-based splits + parameters["max_cat_to_onehot"] = USE_PART + parameters["reg_lambda"] = 0 + train( + parameters, + Xy_cat, + num_boost_round=rounds, + evals=[(Xy_cat, "Train")], + evals_result=by_grouping, + ) + rmse_oh = by_builtin_results["Train"]["rmse"] + rmse_group = by_grouping["Train"]["rmse"] + # always better or equal to onehot when there's no regularization. + for a, b in zip(rmse_oh, rmse_group): + assert a >= b + + parameters["reg_lambda"] = 1.0 + by_grouping = {} + train( + parameters, + Xy_cat, + num_boost_round=32, + evals=[(Xy_cat, "Train")], + evals_result=by_grouping, + ) + assert non_increasing(by_grouping["Train"]["rmse"]), by_grouping + + +def check_categorical_missing( # pylint: disable=too-many-arguments + rows: int, + cols: int, + cats: int, + *, + device: Device, + tree_method: str, + extmem: bool, +) -> None: + """Check categorical data with missing values.""" + parameters: Dict[str, Any] = {"tree_method": tree_method, "device": device} + Xy = _create_dmatrix( + rows, + cols, + n_cats=cats, + sparsity=0.5, + device=device, + tree_method=tree_method, + onehot=False, + extmem=extmem, + enable_categorical=True, + ) + label = Xy.get_label() + + def run(max_cat_to_onehot: int) -> None: + # Test with onehot splits + parameters["max_cat_to_onehot"] = max_cat_to_onehot + + evals_result: Dict[str, Dict] = {} + booster = train( + parameters, + Xy, + num_boost_round=8, + evals=[(Xy, "Train")], + evals_result=evals_result, + ) + assert non_increasing(evals_result["Train"]["rmse"]) + y_predt = booster.predict(Xy) + rmse = tm.root_mean_square(label, y_predt) + assert_allclose(device, rmse, evals_result["Train"]["rmse"][-1], rtol=2e-5) + + # Test with OHE split + run(USE_ONEHOT) + + # Test with partition-based split + run(USE_PART) + + +def run_max_cat(tree_method: str, device: Device) -> None: + """Test data with size smaller than number of categories.""" + import pandas as pd + + rng = np.random.default_rng(0) + n_cat = 100 + n = 5 + + X = pd.Series( + ["".join(rng.choice(list(ascii_lowercase), size=3)) for i in range(n_cat)], + dtype="category", + )[:n].to_frame() + + reg = XGBRegressor( + enable_categorical=True, + tree_method=tree_method, + device=device, + n_estimators=10, + ) + y = pd.Series(range(n)) + reg.fit(X=X, y=y, eval_set=[(X, y)]) + assert non_increasing(reg.evals_result()["validation_0"]["rmse"]) + + +def run_invalid_category(tree_method: str, device: Device) -> None: + """Test with invalid categorical inputs.""" + rng = np.random.default_rng() + # too large + X = rng.integers(low=0, high=4, size=1000).reshape(100, 10) + y = rng.normal(loc=0, scale=1, size=100) + X[13, 7] = np.iinfo(np.int32).max + 1 + + # Check is performed during sketching. + Xy = DMatrix(X, y, feature_types=["c"] * 10) + with pytest.raises(ValueError): + train({"tree_method": tree_method, "device": device}, Xy) + + X[13, 7] = 16777216 + Xy = DMatrix(X, y, feature_types=["c"] * 10) + with pytest.raises(ValueError): + train({"tree_method": tree_method, "device": device}, Xy) + + # mixed positive and negative values + X = rng.normal(loc=0, scale=1, size=1000).reshape(100, 10) # type: ignore + y = rng.normal(loc=0, scale=1, size=100) + + Xy = DMatrix(X, y, feature_types=["c"] * 10) + with pytest.raises(ValueError): + train({"tree_method": tree_method, "device": device}, Xy) + + if device == "cuda": + import cupy as cp + + X, y = cp.array(X), cp.array(y) + with pytest.raises(ValueError): + QuantileDMatrix(X, y, feature_types=["c"] * 10) + + +def train_result( + param: Dict[str, Any], dmat: DMatrix, num_rounds: int +) -> Dict[str, Any]: + """Get training result from parameters and data.""" + result: Dict[str, Any] = {} + booster = train( + param, + dmat, + num_rounds, + evals=[(dmat, "train")], + verbose_eval=False, + evals_result=result, + ) + assert booster.num_features() == dmat.num_col() + assert booster.num_boosted_rounds() == num_rounds + assert booster.feature_names == dmat.feature_names + assert booster.feature_types == dmat.feature_types + + return result + + +class ResetStrategy(TrainingCallback): + """Callback for testing multi-output.""" + + def after_iteration(self, model: Booster, epoch: int, evals_log: dict) -> bool: + if epoch % 2 == 0: + model.set_param({"multi_strategy": "multi_output_tree"}) + else: + model.set_param({"multi_strategy": "one_output_per_tree"}) + return False diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/xgboost/testing/utils.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/xgboost/testing/utils.py new file mode 100644 index 0000000000000000000000000000000000000000..4503cfd060cd8861c843aea999a96d1269e1137b --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/xgboost/testing/utils.py @@ -0,0 +1,44 @@ +"""Helpers for test code.""" + +from typing import Any, Literal, Sequence, TypeAlias + +import numpy as np + +from ..compat import _is_cupy_alike, import_cupy +from ..core import DMatrix + +Device: TypeAlias = Literal["cpu", "cuda"] + + +def assert_allclose( + device: Device, a: Any, b: Any, *, rtol: float = 1e-7, atol: float = 0 +) -> None: + """Dispatch the assert_allclose for devices.""" + if device == "cpu" and not _is_cupy_alike(a) and not _is_cupy_alike(b): + np.testing.assert_allclose(a, b, atol=atol, rtol=rtol) + else: + cp = import_cupy() + cp.testing.assert_allclose(a, b, atol=atol, rtol=rtol) + + +def predictor_equal(lhs: DMatrix, rhs: DMatrix) -> bool: + """Assert whether two DMatrices contain the same predictors.""" + lcsr = lhs.get_data() + rcsr = rhs.get_data() + return all( + ( + np.array_equal(lcsr.data, rcsr.data), + np.array_equal(lcsr.indices, rcsr.indices), + np.array_equal(lcsr.indptr, rcsr.indptr), + ) + ) + + +def non_increasing(L: Sequence[float], tolerance: float = 1e-4) -> bool: + """Values in the sequence are not increasing.""" + return all((y - x) < tolerance for x, y in zip(L, L[1:])) + + +def non_decreasing(L: Sequence[float], tolerance: float = 1e-4) -> bool: + """Values in the sequence are not decreasing.""" + return all((y - x) >= -tolerance for x, y in zip(L, L[1:])) diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/xgboost/testing/with_skl.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/xgboost/testing/with_skl.py new file mode 100644 index 0000000000000000000000000000000000000000..f892a4db950528fe2e7a4c58251612588a3a488b --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/xgboost/testing/with_skl.py @@ -0,0 +1,234 @@ +# pylint: disable=too-many-arguments, too-many-positional-arguments +"""Tests for compatiblity with sklearn.""" + +from typing import Callable, Optional, Type + +import numpy as np +import pytest +from scipy.special import softmax + +from ..core import DMatrix +from ..sklearn import XGBClassifier, XGBRegressor, XGBRFRegressor +from .data import get_california_housing, make_batches +from .ordinal import make_recoded +from .utils import Device, assert_allclose + + +def run_boost_from_prediction_binary( + tree_method: str, + device: Device, + X: np.ndarray, + y: np.ndarray, + as_frame: Optional[Callable], +) -> None: + """ + Parameters + ---------- + + as_frame: A callable function to convert margin into DataFrame, useful for different + df implementations. + """ + + model_0 = XGBClassifier( + learning_rate=0.3, + random_state=0, + n_estimators=4, + tree_method=tree_method, + device=device, + ) + model_0.fit(X=X, y=y) + margin = model_0.predict(X, output_margin=True) + if as_frame is not None: + margin = as_frame(margin) + + model_1 = XGBClassifier( + learning_rate=0.3, + random_state=0, + n_estimators=4, + tree_method=tree_method, + device=device, + ) + model_1.fit(X=X, y=y, base_margin=margin) + predictions_1 = model_1.predict(X, base_margin=margin) + + cls_2 = XGBClassifier( + learning_rate=0.3, + random_state=0, + n_estimators=8, + tree_method=tree_method, + device=device, + ) + cls_2.fit(X=X, y=y) + predictions_2 = cls_2.predict(X) + np.testing.assert_allclose(predictions_1, predictions_2) + + +def run_boost_from_prediction_multi_clasas( + estimator: Type, + tree_method: str, + device: Device, + X: np.ndarray, + y: np.ndarray, + as_frame: Optional[Callable], +) -> None: + """Boosting from prediction with multi-class clf.""" + # Multi-class + model_0 = estimator( + learning_rate=0.3, + random_state=0, + n_estimators=4, + tree_method=tree_method, + device=device, + ) + model_0.fit(X=X, y=y) + margin = model_0.get_booster().inplace_predict(X, predict_type="margin") + if as_frame is not None: + margin = as_frame(margin) + + model_1 = estimator( + learning_rate=0.3, + random_state=0, + n_estimators=4, + tree_method=tree_method, + device=device, + ) + model_1.fit(X=X, y=y, base_margin=margin) + predictions_1 = model_1.get_booster().predict( + DMatrix(X, base_margin=margin), output_margin=True + ) + + model_2 = estimator( + learning_rate=0.3, + random_state=0, + n_estimators=8, + tree_method=tree_method, + device=device, + ) + model_2.fit(X=X, y=y) + predictions_2 = model_2.get_booster().inplace_predict(X, predict_type="margin") + + if hasattr(predictions_1, "get"): + predictions_1 = predictions_1.get() + if hasattr(predictions_2, "get"): + predictions_2 = predictions_2.get() + np.testing.assert_allclose(predictions_1, predictions_2, atol=1e-6) + + +def run_housing_rf_regression(tree_method: str, device: Device) -> None: + """Testwith the cali housing dataset.""" + from sklearn.metrics import mean_squared_error + from sklearn.model_selection import KFold + + X, y = get_california_housing() + rng = np.random.RandomState(1994) + kf = KFold(n_splits=2, shuffle=True, random_state=rng) + for train_index, test_index in kf.split(X, y): + xgb_model = XGBRFRegressor( + random_state=42, tree_method=tree_method, device=device + ).fit(X[train_index], y[train_index]) + preds = xgb_model.predict(X[test_index]) + labels = y[test_index] + assert mean_squared_error(preds, labels) < 35 + + rfreg = XGBRFRegressor(device=device) + with pytest.raises(NotImplementedError): + rfreg.set_params(early_stopping_rounds=10) + rfreg.fit(X, y) + + +def run_recoding(device: Device) -> None: + """Test re-coding for training continuation.""" + enc, reenc, y, _, _ = make_recoded(device, n_features=16) + reg = XGBRegressor(enable_categorical=True, n_estimators=2, device=device) + reg.fit(enc, y, eval_set=[(reenc, y)]) + results_0 = reg.evals_result() + + booster = reg.get_booster() + assert not booster.get_categories().empty() + + reg = XGBRegressor(enable_categorical=True, n_estimators=2, device=device) + reg.fit(reenc, y, xgb_model=booster, eval_set=[(enc, y)]) + results_1 = reg.evals_result() + + booster = reg.get_booster() + assert booster.num_boosted_rounds() == 4 + assert not booster.get_categories().empty() + + reg = XGBRegressor(enable_categorical=True, n_estimators=4, device=device) + reg.fit(enc, y, eval_set=[(reenc, y)]) + results_2 = reg.evals_result() + + np.testing.assert_allclose( + results_2["validation_0"]["rmse"], + results_0["validation_0"]["rmse"] + results_1["validation_0"]["rmse"], + ) + + np.testing.assert_allclose(reg.predict(reenc), reg.predict(enc)) + np.testing.assert_allclose(reg.apply(reenc), reg.apply(enc)) + + +def run_intercept(device: Device) -> None: + """Tests for the intercept.""" + from sklearn.datasets import make_classification, make_multilabel_classification + + X, y, w = [v[0] for v in make_batches(256, 3, 1, use_cupy=False)] + reg = XGBRegressor(device=device) + reg.fit(X, y, sample_weight=w) + result = reg.intercept_ + assert result.dtype == np.float32 + assert result[0] < 0.5 + + reg = XGBRegressor(booster="gblinear", device=device) + reg.fit(X, y, sample_weight=w) + result = reg.intercept_ + assert isinstance(result, np.ndarray) + assert result.dtype == np.float32 + assert result[0] < 0.5 + + n_classes = 4 + X, y = make_classification( + random_state=1994, + n_samples=128, + n_features=16, + n_classes=n_classes, + n_informative=16, + n_redundant=0, + ) + + clf = XGBClassifier(booster="gbtree", objective="multi:softprob", device=device) + clf.fit(X, y) + result = clf.intercept_ + assert isinstance(result, np.ndarray) + assert len(result) == 4 + + assert (softmax(result) >= 0.0).all() + np.testing.assert_allclose(sum(result), 0.0, atol=1e-6) + np.testing.assert_allclose(sum(softmax(result)), 1.0) + + # Tests for user input + # Multi-class + intercept = np.ones(shape=(n_classes), dtype=np.float32) / n_classes + if device == "cuda": + import cupy as cp + + intercept = cp.array(intercept) + + clf = XGBClassifier(objective="multi:softprob", base_score=intercept) + clf.fit(X, y) + assert_allclose(device, intercept, clf.intercept_) + + X, y = make_multilabel_classification( # pylint: disable=unbalanced-tuple-unpacking + random_state=1994, n_samples=128, n_features=16, n_classes=n_classes + ) + + # Multi-label + intercept = np.ones(shape=(n_classes), dtype=np.float32) / 2 + if device == "cuda": + import cupy as cp + + intercept = cp.array(intercept) + + clf = XGBClassifier(base_score=intercept) + clf.fit(X, y) + assert_allclose(device, intercept, clf.intercept_) + assert clf.objective == "binary:logistic" diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/xgboost/tracker.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/xgboost/tracker.py new file mode 100644 index 0000000000000000000000000000000000000000..926c957b28a41eb60ed4c61b992629e401b7ed79 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/xgboost/tracker.py @@ -0,0 +1,142 @@ +"""Tracker for XGBoost collective.""" + +import ctypes +import json +import socket +from enum import IntEnum, unique +from typing import Dict, Optional, Union + +from .core import _LIB, _check_call, _deprecate_positional_args, make_jcargs + + +def get_family(addr: str) -> int: + """Get network family from address.""" + return socket.getaddrinfo(addr, None)[0][0] + + +class RabitTracker: + """Tracker for the collective used in XGBoost, acting as a coordinator between + workers. + + Parameters + ---------- + + n_workers: + + The total number of workers in the communication group. + + host_ip: + + The IP address of the tracker node. XGBoost can try to guess one by probing with + sockets. But it's best to explicitly pass an address. + + port: + + The port this tracker should listen to. XGBoost can query an available port from + the OS, this configuration is useful for restricted network environments. + + sortby: + + How to sort the workers for rank assignment. The default is host, but users can + set the `DMLC_TASK_ID` via arguments of :py:meth:`~xgboost.collective.init` and + obtain deterministic rank assignment through sorting by task name. Available + options are: + + - host + - task + + timeout : + + Timeout for constructing (bootstrap) and shutting down the communication group, + doesn't apply to communication when the group is up and running. + + The timeout value should take the time of data loading and pre-processing into + account, due to potential lazy execution. By default the Tracker doesn't have + any timeout to avoid pre-mature aborting. + + The :py:meth:`.wait_for` method has a different timeout parameter that can stop + the tracker even if the tracker is still being used. A value error is raised + when timeout is reached. + + Examples + -------- + + .. code-block:: python + + from xgboost.tracker import RabitTracker + from xgboost import collective as coll + + tracker = RabitTracker(host_ip="127.0.0.1", n_workers=2) + tracker.start() + + with coll.CommunicatorContext(**tracker.worker_args()): + ret = coll.broadcast("msg", 0) + assert str(ret) == "msg" + + """ + + @unique + class _SortBy(IntEnum): + HOST = 0 + TASK = 1 + + @_deprecate_positional_args + def __init__( # pylint: disable=too-many-arguments + self, + n_workers: int, + host_ip: Optional[str], + port: int = 0, + *, + sortby: str = "host", + timeout: int = 0, + ) -> None: + + handle = ctypes.c_void_p() + if sortby not in ("host", "task"): + raise ValueError("Expecting either 'host' or 'task' for sortby.") + if host_ip is not None: + get_family(host_ip) # use python socket to stop early for invalid address + args = make_jcargs( + host=host_ip, + n_workers=n_workers, + port=port, + dmlc_communicator="rabit", + sortby=self._SortBy.HOST if sortby == "host" else self._SortBy.TASK, + timeout=int(timeout), + ) + _check_call(_LIB.XGTrackerCreate(args, ctypes.byref(handle))) + self.handle = handle + + def free(self) -> None: + """Internal function for testing.""" + if hasattr(self, "handle"): + handle = self.handle + del self.handle + _check_call(_LIB.XGTrackerFree(handle)) + + def __del__(self) -> None: + self.free() + + def start(self) -> None: + """Start the tracker. Once started, the client still need to call the + :py:meth:`wait_for` method in order to wait for it to finish (think of it as a + thread). + + """ + _check_call(_LIB.XGTrackerRun(self.handle, make_jcargs())) + + def wait_for(self, timeout: Optional[int] = None) -> None: + """Wait for the tracker to finish all the work and shutdown. When timeout is + reached, a value error is raised. By default we don't have timeout since we + don't know how long it takes for the model to finish training. + + """ + _check_call(_LIB.XGTrackerWaitFor(self.handle, make_jcargs(timeout=timeout))) + + def worker_args(self) -> Dict[str, Union[str, int]]: + """Get arguments for workers.""" + c_env = ctypes.c_char_p() + _check_call(_LIB.XGTrackerWorkerArgs(self.handle, ctypes.byref(c_env))) + assert c_env.value is not None + env = json.loads(c_env.value) + return env diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/xgboost/training.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/xgboost/training.py new file mode 100644 index 0000000000000000000000000000000000000000..00adca5a23c29ba2a4625834badd470088987bac --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/xgboost/training.py @@ -0,0 +1,623 @@ +# pylint: disable=too-many-locals, too-many-arguments +# pylint: disable=too-many-branches, too-many-statements +"""Training Library containing training routines.""" + +import copy +import os +import weakref +from typing import ( + TYPE_CHECKING, + Any, + Dict, + Iterable, + List, + Optional, + Sequence, + Tuple, + Union, + cast, +) + +import numpy as np + +from ._typing import BoosterParam, Callable, FPreProcCallable +from .callback import ( + CallbackContainer, + EarlyStopping, + EvaluationMonitor, + TrainingCallback, +) +from .compat import SKLEARN_INSTALLED, XGBStratifiedKFold +from .core import ( + Booster, + DMatrix, + Metric, + PlainObj, + XGBoostError, + _deprecate_positional_args, + _RefMixIn, +) + +if TYPE_CHECKING: + from pandas import DataFrame as PdDataFrame + +_CVFolds = Sequence["CVPack"] + +_RefError = ( + "Training dataset should be used as a reference when constructing the " + "`QuantileDMatrix` for evaluation.", +) + + +@_deprecate_positional_args +def train( + params: Dict[str, Any], + dtrain: DMatrix, + num_boost_round: int = 10, + *, + evals: Optional[Sequence[Tuple[DMatrix, str]]] = None, + obj: Optional[PlainObj] = None, + maximize: Optional[bool] = None, + early_stopping_rounds: Optional[int] = None, + evals_result: Optional[TrainingCallback.EvalsLog] = None, + verbose_eval: Optional[Union[bool, int]] = True, + xgb_model: Optional[Union[str, os.PathLike, Booster, bytearray]] = None, + callbacks: Optional[Sequence[TrainingCallback]] = None, + custom_metric: Optional[Metric] = None, +) -> Booster: + """Train a booster with given parameters. + + Parameters + ---------- + params : + Booster params. + dtrain : + Data to be trained. + num_boost_round : + Number of boosting iterations. + evals : + List of validation sets for which metrics will evaluated during training. + Validation metrics will help us track the performance of the model. + obj + Custom objective function. See :doc:`Custom Objective + ` for details. + maximize : + Whether to maximize custom_metric. + + early_stopping_rounds : + + Activates early stopping. Validation metric needs to improve at least once in + every **early_stopping_rounds** round(s) to continue training. + + Requires at least one item in **evals**. + + The method returns the model from the last iteration (not the best one). Use + custom callback :py:class:`~xgboost.callback.EarlyStopping` or :py:meth:`model + slicing ` if the best model is desired. If there's + more than one item in **evals**, the last entry will be used for early stopping. + + If there's more than one metric in the **eval_metric** parameter given in + **params**, the last metric will be used for early stopping. + + If early stopping occurs, the model will have two additional fields: + ``bst.best_score``, ``bst.best_iteration``. + + evals_result : + This dictionary stores the evaluation results of all the items in watchlist. + + Example: with a watchlist containing + ``[(dtest,'eval'), (dtrain,'train')]`` and + a parameter containing ``('eval_metric': 'logloss')``, + the **evals_result** returns + + .. code-block:: python + + {'train': {'logloss': ['0.48253', '0.35953']}, + 'eval': {'logloss': ['0.480385', '0.357756']}} + + verbose_eval : + Requires at least one item in **evals**. + + If **verbose_eval** is True then the evaluation metric on the validation set is + printed at each boosting stage. + + If **verbose_eval** is an integer then the evaluation metric on the validation + set is printed at every given **verbose_eval** boosting stage. The last boosting + stage / the boosting stage found by using **early_stopping_rounds** is also + printed. + + Example: with ``verbose_eval=4`` and at least one item in **evals**, an + evaluation metric is printed every 4 boosting stages, instead of every boosting + stage. + + xgb_model : + Xgb model to be loaded before training (allows training continuation). + + callbacks : + List of callback functions that are applied at end of each iteration. + It is possible to use predefined callbacks by using + :ref:`Callback API `. + + .. note:: + + States in callback are not preserved during training, which means callback + objects can not be reused for multiple training sessions without + reinitialization or deepcopy. + + .. code-block:: python + + for params in parameters_grid: + # be sure to (re)initialize the callbacks before each run + callbacks = [xgb.callback.LearningRateScheduler(custom_rates)] + xgboost.train(params, Xy, callbacks=callbacks) + + custom_metric: + + .. versionadded 1.6.0 + + Custom metric function. See :doc:`Custom Metric ` + for details. The metric receives transformed prediction (after applying the + reverse link function) when using a builtin objective, and raw output when using + a custom objective. + + Returns + ------- + Booster : a trained booster model + + """ + + callbacks = [] if callbacks is None else copy.copy(list(callbacks)) + evals = list(evals) if evals else [] + + for va, _ in evals: + if not isinstance(va, DMatrix): + raise TypeError("Invalid type for the `evals`.") + + if ( + isinstance(va, _RefMixIn) + and va.ref is not weakref.ref(dtrain) + and va is not dtrain + ): + raise ValueError(_RefError) + + bst = Booster(params, [dtrain] + [d[0] for d in evals], model_file=xgb_model) + start_iteration = 0 + + if verbose_eval: + verbose_eval = 1 if verbose_eval is True else verbose_eval + callbacks.append(EvaluationMonitor(period=verbose_eval)) + if early_stopping_rounds: + callbacks.append(EarlyStopping(rounds=early_stopping_rounds, maximize=maximize)) + cb_container = CallbackContainer( + callbacks, metric=custom_metric, output_margin=callable(obj) + ) + + bst = cb_container.before_training(bst) + + for i in range(start_iteration, num_boost_round): + if cb_container.before_iteration(bst, i, dtrain, evals): + break + bst.update(dtrain, iteration=i, fobj=obj) + if cb_container.after_iteration(bst, i, dtrain, evals): + break + + bst = cb_container.after_training(bst) + + if evals_result is not None: + evals_result.update(cb_container.history) + + return bst.reset() + + +class CVPack: + """ "Auxiliary datastruct to hold one fold of CV.""" + + def __init__( + self, dtrain: DMatrix, dtest: DMatrix, param: Optional[Union[Dict, List]] + ) -> None: + """Initialize the CVPack.""" + self.dtrain = dtrain + self.dtest = dtest + self.watchlist = [(dtrain, "train"), (dtest, "test")] + self.bst = Booster(param, [dtrain, dtest]) + + def __getattr__(self, name: str) -> Callable: + def _inner(*args: Any, **kwargs: Any) -> Any: + return getattr(self.bst, name)(*args, **kwargs) + + return _inner + + def update(self, iteration: int, fobj: Optional[PlainObj]) -> None: + """ "Update the boosters for one iteration""" + self.bst.update(self.dtrain, iteration, fobj) + + def eval(self, iteration: int, feval: Optional[Metric], output_margin: bool) -> str: + """ "Evaluate the CVPack for one iteration.""" + return self.bst.eval_set(self.watchlist, iteration, feval, output_margin) + + +class _PackedBooster: + def __init__(self, cvfolds: _CVFolds) -> None: + self.cvfolds = cvfolds + + def update(self, iteration: int, obj: Optional[PlainObj]) -> None: + """Iterate through folds for update""" + for fold in self.cvfolds: + fold.update(iteration, obj) + + def eval( + self, iteration: int, feval: Optional[Metric], output_margin: bool + ) -> List[str]: + """Iterate through folds for eval""" + result = [f.eval(iteration, feval, output_margin) for f in self.cvfolds] + return result + + def set_attr(self, **kwargs: Optional[Any]) -> Any: + """Iterate through folds for setting attributes""" + for f in self.cvfolds: + f.bst.set_attr(**kwargs) + + def attr(self, key: str) -> Optional[str]: + """Redirect to booster attr.""" + return self.cvfolds[0].bst.attr(key) + + def set_param( + self, + params: Union[Dict, Iterable[Tuple[str, Any]], str], + value: Optional[str] = None, + ) -> None: + """Iterate through folds for set_param""" + for f in self.cvfolds: + f.bst.set_param(params, value) + + def num_boosted_rounds(self) -> int: + """Number of boosted rounds.""" + return self.cvfolds[0].num_boosted_rounds() + + @property + def best_iteration(self) -> int: + """Get best_iteration""" + return int(cast(int, self.cvfolds[0].bst.attr("best_iteration"))) + + @best_iteration.setter + def best_iteration(self, iteration: int) -> None: + """Get best_iteration""" + self.set_attr(best_iteration=iteration) + + @property + def best_score(self) -> float: + """Get best_score.""" + return float(cast(float, self.cvfolds[0].bst.attr("best_score"))) + + @best_score.setter + def best_score(self, score: float) -> None: + self.set_attr(best_score=score) + + +def groups_to_rows(groups: np.ndarray, boundaries: np.ndarray) -> np.ndarray: + """ + Given group row boundaries, convert ground indexes to row indexes + :param groups: list of groups for testing + :param boundaries: rows index limits of each group + :return: row in group + """ + return np.concatenate([np.arange(boundaries[g], boundaries[g + 1]) for g in groups]) + + +def mkgroupfold( + *, + dall: DMatrix, + nfold: int, + param: BoosterParam, + evals: Sequence[str] = (), + fpreproc: Optional[FPreProcCallable] = None, + shuffle: bool = True, +) -> List[CVPack]: + """ + Make n folds for cross-validation maintaining groups + :return: cross-validation folds + """ + # we have groups for pairwise ranking... get a list of the group indexes + group_boundaries = dall.get_uint_info("group_ptr") + group_sizes = np.diff(group_boundaries) + + if shuffle is True: + idx = np.random.permutation(len(group_sizes)) + else: + idx = np.arange(len(group_sizes)) + # list by fold of test group indexes + out_group_idset = np.array_split(idx, nfold) + # list by fold of train group indexes + in_group_idset = [ + np.concatenate([out_group_idset[i] for i in range(nfold) if k != i]) + for k in range(nfold) + ] + # from the group indexes, convert them to row indexes + in_idset = [ + groups_to_rows(in_groups, group_boundaries) for in_groups in in_group_idset + ] + out_idset = [ + groups_to_rows(out_groups, group_boundaries) for out_groups in out_group_idset + ] + + # build the folds by taking the appropriate slices + ret = [] + for k in range(nfold): + # perform the slicing using the indexes determined by the above methods + dtrain = dall.slice(in_idset[k], allow_groups=True) + dtrain.set_group(group_sizes[in_group_idset[k]]) + dtest = dall.slice(out_idset[k], allow_groups=True) + dtest.set_group(group_sizes[out_group_idset[k]]) + # run preprocessing on the data set if needed + if fpreproc is not None: + dtrain, dtest, tparam = fpreproc(dtrain, dtest, param.copy()) + else: + tparam = param + plst = list(tparam.items()) + [("eval_metric", itm) for itm in evals] + ret.append(CVPack(dtrain, dtest, plst)) + return ret + + +def mknfold( + *, + dall: DMatrix, + nfold: int, + param: BoosterParam, + seed: int, + evals: Sequence[str] = (), + fpreproc: Optional[FPreProcCallable] = None, + stratified: Optional[bool] = False, + folds: Optional[XGBStratifiedKFold] = None, + shuffle: bool = True, +) -> List[CVPack]: + """ + Make an n-fold list of CVPack from random indices. + """ + evals = list(evals) + np.random.seed(seed) + + if stratified is False and folds is None: + # Do standard k-fold cross validation. Automatically determine the folds. + if len(dall.get_uint_info("group_ptr")) > 1: + return mkgroupfold( + dall=dall, + nfold=nfold, + param=param, + evals=evals, + fpreproc=fpreproc, + shuffle=shuffle, + ) + + if shuffle is True: + idx = np.random.permutation(dall.num_row()) + else: + idx = np.arange(dall.num_row()) + out_idset = np.array_split(idx, nfold) + in_idset = [ + np.concatenate([out_idset[i] for i in range(nfold) if k != i]) + for k in range(nfold) + ] + elif folds is not None: + # Use user specified custom split using indices + try: + in_idset = [x[0] for x in folds] + out_idset = [x[1] for x in folds] + except TypeError: + # Custom stratification using Sklearn KFoldSplit object + splits = list(folds.split(X=dall.get_label(), y=dall.get_label())) + in_idset = [x[0] for x in splits] + out_idset = [x[1] for x in splits] + nfold = len(out_idset) + else: + # Do standard stratefied shuffle k-fold split + sfk = XGBStratifiedKFold(n_splits=nfold, shuffle=True, random_state=seed) + splits = list(sfk.split(X=dall.get_label(), y=dall.get_label())) + in_idset = [x[0] for x in splits] + out_idset = [x[1] for x in splits] + nfold = len(out_idset) + + ret = [] + for k in range(nfold): + # perform the slicing using the indexes determined by the above methods + dtrain = dall.slice(in_idset[k]) + dtest = dall.slice(out_idset[k]) + # run preprocessing on the data set if needed + if fpreproc is not None: + dtrain, dtest, tparam = fpreproc(dtrain, dtest, param.copy()) + else: + tparam = param + plst = list(tparam.items()) + [("eval_metric", itm) for itm in evals] + ret.append(CVPack(dtrain, dtest, plst)) + return ret + + +@_deprecate_positional_args +def cv( + params: BoosterParam, + dtrain: DMatrix, + num_boost_round: int = 10, + *, + nfold: int = 3, + stratified: bool = False, + folds: XGBStratifiedKFold = None, + metrics: Sequence[str] = (), + obj: Optional[PlainObj] = None, + maximize: Optional[bool] = None, + early_stopping_rounds: Optional[int] = None, + fpreproc: Optional[FPreProcCallable] = None, + as_pandas: bool = True, + verbose_eval: Optional[Union[int, bool]] = None, + show_stdv: bool = True, + seed: int = 0, + callbacks: Optional[Sequence[TrainingCallback]] = None, + shuffle: bool = True, + custom_metric: Optional[Metric] = None, +) -> Union[Dict[str, float], "PdDataFrame"]: + """Cross-validation with given parameters. + + Parameters + ---------- + params : dict + Booster params. + dtrain : + Data to be trained. Only the :py:class:`DMatrix` without external memory is + supported. + num_boost_round : + Number of boosting iterations. + nfold : int + Number of folds in CV. + stratified : bool + Perform stratified sampling. + folds : a KFold or StratifiedKFold instance or list of fold indices + Sklearn KFolds or StratifiedKFolds object. + Alternatively may explicitly pass sample indices for each fold. + For ``n`` folds, **folds** should be a length ``n`` list of tuples. + Each tuple is ``(in,out)`` where ``in`` is a list of indices to be used + as the training samples for the ``n`` th fold and ``out`` is a list of + indices to be used as the testing samples for the ``n`` th fold. + metrics : string or list of strings + Evaluation metrics to be watched in CV. + obj : + + Custom objective function. See :doc:`Custom Objective + ` for details. + + maximize : bool + Whether to maximize the evaluataion metric (score or error). + + early_stopping_rounds: int + Activates early stopping. Cross-Validation metric (average of validation + metric computed over CV folds) needs to improve at least once in + every **early_stopping_rounds** round(s) to continue training. + The last entry in the evaluation history will represent the best iteration. + If there's more than one metric in the **eval_metric** parameter given in + **params**, the last metric will be used for early stopping. + fpreproc : function + Preprocessing function that takes (dtrain, dtest, param) and returns + transformed versions of those. + as_pandas : bool, default True + Return pd.DataFrame when pandas is installed. + If False or pandas is not installed, return np.ndarray + verbose_eval : bool, int, or None, default None + Whether to display the progress. If None, progress will be displayed + when np.ndarray is returned. If True, progress will be displayed at + boosting stage. If an integer is given, progress will be displayed + at every given `verbose_eval` boosting stage. + show_stdv : bool, default True + Whether to display the standard deviation in progress. + Results are not affected, and always contains std. + seed : int + Seed used to generate the folds (passed to numpy.random.seed). + callbacks : + List of callback functions that are applied at end of each iteration. + It is possible to use predefined callbacks by using + :ref:`Callback API `. + + .. note:: + + States in callback are not preserved during training, which means callback + objects can not be reused for multiple training sessions without + reinitialization or deepcopy. + + .. code-block:: python + + for params in parameters_grid: + # be sure to (re)initialize the callbacks before each run + callbacks = [xgb.callback.LearningRateScheduler(custom_rates)] + xgboost.train(params, Xy, callbacks=callbacks) + + shuffle : bool + Shuffle data before creating folds. + custom_metric : + + .. versionadded 1.6.0 + + Custom metric function. See :doc:`Custom Metric ` + for details. + + Returns + ------- + evaluation history : list(string) + """ + if stratified is True and not SKLEARN_INSTALLED: + raise XGBoostError( + "sklearn needs to be installed in order to use stratified cv" + ) + if isinstance(metrics, str): + metrics = [metrics] + if isinstance(dtrain, _RefMixIn): + raise ValueError("`QuantileDMatrix` is not yet supported.") + + params = params.copy() + if isinstance(params, list): + _metrics = [x[1] for x in params if x[0] == "eval_metric"] + params = dict(params) + if "eval_metric" in params: + params["eval_metric"] = _metrics + + if (not metrics) and "eval_metric" in params: + if isinstance(params["eval_metric"], list): + metrics = params["eval_metric"] + else: + metrics = [params["eval_metric"]] + + params.pop("eval_metric", None) + + results: Dict[str, List[float]] = {} + cvfolds = mknfold( + dall=dtrain, + nfold=nfold, + param=params, + seed=seed, + evals=metrics, + fpreproc=fpreproc, + stratified=stratified, + folds=folds, + shuffle=shuffle, + ) + + # setup callbacks + callbacks = [] if callbacks is None else copy.copy(list(callbacks)) + + if verbose_eval: + verbose_eval = 1 if verbose_eval is True else verbose_eval + callbacks.append(EvaluationMonitor(period=verbose_eval, show_stdv=show_stdv)) + if early_stopping_rounds: + callbacks.append(EarlyStopping(rounds=early_stopping_rounds, maximize=maximize)) + callbacks_container = CallbackContainer( + callbacks, metric=custom_metric, is_cv=True, output_margin=callable(obj) + ) + + booster = _PackedBooster(cvfolds) + callbacks_container.before_training(booster) + + for i in range(num_boost_round): + if callbacks_container.before_iteration(booster, i, dtrain, None): + break + booster.update(i, obj) + + should_break = callbacks_container.after_iteration(booster, i, dtrain, None) + res = callbacks_container.aggregated_cv + for key, mean, std in cast(List[Tuple[str, float, float]], res): + if key + "-mean" not in results: + results[key + "-mean"] = [] + if key + "-std" not in results: + results[key + "-std"] = [] + results[key + "-mean"].append(mean) + results[key + "-std"].append(std) + + if should_break: + for k in results.keys(): # pylint: disable=consider-iterating-dictionary + results[k] = results[k][: (booster.best_iteration + 1)] + break + if as_pandas: + try: + import pandas as pd + + results = pd.DataFrame.from_dict(results) + except ImportError: + pass + + callbacks_container.after_training(booster) + + return results diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/yaml/__init__.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/yaml/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..d58f0891737def7f38e5d86dde2dbf9be0c13dce --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/yaml/__init__.py @@ -0,0 +1,390 @@ + +from .error import * + +from .tokens import * +from .events import * +from .nodes import * + +from .loader import * +from .dumper import * + +__version__ = '6.0.3' +try: + from .cyaml import * + __with_libyaml__ = True +except ImportError: + __with_libyaml__ = False + +import io + +#------------------------------------------------------------------------------ +# XXX "Warnings control" is now deprecated. Leaving in the API function to not +# break code that uses it. +#------------------------------------------------------------------------------ +def warnings(settings=None): + if settings is None: + return {} + +#------------------------------------------------------------------------------ +def scan(stream, Loader=Loader): + """ + Scan a YAML stream and produce scanning tokens. + """ + loader = Loader(stream) + try: + while loader.check_token(): + yield loader.get_token() + finally: + loader.dispose() + +def parse(stream, Loader=Loader): + """ + Parse a YAML stream and produce parsing events. + """ + loader = Loader(stream) + try: + while loader.check_event(): + yield loader.get_event() + finally: + loader.dispose() + +def compose(stream, Loader=Loader): + """ + Parse the first YAML document in a stream + and produce the corresponding representation tree. + """ + loader = Loader(stream) + try: + return loader.get_single_node() + finally: + loader.dispose() + +def compose_all(stream, Loader=Loader): + """ + Parse all YAML documents in a stream + and produce corresponding representation trees. + """ + loader = Loader(stream) + try: + while loader.check_node(): + yield loader.get_node() + finally: + loader.dispose() + +def load(stream, Loader): + """ + Parse the first YAML document in a stream + and produce the corresponding Python object. + """ + loader = Loader(stream) + try: + return loader.get_single_data() + finally: + loader.dispose() + +def load_all(stream, Loader): + """ + Parse all YAML documents in a stream + and produce corresponding Python objects. + """ + loader = Loader(stream) + try: + while loader.check_data(): + yield loader.get_data() + finally: + loader.dispose() + +def full_load(stream): + """ + Parse the first YAML document in a stream + and produce the corresponding Python object. + + Resolve all tags except those known to be + unsafe on untrusted input. + """ + return load(stream, FullLoader) + +def full_load_all(stream): + """ + Parse all YAML documents in a stream + and produce corresponding Python objects. + + Resolve all tags except those known to be + unsafe on untrusted input. + """ + return load_all(stream, FullLoader) + +def safe_load(stream): + """ + Parse the first YAML document in a stream + and produce the corresponding Python object. + + Resolve only basic YAML tags. This is known + to be safe for untrusted input. + """ + return load(stream, SafeLoader) + +def safe_load_all(stream): + """ + Parse all YAML documents in a stream + and produce corresponding Python objects. + + Resolve only basic YAML tags. This is known + to be safe for untrusted input. + """ + return load_all(stream, SafeLoader) + +def unsafe_load(stream): + """ + Parse the first YAML document in a stream + and produce the corresponding Python object. + + Resolve all tags, even those known to be + unsafe on untrusted input. + """ + return load(stream, UnsafeLoader) + +def unsafe_load_all(stream): + """ + Parse all YAML documents in a stream + and produce corresponding Python objects. + + Resolve all tags, even those known to be + unsafe on untrusted input. + """ + return load_all(stream, UnsafeLoader) + +def emit(events, stream=None, Dumper=Dumper, + canonical=None, indent=None, width=None, + allow_unicode=None, line_break=None): + """ + Emit YAML parsing events into a stream. + If stream is None, return the produced string instead. + """ + getvalue = None + if stream is None: + stream = io.StringIO() + getvalue = stream.getvalue + dumper = Dumper(stream, canonical=canonical, indent=indent, width=width, + allow_unicode=allow_unicode, line_break=line_break) + try: + for event in events: + dumper.emit(event) + finally: + dumper.dispose() + if getvalue: + return getvalue() + +def serialize_all(nodes, stream=None, Dumper=Dumper, + canonical=None, indent=None, width=None, + allow_unicode=None, line_break=None, + encoding=None, explicit_start=None, explicit_end=None, + version=None, tags=None): + """ + Serialize a sequence of representation trees into a YAML stream. + If stream is None, return the produced string instead. + """ + getvalue = None + if stream is None: + if encoding is None: + stream = io.StringIO() + else: + stream = io.BytesIO() + getvalue = stream.getvalue + dumper = Dumper(stream, canonical=canonical, indent=indent, width=width, + allow_unicode=allow_unicode, line_break=line_break, + encoding=encoding, version=version, tags=tags, + explicit_start=explicit_start, explicit_end=explicit_end) + try: + dumper.open() + for node in nodes: + dumper.serialize(node) + dumper.close() + finally: + dumper.dispose() + if getvalue: + return getvalue() + +def serialize(node, stream=None, Dumper=Dumper, **kwds): + """ + Serialize a representation tree into a YAML stream. + If stream is None, return the produced string instead. + """ + return serialize_all([node], stream, Dumper=Dumper, **kwds) + +def dump_all(documents, stream=None, Dumper=Dumper, + default_style=None, default_flow_style=False, + canonical=None, indent=None, width=None, + allow_unicode=None, line_break=None, + encoding=None, explicit_start=None, explicit_end=None, + version=None, tags=None, sort_keys=True): + """ + Serialize a sequence of Python objects into a YAML stream. + If stream is None, return the produced string instead. + """ + getvalue = None + if stream is None: + if encoding is None: + stream = io.StringIO() + else: + stream = io.BytesIO() + getvalue = stream.getvalue + dumper = Dumper(stream, default_style=default_style, + default_flow_style=default_flow_style, + canonical=canonical, indent=indent, width=width, + allow_unicode=allow_unicode, line_break=line_break, + encoding=encoding, version=version, tags=tags, + explicit_start=explicit_start, explicit_end=explicit_end, sort_keys=sort_keys) + try: + dumper.open() + for data in documents: + dumper.represent(data) + dumper.close() + finally: + dumper.dispose() + if getvalue: + return getvalue() + +def dump(data, stream=None, Dumper=Dumper, **kwds): + """ + Serialize a Python object into a YAML stream. + If stream is None, return the produced string instead. + """ + return dump_all([data], stream, Dumper=Dumper, **kwds) + +def safe_dump_all(documents, stream=None, **kwds): + """ + Serialize a sequence of Python objects into a YAML stream. + Produce only basic YAML tags. + If stream is None, return the produced string instead. + """ + return dump_all(documents, stream, Dumper=SafeDumper, **kwds) + +def safe_dump(data, stream=None, **kwds): + """ + Serialize a Python object into a YAML stream. + Produce only basic YAML tags. + If stream is None, return the produced string instead. + """ + return dump_all([data], stream, Dumper=SafeDumper, **kwds) + +def add_implicit_resolver(tag, regexp, first=None, + Loader=None, Dumper=Dumper): + """ + Add an implicit scalar detector. + If an implicit scalar value matches the given regexp, + the corresponding tag is assigned to the scalar. + first is a sequence of possible initial characters or None. + """ + if Loader is None: + loader.Loader.add_implicit_resolver(tag, regexp, first) + loader.FullLoader.add_implicit_resolver(tag, regexp, first) + loader.UnsafeLoader.add_implicit_resolver(tag, regexp, first) + else: + Loader.add_implicit_resolver(tag, regexp, first) + Dumper.add_implicit_resolver(tag, regexp, first) + +def add_path_resolver(tag, path, kind=None, Loader=None, Dumper=Dumper): + """ + Add a path based resolver for the given tag. + A path is a list of keys that forms a path + to a node in the representation tree. + Keys can be string values, integers, or None. + """ + if Loader is None: + loader.Loader.add_path_resolver(tag, path, kind) + loader.FullLoader.add_path_resolver(tag, path, kind) + loader.UnsafeLoader.add_path_resolver(tag, path, kind) + else: + Loader.add_path_resolver(tag, path, kind) + Dumper.add_path_resolver(tag, path, kind) + +def add_constructor(tag, constructor, Loader=None): + """ + Add a constructor for the given tag. + Constructor is a function that accepts a Loader instance + and a node object and produces the corresponding Python object. + """ + if Loader is None: + loader.Loader.add_constructor(tag, constructor) + loader.FullLoader.add_constructor(tag, constructor) + loader.UnsafeLoader.add_constructor(tag, constructor) + else: + Loader.add_constructor(tag, constructor) + +def add_multi_constructor(tag_prefix, multi_constructor, Loader=None): + """ + Add a multi-constructor for the given tag prefix. + Multi-constructor is called for a node if its tag starts with tag_prefix. + Multi-constructor accepts a Loader instance, a tag suffix, + and a node object and produces the corresponding Python object. + """ + if Loader is None: + loader.Loader.add_multi_constructor(tag_prefix, multi_constructor) + loader.FullLoader.add_multi_constructor(tag_prefix, multi_constructor) + loader.UnsafeLoader.add_multi_constructor(tag_prefix, multi_constructor) + else: + Loader.add_multi_constructor(tag_prefix, multi_constructor) + +def add_representer(data_type, representer, Dumper=Dumper): + """ + Add a representer for the given type. + Representer is a function accepting a Dumper instance + and an instance of the given data type + and producing the corresponding representation node. + """ + Dumper.add_representer(data_type, representer) + +def add_multi_representer(data_type, multi_representer, Dumper=Dumper): + """ + Add a representer for the given type. + Multi-representer is a function accepting a Dumper instance + and an instance of the given data type or subtype + and producing the corresponding representation node. + """ + Dumper.add_multi_representer(data_type, multi_representer) + +class YAMLObjectMetaclass(type): + """ + The metaclass for YAMLObject. + """ + def __init__(cls, name, bases, kwds): + super(YAMLObjectMetaclass, cls).__init__(name, bases, kwds) + if 'yaml_tag' in kwds and kwds['yaml_tag'] is not None: + if isinstance(cls.yaml_loader, list): + for loader in cls.yaml_loader: + loader.add_constructor(cls.yaml_tag, cls.from_yaml) + else: + cls.yaml_loader.add_constructor(cls.yaml_tag, cls.from_yaml) + + cls.yaml_dumper.add_representer(cls, cls.to_yaml) + +class YAMLObject(metaclass=YAMLObjectMetaclass): + """ + An object that can dump itself to a YAML stream + and load itself from a YAML stream. + """ + + __slots__ = () # no direct instantiation, so allow immutable subclasses + + yaml_loader = [Loader, FullLoader, UnsafeLoader] + yaml_dumper = Dumper + + yaml_tag = None + yaml_flow_style = None + + @classmethod + def from_yaml(cls, loader, node): + """ + Convert a representation node to a Python object. + """ + return loader.construct_yaml_object(node, cls) + + @classmethod + def to_yaml(cls, dumper, data): + """ + Convert a Python object to a representation node. + """ + return dumper.represent_yaml_object(cls.yaml_tag, data, cls, + flow_style=cls.yaml_flow_style) + diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/yaml/composer.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/yaml/composer.py new file mode 100644 index 0000000000000000000000000000000000000000..6d15cb40e3b4198819c91c6f8d8b32807fcf53b2 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/yaml/composer.py @@ -0,0 +1,139 @@ + +__all__ = ['Composer', 'ComposerError'] + +from .error import MarkedYAMLError +from .events import * +from .nodes import * + +class ComposerError(MarkedYAMLError): + pass + +class Composer: + + def __init__(self): + self.anchors = {} + + def check_node(self): + # Drop the STREAM-START event. + if self.check_event(StreamStartEvent): + self.get_event() + + # If there are more documents available? + return not self.check_event(StreamEndEvent) + + def get_node(self): + # Get the root node of the next document. + if not self.check_event(StreamEndEvent): + return self.compose_document() + + def get_single_node(self): + # Drop the STREAM-START event. + self.get_event() + + # Compose a document if the stream is not empty. + document = None + if not self.check_event(StreamEndEvent): + document = self.compose_document() + + # Ensure that the stream contains no more documents. + if not self.check_event(StreamEndEvent): + event = self.get_event() + raise ComposerError("expected a single document in the stream", + document.start_mark, "but found another document", + event.start_mark) + + # Drop the STREAM-END event. + self.get_event() + + return document + + def compose_document(self): + # Drop the DOCUMENT-START event. + self.get_event() + + # Compose the root node. + node = self.compose_node(None, None) + + # Drop the DOCUMENT-END event. + self.get_event() + + self.anchors = {} + return node + + def compose_node(self, parent, index): + if self.check_event(AliasEvent): + event = self.get_event() + anchor = event.anchor + if anchor not in self.anchors: + raise ComposerError(None, None, "found undefined alias %r" + % anchor, event.start_mark) + return self.anchors[anchor] + event = self.peek_event() + anchor = event.anchor + if anchor is not None: + if anchor in self.anchors: + raise ComposerError("found duplicate anchor %r; first occurrence" + % anchor, self.anchors[anchor].start_mark, + "second occurrence", event.start_mark) + self.descend_resolver(parent, index) + if self.check_event(ScalarEvent): + node = self.compose_scalar_node(anchor) + elif self.check_event(SequenceStartEvent): + node = self.compose_sequence_node(anchor) + elif self.check_event(MappingStartEvent): + node = self.compose_mapping_node(anchor) + self.ascend_resolver() + return node + + def compose_scalar_node(self, anchor): + event = self.get_event() + tag = event.tag + if tag is None or tag == '!': + tag = self.resolve(ScalarNode, event.value, event.implicit) + node = ScalarNode(tag, event.value, + event.start_mark, event.end_mark, style=event.style) + if anchor is not None: + self.anchors[anchor] = node + return node + + def compose_sequence_node(self, anchor): + start_event = self.get_event() + tag = start_event.tag + if tag is None or tag == '!': + tag = self.resolve(SequenceNode, None, start_event.implicit) + node = SequenceNode(tag, [], + start_event.start_mark, None, + flow_style=start_event.flow_style) + if anchor is not None: + self.anchors[anchor] = node + index = 0 + while not self.check_event(SequenceEndEvent): + node.value.append(self.compose_node(node, index)) + index += 1 + end_event = self.get_event() + node.end_mark = end_event.end_mark + return node + + def compose_mapping_node(self, anchor): + start_event = self.get_event() + tag = start_event.tag + if tag is None or tag == '!': + tag = self.resolve(MappingNode, None, start_event.implicit) + node = MappingNode(tag, [], + start_event.start_mark, None, + flow_style=start_event.flow_style) + if anchor is not None: + self.anchors[anchor] = node + while not self.check_event(MappingEndEvent): + #key_event = self.peek_event() + item_key = self.compose_node(node, None) + #if item_key in node.value: + # raise ComposerError("while composing a mapping", start_event.start_mark, + # "found duplicate key", key_event.start_mark) + item_value = self.compose_node(node, item_key) + #node.value[item_key] = item_value + node.value.append((item_key, item_value)) + end_event = self.get_event() + node.end_mark = end_event.end_mark + return node + diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/yaml/constructor.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/yaml/constructor.py new file mode 100644 index 0000000000000000000000000000000000000000..619acd3070a4845c653fcf22a626e05158035bc2 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/yaml/constructor.py @@ -0,0 +1,748 @@ + +__all__ = [ + 'BaseConstructor', + 'SafeConstructor', + 'FullConstructor', + 'UnsafeConstructor', + 'Constructor', + 'ConstructorError' +] + +from .error import * +from .nodes import * + +import collections.abc, datetime, base64, binascii, re, sys, types + +class ConstructorError(MarkedYAMLError): + pass + +class BaseConstructor: + + yaml_constructors = {} + yaml_multi_constructors = {} + + def __init__(self): + self.constructed_objects = {} + self.recursive_objects = {} + self.state_generators = [] + self.deep_construct = False + + def check_data(self): + # If there are more documents available? + return self.check_node() + + def check_state_key(self, key): + """Block special attributes/methods from being set in a newly created + object, to prevent user-controlled methods from being called during + deserialization""" + if self.get_state_keys_blacklist_regexp().match(key): + raise ConstructorError(None, None, + "blacklisted key '%s' in instance state found" % (key,), None) + + def get_data(self): + # Construct and return the next document. + if self.check_node(): + return self.construct_document(self.get_node()) + + def get_single_data(self): + # Ensure that the stream contains a single document and construct it. + node = self.get_single_node() + if node is not None: + return self.construct_document(node) + return None + + def construct_document(self, node): + data = self.construct_object(node) + while self.state_generators: + state_generators = self.state_generators + self.state_generators = [] + for generator in state_generators: + for dummy in generator: + pass + self.constructed_objects = {} + self.recursive_objects = {} + self.deep_construct = False + return data + + def construct_object(self, node, deep=False): + if node in self.constructed_objects: + return self.constructed_objects[node] + if deep: + old_deep = self.deep_construct + self.deep_construct = True + if node in self.recursive_objects: + raise ConstructorError(None, None, + "found unconstructable recursive node", node.start_mark) + self.recursive_objects[node] = None + constructor = None + tag_suffix = None + if node.tag in self.yaml_constructors: + constructor = self.yaml_constructors[node.tag] + else: + for tag_prefix in self.yaml_multi_constructors: + if tag_prefix is not None and node.tag.startswith(tag_prefix): + tag_suffix = node.tag[len(tag_prefix):] + constructor = self.yaml_multi_constructors[tag_prefix] + break + else: + if None in self.yaml_multi_constructors: + tag_suffix = node.tag + constructor = self.yaml_multi_constructors[None] + elif None in self.yaml_constructors: + constructor = self.yaml_constructors[None] + elif isinstance(node, ScalarNode): + constructor = self.__class__.construct_scalar + elif isinstance(node, SequenceNode): + constructor = self.__class__.construct_sequence + elif isinstance(node, MappingNode): + constructor = self.__class__.construct_mapping + if tag_suffix is None: + data = constructor(self, node) + else: + data = constructor(self, tag_suffix, node) + if isinstance(data, types.GeneratorType): + generator = data + data = next(generator) + if self.deep_construct: + for dummy in generator: + pass + else: + self.state_generators.append(generator) + self.constructed_objects[node] = data + del self.recursive_objects[node] + if deep: + self.deep_construct = old_deep + return data + + def construct_scalar(self, node): + if not isinstance(node, ScalarNode): + raise ConstructorError(None, None, + "expected a scalar node, but found %s" % node.id, + node.start_mark) + return node.value + + def construct_sequence(self, node, deep=False): + if not isinstance(node, SequenceNode): + raise ConstructorError(None, None, + "expected a sequence node, but found %s" % node.id, + node.start_mark) + return [self.construct_object(child, deep=deep) + for child in node.value] + + def construct_mapping(self, node, deep=False): + if not isinstance(node, MappingNode): + raise ConstructorError(None, None, + "expected a mapping node, but found %s" % node.id, + node.start_mark) + mapping = {} + for key_node, value_node in node.value: + key = self.construct_object(key_node, deep=deep) + if not isinstance(key, collections.abc.Hashable): + raise ConstructorError("while constructing a mapping", node.start_mark, + "found unhashable key", key_node.start_mark) + value = self.construct_object(value_node, deep=deep) + mapping[key] = value + return mapping + + def construct_pairs(self, node, deep=False): + if not isinstance(node, MappingNode): + raise ConstructorError(None, None, + "expected a mapping node, but found %s" % node.id, + node.start_mark) + pairs = [] + for key_node, value_node in node.value: + key = self.construct_object(key_node, deep=deep) + value = self.construct_object(value_node, deep=deep) + pairs.append((key, value)) + return pairs + + @classmethod + def add_constructor(cls, tag, constructor): + if not 'yaml_constructors' in cls.__dict__: + cls.yaml_constructors = cls.yaml_constructors.copy() + cls.yaml_constructors[tag] = constructor + + @classmethod + def add_multi_constructor(cls, tag_prefix, multi_constructor): + if not 'yaml_multi_constructors' in cls.__dict__: + cls.yaml_multi_constructors = cls.yaml_multi_constructors.copy() + cls.yaml_multi_constructors[tag_prefix] = multi_constructor + +class SafeConstructor(BaseConstructor): + + def construct_scalar(self, node): + if isinstance(node, MappingNode): + for key_node, value_node in node.value: + if key_node.tag == 'tag:yaml.org,2002:value': + return self.construct_scalar(value_node) + return super().construct_scalar(node) + + def flatten_mapping(self, node): + merge = [] + index = 0 + while index < len(node.value): + key_node, value_node = node.value[index] + if key_node.tag == 'tag:yaml.org,2002:merge': + del node.value[index] + if isinstance(value_node, MappingNode): + self.flatten_mapping(value_node) + merge.extend(value_node.value) + elif isinstance(value_node, SequenceNode): + submerge = [] + for subnode in value_node.value: + if not isinstance(subnode, MappingNode): + raise ConstructorError("while constructing a mapping", + node.start_mark, + "expected a mapping for merging, but found %s" + % subnode.id, subnode.start_mark) + self.flatten_mapping(subnode) + submerge.append(subnode.value) + submerge.reverse() + for value in submerge: + merge.extend(value) + else: + raise ConstructorError("while constructing a mapping", node.start_mark, + "expected a mapping or list of mappings for merging, but found %s" + % value_node.id, value_node.start_mark) + elif key_node.tag == 'tag:yaml.org,2002:value': + key_node.tag = 'tag:yaml.org,2002:str' + index += 1 + else: + index += 1 + if merge: + node.value = merge + node.value + + def construct_mapping(self, node, deep=False): + if isinstance(node, MappingNode): + self.flatten_mapping(node) + return super().construct_mapping(node, deep=deep) + + def construct_yaml_null(self, node): + self.construct_scalar(node) + return None + + bool_values = { + 'yes': True, + 'no': False, + 'true': True, + 'false': False, + 'on': True, + 'off': False, + } + + def construct_yaml_bool(self, node): + value = self.construct_scalar(node) + return self.bool_values[value.lower()] + + def construct_yaml_int(self, node): + value = self.construct_scalar(node) + value = value.replace('_', '') + sign = +1 + if value[0] == '-': + sign = -1 + if value[0] in '+-': + value = value[1:] + if value == '0': + return 0 + elif value.startswith('0b'): + return sign*int(value[2:], 2) + elif value.startswith('0x'): + return sign*int(value[2:], 16) + elif value[0] == '0': + return sign*int(value, 8) + elif ':' in value: + digits = [int(part) for part in value.split(':')] + digits.reverse() + base = 1 + value = 0 + for digit in digits: + value += digit*base + base *= 60 + return sign*value + else: + return sign*int(value) + + inf_value = 1e300 + while inf_value != inf_value*inf_value: + inf_value *= inf_value + nan_value = -inf_value/inf_value # Trying to make a quiet NaN (like C99). + + def construct_yaml_float(self, node): + value = self.construct_scalar(node) + value = value.replace('_', '').lower() + sign = +1 + if value[0] == '-': + sign = -1 + if value[0] in '+-': + value = value[1:] + if value == '.inf': + return sign*self.inf_value + elif value == '.nan': + return self.nan_value + elif ':' in value: + digits = [float(part) for part in value.split(':')] + digits.reverse() + base = 1 + value = 0.0 + for digit in digits: + value += digit*base + base *= 60 + return sign*value + else: + return sign*float(value) + + def construct_yaml_binary(self, node): + try: + value = self.construct_scalar(node).encode('ascii') + except UnicodeEncodeError as exc: + raise ConstructorError(None, None, + "failed to convert base64 data into ascii: %s" % exc, + node.start_mark) + try: + if hasattr(base64, 'decodebytes'): + return base64.decodebytes(value) + else: + return base64.decodestring(value) + except binascii.Error as exc: + raise ConstructorError(None, None, + "failed to decode base64 data: %s" % exc, node.start_mark) + + timestamp_regexp = re.compile( + r'''^(?P[0-9][0-9][0-9][0-9]) + -(?P[0-9][0-9]?) + -(?P[0-9][0-9]?) + (?:(?:[Tt]|[ \t]+) + (?P[0-9][0-9]?) + :(?P[0-9][0-9]) + :(?P[0-9][0-9]) + (?:\.(?P[0-9]*))? + (?:[ \t]*(?PZ|(?P[-+])(?P[0-9][0-9]?) + (?::(?P[0-9][0-9]))?))?)?$''', re.X) + + def construct_yaml_timestamp(self, node): + value = self.construct_scalar(node) + match = self.timestamp_regexp.match(node.value) + values = match.groupdict() + year = int(values['year']) + month = int(values['month']) + day = int(values['day']) + if not values['hour']: + return datetime.date(year, month, day) + hour = int(values['hour']) + minute = int(values['minute']) + second = int(values['second']) + fraction = 0 + tzinfo = None + if values['fraction']: + fraction = values['fraction'][:6] + while len(fraction) < 6: + fraction += '0' + fraction = int(fraction) + if values['tz_sign']: + tz_hour = int(values['tz_hour']) + tz_minute = int(values['tz_minute'] or 0) + delta = datetime.timedelta(hours=tz_hour, minutes=tz_minute) + if values['tz_sign'] == '-': + delta = -delta + tzinfo = datetime.timezone(delta) + elif values['tz']: + tzinfo = datetime.timezone.utc + return datetime.datetime(year, month, day, hour, minute, second, fraction, + tzinfo=tzinfo) + + def construct_yaml_omap(self, node): + # Note: we do not check for duplicate keys, because it's too + # CPU-expensive. + omap = [] + yield omap + if not isinstance(node, SequenceNode): + raise ConstructorError("while constructing an ordered map", node.start_mark, + "expected a sequence, but found %s" % node.id, node.start_mark) + for subnode in node.value: + if not isinstance(subnode, MappingNode): + raise ConstructorError("while constructing an ordered map", node.start_mark, + "expected a mapping of length 1, but found %s" % subnode.id, + subnode.start_mark) + if len(subnode.value) != 1: + raise ConstructorError("while constructing an ordered map", node.start_mark, + "expected a single mapping item, but found %d items" % len(subnode.value), + subnode.start_mark) + key_node, value_node = subnode.value[0] + key = self.construct_object(key_node) + value = self.construct_object(value_node) + omap.append((key, value)) + + def construct_yaml_pairs(self, node): + # Note: the same code as `construct_yaml_omap`. + pairs = [] + yield pairs + if not isinstance(node, SequenceNode): + raise ConstructorError("while constructing pairs", node.start_mark, + "expected a sequence, but found %s" % node.id, node.start_mark) + for subnode in node.value: + if not isinstance(subnode, MappingNode): + raise ConstructorError("while constructing pairs", node.start_mark, + "expected a mapping of length 1, but found %s" % subnode.id, + subnode.start_mark) + if len(subnode.value) != 1: + raise ConstructorError("while constructing pairs", node.start_mark, + "expected a single mapping item, but found %d items" % len(subnode.value), + subnode.start_mark) + key_node, value_node = subnode.value[0] + key = self.construct_object(key_node) + value = self.construct_object(value_node) + pairs.append((key, value)) + + def construct_yaml_set(self, node): + data = set() + yield data + value = self.construct_mapping(node) + data.update(value) + + def construct_yaml_str(self, node): + return self.construct_scalar(node) + + def construct_yaml_seq(self, node): + data = [] + yield data + data.extend(self.construct_sequence(node)) + + def construct_yaml_map(self, node): + data = {} + yield data + value = self.construct_mapping(node) + data.update(value) + + def construct_yaml_object(self, node, cls): + data = cls.__new__(cls) + yield data + if hasattr(data, '__setstate__'): + state = self.construct_mapping(node, deep=True) + data.__setstate__(state) + else: + state = self.construct_mapping(node) + data.__dict__.update(state) + + def construct_undefined(self, node): + raise ConstructorError(None, None, + "could not determine a constructor for the tag %r" % node.tag, + node.start_mark) + +SafeConstructor.add_constructor( + 'tag:yaml.org,2002:null', + SafeConstructor.construct_yaml_null) + +SafeConstructor.add_constructor( + 'tag:yaml.org,2002:bool', + SafeConstructor.construct_yaml_bool) + +SafeConstructor.add_constructor( + 'tag:yaml.org,2002:int', + SafeConstructor.construct_yaml_int) + +SafeConstructor.add_constructor( + 'tag:yaml.org,2002:float', + SafeConstructor.construct_yaml_float) + +SafeConstructor.add_constructor( + 'tag:yaml.org,2002:binary', + SafeConstructor.construct_yaml_binary) + +SafeConstructor.add_constructor( + 'tag:yaml.org,2002:timestamp', + SafeConstructor.construct_yaml_timestamp) + +SafeConstructor.add_constructor( + 'tag:yaml.org,2002:omap', + SafeConstructor.construct_yaml_omap) + +SafeConstructor.add_constructor( + 'tag:yaml.org,2002:pairs', + SafeConstructor.construct_yaml_pairs) + +SafeConstructor.add_constructor( + 'tag:yaml.org,2002:set', + SafeConstructor.construct_yaml_set) + +SafeConstructor.add_constructor( + 'tag:yaml.org,2002:str', + SafeConstructor.construct_yaml_str) + +SafeConstructor.add_constructor( + 'tag:yaml.org,2002:seq', + SafeConstructor.construct_yaml_seq) + +SafeConstructor.add_constructor( + 'tag:yaml.org,2002:map', + SafeConstructor.construct_yaml_map) + +SafeConstructor.add_constructor(None, + SafeConstructor.construct_undefined) + +class FullConstructor(SafeConstructor): + # 'extend' is blacklisted because it is used by + # construct_python_object_apply to add `listitems` to a newly generate + # python instance + def get_state_keys_blacklist(self): + return ['^extend$', '^__.*__$'] + + def get_state_keys_blacklist_regexp(self): + if not hasattr(self, 'state_keys_blacklist_regexp'): + self.state_keys_blacklist_regexp = re.compile('(' + '|'.join(self.get_state_keys_blacklist()) + ')') + return self.state_keys_blacklist_regexp + + def construct_python_str(self, node): + return self.construct_scalar(node) + + def construct_python_unicode(self, node): + return self.construct_scalar(node) + + def construct_python_bytes(self, node): + try: + value = self.construct_scalar(node).encode('ascii') + except UnicodeEncodeError as exc: + raise ConstructorError(None, None, + "failed to convert base64 data into ascii: %s" % exc, + node.start_mark) + try: + if hasattr(base64, 'decodebytes'): + return base64.decodebytes(value) + else: + return base64.decodestring(value) + except binascii.Error as exc: + raise ConstructorError(None, None, + "failed to decode base64 data: %s" % exc, node.start_mark) + + def construct_python_long(self, node): + return self.construct_yaml_int(node) + + def construct_python_complex(self, node): + return complex(self.construct_scalar(node)) + + def construct_python_tuple(self, node): + return tuple(self.construct_sequence(node)) + + def find_python_module(self, name, mark, unsafe=False): + if not name: + raise ConstructorError("while constructing a Python module", mark, + "expected non-empty name appended to the tag", mark) + if unsafe: + try: + __import__(name) + except ImportError as exc: + raise ConstructorError("while constructing a Python module", mark, + "cannot find module %r (%s)" % (name, exc), mark) + if name not in sys.modules: + raise ConstructorError("while constructing a Python module", mark, + "module %r is not imported" % name, mark) + return sys.modules[name] + + def find_python_name(self, name, mark, unsafe=False): + if not name: + raise ConstructorError("while constructing a Python object", mark, + "expected non-empty name appended to the tag", mark) + if '.' in name: + module_name, object_name = name.rsplit('.', 1) + else: + module_name = 'builtins' + object_name = name + if unsafe: + try: + __import__(module_name) + except ImportError as exc: + raise ConstructorError("while constructing a Python object", mark, + "cannot find module %r (%s)" % (module_name, exc), mark) + if module_name not in sys.modules: + raise ConstructorError("while constructing a Python object", mark, + "module %r is not imported" % module_name, mark) + module = sys.modules[module_name] + if not hasattr(module, object_name): + raise ConstructorError("while constructing a Python object", mark, + "cannot find %r in the module %r" + % (object_name, module.__name__), mark) + return getattr(module, object_name) + + def construct_python_name(self, suffix, node): + value = self.construct_scalar(node) + if value: + raise ConstructorError("while constructing a Python name", node.start_mark, + "expected the empty value, but found %r" % value, node.start_mark) + return self.find_python_name(suffix, node.start_mark) + + def construct_python_module(self, suffix, node): + value = self.construct_scalar(node) + if value: + raise ConstructorError("while constructing a Python module", node.start_mark, + "expected the empty value, but found %r" % value, node.start_mark) + return self.find_python_module(suffix, node.start_mark) + + def make_python_instance(self, suffix, node, + args=None, kwds=None, newobj=False, unsafe=False): + if not args: + args = [] + if not kwds: + kwds = {} + cls = self.find_python_name(suffix, node.start_mark) + if not (unsafe or isinstance(cls, type)): + raise ConstructorError("while constructing a Python instance", node.start_mark, + "expected a class, but found %r" % type(cls), + node.start_mark) + if newobj and isinstance(cls, type): + return cls.__new__(cls, *args, **kwds) + else: + return cls(*args, **kwds) + + def set_python_instance_state(self, instance, state, unsafe=False): + if hasattr(instance, '__setstate__'): + instance.__setstate__(state) + else: + slotstate = {} + if isinstance(state, tuple) and len(state) == 2: + state, slotstate = state + if hasattr(instance, '__dict__'): + if not unsafe and state: + for key in state.keys(): + self.check_state_key(key) + instance.__dict__.update(state) + elif state: + slotstate.update(state) + for key, value in slotstate.items(): + if not unsafe: + self.check_state_key(key) + setattr(instance, key, value) + + def construct_python_object(self, suffix, node): + # Format: + # !!python/object:module.name { ... state ... } + instance = self.make_python_instance(suffix, node, newobj=True) + yield instance + deep = hasattr(instance, '__setstate__') + state = self.construct_mapping(node, deep=deep) + self.set_python_instance_state(instance, state) + + def construct_python_object_apply(self, suffix, node, newobj=False): + # Format: + # !!python/object/apply # (or !!python/object/new) + # args: [ ... arguments ... ] + # kwds: { ... keywords ... } + # state: ... state ... + # listitems: [ ... listitems ... ] + # dictitems: { ... dictitems ... } + # or short format: + # !!python/object/apply [ ... arguments ... ] + # The difference between !!python/object/apply and !!python/object/new + # is how an object is created, check make_python_instance for details. + if isinstance(node, SequenceNode): + args = self.construct_sequence(node, deep=True) + kwds = {} + state = {} + listitems = [] + dictitems = {} + else: + value = self.construct_mapping(node, deep=True) + args = value.get('args', []) + kwds = value.get('kwds', {}) + state = value.get('state', {}) + listitems = value.get('listitems', []) + dictitems = value.get('dictitems', {}) + instance = self.make_python_instance(suffix, node, args, kwds, newobj) + if state: + self.set_python_instance_state(instance, state) + if listitems: + instance.extend(listitems) + if dictitems: + for key in dictitems: + instance[key] = dictitems[key] + return instance + + def construct_python_object_new(self, suffix, node): + return self.construct_python_object_apply(suffix, node, newobj=True) + +FullConstructor.add_constructor( + 'tag:yaml.org,2002:python/none', + FullConstructor.construct_yaml_null) + +FullConstructor.add_constructor( + 'tag:yaml.org,2002:python/bool', + FullConstructor.construct_yaml_bool) + +FullConstructor.add_constructor( + 'tag:yaml.org,2002:python/str', + FullConstructor.construct_python_str) + +FullConstructor.add_constructor( + 'tag:yaml.org,2002:python/unicode', + FullConstructor.construct_python_unicode) + +FullConstructor.add_constructor( + 'tag:yaml.org,2002:python/bytes', + FullConstructor.construct_python_bytes) + +FullConstructor.add_constructor( + 'tag:yaml.org,2002:python/int', + FullConstructor.construct_yaml_int) + +FullConstructor.add_constructor( + 'tag:yaml.org,2002:python/long', + FullConstructor.construct_python_long) + +FullConstructor.add_constructor( + 'tag:yaml.org,2002:python/float', + FullConstructor.construct_yaml_float) + +FullConstructor.add_constructor( + 'tag:yaml.org,2002:python/complex', + FullConstructor.construct_python_complex) + +FullConstructor.add_constructor( + 'tag:yaml.org,2002:python/list', + FullConstructor.construct_yaml_seq) + +FullConstructor.add_constructor( + 'tag:yaml.org,2002:python/tuple', + FullConstructor.construct_python_tuple) + +FullConstructor.add_constructor( + 'tag:yaml.org,2002:python/dict', + FullConstructor.construct_yaml_map) + +FullConstructor.add_multi_constructor( + 'tag:yaml.org,2002:python/name:', + FullConstructor.construct_python_name) + +class UnsafeConstructor(FullConstructor): + + def find_python_module(self, name, mark): + return super(UnsafeConstructor, self).find_python_module(name, mark, unsafe=True) + + def find_python_name(self, name, mark): + return super(UnsafeConstructor, self).find_python_name(name, mark, unsafe=True) + + def make_python_instance(self, suffix, node, args=None, kwds=None, newobj=False): + return super(UnsafeConstructor, self).make_python_instance( + suffix, node, args, kwds, newobj, unsafe=True) + + def set_python_instance_state(self, instance, state): + return super(UnsafeConstructor, self).set_python_instance_state( + instance, state, unsafe=True) + +UnsafeConstructor.add_multi_constructor( + 'tag:yaml.org,2002:python/module:', + UnsafeConstructor.construct_python_module) + +UnsafeConstructor.add_multi_constructor( + 'tag:yaml.org,2002:python/object:', + UnsafeConstructor.construct_python_object) + +UnsafeConstructor.add_multi_constructor( + 'tag:yaml.org,2002:python/object/new:', + UnsafeConstructor.construct_python_object_new) + +UnsafeConstructor.add_multi_constructor( + 'tag:yaml.org,2002:python/object/apply:', + UnsafeConstructor.construct_python_object_apply) + +# Constructor is same as UnsafeConstructor. Need to leave this in place in case +# people have extended it directly. +class Constructor(UnsafeConstructor): + pass diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/yaml/cyaml.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/yaml/cyaml.py new file mode 100644 index 0000000000000000000000000000000000000000..0c21345879b298bb8668201bebe7d289586b17f9 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/yaml/cyaml.py @@ -0,0 +1,101 @@ + +__all__ = [ + 'CBaseLoader', 'CSafeLoader', 'CFullLoader', 'CUnsafeLoader', 'CLoader', + 'CBaseDumper', 'CSafeDumper', 'CDumper' +] + +from yaml._yaml import CParser, CEmitter + +from .constructor import * + +from .serializer import * +from .representer import * + +from .resolver import * + +class CBaseLoader(CParser, BaseConstructor, BaseResolver): + + def __init__(self, stream): + CParser.__init__(self, stream) + BaseConstructor.__init__(self) + BaseResolver.__init__(self) + +class CSafeLoader(CParser, SafeConstructor, Resolver): + + def __init__(self, stream): + CParser.__init__(self, stream) + SafeConstructor.__init__(self) + Resolver.__init__(self) + +class CFullLoader(CParser, FullConstructor, Resolver): + + def __init__(self, stream): + CParser.__init__(self, stream) + FullConstructor.__init__(self) + Resolver.__init__(self) + +class CUnsafeLoader(CParser, UnsafeConstructor, Resolver): + + def __init__(self, stream): + CParser.__init__(self, stream) + UnsafeConstructor.__init__(self) + Resolver.__init__(self) + +class CLoader(CParser, Constructor, Resolver): + + def __init__(self, stream): + CParser.__init__(self, stream) + Constructor.__init__(self) + Resolver.__init__(self) + +class CBaseDumper(CEmitter, BaseRepresenter, BaseResolver): + + def __init__(self, stream, + default_style=None, default_flow_style=False, + canonical=None, indent=None, width=None, + allow_unicode=None, line_break=None, + encoding=None, explicit_start=None, explicit_end=None, + version=None, tags=None, sort_keys=True): + CEmitter.__init__(self, stream, canonical=canonical, + indent=indent, width=width, encoding=encoding, + allow_unicode=allow_unicode, line_break=line_break, + explicit_start=explicit_start, explicit_end=explicit_end, + version=version, tags=tags) + Representer.__init__(self, default_style=default_style, + default_flow_style=default_flow_style, sort_keys=sort_keys) + Resolver.__init__(self) + +class CSafeDumper(CEmitter, SafeRepresenter, Resolver): + + def __init__(self, stream, + default_style=None, default_flow_style=False, + canonical=None, indent=None, width=None, + allow_unicode=None, line_break=None, + encoding=None, explicit_start=None, explicit_end=None, + version=None, tags=None, sort_keys=True): + CEmitter.__init__(self, stream, canonical=canonical, + indent=indent, width=width, encoding=encoding, + allow_unicode=allow_unicode, line_break=line_break, + explicit_start=explicit_start, explicit_end=explicit_end, + version=version, tags=tags) + SafeRepresenter.__init__(self, default_style=default_style, + default_flow_style=default_flow_style, sort_keys=sort_keys) + Resolver.__init__(self) + +class CDumper(CEmitter, Serializer, Representer, Resolver): + + def __init__(self, stream, + default_style=None, default_flow_style=False, + canonical=None, indent=None, width=None, + allow_unicode=None, line_break=None, + encoding=None, explicit_start=None, explicit_end=None, + version=None, tags=None, sort_keys=True): + CEmitter.__init__(self, stream, canonical=canonical, + indent=indent, width=width, encoding=encoding, + allow_unicode=allow_unicode, line_break=line_break, + explicit_start=explicit_start, explicit_end=explicit_end, + version=version, tags=tags) + Representer.__init__(self, default_style=default_style, + default_flow_style=default_flow_style, sort_keys=sort_keys) + Resolver.__init__(self) + diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/yaml/dumper.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/yaml/dumper.py new file mode 100644 index 0000000000000000000000000000000000000000..6aadba551f3836b02f4752277f4b3027073defad --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/yaml/dumper.py @@ -0,0 +1,62 @@ + +__all__ = ['BaseDumper', 'SafeDumper', 'Dumper'] + +from .emitter import * +from .serializer import * +from .representer import * +from .resolver import * + +class BaseDumper(Emitter, Serializer, BaseRepresenter, BaseResolver): + + def __init__(self, stream, + default_style=None, default_flow_style=False, + canonical=None, indent=None, width=None, + allow_unicode=None, line_break=None, + encoding=None, explicit_start=None, explicit_end=None, + version=None, tags=None, sort_keys=True): + Emitter.__init__(self, stream, canonical=canonical, + indent=indent, width=width, + allow_unicode=allow_unicode, line_break=line_break) + Serializer.__init__(self, encoding=encoding, + explicit_start=explicit_start, explicit_end=explicit_end, + version=version, tags=tags) + Representer.__init__(self, default_style=default_style, + default_flow_style=default_flow_style, sort_keys=sort_keys) + Resolver.__init__(self) + +class SafeDumper(Emitter, Serializer, SafeRepresenter, Resolver): + + def __init__(self, stream, + default_style=None, default_flow_style=False, + canonical=None, indent=None, width=None, + allow_unicode=None, line_break=None, + encoding=None, explicit_start=None, explicit_end=None, + version=None, tags=None, sort_keys=True): + Emitter.__init__(self, stream, canonical=canonical, + indent=indent, width=width, + allow_unicode=allow_unicode, line_break=line_break) + Serializer.__init__(self, encoding=encoding, + explicit_start=explicit_start, explicit_end=explicit_end, + version=version, tags=tags) + SafeRepresenter.__init__(self, default_style=default_style, + default_flow_style=default_flow_style, sort_keys=sort_keys) + Resolver.__init__(self) + +class Dumper(Emitter, Serializer, Representer, Resolver): + + def __init__(self, stream, + default_style=None, default_flow_style=False, + canonical=None, indent=None, width=None, + allow_unicode=None, line_break=None, + encoding=None, explicit_start=None, explicit_end=None, + version=None, tags=None, sort_keys=True): + Emitter.__init__(self, stream, canonical=canonical, + indent=indent, width=width, + allow_unicode=allow_unicode, line_break=line_break) + Serializer.__init__(self, encoding=encoding, + explicit_start=explicit_start, explicit_end=explicit_end, + version=version, tags=tags) + Representer.__init__(self, default_style=default_style, + default_flow_style=default_flow_style, sort_keys=sort_keys) + Resolver.__init__(self) + diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/yaml/emitter.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/yaml/emitter.py new file mode 100644 index 0000000000000000000000000000000000000000..a664d011162af69184df2f8e59ab7feec818f7c7 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/yaml/emitter.py @@ -0,0 +1,1137 @@ + +# Emitter expects events obeying the following grammar: +# stream ::= STREAM-START document* STREAM-END +# document ::= DOCUMENT-START node DOCUMENT-END +# node ::= SCALAR | sequence | mapping +# sequence ::= SEQUENCE-START node* SEQUENCE-END +# mapping ::= MAPPING-START (node node)* MAPPING-END + +__all__ = ['Emitter', 'EmitterError'] + +from .error import YAMLError +from .events import * + +class EmitterError(YAMLError): + pass + +class ScalarAnalysis: + def __init__(self, scalar, empty, multiline, + allow_flow_plain, allow_block_plain, + allow_single_quoted, allow_double_quoted, + allow_block): + self.scalar = scalar + self.empty = empty + self.multiline = multiline + self.allow_flow_plain = allow_flow_plain + self.allow_block_plain = allow_block_plain + self.allow_single_quoted = allow_single_quoted + self.allow_double_quoted = allow_double_quoted + self.allow_block = allow_block + +class Emitter: + + DEFAULT_TAG_PREFIXES = { + '!' : '!', + 'tag:yaml.org,2002:' : '!!', + } + + def __init__(self, stream, canonical=None, indent=None, width=None, + allow_unicode=None, line_break=None): + + # The stream should have the methods `write` and possibly `flush`. + self.stream = stream + + # Encoding can be overridden by STREAM-START. + self.encoding = None + + # Emitter is a state machine with a stack of states to handle nested + # structures. + self.states = [] + self.state = self.expect_stream_start + + # Current event and the event queue. + self.events = [] + self.event = None + + # The current indentation level and the stack of previous indents. + self.indents = [] + self.indent = None + + # Flow level. + self.flow_level = 0 + + # Contexts. + self.root_context = False + self.sequence_context = False + self.mapping_context = False + self.simple_key_context = False + + # Characteristics of the last emitted character: + # - current position. + # - is it a whitespace? + # - is it an indention character + # (indentation space, '-', '?', or ':')? + self.line = 0 + self.column = 0 + self.whitespace = True + self.indention = True + + # Whether the document requires an explicit document indicator + self.open_ended = False + + # Formatting details. + self.canonical = canonical + self.allow_unicode = allow_unicode + self.best_indent = 2 + if indent and 1 < indent < 10: + self.best_indent = indent + self.best_width = 80 + if width and width > self.best_indent*2: + self.best_width = width + self.best_line_break = '\n' + if line_break in ['\r', '\n', '\r\n']: + self.best_line_break = line_break + + # Tag prefixes. + self.tag_prefixes = None + + # Prepared anchor and tag. + self.prepared_anchor = None + self.prepared_tag = None + + # Scalar analysis and style. + self.analysis = None + self.style = None + + def dispose(self): + # Reset the state attributes (to clear self-references) + self.states = [] + self.state = None + + def emit(self, event): + self.events.append(event) + while not self.need_more_events(): + self.event = self.events.pop(0) + self.state() + self.event = None + + # In some cases, we wait for a few next events before emitting. + + def need_more_events(self): + if not self.events: + return True + event = self.events[0] + if isinstance(event, DocumentStartEvent): + return self.need_events(1) + elif isinstance(event, SequenceStartEvent): + return self.need_events(2) + elif isinstance(event, MappingStartEvent): + return self.need_events(3) + else: + return False + + def need_events(self, count): + level = 0 + for event in self.events[1:]: + if isinstance(event, (DocumentStartEvent, CollectionStartEvent)): + level += 1 + elif isinstance(event, (DocumentEndEvent, CollectionEndEvent)): + level -= 1 + elif isinstance(event, StreamEndEvent): + level = -1 + if level < 0: + return False + return (len(self.events) < count+1) + + def increase_indent(self, flow=False, indentless=False): + self.indents.append(self.indent) + if self.indent is None: + if flow: + self.indent = self.best_indent + else: + self.indent = 0 + elif not indentless: + self.indent += self.best_indent + + # States. + + # Stream handlers. + + def expect_stream_start(self): + if isinstance(self.event, StreamStartEvent): + if self.event.encoding and not hasattr(self.stream, 'encoding'): + self.encoding = self.event.encoding + self.write_stream_start() + self.state = self.expect_first_document_start + else: + raise EmitterError("expected StreamStartEvent, but got %s" + % self.event) + + def expect_nothing(self): + raise EmitterError("expected nothing, but got %s" % self.event) + + # Document handlers. + + def expect_first_document_start(self): + return self.expect_document_start(first=True) + + def expect_document_start(self, first=False): + if isinstance(self.event, DocumentStartEvent): + if (self.event.version or self.event.tags) and self.open_ended: + self.write_indicator('...', True) + self.write_indent() + if self.event.version: + version_text = self.prepare_version(self.event.version) + self.write_version_directive(version_text) + self.tag_prefixes = self.DEFAULT_TAG_PREFIXES.copy() + if self.event.tags: + handles = sorted(self.event.tags.keys()) + for handle in handles: + prefix = self.event.tags[handle] + self.tag_prefixes[prefix] = handle + handle_text = self.prepare_tag_handle(handle) + prefix_text = self.prepare_tag_prefix(prefix) + self.write_tag_directive(handle_text, prefix_text) + implicit = (first and not self.event.explicit and not self.canonical + and not self.event.version and not self.event.tags + and not self.check_empty_document()) + if not implicit: + self.write_indent() + self.write_indicator('---', True) + if self.canonical: + self.write_indent() + self.state = self.expect_document_root + elif isinstance(self.event, StreamEndEvent): + if self.open_ended: + self.write_indicator('...', True) + self.write_indent() + self.write_stream_end() + self.state = self.expect_nothing + else: + raise EmitterError("expected DocumentStartEvent, but got %s" + % self.event) + + def expect_document_end(self): + if isinstance(self.event, DocumentEndEvent): + self.write_indent() + if self.event.explicit: + self.write_indicator('...', True) + self.write_indent() + self.flush_stream() + self.state = self.expect_document_start + else: + raise EmitterError("expected DocumentEndEvent, but got %s" + % self.event) + + def expect_document_root(self): + self.states.append(self.expect_document_end) + self.expect_node(root=True) + + # Node handlers. + + def expect_node(self, root=False, sequence=False, mapping=False, + simple_key=False): + self.root_context = root + self.sequence_context = sequence + self.mapping_context = mapping + self.simple_key_context = simple_key + if isinstance(self.event, AliasEvent): + self.expect_alias() + elif isinstance(self.event, (ScalarEvent, CollectionStartEvent)): + self.process_anchor('&') + self.process_tag() + if isinstance(self.event, ScalarEvent): + self.expect_scalar() + elif isinstance(self.event, SequenceStartEvent): + if self.flow_level or self.canonical or self.event.flow_style \ + or self.check_empty_sequence(): + self.expect_flow_sequence() + else: + self.expect_block_sequence() + elif isinstance(self.event, MappingStartEvent): + if self.flow_level or self.canonical or self.event.flow_style \ + or self.check_empty_mapping(): + self.expect_flow_mapping() + else: + self.expect_block_mapping() + else: + raise EmitterError("expected NodeEvent, but got %s" % self.event) + + def expect_alias(self): + if self.event.anchor is None: + raise EmitterError("anchor is not specified for alias") + self.process_anchor('*') + self.state = self.states.pop() + + def expect_scalar(self): + self.increase_indent(flow=True) + self.process_scalar() + self.indent = self.indents.pop() + self.state = self.states.pop() + + # Flow sequence handlers. + + def expect_flow_sequence(self): + self.write_indicator('[', True, whitespace=True) + self.flow_level += 1 + self.increase_indent(flow=True) + self.state = self.expect_first_flow_sequence_item + + def expect_first_flow_sequence_item(self): + if isinstance(self.event, SequenceEndEvent): + self.indent = self.indents.pop() + self.flow_level -= 1 + self.write_indicator(']', False) + self.state = self.states.pop() + else: + if self.canonical or self.column > self.best_width: + self.write_indent() + self.states.append(self.expect_flow_sequence_item) + self.expect_node(sequence=True) + + def expect_flow_sequence_item(self): + if isinstance(self.event, SequenceEndEvent): + self.indent = self.indents.pop() + self.flow_level -= 1 + if self.canonical: + self.write_indicator(',', False) + self.write_indent() + self.write_indicator(']', False) + self.state = self.states.pop() + else: + self.write_indicator(',', False) + if self.canonical or self.column > self.best_width: + self.write_indent() + self.states.append(self.expect_flow_sequence_item) + self.expect_node(sequence=True) + + # Flow mapping handlers. + + def expect_flow_mapping(self): + self.write_indicator('{', True, whitespace=True) + self.flow_level += 1 + self.increase_indent(flow=True) + self.state = self.expect_first_flow_mapping_key + + def expect_first_flow_mapping_key(self): + if isinstance(self.event, MappingEndEvent): + self.indent = self.indents.pop() + self.flow_level -= 1 + self.write_indicator('}', False) + self.state = self.states.pop() + else: + if self.canonical or self.column > self.best_width: + self.write_indent() + if not self.canonical and self.check_simple_key(): + self.states.append(self.expect_flow_mapping_simple_value) + self.expect_node(mapping=True, simple_key=True) + else: + self.write_indicator('?', True) + self.states.append(self.expect_flow_mapping_value) + self.expect_node(mapping=True) + + def expect_flow_mapping_key(self): + if isinstance(self.event, MappingEndEvent): + self.indent = self.indents.pop() + self.flow_level -= 1 + if self.canonical: + self.write_indicator(',', False) + self.write_indent() + self.write_indicator('}', False) + self.state = self.states.pop() + else: + self.write_indicator(',', False) + if self.canonical or self.column > self.best_width: + self.write_indent() + if not self.canonical and self.check_simple_key(): + self.states.append(self.expect_flow_mapping_simple_value) + self.expect_node(mapping=True, simple_key=True) + else: + self.write_indicator('?', True) + self.states.append(self.expect_flow_mapping_value) + self.expect_node(mapping=True) + + def expect_flow_mapping_simple_value(self): + self.write_indicator(':', False) + self.states.append(self.expect_flow_mapping_key) + self.expect_node(mapping=True) + + def expect_flow_mapping_value(self): + if self.canonical or self.column > self.best_width: + self.write_indent() + self.write_indicator(':', True) + self.states.append(self.expect_flow_mapping_key) + self.expect_node(mapping=True) + + # Block sequence handlers. + + def expect_block_sequence(self): + indentless = (self.mapping_context and not self.indention) + self.increase_indent(flow=False, indentless=indentless) + self.state = self.expect_first_block_sequence_item + + def expect_first_block_sequence_item(self): + return self.expect_block_sequence_item(first=True) + + def expect_block_sequence_item(self, first=False): + if not first and isinstance(self.event, SequenceEndEvent): + self.indent = self.indents.pop() + self.state = self.states.pop() + else: + self.write_indent() + self.write_indicator('-', True, indention=True) + self.states.append(self.expect_block_sequence_item) + self.expect_node(sequence=True) + + # Block mapping handlers. + + def expect_block_mapping(self): + self.increase_indent(flow=False) + self.state = self.expect_first_block_mapping_key + + def expect_first_block_mapping_key(self): + return self.expect_block_mapping_key(first=True) + + def expect_block_mapping_key(self, first=False): + if not first and isinstance(self.event, MappingEndEvent): + self.indent = self.indents.pop() + self.state = self.states.pop() + else: + self.write_indent() + if self.check_simple_key(): + self.states.append(self.expect_block_mapping_simple_value) + self.expect_node(mapping=True, simple_key=True) + else: + self.write_indicator('?', True, indention=True) + self.states.append(self.expect_block_mapping_value) + self.expect_node(mapping=True) + + def expect_block_mapping_simple_value(self): + self.write_indicator(':', False) + self.states.append(self.expect_block_mapping_key) + self.expect_node(mapping=True) + + def expect_block_mapping_value(self): + self.write_indent() + self.write_indicator(':', True, indention=True) + self.states.append(self.expect_block_mapping_key) + self.expect_node(mapping=True) + + # Checkers. + + def check_empty_sequence(self): + return (isinstance(self.event, SequenceStartEvent) and self.events + and isinstance(self.events[0], SequenceEndEvent)) + + def check_empty_mapping(self): + return (isinstance(self.event, MappingStartEvent) and self.events + and isinstance(self.events[0], MappingEndEvent)) + + def check_empty_document(self): + if not isinstance(self.event, DocumentStartEvent) or not self.events: + return False + event = self.events[0] + return (isinstance(event, ScalarEvent) and event.anchor is None + and event.tag is None and event.implicit and event.value == '') + + def check_simple_key(self): + length = 0 + if isinstance(self.event, NodeEvent) and self.event.anchor is not None: + if self.prepared_anchor is None: + self.prepared_anchor = self.prepare_anchor(self.event.anchor) + length += len(self.prepared_anchor) + if isinstance(self.event, (ScalarEvent, CollectionStartEvent)) \ + and self.event.tag is not None: + if self.prepared_tag is None: + self.prepared_tag = self.prepare_tag(self.event.tag) + length += len(self.prepared_tag) + if isinstance(self.event, ScalarEvent): + if self.analysis is None: + self.analysis = self.analyze_scalar(self.event.value) + length += len(self.analysis.scalar) + return (length < 128 and (isinstance(self.event, AliasEvent) + or (isinstance(self.event, ScalarEvent) + and not self.analysis.empty and not self.analysis.multiline) + or self.check_empty_sequence() or self.check_empty_mapping())) + + # Anchor, Tag, and Scalar processors. + + def process_anchor(self, indicator): + if self.event.anchor is None: + self.prepared_anchor = None + return + if self.prepared_anchor is None: + self.prepared_anchor = self.prepare_anchor(self.event.anchor) + if self.prepared_anchor: + self.write_indicator(indicator+self.prepared_anchor, True) + self.prepared_anchor = None + + def process_tag(self): + tag = self.event.tag + if isinstance(self.event, ScalarEvent): + if self.style is None: + self.style = self.choose_scalar_style() + if ((not self.canonical or tag is None) and + ((self.style == '' and self.event.implicit[0]) + or (self.style != '' and self.event.implicit[1]))): + self.prepared_tag = None + return + if self.event.implicit[0] and tag is None: + tag = '!' + self.prepared_tag = None + else: + if (not self.canonical or tag is None) and self.event.implicit: + self.prepared_tag = None + return + if tag is None: + raise EmitterError("tag is not specified") + if self.prepared_tag is None: + self.prepared_tag = self.prepare_tag(tag) + if self.prepared_tag: + self.write_indicator(self.prepared_tag, True) + self.prepared_tag = None + + def choose_scalar_style(self): + if self.analysis is None: + self.analysis = self.analyze_scalar(self.event.value) + if self.event.style == '"' or self.canonical: + return '"' + if not self.event.style and self.event.implicit[0]: + if (not (self.simple_key_context and + (self.analysis.empty or self.analysis.multiline)) + and (self.flow_level and self.analysis.allow_flow_plain + or (not self.flow_level and self.analysis.allow_block_plain))): + return '' + if self.event.style and self.event.style in '|>': + if (not self.flow_level and not self.simple_key_context + and self.analysis.allow_block): + return self.event.style + if not self.event.style or self.event.style == '\'': + if (self.analysis.allow_single_quoted and + not (self.simple_key_context and self.analysis.multiline)): + return '\'' + return '"' + + def process_scalar(self): + if self.analysis is None: + self.analysis = self.analyze_scalar(self.event.value) + if self.style is None: + self.style = self.choose_scalar_style() + split = (not self.simple_key_context) + #if self.analysis.multiline and split \ + # and (not self.style or self.style in '\'\"'): + # self.write_indent() + if self.style == '"': + self.write_double_quoted(self.analysis.scalar, split) + elif self.style == '\'': + self.write_single_quoted(self.analysis.scalar, split) + elif self.style == '>': + self.write_folded(self.analysis.scalar) + elif self.style == '|': + self.write_literal(self.analysis.scalar) + else: + self.write_plain(self.analysis.scalar, split) + self.analysis = None + self.style = None + + # Analyzers. + + def prepare_version(self, version): + major, minor = version + if major != 1: + raise EmitterError("unsupported YAML version: %d.%d" % (major, minor)) + return '%d.%d' % (major, minor) + + def prepare_tag_handle(self, handle): + if not handle: + raise EmitterError("tag handle must not be empty") + if handle[0] != '!' or handle[-1] != '!': + raise EmitterError("tag handle must start and end with '!': %r" % handle) + for ch in handle[1:-1]: + if not ('0' <= ch <= '9' or 'A' <= ch <= 'Z' or 'a' <= ch <= 'z' \ + or ch in '-_'): + raise EmitterError("invalid character %r in the tag handle: %r" + % (ch, handle)) + return handle + + def prepare_tag_prefix(self, prefix): + if not prefix: + raise EmitterError("tag prefix must not be empty") + chunks = [] + start = end = 0 + if prefix[0] == '!': + end = 1 + while end < len(prefix): + ch = prefix[end] + if '0' <= ch <= '9' or 'A' <= ch <= 'Z' or 'a' <= ch <= 'z' \ + or ch in '-;/?!:@&=+$,_.~*\'()[]': + end += 1 + else: + if start < end: + chunks.append(prefix[start:end]) + start = end = end+1 + data = ch.encode('utf-8') + for ch in data: + chunks.append('%%%02X' % ord(ch)) + if start < end: + chunks.append(prefix[start:end]) + return ''.join(chunks) + + def prepare_tag(self, tag): + if not tag: + raise EmitterError("tag must not be empty") + if tag == '!': + return tag + handle = None + suffix = tag + prefixes = sorted(self.tag_prefixes.keys()) + for prefix in prefixes: + if tag.startswith(prefix) \ + and (prefix == '!' or len(prefix) < len(tag)): + handle = self.tag_prefixes[prefix] + suffix = tag[len(prefix):] + chunks = [] + start = end = 0 + while end < len(suffix): + ch = suffix[end] + if '0' <= ch <= '9' or 'A' <= ch <= 'Z' or 'a' <= ch <= 'z' \ + or ch in '-;/?:@&=+$,_.~*\'()[]' \ + or (ch == '!' and handle != '!'): + end += 1 + else: + if start < end: + chunks.append(suffix[start:end]) + start = end = end+1 + data = ch.encode('utf-8') + for ch in data: + chunks.append('%%%02X' % ch) + if start < end: + chunks.append(suffix[start:end]) + suffix_text = ''.join(chunks) + if handle: + return '%s%s' % (handle, suffix_text) + else: + return '!<%s>' % suffix_text + + def prepare_anchor(self, anchor): + if not anchor: + raise EmitterError("anchor must not be empty") + for ch in anchor: + if not ('0' <= ch <= '9' or 'A' <= ch <= 'Z' or 'a' <= ch <= 'z' \ + or ch in '-_'): + raise EmitterError("invalid character %r in the anchor: %r" + % (ch, anchor)) + return anchor + + def analyze_scalar(self, scalar): + + # Empty scalar is a special case. + if not scalar: + return ScalarAnalysis(scalar=scalar, empty=True, multiline=False, + allow_flow_plain=False, allow_block_plain=True, + allow_single_quoted=True, allow_double_quoted=True, + allow_block=False) + + # Indicators and special characters. + block_indicators = False + flow_indicators = False + line_breaks = False + special_characters = False + + # Important whitespace combinations. + leading_space = False + leading_break = False + trailing_space = False + trailing_break = False + break_space = False + space_break = False + + # Check document indicators. + if scalar.startswith('---') or scalar.startswith('...'): + block_indicators = True + flow_indicators = True + + # First character or preceded by a whitespace. + preceded_by_whitespace = True + + # Last character or followed by a whitespace. + followed_by_whitespace = (len(scalar) == 1 or + scalar[1] in '\0 \t\r\n\x85\u2028\u2029') + + # The previous character is a space. + previous_space = False + + # The previous character is a break. + previous_break = False + + index = 0 + while index < len(scalar): + ch = scalar[index] + + # Check for indicators. + if index == 0: + # Leading indicators are special characters. + if ch in '#,[]{}&*!|>\'\"%@`': + flow_indicators = True + block_indicators = True + if ch in '?:': + flow_indicators = True + if followed_by_whitespace: + block_indicators = True + if ch == '-' and followed_by_whitespace: + flow_indicators = True + block_indicators = True + else: + # Some indicators cannot appear within a scalar as well. + if ch in ',?[]{}': + flow_indicators = True + if ch == ':': + flow_indicators = True + if followed_by_whitespace: + block_indicators = True + if ch == '#' and preceded_by_whitespace: + flow_indicators = True + block_indicators = True + + # Check for line breaks, special, and unicode characters. + if ch in '\n\x85\u2028\u2029': + line_breaks = True + if not (ch == '\n' or '\x20' <= ch <= '\x7E'): + if (ch == '\x85' or '\xA0' <= ch <= '\uD7FF' + or '\uE000' <= ch <= '\uFFFD' + or '\U00010000' <= ch < '\U0010ffff') and ch != '\uFEFF': + unicode_characters = True + if not self.allow_unicode: + special_characters = True + else: + special_characters = True + + # Detect important whitespace combinations. + if ch == ' ': + if index == 0: + leading_space = True + if index == len(scalar)-1: + trailing_space = True + if previous_break: + break_space = True + previous_space = True + previous_break = False + elif ch in '\n\x85\u2028\u2029': + if index == 0: + leading_break = True + if index == len(scalar)-1: + trailing_break = True + if previous_space: + space_break = True + previous_space = False + previous_break = True + else: + previous_space = False + previous_break = False + + # Prepare for the next character. + index += 1 + preceded_by_whitespace = (ch in '\0 \t\r\n\x85\u2028\u2029') + followed_by_whitespace = (index+1 >= len(scalar) or + scalar[index+1] in '\0 \t\r\n\x85\u2028\u2029') + + # Let's decide what styles are allowed. + allow_flow_plain = True + allow_block_plain = True + allow_single_quoted = True + allow_double_quoted = True + allow_block = True + + # Leading and trailing whitespaces are bad for plain scalars. + if (leading_space or leading_break + or trailing_space or trailing_break): + allow_flow_plain = allow_block_plain = False + + # We do not permit trailing spaces for block scalars. + if trailing_space: + allow_block = False + + # Spaces at the beginning of a new line are only acceptable for block + # scalars. + if break_space: + allow_flow_plain = allow_block_plain = allow_single_quoted = False + + # Spaces followed by breaks, as well as special character are only + # allowed for double quoted scalars. + if space_break or special_characters: + allow_flow_plain = allow_block_plain = \ + allow_single_quoted = allow_block = False + + # Although the plain scalar writer supports breaks, we never emit + # multiline plain scalars. + if line_breaks: + allow_flow_plain = allow_block_plain = False + + # Flow indicators are forbidden for flow plain scalars. + if flow_indicators: + allow_flow_plain = False + + # Block indicators are forbidden for block plain scalars. + if block_indicators: + allow_block_plain = False + + return ScalarAnalysis(scalar=scalar, + empty=False, multiline=line_breaks, + allow_flow_plain=allow_flow_plain, + allow_block_plain=allow_block_plain, + allow_single_quoted=allow_single_quoted, + allow_double_quoted=allow_double_quoted, + allow_block=allow_block) + + # Writers. + + def flush_stream(self): + if hasattr(self.stream, 'flush'): + self.stream.flush() + + def write_stream_start(self): + # Write BOM if needed. + if self.encoding and self.encoding.startswith('utf-16'): + self.stream.write('\uFEFF'.encode(self.encoding)) + + def write_stream_end(self): + self.flush_stream() + + def write_indicator(self, indicator, need_whitespace, + whitespace=False, indention=False): + if self.whitespace or not need_whitespace: + data = indicator + else: + data = ' '+indicator + self.whitespace = whitespace + self.indention = self.indention and indention + self.column += len(data) + self.open_ended = False + if self.encoding: + data = data.encode(self.encoding) + self.stream.write(data) + + def write_indent(self): + indent = self.indent or 0 + if not self.indention or self.column > indent \ + or (self.column == indent and not self.whitespace): + self.write_line_break() + if self.column < indent: + self.whitespace = True + data = ' '*(indent-self.column) + self.column = indent + if self.encoding: + data = data.encode(self.encoding) + self.stream.write(data) + + def write_line_break(self, data=None): + if data is None: + data = self.best_line_break + self.whitespace = True + self.indention = True + self.line += 1 + self.column = 0 + if self.encoding: + data = data.encode(self.encoding) + self.stream.write(data) + + def write_version_directive(self, version_text): + data = '%%YAML %s' % version_text + if self.encoding: + data = data.encode(self.encoding) + self.stream.write(data) + self.write_line_break() + + def write_tag_directive(self, handle_text, prefix_text): + data = '%%TAG %s %s' % (handle_text, prefix_text) + if self.encoding: + data = data.encode(self.encoding) + self.stream.write(data) + self.write_line_break() + + # Scalar streams. + + def write_single_quoted(self, text, split=True): + self.write_indicator('\'', True) + spaces = False + breaks = False + start = end = 0 + while end <= len(text): + ch = None + if end < len(text): + ch = text[end] + if spaces: + if ch is None or ch != ' ': + if start+1 == end and self.column > self.best_width and split \ + and start != 0 and end != len(text): + self.write_indent() + else: + data = text[start:end] + self.column += len(data) + if self.encoding: + data = data.encode(self.encoding) + self.stream.write(data) + start = end + elif breaks: + if ch is None or ch not in '\n\x85\u2028\u2029': + if text[start] == '\n': + self.write_line_break() + for br in text[start:end]: + if br == '\n': + self.write_line_break() + else: + self.write_line_break(br) + self.write_indent() + start = end + else: + if ch is None or ch in ' \n\x85\u2028\u2029' or ch == '\'': + if start < end: + data = text[start:end] + self.column += len(data) + if self.encoding: + data = data.encode(self.encoding) + self.stream.write(data) + start = end + if ch == '\'': + data = '\'\'' + self.column += 2 + if self.encoding: + data = data.encode(self.encoding) + self.stream.write(data) + start = end + 1 + if ch is not None: + spaces = (ch == ' ') + breaks = (ch in '\n\x85\u2028\u2029') + end += 1 + self.write_indicator('\'', False) + + ESCAPE_REPLACEMENTS = { + '\0': '0', + '\x07': 'a', + '\x08': 'b', + '\x09': 't', + '\x0A': 'n', + '\x0B': 'v', + '\x0C': 'f', + '\x0D': 'r', + '\x1B': 'e', + '\"': '\"', + '\\': '\\', + '\x85': 'N', + '\xA0': '_', + '\u2028': 'L', + '\u2029': 'P', + } + + def write_double_quoted(self, text, split=True): + self.write_indicator('"', True) + start = end = 0 + while end <= len(text): + ch = None + if end < len(text): + ch = text[end] + if ch is None or ch in '"\\\x85\u2028\u2029\uFEFF' \ + or not ('\x20' <= ch <= '\x7E' + or (self.allow_unicode + and ('\xA0' <= ch <= '\uD7FF' + or '\uE000' <= ch <= '\uFFFD'))): + if start < end: + data = text[start:end] + self.column += len(data) + if self.encoding: + data = data.encode(self.encoding) + self.stream.write(data) + start = end + if ch is not None: + if ch in self.ESCAPE_REPLACEMENTS: + data = '\\'+self.ESCAPE_REPLACEMENTS[ch] + elif ch <= '\xFF': + data = '\\x%02X' % ord(ch) + elif ch <= '\uFFFF': + data = '\\u%04X' % ord(ch) + else: + data = '\\U%08X' % ord(ch) + self.column += len(data) + if self.encoding: + data = data.encode(self.encoding) + self.stream.write(data) + start = end+1 + if 0 < end < len(text)-1 and (ch == ' ' or start >= end) \ + and self.column+(end-start) > self.best_width and split: + data = text[start:end]+'\\' + if start < end: + start = end + self.column += len(data) + if self.encoding: + data = data.encode(self.encoding) + self.stream.write(data) + self.write_indent() + self.whitespace = False + self.indention = False + if text[start] == ' ': + data = '\\' + self.column += len(data) + if self.encoding: + data = data.encode(self.encoding) + self.stream.write(data) + end += 1 + self.write_indicator('"', False) + + def determine_block_hints(self, text): + hints = '' + if text: + if text[0] in ' \n\x85\u2028\u2029': + hints += str(self.best_indent) + if text[-1] not in '\n\x85\u2028\u2029': + hints += '-' + elif len(text) == 1 or text[-2] in '\n\x85\u2028\u2029': + hints += '+' + return hints + + def write_folded(self, text): + hints = self.determine_block_hints(text) + self.write_indicator('>'+hints, True) + if hints[-1:] == '+': + self.open_ended = True + self.write_line_break() + leading_space = True + spaces = False + breaks = True + start = end = 0 + while end <= len(text): + ch = None + if end < len(text): + ch = text[end] + if breaks: + if ch is None or ch not in '\n\x85\u2028\u2029': + if not leading_space and ch is not None and ch != ' ' \ + and text[start] == '\n': + self.write_line_break() + leading_space = (ch == ' ') + for br in text[start:end]: + if br == '\n': + self.write_line_break() + else: + self.write_line_break(br) + if ch is not None: + self.write_indent() + start = end + elif spaces: + if ch != ' ': + if start+1 == end and self.column > self.best_width: + self.write_indent() + else: + data = text[start:end] + self.column += len(data) + if self.encoding: + data = data.encode(self.encoding) + self.stream.write(data) + start = end + else: + if ch is None or ch in ' \n\x85\u2028\u2029': + data = text[start:end] + self.column += len(data) + if self.encoding: + data = data.encode(self.encoding) + self.stream.write(data) + if ch is None: + self.write_line_break() + start = end + if ch is not None: + breaks = (ch in '\n\x85\u2028\u2029') + spaces = (ch == ' ') + end += 1 + + def write_literal(self, text): + hints = self.determine_block_hints(text) + self.write_indicator('|'+hints, True) + if hints[-1:] == '+': + self.open_ended = True + self.write_line_break() + breaks = True + start = end = 0 + while end <= len(text): + ch = None + if end < len(text): + ch = text[end] + if breaks: + if ch is None or ch not in '\n\x85\u2028\u2029': + for br in text[start:end]: + if br == '\n': + self.write_line_break() + else: + self.write_line_break(br) + if ch is not None: + self.write_indent() + start = end + else: + if ch is None or ch in '\n\x85\u2028\u2029': + data = text[start:end] + if self.encoding: + data = data.encode(self.encoding) + self.stream.write(data) + if ch is None: + self.write_line_break() + start = end + if ch is not None: + breaks = (ch in '\n\x85\u2028\u2029') + end += 1 + + def write_plain(self, text, split=True): + if self.root_context: + self.open_ended = True + if not text: + return + if not self.whitespace: + data = ' ' + self.column += len(data) + if self.encoding: + data = data.encode(self.encoding) + self.stream.write(data) + self.whitespace = False + self.indention = False + spaces = False + breaks = False + start = end = 0 + while end <= len(text): + ch = None + if end < len(text): + ch = text[end] + if spaces: + if ch != ' ': + if start+1 == end and self.column > self.best_width and split: + self.write_indent() + self.whitespace = False + self.indention = False + else: + data = text[start:end] + self.column += len(data) + if self.encoding: + data = data.encode(self.encoding) + self.stream.write(data) + start = end + elif breaks: + if ch not in '\n\x85\u2028\u2029': + if text[start] == '\n': + self.write_line_break() + for br in text[start:end]: + if br == '\n': + self.write_line_break() + else: + self.write_line_break(br) + self.write_indent() + self.whitespace = False + self.indention = False + start = end + else: + if ch is None or ch in ' \n\x85\u2028\u2029': + data = text[start:end] + self.column += len(data) + if self.encoding: + data = data.encode(self.encoding) + self.stream.write(data) + start = end + if ch is not None: + spaces = (ch == ' ') + breaks = (ch in '\n\x85\u2028\u2029') + end += 1 diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/yaml/error.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/yaml/error.py new file mode 100644 index 0000000000000000000000000000000000000000..b796b4dc519512c4825ff539a2e6aa20f4d370d0 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/yaml/error.py @@ -0,0 +1,75 @@ + +__all__ = ['Mark', 'YAMLError', 'MarkedYAMLError'] + +class Mark: + + def __init__(self, name, index, line, column, buffer, pointer): + self.name = name + self.index = index + self.line = line + self.column = column + self.buffer = buffer + self.pointer = pointer + + def get_snippet(self, indent=4, max_length=75): + if self.buffer is None: + return None + head = '' + start = self.pointer + while start > 0 and self.buffer[start-1] not in '\0\r\n\x85\u2028\u2029': + start -= 1 + if self.pointer-start > max_length/2-1: + head = ' ... ' + start += 5 + break + tail = '' + end = self.pointer + while end < len(self.buffer) and self.buffer[end] not in '\0\r\n\x85\u2028\u2029': + end += 1 + if end-self.pointer > max_length/2-1: + tail = ' ... ' + end -= 5 + break + snippet = self.buffer[start:end] + return ' '*indent + head + snippet + tail + '\n' \ + + ' '*(indent+self.pointer-start+len(head)) + '^' + + def __str__(self): + snippet = self.get_snippet() + where = " in \"%s\", line %d, column %d" \ + % (self.name, self.line+1, self.column+1) + if snippet is not None: + where += ":\n"+snippet + return where + +class YAMLError(Exception): + pass + +class MarkedYAMLError(YAMLError): + + def __init__(self, context=None, context_mark=None, + problem=None, problem_mark=None, note=None): + self.context = context + self.context_mark = context_mark + self.problem = problem + self.problem_mark = problem_mark + self.note = note + + def __str__(self): + lines = [] + if self.context is not None: + lines.append(self.context) + if self.context_mark is not None \ + and (self.problem is None or self.problem_mark is None + or self.context_mark.name != self.problem_mark.name + or self.context_mark.line != self.problem_mark.line + or self.context_mark.column != self.problem_mark.column): + lines.append(str(self.context_mark)) + if self.problem is not None: + lines.append(self.problem) + if self.problem_mark is not None: + lines.append(str(self.problem_mark)) + if self.note is not None: + lines.append(self.note) + return '\n'.join(lines) + diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/yaml/events.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/yaml/events.py new file mode 100644 index 0000000000000000000000000000000000000000..f79ad389cb6c9517e391dcd25534866bc9ccd36a --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/yaml/events.py @@ -0,0 +1,86 @@ + +# Abstract classes. + +class Event(object): + def __init__(self, start_mark=None, end_mark=None): + self.start_mark = start_mark + self.end_mark = end_mark + def __repr__(self): + attributes = [key for key in ['anchor', 'tag', 'implicit', 'value'] + if hasattr(self, key)] + arguments = ', '.join(['%s=%r' % (key, getattr(self, key)) + for key in attributes]) + return '%s(%s)' % (self.__class__.__name__, arguments) + +class NodeEvent(Event): + def __init__(self, anchor, start_mark=None, end_mark=None): + self.anchor = anchor + self.start_mark = start_mark + self.end_mark = end_mark + +class CollectionStartEvent(NodeEvent): + def __init__(self, anchor, tag, implicit, start_mark=None, end_mark=None, + flow_style=None): + self.anchor = anchor + self.tag = tag + self.implicit = implicit + self.start_mark = start_mark + self.end_mark = end_mark + self.flow_style = flow_style + +class CollectionEndEvent(Event): + pass + +# Implementations. + +class StreamStartEvent(Event): + def __init__(self, start_mark=None, end_mark=None, encoding=None): + self.start_mark = start_mark + self.end_mark = end_mark + self.encoding = encoding + +class StreamEndEvent(Event): + pass + +class DocumentStartEvent(Event): + def __init__(self, start_mark=None, end_mark=None, + explicit=None, version=None, tags=None): + self.start_mark = start_mark + self.end_mark = end_mark + self.explicit = explicit + self.version = version + self.tags = tags + +class DocumentEndEvent(Event): + def __init__(self, start_mark=None, end_mark=None, + explicit=None): + self.start_mark = start_mark + self.end_mark = end_mark + self.explicit = explicit + +class AliasEvent(NodeEvent): + pass + +class ScalarEvent(NodeEvent): + def __init__(self, anchor, tag, implicit, value, + start_mark=None, end_mark=None, style=None): + self.anchor = anchor + self.tag = tag + self.implicit = implicit + self.value = value + self.start_mark = start_mark + self.end_mark = end_mark + self.style = style + +class SequenceStartEvent(CollectionStartEvent): + pass + +class SequenceEndEvent(CollectionEndEvent): + pass + +class MappingStartEvent(CollectionStartEvent): + pass + +class MappingEndEvent(CollectionEndEvent): + pass + diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/yaml/loader.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/yaml/loader.py new file mode 100644 index 0000000000000000000000000000000000000000..e90c11224c38e559cdf0cb205f0692ebd4fb8681 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/yaml/loader.py @@ -0,0 +1,63 @@ + +__all__ = ['BaseLoader', 'FullLoader', 'SafeLoader', 'Loader', 'UnsafeLoader'] + +from .reader import * +from .scanner import * +from .parser import * +from .composer import * +from .constructor import * +from .resolver import * + +class BaseLoader(Reader, Scanner, Parser, Composer, BaseConstructor, BaseResolver): + + def __init__(self, stream): + Reader.__init__(self, stream) + Scanner.__init__(self) + Parser.__init__(self) + Composer.__init__(self) + BaseConstructor.__init__(self) + BaseResolver.__init__(self) + +class FullLoader(Reader, Scanner, Parser, Composer, FullConstructor, Resolver): + + def __init__(self, stream): + Reader.__init__(self, stream) + Scanner.__init__(self) + Parser.__init__(self) + Composer.__init__(self) + FullConstructor.__init__(self) + Resolver.__init__(self) + +class SafeLoader(Reader, Scanner, Parser, Composer, SafeConstructor, Resolver): + + def __init__(self, stream): + Reader.__init__(self, stream) + Scanner.__init__(self) + Parser.__init__(self) + Composer.__init__(self) + SafeConstructor.__init__(self) + Resolver.__init__(self) + +class Loader(Reader, Scanner, Parser, Composer, Constructor, Resolver): + + def __init__(self, stream): + Reader.__init__(self, stream) + Scanner.__init__(self) + Parser.__init__(self) + Composer.__init__(self) + Constructor.__init__(self) + Resolver.__init__(self) + +# UnsafeLoader is the same as Loader (which is and was always unsafe on +# untrusted input). Use of either Loader or UnsafeLoader should be rare, since +# FullLoad should be able to load almost all YAML safely. Loader is left intact +# to ensure backwards compatibility. +class UnsafeLoader(Reader, Scanner, Parser, Composer, Constructor, Resolver): + + def __init__(self, stream): + Reader.__init__(self, stream) + Scanner.__init__(self) + Parser.__init__(self) + Composer.__init__(self) + Constructor.__init__(self) + Resolver.__init__(self) diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/yaml/nodes.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/yaml/nodes.py new file mode 100644 index 0000000000000000000000000000000000000000..c4f070c41e1fb1bc01af27d69329e92dded38908 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/yaml/nodes.py @@ -0,0 +1,49 @@ + +class Node(object): + def __init__(self, tag, value, start_mark, end_mark): + self.tag = tag + self.value = value + self.start_mark = start_mark + self.end_mark = end_mark + def __repr__(self): + value = self.value + #if isinstance(value, list): + # if len(value) == 0: + # value = '' + # elif len(value) == 1: + # value = '<1 item>' + # else: + # value = '<%d items>' % len(value) + #else: + # if len(value) > 75: + # value = repr(value[:70]+u' ... ') + # else: + # value = repr(value) + value = repr(value) + return '%s(tag=%r, value=%s)' % (self.__class__.__name__, self.tag, value) + +class ScalarNode(Node): + id = 'scalar' + def __init__(self, tag, value, + start_mark=None, end_mark=None, style=None): + self.tag = tag + self.value = value + self.start_mark = start_mark + self.end_mark = end_mark + self.style = style + +class CollectionNode(Node): + def __init__(self, tag, value, + start_mark=None, end_mark=None, flow_style=None): + self.tag = tag + self.value = value + self.start_mark = start_mark + self.end_mark = end_mark + self.flow_style = flow_style + +class SequenceNode(CollectionNode): + id = 'sequence' + +class MappingNode(CollectionNode): + id = 'mapping' + diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/yaml/parser.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/yaml/parser.py new file mode 100644 index 0000000000000000000000000000000000000000..13a5995d292045d0f865a99abf692bd35dc87814 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/yaml/parser.py @@ -0,0 +1,589 @@ + +# The following YAML grammar is LL(1) and is parsed by a recursive descent +# parser. +# +# stream ::= STREAM-START implicit_document? explicit_document* STREAM-END +# implicit_document ::= block_node DOCUMENT-END* +# explicit_document ::= DIRECTIVE* DOCUMENT-START block_node? DOCUMENT-END* +# block_node_or_indentless_sequence ::= +# ALIAS +# | properties (block_content | indentless_block_sequence)? +# | block_content +# | indentless_block_sequence +# block_node ::= ALIAS +# | properties block_content? +# | block_content +# flow_node ::= ALIAS +# | properties flow_content? +# | flow_content +# properties ::= TAG ANCHOR? | ANCHOR TAG? +# block_content ::= block_collection | flow_collection | SCALAR +# flow_content ::= flow_collection | SCALAR +# block_collection ::= block_sequence | block_mapping +# flow_collection ::= flow_sequence | flow_mapping +# block_sequence ::= BLOCK-SEQUENCE-START (BLOCK-ENTRY block_node?)* BLOCK-END +# indentless_sequence ::= (BLOCK-ENTRY block_node?)+ +# block_mapping ::= BLOCK-MAPPING_START +# ((KEY block_node_or_indentless_sequence?)? +# (VALUE block_node_or_indentless_sequence?)?)* +# BLOCK-END +# flow_sequence ::= FLOW-SEQUENCE-START +# (flow_sequence_entry FLOW-ENTRY)* +# flow_sequence_entry? +# FLOW-SEQUENCE-END +# flow_sequence_entry ::= flow_node | KEY flow_node? (VALUE flow_node?)? +# flow_mapping ::= FLOW-MAPPING-START +# (flow_mapping_entry FLOW-ENTRY)* +# flow_mapping_entry? +# FLOW-MAPPING-END +# flow_mapping_entry ::= flow_node | KEY flow_node? (VALUE flow_node?)? +# +# FIRST sets: +# +# stream: { STREAM-START } +# explicit_document: { DIRECTIVE DOCUMENT-START } +# implicit_document: FIRST(block_node) +# block_node: { ALIAS TAG ANCHOR SCALAR BLOCK-SEQUENCE-START BLOCK-MAPPING-START FLOW-SEQUENCE-START FLOW-MAPPING-START } +# flow_node: { ALIAS ANCHOR TAG SCALAR FLOW-SEQUENCE-START FLOW-MAPPING-START } +# block_content: { BLOCK-SEQUENCE-START BLOCK-MAPPING-START FLOW-SEQUENCE-START FLOW-MAPPING-START SCALAR } +# flow_content: { FLOW-SEQUENCE-START FLOW-MAPPING-START SCALAR } +# block_collection: { BLOCK-SEQUENCE-START BLOCK-MAPPING-START } +# flow_collection: { FLOW-SEQUENCE-START FLOW-MAPPING-START } +# block_sequence: { BLOCK-SEQUENCE-START } +# block_mapping: { BLOCK-MAPPING-START } +# block_node_or_indentless_sequence: { ALIAS ANCHOR TAG SCALAR BLOCK-SEQUENCE-START BLOCK-MAPPING-START FLOW-SEQUENCE-START FLOW-MAPPING-START BLOCK-ENTRY } +# indentless_sequence: { ENTRY } +# flow_collection: { FLOW-SEQUENCE-START FLOW-MAPPING-START } +# flow_sequence: { FLOW-SEQUENCE-START } +# flow_mapping: { FLOW-MAPPING-START } +# flow_sequence_entry: { ALIAS ANCHOR TAG SCALAR FLOW-SEQUENCE-START FLOW-MAPPING-START KEY } +# flow_mapping_entry: { ALIAS ANCHOR TAG SCALAR FLOW-SEQUENCE-START FLOW-MAPPING-START KEY } + +__all__ = ['Parser', 'ParserError'] + +from .error import MarkedYAMLError +from .tokens import * +from .events import * +from .scanner import * + +class ParserError(MarkedYAMLError): + pass + +class Parser: + # Since writing a recursive-descendant parser is a straightforward task, we + # do not give many comments here. + + DEFAULT_TAGS = { + '!': '!', + '!!': 'tag:yaml.org,2002:', + } + + def __init__(self): + self.current_event = None + self.yaml_version = None + self.tag_handles = {} + self.states = [] + self.marks = [] + self.state = self.parse_stream_start + + def dispose(self): + # Reset the state attributes (to clear self-references) + self.states = [] + self.state = None + + def check_event(self, *choices): + # Check the type of the next event. + if self.current_event is None: + if self.state: + self.current_event = self.state() + if self.current_event is not None: + if not choices: + return True + for choice in choices: + if isinstance(self.current_event, choice): + return True + return False + + def peek_event(self): + # Get the next event. + if self.current_event is None: + if self.state: + self.current_event = self.state() + return self.current_event + + def get_event(self): + # Get the next event and proceed further. + if self.current_event is None: + if self.state: + self.current_event = self.state() + value = self.current_event + self.current_event = None + return value + + # stream ::= STREAM-START implicit_document? explicit_document* STREAM-END + # implicit_document ::= block_node DOCUMENT-END* + # explicit_document ::= DIRECTIVE* DOCUMENT-START block_node? DOCUMENT-END* + + def parse_stream_start(self): + + # Parse the stream start. + token = self.get_token() + event = StreamStartEvent(token.start_mark, token.end_mark, + encoding=token.encoding) + + # Prepare the next state. + self.state = self.parse_implicit_document_start + + return event + + def parse_implicit_document_start(self): + + # Parse an implicit document. + if not self.check_token(DirectiveToken, DocumentStartToken, + StreamEndToken): + self.tag_handles = self.DEFAULT_TAGS + token = self.peek_token() + start_mark = end_mark = token.start_mark + event = DocumentStartEvent(start_mark, end_mark, + explicit=False) + + # Prepare the next state. + self.states.append(self.parse_document_end) + self.state = self.parse_block_node + + return event + + else: + return self.parse_document_start() + + def parse_document_start(self): + + # Parse any extra document end indicators. + while self.check_token(DocumentEndToken): + self.get_token() + + # Parse an explicit document. + if not self.check_token(StreamEndToken): + token = self.peek_token() + start_mark = token.start_mark + version, tags = self.process_directives() + if not self.check_token(DocumentStartToken): + raise ParserError(None, None, + "expected '', but found %r" + % self.peek_token().id, + self.peek_token().start_mark) + token = self.get_token() + end_mark = token.end_mark + event = DocumentStartEvent(start_mark, end_mark, + explicit=True, version=version, tags=tags) + self.states.append(self.parse_document_end) + self.state = self.parse_document_content + else: + # Parse the end of the stream. + token = self.get_token() + event = StreamEndEvent(token.start_mark, token.end_mark) + assert not self.states + assert not self.marks + self.state = None + return event + + def parse_document_end(self): + + # Parse the document end. + token = self.peek_token() + start_mark = end_mark = token.start_mark + explicit = False + if self.check_token(DocumentEndToken): + token = self.get_token() + end_mark = token.end_mark + explicit = True + event = DocumentEndEvent(start_mark, end_mark, + explicit=explicit) + + # Prepare the next state. + self.state = self.parse_document_start + + return event + + def parse_document_content(self): + if self.check_token(DirectiveToken, + DocumentStartToken, DocumentEndToken, StreamEndToken): + event = self.process_empty_scalar(self.peek_token().start_mark) + self.state = self.states.pop() + return event + else: + return self.parse_block_node() + + def process_directives(self): + self.yaml_version = None + self.tag_handles = {} + while self.check_token(DirectiveToken): + token = self.get_token() + if token.name == 'YAML': + if self.yaml_version is not None: + raise ParserError(None, None, + "found duplicate YAML directive", token.start_mark) + major, minor = token.value + if major != 1: + raise ParserError(None, None, + "found incompatible YAML document (version 1.* is required)", + token.start_mark) + self.yaml_version = token.value + elif token.name == 'TAG': + handle, prefix = token.value + if handle in self.tag_handles: + raise ParserError(None, None, + "duplicate tag handle %r" % handle, + token.start_mark) + self.tag_handles[handle] = prefix + if self.tag_handles: + value = self.yaml_version, self.tag_handles.copy() + else: + value = self.yaml_version, None + for key in self.DEFAULT_TAGS: + if key not in self.tag_handles: + self.tag_handles[key] = self.DEFAULT_TAGS[key] + return value + + # block_node_or_indentless_sequence ::= ALIAS + # | properties (block_content | indentless_block_sequence)? + # | block_content + # | indentless_block_sequence + # block_node ::= ALIAS + # | properties block_content? + # | block_content + # flow_node ::= ALIAS + # | properties flow_content? + # | flow_content + # properties ::= TAG ANCHOR? | ANCHOR TAG? + # block_content ::= block_collection | flow_collection | SCALAR + # flow_content ::= flow_collection | SCALAR + # block_collection ::= block_sequence | block_mapping + # flow_collection ::= flow_sequence | flow_mapping + + def parse_block_node(self): + return self.parse_node(block=True) + + def parse_flow_node(self): + return self.parse_node() + + def parse_block_node_or_indentless_sequence(self): + return self.parse_node(block=True, indentless_sequence=True) + + def parse_node(self, block=False, indentless_sequence=False): + if self.check_token(AliasToken): + token = self.get_token() + event = AliasEvent(token.value, token.start_mark, token.end_mark) + self.state = self.states.pop() + else: + anchor = None + tag = None + start_mark = end_mark = tag_mark = None + if self.check_token(AnchorToken): + token = self.get_token() + start_mark = token.start_mark + end_mark = token.end_mark + anchor = token.value + if self.check_token(TagToken): + token = self.get_token() + tag_mark = token.start_mark + end_mark = token.end_mark + tag = token.value + elif self.check_token(TagToken): + token = self.get_token() + start_mark = tag_mark = token.start_mark + end_mark = token.end_mark + tag = token.value + if self.check_token(AnchorToken): + token = self.get_token() + end_mark = token.end_mark + anchor = token.value + if tag is not None: + handle, suffix = tag + if handle is not None: + if handle not in self.tag_handles: + raise ParserError("while parsing a node", start_mark, + "found undefined tag handle %r" % handle, + tag_mark) + tag = self.tag_handles[handle]+suffix + else: + tag = suffix + #if tag == '!': + # raise ParserError("while parsing a node", start_mark, + # "found non-specific tag '!'", tag_mark, + # "Please check 'http://pyyaml.org/wiki/YAMLNonSpecificTag' and share your opinion.") + if start_mark is None: + start_mark = end_mark = self.peek_token().start_mark + event = None + implicit = (tag is None or tag == '!') + if indentless_sequence and self.check_token(BlockEntryToken): + end_mark = self.peek_token().end_mark + event = SequenceStartEvent(anchor, tag, implicit, + start_mark, end_mark) + self.state = self.parse_indentless_sequence_entry + else: + if self.check_token(ScalarToken): + token = self.get_token() + end_mark = token.end_mark + if (token.plain and tag is None) or tag == '!': + implicit = (True, False) + elif tag is None: + implicit = (False, True) + else: + implicit = (False, False) + event = ScalarEvent(anchor, tag, implicit, token.value, + start_mark, end_mark, style=token.style) + self.state = self.states.pop() + elif self.check_token(FlowSequenceStartToken): + end_mark = self.peek_token().end_mark + event = SequenceStartEvent(anchor, tag, implicit, + start_mark, end_mark, flow_style=True) + self.state = self.parse_flow_sequence_first_entry + elif self.check_token(FlowMappingStartToken): + end_mark = self.peek_token().end_mark + event = MappingStartEvent(anchor, tag, implicit, + start_mark, end_mark, flow_style=True) + self.state = self.parse_flow_mapping_first_key + elif block and self.check_token(BlockSequenceStartToken): + end_mark = self.peek_token().start_mark + event = SequenceStartEvent(anchor, tag, implicit, + start_mark, end_mark, flow_style=False) + self.state = self.parse_block_sequence_first_entry + elif block and self.check_token(BlockMappingStartToken): + end_mark = self.peek_token().start_mark + event = MappingStartEvent(anchor, tag, implicit, + start_mark, end_mark, flow_style=False) + self.state = self.parse_block_mapping_first_key + elif anchor is not None or tag is not None: + # Empty scalars are allowed even if a tag or an anchor is + # specified. + event = ScalarEvent(anchor, tag, (implicit, False), '', + start_mark, end_mark) + self.state = self.states.pop() + else: + if block: + node = 'block' + else: + node = 'flow' + token = self.peek_token() + raise ParserError("while parsing a %s node" % node, start_mark, + "expected the node content, but found %r" % token.id, + token.start_mark) + return event + + # block_sequence ::= BLOCK-SEQUENCE-START (BLOCK-ENTRY block_node?)* BLOCK-END + + def parse_block_sequence_first_entry(self): + token = self.get_token() + self.marks.append(token.start_mark) + return self.parse_block_sequence_entry() + + def parse_block_sequence_entry(self): + if self.check_token(BlockEntryToken): + token = self.get_token() + if not self.check_token(BlockEntryToken, BlockEndToken): + self.states.append(self.parse_block_sequence_entry) + return self.parse_block_node() + else: + self.state = self.parse_block_sequence_entry + return self.process_empty_scalar(token.end_mark) + if not self.check_token(BlockEndToken): + token = self.peek_token() + raise ParserError("while parsing a block collection", self.marks[-1], + "expected , but found %r" % token.id, token.start_mark) + token = self.get_token() + event = SequenceEndEvent(token.start_mark, token.end_mark) + self.state = self.states.pop() + self.marks.pop() + return event + + # indentless_sequence ::= (BLOCK-ENTRY block_node?)+ + + def parse_indentless_sequence_entry(self): + if self.check_token(BlockEntryToken): + token = self.get_token() + if not self.check_token(BlockEntryToken, + KeyToken, ValueToken, BlockEndToken): + self.states.append(self.parse_indentless_sequence_entry) + return self.parse_block_node() + else: + self.state = self.parse_indentless_sequence_entry + return self.process_empty_scalar(token.end_mark) + token = self.peek_token() + event = SequenceEndEvent(token.start_mark, token.start_mark) + self.state = self.states.pop() + return event + + # block_mapping ::= BLOCK-MAPPING_START + # ((KEY block_node_or_indentless_sequence?)? + # (VALUE block_node_or_indentless_sequence?)?)* + # BLOCK-END + + def parse_block_mapping_first_key(self): + token = self.get_token() + self.marks.append(token.start_mark) + return self.parse_block_mapping_key() + + def parse_block_mapping_key(self): + if self.check_token(KeyToken): + token = self.get_token() + if not self.check_token(KeyToken, ValueToken, BlockEndToken): + self.states.append(self.parse_block_mapping_value) + return self.parse_block_node_or_indentless_sequence() + else: + self.state = self.parse_block_mapping_value + return self.process_empty_scalar(token.end_mark) + if not self.check_token(BlockEndToken): + token = self.peek_token() + raise ParserError("while parsing a block mapping", self.marks[-1], + "expected , but found %r" % token.id, token.start_mark) + token = self.get_token() + event = MappingEndEvent(token.start_mark, token.end_mark) + self.state = self.states.pop() + self.marks.pop() + return event + + def parse_block_mapping_value(self): + if self.check_token(ValueToken): + token = self.get_token() + if not self.check_token(KeyToken, ValueToken, BlockEndToken): + self.states.append(self.parse_block_mapping_key) + return self.parse_block_node_or_indentless_sequence() + else: + self.state = self.parse_block_mapping_key + return self.process_empty_scalar(token.end_mark) + else: + self.state = self.parse_block_mapping_key + token = self.peek_token() + return self.process_empty_scalar(token.start_mark) + + # flow_sequence ::= FLOW-SEQUENCE-START + # (flow_sequence_entry FLOW-ENTRY)* + # flow_sequence_entry? + # FLOW-SEQUENCE-END + # flow_sequence_entry ::= flow_node | KEY flow_node? (VALUE flow_node?)? + # + # Note that while production rules for both flow_sequence_entry and + # flow_mapping_entry are equal, their interpretations are different. + # For `flow_sequence_entry`, the part `KEY flow_node? (VALUE flow_node?)?` + # generate an inline mapping (set syntax). + + def parse_flow_sequence_first_entry(self): + token = self.get_token() + self.marks.append(token.start_mark) + return self.parse_flow_sequence_entry(first=True) + + def parse_flow_sequence_entry(self, first=False): + if not self.check_token(FlowSequenceEndToken): + if not first: + if self.check_token(FlowEntryToken): + self.get_token() + else: + token = self.peek_token() + raise ParserError("while parsing a flow sequence", self.marks[-1], + "expected ',' or ']', but got %r" % token.id, token.start_mark) + + if self.check_token(KeyToken): + token = self.peek_token() + event = MappingStartEvent(None, None, True, + token.start_mark, token.end_mark, + flow_style=True) + self.state = self.parse_flow_sequence_entry_mapping_key + return event + elif not self.check_token(FlowSequenceEndToken): + self.states.append(self.parse_flow_sequence_entry) + return self.parse_flow_node() + token = self.get_token() + event = SequenceEndEvent(token.start_mark, token.end_mark) + self.state = self.states.pop() + self.marks.pop() + return event + + def parse_flow_sequence_entry_mapping_key(self): + token = self.get_token() + if not self.check_token(ValueToken, + FlowEntryToken, FlowSequenceEndToken): + self.states.append(self.parse_flow_sequence_entry_mapping_value) + return self.parse_flow_node() + else: + self.state = self.parse_flow_sequence_entry_mapping_value + return self.process_empty_scalar(token.end_mark) + + def parse_flow_sequence_entry_mapping_value(self): + if self.check_token(ValueToken): + token = self.get_token() + if not self.check_token(FlowEntryToken, FlowSequenceEndToken): + self.states.append(self.parse_flow_sequence_entry_mapping_end) + return self.parse_flow_node() + else: + self.state = self.parse_flow_sequence_entry_mapping_end + return self.process_empty_scalar(token.end_mark) + else: + self.state = self.parse_flow_sequence_entry_mapping_end + token = self.peek_token() + return self.process_empty_scalar(token.start_mark) + + def parse_flow_sequence_entry_mapping_end(self): + self.state = self.parse_flow_sequence_entry + token = self.peek_token() + return MappingEndEvent(token.start_mark, token.start_mark) + + # flow_mapping ::= FLOW-MAPPING-START + # (flow_mapping_entry FLOW-ENTRY)* + # flow_mapping_entry? + # FLOW-MAPPING-END + # flow_mapping_entry ::= flow_node | KEY flow_node? (VALUE flow_node?)? + + def parse_flow_mapping_first_key(self): + token = self.get_token() + self.marks.append(token.start_mark) + return self.parse_flow_mapping_key(first=True) + + def parse_flow_mapping_key(self, first=False): + if not self.check_token(FlowMappingEndToken): + if not first: + if self.check_token(FlowEntryToken): + self.get_token() + else: + token = self.peek_token() + raise ParserError("while parsing a flow mapping", self.marks[-1], + "expected ',' or '}', but got %r" % token.id, token.start_mark) + if self.check_token(KeyToken): + token = self.get_token() + if not self.check_token(ValueToken, + FlowEntryToken, FlowMappingEndToken): + self.states.append(self.parse_flow_mapping_value) + return self.parse_flow_node() + else: + self.state = self.parse_flow_mapping_value + return self.process_empty_scalar(token.end_mark) + elif not self.check_token(FlowMappingEndToken): + self.states.append(self.parse_flow_mapping_empty_value) + return self.parse_flow_node() + token = self.get_token() + event = MappingEndEvent(token.start_mark, token.end_mark) + self.state = self.states.pop() + self.marks.pop() + return event + + def parse_flow_mapping_value(self): + if self.check_token(ValueToken): + token = self.get_token() + if not self.check_token(FlowEntryToken, FlowMappingEndToken): + self.states.append(self.parse_flow_mapping_key) + return self.parse_flow_node() + else: + self.state = self.parse_flow_mapping_key + return self.process_empty_scalar(token.end_mark) + else: + self.state = self.parse_flow_mapping_key + token = self.peek_token() + return self.process_empty_scalar(token.start_mark) + + def parse_flow_mapping_empty_value(self): + self.state = self.parse_flow_mapping_key + return self.process_empty_scalar(self.peek_token().start_mark) + + def process_empty_scalar(self, mark): + return ScalarEvent(None, None, (True, False), '', mark, mark) + diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/yaml/reader.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/yaml/reader.py new file mode 100644 index 0000000000000000000000000000000000000000..774b0219b5932a0ee1c27e637371de5ba8d9cb16 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/yaml/reader.py @@ -0,0 +1,185 @@ +# This module contains abstractions for the input stream. You don't have to +# looks further, there are no pretty code. +# +# We define two classes here. +# +# Mark(source, line, column) +# It's just a record and its only use is producing nice error messages. +# Parser does not use it for any other purposes. +# +# Reader(source, data) +# Reader determines the encoding of `data` and converts it to unicode. +# Reader provides the following methods and attributes: +# reader.peek(length=1) - return the next `length` characters +# reader.forward(length=1) - move the current position to `length` characters. +# reader.index - the number of the current character. +# reader.line, stream.column - the line and the column of the current character. + +__all__ = ['Reader', 'ReaderError'] + +from .error import YAMLError, Mark + +import codecs, re + +class ReaderError(YAMLError): + + def __init__(self, name, position, character, encoding, reason): + self.name = name + self.character = character + self.position = position + self.encoding = encoding + self.reason = reason + + def __str__(self): + if isinstance(self.character, bytes): + return "'%s' codec can't decode byte #x%02x: %s\n" \ + " in \"%s\", position %d" \ + % (self.encoding, ord(self.character), self.reason, + self.name, self.position) + else: + return "unacceptable character #x%04x: %s\n" \ + " in \"%s\", position %d" \ + % (self.character, self.reason, + self.name, self.position) + +class Reader(object): + # Reader: + # - determines the data encoding and converts it to a unicode string, + # - checks if characters are in allowed range, + # - adds '\0' to the end. + + # Reader accepts + # - a `bytes` object, + # - a `str` object, + # - a file-like object with its `read` method returning `str`, + # - a file-like object with its `read` method returning `unicode`. + + # Yeah, it's ugly and slow. + + def __init__(self, stream): + self.name = None + self.stream = None + self.stream_pointer = 0 + self.eof = True + self.buffer = '' + self.pointer = 0 + self.raw_buffer = None + self.raw_decode = None + self.encoding = None + self.index = 0 + self.line = 0 + self.column = 0 + if isinstance(stream, str): + self.name = "" + self.check_printable(stream) + self.buffer = stream+'\0' + elif isinstance(stream, bytes): + self.name = "" + self.raw_buffer = stream + self.determine_encoding() + else: + self.stream = stream + self.name = getattr(stream, 'name', "") + self.eof = False + self.raw_buffer = None + self.determine_encoding() + + def peek(self, index=0): + try: + return self.buffer[self.pointer+index] + except IndexError: + self.update(index+1) + return self.buffer[self.pointer+index] + + def prefix(self, length=1): + if self.pointer+length >= len(self.buffer): + self.update(length) + return self.buffer[self.pointer:self.pointer+length] + + def forward(self, length=1): + if self.pointer+length+1 >= len(self.buffer): + self.update(length+1) + while length: + ch = self.buffer[self.pointer] + self.pointer += 1 + self.index += 1 + if ch in '\n\x85\u2028\u2029' \ + or (ch == '\r' and self.buffer[self.pointer] != '\n'): + self.line += 1 + self.column = 0 + elif ch != '\uFEFF': + self.column += 1 + length -= 1 + + def get_mark(self): + if self.stream is None: + return Mark(self.name, self.index, self.line, self.column, + self.buffer, self.pointer) + else: + return Mark(self.name, self.index, self.line, self.column, + None, None) + + def determine_encoding(self): + while not self.eof and (self.raw_buffer is None or len(self.raw_buffer) < 2): + self.update_raw() + if isinstance(self.raw_buffer, bytes): + if self.raw_buffer.startswith(codecs.BOM_UTF16_LE): + self.raw_decode = codecs.utf_16_le_decode + self.encoding = 'utf-16-le' + elif self.raw_buffer.startswith(codecs.BOM_UTF16_BE): + self.raw_decode = codecs.utf_16_be_decode + self.encoding = 'utf-16-be' + else: + self.raw_decode = codecs.utf_8_decode + self.encoding = 'utf-8' + self.update(1) + + NON_PRINTABLE = re.compile('[^\x09\x0A\x0D\x20-\x7E\x85\xA0-\uD7FF\uE000-\uFFFD\U00010000-\U0010ffff]') + def check_printable(self, data): + match = self.NON_PRINTABLE.search(data) + if match: + character = match.group() + position = self.index+(len(self.buffer)-self.pointer)+match.start() + raise ReaderError(self.name, position, ord(character), + 'unicode', "special characters are not allowed") + + def update(self, length): + if self.raw_buffer is None: + return + self.buffer = self.buffer[self.pointer:] + self.pointer = 0 + while len(self.buffer) < length: + if not self.eof: + self.update_raw() + if self.raw_decode is not None: + try: + data, converted = self.raw_decode(self.raw_buffer, + 'strict', self.eof) + except UnicodeDecodeError as exc: + character = self.raw_buffer[exc.start] + if self.stream is not None: + position = self.stream_pointer-len(self.raw_buffer)+exc.start + else: + position = exc.start + raise ReaderError(self.name, position, character, + exc.encoding, exc.reason) + else: + data = self.raw_buffer + converted = len(data) + self.check_printable(data) + self.buffer += data + self.raw_buffer = self.raw_buffer[converted:] + if self.eof: + self.buffer += '\0' + self.raw_buffer = None + break + + def update_raw(self, size=4096): + data = self.stream.read(size) + if self.raw_buffer is None: + self.raw_buffer = data + else: + self.raw_buffer += data + self.stream_pointer += len(data) + if not data: + self.eof = True diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/yaml/representer.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/yaml/representer.py new file mode 100644 index 0000000000000000000000000000000000000000..808ca06dfbd60c9a23eb079151b74a82ef688749 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/yaml/representer.py @@ -0,0 +1,389 @@ + +__all__ = ['BaseRepresenter', 'SafeRepresenter', 'Representer', + 'RepresenterError'] + +from .error import * +from .nodes import * + +import datetime, copyreg, types, base64, collections + +class RepresenterError(YAMLError): + pass + +class BaseRepresenter: + + yaml_representers = {} + yaml_multi_representers = {} + + def __init__(self, default_style=None, default_flow_style=False, sort_keys=True): + self.default_style = default_style + self.sort_keys = sort_keys + self.default_flow_style = default_flow_style + self.represented_objects = {} + self.object_keeper = [] + self.alias_key = None + + def represent(self, data): + node = self.represent_data(data) + self.serialize(node) + self.represented_objects = {} + self.object_keeper = [] + self.alias_key = None + + def represent_data(self, data): + if self.ignore_aliases(data): + self.alias_key = None + else: + self.alias_key = id(data) + if self.alias_key is not None: + if self.alias_key in self.represented_objects: + node = self.represented_objects[self.alias_key] + #if node is None: + # raise RepresenterError("recursive objects are not allowed: %r" % data) + return node + #self.represented_objects[alias_key] = None + self.object_keeper.append(data) + data_types = type(data).__mro__ + if data_types[0] in self.yaml_representers: + node = self.yaml_representers[data_types[0]](self, data) + else: + for data_type in data_types: + if data_type in self.yaml_multi_representers: + node = self.yaml_multi_representers[data_type](self, data) + break + else: + if None in self.yaml_multi_representers: + node = self.yaml_multi_representers[None](self, data) + elif None in self.yaml_representers: + node = self.yaml_representers[None](self, data) + else: + node = ScalarNode(None, str(data)) + #if alias_key is not None: + # self.represented_objects[alias_key] = node + return node + + @classmethod + def add_representer(cls, data_type, representer): + if not 'yaml_representers' in cls.__dict__: + cls.yaml_representers = cls.yaml_representers.copy() + cls.yaml_representers[data_type] = representer + + @classmethod + def add_multi_representer(cls, data_type, representer): + if not 'yaml_multi_representers' in cls.__dict__: + cls.yaml_multi_representers = cls.yaml_multi_representers.copy() + cls.yaml_multi_representers[data_type] = representer + + def represent_scalar(self, tag, value, style=None): + if style is None: + style = self.default_style + node = ScalarNode(tag, value, style=style) + if self.alias_key is not None: + self.represented_objects[self.alias_key] = node + return node + + def represent_sequence(self, tag, sequence, flow_style=None): + value = [] + node = SequenceNode(tag, value, flow_style=flow_style) + if self.alias_key is not None: + self.represented_objects[self.alias_key] = node + best_style = True + for item in sequence: + node_item = self.represent_data(item) + if not (isinstance(node_item, ScalarNode) and not node_item.style): + best_style = False + value.append(node_item) + if flow_style is None: + if self.default_flow_style is not None: + node.flow_style = self.default_flow_style + else: + node.flow_style = best_style + return node + + def represent_mapping(self, tag, mapping, flow_style=None): + value = [] + node = MappingNode(tag, value, flow_style=flow_style) + if self.alias_key is not None: + self.represented_objects[self.alias_key] = node + best_style = True + if hasattr(mapping, 'items'): + mapping = list(mapping.items()) + if self.sort_keys: + try: + mapping = sorted(mapping) + except TypeError: + pass + for item_key, item_value in mapping: + node_key = self.represent_data(item_key) + node_value = self.represent_data(item_value) + if not (isinstance(node_key, ScalarNode) and not node_key.style): + best_style = False + if not (isinstance(node_value, ScalarNode) and not node_value.style): + best_style = False + value.append((node_key, node_value)) + if flow_style is None: + if self.default_flow_style is not None: + node.flow_style = self.default_flow_style + else: + node.flow_style = best_style + return node + + def ignore_aliases(self, data): + return False + +class SafeRepresenter(BaseRepresenter): + + def ignore_aliases(self, data): + if data is None: + return True + if isinstance(data, tuple) and data == (): + return True + if isinstance(data, (str, bytes, bool, int, float)): + return True + + def represent_none(self, data): + return self.represent_scalar('tag:yaml.org,2002:null', 'null') + + def represent_str(self, data): + return self.represent_scalar('tag:yaml.org,2002:str', data) + + def represent_binary(self, data): + if hasattr(base64, 'encodebytes'): + data = base64.encodebytes(data).decode('ascii') + else: + data = base64.encodestring(data).decode('ascii') + return self.represent_scalar('tag:yaml.org,2002:binary', data, style='|') + + def represent_bool(self, data): + if data: + value = 'true' + else: + value = 'false' + return self.represent_scalar('tag:yaml.org,2002:bool', value) + + def represent_int(self, data): + return self.represent_scalar('tag:yaml.org,2002:int', str(data)) + + inf_value = 1e300 + while repr(inf_value) != repr(inf_value*inf_value): + inf_value *= inf_value + + def represent_float(self, data): + if data != data or (data == 0.0 and data == 1.0): + value = '.nan' + elif data == self.inf_value: + value = '.inf' + elif data == -self.inf_value: + value = '-.inf' + else: + value = repr(data).lower() + # Note that in some cases `repr(data)` represents a float number + # without the decimal parts. For instance: + # >>> repr(1e17) + # '1e17' + # Unfortunately, this is not a valid float representation according + # to the definition of the `!!float` tag. We fix this by adding + # '.0' before the 'e' symbol. + if '.' not in value and 'e' in value: + value = value.replace('e', '.0e', 1) + return self.represent_scalar('tag:yaml.org,2002:float', value) + + def represent_list(self, data): + #pairs = (len(data) > 0 and isinstance(data, list)) + #if pairs: + # for item in data: + # if not isinstance(item, tuple) or len(item) != 2: + # pairs = False + # break + #if not pairs: + return self.represent_sequence('tag:yaml.org,2002:seq', data) + #value = [] + #for item_key, item_value in data: + # value.append(self.represent_mapping(u'tag:yaml.org,2002:map', + # [(item_key, item_value)])) + #return SequenceNode(u'tag:yaml.org,2002:pairs', value) + + def represent_dict(self, data): + return self.represent_mapping('tag:yaml.org,2002:map', data) + + def represent_set(self, data): + value = {} + for key in data: + value[key] = None + return self.represent_mapping('tag:yaml.org,2002:set', value) + + def represent_date(self, data): + value = data.isoformat() + return self.represent_scalar('tag:yaml.org,2002:timestamp', value) + + def represent_datetime(self, data): + value = data.isoformat(' ') + return self.represent_scalar('tag:yaml.org,2002:timestamp', value) + + def represent_yaml_object(self, tag, data, cls, flow_style=None): + if hasattr(data, '__getstate__'): + state = data.__getstate__() + else: + state = data.__dict__.copy() + return self.represent_mapping(tag, state, flow_style=flow_style) + + def represent_undefined(self, data): + raise RepresenterError("cannot represent an object", data) + +SafeRepresenter.add_representer(type(None), + SafeRepresenter.represent_none) + +SafeRepresenter.add_representer(str, + SafeRepresenter.represent_str) + +SafeRepresenter.add_representer(bytes, + SafeRepresenter.represent_binary) + +SafeRepresenter.add_representer(bool, + SafeRepresenter.represent_bool) + +SafeRepresenter.add_representer(int, + SafeRepresenter.represent_int) + +SafeRepresenter.add_representer(float, + SafeRepresenter.represent_float) + +SafeRepresenter.add_representer(list, + SafeRepresenter.represent_list) + +SafeRepresenter.add_representer(tuple, + SafeRepresenter.represent_list) + +SafeRepresenter.add_representer(dict, + SafeRepresenter.represent_dict) + +SafeRepresenter.add_representer(set, + SafeRepresenter.represent_set) + +SafeRepresenter.add_representer(datetime.date, + SafeRepresenter.represent_date) + +SafeRepresenter.add_representer(datetime.datetime, + SafeRepresenter.represent_datetime) + +SafeRepresenter.add_representer(None, + SafeRepresenter.represent_undefined) + +class Representer(SafeRepresenter): + + def represent_complex(self, data): + if data.imag == 0.0: + data = '%r' % data.real + elif data.real == 0.0: + data = '%rj' % data.imag + elif data.imag > 0: + data = '%r+%rj' % (data.real, data.imag) + else: + data = '%r%rj' % (data.real, data.imag) + return self.represent_scalar('tag:yaml.org,2002:python/complex', data) + + def represent_tuple(self, data): + return self.represent_sequence('tag:yaml.org,2002:python/tuple', data) + + def represent_name(self, data): + name = '%s.%s' % (data.__module__, data.__name__) + return self.represent_scalar('tag:yaml.org,2002:python/name:'+name, '') + + def represent_module(self, data): + return self.represent_scalar( + 'tag:yaml.org,2002:python/module:'+data.__name__, '') + + def represent_object(self, data): + # We use __reduce__ API to save the data. data.__reduce__ returns + # a tuple of length 2-5: + # (function, args, state, listitems, dictitems) + + # For reconstructing, we calls function(*args), then set its state, + # listitems, and dictitems if they are not None. + + # A special case is when function.__name__ == '__newobj__'. In this + # case we create the object with args[0].__new__(*args). + + # Another special case is when __reduce__ returns a string - we don't + # support it. + + # We produce a !!python/object, !!python/object/new or + # !!python/object/apply node. + + cls = type(data) + if cls in copyreg.dispatch_table: + reduce = copyreg.dispatch_table[cls](data) + elif hasattr(data, '__reduce_ex__'): + reduce = data.__reduce_ex__(2) + elif hasattr(data, '__reduce__'): + reduce = data.__reduce__() + else: + raise RepresenterError("cannot represent an object", data) + reduce = (list(reduce)+[None]*5)[:5] + function, args, state, listitems, dictitems = reduce + args = list(args) + if state is None: + state = {} + if listitems is not None: + listitems = list(listitems) + if dictitems is not None: + dictitems = dict(dictitems) + if function.__name__ == '__newobj__': + function = args[0] + args = args[1:] + tag = 'tag:yaml.org,2002:python/object/new:' + newobj = True + else: + tag = 'tag:yaml.org,2002:python/object/apply:' + newobj = False + function_name = '%s.%s' % (function.__module__, function.__name__) + if not args and not listitems and not dictitems \ + and isinstance(state, dict) and newobj: + return self.represent_mapping( + 'tag:yaml.org,2002:python/object:'+function_name, state) + if not listitems and not dictitems \ + and isinstance(state, dict) and not state: + return self.represent_sequence(tag+function_name, args) + value = {} + if args: + value['args'] = args + if state or not isinstance(state, dict): + value['state'] = state + if listitems: + value['listitems'] = listitems + if dictitems: + value['dictitems'] = dictitems + return self.represent_mapping(tag+function_name, value) + + def represent_ordered_dict(self, data): + # Provide uniform representation across different Python versions. + data_type = type(data) + tag = 'tag:yaml.org,2002:python/object/apply:%s.%s' \ + % (data_type.__module__, data_type.__name__) + items = [[key, value] for key, value in data.items()] + return self.represent_sequence(tag, [items]) + +Representer.add_representer(complex, + Representer.represent_complex) + +Representer.add_representer(tuple, + Representer.represent_tuple) + +Representer.add_multi_representer(type, + Representer.represent_name) + +Representer.add_representer(collections.OrderedDict, + Representer.represent_ordered_dict) + +Representer.add_representer(types.FunctionType, + Representer.represent_name) + +Representer.add_representer(types.BuiltinFunctionType, + Representer.represent_name) + +Representer.add_representer(types.ModuleType, + Representer.represent_module) + +Representer.add_multi_representer(object, + Representer.represent_object) + diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/yaml/resolver.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/yaml/resolver.py new file mode 100644 index 0000000000000000000000000000000000000000..3522bdaaf6358110b608f4e6503b9d314c82d887 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/yaml/resolver.py @@ -0,0 +1,227 @@ + +__all__ = ['BaseResolver', 'Resolver'] + +from .error import * +from .nodes import * + +import re + +class ResolverError(YAMLError): + pass + +class BaseResolver: + + DEFAULT_SCALAR_TAG = 'tag:yaml.org,2002:str' + DEFAULT_SEQUENCE_TAG = 'tag:yaml.org,2002:seq' + DEFAULT_MAPPING_TAG = 'tag:yaml.org,2002:map' + + yaml_implicit_resolvers = {} + yaml_path_resolvers = {} + + def __init__(self): + self.resolver_exact_paths = [] + self.resolver_prefix_paths = [] + + @classmethod + def add_implicit_resolver(cls, tag, regexp, first): + if not 'yaml_implicit_resolvers' in cls.__dict__: + implicit_resolvers = {} + for key in cls.yaml_implicit_resolvers: + implicit_resolvers[key] = cls.yaml_implicit_resolvers[key][:] + cls.yaml_implicit_resolvers = implicit_resolvers + if first is None: + first = [None] + for ch in first: + cls.yaml_implicit_resolvers.setdefault(ch, []).append((tag, regexp)) + + @classmethod + def add_path_resolver(cls, tag, path, kind=None): + # Note: `add_path_resolver` is experimental. The API could be changed. + # `new_path` is a pattern that is matched against the path from the + # root to the node that is being considered. `node_path` elements are + # tuples `(node_check, index_check)`. `node_check` is a node class: + # `ScalarNode`, `SequenceNode`, `MappingNode` or `None`. `None` + # matches any kind of a node. `index_check` could be `None`, a boolean + # value, a string value, or a number. `None` and `False` match against + # any _value_ of sequence and mapping nodes. `True` matches against + # any _key_ of a mapping node. A string `index_check` matches against + # a mapping value that corresponds to a scalar key which content is + # equal to the `index_check` value. An integer `index_check` matches + # against a sequence value with the index equal to `index_check`. + if not 'yaml_path_resolvers' in cls.__dict__: + cls.yaml_path_resolvers = cls.yaml_path_resolvers.copy() + new_path = [] + for element in path: + if isinstance(element, (list, tuple)): + if len(element) == 2: + node_check, index_check = element + elif len(element) == 1: + node_check = element[0] + index_check = True + else: + raise ResolverError("Invalid path element: %s" % element) + else: + node_check = None + index_check = element + if node_check is str: + node_check = ScalarNode + elif node_check is list: + node_check = SequenceNode + elif node_check is dict: + node_check = MappingNode + elif node_check not in [ScalarNode, SequenceNode, MappingNode] \ + and not isinstance(node_check, str) \ + and node_check is not None: + raise ResolverError("Invalid node checker: %s" % node_check) + if not isinstance(index_check, (str, int)) \ + and index_check is not None: + raise ResolverError("Invalid index checker: %s" % index_check) + new_path.append((node_check, index_check)) + if kind is str: + kind = ScalarNode + elif kind is list: + kind = SequenceNode + elif kind is dict: + kind = MappingNode + elif kind not in [ScalarNode, SequenceNode, MappingNode] \ + and kind is not None: + raise ResolverError("Invalid node kind: %s" % kind) + cls.yaml_path_resolvers[tuple(new_path), kind] = tag + + def descend_resolver(self, current_node, current_index): + if not self.yaml_path_resolvers: + return + exact_paths = {} + prefix_paths = [] + if current_node: + depth = len(self.resolver_prefix_paths) + for path, kind in self.resolver_prefix_paths[-1]: + if self.check_resolver_prefix(depth, path, kind, + current_node, current_index): + if len(path) > depth: + prefix_paths.append((path, kind)) + else: + exact_paths[kind] = self.yaml_path_resolvers[path, kind] + else: + for path, kind in self.yaml_path_resolvers: + if not path: + exact_paths[kind] = self.yaml_path_resolvers[path, kind] + else: + prefix_paths.append((path, kind)) + self.resolver_exact_paths.append(exact_paths) + self.resolver_prefix_paths.append(prefix_paths) + + def ascend_resolver(self): + if not self.yaml_path_resolvers: + return + self.resolver_exact_paths.pop() + self.resolver_prefix_paths.pop() + + def check_resolver_prefix(self, depth, path, kind, + current_node, current_index): + node_check, index_check = path[depth-1] + if isinstance(node_check, str): + if current_node.tag != node_check: + return + elif node_check is not None: + if not isinstance(current_node, node_check): + return + if index_check is True and current_index is not None: + return + if (index_check is False or index_check is None) \ + and current_index is None: + return + if isinstance(index_check, str): + if not (isinstance(current_index, ScalarNode) + and index_check == current_index.value): + return + elif isinstance(index_check, int) and not isinstance(index_check, bool): + if index_check != current_index: + return + return True + + def resolve(self, kind, value, implicit): + if kind is ScalarNode and implicit[0]: + if value == '': + resolvers = self.yaml_implicit_resolvers.get('', []) + else: + resolvers = self.yaml_implicit_resolvers.get(value[0], []) + wildcard_resolvers = self.yaml_implicit_resolvers.get(None, []) + for tag, regexp in resolvers + wildcard_resolvers: + if regexp.match(value): + return tag + implicit = implicit[1] + if self.yaml_path_resolvers: + exact_paths = self.resolver_exact_paths[-1] + if kind in exact_paths: + return exact_paths[kind] + if None in exact_paths: + return exact_paths[None] + if kind is ScalarNode: + return self.DEFAULT_SCALAR_TAG + elif kind is SequenceNode: + return self.DEFAULT_SEQUENCE_TAG + elif kind is MappingNode: + return self.DEFAULT_MAPPING_TAG + +class Resolver(BaseResolver): + pass + +Resolver.add_implicit_resolver( + 'tag:yaml.org,2002:bool', + re.compile(r'''^(?:yes|Yes|YES|no|No|NO + |true|True|TRUE|false|False|FALSE + |on|On|ON|off|Off|OFF)$''', re.X), + list('yYnNtTfFoO')) + +Resolver.add_implicit_resolver( + 'tag:yaml.org,2002:float', + re.compile(r'''^(?:[-+]?(?:[0-9][0-9_]*)\.[0-9_]*(?:[eE][-+][0-9]+)? + |\.[0-9][0-9_]*(?:[eE][-+][0-9]+)? + |[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]* + |[-+]?\.(?:inf|Inf|INF) + |\.(?:nan|NaN|NAN))$''', re.X), + list('-+0123456789.')) + +Resolver.add_implicit_resolver( + 'tag:yaml.org,2002:int', + re.compile(r'''^(?:[-+]?0b[0-1_]+ + |[-+]?0[0-7_]+ + |[-+]?(?:0|[1-9][0-9_]*) + |[-+]?0x[0-9a-fA-F_]+ + |[-+]?[1-9][0-9_]*(?::[0-5]?[0-9])+)$''', re.X), + list('-+0123456789')) + +Resolver.add_implicit_resolver( + 'tag:yaml.org,2002:merge', + re.compile(r'^(?:<<)$'), + ['<']) + +Resolver.add_implicit_resolver( + 'tag:yaml.org,2002:null', + re.compile(r'''^(?: ~ + |null|Null|NULL + | )$''', re.X), + ['~', 'n', 'N', '']) + +Resolver.add_implicit_resolver( + 'tag:yaml.org,2002:timestamp', + re.compile(r'''^(?:[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9] + |[0-9][0-9][0-9][0-9] -[0-9][0-9]? -[0-9][0-9]? + (?:[Tt]|[ \t]+)[0-9][0-9]? + :[0-9][0-9] :[0-9][0-9] (?:\.[0-9]*)? + (?:[ \t]*(?:Z|[-+][0-9][0-9]?(?::[0-9][0-9])?))?)$''', re.X), + list('0123456789')) + +Resolver.add_implicit_resolver( + 'tag:yaml.org,2002:value', + re.compile(r'^(?:=)$'), + ['=']) + +# The following resolver is only for documentation purposes. It cannot work +# because plain scalars cannot start with '!', '&', or '*'. +Resolver.add_implicit_resolver( + 'tag:yaml.org,2002:yaml', + re.compile(r'^(?:!|&|\*)$'), + list('!&*')) + diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/yaml/scanner.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/yaml/scanner.py new file mode 100644 index 0000000000000000000000000000000000000000..de925b07f1eaec33c9c305a8a69f9eb7ac5983c5 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/yaml/scanner.py @@ -0,0 +1,1435 @@ + +# Scanner produces tokens of the following types: +# STREAM-START +# STREAM-END +# DIRECTIVE(name, value) +# DOCUMENT-START +# DOCUMENT-END +# BLOCK-SEQUENCE-START +# BLOCK-MAPPING-START +# BLOCK-END +# FLOW-SEQUENCE-START +# FLOW-MAPPING-START +# FLOW-SEQUENCE-END +# FLOW-MAPPING-END +# BLOCK-ENTRY +# FLOW-ENTRY +# KEY +# VALUE +# ALIAS(value) +# ANCHOR(value) +# TAG(value) +# SCALAR(value, plain, style) +# +# Read comments in the Scanner code for more details. +# + +__all__ = ['Scanner', 'ScannerError'] + +from .error import MarkedYAMLError +from .tokens import * + +class ScannerError(MarkedYAMLError): + pass + +class SimpleKey: + # See below simple keys treatment. + + def __init__(self, token_number, required, index, line, column, mark): + self.token_number = token_number + self.required = required + self.index = index + self.line = line + self.column = column + self.mark = mark + +class Scanner: + + def __init__(self): + """Initialize the scanner.""" + # It is assumed that Scanner and Reader will have a common descendant. + # Reader do the dirty work of checking for BOM and converting the + # input data to Unicode. It also adds NUL to the end. + # + # Reader supports the following methods + # self.peek(i=0) # peek the next i-th character + # self.prefix(l=1) # peek the next l characters + # self.forward(l=1) # read the next l characters and move the pointer. + + # Had we reached the end of the stream? + self.done = False + + # The number of unclosed '{' and '['. `flow_level == 0` means block + # context. + self.flow_level = 0 + + # List of processed tokens that are not yet emitted. + self.tokens = [] + + # Add the STREAM-START token. + self.fetch_stream_start() + + # Number of tokens that were emitted through the `get_token` method. + self.tokens_taken = 0 + + # The current indentation level. + self.indent = -1 + + # Past indentation levels. + self.indents = [] + + # Variables related to simple keys treatment. + + # A simple key is a key that is not denoted by the '?' indicator. + # Example of simple keys: + # --- + # block simple key: value + # ? not a simple key: + # : { flow simple key: value } + # We emit the KEY token before all keys, so when we find a potential + # simple key, we try to locate the corresponding ':' indicator. + # Simple keys should be limited to a single line and 1024 characters. + + # Can a simple key start at the current position? A simple key may + # start: + # - at the beginning of the line, not counting indentation spaces + # (in block context), + # - after '{', '[', ',' (in the flow context), + # - after '?', ':', '-' (in the block context). + # In the block context, this flag also signifies if a block collection + # may start at the current position. + self.allow_simple_key = True + + # Keep track of possible simple keys. This is a dictionary. The key + # is `flow_level`; there can be no more that one possible simple key + # for each level. The value is a SimpleKey record: + # (token_number, required, index, line, column, mark) + # A simple key may start with ALIAS, ANCHOR, TAG, SCALAR(flow), + # '[', or '{' tokens. + self.possible_simple_keys = {} + + # Public methods. + + def check_token(self, *choices): + # Check if the next token is one of the given types. + while self.need_more_tokens(): + self.fetch_more_tokens() + if self.tokens: + if not choices: + return True + for choice in choices: + if isinstance(self.tokens[0], choice): + return True + return False + + def peek_token(self): + # Return the next token, but do not delete if from the queue. + # Return None if no more tokens. + while self.need_more_tokens(): + self.fetch_more_tokens() + if self.tokens: + return self.tokens[0] + else: + return None + + def get_token(self): + # Return the next token. + while self.need_more_tokens(): + self.fetch_more_tokens() + if self.tokens: + self.tokens_taken += 1 + return self.tokens.pop(0) + + # Private methods. + + def need_more_tokens(self): + if self.done: + return False + if not self.tokens: + return True + # The current token may be a potential simple key, so we + # need to look further. + self.stale_possible_simple_keys() + if self.next_possible_simple_key() == self.tokens_taken: + return True + + def fetch_more_tokens(self): + + # Eat whitespaces and comments until we reach the next token. + self.scan_to_next_token() + + # Remove obsolete possible simple keys. + self.stale_possible_simple_keys() + + # Compare the current indentation and column. It may add some tokens + # and decrease the current indentation level. + self.unwind_indent(self.column) + + # Peek the next character. + ch = self.peek() + + # Is it the end of stream? + if ch == '\0': + return self.fetch_stream_end() + + # Is it a directive? + if ch == '%' and self.check_directive(): + return self.fetch_directive() + + # Is it the document start? + if ch == '-' and self.check_document_start(): + return self.fetch_document_start() + + # Is it the document end? + if ch == '.' and self.check_document_end(): + return self.fetch_document_end() + + # TODO: support for BOM within a stream. + #if ch == '\uFEFF': + # return self.fetch_bom() <-- issue BOMToken + + # Note: the order of the following checks is NOT significant. + + # Is it the flow sequence start indicator? + if ch == '[': + return self.fetch_flow_sequence_start() + + # Is it the flow mapping start indicator? + if ch == '{': + return self.fetch_flow_mapping_start() + + # Is it the flow sequence end indicator? + if ch == ']': + return self.fetch_flow_sequence_end() + + # Is it the flow mapping end indicator? + if ch == '}': + return self.fetch_flow_mapping_end() + + # Is it the flow entry indicator? + if ch == ',': + return self.fetch_flow_entry() + + # Is it the block entry indicator? + if ch == '-' and self.check_block_entry(): + return self.fetch_block_entry() + + # Is it the key indicator? + if ch == '?' and self.check_key(): + return self.fetch_key() + + # Is it the value indicator? + if ch == ':' and self.check_value(): + return self.fetch_value() + + # Is it an alias? + if ch == '*': + return self.fetch_alias() + + # Is it an anchor? + if ch == '&': + return self.fetch_anchor() + + # Is it a tag? + if ch == '!': + return self.fetch_tag() + + # Is it a literal scalar? + if ch == '|' and not self.flow_level: + return self.fetch_literal() + + # Is it a folded scalar? + if ch == '>' and not self.flow_level: + return self.fetch_folded() + + # Is it a single quoted scalar? + if ch == '\'': + return self.fetch_single() + + # Is it a double quoted scalar? + if ch == '\"': + return self.fetch_double() + + # It must be a plain scalar then. + if self.check_plain(): + return self.fetch_plain() + + # No? It's an error. Let's produce a nice error message. + raise ScannerError("while scanning for the next token", None, + "found character %r that cannot start any token" % ch, + self.get_mark()) + + # Simple keys treatment. + + def next_possible_simple_key(self): + # Return the number of the nearest possible simple key. Actually we + # don't need to loop through the whole dictionary. We may replace it + # with the following code: + # if not self.possible_simple_keys: + # return None + # return self.possible_simple_keys[ + # min(self.possible_simple_keys.keys())].token_number + min_token_number = None + for level in self.possible_simple_keys: + key = self.possible_simple_keys[level] + if min_token_number is None or key.token_number < min_token_number: + min_token_number = key.token_number + return min_token_number + + def stale_possible_simple_keys(self): + # Remove entries that are no longer possible simple keys. According to + # the YAML specification, simple keys + # - should be limited to a single line, + # - should be no longer than 1024 characters. + # Disabling this procedure will allow simple keys of any length and + # height (may cause problems if indentation is broken though). + for level in list(self.possible_simple_keys): + key = self.possible_simple_keys[level] + if key.line != self.line \ + or self.index-key.index > 1024: + if key.required: + raise ScannerError("while scanning a simple key", key.mark, + "could not find expected ':'", self.get_mark()) + del self.possible_simple_keys[level] + + def save_possible_simple_key(self): + # The next token may start a simple key. We check if it's possible + # and save its position. This function is called for + # ALIAS, ANCHOR, TAG, SCALAR(flow), '[', and '{'. + + # Check if a simple key is required at the current position. + required = not self.flow_level and self.indent == self.column + + # The next token might be a simple key. Let's save it's number and + # position. + if self.allow_simple_key: + self.remove_possible_simple_key() + token_number = self.tokens_taken+len(self.tokens) + key = SimpleKey(token_number, required, + self.index, self.line, self.column, self.get_mark()) + self.possible_simple_keys[self.flow_level] = key + + def remove_possible_simple_key(self): + # Remove the saved possible key position at the current flow level. + if self.flow_level in self.possible_simple_keys: + key = self.possible_simple_keys[self.flow_level] + + if key.required: + raise ScannerError("while scanning a simple key", key.mark, + "could not find expected ':'", self.get_mark()) + + del self.possible_simple_keys[self.flow_level] + + # Indentation functions. + + def unwind_indent(self, column): + + ## In flow context, tokens should respect indentation. + ## Actually the condition should be `self.indent >= column` according to + ## the spec. But this condition will prohibit intuitively correct + ## constructions such as + ## key : { + ## } + #if self.flow_level and self.indent > column: + # raise ScannerError(None, None, + # "invalid indentation or unclosed '[' or '{'", + # self.get_mark()) + + # In the flow context, indentation is ignored. We make the scanner less + # restrictive then specification requires. + if self.flow_level: + return + + # In block context, we may need to issue the BLOCK-END tokens. + while self.indent > column: + mark = self.get_mark() + self.indent = self.indents.pop() + self.tokens.append(BlockEndToken(mark, mark)) + + def add_indent(self, column): + # Check if we need to increase indentation. + if self.indent < column: + self.indents.append(self.indent) + self.indent = column + return True + return False + + # Fetchers. + + def fetch_stream_start(self): + # We always add STREAM-START as the first token and STREAM-END as the + # last token. + + # Read the token. + mark = self.get_mark() + + # Add STREAM-START. + self.tokens.append(StreamStartToken(mark, mark, + encoding=self.encoding)) + + + def fetch_stream_end(self): + + # Set the current indentation to -1. + self.unwind_indent(-1) + + # Reset simple keys. + self.remove_possible_simple_key() + self.allow_simple_key = False + self.possible_simple_keys = {} + + # Read the token. + mark = self.get_mark() + + # Add STREAM-END. + self.tokens.append(StreamEndToken(mark, mark)) + + # The steam is finished. + self.done = True + + def fetch_directive(self): + + # Set the current indentation to -1. + self.unwind_indent(-1) + + # Reset simple keys. + self.remove_possible_simple_key() + self.allow_simple_key = False + + # Scan and add DIRECTIVE. + self.tokens.append(self.scan_directive()) + + def fetch_document_start(self): + self.fetch_document_indicator(DocumentStartToken) + + def fetch_document_end(self): + self.fetch_document_indicator(DocumentEndToken) + + def fetch_document_indicator(self, TokenClass): + + # Set the current indentation to -1. + self.unwind_indent(-1) + + # Reset simple keys. Note that there could not be a block collection + # after '---'. + self.remove_possible_simple_key() + self.allow_simple_key = False + + # Add DOCUMENT-START or DOCUMENT-END. + start_mark = self.get_mark() + self.forward(3) + end_mark = self.get_mark() + self.tokens.append(TokenClass(start_mark, end_mark)) + + def fetch_flow_sequence_start(self): + self.fetch_flow_collection_start(FlowSequenceStartToken) + + def fetch_flow_mapping_start(self): + self.fetch_flow_collection_start(FlowMappingStartToken) + + def fetch_flow_collection_start(self, TokenClass): + + # '[' and '{' may start a simple key. + self.save_possible_simple_key() + + # Increase the flow level. + self.flow_level += 1 + + # Simple keys are allowed after '[' and '{'. + self.allow_simple_key = True + + # Add FLOW-SEQUENCE-START or FLOW-MAPPING-START. + start_mark = self.get_mark() + self.forward() + end_mark = self.get_mark() + self.tokens.append(TokenClass(start_mark, end_mark)) + + def fetch_flow_sequence_end(self): + self.fetch_flow_collection_end(FlowSequenceEndToken) + + def fetch_flow_mapping_end(self): + self.fetch_flow_collection_end(FlowMappingEndToken) + + def fetch_flow_collection_end(self, TokenClass): + + # Reset possible simple key on the current level. + self.remove_possible_simple_key() + + # Decrease the flow level. + self.flow_level -= 1 + + # No simple keys after ']' or '}'. + self.allow_simple_key = False + + # Add FLOW-SEQUENCE-END or FLOW-MAPPING-END. + start_mark = self.get_mark() + self.forward() + end_mark = self.get_mark() + self.tokens.append(TokenClass(start_mark, end_mark)) + + def fetch_flow_entry(self): + + # Simple keys are allowed after ','. + self.allow_simple_key = True + + # Reset possible simple key on the current level. + self.remove_possible_simple_key() + + # Add FLOW-ENTRY. + start_mark = self.get_mark() + self.forward() + end_mark = self.get_mark() + self.tokens.append(FlowEntryToken(start_mark, end_mark)) + + def fetch_block_entry(self): + + # Block context needs additional checks. + if not self.flow_level: + + # Are we allowed to start a new entry? + if not self.allow_simple_key: + raise ScannerError(None, None, + "sequence entries are not allowed here", + self.get_mark()) + + # We may need to add BLOCK-SEQUENCE-START. + if self.add_indent(self.column): + mark = self.get_mark() + self.tokens.append(BlockSequenceStartToken(mark, mark)) + + # It's an error for the block entry to occur in the flow context, + # but we let the parser detect this. + else: + pass + + # Simple keys are allowed after '-'. + self.allow_simple_key = True + + # Reset possible simple key on the current level. + self.remove_possible_simple_key() + + # Add BLOCK-ENTRY. + start_mark = self.get_mark() + self.forward() + end_mark = self.get_mark() + self.tokens.append(BlockEntryToken(start_mark, end_mark)) + + def fetch_key(self): + + # Block context needs additional checks. + if not self.flow_level: + + # Are we allowed to start a key (not necessary a simple)? + if not self.allow_simple_key: + raise ScannerError(None, None, + "mapping keys are not allowed here", + self.get_mark()) + + # We may need to add BLOCK-MAPPING-START. + if self.add_indent(self.column): + mark = self.get_mark() + self.tokens.append(BlockMappingStartToken(mark, mark)) + + # Simple keys are allowed after '?' in the block context. + self.allow_simple_key = not self.flow_level + + # Reset possible simple key on the current level. + self.remove_possible_simple_key() + + # Add KEY. + start_mark = self.get_mark() + self.forward() + end_mark = self.get_mark() + self.tokens.append(KeyToken(start_mark, end_mark)) + + def fetch_value(self): + + # Do we determine a simple key? + if self.flow_level in self.possible_simple_keys: + + # Add KEY. + key = self.possible_simple_keys[self.flow_level] + del self.possible_simple_keys[self.flow_level] + self.tokens.insert(key.token_number-self.tokens_taken, + KeyToken(key.mark, key.mark)) + + # If this key starts a new block mapping, we need to add + # BLOCK-MAPPING-START. + if not self.flow_level: + if self.add_indent(key.column): + self.tokens.insert(key.token_number-self.tokens_taken, + BlockMappingStartToken(key.mark, key.mark)) + + # There cannot be two simple keys one after another. + self.allow_simple_key = False + + # It must be a part of a complex key. + else: + + # Block context needs additional checks. + # (Do we really need them? They will be caught by the parser + # anyway.) + if not self.flow_level: + + # We are allowed to start a complex value if and only if + # we can start a simple key. + if not self.allow_simple_key: + raise ScannerError(None, None, + "mapping values are not allowed here", + self.get_mark()) + + # If this value starts a new block mapping, we need to add + # BLOCK-MAPPING-START. It will be detected as an error later by + # the parser. + if not self.flow_level: + if self.add_indent(self.column): + mark = self.get_mark() + self.tokens.append(BlockMappingStartToken(mark, mark)) + + # Simple keys are allowed after ':' in the block context. + self.allow_simple_key = not self.flow_level + + # Reset possible simple key on the current level. + self.remove_possible_simple_key() + + # Add VALUE. + start_mark = self.get_mark() + self.forward() + end_mark = self.get_mark() + self.tokens.append(ValueToken(start_mark, end_mark)) + + def fetch_alias(self): + + # ALIAS could be a simple key. + self.save_possible_simple_key() + + # No simple keys after ALIAS. + self.allow_simple_key = False + + # Scan and add ALIAS. + self.tokens.append(self.scan_anchor(AliasToken)) + + def fetch_anchor(self): + + # ANCHOR could start a simple key. + self.save_possible_simple_key() + + # No simple keys after ANCHOR. + self.allow_simple_key = False + + # Scan and add ANCHOR. + self.tokens.append(self.scan_anchor(AnchorToken)) + + def fetch_tag(self): + + # TAG could start a simple key. + self.save_possible_simple_key() + + # No simple keys after TAG. + self.allow_simple_key = False + + # Scan and add TAG. + self.tokens.append(self.scan_tag()) + + def fetch_literal(self): + self.fetch_block_scalar(style='|') + + def fetch_folded(self): + self.fetch_block_scalar(style='>') + + def fetch_block_scalar(self, style): + + # A simple key may follow a block scalar. + self.allow_simple_key = True + + # Reset possible simple key on the current level. + self.remove_possible_simple_key() + + # Scan and add SCALAR. + self.tokens.append(self.scan_block_scalar(style)) + + def fetch_single(self): + self.fetch_flow_scalar(style='\'') + + def fetch_double(self): + self.fetch_flow_scalar(style='"') + + def fetch_flow_scalar(self, style): + + # A flow scalar could be a simple key. + self.save_possible_simple_key() + + # No simple keys after flow scalars. + self.allow_simple_key = False + + # Scan and add SCALAR. + self.tokens.append(self.scan_flow_scalar(style)) + + def fetch_plain(self): + + # A plain scalar could be a simple key. + self.save_possible_simple_key() + + # No simple keys after plain scalars. But note that `scan_plain` will + # change this flag if the scan is finished at the beginning of the + # line. + self.allow_simple_key = False + + # Scan and add SCALAR. May change `allow_simple_key`. + self.tokens.append(self.scan_plain()) + + # Checkers. + + def check_directive(self): + + # DIRECTIVE: ^ '%' ... + # The '%' indicator is already checked. + if self.column == 0: + return True + + def check_document_start(self): + + # DOCUMENT-START: ^ '---' (' '|'\n') + if self.column == 0: + if self.prefix(3) == '---' \ + and self.peek(3) in '\0 \t\r\n\x85\u2028\u2029': + return True + + def check_document_end(self): + + # DOCUMENT-END: ^ '...' (' '|'\n') + if self.column == 0: + if self.prefix(3) == '...' \ + and self.peek(3) in '\0 \t\r\n\x85\u2028\u2029': + return True + + def check_block_entry(self): + + # BLOCK-ENTRY: '-' (' '|'\n') + return self.peek(1) in '\0 \t\r\n\x85\u2028\u2029' + + def check_key(self): + + # KEY(flow context): '?' + if self.flow_level: + return True + + # KEY(block context): '?' (' '|'\n') + else: + return self.peek(1) in '\0 \t\r\n\x85\u2028\u2029' + + def check_value(self): + + # VALUE(flow context): ':' + if self.flow_level: + return True + + # VALUE(block context): ':' (' '|'\n') + else: + return self.peek(1) in '\0 \t\r\n\x85\u2028\u2029' + + def check_plain(self): + + # A plain scalar may start with any non-space character except: + # '-', '?', ':', ',', '[', ']', '{', '}', + # '#', '&', '*', '!', '|', '>', '\'', '\"', + # '%', '@', '`'. + # + # It may also start with + # '-', '?', ':' + # if it is followed by a non-space character. + # + # Note that we limit the last rule to the block context (except the + # '-' character) because we want the flow context to be space + # independent. + ch = self.peek() + return ch not in '\0 \t\r\n\x85\u2028\u2029-?:,[]{}#&*!|>\'\"%@`' \ + or (self.peek(1) not in '\0 \t\r\n\x85\u2028\u2029' + and (ch == '-' or (not self.flow_level and ch in '?:'))) + + # Scanners. + + def scan_to_next_token(self): + # We ignore spaces, line breaks and comments. + # If we find a line break in the block context, we set the flag + # `allow_simple_key` on. + # The byte order mark is stripped if it's the first character in the + # stream. We do not yet support BOM inside the stream as the + # specification requires. Any such mark will be considered as a part + # of the document. + # + # TODO: We need to make tab handling rules more sane. A good rule is + # Tabs cannot precede tokens + # BLOCK-SEQUENCE-START, BLOCK-MAPPING-START, BLOCK-END, + # KEY(block), VALUE(block), BLOCK-ENTRY + # So the checking code is + # if : + # self.allow_simple_keys = False + # We also need to add the check for `allow_simple_keys == True` to + # `unwind_indent` before issuing BLOCK-END. + # Scanners for block, flow, and plain scalars need to be modified. + + if self.index == 0 and self.peek() == '\uFEFF': + self.forward() + found = False + while not found: + while self.peek() == ' ': + self.forward() + if self.peek() == '#': + while self.peek() not in '\0\r\n\x85\u2028\u2029': + self.forward() + if self.scan_line_break(): + if not self.flow_level: + self.allow_simple_key = True + else: + found = True + + def scan_directive(self): + # See the specification for details. + start_mark = self.get_mark() + self.forward() + name = self.scan_directive_name(start_mark) + value = None + if name == 'YAML': + value = self.scan_yaml_directive_value(start_mark) + end_mark = self.get_mark() + elif name == 'TAG': + value = self.scan_tag_directive_value(start_mark) + end_mark = self.get_mark() + else: + end_mark = self.get_mark() + while self.peek() not in '\0\r\n\x85\u2028\u2029': + self.forward() + self.scan_directive_ignored_line(start_mark) + return DirectiveToken(name, value, start_mark, end_mark) + + def scan_directive_name(self, start_mark): + # See the specification for details. + length = 0 + ch = self.peek(length) + while '0' <= ch <= '9' or 'A' <= ch <= 'Z' or 'a' <= ch <= 'z' \ + or ch in '-_': + length += 1 + ch = self.peek(length) + if not length: + raise ScannerError("while scanning a directive", start_mark, + "expected alphabetic or numeric character, but found %r" + % ch, self.get_mark()) + value = self.prefix(length) + self.forward(length) + ch = self.peek() + if ch not in '\0 \r\n\x85\u2028\u2029': + raise ScannerError("while scanning a directive", start_mark, + "expected alphabetic or numeric character, but found %r" + % ch, self.get_mark()) + return value + + def scan_yaml_directive_value(self, start_mark): + # See the specification for details. + while self.peek() == ' ': + self.forward() + major = self.scan_yaml_directive_number(start_mark) + if self.peek() != '.': + raise ScannerError("while scanning a directive", start_mark, + "expected a digit or '.', but found %r" % self.peek(), + self.get_mark()) + self.forward() + minor = self.scan_yaml_directive_number(start_mark) + if self.peek() not in '\0 \r\n\x85\u2028\u2029': + raise ScannerError("while scanning a directive", start_mark, + "expected a digit or ' ', but found %r" % self.peek(), + self.get_mark()) + return (major, minor) + + def scan_yaml_directive_number(self, start_mark): + # See the specification for details. + ch = self.peek() + if not ('0' <= ch <= '9'): + raise ScannerError("while scanning a directive", start_mark, + "expected a digit, but found %r" % ch, self.get_mark()) + length = 0 + while '0' <= self.peek(length) <= '9': + length += 1 + value = int(self.prefix(length)) + self.forward(length) + return value + + def scan_tag_directive_value(self, start_mark): + # See the specification for details. + while self.peek() == ' ': + self.forward() + handle = self.scan_tag_directive_handle(start_mark) + while self.peek() == ' ': + self.forward() + prefix = self.scan_tag_directive_prefix(start_mark) + return (handle, prefix) + + def scan_tag_directive_handle(self, start_mark): + # See the specification for details. + value = self.scan_tag_handle('directive', start_mark) + ch = self.peek() + if ch != ' ': + raise ScannerError("while scanning a directive", start_mark, + "expected ' ', but found %r" % ch, self.get_mark()) + return value + + def scan_tag_directive_prefix(self, start_mark): + # See the specification for details. + value = self.scan_tag_uri('directive', start_mark) + ch = self.peek() + if ch not in '\0 \r\n\x85\u2028\u2029': + raise ScannerError("while scanning a directive", start_mark, + "expected ' ', but found %r" % ch, self.get_mark()) + return value + + def scan_directive_ignored_line(self, start_mark): + # See the specification for details. + while self.peek() == ' ': + self.forward() + if self.peek() == '#': + while self.peek() not in '\0\r\n\x85\u2028\u2029': + self.forward() + ch = self.peek() + if ch not in '\0\r\n\x85\u2028\u2029': + raise ScannerError("while scanning a directive", start_mark, + "expected a comment or a line break, but found %r" + % ch, self.get_mark()) + self.scan_line_break() + + def scan_anchor(self, TokenClass): + # The specification does not restrict characters for anchors and + # aliases. This may lead to problems, for instance, the document: + # [ *alias, value ] + # can be interpreted in two ways, as + # [ "value" ] + # and + # [ *alias , "value" ] + # Therefore we restrict aliases to numbers and ASCII letters. + start_mark = self.get_mark() + indicator = self.peek() + if indicator == '*': + name = 'alias' + else: + name = 'anchor' + self.forward() + length = 0 + ch = self.peek(length) + while '0' <= ch <= '9' or 'A' <= ch <= 'Z' or 'a' <= ch <= 'z' \ + or ch in '-_': + length += 1 + ch = self.peek(length) + if not length: + raise ScannerError("while scanning an %s" % name, start_mark, + "expected alphabetic or numeric character, but found %r" + % ch, self.get_mark()) + value = self.prefix(length) + self.forward(length) + ch = self.peek() + if ch not in '\0 \t\r\n\x85\u2028\u2029?:,]}%@`': + raise ScannerError("while scanning an %s" % name, start_mark, + "expected alphabetic or numeric character, but found %r" + % ch, self.get_mark()) + end_mark = self.get_mark() + return TokenClass(value, start_mark, end_mark) + + def scan_tag(self): + # See the specification for details. + start_mark = self.get_mark() + ch = self.peek(1) + if ch == '<': + handle = None + self.forward(2) + suffix = self.scan_tag_uri('tag', start_mark) + if self.peek() != '>': + raise ScannerError("while parsing a tag", start_mark, + "expected '>', but found %r" % self.peek(), + self.get_mark()) + self.forward() + elif ch in '\0 \t\r\n\x85\u2028\u2029': + handle = None + suffix = '!' + self.forward() + else: + length = 1 + use_handle = False + while ch not in '\0 \r\n\x85\u2028\u2029': + if ch == '!': + use_handle = True + break + length += 1 + ch = self.peek(length) + handle = '!' + if use_handle: + handle = self.scan_tag_handle('tag', start_mark) + else: + handle = '!' + self.forward() + suffix = self.scan_tag_uri('tag', start_mark) + ch = self.peek() + if ch not in '\0 \r\n\x85\u2028\u2029': + raise ScannerError("while scanning a tag", start_mark, + "expected ' ', but found %r" % ch, self.get_mark()) + value = (handle, suffix) + end_mark = self.get_mark() + return TagToken(value, start_mark, end_mark) + + def scan_block_scalar(self, style): + # See the specification for details. + + if style == '>': + folded = True + else: + folded = False + + chunks = [] + start_mark = self.get_mark() + + # Scan the header. + self.forward() + chomping, increment = self.scan_block_scalar_indicators(start_mark) + self.scan_block_scalar_ignored_line(start_mark) + + # Determine the indentation level and go to the first non-empty line. + min_indent = self.indent+1 + if min_indent < 1: + min_indent = 1 + if increment is None: + breaks, max_indent, end_mark = self.scan_block_scalar_indentation() + indent = max(min_indent, max_indent) + else: + indent = min_indent+increment-1 + breaks, end_mark = self.scan_block_scalar_breaks(indent) + line_break = '' + + # Scan the inner part of the block scalar. + while self.column == indent and self.peek() != '\0': + chunks.extend(breaks) + leading_non_space = self.peek() not in ' \t' + length = 0 + while self.peek(length) not in '\0\r\n\x85\u2028\u2029': + length += 1 + chunks.append(self.prefix(length)) + self.forward(length) + line_break = self.scan_line_break() + breaks, end_mark = self.scan_block_scalar_breaks(indent) + if self.column == indent and self.peek() != '\0': + + # Unfortunately, folding rules are ambiguous. + # + # This is the folding according to the specification: + + if folded and line_break == '\n' \ + and leading_non_space and self.peek() not in ' \t': + if not breaks: + chunks.append(' ') + else: + chunks.append(line_break) + + # This is Clark Evans's interpretation (also in the spec + # examples): + # + #if folded and line_break == '\n': + # if not breaks: + # if self.peek() not in ' \t': + # chunks.append(' ') + # else: + # chunks.append(line_break) + #else: + # chunks.append(line_break) + else: + break + + # Chomp the tail. + if chomping is not False: + chunks.append(line_break) + if chomping is True: + chunks.extend(breaks) + + # We are done. + return ScalarToken(''.join(chunks), False, start_mark, end_mark, + style) + + def scan_block_scalar_indicators(self, start_mark): + # See the specification for details. + chomping = None + increment = None + ch = self.peek() + if ch in '+-': + if ch == '+': + chomping = True + else: + chomping = False + self.forward() + ch = self.peek() + if ch in '0123456789': + increment = int(ch) + if increment == 0: + raise ScannerError("while scanning a block scalar", start_mark, + "expected indentation indicator in the range 1-9, but found 0", + self.get_mark()) + self.forward() + elif ch in '0123456789': + increment = int(ch) + if increment == 0: + raise ScannerError("while scanning a block scalar", start_mark, + "expected indentation indicator in the range 1-9, but found 0", + self.get_mark()) + self.forward() + ch = self.peek() + if ch in '+-': + if ch == '+': + chomping = True + else: + chomping = False + self.forward() + ch = self.peek() + if ch not in '\0 \r\n\x85\u2028\u2029': + raise ScannerError("while scanning a block scalar", start_mark, + "expected chomping or indentation indicators, but found %r" + % ch, self.get_mark()) + return chomping, increment + + def scan_block_scalar_ignored_line(self, start_mark): + # See the specification for details. + while self.peek() == ' ': + self.forward() + if self.peek() == '#': + while self.peek() not in '\0\r\n\x85\u2028\u2029': + self.forward() + ch = self.peek() + if ch not in '\0\r\n\x85\u2028\u2029': + raise ScannerError("while scanning a block scalar", start_mark, + "expected a comment or a line break, but found %r" % ch, + self.get_mark()) + self.scan_line_break() + + def scan_block_scalar_indentation(self): + # See the specification for details. + chunks = [] + max_indent = 0 + end_mark = self.get_mark() + while self.peek() in ' \r\n\x85\u2028\u2029': + if self.peek() != ' ': + chunks.append(self.scan_line_break()) + end_mark = self.get_mark() + else: + self.forward() + if self.column > max_indent: + max_indent = self.column + return chunks, max_indent, end_mark + + def scan_block_scalar_breaks(self, indent): + # See the specification for details. + chunks = [] + end_mark = self.get_mark() + while self.column < indent and self.peek() == ' ': + self.forward() + while self.peek() in '\r\n\x85\u2028\u2029': + chunks.append(self.scan_line_break()) + end_mark = self.get_mark() + while self.column < indent and self.peek() == ' ': + self.forward() + return chunks, end_mark + + def scan_flow_scalar(self, style): + # See the specification for details. + # Note that we loose indentation rules for quoted scalars. Quoted + # scalars don't need to adhere indentation because " and ' clearly + # mark the beginning and the end of them. Therefore we are less + # restrictive then the specification requires. We only need to check + # that document separators are not included in scalars. + if style == '"': + double = True + else: + double = False + chunks = [] + start_mark = self.get_mark() + quote = self.peek() + self.forward() + chunks.extend(self.scan_flow_scalar_non_spaces(double, start_mark)) + while self.peek() != quote: + chunks.extend(self.scan_flow_scalar_spaces(double, start_mark)) + chunks.extend(self.scan_flow_scalar_non_spaces(double, start_mark)) + self.forward() + end_mark = self.get_mark() + return ScalarToken(''.join(chunks), False, start_mark, end_mark, + style) + + ESCAPE_REPLACEMENTS = { + '0': '\0', + 'a': '\x07', + 'b': '\x08', + 't': '\x09', + '\t': '\x09', + 'n': '\x0A', + 'v': '\x0B', + 'f': '\x0C', + 'r': '\x0D', + 'e': '\x1B', + ' ': '\x20', + '\"': '\"', + '\\': '\\', + '/': '/', + 'N': '\x85', + '_': '\xA0', + 'L': '\u2028', + 'P': '\u2029', + } + + ESCAPE_CODES = { + 'x': 2, + 'u': 4, + 'U': 8, + } + + def scan_flow_scalar_non_spaces(self, double, start_mark): + # See the specification for details. + chunks = [] + while True: + length = 0 + while self.peek(length) not in '\'\"\\\0 \t\r\n\x85\u2028\u2029': + length += 1 + if length: + chunks.append(self.prefix(length)) + self.forward(length) + ch = self.peek() + if not double and ch == '\'' and self.peek(1) == '\'': + chunks.append('\'') + self.forward(2) + elif (double and ch == '\'') or (not double and ch in '\"\\'): + chunks.append(ch) + self.forward() + elif double and ch == '\\': + self.forward() + ch = self.peek() + if ch in self.ESCAPE_REPLACEMENTS: + chunks.append(self.ESCAPE_REPLACEMENTS[ch]) + self.forward() + elif ch in self.ESCAPE_CODES: + length = self.ESCAPE_CODES[ch] + self.forward() + for k in range(length): + if self.peek(k) not in '0123456789ABCDEFabcdef': + raise ScannerError("while scanning a double-quoted scalar", start_mark, + "expected escape sequence of %d hexadecimal numbers, but found %r" % + (length, self.peek(k)), self.get_mark()) + code = int(self.prefix(length), 16) + chunks.append(chr(code)) + self.forward(length) + elif ch in '\r\n\x85\u2028\u2029': + self.scan_line_break() + chunks.extend(self.scan_flow_scalar_breaks(double, start_mark)) + else: + raise ScannerError("while scanning a double-quoted scalar", start_mark, + "found unknown escape character %r" % ch, self.get_mark()) + else: + return chunks + + def scan_flow_scalar_spaces(self, double, start_mark): + # See the specification for details. + chunks = [] + length = 0 + while self.peek(length) in ' \t': + length += 1 + whitespaces = self.prefix(length) + self.forward(length) + ch = self.peek() + if ch == '\0': + raise ScannerError("while scanning a quoted scalar", start_mark, + "found unexpected end of stream", self.get_mark()) + elif ch in '\r\n\x85\u2028\u2029': + line_break = self.scan_line_break() + breaks = self.scan_flow_scalar_breaks(double, start_mark) + if line_break != '\n': + chunks.append(line_break) + elif not breaks: + chunks.append(' ') + chunks.extend(breaks) + else: + chunks.append(whitespaces) + return chunks + + def scan_flow_scalar_breaks(self, double, start_mark): + # See the specification for details. + chunks = [] + while True: + # Instead of checking indentation, we check for document + # separators. + prefix = self.prefix(3) + if (prefix == '---' or prefix == '...') \ + and self.peek(3) in '\0 \t\r\n\x85\u2028\u2029': + raise ScannerError("while scanning a quoted scalar", start_mark, + "found unexpected document separator", self.get_mark()) + while self.peek() in ' \t': + self.forward() + if self.peek() in '\r\n\x85\u2028\u2029': + chunks.append(self.scan_line_break()) + else: + return chunks + + def scan_plain(self): + # See the specification for details. + # We add an additional restriction for the flow context: + # plain scalars in the flow context cannot contain ',' or '?'. + # We also keep track of the `allow_simple_key` flag here. + # Indentation rules are loosed for the flow context. + chunks = [] + start_mark = self.get_mark() + end_mark = start_mark + indent = self.indent+1 + # We allow zero indentation for scalars, but then we need to check for + # document separators at the beginning of the line. + #if indent == 0: + # indent = 1 + spaces = [] + while True: + length = 0 + if self.peek() == '#': + break + while True: + ch = self.peek(length) + if ch in '\0 \t\r\n\x85\u2028\u2029' \ + or (ch == ':' and + self.peek(length+1) in '\0 \t\r\n\x85\u2028\u2029' + + (u',[]{}' if self.flow_level else u''))\ + or (self.flow_level and ch in ',?[]{}'): + break + length += 1 + if length == 0: + break + self.allow_simple_key = False + chunks.extend(spaces) + chunks.append(self.prefix(length)) + self.forward(length) + end_mark = self.get_mark() + spaces = self.scan_plain_spaces(indent, start_mark) + if not spaces or self.peek() == '#' \ + or (not self.flow_level and self.column < indent): + break + return ScalarToken(''.join(chunks), True, start_mark, end_mark) + + def scan_plain_spaces(self, indent, start_mark): + # See the specification for details. + # The specification is really confusing about tabs in plain scalars. + # We just forbid them completely. Do not use tabs in YAML! + chunks = [] + length = 0 + while self.peek(length) in ' ': + length += 1 + whitespaces = self.prefix(length) + self.forward(length) + ch = self.peek() + if ch in '\r\n\x85\u2028\u2029': + line_break = self.scan_line_break() + self.allow_simple_key = True + prefix = self.prefix(3) + if (prefix == '---' or prefix == '...') \ + and self.peek(3) in '\0 \t\r\n\x85\u2028\u2029': + return + breaks = [] + while self.peek() in ' \r\n\x85\u2028\u2029': + if self.peek() == ' ': + self.forward() + else: + breaks.append(self.scan_line_break()) + prefix = self.prefix(3) + if (prefix == '---' or prefix == '...') \ + and self.peek(3) in '\0 \t\r\n\x85\u2028\u2029': + return + if line_break != '\n': + chunks.append(line_break) + elif not breaks: + chunks.append(' ') + chunks.extend(breaks) + elif whitespaces: + chunks.append(whitespaces) + return chunks + + def scan_tag_handle(self, name, start_mark): + # See the specification for details. + # For some strange reasons, the specification does not allow '_' in + # tag handles. I have allowed it anyway. + ch = self.peek() + if ch != '!': + raise ScannerError("while scanning a %s" % name, start_mark, + "expected '!', but found %r" % ch, self.get_mark()) + length = 1 + ch = self.peek(length) + if ch != ' ': + while '0' <= ch <= '9' or 'A' <= ch <= 'Z' or 'a' <= ch <= 'z' \ + or ch in '-_': + length += 1 + ch = self.peek(length) + if ch != '!': + self.forward(length) + raise ScannerError("while scanning a %s" % name, start_mark, + "expected '!', but found %r" % ch, self.get_mark()) + length += 1 + value = self.prefix(length) + self.forward(length) + return value + + def scan_tag_uri(self, name, start_mark): + # See the specification for details. + # Note: we do not check if URI is well-formed. + chunks = [] + length = 0 + ch = self.peek(length) + while '0' <= ch <= '9' or 'A' <= ch <= 'Z' or 'a' <= ch <= 'z' \ + or ch in '-;/?:@&=+$,_.!~*\'()[]%': + if ch == '%': + chunks.append(self.prefix(length)) + self.forward(length) + length = 0 + chunks.append(self.scan_uri_escapes(name, start_mark)) + else: + length += 1 + ch = self.peek(length) + if length: + chunks.append(self.prefix(length)) + self.forward(length) + length = 0 + if not chunks: + raise ScannerError("while parsing a %s" % name, start_mark, + "expected URI, but found %r" % ch, self.get_mark()) + return ''.join(chunks) + + def scan_uri_escapes(self, name, start_mark): + # See the specification for details. + codes = [] + mark = self.get_mark() + while self.peek() == '%': + self.forward() + for k in range(2): + if self.peek(k) not in '0123456789ABCDEFabcdef': + raise ScannerError("while scanning a %s" % name, start_mark, + "expected URI escape sequence of 2 hexadecimal numbers, but found %r" + % self.peek(k), self.get_mark()) + codes.append(int(self.prefix(2), 16)) + self.forward(2) + try: + value = bytes(codes).decode('utf-8') + except UnicodeDecodeError as exc: + raise ScannerError("while scanning a %s" % name, start_mark, str(exc), mark) + return value + + def scan_line_break(self): + # Transforms: + # '\r\n' : '\n' + # '\r' : '\n' + # '\n' : '\n' + # '\x85' : '\n' + # '\u2028' : '\u2028' + # '\u2029 : '\u2029' + # default : '' + ch = self.peek() + if ch in '\r\n\x85': + if self.prefix(2) == '\r\n': + self.forward(2) + else: + self.forward() + return '\n' + elif ch in '\u2028\u2029': + self.forward() + return ch + return '' diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/yaml/serializer.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/yaml/serializer.py new file mode 100644 index 0000000000000000000000000000000000000000..fe911e67ae7a739abb491fbbc6834b9c37bbda4b --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/yaml/serializer.py @@ -0,0 +1,111 @@ + +__all__ = ['Serializer', 'SerializerError'] + +from .error import YAMLError +from .events import * +from .nodes import * + +class SerializerError(YAMLError): + pass + +class Serializer: + + ANCHOR_TEMPLATE = 'id%03d' + + def __init__(self, encoding=None, + explicit_start=None, explicit_end=None, version=None, tags=None): + self.use_encoding = encoding + self.use_explicit_start = explicit_start + self.use_explicit_end = explicit_end + self.use_version = version + self.use_tags = tags + self.serialized_nodes = {} + self.anchors = {} + self.last_anchor_id = 0 + self.closed = None + + def open(self): + if self.closed is None: + self.emit(StreamStartEvent(encoding=self.use_encoding)) + self.closed = False + elif self.closed: + raise SerializerError("serializer is closed") + else: + raise SerializerError("serializer is already opened") + + def close(self): + if self.closed is None: + raise SerializerError("serializer is not opened") + elif not self.closed: + self.emit(StreamEndEvent()) + self.closed = True + + #def __del__(self): + # self.close() + + def serialize(self, node): + if self.closed is None: + raise SerializerError("serializer is not opened") + elif self.closed: + raise SerializerError("serializer is closed") + self.emit(DocumentStartEvent(explicit=self.use_explicit_start, + version=self.use_version, tags=self.use_tags)) + self.anchor_node(node) + self.serialize_node(node, None, None) + self.emit(DocumentEndEvent(explicit=self.use_explicit_end)) + self.serialized_nodes = {} + self.anchors = {} + self.last_anchor_id = 0 + + def anchor_node(self, node): + if node in self.anchors: + if self.anchors[node] is None: + self.anchors[node] = self.generate_anchor(node) + else: + self.anchors[node] = None + if isinstance(node, SequenceNode): + for item in node.value: + self.anchor_node(item) + elif isinstance(node, MappingNode): + for key, value in node.value: + self.anchor_node(key) + self.anchor_node(value) + + def generate_anchor(self, node): + self.last_anchor_id += 1 + return self.ANCHOR_TEMPLATE % self.last_anchor_id + + def serialize_node(self, node, parent, index): + alias = self.anchors[node] + if node in self.serialized_nodes: + self.emit(AliasEvent(alias)) + else: + self.serialized_nodes[node] = True + self.descend_resolver(parent, index) + if isinstance(node, ScalarNode): + detected_tag = self.resolve(ScalarNode, node.value, (True, False)) + default_tag = self.resolve(ScalarNode, node.value, (False, True)) + implicit = (node.tag == detected_tag), (node.tag == default_tag) + self.emit(ScalarEvent(alias, node.tag, implicit, node.value, + style=node.style)) + elif isinstance(node, SequenceNode): + implicit = (node.tag + == self.resolve(SequenceNode, node.value, True)) + self.emit(SequenceStartEvent(alias, node.tag, implicit, + flow_style=node.flow_style)) + index = 0 + for item in node.value: + self.serialize_node(item, node, index) + index += 1 + self.emit(SequenceEndEvent()) + elif isinstance(node, MappingNode): + implicit = (node.tag + == self.resolve(MappingNode, node.value, True)) + self.emit(MappingStartEvent(alias, node.tag, implicit, + flow_style=node.flow_style)) + for key, value in node.value: + self.serialize_node(key, node, None) + self.serialize_node(value, node, key) + self.emit(MappingEndEvent()) + self.ascend_resolver() + diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/yaml/tokens.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/yaml/tokens.py new file mode 100644 index 0000000000000000000000000000000000000000..4d0b48a394ac8c019b401516a12f688df361cf90 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/yaml/tokens.py @@ -0,0 +1,104 @@ + +class Token(object): + def __init__(self, start_mark, end_mark): + self.start_mark = start_mark + self.end_mark = end_mark + def __repr__(self): + attributes = [key for key in self.__dict__ + if not key.endswith('_mark')] + attributes.sort() + arguments = ', '.join(['%s=%r' % (key, getattr(self, key)) + for key in attributes]) + return '%s(%s)' % (self.__class__.__name__, arguments) + +#class BOMToken(Token): +# id = '' + +class DirectiveToken(Token): + id = '' + def __init__(self, name, value, start_mark, end_mark): + self.name = name + self.value = value + self.start_mark = start_mark + self.end_mark = end_mark + +class DocumentStartToken(Token): + id = '' + +class DocumentEndToken(Token): + id = '' + +class StreamStartToken(Token): + id = '' + def __init__(self, start_mark=None, end_mark=None, + encoding=None): + self.start_mark = start_mark + self.end_mark = end_mark + self.encoding = encoding + +class StreamEndToken(Token): + id = '' + +class BlockSequenceStartToken(Token): + id = '' + +class BlockMappingStartToken(Token): + id = '' + +class BlockEndToken(Token): + id = '' + +class FlowSequenceStartToken(Token): + id = '[' + +class FlowMappingStartToken(Token): + id = '{' + +class FlowSequenceEndToken(Token): + id = ']' + +class FlowMappingEndToken(Token): + id = '}' + +class KeyToken(Token): + id = '?' + +class ValueToken(Token): + id = ':' + +class BlockEntryToken(Token): + id = '-' + +class FlowEntryToken(Token): + id = ',' + +class AliasToken(Token): + id = '' + def __init__(self, value, start_mark, end_mark): + self.value = value + self.start_mark = start_mark + self.end_mark = end_mark + +class AnchorToken(Token): + id = '' + def __init__(self, value, start_mark, end_mark): + self.value = value + self.start_mark = start_mark + self.end_mark = end_mark + +class TagToken(Token): + id = '' + def __init__(self, value, start_mark, end_mark): + self.value = value + self.start_mark = start_mark + self.end_mark = end_mark + +class ScalarToken(Token): + id = '' + def __init__(self, value, plain, start_mark, end_mark, style=None): + self.value = value + self.plain = plain + self.start_mark = start_mark + self.end_mark = end_mark + self.style = style + diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/__init__.pxd b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/__init__.pxd new file mode 100644 index 0000000000000000000000000000000000000000..37b8362e2a07a77d41ff9f6d3b589364a5e00a05 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/__init__.pxd @@ -0,0 +1 @@ +from zmq.backend.cython cimport Context, Frame, Socket, libzmq diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/__init__.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..ab0326be0b64dc82b37d383fc6dd5687b6219eb7 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/__init__.py @@ -0,0 +1,97 @@ +"""Python bindings for 0MQ""" + +# Copyright (C) PyZMQ Developers +# Distributed under the terms of the Modified BSD License. + +from __future__ import annotations + +import os +import sys +from contextlib import contextmanager + + +@contextmanager +def _libs_on_path(): + """context manager for libs directory on $PATH + + Works around mysterious issue where os.add_dll_directory + does not resolve imports (conda-forge Python >= 3.8) + """ + + if not sys.platform.startswith("win"): + yield + return + + libs_dir = os.path.abspath( + os.path.join( + os.path.dirname(__file__), + os.pardir, + "pyzmq.libs", + ) + ) + if not os.path.exists(libs_dir): + # no bundled libs + yield + return + + path_before = os.environ.get("PATH") + try: + os.environ["PATH"] = os.pathsep.join([path_before or "", libs_dir]) + yield + finally: + if path_before is None: + os.environ.pop("PATH") + else: + os.environ["PATH"] = path_before + + +# zmq top-level imports + +# workaround for Windows +with _libs_on_path(): + from zmq import backend + +from . import constants # noqa +from .constants import * # noqa +from zmq.backend import * # noqa +from zmq import sugar +from zmq.sugar import * # noqa + + +def get_includes(): + """Return a list of directories to include for linking against pyzmq with cython.""" + from os.path import abspath, dirname, exists, join, pardir + + base = dirname(__file__) + parent = abspath(join(base, pardir)) + includes = [parent] + [join(parent, base, subdir) for subdir in ('utils',)] + if exists(join(parent, base, 'include')): + includes.append(join(parent, base, 'include')) + return includes + + +def get_library_dirs(): + """Return a list of directories used to link against pyzmq's bundled libzmq.""" + from os.path import abspath, dirname, join, pardir + + base = dirname(__file__) + parent = abspath(join(base, pardir)) + return [join(parent, base)] + + +COPY_THRESHOLD = 65536 +# zmq.DRAFT_API represents _both_ the current runtime-loaded libzmq +# and pyzmq were built with drafts, +# which is required for pyzmq draft support +DRAFT_API: bool = backend.has('draft') and backend.PYZMQ_DRAFT_API + +__all__ = ( + [ + 'get_includes', + 'COPY_THRESHOLD', + 'DRAFT_API', + ] + + constants.__all__ + + sugar.__all__ + + backend.__all__ +) diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/__init__.pyi b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/__init__.pyi new file mode 100644 index 0000000000000000000000000000000000000000..56f4bdcaf0c08c199b0da853bae063d5d392fe5a --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/__init__.pyi @@ -0,0 +1,28 @@ +from typing import List + +from . import backend, sugar + +COPY_THRESHOLD: int +DRAFT_API: bool +__version__: str + +# mypy doesn't like overwriting symbols with * so be explicit +# about what comes from backend, not from sugar +# see tools/backend_imports.py to generate this list +# note: `x as x` is required for re-export +# see https://github.com/python/mypy/issues/2190 +from .backend import IPC_PATH_MAX_LEN as IPC_PATH_MAX_LEN +from .backend import curve_keypair as curve_keypair +from .backend import curve_public as curve_public +from .backend import has as has +from .backend import proxy as proxy +from .backend import proxy_steerable as proxy_steerable +from .backend import strerror as strerror +from .backend import zmq_errno as zmq_errno +from .backend import zmq_poll as zmq_poll +from .constants import * +from .error import * +from .sugar import * + +def get_includes() -> list[str]: ... +def get_library_dirs() -> list[str]: ... diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/_future.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/_future.py new file mode 100644 index 0000000000000000000000000000000000000000..e598de14f768dc8540684bfa79589c00eeeceed0 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/_future.py @@ -0,0 +1,737 @@ +"""Future-returning APIs for coroutines.""" + +# Copyright (c) PyZMQ Developers. +# Distributed under the terms of the Modified BSD License. +from __future__ import annotations + +import warnings +from asyncio import Future +from collections import deque +from functools import partial +from itertools import chain +from typing import ( + Any, + Awaitable, + Callable, + NamedTuple, + TypeVar, + cast, +) + +import zmq as _zmq +from zmq import EVENTS, POLLIN, POLLOUT + + +class _FutureEvent(NamedTuple): + future: Future + kind: str + args: tuple + kwargs: dict + msg: Any + timer: Any + + +# These are incomplete classes and need a Mixin for compatibility with an eventloop +# defining the following attributes: +# +# _Future +# _READ +# _WRITE +# _default_loop() + + +class _Async: + """Mixin for common async logic""" + + _current_loop: Any = None + _Future: type[Future] + + def _get_loop(self) -> Any: + """Get event loop + + Notice if event loop has changed, + and register init_io_state on activation of a new event loop + """ + if self._current_loop is None: + self._current_loop = self._default_loop() + self._init_io_state(self._current_loop) + return self._current_loop + current_loop = self._default_loop() + if current_loop is not self._current_loop: + # warn? This means a socket is being used in multiple loops! + self._current_loop = current_loop + self._init_io_state(current_loop) + return current_loop + + def _default_loop(self) -> Any: + raise NotImplementedError("Must be implemented in a subclass") + + def _init_io_state(self, loop=None) -> None: + pass + + +class _AsyncPoller(_Async, _zmq.Poller): + """Poller that returns a Future on poll, instead of blocking.""" + + _socket_class: type[_AsyncSocket] + _READ: int + _WRITE: int + raw_sockets: list[Any] + + def _watch_raw_socket(self, loop: Any, socket: Any, evt: int, f: Callable) -> None: + """Schedule callback for a raw socket""" + raise NotImplementedError() + + def _unwatch_raw_sockets(self, loop: Any, *sockets: Any) -> None: + """Unschedule callback for a raw socket""" + raise NotImplementedError() + + def poll(self, timeout=-1) -> Awaitable[list[tuple[Any, int]]]: # type: ignore + """Return a Future for a poll event""" + future = self._Future() + if timeout == 0: + try: + result = super().poll(0) + except Exception as e: + future.set_exception(e) + else: + future.set_result(result) + return future + + loop = self._get_loop() + + # register Future to be called as soon as any event is available on any socket + watcher = self._Future() + + # watch raw sockets: + raw_sockets: list[Any] = [] + + def wake_raw(*args): + if not watcher.done(): + watcher.set_result(None) + + watcher.add_done_callback( + lambda f: self._unwatch_raw_sockets(loop, *raw_sockets) + ) + + wrapped_sockets: list[_AsyncSocket] = [] + + def _clear_wrapper_io(f): + for s in wrapped_sockets: + s._clear_io_state() + + for socket, mask in self.sockets: + if isinstance(socket, _zmq.Socket): + if not isinstance(socket, self._socket_class): + # it's a blocking zmq.Socket, wrap it in async + socket = self._socket_class.from_socket(socket) + wrapped_sockets.append(socket) + if mask & _zmq.POLLIN: + socket._add_recv_event('poll', future=watcher) + if mask & _zmq.POLLOUT: + socket._add_send_event('poll', future=watcher) + else: + raw_sockets.append(socket) + evt = 0 + if mask & _zmq.POLLIN: + evt |= self._READ + if mask & _zmq.POLLOUT: + evt |= self._WRITE + self._watch_raw_socket(loop, socket, evt, wake_raw) + + def on_poll_ready(f): + if future.done(): + return + if watcher.cancelled(): + try: + future.cancel() + except RuntimeError: + # RuntimeError may be called during teardown + pass + return + if watcher.exception(): + future.set_exception(watcher.exception()) + else: + try: + result = super(_AsyncPoller, self).poll(0) + except Exception as e: + future.set_exception(e) + else: + future.set_result(result) + + watcher.add_done_callback(on_poll_ready) + + if wrapped_sockets: + watcher.add_done_callback(_clear_wrapper_io) + + if timeout is not None and timeout > 0: + # schedule cancel to fire on poll timeout, if any + def trigger_timeout(): + if not watcher.done(): + watcher.set_result(None) + + timeout_handle = loop.call_later(1e-3 * timeout, trigger_timeout) + + def cancel_timeout(f): + if hasattr(timeout_handle, 'cancel'): + timeout_handle.cancel() + else: + loop.remove_timeout(timeout_handle) + + future.add_done_callback(cancel_timeout) + + def cancel_watcher(f): + if not watcher.done(): + watcher.cancel() + + future.add_done_callback(cancel_watcher) + + return future + + +class _NoTimer: + @staticmethod + def cancel(): + pass + + +T = TypeVar("T", bound="_AsyncSocket") + + +class _AsyncSocket(_Async, _zmq.Socket[Future]): + # Warning : these class variables are only here to allow to call super().__setattr__. + # They be overridden at instance initialization and not shared in the whole class + _recv_futures = None + _send_futures = None + _state = 0 + _shadow_sock: _zmq.Socket + _poller_class = _AsyncPoller + _fd = None + + def __init__( + self, + context=None, + socket_type=-1, + io_loop=None, + _from_socket: _zmq.Socket | None = None, + **kwargs, + ) -> None: + if isinstance(context, _zmq.Socket): + context, _from_socket = (None, context) + if _from_socket is not None: + super().__init__(shadow=_from_socket.underlying) # type: ignore + self._shadow_sock = _from_socket + else: + super().__init__(context, socket_type, **kwargs) # type: ignore + self._shadow_sock = _zmq.Socket.shadow(self.underlying) + + if io_loop is not None: + warnings.warn( + f"{self.__class__.__name__}(io_loop) argument is deprecated in pyzmq 22.2." + " The currently active loop will always be used.", + DeprecationWarning, + stacklevel=3, + ) + self._recv_futures = deque() + self._send_futures = deque() + self._state = 0 + self._fd = self._shadow_sock.FD + + @classmethod + def from_socket(cls: type[T], socket: _zmq.Socket, io_loop: Any = None) -> T: + """Create an async socket from an existing Socket""" + return cls(_from_socket=socket, io_loop=io_loop) + + def close(self, linger: int | None = None) -> None: + if not self.closed and self._fd is not None: + event_list: list[_FutureEvent] = list( + chain(self._recv_futures or [], self._send_futures or []) + ) + for event in event_list: + if not event.future.done(): + try: + event.future.cancel() + except RuntimeError: + # RuntimeError may be called during teardown + pass + self._clear_io_state() + super().close(linger=linger) + + close.__doc__ = _zmq.Socket.close.__doc__ + + def get(self, key): + result = super().get(key) + if key == EVENTS: + self._schedule_remaining_events(result) + return result + + get.__doc__ = _zmq.Socket.get.__doc__ + + def recv_multipart( + self, flags: int = 0, copy: bool = True, track: bool = False + ) -> Awaitable[list[bytes] | list[_zmq.Frame]]: + """Receive a complete multipart zmq message. + + Returns a Future whose result will be a multipart message. + """ + return self._add_recv_event( + 'recv_multipart', kwargs=dict(flags=flags, copy=copy, track=track) + ) + + def recv( # type: ignore + self, flags: int = 0, copy: bool = True, track: bool = False + ) -> Awaitable[bytes | _zmq.Frame]: + """Receive a single zmq frame. + + Returns a Future, whose result will be the received frame. + + Recommend using recv_multipart instead. + """ + return self._add_recv_event( + 'recv', kwargs=dict(flags=flags, copy=copy, track=track) + ) + + def recv_into( # type: ignore + self, buf, /, *, nbytes: int = 0, flags: int = 0 + ) -> Awaitable[int]: + """Receive a single zmq frame into a pre-allocated buffer. + + Returns a Future, whose result will be the number of bytes received. + """ + return self._add_recv_event( + 'recv_into', args=(buf,), kwargs=dict(nbytes=nbytes, flags=flags) + ) + + def send_multipart( # type: ignore + self, msg_parts: Any, flags: int = 0, copy: bool = True, track=False, **kwargs + ) -> Awaitable[_zmq.MessageTracker | None]: + """Send a complete multipart zmq message. + + Returns a Future that resolves when sending is complete. + """ + kwargs['flags'] = flags + kwargs['copy'] = copy + kwargs['track'] = track + return self._add_send_event('send_multipart', msg=msg_parts, kwargs=kwargs) + + def send( # type: ignore + self, + data: Any, + flags: int = 0, + copy: bool = True, + track: bool = False, + **kwargs: Any, + ) -> Awaitable[_zmq.MessageTracker | None]: + """Send a single zmq frame. + + Returns a Future that resolves when sending is complete. + + Recommend using send_multipart instead. + """ + kwargs['flags'] = flags + kwargs['copy'] = copy + kwargs['track'] = track + kwargs.update(dict(flags=flags, copy=copy, track=track)) + return self._add_send_event('send', msg=data, kwargs=kwargs) + + def _deserialize(self, recvd, load): + """Deserialize with Futures""" + f = self._Future() + + def _chain(_): + """Chain result through serialization to recvd""" + if f.done(): + # chained future may be cancelled, which means nobody is going to get this result + # if it's an error, that's no big deal (probably zmq.Again), + # but if it's a successful recv, this is a dropped message! + if not recvd.cancelled() and recvd.exception() is None: + warnings.warn( + # is there a useful stacklevel? + # ideally, it would point to where `f.cancel()` was called + f"Future {f} completed while awaiting {recvd}. A message has been dropped!", + RuntimeWarning, + ) + return + if recvd.exception(): + f.set_exception(recvd.exception()) + else: + buf = recvd.result() + try: + loaded = load(buf) + except Exception as e: + f.set_exception(e) + else: + f.set_result(loaded) + + recvd.add_done_callback(_chain) + + def _chain_cancel(_): + """Chain cancellation from f to recvd""" + if recvd.done(): + return + if f.cancelled(): + recvd.cancel() + + f.add_done_callback(_chain_cancel) + + return f + + def poll(self, timeout=None, flags=_zmq.POLLIN) -> Awaitable[int]: # type: ignore + """poll the socket for events + + returns a Future for the poll results. + """ + + if self.closed: + raise _zmq.ZMQError(_zmq.ENOTSUP) + + p = self._poller_class() + p.register(self, flags) + poll_future = cast(Future, p.poll(timeout)) + + future = self._Future() + + def unwrap_result(f): + if future.done(): + return + if poll_future.cancelled(): + try: + future.cancel() + except RuntimeError: + # RuntimeError may be called during teardown + pass + return + if f.exception(): + future.set_exception(poll_future.exception()) + else: + evts = dict(poll_future.result()) + future.set_result(evts.get(self, 0)) + + if poll_future.done(): + # hook up result if already done + unwrap_result(poll_future) + else: + poll_future.add_done_callback(unwrap_result) + + def cancel_poll(future): + """Cancel underlying poll if request has been cancelled""" + if not poll_future.done(): + try: + poll_future.cancel() + except RuntimeError: + # RuntimeError may be called during teardown + pass + + future.add_done_callback(cancel_poll) + + return future + + def _add_timeout(self, future, timeout): + """Add a timeout for a send or recv Future""" + + def future_timeout(): + if future.done(): + # future already resolved, do nothing + return + + # raise EAGAIN + future.set_exception(_zmq.Again()) + + return self._call_later(timeout, future_timeout) + + def _call_later(self, delay, callback): + """Schedule a function to be called later + + Override for different IOLoop implementations + + Tornado and asyncio happen to both have ioloop.call_later + with the same signature. + """ + return self._get_loop().call_later(delay, callback) + + @staticmethod + def _remove_finished_future(future, event_list, event=None): + """Make sure that futures are removed from the event list when they resolve + + Avoids delaying cleanup until the next send/recv event, + which may never come. + """ + # "future" instance is shared between sockets, but each socket has its own event list. + if not event_list: + return + # only unconsumed events (e.g. cancelled calls) + # will be present when this happens + try: + event_list.remove(event) + except ValueError: + # usually this will have been removed by being consumed + return + + def _add_recv_event( + self, + kind: str, + *, + args: tuple | None = None, + kwargs: dict[str, Any] | None = None, + future: Future | None = None, + ) -> Future: + """Add a recv event, returning the corresponding Future""" + f = future or self._Future() + if args is None: + args = () + if kwargs is None: + kwargs = {} + if kind.startswith('recv') and kwargs.get('flags', 0) & _zmq.DONTWAIT: + # short-circuit non-blocking calls + recv = getattr(self._shadow_sock, kind) + try: + r = recv(*args, **kwargs) + except Exception as e: + f.set_exception(e) + else: + f.set_result(r) + return f + + timer = _NoTimer + if hasattr(_zmq, 'RCVTIMEO'): + timeout_ms = self._shadow_sock.rcvtimeo + if timeout_ms >= 0: + timer = self._add_timeout(f, timeout_ms * 1e-3) + + # we add it to the list of futures before we add the timeout as the + # timeout will remove the future from recv_futures to avoid leaks + _future_event = _FutureEvent( + f, kind, args=args, kwargs=kwargs, msg=None, timer=timer + ) + self._recv_futures.append(_future_event) + + if self._shadow_sock.get(EVENTS) & POLLIN: + # recv immediately, if we can + self._handle_recv() + if self._recv_futures and _future_event in self._recv_futures: + # Don't let the Future sit in _recv_events after it's done + # no need to register this if we've already been handled + # (i.e. immediately-resolved recv) + f.add_done_callback( + partial( + self._remove_finished_future, + event_list=self._recv_futures, + event=_future_event, + ) + ) + self._add_io_state(POLLIN) + return f + + def _add_send_event(self, kind, msg=None, kwargs=None, future=None): + """Add a send event, returning the corresponding Future""" + f = future or self._Future() + # attempt send with DONTWAIT if no futures are waiting + # short-circuit for sends that will resolve immediately + # only call if no send Futures are waiting + if kind in ('send', 'send_multipart') and not self._send_futures: + flags = kwargs.get('flags', 0) + nowait_kwargs = kwargs.copy() + nowait_kwargs['flags'] = flags | _zmq.DONTWAIT + + # short-circuit non-blocking calls + send = getattr(self._shadow_sock, kind) + # track if the send resolved or not + # (EAGAIN if DONTWAIT is not set should proceed with) + finish_early = True + try: + r = send(msg, **nowait_kwargs) + except _zmq.Again as e: + if flags & _zmq.DONTWAIT: + f.set_exception(e) + else: + # EAGAIN raised and DONTWAIT not requested, + # proceed with async send + finish_early = False + except Exception as e: + f.set_exception(e) + else: + f.set_result(r) + + if finish_early: + # short-circuit resolved, return finished Future + # schedule wake for recv if there are any receivers waiting + if self._recv_futures: + self._schedule_remaining_events() + return f + + timer = _NoTimer + if hasattr(_zmq, 'SNDTIMEO'): + timeout_ms = self._shadow_sock.get(_zmq.SNDTIMEO) + if timeout_ms >= 0: + timer = self._add_timeout(f, timeout_ms * 1e-3) + + # we add it to the list of futures before we add the timeout as the + # timeout will remove the future from recv_futures to avoid leaks + _future_event = _FutureEvent( + f, kind, args=(), kwargs=kwargs, msg=msg, timer=timer + ) + self._send_futures.append(_future_event) + # Don't let the Future sit in _send_futures after it's done + f.add_done_callback( + partial( + self._remove_finished_future, + event_list=self._send_futures, + event=_future_event, + ) + ) + + self._add_io_state(POLLOUT) + return f + + def _handle_recv(self): + """Handle recv events""" + if not self._shadow_sock.get(EVENTS) & POLLIN: + # event triggered, but state may have been changed between trigger and callback + return + f = None + while self._recv_futures: + f, kind, args, kwargs, _, timer = self._recv_futures.popleft() + # skip any cancelled futures + if f.done(): + f = None + else: + break + + if not self._recv_futures: + self._drop_io_state(POLLIN) + + if f is None: + return + + timer.cancel() + + if kind == 'poll': + # on poll event, just signal ready, nothing else. + f.set_result(None) + return + elif kind == 'recv_multipart': + recv = self._shadow_sock.recv_multipart + elif kind == 'recv': + recv = self._shadow_sock.recv + elif kind == 'recv_into': + recv = self._shadow_sock.recv_into + else: + raise ValueError(f"Unhandled recv event type: {kind!r}") + + kwargs['flags'] |= _zmq.DONTWAIT + try: + result = recv(*args, **kwargs) + except Exception as e: + f.set_exception(e) + else: + f.set_result(result) + + def _handle_send(self): + if not self._shadow_sock.get(EVENTS) & POLLOUT: + # event triggered, but state may have been changed between trigger and callback + return + f = None + while self._send_futures: + f, kind, args, kwargs, msg, timer = self._send_futures.popleft() + # skip any cancelled futures + if f.done(): + f = None + else: + break + + if not self._send_futures: + self._drop_io_state(POLLOUT) + + if f is None: + return + + timer.cancel() + + if kind == 'poll': + # on poll event, just signal ready, nothing else. + f.set_result(None) + return + elif kind == 'send_multipart': + send = self._shadow_sock.send_multipart + elif kind == 'send': + send = self._shadow_sock.send + else: + raise ValueError(f"Unhandled send event type: {kind!r}") + + kwargs['flags'] |= _zmq.DONTWAIT + try: + result = send(msg, **kwargs) + except Exception as e: + f.set_exception(e) + else: + f.set_result(result) + + # event masking from ZMQStream + def _handle_events(self, fd=0, events=0): + """Dispatch IO events to _handle_recv, etc.""" + if self._shadow_sock.closed: + return + + zmq_events = self._shadow_sock.get(EVENTS) + if zmq_events & _zmq.POLLIN: + self._handle_recv() + if zmq_events & _zmq.POLLOUT: + self._handle_send() + self._schedule_remaining_events() + + def _schedule_remaining_events(self, events=None): + """Schedule a call to handle_events next loop iteration + + If there are still events to handle. + """ + # edge-triggered handling + # allow passing events in, in case this is triggered by retrieving events, + # so we don't have to retrieve it twice. + if self._state == 0: + # not watching for anything, nothing to schedule + return + if events is None: + events = self._shadow_sock.get(EVENTS) + if events & self._state: + self._call_later(0, self._handle_events) + + def _add_io_state(self, state): + """Add io_state to poller.""" + if self._state != state: + state = self._state = self._state | state + self._update_handler(self._state) + + def _drop_io_state(self, state): + """Stop poller from watching an io_state.""" + if self._state & state: + self._state = self._state & (~state) + self._update_handler(self._state) + + def _update_handler(self, state): + """Update IOLoop handler with state. + + zmq FD is always read-only. + """ + # ensure loop is registered and init_io has been called + # if there are any events to watch for + if state: + self._get_loop() + self._schedule_remaining_events() + + def _init_io_state(self, loop=None): + """initialize the ioloop event handler""" + if loop is None: + loop = self._get_loop() + loop.add_handler(self._shadow_sock, self._handle_events, self._READ) + self._call_later(0, self._handle_events) + + def _clear_io_state(self): + """unregister the ioloop event handler + + called once during close + """ + fd = self._shadow_sock + if self._shadow_sock.closed: + fd = self._fd + if self._current_loop is not None: + self._current_loop.remove_handler(fd) diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/_future.pyi b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/_future.pyi new file mode 100644 index 0000000000000000000000000000000000000000..e22315e82598249391a3bbffbbf2ecc5dd0d12d5 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/_future.pyi @@ -0,0 +1,95 @@ +"""type annotations for async sockets""" + +from __future__ import annotations + +from asyncio import Future +from pickle import DEFAULT_PROTOCOL +from typing import Any, Awaitable, Literal, Sequence, TypeVar, overload + +import zmq as _zmq + +class _AsyncPoller(_zmq.Poller): + _socket_class: type[_AsyncSocket] + + def poll(self, timeout=-1) -> Awaitable[list[tuple[Any, int]]]: ... # type: ignore + +T = TypeVar("T", bound="_AsyncSocket") + +class _AsyncSocket(_zmq.Socket[Future]): + @classmethod + def from_socket(cls: type[T], socket: _zmq.Socket, io_loop: Any = None) -> T: ... + def send( # type: ignore + self, + data: Any, + flags: int = 0, + copy: bool = True, + track: bool = False, + routing_id: int | None = None, + group: str | None = None, + ) -> Awaitable[_zmq.MessageTracker | None]: ... + @overload # type: ignore + def recv(self, flags: int = 0, *, track: bool = False) -> Awaitable[bytes]: ... + @overload + def recv( + self, flags: int = 0, *, copy: Literal[True], track: bool = False + ) -> Awaitable[bytes]: ... + @overload + def recv( + self, flags: int = 0, *, copy: Literal[False], track: bool = False + ) -> Awaitable[_zmq.Frame]: ... + @overload + def recv( + self, flags: int = 0, copy: bool = True, track: bool = False + ) -> Awaitable[bytes | _zmq.Frame]: ... + def recv_into( # type: ignore + self, buffer: Any, /, *, nbytes: int = 0, flags: int = 0 + ) -> Awaitable[int]: ... + def send_multipart( # type: ignore + self, + msg_parts: Sequence, + flags: int = 0, + copy: bool = True, + track: bool = False, + routing_id: int | None = None, + group: str | None = None, + ) -> Awaitable[_zmq.MessageTracker | None]: ... + @overload # type: ignore + def recv_multipart( + self, flags: int = 0, *, track: bool = False + ) -> Awaitable[list[bytes]]: ... + @overload + def recv_multipart( + self, flags: int = 0, *, copy: Literal[True], track: bool = False + ) -> Awaitable[list[bytes]]: ... + @overload + def recv_multipart( + self, flags: int = 0, *, copy: Literal[False], track: bool = False + ) -> Awaitable[list[_zmq.Frame]]: ... + @overload + def recv_multipart( + self, flags: int = 0, copy: bool = True, track: bool = False + ) -> Awaitable[list[bytes] | list[_zmq.Frame]]: ... + + # serialization wrappers + + def send_string( # type: ignore + self, + u: str, + flags: int = 0, + copy: bool = True, + *, + encoding: str = 'utf-8', + **kwargs, + ) -> Awaitable[_zmq.Frame | None]: ... + def recv_string( # type: ignore + self, flags: int = 0, encoding: str = 'utf-8' + ) -> Awaitable[str]: ... + def send_pyobj( # type: ignore + self, obj: Any, flags: int = 0, protocol: int = DEFAULT_PROTOCOL, **kwargs + ) -> Awaitable[_zmq.Frame | None]: ... + def recv_pyobj(self, flags: int = 0) -> Awaitable[Any]: ... # type: ignore + def send_json( # type: ignore + self, obj: Any, flags: int = 0, **kwargs + ) -> Awaitable[_zmq.Frame | None]: ... + def recv_json(self, flags: int = 0, **kwargs) -> Awaitable[Any]: ... # type: ignore + def poll(self, timeout=-1) -> Awaitable[list[tuple[Any, int]]]: ... # type: ignore diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/_typing.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/_typing.py new file mode 100644 index 0000000000000000000000000000000000000000..9833a1b9d2bc5d66207e782773c2a09d8878ebcf --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/_typing.py @@ -0,0 +1,11 @@ +from __future__ import annotations + +import sys + +if sys.version_info >= (3, 10): + from typing import TypeAlias +else: + try: + from typing_extensions import TypeAlias + except ImportError: + TypeAlias = type # type: ignore diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/asyncio.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/asyncio.py new file mode 100644 index 0000000000000000000000000000000000000000..22bbd14d423cc2fb31efa7846681ab4420a2a6fd --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/asyncio.py @@ -0,0 +1,224 @@ +"""AsyncIO support for zmq + +Requires asyncio and Python 3. +""" + +# Copyright (c) PyZMQ Developers. +# Distributed under the terms of the Modified BSD License. +from __future__ import annotations + +import asyncio +import selectors +import sys +import warnings +from asyncio import Future, SelectorEventLoop +from weakref import WeakKeyDictionary + +import zmq as _zmq +from zmq import _future + +# registry of asyncio loop : selector thread +_selectors: WeakKeyDictionary = WeakKeyDictionary() + + +class ProactorSelectorThreadWarning(RuntimeWarning): + """Warning class for notifying about the extra thread spawned by tornado + + We automatically support proactor via tornado's AddThreadSelectorEventLoop""" + + +def _get_selector_windows( + asyncio_loop, +) -> asyncio.AbstractEventLoop: + """Get selector-compatible loop + + Returns an object with ``add_reader`` family of methods, + either the loop itself or a SelectorThread instance. + + Workaround Windows proactor removal of + *reader methods, which we need for zmq sockets. + """ + + if asyncio_loop in _selectors: + return _selectors[asyncio_loop] + + # detect add_reader instead of checking for proactor? + if hasattr(asyncio, "ProactorEventLoop") and isinstance( + asyncio_loop, + asyncio.ProactorEventLoop, # type: ignore + ): + try: + from tornado.platform.asyncio import AddThreadSelectorEventLoop + except ImportError: + raise RuntimeError( + "Proactor event loop does not implement add_reader family of methods required for zmq." + " zmq will work with proactor if tornado >= 6.1 can be found." + " Use `asyncio.set_event_loop_policy(WindowsSelectorEventLoopPolicy())`" + " or install 'tornado>=6.1' to avoid this error." + ) + + warnings.warn( + "Proactor event loop does not implement add_reader family of methods required for zmq." + " Registering an additional selector thread for add_reader support via tornado." + " Use `asyncio.set_event_loop_policy(WindowsSelectorEventLoopPolicy())`" + " to avoid this warning.", + RuntimeWarning, + # stacklevel 5 matches most likely zmq.asyncio.Context().socket() + stacklevel=5, + ) + + selector_loop = _selectors[asyncio_loop] = AddThreadSelectorEventLoop( + asyncio_loop + ) # type: ignore + + # patch loop.close to also close the selector thread + loop_close = asyncio_loop.close + + def _close_selector_and_loop(): + # restore original before calling selector.close, + # which in turn calls eventloop.close! + asyncio_loop.close = loop_close + _selectors.pop(asyncio_loop, None) + selector_loop.close() + + asyncio_loop.close = _close_selector_and_loop # type: ignore # mypy bug - assign a function to method + return selector_loop + else: + return asyncio_loop + + +def _get_selector_noop(loop) -> asyncio.AbstractEventLoop: + """no-op on non-Windows""" + return loop + + +if sys.platform == "win32": + _get_selector = _get_selector_windows +else: + _get_selector = _get_selector_noop + + +class _AsyncIO: + _Future = Future + _WRITE = selectors.EVENT_WRITE + _READ = selectors.EVENT_READ + + def _default_loop(self): + try: + return asyncio.get_running_loop() + except RuntimeError: + warnings.warn( + "No running event loop. zmq.asyncio should be used from within an asyncio loop.", + RuntimeWarning, + stacklevel=4, + ) + # get_event_loop deprecated in 3.10: + return asyncio.get_event_loop() + + +class Poller(_AsyncIO, _future._AsyncPoller): + """Poller returning asyncio.Future for poll results.""" + + def _watch_raw_socket(self, loop, socket, evt, f): + """Schedule callback for a raw socket""" + selector = _get_selector(loop) + if evt & self._READ: + selector.add_reader(socket, lambda *args: f()) + if evt & self._WRITE: + selector.add_writer(socket, lambda *args: f()) + + def _unwatch_raw_sockets(self, loop, *sockets): + """Unschedule callback for a raw socket""" + selector = _get_selector(loop) + for socket in sockets: + selector.remove_reader(socket) + selector.remove_writer(socket) + + +class Socket(_AsyncIO, _future._AsyncSocket): + """Socket returning asyncio Futures for send/recv/poll methods.""" + + _poller_class = Poller + + def _get_selector(self, io_loop=None): + if io_loop is None: + io_loop = self._get_loop() + return _get_selector(io_loop) + + def _init_io_state(self, io_loop=None): + """initialize the ioloop event handler""" + self._get_selector(io_loop).add_reader( + self._fd, lambda: self._handle_events(0, 0) + ) + + def _clear_io_state(self): + """clear any ioloop event handler + + called once at close + """ + loop = self._current_loop + if loop and not loop.is_closed() and self._fd != -1: + self._get_selector(loop).remove_reader(self._fd) + + +Poller._socket_class = Socket + + +class Context(_zmq.Context[Socket]): + """Context for creating asyncio-compatible Sockets""" + + _socket_class = Socket + + # avoid sharing instance with base Context class + _instance = None + + # overload with no changes to satisfy pyright + def __init__( + self: Context, + io_threads: int | _zmq.Context = 1, + shadow: _zmq.Context | int = 0, + ) -> None: + super().__init__(io_threads, shadow) # type: ignore + + +class ZMQEventLoop(SelectorEventLoop): + """DEPRECATED: AsyncIO eventloop using zmq_poll. + + pyzmq sockets should work with any asyncio event loop as of pyzmq 17. + """ + + def __init__(self, selector=None): + _deprecated() + return super().__init__(selector) + + +_loop = None + + +def _deprecated(): + if _deprecated.called: # type: ignore + return + _deprecated.called = True # type: ignore + + warnings.warn( + "ZMQEventLoop and zmq.asyncio.install are deprecated in pyzmq 17. Special eventloop integration is no longer needed.", + DeprecationWarning, + stacklevel=3, + ) + + +_deprecated.called = False # type: ignore + + +def install(): + """DEPRECATED: No longer needed in pyzmq 17""" + _deprecated() + + +__all__ = [ + "Context", + "Socket", + "Poller", + "ZMQEventLoop", + "install", +] diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/auth/__init__.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/auth/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..ebacab71272ab4e1b7999ea8d6a875c08c6b861b --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/auth/__init__.py @@ -0,0 +1,13 @@ +"""Utilities for ZAP authentication. + +To run authentication in a background thread, see :mod:`zmq.auth.thread`. +For integration with the asyncio event loop, see :mod:`zmq.auth.asyncio`. + +Authentication examples are provided in the pyzmq codebase, under +`/examples/security/`. + +.. versionadded:: 14.1 +""" + +from .base import * +from .certs import * diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/auth/asyncio.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/auth/asyncio.py new file mode 100644 index 0000000000000000000000000000000000000000..8b4915c12784538761dab70cee8e34395a1df066 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/auth/asyncio.py @@ -0,0 +1,66 @@ +"""ZAP Authenticator integrated with the asyncio IO loop. + +.. versionadded:: 15.2 +""" + +# Copyright (C) PyZMQ Developers +# Distributed under the terms of the Modified BSD License. + +import asyncio +import warnings +from typing import Any, Optional + +import zmq +from zmq.asyncio import Poller + +from .base import Authenticator + + +class AsyncioAuthenticator(Authenticator): + """ZAP authentication for use in the asyncio IO loop""" + + __poller: Optional[Poller] + __task: Any + + def __init__( + self, + context: Optional["zmq.Context"] = None, + loop: Any = None, + encoding: str = 'utf-8', + log: Any = None, + ): + super().__init__(context, encoding, log) + if loop is not None: + warnings.warn( + f"{self.__class__.__name__}(loop) is deprecated and ignored", + DeprecationWarning, + stacklevel=2, + ) + self.__poller = None + self.__task = None + + async def __handle_zap(self) -> None: + while self.__poller is not None: + events = await self.__poller.poll() + if self.zap_socket in dict(events): + msg = self.zap_socket.recv_multipart() + await self.handle_zap_message(msg) + + def start(self) -> None: + """Start ZAP authentication""" + super().start() + self.__poller = Poller() + self.__poller.register(self.zap_socket, zmq.POLLIN) + self.__task = asyncio.ensure_future(self.__handle_zap()) + + def stop(self) -> None: + """Stop ZAP authentication""" + if self.__task: + self.__task.cancel() + if self.__poller: + self.__poller.unregister(self.zap_socket) + self.__poller = None + super().stop() + + +__all__ = ["AsyncioAuthenticator"] diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/auth/base.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/auth/base.py new file mode 100644 index 0000000000000000000000000000000000000000..c862b60c14f0625de1cf8c0006357760dce88d29 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/auth/base.py @@ -0,0 +1,445 @@ +"""Base implementation of 0MQ authentication.""" + +# Copyright (C) PyZMQ Developers +# Distributed under the terms of the Modified BSD License. + +import logging +import os +from typing import Any, Awaitable, Dict, List, Optional, Set, Tuple, Union + +import zmq +from zmq.error import _check_version +from zmq.utils import z85 + +from .certs import load_certificates + +CURVE_ALLOW_ANY = '*' +VERSION = b'1.0' + + +class Authenticator: + """Implementation of ZAP authentication for zmq connections. + + This authenticator class does not register with an event loop. As a result, + you will need to manually call `handle_zap_message`:: + + auth = zmq.Authenticator() + auth.allow("127.0.0.1") + auth.start() + while True: + await auth.handle_zap_msg(auth.zap_socket.recv_multipart()) + + Alternatively, you can register `auth.zap_socket` with a poller. + + Since many users will want to run ZAP in a way that does not block the + main thread, other authentication classes (such as :mod:`zmq.auth.thread`) + are provided. + + Note: + + - libzmq provides four levels of security: default NULL (which the Authenticator does + not see), and authenticated NULL, PLAIN, CURVE, and GSSAPI, which the Authenticator can see. + - until you add policies, all incoming NULL connections are allowed. + (classic ZeroMQ behavior), and all PLAIN and CURVE connections are denied. + - GSSAPI requires no configuration. + """ + + context: "zmq.Context" + encoding: str + allow_any: bool + credentials_providers: Dict[str, Any] + zap_socket: "zmq.Socket" + _allowed: Set[str] + _denied: Set[str] + passwords: Dict[str, Dict[str, str]] + certs: Dict[str, Dict[bytes, Any]] + log: Any + + def __init__( + self, + context: Optional["zmq.Context"] = None, + encoding: str = 'utf-8', + log: Any = None, + ): + _check_version((4, 0), "security") + self.context = context or zmq.Context.instance() + self.encoding = encoding + self.allow_any = False + self.credentials_providers = {} + self.zap_socket = None # type: ignore + self._allowed = set() + self._denied = set() + # passwords is a dict keyed by domain and contains values + # of dicts with username:password pairs. + self.passwords = {} + # certs is dict keyed by domain and contains values + # of dicts keyed by the public keys from the specified location. + self.certs = {} + self.log = log or logging.getLogger('zmq.auth') + + def start(self) -> None: + """Create and bind the ZAP socket""" + self.zap_socket = self.context.socket(zmq.REP, socket_class=zmq.Socket) + self.zap_socket.linger = 1 + self.zap_socket.bind("inproc://zeromq.zap.01") + self.log.debug("Starting") + + def stop(self) -> None: + """Close the ZAP socket""" + if self.zap_socket: + self.zap_socket.close() + self.zap_socket = None # type: ignore + + def allow(self, *addresses: str) -> None: + """Allow IP address(es). + + Connections from addresses not explicitly allowed will be rejected. + + - For NULL, all clients from this address will be accepted. + - For real auth setups, they will be allowed to continue with authentication. + + allow is mutually exclusive with deny. + """ + if self._denied: + raise ValueError("Only use allow or deny, not both") + self.log.debug("Allowing %s", ','.join(addresses)) + self._allowed.update(addresses) + + def deny(self, *addresses: str) -> None: + """Deny IP address(es). + + Addresses not explicitly denied will be allowed to continue with authentication. + + deny is mutually exclusive with allow. + """ + if self._allowed: + raise ValueError("Only use a allow or deny, not both") + self.log.debug("Denying %s", ','.join(addresses)) + self._denied.update(addresses) + + def configure_plain( + self, domain: str = '*', passwords: Optional[Dict[str, str]] = None + ) -> None: + """Configure PLAIN authentication for a given domain. + + PLAIN authentication uses a plain-text password file. + To cover all domains, use "*". + You can modify the password file at any time; it is reloaded automatically. + """ + if passwords: + self.passwords[domain] = passwords + self.log.debug("Configure plain: %s", domain) + + def configure_curve( + self, domain: str = '*', location: Union[str, os.PathLike] = "." + ) -> None: + """Configure CURVE authentication for a given domain. + + CURVE authentication uses a directory that holds all public client certificates, + i.e. their public keys. + + To cover all domains, use "*". + + You can add and remove certificates in that directory at any time. configure_curve must be called + every time certificates are added or removed, in order to update the Authenticator's state + + To allow all client keys without checking, specify CURVE_ALLOW_ANY for the location. + """ + # If location is CURVE_ALLOW_ANY then allow all clients. Otherwise + # treat location as a directory that holds the certificates. + self.log.debug("Configure curve: %s[%s]", domain, location) + if location == CURVE_ALLOW_ANY: + self.allow_any = True + else: + self.allow_any = False + try: + self.certs[domain] = load_certificates(location) + except Exception as e: + self.log.error("Failed to load CURVE certs from %s: %s", location, e) + + def configure_curve_callback( + self, domain: str = '*', credentials_provider: Any = None + ) -> None: + """Configure CURVE authentication for a given domain. + + CURVE authentication using a callback function validating + the client public key according to a custom mechanism, e.g. checking the + key against records in a db. credentials_provider is an object of a class which + implements a callback method accepting two parameters (domain and key), e.g.:: + + class CredentialsProvider(object): + + def __init__(self): + ...e.g. db connection + + def callback(self, domain, key): + valid = ...lookup key and/or domain in db + if valid: + logging.info('Authorizing: {0}, {1}'.format(domain, key)) + return True + else: + logging.warning('NOT Authorizing: {0}, {1}'.format(domain, key)) + return False + + To cover all domains, use "*". + """ + + self.allow_any = False + + if credentials_provider is not None: + self.credentials_providers[domain] = credentials_provider + else: + self.log.error("None credentials_provider provided for domain:%s", domain) + + def curve_user_id(self, client_public_key: bytes) -> str: + """Return the User-Id corresponding to a CURVE client's public key + + Default implementation uses the z85-encoding of the public key. + + Override to define a custom mapping of public key : user-id + + This is only called on successful authentication. + + Parameters + ---------- + client_public_key: bytes + The client public key used for the given message + + Returns + ------- + user_id: unicode + The user ID as text + """ + return z85.encode(client_public_key).decode('ascii') + + def configure_gssapi( + self, domain: str = '*', location: Optional[str] = None + ) -> None: + """Configure GSSAPI authentication + + Currently this is a no-op because there is nothing to configure with GSSAPI. + """ + + async def handle_zap_message(self, msg: List[bytes]): + """Perform ZAP authentication""" + if len(msg) < 6: + self.log.error("Invalid ZAP message, not enough frames: %r", msg) + if len(msg) < 2: + self.log.error("Not enough information to reply") + else: + self._send_zap_reply(msg[1], b"400", b"Not enough frames") + return + + version, request_id, domain, address, identity, mechanism = msg[:6] + credentials = msg[6:] + + domain = domain.decode(self.encoding, 'replace') + address = address.decode(self.encoding, 'replace') + + if version != VERSION: + self.log.error("Invalid ZAP version: %r", msg) + self._send_zap_reply(request_id, b"400", b"Invalid version") + return + + self.log.debug( + "version: %r, request_id: %r, domain: %r," + " address: %r, identity: %r, mechanism: %r", + version, + request_id, + domain, + address, + identity, + mechanism, + ) + + # Is address is explicitly allowed or _denied? + allowed = False + denied = False + reason = b"NO ACCESS" + + if self._allowed: + if address in self._allowed: + allowed = True + self.log.debug("PASSED (allowed) address=%s", address) + else: + denied = True + reason = b"Address not allowed" + self.log.debug("DENIED (not allowed) address=%s", address) + + elif self._denied: + if address in self._denied: + denied = True + reason = b"Address denied" + self.log.debug("DENIED (denied) address=%s", address) + else: + allowed = True + self.log.debug("PASSED (not denied) address=%s", address) + + # Perform authentication mechanism-specific checks if necessary + username = "anonymous" + if not denied: + if mechanism == b'NULL' and not allowed: + # For NULL, we allow if the address wasn't denied + self.log.debug("ALLOWED (NULL)") + allowed = True + + elif mechanism == b'PLAIN': + # For PLAIN, even a _alloweded address must authenticate + if len(credentials) != 2: + self.log.error("Invalid PLAIN credentials: %r", credentials) + self._send_zap_reply(request_id, b"400", b"Invalid credentials") + return + username, password = ( + c.decode(self.encoding, 'replace') for c in credentials + ) + allowed, reason = self._authenticate_plain(domain, username, password) + + elif mechanism == b'CURVE': + # For CURVE, even a _alloweded address must authenticate + if len(credentials) != 1: + self.log.error("Invalid CURVE credentials: %r", credentials) + self._send_zap_reply(request_id, b"400", b"Invalid credentials") + return + key = credentials[0] + allowed, reason = await self._authenticate_curve(domain, key) + if allowed: + username = self.curve_user_id(key) + + elif mechanism == b'GSSAPI': + if len(credentials) != 1: + self.log.error("Invalid GSSAPI credentials: %r", credentials) + self._send_zap_reply(request_id, b"400", b"Invalid credentials") + return + # use principal as user-id for now + principal = credentials[0] + username = principal.decode("utf8") + allowed, reason = self._authenticate_gssapi(domain, principal) + + if allowed: + self._send_zap_reply(request_id, b"200", b"OK", username) + else: + self._send_zap_reply(request_id, b"400", reason) + + def _authenticate_plain( + self, domain: str, username: str, password: str + ) -> Tuple[bool, bytes]: + """PLAIN ZAP authentication""" + allowed = False + reason = b"" + if self.passwords: + # If no domain is not specified then use the default domain + if not domain: + domain = '*' + + if domain in self.passwords: + if username in self.passwords[domain]: + if password == self.passwords[domain][username]: + allowed = True + else: + reason = b"Invalid password" + else: + reason = b"Invalid username" + else: + reason = b"Invalid domain" + + if allowed: + self.log.debug( + "ALLOWED (PLAIN) domain=%s username=%s password=%s", + domain, + username, + password, + ) + else: + self.log.debug("DENIED %s", reason) + + else: + reason = b"No passwords defined" + self.log.debug("DENIED (PLAIN) %s", reason) + + return allowed, reason + + async def _authenticate_curve( + self, domain: str, client_key: bytes + ) -> Tuple[bool, bytes]: + """CURVE ZAP authentication""" + allowed = False + reason = b"" + if self.allow_any: + allowed = True + reason = b"OK" + self.log.debug("ALLOWED (CURVE allow any client)") + elif self.credentials_providers != {}: + # If no explicit domain is specified then use the default domain + if not domain: + domain = '*' + + if domain in self.credentials_providers: + z85_client_key = z85.encode(client_key) + # Callback to check if key is Allowed + r = self.credentials_providers[domain].callback(domain, z85_client_key) + if isinstance(r, Awaitable): + r = await r + if r: + allowed = True + reason = b"OK" + else: + reason = b"Unknown key" + + status = "ALLOWED" if allowed else "DENIED" + self.log.debug( + "%s (CURVE auth_callback) domain=%s client_key=%s", + status, + domain, + z85_client_key, + ) + else: + reason = b"Unknown domain" + else: + # If no explicit domain is specified then use the default domain + if not domain: + domain = '*' + + if domain in self.certs: + # The certs dict stores keys in z85 format, convert binary key to z85 bytes + z85_client_key = z85.encode(client_key) + if self.certs[domain].get(z85_client_key): + allowed = True + reason = b"OK" + else: + reason = b"Unknown key" + + status = "ALLOWED" if allowed else "DENIED" + self.log.debug( + "%s (CURVE) domain=%s client_key=%s", + status, + domain, + z85_client_key, + ) + else: + reason = b"Unknown domain" + + return allowed, reason + + def _authenticate_gssapi(self, domain: str, principal: bytes) -> Tuple[bool, bytes]: + """Nothing to do for GSSAPI, which has already been handled by an external service.""" + self.log.debug("ALLOWED (GSSAPI) domain=%s principal=%s", domain, principal) + return True, b'OK' + + def _send_zap_reply( + self, + request_id: bytes, + status_code: bytes, + status_text: bytes, + user_id: str = 'anonymous', + ) -> None: + """Send a ZAP reply to finish the authentication.""" + user_id = user_id if status_code == b'200' else b'' + if isinstance(user_id, str): + user_id = user_id.encode(self.encoding, 'replace') + metadata = b'' # not currently used + self.log.debug("ZAP reply code=%s text=%s", status_code, status_text) + reply = [VERSION, request_id, status_code, status_text, user_id, metadata] + self.zap_socket.send_multipart(reply) + + +__all__ = ['Authenticator', 'CURVE_ALLOW_ANY'] diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/auth/certs.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/auth/certs.py new file mode 100644 index 0000000000000000000000000000000000000000..d60ae005dc111da80576adcdc378390ba6026527 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/auth/certs.py @@ -0,0 +1,140 @@ +"""0MQ authentication related functions and classes.""" + +# Copyright (C) PyZMQ Developers +# Distributed under the terms of the Modified BSD License. + +import datetime +import glob +import os +from typing import Dict, Optional, Tuple, Union + +import zmq + +_cert_secret_banner = """# **** Generated on {0} by pyzmq **** +# ZeroMQ CURVE **Secret** Certificate +# DO NOT PROVIDE THIS FILE TO OTHER USERS nor change its permissions. + +""" + + +_cert_public_banner = """# **** Generated on {0} by pyzmq **** +# ZeroMQ CURVE Public Certificate +# Exchange securely, or use a secure mechanism to verify the contents +# of this file after exchange. Store public certificates in your home +# directory, in the .curve subdirectory. + +""" + + +def _write_key_file( + key_filename: Union[str, os.PathLike], + banner: str, + public_key: Union[str, bytes], + secret_key: Optional[Union[str, bytes]] = None, + metadata: Optional[Dict[str, str]] = None, + encoding: str = 'utf-8', +) -> None: + """Create a certificate file""" + if isinstance(public_key, bytes): + public_key = public_key.decode(encoding) + if isinstance(secret_key, bytes): + secret_key = secret_key.decode(encoding) + with open(key_filename, 'w', encoding='utf8') as f: + f.write(banner.format(datetime.datetime.now())) + + f.write('metadata\n') + if metadata: + for k, v in metadata.items(): + if isinstance(k, bytes): + k = k.decode(encoding) + if isinstance(v, bytes): + v = v.decode(encoding) + f.write(f" {k} = {v}\n") + + f.write('curve\n') + f.write(f" public-key = \"{public_key}\"\n") + + if secret_key: + f.write(f" secret-key = \"{secret_key}\"\n") + + +def create_certificates( + key_dir: Union[str, os.PathLike], + name: str, + metadata: Optional[Dict[str, str]] = None, +) -> Tuple[str, str]: + """Create zmq certificates. + + Returns the file paths to the public and secret certificate files. + """ + public_key, secret_key = zmq.curve_keypair() + base_filename = os.path.join(key_dir, name) + secret_key_file = f"{base_filename}.key_secret" + public_key_file = f"{base_filename}.key" + now = datetime.datetime.now() + + _write_key_file(public_key_file, _cert_public_banner.format(now), public_key) + + _write_key_file( + secret_key_file, + _cert_secret_banner.format(now), + public_key, + secret_key=secret_key, + metadata=metadata, + ) + + return public_key_file, secret_key_file + + +def load_certificate( + filename: Union[str, os.PathLike], +) -> Tuple[bytes, Optional[bytes]]: + """Load public and secret key from a zmq certificate. + + Returns (public_key, secret_key) + + If the certificate file only contains the public key, + secret_key will be None. + + If there is no public key found in the file, ValueError will be raised. + """ + public_key = None + secret_key = None + if not os.path.exists(filename): + raise OSError(f"Invalid certificate file: {filename}") + + with open(filename, 'rb') as f: + for line in f: + line = line.strip() + if line.startswith(b'#'): + continue + if line.startswith(b'public-key'): + public_key = line.split(b"=", 1)[1].strip(b' \t\'"') + if line.startswith(b'secret-key'): + secret_key = line.split(b"=", 1)[1].strip(b' \t\'"') + if public_key and secret_key: + break + + if public_key is None: + raise ValueError(f"No public key found in {filename}") + + return public_key, secret_key + + +def load_certificates(directory: Union[str, os.PathLike] = '.') -> Dict[bytes, bool]: + """Load public keys from all certificates in a directory""" + certs = {} + if not os.path.isdir(directory): + raise OSError(f"Invalid certificate directory: {directory}") + # Follow czmq pattern of public keys stored in *.key files. + glob_string = os.path.join(directory, "*.key") + + cert_files = glob.glob(glob_string) + for cert_file in cert_files: + public_key, _ = load_certificate(cert_file) + if public_key: + certs[public_key] = True + return certs + + +__all__ = ['create_certificates', 'load_certificate', 'load_certificates'] diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/auth/ioloop.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/auth/ioloop.py new file mode 100644 index 0000000000000000000000000000000000000000..f87f068e7ef92004a7bbad93e77e445a607e0093 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/auth/ioloop.py @@ -0,0 +1,48 @@ +"""ZAP Authenticator integrated with the tornado IOLoop. + +.. versionadded:: 14.1 +.. deprecated:: 25 + Use asyncio.AsyncioAuthenticator instead. + Since tornado runs on asyncio, the asyncio authenticator + offers the same functionality in tornado. +""" + +import warnings + +# Copyright (C) PyZMQ Developers +# Distributed under the terms of the Modified BSD License. +from typing import Any, Optional + +import zmq + +from .asyncio import AsyncioAuthenticator + +warnings.warn( + "zmq.auth.ioloop.IOLoopAuthenticator is deprecated. Use zmq.auth.asyncio.AsyncioAuthenticator", + DeprecationWarning, + stacklevel=2, +) + + +class IOLoopAuthenticator(AsyncioAuthenticator): + """ZAP authentication for use in the tornado IOLoop""" + + def __init__( + self, + context: Optional["zmq.Context"] = None, + encoding: str = 'utf-8', + log: Any = None, + io_loop: Any = None, + ): + loop = None + if io_loop is not None: + warnings.warn( + f"{self.__class__.__name__}(io_loop) is deprecated and ignored", + DeprecationWarning, + stacklevel=2, + ) + loop = io_loop.asyncio_loop + super().__init__(context=context, encoding=encoding, log=log, loop=loop) + + +__all__ = ['IOLoopAuthenticator'] diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/auth/thread.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/auth/thread.py new file mode 100644 index 0000000000000000000000000000000000000000..a227c4bd5974f95e3b5b844a1ce0de34f9454f10 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/auth/thread.py @@ -0,0 +1,139 @@ +"""ZAP Authenticator in a Python Thread. + +.. versionadded:: 14.1 +""" + +# Copyright (C) PyZMQ Developers +# Distributed under the terms of the Modified BSD License. + +import asyncio +from threading import Event, Thread +from typing import Any, List, Optional + +import zmq +import zmq.asyncio + +from .base import Authenticator + + +class AuthenticationThread(Thread): + """A Thread for running a zmq Authenticator + + This is run in the background by ThreadAuthenticator + """ + + pipe: zmq.Socket + loop: asyncio.AbstractEventLoop + authenticator: Authenticator + poller: Optional[zmq.asyncio.Poller] = None + + def __init__( + self, + authenticator: Authenticator, + pipe: zmq.Socket, + ) -> None: + super().__init__(daemon=True) + self.authenticator = authenticator + self.log = authenticator.log + self.pipe = pipe + + self.started = Event() + + def run(self) -> None: + """Start the Authentication Agent thread task""" + + loop = asyncio.new_event_loop() + try: + loop.run_until_complete(self._run()) + finally: + if self.pipe: + self.pipe.close() + self.pipe = None # type: ignore + + loop.close() + + async def _run(self): + self.poller = zmq.asyncio.Poller() + self.poller.register(self.pipe, zmq.POLLIN) + self.poller.register(self.authenticator.zap_socket, zmq.POLLIN) + self.started.set() + + while True: + events = dict(await self.poller.poll()) + if self.pipe in events: + msg = self.pipe.recv_multipart() + if self._handle_pipe_message(msg): + return + if self.authenticator.zap_socket in events: + msg = self.authenticator.zap_socket.recv_multipart() + await self.authenticator.handle_zap_message(msg) + + def _handle_pipe_message(self, msg: List[bytes]) -> bool: + command = msg[0] + self.log.debug("auth received API command %r", command) + + if command == b'TERMINATE': + return True + + else: + self.log.error("Invalid auth command from API: %r", command) + self.pipe.send(b'ERROR') + + return False + + +class ThreadAuthenticator(Authenticator): + """Run ZAP authentication in a background thread""" + + pipe: "zmq.Socket" + pipe_endpoint: str = '' + thread: AuthenticationThread + + def __init__( + self, + context: Optional["zmq.Context"] = None, + encoding: str = 'utf-8', + log: Any = None, + ): + super().__init__(context=context, encoding=encoding, log=log) + self.pipe = None # type: ignore + self.pipe_endpoint = f"inproc://{id(self)}.inproc" + self.thread = None # type: ignore + + def start(self) -> None: + """Start the authentication thread""" + # start the Authenticator + super().start() + + # create a socket pair to communicate with auth thread. + self.pipe = self.context.socket(zmq.PAIR, socket_class=zmq.Socket) + self.pipe.linger = 1 + self.pipe.bind(self.pipe_endpoint) + thread_pipe = self.context.socket(zmq.PAIR, socket_class=zmq.Socket) + thread_pipe.linger = 1 + thread_pipe.connect(self.pipe_endpoint) + self.thread = AuthenticationThread(authenticator=self, pipe=thread_pipe) + self.thread.start() + if not self.thread.started.wait(timeout=10): + raise RuntimeError("Authenticator thread failed to start") + + def stop(self) -> None: + """Stop the authentication thread""" + if self.pipe: + self.pipe.send(b'TERMINATE') + if self.is_alive(): + self.thread.join() + self.thread = None # type: ignore + self.pipe.close() + self.pipe = None # type: ignore + super().stop() + + def is_alive(self) -> bool: + """Is the ZAP thread currently running?""" + return bool(self.thread and self.thread.is_alive()) + + def __del__(self) -> None: + self.stop() + + +__all__ = ['ThreadAuthenticator'] diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/backend/__init__.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/backend/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..15f696d9d3ad5275443eb3145b9c4087f1e6609f --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/backend/__init__.py @@ -0,0 +1,34 @@ +"""Import basic exposure of libzmq C API as a backend""" + +# Copyright (C) PyZMQ Developers +# Distributed under the terms of the Modified BSD License. + +import os +import platform + +from .select import public_api, select_backend + +if 'PYZMQ_BACKEND' in os.environ: + backend = os.environ['PYZMQ_BACKEND'] + if backend in ('cython', 'cffi'): + backend = f'zmq.backend.{backend}' + _ns = select_backend(backend) +else: + # default to cython, fallback to cffi + # (reverse on PyPy) + if platform.python_implementation() == 'PyPy': + first, second = ('zmq.backend.cffi', 'zmq.backend.cython') + else: + first, second = ('zmq.backend.cython', 'zmq.backend.cffi') + + try: + _ns = select_backend(first) + except Exception as original_error: + try: + _ns = select_backend(second) + except ImportError: + raise original_error from None + +globals().update(_ns) + +__all__ = public_api diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/backend/__init__.pyi b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/backend/__init__.pyi new file mode 100644 index 0000000000000000000000000000000000000000..2d51e876e72d8d4d59151828ba794d2d89120044 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/backend/__init__.pyi @@ -0,0 +1,123 @@ +from typing import Any, Callable, List, Optional, Set, Tuple, TypeVar, Union, overload + +from typing_extensions import Literal + +import zmq + +from .select import select_backend + +# avoid collision in Frame.bytes +_bytestr = bytes + +T = TypeVar("T") + +class Frame: + buffer: Any + bytes: bytes + more: bool + tracker: Any + def __init__( + self, + data: Any = None, + track: bool = False, + copy: bool | None = None, + copy_threshold: int | None = None, + ): ... + def copy_fast(self: T) -> T: ... + def get(self, option: int) -> int | _bytestr | str: ... + def set(self, option: int, value: int | _bytestr | str) -> None: ... + +class Socket: + underlying: int + context: zmq.Context + copy_threshold: int + + # specific option types + FD: int + + def __init__( + self, + context: Context | None = None, + socket_type: int = 0, + shadow: int = 0, + copy_threshold: int | None = zmq.COPY_THRESHOLD, + ) -> None: ... + def close(self, linger: int | None = ...) -> None: ... + def get(self, option: int) -> int | bytes | str: ... + def set(self, option: int, value: int | bytes | str) -> None: ... + def connect(self, url: str): ... + def disconnect(self, url: str) -> None: ... + def bind(self, url: str): ... + def unbind(self, url: str) -> None: ... + def send( + self, + data: Any, + flags: int = ..., + copy: bool = ..., + track: bool = ..., + ) -> zmq.MessageTracker | None: ... + @overload + def recv( + self, + flags: int = ..., + *, + copy: Literal[False], + track: bool = ..., + ) -> zmq.Frame: ... + @overload + def recv( + self, + flags: int = ..., + *, + copy: Literal[True], + track: bool = ..., + ) -> bytes: ... + @overload + def recv( + self, + flags: int = ..., + track: bool = False, + ) -> bytes: ... + @overload + def recv( + self, + flags: int | None = ..., + copy: bool = ..., + track: bool | None = False, + ) -> zmq.Frame | bytes: ... + def recv_into(self, buf, /, *, nbytes: int = 0, flags: int = 0) -> int: ... + def monitor(self, addr: str | None, events: int) -> None: ... + # draft methods + def join(self, group: str) -> None: ... + def leave(self, group: str) -> None: ... + +class Context: + underlying: int + def __init__(self, io_threads: int = 1, shadow: int = 0): ... + def get(self, option: int) -> int | bytes | str: ... + def set(self, option: int, value: int | bytes | str) -> None: ... + def socket(self, socket_type: int) -> Socket: ... + def term(self) -> None: ... + +IPC_PATH_MAX_LEN: int +PYZMQ_DRAFT_API: bool + +def has(capability: str) -> bool: ... +def curve_keypair() -> tuple[bytes, bytes]: ... +def curve_public(secret_key: bytes) -> bytes: ... +def strerror(errno: int | None = ...) -> str: ... +def zmq_errno() -> int: ... +def zmq_version() -> str: ... +def zmq_version_info() -> tuple[int, int, int]: ... +def zmq_poll( + sockets: list[Any], timeout: int | None = ... +) -> list[tuple[Socket, int]]: ... +def proxy(frontend: Socket, backend: Socket, capture: Socket | None = None) -> int: ... +def proxy_steerable( + frontend: Socket, + backend: Socket, + capture: Socket | None = ..., + control: Socket | None = ..., +) -> int: ... + +monitored_queue = Callable | None diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/backend/cffi/README.md b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/backend/cffi/README.md new file mode 100644 index 0000000000000000000000000000000000000000..00bb32989dcfbc787760075fd6dc4801568ab0a2 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/backend/cffi/README.md @@ -0,0 +1 @@ +PyZMQ's CFFI support is designed only for (Unix) systems conforming to `have_sys_un_h = True`. diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/backend/cffi/__init__.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/backend/cffi/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..ce929a7a6a6bbe84c6a1cdd873095152837cd44c --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/backend/cffi/__init__.py @@ -0,0 +1,38 @@ +"""CFFI backend (for PyPy)""" + +# Copyright (C) PyZMQ Developers +# Distributed under the terms of the Modified BSD License. + +# for clearer error message on missing cffi +import cffi # noqa + +from zmq.backend.cffi import _poll, context, devices, error, message, socket, utils + +from ._cffi import ffi +from ._cffi import lib as C + + +def zmq_version_info(): + """Get libzmq version as tuple of ints""" + major = ffi.new('int*') + minor = ffi.new('int*') + patch = ffi.new('int*') + + C.zmq_version(major, minor, patch) + + return (int(major[0]), int(minor[0]), int(patch[0])) + + +__all__ = ["zmq_version_info"] +for submod in (error, message, context, socket, _poll, devices, utils): + __all__.extend(submod.__all__) + +from ._poll import * +from .context import * +from .devices import * +from .error import * +from .message import * +from .socket import * +from .utils import * + +monitored_queue = None diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/backend/cffi/_cdefs.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/backend/cffi/_cdefs.h new file mode 100644 index 0000000000000000000000000000000000000000..98f7ce6208af75fa666a2e16bf25892ed2474d62 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/backend/cffi/_cdefs.h @@ -0,0 +1,98 @@ +void zmq_version(int *major, int *minor, int *patch); + +void* zmq_socket(void *context, int type); +int zmq_close(void *socket); + +int zmq_bind(void *socket, const char *endpoint); +int zmq_connect(void *socket, const char *endpoint); + +int zmq_errno(void); +const char * zmq_strerror(int errnum); + +int zmq_unbind(void *socket, const char *endpoint); +int zmq_disconnect(void *socket, const char *endpoint); +void* zmq_ctx_new(); +int zmq_ctx_destroy(void *context); +int zmq_ctx_get(void *context, int opt); +int zmq_ctx_set(void *context, int opt, int optval); +int zmq_proxy(void *frontend, void *backend, void *capture); +int zmq_proxy_steerable(void *frontend, + void *backend, + void *capture, + void *control); +int zmq_socket_monitor(void *socket, const char *addr, int events); + +int zmq_curve_keypair (char *z85_public_key, char *z85_secret_key); +int zmq_curve_public (char *z85_public_key, char *z85_secret_key); +int zmq_has (const char *capability); + +typedef struct { ...; } zmq_msg_t; +typedef ... zmq_free_fn; + +int zmq_msg_init(zmq_msg_t *msg); +int zmq_msg_init_size(zmq_msg_t *msg, size_t size); +int zmq_msg_init_data(zmq_msg_t *msg, + void *data, + size_t size, + zmq_free_fn *ffn, + void *hint); + +size_t zmq_msg_size(zmq_msg_t *msg); +void *zmq_msg_data(zmq_msg_t *msg); +int zmq_msg_close(zmq_msg_t *msg); + +int zmq_msg_copy(zmq_msg_t *dst, zmq_msg_t *src); +int zmq_msg_send(zmq_msg_t *msg, void *socket, int flags); +int zmq_msg_recv(zmq_msg_t *msg, void *socket, int flags); +int zmq_recv(void *socket, void *buf, int nbytes, int flags); + +int zmq_getsockopt(void *socket, + int option_name, + void *option_value, + size_t *option_len); + +int zmq_setsockopt(void *socket, + int option_name, + const void *option_value, + size_t option_len); + +typedef int... ZMQ_FD_T; + +typedef struct +{ + void *socket; + ZMQ_FD_T fd; + short events; + short revents; +} zmq_pollitem_t; + +int zmq_poll(zmq_pollitem_t *items, int nitems, long timeout); + +// draft poller +void *zmq_poller_new (); +int zmq_poller_destroy (void **poller_p_); +int zmq_poller_add (void *poller_, void *socket_, void *user_data_, short events_); +int zmq_poller_fd (void *poller_, ZMQ_FD_T *fd_); + +// miscellany +void * memcpy(void *restrict s1, const void *restrict s2, size_t n); +void * malloc(size_t sz); +void free(void *p); +int get_ipc_path_max_len(void); + +typedef struct { ...; } mutex_t; + +typedef struct _zhint { + void *sock; + mutex_t *mutex; + size_t id; +} zhint; + +mutex_t* mutex_allocate(); + +int zmq_wrap_msg_init_data(zmq_msg_t *msg, + void *data, + size_t size, + void *hint); + +#define PYZMQ_DRAFT_API ... diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/backend/cffi/_cffi_src.c b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/backend/cffi/_cffi_src.c new file mode 100644 index 0000000000000000000000000000000000000000..691be3c782d3d8209dc67e12d241e749e08440cb --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/backend/cffi/_cffi_src.c @@ -0,0 +1,50 @@ +#include +#include + +#include "pyversion_compat.h" +#include "mutex.h" +#include "ipcmaxlen.h" +#include "zmq_compat.h" +#include + +typedef struct _zhint { + void *sock; + mutex_t *mutex; + size_t id; +} zhint; + +void free_python_msg(void *data, void *vhint) { + zmq_msg_t msg; + zhint *hint = (zhint *)vhint; + int rc; + if (hint != NULL) { + zmq_msg_init_size(&msg, sizeof(size_t)); + memcpy(zmq_msg_data(&msg), &hint->id, sizeof(size_t)); + rc = mutex_lock(hint->mutex); + if (rc != 0) { + fprintf(stderr, "pyzmq-gc mutex lock failed rc=%d\n", rc); + } + rc = zmq_msg_send(&msg, hint->sock, 0); + if (rc < 0) { + /* + * gc socket could have been closed, e.g. during process teardown. + * If so, ignore the failure because there's nothing to do. + */ + if (zmq_errno() != ENOTSOCK) { + fprintf(stderr, "pyzmq-gc send failed: %s\n", + zmq_strerror(zmq_errno())); + } + } + rc = mutex_unlock(hint->mutex); + if (rc != 0) { + fprintf(stderr, "pyzmq-gc mutex unlock failed rc=%d\n", rc); + } + zmq_msg_close(&msg); + free(hint); + } +} + +int zmq_wrap_msg_init_data(zmq_msg_t *msg, void *data, size_t size, + void *hint) { + return zmq_msg_init_data(msg, data, size, free_python_msg, hint); +} diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/backend/cffi/_poll.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/backend/cffi/_poll.py new file mode 100644 index 0000000000000000000000000000000000000000..63e2763b9c57b065b963df9b0a1f86cd9fe30af0 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/backend/cffi/_poll.py @@ -0,0 +1,92 @@ +"""zmq poll function""" + +# Copyright (C) PyZMQ Developers +# Distributed under the terms of the Modified BSD License. + +try: + from time import monotonic +except ImportError: + from time import clock as monotonic + +import warnings + +from zmq.error import InterruptedSystemCall, _check_rc + +from ._cffi import ffi +from ._cffi import lib as C + + +def _make_zmq_pollitem(socket, flags): + zmq_socket = socket._zmq_socket + zmq_pollitem = ffi.new('zmq_pollitem_t*') + zmq_pollitem.socket = zmq_socket + zmq_pollitem.fd = 0 + zmq_pollitem.events = flags + zmq_pollitem.revents = 0 + return zmq_pollitem[0] + + +def _make_zmq_pollitem_fromfd(socket_fd, flags): + zmq_pollitem = ffi.new('zmq_pollitem_t*') + zmq_pollitem.socket = ffi.NULL + zmq_pollitem.fd = socket_fd + zmq_pollitem.events = flags + zmq_pollitem.revents = 0 + return zmq_pollitem[0] + + +def zmq_poll(sockets, timeout): + cffi_pollitem_list = [] + low_level_to_socket_obj = {} + from zmq import Socket + + for item in sockets: + if isinstance(item[0], Socket): + low_level_to_socket_obj[item[0]._zmq_socket] = item + cffi_pollitem_list.append(_make_zmq_pollitem(item[0], item[1])) + else: + if not isinstance(item[0], int): + # not an FD, get it from fileno() + item = (item[0].fileno(), item[1]) + low_level_to_socket_obj[item[0]] = item + cffi_pollitem_list.append(_make_zmq_pollitem_fromfd(item[0], item[1])) + items = ffi.new('zmq_pollitem_t[]', cffi_pollitem_list) + list_length = ffi.cast('int', len(cffi_pollitem_list)) + while True: + c_timeout = ffi.cast('long', timeout) + start = monotonic() + rc = C.zmq_poll(items, list_length, c_timeout) + try: + _check_rc(rc) + except InterruptedSystemCall: + if timeout > 0: + ms_passed = int(1000 * (monotonic() - start)) + if ms_passed < 0: + # don't allow negative ms_passed, + # which can happen on old Python versions without time.monotonic. + warnings.warn( + f"Negative elapsed time for interrupted poll: {ms_passed}." + " Did the clock change?", + RuntimeWarning, + ) + ms_passed = 0 + timeout = max(0, timeout - ms_passed) + continue + else: + break + result = [] + for item in items: + if item.revents > 0: + if item.socket != ffi.NULL: + result.append( + ( + low_level_to_socket_obj[item.socket][0], + item.revents, + ) + ) + else: + result.append((item.fd, item.revents)) + return result + + +__all__ = ['zmq_poll'] diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/backend/cffi/context.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/backend/cffi/context.py new file mode 100644 index 0000000000000000000000000000000000000000..23a69ecf1d97c1353470ebec03601370b8a5eb73 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/backend/cffi/context.py @@ -0,0 +1,77 @@ +"""zmq Context class""" + +# Copyright (C) PyZMQ Developers +# Distributed under the terms of the Modified BSD License. + +from zmq.constants import EINVAL, IO_THREADS +from zmq.error import InterruptedSystemCall, ZMQError, _check_rc + +from ._cffi import ffi +from ._cffi import lib as C + + +class Context: + _zmq_ctx = None + _iothreads = None + _closed = True + _shadow = False + + def __init__(self, io_threads=1, shadow=None): + if shadow: + self._zmq_ctx = ffi.cast("void *", shadow) + self._shadow = True + else: + self._shadow = False + if not io_threads >= 0: + raise ZMQError(EINVAL) + + self._zmq_ctx = C.zmq_ctx_new() + if self._zmq_ctx == ffi.NULL: + raise ZMQError(C.zmq_errno()) + if not shadow: + C.zmq_ctx_set(self._zmq_ctx, IO_THREADS, io_threads) + self._closed = False + + @property + def underlying(self): + """The address of the underlying libzmq context""" + return int(ffi.cast('size_t', self._zmq_ctx)) + + @property + def closed(self): + return self._closed + + def set(self, option, value): + """set a context option + + see zmq_ctx_set + """ + rc = C.zmq_ctx_set(self._zmq_ctx, option, value) + _check_rc(rc) + + def get(self, option): + """get context option + + see zmq_ctx_get + """ + rc = C.zmq_ctx_get(self._zmq_ctx, option) + _check_rc(rc, error_without_errno=False) + return rc + + def term(self): + if self.closed: + return + + rc = C.zmq_ctx_destroy(self._zmq_ctx) + try: + _check_rc(rc) + except InterruptedSystemCall: + # ignore interrupted term + # see PEP 475 notes about close & EINTR for why + pass + + self._zmq_ctx = None + self._closed = True + + +__all__ = ['Context'] diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/backend/cffi/devices.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/backend/cffi/devices.py new file mode 100644 index 0000000000000000000000000000000000000000..a906be6e8709ce1e16ffedd231d2aff872978ba2 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/backend/cffi/devices.py @@ -0,0 +1,59 @@ +"""zmq device functions""" + +# Copyright (C) PyZMQ Developers +# Distributed under the terms of the Modified BSD License. + +from ._cffi import ffi +from ._cffi import lib as C +from .socket import Socket +from .utils import _retry_sys_call + + +def proxy(frontend, backend, capture=None): + if isinstance(capture, Socket): + capture = capture._zmq_socket + else: + capture = ffi.NULL + + _retry_sys_call(C.zmq_proxy, frontend._zmq_socket, backend._zmq_socket, capture) + + +def proxy_steerable(frontend, backend, capture=None, control=None): + """proxy_steerable(frontend, backend, capture, control) + + Start a zeromq proxy with control flow. + + .. versionadded:: libzmq-4.1 + .. versionadded:: 18.0 + + Parameters + ---------- + frontend : Socket + The Socket instance for the incoming traffic. + backend : Socket + The Socket instance for the outbound traffic. + capture : Socket (optional) + The Socket instance for capturing traffic. + control : Socket (optional) + The Socket instance for control flow. + """ + if isinstance(capture, Socket): + capture = capture._zmq_socket + else: + capture = ffi.NULL + + if isinstance(control, Socket): + control = control._zmq_socket + else: + control = ffi.NULL + + _retry_sys_call( + C.zmq_proxy_steerable, + frontend._zmq_socket, + backend._zmq_socket, + capture, + control, + ) + + +__all__ = ['proxy', 'proxy_steerable'] diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/backend/cffi/error.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/backend/cffi/error.py new file mode 100644 index 0000000000000000000000000000000000000000..5561394ddecc5a47c3767f6921cfa80df5f6a3c1 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/backend/cffi/error.py @@ -0,0 +1,16 @@ +"""zmq error functions""" + +# Copyright (C) PyZMQ Developers +# Distributed under the terms of the Modified BSD License. + +from ._cffi import ffi +from ._cffi import lib as C + + +def strerror(errno): + return ffi.string(C.zmq_strerror(errno)).decode() + + +zmq_errno = C.zmq_errno + +__all__ = ['strerror', 'zmq_errno'] diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/backend/cffi/message.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/backend/cffi/message.py new file mode 100644 index 0000000000000000000000000000000000000000..94bb8c96fc7c2a79cd0b20dda2abca5643599c4b --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/backend/cffi/message.py @@ -0,0 +1,225 @@ +"""Dummy Frame object""" + +# Copyright (C) PyZMQ Developers +# Distributed under the terms of the Modified BSD License. + +import errno +from threading import Event + +import zmq +import zmq.error +from zmq.constants import ETERM + +from ._cffi import ffi +from ._cffi import lib as C + +zmq_gc = None + +try: + from __pypy__.bufferable import bufferable as maybe_bufferable +except ImportError: + maybe_bufferable = object + + +def _content(obj): + """Return content of obj as bytes""" + if type(obj) is bytes: + return obj + if not isinstance(obj, memoryview): + obj = memoryview(obj) + return obj.tobytes() + + +def _check_rc(rc): + err = C.zmq_errno() + if rc == -1: + if err == errno.EINTR: + raise zmq.error.InterrruptedSystemCall(err) + elif err == errno.EAGAIN: + raise zmq.error.Again(errno) + elif err == ETERM: + raise zmq.error.ContextTerminated(err) + else: + raise zmq.error.ZMQError(err) + return 0 + + +class Frame(maybe_bufferable): + _data = None + tracker = None + closed = False + more = False + _buffer = None + _bytes = None + _failed_init = False + tracker_event = None + zmq_msg = None + + def __init__(self, data=None, track=False, copy=None, copy_threshold=None): + self._failed_init = True + + self.zmq_msg = ffi.cast('zmq_msg_t[1]', C.malloc(ffi.sizeof("zmq_msg_t"))) + + # self.tracker should start finished + # except in the case where we are sharing memory with libzmq + if track: + self.tracker = zmq._FINISHED_TRACKER + + if isinstance(data, str): + raise TypeError( + "Unicode strings are not allowed. Only: bytes, buffer interfaces." + ) + + if data is None: + rc = C.zmq_msg_init(self.zmq_msg) + _check_rc(rc) + self._failed_init = False + return + + self._data = data + if type(data) is bytes: + # avoid unnecessary copy on .bytes access + self._bytes = data + + self._buffer = memoryview(data) + if not self._buffer.contiguous: + raise BufferError("memoryview: underlying buffer is not contiguous") + # from_buffer silently copies if memory is not contiguous + c_data = ffi.from_buffer(self._buffer) + data_len_c = self._buffer.nbytes + + if copy is None: + if copy_threshold and data_len_c < copy_threshold: + copy = True + else: + copy = False + + if copy: + # copy message data instead of sharing memory + rc = C.zmq_msg_init_size(self.zmq_msg, data_len_c) + _check_rc(rc) + ffi.buffer(C.zmq_msg_data(self.zmq_msg), data_len_c)[:] = self._buffer + self._failed_init = False + return + + # Getting here means that we are doing a true zero-copy Frame, + # where libzmq and Python are sharing memory. + # Hook up garbage collection with MessageTracker and zmq_free_fn + + # Event and MessageTracker for monitoring when zmq is done with data: + if track: + evt = Event() + self.tracker_event = evt + self.tracker = zmq.MessageTracker(evt) + # create the hint for zmq_free_fn + # two pointers: the zmq_gc context and a message to be sent to the zmq_gc PULL socket + # allows libzmq to signal to Python when it is done with Python-owned memory. + global zmq_gc + if zmq_gc is None: + from zmq.utils.garbage import gc as zmq_gc + # can't use ffi.new because it will be freed at the wrong time! + hint = ffi.cast("zhint[1]", C.malloc(ffi.sizeof("zhint"))) + hint[0].id = zmq_gc.store(data, self.tracker_event) + if not zmq_gc._push_mutex: + zmq_gc._push_mutex = C.mutex_allocate() + + hint[0].mutex = ffi.cast("mutex_t*", zmq_gc._push_mutex) + hint[0].sock = ffi.cast("void*", zmq_gc._push_socket.underlying) + + # calls zmq_wrap_msg_init_data with the C.free_python_msg callback + rc = C.zmq_wrap_msg_init_data( + self.zmq_msg, + c_data, + data_len_c, + hint, + ) + if rc != 0: + C.free(hint) + C.free(self.zmq_msg) + _check_rc(rc) + self._failed_init = False + + def __del__(self): + if not self.closed and not self._failed_init: + self.close() + + def close(self): + if self.closed or self._failed_init or self.zmq_msg is None: + return + self.closed = True + rc = C.zmq_msg_close(self.zmq_msg) + C.free(self.zmq_msg) + self.zmq_msg = None + if rc != 0: + _check_rc(rc) + + def _buffer_from_zmq_msg(self): + """one-time extract buffer from zmq_msg + + for Frames created by recv + """ + if self._data is None: + self._data = ffi.buffer( + C.zmq_msg_data(self.zmq_msg), C.zmq_msg_size(self.zmq_msg) + ) + if self._buffer is None: + self._buffer = memoryview(self._data) + + @property + def buffer(self): + if self._buffer is None: + self._buffer_from_zmq_msg() + return self._buffer + + @property + def bytes(self): + if self._bytes is None: + self._bytes = self.buffer.tobytes() + return self._bytes + + def __len__(self): + return self.buffer.nbytes + + def __eq__(self, other): + return self.bytes == _content(other) + + @property + def done(self): + return self.tracker.done() + + def __buffer__(self, flags): + return self.buffer + + def __copy__(self): + """Create a shallow copy of the message. + + This does not copy the contents of the Frame, just the pointer. + This will increment the 0MQ ref count of the message, but not + the ref count of the Python object. That is only done once when + the Python is first turned into a 0MQ message. + """ + return self.fast_copy() + + def fast_copy(self): + """Fast shallow copy of the Frame. + + Does not copy underlying data. + """ + new_msg = Frame() + # This does not copy the contents, but just increases the ref-count + # of the zmq_msg by one. + C.zmq_msg_copy(new_msg.zmq_msg, self.zmq_msg) + # Copy the ref to underlying data + new_msg._data = self._data + new_msg._buffer = self._buffer + + # Frame copies share the tracker and tracker_event + new_msg.tracker_event = self.tracker_event + new_msg.tracker = self.tracker + + return new_msg + + +Message = Frame + +__all__ = ['Frame', 'Message'] diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/backend/cffi/socket.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/backend/cffi/socket.py new file mode 100644 index 0000000000000000000000000000000000000000..6a47dad909a62cd28044f88a1c8eb0c7062f7ea9 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/backend/cffi/socket.py @@ -0,0 +1,435 @@ +"""zmq Socket class""" + +# Copyright (C) PyZMQ Developers +# Distributed under the terms of the Modified BSD License. + +import errno as errno_mod +import warnings + +import zmq +from zmq.constants import SocketOption, _OptType +from zmq.error import ZMQError, _check_rc, _check_version + +from ._cffi import ffi +from ._cffi import lib as C +from .message import Frame +from .utils import _retry_sys_call + +nsp = new_sizet_pointer = lambda length: ffi.new('size_t*', length) + + +def new_uint64_pointer(): + return ffi.new('uint64_t*'), nsp(ffi.sizeof('uint64_t')) + + +def new_int64_pointer(): + return ffi.new('int64_t*'), nsp(ffi.sizeof('int64_t')) + + +def new_int_pointer(): + return ffi.new('int*'), nsp(ffi.sizeof('int')) + + +def new_binary_data(length): + return ffi.new(f'char[{length:d}]'), nsp(ffi.sizeof('char') * length) + + +def value_uint64_pointer(val): + return ffi.new('uint64_t*', val), ffi.sizeof('uint64_t') + + +def value_int64_pointer(val): + return ffi.new('int64_t*', val), ffi.sizeof('int64_t') + + +def value_int_pointer(val): + return ffi.new('int*', val), ffi.sizeof('int') + + +def value_binary_data(val, length): + return ffi.new(f'char[{length + 1:d}]', val), ffi.sizeof('char') * length + + +_fd_size = ffi.sizeof('ZMQ_FD_T') +ZMQ_FD_64BIT = _fd_size == 8 + +IPC_PATH_MAX_LEN = C.get_ipc_path_max_len() + + +def new_pointer_from_opt(option, length=0): + opt_type = getattr(option, "_opt_type", _OptType.int) + + if opt_type == _OptType.int64 or (ZMQ_FD_64BIT and opt_type == _OptType.fd): + return new_int64_pointer() + elif opt_type == _OptType.bytes: + return new_binary_data(length) + else: + # default + return new_int_pointer() + + +def value_from_opt_pointer(option, opt_pointer, length=0): + try: + option = SocketOption(option) + except ValueError: + # unrecognized option, + # assume from the future, + # let EINVAL raise + opt_type = _OptType.int + else: + opt_type = option._opt_type + + if opt_type == _OptType.bytes: + return ffi.buffer(opt_pointer, length)[:] + else: + return int(opt_pointer[0]) + + +def initialize_opt_pointer(option, value, length=0): + opt_type = getattr(option, "_opt_type", _OptType.int) + if opt_type == _OptType.int64 or (ZMQ_FD_64BIT and opt_type == _OptType.fd): + return value_int64_pointer(value) + elif opt_type == _OptType.bytes: + return value_binary_data(value, length) + else: + return value_int_pointer(value) + + +class Socket: + context = None + socket_type = None + _zmq_socket = None + _closed = None + _ref = None + _shadow = False + _draft_poller = None + _draft_poller_ptr = None + copy_threshold = 0 + + def __init__(self, context=None, socket_type=None, shadow=0, copy_threshold=None): + if copy_threshold is None: + copy_threshold = zmq.COPY_THRESHOLD + self.copy_threshold = copy_threshold + + self.context = context + self._draft_poller = self._draft_poller_ptr = None + if shadow: + self._zmq_socket = ffi.cast("void *", shadow) + self._shadow = True + else: + self._shadow = False + self._zmq_socket = C.zmq_socket(context._zmq_ctx, socket_type) + if self._zmq_socket == ffi.NULL: + raise ZMQError() + self._closed = False + + @property + def underlying(self): + """The address of the underlying libzmq socket""" + return int(ffi.cast('size_t', self._zmq_socket)) + + def _check_closed_deep(self): + """thorough check of whether the socket has been closed, + even if by another entity (e.g. ctx.destroy). + + Only used by the `closed` property. + + returns True if closed, False otherwise + """ + if self._closed: + return True + try: + self.get(zmq.TYPE) + except ZMQError as e: + if e.errno == zmq.ENOTSOCK: + self._closed = True + return True + elif e.errno == zmq.ETERM: + pass + else: + raise + return False + + @property + def closed(self): + return self._check_closed_deep() + + def close(self, linger=None): + rc = 0 + if not self._closed and hasattr(self, '_zmq_socket'): + if self._draft_poller_ptr is not None: + rc = C.zmq_poller_destroy(self._draft_poller_ptr) + self._draft_poller = self._draft_poller_ptr = None + + if self._zmq_socket is not None: + if linger is not None: + self.set(zmq.LINGER, linger) + rc = C.zmq_close(self._zmq_socket) + self._closed = True + if rc < 0: + _check_rc(rc) + + def bind(self, address): + if isinstance(address, str): + address_b = address.encode('utf8') + else: + address_b = address + if isinstance(address, bytes): + address = address_b.decode('utf8') + rc = C.zmq_bind(self._zmq_socket, address_b) + if rc < 0: + if IPC_PATH_MAX_LEN and C.zmq_errno() == errno_mod.ENAMETOOLONG: + path = address.split('://', 1)[-1] + msg = ( + f'ipc path "{path}" is longer than {IPC_PATH_MAX_LEN} ' + 'characters (sizeof(sockaddr_un.sun_path)).' + ) + raise ZMQError(C.zmq_errno(), msg=msg) + elif C.zmq_errno() == errno_mod.ENOENT: + path = address.split('://', 1)[-1] + msg = f'No such file or directory for ipc path "{path}".' + raise ZMQError(C.zmq_errno(), msg=msg) + else: + _check_rc(rc) + + def unbind(self, address): + if isinstance(address, str): + address = address.encode('utf8') + rc = C.zmq_unbind(self._zmq_socket, address) + _check_rc(rc) + + def connect(self, address): + if isinstance(address, str): + address = address.encode('utf8') + rc = C.zmq_connect(self._zmq_socket, address) + _check_rc(rc) + + def disconnect(self, address): + if isinstance(address, str): + address = address.encode('utf8') + rc = C.zmq_disconnect(self._zmq_socket, address) + _check_rc(rc) + + def set(self, option, value): + length = None + if isinstance(value, str): + raise TypeError("unicode not allowed, use bytes") + + try: + option = SocketOption(option) + except ValueError: + # unrecognized option, + # assume from the future, + # let EINVAL raise + opt_type = _OptType.int + else: + opt_type = option._opt_type + + if isinstance(value, bytes): + if opt_type != _OptType.bytes: + raise TypeError(f"not a bytes sockopt: {option}") + length = len(value) + + c_value_pointer, c_sizet = initialize_opt_pointer(option, value, length) + + _retry_sys_call( + C.zmq_setsockopt, + self._zmq_socket, + option, + ffi.cast('void*', c_value_pointer), + c_sizet, + ) + + def get(self, option): + try: + option = SocketOption(option) + except ValueError: + # unrecognized option, + # assume from the future, + # let EINVAL raise + opt_type = _OptType.int + else: + opt_type = option._opt_type + + if option == zmq.FD and self._draft_poller is not None: + c_value_pointer, _ = new_pointer_from_opt(option) + C.zmq_poller_fd(self._draft_poller, ffi.cast('void*', c_value_pointer)) + return int(c_value_pointer[0]) + + c_value_pointer, c_sizet_pointer = new_pointer_from_opt(option, length=255) + + try: + _retry_sys_call( + C.zmq_getsockopt, + self._zmq_socket, + option, + c_value_pointer, + c_sizet_pointer, + ) + except ZMQError as e: + if ( + option == SocketOption.FD + and e.errno == zmq.Errno.EINVAL + and self.get(SocketOption.THREAD_SAFE) + ): + _check_version((4, 3, 2), "draft socket FD support via zmq_poller_fd") + if not zmq.DRAFT_API: + raise RuntimeError("libzmq must be built with draft support") + warnings.warn(zmq.error.DraftFDWarning(), stacklevel=2) + + # create a poller and retrieve its fd + self._draft_poller_ptr = ffi.new("void*[1]") + self._draft_poller_ptr[0] = self._draft_poller = C.zmq_poller_new() + if self._draft_poller == ffi.NULL: + # failed (why?), raise original error + self._draft_poller_ptr = self._draft_poller = None + raise + # register self with poller + rc = C.zmq_poller_add( + self._draft_poller, + self._zmq_socket, + ffi.NULL, + zmq.POLLIN | zmq.POLLOUT, + ) + _check_rc(rc) + # use poller fd as proxy for ours + rc = C.zmq_poller_fd( + self._draft_poller, ffi.cast('void *', c_value_pointer) + ) + _check_rc(rc) + return int(c_value_pointer[0]) + else: + raise + + sz = c_sizet_pointer[0] + v = value_from_opt_pointer(option, c_value_pointer, sz) + if ( + option != zmq.SocketOption.ROUTING_ID + and opt_type == _OptType.bytes + and v.endswith(b'\0') + ): + v = v[:-1] + return v + + def _send_copy(self, buf, flags): + """Send a copy of a bufferable""" + zmq_msg = ffi.new('zmq_msg_t*') + if not isinstance(buf, bytes): + # cast any bufferable data to bytes via memoryview + buf = memoryview(buf).tobytes() + + c_message = ffi.new('char[]', buf) + rc = C.zmq_msg_init_size(zmq_msg, len(buf)) + _check_rc(rc) + C.memcpy(C.zmq_msg_data(zmq_msg), c_message, len(buf)) + _retry_sys_call(C.zmq_msg_send, zmq_msg, self._zmq_socket, flags) + rc2 = C.zmq_msg_close(zmq_msg) + _check_rc(rc2) + + def _send_frame(self, frame, flags): + """Send a Frame on this socket in a non-copy manner.""" + # Always copy the Frame so the original message isn't garbage collected. + # This doesn't do a real copy, just a reference. + frame_copy = frame.fast_copy() + zmq_msg = frame_copy.zmq_msg + _retry_sys_call(C.zmq_msg_send, zmq_msg, self._zmq_socket, flags) + tracker = frame_copy.tracker + frame_copy.close() + return tracker + + def send(self, data, flags=0, copy=False, track=False): + if isinstance(data, str): + raise TypeError("Message must be in bytes, not a unicode object") + + if copy and not isinstance(data, Frame): + return self._send_copy(data, flags) + else: + close_frame = False + if isinstance(data, Frame): + if track and not data.tracker: + raise ValueError('Not a tracked message') + frame = data + else: + if self.copy_threshold: + buf = memoryview(data) + # always copy messages smaller than copy_threshold + if buf.nbytes < self.copy_threshold: + self._send_copy(buf, flags) + return zmq._FINISHED_TRACKER + frame = Frame(data, track=track, copy_threshold=self.copy_threshold) + close_frame = True + + tracker = self._send_frame(frame, flags) + if close_frame: + frame.close() + return tracker + + def recv(self, flags=0, copy=True, track=False): + if copy: + zmq_msg = ffi.new('zmq_msg_t*') + C.zmq_msg_init(zmq_msg) + else: + frame = zmq.Frame(track=track) + zmq_msg = frame.zmq_msg + + try: + _retry_sys_call(C.zmq_msg_recv, zmq_msg, self._zmq_socket, flags) + except Exception: + if copy: + C.zmq_msg_close(zmq_msg) + raise + + if not copy: + return frame + + _buffer = ffi.buffer(C.zmq_msg_data(zmq_msg), C.zmq_msg_size(zmq_msg)) + _bytes = _buffer[:] + rc = C.zmq_msg_close(zmq_msg) + _check_rc(rc) + return _bytes + + def recv_into(self, buffer, /, *, nbytes: int = 0, flags: int = 0) -> int: + view = memoryview(buffer) + if not view.contiguous: + raise BufferError("Can only recv_into contiguous buffers") + if view.readonly: + raise BufferError("Cannot recv_into readonly buffer") + if nbytes < 0: + raise ValueError(f"{nbytes=} must be non-negative") + view_bytes = view.nbytes + if nbytes == 0: + nbytes = view_bytes + elif nbytes > view_bytes: + raise ValueError(f"{nbytes=} too big for memoryview of {view_bytes}B") + c_buf = ffi.from_buffer(view) + rc: int = _retry_sys_call(C.zmq_recv, self._zmq_socket, c_buf, nbytes, flags) + _check_rc(rc) + return rc + + def monitor(self, addr, events=-1): + """s.monitor(addr, flags) + + Start publishing socket events on inproc. + See libzmq docs for zmq_monitor for details. + + Note: requires libzmq >= 3.2 + + Parameters + ---------- + addr : str + The inproc url used for monitoring. Passing None as + the addr will cause an existing socket monitor to be + deregistered. + events : int [default: zmq.EVENT_ALL] + The zmq event bitmask for which events will be sent to the monitor. + """ + if events < 0: + events = zmq.EVENT_ALL + if addr is None: + addr = ffi.NULL + if isinstance(addr, str): + addr = addr.encode('utf8') + C.zmq_socket_monitor(self._zmq_socket, addr, events) + + +__all__ = ['Socket', 'IPC_PATH_MAX_LEN'] diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/backend/cffi/utils.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/backend/cffi/utils.py new file mode 100644 index 0000000000000000000000000000000000000000..8dcc1c50d5ffa605630fa60aa157ff6e8329cabb --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/backend/cffi/utils.py @@ -0,0 +1,80 @@ +"""miscellaneous zmq_utils wrapping""" + +# Copyright (C) PyZMQ Developers +# Distributed under the terms of the Modified BSD License. + +from zmq.error import InterruptedSystemCall, _check_rc, _check_version + +from ._cffi import ffi +from ._cffi import lib as C + + +def has(capability): + """Check for zmq capability by name (e.g. 'ipc', 'curve') + + .. versionadded:: libzmq-4.1 + .. versionadded:: 14.1 + """ + _check_version((4, 1), 'zmq.has') + if isinstance(capability, str): + capability = capability.encode('utf8') + return bool(C.zmq_has(capability)) + + +def curve_keypair(): + """generate a Z85 key pair for use with zmq.CURVE security + + Requires libzmq (≥ 4.0) to have been built with CURVE support. + + Returns + ------- + (public, secret) : two bytestrings + The public and private key pair as 40 byte z85-encoded bytestrings. + """ + public = ffi.new('char[64]') + private = ffi.new('char[64]') + rc = C.zmq_curve_keypair(public, private) + _check_rc(rc) + return ffi.buffer(public)[:40], ffi.buffer(private)[:40] + + +def curve_public(private): + """Compute the public key corresponding to a private key for use + with zmq.CURVE security + + Requires libzmq (≥ 4.2) to have been built with CURVE support. + + Parameters + ---------- + private + The private key as a 40 byte z85-encoded bytestring + Returns + ------- + bytestring + The public key as a 40 byte z85-encoded bytestring. + """ + if isinstance(private, str): + private = private.encode('utf8') + _check_version((4, 2), "curve_public") + public = ffi.new('char[64]') + rc = C.zmq_curve_public(public, private) + _check_rc(rc) + return ffi.buffer(public)[:40] + + +def _retry_sys_call(f, *args, **kwargs): + """make a call, retrying if interrupted with EINTR""" + while True: + rc = f(*args) + try: + _check_rc(rc) + except InterruptedSystemCall: + continue + else: + break + return rc + + +PYZMQ_DRAFT_API: bool = bool(C.PYZMQ_DRAFT_API) + +__all__ = ['has', 'curve_keypair', 'curve_public', 'PYZMQ_DRAFT_API'] diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/backend/cython/__init__.pxd b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/backend/cython/__init__.pxd new file mode 100644 index 0000000000000000000000000000000000000000..94c7f8a3fb3b246dec15c64768147889f6593579 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/backend/cython/__init__.pxd @@ -0,0 +1 @@ +from zmq.backend.cython._zmq cimport Context, Frame, Socket diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/backend/cython/__init__.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/backend/cython/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..6c4179a80a3165e15a6f01b602d0281e64254e06 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/backend/cython/__init__.py @@ -0,0 +1,15 @@ +"""Python bindings for core 0MQ objects.""" + +# Copyright (C) PyZMQ Developers +# Distributed under the terms of the Modified BSD License. + +from . import _zmq + +# mq not in __all__ +from ._zmq import * # noqa +from ._zmq import monitored_queue # noqa + +Message = _zmq.Frame + +__all__ = ["Message"] +__all__.extend(_zmq.__all__) diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/backend/cython/_externs.pxd b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/backend/cython/_externs.pxd new file mode 100644 index 0000000000000000000000000000000000000000..dfe0744ddf1da8f8e25bd948d5bcc9517197fbde --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/backend/cython/_externs.pxd @@ -0,0 +1,13 @@ +cdef extern from "mutex.h" nogil: + ctypedef struct mutex_t: + pass + cdef mutex_t* mutex_allocate() + cdef void mutex_dallocate(mutex_t*) + cdef int mutex_lock(mutex_t*) + cdef int mutex_unlock(mutex_t*) + +cdef extern from "getpid_compat.h": + cdef int getpid() + +cdef extern from "ipcmaxlen.h": + cdef int get_ipc_path_max_len() diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/backend/cython/_zmq.pxd b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/backend/cython/_zmq.pxd new file mode 100644 index 0000000000000000000000000000000000000000..a7e4f244294c6d954fb8989bb161dd25dcb36a6f --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/backend/cython/_zmq.pxd @@ -0,0 +1,52 @@ +# cython: language_level = 3str +"""zmq Cython backend augmented declarations""" + +# Copyright (C) PyZMQ Developers +# Distributed under the terms of the Modified BSD License. + +from zmq.backend.cython.libzmq cimport zmq_msg_t + +cdef class Context: + + cdef object __weakref__ # enable weakref + cdef void *handle # The C handle for the underlying zmq object. + cdef bint _shadow # whether the Context is a shadow wrapper of another + cdef int _pid # the pid of the process which created me (for fork safety) + + cdef public bint closed # bool property for a closed context. + cdef inline int _term(self) + +cdef class MessageTracker(object): + cdef set events # Message Event objects to track. + cdef set peers # Other Message or MessageTracker objects. + +cdef class Frame: + + cdef zmq_msg_t zmq_msg + cdef object _data # The actual message data as a Python object. + cdef object _buffer # A Python memoryview of the message contents + cdef object _bytes # A bytes copy of the message. + cdef bint _failed_init # flag to hold failed init + cdef public object tracker_event # Event for use with zmq_free_fn. + cdef public object tracker # MessageTracker object. + cdef public bint more # whether RCVMORE was set + + cdef Frame fast_copy(self) # Create shallow copy of Message object. + +cdef class Socket: + + cdef object __weakref__ # enable weakref + cdef void *handle # The C handle for the underlying zmq object. + cdef bint _shadow # whether the Socket is a shadow wrapper of another + # Hold on to a reference to the context to make sure it is not garbage + # collected until the socket it done with it. + cdef public Context context # The zmq Context object that owns this. + cdef public bint _closed # bool property for a closed socket. + cdef public int copy_threshold # threshold below which pyzmq will always copy messages + cdef int _pid # the pid of the process which created me (for fork safety) + cdef void *_draft_poller # The C handle for the zmq poller for draft socket zmq.FD support + + # cpdef methods for direct-cython access: + cpdef object send(self, data, int flags=*, bint copy=*, bint track=*) + cpdef object recv(self, int flags=*, bint copy=*, bint track=*) + cpdef int recv_into(self, buffer, int nbytes=*, int flags=*) diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/backend/cython/_zmq.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/backend/cython/_zmq.py new file mode 100644 index 0000000000000000000000000000000000000000..c6f53a54047f761b81e05b82e94a48d1275cdf2d --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/backend/cython/_zmq.py @@ -0,0 +1,2048 @@ +# cython: language_level = 3str +# cython: freethreading_compatible = True +"""Cython backend for pyzmq""" + +# Copyright (C) PyZMQ Developers +# Distributed under the terms of the Modified BSD License. + +from __future__ import annotations + +try: + import cython + + if not cython.compiled: + raise ImportError() +except ImportError: + from pathlib import Path + + zmq_root = Path(__file__).parents[3] + msg = f""" + Attempting to import zmq Cython backend, which has not been compiled. + + This probably means you are importing zmq from its source tree. + if this is what you want, make sure to do an in-place build first: + + pip install -e '{zmq_root}' + + If it is not, then '{zmq_root}' is probably on your sys.path, + when it shouldn't be. Is that your current working directory? + + If neither of those is true and this file is actually installed, + something seems to have gone wrong with the install! + Please report at https://github.com/zeromq/pyzmq/issues + """ + raise ImportError(msg) + +import warnings +from threading import Event +from time import monotonic +from weakref import ref + +import cython as C +from cython import ( + NULL, + Py_ssize_t, + address, + bint, + cast, + cclass, + cfunc, + char, + declare, + inline, + nogil, + p_char, + p_void, + pointer, + size_t, + sizeof, +) +from cython.cimports.cpython.buffer import ( + Py_buffer, + PyBUF_ANY_CONTIGUOUS, + PyBUF_WRITABLE, + PyBuffer_Release, + PyObject_GetBuffer, +) +from cython.cimports.cpython.bytes import ( + PyBytes_AsString, + PyBytes_FromStringAndSize, + PyBytes_Size, +) +from cython.cimports.cpython.exc import PyErr_CheckSignals +from cython.cimports.libc.errno import EAGAIN, EINTR, ENAMETOOLONG, ENOENT, ENOTSOCK +from cython.cimports.libc.stdint import uint32_t +from cython.cimports.libc.stdio import fprintf +from cython.cimports.libc.stdio import stderr as cstderr +from cython.cimports.libc.stdlib import free, malloc +from cython.cimports.libc.string import memcpy +from cython.cimports.zmq.backend.cython import libzmq +from cython.cimports.zmq.backend.cython._externs import ( + get_ipc_path_max_len, + getpid, + mutex_allocate, + mutex_lock, + mutex_t, + mutex_unlock, +) +from cython.cimports.zmq.backend.cython.libzmq import ( + ZMQ_ENOTSOCK, + ZMQ_ETERM, + ZMQ_EVENT_ALL, + ZMQ_FD, + ZMQ_IDENTITY, + ZMQ_IO_THREADS, + ZMQ_LINGER, + ZMQ_POLLIN, + ZMQ_POLLOUT, + ZMQ_RCVMORE, + ZMQ_ROUTER, + ZMQ_SNDMORE, + ZMQ_THREAD_SAFE, + ZMQ_TYPE, + _zmq_version, + fd_t, + int64_t, + zmq_bind, + zmq_close, + zmq_connect, + zmq_ctx_destroy, + zmq_ctx_get, + zmq_ctx_new, + zmq_ctx_set, + zmq_curve_keypair, + zmq_curve_public, + zmq_disconnect, + zmq_free_fn, + zmq_getsockopt, + zmq_has, + zmq_join, + zmq_leave, + zmq_msg_close, + zmq_msg_copy, + zmq_msg_data, + zmq_msg_get, + zmq_msg_gets, + zmq_msg_group, + zmq_msg_init, + zmq_msg_init_data, + zmq_msg_init_size, + zmq_msg_recv, + zmq_msg_routing_id, + zmq_msg_send, + zmq_msg_set, + zmq_msg_set_group, + zmq_msg_set_routing_id, + zmq_msg_size, + zmq_msg_t, + zmq_poller_add, + zmq_poller_destroy, + zmq_poller_fd, + zmq_poller_new, + zmq_pollitem_t, + zmq_proxy, + zmq_proxy_steerable, + zmq_recv, + zmq_setsockopt, + zmq_socket, + zmq_socket_monitor, + zmq_strerror, + zmq_unbind, +) +from cython.cimports.zmq.backend.cython.libzmq import zmq_errno as _zmq_errno +from cython.cimports.zmq.backend.cython.libzmq import zmq_poll as zmq_poll_c + +import zmq +from zmq.constants import SocketOption, _OptType +from zmq.error import ( + Again, + ContextTerminated, + InterruptedSystemCall, + ZMQError, + _check_version, +) + +IPC_PATH_MAX_LEN: int = get_ipc_path_max_len() + +PYZMQ_DRAFT_API: bool = bool(libzmq.PYZMQ_DRAFT_API) + + +@cfunc +@inline +@C.exceptval(-1) +def _check_rc(rc: C.int, error_without_errno: bint = False) -> C.int: + """internal utility for checking zmq return condition + + and raising the appropriate Exception class + """ + errno: C.int = _zmq_errno() + PyErr_CheckSignals() + if errno == 0 and not error_without_errno: + return 0 + if rc == -1: # if rc < -1, it's a bug in libzmq. Should we warn? + if errno == EINTR: + raise InterruptedSystemCall(errno) + elif errno == EAGAIN: + raise Again(errno) + elif errno == ZMQ_ETERM: + raise ContextTerminated(errno) + else: + raise ZMQError(errno) + return 0 + + +# message Frame class + +_zhint = C.struct( + sock=p_void, + mutex=pointer(mutex_t), + id=size_t, +) + + +@cfunc +@nogil +def free_python_msg(data: p_void, vhint: p_void) -> C.int: + """A pure-C function for DECREF'ing Python-owned message data. + + Sends a message on a PUSH socket + + The hint is a `zhint` struct with two values: + + sock (void *): pointer to the Garbage Collector's PUSH socket + id (size_t): the id to be used to construct a zmq_msg_t that should be sent on a PUSH socket, + signaling the Garbage Collector to remove its reference to the object. + + When the Garbage Collector's PULL socket receives the message, + it deletes its reference to the object, + allowing Python to free the memory. + """ + msg = declare(zmq_msg_t) + msg_ptr: pointer(zmq_msg_t) = address(msg) + hint: pointer(_zhint) = cast(pointer(_zhint), vhint) + rc: C.int + + if hint != NULL: + zmq_msg_init_size(msg_ptr, sizeof(size_t)) + memcpy(zmq_msg_data(msg_ptr), address(hint.id), sizeof(size_t)) + rc = mutex_lock(hint.mutex) + if rc != 0: + fprintf(cstderr, "pyzmq-gc mutex lock failed rc=%d\n", rc) + rc = zmq_msg_send(msg_ptr, hint.sock, 0) + if rc < 0: + # gc socket could have been closed, e.g. during process teardown. + # If so, ignore the failure because there's nothing to do. + if _zmq_errno() != ZMQ_ENOTSOCK: + fprintf( + cstderr, "pyzmq-gc send failed: %s\n", zmq_strerror(_zmq_errno()) + ) + rc = mutex_unlock(hint.mutex) + if rc != 0: + fprintf(cstderr, "pyzmq-gc mutex unlock failed rc=%d\n", rc) + + zmq_msg_close(msg_ptr) + free(hint) + return 0 + + +@cfunc +@inline +def _copy_zmq_msg_bytes(zmq_msg: pointer(zmq_msg_t)) -> bytes: + """Copy the data from a zmq_msg_t""" + data_c: p_char = NULL + data_len_c: Py_ssize_t + data_c = cast(p_char, zmq_msg_data(zmq_msg)) + data_len_c = zmq_msg_size(zmq_msg) + return PyBytes_FromStringAndSize(data_c, data_len_c) + + +@cfunc +@inline +def _asbuffer(obj, data_c: pointer(p_void), writable: bint = False) -> size_t: + """Get a C buffer from a memoryview""" + pybuf = declare(Py_buffer) + flags: C.int = PyBUF_ANY_CONTIGUOUS + if writable: + flags |= PyBUF_WRITABLE + rc: C.int = PyObject_GetBuffer(obj, address(pybuf), flags) + if rc < 0: + raise ValueError("Couldn't create buffer") + data_c[0] = pybuf.buf + data_size: size_t = pybuf.len + PyBuffer_Release(address(pybuf)) + return data_size + + +_gc = None + + +@cclass +class Frame: + def __init__( + self, data=None, track=False, copy=None, copy_threshold=None, **kwargs + ): + rc: C.int + data_c: p_char = NULL + data_len_c: Py_ssize_t = 0 + hint: pointer(_zhint) + if copy_threshold is None: + copy_threshold = zmq.COPY_THRESHOLD + + c_copy_threshold: C.size_t = 0 + if copy_threshold is not None: + c_copy_threshold = copy_threshold + + zmq_msg_ptr: pointer(zmq_msg_t) = address(self.zmq_msg) + # init more as False + self.more = False + + # Save the data object in case the user wants the the data as a str. + self._data = data + self._failed_init = True # bool switch for dealloc + self._buffer = None # buffer view of data + self._bytes = None # bytes copy of data + + self.tracker_event = None + self.tracker = None + # self.tracker should start finished + # except in the case where we are sharing memory with libzmq + if track: + self.tracker = zmq._FINISHED_TRACKER + + if isinstance(data, str): + raise TypeError("Str objects not allowed. Only: bytes, buffer interfaces.") + + if data is None: + rc = zmq_msg_init(zmq_msg_ptr) + _check_rc(rc) + self._failed_init = False + return + + data_len_c = _asbuffer(data, cast(pointer(p_void), address(data_c))) + + # copy unspecified, apply copy_threshold + c_copy: bint = True + if copy is None: + if c_copy_threshold and data_len_c < c_copy_threshold: + c_copy = True + else: + c_copy = False + else: + c_copy = copy + + if c_copy: + # copy message data instead of sharing memory + rc = zmq_msg_init_size(zmq_msg_ptr, data_len_c) + _check_rc(rc) + memcpy(zmq_msg_data(zmq_msg_ptr), data_c, data_len_c) + self._failed_init = False + return + + # Getting here means that we are doing a true zero-copy Frame, + # where libzmq and Python are sharing memory. + # Hook up garbage collection with MessageTracker and zmq_free_fn + + # Event and MessageTracker for monitoring when zmq is done with data: + if track: + evt = Event() + self.tracker_event = evt + self.tracker = zmq.MessageTracker(evt) + # create the hint for zmq_free_fn + # two pointers: the gc context and a message to be sent to the gc PULL socket + # allows libzmq to signal to Python when it is done with Python-owned memory. + global _gc + if _gc is None: + from zmq.utils.garbage import gc as _gc + + hint: pointer(_zhint) = cast(pointer(_zhint), malloc(sizeof(_zhint))) + hint.id = _gc.store(data, self.tracker_event) + if not _gc._push_mutex: + hint.mutex = mutex_allocate() + _gc._push_mutex = cast(size_t, hint.mutex) + else: + hint.mutex = cast(pointer(mutex_t), cast(size_t, _gc._push_mutex)) + hint.sock = cast(p_void, cast(size_t, _gc._push_socket.underlying)) + + rc = zmq_msg_init_data( + zmq_msg_ptr, + cast(p_void, data_c), + data_len_c, + cast(pointer(zmq_free_fn), free_python_msg), + cast(p_void, hint), + ) + if rc != 0: + free(hint) + _check_rc(rc) + self._failed_init = False + + def __dealloc__(self): + if self._failed_init: + return + # decrease the 0MQ ref-count of zmq_msg + with nogil: + rc: C.int = zmq_msg_close(address(self.zmq_msg)) + _check_rc(rc) + + def __copy__(self): + return self.fast_copy() + + def fast_copy(self) -> Frame: + new_msg: Frame = Frame() + # This does not copy the contents, but just increases the ref-count + # of the zmq_msg by one. + zmq_msg_copy(address(new_msg.zmq_msg), address(self.zmq_msg)) + # Copy the ref to data so the copy won't create a copy when str is + # called. + if self._data is not None: + new_msg._data = self._data + if self._buffer is not None: + new_msg._buffer = self._buffer + if self._bytes is not None: + new_msg._bytes = self._bytes + + # Frame copies share the tracker and tracker_event + new_msg.tracker_event = self.tracker_event + new_msg.tracker = self.tracker + + return new_msg + + # buffer interface code adapted from petsc4py by Lisandro Dalcin, a BSD project + + def __getbuffer__(self, buffer: pointer(Py_buffer), flags: C.int): # noqa: F821 + # new-style (memoryview) buffer interface + buffer.buf = zmq_msg_data(address(self.zmq_msg)) + buffer.len = zmq_msg_size(address(self.zmq_msg)) + + buffer.obj = self + buffer.readonly = 0 + buffer.format = "B" + buffer.ndim = 1 + buffer.shape = address(buffer.len) + buffer.strides = NULL + buffer.suboffsets = NULL + buffer.itemsize = 1 + buffer.internal = NULL + + def __len__(self) -> size_t: + """Return the length of the message in bytes.""" + sz: size_t = zmq_msg_size(address(self.zmq_msg)) + return sz + + @property + def buffer(self): + """A memoryview of the message contents.""" + _buffer = self._buffer and self._buffer() + if _buffer is not None: + return _buffer + _buffer = memoryview(self) + self._buffer = ref(_buffer) + return _buffer + + @property + def bytes(self): + """The message content as a Python bytes object. + + The first time this property is accessed, a copy of the message + contents is made. From then on that same copy of the message is + returned. + """ + if self._bytes is None: + self._bytes = _copy_zmq_msg_bytes(address(self.zmq_msg)) + return self._bytes + + def get(self, option): + """ + Get a Frame option or property. + + See the 0MQ API documentation for zmq_msg_get and zmq_msg_gets + for details on specific options. + + .. versionadded:: libzmq-3.2 + .. versionadded:: 13.0 + + .. versionchanged:: 14.3 + add support for zmq_msg_gets (requires libzmq-4.1) + All message properties are strings. + + .. versionchanged:: 17.0 + Added support for `routing_id` and `group`. + Only available if draft API is enabled + with libzmq >= 4.2. + """ + rc: C.int = 0 + property_c: p_char = NULL + + # zmq_msg_get + if isinstance(option, int): + rc = zmq_msg_get(address(self.zmq_msg), option) + _check_rc(rc) + return rc + + if option == 'routing_id': + routing_id: uint32_t = zmq_msg_routing_id(address(self.zmq_msg)) + if routing_id == 0: + _check_rc(-1) + return routing_id + elif option == 'group': + buf = zmq_msg_group(address(self.zmq_msg)) + if buf == NULL: + _check_rc(-1) + return buf.decode('utf8') + + # zmq_msg_gets + _check_version((4, 1), "get string properties") + if isinstance(option, str): + option = option.encode('utf8') + + if not isinstance(option, bytes): + raise TypeError(f"expected str, got: {option!r}") + + property_c = option + + result: p_char = cast(p_char, zmq_msg_gets(address(self.zmq_msg), property_c)) + if result == NULL: + _check_rc(-1) + return result.decode('utf8') + + def set(self, option, value): + """Set a Frame option. + + See the 0MQ API documentation for zmq_msg_set + for details on specific options. + + .. versionadded:: libzmq-3.2 + .. versionadded:: 13.0 + .. versionchanged:: 17.0 + Added support for `routing_id` and `group`. + Only available if draft API is enabled + with libzmq >= 4.2. + """ + rc: C.int + + if option == 'routing_id': + routing_id: uint32_t = value + rc = zmq_msg_set_routing_id(address(self.zmq_msg), routing_id) + _check_rc(rc) + return + elif option == 'group': + if isinstance(value, str): + value = value.encode('utf8') + rc = zmq_msg_set_group(address(self.zmq_msg), value) + _check_rc(rc) + return + + rc = zmq_msg_set(address(self.zmq_msg), option, value) + _check_rc(rc) + + +@cclass +class Context: + """ + Manage the lifecycle of a 0MQ context. + + Parameters + ---------- + io_threads : int + The number of IO threads. + """ + + def __init__(self, io_threads: C.int = 1, shadow: size_t = 0): + self.handle = NULL + self._pid = 0 + self._shadow = False + + if shadow: + self.handle = cast(p_void, shadow) + self._shadow = True + else: + self._shadow = False + self.handle = zmq_ctx_new() + + if self.handle == NULL: + raise ZMQError() + + rc: C.int = 0 + if not self._shadow: + rc = zmq_ctx_set(self.handle, ZMQ_IO_THREADS, io_threads) + _check_rc(rc) + + self.closed = False + self._pid = getpid() + + @property + def underlying(self): + """The address of the underlying libzmq context""" + return cast(size_t, self.handle) + + @cfunc + @inline + def _term(self) -> C.int: + rc: C.int = 0 + if self.handle != NULL and not self.closed and getpid() == self._pid: + with nogil: + rc = zmq_ctx_destroy(self.handle) + self.handle = NULL + return rc + + def term(self): + """ + Close or terminate the context. + + This can be called to close the context by hand. If this is not called, + the context will automatically be closed when it is garbage collected. + """ + rc: C.int = self._term() + try: + _check_rc(rc) + except InterruptedSystemCall: + # ignore interrupted term + # see PEP 475 notes about close & EINTR for why + pass + + self.closed = True + + def set(self, option: C.int, optval): + """ + Set a context option. + + See the 0MQ API documentation for zmq_ctx_set + for details on specific options. + + .. versionadded:: libzmq-3.2 + .. versionadded:: 13.0 + + Parameters + ---------- + option : int + The option to set. Available values will depend on your + version of libzmq. Examples include:: + + zmq.IO_THREADS, zmq.MAX_SOCKETS + + optval : int + The value of the option to set. + """ + optval_int_c: C.int + rc: C.int + + if self.closed: + raise RuntimeError("Context has been destroyed") + + if not isinstance(optval, int): + raise TypeError(f'expected int, got: {optval!r}') + optval_int_c = optval + rc = zmq_ctx_set(self.handle, option, optval_int_c) + _check_rc(rc) + + def get(self, option: C.int): + """ + Get the value of a context option. + + See the 0MQ API documentation for zmq_ctx_get + for details on specific options. + + .. versionadded:: libzmq-3.2 + .. versionadded:: 13.0 + + Parameters + ---------- + option : int + The option to get. Available values will depend on your + version of libzmq. Examples include:: + + zmq.IO_THREADS, zmq.MAX_SOCKETS + + Returns + ------- + optval : int + The value of the option as an integer. + """ + rc: C.int + + if self.closed: + raise RuntimeError("Context has been destroyed") + + rc = zmq_ctx_get(self.handle, option) + _check_rc(rc, error_without_errno=False) + return rc + + +@cfunc +@inline +def _c_addr(addr) -> bytes: + """cast an address input to bytes + + Expects a str, but accepts bytes + and raises informative TypeError otherwise. + """ + if isinstance(addr, str): + addr = addr.encode("utf-8") + try: + c_addr: bytes = addr + except TypeError: + raise TypeError(f"Expected addr to be str, got addr={addr!r}") + return c_addr + + +@cclass +class Socket: + """ + A 0MQ socket. + + These objects will generally be constructed via the socket() method of a Context object. + + Note: 0MQ Sockets are *not* threadsafe. **DO NOT** share them across threads. + + Parameters + ---------- + context : Context + The 0MQ Context this Socket belongs to. + socket_type : int + The socket type, which can be any of the 0MQ socket types: + REQ, REP, PUB, SUB, PAIR, DEALER, ROUTER, PULL, PUSH, XPUB, XSUB. + + See Also + -------- + .Context.socket : method for creating a socket bound to a Context. + """ + + def __init__( + self, + context=None, + socket_type: C.int = -1, + shadow: size_t = 0, + copy_threshold=None, + ): + # pre-init + self.handle = NULL + self._draft_poller = NULL + self._pid = 0 + self._shadow = False + self.context = None + + if copy_threshold is None: + copy_threshold = zmq.COPY_THRESHOLD + self.copy_threshold = copy_threshold + + self.handle = NULL + self.context = context + if shadow: + self._shadow = True + self.handle = cast(p_void, shadow) + else: + if context is None: + raise TypeError("context must be specified") + if socket_type < 0: + raise TypeError("socket_type must be specified") + self._shadow = False + self.handle = zmq_socket(self.context.handle, socket_type) + if self.handle == NULL: + raise ZMQError() + self._closed = False + self._pid = getpid() + + @property + def underlying(self): + """The address of the underlying libzmq socket""" + return cast(size_t, self.handle) + + @property + def closed(self): + """Whether the socket is closed""" + return _check_closed_deep(self) + + def close(self, linger: int | None = None): + """ + Close the socket. + + If linger is specified, LINGER sockopt will be set prior to closing. + + This can be called to close the socket by hand. If this is not + called, the socket will automatically be closed when it is + garbage collected. + """ + rc: C.int = 0 + linger_c: C.int + setlinger: bint = False + + if linger is not None: + linger_c = linger + setlinger = True + + if self.handle != NULL and not self._closed and getpid() == self._pid: + if setlinger: + zmq_setsockopt(self.handle, ZMQ_LINGER, address(linger_c), sizeof(int)) + + # teardown draft poller + if self._draft_poller != NULL: + zmq_poller_destroy(address(self._draft_poller)) + self._draft_poller = NULL + + rc = zmq_close(self.handle) + if rc < 0 and _zmq_errno() != ENOTSOCK: + # ignore ENOTSOCK (closed by Context) + _check_rc(rc) + self._closed = True + self.handle = NULL + + def set(self, option: C.int, optval): + """ + Set socket options. + + See the 0MQ API documentation for details on specific options. + + Parameters + ---------- + option : int + The option to set. Available values will depend on your + version of libzmq. Examples include:: + + zmq.SUBSCRIBE, UNSUBSCRIBE, IDENTITY, HWM, LINGER, FD + + optval : int or bytes + The value of the option to set. + + Notes + ----- + .. warning:: + + All options other than zmq.SUBSCRIBE, zmq.UNSUBSCRIBE and + zmq.LINGER only take effect for subsequent socket bind/connects. + """ + optval_int64_c: int64_t + optval_int_c: C.int + optval_c: p_char + sz: Py_ssize_t + + _check_closed(self) + if isinstance(optval, str): + raise TypeError("unicode not allowed, use setsockopt_string") + + try: + sopt = SocketOption(option) + except ValueError: + # unrecognized option, + # assume from the future, + # let EINVAL raise + opt_type = _OptType.int + else: + opt_type = sopt._opt_type + + if opt_type == _OptType.bytes: + if not isinstance(optval, bytes): + raise TypeError(f'expected bytes, got: {optval!r}') + optval_c = PyBytes_AsString(optval) + sz = PyBytes_Size(optval) + _setsockopt(self.handle, option, optval_c, sz) + elif opt_type == _OptType.int64: + if not isinstance(optval, int): + raise TypeError(f'expected int, got: {optval!r}') + optval_int64_c = optval + _setsockopt(self.handle, option, address(optval_int64_c), sizeof(int64_t)) + else: + # default is to assume int, which is what most new sockopts will be + # this lets pyzmq work with newer libzmq which may add constants + # pyzmq has not yet added, rather than artificially raising. Invalid + # sockopts will still raise just the same, but it will be libzmq doing + # the raising. + if not isinstance(optval, int): + raise TypeError(f'expected int, got: {optval!r}') + optval_int_c = optval + _setsockopt(self.handle, option, address(optval_int_c), sizeof(int)) + + def get(self, option: C.int): + """ + Get the value of a socket option. + + See the 0MQ API documentation for details on specific options. + + .. versionchanged:: 27 + Added experimental support for ZMQ_FD for draft sockets via `zmq_poller_fd`. + Requires libzmq >=4.3.2 built with draft support. + + Parameters + ---------- + option : int + The option to get. Available values will depend on your + version of libzmq. Examples include:: + + zmq.IDENTITY, HWM, LINGER, FD, EVENTS + + Returns + ------- + optval : int or bytes + The value of the option as a bytestring or int. + """ + optval_int64_c = declare(int64_t) + optval_int_c = declare(C.int) + optval_fd_c = declare(fd_t) + identity_str_c = declare(char[255]) + sz: size_t + + _check_closed(self) + + try: + sopt = SocketOption(option) + except ValueError: + # unrecognized option, + # assume from the future, + # let EINVAL raise + opt_type = _OptType.int + else: + opt_type = sopt._opt_type + + if opt_type == _OptType.bytes: + sz = 255 + _getsockopt(self.handle, option, cast(p_void, identity_str_c), address(sz)) + # strip null-terminated strings *except* identity + if ( + option != ZMQ_IDENTITY + and sz > 0 + and (cast(p_char, identity_str_c))[sz - 1] == b'\0' + ): + sz -= 1 + result = PyBytes_FromStringAndSize(cast(p_char, identity_str_c), sz) + elif opt_type == _OptType.int64: + sz = sizeof(int64_t) + _getsockopt( + self.handle, option, cast(p_void, address(optval_int64_c)), address(sz) + ) + result = optval_int64_c + elif option == ZMQ_FD and self._draft_poller != NULL: + # draft sockets use FD of a draft zmq_poller as proxy + rc = zmq_poller_fd(self._draft_poller, address(optval_fd_c)) + _check_rc(rc) + result = optval_fd_c + elif opt_type == _OptType.fd: + sz = sizeof(fd_t) + try: + _getsockopt( + self.handle, option, cast(p_void, address(optval_fd_c)), address(sz) + ) + except ZMQError as e: + # threadsafe sockets don't support ZMQ_FD (yet!) + # fallback on zmq_poller_fd as proxy with the same behavior + # until libzmq fixes this. + # if upstream fixes it, this branch will never be taken + if ( + option == ZMQ_FD + and e.errno == zmq.Errno.EINVAL + and self.get(ZMQ_THREAD_SAFE) + ): + _check_version( + (4, 3, 2), "draft socket FD support via zmq_poller_fd" + ) + if not zmq.DRAFT_API: + raise RuntimeError( + "libzmq and pyzmq must be built with draft support" + ) + warnings.warn(zmq.error.DraftFDWarning(), stacklevel=2) + + # create a poller and retrieve its fd + self._draft_poller = zmq_poller_new() + if self._draft_poller == NULL: + # failed (why?), raise original error + raise + # register self with poller + rc = zmq_poller_add( + self._draft_poller, self.handle, NULL, ZMQ_POLLIN | ZMQ_POLLOUT + ) + _check_rc(rc) + # use poller fd as proxy for ours + rc = zmq_poller_fd(self._draft_poller, address(optval_fd_c)) + _check_rc(rc) + else: + raise + result = optval_fd_c + else: + # default is to assume int, which is what most new sockopts will be + # this lets pyzmq work with newer libzmq which may add constants + # pyzmq has not yet added, rather than artificially raising. Invalid + # sockopts will still raise just the same, but it will be libzmq doing + # the raising. + sz = sizeof(int) + _getsockopt( + self.handle, option, cast(p_void, address(optval_int_c)), address(sz) + ) + result = optval_int_c + + return result + + def bind(self, addr: str | bytes): + """ + Bind the socket to an address. + + This causes the socket to listen on a network port. Sockets on the + other side of this connection will use ``Socket.connect(addr)`` to + connect to this socket. + + Parameters + ---------- + addr : str + The address string. This has the form 'protocol://interface:port', + for example 'tcp://127.0.0.1:5555'. Protocols supported include + tcp, udp, pgm, epgm, inproc and ipc. If the address is unicode, it is + encoded to utf-8 first. + """ + _addr_bytes: bytes = _c_addr(addr) + c_addr: p_char = _addr_bytes + _check_closed(self) + rc: C.int = zmq_bind(self.handle, c_addr) + if rc != 0: + _errno: C.int = _zmq_errno() + _ipc_max: C.int = get_ipc_path_max_len() + if _ipc_max and _errno == ENAMETOOLONG: + path = addr.split('://', 1)[-1] + msg = ( + f'ipc path "{path}" is longer than {_ipc_max} ' + 'characters (sizeof(sockaddr_un.sun_path)). ' + 'zmq.IPC_PATH_MAX_LEN constant can be used ' + 'to check addr length (if it is defined).' + ) + raise ZMQError(msg=msg) + elif _errno == ENOENT: + path = addr.split('://', 1)[-1] + msg = f'No such file or directory for ipc path "{path}".' + raise ZMQError(msg=msg) + while True: + try: + _check_rc(rc) + except InterruptedSystemCall: + rc = zmq_bind(self.handle, c_addr) + continue + else: + break + + def connect(self, addr: str | bytes) -> None: + """ + Connect to a remote 0MQ socket. + + Parameters + ---------- + addr : str + The address string. This has the form 'protocol://interface:port', + for example 'tcp://127.0.0.1:5555'. Protocols supported are + tcp, udp, pgm, inproc and ipc. If the address is unicode, it is + encoded to utf-8 first. + """ + rc: C.int + _addr_bytes: bytes = _c_addr(addr) + c_addr: p_char = _addr_bytes + _check_closed(self) + + while True: + try: + rc = zmq_connect(self.handle, c_addr) + _check_rc(rc) + except InterruptedSystemCall: + # retry syscall + continue + else: + break + + def unbind(self, addr: str | bytes): + """ + Unbind from an address (undoes a call to bind). + + .. versionadded:: libzmq-3.2 + .. versionadded:: 13.0 + + Parameters + ---------- + addr : str + The address string. This has the form 'protocol://interface:port', + for example 'tcp://127.0.0.1:5555'. Protocols supported are + tcp, udp, pgm, inproc and ipc. If the address is unicode, it is + encoded to utf-8 first. + """ + _addr_bytes: bytes = _c_addr(addr) + c_addr: p_char = _addr_bytes + _check_closed(self) + rc: C.int = zmq_unbind(self.handle, c_addr) + if rc != 0: + raise ZMQError() + + def disconnect(self, addr: str | bytes): + """ + Disconnect from a remote 0MQ socket (undoes a call to connect). + + .. versionadded:: libzmq-3.2 + .. versionadded:: 13.0 + + Parameters + ---------- + addr : str + The address string. This has the form 'protocol://interface:port', + for example 'tcp://127.0.0.1:5555'. Protocols supported are + tcp, udp, pgm, inproc and ipc. If the address is unicode, it is + encoded to utf-8 first. + """ + _addr_bytes: bytes = _c_addr(addr) + c_addr: p_char = _addr_bytes + _check_closed(self) + + rc: C.int = zmq_disconnect(self.handle, c_addr) + if rc != 0: + raise ZMQError() + + def monitor(self, addr: str | bytes | None, events: C.int = ZMQ_EVENT_ALL): + """ + Start publishing socket events on inproc. + See libzmq docs for zmq_monitor for details. + + While this function is available from libzmq 3.2, + pyzmq cannot parse monitor messages from libzmq prior to 4.0. + + .. versionadded: libzmq-3.2 + .. versionadded: 14.0 + + Parameters + ---------- + addr : str | None + The inproc url used for monitoring. Passing None as + the addr will cause an existing socket monitor to be + deregistered. + events : int + default: zmq.EVENT_ALL + The zmq event bitmask for which events will be sent to the monitor. + """ + c_addr: p_char = NULL + if addr is not None: + _addr_bytes: bytes = _c_addr(addr) + c_addr: p_char = _addr_bytes + _check_closed(self) + + _check_rc(zmq_socket_monitor(self.handle, c_addr, events)) + + def join(self, group: str | bytes): + """ + Join a RADIO-DISH group + + Only for DISH sockets. + + libzmq and pyzmq must have been built with ZMQ_BUILD_DRAFT_API + + .. versionadded:: 17 + """ + _check_version((4, 2), "RADIO-DISH") + if not zmq.DRAFT_API: + raise RuntimeError("libzmq and pyzmq must be built with draft support") + if isinstance(group, str): + group = group.encode('utf8') + c_group: bytes = group + rc: C.int = zmq_join(self.handle, c_group) + _check_rc(rc) + + def leave(self, group): + """ + Leave a RADIO-DISH group + + Only for DISH sockets. + + libzmq and pyzmq must have been built with ZMQ_BUILD_DRAFT_API + + .. versionadded:: 17 + """ + _check_version((4, 2), "RADIO-DISH") + if not zmq.DRAFT_API: + raise RuntimeError("libzmq and pyzmq must be built with draft support") + rc: C.int = zmq_leave(self.handle, group) + _check_rc(rc) + + def send(self, data, flags=0, copy: bint = True, track: bint = False): + """ + Send a single zmq message frame on this socket. + + This queues the message to be sent by the IO thread at a later time. + + With flags=NOBLOCK, this raises :class:`ZMQError` if the queue is full; + otherwise, this waits until space is available. + See :class:`Poller` for more general non-blocking I/O. + + Parameters + ---------- + data : bytes, Frame, memoryview + The content of the message. This can be any object that provides + the Python buffer API (`memoryview(data)` can be called). + flags : int + 0, NOBLOCK, SNDMORE, or NOBLOCK|SNDMORE. + copy : bool + Should the message be sent in a copying or non-copying manner. + track : bool + Should the message be tracked for notification that ZMQ has + finished with it? (ignored if copy=True) + + Returns + ------- + None : if `copy` or not track + None if message was sent, raises an exception otherwise. + MessageTracker : if track and not copy + a MessageTracker object, whose `done` property will + be False until the send is completed. + + Raises + ------ + TypeError + If a unicode object is passed + ValueError + If `track=True`, but an untracked Frame is passed. + ZMQError + for any of the reasons zmq_msg_send might fail (including + if NOBLOCK is set and the outgoing queue is full). + + """ + _check_closed(self) + + if isinstance(data, str): + raise TypeError("unicode not allowed, use send_string") + + if copy and not isinstance(data, Frame): + return _send_copy(self.handle, data, flags) + else: + if isinstance(data, Frame): + if track and not data.tracker: + raise ValueError('Not a tracked message') + msg = data + else: + if self.copy_threshold: + buf = memoryview(data) + nbytes: size_t = buf.nbytes + copy_threshold: size_t = self.copy_threshold + # always copy messages smaller than copy_threshold + if nbytes < copy_threshold: + _send_copy(self.handle, buf, flags) + return zmq._FINISHED_TRACKER + msg = Frame(data, track=track, copy_threshold=self.copy_threshold) + return _send_frame(self.handle, msg, flags) + + def recv(self, flags=0, copy: bint = True, track: bint = False): + """ + Receive a message. + + With flags=NOBLOCK, this raises :class:`ZMQError` if no messages have + arrived; otherwise, this waits until a message arrives. + See :class:`Poller` for more general non-blocking I/O. + + Parameters + ---------- + flags : int + 0 or NOBLOCK. + copy : bool + Should the message be received in a copying or non-copying manner? + If False a Frame object is returned, if True a string copy of + message is returned. + track : bool + Should the message be tracked for notification that ZMQ has + finished with it? (ignored if copy=True) + + Returns + ------- + msg : bytes or Frame + The received message frame. If `copy` is False, then it will be a Frame, + otherwise it will be bytes. + + Raises + ------ + ZMQError + for any of the reasons zmq_msg_recv might fail (including if + NOBLOCK is set and no new messages have arrived). + """ + _check_closed(self) + + if copy: + return _recv_copy(self.handle, flags) + else: + frame = _recv_frame(self.handle, flags, track) + more: bint = False + sz: size_t = sizeof(bint) + _getsockopt( + self.handle, ZMQ_RCVMORE, cast(p_void, address(more)), address(sz) + ) + frame.more = more + return frame + + def recv_into(self, buffer, /, *, nbytes=0, flags=0) -> C.int: + """ + Receive up to nbytes bytes from the socket, + storing the data into a buffer rather than allocating a new Frame. + + The next message frame can be discarded by receiving into an empty buffer:: + + sock.recv_into(bytearray()) + + .. versionadded:: 26.4 + + Parameters + ---------- + buffer : memoryview + Any object providing the buffer interface (i.e. `memoryview(buffer)` works), + where the memoryview is contiguous and writable. + nbytes: int, default=0 + The maximum number of bytes to receive. + If nbytes is not specified (or 0), receive up to the size available in the given buffer. + If the next frame is larger than this, the frame will be truncated and message content discarded. + flags: int, default=0 + See `socket.recv` + + Returns + ------- + bytes_received: int + Returns the number of bytes received. + This is always the size of the received frame. + If the returned `bytes_received` is larger than `nbytes` (or size of `buffer` if `nbytes=0`), + the message has been truncated and the rest of the frame discarded. + Truncated data cannot be recovered. + + Raises + ------ + ZMQError + for any of the reasons `zmq_recv` might fail. + BufferError + for invalid buffers, such as readonly or not contiguous. + """ + c_flags: C.int = flags + _check_closed(self) + c_nbytes: size_t = nbytes + if c_nbytes < 0: + raise ValueError(f"{nbytes=} must be non-negative") + view = memoryview(buffer) + c_data = declare(pointer(C.void)) + view_bytes: C.size_t = _asbuffer(view, address(c_data), True) + if nbytes == 0: + c_nbytes = view_bytes + elif c_nbytes > view_bytes: + raise ValueError(f"{nbytes=} too big for memoryview of {view_bytes}B") + + # call zmq_recv, with retries + while True: + with nogil: + rc: C.int = zmq_recv(self.handle, c_data, c_nbytes, c_flags) + try: + _check_rc(rc) + except InterruptedSystemCall: + continue + else: + return rc + + +# inline socket methods + + +@inline +@cfunc +def _check_closed(s: Socket): + """raise ENOTSUP if socket is closed + + Does not do a deep check + """ + if s._closed: + raise ZMQError(ENOTSOCK) + + +@inline +@cfunc +def _check_closed_deep(s: Socket) -> bint: + """thorough check of whether the socket has been closed, + even if by another entity (e.g. ctx.destroy). + + Only used by the `closed` property. + + returns True if closed, False otherwise + """ + rc: C.int + errno: C.int + stype = declare(C.int) + sz: size_t = sizeof(int) + + if s._closed: + return True + else: + rc = zmq_getsockopt( + s.handle, ZMQ_TYPE, cast(p_void, address(stype)), address(sz) + ) + if rc < 0: + errno = _zmq_errno() + if errno == ENOTSOCK: + s._closed = True + return True + elif errno == ZMQ_ETERM: + # don't raise ETERM when checking if we're closed + return False + else: + _check_rc(rc) + return False + + +@cfunc +@inline +def _recv_frame(handle: p_void, flags: C.int = 0, track: bint = False) -> Frame: + """Receive a message in a non-copying manner and return a Frame.""" + rc: C.int + msg = zmq.Frame(track=track) + cmsg: Frame = msg + + while True: + with nogil: + rc = zmq_msg_recv(address(cmsg.zmq_msg), handle, flags) + try: + _check_rc(rc) + except InterruptedSystemCall: + continue + else: + break + return msg + + +@cfunc +@inline +def _recv_copy(handle: p_void, flags: C.int = 0): + """Receive a message and return a copy""" + zmq_msg = declare(zmq_msg_t) + zmq_msg_p: pointer(zmq_msg_t) = address(zmq_msg) + rc: C.int = zmq_msg_init(zmq_msg_p) + _check_rc(rc) + while True: + with nogil: + rc = zmq_msg_recv(zmq_msg_p, handle, flags) + try: + _check_rc(rc) + except InterruptedSystemCall: + continue + except Exception: + zmq_msg_close(zmq_msg_p) # ensure msg is closed on failure + raise + else: + break + + msg_bytes = _copy_zmq_msg_bytes(zmq_msg_p) + zmq_msg_close(zmq_msg_p) + return msg_bytes + + +@cfunc +@inline +def _send_frame(handle: p_void, msg: Frame, flags: C.int = 0): + """Send a Frame on this socket in a non-copy manner.""" + rc: C.int + msg_copy: Frame + + # Always copy so the original message isn't garbage collected. + # This doesn't do a real copy, just a reference. + msg_copy = msg.fast_copy() + + while True: + with nogil: + rc = zmq_msg_send(address(msg_copy.zmq_msg), handle, flags) + try: + _check_rc(rc) + except InterruptedSystemCall: + continue + else: + break + + return msg.tracker + + +@cfunc +@inline +def _send_copy(handle: p_void, buf, flags: C.int = 0): + """Send a message on this socket by copying its content.""" + rc: C.int + msg = declare(zmq_msg_t) + c_bytes = declare(p_void) + + # copy to c array: + c_bytes_len = _asbuffer(buf, address(c_bytes)) + + # Copy the msg before sending. This avoids any complications with + # the GIL, etc. + # If zmq_msg_init_* fails we must not call zmq_msg_close (Bus Error) + rc = zmq_msg_init_size(address(msg), c_bytes_len) + _check_rc(rc) + + while True: + with nogil: + memcpy(zmq_msg_data(address(msg)), c_bytes, zmq_msg_size(address(msg))) + rc = zmq_msg_send(address(msg), handle, flags) + try: + _check_rc(rc) + except InterruptedSystemCall: + continue + except Exception: + zmq_msg_close(address(msg)) # close the unused msg + raise # raise original exception + else: + rc = zmq_msg_close(address(msg)) + _check_rc(rc) + break + + +@cfunc +@inline +def _getsockopt(handle: p_void, option: C.int, optval: p_void, sz: pointer(size_t)): + """getsockopt, retrying interrupted calls + + checks rc, raising ZMQError on failure. + """ + rc: C.int = 0 + while True: + rc = zmq_getsockopt(handle, option, optval, sz) + try: + _check_rc(rc) + except InterruptedSystemCall: + continue + else: + break + + +@cfunc +@inline +def _setsockopt(handle: p_void, option: C.int, optval: p_void, sz: size_t): + """setsockopt, retrying interrupted calls + + checks rc, raising ZMQError on failure. + """ + rc: C.int = 0 + while True: + rc = zmq_setsockopt(handle, option, optval, sz) + try: + _check_rc(rc) + except InterruptedSystemCall: + continue + else: + break + + +# General utility functions + + +def zmq_errno() -> C.int: + """Return the integer errno of the most recent zmq error.""" + return _zmq_errno() + + +def strerror(errno: C.int) -> str: + """ + Return the error string given the error number. + """ + str_e: bytes = zmq_strerror(errno) + return str_e.decode("utf8", "replace") + + +def zmq_version_info() -> tuple[int, int, int]: + """Return the version of ZeroMQ itself as a 3-tuple of ints.""" + major: C.int = 0 + minor: C.int = 0 + patch: C.int = 0 + _zmq_version(address(major), address(minor), address(patch)) + return (major, minor, patch) + + +def has(capability: str) -> bool: + """Check for zmq capability by name (e.g. 'ipc', 'curve') + + .. versionadded:: libzmq-4.1 + .. versionadded:: 14.1 + """ + _check_version((4, 1), 'zmq.has') + ccap: bytes = capability.encode('utf8') + return bool(zmq_has(ccap)) + + +def curve_keypair() -> tuple[bytes, bytes]: + """generate a Z85 key pair for use with zmq.CURVE security + + Requires libzmq (≥ 4.0) to have been built with CURVE support. + + .. versionadded:: libzmq-4.0 + .. versionadded:: 14.0 + + Returns + ------- + public: bytes + The public key as 40 byte z85-encoded bytestring. + private: bytes + The private key as 40 byte z85-encoded bytestring. + """ + rc: C.int + public_key = declare(char[64]) + secret_key = declare(char[64]) + _check_version((4, 0), "curve_keypair") + # see huge comment in libzmq/src/random.cpp + # about threadsafety of random initialization + rc = zmq_curve_keypair(public_key, secret_key) + _check_rc(rc) + return public_key, secret_key + + +def curve_public(secret_key) -> bytes: + """Compute the public key corresponding to a secret key for use + with zmq.CURVE security + + Requires libzmq (≥ 4.2) to have been built with CURVE support. + + Parameters + ---------- + private + The private key as a 40 byte z85-encoded bytestring + + Returns + ------- + bytes + The public key as a 40 byte z85-encoded bytestring + """ + if isinstance(secret_key, str): + secret_key = secret_key.encode('utf8') + if not len(secret_key) == 40: + raise ValueError('secret key must be a 40 byte z85 encoded string') + + rc: C.int + public_key = declare(char[64]) + c_secret_key: pointer(char) = secret_key + _check_version((4, 2), "curve_public") + # see huge comment in libzmq/src/random.cpp + # about threadsafety of random initialization + rc = zmq_curve_public(public_key, c_secret_key) + _check_rc(rc) + return public_key[:40] + + +# polling +def zmq_poll(sockets, timeout: C.int = -1): + """zmq_poll(sockets, timeout=-1) + + Poll a set of 0MQ sockets, native file descs. or sockets. + + Parameters + ---------- + sockets : list of tuples of (socket, flags) + Each element of this list is a two-tuple containing a socket + and a flags. The socket may be a 0MQ socket or any object with + a ``fileno()`` method. The flags can be zmq.POLLIN (for detecting + for incoming messages), zmq.POLLOUT (for detecting that send is OK) + or zmq.POLLIN|zmq.POLLOUT for detecting both. + timeout : int + The number of milliseconds to poll for. Negative means no timeout. + """ + rc: C.int + i: C.int + fileno: fd_t + events: C.int + pollitems: pointer(zmq_pollitem_t) = NULL + nsockets: C.int = len(sockets) + + if nsockets == 0: + return [] + + pollitems = cast(pointer(zmq_pollitem_t), malloc(nsockets * sizeof(zmq_pollitem_t))) + if pollitems == NULL: + raise MemoryError("Could not allocate poll items") + + for i in range(nsockets): + s, events = sockets[i] + if isinstance(s, Socket): + pollitems[i].socket = cast(Socket, s).handle + pollitems[i].fd = 0 + pollitems[i].events = events + pollitems[i].revents = 0 + elif isinstance(s, int): + fileno = s + pollitems[i].socket = NULL + pollitems[i].fd = fileno + pollitems[i].events = events + pollitems[i].revents = 0 + elif hasattr(s, 'fileno'): + try: + fileno = int(s.fileno()) + except Exception: + free(pollitems) + raise ValueError('fileno() must return a valid integer fd') + else: + pollitems[i].socket = NULL + pollitems[i].fd = fileno + pollitems[i].events = events + pollitems[i].revents = 0 + else: + free(pollitems) + raise TypeError( + "Socket must be a 0MQ socket, an integer fd or have " + f"a fileno() method: {s!r}" + ) + + ms_passed: C.int = 0 + tic: C.int + try: + while True: + start: C.int = monotonic() + with nogil: + rc = zmq_poll_c(pollitems, nsockets, timeout) + try: + _check_rc(rc) + except InterruptedSystemCall: + if timeout > 0: + tic = monotonic() + ms_passed = int(1000 * (tic - start)) + if ms_passed < 0: + # don't allow negative ms_passed, + # which can happen on old Python versions without time.monotonic. + warnings.warn( + f"Negative elapsed time for interrupted poll: {ms_passed}." + " Did the clock change?", + RuntimeWarning, + ) + # treat this case the same as no time passing, + # since it should be rare and not happen twice in a row. + ms_passed = 0 + timeout = max(0, timeout - ms_passed) + continue + else: + break + except Exception: + free(pollitems) + raise + + results = [] + for i in range(nsockets): + revents = pollitems[i].revents + # for compatibility with select.poll: + # - only return sockets with non-zero status + # - return the fd for plain sockets + if revents > 0: + if pollitems[i].socket != NULL: + s = sockets[i][0] + else: + s = pollitems[i].fd + results.append((s, revents)) + + free(pollitems) + return results + + +def proxy(frontend: Socket, backend: Socket, capture: Socket = None): + """ + Start a zeromq proxy (replacement for device). + + .. versionadded:: libzmq-3.2 + .. versionadded:: 13.0 + + Parameters + ---------- + frontend : Socket + The Socket instance for the incoming traffic. + backend : Socket + The Socket instance for the outbound traffic. + capture : Socket (optional) + The Socket instance for capturing traffic. + """ + rc: C.int = 0 + capture_handle: p_void + if isinstance(capture, Socket): + capture_handle = capture.handle + else: + capture_handle = NULL + while True: + with nogil: + rc = zmq_proxy(frontend.handle, backend.handle, capture_handle) + try: + _check_rc(rc) + except InterruptedSystemCall: + continue + else: + break + return rc + + +def proxy_steerable( + frontend: Socket, + backend: Socket, + capture: Socket = None, + control: Socket = None, +): + """ + Start a zeromq proxy with control flow. + + .. versionadded:: libzmq-4.1 + .. versionadded:: 18.0 + + Parameters + ---------- + frontend : Socket + The Socket instance for the incoming traffic. + backend : Socket + The Socket instance for the outbound traffic. + capture : Socket (optional) + The Socket instance for capturing traffic. + control : Socket (optional) + The Socket instance for control flow. + """ + rc: C.int = 0 + capture_handle: p_void + if isinstance(capture, Socket): + capture_handle = capture.handle + else: + capture_handle = NULL + if isinstance(control, Socket): + control_handle = control.handle + else: + control_handle = NULL + while True: + with nogil: + rc = zmq_proxy_steerable( + frontend.handle, backend.handle, capture_handle, control_handle + ) + try: + _check_rc(rc) + except InterruptedSystemCall: + continue + else: + break + return rc + + +# monitored queue - like proxy (predates libzmq proxy) +# but supports ROUTER-ROUTER devices +@cfunc +@inline +@nogil +def _mq_relay( + in_socket: p_void, + out_socket: p_void, + side_socket: p_void, + msg: zmq_msg_t, + side_msg: zmq_msg_t, + id_msg: zmq_msg_t, + swap_ids: bint, +) -> C.int: + rc: C.int + flags: C.int + flagsz = declare(size_t) + more = declare(int) + flagsz = sizeof(int) + + if swap_ids: # both router, must send second identity first + # recv two ids into msg, id_msg + rc = zmq_msg_recv(address(msg), in_socket, 0) + if rc < 0: + return rc + + rc = zmq_msg_recv(address(id_msg), in_socket, 0) + if rc < 0: + return rc + + # send second id (id_msg) first + # !!!! always send a copy before the original !!!! + rc = zmq_msg_copy(address(side_msg), address(id_msg)) + if rc < 0: + return rc + rc = zmq_msg_send(address(side_msg), out_socket, ZMQ_SNDMORE) + if rc < 0: + return rc + rc = zmq_msg_send(address(id_msg), side_socket, ZMQ_SNDMORE) + if rc < 0: + return rc + # send first id (msg) second + rc = zmq_msg_copy(address(side_msg), address(msg)) + if rc < 0: + return rc + rc = zmq_msg_send(address(side_msg), out_socket, ZMQ_SNDMORE) + if rc < 0: + return rc + rc = zmq_msg_send(address(msg), side_socket, ZMQ_SNDMORE) + if rc < 0: + return rc + while True: + rc = zmq_msg_recv(address(msg), in_socket, 0) + if rc < 0: + return rc + # assert (rc == 0) + rc = zmq_getsockopt(in_socket, ZMQ_RCVMORE, address(more), address(flagsz)) + if rc < 0: + return rc + flags = 0 + if more: + flags |= ZMQ_SNDMORE + + rc = zmq_msg_copy(address(side_msg), address(msg)) + if rc < 0: + return rc + if flags: + rc = zmq_msg_send(address(side_msg), out_socket, flags) + if rc < 0: + return rc + # only SNDMORE for side-socket + rc = zmq_msg_send(address(msg), side_socket, ZMQ_SNDMORE) + if rc < 0: + return rc + else: + rc = zmq_msg_send(address(side_msg), out_socket, 0) + if rc < 0: + return rc + rc = zmq_msg_send(address(msg), side_socket, 0) + if rc < 0: + return rc + break + return rc + + +@cfunc +@inline +@nogil +def _mq_inline( + in_socket: p_void, + out_socket: p_void, + side_socket: p_void, + in_msg_ptr: pointer(zmq_msg_t), + out_msg_ptr: pointer(zmq_msg_t), + swap_ids: bint, +) -> C.int: + """ + inner C function for monitored_queue + """ + + msg: zmq_msg_t = declare(zmq_msg_t) + rc: C.int = zmq_msg_init(address(msg)) + id_msg = declare(zmq_msg_t) + rc = zmq_msg_init(address(id_msg)) + if rc < 0: + return rc + side_msg = declare(zmq_msg_t) + rc = zmq_msg_init(address(side_msg)) + if rc < 0: + return rc + + items = declare(zmq_pollitem_t[2]) + items[0].socket = in_socket + items[0].events = ZMQ_POLLIN + items[0].fd = items[0].revents = 0 + items[1].socket = out_socket + items[1].events = ZMQ_POLLIN + items[1].fd = items[1].revents = 0 + + while True: + # wait for the next message to process + rc = zmq_poll_c(address(items[0]), 2, -1) + if rc < 0: + return rc + if items[0].revents & ZMQ_POLLIN: + # send in_prefix to side socket + rc = zmq_msg_copy(address(side_msg), in_msg_ptr) + if rc < 0: + return rc + rc = zmq_msg_send(address(side_msg), side_socket, ZMQ_SNDMORE) + if rc < 0: + return rc + # relay the rest of the message + rc = _mq_relay( + in_socket, out_socket, side_socket, msg, side_msg, id_msg, swap_ids + ) + if rc < 0: + return rc + if items[1].revents & ZMQ_POLLIN: + # send out_prefix to side socket + rc = zmq_msg_copy(address(side_msg), out_msg_ptr) + if rc < 0: + return rc + rc = zmq_msg_send(address(side_msg), side_socket, ZMQ_SNDMORE) + if rc < 0: + return rc + # relay the rest of the message + rc = _mq_relay( + out_socket, in_socket, side_socket, msg, side_msg, id_msg, swap_ids + ) + if rc < 0: + return rc + return rc + + +def monitored_queue( + in_socket: Socket, + out_socket: Socket, + mon_socket: Socket, + in_prefix: bytes = b'in', + out_prefix: bytes = b'out', +): + """ + Start a monitored queue device. + + A monitored queue is very similar to the zmq.proxy device (monitored queue came first). + + Differences from zmq.proxy: + + - monitored_queue supports both in and out being ROUTER sockets + (via swapping IDENTITY prefixes). + - monitor messages are prefixed, making in and out messages distinguishable. + + Parameters + ---------- + in_socket : zmq.Socket + One of the sockets to the Queue. Its messages will be prefixed with + 'in'. + out_socket : zmq.Socket + One of the sockets to the Queue. Its messages will be prefixed with + 'out'. The only difference between in/out socket is this prefix. + mon_socket : zmq.Socket + This socket sends out every message received by each of the others + with an in/out prefix specifying which one it was. + in_prefix : str + Prefix added to broadcast messages from in_socket. + out_prefix : str + Prefix added to broadcast messages from out_socket. + """ + ins: p_void = in_socket.handle + outs: p_void = out_socket.handle + mons: p_void = mon_socket.handle + in_msg = declare(zmq_msg_t) + out_msg = declare(zmq_msg_t) + swap_ids: bint + msg_c: p_void = NULL + msg_c_len = declare(Py_ssize_t) + rc: C.int + + # force swap_ids if both ROUTERs + swap_ids = in_socket.type == ZMQ_ROUTER and out_socket.type == ZMQ_ROUTER + + # build zmq_msg objects from str prefixes + msg_c_len = _asbuffer(in_prefix, address(msg_c)) + rc = zmq_msg_init_size(address(in_msg), msg_c_len) + _check_rc(rc) + + memcpy(zmq_msg_data(address(in_msg)), msg_c, zmq_msg_size(address(in_msg))) + + msg_c_len = _asbuffer(out_prefix, address(msg_c)) + + rc = zmq_msg_init_size(address(out_msg), msg_c_len) + _check_rc(rc) + + while True: + with nogil: + memcpy( + zmq_msg_data(address(out_msg)), msg_c, zmq_msg_size(address(out_msg)) + ) + rc = _mq_inline( + ins, outs, mons, address(in_msg), address(out_msg), swap_ids + ) + try: + _check_rc(rc) + except InterruptedSystemCall: + continue + else: + break + return rc + + +__all__ = [ + 'IPC_PATH_MAX_LEN', + 'PYZMQ_DRAFT_API', + 'Context', + 'Socket', + 'Frame', + 'has', + 'curve_keypair', + 'curve_public', + 'zmq_version_info', + 'zmq_errno', + 'zmq_poll', + 'strerror', + 'proxy', + 'proxy_steerable', +] diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/backend/cython/constant_enums.pxi b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/backend/cython/constant_enums.pxi new file mode 100644 index 0000000000000000000000000000000000000000..811d2a84f56f1b96d98a3f4a57cfbacf50c69a08 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/backend/cython/constant_enums.pxi @@ -0,0 +1,250 @@ +cdef extern from "zmq.h" nogil: + enum: PYZMQ_DRAFT_API + enum: ZMQ_VERSION + enum: ZMQ_VERSION_MAJOR + enum: ZMQ_VERSION_MINOR + enum: ZMQ_VERSION_PATCH + enum: ZMQ_IO_THREADS + enum: ZMQ_MAX_SOCKETS + enum: ZMQ_SOCKET_LIMIT + enum: ZMQ_THREAD_PRIORITY + enum: ZMQ_THREAD_SCHED_POLICY + enum: ZMQ_MAX_MSGSZ + enum: ZMQ_MSG_T_SIZE + enum: ZMQ_THREAD_AFFINITY_CPU_ADD + enum: ZMQ_THREAD_AFFINITY_CPU_REMOVE + enum: ZMQ_THREAD_NAME_PREFIX + enum: ZMQ_STREAMER + enum: ZMQ_FORWARDER + enum: ZMQ_QUEUE + enum: ZMQ_EAGAIN "EAGAIN" + enum: ZMQ_EFAULT "EFAULT" + enum: ZMQ_EINVAL "EINVAL" + enum: ZMQ_ENOTSUP "ENOTSUP" + enum: ZMQ_EPROTONOSUPPORT "EPROTONOSUPPORT" + enum: ZMQ_ENOBUFS "ENOBUFS" + enum: ZMQ_ENETDOWN "ENETDOWN" + enum: ZMQ_EADDRINUSE "EADDRINUSE" + enum: ZMQ_EADDRNOTAVAIL "EADDRNOTAVAIL" + enum: ZMQ_ECONNREFUSED "ECONNREFUSED" + enum: ZMQ_EINPROGRESS "EINPROGRESS" + enum: ZMQ_ENOTSOCK "ENOTSOCK" + enum: ZMQ_EMSGSIZE "EMSGSIZE" + enum: ZMQ_EAFNOSUPPORT "EAFNOSUPPORT" + enum: ZMQ_ENETUNREACH "ENETUNREACH" + enum: ZMQ_ECONNABORTED "ECONNABORTED" + enum: ZMQ_ECONNRESET "ECONNRESET" + enum: ZMQ_ENOTCONN "ENOTCONN" + enum: ZMQ_ETIMEDOUT "ETIMEDOUT" + enum: ZMQ_EHOSTUNREACH "EHOSTUNREACH" + enum: ZMQ_ENETRESET "ENETRESET" + enum: ZMQ_EFSM "EFSM" + enum: ZMQ_ENOCOMPATPROTO "ENOCOMPATPROTO" + enum: ZMQ_ETERM "ETERM" + enum: ZMQ_EMTHREAD "EMTHREAD" + enum: ZMQ_PROTOCOL_ERROR_WS_UNSPECIFIED + enum: ZMQ_PROTOCOL_ERROR_ZMTP_UNSPECIFIED + enum: ZMQ_PROTOCOL_ERROR_ZMTP_UNEXPECTED_COMMAND + enum: ZMQ_PROTOCOL_ERROR_ZMTP_INVALID_SEQUENCE + enum: ZMQ_PROTOCOL_ERROR_ZMTP_KEY_EXCHANGE + enum: ZMQ_PROTOCOL_ERROR_ZMTP_MALFORMED_COMMAND_UNSPECIFIED + enum: ZMQ_PROTOCOL_ERROR_ZMTP_MALFORMED_COMMAND_MESSAGE + enum: ZMQ_PROTOCOL_ERROR_ZMTP_MALFORMED_COMMAND_HELLO + enum: ZMQ_PROTOCOL_ERROR_ZMTP_MALFORMED_COMMAND_INITIATE + enum: ZMQ_PROTOCOL_ERROR_ZMTP_MALFORMED_COMMAND_ERROR + enum: ZMQ_PROTOCOL_ERROR_ZMTP_MALFORMED_COMMAND_READY + enum: ZMQ_PROTOCOL_ERROR_ZMTP_MALFORMED_COMMAND_WELCOME + enum: ZMQ_PROTOCOL_ERROR_ZMTP_INVALID_METADATA + enum: ZMQ_PROTOCOL_ERROR_ZMTP_CRYPTOGRAPHIC + enum: ZMQ_PROTOCOL_ERROR_ZMTP_MECHANISM_MISMATCH + enum: ZMQ_PROTOCOL_ERROR_ZAP_UNSPECIFIED + enum: ZMQ_PROTOCOL_ERROR_ZAP_MALFORMED_REPLY + enum: ZMQ_PROTOCOL_ERROR_ZAP_BAD_REQUEST_ID + enum: ZMQ_PROTOCOL_ERROR_ZAP_BAD_VERSION + enum: ZMQ_PROTOCOL_ERROR_ZAP_INVALID_STATUS_CODE + enum: ZMQ_PROTOCOL_ERROR_ZAP_INVALID_METADATA + enum: ZMQ_EVENT_CONNECTED + enum: ZMQ_EVENT_CONNECT_DELAYED + enum: ZMQ_EVENT_CONNECT_RETRIED + enum: ZMQ_EVENT_LISTENING + enum: ZMQ_EVENT_BIND_FAILED + enum: ZMQ_EVENT_ACCEPTED + enum: ZMQ_EVENT_ACCEPT_FAILED + enum: ZMQ_EVENT_CLOSED + enum: ZMQ_EVENT_CLOSE_FAILED + enum: ZMQ_EVENT_DISCONNECTED + enum: ZMQ_EVENT_MONITOR_STOPPED + enum: ZMQ_EVENT_HANDSHAKE_FAILED_NO_DETAIL + enum: ZMQ_EVENT_HANDSHAKE_SUCCEEDED + enum: ZMQ_EVENT_HANDSHAKE_FAILED_PROTOCOL + enum: ZMQ_EVENT_HANDSHAKE_FAILED_AUTH + enum: ZMQ_EVENT_ALL_V1 + enum: ZMQ_EVENT_ALL + enum: ZMQ_EVENT_PIPES_STATS + enum: ZMQ_EVENT_ALL_V2 + enum: ZMQ_DONTWAIT + enum: ZMQ_SNDMORE + enum: ZMQ_NOBLOCK + enum: ZMQ_MORE + enum: ZMQ_SHARED + enum: ZMQ_SRCFD + enum: ZMQ_NORM_FIXED + enum: ZMQ_NORM_CC + enum: ZMQ_NORM_CCL + enum: ZMQ_NORM_CCE + enum: ZMQ_NORM_CCE_ECNONLY + enum: ZMQ_POLLIN + enum: ZMQ_POLLOUT + enum: ZMQ_POLLERR + enum: ZMQ_POLLPRI + enum: ZMQ_RECONNECT_STOP_CONN_REFUSED + enum: ZMQ_RECONNECT_STOP_HANDSHAKE_FAILED + enum: ZMQ_RECONNECT_STOP_AFTER_DISCONNECT + enum: ZMQ_NOTIFY_CONNECT + enum: ZMQ_NOTIFY_DISCONNECT + enum: ZMQ_NULL + enum: ZMQ_PLAIN + enum: ZMQ_CURVE + enum: ZMQ_GSSAPI + enum: ZMQ_HWM + enum: ZMQ_AFFINITY + enum: ZMQ_ROUTING_ID + enum: ZMQ_SUBSCRIBE + enum: ZMQ_UNSUBSCRIBE + enum: ZMQ_RATE + enum: ZMQ_RECOVERY_IVL + enum: ZMQ_SNDBUF + enum: ZMQ_RCVBUF + enum: ZMQ_RCVMORE + enum: ZMQ_FD + enum: ZMQ_EVENTS + enum: ZMQ_TYPE + enum: ZMQ_LINGER + enum: ZMQ_RECONNECT_IVL + enum: ZMQ_BACKLOG + enum: ZMQ_RECONNECT_IVL_MAX + enum: ZMQ_MAXMSGSIZE + enum: ZMQ_SNDHWM + enum: ZMQ_RCVHWM + enum: ZMQ_MULTICAST_HOPS + enum: ZMQ_RCVTIMEO + enum: ZMQ_SNDTIMEO + enum: ZMQ_LAST_ENDPOINT + enum: ZMQ_ROUTER_MANDATORY + enum: ZMQ_TCP_KEEPALIVE + enum: ZMQ_TCP_KEEPALIVE_CNT + enum: ZMQ_TCP_KEEPALIVE_IDLE + enum: ZMQ_TCP_KEEPALIVE_INTVL + enum: ZMQ_IMMEDIATE + enum: ZMQ_XPUB_VERBOSE + enum: ZMQ_ROUTER_RAW + enum: ZMQ_IPV6 + enum: ZMQ_MECHANISM + enum: ZMQ_PLAIN_SERVER + enum: ZMQ_PLAIN_USERNAME + enum: ZMQ_PLAIN_PASSWORD + enum: ZMQ_CURVE_SERVER + enum: ZMQ_CURVE_PUBLICKEY + enum: ZMQ_CURVE_SECRETKEY + enum: ZMQ_CURVE_SERVERKEY + enum: ZMQ_PROBE_ROUTER + enum: ZMQ_REQ_CORRELATE + enum: ZMQ_REQ_RELAXED + enum: ZMQ_CONFLATE + enum: ZMQ_ZAP_DOMAIN + enum: ZMQ_ROUTER_HANDOVER + enum: ZMQ_TOS + enum: ZMQ_CONNECT_ROUTING_ID + enum: ZMQ_GSSAPI_SERVER + enum: ZMQ_GSSAPI_PRINCIPAL + enum: ZMQ_GSSAPI_SERVICE_PRINCIPAL + enum: ZMQ_GSSAPI_PLAINTEXT + enum: ZMQ_HANDSHAKE_IVL + enum: ZMQ_SOCKS_PROXY + enum: ZMQ_XPUB_NODROP + enum: ZMQ_BLOCKY + enum: ZMQ_XPUB_MANUAL + enum: ZMQ_XPUB_WELCOME_MSG + enum: ZMQ_STREAM_NOTIFY + enum: ZMQ_INVERT_MATCHING + enum: ZMQ_HEARTBEAT_IVL + enum: ZMQ_HEARTBEAT_TTL + enum: ZMQ_HEARTBEAT_TIMEOUT + enum: ZMQ_XPUB_VERBOSER + enum: ZMQ_CONNECT_TIMEOUT + enum: ZMQ_TCP_MAXRT + enum: ZMQ_THREAD_SAFE + enum: ZMQ_MULTICAST_MAXTPDU + enum: ZMQ_VMCI_BUFFER_SIZE + enum: ZMQ_VMCI_BUFFER_MIN_SIZE + enum: ZMQ_VMCI_BUFFER_MAX_SIZE + enum: ZMQ_VMCI_CONNECT_TIMEOUT + enum: ZMQ_USE_FD + enum: ZMQ_GSSAPI_PRINCIPAL_NAMETYPE + enum: ZMQ_GSSAPI_SERVICE_PRINCIPAL_NAMETYPE + enum: ZMQ_BINDTODEVICE + enum: ZMQ_IDENTITY + enum: ZMQ_CONNECT_RID + enum: ZMQ_TCP_ACCEPT_FILTER + enum: ZMQ_IPC_FILTER_PID + enum: ZMQ_IPC_FILTER_UID + enum: ZMQ_IPC_FILTER_GID + enum: ZMQ_IPV4ONLY + enum: ZMQ_DELAY_ATTACH_ON_CONNECT + enum: ZMQ_FAIL_UNROUTABLE + enum: ZMQ_ROUTER_BEHAVIOR + enum: ZMQ_ZAP_ENFORCE_DOMAIN + enum: ZMQ_LOOPBACK_FASTPATH + enum: ZMQ_METADATA + enum: ZMQ_MULTICAST_LOOP + enum: ZMQ_ROUTER_NOTIFY + enum: ZMQ_XPUB_MANUAL_LAST_VALUE + enum: ZMQ_SOCKS_USERNAME + enum: ZMQ_SOCKS_PASSWORD + enum: ZMQ_IN_BATCH_SIZE + enum: ZMQ_OUT_BATCH_SIZE + enum: ZMQ_WSS_KEY_PEM + enum: ZMQ_WSS_CERT_PEM + enum: ZMQ_WSS_TRUST_PEM + enum: ZMQ_WSS_HOSTNAME + enum: ZMQ_WSS_TRUST_SYSTEM + enum: ZMQ_ONLY_FIRST_SUBSCRIBE + enum: ZMQ_RECONNECT_STOP + enum: ZMQ_HELLO_MSG + enum: ZMQ_DISCONNECT_MSG + enum: ZMQ_PRIORITY + enum: ZMQ_BUSY_POLL + enum: ZMQ_HICCUP_MSG + enum: ZMQ_XSUB_VERBOSE_UNSUBSCRIBE + enum: ZMQ_TOPICS_COUNT + enum: ZMQ_NORM_MODE + enum: ZMQ_NORM_UNICAST_NACK + enum: ZMQ_NORM_BUFFER_SIZE + enum: ZMQ_NORM_SEGMENT_SIZE + enum: ZMQ_NORM_BLOCK_SIZE + enum: ZMQ_NORM_NUM_PARITY + enum: ZMQ_NORM_NUM_AUTOPARITY + enum: ZMQ_NORM_PUSH + enum: ZMQ_PAIR + enum: ZMQ_PUB + enum: ZMQ_SUB + enum: ZMQ_REQ + enum: ZMQ_REP + enum: ZMQ_DEALER + enum: ZMQ_ROUTER + enum: ZMQ_PULL + enum: ZMQ_PUSH + enum: ZMQ_XPUB + enum: ZMQ_XSUB + enum: ZMQ_STREAM + enum: ZMQ_XREQ + enum: ZMQ_XREP + enum: ZMQ_SERVER + enum: ZMQ_CLIENT + enum: ZMQ_RADIO + enum: ZMQ_DISH + enum: ZMQ_GATHER + enum: ZMQ_SCATTER + enum: ZMQ_DGRAM + enum: ZMQ_PEER + enum: ZMQ_CHANNEL diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/backend/cython/libzmq.pxd b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/backend/cython/libzmq.pxd new file mode 100644 index 0000000000000000000000000000000000000000..2e88f58ebf39ca3044668cafa663b632faf17a2c --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/backend/cython/libzmq.pxd @@ -0,0 +1,128 @@ +"""All the C imports for 0MQ""" + +# +# Copyright (c) 2010 Brian E. Granger & Min Ragan-Kelley +# +# This file is part of pyzmq. +# +# pyzmq is free software; you can redistribute it and/or modify it under +# the terms of the Lesser GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# pyzmq is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# Lesser GNU General Public License for more details. +# +# You should have received a copy of the Lesser GNU General Public License +# along with this program. If not, see . +# + +#----------------------------------------------------------------------------- +# Imports +#----------------------------------------------------------------------------- + +#----------------------------------------------------------------------------- +# Import the C header files +#----------------------------------------------------------------------------- + +# common includes, such as zmq compat, pyversion_compat +# make sure we load pyversion compat in every Cython module +cdef extern from "pyversion_compat.h": + pass + +# were it not for Windows, +# we could cimport these from libc.stdint +cdef extern from "zmq_compat.h": + ctypedef signed long long int64_t "pyzmq_int64_t" + ctypedef unsigned int uint32_t "pyzmq_uint32_t" + +include "constant_enums.pxi" + +cdef extern from "zmq.h" nogil: + + void _zmq_version "zmq_version"(int *major, int *minor, int *patch) + + ctypedef int fd_t "ZMQ_FD_T" + + enum: errno + const char *zmq_strerror (int errnum) + int zmq_errno() + + void *zmq_ctx_new () + int zmq_ctx_destroy (void *context) + int zmq_ctx_set (void *context, int option, int optval) + int zmq_ctx_get (void *context, int option) + void *zmq_init (int io_threads) + int zmq_term (void *context) + + # blackbox def for zmq_msg_t + ctypedef void * zmq_msg_t "zmq_msg_t" + + ctypedef void zmq_free_fn(void *data, void *hint) + + int zmq_msg_init (zmq_msg_t *msg) + int zmq_msg_init_size (zmq_msg_t *msg, size_t size) + int zmq_msg_init_data (zmq_msg_t *msg, void *data, + size_t size, zmq_free_fn *ffn, void *hint) + int zmq_msg_send (zmq_msg_t *msg, void *s, int flags) + int zmq_msg_recv (zmq_msg_t *msg, void *s, int flags) + int zmq_msg_close (zmq_msg_t *msg) + int zmq_msg_move (zmq_msg_t *dest, zmq_msg_t *src) + int zmq_msg_copy (zmq_msg_t *dest, zmq_msg_t *src) + void *zmq_msg_data (zmq_msg_t *msg) + size_t zmq_msg_size (zmq_msg_t *msg) + int zmq_msg_more (zmq_msg_t *msg) + int zmq_msg_get (zmq_msg_t *msg, int option) + int zmq_msg_set (zmq_msg_t *msg, int option, int optval) + const char *zmq_msg_gets (zmq_msg_t *msg, const char *property) + int zmq_has (const char *capability) + + void *zmq_socket (void *context, int type) + int zmq_close (void *s) + int zmq_setsockopt (void *s, int option, void *optval, size_t optvallen) + int zmq_getsockopt (void *s, int option, void *optval, size_t *optvallen) + int zmq_bind (void *s, char *addr) + int zmq_connect (void *s, char *addr) + int zmq_unbind (void *s, char *addr) + int zmq_disconnect (void *s, char *addr) + + int zmq_socket_monitor (void *s, char *addr, int flags) + + # send/recv + int zmq_send (void *s, const void *buf, size_t n, int flags) + int zmq_recv (void *s, void *buf, size_t n, int flags) + + ctypedef struct zmq_pollitem_t: + void *socket + fd_t fd + short events + short revents + + int zmq_poll (zmq_pollitem_t *items, int nitems, long timeout) + + int zmq_proxy (void *frontend, void *backend, void *capture) + int zmq_proxy_steerable (void *frontend, + void *backend, + void *capture, + void *control) + + int zmq_curve_keypair (char *z85_public_key, char *z85_secret_key) + int zmq_curve_public (char *z85_public_key, char *z85_secret_key) + + # 4.2 draft + int zmq_join (void *s, const char *group) + int zmq_leave (void *s, const char *group) + + int zmq_msg_set_routing_id(zmq_msg_t *msg, uint32_t routing_id) + uint32_t zmq_msg_routing_id(zmq_msg_t *msg) + int zmq_msg_set_group(zmq_msg_t *msg, const char *group) + const char *zmq_msg_group(zmq_msg_t *msg) + + void *zmq_poller_new () + int zmq_poller_destroy (void **poller_p_) + int zmq_poller_add (void *poller_, void *socket_, void *user_data_, short events_) + int zmq_poller_modify (void *poller_, void *socket_, short events_) + int zmq_poller_remove (void *poller_, void *socket_) + int zmq_poller_fd (void *poller_, fd_t *fd_) diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/backend/select.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/backend/select.py new file mode 100644 index 0000000000000000000000000000000000000000..17cbea8285337fa370983f18bb4ad90db686aa37 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/backend/select.py @@ -0,0 +1,41 @@ +"""Import basic exposure of libzmq C API as a backend""" + +# Copyright (C) PyZMQ Developers +# Distributed under the terms of the Modified BSD License. + +from importlib import import_module +from typing import Dict + +public_api = [ + 'Context', + 'Socket', + 'Frame', + 'Message', + 'proxy', + 'proxy_steerable', + 'zmq_poll', + 'strerror', + 'zmq_errno', + 'has', + 'curve_keypair', + 'curve_public', + 'zmq_version_info', + 'IPC_PATH_MAX_LEN', + 'PYZMQ_DRAFT_API', +] + + +def select_backend(name: str) -> Dict: + """Select the pyzmq backend""" + try: + mod = import_module(name) + except ImportError: + raise + except Exception as e: + raise ImportError(f"Importing {name} failed with {e}") from e + ns = { + # private API + 'monitored_queue': mod.monitored_queue, + } + ns.update({key: getattr(mod, key) for key in public_api}) + return ns diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/constants.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/constants.py new file mode 100644 index 0000000000000000000000000000000000000000..cddf433a15d9102b9162425f8d8a54aa125f783e --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/constants.py @@ -0,0 +1,974 @@ +"""zmq constants as enums""" + +from __future__ import annotations + +import errno +import sys +from enum import Enum, IntEnum, IntFlag + +_HAUSNUMERO = 156384712 + + +class Errno(IntEnum): + """libzmq error codes + + .. versionadded:: 23 + """ + + EAGAIN = errno.EAGAIN + EFAULT = errno.EFAULT + EINVAL = errno.EINVAL + + if sys.platform.startswith("win"): + # Windows: libzmq uses errno.h + # while Python errno prefers WSA* variants + # many of these were introduced to errno.h in vs2010 + # ref: https://github.com/python/cpython/blob/3.9/Modules/errnomodule.c#L10-L37 + # source: https://docs.microsoft.com/en-us/cpp/c-runtime-library/errno-constants + ENOTSUP = 129 + EPROTONOSUPPORT = 135 + ENOBUFS = 119 + ENETDOWN = 116 + EADDRINUSE = 100 + EADDRNOTAVAIL = 101 + ECONNREFUSED = 107 + EINPROGRESS = 112 + ENOTSOCK = 128 + EMSGSIZE = 115 + EAFNOSUPPORT = 102 + ENETUNREACH = 118 + ECONNABORTED = 106 + ECONNRESET = 108 + ENOTCONN = 126 + ETIMEDOUT = 138 + EHOSTUNREACH = 110 + ENETRESET = 117 + + else: + ENOTSUP = getattr(errno, "ENOTSUP", _HAUSNUMERO + 1) + EPROTONOSUPPORT = getattr(errno, "EPROTONOSUPPORT", _HAUSNUMERO + 2) + ENOBUFS = getattr(errno, "ENOBUFS", _HAUSNUMERO + 3) + ENETDOWN = getattr(errno, "ENETDOWN", _HAUSNUMERO + 4) + EADDRINUSE = getattr(errno, "EADDRINUSE", _HAUSNUMERO + 5) + EADDRNOTAVAIL = getattr(errno, "EADDRNOTAVAIL", _HAUSNUMERO + 6) + ECONNREFUSED = getattr(errno, "ECONNREFUSED", _HAUSNUMERO + 7) + EINPROGRESS = getattr(errno, "EINPROGRESS", _HAUSNUMERO + 8) + ENOTSOCK = getattr(errno, "ENOTSOCK", _HAUSNUMERO + 9) + EMSGSIZE = getattr(errno, "EMSGSIZE", _HAUSNUMERO + 10) + EAFNOSUPPORT = getattr(errno, "EAFNOSUPPORT", _HAUSNUMERO + 11) + ENETUNREACH = getattr(errno, "ENETUNREACH", _HAUSNUMERO + 12) + ECONNABORTED = getattr(errno, "ECONNABORTED", _HAUSNUMERO + 13) + ECONNRESET = getattr(errno, "ECONNRESET", _HAUSNUMERO + 14) + ENOTCONN = getattr(errno, "ENOTCONN", _HAUSNUMERO + 15) + ETIMEDOUT = getattr(errno, "ETIMEDOUT", _HAUSNUMERO + 16) + EHOSTUNREACH = getattr(errno, "EHOSTUNREACH", _HAUSNUMERO + 17) + ENETRESET = getattr(errno, "ENETRESET", _HAUSNUMERO + 18) + + # Native 0MQ error codes + EFSM = _HAUSNUMERO + 51 + ENOCOMPATPROTO = _HAUSNUMERO + 52 + ETERM = _HAUSNUMERO + 53 + EMTHREAD = _HAUSNUMERO + 54 + + +class ContextOption(IntEnum): + """Options for Context.get/set + + .. versionadded:: 23 + """ + + IO_THREADS = 1 + MAX_SOCKETS = 2 + SOCKET_LIMIT = 3 + THREAD_PRIORITY = 3 + THREAD_SCHED_POLICY = 4 + MAX_MSGSZ = 5 + MSG_T_SIZE = 6 + THREAD_AFFINITY_CPU_ADD = 7 + THREAD_AFFINITY_CPU_REMOVE = 8 + THREAD_NAME_PREFIX = 9 + + +class SocketType(IntEnum): + """zmq socket types + + .. versionadded:: 23 + """ + + PAIR = 0 + PUB = 1 + SUB = 2 + REQ = 3 + REP = 4 + DEALER = 5 + ROUTER = 6 + PULL = 7 + PUSH = 8 + XPUB = 9 + XSUB = 10 + STREAM = 11 + + # deprecated aliases + XREQ = DEALER + XREP = ROUTER + + # DRAFT socket types + SERVER = 12 + CLIENT = 13 + RADIO = 14 + DISH = 15 + GATHER = 16 + SCATTER = 17 + DGRAM = 18 + PEER = 19 + CHANNEL = 20 + + +class _OptType(Enum): + int = 'int' + int64 = 'int64' + bytes = 'bytes' + fd = 'fd' + + +class SocketOption(IntEnum): + """Options for Socket.get/set + + .. versionadded:: 23 + """ + + _opt_type: _OptType + + def __new__(cls, value: int, opt_type: _OptType = _OptType.int): + """Attach option type as `._opt_type`""" + obj = int.__new__(cls, value) + obj._value_ = value + obj._opt_type = opt_type + return obj + + HWM = 1 + AFFINITY = 4, _OptType.int64 + ROUTING_ID = 5, _OptType.bytes + SUBSCRIBE = 6, _OptType.bytes + UNSUBSCRIBE = 7, _OptType.bytes + RATE = 8 + RECOVERY_IVL = 9 + SNDBUF = 11 + RCVBUF = 12 + RCVMORE = 13 + FD = 14, _OptType.fd + EVENTS = 15 + TYPE = 16 + LINGER = 17 + RECONNECT_IVL = 18 + BACKLOG = 19 + RECONNECT_IVL_MAX = 21 + MAXMSGSIZE = 22, _OptType.int64 + SNDHWM = 23 + RCVHWM = 24 + MULTICAST_HOPS = 25 + RCVTIMEO = 27 + SNDTIMEO = 28 + LAST_ENDPOINT = 32, _OptType.bytes + ROUTER_MANDATORY = 33 + TCP_KEEPALIVE = 34 + TCP_KEEPALIVE_CNT = 35 + TCP_KEEPALIVE_IDLE = 36 + TCP_KEEPALIVE_INTVL = 37 + IMMEDIATE = 39 + XPUB_VERBOSE = 40 + ROUTER_RAW = 41 + IPV6 = 42 + MECHANISM = 43 + PLAIN_SERVER = 44 + PLAIN_USERNAME = 45, _OptType.bytes + PLAIN_PASSWORD = 46, _OptType.bytes + CURVE_SERVER = 47 + CURVE_PUBLICKEY = 48, _OptType.bytes + CURVE_SECRETKEY = 49, _OptType.bytes + CURVE_SERVERKEY = 50, _OptType.bytes + PROBE_ROUTER = 51 + REQ_CORRELATE = 52 + REQ_RELAXED = 53 + CONFLATE = 54 + ZAP_DOMAIN = 55, _OptType.bytes + ROUTER_HANDOVER = 56 + TOS = 57 + CONNECT_ROUTING_ID = 61, _OptType.bytes + GSSAPI_SERVER = 62 + GSSAPI_PRINCIPAL = 63, _OptType.bytes + GSSAPI_SERVICE_PRINCIPAL = 64, _OptType.bytes + GSSAPI_PLAINTEXT = 65 + HANDSHAKE_IVL = 66 + SOCKS_PROXY = 68, _OptType.bytes + XPUB_NODROP = 69 + BLOCKY = 70 + XPUB_MANUAL = 71 + XPUB_WELCOME_MSG = 72, _OptType.bytes + STREAM_NOTIFY = 73 + INVERT_MATCHING = 74 + HEARTBEAT_IVL = 75 + HEARTBEAT_TTL = 76 + HEARTBEAT_TIMEOUT = 77 + XPUB_VERBOSER = 78 + CONNECT_TIMEOUT = 79 + TCP_MAXRT = 80 + THREAD_SAFE = 81 + MULTICAST_MAXTPDU = 84 + VMCI_BUFFER_SIZE = 85, _OptType.int64 + VMCI_BUFFER_MIN_SIZE = 86, _OptType.int64 + VMCI_BUFFER_MAX_SIZE = 87, _OptType.int64 + VMCI_CONNECT_TIMEOUT = 88 + USE_FD = 89 + GSSAPI_PRINCIPAL_NAMETYPE = 90 + GSSAPI_SERVICE_PRINCIPAL_NAMETYPE = 91 + BINDTODEVICE = 92, _OptType.bytes + + # Deprecated options and aliases + # must not use name-assignment, must have the same value + IDENTITY = ROUTING_ID + CONNECT_RID = CONNECT_ROUTING_ID + TCP_ACCEPT_FILTER = 38, _OptType.bytes + IPC_FILTER_PID = 58 + IPC_FILTER_UID = 59 + IPC_FILTER_GID = 60 + IPV4ONLY = 31 + DELAY_ATTACH_ON_CONNECT = IMMEDIATE + FAIL_UNROUTABLE = ROUTER_MANDATORY + ROUTER_BEHAVIOR = ROUTER_MANDATORY + + # Draft socket options + ZAP_ENFORCE_DOMAIN = 93 + LOOPBACK_FASTPATH = 94 + METADATA = 95, _OptType.bytes + MULTICAST_LOOP = 96 + ROUTER_NOTIFY = 97 + XPUB_MANUAL_LAST_VALUE = 98 + SOCKS_USERNAME = 99, _OptType.bytes + SOCKS_PASSWORD = 100, _OptType.bytes + IN_BATCH_SIZE = 101 + OUT_BATCH_SIZE = 102 + WSS_KEY_PEM = 103, _OptType.bytes + WSS_CERT_PEM = 104, _OptType.bytes + WSS_TRUST_PEM = 105, _OptType.bytes + WSS_HOSTNAME = 106, _OptType.bytes + WSS_TRUST_SYSTEM = 107 + ONLY_FIRST_SUBSCRIBE = 108 + RECONNECT_STOP = 109 + HELLO_MSG = 110, _OptType.bytes + DISCONNECT_MSG = 111, _OptType.bytes + PRIORITY = 112 + # 4.3.5 + BUSY_POLL = 113 + HICCUP_MSG = 114, _OptType.bytes + XSUB_VERBOSE_UNSUBSCRIBE = 115 + TOPICS_COUNT = 116 + NORM_MODE = 117 + NORM_UNICAST_NACK = 118 + NORM_BUFFER_SIZE = 119 + NORM_SEGMENT_SIZE = 120 + NORM_BLOCK_SIZE = 121 + NORM_NUM_PARITY = 122 + NORM_NUM_AUTOPARITY = 123 + NORM_PUSH = 124 + + +class MessageOption(IntEnum): + """Options on zmq.Frame objects + + .. versionadded:: 23 + """ + + MORE = 1 + SHARED = 3 + # Deprecated message options + SRCFD = 2 + + +class Flag(IntFlag): + """Send/recv flags + + .. versionadded:: 23 + """ + + DONTWAIT = 1 + SNDMORE = 2 + NOBLOCK = DONTWAIT + + +class RouterNotify(IntEnum): + """Values for zmq.ROUTER_NOTIFY socket option + + .. versionadded:: 26 + .. versionadded:: libzmq-4.3.0 (draft) + """ + + @staticmethod + def _global_name(name): + return f"NOTIFY_{name}" + + CONNECT = 1 + DISCONNECT = 2 + + +class NormMode(IntEnum): + """Values for zmq.NORM_MODE socket option + + .. versionadded:: 26 + .. versionadded:: libzmq-4.3.5 (draft) + """ + + @staticmethod + def _global_name(name): + return f"NORM_{name}" + + FIXED = 0 + CC = 1 + CCL = 2 + CCE = 3 + CCE_ECNONLY = 4 + + +class SecurityMechanism(IntEnum): + """Security mechanisms (as returned by ``socket.get(zmq.MECHANISM)``) + + .. versionadded:: 23 + """ + + NULL = 0 + PLAIN = 1 + CURVE = 2 + GSSAPI = 3 + + +class ReconnectStop(IntEnum): + """Select behavior for socket.reconnect_stop + + .. versionadded:: 25 + """ + + @staticmethod + def _global_name(name): + return f"RECONNECT_STOP_{name}" + + CONN_REFUSED = 0x1 + HANDSHAKE_FAILED = 0x2 + AFTER_DISCONNECT = 0x4 + + +class Event(IntFlag): + """Socket monitoring events + + .. versionadded:: 23 + """ + + @staticmethod + def _global_name(name): + if name.startswith("PROTOCOL_ERROR_"): + return name + else: + # add EVENT_ prefix + return "EVENT_" + name + + PROTOCOL_ERROR_WS_UNSPECIFIED = 0x30000000 + PROTOCOL_ERROR_ZMTP_UNSPECIFIED = 0x10000000 + PROTOCOL_ERROR_ZMTP_UNEXPECTED_COMMAND = 0x10000001 + PROTOCOL_ERROR_ZMTP_INVALID_SEQUENCE = 0x10000002 + PROTOCOL_ERROR_ZMTP_KEY_EXCHANGE = 0x10000003 + PROTOCOL_ERROR_ZMTP_MALFORMED_COMMAND_UNSPECIFIED = 0x10000011 + PROTOCOL_ERROR_ZMTP_MALFORMED_COMMAND_MESSAGE = 0x10000012 + PROTOCOL_ERROR_ZMTP_MALFORMED_COMMAND_HELLO = 0x10000013 + PROTOCOL_ERROR_ZMTP_MALFORMED_COMMAND_INITIATE = 0x10000014 + PROTOCOL_ERROR_ZMTP_MALFORMED_COMMAND_ERROR = 0x10000015 + PROTOCOL_ERROR_ZMTP_MALFORMED_COMMAND_READY = 0x10000016 + PROTOCOL_ERROR_ZMTP_MALFORMED_COMMAND_WELCOME = 0x10000017 + PROTOCOL_ERROR_ZMTP_INVALID_METADATA = 0x10000018 + + PROTOCOL_ERROR_ZMTP_CRYPTOGRAPHIC = 0x11000001 + PROTOCOL_ERROR_ZMTP_MECHANISM_MISMATCH = 0x11000002 + PROTOCOL_ERROR_ZAP_UNSPECIFIED = 0x20000000 + PROTOCOL_ERROR_ZAP_MALFORMED_REPLY = 0x20000001 + PROTOCOL_ERROR_ZAP_BAD_REQUEST_ID = 0x20000002 + PROTOCOL_ERROR_ZAP_BAD_VERSION = 0x20000003 + PROTOCOL_ERROR_ZAP_INVALID_STATUS_CODE = 0x20000004 + PROTOCOL_ERROR_ZAP_INVALID_METADATA = 0x20000005 + + # define event types _after_ overlapping protocol error masks + CONNECTED = 0x0001 + CONNECT_DELAYED = 0x0002 + CONNECT_RETRIED = 0x0004 + LISTENING = 0x0008 + BIND_FAILED = 0x0010 + ACCEPTED = 0x0020 + ACCEPT_FAILED = 0x0040 + CLOSED = 0x0080 + CLOSE_FAILED = 0x0100 + DISCONNECTED = 0x0200 + MONITOR_STOPPED = 0x0400 + + HANDSHAKE_FAILED_NO_DETAIL = 0x0800 + HANDSHAKE_SUCCEEDED = 0x1000 + HANDSHAKE_FAILED_PROTOCOL = 0x2000 + HANDSHAKE_FAILED_AUTH = 0x4000 + + ALL_V1 = 0xFFFF + ALL = ALL_V1 + + # DRAFT Socket monitoring events + PIPES_STATS = 0x10000 + ALL_V2 = ALL_V1 | PIPES_STATS + + +class PollEvent(IntFlag): + """Which events to poll for in poll methods + + .. versionadded: 23 + """ + + POLLIN = 1 + POLLOUT = 2 + POLLERR = 4 + POLLPRI = 8 + + +class DeviceType(IntEnum): + """Device type constants for zmq.device + + .. versionadded: 23 + """ + + STREAMER = 1 + FORWARDER = 2 + QUEUE = 3 + + +# AUTOGENERATED_BELOW_HERE + + +IO_THREADS: int = ContextOption.IO_THREADS +MAX_SOCKETS: int = ContextOption.MAX_SOCKETS +SOCKET_LIMIT: int = ContextOption.SOCKET_LIMIT +THREAD_PRIORITY: int = ContextOption.THREAD_PRIORITY +THREAD_SCHED_POLICY: int = ContextOption.THREAD_SCHED_POLICY +MAX_MSGSZ: int = ContextOption.MAX_MSGSZ +MSG_T_SIZE: int = ContextOption.MSG_T_SIZE +THREAD_AFFINITY_CPU_ADD: int = ContextOption.THREAD_AFFINITY_CPU_ADD +THREAD_AFFINITY_CPU_REMOVE: int = ContextOption.THREAD_AFFINITY_CPU_REMOVE +THREAD_NAME_PREFIX: int = ContextOption.THREAD_NAME_PREFIX +STREAMER: int = DeviceType.STREAMER +FORWARDER: int = DeviceType.FORWARDER +QUEUE: int = DeviceType.QUEUE +EAGAIN: int = Errno.EAGAIN +EFAULT: int = Errno.EFAULT +EINVAL: int = Errno.EINVAL +ENOTSUP: int = Errno.ENOTSUP +EPROTONOSUPPORT: int = Errno.EPROTONOSUPPORT +ENOBUFS: int = Errno.ENOBUFS +ENETDOWN: int = Errno.ENETDOWN +EADDRINUSE: int = Errno.EADDRINUSE +EADDRNOTAVAIL: int = Errno.EADDRNOTAVAIL +ECONNREFUSED: int = Errno.ECONNREFUSED +EINPROGRESS: int = Errno.EINPROGRESS +ENOTSOCK: int = Errno.ENOTSOCK +EMSGSIZE: int = Errno.EMSGSIZE +EAFNOSUPPORT: int = Errno.EAFNOSUPPORT +ENETUNREACH: int = Errno.ENETUNREACH +ECONNABORTED: int = Errno.ECONNABORTED +ECONNRESET: int = Errno.ECONNRESET +ENOTCONN: int = Errno.ENOTCONN +ETIMEDOUT: int = Errno.ETIMEDOUT +EHOSTUNREACH: int = Errno.EHOSTUNREACH +ENETRESET: int = Errno.ENETRESET +EFSM: int = Errno.EFSM +ENOCOMPATPROTO: int = Errno.ENOCOMPATPROTO +ETERM: int = Errno.ETERM +EMTHREAD: int = Errno.EMTHREAD +PROTOCOL_ERROR_WS_UNSPECIFIED: int = Event.PROTOCOL_ERROR_WS_UNSPECIFIED +PROTOCOL_ERROR_ZMTP_UNSPECIFIED: int = Event.PROTOCOL_ERROR_ZMTP_UNSPECIFIED +PROTOCOL_ERROR_ZMTP_UNEXPECTED_COMMAND: int = ( + Event.PROTOCOL_ERROR_ZMTP_UNEXPECTED_COMMAND +) +PROTOCOL_ERROR_ZMTP_INVALID_SEQUENCE: int = Event.PROTOCOL_ERROR_ZMTP_INVALID_SEQUENCE +PROTOCOL_ERROR_ZMTP_KEY_EXCHANGE: int = Event.PROTOCOL_ERROR_ZMTP_KEY_EXCHANGE +PROTOCOL_ERROR_ZMTP_MALFORMED_COMMAND_UNSPECIFIED: int = ( + Event.PROTOCOL_ERROR_ZMTP_MALFORMED_COMMAND_UNSPECIFIED +) +PROTOCOL_ERROR_ZMTP_MALFORMED_COMMAND_MESSAGE: int = ( + Event.PROTOCOL_ERROR_ZMTP_MALFORMED_COMMAND_MESSAGE +) +PROTOCOL_ERROR_ZMTP_MALFORMED_COMMAND_HELLO: int = ( + Event.PROTOCOL_ERROR_ZMTP_MALFORMED_COMMAND_HELLO +) +PROTOCOL_ERROR_ZMTP_MALFORMED_COMMAND_INITIATE: int = ( + Event.PROTOCOL_ERROR_ZMTP_MALFORMED_COMMAND_INITIATE +) +PROTOCOL_ERROR_ZMTP_MALFORMED_COMMAND_ERROR: int = ( + Event.PROTOCOL_ERROR_ZMTP_MALFORMED_COMMAND_ERROR +) +PROTOCOL_ERROR_ZMTP_MALFORMED_COMMAND_READY: int = ( + Event.PROTOCOL_ERROR_ZMTP_MALFORMED_COMMAND_READY +) +PROTOCOL_ERROR_ZMTP_MALFORMED_COMMAND_WELCOME: int = ( + Event.PROTOCOL_ERROR_ZMTP_MALFORMED_COMMAND_WELCOME +) +PROTOCOL_ERROR_ZMTP_INVALID_METADATA: int = Event.PROTOCOL_ERROR_ZMTP_INVALID_METADATA +PROTOCOL_ERROR_ZMTP_CRYPTOGRAPHIC: int = Event.PROTOCOL_ERROR_ZMTP_CRYPTOGRAPHIC +PROTOCOL_ERROR_ZMTP_MECHANISM_MISMATCH: int = ( + Event.PROTOCOL_ERROR_ZMTP_MECHANISM_MISMATCH +) +PROTOCOL_ERROR_ZAP_UNSPECIFIED: int = Event.PROTOCOL_ERROR_ZAP_UNSPECIFIED +PROTOCOL_ERROR_ZAP_MALFORMED_REPLY: int = Event.PROTOCOL_ERROR_ZAP_MALFORMED_REPLY +PROTOCOL_ERROR_ZAP_BAD_REQUEST_ID: int = Event.PROTOCOL_ERROR_ZAP_BAD_REQUEST_ID +PROTOCOL_ERROR_ZAP_BAD_VERSION: int = Event.PROTOCOL_ERROR_ZAP_BAD_VERSION +PROTOCOL_ERROR_ZAP_INVALID_STATUS_CODE: int = ( + Event.PROTOCOL_ERROR_ZAP_INVALID_STATUS_CODE +) +PROTOCOL_ERROR_ZAP_INVALID_METADATA: int = Event.PROTOCOL_ERROR_ZAP_INVALID_METADATA +EVENT_CONNECTED: int = Event.CONNECTED +EVENT_CONNECT_DELAYED: int = Event.CONNECT_DELAYED +EVENT_CONNECT_RETRIED: int = Event.CONNECT_RETRIED +EVENT_LISTENING: int = Event.LISTENING +EVENT_BIND_FAILED: int = Event.BIND_FAILED +EVENT_ACCEPTED: int = Event.ACCEPTED +EVENT_ACCEPT_FAILED: int = Event.ACCEPT_FAILED +EVENT_CLOSED: int = Event.CLOSED +EVENT_CLOSE_FAILED: int = Event.CLOSE_FAILED +EVENT_DISCONNECTED: int = Event.DISCONNECTED +EVENT_MONITOR_STOPPED: int = Event.MONITOR_STOPPED +EVENT_HANDSHAKE_FAILED_NO_DETAIL: int = Event.HANDSHAKE_FAILED_NO_DETAIL +EVENT_HANDSHAKE_SUCCEEDED: int = Event.HANDSHAKE_SUCCEEDED +EVENT_HANDSHAKE_FAILED_PROTOCOL: int = Event.HANDSHAKE_FAILED_PROTOCOL +EVENT_HANDSHAKE_FAILED_AUTH: int = Event.HANDSHAKE_FAILED_AUTH +EVENT_ALL_V1: int = Event.ALL_V1 +EVENT_ALL: int = Event.ALL +EVENT_PIPES_STATS: int = Event.PIPES_STATS +EVENT_ALL_V2: int = Event.ALL_V2 +DONTWAIT: int = Flag.DONTWAIT +SNDMORE: int = Flag.SNDMORE +NOBLOCK: int = Flag.NOBLOCK +MORE: int = MessageOption.MORE +SHARED: int = MessageOption.SHARED +SRCFD: int = MessageOption.SRCFD +NORM_FIXED: int = NormMode.FIXED +NORM_CC: int = NormMode.CC +NORM_CCL: int = NormMode.CCL +NORM_CCE: int = NormMode.CCE +NORM_CCE_ECNONLY: int = NormMode.CCE_ECNONLY +POLLIN: int = PollEvent.POLLIN +POLLOUT: int = PollEvent.POLLOUT +POLLERR: int = PollEvent.POLLERR +POLLPRI: int = PollEvent.POLLPRI +RECONNECT_STOP_CONN_REFUSED: int = ReconnectStop.CONN_REFUSED +RECONNECT_STOP_HANDSHAKE_FAILED: int = ReconnectStop.HANDSHAKE_FAILED +RECONNECT_STOP_AFTER_DISCONNECT: int = ReconnectStop.AFTER_DISCONNECT +NOTIFY_CONNECT: int = RouterNotify.CONNECT +NOTIFY_DISCONNECT: int = RouterNotify.DISCONNECT +NULL: int = SecurityMechanism.NULL +PLAIN: int = SecurityMechanism.PLAIN +CURVE: int = SecurityMechanism.CURVE +GSSAPI: int = SecurityMechanism.GSSAPI +HWM: int = SocketOption.HWM +AFFINITY: int = SocketOption.AFFINITY +ROUTING_ID: int = SocketOption.ROUTING_ID +SUBSCRIBE: int = SocketOption.SUBSCRIBE +UNSUBSCRIBE: int = SocketOption.UNSUBSCRIBE +RATE: int = SocketOption.RATE +RECOVERY_IVL: int = SocketOption.RECOVERY_IVL +SNDBUF: int = SocketOption.SNDBUF +RCVBUF: int = SocketOption.RCVBUF +RCVMORE: int = SocketOption.RCVMORE +FD: int = SocketOption.FD +EVENTS: int = SocketOption.EVENTS +TYPE: int = SocketOption.TYPE +LINGER: int = SocketOption.LINGER +RECONNECT_IVL: int = SocketOption.RECONNECT_IVL +BACKLOG: int = SocketOption.BACKLOG +RECONNECT_IVL_MAX: int = SocketOption.RECONNECT_IVL_MAX +MAXMSGSIZE: int = SocketOption.MAXMSGSIZE +SNDHWM: int = SocketOption.SNDHWM +RCVHWM: int = SocketOption.RCVHWM +MULTICAST_HOPS: int = SocketOption.MULTICAST_HOPS +RCVTIMEO: int = SocketOption.RCVTIMEO +SNDTIMEO: int = SocketOption.SNDTIMEO +LAST_ENDPOINT: int = SocketOption.LAST_ENDPOINT +ROUTER_MANDATORY: int = SocketOption.ROUTER_MANDATORY +TCP_KEEPALIVE: int = SocketOption.TCP_KEEPALIVE +TCP_KEEPALIVE_CNT: int = SocketOption.TCP_KEEPALIVE_CNT +TCP_KEEPALIVE_IDLE: int = SocketOption.TCP_KEEPALIVE_IDLE +TCP_KEEPALIVE_INTVL: int = SocketOption.TCP_KEEPALIVE_INTVL +IMMEDIATE: int = SocketOption.IMMEDIATE +XPUB_VERBOSE: int = SocketOption.XPUB_VERBOSE +ROUTER_RAW: int = SocketOption.ROUTER_RAW +IPV6: int = SocketOption.IPV6 +MECHANISM: int = SocketOption.MECHANISM +PLAIN_SERVER: int = SocketOption.PLAIN_SERVER +PLAIN_USERNAME: int = SocketOption.PLAIN_USERNAME +PLAIN_PASSWORD: int = SocketOption.PLAIN_PASSWORD +CURVE_SERVER: int = SocketOption.CURVE_SERVER +CURVE_PUBLICKEY: int = SocketOption.CURVE_PUBLICKEY +CURVE_SECRETKEY: int = SocketOption.CURVE_SECRETKEY +CURVE_SERVERKEY: int = SocketOption.CURVE_SERVERKEY +PROBE_ROUTER: int = SocketOption.PROBE_ROUTER +REQ_CORRELATE: int = SocketOption.REQ_CORRELATE +REQ_RELAXED: int = SocketOption.REQ_RELAXED +CONFLATE: int = SocketOption.CONFLATE +ZAP_DOMAIN: int = SocketOption.ZAP_DOMAIN +ROUTER_HANDOVER: int = SocketOption.ROUTER_HANDOVER +TOS: int = SocketOption.TOS +CONNECT_ROUTING_ID: int = SocketOption.CONNECT_ROUTING_ID +GSSAPI_SERVER: int = SocketOption.GSSAPI_SERVER +GSSAPI_PRINCIPAL: int = SocketOption.GSSAPI_PRINCIPAL +GSSAPI_SERVICE_PRINCIPAL: int = SocketOption.GSSAPI_SERVICE_PRINCIPAL +GSSAPI_PLAINTEXT: int = SocketOption.GSSAPI_PLAINTEXT +HANDSHAKE_IVL: int = SocketOption.HANDSHAKE_IVL +SOCKS_PROXY: int = SocketOption.SOCKS_PROXY +XPUB_NODROP: int = SocketOption.XPUB_NODROP +BLOCKY: int = SocketOption.BLOCKY +XPUB_MANUAL: int = SocketOption.XPUB_MANUAL +XPUB_WELCOME_MSG: int = SocketOption.XPUB_WELCOME_MSG +STREAM_NOTIFY: int = SocketOption.STREAM_NOTIFY +INVERT_MATCHING: int = SocketOption.INVERT_MATCHING +HEARTBEAT_IVL: int = SocketOption.HEARTBEAT_IVL +HEARTBEAT_TTL: int = SocketOption.HEARTBEAT_TTL +HEARTBEAT_TIMEOUT: int = SocketOption.HEARTBEAT_TIMEOUT +XPUB_VERBOSER: int = SocketOption.XPUB_VERBOSER +CONNECT_TIMEOUT: int = SocketOption.CONNECT_TIMEOUT +TCP_MAXRT: int = SocketOption.TCP_MAXRT +THREAD_SAFE: int = SocketOption.THREAD_SAFE +MULTICAST_MAXTPDU: int = SocketOption.MULTICAST_MAXTPDU +VMCI_BUFFER_SIZE: int = SocketOption.VMCI_BUFFER_SIZE +VMCI_BUFFER_MIN_SIZE: int = SocketOption.VMCI_BUFFER_MIN_SIZE +VMCI_BUFFER_MAX_SIZE: int = SocketOption.VMCI_BUFFER_MAX_SIZE +VMCI_CONNECT_TIMEOUT: int = SocketOption.VMCI_CONNECT_TIMEOUT +USE_FD: int = SocketOption.USE_FD +GSSAPI_PRINCIPAL_NAMETYPE: int = SocketOption.GSSAPI_PRINCIPAL_NAMETYPE +GSSAPI_SERVICE_PRINCIPAL_NAMETYPE: int = SocketOption.GSSAPI_SERVICE_PRINCIPAL_NAMETYPE +BINDTODEVICE: int = SocketOption.BINDTODEVICE +IDENTITY: int = SocketOption.IDENTITY +CONNECT_RID: int = SocketOption.CONNECT_RID +TCP_ACCEPT_FILTER: int = SocketOption.TCP_ACCEPT_FILTER +IPC_FILTER_PID: int = SocketOption.IPC_FILTER_PID +IPC_FILTER_UID: int = SocketOption.IPC_FILTER_UID +IPC_FILTER_GID: int = SocketOption.IPC_FILTER_GID +IPV4ONLY: int = SocketOption.IPV4ONLY +DELAY_ATTACH_ON_CONNECT: int = SocketOption.DELAY_ATTACH_ON_CONNECT +FAIL_UNROUTABLE: int = SocketOption.FAIL_UNROUTABLE +ROUTER_BEHAVIOR: int = SocketOption.ROUTER_BEHAVIOR +ZAP_ENFORCE_DOMAIN: int = SocketOption.ZAP_ENFORCE_DOMAIN +LOOPBACK_FASTPATH: int = SocketOption.LOOPBACK_FASTPATH +METADATA: int = SocketOption.METADATA +MULTICAST_LOOP: int = SocketOption.MULTICAST_LOOP +ROUTER_NOTIFY: int = SocketOption.ROUTER_NOTIFY +XPUB_MANUAL_LAST_VALUE: int = SocketOption.XPUB_MANUAL_LAST_VALUE +SOCKS_USERNAME: int = SocketOption.SOCKS_USERNAME +SOCKS_PASSWORD: int = SocketOption.SOCKS_PASSWORD +IN_BATCH_SIZE: int = SocketOption.IN_BATCH_SIZE +OUT_BATCH_SIZE: int = SocketOption.OUT_BATCH_SIZE +WSS_KEY_PEM: int = SocketOption.WSS_KEY_PEM +WSS_CERT_PEM: int = SocketOption.WSS_CERT_PEM +WSS_TRUST_PEM: int = SocketOption.WSS_TRUST_PEM +WSS_HOSTNAME: int = SocketOption.WSS_HOSTNAME +WSS_TRUST_SYSTEM: int = SocketOption.WSS_TRUST_SYSTEM +ONLY_FIRST_SUBSCRIBE: int = SocketOption.ONLY_FIRST_SUBSCRIBE +RECONNECT_STOP: int = SocketOption.RECONNECT_STOP +HELLO_MSG: int = SocketOption.HELLO_MSG +DISCONNECT_MSG: int = SocketOption.DISCONNECT_MSG +PRIORITY: int = SocketOption.PRIORITY +BUSY_POLL: int = SocketOption.BUSY_POLL +HICCUP_MSG: int = SocketOption.HICCUP_MSG +XSUB_VERBOSE_UNSUBSCRIBE: int = SocketOption.XSUB_VERBOSE_UNSUBSCRIBE +TOPICS_COUNT: int = SocketOption.TOPICS_COUNT +NORM_MODE: int = SocketOption.NORM_MODE +NORM_UNICAST_NACK: int = SocketOption.NORM_UNICAST_NACK +NORM_BUFFER_SIZE: int = SocketOption.NORM_BUFFER_SIZE +NORM_SEGMENT_SIZE: int = SocketOption.NORM_SEGMENT_SIZE +NORM_BLOCK_SIZE: int = SocketOption.NORM_BLOCK_SIZE +NORM_NUM_PARITY: int = SocketOption.NORM_NUM_PARITY +NORM_NUM_AUTOPARITY: int = SocketOption.NORM_NUM_AUTOPARITY +NORM_PUSH: int = SocketOption.NORM_PUSH +PAIR: int = SocketType.PAIR +PUB: int = SocketType.PUB +SUB: int = SocketType.SUB +REQ: int = SocketType.REQ +REP: int = SocketType.REP +DEALER: int = SocketType.DEALER +ROUTER: int = SocketType.ROUTER +PULL: int = SocketType.PULL +PUSH: int = SocketType.PUSH +XPUB: int = SocketType.XPUB +XSUB: int = SocketType.XSUB +STREAM: int = SocketType.STREAM +XREQ: int = SocketType.XREQ +XREP: int = SocketType.XREP +SERVER: int = SocketType.SERVER +CLIENT: int = SocketType.CLIENT +RADIO: int = SocketType.RADIO +DISH: int = SocketType.DISH +GATHER: int = SocketType.GATHER +SCATTER: int = SocketType.SCATTER +DGRAM: int = SocketType.DGRAM +PEER: int = SocketType.PEER +CHANNEL: int = SocketType.CHANNEL + +__all__: list[str] = [ + "ContextOption", + "IO_THREADS", + "MAX_SOCKETS", + "SOCKET_LIMIT", + "THREAD_PRIORITY", + "THREAD_SCHED_POLICY", + "MAX_MSGSZ", + "MSG_T_SIZE", + "THREAD_AFFINITY_CPU_ADD", + "THREAD_AFFINITY_CPU_REMOVE", + "THREAD_NAME_PREFIX", + "DeviceType", + "STREAMER", + "FORWARDER", + "QUEUE", + "Enum", + "Errno", + "EAGAIN", + "EFAULT", + "EINVAL", + "ENOTSUP", + "EPROTONOSUPPORT", + "ENOBUFS", + "ENETDOWN", + "EADDRINUSE", + "EADDRNOTAVAIL", + "ECONNREFUSED", + "EINPROGRESS", + "ENOTSOCK", + "EMSGSIZE", + "EAFNOSUPPORT", + "ENETUNREACH", + "ECONNABORTED", + "ECONNRESET", + "ENOTCONN", + "ETIMEDOUT", + "EHOSTUNREACH", + "ENETRESET", + "EFSM", + "ENOCOMPATPROTO", + "ETERM", + "EMTHREAD", + "Event", + "PROTOCOL_ERROR_WS_UNSPECIFIED", + "PROTOCOL_ERROR_ZMTP_UNSPECIFIED", + "PROTOCOL_ERROR_ZMTP_UNEXPECTED_COMMAND", + "PROTOCOL_ERROR_ZMTP_INVALID_SEQUENCE", + "PROTOCOL_ERROR_ZMTP_KEY_EXCHANGE", + "PROTOCOL_ERROR_ZMTP_MALFORMED_COMMAND_UNSPECIFIED", + "PROTOCOL_ERROR_ZMTP_MALFORMED_COMMAND_MESSAGE", + "PROTOCOL_ERROR_ZMTP_MALFORMED_COMMAND_HELLO", + "PROTOCOL_ERROR_ZMTP_MALFORMED_COMMAND_INITIATE", + "PROTOCOL_ERROR_ZMTP_MALFORMED_COMMAND_ERROR", + "PROTOCOL_ERROR_ZMTP_MALFORMED_COMMAND_READY", + "PROTOCOL_ERROR_ZMTP_MALFORMED_COMMAND_WELCOME", + "PROTOCOL_ERROR_ZMTP_INVALID_METADATA", + "PROTOCOL_ERROR_ZMTP_CRYPTOGRAPHIC", + "PROTOCOL_ERROR_ZMTP_MECHANISM_MISMATCH", + "PROTOCOL_ERROR_ZAP_UNSPECIFIED", + "PROTOCOL_ERROR_ZAP_MALFORMED_REPLY", + "PROTOCOL_ERROR_ZAP_BAD_REQUEST_ID", + "PROTOCOL_ERROR_ZAP_BAD_VERSION", + "PROTOCOL_ERROR_ZAP_INVALID_STATUS_CODE", + "PROTOCOL_ERROR_ZAP_INVALID_METADATA", + "EVENT_CONNECTED", + "EVENT_CONNECT_DELAYED", + "EVENT_CONNECT_RETRIED", + "EVENT_LISTENING", + "EVENT_BIND_FAILED", + "EVENT_ACCEPTED", + "EVENT_ACCEPT_FAILED", + "EVENT_CLOSED", + "EVENT_CLOSE_FAILED", + "EVENT_DISCONNECTED", + "EVENT_MONITOR_STOPPED", + "EVENT_HANDSHAKE_FAILED_NO_DETAIL", + "EVENT_HANDSHAKE_SUCCEEDED", + "EVENT_HANDSHAKE_FAILED_PROTOCOL", + "EVENT_HANDSHAKE_FAILED_AUTH", + "EVENT_ALL_V1", + "EVENT_ALL", + "EVENT_PIPES_STATS", + "EVENT_ALL_V2", + "Flag", + "DONTWAIT", + "SNDMORE", + "NOBLOCK", + "IntEnum", + "IntFlag", + "MessageOption", + "MORE", + "SHARED", + "SRCFD", + "NormMode", + "NORM_FIXED", + "NORM_CC", + "NORM_CCL", + "NORM_CCE", + "NORM_CCE_ECNONLY", + "PollEvent", + "POLLIN", + "POLLOUT", + "POLLERR", + "POLLPRI", + "ReconnectStop", + "RECONNECT_STOP_CONN_REFUSED", + "RECONNECT_STOP_HANDSHAKE_FAILED", + "RECONNECT_STOP_AFTER_DISCONNECT", + "RouterNotify", + "NOTIFY_CONNECT", + "NOTIFY_DISCONNECT", + "SecurityMechanism", + "NULL", + "PLAIN", + "CURVE", + "GSSAPI", + "SocketOption", + "HWM", + "AFFINITY", + "ROUTING_ID", + "SUBSCRIBE", + "UNSUBSCRIBE", + "RATE", + "RECOVERY_IVL", + "SNDBUF", + "RCVBUF", + "RCVMORE", + "FD", + "EVENTS", + "TYPE", + "LINGER", + "RECONNECT_IVL", + "BACKLOG", + "RECONNECT_IVL_MAX", + "MAXMSGSIZE", + "SNDHWM", + "RCVHWM", + "MULTICAST_HOPS", + "RCVTIMEO", + "SNDTIMEO", + "LAST_ENDPOINT", + "ROUTER_MANDATORY", + "TCP_KEEPALIVE", + "TCP_KEEPALIVE_CNT", + "TCP_KEEPALIVE_IDLE", + "TCP_KEEPALIVE_INTVL", + "IMMEDIATE", + "XPUB_VERBOSE", + "ROUTER_RAW", + "IPV6", + "MECHANISM", + "PLAIN_SERVER", + "PLAIN_USERNAME", + "PLAIN_PASSWORD", + "CURVE_SERVER", + "CURVE_PUBLICKEY", + "CURVE_SECRETKEY", + "CURVE_SERVERKEY", + "PROBE_ROUTER", + "REQ_CORRELATE", + "REQ_RELAXED", + "CONFLATE", + "ZAP_DOMAIN", + "ROUTER_HANDOVER", + "TOS", + "CONNECT_ROUTING_ID", + "GSSAPI_SERVER", + "GSSAPI_PRINCIPAL", + "GSSAPI_SERVICE_PRINCIPAL", + "GSSAPI_PLAINTEXT", + "HANDSHAKE_IVL", + "SOCKS_PROXY", + "XPUB_NODROP", + "BLOCKY", + "XPUB_MANUAL", + "XPUB_WELCOME_MSG", + "STREAM_NOTIFY", + "INVERT_MATCHING", + "HEARTBEAT_IVL", + "HEARTBEAT_TTL", + "HEARTBEAT_TIMEOUT", + "XPUB_VERBOSER", + "CONNECT_TIMEOUT", + "TCP_MAXRT", + "THREAD_SAFE", + "MULTICAST_MAXTPDU", + "VMCI_BUFFER_SIZE", + "VMCI_BUFFER_MIN_SIZE", + "VMCI_BUFFER_MAX_SIZE", + "VMCI_CONNECT_TIMEOUT", + "USE_FD", + "GSSAPI_PRINCIPAL_NAMETYPE", + "GSSAPI_SERVICE_PRINCIPAL_NAMETYPE", + "BINDTODEVICE", + "IDENTITY", + "CONNECT_RID", + "TCP_ACCEPT_FILTER", + "IPC_FILTER_PID", + "IPC_FILTER_UID", + "IPC_FILTER_GID", + "IPV4ONLY", + "DELAY_ATTACH_ON_CONNECT", + "FAIL_UNROUTABLE", + "ROUTER_BEHAVIOR", + "ZAP_ENFORCE_DOMAIN", + "LOOPBACK_FASTPATH", + "METADATA", + "MULTICAST_LOOP", + "ROUTER_NOTIFY", + "XPUB_MANUAL_LAST_VALUE", + "SOCKS_USERNAME", + "SOCKS_PASSWORD", + "IN_BATCH_SIZE", + "OUT_BATCH_SIZE", + "WSS_KEY_PEM", + "WSS_CERT_PEM", + "WSS_TRUST_PEM", + "WSS_HOSTNAME", + "WSS_TRUST_SYSTEM", + "ONLY_FIRST_SUBSCRIBE", + "RECONNECT_STOP", + "HELLO_MSG", + "DISCONNECT_MSG", + "PRIORITY", + "BUSY_POLL", + "HICCUP_MSG", + "XSUB_VERBOSE_UNSUBSCRIBE", + "TOPICS_COUNT", + "NORM_MODE", + "NORM_UNICAST_NACK", + "NORM_BUFFER_SIZE", + "NORM_SEGMENT_SIZE", + "NORM_BLOCK_SIZE", + "NORM_NUM_PARITY", + "NORM_NUM_AUTOPARITY", + "NORM_PUSH", + "SocketType", + "PAIR", + "PUB", + "SUB", + "REQ", + "REP", + "DEALER", + "ROUTER", + "PULL", + "PUSH", + "XPUB", + "XSUB", + "STREAM", + "XREQ", + "XREP", + "SERVER", + "CLIENT", + "RADIO", + "DISH", + "GATHER", + "SCATTER", + "DGRAM", + "PEER", + "CHANNEL", +] diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/decorators.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/decorators.py new file mode 100644 index 0000000000000000000000000000000000000000..7cd80ebc764fb0b83146821ea85af3ce4aad8196 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/decorators.py @@ -0,0 +1,190 @@ +"""Decorators for running functions with context/sockets. + +.. versionadded:: 15.3 + +Like using Contexts and Sockets as context managers, but with decorator syntax. +Context and sockets are closed at the end of the function. + +For example:: + + from zmq.decorators import context, socket + + @context() + @socket(zmq.PUSH) + def work(ctx, push): + ... +""" + +from __future__ import annotations + +# Copyright (c) PyZMQ Developers. +# Distributed under the terms of the Modified BSD License. + +__all__ = ( + 'context', + 'socket', +) + +from functools import wraps + +import zmq + + +class _Decorator: + '''The mini decorator factory''' + + def __init__(self, target=None): + self._target = target + + def __call__(self, *dec_args, **dec_kwargs): + """ + The main logic of decorator + + Here is how those arguments works:: + + @out_decorator(*dec_args, *dec_kwargs) + def func(*wrap_args, **wrap_kwargs): + ... + + And in the ``wrapper``, we simply create ``self.target`` instance via + ``with``:: + + target = self.get_target(*args, **kwargs) + with target(*dec_args, **dec_kwargs) as obj: + ... + + """ + kw_name, dec_args, dec_kwargs = self.process_decorator_args( + *dec_args, **dec_kwargs + ) + + def decorator(func): + @wraps(func) + def wrapper(*args, **kwargs): + target = self.get_target(*args, **kwargs) + + with target(*dec_args, **dec_kwargs) as obj: + # insert our object into args + if kw_name and kw_name not in kwargs: + kwargs[kw_name] = obj + elif kw_name and kw_name in kwargs: + raise TypeError( + f"{func.__name__}() got multiple values for" + f" argument '{kw_name}'" + ) + else: + args = args + (obj,) + + return func(*args, **kwargs) + + return wrapper + + return decorator + + def get_target(self, *args, **kwargs): + """Return the target function + + Allows modifying args/kwargs to be passed. + """ + return self._target + + def process_decorator_args(self, *args, **kwargs): + """Process args passed to the decorator. + + args not consumed by the decorator will be passed to the target factory + (Context/Socket constructor). + """ + kw_name = None + + if isinstance(kwargs.get('name'), str): + kw_name = kwargs.pop('name') + elif len(args) >= 1 and isinstance(args[0], str): + kw_name = args[0] + args = args[1:] + + return kw_name, args, kwargs + + +class _ContextDecorator(_Decorator): + """Decorator subclass for Contexts""" + + def __init__(self): + super().__init__(zmq.Context) + + +class _SocketDecorator(_Decorator): + """Decorator subclass for sockets + + Gets the context from other args. + """ + + def process_decorator_args(self, *args, **kwargs): + """Also grab context_name out of kwargs""" + kw_name, args, kwargs = super().process_decorator_args(*args, **kwargs) + self.context_name = kwargs.pop('context_name', 'context') + return kw_name, args, kwargs + + def get_target(self, *args, **kwargs): + """Get context, based on call-time args""" + context = self._get_context(*args, **kwargs) + return context.socket + + def _get_context(self, *args, **kwargs): + """ + Find the ``zmq.Context`` from ``args`` and ``kwargs`` at call time. + + First, if there is an keyword argument named ``context`` and it is a + ``zmq.Context`` instance , we will take it. + + Second, we check all the ``args``, take the first ``zmq.Context`` + instance. + + Finally, we will provide default Context -- ``zmq.Context.instance`` + + :return: a ``zmq.Context`` instance + """ + if self.context_name in kwargs: + ctx = kwargs[self.context_name] + + if isinstance(ctx, zmq.Context): + return ctx + + for arg in args: + if isinstance(arg, zmq.Context): + return arg + # not specified by any decorator + return zmq.Context.instance() + + +def context(*args, **kwargs): + """Decorator for adding a Context to a function. + + Usage:: + + @context() + def foo(ctx): + ... + + .. versionadded:: 15.3 + + :param str name: the keyword argument passed to decorated function + """ + return _ContextDecorator()(*args, **kwargs) + + +def socket(*args, **kwargs): + """Decorator for adding a socket to a function. + + Usage:: + + @socket(zmq.PUSH) + def foo(push): + ... + + .. versionadded:: 15.3 + + :param str name: the keyword argument passed to decorated function + :param str context_name: the keyword only argument to identify context + object + """ + return _SocketDecorator()(*args, **kwargs) diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/devices/__init__.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/devices/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..a2ccf2aa471104cccb82fe55e91a14ce81e1b25a --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/devices/__init__.py @@ -0,0 +1,30 @@ +"""0MQ Device classes for running in background threads or processes.""" + +# Copyright (C) PyZMQ Developers +# Distributed under the terms of the Modified BSD License. + +from __future__ import annotations + +from zmq import DeviceType, proxy +from zmq.devices import ( + basedevice, + monitoredqueue, + monitoredqueuedevice, + proxydevice, + proxysteerabledevice, +) +from zmq.devices.basedevice import * +from zmq.devices.monitoredqueue import * +from zmq.devices.monitoredqueuedevice import * +from zmq.devices.proxydevice import * +from zmq.devices.proxysteerabledevice import * + +__all__ = [] +for submod in ( + basedevice, + proxydevice, + proxysteerabledevice, + monitoredqueue, + monitoredqueuedevice, +): + __all__.extend(submod.__all__) # type: ignore diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/devices/basedevice.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/devices/basedevice.py new file mode 100644 index 0000000000000000000000000000000000000000..5039fd70d03e9713beb6954016f4946e11052e75 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/devices/basedevice.py @@ -0,0 +1,310 @@ +"""Classes for running 0MQ Devices in the background.""" + +# Copyright (C) PyZMQ Developers +# Distributed under the terms of the Modified BSD License. + +import time +from multiprocessing import Process +from threading import Thread +from typing import Any, Callable, List, Optional, Tuple + +import zmq +from zmq import ENOTSOCK, ETERM, PUSH, QUEUE, Context, ZMQBindError, ZMQError, proxy + + +class Device: + """A 0MQ Device to be run in the background. + + You do not pass Socket instances to this, but rather Socket types:: + + Device(device_type, in_socket_type, out_socket_type) + + For instance:: + + dev = Device(zmq.QUEUE, zmq.DEALER, zmq.ROUTER) + + Similar to zmq.device, but socket types instead of sockets themselves are + passed, and the sockets are created in the work thread, to avoid issues + with thread safety. As a result, additional bind_{in|out} and + connect_{in|out} methods and setsockopt_{in|out} allow users to specify + connections for the sockets. + + Parameters + ---------- + device_type : int + The 0MQ Device type + {in|out}_type : int + zmq socket types, to be passed later to context.socket(). e.g. + zmq.PUB, zmq.SUB, zmq.REQ. If out_type is < 0, then in_socket is used + for both in_socket and out_socket. + + Methods + ------- + bind_{in_out}(iface) + passthrough for ``{in|out}_socket.bind(iface)``, to be called in the thread + connect_{in_out}(iface) + passthrough for ``{in|out}_socket.connect(iface)``, to be called in the + thread + setsockopt_{in_out}(opt,value) + passthrough for ``{in|out}_socket.setsockopt(opt, value)``, to be called in + the thread + + Attributes + ---------- + daemon : bool + sets whether the thread should be run as a daemon + Default is true, because if it is false, the thread will not + exit unless it is killed + context_factory : callable + This is a class attribute. + Function for creating the Context. This will be Context.instance + in ThreadDevices, and Context in ProcessDevices. The only reason + it is not instance() in ProcessDevices is that there may be a stale + Context instance already initialized, and the forked environment + should *never* try to use it. + """ + + context_factory: Callable[[], zmq.Context] = Context.instance + """Callable that returns a context. Typically either Context.instance or Context, + depending on whether the device should share the global instance or not. + """ + + daemon: bool + device_type: int + in_type: int + out_type: int + + _in_binds: List[str] + _in_connects: List[str] + _in_sockopts: List[Tuple[int, Any]] + _out_binds: List[str] + _out_connects: List[str] + _out_sockopts: List[Tuple[int, Any]] + _random_addrs: List[str] + _sockets: List[zmq.Socket] + + def __init__( + self, + device_type: int = QUEUE, + in_type: Optional[int] = None, + out_type: Optional[int] = None, + ) -> None: + self.device_type = device_type + if in_type is None: + raise TypeError("in_type must be specified") + if out_type is None: + raise TypeError("out_type must be specified") + self.in_type = in_type + self.out_type = out_type + self._in_binds = [] + self._in_connects = [] + self._in_sockopts = [] + self._out_binds = [] + self._out_connects = [] + self._out_sockopts = [] + self._random_addrs = [] + self.daemon = True + self.done = False + self._sockets = [] + + def bind_in(self, addr: str) -> None: + """Enqueue ZMQ address for binding on in_socket. + + See zmq.Socket.bind for details. + """ + self._in_binds.append(addr) + + def bind_in_to_random_port(self, addr: str, *args, **kwargs) -> int: + """Enqueue a random port on the given interface for binding on + in_socket. + + See zmq.Socket.bind_to_random_port for details. + + .. versionadded:: 18.0 + """ + port = self._reserve_random_port(addr, *args, **kwargs) + + self.bind_in(f'{addr}:{port}') + + return port + + def connect_in(self, addr: str) -> None: + """Enqueue ZMQ address for connecting on in_socket. + + See zmq.Socket.connect for details. + """ + self._in_connects.append(addr) + + def setsockopt_in(self, opt: int, value: Any) -> None: + """Enqueue setsockopt(opt, value) for in_socket + + See zmq.Socket.setsockopt for details. + """ + self._in_sockopts.append((opt, value)) + + def bind_out(self, addr: str) -> None: + """Enqueue ZMQ address for binding on out_socket. + + See zmq.Socket.bind for details. + """ + self._out_binds.append(addr) + + def bind_out_to_random_port(self, addr: str, *args, **kwargs) -> int: + """Enqueue a random port on the given interface for binding on + out_socket. + + See zmq.Socket.bind_to_random_port for details. + + .. versionadded:: 18.0 + """ + port = self._reserve_random_port(addr, *args, **kwargs) + + self.bind_out(f'{addr}:{port}') + + return port + + def connect_out(self, addr: str): + """Enqueue ZMQ address for connecting on out_socket. + + See zmq.Socket.connect for details. + """ + self._out_connects.append(addr) + + def setsockopt_out(self, opt: int, value: Any): + """Enqueue setsockopt(opt, value) for out_socket + + See zmq.Socket.setsockopt for details. + """ + self._out_sockopts.append((opt, value)) + + def _reserve_random_port(self, addr: str, *args, **kwargs) -> int: + with Context() as ctx: + with ctx.socket(PUSH) as binder: + for i in range(5): + port = binder.bind_to_random_port(addr, *args, **kwargs) + + new_addr = f'{addr}:{port}' + + if new_addr in self._random_addrs: + continue + else: + break + else: + raise ZMQBindError("Could not reserve random port.") + + self._random_addrs.append(new_addr) + + return port + + def _setup_sockets(self) -> Tuple[zmq.Socket, zmq.Socket]: + ctx: zmq.Context[zmq.Socket] = self.context_factory() # type: ignore + self._context = ctx + + # create the sockets + ins = ctx.socket(self.in_type) + self._sockets.append(ins) + if self.out_type < 0: + outs = ins + else: + outs = ctx.socket(self.out_type) + self._sockets.append(outs) + + # set sockopts (must be done first, in case of zmq.IDENTITY) + for opt, value in self._in_sockopts: + ins.setsockopt(opt, value) + for opt, value in self._out_sockopts: + outs.setsockopt(opt, value) + + for iface in self._in_binds: + ins.bind(iface) + for iface in self._out_binds: + outs.bind(iface) + + for iface in self._in_connects: + ins.connect(iface) + for iface in self._out_connects: + outs.connect(iface) + + return ins, outs + + def run_device(self) -> None: + """The runner method. + + Do not call me directly, instead call ``self.start()``, just like a Thread. + """ + ins, outs = self._setup_sockets() + proxy(ins, outs) + + def _close_sockets(self): + """Cleanup sockets we created""" + for s in self._sockets: + if s and not s.closed: + s.close() + + def run(self) -> None: + """wrap run_device in try/catch ETERM""" + try: + self.run_device() + except ZMQError as e: + if e.errno in {ETERM, ENOTSOCK}: + # silence TERM, ENOTSOCK errors, because this should be a clean shutdown + pass + else: + raise + finally: + self.done = True + self._close_sockets() + + def start(self) -> None: + """Start the device. Override me in subclass for other launchers.""" + return self.run() + + def join(self, timeout: Optional[float] = None) -> None: + """wait for me to finish, like Thread.join. + + Reimplemented appropriately by subclasses.""" + tic = time.monotonic() + toc = tic + while not self.done and not (timeout is not None and toc - tic > timeout): + time.sleep(0.001) + toc = time.monotonic() + + +class BackgroundDevice(Device): + """Base class for launching Devices in background processes and threads.""" + + launcher: Any = None + _launch_class: Any = None + + def start(self) -> None: + self.launcher = self._launch_class(target=self.run) + self.launcher.daemon = self.daemon + return self.launcher.start() + + def join(self, timeout: Optional[float] = None) -> None: + return self.launcher.join(timeout=timeout) + + +class ThreadDevice(BackgroundDevice): + """A Device that will be run in a background Thread. + + See Device for details. + """ + + _launch_class = Thread + + +class ProcessDevice(BackgroundDevice): + """A Device that will be run in a background Process. + + See Device for details. + """ + + _launch_class = Process + context_factory = Context + """Callable that returns a context. Typically either Context.instance or Context, + depending on whether the device should share the global instance or not. + """ + + +__all__ = ['Device', 'ThreadDevice', 'ProcessDevice'] diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/devices/monitoredqueue.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/devices/monitoredqueue.py new file mode 100644 index 0000000000000000000000000000000000000000..f590457a8696979889fe3b5f4b7604f6149d69b7 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/devices/monitoredqueue.py @@ -0,0 +1,51 @@ +"""pure Python monitored_queue function + +For use when Cython extension is unavailable (PyPy). + +Authors +------- +* MinRK +""" + +# Copyright (C) PyZMQ Developers +# Distributed under the terms of the Modified BSD License. + +from typing import Callable + +import zmq +from zmq.backend import monitored_queue as _backend_mq + + +def _relay(ins, outs, sides, prefix, swap_ids): + msg = ins.recv_multipart() + if swap_ids: + msg[:2] = msg[:2][::-1] + outs.send_multipart(msg) + sides.send_multipart([prefix] + msg) + + +def _monitored_queue( + in_socket, out_socket, mon_socket, in_prefix=b'in', out_prefix=b'out' +): + swap_ids = in_socket.type == zmq.ROUTER and out_socket.type == zmq.ROUTER + + poller = zmq.Poller() + poller.register(in_socket, zmq.POLLIN) + poller.register(out_socket, zmq.POLLIN) + while True: + events = dict(poller.poll()) + if in_socket in events: + _relay(in_socket, out_socket, mon_socket, in_prefix, swap_ids) + if out_socket in events: + _relay(out_socket, in_socket, mon_socket, out_prefix, swap_ids) + + +monitored_queue: Callable +if _backend_mq is not None: + monitored_queue = _backend_mq # type: ignore +else: + # backend has no monitored_queue + monitored_queue = _monitored_queue + + +__all__ = ['monitored_queue'] diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/devices/monitoredqueuedevice.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/devices/monitoredqueuedevice.py new file mode 100644 index 0000000000000000000000000000000000000000..7bcc5629964e3c1fb19cf042c4ec4e16444ac8aa --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/devices/monitoredqueuedevice.py @@ -0,0 +1,60 @@ +"""MonitoredQueue classes and functions.""" + +# Copyright (C) PyZMQ Developers +# Distributed under the terms of the Modified BSD License. + +from zmq import PUB +from zmq.devices.monitoredqueue import monitored_queue +from zmq.devices.proxydevice import ProcessProxy, Proxy, ProxyBase, ThreadProxy + + +class MonitoredQueueBase(ProxyBase): + """Base class for overriding methods.""" + + _in_prefix = b'' + _out_prefix = b'' + + def __init__( + self, in_type, out_type, mon_type=PUB, in_prefix=b'in', out_prefix=b'out' + ): + ProxyBase.__init__(self, in_type=in_type, out_type=out_type, mon_type=mon_type) + + self._in_prefix = in_prefix + self._out_prefix = out_prefix + + def run_device(self): + ins, outs, mons = self._setup_sockets() + monitored_queue(ins, outs, mons, self._in_prefix, self._out_prefix) + + +class MonitoredQueue(MonitoredQueueBase, Proxy): + """Class for running monitored_queue in the background. + + See zmq.devices.Device for most of the spec. MonitoredQueue differs from Proxy, + only in that it adds a ``prefix`` to messages sent on the monitor socket, + with a different prefix for each direction. + + MQ also supports ROUTER on both sides, which zmq.proxy does not. + + If a message arrives on `in_sock`, it will be prefixed with `in_prefix` on the monitor socket. + If it arrives on out_sock, it will be prefixed with `out_prefix`. + + A PUB socket is the most logical choice for the mon_socket, but it is not required. + """ + + +class ThreadMonitoredQueue(MonitoredQueueBase, ThreadProxy): + """Run zmq.monitored_queue in a background thread. + + See MonitoredQueue and Proxy for details. + """ + + +class ProcessMonitoredQueue(MonitoredQueueBase, ProcessProxy): + """Run zmq.monitored_queue in a separate process. + + See MonitoredQueue and Proxy for details. + """ + + +__all__ = ['MonitoredQueue', 'ThreadMonitoredQueue', 'ProcessMonitoredQueue'] diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/devices/proxydevice.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/devices/proxydevice.py new file mode 100644 index 0000000000000000000000000000000000000000..f2af06793c27bbf4c9a9c33a377e2acd6ded5c09 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/devices/proxydevice.py @@ -0,0 +1,104 @@ +"""Proxy classes and functions.""" + +# Copyright (C) PyZMQ Developers +# Distributed under the terms of the Modified BSD License. + +import zmq +from zmq.devices.basedevice import Device, ProcessDevice, ThreadDevice + + +class ProxyBase: + """Base class for overriding methods.""" + + def __init__(self, in_type, out_type, mon_type=zmq.PUB): + Device.__init__(self, in_type=in_type, out_type=out_type) + self.mon_type = mon_type + self._mon_binds = [] + self._mon_connects = [] + self._mon_sockopts = [] + + def bind_mon(self, addr): + """Enqueue ZMQ address for binding on mon_socket. + + See zmq.Socket.bind for details. + """ + self._mon_binds.append(addr) + + def bind_mon_to_random_port(self, addr, *args, **kwargs): + """Enqueue a random port on the given interface for binding on + mon_socket. + + See zmq.Socket.bind_to_random_port for details. + + .. versionadded:: 18.0 + """ + port = self._reserve_random_port(addr, *args, **kwargs) + + self.bind_mon(f'{addr}:{port}') + + return port + + def connect_mon(self, addr): + """Enqueue ZMQ address for connecting on mon_socket. + + See zmq.Socket.connect for details. + """ + self._mon_connects.append(addr) + + def setsockopt_mon(self, opt, value): + """Enqueue setsockopt(opt, value) for mon_socket + + See zmq.Socket.setsockopt for details. + """ + self._mon_sockopts.append((opt, value)) + + def _setup_sockets(self): + ins, outs = Device._setup_sockets(self) + ctx = self._context + mons = ctx.socket(self.mon_type) + self._sockets.append(mons) + + # set sockopts (must be done first, in case of zmq.IDENTITY) + for opt, value in self._mon_sockopts: + mons.setsockopt(opt, value) + + for iface in self._mon_binds: + mons.bind(iface) + + for iface in self._mon_connects: + mons.connect(iface) + + return ins, outs, mons + + def run_device(self): + ins, outs, mons = self._setup_sockets() + zmq.proxy(ins, outs, mons) + + +class Proxy(ProxyBase, Device): + """Threadsafe Proxy object. + + See zmq.devices.Device for most of the spec. This subclass adds a + _mon version of each _{in|out} method, for configuring the + monitor socket. + + A Proxy is a 3-socket ZMQ Device that functions just like a + QUEUE, except each message is also sent out on the monitor socket. + + A PUB socket is the most logical choice for the mon_socket, but it is not required. + """ + + +class ThreadProxy(ProxyBase, ThreadDevice): + """Proxy in a Thread. See Proxy for more.""" + + +class ProcessProxy(ProxyBase, ProcessDevice): + """Proxy in a Process. See Proxy for more.""" + + +__all__ = [ + 'Proxy', + 'ThreadProxy', + 'ProcessProxy', +] diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/devices/proxysteerabledevice.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/devices/proxysteerabledevice.py new file mode 100644 index 0000000000000000000000000000000000000000..256a1e0498c907791da79935c7ed0f35faf90ce0 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/devices/proxysteerabledevice.py @@ -0,0 +1,106 @@ +"""Classes for running a steerable ZMQ proxy""" + +# Copyright (C) PyZMQ Developers +# Distributed under the terms of the Modified BSD License. + +import zmq +from zmq.devices.proxydevice import ProcessProxy, Proxy, ThreadProxy + + +class ProxySteerableBase: + """Base class for overriding methods.""" + + def __init__(self, in_type, out_type, mon_type=zmq.PUB, ctrl_type=None): + super().__init__(in_type=in_type, out_type=out_type, mon_type=mon_type) + self.ctrl_type = ctrl_type + self._ctrl_binds = [] + self._ctrl_connects = [] + self._ctrl_sockopts = [] + + def bind_ctrl(self, addr): + """Enqueue ZMQ address for binding on ctrl_socket. + + See zmq.Socket.bind for details. + """ + self._ctrl_binds.append(addr) + + def bind_ctrl_to_random_port(self, addr, *args, **kwargs): + """Enqueue a random port on the given interface for binding on + ctrl_socket. + + See zmq.Socket.bind_to_random_port for details. + """ + port = self._reserve_random_port(addr, *args, **kwargs) + + self.bind_ctrl(f'{addr}:{port}') + + return port + + def connect_ctrl(self, addr): + """Enqueue ZMQ address for connecting on ctrl_socket. + + See zmq.Socket.connect for details. + """ + self._ctrl_connects.append(addr) + + def setsockopt_ctrl(self, opt, value): + """Enqueue setsockopt(opt, value) for ctrl_socket + + See zmq.Socket.setsockopt for details. + """ + self._ctrl_sockopts.append((opt, value)) + + def _setup_sockets(self): + ins, outs, mons = super()._setup_sockets() + ctx = self._context + ctrls = ctx.socket(self.ctrl_type) + self._sockets.append(ctrls) + + for opt, value in self._ctrl_sockopts: + ctrls.setsockopt(opt, value) + + for iface in self._ctrl_binds: + ctrls.bind(iface) + + for iface in self._ctrl_connects: + ctrls.connect(iface) + + return ins, outs, mons, ctrls + + def run_device(self): + ins, outs, mons, ctrls = self._setup_sockets() + zmq.proxy_steerable(ins, outs, mons, ctrls) + + +class ProxySteerable(ProxySteerableBase, Proxy): + """Class for running a steerable proxy in the background. + + See zmq.devices.Proxy for most of the spec. If the control socket is not + NULL, the proxy supports control flow, provided by the socket. + + If PAUSE is received on this socket, the proxy suspends its activities. If + RESUME is received, it goes on. If TERMINATE is received, it terminates + smoothly. If the control socket is NULL, the proxy behave exactly as if + zmq.devices.Proxy had been used. + + This subclass adds a _ctrl version of each _{in|out} + method, for configuring the control socket. + + .. versionadded:: libzmq-4.1 + .. versionadded:: 18.0 + """ + + +class ThreadProxySteerable(ProxySteerableBase, ThreadProxy): + """ProxySteerable in a Thread. See ProxySteerable for details.""" + + +class ProcessProxySteerable(ProxySteerableBase, ProcessProxy): + """ProxySteerable in a Process. See ProxySteerable for details.""" + + +__all__ = [ + 'ProxySteerable', + 'ThreadProxySteerable', + 'ProcessProxySteerable', +] diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/error.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/error.py new file mode 100644 index 0000000000000000000000000000000000000000..8a07a51fe1fc55aaeb0e1908d5f2251b0d32e9ac --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/error.py @@ -0,0 +1,229 @@ +"""0MQ Error classes and functions.""" + +# Copyright (C) PyZMQ Developers +# Distributed under the terms of the Modified BSD License. +from __future__ import annotations + +from errno import EINTR + + +class DraftFDWarning(RuntimeWarning): + """Warning for using experimental FD on draft sockets. + + .. versionadded:: 27 + """ + + def __init__(self, msg=""): + if not msg: + msg = ( + "pyzmq's back-fill socket.FD support on thread-safe sockets is experimental, and may be removed." + " This warning will go away automatically if/when libzmq implements socket.FD on thread-safe sockets." + " You can suppress this warning with `warnings.simplefilter('ignore', zmq.error.DraftFDWarning)" + ) + super().__init__(msg) + + +class ZMQBaseError(Exception): + """Base exception class for 0MQ errors in Python.""" + + +class ZMQError(ZMQBaseError): + """Wrap an errno style error. + + Parameters + ---------- + errno : int + The ZMQ errno or None. If None, then ``zmq_errno()`` is called and + used. + msg : str + Description of the error or None. + """ + + errno: int | None = None + strerror: str + + def __init__(self, errno: int | None = None, msg: str | None = None): + """Wrap an errno style error. + + Parameters + ---------- + errno : int + The ZMQ errno or None. If None, then ``zmq_errno()`` is called and + used. + msg : string + Description of the error or None. + """ + from zmq.backend import strerror, zmq_errno + + if errno is None: + errno = zmq_errno() + if isinstance(errno, int): + self.errno = errno + if msg is None: + self.strerror = strerror(errno) + else: + self.strerror = msg + else: + if msg is None: + self.strerror = str(errno) + else: + self.strerror = msg + # flush signals, because there could be a SIGINT + # waiting to pounce, resulting in uncaught exceptions. + # Doing this here means getting SIGINT during a blocking + # libzmq call will raise a *catchable* KeyboardInterrupt + # PyErr_CheckSignals() + + def __str__(self) -> str: + return self.strerror + + def __repr__(self) -> str: + return f"{self.__class__.__name__}('{str(self)}')" + + +class ZMQBindError(ZMQBaseError): + """An error for ``Socket.bind_to_random_port()``. + + See Also + -------- + .Socket.bind_to_random_port + """ + + +class NotDone(ZMQBaseError): + """Raised when timeout is reached while waiting for 0MQ to finish with a Message + + See Also + -------- + .MessageTracker.wait : object for tracking when ZeroMQ is done + """ + + +class ContextTerminated(ZMQError): + """Wrapper for zmq.ETERM + + .. versionadded:: 13.0 + """ + + def __init__(self, errno="ignored", msg="ignored"): + from zmq import ETERM + + super().__init__(ETERM) + + +class Again(ZMQError): + """Wrapper for zmq.EAGAIN + + .. versionadded:: 13.0 + """ + + def __init__(self, errno="ignored", msg="ignored"): + from zmq import EAGAIN + + super().__init__(EAGAIN) + + +class InterruptedSystemCall(ZMQError, InterruptedError): + """Wrapper for EINTR + + This exception should be caught internally in pyzmq + to retry system calls, and not propagate to the user. + + .. versionadded:: 14.7 + """ + + errno = EINTR + strerror: str + + def __init__(self, errno="ignored", msg="ignored"): + super().__init__(EINTR) + + def __str__(self): + s = super().__str__() + return s + ": This call should have been retried. Please report this to pyzmq." + + +def _check_rc(rc, errno=None, error_without_errno=True): + """internal utility for checking zmq return condition + + and raising the appropriate Exception class + """ + if rc == -1: + if errno is None: + from zmq.backend import zmq_errno + + errno = zmq_errno() + if errno == 0 and not error_without_errno: + return + from zmq import EAGAIN, ETERM + + if errno == EINTR: + raise InterruptedSystemCall(errno) + elif errno == EAGAIN: + raise Again(errno) + elif errno == ETERM: + raise ContextTerminated(errno) + else: + raise ZMQError(errno) + + +_zmq_version_info = None +_zmq_version = None + + +class ZMQVersionError(NotImplementedError): + """Raised when a feature is not provided by the linked version of libzmq. + + .. versionadded:: 14.2 + """ + + min_version = None + + def __init__(self, min_version: str, msg: str = "Feature"): + global _zmq_version + if _zmq_version is None: + from zmq import zmq_version + + _zmq_version = zmq_version() + self.msg = msg + self.min_version = min_version + self.version = _zmq_version + + def __repr__(self): + return f"ZMQVersionError('{str(self)}')" + + def __str__(self): + return f"{self.msg} requires libzmq >= {self.min_version}, have {self.version}" + + +def _check_version( + min_version_info: tuple[int] | tuple[int, int] | tuple[int, int, int], + msg: str = "Feature", +): + """Check for libzmq + + raises ZMQVersionError if current zmq version is not at least min_version + + min_version_info is a tuple of integers, and will be compared against zmq.zmq_version_info(). + """ + global _zmq_version_info + if _zmq_version_info is None: + from zmq import zmq_version_info + + _zmq_version_info = zmq_version_info() + if _zmq_version_info < min_version_info: + min_version = ".".join(str(v) for v in min_version_info) + raise ZMQVersionError(min_version, msg) + + +__all__ = [ + "DraftFDWarning", + "ZMQBaseError", + "ZMQBindError", + "ZMQError", + "NotDone", + "ContextTerminated", + "InterruptedSystemCall", + "Again", + "ZMQVersionError", +] diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/eventloop/__init__.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/eventloop/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..a99e143ccf3035db55cb5a34caa13e98ba793e9a --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/eventloop/__init__.py @@ -0,0 +1,5 @@ +"""Tornado eventloop integration for pyzmq""" + +from tornado.ioloop import IOLoop + +__all__ = ['IOLoop'] diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/eventloop/_deprecated.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/eventloop/_deprecated.py new file mode 100644 index 0000000000000000000000000000000000000000..06bce13c199bcdc58dc611f661dc348b71e272cf --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/eventloop/_deprecated.py @@ -0,0 +1,212 @@ +"""tornado IOLoop API with zmq compatibility + +If you have tornado ≥ 3.0, this is a subclass of tornado's IOLoop, +otherwise we ship a minimal subset of tornado in zmq.eventloop.minitornado. + +The minimal shipped version of tornado's IOLoop does not include +support for concurrent futures - this will only be available if you +have tornado ≥ 3.0. +""" + +# Copyright (C) PyZMQ Developers +# Distributed under the terms of the Modified BSD License. + +import time +import warnings +from typing import Tuple + +from zmq import ETERM, POLLERR, POLLIN, POLLOUT, Poller, ZMQError + +tornado_version: Tuple = () +try: + import tornado + + tornado_version = tornado.version_info +except (ImportError, AttributeError): + pass + +from .minitornado.ioloop import PeriodicCallback, PollIOLoop +from .minitornado.log import gen_log + + +class DelayedCallback(PeriodicCallback): + """Schedules the given callback to be called once. + + The callback is called once, after callback_time milliseconds. + + `start` must be called after the DelayedCallback is created. + + The timeout is calculated from when `start` is called. + """ + + def __init__(self, callback, callback_time, io_loop=None): + # PeriodicCallback require callback_time to be positive + warnings.warn( + """DelayedCallback is deprecated. + Use loop.add_timeout instead.""", + DeprecationWarning, + ) + callback_time = max(callback_time, 1e-3) + super().__init__(callback, callback_time, io_loop) + + def start(self): + """Starts the timer.""" + self._running = True + self._firstrun = True + self._next_timeout = time.time() + self.callback_time / 1000.0 + self.io_loop.add_timeout(self._next_timeout, self._run) + + def _run(self): + if not self._running: + return + self._running = False + try: + self.callback() + except Exception: + gen_log.error("Error in delayed callback", exc_info=True) + + +class ZMQPoller: + """A poller that can be used in the tornado IOLoop. + + This simply wraps a regular zmq.Poller, scaling the timeout + by 1000, so that it is in seconds rather than milliseconds. + """ + + def __init__(self): + self._poller = Poller() + + @staticmethod + def _map_events(events): + """translate IOLoop.READ/WRITE/ERROR event masks into zmq.POLLIN/OUT/ERR""" + z_events = 0 + if events & IOLoop.READ: + z_events |= POLLIN + if events & IOLoop.WRITE: + z_events |= POLLOUT + if events & IOLoop.ERROR: + z_events |= POLLERR + return z_events + + @staticmethod + def _remap_events(z_events): + """translate zmq.POLLIN/OUT/ERR event masks into IOLoop.READ/WRITE/ERROR""" + events = 0 + if z_events & POLLIN: + events |= IOLoop.READ + if z_events & POLLOUT: + events |= IOLoop.WRITE + if z_events & POLLERR: + events |= IOLoop.ERROR + return events + + def register(self, fd, events): + return self._poller.register(fd, self._map_events(events)) + + def modify(self, fd, events): + return self._poller.modify(fd, self._map_events(events)) + + def unregister(self, fd): + return self._poller.unregister(fd) + + def poll(self, timeout): + """poll in seconds rather than milliseconds. + + Event masks will be IOLoop.READ/WRITE/ERROR + """ + z_events = self._poller.poll(1000 * timeout) + return [(fd, self._remap_events(evt)) for (fd, evt) in z_events] + + def close(self): + pass + + +class ZMQIOLoop(PollIOLoop): + """ZMQ subclass of tornado's IOLoop + + Minor modifications, so that .current/.instance return self + """ + + _zmq_impl = ZMQPoller + + def initialize(self, impl=None, **kwargs): + impl = self._zmq_impl() if impl is None else impl + super().initialize(impl=impl, **kwargs) + + @classmethod + def instance(cls, *args, **kwargs): + """Returns a global `IOLoop` instance. + + Most applications have a single, global `IOLoop` running on the + main thread. Use this method to get this instance from + another thread. To get the current thread's `IOLoop`, use `current()`. + """ + # install ZMQIOLoop as the active IOLoop implementation + # when using tornado 3 + if tornado_version >= (3,): + PollIOLoop.configure(cls) + loop = PollIOLoop.instance(*args, **kwargs) + if not isinstance(loop, cls): + warnings.warn( + f"IOLoop.current expected instance of {cls!r}, got {loop!r}", + RuntimeWarning, + stacklevel=2, + ) + return loop + + @classmethod + def current(cls, *args, **kwargs): + """Returns the current thread’s IOLoop.""" + # install ZMQIOLoop as the active IOLoop implementation + # when using tornado 3 + if tornado_version >= (3,): + PollIOLoop.configure(cls) + loop = PollIOLoop.current(*args, **kwargs) + if not isinstance(loop, cls): + warnings.warn( + f"IOLoop.current expected instance of {cls!r}, got {loop!r}", + RuntimeWarning, + stacklevel=2, + ) + return loop + + def start(self): + try: + super().start() + except ZMQError as e: + if e.errno == ETERM: + # quietly return on ETERM + pass + else: + raise + + +# public API name +IOLoop = ZMQIOLoop + + +def install(): + """set the tornado IOLoop instance with the pyzmq IOLoop. + + After calling this function, tornado's IOLoop.instance() and pyzmq's + IOLoop.instance() will return the same object. + + An assertion error will be raised if tornado's IOLoop has been initialized + prior to calling this function. + """ + from tornado import ioloop + + # check if tornado's IOLoop is already initialized to something other + # than the pyzmq IOLoop instance: + assert ( + not ioloop.IOLoop.initialized() + ) or ioloop.IOLoop.instance() is IOLoop.instance(), ( + "tornado IOLoop already initialized" + ) + + if tornado_version >= (3,): + # tornado 3 has an official API for registering new defaults, yay! + ioloop.IOLoop.configure(ZMQIOLoop) + else: + # we have to set the global instance explicitly + ioloop.IOLoop._instance = IOLoop.instance() diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/eventloop/future.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/eventloop/future.py new file mode 100644 index 0000000000000000000000000000000000000000..0f34f0ef93a8947e622b74e8ebedf79003727e0a --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/eventloop/future.py @@ -0,0 +1,104 @@ +"""Future-returning APIs for tornado coroutines. + +.. seealso:: + + :mod:`zmq.asyncio` + +""" + +# Copyright (c) PyZMQ Developers. +# Distributed under the terms of the Modified BSD License. +from __future__ import annotations + +import asyncio +import warnings +from typing import Any + +from tornado.concurrent import Future +from tornado.ioloop import IOLoop + +import zmq as _zmq +from zmq._future import _AsyncPoller, _AsyncSocket + + +class CancelledError(Exception): + pass + + +class _TornadoFuture(Future): + """Subclass Tornado Future, reinstating cancellation.""" + + def cancel(self): + if self.done(): + return False + self.set_exception(CancelledError()) + return True + + def cancelled(self): + return self.done() and isinstance(self.exception(), CancelledError) + + +class _CancellableTornadoTimeout: + def __init__(self, loop, timeout): + self.loop = loop + self.timeout = timeout + + def cancel(self): + self.loop.remove_timeout(self.timeout) + + +# mixin for tornado/asyncio compatibility + + +class _AsyncTornado: + _Future: type[asyncio.Future] = _TornadoFuture + _READ = IOLoop.READ + _WRITE = IOLoop.WRITE + + def _default_loop(self): + return IOLoop.current() + + def _call_later(self, delay, callback): + io_loop = self._get_loop() + timeout = io_loop.call_later(delay, callback) + return _CancellableTornadoTimeout(io_loop, timeout) + + +class Poller(_AsyncTornado, _AsyncPoller): + def _watch_raw_socket(self, loop, socket, evt, f): + """Schedule callback for a raw socket""" + loop.add_handler(socket, lambda *args: f(), evt) + + def _unwatch_raw_sockets(self, loop, *sockets): + """Unschedule callback for a raw socket""" + for socket in sockets: + loop.remove_handler(socket) + + +class Socket(_AsyncTornado, _AsyncSocket): + _poller_class = Poller + + +Poller._socket_class = Socket + + +class Context(_zmq.Context[Socket]): + # avoid sharing instance with base Context class + _instance = None + + io_loop = None + + @staticmethod + def _socket_class(self, socket_type): + return Socket(self, socket_type) + + def __init__(self: Context, *args: Any, **kwargs: Any) -> None: + io_loop = kwargs.pop('io_loop', None) + if io_loop is not None: + warnings.warn( + f"{self.__class__.__name__}(io_loop) argument is deprecated in pyzmq 22.2." + " The currently active loop will always be used.", + DeprecationWarning, + stacklevel=2, + ) + super().__init__(*args, **kwargs) # type: ignore diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/eventloop/ioloop.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/eventloop/ioloop.py new file mode 100644 index 0000000000000000000000000000000000000000..dccb92a14eba7190c8571c0ee880ab5542e31bb7 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/eventloop/ioloop.py @@ -0,0 +1,37 @@ +"""tornado IOLoop API with zmq compatibility + +This module is deprecated in pyzmq 17. +To use zmq with tornado, +eventloop integration is no longer required +and tornado itself should be used. +""" + +# Copyright (C) PyZMQ Developers +# Distributed under the terms of the Modified BSD License. + +import warnings + + +def _deprecated(): + warnings.warn( + "zmq.eventloop.ioloop is deprecated in pyzmq 17." + " pyzmq now works with default tornado and asyncio eventloops.", + DeprecationWarning, + stacklevel=3, + ) + + +_deprecated() + +from tornado.ioloop import * # noqa +from tornado.ioloop import IOLoop + +ZMQIOLoop = IOLoop + + +def install(): + """DEPRECATED + + pyzmq 17 no longer needs any special integration for tornado. + """ + _deprecated() diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/eventloop/zmqstream.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/eventloop/zmqstream.py new file mode 100644 index 0000000000000000000000000000000000000000..e0b5d297b19f973d19271625a2508ec6f24ee858 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/eventloop/zmqstream.py @@ -0,0 +1,688 @@ +# Derived from iostream.py from tornado 1.0, Copyright 2009 Facebook +# Used under Apache License Version 2.0 +# +# Modifications are Copyright (C) PyZMQ Developers +# Distributed under the terms of the Modified BSD License. +"""A utility class for event-based messaging on a zmq socket using tornado. + +.. seealso:: + + - :mod:`zmq.asyncio` + - :mod:`zmq.eventloop.future` +""" + +from __future__ import annotations + +import asyncio +import pickle +import warnings +from queue import Queue +from typing import Any, Awaitable, Callable, Literal, Sequence, cast, overload + +from tornado.ioloop import IOLoop +from tornado.log import gen_log + +import zmq +import zmq._future +from zmq import POLLIN, POLLOUT +from zmq.utils import jsonapi + + +class ZMQStream: + """A utility class to register callbacks when a zmq socket sends and receives + + For use with tornado IOLoop. + + There are three main methods + + Methods: + + * **on_recv(callback, copy=True):** + register a callback to be run every time the socket has something to receive + * **on_send(callback):** + register a callback to be run every time you call send + * **send_multipart(self, msg, flags=0, copy=False, callback=None):** + perform a send that will trigger the callback + if callback is passed, on_send is also called. + + There are also send_multipart(), send_json(), send_pyobj() + + Three other methods for deactivating the callbacks: + + * **stop_on_recv():** + turn off the recv callback + * **stop_on_send():** + turn off the send callback + + which simply call ``on_(None)``. + + The entire socket interface, excluding direct recv methods, is also + provided, primarily through direct-linking the methods. + e.g. + + >>> stream.bind is stream.socket.bind + True + + + .. versionadded:: 25 + + send/recv callbacks can be coroutines. + + .. versionchanged:: 25 + + ZMQStreams only support base zmq.Socket classes (this has always been true, but not enforced). + If ZMQStreams are created with e.g. async Socket subclasses, + a RuntimeWarning will be shown, + and the socket cast back to the default zmq.Socket + before connecting events. + + Previously, using async sockets (or any zmq.Socket subclass) would result in undefined behavior for the + arguments passed to callback functions. + Now, the callback functions reliably get the return value of the base `zmq.Socket` send/recv_multipart methods + (the list of message frames). + """ + + socket: zmq.Socket + io_loop: IOLoop + poller: zmq.Poller + _send_queue: Queue + _recv_callback: Callable | None + _send_callback: Callable | None + _close_callback: Callable | None + _state: int = 0 + _flushed: bool = False + _recv_copy: bool = False + _fd: int + + def __init__(self, socket: zmq.Socket, io_loop: IOLoop | None = None): + if isinstance(socket, zmq._future._AsyncSocket): + warnings.warn( + f"""ZMQStream only supports the base zmq.Socket class. + + Use zmq.Socket(shadow=other_socket) + or `ctx.socket(zmq.{socket._type_name}, socket_class=zmq.Socket)` + to create a base zmq.Socket object, + no matter what other kind of socket your Context creates. + """, + RuntimeWarning, + stacklevel=2, + ) + # shadow back to base zmq.Socket, + # otherwise callbacks like `on_recv` will get the wrong types. + socket = zmq.Socket(shadow=socket) + self.socket = socket + + # IOLoop.current() is deprecated if called outside the event loop + # that means + self.io_loop = io_loop or IOLoop.current() + self.poller = zmq.Poller() + self._fd = cast(int, self.socket.FD) + + self._send_queue = Queue() + self._recv_callback = None + self._send_callback = None + self._close_callback = None + self._recv_copy = False + self._flushed = False + + self._state = 0 + self._init_io_state() + + # shortcircuit some socket methods + self.bind = self.socket.bind + self.bind_to_random_port = self.socket.bind_to_random_port + self.connect = self.socket.connect + self.setsockopt = self.socket.setsockopt + self.getsockopt = self.socket.getsockopt + self.setsockopt_string = self.socket.setsockopt_string + self.getsockopt_string = self.socket.getsockopt_string + self.setsockopt_unicode = self.socket.setsockopt_unicode + self.getsockopt_unicode = self.socket.getsockopt_unicode + + def stop_on_recv(self): + """Disable callback and automatic receiving.""" + return self.on_recv(None) + + def stop_on_send(self): + """Disable callback on sending.""" + return self.on_send(None) + + def stop_on_err(self): + """DEPRECATED, does nothing""" + gen_log.warn("on_err does nothing, and will be removed") + + def on_err(self, callback: Callable): + """DEPRECATED, does nothing""" + gen_log.warn("on_err does nothing, and will be removed") + + @overload + def on_recv( + self, + callback: Callable[[list[bytes]], Any], + ) -> None: ... + + @overload + def on_recv( + self, + callback: Callable[[list[bytes]], Any], + copy: Literal[True], + ) -> None: ... + + @overload + def on_recv( + self, + callback: Callable[[list[zmq.Frame]], Any], + copy: Literal[False], + ) -> None: ... + + @overload + def on_recv( + self, + callback: Callable[[list[zmq.Frame]], Any] | Callable[[list[bytes]], Any], + copy: bool = ..., + ): ... + + def on_recv( + self, + callback: Callable[[list[zmq.Frame]], Any] | Callable[[list[bytes]], Any], + copy: bool = True, + ) -> None: + """Register a callback for when a message is ready to recv. + + There can be only one callback registered at a time, so each + call to `on_recv` replaces previously registered callbacks. + + on_recv(None) disables recv event polling. + + Use on_recv_stream(callback) instead, to register a callback that will receive + both this ZMQStream and the message, instead of just the message. + + Parameters + ---------- + + callback : callable + callback must take exactly one argument, which will be a + list, as returned by socket.recv_multipart() + if callback is None, recv callbacks are disabled. + copy : bool + copy is passed directly to recv, so if copy is False, + callback will receive Message objects. If copy is True, + then callback will receive bytes/str objects. + + Returns : None + """ + + self._check_closed() + assert callback is None or callable(callback) + self._recv_callback = callback + self._recv_copy = copy + if callback is None: + self._drop_io_state(zmq.POLLIN) + else: + self._add_io_state(zmq.POLLIN) + + @overload + def on_recv_stream( + self, + callback: Callable[[ZMQStream, list[bytes]], Any], + ) -> None: ... + + @overload + def on_recv_stream( + self, + callback: Callable[[ZMQStream, list[bytes]], Any], + copy: Literal[True], + ) -> None: ... + + @overload + def on_recv_stream( + self, + callback: Callable[[ZMQStream, list[zmq.Frame]], Any], + copy: Literal[False], + ) -> None: ... + + @overload + def on_recv_stream( + self, + callback: ( + Callable[[ZMQStream, list[zmq.Frame]], Any] + | Callable[[ZMQStream, list[bytes]], Any] + ), + copy: bool = ..., + ): ... + + def on_recv_stream( + self, + callback: ( + Callable[[ZMQStream, list[zmq.Frame]], Any] + | Callable[[ZMQStream, list[bytes]], Any] + ), + copy: bool = True, + ): + """Same as on_recv, but callback will get this stream as first argument + + callback must take exactly two arguments, as it will be called as:: + + callback(stream, msg) + + Useful when a single callback should be used with multiple streams. + """ + if callback is None: + self.stop_on_recv() + else: + + def stream_callback(msg): + return callback(self, msg) + + self.on_recv(stream_callback, copy=copy) + + def on_send( + self, callback: Callable[[Sequence[Any], zmq.MessageTracker | None], Any] + ): + """Register a callback to be called on each send + + There will be two arguments:: + + callback(msg, status) + + * `msg` will be the list of sendable objects that was just sent + * `status` will be the return result of socket.send_multipart(msg) - + MessageTracker or None. + + Non-copying sends return a MessageTracker object whose + `done` attribute will be True when the send is complete. + This allows users to track when an object is safe to write to + again. + + The second argument will always be None if copy=True + on the send. + + Use on_send_stream(callback) to register a callback that will be passed + this ZMQStream as the first argument, in addition to the other two. + + on_send(None) disables recv event polling. + + Parameters + ---------- + + callback : callable + callback must take exactly two arguments, which will be + the message being sent (always a list), + and the return result of socket.send_multipart(msg) - + MessageTracker or None. + + if callback is None, send callbacks are disabled. + """ + + self._check_closed() + assert callback is None or callable(callback) + self._send_callback = callback + + def on_send_stream( + self, + callback: Callable[[ZMQStream, Sequence[Any], zmq.MessageTracker | None], Any], + ): + """Same as on_send, but callback will get this stream as first argument + + Callback will be passed three arguments:: + + callback(stream, msg, status) + + Useful when a single callback should be used with multiple streams. + """ + if callback is None: + self.stop_on_send() + else: + self.on_send(lambda msg, status: callback(self, msg, status)) + + def send(self, msg, flags=0, copy=True, track=False, callback=None, **kwargs): + """Send a message, optionally also register a new callback for sends. + See zmq.socket.send for details. + """ + return self.send_multipart( + [msg], flags=flags, copy=copy, track=track, callback=callback, **kwargs + ) + + def send_multipart( + self, + msg: Sequence[Any], + flags: int = 0, + copy: bool = True, + track: bool = False, + callback: Callable | None = None, + **kwargs: Any, + ) -> None: + """Send a multipart message, optionally also register a new callback for sends. + See zmq.socket.send_multipart for details. + """ + kwargs.update(dict(flags=flags, copy=copy, track=track)) + self._send_queue.put((msg, kwargs)) + callback = callback or self._send_callback + if callback is not None: + self.on_send(callback) + else: + # noop callback + self.on_send(lambda *args: None) + self._add_io_state(zmq.POLLOUT) + + def send_string( + self, + u: str, + flags: int = 0, + encoding: str = 'utf-8', + callback: Callable | None = None, + **kwargs: Any, + ): + """Send a unicode message with an encoding. + See zmq.socket.send_unicode for details. + """ + if not isinstance(u, str): + raise TypeError("unicode/str objects only") + return self.send(u.encode(encoding), flags=flags, callback=callback, **kwargs) + + send_unicode = send_string + + def send_json( + self, + obj: Any, + flags: int = 0, + callback: Callable | None = None, + **kwargs: Any, + ): + """Send json-serialized version of an object. + See zmq.socket.send_json for details. + """ + msg = jsonapi.dumps(obj) + return self.send(msg, flags=flags, callback=callback, **kwargs) + + def send_pyobj( + self, + obj: Any, + flags: int = 0, + protocol: int = -1, + callback: Callable | None = None, + **kwargs: Any, + ): + """Send a Python object as a message using pickle to serialize. + + See zmq.socket.send_json for details. + """ + msg = pickle.dumps(obj, protocol) + return self.send(msg, flags, callback=callback, **kwargs) + + def _finish_flush(self): + """callback for unsetting _flushed flag.""" + self._flushed = False + + def flush(self, flag: int = zmq.POLLIN | zmq.POLLOUT, limit: int | None = None): + """Flush pending messages. + + This method safely handles all pending incoming and/or outgoing messages, + bypassing the inner loop, passing them to the registered callbacks. + + A limit can be specified, to prevent blocking under high load. + + flush will return the first time ANY of these conditions are met: + * No more events matching the flag are pending. + * the total number of events handled reaches the limit. + + Note that if ``flag|POLLIN != 0``, recv events will be flushed even if no callback + is registered, unlike normal IOLoop operation. This allows flush to be + used to remove *and ignore* incoming messages. + + Parameters + ---------- + flag : int + default=POLLIN|POLLOUT + 0MQ poll flags. + If flag|POLLIN, recv events will be flushed. + If flag|POLLOUT, send events will be flushed. + Both flags can be set at once, which is the default. + limit : None or int, optional + The maximum number of messages to send or receive. + Both send and recv count against this limit. + + Returns + ------- + int : + count of events handled (both send and recv) + """ + self._check_closed() + # unset self._flushed, so callbacks will execute, in case flush has + # already been called this iteration + already_flushed = self._flushed + self._flushed = False + # initialize counters + count = 0 + + def update_flag(): + """Update the poll flag, to prevent registering POLLOUT events + if we don't have pending sends.""" + return flag & zmq.POLLIN | (self.sending() and flag & zmq.POLLOUT) + + flag = update_flag() + if not flag: + # nothing to do + return 0 + self.poller.register(self.socket, flag) + events = self.poller.poll(0) + while events and (not limit or count < limit): + s, event = events[0] + if event & POLLIN: # receiving + self._handle_recv() + count += 1 + if self.socket is None: + # break if socket was closed during callback + break + if event & POLLOUT and self.sending(): + self._handle_send() + count += 1 + if self.socket is None: + # break if socket was closed during callback + break + + flag = update_flag() + if flag: + self.poller.register(self.socket, flag) + events = self.poller.poll(0) + else: + events = [] + if count: # only bypass loop if we actually flushed something + # skip send/recv callbacks this iteration + self._flushed = True + # reregister them at the end of the loop + if not already_flushed: # don't need to do it again + self.io_loop.add_callback(self._finish_flush) + elif already_flushed: + self._flushed = True + + # update ioloop poll state, which may have changed + self._rebuild_io_state() + return count + + def set_close_callback(self, callback: Callable | None): + """Call the given callback when the stream is closed.""" + self._close_callback = callback + + def close(self, linger: int | None = None) -> None: + """Close this stream.""" + if self.socket is not None: + if self.socket.closed: + # fallback on raw fd for closed sockets + # hopefully this happened promptly after close, + # otherwise somebody else may have the FD + warnings.warn( + f"Unregistering FD {self._fd} after closing socket. " + "This could result in unregistering handlers for the wrong socket. " + "Please use stream.close() instead of closing the socket directly.", + stacklevel=2, + ) + self.io_loop.remove_handler(self._fd) + else: + self.io_loop.remove_handler(self.socket) + self.socket.close(linger) + self.socket = None # type: ignore + if self._close_callback: + self._run_callback(self._close_callback) + + def receiving(self) -> bool: + """Returns True if we are currently receiving from the stream.""" + return self._recv_callback is not None + + def sending(self) -> bool: + """Returns True if we are currently sending to the stream.""" + return not self._send_queue.empty() + + def closed(self) -> bool: + if self.socket is None: + return True + if self.socket.closed: + # underlying socket has been closed, but not by us! + # trigger our cleanup + self.close() + return True + return False + + def _run_callback(self, callback, *args, **kwargs): + """Wrap running callbacks in try/except to allow us to + close our socket.""" + try: + f = callback(*args, **kwargs) + if isinstance(f, Awaitable): + f = asyncio.ensure_future(f) + else: + f = None + except Exception: + gen_log.error("Uncaught exception in ZMQStream callback", exc_info=True) + # Re-raise the exception so that IOLoop.handle_callback_exception + # can see it and log the error + raise + + if f is not None: + # handle async callbacks + def _log_error(f): + try: + f.result() + except Exception: + gen_log.error( + "Uncaught exception in ZMQStream callback", exc_info=True + ) + + f.add_done_callback(_log_error) + + def _handle_events(self, fd, events): + """This method is the actual handler for IOLoop, that gets called whenever + an event on my socket is posted. It dispatches to _handle_recv, etc.""" + if not self.socket: + gen_log.warning("Got events for closed stream %s", self) + return + try: + zmq_events = self.socket.EVENTS + except zmq.ContextTerminated: + gen_log.warning("Got events for stream %s after terminating context", self) + # trigger close check, this will unregister callbacks + self.closed() + return + except zmq.ZMQError as e: + # run close check + # shadow sockets may have been closed elsewhere, + # which should show up as ENOTSOCK here + if self.closed(): + gen_log.warning( + "Got events for stream %s attached to closed socket: %s", self, e + ) + else: + gen_log.error("Error getting events for %s: %s", self, e) + return + try: + # dispatch events: + if zmq_events & zmq.POLLIN and self.receiving(): + self._handle_recv() + if not self.socket: + return + if zmq_events & zmq.POLLOUT and self.sending(): + self._handle_send() + if not self.socket: + return + + # rebuild the poll state + self._rebuild_io_state() + except Exception: + gen_log.error("Uncaught exception in zmqstream callback", exc_info=True) + raise + + def _handle_recv(self): + """Handle a recv event.""" + if self._flushed: + return + try: + msg = self.socket.recv_multipart(zmq.NOBLOCK, copy=self._recv_copy) + except zmq.ZMQError as e: + if e.errno == zmq.EAGAIN: + # state changed since poll event + pass + else: + raise + else: + if self._recv_callback: + callback = self._recv_callback + self._run_callback(callback, msg) + + def _handle_send(self): + """Handle a send event.""" + if self._flushed: + return + if not self.sending(): + gen_log.error("Shouldn't have handled a send event") + return + + msg, kwargs = self._send_queue.get() + try: + status = self.socket.send_multipart(msg, **kwargs) + except zmq.ZMQError as e: + gen_log.error("SEND Error: %s", e) + status = e + if self._send_callback: + callback = self._send_callback + self._run_callback(callback, msg, status) + + def _check_closed(self): + if not self.socket: + raise OSError("Stream is closed") + + def _rebuild_io_state(self): + """rebuild io state based on self.sending() and receiving()""" + if self.socket is None: + return + state = 0 + if self.receiving(): + state |= zmq.POLLIN + if self.sending(): + state |= zmq.POLLOUT + + self._state = state + self._update_handler(state) + + def _add_io_state(self, state): + """Add io_state to poller.""" + self._state = self._state | state + self._update_handler(self._state) + + def _drop_io_state(self, state): + """Stop poller from watching an io_state.""" + self._state = self._state & (~state) + self._update_handler(self._state) + + def _update_handler(self, state): + """Update IOLoop handler with state.""" + if self.socket is None: + return + + if state & self.socket.events: + # events still exist that haven't been processed + # explicitly schedule handling to avoid missing events due to edge-triggered FDs + self.io_loop.add_callback(lambda: self._handle_events(self.socket, 0)) + + def _init_io_state(self): + """initialize the ioloop event handler""" + self.io_loop.add_handler(self.socket, self._handle_events, self.io_loop.READ) diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/green/__init__.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/green/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..8543864b00d60f236c05463f62494a483c739871 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/green/__init__.py @@ -0,0 +1,48 @@ +# ----------------------------------------------------------------------------- +# Copyright (C) 2011-2012 Travis Cline +# +# This file is part of pyzmq +# It is adapted from upstream project zeromq_gevent under the New BSD License +# +# Distributed under the terms of the New BSD License. The full license is in +# the file LICENSE.BSD, distributed as part of this software. +# ----------------------------------------------------------------------------- + +"""zmq.green - gevent compatibility with zeromq. + +Usage +----- + +Instead of importing zmq directly, do so in the following manner: + +.. + + import zmq.green as zmq + + +Any calls that would have blocked the current thread will now only block the +current green thread. + +This compatibility is accomplished by ensuring the nonblocking flag is set +before any blocking operation and the ØMQ file descriptor is polled internally +to trigger needed events. +""" + +from __future__ import annotations + +from typing import List + +import zmq as _zmq +from zmq import * +from zmq.green.core import _Context, _Socket +from zmq.green.poll import _Poller + +Context = _Context # type: ignore +Socket = _Socket # type: ignore +Poller = _Poller # type: ignore + +from zmq.green.device import device # type: ignore + +__all__: list[str] = [] +# adding `__all__` to __init__.pyi gets mypy all confused +__all__.extend(_zmq.__all__) # type: ignore diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/green/core.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/green/core.py new file mode 100644 index 0000000000000000000000000000000000000000..ddfccc205a6500eaf3e81df77bd35f4af274fac5 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/green/core.py @@ -0,0 +1,334 @@ +# ----------------------------------------------------------------------------- +# Copyright (C) 2011-2012 Travis Cline +# +# This file is part of pyzmq +# It is adapted from upstream project zeromq_gevent under the New BSD License +# +# Distributed under the terms of the New BSD License. The full license is in +# the file LICENSE.BSD, distributed as part of this software. +# ----------------------------------------------------------------------------- + +"""This module wraps the :class:`Socket` and :class:`Context` found in :mod:`pyzmq ` to be non blocking""" + +from __future__ import annotations + +import sys +import time +import warnings + +import gevent +from gevent.event import AsyncResult +from gevent.hub import get_hub + +import zmq +from zmq import Context as _original_Context +from zmq import Socket as _original_Socket + +from .poll import _Poller + +if hasattr(zmq, 'RCVTIMEO'): + TIMEOS: tuple = (zmq.RCVTIMEO, zmq.SNDTIMEO) +else: + TIMEOS = () + + +def _stop(evt): + """simple wrapper for stopping an Event, allowing for method rename in gevent 1.0""" + try: + evt.stop() + except AttributeError: + # gevent<1.0 compat + evt.cancel() + + +class _Socket(_original_Socket): + """Green version of :class:`zmq.Socket` + + The following methods are overridden: + + * send + * recv + + To ensure that the ``zmq.NOBLOCK`` flag is set and that sending or receiving + is deferred to the hub if a ``zmq.EAGAIN`` (retry) error is raised. + + The `__state_changed` method is triggered when the zmq.FD for the socket is + marked as readable and triggers the necessary read and write events (which + are waited for in the recv and send methods). + + Some double underscore prefixes are used to minimize pollution of + :class:`zmq.Socket`'s namespace. + """ + + __in_send_multipart = False + __in_recv_multipart = False + __writable = None + __readable = None + _state_event = None + _gevent_bug_timeout = 11.6 # timeout for not trusting gevent + _debug_gevent = False # turn on if you think gevent is missing events + _poller_class = _Poller + _repr_cls = "zmq.green.Socket" + + def __init__(self, *a, **kw): + super().__init__(*a, **kw) + self.__in_send_multipart = False + self.__in_recv_multipart = False + self.__setup_events() + + def __del__(self): + self.close() + + def close(self, linger=None): + super().close(linger) + self.__cleanup_events() + + def __cleanup_events(self): + # close the _state_event event, keeps the number of active file descriptors down + if getattr(self, '_state_event', None): + _stop(self._state_event) + self._state_event = None + # if the socket has entered a close state resume any waiting greenlets + self.__writable.set() + self.__readable.set() + + def __setup_events(self): + self.__readable = AsyncResult() + self.__writable = AsyncResult() + self.__readable.set() + self.__writable.set() + + try: + self._state_event = get_hub().loop.io( + self.getsockopt(zmq.FD), 1 + ) # read state watcher + self._state_event.start(self.__state_changed) + except AttributeError: + # for gevent<1.0 compatibility + from gevent.core import read_event + + self._state_event = read_event( + self.getsockopt(zmq.FD), self.__state_changed, persist=True + ) + + def __state_changed(self, event=None, _evtype=None): + if self.closed: + self.__cleanup_events() + return + try: + # avoid triggering __state_changed from inside __state_changed + events = super().getsockopt(zmq.EVENTS) + except zmq.ZMQError as exc: + self.__writable.set_exception(exc) + self.__readable.set_exception(exc) + else: + if events & zmq.POLLOUT: + self.__writable.set() + if events & zmq.POLLIN: + self.__readable.set() + + def _wait_write(self): + assert self.__writable.ready(), "Only one greenlet can be waiting on this event" + self.__writable = AsyncResult() + # timeout is because libzmq cannot be trusted to properly signal a new send event: + # this is effectively a maximum poll interval of 1s + tic = time.time() + dt = self._gevent_bug_timeout + if dt: + timeout = gevent.Timeout(seconds=dt) + else: + timeout = None + try: + if timeout: + timeout.start() + self.__writable.get(block=True) + except gevent.Timeout as t: + if t is not timeout: + raise + toc = time.time() + # gevent bug: get can raise timeout even on clean return + # don't display zmq bug warning for gevent bug (this is getting ridiculous) + if ( + self._debug_gevent + and timeout + and toc - tic > dt + and self.getsockopt(zmq.EVENTS) & zmq.POLLOUT + ): + print( + f"BUG: gevent may have missed a libzmq send event on {self.FD}!", + file=sys.stderr, + ) + finally: + if timeout: + timeout.close() + self.__writable.set() + + def _wait_read(self): + assert self.__readable.ready(), "Only one greenlet can be waiting on this event" + self.__readable = AsyncResult() + # timeout is because libzmq cannot always be trusted to play nice with libevent. + # I can only confirm that this actually happens for send, but lets be symmetrical + # with our dirty hacks. + # this is effectively a maximum poll interval of 1s + tic = time.time() + dt = self._gevent_bug_timeout + if dt: + timeout = gevent.Timeout(seconds=dt) + else: + timeout = None + try: + if timeout: + timeout.start() + self.__readable.get(block=True) + except gevent.Timeout as t: + if t is not timeout: + raise + toc = time.time() + # gevent bug: get can raise timeout even on clean return + # don't display zmq bug warning for gevent bug (this is getting ridiculous) + if ( + self._debug_gevent + and timeout + and toc - tic > dt + and self.getsockopt(zmq.EVENTS) & zmq.POLLIN + ): + print( + f"BUG: gevent may have missed a libzmq recv event on {self.FD}!", + file=sys.stderr, + ) + finally: + if timeout: + timeout.close() + self.__readable.set() + + def send(self, data, flags=0, copy=True, track=False, **kwargs): + """send, which will only block current greenlet + + state_changed always fires exactly once (success or fail) at the + end of this method. + """ + + # if we're given the NOBLOCK flag act as normal and let the EAGAIN get raised + if flags & zmq.NOBLOCK: + try: + msg = super().send(data, flags, copy, track, **kwargs) + finally: + if not self.__in_send_multipart: + self.__state_changed() + return msg + # ensure the zmq.NOBLOCK flag is part of flags + flags |= zmq.NOBLOCK + while True: # Attempt to complete this operation indefinitely, blocking the current greenlet + try: + # attempt the actual call + msg = super().send(data, flags, copy, track) + except zmq.ZMQError as e: + # if the raised ZMQError is not EAGAIN, reraise + if e.errno != zmq.EAGAIN: + if not self.__in_send_multipart: + self.__state_changed() + raise + else: + if not self.__in_send_multipart: + self.__state_changed() + return msg + # defer to the event loop until we're notified the socket is writable + self._wait_write() + + def recv(self, flags=0, copy=True, track=False): + """recv, which will only block current greenlet + + state_changed always fires exactly once (success or fail) at the + end of this method. + """ + if flags & zmq.NOBLOCK: + try: + msg = super().recv(flags, copy, track) + finally: + if not self.__in_recv_multipart: + self.__state_changed() + return msg + + flags |= zmq.NOBLOCK + while True: + try: + msg = super().recv(flags, copy, track) + except zmq.ZMQError as e: + if e.errno != zmq.EAGAIN: + if not self.__in_recv_multipart: + self.__state_changed() + raise + else: + if not self.__in_recv_multipart: + self.__state_changed() + return msg + self._wait_read() + + def recv_into(self, buffer, /, *, nbytes=0, flags=0): + """recv_into, which will only block current greenlet""" + if flags & zmq.DONTWAIT: + return super().recv_into(buffer, nbytes=nbytes, flags=flags) + flags |= zmq.DONTWAIT + while True: + try: + recvd = super().recv_into(buffer, nbytes=nbytes, flags=flags) + except zmq.ZMQError as e: + if e.errno != zmq.EAGAIN: + self.__state_changed() + raise + else: + self.__state_changed() + return recvd + self._wait_read() + + def send_multipart(self, *args, **kwargs): + """wrap send_multipart to prevent state_changed on each partial send""" + self.__in_send_multipart = True + try: + msg = super().send_multipart(*args, **kwargs) + finally: + self.__in_send_multipart = False + self.__state_changed() + return msg + + def recv_multipart(self, *args, **kwargs): + """wrap recv_multipart to prevent state_changed on each partial recv""" + self.__in_recv_multipart = True + try: + msg = super().recv_multipart(*args, **kwargs) + finally: + self.__in_recv_multipart = False + self.__state_changed() + return msg + + def get(self, opt): + """trigger state_changed on getsockopt(EVENTS)""" + if opt in TIMEOS: + warnings.warn( + "TIMEO socket options have no effect in zmq.green", UserWarning + ) + optval = super().get(opt) + if opt == zmq.EVENTS: + self.__state_changed() + return optval + + def set(self, opt, val): + """set socket option""" + if opt in TIMEOS: + warnings.warn( + "TIMEO socket options have no effect in zmq.green", UserWarning + ) + return super().set(opt, val) + + +class _Context(_original_Context[_Socket]): + """Replacement for :class:`zmq.Context` + + Ensures that the greened Socket above is used in calls to `socket`. + """ + + _socket_class = _Socket + _repr_cls = "zmq.green.Context" + + # avoid sharing instance with base Context class + _instance = None diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/green/device.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/green/device.py new file mode 100644 index 0000000000000000000000000000000000000000..f9beae39eff8f023997aa075afd2a1baf80ac196 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/green/device.py @@ -0,0 +1,34 @@ +# Copyright (C) PyZMQ Developers +# Distributed under the terms of the Modified BSD License. +from __future__ import annotations + +import zmq +from zmq.green import Poller + + +def device(device_type, isocket, osocket): + """Start a zeromq device (gevent-compatible). + + Unlike the true zmq.device, this does not release the GIL. + + Parameters + ---------- + device_type : (QUEUE, FORWARDER, STREAMER) + The type of device to start (ignored). + isocket : Socket + The Socket instance for the incoming traffic. + osocket : Socket + The Socket instance for the outbound traffic. + """ + p = Poller() + if osocket == -1: + osocket = isocket + p.register(isocket, zmq.POLLIN) + p.register(osocket, zmq.POLLIN) + + while True: + events = dict(p.poll()) + if isocket in events: + osocket.send_multipart(isocket.recv_multipart()) + if osocket in events: + isocket.send_multipart(osocket.recv_multipart()) diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/green/eventloop/__init__.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/green/eventloop/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..b0ef0272c4e93a6f7a9955e9ac16f9a6ddf148e2 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/green/eventloop/__init__.py @@ -0,0 +1,3 @@ +from zmq.green.eventloop.ioloop import IOLoop + +__all__ = ['IOLoop'] diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/green/eventloop/ioloop.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/green/eventloop/ioloop.py new file mode 100644 index 0000000000000000000000000000000000000000..50e9151469570311c2fbc6af9fbb8d04b2d594f4 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/green/eventloop/ioloop.py @@ -0,0 +1 @@ +from zmq.eventloop.ioloop import * # noqa diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/green/eventloop/zmqstream.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/green/eventloop/zmqstream.py new file mode 100644 index 0000000000000000000000000000000000000000..c06c2ab50e1b7e4ef1501e78a7ac85f2fa43d6c3 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/green/eventloop/zmqstream.py @@ -0,0 +1,11 @@ +from zmq.eventloop import zmqstream +from zmq.green.eventloop.ioloop import IOLoop + + +class ZMQStream(zmqstream.ZMQStream): + def __init__(self, socket, io_loop=None): + io_loop = io_loop or IOLoop.instance() + super().__init__(socket, io_loop=io_loop) + + +__all__ = ["ZMQStream"] diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/green/poll.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/green/poll.py new file mode 100644 index 0000000000000000000000000000000000000000..7aa1bedd461aac26c26978b29e6e92ec0242dbf0 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/green/poll.py @@ -0,0 +1,101 @@ +from __future__ import annotations + +import gevent +from gevent import select + +import zmq +from zmq import Poller as _original_Poller + + +class _Poller(_original_Poller): + """Replacement for :class:`zmq.Poller` + + Ensures that the greened Poller below is used in calls to + :meth:`zmq.Poller.poll`. + """ + + _gevent_bug_timeout = 1.33 # minimum poll interval, for working around gevent bug + + def _get_descriptors(self): + """Returns three elements tuple with socket descriptors ready + for gevent.select.select + """ + rlist = [] + wlist = [] + xlist = [] + + for socket, flags in self.sockets: + if isinstance(socket, zmq.Socket): + rlist.append(socket.getsockopt(zmq.FD)) + continue + elif isinstance(socket, int): + fd = socket + elif hasattr(socket, 'fileno'): + try: + fd = int(socket.fileno()) + except Exception: + raise ValueError('fileno() must return an valid integer fd') + else: + raise TypeError( + 'Socket must be a 0MQ socket, an integer fd ' + f'or have a fileno() method: {socket!r}' + ) + + if flags & zmq.POLLIN: + rlist.append(fd) + if flags & zmq.POLLOUT: + wlist.append(fd) + if flags & zmq.POLLERR: + xlist.append(fd) + + return (rlist, wlist, xlist) + + def poll(self, timeout=-1): + """Overridden method to ensure that the green version of + Poller is used. + + Behaves the same as :meth:`zmq.core.Poller.poll` + """ + + if timeout is None: + timeout = -1 + + if timeout < 0: + timeout = -1 + + rlist = None + wlist = None + xlist = None + + if timeout > 0: + tout = gevent.Timeout.start_new(timeout / 1000.0) + else: + tout = None + + try: + # Loop until timeout or events available + rlist, wlist, xlist = self._get_descriptors() + while True: + events = super().poll(0) + if events or timeout == 0: + return events + + # wait for activity on sockets in a green way + # set a minimum poll frequency, + # because gevent < 1.0 cannot be trusted to catch edge-triggered FD events + _bug_timeout = gevent.Timeout.start_new(self._gevent_bug_timeout) + try: + select.select(rlist, wlist, xlist) + except gevent.Timeout as t: + if t is not _bug_timeout: + raise + finally: + _bug_timeout.cancel() + + except gevent.Timeout as t: + if t is not tout: + raise + return [] + finally: + if timeout > 0: + tout.cancel() diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/log/__init__.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/log/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/log/__main__.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/log/__main__.py new file mode 100644 index 0000000000000000000000000000000000000000..98c6b97c47381d413fa861702a926e1d57d39a8a --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/log/__main__.py @@ -0,0 +1,135 @@ +"""pyzmq log watcher. + +Easily view log messages published by the PUBHandler in zmq.log.handlers + +Designed to be run as an executable module - try this to see options: + python -m zmq.log -h + +Subscribes to the '' (empty string) topic by default which means it will work +out-of-the-box with a PUBHandler object instantiated with default settings. +If you change the root topic with PUBHandler.setRootTopic() you must pass +the value to this script with the --topic argument. + +Note that the default formats for the PUBHandler object selectively include +the log level in the message. This creates redundancy in this script as it +always prints the topic of the message, which includes the log level. +Consider overriding the default formats with PUBHandler.setFormat() to +avoid this issue. + +""" + +# encoding: utf-8 + +# Copyright (C) PyZMQ Developers +# Distributed under the terms of the Modified BSD License. + +import argparse +from datetime import datetime +from typing import Dict + +import zmq + +parser = argparse.ArgumentParser('ZMQ Log Watcher') +parser.add_argument('zmq_pub_url', type=str, help='URL to a ZMQ publisher socket.') +parser.add_argument( + '-t', + '--topic', + type=str, + default='', + help='Only receive messages that start with this topic.', +) +parser.add_argument( + '--timestamp', action='store_true', help='Append local time to the log messages.' +) +parser.add_argument( + '--separator', + type=str, + default=' | ', + help='String to print between topic and message.', +) +parser.add_argument( + '--dateformat', + type=str, + default='%Y-%d-%m %H:%M', + help='Set alternative date format for use with --timestamp.', +) +parser.add_argument( + '--align', + action='store_true', + default=False, + help='Try to align messages by the width of their topics.', +) +parser.add_argument( + '--color', + action='store_true', + default=False, + help='Color the output based on the error level. Requires the colorama module.', +) +args = parser.parse_args() + + +if args.color: + import colorama + + colorama.init() + colors = { + 'DEBUG': colorama.Fore.LIGHTCYAN_EX, + 'INFO': colorama.Fore.LIGHTWHITE_EX, + 'WARNING': colorama.Fore.YELLOW, + 'ERROR': colorama.Fore.LIGHTRED_EX, + 'CRITICAL': colorama.Fore.LIGHTRED_EX, + '__RESET__': colorama.Fore.RESET, + } +else: + colors = {} + + +ctx = zmq.Context() +sub = ctx.socket(zmq.SUB) +sub.subscribe(args.topic.encode("utf8")) +sub.connect(args.zmq_pub_url) + +topic_widths: Dict[int, int] = {} + +while True: + try: + if sub.poll(10, zmq.POLLIN): + topic, msg = sub.recv_multipart() + topics = topic.decode('utf8').strip().split('.') + + if args.align: + topics.extend(' ' for extra in range(len(topics), len(topic_widths))) + aligned_parts = [] + for key, part in enumerate(topics): + topic_widths[key] = max(len(part), topic_widths.get(key, 0)) + fmt = ''.join(('{:<', str(topic_widths[key]), '}')) + aligned_parts.append(fmt.format(part)) + + if len(topics) == 1: + level = topics[0] + else: + level = topics[1] + + fields = { + 'msg': msg.decode('utf8').strip(), + 'ts': ( + datetime.now().strftime(args.dateformat) + ' ' + if args.timestamp + else '' + ), + 'aligned': ( + '.'.join(aligned_parts) + if args.align + else topic.decode('utf8').strip() + ), + 'color': colors.get(level, ''), + 'color_rst': colors.get('__RESET__', ''), + 'sep': args.separator, + } + print('{ts}{color}{aligned}{sep}{msg}{color_rst}'.format(**fields)) + except KeyboardInterrupt: + break + +sub.disconnect(args.zmq_pub_url) +if args.color: + print(colorama.Fore.RESET) diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/log/handlers.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/log/handlers.py new file mode 100644 index 0000000000000000000000000000000000000000..8138d2eed96c676261688f74ba9fe91dbc29d9c0 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/log/handlers.py @@ -0,0 +1,232 @@ +"""pyzmq logging handlers. + +This mainly defines the PUBHandler object for publishing logging messages over +a zmq.PUB socket. + +The PUBHandler can be used with the regular logging module, as in:: + + >>> import logging + >>> handler = PUBHandler('tcp://127.0.0.1:12345') + >>> handler.root_topic = 'foo' + >>> logger = logging.getLogger('foobar') + >>> logger.setLevel(logging.DEBUG) + >>> logger.addHandler(handler) + +Or using ``dictConfig``, as in:: + + >>> from logging.config import dictConfig + >>> socket = Context.instance().socket(PUB) + >>> socket.connect('tcp://127.0.0.1:12345') + >>> dictConfig({ + >>> 'version': 1, + >>> 'handlers': { + >>> 'zmq': { + >>> 'class': 'zmq.log.handlers.PUBHandler', + >>> 'level': logging.DEBUG, + >>> 'root_topic': 'foo', + >>> 'interface_or_socket': socket + >>> } + >>> }, + >>> 'root': { + >>> 'level': 'DEBUG', + >>> 'handlers': ['zmq'], + >>> } + >>> }) + + +After this point, all messages logged by ``logger`` will be published on the +PUB socket. + +Code adapted from StarCluster: + + https://github.com/jtriley/StarCluster/blob/StarCluster-0.91/starcluster/logger.py +""" + +from __future__ import annotations + +import logging +from copy import copy + +import zmq + +# Copyright (C) PyZMQ Developers +# Distributed under the terms of the Modified BSD License. + + +TOPIC_DELIM = "::" # delimiter for splitting topics on the receiving end. + + +class PUBHandler(logging.Handler): + """A basic logging handler that emits log messages through a PUB socket. + + Takes a PUB socket already bound to interfaces or an interface to bind to. + + Example:: + + sock = context.socket(zmq.PUB) + sock.bind('inproc://log') + handler = PUBHandler(sock) + + Or:: + + handler = PUBHandler('inproc://loc') + + These are equivalent. + + Log messages handled by this handler are broadcast with ZMQ topics + ``this.root_topic`` comes first, followed by the log level + (DEBUG,INFO,etc.), followed by any additional subtopics specified in the + message by: log.debug("subtopic.subsub::the real message") + """ + + ctx: zmq.Context + socket: zmq.Socket + + def __init__( + self, + interface_or_socket: str | zmq.Socket, + context: zmq.Context | None = None, + root_topic: str = '', + ) -> None: + logging.Handler.__init__(self) + self.root_topic = root_topic + self.formatters = { + logging.DEBUG: logging.Formatter( + "%(levelname)s %(filename)s:%(lineno)d - %(message)s\n" + ), + logging.INFO: logging.Formatter("%(message)s\n"), + logging.WARN: logging.Formatter( + "%(levelname)s %(filename)s:%(lineno)d - %(message)s\n" + ), + logging.ERROR: logging.Formatter( + "%(levelname)s %(filename)s:%(lineno)d - %(message)s - %(exc_info)s\n" + ), + logging.CRITICAL: logging.Formatter( + "%(levelname)s %(filename)s:%(lineno)d - %(message)s\n" + ), + } + if isinstance(interface_or_socket, zmq.Socket): + self.socket = interface_or_socket + self.ctx = self.socket.context + else: + self.ctx = context or zmq.Context() + self.socket = self.ctx.socket(zmq.PUB) + self.socket.bind(interface_or_socket) + + @property + def root_topic(self) -> str: + return self._root_topic + + @root_topic.setter + def root_topic(self, value: str): + self.setRootTopic(value) + + def setRootTopic(self, root_topic: str): + """Set the root topic for this handler. + + This value is prepended to all messages published by this handler, and it + defaults to the empty string ''. When you subscribe to this socket, you must + set your subscription to an empty string, or to at least the first letter of + the binary representation of this string to ensure you receive any messages + from this handler. + + If you use the default empty string root topic, messages will begin with + the binary representation of the log level string (INFO, WARN, etc.). + Note that ZMQ SUB sockets can have multiple subscriptions. + """ + if isinstance(root_topic, bytes): + root_topic = root_topic.decode("utf8") + self._root_topic = root_topic + + def setFormatter(self, fmt, level=logging.NOTSET): + """Set the Formatter for this handler. + + If no level is provided, the same format is used for all levels. This + will overwrite all selective formatters set in the object constructor. + """ + if level == logging.NOTSET: + for fmt_level in self.formatters.keys(): + self.formatters[fmt_level] = fmt + else: + self.formatters[level] = fmt + + def format(self, record): + """Format a record.""" + return self.formatters[record.levelno].format(record) + + def emit(self, record): + """Emit a log message on my socket.""" + + # LogRecord.getMessage explicitly allows msg to be anything _castable_ to a str + try: + topic, msg = str(record.msg).split(TOPIC_DELIM, 1) + except ValueError: + topic = "" + else: + # copy to avoid mutating LogRecord in-place + record = copy(record) + record.msg = msg + + try: + bmsg = self.format(record).encode("utf8") + except Exception: + self.handleError(record) + return + + topic_list = [] + + if self.root_topic: + topic_list.append(self.root_topic) + + topic_list.append(record.levelname) + + if topic: + topic_list.append(topic) + + btopic = '.'.join(topic_list).encode("utf8", "replace") + + self.socket.send_multipart([btopic, bmsg]) + + +class TopicLogger(logging.Logger): + """A simple wrapper that takes an additional argument to log methods. + + All the regular methods exist, but instead of one msg argument, two + arguments: topic, msg are passed. + + That is:: + + logger.debug('msg') + + Would become:: + + logger.debug('topic.sub', 'msg') + """ + + def log(self, level, topic, msg, *args, **kwargs): + """Log 'msg % args' with level and topic. + + To pass exception information, use the keyword argument exc_info + with a True value:: + + logger.log(level, "zmq.fun", "We have a %s", + "mysterious problem", exc_info=1) + """ + logging.Logger.log(self, level, f'{topic}{TOPIC_DELIM}{msg}', *args, **kwargs) + + +# Generate the methods of TopicLogger, since they are just adding a +# topic prefix to a message. +for name in "debug warn warning error critical fatal".split(): + try: + meth = getattr(logging.Logger, name) + except AttributeError: + # some methods are missing, e.g. Logger.warn was removed from Python 3.13 + continue + setattr( + TopicLogger, + name, + lambda self, level, topic, msg, *args, **kwargs: meth( + self, level, topic + TOPIC_DELIM + msg, *args, **kwargs + ), + ) diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/py.typed b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/py.typed new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/ssh/__init__.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/ssh/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..57f09568223c48babf9c9d7745218f7e33290eaa --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/ssh/__init__.py @@ -0,0 +1 @@ +from zmq.ssh.tunnel import * diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/ssh/forward.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/ssh/forward.py new file mode 100644 index 0000000000000000000000000000000000000000..074a98f23c43930a47f2aa6b59259a849df2d5e9 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/ssh/forward.py @@ -0,0 +1,95 @@ +# +# This file is adapted from a paramiko demo, and thus licensed under LGPL 2.1. +# Original Copyright (C) 2003-2007 Robey Pointer +# Edits Copyright (C) 2010 The IPython Team +# +# Paramiko is free software; you can redistribute it and/or modify it under the +# terms of the GNU Lesser General Public License as published by the Free +# Software Foundation; either version 2.1 of the License, or (at your option) +# any later version. +# +# Paramiko is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR +# A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more +# details. +# +# You should have received a copy of the GNU Lesser General Public License +# along with Paramiko; if not, see . + +""" +Sample script showing how to do local port forwarding over paramiko. + +This script connects to the requested SSH server and sets up local port +forwarding (the openssh -L option) from a local port through a tunneled +connection to a destination reachable from the SSH server machine. +""" + +import logging +import select +import socketserver + +logger = logging.getLogger('ssh') + + +class ForwardServer(socketserver.ThreadingTCPServer): + daemon_threads = True + allow_reuse_address = True + + +class Handler(socketserver.BaseRequestHandler): + def handle(self): + try: + chan = self.ssh_transport.open_channel( + 'direct-tcpip', + (self.chain_host, self.chain_port), + self.request.getpeername(), + ) + except Exception as e: + logger.debug( + 'Incoming request to %s:%d failed: %r', + self.chain_host, + self.chain_port, + e, + ) + return + if chan is None: + logger.debug( + 'Incoming request to %s:%d was rejected by the SSH server.', + self.chain_host, + self.chain_port, + ) + return + + logger.debug( + f'Connected! Tunnel open {self.request.getpeername()!r} -> {chan.getpeername()!r} -> {(self.chain_host, self.chain_port)!r}' + ) + while True: + r, w, x = select.select([self.request, chan], [], []) + if self.request in r: + data = self.request.recv(1024) + if len(data) == 0: + break + chan.send(data) + if chan in r: + data = chan.recv(1024) + if len(data) == 0: + break + self.request.send(data) + chan.close() + self.request.close() + logger.debug('Tunnel closed ') + + +def forward_tunnel(local_port, remote_host, remote_port, transport): + # this is a little convoluted, but lets me configure things for the Handler + # object. (SocketServer doesn't give Handlers any way to access the outer + # server normally.) + class SubHander(Handler): + chain_host = remote_host + chain_port = remote_port + ssh_transport = transport + + ForwardServer(('127.0.0.1', local_port), SubHander).serve_forever() + + +__all__ = ['forward_tunnel'] diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/ssh/tunnel.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/ssh/tunnel.py new file mode 100644 index 0000000000000000000000000000000000000000..0e9c88e8a1acd88ad3aca4495d9632591cb7d336 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/ssh/tunnel.py @@ -0,0 +1,430 @@ +"""Basic ssh tunnel utilities, and convenience functions for tunneling +zeromq connections. +""" + +# Copyright (C) 2010-2011 IPython Development Team +# Copyright (C) 2011- PyZMQ Developers +# +# Redistributed from IPython under the terms of the BSD License. + +import atexit +import os +import re +import signal +import socket +import sys +import warnings +from getpass import getpass, getuser +from multiprocessing import Process + +try: + with warnings.catch_warnings(): + warnings.simplefilter('ignore', DeprecationWarning) + import paramiko + + SSHException = paramiko.ssh_exception.SSHException +except ImportError: + paramiko = None # type: ignore + + class SSHException(Exception): # type: ignore + pass + +else: + from .forward import forward_tunnel + +try: + import pexpect +except ImportError: + pexpect = None + + +class MaxRetryExceeded(Exception): + pass + + +def select_random_ports(n): + """Select and return n random ports that are available.""" + ports = [] + sockets = [] + for i in range(n): + sock = socket.socket() + sock.bind(('', 0)) + ports.append(sock.getsockname()[1]) + sockets.append(sock) + for sock in sockets: + sock.close() + return ports + + +# ----------------------------------------------------------------------------- +# Check for passwordless login +# ----------------------------------------------------------------------------- +_password_pat = re.compile(rb'pass(word|phrase)', re.IGNORECASE) + + +def try_passwordless_ssh(server, keyfile, paramiko=None): + """Attempt to make an ssh connection without a password. + This is mainly used for requiring password input only once + when many tunnels may be connected to the same server. + + If paramiko is None, the default for the platform is chosen. + """ + if paramiko is None: + paramiko = sys.platform == 'win32' + if not paramiko: + f = _try_passwordless_openssh + else: + f = _try_passwordless_paramiko + return f(server, keyfile) + + +def _try_passwordless_openssh(server, keyfile): + """Try passwordless login with shell ssh command.""" + if pexpect is None: + raise ImportError("pexpect unavailable, use paramiko") + cmd = 'ssh -f ' + server + if keyfile: + cmd += ' -i ' + keyfile + cmd += ' exit' + + # pop SSH_ASKPASS from env + env = os.environ.copy() + env.pop('SSH_ASKPASS', None) + + ssh_newkey = 'Are you sure you want to continue connecting' + p = pexpect.spawn(cmd, env=env) + + MAX_RETRY = 10 + + for _ in range(MAX_RETRY): + try: + i = p.expect([ssh_newkey, _password_pat], timeout=0.1) + if i == 0: + raise SSHException( + 'The authenticity of the host can\'t be established.' + ) + except pexpect.TIMEOUT: + continue + except pexpect.EOF: + return True + else: + return False + + raise MaxRetryExceeded(f"Failed after {MAX_RETRY} attempts") + + +def _try_passwordless_paramiko(server, keyfile): + """Try passwordless login with paramiko.""" + if paramiko is None: + msg = "Paramiko unavailable, " + if sys.platform == 'win32': + msg += "Paramiko is required for ssh tunneled connections on Windows." + else: + msg += "use OpenSSH." + raise ImportError(msg) + username, server, port = _split_server(server) + client = paramiko.SSHClient() + known_hosts = os.path.expanduser("~/.ssh/known_hosts") + try: + client.load_host_keys(known_hosts) + except FileNotFoundError: + pass + + policy_name = os.environ.get("PYZMQ_PARAMIKO_HOST_KEY_POLICY", None) + if policy_name: + policy = getattr(paramiko, f"{policy_name}Policy") + client.set_missing_host_key_policy(policy()) + try: + client.connect( + server, port, username=username, key_filename=keyfile, look_for_keys=True + ) + except paramiko.AuthenticationException: + return False + else: + client.close() + return True + + +def tunnel_connection( + socket, addr, server, keyfile=None, password=None, paramiko=None, timeout=60 +): + """Connect a socket to an address via an ssh tunnel. + + This is a wrapper for socket.connect(addr), when addr is not accessible + from the local machine. It simply creates an ssh tunnel using the remaining args, + and calls socket.connect('tcp://localhost:lport') where lport is the randomly + selected local port of the tunnel. + + """ + new_url, tunnel = open_tunnel( + addr, + server, + keyfile=keyfile, + password=password, + paramiko=paramiko, + timeout=timeout, + ) + socket.connect(new_url) + return tunnel + + +def open_tunnel(addr, server, keyfile=None, password=None, paramiko=None, timeout=60): + """Open a tunneled connection from a 0MQ url. + + For use inside tunnel_connection. + + Returns + ------- + + (url, tunnel) : (str, object) + The 0MQ url that has been forwarded, and the tunnel object + """ + + lport = select_random_ports(1)[0] + transport, addr = addr.split('://') + ip, rport = addr.split(':') + rport = int(rport) + if paramiko is None: + paramiko = sys.platform == 'win32' + if paramiko: + tunnelf = paramiko_tunnel + else: + tunnelf = openssh_tunnel + + tunnel = tunnelf( + lport, + rport, + server, + remoteip=ip, + keyfile=keyfile, + password=password, + timeout=timeout, + ) + return f'tcp://127.0.0.1:{lport}', tunnel + + +def openssh_tunnel( + lport, rport, server, remoteip='127.0.0.1', keyfile=None, password=None, timeout=60 +): + """Create an ssh tunnel using command-line ssh that connects port lport + on this machine to localhost:rport on server. The tunnel + will automatically close when not in use, remaining open + for a minimum of timeout seconds for an initial connection. + + This creates a tunnel redirecting `localhost:lport` to `remoteip:rport`, + as seen from `server`. + + keyfile and password may be specified, but ssh config is checked for defaults. + + Parameters + ---------- + + lport : int + local port for connecting to the tunnel from this machine. + rport : int + port on the remote machine to connect to. + server : str + The ssh server to connect to. The full ssh server string will be parsed. + user@server:port + remoteip : str [Default: 127.0.0.1] + The remote ip, specifying the destination of the tunnel. + Default is localhost, which means that the tunnel would redirect + localhost:lport on this machine to localhost:rport on the *server*. + + keyfile : str; path to private key file + This specifies a key to be used in ssh login, default None. + Regular default ssh keys will be used without specifying this argument. + password : str; + Your ssh password to the ssh server. Note that if this is left None, + you will be prompted for it if passwordless key based login is unavailable. + timeout : int [default: 60] + The time (in seconds) after which no activity will result in the tunnel + closing. This prevents orphaned tunnels from running forever. + """ + if pexpect is None: + raise ImportError("pexpect unavailable, use paramiko_tunnel") + ssh = "ssh " + if keyfile: + ssh += "-i " + keyfile + + if ':' in server: + server, port = server.split(':') + ssh += f" -p {port}" + + cmd = f"{ssh} -O check {server}" + (output, exitstatus) = pexpect.run(cmd, withexitstatus=True) + if not exitstatus: + pid = int(output[output.find(b"(pid=") + 5 : output.find(b")")]) + cmd = f"{ssh} -O forward -L 127.0.0.1:{lport}:{remoteip}:{rport} {server}" + (output, exitstatus) = pexpect.run(cmd, withexitstatus=True) + if not exitstatus: + atexit.register(_stop_tunnel, cmd.replace("-O forward", "-O cancel", 1)) + return pid + cmd = f"{ssh} -f -S none -L 127.0.0.1:{lport}:{remoteip}:{rport} {server} sleep {timeout}" + + # pop SSH_ASKPASS from env + env = os.environ.copy() + env.pop('SSH_ASKPASS', None) + + ssh_newkey = 'Are you sure you want to continue connecting' + tunnel = pexpect.spawn(cmd, env=env) + failed = False + MAX_RETRY = 10 + for _ in range(MAX_RETRY): + try: + i = tunnel.expect([ssh_newkey, _password_pat], timeout=0.1) + if i == 0: + raise SSHException( + 'The authenticity of the host can\'t be established.' + ) + except pexpect.TIMEOUT: + continue + except pexpect.EOF: + if tunnel.exitstatus: + print(tunnel.exitstatus) + print(tunnel.before) + print(tunnel.after) + raise RuntimeError(f"tunnel '{cmd}' failed to start") + else: + return tunnel.pid + else: + if failed: + print("Password rejected, try again") + password = None + if password is None: + password = getpass(f"{server}'s password: ") + tunnel.sendline(password) + failed = True + raise MaxRetryExceeded(f"Failed after {MAX_RETRY} attempts") + + +def _stop_tunnel(cmd): + pexpect.run(cmd) + + +def _split_server(server): + if '@' in server: + username, server = server.split('@', 1) + else: + username = getuser() + if ':' in server: + server, port = server.split(':') + port = int(port) + else: + port = 22 + return username, server, port + + +def paramiko_tunnel( + lport, rport, server, remoteip='127.0.0.1', keyfile=None, password=None, timeout=60 +): + """launch a tunner with paramiko in a subprocess. This should only be used + when shell ssh is unavailable (e.g. Windows). + + This creates a tunnel redirecting `localhost:lport` to `remoteip:rport`, + as seen from `server`. + + If you are familiar with ssh tunnels, this creates the tunnel: + + ssh server -L localhost:lport:remoteip:rport + + keyfile and password may be specified, but ssh config is checked for defaults. + + + Parameters + ---------- + + lport : int + local port for connecting to the tunnel from this machine. + rport : int + port on the remote machine to connect to. + server : str + The ssh server to connect to. The full ssh server string will be parsed. + user@server:port + remoteip : str [Default: 127.0.0.1] + The remote ip, specifying the destination of the tunnel. + Default is localhost, which means that the tunnel would redirect + localhost:lport on this machine to localhost:rport on the *server*. + + keyfile : str; path to private key file + This specifies a key to be used in ssh login, default None. + Regular default ssh keys will be used without specifying this argument. + password : str; + Your ssh password to the ssh server. Note that if this is left None, + you will be prompted for it if passwordless key based login is unavailable. + timeout : int [default: 60] + The time (in seconds) after which no activity will result in the tunnel + closing. This prevents orphaned tunnels from running forever. + + """ + if paramiko is None: + raise ImportError("Paramiko not available") + + if password is None: + if not _try_passwordless_paramiko(server, keyfile): + password = getpass(f"{server}'s password: ") + + p = Process( + target=_paramiko_tunnel, + args=(lport, rport, server, remoteip), + kwargs=dict(keyfile=keyfile, password=password), + ) + p.daemon = True + p.start() + return p + + +def _paramiko_tunnel(lport, rport, server, remoteip, keyfile=None, password=None): + """Function for actually starting a paramiko tunnel, to be passed + to multiprocessing.Process(target=this), and not called directly. + """ + username, server, port = _split_server(server) + client = paramiko.SSHClient() + client.load_system_host_keys() + client.set_missing_host_key_policy(paramiko.WarningPolicy()) + + try: + client.connect( + server, + port, + username=username, + key_filename=keyfile, + look_for_keys=True, + password=password, + ) + # except paramiko.AuthenticationException: + # if password is None: + # password = getpass("%s@%s's password: "%(username, server)) + # client.connect(server, port, username=username, password=password) + # else: + # raise + except Exception as e: + print(f'*** Failed to connect to {server}:{port}: {e!r}') + sys.exit(1) + + # Don't let SIGINT kill the tunnel subprocess + signal.signal(signal.SIGINT, signal.SIG_IGN) + + try: + forward_tunnel(lport, remoteip, rport, client.get_transport()) + except KeyboardInterrupt: + print('SIGINT: Port forwarding stopped cleanly') + sys.exit(0) + except Exception as e: + print(f"Port forwarding stopped uncleanly: {e}") + sys.exit(255) + + +if sys.platform == 'win32': + ssh_tunnel = paramiko_tunnel +else: + ssh_tunnel = openssh_tunnel + + +__all__ = [ + 'tunnel_connection', + 'ssh_tunnel', + 'openssh_tunnel', + 'paramiko_tunnel', + 'try_passwordless_ssh', +] diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/sugar/__init__.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/sugar/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..88e755682c1096272830c01e37ef71d822ec1b05 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/sugar/__init__.py @@ -0,0 +1,39 @@ +"""pure-Python sugar wrappers for core 0MQ objects.""" + +# Copyright (C) PyZMQ Developers +# Distributed under the terms of the Modified BSD License. + +from __future__ import annotations + +from zmq import error +from zmq.backend import proxy +from zmq.constants import DeviceType +from zmq.sugar import context, frame, poll, socket, tracker, version + + +def device(device_type: DeviceType, frontend: socket.Socket, backend: socket.Socket): + """Deprecated alias for zmq.proxy + + .. deprecated:: libzmq-3.2 + .. deprecated:: 13.0 + """ + + return proxy(frontend, backend) + + +__all__ = ["device"] +for submod in (context, error, frame, poll, socket, tracker, version): + __all__.extend(submod.__all__) + +from zmq.error import * # noqa +from zmq.sugar.context import * # noqa +from zmq.sugar.frame import * # noqa +from zmq.sugar.poll import * # noqa +from zmq.sugar.socket import * # noqa + +# deprecated: +from zmq.sugar.stopwatch import Stopwatch # noqa +from zmq.sugar.tracker import * # noqa +from zmq.sugar.version import * # noqa + +__all__.append('Stopwatch') diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/sugar/__init__.pyi b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/sugar/__init__.pyi new file mode 100644 index 0000000000000000000000000000000000000000..732f605017a063e9b66403921623a468f1ea0abe --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/sugar/__init__.pyi @@ -0,0 +1,10 @@ +from zmq.error import * + +from . import constants as constants +from .constants import * +from .context import * +from .frame import * +from .poll import * +from .socket import * +from .tracker import * +from .version import * diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/sugar/attrsettr.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/sugar/attrsettr.py new file mode 100644 index 0000000000000000000000000000000000000000..844fce606e53def45930d2e3a19873b4e8b4aeac --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/sugar/attrsettr.py @@ -0,0 +1,79 @@ +"""Mixin for mapping set/getattr to self.set/get""" + +# Copyright (C) PyZMQ Developers +# Distributed under the terms of the Modified BSD License. +from __future__ import annotations + +import errno +from typing import TypeVar, Union + +from .. import constants + +T = TypeVar("T") +OptValT = Union[str, bytes, int] + + +class AttributeSetter: + def __setattr__(self, key: str, value: OptValT) -> None: + """set zmq options by attribute""" + + if key in self.__dict__: + object.__setattr__(self, key, value) + return + # regular setattr only allowed for class-defined attributes + for cls in self.__class__.mro(): + if key in cls.__dict__ or key in getattr(cls, "__annotations__", {}): + object.__setattr__(self, key, value) + return + + upper_key = key.upper() + try: + opt = getattr(constants, upper_key) + except AttributeError: + raise AttributeError( + f"{self.__class__.__name__} has no such option: {upper_key}" + ) + else: + self._set_attr_opt(upper_key, opt, value) + + def _set_attr_opt(self, name: str, opt: int, value: OptValT) -> None: + """override if setattr should do something other than call self.set""" + self.set(opt, value) + + def __getattr__(self, key: str) -> OptValT: + """get zmq options by attribute""" + upper_key = key.upper() + try: + opt = getattr(constants, upper_key) + except AttributeError: + raise AttributeError( + f"{self.__class__.__name__} has no such option: {upper_key}" + ) from None + else: + from zmq import ZMQError + + try: + return self._get_attr_opt(upper_key, opt) + except ZMQError as e: + # EINVAL will be raised on access for write-only attributes. + # Turn that into an AttributeError + # necessary for mocking + if e.errno in {errno.EINVAL, errno.EFAULT}: + raise AttributeError(f"{key} attribute is write-only") + else: + raise + + def _get_attr_opt(self, name, opt) -> OptValT: + """override if getattr should do something other than call self.get""" + return self.get(opt) + + def get(self, opt: int) -> OptValT: + """Override in subclass""" + raise NotImplementedError("override in subclass") + + def set(self, opt: int, val: OptValT) -> None: + """Override in subclass""" + raise NotImplementedError("override in subclass") + + +__all__ = ['AttributeSetter'] diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/sugar/context.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/sugar/context.py new file mode 100644 index 0000000000000000000000000000000000000000..21bc2cdda9d9319b03a6a0b45d791a6c5e2c3e8a --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/sugar/context.py @@ -0,0 +1,420 @@ +"""Python bindings for 0MQ.""" + +# Copyright (C) PyZMQ Developers +# Distributed under the terms of the Modified BSD License. + +from __future__ import annotations + +import atexit +import os +from threading import Lock +from typing import Any, Callable, Generic, TypeVar, overload +from warnings import warn +from weakref import WeakSet + +import zmq +from zmq._typing import TypeAlias +from zmq.backend import Context as ContextBase +from zmq.constants import ContextOption, Errno, SocketOption +from zmq.error import ZMQError +from zmq.utils.interop import cast_int_addr + +from .attrsettr import AttributeSetter, OptValT +from .socket import Socket, SyncSocket + +# notice when exiting, to avoid triggering term on exit +_exiting = False + + +def _notice_atexit() -> None: + global _exiting + _exiting = True + + +atexit.register(_notice_atexit) + +_ContextType = TypeVar('_ContextType', bound='Context') +_SocketType = TypeVar('_SocketType', bound='Socket', covariant=True) + + +class Context(ContextBase, AttributeSetter, Generic[_SocketType]): + """Create a zmq Context + + A zmq Context creates sockets via its ``ctx.socket`` method. + + .. versionchanged:: 24 + + When using a Context as a context manager (``with zmq.Context()``), + or deleting a context without closing it first, + ``ctx.destroy()`` is called, + closing any leftover sockets, + instead of `ctx.term()` which requires sockets to be closed first. + + This prevents hangs caused by `ctx.term()` if sockets are left open, + but means that unclean destruction of contexts + (with sockets left open) is not safe + if sockets are managed in other threads. + + .. versionadded:: 25 + + Contexts can now be shadowed by passing another Context. + This helps in creating an async copy of a sync context or vice versa:: + + ctx = zmq.Context(async_ctx) + + Which previously had to be:: + + ctx = zmq.Context.shadow(async_ctx.underlying) + """ + + sockopts: dict[int, Any] + _instance: Any = None + _instance_lock = Lock() + _instance_pid: int | None = None + _shadow = False + _shadow_obj = None + _warn_destroy_close = False + _sockets: WeakSet + # mypy doesn't like a default value here + _socket_class: type[_SocketType] = Socket # type: ignore + + @overload + def __init__(self: SyncContext, io_threads: int = 1): ... + + @overload + def __init__(self: SyncContext, io_threads: Context, /): ... + + @overload + def __init__(self: SyncContext, *, shadow: Context | int): ... + + def __init__( + self: SyncContext, + io_threads: int | Context = 1, + shadow: Context | int = 0, + ) -> None: + if isinstance(io_threads, Context): + # allow positional shadow `zmq.Context(zmq.asyncio.Context())` + # this s + shadow = io_threads + io_threads = 1 + + shadow_address: int = 0 + if shadow: + self._shadow = True + # hold a reference to the shadow object + self._shadow_obj = shadow + if not isinstance(shadow, int): + try: + shadow = shadow.underlying + except AttributeError: + pass + shadow_address = cast_int_addr(shadow) + else: + self._shadow = False + super().__init__(io_threads=io_threads, shadow=shadow_address) + self.sockopts = {} + self._sockets = WeakSet() + + def __del__(self) -> None: + """Deleting a Context without closing it destroys it and all sockets. + + .. versionchanged:: 24 + Switch from threadsafe `term()` which hangs in the event of open sockets + to less safe `destroy()` which + warns about any leftover sockets and closes them. + """ + + # Calling locals() here conceals issue #1167 on Windows CPython 3.5.4. + locals() + + if not self._shadow and not _exiting and not self.closed: + self._warn_destroy_close = True + if warn is not None and getattr(self, "_sockets", None) is not None: + # warn can be None during process teardown + warn( + f"Unclosed context {self}", + ResourceWarning, + stacklevel=2, + source=self, + ) + self.destroy() + + _repr_cls = "zmq.Context" + + def __repr__(self) -> str: + cls = self.__class__ + # look up _repr_cls on exact class, not inherited + _repr_cls = cls.__dict__.get("_repr_cls", None) + if _repr_cls is None: + _repr_cls = f"{cls.__module__}.{cls.__name__}" + + closed = ' closed' if self.closed else '' + if getattr(self, "_sockets", None): + n_sockets = len(self._sockets) + s = 's' if n_sockets > 1 else '' + sockets = f"{n_sockets} socket{s}" + else: + sockets = "" + return f"<{_repr_cls}({sockets}) at {hex(id(self))}{closed}>" + + def __enter__(self: _ContextType) -> _ContextType: + return self + + def __exit__(self, exc_type: Any, exc_value: Any, traceback: Any) -> None: + # warn about any leftover sockets before closing them + self._warn_destroy_close = True + self.destroy() + + def __copy__(self: _ContextType, memo: Any = None) -> _ContextType: + """Copying a Context creates a shadow copy""" + return self.__class__.shadow(self.underlying) + + __deepcopy__ = __copy__ + + @classmethod + def shadow(cls: type[_ContextType], address: int | zmq.Context) -> _ContextType: + """Shadow an existing libzmq context + + address is a zmq.Context or an integer (or FFI pointer) + representing the address of the libzmq context. + + .. versionadded:: 14.1 + + .. versionadded:: 25 + Support for shadowing `zmq.Context` objects, + instead of just integer addresses. + """ + return cls(shadow=address) + + @classmethod + def shadow_pyczmq(cls: type[_ContextType], ctx: Any) -> _ContextType: + """Shadow an existing pyczmq context + + ctx is the FFI `zctx_t *` pointer + + .. versionadded:: 14.1 + """ + from pyczmq import zctx # type: ignore + + from zmq.utils.interop import cast_int_addr + + underlying = zctx.underlying(ctx) + address = cast_int_addr(underlying) + return cls(shadow=address) + + # static method copied from tornado IOLoop.instance + @classmethod + def instance(cls: type[_ContextType], io_threads: int = 1) -> _ContextType: + """Returns a global Context instance. + + Most single-process applications have a single, global Context. + Use this method instead of passing around Context instances + throughout your code. + + A common pattern for classes that depend on Contexts is to use + a default argument to enable programs with multiple Contexts + but not require the argument for simpler applications:: + + class MyClass(object): + def __init__(self, context=None): + self.context = context or Context.instance() + + .. versionchanged:: 18.1 + + When called in a subprocess after forking, + a new global instance is created instead of inheriting + a Context that won't work from the parent process. + """ + if ( + cls._instance is None + or cls._instance_pid != os.getpid() + or cls._instance.closed + ): + with cls._instance_lock: + if ( + cls._instance is None + or cls._instance_pid != os.getpid() + or cls._instance.closed + ): + cls._instance = cls(io_threads=io_threads) + cls._instance_pid = os.getpid() + return cls._instance + + def term(self) -> None: + """Close or terminate the context. + + Context termination is performed in the following steps: + + - Any blocking operations currently in progress on sockets open within context shall + raise :class:`zmq.ContextTerminated`. + With the exception of socket.close(), any further operations on sockets open within this context + shall raise :class:`zmq.ContextTerminated`. + - After interrupting all blocking calls, term shall block until the following conditions are satisfied: + - All sockets open within context have been closed. + - For each socket within context, all messages sent on the socket have either been + physically transferred to a network peer, + or the socket's linger period set with the zmq.LINGER socket option has expired. + + For further details regarding socket linger behaviour refer to libzmq documentation for ZMQ_LINGER. + + This can be called to close the context by hand. If this is not called, + the context will automatically be closed when it is garbage collected, + in which case you may see a ResourceWarning about the unclosed context. + """ + super().term() + + # ------------------------------------------------------------------------- + # Hooks for ctxopt completion + # ------------------------------------------------------------------------- + + def __dir__(self) -> list[str]: + keys = dir(self.__class__) + keys.extend(ContextOption.__members__) + return keys + + # ------------------------------------------------------------------------- + # Creating Sockets + # ------------------------------------------------------------------------- + + def _add_socket(self, socket: Any) -> None: + """Add a weakref to a socket for Context.destroy / reference counting""" + self._sockets.add(socket) + + def _rm_socket(self, socket: Any) -> None: + """Remove a socket for Context.destroy / reference counting""" + # allow _sockets to be None in case of process teardown + if getattr(self, "_sockets", None) is not None: + self._sockets.discard(socket) + + def destroy(self, linger: int | None = None) -> None: + """Close all sockets associated with this context and then terminate + the context. + + .. warning:: + + destroy involves calling :meth:`Socket.close`, which is **NOT** threadsafe. + If there are active sockets in other threads, this must not be called. + + Parameters + ---------- + + linger : int, optional + If specified, set LINGER on sockets prior to closing them. + """ + if self.closed: + return + + sockets: list[_SocketType] = list(getattr(self, "_sockets", None) or []) + for s in sockets: + if s and not s.closed: + if self._warn_destroy_close and warn is not None: + # warn can be None during process teardown + warn( + f"Destroying context with unclosed socket {s}", + ResourceWarning, + stacklevel=3, + source=s, + ) + if linger is not None: + s.setsockopt(SocketOption.LINGER, linger) + s.close() + + self.term() + + def socket( + self: _ContextType, + socket_type: int, + socket_class: Callable[[_ContextType, int], _SocketType] | None = None, + **kwargs: Any, + ) -> _SocketType: + """Create a Socket associated with this Context. + + Parameters + ---------- + socket_type : int + The socket type, which can be any of the 0MQ socket types: + REQ, REP, PUB, SUB, PAIR, DEALER, ROUTER, PULL, PUSH, etc. + + socket_class: zmq.Socket + The socket class to instantiate, if different from the default for this Context. + e.g. for creating an asyncio socket attached to a default Context or vice versa. + + .. versionadded:: 25 + + kwargs: + will be passed to the __init__ method of the socket class. + """ + if self.closed: + raise ZMQError(Errno.ENOTSUP) + if socket_class is None: + socket_class = self._socket_class + s: _SocketType = ( + socket_class( # set PYTHONTRACEMALLOC=2 to get the calling frame + self, socket_type, **kwargs + ) + ) + for opt, value in self.sockopts.items(): + try: + s.setsockopt(opt, value) + except ZMQError: + # ignore ZMQErrors, which are likely for socket options + # that do not apply to a particular socket type, e.g. + # SUBSCRIBE for non-SUB sockets. + pass + self._add_socket(s) + return s + + def setsockopt(self, opt: int, value: Any) -> None: + """set default socket options for new sockets created by this Context + + .. versionadded:: 13.0 + """ + self.sockopts[opt] = value + + def getsockopt(self, opt: int) -> OptValT: + """get default socket options for new sockets created by this Context + + .. versionadded:: 13.0 + """ + return self.sockopts[opt] + + def _set_attr_opt(self, name: str, opt: int, value: OptValT) -> None: + """set default sockopts as attributes""" + if name in ContextOption.__members__: + return self.set(opt, value) + elif name in SocketOption.__members__: + self.sockopts[opt] = value + else: + raise AttributeError(f"No such context or socket option: {name}") + + def _get_attr_opt(self, name: str, opt: int) -> OptValT: + """get default sockopts as attributes""" + if name in ContextOption.__members__: + return self.get(opt) + else: + if opt not in self.sockopts: + raise AttributeError(name) + else: + return self.sockopts[opt] + + def __delattr__(self, key: str) -> None: + """delete default sockopts as attributes""" + if key in self.__dict__: + self.__dict__.pop(key) + return + key = key.upper() + try: + opt = getattr(SocketOption, key) + except AttributeError: + raise AttributeError(f"No such socket option: {key!r}") + else: + if opt not in self.sockopts: + raise AttributeError(key) + else: + del self.sockopts[opt] + + +SyncContext: TypeAlias = Context[SyncSocket] + + +__all__ = ['Context', 'SyncContext'] diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/sugar/frame.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/sugar/frame.py new file mode 100644 index 0000000000000000000000000000000000000000..3239d357e1c67bc0bc41b3e01b479f3c893544f2 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/sugar/frame.py @@ -0,0 +1,134 @@ +"""0MQ Frame pure Python methods.""" + +# Copyright (C) PyZMQ Developers +# Distributed under the terms of the Modified BSD License. + +import zmq +from zmq.backend import Frame as FrameBase + +from .attrsettr import AttributeSetter + + +def _draft(v, feature): + zmq.error._check_version(v, feature) + if not zmq.DRAFT_API: + raise RuntimeError( + f"libzmq and pyzmq must be built with draft support for {feature}" + ) + + +class Frame(FrameBase, AttributeSetter): + """ + A zmq message Frame class for non-copying send/recvs and access to message properties. + + A ``zmq.Frame`` wraps an underlying ``zmq_msg_t``. + + Message *properties* can be accessed by treating a Frame like a dictionary (``frame["User-Id"]``). + + .. versionadded:: 14.4, libzmq 4 + + Frames created by ``recv(copy=False)`` can be used to access message properties and attributes, + such as the CURVE User-Id. + + For example:: + + frames = socket.recv_multipart(copy=False) + user_id = frames[0]["User-Id"] + + This class is used if you want to do non-copying send and recvs. + When you pass a chunk of bytes to this class, e.g. ``Frame(buf)``, the + ref-count of `buf` is increased by two: once because the Frame saves `buf` as + an instance attribute and another because a ZMQ message is created that + points to the buffer of `buf`. This second ref-count increase makes sure + that `buf` lives until all messages that use it have been sent. + Once 0MQ sends all the messages and it doesn't need the buffer of ``buf``, + 0MQ will call ``Py_DECREF(s)``. + + Parameters + ---------- + + data : object, optional + any object that provides the buffer interface will be used to + construct the 0MQ message data. + track : bool + whether a MessageTracker_ should be created to track this object. + Tracking a message has a cost at creation, because it creates a threadsafe + Event object. + copy : bool + default: use copy_threshold + Whether to create a copy of the data to pass to libzmq + or share the memory with libzmq. + If unspecified, copy_threshold is used. + copy_threshold: int + default: :const:`zmq.COPY_THRESHOLD` + If copy is unspecified, messages smaller than this many bytes + will be copied and messages larger than this will be shared with libzmq. + """ + + def __getitem__(self, key): + # map Frame['User-Id'] to Frame.get('User-Id') + return self.get(key) + + def __repr__(self): + """Return the str form of the message.""" + nbytes = len(self) + msg_suffix = "" + if nbytes > 16: + msg_bytes = bytes(memoryview(self.buffer)[:12]) + if nbytes >= 1e9: + unit = "GB" + n = nbytes // 1e9 + elif nbytes >= 2**20: + unit = "MB" + n = nbytes // 1e6 + elif nbytes >= 1e3: + unit = "kB" + n = nbytes // 1e3 + else: + unit = "B" + n = nbytes + msg_suffix = f'...{n:.0f}{unit}' + else: + msg_bytes = self.bytes + + _module = self.__class__.__module__ + if _module == "zmq.sugar.frame": + _module = "zmq" + return f"<{_module}.{self.__class__.__name__}({msg_bytes!r}{msg_suffix})>" + + @property + def group(self): + """The RADIO-DISH group of the message. + + Requires libzmq >= 4.2 and pyzmq built with draft APIs enabled. + + .. versionadded:: 17 + """ + _draft((4, 2), "RADIO-DISH") + return self.get('group') + + @group.setter + def group(self, group): + _draft((4, 2), "RADIO-DISH") + self.set('group', group) + + @property + def routing_id(self): + """The CLIENT-SERVER routing id of the message. + + Requires libzmq >= 4.2 and pyzmq built with draft APIs enabled. + + .. versionadded:: 17 + """ + _draft((4, 2), "CLIENT-SERVER") + return self.get('routing_id') + + @routing_id.setter + def routing_id(self, routing_id): + _draft((4, 2), "CLIENT-SERVER") + self.set('routing_id', routing_id) + + +# keep deprecated alias +Message = Frame +__all__ = ['Frame', 'Message'] diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/sugar/poll.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/sugar/poll.py new file mode 100644 index 0000000000000000000000000000000000000000..27baad46e75626d68a0691b6c89ba0fbd7c353e2 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/sugar/poll.py @@ -0,0 +1,172 @@ +"""0MQ polling related functions and classes.""" + +# Copyright (C) PyZMQ Developers +# Distributed under the terms of the Modified BSD License. + +from __future__ import annotations + +from typing import Any + +from zmq.backend import zmq_poll +from zmq.constants import POLLERR, POLLIN, POLLOUT + +# ----------------------------------------------------------------------------- +# Polling related methods +# ----------------------------------------------------------------------------- + + +class Poller: + """A stateful poll interface that mirrors Python's built-in poll.""" + + sockets: list[tuple[Any, int]] + _map: dict + + def __init__(self) -> None: + self.sockets = [] + self._map = {} + + def __contains__(self, socket: Any) -> bool: + return socket in self._map + + def register(self, socket: Any, flags: int = POLLIN | POLLOUT): + """p.register(socket, flags=POLLIN|POLLOUT) + + Register a 0MQ socket or native fd for I/O monitoring. + + register(s,0) is equivalent to unregister(s). + + Parameters + ---------- + socket : zmq.Socket or native socket + A zmq.Socket or any Python object having a ``fileno()`` + method that returns a valid file descriptor. + flags : int + The events to watch for. Can be POLLIN, POLLOUT or POLLIN|POLLOUT. + If `flags=0`, socket will be unregistered. + """ + if flags: + if socket in self._map: + idx = self._map[socket] + self.sockets[idx] = (socket, flags) + else: + idx = len(self.sockets) + self.sockets.append((socket, flags)) + self._map[socket] = idx + elif socket in self._map: + # uregister sockets registered with no events + self.unregister(socket) + else: + # ignore new sockets with no events + pass + + def modify(self, socket, flags=POLLIN | POLLOUT): + """Modify the flags for an already registered 0MQ socket or native fd.""" + self.register(socket, flags) + + def unregister(self, socket: Any): + """Remove a 0MQ socket or native fd for I/O monitoring. + + Parameters + ---------- + socket : Socket + The socket instance to stop polling. + """ + idx = self._map.pop(socket) + self.sockets.pop(idx) + # shift indices after deletion + for socket, flags in self.sockets[idx:]: + self._map[socket] -= 1 + + def poll(self, timeout: int | None = None) -> list[tuple[Any, int]]: + """Poll the registered 0MQ or native fds for I/O. + + If there are currently events ready to be processed, this function will return immediately. + Otherwise, this function will return as soon the first event is available or after timeout + milliseconds have elapsed. + + Parameters + ---------- + timeout : int + The timeout in milliseconds. If None, no `timeout` (infinite). This + is in milliseconds to be compatible with ``select.poll()``. + + Returns + ------- + events : list + The list of events that are ready to be processed. + This is a list of tuples of the form ``(socket, event_mask)``, where the 0MQ Socket + or integer fd is the first element, and the poll event mask (POLLIN, POLLOUT) is the second. + It is common to call ``events = dict(poller.poll())``, + which turns the list of tuples into a mapping of ``socket : event_mask``. + """ + if timeout is None or timeout < 0: + timeout = -1 + elif isinstance(timeout, float): + timeout = int(timeout) + return zmq_poll(self.sockets, timeout=timeout) + + +def select( + rlist: list, wlist: list, xlist: list, timeout: float | None = None +) -> tuple[list, list, list]: + """select(rlist, wlist, xlist, timeout=None) -> (rlist, wlist, xlist) + + Return the result of poll as a lists of sockets ready for r/w/exception. + + This has the same interface as Python's built-in ``select.select()`` function. + + Parameters + ---------- + timeout : float, optional + The timeout in seconds. If None, no timeout (infinite). This is in seconds to be + compatible with ``select.select()``. + rlist : list + sockets/FDs to be polled for read events + wlist : list + sockets/FDs to be polled for write events + xlist : list + sockets/FDs to be polled for error events + + Returns + ------- + rlist: list + list of sockets or FDs that are readable + wlist: list + list of sockets or FDs that are writable + xlist: list + list of sockets or FDs that had error events (rare) + """ + if timeout is None: + timeout = -1 + # Convert from sec -> ms for zmq_poll. + # zmq_poll accepts 3.x style timeout in ms + timeout = int(timeout * 1000.0) + if timeout < 0: + timeout = -1 + sockets = [] + for s in set(rlist + wlist + xlist): + flags = 0 + if s in rlist: + flags |= POLLIN + if s in wlist: + flags |= POLLOUT + if s in xlist: + flags |= POLLERR + sockets.append((s, flags)) + return_sockets = zmq_poll(sockets, timeout) + rlist, wlist, xlist = [], [], [] + for s, flags in return_sockets: + if flags & POLLIN: + rlist.append(s) + if flags & POLLOUT: + wlist.append(s) + if flags & POLLERR: + xlist.append(s) + return rlist, wlist, xlist + + +# ----------------------------------------------------------------------------- +# Symbols to export +# ----------------------------------------------------------------------------- + +__all__ = ['Poller', 'select'] diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/sugar/socket.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/sugar/socket.py new file mode 100644 index 0000000000000000000000000000000000000000..168fcaa116174f679a1d3a317b783690e1ac4967 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/sugar/socket.py @@ -0,0 +1,1125 @@ +"""0MQ Socket pure Python methods.""" + +# Copyright (C) PyZMQ Developers +# Distributed under the terms of the Modified BSD License. + +from __future__ import annotations + +import errno +import pickle +import random +import sys +from typing import ( + Any, + Callable, + Generic, + List, + Literal, + Sequence, + TypeVar, + Union, + cast, + overload, +) +from warnings import warn + +import zmq +from zmq._typing import TypeAlias +from zmq.backend import Socket as SocketBase +from zmq.error import ZMQBindError, ZMQError +from zmq.utils import jsonapi +from zmq.utils.interop import cast_int_addr + +from ..constants import SocketOption, SocketType, _OptType +from .attrsettr import AttributeSetter +from .poll import Poller + +try: + DEFAULT_PROTOCOL = pickle.DEFAULT_PROTOCOL +except AttributeError: + DEFAULT_PROTOCOL = pickle.HIGHEST_PROTOCOL + +_SocketType = TypeVar("_SocketType", bound="Socket") + +_JSONType: TypeAlias = "int | str | bool | list[_JSONType] | dict[str, _JSONType]" + + +class _SocketContext(Generic[_SocketType]): + """Context Manager for socket bind/unbind""" + + socket: _SocketType + kind: str + addr: str + + def __repr__(self): + return f"" + + def __init__( + self: _SocketContext[_SocketType], socket: _SocketType, kind: str, addr: str + ): + assert kind in {"bind", "connect"} + self.socket = socket + self.kind = kind + self.addr = addr + + def __enter__(self: _SocketContext[_SocketType]) -> _SocketType: + return self.socket + + def __exit__(self, *args): + if self.socket.closed: + return + if self.kind == "bind": + self.socket.unbind(self.addr) + elif self.kind == "connect": + self.socket.disconnect(self.addr) + + +SocketReturnType = TypeVar("SocketReturnType") + + +class Socket(SocketBase, AttributeSetter, Generic[SocketReturnType]): + """The ZMQ socket object + + To create a Socket, first create a Context:: + + ctx = zmq.Context.instance() + + then call ``ctx.socket(socket_type)``:: + + s = ctx.socket(zmq.ROUTER) + + .. versionadded:: 25 + + Sockets can now be shadowed by passing another Socket. + This helps in creating an async copy of a sync socket or vice versa:: + + s = zmq.Socket(async_socket) + + Which previously had to be:: + + s = zmq.Socket.shadow(async_socket.underlying) + """ + + _shadow = False + _shadow_obj = None + _monitor_socket = None + _type_name = 'UNKNOWN' + + @overload + def __init__( + self: Socket[bytes], + ctx_or_socket: zmq.Context, + socket_type: int, + *, + copy_threshold: int | None = None, + ): ... + + @overload + def __init__( + self: Socket[bytes], + *, + shadow: Socket | int, + copy_threshold: int | None = None, + ): ... + + @overload + def __init__( + self: Socket[bytes], + ctx_or_socket: Socket, + ): ... + + def __init__( + self: Socket[bytes], + ctx_or_socket: zmq.Context | Socket | None = None, + socket_type: int = 0, + *, + shadow: Socket | int = 0, + copy_threshold: int | None = None, + ): + shadow_context: zmq.Context | None = None + if isinstance(ctx_or_socket, zmq.Socket): + # positional Socket(other_socket) + shadow = ctx_or_socket + ctx_or_socket = None + + shadow_address: int = 0 + + if shadow: + self._shadow = True + # hold a reference to the shadow object + self._shadow_obj = shadow + if not isinstance(shadow, int): + if isinstance(shadow, zmq.Socket): + shadow_context = shadow.context + try: + shadow = cast(int, shadow.underlying) + except AttributeError: + pass + shadow_address = cast_int_addr(shadow) + else: + self._shadow = False + + super().__init__( + ctx_or_socket, + socket_type, + shadow=shadow_address, + copy_threshold=copy_threshold, + ) + if self._shadow_obj and shadow_context: + # keep self.context reference if shadowing a Socket object + self.context = shadow_context + + try: + socket_type = cast(int, self.get(zmq.TYPE)) + except Exception: + pass + else: + try: + self.__dict__["type"] = stype = SocketType(socket_type) + except ValueError: + self._type_name = str(socket_type) + else: + self._type_name = stype.name + + def __del__(self): + if not self._shadow and not self.closed: + if warn is not None: + # warn can be None during process teardown + warn( + f"Unclosed socket {self}", + ResourceWarning, + stacklevel=2, + source=self, + ) + self.close() + + _repr_cls = "zmq.Socket" + + def __repr__(self): + cls = self.__class__ + # look up _repr_cls on exact class, not inherited + _repr_cls = cls.__dict__.get("_repr_cls", None) + if _repr_cls is None: + _repr_cls = f"{cls.__module__}.{cls.__name__}" + + closed = ' closed' if self._closed else '' + + return f"<{_repr_cls}(zmq.{self._type_name}) at {hex(id(self))}{closed}>" + + # socket as context manager: + def __enter__(self: _SocketType) -> _SocketType: + """Sockets are context managers + + .. versionadded:: 14.4 + """ + return self + + def __exit__(self, *args, **kwargs): + self.close() + + # ------------------------------------------------------------------------- + # Socket creation + # ------------------------------------------------------------------------- + + def __copy__(self: _SocketType, memo=None) -> _SocketType: + """Copying a Socket creates a shadow copy""" + return self.__class__.shadow(self.underlying) + + __deepcopy__ = __copy__ + + @classmethod + def shadow(cls: type[_SocketType], address: int | zmq.Socket) -> _SocketType: + """Shadow an existing libzmq socket + + address is a zmq.Socket or an integer (or FFI pointer) + representing the address of the libzmq socket. + + .. versionadded:: 14.1 + + .. versionadded:: 25 + Support for shadowing `zmq.Socket` objects, + instead of just integer addresses. + """ + return cls(shadow=address) + + def close(self, linger=None) -> None: + """ + Close the socket. + + If linger is specified, LINGER sockopt will be set prior to closing. + + Note: closing a zmq Socket may not close the underlying sockets + if there are undelivered messages. + Only after all messages are delivered or discarded by reaching the socket's LINGER timeout + (default: forever) + will the underlying sockets be closed. + + This can be called to close the socket by hand. If this is not + called, the socket will automatically be closed when it is + garbage collected, + in which case you may see a ResourceWarning about the unclosed socket. + """ + if self.context: + self.context._rm_socket(self) + super().close(linger=linger) + + # ------------------------------------------------------------------------- + # Connect/Bind context managers + # ------------------------------------------------------------------------- + + def _connect_cm(self: _SocketType, addr: str) -> _SocketContext[_SocketType]: + """Context manager to disconnect on exit + + .. versionadded:: 20.0 + """ + return _SocketContext(self, 'connect', addr) + + def _bind_cm(self: _SocketType, addr: str) -> _SocketContext[_SocketType]: + """Context manager to unbind on exit + + .. versionadded:: 20.0 + """ + try: + # retrieve last_endpoint + # to support binding on random ports via + # `socket.bind('tcp://127.0.0.1:0')` + addr = cast(bytes, self.get(zmq.LAST_ENDPOINT)).decode("utf8") + except (AttributeError, ZMQError, UnicodeDecodeError): + pass + return _SocketContext(self, 'bind', addr) + + def bind(self: _SocketType, addr: str) -> _SocketContext[_SocketType]: + """s.bind(addr) + + Bind the socket to an address. + + This causes the socket to listen on a network port. Sockets on the + other side of this connection will use ``Socket.connect(addr)`` to + connect to this socket. + + Returns a context manager which will call unbind on exit. + + .. versionadded:: 20.0 + Can be used as a context manager. + + .. versionadded:: 26.0 + binding to port 0 can be used as a context manager + for binding to a random port. + The URL can be retrieved as `socket.last_endpoint`. + + Parameters + ---------- + addr : str + The address string. This has the form 'protocol://interface:port', + for example 'tcp://127.0.0.1:5555'. Protocols supported include + tcp, udp, pgm, epgm, inproc and ipc. If the address is unicode, it is + encoded to utf-8 first. + + """ + try: + super().bind(addr) + except ZMQError as e: + e.strerror += f" (addr={addr!r})" + raise + return self._bind_cm(addr) + + def connect(self: _SocketType, addr: str) -> _SocketContext[_SocketType]: + """s.connect(addr) + + Connect to a remote 0MQ socket. + + Returns a context manager which will call disconnect on exit. + + .. versionadded:: 20.0 + Can be used as a context manager. + + Parameters + ---------- + addr : str + The address string. This has the form 'protocol://interface:port', + for example 'tcp://127.0.0.1:5555'. Protocols supported are + tcp, udp, pgm, inproc and ipc. If the address is unicode, it is + encoded to utf-8 first. + + """ + try: + super().connect(addr) + except ZMQError as e: + e.strerror += f" (addr={addr!r})" + raise + return self._connect_cm(addr) + + # ------------------------------------------------------------------------- + # Deprecated aliases + # ------------------------------------------------------------------------- + + @property + def socket_type(self) -> int: + warn("Socket.socket_type is deprecated, use Socket.type", DeprecationWarning) + return cast(int, self.type) + + # ------------------------------------------------------------------------- + # Hooks for sockopt completion + # ------------------------------------------------------------------------- + + def __dir__(self): + keys = dir(self.__class__) + keys.extend(SocketOption.__members__) + return keys + + # ------------------------------------------------------------------------- + # Getting/Setting options + # ------------------------------------------------------------------------- + setsockopt = SocketBase.set + getsockopt = SocketBase.get + + def __setattr__(self, key, value): + """Override to allow setting zmq.[UN]SUBSCRIBE even though we have a subscribe method""" + if key in self.__dict__: + object.__setattr__(self, key, value) + return + _key = key.lower() + if _key in ('subscribe', 'unsubscribe'): + if isinstance(value, str): + value = value.encode('utf8') + if _key == 'subscribe': + self.set(zmq.SUBSCRIBE, value) + else: + self.set(zmq.UNSUBSCRIBE, value) + return + super().__setattr__(key, value) + + def fileno(self) -> int: + """Return edge-triggered file descriptor for this socket. + + This is a read-only edge-triggered file descriptor for both read and write events on this socket. + It is important that all available events be consumed when an event is detected, + otherwise the read event will not trigger again. + + .. versionadded:: 17.0 + """ + return self.FD + + def subscribe(self, topic: str | bytes) -> None: + """Subscribe to a topic + + Only for SUB sockets. + + .. versionadded:: 15.3 + """ + if isinstance(topic, str): + topic = topic.encode('utf8') + self.set(zmq.SUBSCRIBE, topic) + + def unsubscribe(self, topic: str | bytes) -> None: + """Unsubscribe from a topic + + Only for SUB sockets. + + .. versionadded:: 15.3 + """ + if isinstance(topic, str): + topic = topic.encode('utf8') + self.set(zmq.UNSUBSCRIBE, topic) + + def set_string(self, option: int, optval: str, encoding='utf-8') -> None: + """Set socket options with a unicode object. + + This is simply a wrapper for setsockopt to protect from encoding ambiguity. + + See the 0MQ documentation for details on specific options. + + Parameters + ---------- + option : int + The name of the option to set. Can be any of: SUBSCRIBE, + UNSUBSCRIBE, IDENTITY + optval : str + The value of the option to set. + encoding : str + The encoding to be used, default is utf8 + """ + if not isinstance(optval, str): + raise TypeError(f"strings only, not {type(optval)}: {optval!r}") + return self.set(option, optval.encode(encoding)) + + setsockopt_unicode = setsockopt_string = set_string + + def get_string(self, option: int, encoding='utf-8') -> str: + """Get the value of a socket option. + + See the 0MQ documentation for details on specific options. + + Parameters + ---------- + option : int + The option to retrieve. + + Returns + ------- + optval : str + The value of the option as a unicode string. + """ + if SocketOption(option)._opt_type != _OptType.bytes: + raise TypeError(f"option {option} will not return a string to be decoded") + return cast(bytes, self.get(option)).decode(encoding) + + getsockopt_unicode = getsockopt_string = get_string + + def bind_to_random_port( + self: _SocketType, + addr: str, + min_port: int = 49152, + max_port: int = 65536, + max_tries: int = 100, + ) -> int: + """Bind this socket to a random port in a range. + + If the port range is unspecified, the system will choose the port. + + Parameters + ---------- + addr : str + The address string without the port to pass to ``Socket.bind()``. + min_port : int, optional + The minimum port in the range of ports to try (inclusive). + max_port : int, optional + The maximum port in the range of ports to try (exclusive). + max_tries : int, optional + The maximum number of bind attempts to make. + + Returns + ------- + port : int + The port the socket was bound to. + + Raises + ------ + ZMQBindError + if `max_tries` reached before successful bind + """ + if min_port == 49152 and max_port == 65536: + # if LAST_ENDPOINT is supported, and min_port / max_port weren't specified, + # we can bind to port 0 and let the OS do the work + self.bind(f"{addr}:*") + url = cast(bytes, self.last_endpoint).decode('ascii', 'replace') + _, port_s = url.rsplit(':', 1) + return int(port_s) + + for i in range(max_tries): + try: + port = random.randrange(min_port, max_port) + self.bind(f'{addr}:{port}') + except ZMQError as exception: + en = exception.errno + if en == zmq.EADDRINUSE: + continue + elif sys.platform == 'win32' and en == errno.EACCES: + continue + else: + raise + else: + return port + raise ZMQBindError("Could not bind socket to random port.") + + def get_hwm(self) -> int: + """Get the High Water Mark. + + On libzmq ≥ 3, this gets SNDHWM if available, otherwise RCVHWM + """ + # return sndhwm, fallback on rcvhwm + try: + return cast(int, self.get(zmq.SNDHWM)) + except zmq.ZMQError: + pass + + return cast(int, self.get(zmq.RCVHWM)) + + def set_hwm(self, value: int) -> None: + """Set the High Water Mark. + + On libzmq ≥ 3, this sets both SNDHWM and RCVHWM + + + .. warning:: + + New values only take effect for subsequent socket + bind/connects. + """ + raised = None + try: + self.sndhwm = value + except Exception as e: + raised = e + try: + self.rcvhwm = value + except Exception as e: + raised = e + + if raised: + raise raised + + hwm = property( + get_hwm, + set_hwm, + None, + """Property for High Water Mark. + + Setting hwm sets both SNDHWM and RCVHWM as appropriate. + It gets SNDHWM if available, otherwise RCVHWM. + """, + ) + + # ------------------------------------------------------------------------- + # Sending and receiving messages + # ------------------------------------------------------------------------- + + @overload + def send( + self, + data: Any, + flags: int = ..., + copy: bool = ..., + *, + track: Literal[True], + routing_id: int | None = ..., + group: str | None = ..., + ) -> zmq.MessageTracker: ... + + @overload + def send( + self, + data: Any, + flags: int = ..., + copy: bool = ..., + *, + track: Literal[False], + routing_id: int | None = ..., + group: str | None = ..., + ) -> None: ... + + @overload + def send( + self, + data: Any, + flags: int = ..., + *, + copy: bool = ..., + routing_id: int | None = ..., + group: str | None = ..., + ) -> None: ... + + @overload + def send( + self, + data: Any, + flags: int = ..., + copy: bool = ..., + track: bool = ..., + routing_id: int | None = ..., + group: str | None = ..., + ) -> zmq.MessageTracker | None: ... + + def send( + self, + data: Any, + flags: int = 0, + copy: bool = True, + track: bool = False, + routing_id: int | None = None, + group: str | None = None, + ) -> zmq.MessageTracker | None: + """Send a single zmq message frame on this socket. + + This queues the message to be sent by the IO thread at a later time. + + With flags=NOBLOCK, this raises :class:`ZMQError` if the queue is full; + otherwise, this waits until space is available. + See :class:`Poller` for more general non-blocking I/O. + + Parameters + ---------- + data : bytes, Frame, memoryview + The content of the message. This can be any object that provides + the Python buffer API (i.e. `memoryview(data)` can be called). + flags : int + 0, NOBLOCK, SNDMORE, or NOBLOCK|SNDMORE. + copy : bool + Should the message be sent in a copying or non-copying manner. + track : bool + Should the message be tracked for notification that ZMQ has + finished with it? (ignored if copy=True) + routing_id : int + For use with SERVER sockets + group : str + For use with RADIO sockets + + Returns + ------- + None : if `copy` or not track + None if message was sent, raises an exception otherwise. + MessageTracker : if track and not copy + a MessageTracker object, whose `done` property will + be False until the send is completed. + + Raises + ------ + TypeError + If a unicode object is passed + ValueError + If `track=True`, but an untracked Frame is passed. + ZMQError + If the send does not succeed for any reason (including + if NOBLOCK is set and the outgoing queue is full). + + + .. versionchanged:: 17.0 + + DRAFT support for routing_id and group arguments. + """ + if routing_id is not None: + if not isinstance(data, zmq.Frame): + data = zmq.Frame( + data, + track=track, + copy=copy or None, + copy_threshold=self.copy_threshold, + ) + data.routing_id = routing_id + if group is not None: + if not isinstance(data, zmq.Frame): + data = zmq.Frame( + data, + track=track, + copy=copy or None, + copy_threshold=self.copy_threshold, + ) + data.group = group + return super().send(data, flags=flags, copy=copy, track=track) + + def send_multipart( + self, + msg_parts: Sequence, + flags: int = 0, + copy: bool = True, + track: bool = False, + **kwargs, + ): + """Send a sequence of buffers as a multipart message. + + The zmq.SNDMORE flag is added to all msg parts before the last. + + Parameters + ---------- + msg_parts : iterable + A sequence of objects to send as a multipart message. Each element + can be any sendable object (Frame, bytes, buffer-providers) + flags : int, optional + Any valid flags for :func:`Socket.send`. + SNDMORE is added automatically for frames before the last. + copy : bool, optional + Should the frame(s) be sent in a copying or non-copying manner. + If copy=False, frames smaller than self.copy_threshold bytes + will be copied anyway. + track : bool, optional + Should the frame(s) be tracked for notification that ZMQ has + finished with it (ignored if copy=True). + + Returns + ------- + None : if copy or not track + MessageTracker : if track and not copy + a MessageTracker object, whose `done` property will + be False until the last send is completed. + """ + # typecheck parts before sending: + for i, msg in enumerate(msg_parts): + if isinstance(msg, (zmq.Frame, bytes, memoryview)): + continue + try: + memoryview(msg) + except Exception: + rmsg = repr(msg) + if len(rmsg) > 32: + rmsg = rmsg[:32] + '...' + raise TypeError( + f"Frame {i} ({rmsg}) does not support the buffer interface." + ) + for msg in msg_parts[:-1]: + self.send(msg, zmq.SNDMORE | flags, copy=copy, track=track) + # Send the last part without the extra SNDMORE flag. + return self.send(msg_parts[-1], flags, copy=copy, track=track) + + @overload + def recv_multipart( + self, flags: int = ..., *, copy: Literal[True], track: bool = ... + ) -> list[bytes]: ... + + @overload + def recv_multipart( + self, flags: int = ..., *, copy: Literal[False], track: bool = ... + ) -> list[zmq.Frame]: ... + + @overload + def recv_multipart(self, flags: int = ..., *, track: bool = ...) -> list[bytes]: ... + + @overload + def recv_multipart( + self, flags: int = 0, copy: bool = True, track: bool = False + ) -> list[zmq.Frame] | list[bytes]: ... + + def recv_multipart( + self, flags: int = 0, copy: bool = True, track: bool = False + ) -> list[zmq.Frame] | list[bytes]: + """Receive a multipart message as a list of bytes or Frame objects + + Parameters + ---------- + flags : int, optional + Any valid flags for :func:`Socket.recv`. + copy : bool, optional + Should the message frame(s) be received in a copying or non-copying manner? + If False a Frame object is returned for each part, if True a copy of + the bytes is made for each frame. + track : bool, optional + Should the message frame(s) be tracked for notification that ZMQ has + finished with it? (ignored if copy=True) + + Returns + ------- + msg_parts : list + A list of frames in the multipart message; either Frames or bytes, + depending on `copy`. + + Raises + ------ + ZMQError + for any of the reasons :func:`~Socket.recv` might fail + """ + parts = [self.recv(flags, copy=copy, track=track)] + # have first part already, only loop while more to receive + while self.getsockopt(zmq.RCVMORE): + part = self.recv(flags, copy=copy, track=track) + parts.append(part) + # cast List[Union] to Union[List] + # how do we get mypy to recognize that return type is invariant on `copy`? + return cast(Union[List[zmq.Frame], List[bytes]], parts) + + def _deserialize( + self, + recvd: bytes, + load: Callable[[bytes], Any], + ) -> Any: + """Deserialize a received message + + Override in subclass (e.g. Futures) if recvd is not the raw bytes. + + The default implementation expects bytes and returns the deserialized message immediately. + + Parameters + ---------- + + load: callable + Callable that deserializes bytes + recvd: + The object returned by self.recv + + """ + return load(recvd) + + def send_serialized(self, msg, serialize, flags=0, copy=True, **kwargs): + """Send a message with a custom serialization function. + + .. versionadded:: 17 + + Parameters + ---------- + msg : The message to be sent. Can be any object serializable by `serialize`. + serialize : callable + The serialization function to use. + serialize(msg) should return an iterable of sendable message frames + (e.g. bytes objects), which will be passed to send_multipart. + flags : int, optional + Any valid flags for :func:`Socket.send`. + copy : bool, optional + Whether to copy the frames. + + """ + frames = serialize(msg) + return self.send_multipart(frames, flags=flags, copy=copy, **kwargs) + + def recv_serialized(self, deserialize, flags=0, copy=True): + """Receive a message with a custom deserialization function. + + .. versionadded:: 17 + + Parameters + ---------- + deserialize : callable + The deserialization function to use. + deserialize will be called with one argument: the list of frames + returned by recv_multipart() and can return any object. + flags : int, optional + Any valid flags for :func:`Socket.recv`. + copy : bool, optional + Whether to recv bytes or Frame objects. + + Returns + ------- + obj : object + The object returned by the deserialization function. + + Raises + ------ + ZMQError + for any of the reasons :func:`~Socket.recv` might fail + """ + frames = self.recv_multipart(flags=flags, copy=copy) + return self._deserialize(frames, deserialize) + + def send_string( + self, + u: str, + flags: int = 0, + copy: bool = True, + encoding: str = 'utf-8', + **kwargs, + ) -> zmq.Frame | None: + """Send a Python unicode string as a message with an encoding. + + 0MQ communicates with raw bytes, so you must encode/decode + text (str) around 0MQ. + + Parameters + ---------- + u : str + The unicode string to send. + flags : int, optional + Any valid flags for :func:`Socket.send`. + encoding : str + The encoding to be used + """ + if not isinstance(u, str): + raise TypeError("str objects only") + return self.send(u.encode(encoding), flags=flags, copy=copy, **kwargs) + + send_unicode = send_string + + def recv_string(self, flags: int = 0, encoding: str = 'utf-8') -> str: + """Receive a unicode string, as sent by send_string. + + Parameters + ---------- + flags : int + Any valid flags for :func:`Socket.recv`. + encoding : str + The encoding to be used + + Returns + ------- + s : str + The Python unicode string that arrives as encoded bytes. + + Raises + ------ + ZMQError + for any of the reasons :func:`Socket.recv` might fail + """ + msg = self.recv(flags=flags) + return self._deserialize(msg, lambda buf: buf.decode(encoding)) + + recv_unicode = recv_string + + def send_pyobj( + self, obj: Any, flags: int = 0, protocol: int = DEFAULT_PROTOCOL, **kwargs + ) -> zmq.Frame | None: + """ + Send a Python object as a message using pickle to serialize. + + .. warning:: + + Never deserialize an untrusted message with pickle, + which can involve arbitrary code execution. + Make sure to authenticate the sources of messages + before unpickling them, e.g. with transport-level security + (e.g. CURVE, ZAP, or IPC permissions) + or signed messages. + + Parameters + ---------- + obj : Python object + The Python object to send. + flags : int + Any valid flags for :func:`Socket.send`. + protocol : int + The pickle protocol number to use. The default is pickle.DEFAULT_PROTOCOL + where defined, and pickle.HIGHEST_PROTOCOL elsewhere. + """ + msg = pickle.dumps(obj, protocol) + return self.send(msg, flags=flags, **kwargs) + + def recv_pyobj(self, flags: int = 0) -> Any: + """ + Receive a Python object as a message using UNSAFE pickle to serialize. + + .. warning:: + + Never deserialize an untrusted message with pickle, + which can involve arbitrary code execution. + Make sure to authenticate the sources of messages + before unpickling them, e.g. with transport-level security + (such as CURVE or IPC permissions) + or authenticating messages themselves before deserializing. + + Parameters + ---------- + flags : int + Any valid flags for :func:`Socket.recv`. + + Returns + ------- + obj : Python object + The Python object that arrives as a message. + + Raises + ------ + ZMQError + for any of the reasons :func:`~Socket.recv` might fail + """ + msg = self.recv(flags) + return self._deserialize(msg, pickle.loads) + + def send_json(self, obj: Any, flags: int = 0, **kwargs) -> None: + """Send a Python object as a message using json to serialize. + + Keyword arguments are passed on to json.dumps + + Parameters + ---------- + obj : Python object + The Python object to send + flags : int + Any valid flags for :func:`Socket.send` + """ + send_kwargs = {} + for key in ('routing_id', 'group'): + if key in kwargs: + send_kwargs[key] = kwargs.pop(key) + msg = jsonapi.dumps(obj, **kwargs) + return self.send(msg, flags=flags, **send_kwargs) + + def recv_json(self, flags: int = 0, **kwargs) -> _JSONType: + """Receive a Python object as a message using json to serialize. + + Keyword arguments are passed on to json.loads + + Parameters + ---------- + flags : int + Any valid flags for :func:`Socket.recv`. + + Returns + ------- + obj : Python object + The Python object that arrives as a message. + + Raises + ------ + ZMQError + for any of the reasons :func:`~Socket.recv` might fail + """ + msg = self.recv(flags) + return self._deserialize(msg, lambda buf: jsonapi.loads(buf, **kwargs)) + + _poller_class = Poller + + def poll(self, timeout: int | None = None, flags: int = zmq.POLLIN) -> int: + """Poll the socket for events. + + See :class:`Poller` to wait for multiple sockets at once. + + Parameters + ---------- + timeout : int + The timeout (in milliseconds) to wait for an event. If unspecified + (or specified None), will wait forever for an event. + flags : int + default: POLLIN. + POLLIN, POLLOUT, or POLLIN|POLLOUT. The event flags to poll for. + + Returns + ------- + event_mask : int + The poll event mask (POLLIN, POLLOUT), + 0 if the timeout was reached without an event. + """ + + if self.closed: + raise ZMQError(zmq.ENOTSUP) + + p = self._poller_class() + p.register(self, flags) + evts = dict(p.poll(timeout)) + # return 0 if no events, otherwise return event bitfield + return evts.get(self, 0) + + def get_monitor_socket( + self: _SocketType, events: int | None = None, addr: str | None = None + ) -> _SocketType: + """Return a connected PAIR socket ready to receive the event notifications. + + .. versionadded:: libzmq-4.0 + .. versionadded:: 14.0 + + Parameters + ---------- + events : int + default: `zmq.EVENT_ALL` + The bitmask defining which events are wanted. + addr : str + The optional endpoint for the monitoring sockets. + + Returns + ------- + socket : zmq.Socket + The PAIR socket, connected and ready to receive messages. + """ + # safe-guard, method only available on libzmq >= 4 + if zmq.zmq_version_info() < (4,): + raise NotImplementedError( + f"get_monitor_socket requires libzmq >= 4, have {zmq.zmq_version()}" + ) + + # if already monitoring, return existing socket + if self._monitor_socket: + if self._monitor_socket.closed: + self._monitor_socket = None + else: + return self._monitor_socket + + if addr is None: + # create endpoint name from internal fd + addr = f"inproc://monitor.s-{self.FD}" + if events is None: + # use all events + events = zmq.EVENT_ALL + # attach monitoring socket + self.monitor(addr, events) + # create new PAIR socket and connect it + self._monitor_socket = self.context.socket(zmq.PAIR) + self._monitor_socket.connect(addr) + return self._monitor_socket + + def disable_monitor(self) -> None: + """Shutdown the PAIR socket (created using get_monitor_socket) + that is serving socket events. + + .. versionadded:: 14.4 + """ + self._monitor_socket = None + self.monitor(None, 0) + + +SyncSocket: TypeAlias = Socket[bytes] + +__all__ = ['Socket', 'SyncSocket'] diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/sugar/stopwatch.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/sugar/stopwatch.py new file mode 100644 index 0000000000000000000000000000000000000000..2001e670a92761a5c3a10e40d93f39e2c21a3a10 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/sugar/stopwatch.py @@ -0,0 +1,36 @@ +"""Deprecated Stopwatch implementation""" + +# Copyright (c) PyZMQ Development Team. +# Distributed under the terms of the Modified BSD License. + + +class Stopwatch: + """Deprecated zmq.Stopwatch implementation + + You can use Python's builtin timers (time.monotonic, etc.). + """ + + def __init__(self): + import warnings + + warnings.warn( + "zmq.Stopwatch is deprecated. Use stdlib time.monotonic and friends instead", + DeprecationWarning, + stacklevel=2, + ) + self._start = 0 + import time + + try: + self._monotonic = time.monotonic + except AttributeError: + self._monotonic = time.time + + def start(self): + """Start the counter""" + self._start = self._monotonic() + + def stop(self): + """Return time since start in microseconds""" + stop = self._monotonic() + return int(1e6 * (stop - self._start)) diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/sugar/tracker.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/sugar/tracker.py new file mode 100644 index 0000000000000000000000000000000000000000..973fdbd6e2740951969e0f071dd07837cad1d632 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/sugar/tracker.py @@ -0,0 +1,116 @@ +"""Tracker for zero-copy messages with 0MQ.""" + +# Copyright (C) PyZMQ Developers +# Distributed under the terms of the Modified BSD License. + +from __future__ import annotations + +import time +from threading import Event + +from zmq.backend import Frame +from zmq.error import NotDone + + +class MessageTracker: + """A class for tracking if 0MQ is done using one or more messages. + + When you send a 0MQ message, it is not sent immediately. The 0MQ IO thread + sends the message at some later time. Often you want to know when 0MQ has + actually sent the message though. This is complicated by the fact that + a single 0MQ message can be sent multiple times using different sockets. + This class allows you to track all of the 0MQ usages of a message. + + Parameters + ---------- + towatch : Event, MessageTracker, zmq.Frame + This objects to track. This class can track the low-level + Events used by the Message class, other MessageTrackers or + actual Messages. + """ + + events: set[Event] + peers: set[MessageTracker] + + def __init__(self, *towatch: tuple[MessageTracker | Event | Frame]): + """Create a message tracker to track a set of messages. + + Parameters + ---------- + *towatch : tuple of Event, MessageTracker, Message instances. + This list of objects to track. This class can track the low-level + Events used by the Message class, other MessageTrackers or + actual Messages. + """ + self.events = set() + self.peers = set() + for obj in towatch: + if isinstance(obj, Event): + self.events.add(obj) + elif isinstance(obj, MessageTracker): + self.peers.add(obj) + elif isinstance(obj, Frame): + if not obj.tracker: + raise ValueError("Not a tracked message") + self.peers.add(obj.tracker) + else: + raise TypeError(f"Require Events or Message Frames, not {type(obj)}") + + @property + def done(self): + """Is 0MQ completely done with the message(s) being tracked?""" + for evt in self.events: + if not evt.is_set(): + return False + for pm in self.peers: + if not pm.done: + return False + return True + + def wait(self, timeout: float | int = -1): + """Wait for 0MQ to be done with the message or until `timeout`. + + Parameters + ---------- + timeout : float + default: -1, which means wait forever. + Maximum time in (s) to wait before raising NotDone. + + Returns + ------- + None + if done before `timeout` + + Raises + ------ + NotDone + if `timeout` reached before I am done. + """ + tic = time.time() + remaining: float + if timeout is False or timeout < 0: + remaining = 3600 * 24 * 7 # a week + else: + remaining = timeout + for evt in self.events: + if remaining < 0: + raise NotDone + evt.wait(timeout=remaining) + if not evt.is_set(): + raise NotDone + toc = time.time() + remaining -= toc - tic + tic = toc + + for peer in self.peers: + if remaining < 0: + raise NotDone + peer.wait(timeout=remaining) + toc = time.time() + remaining -= toc - tic + tic = toc + + +_FINISHED_TRACKER = MessageTracker() + +__all__ = ['MessageTracker', '_FINISHED_TRACKER'] diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/sugar/version.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/sugar/version.py new file mode 100644 index 0000000000000000000000000000000000000000..5659d7bc43561ca28e384fe76d54159b36df5871 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/sugar/version.py @@ -0,0 +1,67 @@ +"""PyZMQ and 0MQ version functions.""" + +# Copyright (C) PyZMQ Developers +# Distributed under the terms of the Modified BSD License. +from __future__ import annotations + +import re +from typing import Match, cast + +from zmq.backend import zmq_version_info + +__version__: str = "27.1.0" +_version_pat = re.compile(r"(\d+)\.(\d+)\.(\d+)(.*)") +_match = cast(Match, _version_pat.match(__version__)) +_version_groups = _match.groups() + +VERSION_MAJOR = int(_version_groups[0]) +VERSION_MINOR = int(_version_groups[1]) +VERSION_PATCH = int(_version_groups[2]) +VERSION_EXTRA = _version_groups[3].lstrip(".") + +version_info: tuple[int, int, int] | tuple[int, int, int, float] = ( + VERSION_MAJOR, + VERSION_MINOR, + VERSION_PATCH, +) + +if VERSION_EXTRA: + version_info = ( + VERSION_MAJOR, + VERSION_MINOR, + VERSION_PATCH, + float('inf'), + ) + +__revision__: str = '' + + +def pyzmq_version() -> str: + """return the version of pyzmq as a string""" + if __revision__: + return '+'.join([__version__, __revision__[:6]]) + else: + return __version__ + + +def pyzmq_version_info() -> tuple[int, int, int] | tuple[int, int, int, float]: + """return the pyzmq version as a tuple of at least three numbers + + If pyzmq is a development version, `inf` will be appended after the third integer. + """ + return version_info + + +def zmq_version() -> str: + """return the version of libzmq as a string""" + return "{}.{}.{}".format(*zmq_version_info()) + + +__all__ = [ + 'zmq_version', + 'zmq_version_info', + 'pyzmq_version', + 'pyzmq_version_info', + '__version__', + '__revision__', +] diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/tests/__init__.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..5be08c6a8a2c01f8bcce399252a7794d646a670d --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/tests/__init__.py @@ -0,0 +1,262 @@ +# Copyright (c) PyZMQ Developers. +# Distributed under the terms of the Modified BSD License. + +import os +import platform +import signal +import sys +import time +import warnings +from functools import partial +from threading import Thread +from typing import List +from unittest import SkipTest, TestCase + +from pytest import mark + +import zmq +from zmq.utils import jsonapi + +try: + import gevent + + from zmq import green as gzmq + + have_gevent = True +except ImportError: + have_gevent = False + + +PYPY = platform.python_implementation() == 'PyPy' + +# ----------------------------------------------------------------------------- +# skip decorators (directly from unittest) +# ----------------------------------------------------------------------------- +warnings.warn( + "zmq.tests is deprecated in pyzmq 25, we recommend managing your own contexts and sockets.", + DeprecationWarning, +) + + +def _id(x): + return x + + +skip_pypy = mark.skipif(PYPY, reason="Doesn't work on PyPy") +require_zmq_4 = mark.skipif(zmq.zmq_version_info() < (4,), reason="requires zmq >= 4") + +# ----------------------------------------------------------------------------- +# Base test class +# ----------------------------------------------------------------------------- + + +def term_context(ctx, timeout): + """Terminate a context with a timeout""" + t = Thread(target=ctx.term) + t.daemon = True + t.start() + t.join(timeout=timeout) + if t.is_alive(): + # reset Context.instance, so the failure to term doesn't corrupt subsequent tests + zmq.sugar.context.Context._instance = None + raise RuntimeError( + "context could not terminate, open sockets likely remain in test" + ) + + +class BaseZMQTestCase(TestCase): + green = False + teardown_timeout = 10 + test_timeout_seconds = int(os.environ.get("ZMQ_TEST_TIMEOUT") or 60) + sockets: List[zmq.Socket] + + @property + def _is_pyzmq_test(self): + return self.__class__.__module__.split(".", 1)[0] == __name__.split(".", 1)[0] + + @property + def _should_test_timeout(self): + return ( + self._is_pyzmq_test + and hasattr(signal, 'SIGALRM') + and self.test_timeout_seconds + ) + + @property + def Context(self): + if self.green: + return gzmq.Context + else: + return zmq.Context + + def socket(self, socket_type): + s = self.context.socket(socket_type) + self.sockets.append(s) + return s + + def _alarm_timeout(self, timeout, *args): + raise TimeoutError(f"Test did not complete in {timeout} seconds") + + def setUp(self): + super().setUp() + if self.green and not have_gevent: + raise SkipTest("requires gevent") + + self.context = self.Context.instance() + self.sockets = [] + if self._should_test_timeout: + # use SIGALRM to avoid test hangs + signal.signal( + signal.SIGALRM, partial(self._alarm_timeout, self.test_timeout_seconds) + ) + signal.alarm(self.test_timeout_seconds) + + def tearDown(self): + if self._should_test_timeout: + # cancel the timeout alarm, if there was one + signal.alarm(0) + contexts = {self.context} + while self.sockets: + sock = self.sockets.pop() + contexts.add(sock.context) # in case additional contexts are created + sock.close(0) + for ctx in contexts: + try: + term_context(ctx, self.teardown_timeout) + except Exception: + # reset Context.instance, so the failure to term doesn't corrupt subsequent tests + zmq.sugar.context.Context._instance = None + raise + + super().tearDown() + + def create_bound_pair( + self, type1=zmq.PAIR, type2=zmq.PAIR, interface='tcp://127.0.0.1' + ): + """Create a bound socket pair using a random port.""" + s1 = self.context.socket(type1) + s1.setsockopt(zmq.LINGER, 0) + port = s1.bind_to_random_port(interface) + s2 = self.context.socket(type2) + s2.setsockopt(zmq.LINGER, 0) + s2.connect(f'{interface}:{port}') + self.sockets.extend([s1, s2]) + return s1, s2 + + def ping_pong(self, s1, s2, msg): + s1.send(msg) + msg2 = s2.recv() + s2.send(msg2) + msg3 = s1.recv() + return msg3 + + def ping_pong_json(self, s1, s2, o): + if jsonapi.jsonmod is None: + raise SkipTest("No json library") + s1.send_json(o) + o2 = s2.recv_json() + s2.send_json(o2) + o3 = s1.recv_json() + return o3 + + def ping_pong_pyobj(self, s1, s2, o): + s1.send_pyobj(o) + o2 = s2.recv_pyobj() + s2.send_pyobj(o2) + o3 = s1.recv_pyobj() + return o3 + + def assertRaisesErrno(self, errno, func, *args, **kwargs): + try: + func(*args, **kwargs) + except zmq.ZMQError as e: + self.assertEqual( + e.errno, + errno, + f"wrong error raised, expected '{zmq.ZMQError(errno)}' \ +got '{zmq.ZMQError(e.errno)}'", + ) + else: + self.fail("Function did not raise any error") + + def _select_recv(self, multipart, socket, **kwargs): + """call recv[_multipart] in a way that raises if there is nothing to receive""" + # zmq 3.1 has a bug, where poll can return false positives, + # so we wait a little bit just in case + # See LIBZMQ-280 on JIRA + time.sleep(0.1) + + r, w, x = zmq.select([socket], [], [], timeout=kwargs.pop('timeout', 5)) + assert len(r) > 0, "Should have received a message" + kwargs['flags'] = zmq.DONTWAIT | kwargs.get('flags', 0) + + recv = socket.recv_multipart if multipart else socket.recv + return recv(**kwargs) + + def recv(self, socket, **kwargs): + """call recv in a way that raises if there is nothing to receive""" + return self._select_recv(False, socket, **kwargs) + + def recv_multipart(self, socket, **kwargs): + """call recv_multipart in a way that raises if there is nothing to receive""" + return self._select_recv(True, socket, **kwargs) + + +class PollZMQTestCase(BaseZMQTestCase): + pass + + +class GreenTest: + """Mixin for making green versions of test classes""" + + green = True + teardown_timeout = 10 + + def assertRaisesErrno(self, errno, func, *args, **kwargs): + if errno == zmq.EAGAIN: + raise SkipTest("Skipping because we're green.") + try: + func(*args, **kwargs) + except zmq.ZMQError: + e = sys.exc_info()[1] + self.assertEqual( + e.errno, + errno, + f"wrong error raised, expected '{zmq.ZMQError(errno)}' \ +got '{zmq.ZMQError(e.errno)}'", + ) + else: + self.fail("Function did not raise any error") + + def tearDown(self): + if self._should_test_timeout: + # cancel the timeout alarm, if there was one + signal.alarm(0) + contexts = {self.context} + while self.sockets: + sock = self.sockets.pop() + contexts.add(sock.context) # in case additional contexts are created + sock.close() + try: + gevent.joinall( + [gevent.spawn(ctx.term) for ctx in contexts], + timeout=self.teardown_timeout, + raise_error=True, + ) + except gevent.Timeout: + raise RuntimeError( + "context could not terminate, open sockets likely remain in test" + ) + + def skip_green(self): + raise SkipTest("Skipping because we are green") + + +def skip_green(f): + def skipping_test(self, *args, **kwargs): + if self.green: + raise SkipTest("Skipping because we are green") + else: + return f(self, *args, **kwargs) + + return skipping_test diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/utils/__init__.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/utils/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/utils/garbage.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/utils/garbage.py new file mode 100644 index 0000000000000000000000000000000000000000..2c700313d917f2dd44a3d62b4a2a79bb0a1f9de0 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/utils/garbage.py @@ -0,0 +1,213 @@ +"""Garbage collection thread for representing zmq refcount of Python objects +used in zero-copy sends. +""" + +# Copyright (C) PyZMQ Developers +# Distributed under the terms of the Modified BSD License. + +import atexit +import struct +import warnings +from collections import namedtuple +from os import getpid +from threading import Event, Lock, Thread + +import zmq + +gcref = namedtuple('gcref', ['obj', 'event']) + + +class GarbageCollectorThread(Thread): + """Thread in which garbage collection actually happens.""" + + def __init__(self, gc): + super().__init__() + self.gc = gc + self.daemon = True + self.pid = getpid() + self.ready = Event() + + def run(self): + # detect fork at beginning of the thread + if getpid is None or getpid() != self.pid: + self.ready.set() + return + try: + s = self.gc.context.socket(zmq.PULL) + s.linger = 0 + s.bind(self.gc.url) + finally: + self.ready.set() + + while True: + # detect fork + if getpid is None or getpid() != self.pid: + return + msg = s.recv() + if msg == b'DIE': + break + fmt = 'L' if len(msg) == 4 else 'Q' + key = struct.unpack(fmt, msg)[0] + tup = self.gc.refs.pop(key, None) + if tup and tup.event: + tup.event.set() + del tup + s.close() + + +class GarbageCollector: + """PyZMQ Garbage Collector + + Used for representing the reference held by libzmq during zero-copy sends. + This object holds a dictionary, keyed by Python id, + of the Python objects whose memory are currently in use by zeromq. + + When zeromq is done with the memory, it sends a message on an inproc PUSH socket + containing the packed size_t (32 or 64-bit unsigned int), + which is the key in the dict. + When the PULL socket in the gc thread receives that message, + the reference is popped from the dict, + and any tracker events that should be signaled fire. + """ + + refs = None + _context = None + _lock = None + url = "inproc://pyzmq.gc.01" + + def __init__(self, context=None): + super().__init__() + self.refs = {} + self.pid = None + self.thread = None + self._context = context + self._lock = Lock() + self._stay_down = False + self._push = None + self._push_mutex = None + atexit.register(self._atexit) + + @property + def context(self): + if self._context is None: + if Thread.__module__.startswith('gevent'): + # gevent has monkey-patched Thread, use green Context + from zmq import green + + self._context = green.Context() + else: + self._context = zmq.Context() + return self._context + + @context.setter + def context(self, ctx): + if self.is_alive(): + if self.refs: + warnings.warn( + "Replacing gc context while gc is running", RuntimeWarning + ) + self.stop() + self._context = ctx + + def _atexit(self): + """atexit callback + + sets _stay_down flag so that gc doesn't try to start up again in other atexit handlers + """ + self._stay_down = True + self.stop() + + def stop(self): + """stop the garbage-collection thread""" + if not self.is_alive(): + return + self._stop() + + def _clear(self): + """Clear state + + called after stop or when setting up a new subprocess + """ + self._push = None + self._push_mutex = None + self.thread = None + self.refs.clear() + self.context = None + + def _stop(self): + push = self.context.socket(zmq.PUSH) + push.connect(self.url) + push.send(b'DIE') + push.close() + if self._push: + self._push.close() + self.thread.join() + self.context.term() + self._clear() + + @property + def _push_socket(self): + """The PUSH socket for use in the zmq message destructor callback.""" + if getattr(self, "_stay_down", False): + raise RuntimeError("zmq gc socket requested during shutdown") + if not self.is_alive() or self._push is None: + self._push = self.context.socket(zmq.PUSH) + self._push.connect(self.url) + return self._push + + def start(self): + """Start a new garbage collection thread. + + Creates a new zmq Context used for garbage collection. + Under most circumstances, this will only be called once per process. + """ + if self.thread is not None and self.pid != getpid(): + # It's re-starting, must free earlier thread's context + # since a fork probably broke it + self._clear() + self.pid = getpid() + self.refs = {} + self.thread = GarbageCollectorThread(self) + self.thread.start() + self.thread.ready.wait() + + def is_alive(self): + """Is the garbage collection thread currently running? + + Includes checks for process shutdown or fork. + """ + if ( + getpid is None + or getpid() != self.pid + or self.thread is None + or not self.thread.is_alive() + ): + return False + return True + + def store(self, obj, event=None): + """store an object and (optionally) event for zero-copy""" + if not self.is_alive(): + if self._stay_down: + return 0 + # safely start the gc thread + # use lock and double check, + # so we don't start multiple threads + with self._lock: + if not self.is_alive(): + self.start() + tup = gcref(obj, event) + theid = id(tup) + self.refs[theid] = tup + return theid + + def __del__(self): + if not self.is_alive(): + return + try: + self.stop() + except Exception as e: + raise (e) + + +gc = GarbageCollector() diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/utils/getpid_compat.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/utils/getpid_compat.h new file mode 100644 index 0000000000000000000000000000000000000000..3fe1bec4c24ac472fb9ab8940da43adc1de60257 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/utils/getpid_compat.h @@ -0,0 +1,7 @@ +#pragma once +#ifdef _WIN32 + #include + #define getpid _getpid +#else + #include +#endif diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/utils/interop.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/utils/interop.py new file mode 100644 index 0000000000000000000000000000000000000000..ab4ffd9a813c7c0e490428123b08b9e38c85d52b --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/utils/interop.py @@ -0,0 +1,29 @@ +"""Utils for interoperability with other libraries. + +Just CFFI pointer casting for now. +""" + +# Copyright (C) PyZMQ Developers +# Distributed under the terms of the Modified BSD License. + +from typing import Any + + +def cast_int_addr(n: Any) -> int: + """Cast an address to a Python int + + This could be a Python integer or a CFFI pointer + """ + if isinstance(n, int): + return n + try: + import cffi # type: ignore + except ImportError: + pass + else: + # from pyzmq, this is an FFI void * + ffi = cffi.FFI() + if isinstance(n, ffi.CData): + return int(ffi.cast("size_t", n)) + + raise ValueError(f"Cannot cast {n!r} to int") diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/utils/ipcmaxlen.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/utils/ipcmaxlen.h new file mode 100644 index 0000000000000000000000000000000000000000..7af9a261be4be890aab7df2b570d59e09ff2a3e2 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/utils/ipcmaxlen.h @@ -0,0 +1,27 @@ +/* + +Platform-independant detection of IPC path max length + +Copyright (c) 2012 Godefroid Chapelle + +Distributed under the terms of the New BSD License. The full license is in +the file LICENSE.BSD, distributed as part of this software. + */ + +#pragma once + +#if defined(HAVE_SYS_UN_H) +#if defined _MSC_VER +#include +#else +#include +#endif +int get_ipc_path_max_len(void) { + struct sockaddr_un *dummy; + return sizeof(dummy->sun_path) - 1; +} +#else +int get_ipc_path_max_len(void) { + return 0; +} +#endif diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/utils/jsonapi.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/utils/jsonapi.py new file mode 100644 index 0000000000000000000000000000000000000000..6a6ee0785229f449ccc9efc3e778909699866de0 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/utils/jsonapi.py @@ -0,0 +1,38 @@ +"""JSON serialize to/from utf8 bytes + +.. versionchanged:: 22.2 + Remove optional imports of different JSON implementations. + Now that we require recent Python, unconditionally use the standard library. + Custom JSON libraries can be used via custom serialization functions. +""" + +# Copyright (C) PyZMQ Developers +# Distributed under the terms of the Modified BSD License. +from __future__ import annotations + +import json +from typing import Any + +# backward-compatibility, unused +jsonmod = json + + +def dumps(o: Any, **kwargs) -> bytes: + """Serialize object to JSON bytes (utf-8). + + Keyword arguments are passed along to :py:func:`json.dumps`. + """ + return json.dumps(o, **kwargs).encode("utf8") + + +def loads(s: bytes | str, **kwargs) -> dict | list | str | int | float: + """Load object from JSON bytes (utf-8). + + Keyword arguments are passed along to :py:func:`json.loads`. + """ + if isinstance(s, bytes): + s = s.decode("utf8") + return json.loads(s, **kwargs) + + +__all__ = ['dumps', 'loads'] diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/utils/monitor.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/utils/monitor.py new file mode 100644 index 0000000000000000000000000000000000000000..872e24dc2953ba17877d39c1628d3f38d53484d6 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/utils/monitor.py @@ -0,0 +1,128 @@ +"""Module holding utility and convenience functions for zmq event monitoring.""" + +# Copyright (C) PyZMQ Developers +# Distributed under the terms of the Modified BSD License. + +from __future__ import annotations + +import struct +from typing import Awaitable, TypedDict, overload + +import zmq +import zmq.asyncio +from zmq.error import _check_version + + +class _MonitorMessage(TypedDict): + event: int + value: int + endpoint: bytes + + +def parse_monitor_message(msg: list[bytes]) -> _MonitorMessage: + """decode zmq_monitor event messages. + + Parameters + ---------- + msg : list(bytes) + zmq multipart message that has arrived on a monitor PAIR socket. + + First frame is:: + + 16 bit event id + 32 bit event value + no padding + + Second frame is the endpoint as a bytestring + + Returns + ------- + event : dict + event description as dict with the keys `event`, `value`, and `endpoint`. + """ + if len(msg) != 2 or len(msg[0]) != 6: + raise RuntimeError(f"Invalid event message format: {msg}") + event_id, value = struct.unpack("=hi", msg[0]) + event: _MonitorMessage = { + 'event': zmq.Event(event_id), + 'value': zmq.Event(value), + 'endpoint': msg[1], + } + return event + + +async def _parse_monitor_msg_async( + awaitable_msg: Awaitable[list[bytes]], +) -> _MonitorMessage: + """Like parse_monitor_msg, but awaitable + + Given awaitable message, return awaitable for the parsed monitor message. + """ + + msg = await awaitable_msg + # 4.0-style event API + return parse_monitor_message(msg) + + +@overload +def recv_monitor_message( + socket: zmq.asyncio.Socket, + flags: int = 0, +) -> Awaitable[_MonitorMessage]: ... + + +@overload +def recv_monitor_message( + socket: zmq.Socket[bytes], + flags: int = 0, +) -> _MonitorMessage: ... + + +def recv_monitor_message( + socket: zmq.Socket, + flags: int = 0, +) -> _MonitorMessage | Awaitable[_MonitorMessage]: + """Receive and decode the given raw message from the monitoring socket and return a dict. + + Requires libzmq ≥ 4.0 + + The returned dict will have the following entries: + event : int + the event id as described in `libzmq.zmq_socket_monitor` + value : int + the event value associated with the event, see `libzmq.zmq_socket_monitor` + endpoint : str + the affected endpoint + + .. versionchanged:: 23.1 + Support for async sockets added. + When called with a async socket, + returns an awaitable for the monitor message. + + Parameters + ---------- + socket : zmq.Socket + The PAIR socket (created by other.get_monitor_socket()) on which to recv the message + flags : int + standard zmq recv flags + + Returns + ------- + event : dict + event description as dict with the keys `event`, `value`, and `endpoint`. + """ + + _check_version((4, 0), 'libzmq event API') + # will always return a list + msg = socket.recv_multipart(flags) + + # transparently handle asyncio socket, + # returns a Future instead of a dict + if isinstance(msg, Awaitable): + return _parse_monitor_msg_async(msg) + + # 4.0-style event API + return parse_monitor_message(msg) + + +__all__ = ['parse_monitor_message', 'recv_monitor_message'] diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/utils/mutex.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/utils/mutex.h new file mode 100644 index 0000000000000000000000000000000000000000..b6275ea28b0799607b93a69679a86f51a95fbb28 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/utils/mutex.h @@ -0,0 +1,84 @@ +/* +* simplified from mutex.c from Foundation Library, in the Public Domain +* https://github.com/rampantpixels/foundation_lib/blob/master/foundation/mutex.c +* +* This file is Copyright (C) PyZMQ Developers +* Distributed under the terms of the Modified BSD License. +* +*/ + +#pragma once + +#include + +#if defined(_WIN32) +# include +#else +# include +#endif + +typedef struct { +#if defined(_WIN32) + CRITICAL_SECTION csection; +#else + pthread_mutex_t mutex; +#endif +} mutex_t; + + +static void +_mutex_initialize(mutex_t* mutex) { +#if defined(_WIN32) + InitializeCriticalSectionAndSpinCount(&mutex->csection, 4000); +#else + pthread_mutexattr_t attr; + pthread_mutexattr_init(&attr); + pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE); + pthread_mutex_init(&mutex->mutex, &attr); + pthread_mutexattr_destroy(&attr); +#endif +} + +static void +_mutex_finalize(mutex_t* mutex) { +#if defined(_WIN32) + DeleteCriticalSection(&mutex->csection); +#else + pthread_mutex_destroy(&mutex->mutex); +#endif +} + +mutex_t* +mutex_allocate(void) { + mutex_t* mutex = (mutex_t*)malloc(sizeof(mutex_t)); + _mutex_initialize(mutex); + return mutex; +} + +void +mutex_deallocate(mutex_t* mutex) { + if (!mutex) + return; + _mutex_finalize(mutex); + free(mutex); +} + +int +mutex_lock(mutex_t* mutex) { +#if defined(_WIN32) + EnterCriticalSection(&mutex->csection); + return 0; +#else + return pthread_mutex_lock(&mutex->mutex); +#endif +} + +int +mutex_unlock(mutex_t* mutex) { +#if defined(_WIN32) + LeaveCriticalSection(&mutex->csection); + return 0; +#else + return pthread_mutex_unlock(&mutex->mutex); +#endif +} diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/utils/pyversion_compat.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/utils/pyversion_compat.h new file mode 100644 index 0000000000000000000000000000000000000000..fb19dcf09d6840ac12e995a308bb96838813797a --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/utils/pyversion_compat.h @@ -0,0 +1,12 @@ +#include "Python.h" + +// default to Python's own target Windows version(s) +// override by setting WINVER, _WIN32_WINNT, (maybe also NTDDI_VERSION?) macros +#ifdef Py_WINVER +#ifndef WINVER +#define WINVER Py_WINVER +#endif +#ifndef _WIN32_WINNT +#define _WIN32_WINNT Py_WINVER +#endif +#endif diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/utils/strtypes.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/utils/strtypes.py new file mode 100644 index 0000000000000000000000000000000000000000..3d90a04809ca4f29e1457099b63c03302e837a1e --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/utils/strtypes.py @@ -0,0 +1,62 @@ +"""Declare basic string types unambiguously for various Python versions. + +Authors +------- +* MinRK +""" + +# Copyright (C) PyZMQ Developers +# Distributed under the terms of the Modified BSD License. + +import warnings + +bytes = bytes +unicode = str +basestring = (str,) + + +def cast_bytes(s, encoding='utf8', errors='strict'): + """cast unicode or bytes to bytes""" + warnings.warn( + "zmq.utils.strtypes is deprecated in pyzmq 23.", + DeprecationWarning, + stacklevel=2, + ) + if isinstance(s, bytes): + return s + elif isinstance(s, str): + return s.encode(encoding, errors) + else: + raise TypeError(f"Expected unicode or bytes, got {s!r}") + + +def cast_unicode(s, encoding='utf8', errors='strict'): + """cast bytes or unicode to unicode""" + warnings.warn( + "zmq.utils.strtypes is deprecated in pyzmq 23.", + DeprecationWarning, + stacklevel=2, + ) + if isinstance(s, bytes): + return s.decode(encoding, errors) + elif isinstance(s, str): + return s + else: + raise TypeError(f"Expected unicode or bytes, got {s!r}") + + +# give short 'b' alias for cast_bytes, so that we can use fake b'stuff' +# to simulate b'stuff' +b = asbytes = cast_bytes +u = cast_unicode + +__all__ = [ + 'asbytes', + 'bytes', + 'unicode', + 'basestring', + 'b', + 'u', + 'cast_bytes', + 'cast_unicode', +] diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/utils/win32.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/utils/win32.py new file mode 100644 index 0000000000000000000000000000000000000000..019d429715af914d4aeb508bda342f764a74e9d0 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/utils/win32.py @@ -0,0 +1,130 @@ +"""Win32 compatibility utilities.""" + +# ----------------------------------------------------------------------------- +# Copyright (C) PyZMQ Developers +# Distributed under the terms of the Modified BSD License. +# ----------------------------------------------------------------------------- +from __future__ import annotations + +import os +from typing import Any, Callable + + +class allow_interrupt: + """Utility for fixing CTRL-C events on Windows. + + On Windows, the Python interpreter intercepts CTRL-C events in order to + translate them into ``KeyboardInterrupt`` exceptions. It (presumably) + does this by setting a flag in its "console control handler" and + checking it later at a convenient location in the interpreter. + + However, when the Python interpreter is blocked waiting for the ZMQ + poll operation to complete, it must wait for ZMQ's ``select()`` + operation to complete before translating the CTRL-C event into the + ``KeyboardInterrupt`` exception. + + The only way to fix this seems to be to add our own "console control + handler" and perform some application-defined operation that will + unblock the ZMQ polling operation in order to force ZMQ to pass control + back to the Python interpreter. + + This context manager performs all that Windows-y stuff, providing you + with a hook that is called when a CTRL-C event is intercepted. This + hook allows you to unblock your ZMQ poll operation immediately, which + will then result in the expected ``KeyboardInterrupt`` exception. + + Without this context manager, your ZMQ-based application will not + respond normally to CTRL-C events on Windows. If a CTRL-C event occurs + while blocked on ZMQ socket polling, the translation to a + ``KeyboardInterrupt`` exception will be delayed until the I/O completes + and control returns to the Python interpreter (this may never happen if + you use an infinite timeout). + + A no-op implementation is provided on non-Win32 systems to avoid the + application from having to conditionally use it. + + Example usage: + + .. sourcecode:: python + + def stop_my_application(): + # ... + + with allow_interrupt(stop_my_application): + # main polling loop. + + In a typical ZMQ application, you would use the "self pipe trick" to + send message to a ``PAIR`` socket in order to interrupt your blocking + socket polling operation. + + In a Tornado event loop, you can use the ``IOLoop.stop`` method to + unblock your I/O loop. + """ + + def __init__(self, action: Callable[[], Any] | None = None) -> None: + """Translate ``action`` into a CTRL-C handler. + + ``action`` is a callable that takes no arguments and returns no + value (returned value is ignored). It must *NEVER* raise an + exception. + + If unspecified, a no-op will be used. + """ + if os.name != "nt": + return + self._init_action(action) + + def _init_action(self, action): + from ctypes import WINFUNCTYPE, windll + from ctypes.wintypes import BOOL, DWORD + + kernel32 = windll.LoadLibrary('kernel32') + + # + PHANDLER_ROUTINE = WINFUNCTYPE(BOOL, DWORD) + SetConsoleCtrlHandler = self._SetConsoleCtrlHandler = ( + kernel32.SetConsoleCtrlHandler + ) + SetConsoleCtrlHandler.argtypes = (PHANDLER_ROUTINE, BOOL) + SetConsoleCtrlHandler.restype = BOOL + + if action is None: + + def action(): + return None + + self.action = action + + @PHANDLER_ROUTINE + def handle(event): + if event == 0: # CTRL_C_EVENT + action() + # Typical C implementations would return 1 to indicate that + # the event was processed and other control handlers in the + # stack should not be executed. However, that would + # prevent the Python interpreter's handler from translating + # CTRL-C to a `KeyboardInterrupt` exception, so we pretend + # that we didn't handle it. + return 0 + + self.handle = handle + + def __enter__(self): + """Install the custom CTRL-C handler.""" + if os.name != "nt": + return + result = self._SetConsoleCtrlHandler(self.handle, 1) + if result == 0: + # Have standard library automatically call `GetLastError()` and + # `FormatMessage()` into a nice exception object :-) + raise OSError() + + def __exit__(self, *args): + """Remove the custom CTRL-C handler.""" + if os.name != "nt": + return + result = self._SetConsoleCtrlHandler(self.handle, 0) + if result == 0: + # Have standard library automatically call `GetLastError()` and + # `FormatMessage()` into a nice exception object :-) + raise OSError() diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/utils/z85.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/utils/z85.py new file mode 100644 index 0000000000000000000000000000000000000000..016bdfe12f303f1542fe00fc92ab1a72a20a20b9 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/utils/z85.py @@ -0,0 +1,58 @@ +"""Python implementation of Z85 85-bit encoding + +Z85 encoding is a plaintext encoding for a bytestring interpreted as 32bit integers. +Since the chunks are 32bit, a bytestring must be a multiple of 4 bytes. +See ZMQ RFC 32 for details. + + +""" + +# Copyright (C) PyZMQ Developers +# Distributed under the terms of the Modified BSD License. +from __future__ import annotations + +import struct + +# Z85CHARS is the base 85 symbol table +Z85CHARS = b"0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ.-:+=^!/*?&<>()[]{}@%$#" +# Z85MAP maps integers in [0,84] to the appropriate character in Z85CHARS +Z85MAP = {c: idx for idx, c in enumerate(Z85CHARS)} + +_85s = [85**i for i in range(5)][::-1] + + +def encode(rawbytes): + """encode raw bytes into Z85""" + # Accepts only byte arrays bounded to 4 bytes + if len(rawbytes) % 4: + raise ValueError(f"length must be multiple of 4, not {len(rawbytes)}") + + nvalues = len(rawbytes) // 4 + values = struct.unpack(f'>{nvalues:d}I', rawbytes) + encoded = [] + for v in values: + for offset in _85s: + encoded.append(Z85CHARS[(v // offset) % 85]) + + return bytes(encoded) + + +def decode(z85bytes): + """decode Z85 bytes to raw bytes, accepts ASCII string""" + if isinstance(z85bytes, str): + try: + z85bytes = z85bytes.encode('ascii') + except UnicodeEncodeError: + raise ValueError('string argument should contain only ASCII characters') + + if len(z85bytes) % 5: + raise ValueError(f"Z85 length must be multiple of 5, not {len(z85bytes)}") + + nvalues = len(z85bytes) // 5 + values = [] + for i in range(0, len(z85bytes), 5): + value = 0 + for j, offset in enumerate(_85s): + value += Z85MAP[z85bytes[i + j]] * offset + values.append(value) + return struct.pack(f'>{nvalues:d}I', *values) diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/utils/zmq_compat.h b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/utils/zmq_compat.h new file mode 100644 index 0000000000000000000000000000000000000000..55fb58ec877a08a2126cbfebd5f39174476c8290 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zmq/utils/zmq_compat.h @@ -0,0 +1,100 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2010 Brian Granger, Min Ragan-Kelley +// +// Distributed under the terms of the New BSD License. The full license is in +// the file LICENSE.BSD, distributed as part of this software. +//----------------------------------------------------------------------------- + +#pragma once + +#if defined(_MSC_VER) +#define pyzmq_int64_t __int64 +#define pyzmq_uint32_t unsigned __int32 +#else +#include +#define pyzmq_int64_t int64_t +#define pyzmq_uint32_t uint32_t +#endif + + +#include "zmq.h" + +#define _missing (-1) + +#if (ZMQ_VERSION >= 40303) + // libzmq >= 4.3.3 defines zmq_fd_t for us + #define ZMQ_FD_T zmq_fd_t +#else + #ifdef _WIN32 + #if defined(_MSC_VER) && _MSC_VER <= 1400 + #define ZMQ_FD_T UINT_PTR + #else + #define ZMQ_FD_T SOCKET + #endif + #else + #define ZMQ_FD_T int + #endif +#endif + +#if (ZMQ_VERSION >= 40200) + // Nothing to remove +#else + #define zmq_curve_public(z85_public_key, z85_secret_key) _missing +#endif + +// use unambiguous aliases for zmq_send/recv functions + +#if ZMQ_VERSION_MAJOR >= 4 +// nothing to remove + #if ZMQ_VERSION_MAJOR == 4 && ZMQ_VERSION_MINOR == 0 + // zmq 4.1 deprecates zmq_utils.h + // we only get zmq_curve_keypair from it + #include "zmq_utils.h" + #endif +#else + #define zmq_curve_keypair(z85_public_key, z85_secret_key) _missing +#endif + +// libzmq 4.2 draft API +#ifdef ZMQ_BUILD_DRAFT_API + #define PYZMQ_DRAFT_API 1 + #if ZMQ_VERSION >= 40200 + #define PYZMQ_DRAFT_42 + #endif + #if ZMQ_VERSION >= 40302 + #define PYZMQ_DRAFT_432 + #endif +#else + #define PYZMQ_DRAFT_API 0 +#endif + +#ifndef PYZMQ_DRAFT_42 + #define zmq_join(s, group) _missing + #define zmq_leave(s, group) _missing + #define zmq_msg_set_routing_id(msg, routing_id) _missing + #define zmq_msg_routing_id(msg) 0 + #define zmq_msg_set_group(msg, group) _missing + #define zmq_msg_group(msg) NULL + #define zmq_poller_new() NULL + #define zmq_poller_destroy(poller_p) _missing + #define zmq_poller_add(poller, socket, userdata, events) _missing + #define zmq_poller_modify(poller, socket, events) _missing + #define zmq_poller_remove(poller, socket) _missing +#endif +#ifndef PYZMQ_DRAFT_432 + #define zmq_poller_fd(poller, fd) _missing +#endif + +#if ZMQ_VERSION >= 40100 +// nothing to remove +#else + #define zmq_msg_gets(msg, prop) _missing + #define zmq_has(capability) _missing + #define zmq_proxy_steerable(in, out, mon, ctrl) _missing +#endif + +// 3.x deprecations - these symbols haven't been removed, +// but let's protect against their planned removal +#define zmq_device(device_type, isocket, osocket) _missing +#define zmq_init(io_threads) ((void*)NULL) +#define zmq_term zmq_ctx_destroy diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope/deprecation/__init__.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope/deprecation/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..3d6f44c4828f5b6089e927db8313fba1f3762da1 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope/deprecation/__init__.py @@ -0,0 +1,23 @@ +############################################################################## +# +# Copyright (c) 2005 Zope Foundation and Contributors. +# All Rights Reserved. +# +# This software is subject to the provisions of the Zope Public License, +# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. +# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED +# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS +# FOR A PARTICULAR PURPOSE. +# +############################################################################## +"""Deprecation of modules / APIs. +""" +__docformat__ = "reStructuredText" + +from zope.deprecation.deprecation import ShowSwitch +from zope.deprecation.deprecation import Suppressor +from zope.deprecation.deprecation import __show__ +from zope.deprecation.deprecation import deprecate +from zope.deprecation.deprecation import deprecated +from zope.deprecation.deprecation import moved diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope/deprecation/deprecation.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope/deprecation/deprecation.py new file mode 100644 index 0000000000000000000000000000000000000000..cc249dd6e71f705cc38a4fdf5468b16c51b73b83 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope/deprecation/deprecation.py @@ -0,0 +1,237 @@ +############################################################################## +# +# Copyright (c) 2005 Zope Foundation and Contributors. +# All Rights Reserved. +# +# This software is subject to the provisions of the Zope Public License, +# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. +# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED +# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS +# FOR A PARTICULAR PURPOSE. +# +############################################################################## +"""Deprecation Support + +This module provides utilities to ease the development of backward-compatible +code. +""" +__docformat__ = "reStructuredText" +import sys +import types +import warnings + + +str_and_sequence_types = (str, list, tuple) + + +class ShowSwitch: + """Simple stack-based switch.""" + + def __init__(self): + self.stack = [] + + def on(self): + self.stack.pop() + + def off(self): + self.stack.append(False) + + def reset(self): + self.stack = [] + + def __call__(self): + return self.stack == [] + + def __repr__(self): + return '' % (self() and 'on' or 'off') + + +# This attribute can be used to temporarily deactivate deprecation +# warnings, so that backward-compatibility code can import other +# backward-compatibility components without warnings being produced. +__show__ = ShowSwitch() + + +class Suppressor: + + def __enter__(self): + __show__.off() + + def __exit__(self, *ignored): + __show__.on() + + +ogetattr = object.__getattribute__ + + +class DeprecationProxy: + + def __init__(self, module): + self.__original_module = module + self.__deprecated = {} + + def deprecate(self, names, message, cls=DeprecationWarning): + """Deprecate the given names.""" + if not isinstance(names, (tuple, list)): + names = (names,) + for name in names: + self.__deprecated[name] = (message, cls) + + def __getattribute__(self, name): + if name == 'deprecate' or name.startswith('_DeprecationProxy__'): + return ogetattr(self, name) + + if name == '__class__': + return types.ModuleType + + if name in ogetattr(self, '_DeprecationProxy__deprecated'): + if __show__(): + msg, cls = self.__deprecated[name] + warnings.warn(name + ': ' + msg, cls, 2) + + return getattr(ogetattr(self, '_DeprecationProxy__original_module'), + name) + + def __setattr__(self, name, value): + if name.startswith('_DeprecationProxy__'): + return object.__setattr__(self, name, value) + + setattr(self.__original_module, name, value) + + def __delattr__(self, name): + if name.startswith('_DeprecationProxy__'): + return object.__delattr__(self, name) + + delattr(self.__original_module, name) + + +class DeprecatedModule: + + def __init__(self, module, msg, cls=DeprecationWarning): + self.__original_module = module + self.__msg = msg + self.__cls = cls + + def __getattribute__(self, name): + if name.startswith('_DeprecatedModule__'): + return ogetattr(self, name) + + if name == '__class__': + return types.ModuleType + + if __show__(): + warnings.warn(self.__msg, self.__cls, 2) + + return getattr(ogetattr(self, '_DeprecatedModule__original_module'), + name) + + def __setattr__(self, name, value): + if name.startswith('_DeprecatedModule__'): + return object.__setattr__(self, name, value) + setattr(self.__original_module, name, value) + + def __delattr__(self, name): + if name.startswith('_DeprecatedModule__'): + return object.__delattr__(self, name) + delattr(self.__original_module, name) + + +class DeprecatedGetProperty: + + def __init__(self, prop, message, cls=DeprecationWarning): + self.message = message + self.prop = prop + self.cls = cls + + def __get__(self, inst, klass): + if __show__(): + warnings.warn(self.message, self.cls, 2) + return self.prop.__get__(inst, klass) + + +class DeprecatedGetSetProperty(DeprecatedGetProperty): + + def __set__(self, inst, prop): + if __show__(): + warnings.warn(self.message, self.cls, 2) + self.prop.__set__(inst, prop) + + +class DeprecatedGetSetDeleteProperty(DeprecatedGetSetProperty): + + def __delete__(self, inst): + if __show__(): + warnings.warn(self.message, self.cls, 2) + self.prop.__delete__(inst) + + +def DeprecatedMethod(method, message, cls=DeprecationWarning): + + def deprecated_method(*args, **kw): + if __show__(): + warnings.warn(message, cls, 2) + return method(*args, **kw) + + return deprecated_method + + +def deprecated(specifier, message, cls=DeprecationWarning): + """Deprecate the given names.""" + + # A string specifier (or list of strings) means we're called + # top-level in a module and are to deprecate things inside this + # module + if isinstance(specifier, str_and_sequence_types): + globals = sys._getframe(1).f_globals + modname = globals['__name__'] + + if not isinstance(sys.modules[modname], DeprecationProxy): + sys.modules[modname] = DeprecationProxy(sys.modules[modname]) + sys.modules[modname].deprecate(specifier, message, cls) + + # Anything else can mean the specifier is a function/method, + # module, or just an attribute of a class + elif isinstance(specifier, types.FunctionType): + return DeprecatedMethod(specifier, message, cls) + elif isinstance(specifier, types.ModuleType): + return DeprecatedModule(specifier, message, cls) + else: + prop = specifier + if hasattr(prop, '__get__') and hasattr(prop, '__set__') and \ + hasattr(prop, '__delete__'): + return DeprecatedGetSetDeleteProperty(prop, message, cls) + elif hasattr(prop, '__get__') and hasattr(prop, '__set__'): + return DeprecatedGetSetProperty(prop, message, cls) + elif hasattr(prop, '__get__'): + return DeprecatedGetProperty(prop, message, cls) + + +class deprecate: + """Deprecation decorator""" + + def __init__(self, msg, cls=DeprecationWarning): + self.msg = msg + self.cls = cls + + def __call__(self, func): + return DeprecatedMethod(func, self.msg, self.cls) + + +def moved(to_location, unsupported_in=None, cls=DeprecationWarning): + old = sys._getframe(1).f_globals['__name__'] + message = f'{old} has moved to {to_location}.' + if unsupported_in: + message += " Import of {} will become unsupported in {}".format( + old, unsupported_in) + + warnings.warn(message, cls, 3) + __import__(to_location) + + fromdict = sys.modules[to_location].__dict__ + tomod = sys.modules[old] + tomod.__doc__ = message + + for name, v in fromdict.items(): + if name not in tomod.__dict__: + setattr(tomod, name, v) diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope/deprecation/fixture.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope/deprecation/fixture.py new file mode 100644 index 0000000000000000000000000000000000000000..3cf2351ba3230a9339542391599f35beb968b7ea --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope/deprecation/fixture.py @@ -0,0 +1,3 @@ +# used by tests + +abc = 1 diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope/deprecation/tests.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope/deprecation/tests.py new file mode 100644 index 0000000000000000000000000000000000000000..21aaba9fcd8b8749bda6cb2b4ef5f4e20dea96e0 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope/deprecation/tests.py @@ -0,0 +1,625 @@ +import sys +import types +import unittest + + +class TestShowSwitch(unittest.TestCase): + def _makeOne(self): + from zope.deprecation import ShowSwitch + return ShowSwitch() + + def test_on(self): + switch = self._makeOne() + switch.stack.append(False) + switch.on() + self.assertEqual(switch.stack, []) + + def test_off(self): + switch = self._makeOne() + switch.off() + self.assertEqual(switch.stack, [False]) + + def test_reset(self): + switch = self._makeOne() + switch.stack.append(False) + switch.reset() + self.assertEqual(switch.stack, []) + + def test_call_true(self): + switch = self._makeOne() + self.assertEqual(switch(), True) + + def test_call_false(self): + switch = self._makeOne() + switch.stack.append(False) + self.assertEqual(switch(), False) + + def test_repr_on(self): + switch = self._makeOne() + self.assertEqual(repr(switch), '') + + def test_repr_off(self): + switch = self._makeOne() + switch.stack.append(False) + self.assertEqual(repr(switch), '') + + def test___show__global(self): + from zope.deprecation import __show__ + self.assertEqual(self._makeOne().__class__, __show__.__class__) + + +class TestSuppressor(unittest.TestCase): + def _makeOne(self): + from zope.deprecation import Suppressor + return Suppressor() + + def test_it(self): + from zope.deprecation import __show__ + self.assertEqual(__show__.stack, []) + with self._makeOne(): + self.assertEqual(__show__.stack, [False]) + self.assertEqual(__show__.stack, []) + + +class WarningsSetupBase: + def setUp(self): + from zope.deprecation import deprecation + self.oldwarnings = deprecation.warnings + self.oldshow = deprecation.__show__ + self.warnings = DummyWarningsModule() + self.show = DummyShow() + deprecation.warnings = self.warnings + deprecation.__show__ = self.show + + def tearDown(self): + from zope.deprecation import deprecation + deprecation.warnings = self.oldwarnings + deprecation.__show__ = self.oldshow + + +class TestDeprecationProxy(WarningsSetupBase, unittest.TestCase): + def _getTargetClass(self): + from zope.deprecation.deprecation import DeprecationProxy + return DeprecationProxy + + def _makeOne(self, module): + cls = self._getTargetClass() + return cls(module) + + def test_deprecate_and__getattribute__string(self): + tests = _getTestsModule() + proxy = self._makeOne(tests) + proxy.deprecate('ClassFixture', 'hello') + self.assertEqual(proxy.ClassFixture, ClassFixture) + self.assertEqual( + self.warnings.w, + [('ClassFixture: hello', DeprecationWarning, 2)]) + + def test_deprecate_and__getattribute__string_with_custom_cls(self): + tests = _getTestsModule() + proxy = self._makeOne(tests) + proxy.deprecate('ClassFixture', 'hello', DummyWarning) + self.assertEqual(proxy.ClassFixture, ClassFixture) + self.assertEqual( + self.warnings.w, + [('ClassFixture: hello', DummyWarning, 2)]) + + def test_deprecate_and__getattribute__sequence(self): + tests = _getTestsModule() + proxy = self._makeOne(tests) + proxy.deprecate(('ClassFixture', 'ClassFixture2'), 'hello') + self.assertEqual(proxy.ClassFixture, ClassFixture) + self.assertEqual(proxy.ClassFixture2, ClassFixture2) + self.assertEqual( + self.warnings.w, + [('ClassFixture: hello', DeprecationWarning, 2), + ('ClassFixture2: hello', DeprecationWarning, 2)] + ) + + def test_deprecate_and__getattribute__noshow(self): + tests = _getTestsModule() + proxy = self._makeOne(tests) + proxy.deprecate('ClassFixture', 'hello') + self.show.on = False + self.assertEqual(proxy.ClassFixture, ClassFixture) + self.assertEqual( + self.warnings.w, []) + + def test___getattribute____class__(self): + tests = _getTestsModule() + proxy = self._makeOne(tests) + self.assertEqual(proxy.__class__, types.ModuleType) + + def test___getattribute___deprecate(self): + tests = _getTestsModule() + proxy = self._makeOne(tests) + self.assertEqual(type(proxy.deprecate), types.MethodType) + + def test___getattribute__missing(self): + tests = _getTestsModule() + proxy = self._makeOne(tests) + self.assertRaises(AttributeError, getattr, proxy, 'wontbethere') + + def test___setattr__owned(self): + tests = _getTestsModule() + proxy = self._makeOne(tests) + proxy._DeprecationProxy__deprecated = {'foo': 'bar'} + self.assertEqual(proxy._DeprecationProxy__deprecated, {'foo': 'bar'}) + + def test___setattr__notowned(self): + tests = _getTestsModule() + proxy = self._makeOne(tests) + try: + proxy.foo = 'bar' + self.assertEqual(tests.foo, 'bar') + finally: + del tests.foo + + def test___delattr__owned(self): + tests = _getTestsModule() + proxy = self._makeOne(tests) + del proxy._DeprecationProxy__deprecated + self.assertRaises(AttributeError, getattr, proxy, + '_DeprecationProxy__deprecated') + + def test___delattr__notowned(self): + tests = _getTestsModule() + proxy = self._makeOne(tests) + tests.foo = 'bar' + del proxy.foo + self.assertRaises(AttributeError, getattr, tests, 'foo') + + +class TestDeprecatedModule(WarningsSetupBase, unittest.TestCase): + def _getTargetClass(self): + from zope.deprecation.deprecation import DeprecatedModule + return DeprecatedModule + + def _makeOne(self, module, msg, *args): + cls = self._getTargetClass() + return cls(module, msg, *args) + + def test___getattribute____class__(self): + tests = _getTestsModule() + proxy = self._makeOne(tests, 'hello') + self.assertEqual(proxy.__class__, types.ModuleType) + + def test___getattribute____owned__(self): + tests = _getTestsModule() + proxy = self._makeOne(tests, 'hello') + self.assertEqual(proxy._DeprecatedModule__msg, 'hello') + + def test___getattribute___deprecated(self): + tests = _getTestsModule() + proxy = self._makeOne(tests, 'hello') + self.assertEqual(proxy.ClassFixture, ClassFixture) + self.assertEqual( + self.warnings.w, + [('hello', DeprecationWarning, 2)] + ) + + def test___getattribute___deprecated_with_custom_cls(self): + tests = _getTestsModule() + proxy = self._makeOne(tests, 'hello', DummyWarning) + self.assertEqual(proxy.ClassFixture, ClassFixture) + self.assertEqual( + self.warnings.w, + [('hello', DummyWarning, 2)] + ) + + def test___getattribute__missing(self): + tests = _getTestsModule() + proxy = self._makeOne(tests, 'hello') + self.assertRaises(AttributeError, getattr, proxy, 'wontbethere') + self.assertEqual( + self.warnings.w, + [('hello', DeprecationWarning, 2)] + ) + + def test___getattribute___noshow(self): + tests = _getTestsModule() + self.show.on = False + proxy = self._makeOne(tests, 'hello') + self.assertEqual(proxy.ClassFixture, ClassFixture) + self.assertEqual( + self.warnings.w, []) + + def test___setattr__owned(self): + tests = _getTestsModule() + proxy = self._makeOne(tests, 'hello') + proxy._DeprecatedModule__msg = 'foo' + self.assertEqual(proxy._DeprecatedModule__msg, 'foo') + + def test___setattr__notowned(self): + tests = _getTestsModule() + proxy = self._makeOne(tests, 'hello') + try: + proxy.foo = 'bar' + self.assertEqual(tests.foo, 'bar') + finally: + del tests.foo + + def test___delattr__owned(self): + tests = _getTestsModule() + proxy = self._makeOne(tests, 'hello') + del proxy._DeprecatedModule__msg + self.assertRaises(AttributeError, getattr, proxy, + '_DeprecatedModule__msg') + + def test___delattr__notowned(self): + tests = _getTestsModule() + proxy = self._makeOne(tests, 'hello') + tests.foo = 'bar' + del proxy.foo + self.assertRaises(AttributeError, getattr, tests, 'foo') + + +class TestDeprecatedGetProperty(WarningsSetupBase, unittest.TestCase): + def _getTargetClass(self): + from zope.deprecation.deprecation import DeprecatedGetProperty + return DeprecatedGetProperty + + def _makeOne(self, prop, msg, *args): + cls = self._getTargetClass() + return cls(prop, msg, *args) + + def test___get__(self): + prop = DummyProperty() + proxy = self._makeOne(prop, 'hello') + self.assertEqual(proxy.__get__('inst', 'cls'), None) + self.assertEqual(prop.inst, 'inst') + self.assertEqual(prop.cls, 'cls') + self.assertEqual( + self.warnings.w, + [('hello', DeprecationWarning, 2)] + ) + + def test___get___with_custom_cls(self): + prop = DummyProperty() + proxy = self._makeOne(prop, 'hello', DummyWarning) + self.assertEqual(proxy.__get__('inst', 'cls'), None) + self.assertEqual(prop.inst, 'inst') + self.assertEqual(prop.cls, 'cls') + self.assertEqual( + self.warnings.w, + [('hello', DummyWarning, 2)] + ) + + def test___get__noshow(self): + prop = DummyProperty() + self.show.on = False + proxy = self._makeOne(prop, 'hello') + self.assertEqual(proxy.__get__('inst', 'cls'), None) + self.assertEqual(prop.inst, 'inst') + self.assertEqual(prop.cls, 'cls') + self.assertEqual(self.warnings.w, []) + + +class TestDeprecatedGetSetProperty(TestDeprecatedGetProperty): + def _getTargetClass(self): + from zope.deprecation.deprecation import DeprecatedGetSetProperty + return DeprecatedGetSetProperty + + def test___set__(self): + prop = DummyProperty() + proxy = self._makeOne(prop, 'hello') + self.assertEqual(proxy.__set__('inst', 'prop'), None) + self.assertEqual(prop.inst, 'inst') + self.assertEqual(prop.prop, 'prop') + self.assertEqual( + self.warnings.w, + [('hello', DeprecationWarning, 2)] + ) + + def test___set___with_custom_cls(self): + prop = DummyProperty() + proxy = self._makeOne(prop, 'hello', DummyWarning) + self.assertEqual(proxy.__set__('inst', 'prop'), None) + self.assertEqual(prop.inst, 'inst') + self.assertEqual(prop.prop, 'prop') + self.assertEqual( + self.warnings.w, + [('hello', DummyWarning, 2)] + ) + + def test___set__noshow(self): + prop = DummyProperty() + self.show.on = False + proxy = self._makeOne(prop, 'hello') + self.assertEqual(proxy.__set__('inst', 'prop'), None) + self.assertEqual(prop.inst, 'inst') + self.assertEqual(prop.prop, 'prop') + self.assertEqual(self.warnings.w, []) + + +class TestDeprecatedSetGetDeleteProperty(TestDeprecatedGetSetProperty): + def _getTargetClass(self): + from zope.deprecation.deprecation import DeprecatedGetSetDeleteProperty + return DeprecatedGetSetDeleteProperty + + def test___delete__(self): + prop = DummyProperty() + proxy = self._makeOne(prop, 'hello') + self.assertEqual(proxy.__delete__('inst'), None) + self.assertEqual(prop.inst, 'inst') + self.assertEqual( + self.warnings.w, + [('hello', DeprecationWarning, 2)] + ) + + def test___delete___with_custom_cls(self): + prop = DummyProperty() + proxy = self._makeOne(prop, 'hello', DummyWarning) + self.assertEqual(proxy.__delete__('inst'), None) + self.assertEqual(prop.inst, 'inst') + self.assertEqual( + self.warnings.w, + [('hello', DummyWarning, 2)] + ) + + def test___delete__noshow(self): + prop = DummyProperty() + proxy = self._makeOne(prop, 'hello') + self.assertEqual(proxy.__delete__('inst'), None) + self.assertEqual(prop.inst, 'inst') + self.assertEqual( + self.warnings.w, + [('hello', DeprecationWarning, 2)] + ) + + +class TestDeprecatedMethod(WarningsSetupBase, unittest.TestCase): + def _callFUT(self, method, message, *args): + from zope.deprecation.deprecation import DeprecatedMethod + return DeprecatedMethod(method, message, *args) + + def fixture(self, a, b, c=1): + return 'fixture' + + def test_it(self): + result = self._callFUT(self.fixture, 'hello') + self.assertEqual(result('a', 'b', c=2), 'fixture') + self.assertEqual( + self.warnings.w, + [('hello', DeprecationWarning, 2)] + ) + + def test_it_with_custom_cls(self): + result = self._callFUT(self.fixture, 'hello', DummyWarning) + self.assertEqual(result('a', 'b', c=2), 'fixture') + self.assertEqual( + self.warnings.w, + [('hello', DummyWarning, 2)] + ) + + def test_it_noshow(self): + result = self._callFUT(self.fixture, 'hello') + self.show.on = False + self.assertEqual(result('a', 'b', c=2), 'fixture') + self.assertEqual(self.warnings.w, []) + + +class Test_deprecated(WarningsSetupBase, unittest.TestCase): + def setUp(self): + super().setUp() + self.mod = _getTestsModule() + + def tearDown(self): + super().tearDown() + sys.modules['zope.deprecation.tests'] = self.mod + + def _callFUT(self, spec, message, *args): + from zope.deprecation.deprecation import deprecated + return deprecated(spec, message, *args) + + def test_string_specifier(self): + self._callFUT('ClassFixture', 'hello') + mod = _getTestsModule() + self.assertNotEqual(mod, self.mod) + self.assertEqual(mod.ClassFixture, ClassFixture) + self.assertEqual( + self.warnings.w, + [('ClassFixture: hello', DeprecationWarning, 2)]) + + def test_string_specifier_with_custom_cls(self): + self._callFUT('ClassFixture', 'hello', DummyWarning) + mod = _getTestsModule() + self.assertNotEqual(mod, self.mod) + self.assertEqual(mod.ClassFixture, ClassFixture) + self.assertEqual( + self.warnings.w, + [('ClassFixture: hello', DummyWarning, 2)]) + + def test_string_specifier_sys_modules_already_mutated(self): + from zope.deprecation.deprecation import DeprecationProxy + mod = _getTestsModule() + new = sys.modules['zope.deprecation.tests'] = DeprecationProxy(mod) + self._callFUT('ClassFixture', 'hello') + self.assertEqual(new.ClassFixture, ClassFixture) + self.assertEqual( + self.warnings.w, + [('ClassFixture: hello', DeprecationWarning, 2)]) + + def test_function_specifier(self): + result = self._callFUT(functionfixture, 'hello') + self.assertNotEqual(result, functionfixture) + self.assertEqual(self.warnings.w, []) + result() + self.assertEqual( + self.warnings.w, + [('hello', DeprecationWarning, 2)]) + + def test_module_specifier(self): + mod = _getTestsModule() + result = self._callFUT(mod, 'hello') + self.assertEqual(self.warnings.w, []) + self.assertEqual(result.ClassFixture, ClassFixture) + self.assertEqual( + self.warnings.w, + [('hello', DeprecationWarning, 2)]) + + def test_getproperty_specifier(self): + prop = DummyGetProperty() + result = self._callFUT(prop, 'hello') + self.assertEqual(self.warnings.w, []) + self.assertEqual(result.__get__('inst', 'cls'), None) + self.assertEqual( + self.warnings.w, + [('hello', DeprecationWarning, 2)]) + + def test_getsetproperty_specifier(self): + prop = DummyGetSetProperty() + result = self._callFUT(prop, 'hello') + self.assertEqual(self.warnings.w, []) + self.assertEqual(result.__set__('inst', 'prop'), None) + self.assertEqual( + self.warnings.w, + [('hello', DeprecationWarning, 2)]) + + def test_getsetdeleteproperty_specifier(self): + prop = DummyGetSetDeleteProperty() + result = self._callFUT(prop, 'hello') + self.assertEqual(self.warnings.w, []) + self.assertEqual(result.__delete__('inst'), None) + self.assertEqual( + self.warnings.w, + [('hello', DeprecationWarning, 2)]) + + +class Test_deprecate(WarningsSetupBase, unittest.TestCase): + def _getTargetClass(self): + from zope.deprecation.deprecation import deprecate + return deprecate + + def _makeOne(self, msg, *args): + cls = self._getTargetClass() + return cls(msg, *args) + + def fixture(self): + return 42 + + def test___call__(self): + proxy = self._makeOne('hello') + result = proxy(functionfixture) + self.assertEqual(result(), None) + self.assertEqual( + self.warnings.w, + [('hello', DeprecationWarning, 2)]) + + def test___call__method(self): + proxy = self._makeOne('method') + result = proxy(self.fixture) + self.assertEqual(result(), 42) + self.assertEqual( + self.warnings.w, + [('method', DeprecationWarning, 2)]) + + def test___call__with_custom_cls(self): + proxy = self._makeOne('hello', DummyWarning) + result = proxy(functionfixture) + self.assertEqual(result(), None) + self.assertEqual( + self.warnings.w, + [('hello', DummyWarning, 2)]) + + +class Test_moved(WarningsSetupBase, unittest.TestCase): + def setUp(self): + super().setUp() + + def tearDown(self): + super().tearDown() + del _getTestsModule().__dict__['abc'] + + def _callFUT(self, to_location, unsupported_in, *args): + from zope.deprecation.deprecation import moved + return moved(to_location, unsupported_in, *args) + + def test_unsupported_None(self): + self._callFUT('zope.deprecation.fixture', None) + self.assertEqual( + self.warnings.w, + [('zope.deprecation.tests has moved to zope.deprecation.fixture.', + DeprecationWarning, 3)]) + + def test_unsupported_None_with_custom_cls(self): + self._callFUT('zope.deprecation.fixture', None, DummyWarning) + self.assertEqual( + self.warnings.w, + [('zope.deprecation.tests has moved to zope.deprecation.fixture.', + DummyWarning, 3)]) + + def test_unsupported_not_None(self): + self._callFUT('zope.deprecation.fixture', '1.3') + self.assertEqual( + self.warnings.w, + [('zope.deprecation.tests has moved to zope.deprecation.fixture. ' + 'Import of zope.deprecation.tests will become unsupported in ' + '1.3', DeprecationWarning, 3)]) + + +class Test_import_aliases(unittest.TestCase): + def test_it(self): + for name in ('deprecated', 'deprecate', 'moved', 'ShowSwitch', + '__show__'): + real = getattr(sys.modules['zope.deprecation.deprecation'], name) + alias = getattr(sys.modules['zope.deprecation'], name) + self.assertEqual(real, alias, (real, alias)) + + +class DummyWarningsModule: + def __init__(self): + self.w = [] + + def warn(self, msg, type, stacklevel): + self.w.append((msg, type, stacklevel)) + + +class DummyGetProperty: + def __get__(self, inst, cls): + self.inst = inst + self.cls = cls + + +class DummyGetSetProperty(DummyGetProperty): + def __set__(self, inst, prop): + self.inst = inst + self.prop = prop + + +class DummyGetSetDeleteProperty(DummyGetSetProperty): + def __delete__(self, inst): + self.inst = inst + + +class DummyWarning(DeprecationWarning): + pass + + +DummyProperty = DummyGetSetDeleteProperty + + +def _getTestsModule(): + __import__('zope.deprecation.tests') + return sys.modules['zope.deprecation.tests'] + + +class DummyShow: + def __init__(self): + self.on = True + + def __call__(self): + if self.on: + return True + return False + + +class ClassFixture: + pass + + +class ClassFixture2: + pass + + +def functionfixture(): pass diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope/event/__init__.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope/event/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..07675b622d6ff2b814ee0f0798f9ebc79530f589 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope/event/__init__.py @@ -0,0 +1,33 @@ +############################################################################## +# +# Copyright (c) 2004 Zope Foundation and Contributors. +# All Rights Reserved. +# +# This software is subject to the provisions of the Zope Public License, +# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. +# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED +# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS +# FOR A PARTICULAR PURPOSE. +# +############################################################################## +""" Base event system implementation + +""" + +#: Applications may register for notification of events by appending a +#: callable to the ``subscribers`` list. +#: +#: Each subscriber takes a single argument, which is the event object +#: being published. +#: +#: Exceptions raised by subscribers will be propagated *without* running +#: any remaining subscribers. +subscribers = [] + + +def notify(event): + """ Notify all subscribers of ``event``. + """ + for subscriber in subscribers: + subscriber(event) diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope/event/classhandler.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope/event/classhandler.py new file mode 100644 index 0000000000000000000000000000000000000000..464572a3c5ea027110f117742884741d72e77361 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope/event/classhandler.py @@ -0,0 +1,76 @@ +"""Class-based event handlers + + +A light-weight event-handler framework based on event classes. + +Handlers are registered for event classes: + + >>> import zope.event.classhandler + + >>> class MyEvent(object): + ... pass + + >>> def handler1(event): + ... print("handler1 %r" % event.__class__.__name__) + + >>> zope.event.classhandler.handler(MyEvent, handler1) + +Descriptor syntax: + + >>> @zope.event.classhandler.handler(MyEvent) + ... def handler2(event): + ... print("handler2 %r" % event.__class__.__name__) + + >>> class MySubEvent(MyEvent): + ... pass + + >>> @zope.event.classhandler.handler(MySubEvent) + ... def handler3(event): + ... print("handler3 %r" % event.__class__.__name__) + + +Subscribers are called in class method-resolution order, so only +new-style event classes are supported, and then by order of registry. + + >>> import zope.event + >>> zope.event.notify(MySubEvent()) + handler3 'MySubEvent' + handler1 'MySubEvent' + handler2 'MySubEvent' + +""" +import zope.event + + +__all__ = [ + 'handler', +] + +registry = {} + + +def handler(event_class, handler_=None, _decorator=False): + """ Define an event handler for a (new-style) class. + + This can be called with a class and a handler, or with just a + class and the result used as a handler decorator. + """ + if handler_ is None: + return lambda func: handler(event_class, func, True) + + if not registry: + zope.event.subscribers.append(dispatch) + + if event_class not in registry: + registry[event_class] = [handler_] + else: + registry[event_class].append(handler_) + + if _decorator: + return handler + + +def dispatch(event): + for event_class in event.__class__.__mro__: + for handler in registry.get(event_class, ()): + handler(event) diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope/event/tests.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope/event/tests.py new file mode 100644 index 0000000000000000000000000000000000000000..0dc7df2eac8496f864e37defdeaa7152fc656fda --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope/event/tests.py @@ -0,0 +1,64 @@ +############################################################################## +# +# Copyright (c) 2004 Zope Foundation and Contributors. +# All Rights Reserved. +# +# This software is subject to the provisions of the Zope Public License, +# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. +# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED +# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS +# FOR A PARTICULAR PURPOSE. +# +############################################################################## +""" Test the event system +""" +import doctest +import unittest + + +class Test_notify(unittest.TestCase): + + def setUp(self): + from zope.event import subscribers + self._old_subscribers = subscribers[:] + subscribers[:] = [] + + def tearDown(self): + from zope.event import subscribers + subscribers[:] = self._old_subscribers + + def _callFUT(self, event): + from zope.event import notify + notify(event) + + def test_empty(self): + event = object() + self._callFUT(event) + + def test_not_empty(self): + from zope.event import subscribers + dummy = [] + subscribers.append(dummy.append) + event = object() + self._callFUT(event) + self.assertEqual(dummy, [event]) + + +def setUpClassHandlers(test): + import zope.event + test.globs['old_subs'] = zope.event.subscribers + + +def tearDownClassHandlers(test): + import zope.event + zope.event.subscribers = test.globs['old_subs'] + + +def test_suite(): + return unittest.TestSuite(( + unittest.defaultTestLoader.loadTestsFromName(__name__), + doctest.DocTestSuite( + 'zope.event.classhandler', + setUp=setUpClassHandlers, tearDown=tearDownClassHandlers) + )) diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope/interface/__init__.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope/interface/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..2b8e7eb45bf21cdc5febe09bcbd45dafbdb88fb9 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope/interface/__init__.py @@ -0,0 +1,90 @@ +############################################################################## +# +# Copyright (c) 2001, 2002 Zope Foundation and Contributors. +# All Rights Reserved. +# +# This software is subject to the provisions of the Zope Public License, +# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. +# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED +# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS +# FOR A PARTICULAR PURPOSE. +# +############################################################################## +"""Interfaces + +This package implements the Python "scarecrow" proposal. + +The package exports two objects, `Interface` and `Attribute` directly. It also +exports several helper methods. Interface is used to create an interface with +a class statement, as in: + + class IMyInterface(Interface): + '''Interface documentation + ''' + + def meth(arg1, arg2): + '''Documentation for meth + ''' + + # Note that there is no self argument + +To find out what you can do with interfaces, see the interface +interface, `IInterface` in the `interfaces` module. + +The package has several public modules: + + o `declarations` provides utilities to declare interfaces on objects. It + also provides a wide range of helpful utilities that aid in managing + declared interfaces. Most of its public names are however imported here. + + o `document` has a utility for documenting an interface as structured text. + + o `exceptions` has the interface-defined exceptions + + o `interfaces` contains a list of all public interfaces for this package. + + o `verify` has utilities for verifying implementations of interfaces. + +See the module doc strings for more information. +""" +__docformat__ = 'restructuredtext' +# pylint:disable=wrong-import-position,unused-import +from zope.interface.interface import Interface +from zope.interface.interface import _wire + + +# Need to actually get the interface elements to implement the right interfaces +_wire() +del _wire + +from zope.interface.declarations import Declaration # isort: skip +# The following are to make spec pickles cleaner +from zope.interface.declarations import Provides +from zope.interface.declarations import alsoProvides +from zope.interface.declarations import classImplements +from zope.interface.declarations import classImplementsFirst +from zope.interface.declarations import classImplementsOnly +from zope.interface.declarations import directlyProvidedBy +from zope.interface.declarations import directlyProvides +from zope.interface.declarations import implementedBy +from zope.interface.declarations import implementer +from zope.interface.declarations import implementer_only +from zope.interface.declarations import moduleProvides +from zope.interface.declarations import named +from zope.interface.declarations import noLongerProvides +from zope.interface.declarations import providedBy +from zope.interface.declarations import provider +from zope.interface.exceptions import Invalid +from zope.interface.interface import Attribute +from zope.interface.interface import interfacemethod +from zope.interface.interface import invariant +from zope.interface.interface import taggedValue +from zope.interface.interfaces import IInterfaceDeclaration + + +moduleProvides(IInterfaceDeclaration) + +__all__ = ('Interface', 'Attribute') + tuple(IInterfaceDeclaration) + +assert all(k in globals() for k in __all__) diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope/interface/_compat.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope/interface/_compat.py new file mode 100644 index 0000000000000000000000000000000000000000..380329532b165bb76475a3d3b801f32bfd426108 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope/interface/_compat.py @@ -0,0 +1,139 @@ +############################################################################## +# +# Copyright (c) 2006 Zope Foundation and Contributors. +# All Rights Reserved. +# +# This software is subject to the provisions of the Zope Public License, +# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. +# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED +# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS +# FOR A PARTICULAR PURPOSE. +# +############################################################################## +""" +Support functions for dealing with differences in platforms, including Python +versions and implementations. + +This file should have no imports from the rest of zope.interface because it is +used during early bootstrapping. +""" +import os +import sys + + +PY313_OR_OLDER = sys.version_info < (3, 14) + + +def _normalize_name(name): + if isinstance(name, bytes): + name = str(name, 'ascii') + if isinstance(name, str): + return name + raise TypeError("name must be a string or ASCII-only bytes") + + +PYPY = hasattr(sys, 'pypy_version_info') + + +def _c_optimizations_required(): + """ + Return a true value if the C optimizations are required. + + This uses the ``PURE_PYTHON`` variable as documented in `_use_c_impl`. + """ + pure_env = os.environ.get('PURE_PYTHON') + require_c = pure_env == "0" + return require_c + + +def _c_optimizations_available(): + """ + Return the C optimization module, if available, otherwise + a false value. + + If the optimizations are required but not available, this + raises the ImportError. + + This does not say whether they should be used or not. + """ + catch = () if _c_optimizations_required() else (ImportError,) + try: + from zope.interface import _zope_interface_coptimizations as c_opt + return c_opt + except catch: # pragma: no cover (only Jython doesn't build extensions) + return False + + +def _c_optimizations_ignored(): + """ + The opposite of `_c_optimizations_required`. + """ + pure_env = os.environ.get('PURE_PYTHON') + return pure_env is not None and pure_env != "0" + + +def _should_attempt_c_optimizations(): + """ + Return a true value if we should attempt to use the C optimizations. + + This takes into account whether we're on PyPy and the value of the + ``PURE_PYTHON`` environment variable, as defined in `_use_c_impl`. + """ + is_pypy = hasattr(sys, 'pypy_version_info') + + if _c_optimizations_required(): + return True + if is_pypy: + return False + return not _c_optimizations_ignored() + + +def _use_c_impl(py_impl, name=None, globs=None): + """ + Decorator. Given an object implemented in Python, with a name like + ``Foo``, import the corresponding C implementation from + ``zope.interface._zope_interface_coptimizations`` with the name + ``Foo`` and use it instead. + + If the ``PURE_PYTHON`` environment variable is set to any value + other than ``"0"``, or we're on PyPy, ignore the C implementation + and return the Python version. If the C implementation cannot be + imported, return the Python version. If ``PURE_PYTHON`` is set to + 0, *require* the C implementation (let the ImportError propagate); + note that PyPy can import the C implementation in this case (and all + tests pass). + + In all cases, the Python version is kept available. in the module + globals with the name ``FooPy`` and the name ``FooFallback`` (both + conventions have been used; the C implementation of some functions + looks for the ``Fallback`` version, as do some of the Sphinx + documents). + + Example:: + + @_use_c_impl + class Foo(object): + ... + """ + name = name or py_impl.__name__ + globs = globs or sys._getframe(1).f_globals + + def find_impl(): + if not _should_attempt_c_optimizations(): + return py_impl + + c_opt = _c_optimizations_available() + if not c_opt: # pragma: no cover (Jython doesn't build extensions) + return py_impl + + __traceback_info__ = c_opt + return getattr(c_opt, name) + + c_impl = find_impl() + # Always make available by the FooPy name and FooFallback + # name (for testing and documentation) + globs[name + 'Py'] = py_impl + globs[name + 'Fallback'] = py_impl + + return c_impl diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope/interface/_flatten.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope/interface/_flatten.py new file mode 100644 index 0000000000000000000000000000000000000000..a2cb86b7815a46230d98d687026d567e349ab2bc --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope/interface/_flatten.py @@ -0,0 +1,36 @@ +############################################################################## +# +# Copyright (c) 2002 Zope Foundation and Contributors. +# All Rights Reserved. +# +# This software is subject to the provisions of the Zope Public License, +# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. +# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED +# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS +# FOR A PARTICULAR PURPOSE. +# +############################################################################## +"""Adapter-style interface registry + +See Adapter class. +""" +from zope.interface import Declaration + + +def _flatten(implements, include_None=0): + + try: + r = implements.flattened() + except AttributeError: + if implements is None: + r = () + else: + r = Declaration(implements).flattened() + + if not include_None: + return r + + r = list(r) + r.append(None) + return r diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope/interface/_zope_interface_coptimizations.c b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope/interface/_zope_interface_coptimizations.c new file mode 100644 index 0000000000000000000000000000000000000000..45810ec617692edce6a264a1e1e392e5ba311825 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope/interface/_zope_interface_coptimizations.c @@ -0,0 +1,2669 @@ +/*########################################################################### + # + # Copyright (c) 2003 Zope Foundation and Contributors. + # All Rights Reserved. + # + # This software is subject to the provisions of the Zope Public License, + # Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. + # THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED + # WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS + # FOR A PARTICULAR PURPOSE. + # + ############################################################################*/ + +#include "Python.h" +#include "structmember.h" + +#ifdef __clang__ +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wunused-parameter" +#pragma clang diagnostic ignored "-Wmissing-field-initializers" +#endif + +#define TYPE(O) ((PyTypeObject*)(O)) +#define OBJECT(O) ((PyObject*)(O)) +#define CLASSIC(O) ((PyClassObject*)(O)) +#ifndef Py_TYPE +#define Py_TYPE(o) ((o)->ob_type) +#endif + +#define PyNative_FromString PyUnicode_FromString + +#define ASSURE_DICT(N) \ + if (N == NULL) { \ + N = PyDict_New(); \ + if (N == NULL) \ + return NULL; \ + } + +/* + * Don't use heap-allocated types for Python < 3.11: the API needed + * to find the dynamic module, 'PyType_GetModuleByDef', was added then. + */ +#if PY_VERSION_HEX < 0x030b0000 +#define USE_STATIC_TYPES 1 +#define USE_HEAP_TYPES 0 +#else +#define USE_STATIC_TYPES 0 +#define USE_HEAP_TYPES 1 +#endif + +#define BASETYPE_FLAGS \ + Py_TPFLAGS_DEFAULT | \ + Py_TPFLAGS_BASETYPE | \ + Py_TPFLAGS_HAVE_GC + +#if PY_VERSION_HEX >= 0x030c0000 +/* Add MANAGED_WEAKREF flag for Python >= 3.12, and don't define + * the '.tp_weaklistoffset' slot. + * + * See: https://docs.python.org/3/c-api/typeobj.html + * #c.PyTypeObject.tp_weaklistoffset + */ +#define USE_EXPLICIT_WEAKREFLIST 0 +#define WEAKREFTYPE_FLAGS BASETYPE_FLAGS | Py_TPFLAGS_MANAGED_WEAKREF +#else +/* No MANAGED_WEAKREF flag for Python < 3.12, and therefore define + * the '.tp_weaklistoffset' slot, and the member whose offset it holds. + * + * See: https://docs.python.org/3/c-api/typeobj.html + * #c.PyTypeObject.tp_weaklistoffset + */ +#define USE_EXPLICIT_WEAKREFLIST 1 +#define WEAKREFTYPE_FLAGS BASETYPE_FLAGS +#endif + +/* Static strings, used to invoke PyObject_GetAttr (only in hot paths) */ +static PyObject *str__class__ = NULL; +static PyObject *str__conform__ = NULL; +static PyObject *str__dict__ = NULL; +static PyObject *str__module__ = NULL; +static PyObject *str__name__ = NULL; +static PyObject *str__providedBy__ = NULL; +static PyObject *str__provides__ = NULL; +static PyObject *str__self__ = NULL; +static PyObject *str_generation = NULL; +static PyObject *str_registry = NULL; +static PyObject *strro = NULL; + +/* Static strings, used to invoke PyObject_CallMethodObjArgs */ +static PyObject *str_call_conform = NULL; +static PyObject *str_uncached_lookup = NULL; +static PyObject *str_uncached_lookupAll = NULL; +static PyObject *str_uncached_subscriptions = NULL; +static PyObject *strchanged = NULL; +static PyObject *str__adapt__ = NULL; + +/* Static strings, used to invoke PyObject_GetItem + * + * We cannot use PyDict_GetItemString, because the '__dict__' we get + * from our types can be a 'types.mappingproxy', which causes a segfault. + */ +static PyObject* str__implemented__; + + +static int +define_static_strings() +{ + if (str__class__ != NULL) { + return 0; + } + +#define DEFINE_STATIC_STRING(S) \ + if (!(str##S = PyUnicode_FromString(#S))) \ + return -1 + + DEFINE_STATIC_STRING(__class__); + DEFINE_STATIC_STRING(__conform__); + DEFINE_STATIC_STRING(__dict__); + DEFINE_STATIC_STRING(__module__); + DEFINE_STATIC_STRING(__name__); + DEFINE_STATIC_STRING(__providedBy__); + DEFINE_STATIC_STRING(__provides__); + DEFINE_STATIC_STRING(__self__); + DEFINE_STATIC_STRING(_generation); + DEFINE_STATIC_STRING(_registry); + DEFINE_STATIC_STRING(ro); + DEFINE_STATIC_STRING(__implemented__); + DEFINE_STATIC_STRING(_call_conform); + DEFINE_STATIC_STRING(_uncached_lookup); + DEFINE_STATIC_STRING(_uncached_lookupAll); + DEFINE_STATIC_STRING(_uncached_subscriptions); + DEFINE_STATIC_STRING(changed); + DEFINE_STATIC_STRING(__adapt__); +#undef DEFINE_STATIC_STRING + + return 0; +} + +/* Public module-scope functions, forward-declared here for type methods. */ +static PyObject *implementedBy(PyObject* module, PyObject *cls); +static PyObject *getObjectSpecification(PyObject *module, PyObject *ob); +static PyObject *providedBy(PyObject *module, PyObject *ob); + +/* + * Utility functions, forward-declared here for type methods. + */ +static PyObject* _get_module(PyTypeObject *typeobj); +static PyObject* _get_adapter_hooks(PyTypeObject *typeobj); +static PyTypeObject* _get_specification_base_class(PyTypeObject *typeobj); +static PyTypeObject* _get_interface_base_class(PyTypeObject *typeobj); + +#if USE_STATIC_TYPES +/* + * Global used by static IB__adapt + */ +static PyObject* adapter_hooks = NULL; + +/* + * Globals imported from 'zope.interface.declarations' + */ +static int imported_declarations = 0; +static PyObject* BuiltinImplementationSpecifications; +static PyObject* empty; +static PyObject* fallback; +static PyTypeObject *Implements; + +/* Import zope.interface.declarations and store results in global statics. + * + * Static alternative to '_zic_state_load_declarations' below. + */ +static int +import_declarations(void) +{ + PyObject *declarations, *i; + + declarations = PyImport_ImportModule("zope.interface.declarations"); + if (declarations == NULL) { return -1; } + + BuiltinImplementationSpecifications = PyObject_GetAttrString( + declarations, "BuiltinImplementationSpecifications"); + if (BuiltinImplementationSpecifications == NULL) { return -1; } + + empty = PyObject_GetAttrString(declarations, "_empty"); + if (empty == NULL) { return -1; } + + fallback = PyObject_GetAttrString(declarations, "implementedByFallback"); + if (fallback == NULL) { return -1;} + + i = PyObject_GetAttrString(declarations, "Implements"); + if (i == NULL) { return -1; } + + if (! PyType_Check(i)) { + PyErr_SetString( + PyExc_TypeError, + "zope.interface.declarations.Implements is not a type"); + return -1; + } + + Implements = (PyTypeObject *)i; + + Py_DECREF(declarations); + + imported_declarations = 1; + return 0; +} + +#endif + +/* + * SpecificationBase class + */ +typedef struct +{ + PyObject_HEAD + /* + In the past, these fields were stored in the __dict__ + and were technically allowed to contain any Python object, though + other type checks would fail or fall back to generic code paths if + they didn't have the expected type. We preserve that behaviour and don't + make any assumptions about contents. + */ + PyObject* _implied; +#if USE_EXPLICIT_WEAKREFLIST + PyObject* weakreflist; +#endif + /* + The remainder aren't used in C code but must be stored here + to prevent instance layout conflicts. + */ + PyObject* _dependents; + PyObject* _bases; + PyObject* _v_attrs; + PyObject* __iro__; + PyObject* __sro__; +} SB; + +/* + We know what the fields are *supposed* to define, but + they could have anything, so we need to traverse them. +*/ +static int +SB_traverse(SB* self, visitproc visit, void* arg) +{ +/* Visit our 'tp_type' only on Python >= 3.9, per + * https://docs.python.org/3/howto/isolating-extensions.html + * #tp-traverse-in-python-3-8-and-lower + */ +#if USE_HEAP_TYPES && PY_VERSION_HEX > 0x03090000 + Py_VISIT(Py_TYPE(self)); +#endif + Py_VISIT(self->_implied); + Py_VISIT(self->_dependents); + Py_VISIT(self->_bases); + Py_VISIT(self->_v_attrs); + Py_VISIT(self->__iro__); + Py_VISIT(self->__sro__); + return 0; +} + +static int +SB_clear(SB* self) +{ + Py_CLEAR(self->_implied); + Py_CLEAR(self->_dependents); + Py_CLEAR(self->_bases); + Py_CLEAR(self->_v_attrs); + Py_CLEAR(self->__iro__); + Py_CLEAR(self->__sro__); + return 0; +} + +static void +SB_dealloc(SB* self) +{ + PyObject_GC_UnTrack((PyObject*)self); + PyObject_ClearWeakRefs(OBJECT(self)); + PyTypeObject* tp = Py_TYPE(self); + SB_clear(self); + tp->tp_free(OBJECT(self)); +#if USE_HEAP_TYPES + Py_DECREF(tp); +#endif +} + +static char SB_extends__doc__[] = + "Test whether a specification is or extends another"; + +static PyObject* +SB_extends(SB* self, PyObject* other) +{ + PyObject* implied; + + implied = self->_implied; + if (implied == NULL) { + return NULL; + } + + if (PyDict_GetItem(implied, other) != NULL) + Py_RETURN_TRUE; + Py_RETURN_FALSE; +} + +static PyObject* +SB__call__(SB* self, PyObject* args, PyObject* kw) +{ + PyObject* spec; + + if (!PyArg_ParseTuple(args, "O", &spec)) + return NULL; + return SB_extends(self, spec); +} + +static char SB_providedBy__doc__[] = + "Test whether an interface is implemented by the specification"; + +static PyObject* +SB_providedBy(PyObject* self, PyObject* ob) +{ + PyObject *decl; + PyObject *item; + PyObject *module; + PyTypeObject *specification_base_class; + + module = _get_module(Py_TYPE(self)); + specification_base_class = _get_specification_base_class(Py_TYPE(self)); + + decl = providedBy(module, ob); + if (decl == NULL) + return NULL; + + if (PyObject_TypeCheck(decl, specification_base_class)) + item = SB_extends((SB*)decl, self); + else + /* decl is probably a security proxy. We have to go the long way + around. + */ + item = PyObject_CallFunctionObjArgs(decl, self, NULL); + + Py_DECREF(decl); + return item; +} + +static char SB_implementedBy__doc__[] = + "Test whether the specification is implemented by a class or factory.\n" + "Raise TypeError if argument is neither a class nor a callable."; + +static PyObject* +SB_implementedBy(PyObject* self, PyObject* cls) +{ + PyObject *decl; + PyObject *item; + PyObject *module; + PyTypeObject *specification_base_class; + + module = _get_module(Py_TYPE(self)); + specification_base_class = _get_specification_base_class(Py_TYPE(self)); + + decl = implementedBy(module, cls); + if (decl == NULL) + return NULL; + + if (PyObject_TypeCheck(decl, specification_base_class)) + item = SB_extends((SB*)decl, self); + else + item = PyObject_CallFunctionObjArgs(decl, self, NULL); + + Py_DECREF(decl); + return item; +} + +static struct PyMethodDef SB_methods[] = { + { "providedBy", + (PyCFunction)SB_providedBy, + METH_O, + SB_providedBy__doc__ }, + { "implementedBy", + (PyCFunction)SB_implementedBy, + METH_O, + SB_implementedBy__doc__ }, + { "isOrExtends", + (PyCFunction)SB_extends, + METH_O, + SB_extends__doc__ }, + + { NULL, NULL } /* sentinel */ +}; + +static PyMemberDef SB_members[] = { + { "_implied", T_OBJECT_EX, offsetof(SB, _implied), 0, "" }, + { "_dependents", T_OBJECT_EX, offsetof(SB, _dependents), 0, "" }, + { "_bases", T_OBJECT_EX, offsetof(SB, _bases), 0, "" }, + { "_v_attrs", T_OBJECT_EX, offsetof(SB, _v_attrs), 0, "" }, + { "__iro__", T_OBJECT_EX, offsetof(SB, __iro__), 0, "" }, + { "__sro__", T_OBJECT_EX, offsetof(SB, __sro__), 0, "" }, +#if USE_EXPLICIT_WEAKREFLIST + { "__weaklistoffset__", T_PYSSIZET, offsetof(SB, weakreflist), READONLY, "" }, +#endif + { NULL }, +}; + +static char SB__name__[] = "_zope_interface_coptimizations.SpecificationBase"; +static char SB__doc__[] = "Base type for Specification objects"; + +#if USE_STATIC_TYPES + +/* + * Static type: SpecificationBase + */ + +static PyTypeObject SB_type_def = { + PyVarObject_HEAD_INIT(NULL, 0) + .tp_name = SB__name__, + .tp_doc = SB__doc__, + .tp_basicsize = sizeof(SB), + .tp_flags = WEAKREFTYPE_FLAGS, + .tp_call = (ternaryfunc)SB__call__, + .tp_traverse = (traverseproc)SB_traverse, + .tp_clear = (inquiry)SB_clear, + .tp_dealloc = (destructor)SB_dealloc, +#if USE_EXPLICIT_WEAKREFLIST + .tp_weaklistoffset = offsetof(SB, weakreflist), +#endif + .tp_methods = SB_methods, + .tp_members = SB_members, +}; + +#else + +/* + * Heap-based type: SpecificationBase + */ +static PyType_Slot SB_type_slots[] = { + {Py_tp_doc, SB__doc__}, + {Py_tp_call, SB__call__}, + {Py_tp_traverse, SB_traverse}, + {Py_tp_clear, SB_clear}, + {Py_tp_dealloc, SB_dealloc}, + {Py_tp_methods, SB_methods}, + {Py_tp_members, SB_members}, + {0, NULL} +}; + +static PyType_Spec SB_type_spec = { + .name = SB__name__, + .basicsize = sizeof(SB), + .flags = WEAKREFTYPE_FLAGS, + .slots = SB_type_slots +}; + +#endif + +/* + * ObjectSpecificationDescriptor class + */ +#if USE_HEAP_TYPES +static int +OSD_traverse(PyObject* self, visitproc visit, void* arg) +{ + Py_VISIT(Py_TYPE(self)); + return 0; +} + +static void +OSD_dealloc(PyObject* self) +{ + PyObject_GC_UnTrack(self); + PyTypeObject *tp = Py_TYPE(self); + tp->tp_free(OBJECT(self)); + Py_DECREF(tp); +} +#endif + +static PyObject* +OSD_descr_get(PyObject* self, PyObject* inst, PyObject* cls) +{ + PyObject* provides; + PyObject *module; + + module = _get_module(Py_TYPE(self)); + + if (inst == NULL) { + return getObjectSpecification(module, cls); + } + + provides = PyObject_GetAttr(inst, str__provides__); + /* Return __provides__ if we got it, or return NULL and propagate + * non-AttributeError. */ + if (provides != NULL || !PyErr_ExceptionMatches(PyExc_AttributeError)) { + return provides; + } + + PyErr_Clear(); + + return implementedBy(module, cls); +} + +static char OSD__name__[] = ( + "_zope_interface_coptimizations.ObjectSpecificationDescriptor"); +static char OSD__doc__[] = "Object Specification Descriptor"; + +#if USE_STATIC_TYPES + +/* + * Static type: ObjectSpecificationDescriptor + */ + +static PyTypeObject OSD_type_def = { + PyVarObject_HEAD_INIT(NULL, 0) + .tp_name = OSD__name__, + .tp_doc = OSD__doc__, + /* No GC for the static version */ + .tp_flags = Py_TPFLAGS_DEFAULT | + Py_TPFLAGS_BASETYPE, + .tp_descr_get = (descrgetfunc)OSD_descr_get, + /*.tp_traverse, = OSD_traverse}, not reqd for static */ + /*.tp_dealloc, = OSD_dealloc}, not reqd for static */ +}; + +#else + +/* + * Heap type: ObjectSpecificationDescriptor + */ +static PyType_Slot OSD_type_slots[] = { + {Py_tp_doc, OSD__doc__}, + {Py_tp_descr_get, OSD_descr_get}, + {Py_tp_traverse, OSD_traverse}, + {Py_tp_dealloc, OSD_dealloc}, + {0, NULL} +}; + +static PyType_Spec OSD_type_spec = { + .name = OSD__name__, + .basicsize = 0, + .flags = BASETYPE_FLAGS, + .slots = OSD_type_slots +}; + +#endif + +/* + * ClassProvidesBase class + */ +typedef struct +{ + SB spec; + /* These members are handled generically, as for SB members. */ + PyObject* _cls; + PyObject* _implements; +} CPB; + +static int +CPB_traverse(CPB* self, visitproc visit, void* arg) +{ + Py_VISIT(self->_cls); + Py_VISIT(self->_implements); + return SB_traverse((SB*)self, visit, arg); +} + +static int +CPB_clear(CPB* self) +{ + Py_CLEAR(self->_cls); + Py_CLEAR(self->_implements); + return SB_clear((SB*)self); +} + +static void +CPB_dealloc(CPB* self) +{ + PyObject_GC_UnTrack((PyObject*)self); + CPB_clear(self); + SB_dealloc((SB*)self); /* handles decrefing tp */ +} + +static PyObject* +CPB_descr_get(CPB* self, PyObject* inst, PyObject* cls) +{ + PyObject* implements; + + if (self->_cls == NULL) + return NULL; + + if (cls == self->_cls) { + if (inst == NULL) { + Py_INCREF(self); + return OBJECT(self); + } + + implements = self->_implements; + Py_XINCREF(implements); + return implements; + } + + PyErr_SetString(PyExc_AttributeError, "__provides__"); + return NULL; +} + +static PyMemberDef CPB_members[] = { + { "_cls", T_OBJECT_EX, offsetof(CPB, _cls), 0, "Defining class." }, + { "_implements", + T_OBJECT_EX, + offsetof(CPB, _implements), + 0, + "Result of implementedBy." }, + { NULL } +}; + +static char CPB__name__[] = "_zope_interface_coptimizations.ClassProvidesBase"; +static char CPB__doc__[] = "C Base class for ClassProvides"; + +#if USE_STATIC_TYPES + +/* + * Static type: ClassProvidesBase + */ + +static PyTypeObject CPB_type_def = { + PyVarObject_HEAD_INIT(NULL, 0) + .tp_name = CPB__name__, + .tp_doc = CPB__doc__, + .tp_base = &SB_type_def, + .tp_basicsize = sizeof(CPB), + .tp_flags = BASETYPE_FLAGS, + .tp_descr_get = (descrgetfunc)CPB_descr_get, + .tp_traverse = (traverseproc)CPB_traverse, + .tp_clear = (inquiry)CPB_clear, + .tp_dealloc = (destructor)CPB_dealloc, + .tp_members = CPB_members, +}; + +#else + +/* + * Heap type: ClassProvidesBase + */ +static PyType_Slot CPB_type_slots[] = { + {Py_tp_doc, CPB__doc__}, + {Py_tp_descr_get, CPB_descr_get}, + {Py_tp_traverse, CPB_traverse}, + {Py_tp_clear, CPB_clear}, + {Py_tp_dealloc, CPB_dealloc}, + {Py_tp_members, CPB_members}, + /* tp_base cannot be set as a slot -- pass to PyType_FromModuleAndSpec */ + {0, NULL} +}; + +static PyType_Spec CPB_type_spec = { + .name = CPB__name__, + .basicsize = sizeof(CPB), + .flags = BASETYPE_FLAGS, + .slots = CPB_type_slots +}; + +#endif + +/* + * InterfaceBase class + */ + +typedef struct +{ + SB spec; + PyObject* __name__; + PyObject* __module__; + Py_hash_t _v_cached_hash; +} IB; + +static int +IB_traverse(IB* self, visitproc visit, void* arg) +{ + Py_VISIT(self->__name__); + Py_VISIT(self->__module__); + return SB_traverse((SB*)self, visit, arg); +} + +static int +IB_clear(IB* self) +{ + Py_CLEAR(self->__name__); + Py_CLEAR(self->__module__); + return SB_clear((SB*)self); +} + +static void +IB_dealloc(IB* self) +{ + PyObject_GC_UnTrack((PyObject*)self); + IB_clear(self); + SB_dealloc((SB*)self); /* handles decrefing tp */ +} + +static int +IB__init__(IB* self, PyObject* args, PyObject* kwargs) +{ + static char* kwlist[] = { "__name__", "__module__", NULL }; + PyObject* module = NULL; + PyObject* name = NULL; + + if (!PyArg_ParseTupleAndKeywords( + args, kwargs, "|OO:InterfaceBase.__init__", kwlist, &name, &module)) { + return -1; + } + IB_clear(self); + self->__module__ = module ? module : Py_None; + Py_INCREF(self->__module__); + self->__name__ = name ? name : Py_None; + Py_INCREF(self->__name__); + return 0; +} + +/* + def __adapt__(self, obj): + """Adapt an object to the receiver + """ + if self.providedBy(obj): + return obj + + for hook in adapter_hooks: + adapter = hook(self, obj) + if adapter is not None: + return adapter + + +*/ +const char IB__adapt____doc__[] = "Adapt an object to the receiver"; + +static PyObject* +IB__adapt__(PyObject* self, PyObject* obj) +{ + PyObject *decl; + PyObject *args; + PyObject *adapter; + PyObject *module; + PyObject *adapter_hooks; + PyTypeObject *specification_base_class; + int implements; + int i; + int l; + + module = _get_module(Py_TYPE(self)); + + decl = providedBy(module, obj); + if (decl == NULL) + return NULL; + + specification_base_class = _get_specification_base_class(Py_TYPE(self)); + + if (PyObject_TypeCheck(decl, specification_base_class)) { + PyObject* implied; + + implied = ((SB*)decl)->_implied; + if (implied == NULL) { + Py_DECREF(decl); + return NULL; + } + + implements = PyDict_GetItem(implied, self) != NULL; + Py_DECREF(decl); + } else { + /* decl is probably a security proxy. We have to go the long way + around. + */ + PyObject* r; + r = PyObject_CallFunctionObjArgs(decl, self, NULL); + Py_DECREF(decl); + if (r == NULL) + return NULL; + implements = PyObject_IsTrue(r); + Py_DECREF(r); + } + + if (implements) { + Py_INCREF(obj); + return obj; + } + + args = PyTuple_New(2); + if (args == NULL) { return NULL; } + + Py_INCREF(self); + PyTuple_SET_ITEM(args, 0, self); + + Py_INCREF(obj); + PyTuple_SET_ITEM(args, 1, obj); + + adapter_hooks = _get_adapter_hooks(Py_TYPE(self)); + l = PyList_GET_SIZE(adapter_hooks); + for (i = 0; i < l; i++) { + adapter = PyObject_CallObject(PyList_GET_ITEM(adapter_hooks, i), args); + if (adapter == NULL || adapter != Py_None) { + Py_DECREF(args); + return adapter; + } + Py_DECREF(adapter); + } + + Py_DECREF(args); + + Py_INCREF(Py_None); + return Py_None; +} + +/* + def __call__(self, obj, alternate=_marker): + try: + conform = obj.__conform__ + except AttributeError: # pylint:disable=bare-except + conform = None + + if conform is not None: + adapter = self._call_conform(conform) + if adapter is not None: + return adapter + + adapter = self.__adapt__(obj) + + if adapter is not None: + return adapter + if alternate is not _marker: + return alternate + raise TypeError("Could not adapt", obj, self) + +*/ +static PyObject* +IB__call__(PyObject* self, PyObject* args, PyObject* kwargs) +{ + PyObject *conform, *obj, *alternate, *adapter; + static char* kwlist[] = { "obj", "alternate", NULL }; + conform = obj = alternate = adapter = NULL; + + if (!PyArg_ParseTupleAndKeywords( + args, kwargs, "O|O", kwlist, &obj, &alternate)) + return NULL; + + conform = PyObject_GetAttr(obj, str__conform__); + if (conform == NULL) { + if (!PyErr_ExceptionMatches(PyExc_AttributeError)) { + /* Propagate non-AttributeErrors */ + return NULL; + } + PyErr_Clear(); + + Py_INCREF(Py_None); + conform = Py_None; + } + + if (conform != Py_None) { + adapter = + PyObject_CallMethodObjArgs(self, str_call_conform, conform, NULL); + Py_DECREF(conform); + if (adapter == NULL || adapter != Py_None) + return adapter; + Py_DECREF(adapter); + } else { + Py_DECREF(conform); + } + + /* We differ from the Python code here. For speed, instead of always calling + self.__adapt__(), we check to see if the type has defined it. Checking in + the dict for __adapt__ isn't sufficient because there's no cheap way to + tell if it's the __adapt__ that InterfaceBase itself defines (our type + will *never* be InterfaceBase, we're always subclassed by + InterfaceClass). Instead, we cooperate with InterfaceClass in Python to + set a flag in a new subclass when this is necessary. */ + if (PyDict_GetItemString(self->ob_type->tp_dict, "_CALL_CUSTOM_ADAPT")) { + /* Doesn't matter what the value is. Simply being present is enough. */ + adapter = PyObject_CallMethodObjArgs(self, str__adapt__, obj, NULL); + } else { + adapter = IB__adapt__(self, obj); + } + + if (adapter == NULL || adapter != Py_None) { + return adapter; + } + Py_DECREF(adapter); + + if (alternate != NULL) { + Py_INCREF(alternate); + return alternate; + } + + adapter = Py_BuildValue("sOO", "Could not adapt", obj, self); + if (adapter != NULL) { + PyErr_SetObject(PyExc_TypeError, adapter); + Py_DECREF(adapter); + } + return NULL; +} + +static Py_hash_t +IB__hash__(IB* self) +{ + PyObject* tuple; + if (!self->__module__) { + PyErr_SetString(PyExc_AttributeError, "__module__"); + return -1; + } + if (!self->__name__) { + PyErr_SetString(PyExc_AttributeError, "__name__"); + return -1; + } + + if (self->_v_cached_hash) { + return self->_v_cached_hash; + } + + tuple = PyTuple_Pack(2, self->__name__, self->__module__); + if (!tuple) { + return -1; + } + self->_v_cached_hash = PyObject_Hash(tuple); + Py_CLEAR(tuple); + return self->_v_cached_hash; +} + +static PyObject* +IB_richcompare(IB* self, PyObject* other, int op) +{ + PyObject* othername; + PyObject* othermod; + PyObject* oresult; + PyTypeObject* interface_base_class; + IB* otherib; + int result; + + otherib = NULL; + oresult = othername = othermod = NULL; + + if (OBJECT(self) == other) { + switch (op) { + case Py_EQ: + case Py_LE: + case Py_GE: + Py_RETURN_TRUE; + break; + case Py_NE: + Py_RETURN_FALSE; + } + } + + if (other == Py_None) { + switch (op) { + case Py_LT: + case Py_LE: + case Py_NE: + Py_RETURN_TRUE; + default: + Py_RETURN_FALSE; + } + } + + interface_base_class = _get_interface_base_class(Py_TYPE(self)); + if (interface_base_class == NULL) { + oresult = Py_NotImplemented; + goto cleanup; + } + + if (PyObject_TypeCheck(other, interface_base_class)) { + // This branch borrows references. No need to clean + // up if otherib is not null. + otherib = (IB*)other; + othername = otherib->__name__; + othermod = otherib->__module__; + } else { + othername = PyObject_GetAttr(other, str__name__); + if (othername) { + othermod = PyObject_GetAttr(other, str__module__); + } + if (!othername || !othermod) { + if (PyErr_Occurred() && + PyErr_ExceptionMatches(PyExc_AttributeError)) { + PyErr_Clear(); + oresult = Py_NotImplemented; + } + goto cleanup; + } + } +#if 0 +// This is the simple, straightforward version of what Python does. + PyObject* pt1 = PyTuple_Pack(2, self->__name__, self->__module__); + PyObject* pt2 = PyTuple_Pack(2, othername, othermod); + oresult = PyObject_RichCompare(pt1, pt2, op); +#endif + + // tuple comparison is decided by the first non-equal element. + result = PyObject_RichCompareBool(self->__name__, othername, Py_EQ); + if (result == 0) { + result = PyObject_RichCompareBool(self->__name__, othername, op); + } else if (result == 1) { + result = PyObject_RichCompareBool(self->__module__, othermod, op); + } + // If either comparison failed, we have an error set. + // Leave oresult NULL so we raise it. + if (result == -1) { + goto cleanup; + } + + oresult = result ? Py_True : Py_False; + +cleanup: + Py_XINCREF(oresult); + + if (!otherib) { + Py_XDECREF(othername); + Py_XDECREF(othermod); + } + return oresult; +} + +static PyMemberDef IB_members[] = { + { "__name__", T_OBJECT_EX, offsetof(IB, __name__), 0, "" }, + // The redundancy between __module__ and __ibmodule__ is because + // __module__ is often shadowed by subclasses. + { "__module__", T_OBJECT_EX, offsetof(IB, __module__), READONLY, "" }, + { "__ibmodule__", T_OBJECT_EX, offsetof(IB, __module__), 0, "" }, + { NULL } +}; + +static struct PyMethodDef IB_methods[] = { + { "__adapt__", (PyCFunction)IB__adapt__, METH_O, IB__adapt____doc__}, + { NULL, NULL } /* sentinel */ +}; + +static char IB__name__[] ="_zope_interface_coptimizations.InterfaceBase"; +static char IB__doc__[] = ( + "Interface base type providing __call__ and __adapt__" +); + +#if USE_STATIC_TYPES + +/* + * Static type: InterfaceBase + */ + +static PyTypeObject IB_type_def = { + PyVarObject_HEAD_INIT(NULL, 0) + .tp_name = IB__name__, + .tp_doc = IB__doc__, + .tp_base = &SB_type_def, + .tp_basicsize = sizeof(IB), + .tp_flags = BASETYPE_FLAGS, + .tp_init = (initproc)IB__init__, + .tp_hash = (hashfunc)IB__hash__, + .tp_richcompare = (richcmpfunc)IB_richcompare, + .tp_call = (ternaryfunc)IB__call__, + .tp_traverse = (traverseproc)IB_traverse, + .tp_clear = (inquiry)IB_clear, + .tp_dealloc = (destructor)IB_dealloc, + .tp_methods = IB_methods, + .tp_members = IB_members, +}; + +#else + +/* + * Heap type: InterfaceBase + */ +static PyType_Slot IB_type_slots[] = { + {Py_tp_doc, IB__doc__}, + {Py_tp_init, IB__init__}, + {Py_tp_hash, IB__hash__}, + {Py_tp_richcompare, IB_richcompare}, + {Py_tp_call, IB__call__}, + {Py_tp_traverse, IB_traverse}, + {Py_tp_clear, IB_clear}, + {Py_tp_dealloc, IB_dealloc}, + {Py_tp_methods, IB_methods}, + {Py_tp_members, IB_members}, + /* tp_base cannot be set as a slot -- pass to PyType_FromModuleAndSpec */ + {0, NULL} +}; + +static PyType_Spec IB_type_spec = { + .name = IB__name__, + .basicsize = sizeof(IB), + .flags = BASETYPE_FLAGS, + .slots = IB_type_slots +}; + +#endif + +/* + * LookupBase class + */ +typedef struct +{ + PyObject_HEAD + PyObject* _cache; + PyObject* _mcache; + PyObject* _scache; +} LB; + +static int +LB_traverse(LB* self, visitproc visit, void* arg) +{ +/* Visit our 'tp_type' only on Python >= 3.9, per + * https://docs.python.org/3/howto/isolating-extensions.html + * #tp-traverse-in-python-3-8-and-lower + */ +#if USE_HEAP_TYPES && PY_VERSION_HEX > 0x03090000 + Py_VISIT(Py_TYPE(self)); +#endif + Py_VISIT(self->_cache); + Py_VISIT(self->_mcache); + Py_VISIT(self->_scache); + return 0; +} + +static int +LB_clear(LB* self) +{ + Py_CLEAR(self->_cache); + Py_CLEAR(self->_mcache); + Py_CLEAR(self->_scache); + return 0; +} + +static void +LB_dealloc(LB* self) +{ + PyObject_GC_UnTrack((PyObject*)self); + PyTypeObject* tp = Py_TYPE(self); + LB_clear(self); + tp->tp_free((PyObject*)self); +#if USE_HEAP_TYPES + Py_DECREF(tp); +#endif +} + +/* + def changed(self, ignored=None): + self._cache.clear() + self._mcache.clear() + self._scache.clear() +*/ +static PyObject* +LB_changed(LB* self, PyObject* ignored) +{ + LB_clear(self); + Py_INCREF(Py_None); + return Py_None; +} + +/* + def _getcache(self, provided, name): + cache = self._cache.get(provided) + if cache is None: + cache = {} + self._cache[provided] = cache + if name: + c = cache.get(name) + if c is None: + c = {} + cache[name] = c + cache = c + return cache +*/ +static PyObject* +_subcache(PyObject* cache, PyObject* key) +{ + PyObject* subcache; + + subcache = PyDict_GetItem(cache, key); + if (subcache == NULL) { + int status; + + subcache = PyDict_New(); + if (subcache == NULL) + return NULL; + status = PyDict_SetItem(cache, key, subcache); + Py_DECREF(subcache); + if (status < 0) + return NULL; + } + + return subcache; +} + +static PyObject* +_getcache(LB* self, PyObject* provided, PyObject* name) +{ + PyObject* cache; + + ASSURE_DICT(self->_cache); + + cache = _subcache(self->_cache, provided); + if (cache == NULL) + return NULL; + + if (name != NULL && PyObject_IsTrue(name)) + cache = _subcache(cache, name); + + return cache; +} + +/* + def lookup(self, required, provided, name=u'', default=None): + cache = self._getcache(provided, name) + if len(required) == 1: + result = cache.get(required[0], _not_in_mapping) + else: + result = cache.get(tuple(required), _not_in_mapping) + + if result is _not_in_mapping: + result = self._uncached_lookup(required, provided, name) + if len(required) == 1: + cache[required[0]] = result + else: + cache[tuple(required)] = result + + if result is None: + return default + + return result +*/ + +static PyObject* +_lookup(LB* self, + PyObject* required, + PyObject* provided, + PyObject* name, + PyObject* default_) +{ + PyObject *result, *key, *cache; + result = key = cache = NULL; + if (name && !PyUnicode_Check(name)) { + PyErr_SetString(PyExc_ValueError, "name is not a string"); + return NULL; + } + + /* If `required` is a lazy sequence, it could have arbitrary side-effects, + such as clearing our caches. So we must not retrieve the cache until + after resolving it. */ + required = PySequence_Tuple(required); + if (required == NULL) + return NULL; + + cache = _getcache(self, provided, name); + if (cache == NULL) + return NULL; + + if (PyTuple_GET_SIZE(required) == 1) + key = PyTuple_GET_ITEM(required, 0); + else + key = required; + + result = PyDict_GetItem(cache, key); + if (result == NULL) { + int status; + + result = PyObject_CallMethodObjArgs( + OBJECT(self), str_uncached_lookup, required, provided, name, NULL); + if (result == NULL) { + Py_DECREF(required); + return NULL; + } + status = PyDict_SetItem(cache, key, result); + Py_DECREF(required); + if (status < 0) { + Py_DECREF(result); + return NULL; + } + } else { + Py_INCREF(result); + Py_DECREF(required); + } + + if (result == Py_None && default_ != NULL) { + Py_DECREF(Py_None); + Py_INCREF(default_); + return default_; + } + + return result; +} + +static PyObject* +LB_lookup(LB* self, PyObject* args, PyObject* kwds) +{ + static char* kwlist[] = { "required", "provided", "name", "default", NULL }; + PyObject *required, *provided, *name = NULL, *default_ = NULL; + + if (!PyArg_ParseTupleAndKeywords(args, + kwds, + "OO|OO:LookupBase.lookup", + kwlist, + &required, + &provided, + &name, + &default_)) + return NULL; + + return _lookup(self, required, provided, name, default_); +} + +/* + def lookup1(self, required, provided, name=u'', default=None): + cache = self._getcache(provided, name) + result = cache.get(required, _not_in_mapping) + if result is _not_in_mapping: + return self.lookup((required, ), provided, name, default) + + if result is None: + return default + + return result +*/ +static PyObject* +_lookup1(LB* self, + PyObject* required, + PyObject* provided, + PyObject* name, + PyObject* default_) +{ + PyObject *result, *cache; + + if (name && !PyUnicode_Check(name)) { + PyErr_SetString(PyExc_ValueError, "name is not a string"); + return NULL; + } + + cache = _getcache(self, provided, name); + if (cache == NULL) + return NULL; + + result = PyDict_GetItem(cache, required); + if (result == NULL) { + PyObject* tup; + + tup = PyTuple_New(1); + if (tup == NULL) + return NULL; + Py_INCREF(required); + PyTuple_SET_ITEM(tup, 0, required); + result = _lookup(self, tup, provided, name, default_); + Py_DECREF(tup); + } else { + if (result == Py_None && default_ != NULL) { + result = default_; + } + Py_INCREF(result); + } + + return result; +} +static PyObject* +LB_lookup1(LB* self, PyObject* args, PyObject* kwds) +{ + static char* kwlist[] = { "required", "provided", "name", "default", NULL }; + PyObject *required, *provided, *name = NULL, *default_ = NULL; + + if (!PyArg_ParseTupleAndKeywords(args, + kwds, + "OO|OO:LookupBase.lookup1", + kwlist, + &required, + &provided, + &name, + &default_)) + return NULL; + + return _lookup1(self, required, provided, name, default_); +} + +/* + def adapter_hook(self, provided, object, name=u'', default=None): + required = providedBy(object) + cache = self._getcache(provided, name) + factory = cache.get(required, _not_in_mapping) + if factory is _not_in_mapping: + factory = self.lookup((required, ), provided, name) + + if factory is not None: + if isinstance(object, super): + object = object.__self__ + result = factory(object) + if result is not None: + return result + + return default +*/ +static PyObject* +_adapter_hook(LB* self, + PyObject* provided, + PyObject* object, + PyObject* name, + PyObject* default_) +{ + PyObject *required; + PyObject *factory; + PyObject *result; + PyObject *module; + + module = _get_module(Py_TYPE(self)); + + if (name && !PyUnicode_Check(name)) { + PyErr_SetString(PyExc_ValueError, "name is not a string"); + return NULL; + } + + required = providedBy(module, object); + if (required == NULL) + return NULL; + + factory = _lookup1(self, required, provided, name, Py_None); + Py_DECREF(required); + if (factory == NULL) + return NULL; + + if (factory != Py_None) { + if (PyObject_TypeCheck(object, &PySuper_Type)) { + PyObject* self = PyObject_GetAttr(object, str__self__); + if (self == NULL) { + Py_DECREF(factory); + return NULL; + } + // Borrow the reference to self + Py_DECREF(self); + object = self; + } + result = PyObject_CallFunctionObjArgs(factory, object, NULL); + Py_DECREF(factory); + if (result == NULL || result != Py_None) + return result; + } else + result = factory; /* None */ + + if (default_ == NULL || default_ == result) /* No default specified, */ + return result; /* Return None. result is owned None */ + + Py_DECREF(result); + Py_INCREF(default_); + + return default_; +} + +static PyObject* +LB_adapter_hook(LB* self, PyObject* args, PyObject* kwds) +{ + static char* kwlist[] = { "provided", "object", "name", "default", NULL }; + PyObject *object, *provided, *name = NULL, *default_ = NULL; + + if (!PyArg_ParseTupleAndKeywords(args, + kwds, + "OO|OO:LookupBase.adapter_hook", + kwlist, + &provided, + &object, + &name, + &default_)) + return NULL; + + return _adapter_hook(self, provided, object, name, default_); +} + +static PyObject* +LB_queryAdapter(LB* self, PyObject* args, PyObject* kwds) +{ + static char* kwlist[] = { "object", "provided", "name", "default", NULL }; + PyObject *object, *provided, *name = NULL, *default_ = NULL; + + if (!PyArg_ParseTupleAndKeywords(args, + kwds, + "OO|OO:LookupBase.queryAdapter", + kwlist, + &object, + &provided, + &name, + &default_)) + return NULL; + + return _adapter_hook(self, provided, object, name, default_); +} + +/* + def lookupAll(self, required, provided): + cache = self._mcache.get(provided) + if cache is None: + cache = {} + self._mcache[provided] = cache + + required = tuple(required) + result = cache.get(required, _not_in_mapping) + if result is _not_in_mapping: + result = self._uncached_lookupAll(required, provided) + cache[required] = result + + return result +*/ +static PyObject* +_lookupAll(LB* self, PyObject* required, PyObject* provided) +{ + PyObject *cache, *result; + + /* resolve before getting cache. See note in _lookup. */ + required = PySequence_Tuple(required); + if (required == NULL) + return NULL; + + ASSURE_DICT(self->_mcache); + + cache = _subcache(self->_mcache, provided); + if (cache == NULL) + return NULL; + + result = PyDict_GetItem(cache, required); + if (result == NULL) { + int status; + + result = PyObject_CallMethodObjArgs( + OBJECT(self), str_uncached_lookupAll, required, provided, NULL); + if (result == NULL) { + Py_DECREF(required); + return NULL; + } + status = PyDict_SetItem(cache, required, result); + Py_DECREF(required); + if (status < 0) { + Py_DECREF(result); + return NULL; + } + } else { + Py_INCREF(result); + Py_DECREF(required); + } + + return result; +} + +static PyObject* +LB_lookupAll(LB* self, PyObject* args, PyObject* kwds) +{ + static char* kwlist[] = { "required", "provided", NULL }; + PyObject *required, *provided; + + if (!PyArg_ParseTupleAndKeywords( + args, kwds, "OO:LookupBase.lookupAll", kwlist, &required, &provided)) + return NULL; + + return _lookupAll(self, required, provided); +} + +/* + def subscriptions(self, required, provided): + cache = self._scache.get(provided) + if cache is None: + cache = {} + self._scache[provided] = cache + + required = tuple(required) + result = cache.get(required, _not_in_mapping) + if result is _not_in_mapping: + result = self._uncached_subscriptions(required, provided) + cache[required] = result + + return result +*/ +static PyObject* +_subscriptions(LB* self, PyObject* required, PyObject* provided) +{ + PyObject *cache, *result; + + /* resolve before getting cache. See note in _lookup. */ + required = PySequence_Tuple(required); + if (required == NULL) + return NULL; + + ASSURE_DICT(self->_scache); + + cache = _subcache(self->_scache, provided); + if (cache == NULL) + return NULL; + + result = PyDict_GetItem(cache, required); + if (result == NULL) { + int status; + + result = PyObject_CallMethodObjArgs( + OBJECT(self), str_uncached_subscriptions, required, provided, NULL); + if (result == NULL) { + Py_DECREF(required); + return NULL; + } + status = PyDict_SetItem(cache, required, result); + Py_DECREF(required); + if (status < 0) { + Py_DECREF(result); + return NULL; + } + } else { + Py_INCREF(result); + Py_DECREF(required); + } + + return result; +} + +static PyObject* +LB_subscriptions(LB* self, PyObject* args, PyObject* kwds) +{ + static char* kwlist[] = { "required", "provided", NULL }; + PyObject *required, *provided; + + if (!PyArg_ParseTupleAndKeywords( + args, kwds, "OO", kwlist, &required, &provided)) + return NULL; + + return _subscriptions(self, required, provided); +} + +static struct PyMethodDef LB_methods[] = { + { "changed", (PyCFunction)LB_changed, METH_O, "" }, + { "lookup", (PyCFunction)LB_lookup, METH_KEYWORDS | METH_VARARGS, "" }, + { "lookup1", + (PyCFunction)LB_lookup1, + METH_KEYWORDS | METH_VARARGS, + "" }, + { "queryAdapter", + (PyCFunction)LB_queryAdapter, + METH_KEYWORDS | METH_VARARGS, + "" }, + { "adapter_hook", + (PyCFunction)LB_adapter_hook, + METH_KEYWORDS | METH_VARARGS, + "" }, + { "lookupAll", + (PyCFunction)LB_lookupAll, + METH_KEYWORDS | METH_VARARGS, + "" }, + { "subscriptions", + (PyCFunction)LB_subscriptions, + METH_KEYWORDS | METH_VARARGS, + "" }, + { NULL, NULL } /* sentinel */ +}; + +static char LB__name__[] = "_zope_interface_coptimizations.LookupBase"; +static char LB__doc__[] = "Base class for adapter registries"; + + +#if USE_STATIC_TYPES + +/* + * Static type: LookupBase + */ + +static PyTypeObject LB_type_def = { + PyVarObject_HEAD_INIT(NULL, 0) + .tp_name = LB__name__, + .tp_doc = LB__doc__, + .tp_basicsize = sizeof(LB), + .tp_flags = BASETYPE_FLAGS, + .tp_traverse = (traverseproc)LB_traverse, + .tp_clear = (inquiry)LB_clear, + .tp_dealloc = (destructor)&LB_dealloc, + .tp_methods = LB_methods, +}; + +#else + +/* + * Heap type: LookupBase + */ +static PyType_Slot LB_type_slots[] = { + {Py_tp_doc, LB__doc__}, + {Py_tp_traverse, LB_traverse}, + {Py_tp_clear, LB_clear}, + {Py_tp_dealloc, LB_dealloc}, + {Py_tp_methods, LB_methods}, + {0, NULL} +}; + +static PyType_Spec LB_type_spec = { + .name = LB__name__, + .basicsize = sizeof(LB), + .flags = BASETYPE_FLAGS, + .slots = LB_type_slots +}; + +#endif + +typedef struct +{ + LB lookup; + PyObject* _verify_ro; + PyObject* _verify_generations; +} VB; + +static int +VB_traverse(VB* self, visitproc visit, void* arg) +{ + Py_VISIT(self->_verify_ro); + Py_VISIT(self->_verify_generations); + return LB_traverse((LB*)self, visit, arg); +} + +static int +VB_clear(VB* self) +{ + Py_CLEAR(self->_verify_generations); + Py_CLEAR(self->_verify_ro); + return LB_clear((LB*)self); +} + +static void +VB_dealloc(VB* self) +{ + PyObject_GC_UnTrack((PyObject*)self); + PyTypeObject *tp = Py_TYPE(self); + VB_clear(self); + tp->tp_free((PyObject*)self); +#if USE_HEAP_TYPES + Py_DECREF(tp); +#endif +} + +/* + def changed(self, originally_changed): + super(VerifyingBasePy, self).changed(originally_changed) + self._verify_ro = self._registry.ro[1:] + self._verify_generations = [r._generation for r in self._verify_ro] +*/ +static PyObject* +_generations_tuple(PyObject* ro) +{ + int i, l; + PyObject* generations; + + l = PyTuple_GET_SIZE(ro); + generations = PyTuple_New(l); + for (i = 0; i < l; i++) { + PyObject* generation; + + generation = PyObject_GetAttr(PyTuple_GET_ITEM(ro, i), str_generation); + if (generation == NULL) { + Py_DECREF(generations); + return NULL; + } + PyTuple_SET_ITEM(generations, i, generation); + } + + return generations; +} +static PyObject* +verify_changed(VB* self, PyObject* ignored) +{ + PyObject *t, *ro; + + VB_clear(self); + + t = PyObject_GetAttr(OBJECT(self), str_registry); + if (t == NULL) + return NULL; + + ro = PyObject_GetAttr(t, strro); + Py_DECREF(t); + if (ro == NULL) + return NULL; + + t = PyObject_CallFunctionObjArgs(OBJECT(&PyTuple_Type), ro, NULL); + Py_DECREF(ro); + if (t == NULL) + return NULL; + + ro = PyTuple_GetSlice(t, 1, PyTuple_GET_SIZE(t)); + Py_DECREF(t); + if (ro == NULL) + return NULL; + + self->_verify_generations = _generations_tuple(ro); + if (self->_verify_generations == NULL) { + Py_DECREF(ro); + return NULL; + } + + self->_verify_ro = ro; + + Py_INCREF(Py_None); + return Py_None; +} + +/* + def _verify(self): + if ([r._generation for r in self._verify_ro] + != self._verify_generations): + self.changed(None) +*/ +static int +_verify(VB* self) +{ + PyObject* changed_result; + + if (self->_verify_ro != NULL && self->_verify_generations != NULL) { + PyObject* generations; + int changed; + + generations = _generations_tuple(self->_verify_ro); + if (generations == NULL) + return -1; + + changed = PyObject_RichCompareBool( + self->_verify_generations, generations, Py_NE); + Py_DECREF(generations); + if (changed == -1) + return -1; + + if (changed == 0) + return 0; + } + + changed_result = + PyObject_CallMethodObjArgs(OBJECT(self), strchanged, Py_None, NULL); + if (changed_result == NULL) + return -1; + + Py_DECREF(changed_result); + return 0; +} + +static PyObject* +VB_lookup(VB* self, PyObject* args, PyObject* kwds) +{ + static char* kwlist[] = { "required", "provided", "name", "default", NULL }; + PyObject *required, *provided, *name = NULL, *default_ = NULL; + + if (!PyArg_ParseTupleAndKeywords( + args, kwds, "OO|OO", kwlist, &required, &provided, &name, &default_)) + return NULL; + + if (_verify(self) < 0) + return NULL; + + return _lookup((LB*)self, required, provided, name, default_); +} + +static PyObject* +VB_lookup1(VB* self, PyObject* args, PyObject* kwds) +{ + static char* kwlist[] = { "required", "provided", "name", "default", NULL }; + PyObject *required, *provided, *name = NULL, *default_ = NULL; + + if (!PyArg_ParseTupleAndKeywords( + args, kwds, "OO|OO", kwlist, &required, &provided, &name, &default_)) + return NULL; + + if (_verify(self) < 0) + return NULL; + + return _lookup1((LB*)self, required, provided, name, default_); +} + +static PyObject* +VB_adapter_hook(VB* self, PyObject* args, PyObject* kwds) +{ + static char* kwlist[] = { "provided", "object", "name", "default", NULL }; + PyObject *object, *provided, *name = NULL, *default_ = NULL; + + if (!PyArg_ParseTupleAndKeywords( + args, kwds, "OO|OO", kwlist, &provided, &object, &name, &default_)) + return NULL; + + if (_verify(self) < 0) + return NULL; + + return _adapter_hook((LB*)self, provided, object, name, default_); +} + +static PyObject* +VB_queryAdapter(VB* self, PyObject* args, PyObject* kwds) +{ + static char* kwlist[] = { "object", "provided", "name", "default", NULL }; + PyObject *object, *provided, *name = NULL, *default_ = NULL; + + if (!PyArg_ParseTupleAndKeywords( + args, kwds, "OO|OO", kwlist, &object, &provided, &name, &default_)) + return NULL; + + if (_verify(self) < 0) + return NULL; + + return _adapter_hook((LB*)self, provided, object, name, default_); +} + +static PyObject* +VB_lookupAll(VB* self, PyObject* args, PyObject* kwds) +{ + static char* kwlist[] = { "required", "provided", NULL }; + PyObject *required, *provided; + + if (!PyArg_ParseTupleAndKeywords( + args, kwds, "OO", kwlist, &required, &provided)) + return NULL; + + if (_verify(self) < 0) + return NULL; + + return _lookupAll((LB*)self, required, provided); +} + +static PyObject* +VB_subscriptions(VB* self, PyObject* args, PyObject* kwds) +{ + static char* kwlist[] = { "required", "provided", NULL }; + PyObject *required, *provided; + + if (!PyArg_ParseTupleAndKeywords( + args, kwds, "OO", kwlist, &required, &provided)) + return NULL; + + if (_verify(self) < 0) + return NULL; + + return _subscriptions((LB*)self, required, provided); +} + +static struct PyMethodDef VB_methods[] = { + { "changed", (PyCFunction)verify_changed, METH_O, "" }, + { "lookup", + (PyCFunction)VB_lookup, + METH_KEYWORDS | METH_VARARGS, + "" }, + { "lookup1", + (PyCFunction)VB_lookup1, + METH_KEYWORDS | METH_VARARGS, + "" }, + { "queryAdapter", + (PyCFunction)VB_queryAdapter, + METH_KEYWORDS | METH_VARARGS, + "" }, + { "adapter_hook", + (PyCFunction)VB_adapter_hook, + METH_KEYWORDS | METH_VARARGS, + "" }, + { "lookupAll", + (PyCFunction)VB_lookupAll, + METH_KEYWORDS | METH_VARARGS, + "" }, + { "subscriptions", + (PyCFunction)VB_subscriptions, + METH_KEYWORDS | METH_VARARGS, + "" }, + { NULL, NULL } /* sentinel */ +}; + +static char VB__name__[] = "_zope_interface_coptimizations.VerifyingBase"; +static char VB__doc__[] = "Base class for verifying adapter registries."; + +#if USE_STATIC_TYPES + +/* + * Static type: VerifyingBase + */ + +static PyTypeObject VB_type_def = { + PyVarObject_HEAD_INIT(NULL, 0) + .tp_name = VB__name__, + .tp_doc = VB__doc__, + .tp_base = &LB_type_def, + .tp_basicsize = sizeof(VB), + .tp_flags = BASETYPE_FLAGS, + .tp_traverse = (traverseproc)VB_traverse, + .tp_clear = (inquiry)VB_clear, + .tp_dealloc = (destructor)&VB_dealloc, + .tp_methods = VB_methods, +}; + + +#else + +/* + * Heap type: VerifyingBase + */ +static PyType_Slot VB_type_slots[] = { + {Py_tp_doc, VB__doc__}, + {Py_tp_traverse, VB_traverse}, + {Py_tp_clear, VB_clear}, + {Py_tp_dealloc, VB_dealloc}, + {Py_tp_methods, VB_methods}, + /* tp_base cannot be set as a slot -- pass to PyType_FromModuleAndSpec */ + {0, NULL} +}; + +static PyType_Spec VB_type_spec = { + .name = VB__name__, + .basicsize = sizeof(VB), + .flags = BASETYPE_FLAGS, + .slots = VB_type_slots +}; + +#endif + + +/* + * Module state struct: holds all data formerly kept as static globals. + */ +typedef struct +{ + /* our globals (exposed to Python) */ + PyTypeObject* specification_base_class; + PyTypeObject* object_specification_descriptor_class; + PyTypeObject* class_provides_base_class; + PyTypeObject* interface_base_class; + PyTypeObject* lookup_base_class; + PyTypeObject* verifying_base_class; + PyObject* adapter_hooks; + /* members imported from 'zope.interface.declarations' + */ + PyObject* empty; + PyObject* fallback; + PyObject* builtin_impl_specs; + PyTypeObject* implements_class; + /* flag: have we imported the next set of members yet from + * 'zope.interface.declarations? + */ + int decl_imported; +} _zic_module_state; + +/* + * Macro to speed lookup of state members + */ +#define _zic_state(o) ((_zic_module_state*)PyModule_GetState(o)) + +static _zic_module_state* +_zic_state_init(PyObject* module) +{ + _zic_module_state* rec = _zic_state(module); + + rec->specification_base_class = NULL; + rec->object_specification_descriptor_class = NULL; + rec->class_provides_base_class = NULL; + rec->interface_base_class = NULL; + rec->lookup_base_class = NULL; + rec->verifying_base_class = NULL; + rec->adapter_hooks = NULL; + + rec->builtin_impl_specs = NULL; + rec->empty = NULL; + rec->fallback = NULL; + rec->implements_class = NULL; + rec->decl_imported = 0; + + return rec; +} + +static int +_zic_state_traverse(PyObject* module, visitproc visit, void* arg) +{ + _zic_module_state* rec = _zic_state(module); + + Py_VISIT(rec->specification_base_class); + Py_VISIT(rec->object_specification_descriptor_class); + Py_VISIT(rec->class_provides_base_class); + Py_VISIT(rec->interface_base_class); + Py_VISIT(rec->lookup_base_class); + Py_VISIT(rec->verifying_base_class); + Py_VISIT(rec->adapter_hooks); + + Py_VISIT(rec->builtin_impl_specs); + Py_VISIT(rec->empty); + Py_VISIT(rec->fallback); + Py_VISIT(rec->implements_class); + + return 0; +} + +static int +_zic_state_clear(PyObject* module) +{ + _zic_module_state* rec = _zic_state(module); + + Py_CLEAR(rec->specification_base_class); + Py_CLEAR(rec->object_specification_descriptor_class); + Py_CLEAR(rec->class_provides_base_class); + Py_CLEAR(rec->interface_base_class); + Py_CLEAR(rec->lookup_base_class); + Py_CLEAR(rec->verifying_base_class); + Py_CLEAR(rec->adapter_hooks); + + Py_CLEAR(rec->builtin_impl_specs); + Py_CLEAR(rec->empty); + Py_CLEAR(rec->fallback); + Py_CLEAR(rec->implements_class); + + return 0; +} + +#if USE_HEAP_TYPES +/* Import zope.interface.declarations and store results in module state. + * + * Dynamic alternative to 'import_declarations' above. + */ +static _zic_module_state* +_zic_state_load_declarations(PyObject* module) +{ + PyObject* declarations; + PyObject* builtin_impl_specs; + PyObject* empty; + PyObject* fallback; + PyObject* implements; + + _zic_module_state* rec = _zic_state(module); + + if (!rec->decl_imported) { + declarations = PyImport_ImportModule("zope.interface.declarations"); + if (declarations == NULL) { + return NULL; + } + + builtin_impl_specs = PyObject_GetAttrString( + declarations, "BuiltinImplementationSpecifications"); + if (builtin_impl_specs == NULL) { + return NULL; + } + + empty = PyObject_GetAttrString(declarations, "_empty"); + if (empty == NULL) { + return NULL; + } + + fallback = + PyObject_GetAttrString(declarations, "implementedByFallback"); + if (fallback == NULL) { + return NULL; + } + + implements = PyObject_GetAttrString(declarations, "Implements"); + if (implements == NULL) { + return NULL; + } + + if (!PyType_Check(implements)) { + PyErr_SetString( + PyExc_TypeError, + "zope.interface.declarations.Implements is not a type"); + return NULL; + } + + Py_DECREF(declarations); + + rec->builtin_impl_specs = builtin_impl_specs; + rec->empty = empty; + rec->fallback = fallback; + rec->implements_class = (PyTypeObject*)implements; + rec->decl_imported = 1; + } + return rec; +} + +#endif + +/* + * Provide access to the current module given the type. + */ + +static struct PyModuleDef _zic_module_def; + +static PyObject* +_get_module(PyTypeObject *typeobj) +{ +#if USE_STATIC_TYPES + return (PyObject*)&_zic_module_def; +#else + if (PyType_Check(typeobj)) { + /* Only added in Python 3.11 */ + return PyType_GetModuleByDef(typeobj, &_zic_module_def); + } + + PyErr_SetString(PyExc_TypeError, "_get_module: called w/ non-type"); + return NULL; +#endif +} + +/* + * Fetch the adapter hooks for the current type's module. + */ +static PyObject* +_get_adapter_hooks(PyTypeObject *typeobj) +{ +#if USE_STATIC_TYPES + return adapter_hooks; +#else + PyObject* module; + _zic_module_state* rec; + + module = _get_module(typeobj); + if (module == NULL) { return NULL; } + + rec = _zic_state(module); + return rec->adapter_hooks; +#endif +} + +/* + * Fetch the 'SpecificationBase' class for the current type's module. + */ +static PyTypeObject* +_get_specification_base_class(PyTypeObject *typeobj) +{ +#if USE_STATIC_TYPES + return &SB_type_def; +#else + PyObject* module; + _zic_module_state* rec; + + module = _get_module(typeobj); + if (module == NULL) { return NULL; } + + rec = _zic_state(module); + return rec->specification_base_class; +#endif +} + +/* + * Fetch the 'InterfaceBase' class for the current type's module. + */ +static PyTypeObject* +_get_interface_base_class(PyTypeObject *typeobj) +{ +#if USE_STATIC_TYPES + return &IB_type_def; +#else + PyObject* module; + _zic_module_state* rec; + + module = _get_module(typeobj); + if (module == NULL) { return NULL; } + + rec = _zic_state(module); + return rec->interface_base_class; +#endif +} + +static PyObject* +implementedByFallback(PyObject* module, PyObject* cls) +{ +#if USE_STATIC_TYPES + if (imported_declarations == 0 && import_declarations() < 0) { + return NULL; + } + /* now use static 'fallback' */ +#else + PyObject* fallback; + + _zic_module_state* rec = _zic_state_load_declarations(module); + if (rec == NULL) { return NULL; } + + fallback = rec->fallback; +#endif + + return PyObject_CallFunctionObjArgs(fallback, cls, NULL); +} + +static char implementedBy___doc__[] = + ("Interfaces implemented by a class or factory.\n" + "Raises TypeError if argument is neither a class nor a callable."); + +static PyObject* +implementedBy(PyObject* module, PyObject* cls) +{ + /* Fast retrieval of implements spec, if possible, to optimize + common case. Use fallback code if we get stuck. + */ + PyObject *dict = NULL; + PyObject *spec; + PyTypeObject *implements_class; + PyObject *builtin_impl_specs; + +#if USE_STATIC_TYPES + if (imported_declarations == 0 && import_declarations() < 0) { + return NULL; + } + + implements_class = Implements; + builtin_impl_specs = BuiltinImplementationSpecifications; +#else + _zic_module_state* rec = _zic_state_load_declarations(module); + if (rec == NULL) { return NULL; } + + implements_class = rec->implements_class; + builtin_impl_specs = rec->builtin_impl_specs; +#endif + + if (PyObject_TypeCheck(cls, &PySuper_Type)) { + // Let merging be handled by Python. + return implementedByFallback(module, cls); + } + + if (PyType_Check(cls)) { + dict = TYPE(cls)->tp_dict; + Py_XINCREF(dict); + } + + if (dict == NULL) + dict = PyObject_GetAttr(cls, str__dict__); + + if (dict == NULL) { + /* Probably a security proxied class, use more expensive fallback code + */ + PyErr_Clear(); + return implementedByFallback(module, cls); + } + + spec = PyObject_GetItem(dict, str__implemented__); + Py_DECREF(dict); + if (spec) { + + if (PyObject_TypeCheck(spec, implements_class)) + return spec; + + /* Old-style declaration, use more expensive fallback code */ + Py_DECREF(spec); + return implementedByFallback(module, cls); + } + + PyErr_Clear(); + + /* Maybe we have a builtin */ + spec = PyDict_GetItem(builtin_impl_specs, cls); + if (spec != NULL) { + Py_INCREF(spec); + return spec; + } + + /* We're stuck, use fallback */ + return implementedByFallback(module, cls); +} + +static char getObjectSpecification___doc__[] = + ("Get an object's interfaces (internal api)"); + +static PyObject* +getObjectSpecification(PyObject* module, PyObject* ob) +{ + PyObject *cls; + PyObject *result; + PyTypeObject *specification_base_class; + PyObject *empty_; + +#if USE_STATIC_TYPES + specification_base_class = &SB_type_def; + + if (imported_declarations == 0 && import_declarations() < 0) { + return NULL; + } + empty_ = empty; /* global from import */ + +#else + _zic_module_state* rec = _zic_state_load_declarations(module); + if (rec == NULL) { return NULL; } + + specification_base_class = rec->specification_base_class; + empty_ = rec->empty; +#endif + + result = PyObject_GetAttr(ob, str__provides__); + if (!result) { + if (!PyErr_ExceptionMatches(PyExc_AttributeError)) { + /* Propagate non AttributeError exceptions. */ + return NULL; + } + PyErr_Clear(); + } else { + int is_instance = -1; + is_instance = + PyObject_IsInstance(result, OBJECT(specification_base_class)); + if (is_instance < 0) { + /* Propagate all errors */ + return NULL; + } + if (is_instance) { + return result; + } + } + + /* We do a getattr here so as not to be defeated by proxies */ + cls = PyObject_GetAttr(ob, str__class__); + if (cls == NULL) { + if (!PyErr_ExceptionMatches(PyExc_AttributeError)) { + /* Propagate non-AttributeErrors */ + return NULL; + } + PyErr_Clear(); + + Py_INCREF(empty_); + return empty_; + } + result = implementedBy(module, cls); + Py_DECREF(cls); + + return result; +} + +static char providedBy___doc__[] = ("Get an object's interfaces"); + +static PyObject* +providedBy(PyObject* module, PyObject* ob) +{ + PyObject *result = NULL; + PyObject *cls; + PyObject *cp; + PyTypeObject *specification_base_class; + int is_instance = -1; + + is_instance = PyObject_IsInstance(ob, (PyObject*)&PySuper_Type); + if (is_instance < 0) { + if (!PyErr_ExceptionMatches(PyExc_AttributeError)) { + /* Propagate non-AttributeErrors */ + return NULL; + } + PyErr_Clear(); + } + if (is_instance) { + return implementedBy(module, ob); + } + + result = PyObject_GetAttr(ob, str__providedBy__); + + if (result == NULL) { + if (!PyErr_ExceptionMatches(PyExc_AttributeError)) { + return NULL; + } + + PyErr_Clear(); + return getObjectSpecification(module, ob); + } + + /* We want to make sure we have a spec. We can't do a type check + because we may have a proxy, so we'll just try to get the + only attribute. + */ +#if USE_STATIC_TYPES + specification_base_class = &SB_type_def; +#else + _zic_module_state* rec = _zic_state(module); + specification_base_class = rec->specification_base_class; +#endif + if (PyObject_TypeCheck(result, specification_base_class) || + PyObject_HasAttrString(result, "extends")) + return result; + + /* + The object's class doesn't understand descriptors. + Sigh. We need to get an object descriptor, but we have to be + careful. We want to use the instance's __provides__,l if + there is one, but only if it didn't come from the class. + */ + Py_DECREF(result); + + cls = PyObject_GetAttr(ob, str__class__); + if (cls == NULL) + return NULL; + + result = PyObject_GetAttr(ob, str__provides__); + if (result == NULL) { + /* No __provides__, so just fall back to implementedBy */ + PyErr_Clear(); + result = implementedBy(module, cls); + Py_DECREF(cls); + return result; + } + + cp = PyObject_GetAttr(cls, str__provides__); + if (cp == NULL) { + /* The the class has no provides, assume we're done: */ + PyErr_Clear(); + Py_DECREF(cls); + return result; + } + + if (cp == result) { + /* + Oops, we got the provides from the class. This means + the object doesn't have it's own. We should use implementedBy + */ + Py_DECREF(result); + result = implementedBy(module, cls); + } + + Py_DECREF(cls); + Py_DECREF(cp); + + return result; +} + +static struct PyMethodDef _zic_module_methods[] = { + { "implementedBy", + (PyCFunction)implementedBy, + METH_O, + implementedBy___doc__ }, + { "getObjectSpecification", + (PyCFunction)getObjectSpecification, + METH_O, + getObjectSpecification___doc__ }, + { "providedBy", (PyCFunction)providedBy, METH_O, providedBy___doc__ }, + + { NULL, (PyCFunction)NULL, 0, NULL } /* sentinel */ +}; + + +/* Handler for the 'execute' phase of multi-phase initialization + * + * See: https://docs.python.org/3/c-api/module.html#multi-phase-initialization + * and: https://peps.python.org/pep-0489/#module-execution-phase + */ +static int +_zic_module_exec(PyObject* module) +{ + _zic_module_state* rec = _zic_state_init(module); + + rec->adapter_hooks = PyList_New(0); + if (rec->adapter_hooks == NULL) + return -1; + Py_INCREF(rec->adapter_hooks); + +#if USE_STATIC_TYPES + + /* Initialize static global */ + adapter_hooks = rec->adapter_hooks; + + /* Initialize types: */ + SB_type_def.tp_new = PyBaseObject_Type.tp_new; + if (PyType_Ready(&SB_type_def) < 0) { return -1; } + Py_INCREF(&SB_type_def); + rec->specification_base_class = &SB_type_def; + + OSD_type_def.tp_new = PyBaseObject_Type.tp_new; + if (PyType_Ready(&OSD_type_def) < 0) { return -1; } + Py_INCREF(&OSD_type_def); + rec->object_specification_descriptor_class = &OSD_type_def; + + CPB_type_def.tp_new = PyBaseObject_Type.tp_new; + if (PyType_Ready(&CPB_type_def) < 0) { return -1; } + Py_INCREF(&CPB_type_def); + rec->class_provides_base_class = &CPB_type_def; + + IB_type_def.tp_new = PyBaseObject_Type.tp_new; + if (PyType_Ready(&IB_type_def) < 0) { return -1; } + Py_INCREF(&IB_type_def); + rec->interface_base_class = &IB_type_def; + + LB_type_def.tp_new = PyBaseObject_Type.tp_new; + if (PyType_Ready(&LB_type_def) < 0) { return -1; } + Py_INCREF(&LB_type_def); + rec->lookup_base_class = &LB_type_def; + + VB_type_def.tp_new = PyBaseObject_Type.tp_new; + if (PyType_Ready(&VB_type_def) < 0) { return -1; } + Py_INCREF(&VB_type_def); + rec->verifying_base_class = &VB_type_def; + +#else + + PyObject *sb_class; + PyObject *osd_class; + PyObject *cpb_class; + PyObject *ib_class; + PyObject *lb_class; + PyObject *vb_class; + + /* Initialize types: + */ + sb_class = PyType_FromModuleAndSpec(module, &SB_type_spec, NULL); + if (sb_class == NULL) { return -1; } + Py_INCREF(sb_class); + rec->specification_base_class = TYPE(sb_class); + + osd_class = PyType_FromModuleAndSpec(module, &OSD_type_spec, NULL); + if (osd_class == NULL) { return -1; } + Py_INCREF(osd_class); + rec->object_specification_descriptor_class = TYPE(osd_class); + + cpb_class = PyType_FromModuleAndSpec(module, &CPB_type_spec, sb_class); + if (cpb_class == NULL) { return -1; } + Py_INCREF(cpb_class); + rec->class_provides_base_class = TYPE(cpb_class); + + ib_class = PyType_FromModuleAndSpec(module, &IB_type_spec, sb_class); + if (ib_class == NULL) { return -1; } + Py_INCREF(ib_class); + rec->interface_base_class = TYPE(ib_class); + + lb_class = PyType_FromModuleAndSpec(module, &LB_type_spec, NULL); + if (lb_class == NULL) { return -1; } + Py_INCREF(lb_class); + rec->lookup_base_class = TYPE(lb_class); + + vb_class = PyType_FromModuleAndSpec(module, &VB_type_spec, lb_class); + if (vb_class == NULL) { return -1; } + Py_INCREF(vb_class); + rec->verifying_base_class = TYPE(vb_class); + +#endif + + /* Add types to our dict FBO python; also the adapter hooks */ + if (PyModule_AddObject(module, + "SpecificationBase", OBJECT(rec->specification_base_class)) < 0) + return -1; + + if (PyModule_AddObject(module, + "ObjectSpecificationDescriptor", + OBJECT(rec->object_specification_descriptor_class)) < + 0) + return -1; + + if (PyModule_AddObject(module, + "ClassProvidesBase", OBJECT(rec->class_provides_base_class)) < 0) + return -1; + + if (PyModule_AddObject(module, + "InterfaceBase", OBJECT(rec->interface_base_class)) < 0) + return -1; + + if (PyModule_AddObject(module, + "LookupBase", OBJECT(rec->lookup_base_class)) < 0) + return -1; + + if (PyModule_AddObject(module, + "VerifyingBase", OBJECT(rec->verifying_base_class)) < 0) + return -1; + + if (PyModule_AddObject(module, "adapter_hooks", rec->adapter_hooks) < 0) + return -1; + + return 0; +} + + +/* Slot definitions for multi-phase initialization + * + * See: https://docs.python.org/3/c-api/module.html#multi-phase-initialization + * and: https://peps.python.org/pep-0489 + */ +static PyModuleDef_Slot _zic_module_slots[] = { + {Py_mod_exec, _zic_module_exec}, + {0, NULL} +}; + +static char _zic_module__doc__[] = "C optimizations for zope.interface\n\n"; + +static struct PyModuleDef _zic_module_def = { + PyModuleDef_HEAD_INIT, + .m_name = "_zope_interface_coptimizations", + .m_doc = _zic_module__doc__, + .m_size = sizeof(_zic_module_state), + .m_methods = _zic_module_methods, + .m_slots=_zic_module_slots, + .m_traverse = _zic_state_traverse, + .m_clear = _zic_state_clear, +}; + +static PyObject* +init(void) +{ + if (define_static_strings() < 0) { return NULL; } + + return PyModuleDef_Init(&_zic_module_def); +} + +PyMODINIT_FUNC +PyInit__zope_interface_coptimizations(void) +{ + return init(); +} + +#ifdef __clang__ +#pragma clang diagnostic pop +#endif diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope/interface/adapter.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope/interface/adapter.py new file mode 100644 index 0000000000000000000000000000000000000000..a35c3f90c1a6c4827c5330ec5db96263df6582dd --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope/interface/adapter.py @@ -0,0 +1,1048 @@ +############################################################################## +# +# Copyright (c) 2004 Zope Foundation and Contributors. +# All Rights Reserved. +# +# This software is subject to the provisions of the Zope Public License, +# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. +# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED +# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS +# FOR A PARTICULAR PURPOSE. +# +############################################################################## +"""Adapter management +""" +import itertools +import weakref + +from zope.interface import Interface +from zope.interface import implementer +from zope.interface import providedBy +from zope.interface import ro +from zope.interface._compat import _normalize_name +from zope.interface._compat import _use_c_impl +from zope.interface.interfaces import IAdapterRegistry + + +__all__ = [ + 'AdapterRegistry', + 'VerifyingAdapterRegistry', +] + +# In the CPython implementation, +# ``tuple`` and ``list`` cooperate so that ``tuple([some list])`` +# directly allocates and iterates at the C level without using a +# Python iterator. That's not the case for +# ``tuple(generator_expression)`` or ``tuple(map(func, it))``. +## +# 3.8 +# ``tuple([t for t in range(10)])`` -> 610ns +# ``tuple(t for t in range(10))`` -> 696ns +# ``tuple(map(lambda t: t, range(10)))`` -> 881ns +## +# 2.7 +# ``tuple([t fon t in range(10)])`` -> 625ns +# ``tuple(t for t in range(10))`` -> 665ns +# ``tuple(map(lambda t: t, range(10)))`` -> 958ns +# +# All three have substantial variance. +## +# On PyPy, this is also the best option. +## +# PyPy 2.7.18-7.3.3 +# ``tuple([t fon t in range(10)])`` -> 128ns +# ``tuple(t for t in range(10))`` -> 175ns +# ``tuple(map(lambda t: t, range(10)))`` -> 153ns +## +# PyPy 3.7.9 7.3.3-beta +# ``tuple([t fon t in range(10)])`` -> 82ns +# ``tuple(t for t in range(10))`` -> 177ns +# ``tuple(map(lambda t: t, range(10)))`` -> 168ns + + +class BaseAdapterRegistry: + """ + A basic implementation of the data storage and algorithms required + for a :class:`zope.interface.interfaces.IAdapterRegistry`. + + Subclasses can set the following attributes to control how the data + is stored; in particular, these hooks can be helpful for ZODB + persistence. They can be class attributes that are the named + (or similar) type, or they can be methods that act as a constructor + for an object that behaves like the types defined here; this object + will not assume that they are type objects, but subclasses are free + to do so: + + _sequenceType = list + This is the type used for our two mutable top-level "byorder" sequences. + Must support mutation operations like ``append()`` and ``del + seq[index]``. These are usually small (< 10). Although at least one of + them is accessed when performing lookups or queries on this object, the + other is untouched. In many common scenarios, both are only required + when mutating registrations and subscriptions (like what + :meth:`zope.interface.interfaces.IComponents.registerUtility` does). + This use pattern makes it an ideal candidate to be a + :class:`~persistent.list.PersistentList`. + + _leafSequenceType = tuple + This is the type used for the leaf sequences of subscribers. + It could be set to a ``PersistentList`` to avoid many unnecessary data + loads when subscribers aren't being used. Mutation operations are + directed through :meth:`_addValueToLeaf` and + :meth:`_removeValueFromLeaf`; if you use a mutable type, you'll need to + override those. + + _mappingType = dict + This is the mutable mapping type used for the keyed mappings. A + :class:`~persistent.mapping.PersistentMapping` could be used to help + reduce the number of data loads when the registry is large and parts of + it are rarely used. Further reductions in data loads can come from using + a :class:`~BTrees.OOBTree.OOBTree`, but care is required to be sure that + all required/provided values are fully ordered (e.g., no required or + provided values that are classes can be used). + + _providedType = dict + This is the mutable mapping type used for the ``_provided`` mapping. + This is separate from the generic mapping type because the values + are always integers, so one might choose to use a more optimized data + structure such as a :class:`~BTrees.OIBTree.OIBTree`. + The same caveats regarding key types + apply as for ``_mappingType``. + + It is possible to also set these on an instance, but because of the need + to potentially also override :meth:`_addValueToLeaf` and + :meth:`_removeValueFromLeaf`, this may be less useful in a persistent + scenario; using a subclass is recommended. + + .. versionchanged:: 5.3.0 + Add support for customizing the way internal data + structures are created. + .. versionchanged:: 5.3.0 + Add methods :meth:`rebuild`, :meth:`allRegistrations` + and :meth:`allSubscriptions`. + """ + + # List of methods copied from lookup sub-objects: + _delegated = ('lookup', 'queryMultiAdapter', 'lookup1', 'queryAdapter', + 'adapter_hook', 'lookupAll', 'names', + 'subscriptions', 'subscribers') + + # All registries maintain a generation that can be used by verifying + # registries + _generation = 0 + + def __init__(self, bases=()): + + # The comments here could be improved. Possibly this bit needs + # explaining in a separate document, as the comments here can + # be quite confusing. /regebro + + # {order -> {required -> {provided -> {name -> value}}}} + # Here "order" is actually an index in a list, "required" and + # "provided" are interfaces, and "required" is really a nested + # key. So, for example: + # for order == 0 (that is, self._adapters[0]), we have: + # {provided -> {name -> value}} + # but for order == 2 (that is, self._adapters[2]), we have: + # {r1 -> {r2 -> {provided -> {name -> value}}}} + # + self._adapters = self._sequenceType() + + # {order -> {required -> {provided -> {name -> [value]}}}} + # where the remarks about adapters above apply + self._subscribers = self._sequenceType() + + # Set, with a reference count, keeping track of the interfaces + # for which we have provided components: + self._provided = self._providedType() + + # Create ``_v_lookup`` object to perform lookup. We make this a + # separate object to to make it easier to implement just the + # lookup functionality in C. This object keeps track of cache + # invalidation data in two kinds of registries. + + # Invalidating registries have caches that are invalidated + # when they or their base registies change. An invalidating + # registry can only have invalidating registries as bases. + # See LookupBaseFallback below for the pertinent logic. + + # Verifying registies can't rely on getting invalidation messages, + # so have to check the generations of base registries to determine + # if their cache data are current. See VerifyingBasePy below + # for the pertinent object. + self._createLookup() + + # Setting the bases causes the registries described above + # to be initialized (self._setBases -> self.changed -> + # self._v_lookup.changed). + + self.__bases__ = bases + + def _setBases(self, bases): + """ + If subclasses need to track when ``__bases__`` changes, they + can override this method. + + Subclasses must still call this method. + """ + self.__dict__['__bases__'] = bases + self.ro = ro.ro(self) + self.changed(self) + + __bases__ = property(lambda self: self.__dict__['__bases__'], + lambda self, bases: self._setBases(bases), + ) + + def _createLookup(self): + self._v_lookup = self.LookupClass(self) + for name in self._delegated: + self.__dict__[name] = getattr(self._v_lookup, name) + + # Hooks for subclasses to define the types of objects used in + # our data structures. + # These have to be documented in the docstring, instead of local + # comments, because Sphinx autodoc ignores the comment and just writes + # "alias of list" + _sequenceType = list + _leafSequenceType = tuple + _mappingType = dict + _providedType = dict + + def _addValueToLeaf(self, existing_leaf_sequence, new_item): + """ + Add the value *new_item* to the *existing_leaf_sequence*, which may + be ``None``. + + Subclasses that redefine `_leafSequenceType` should override this + method. + + :param existing_leaf_sequence: + If *existing_leaf_sequence* is not *None*, it will be an instance + of `_leafSequenceType`. (Unless the object has been unpickled from + an old pickle and the class definition has changed, in which case + it may be an instance of a previous definition, commonly a + `tuple`.) + + :return: + This method returns the new value to be stored. It may mutate the + sequence in place if it was not ``None`` and the type is mutable, + but it must also return it. + + .. versionadded:: 5.3.0 + """ + if existing_leaf_sequence is None: + return (new_item,) + return existing_leaf_sequence + (new_item,) + + def _removeValueFromLeaf(self, existing_leaf_sequence, to_remove): + """ + Remove the item *to_remove* from the (non-``None``, non-empty) + *existing_leaf_sequence* and return the mutated sequence. + + If there is more than one item that is equal to *to_remove* + they must all be removed. + + Subclasses that redefine `_leafSequenceType` should override + this method. Note that they can call this method to help + in their implementation; this implementation will always + return a new tuple constructed by iterating across + the *existing_leaf_sequence* and omitting items equal to *to_remove*. + + :param existing_leaf_sequence: + As for `_addValueToLeaf`, probably an instance of + `_leafSequenceType` but possibly an older type; never `None`. + :return: + A version of *existing_leaf_sequence* with all items equal to + *to_remove* removed. Must not return `None`. However, + returning an empty + object, even of another type such as the empty tuple, ``()`` is + explicitly allowed; such an object will never be stored. + + .. versionadded:: 5.3.0 + """ + return tuple([v for v in existing_leaf_sequence if v != to_remove]) + + def changed(self, originally_changed): + self._generation += 1 + self._v_lookup.changed(originally_changed) + + def register(self, required, provided, name, value): + if not isinstance(name, str): + raise ValueError('name is not a string') + if value is None: + self.unregister(required, provided, name, value) + return + + required = tuple([_convert_None_to_Interface(r) for r in required]) + name = _normalize_name(name) + order = len(required) + byorder = self._adapters + while len(byorder) <= order: + byorder.append(self._mappingType()) + components = byorder[order] + key = required + (provided,) + + for k in key: + d = components.get(k) + if d is None: + d = self._mappingType() + components[k] = d + components = d + + if components.get(name) is value: + return + + components[name] = value + + n = self._provided.get(provided, 0) + 1 + self._provided[provided] = n + if n == 1: + self._v_lookup.add_extendor(provided) + + self.changed(self) + + def _find_leaf(self, byorder, required, provided, name): + # Find the leaf value, if any, in the *byorder* list + # for the interface sequence *required* and the interface + # *provided*, given the already normalized *name*. + # + # If no such leaf value exists, returns ``None`` + required = tuple([_convert_None_to_Interface(r) for r in required]) + order = len(required) + if len(byorder) <= order: + return None + + components = byorder[order] + key = required + (provided,) + + for k in key: + d = components.get(k) + if d is None: + return None + components = d + + return components.get(name) + + def registered(self, required, provided, name=''): + return self._find_leaf( + self._adapters, + required, + provided, + _normalize_name(name) + ) + + @classmethod + def _allKeys(cls, components, i, parent_k=()): + if i == 0: + for k, v in components.items(): + yield parent_k + (k,), v + else: + for k, v in components.items(): + new_parent_k = parent_k + (k,) + yield from cls._allKeys(v, i - 1, new_parent_k) + + def _all_entries(self, byorder): + # Recurse through the mapping levels of the `byorder` sequence, + # reconstructing a flattened sequence of ``(required, provided, name, + # value)`` tuples that can be used to reconstruct the sequence with + # the appropriate registration methods. + # + # Locally reference the `byorder` data; it might be replaced while + # this method is running (see ``rebuild``). + for i, components in enumerate(byorder): + # We will have *i* levels of dictionaries to go before + # we get to the leaf. + for key, value in self._allKeys(components, i + 1): + assert len(key) == i + 2 + required = key[:i] + provided = key[-2] + name = key[-1] + yield (required, provided, name, value) + + def allRegistrations(self): + """ + Yields tuples ``(required, provided, name, value)`` for all + the registrations that this object holds. + + These tuples could be passed as the arguments to the + :meth:`register` method on another adapter registry to + duplicate the registrations this object holds. + + .. versionadded:: 5.3.0 + """ + yield from self._all_entries(self._adapters) + + def unregister(self, required, provided, name, value=None): + required = tuple([_convert_None_to_Interface(r) for r in required]) + order = len(required) + byorder = self._adapters + if order >= len(byorder): + return False + components = byorder[order] + key = required + (provided,) + + # Keep track of how we got to `components`: + lookups = [] + for k in key: + d = components.get(k) + if d is None: + return + lookups.append((components, k)) + components = d + + old = components.get(name) + if old is None: + return + if (value is not None) and (old is not value): + return + + del components[name] + if not components: + # Clean out empty containers, since we don't want our keys + # to reference global objects (interfaces) unnecessarily. + # This is often a problem when an interface is slated for + # removal; a hold-over entry in the registry can make it + # difficult to remove such interfaces. + for comp, k in reversed(lookups): + d = comp[k] + if d: + break + else: + del comp[k] + while byorder and not byorder[-1]: + del byorder[-1] + n = self._provided[provided] - 1 + if n == 0: + del self._provided[provided] + self._v_lookup.remove_extendor(provided) + else: + self._provided[provided] = n + + self.changed(self) + + def subscribe(self, required, provided, value): + required = tuple([_convert_None_to_Interface(r) for r in required]) + name = '' + order = len(required) + byorder = self._subscribers + while len(byorder) <= order: + byorder.append(self._mappingType()) + components = byorder[order] + key = required + (provided,) + + for k in key: + d = components.get(k) + if d is None: + d = self._mappingType() + components[k] = d + components = d + + components[name] = self._addValueToLeaf(components.get(name), value) + + if provided is not None: + n = self._provided.get(provided, 0) + 1 + self._provided[provided] = n + if n == 1: + self._v_lookup.add_extendor(provided) + + self.changed(self) + + def subscribed(self, required, provided, subscriber): + subscribers = self._find_leaf( + self._subscribers, + required, + provided, + '' + ) or () + return subscriber if subscriber in subscribers else None + + def allSubscriptions(self): + """ + Yields tuples ``(required, provided, value)`` for all the + subscribers that this object holds. + + These tuples could be passed as the arguments to the + :meth:`subscribe` method on another adapter registry to + duplicate the registrations this object holds. + + .. versionadded:: 5.3.0 + """ + for required, provided, _name, value in self._all_entries( + self._subscribers, + ): + for v in value: + yield (required, provided, v) + + def unsubscribe(self, required, provided, value=None): + required = tuple([_convert_None_to_Interface(r) for r in required]) + order = len(required) + byorder = self._subscribers + if order >= len(byorder): + return + components = byorder[order] + key = required + (provided,) + + # Keep track of how we got to `components`: + lookups = [] + for k in key: + d = components.get(k) + if d is None: + return + lookups.append((components, k)) + components = d + + old = components.get('') + if not old: + # this is belt-and-suspenders against the failure of cleanup below + return # pragma: no cover + len_old = len(old) + if value is None: + # Removing everything; note that the type of ``new`` won't + # necessarily match the ``_leafSequenceType``, but that's + # OK because we're about to delete the entire entry + # anyway. + new = () + else: + new = self._removeValueFromLeaf(old, value) + # ``new`` may be the same object as ``old``, just mutated in place, + # so we cannot compare it to ``old`` to check for changes. Remove + # our reference to it now to avoid trying to do so below. + del old + + if len(new) == len_old: + # No changes, so nothing could have been removed. + return + + if new: + components[''] = new + else: + # Instead of setting components[u''] = new, we clean out + # empty containers, since we don't want our keys to + # reference global objects (interfaces) unnecessarily. This + # is often a problem when an interface is slated for + # removal; a hold-over entry in the registry can make it + # difficult to remove such interfaces. + del components[''] + for comp, k in reversed(lookups): + d = comp[k] + if d: + break + else: + del comp[k] + while byorder and not byorder[-1]: + del byorder[-1] + + if provided is not None: + n = self._provided[provided] + len(new) - len_old + if n == 0: + del self._provided[provided] + self._v_lookup.remove_extendor(provided) + else: + self._provided[provided] = n + + self.changed(self) + + def rebuild(self): + """ + Rebuild (and replace) all the internal data structures of this + object. + + This is useful, especially for persistent implementations, if + you suspect an issue with reference counts keeping interfaces + alive even though they are no longer used. + + It is also useful if you or a subclass change the data types + (``_mappingType`` and friends) that are to be used. + + This method replaces all internal data structures with new objects; + it specifically does not re-use any storage. + + .. versionadded:: 5.3.0 + """ + + # Grab the iterators, we're about to discard their data. + registrations = self.allRegistrations() + subscriptions = self.allSubscriptions() + + def buffer(it): + # The generator doesn't actually start running until we + # ask for its next(), by which time the attributes will change + # unless we do so before calling __init__. + try: + first = next(it) + except StopIteration: + return iter(()) + + return itertools.chain((first,), it) + + registrations = buffer(registrations) + subscriptions = buffer(subscriptions) + + # Replace the base data structures as well as _v_lookup. + self.__init__(self.__bases__) + # Re-register everything previously registered and subscribed. + # + # XXX: This is going to call ``self.changed()`` a lot, all of + # which is unnecessary (because ``self.__init__`` just + # re-created those dependent objects and also called + # ``self.changed()``). Is this a bottleneck that needs fixed? + # (We could do ``self.changed = lambda _: None`` before + # beginning and remove it after to disable the presumably expensive + # part of passing that notification to the change of objects.) + for args in registrations: + self.register(*args) + + for args in subscriptions: + self.subscribe(*args) + + # XXX hack to fake out twisted's use of a private api. + # We need to get them to use the new registered method. + def get(self, _): # pragma: no cover + class XXXTwistedFakeOut: + selfImplied = {} + return XXXTwistedFakeOut + + +_not_in_mapping = object() + + +@_use_c_impl +class LookupBase: + + def __init__(self): + self._cache = {} + self._mcache = {} + self._scache = {} + + def changed(self, ignored=None): + self._cache.clear() + self._mcache.clear() + self._scache.clear() + + def _getcache(self, provided, name): + cache = self._cache.get(provided) + if cache is None: + cache = {} + self._cache[provided] = cache + if name: + c = cache.get(name) + if c is None: + c = {} + cache[name] = c + cache = c + return cache + + def lookup(self, required, provided, name='', default=None): + if not isinstance(name, str): + raise ValueError('name is not a string') + cache = self._getcache(provided, name) + required = tuple(required) + if len(required) == 1: + result = cache.get(required[0], _not_in_mapping) + else: + result = cache.get(tuple(required), _not_in_mapping) + + if result is _not_in_mapping: + result = self._uncached_lookup(required, provided, name) + if len(required) == 1: + cache[required[0]] = result + else: + cache[tuple(required)] = result + + if result is None: + return default + + return result + + def lookup1(self, required, provided, name='', default=None): + if not isinstance(name, str): + raise ValueError('name is not a string') + cache = self._getcache(provided, name) + result = cache.get(required, _not_in_mapping) + if result is _not_in_mapping: + return self.lookup((required, ), provided, name, default) + + if result is None: + return default + + return result + + def queryAdapter(self, object, provided, name='', default=None): + return self.adapter_hook(provided, object, name, default) + + def adapter_hook(self, provided, object, name='', default=None): + if not isinstance(name, str): + raise ValueError('name is not a string') + required = providedBy(object) + cache = self._getcache(provided, name) + factory = cache.get(required, _not_in_mapping) + if factory is _not_in_mapping: + factory = self.lookup((required, ), provided, name) + + if factory is not None: + if isinstance(object, super): + object = object.__self__ + result = factory(object) + if result is not None: + return result + + return default + + def lookupAll(self, required, provided): + cache = self._mcache.get(provided) + if cache is None: + cache = {} + self._mcache[provided] = cache + + required = tuple(required) + result = cache.get(required, _not_in_mapping) + if result is _not_in_mapping: + result = self._uncached_lookupAll(required, provided) + cache[required] = result + + return result + + def subscriptions(self, required, provided): + cache = self._scache.get(provided) + if cache is None: + cache = {} + self._scache[provided] = cache + + required = tuple(required) + result = cache.get(required, _not_in_mapping) + if result is _not_in_mapping: + result = self._uncached_subscriptions(required, provided) + cache[required] = result + + return result + + +@_use_c_impl +class VerifyingBase(LookupBaseFallback): # noqa F821 + # Mixin for lookups against registries which "chain" upwards, and + # whose lookups invalidate their own caches whenever a parent registry + # bumps its own '_generation' counter. E.g., used by + # zope.component.persistentregistry + + def changed(self, originally_changed): + LookupBaseFallback.changed(self, originally_changed) # noqa F821 + self._verify_ro = self._registry.ro[1:] + self._verify_generations = [r._generation for r in self._verify_ro] + + def _verify(self): + if ( + [ + r._generation for r in self._verify_ro + ] != self._verify_generations + ): + self.changed(None) + + def _getcache(self, provided, name): + self._verify() + return LookupBaseFallback._getcache( # noqa F821 + self, provided, name, + ) + + def lookupAll(self, required, provided): + self._verify() + return LookupBaseFallback.lookupAll( # noqa F821 + self, required, provided, + ) + + def subscriptions(self, required, provided): + self._verify() + return LookupBaseFallback.subscriptions( # noqa F821 + self, required, provided, + ) + + +class AdapterLookupBase: + + def __init__(self, registry): + self._registry = registry + self._required = {} + self.init_extendors() + super().__init__() + + def changed(self, ignored=None): + super().changed(None) + for r in self._required.keys(): + r = r() + if r is not None: + r.unsubscribe(self) + self._required.clear() + + # Extendors + # --------- + + # When given an target interface for an adapter lookup, we need to consider + # adapters for interfaces that extend the target interface. This is + # what the extendors dictionary is about. It tells us all of the + # interfaces that extend an interface for which there are adapters + # registered. + + # We could separate this by order and name, thus reducing the + # number of provided interfaces to search at run time. The tradeoff, + # however, is that we have to store more information. For example, + # if the same interface is provided for multiple names and if the + # interface extends many interfaces, we'll have to keep track of + # a fair bit of information for each name. It's better to + # be space efficient here and be time efficient in the cache + # implementation. + + # TODO: add invalidation when a provided interface changes, in case + # the interface's __iro__ has changed. This is unlikely enough that + # we'll take our chances for now. + + def init_extendors(self): # noqa E301 + self._extendors = {} + for p in self._registry._provided: + self.add_extendor(p) + + def add_extendor(self, provided): + _extendors = self._extendors + for i in provided.__iro__: + extendors = _extendors.get(i, ()) + _extendors[i] = ( + [ + e for e in extendors if provided.isOrExtends(e) + ] + [ + provided + ] + [ + e for e in extendors if not provided.isOrExtends(e) + ] + ) + + def remove_extendor(self, provided): + _extendors = self._extendors + for i in provided.__iro__: + _extendors[i] = [e for e in _extendors.get(i, ()) + if e != provided] + + def _subscribe(self, *required): + _refs = self._required + for r in required: + ref = r.weakref() + if ref not in _refs: + r.subscribe(self) + _refs[ref] = 1 + + def _uncached_lookup(self, required, provided, name=''): + required = tuple(required) + result = None + order = len(required) + for registry in self._registry.ro: + byorder = registry._adapters + if order >= len(byorder): + continue + + extendors = registry._v_lookup._extendors.get(provided) + if not extendors: + continue + + components = byorder[order] + result = _lookup(components, required, extendors, name, 0, + order) + if result is not None: + break + + self._subscribe(*required) + + return result + + def queryMultiAdapter(self, objects, provided, name='', default=None): + factory = self.lookup([providedBy(o) for o in objects], provided, name) + if factory is None: + return default + + result = factory(*[ + o.__self__ if isinstance(o, super) else o for o in objects + ]) + if result is None: + return default + + return result + + def _uncached_lookupAll(self, required, provided): + required = tuple(required) + order = len(required) + result = {} + for registry in reversed(self._registry.ro): + byorder = registry._adapters + if order >= len(byorder): + continue + extendors = registry._v_lookup._extendors.get(provided) + if not extendors: + continue + components = byorder[order] + _lookupAll(components, required, extendors, result, 0, order) + + self._subscribe(*required) + + return tuple(result.items()) + + def names(self, required, provided): + return [c[0] for c in self.lookupAll(required, provided)] + + def _uncached_subscriptions(self, required, provided): + required = tuple(required) + order = len(required) + result = [] + for registry in reversed(self._registry.ro): + byorder = registry._subscribers + if order >= len(byorder): + continue + + if provided is None: + extendors = (provided, ) + else: + extendors = registry._v_lookup._extendors.get(provided) + if extendors is None: + continue + + _subscriptions(byorder[order], required, extendors, '', + result, 0, order) + + self._subscribe(*required) + + return result + + def subscribers(self, objects, provided): + subscriptions = self.subscriptions( + [providedBy(o) for o in objects], provided + ) + if provided is None: + result = () + for subscription in subscriptions: + subscription(*objects) + else: + result = [] + for subscription in subscriptions: + subscriber = subscription(*objects) + if subscriber is not None: + result.append(subscriber) + return result + + +class AdapterLookup(AdapterLookupBase, LookupBase): + pass + + +@implementer(IAdapterRegistry) +class AdapterRegistry(BaseAdapterRegistry): + """ + A full implementation of ``IAdapterRegistry`` that adds support for + sub-registries. + """ + + LookupClass = AdapterLookup + + def __init__(self, bases=()): + # AdapterRegisties are invalidating registries, so + # we need to keep track of our invalidating subregistries. + self._v_subregistries = weakref.WeakKeyDictionary() + + super().__init__(bases) + + def _addSubregistry(self, r): + self._v_subregistries[r] = 1 + + def _removeSubregistry(self, r): + if r in self._v_subregistries: + del self._v_subregistries[r] + + def _setBases(self, bases): + old = self.__dict__.get('__bases__', ()) + for r in old: + if r not in bases: + r._removeSubregistry(self) + for r in bases: + if r not in old: + r._addSubregistry(self) + + super()._setBases(bases) + + def changed(self, originally_changed): + super().changed(originally_changed) + + for sub in self._v_subregistries.keys(): + sub.changed(originally_changed) + + +class VerifyingAdapterLookup(AdapterLookupBase, VerifyingBase): + pass + + +@implementer(IAdapterRegistry) +class VerifyingAdapterRegistry(BaseAdapterRegistry): + """ + The most commonly-used adapter registry. + """ + + LookupClass = VerifyingAdapterLookup + + +def _convert_None_to_Interface(x): + if x is None: + return Interface + else: + return x + + +def _lookup(components, specs, provided, name, i, l): # noqa: E741 + # this function is called very often. + # The components.get in loops is executed 100 of 1000s times. + # by loading get into a local variable the bytecode + # "LOAD_FAST 0 (components)" in the loop can be eliminated. + components_get = components.get + if i < l: + for spec in specs[i].__sro__: + comps = components_get(spec) + if comps: + r = _lookup(comps, specs, provided, name, i + 1, l) + if r is not None: + return r + else: + for iface in provided: + comps = components_get(iface) + if comps: + r = comps.get(name) + if r is not None: + return r + + return None + + +def _lookupAll(components, specs, provided, result, i, l): # noqa: E741 + components_get = components.get # see _lookup above + if i < l: + for spec in reversed(specs[i].__sro__): + comps = components_get(spec) + if comps: + _lookupAll(comps, specs, provided, result, i + 1, l) + else: + for iface in reversed(provided): + comps = components_get(iface) + if comps: + result.update(comps) + + +def _subscriptions( + components, specs, provided, name, result, i, l # noqa: E741 +): + components_get = components.get # see _lookup above + if i < l: + for spec in reversed(specs[i].__sro__): + comps = components_get(spec) + if comps: + _subscriptions( + comps, specs, provided, name, result, i + 1, l + ) + else: + for iface in reversed(provided): + comps = components_get(iface) + if comps: + comps = comps.get(name) + if comps: + result.extend(comps) diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope/interface/advice.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope/interface/advice.py new file mode 100644 index 0000000000000000000000000000000000000000..f577d42ab803646f7b9cedd34914619f7dd8033e --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope/interface/advice.py @@ -0,0 +1,121 @@ +############################################################################## +# +# Copyright (c) 2003 Zope Foundation and Contributors. +# All Rights Reserved. +# +# This software is subject to the provisions of the Zope Public License, +# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. +# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED +# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS +# FOR A PARTICULAR PURPOSE. +# +############################################################################## +"""Class advice. + +This module was adapted from 'protocols.advice', part of the Python +Enterprise Application Kit (PEAK). Please notify the PEAK authors +(pje@telecommunity.com and tsarna@sarna.org) if bugs are found or +Zope-specific changes are required, so that the PEAK version of this module +can be kept in sync. + +PEAK is a Python application framework that interoperates with (but does +not require) Zope 3 and Twisted. It provides tools for manipulating UML +models, object-relational persistence, aspect-oriented programming, and more. +Visit the PEAK home page at http://peak.telecommunity.com for more information. +""" + +from types import FunctionType + + +__all__ = [ + 'determineMetaclass', + 'getFrameInfo', + 'isClassAdvisor', + 'minimalBases', +] + +import sys + + +def getFrameInfo(frame): + """Return (kind,module,locals,globals) for a frame + + 'kind' is one of "exec", "module", "class", "function call", or "unknown". + """ + + f_locals = frame.f_locals + f_globals = frame.f_globals + + sameNamespace = f_locals is f_globals + hasModule = '__module__' in f_locals + hasName = '__name__' in f_globals + + sameName = hasModule and hasName + sameName = sameName and f_globals['__name__'] == f_locals['__module__'] + + module = hasName and sys.modules.get(f_globals['__name__']) or None + + namespaceIsModule = module and module.__dict__ is f_globals + + if not namespaceIsModule: + # some kind of funky exec + kind = "exec" + elif sameNamespace and not hasModule: + kind = "module" + elif sameName and not sameNamespace: + kind = "class" + elif not sameNamespace: + kind = "function call" + else: # pragma: no cover + # How can you have f_locals is f_globals, and have '__module__' + # set? # This is probably module-level code, but with a + # '__module__' variable. + kind = "unknown" + return kind, module, f_locals, f_globals + + +def isClassAdvisor(ob): + """True if 'ob' is a class advisor function""" + return isinstance(ob, FunctionType) and hasattr(ob, 'previousMetaclass') + + +def determineMetaclass(bases, explicit_mc=None): + """Determine metaclass from 1+ bases and optional explicit __metaclass__""" + + meta = [getattr(b, '__class__', type(b)) for b in bases] + + if explicit_mc is not None: + # The explicit metaclass needs to be verified for compatibility + # as well, and allowed to resolve the incompatible bases, if any + meta.append(explicit_mc) + + if len(meta) == 1: + # easy case + return meta[0] + + candidates = minimalBases(meta) # minimal set of metaclasses + + if len(candidates) > 1: + # We could auto-combine, but for now we won't... + raise TypeError("Incompatible metatypes", bases) + + # Just one, return it + return candidates[0] + + +def minimalBases(classes): + """Reduce a list of base classes to its ordered minimum equivalent""" + candidates = [] + + for m in classes: + for n in classes: + if issubclass(n, m) and m is not n: + break + else: + # m has no subclasses in 'classes' + if m in candidates: + candidates.remove(m) # ensure that we're later in the list + candidates.append(m) + + return candidates diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope/interface/common/__init__.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope/interface/common/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..256ddc9178dff56a2c4dbca5dc638ed56ccc4f65 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope/interface/common/__init__.py @@ -0,0 +1,291 @@ +############################################################################## +# Copyright (c) 2020 Zope Foundation and Contributors. +# All Rights Reserved. +# +# This software is subject to the provisions of the Zope Public License, +# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. +# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED +# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS +# FOR A PARTICULAR PURPOSE. +############################################################################## + +import itertools +from types import FunctionType + +from zope.interface import Interface +from zope.interface import classImplements +from zope.interface.interface import InterfaceClass +from zope.interface.interface import _decorator_non_return +from zope.interface.interface import fromFunction + + +__all__ = [ + # Nothing public here. +] + +# pylint:disable=inherit-non-class, +# pylint:disable=no-self-argument,no-method-argument +# pylint:disable=unexpected-special-method-signature + + +class optional: + # Apply this decorator to a method definition to make it + # optional (remove it from the list of required names), overriding + # the definition inherited from the ABC. + def __init__(self, method): + self.__doc__ = method.__doc__ + + +class ABCInterfaceClass(InterfaceClass): + """ + An interface that is automatically derived from a + :class:`abc.ABCMeta` type. + + Internal use only. + + The body of the interface definition *must* define + a property ``abc`` that is the ABC to base the interface on. + + If ``abc`` is *not* in the interface definition, a regular + interface will be defined instead (but ``extra_classes`` is still + respected). + + Use the ``@optional`` decorator on method definitions if + the ABC defines methods that are not actually required in all cases + because the Python language has multiple ways to implement a protocol. + For example, the ``iter()`` protocol can be implemented with + ``__iter__`` or the pair ``__len__`` and ``__getitem__``. + + When created, any existing classes that are registered to conform + to the ABC are declared to implement this interface. This is *not* + automatically updated as the ABC registry changes. If the body of the + interface definition defines ``extra_classes``, it should be a + tuple giving additional classes to declare implement the interface. + + Note that this is not fully symmetric. For example, it is usually + the case that a subclass relationship carries the interface + declarations over:: + + >>> from zope.interface import Interface + >>> class I1(Interface): + ... pass + ... + >>> from zope.interface import implementer + >>> @implementer(I1) + ... class Root(object): + ... pass + ... + >>> class Child(Root): + ... pass + ... + >>> child = Child() + >>> isinstance(child, Root) + True + >>> from zope.interface import providedBy + >>> list(providedBy(child)) + [] + + However, that's not the case with ABCs and ABC interfaces. Just + because ``isinstance(A(), AnABC)`` and ``isinstance(B(), AnABC)`` + are both true, that doesn't mean there's any class hierarchy + relationship between ``A`` and ``B``, or between either of them + and ``AnABC``. Thus, if ``AnABC`` implemented ``IAnABC``, it would + not follow that either ``A`` or ``B`` implements ``IAnABC`` (nor + their instances provide it):: + + >>> class SizedClass(object): + ... def __len__(self): return 1 + ... + >>> from collections.abc import Sized + >>> isinstance(SizedClass(), Sized) + True + >>> from zope.interface import classImplements + >>> classImplements(Sized, I1) + None + >>> list(providedBy(SizedClass())) + [] + + Thus, to avoid conflicting assumptions, ABCs should not be + declared to implement their parallel ABC interface. Only concrete + classes specifically registered with the ABC should be declared to + do so. + + .. versionadded:: 5.0.0 + """ + + # If we could figure out invalidation, and used some special + # Specification/Declaration instances, and override the method + # ``providedBy`` here, perhaps we could more closely integrate with ABC + # virtual inheritance? + + def __init__(self, name, bases, attrs): + # go ahead and give us a name to ease debugging. + self.__name__ = name + extra_classes = attrs.pop('extra_classes', ()) + ignored_classes = attrs.pop('ignored_classes', ()) + + if 'abc' not in attrs: + # Something like ``IList(ISequence)``: We're extending + # abc interfaces but not an ABC interface ourself. + InterfaceClass.__init__(self, name, bases, attrs) + ABCInterfaceClass.__register_classes( + self, extra_classes, ignored_classes, + ) + self.__class__ = InterfaceClass + return + + based_on = attrs.pop('abc') + self.__abc = based_on + self.__extra_classes = tuple(extra_classes) + self.__ignored_classes = tuple(ignored_classes) + + assert name[1:] == based_on.__name__, (name, based_on) + methods = { + # Passing the name is important in case of aliases, + # e.g., ``__ror__ = __or__``. + k: self.__method_from_function(v, k) + for k, v in vars(based_on).items() + if isinstance(v, FunctionType) and + not self.__is_private_name(k) and + not self.__is_reverse_protocol_name(k) + } + + methods['__doc__'] = self.__create_class_doc(attrs) + # Anything specified in the body takes precedence. + methods.update(attrs) + InterfaceClass.__init__(self, name, bases, methods) + self.__register_classes() + + @staticmethod + def __optional_methods_to_docs(attrs): + optionals = {k: v for k, v in attrs.items() if isinstance(v, optional)} + for k in optionals: + attrs[k] = _decorator_non_return + + if not optionals: + return '' + + docs = "\n\nThe following methods are optional:\n - " + "\n-".join( + f"{k}\n{v.__doc__}" for k, v in optionals.items() + ) + return docs + + def __create_class_doc(self, attrs): + based_on = self.__abc + + def ref(c): + mod = c.__module__ + name = c.__name__ + if mod == str.__module__: + return "`%s`" % name + if mod == '_io': + mod = 'io' + return f"`{mod}.{name}`" + + implementations_doc = "\n - ".join( + ref(c) + for c in sorted(self.getRegisteredConformers(), key=ref) + ) + if implementations_doc: + implementations_doc = ( + "\n\nKnown implementations are:\n\n - " + implementations_doc + ) + + based_on_doc = (based_on.__doc__ or '') + based_on_doc = based_on_doc.splitlines() + based_on_doc = based_on_doc[0] if based_on_doc else '' + + doc = """Interface for the ABC `{}.{}`.\n\n{}{}{}""".format( + based_on.__module__, based_on.__name__, + attrs.get('__doc__', based_on_doc), + self.__optional_methods_to_docs(attrs), + implementations_doc + ) + return doc + + @staticmethod + def __is_private_name(name): + if name.startswith('__') and name.endswith('__'): + return False + return name.startswith('_') + + @staticmethod + def __is_reverse_protocol_name(name): + # The reverse names, like __rand__, + # aren't really part of the protocol. The interpreter has + # very complex behaviour around invoking those. PyPy + # doesn't always even expose them as attributes. + return name.startswith('__r') and name.endswith('__') + + def __method_from_function(self, function, name): + method = fromFunction(function, self, name=name) + # Eliminate the leading *self*, which is implied in + # an interface, but explicit in an ABC. + method.positional = method.positional[1:] + return method + + def __register_classes(self, conformers=None, ignored_classes=None): + # Make the concrete classes already present in our ABC's registry + # declare that they implement this interface. + conformers = ( + conformers if conformers is not None + else self.getRegisteredConformers() + ) + ignored = ( + ignored_classes if ignored_classes is not None + else self.__ignored_classes + ) + for cls in conformers: + if cls in ignored: + continue + classImplements(cls, self) + + def getABC(self): + """ + Return the ABC this interface represents. + """ + return self.__abc + + def getRegisteredConformers(self): + """ + Return an iterable of the classes that are known to conform to + the ABC this interface parallels. + """ + based_on = self.__abc + + # The registry only contains things that aren't already + # known to be subclasses of the ABC. But the ABC is in charge + # of checking that, so its quite possible that registrations + # are in fact ignored, winding up just in the _abc_cache. + try: + registered = ( + list(based_on._abc_registry) + list(based_on._abc_cache) + ) + except AttributeError: + # Rewritten in C in CPython 3.7. + # These expose the underlying weakref. + from abc import _get_dump + data = _get_dump(based_on) + registry = data[0] + cache = data[1] + registered = [x() for x in itertools.chain(registry, cache)] + registered = [x for x in registered if x is not None] + + return set(itertools.chain(registered, self.__extra_classes)) + + +def _create_ABCInterface(): + # It's a two-step process to create the root ABCInterface, because without + # specifying a corresponding ABC, using the normal constructor gets us a + # plain InterfaceClass object, and there is no ABC to associate with the + # root. + abc_name_bases_attrs = ('ABCInterface', (Interface,), {}) + instance = ABCInterfaceClass.__new__( + ABCInterfaceClass, *abc_name_bases_attrs, + ) + InterfaceClass.__init__(instance, *abc_name_bases_attrs) + return instance + + +ABCInterface = _create_ABCInterface() diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope/interface/common/builtins.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope/interface/common/builtins.py new file mode 100644 index 0000000000000000000000000000000000000000..9e543c83f5bdf0832196d7b512c81c0fb60d0ca4 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope/interface/common/builtins.py @@ -0,0 +1,124 @@ +############################################################################## +# Copyright (c) 2020 Zope Foundation and Contributors. +# All Rights Reserved. +# +# This software is subject to the provisions of the Zope Public License, +# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. +# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED +# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS +# FOR A PARTICULAR PURPOSE. +############################################################################## +""" +Interface definitions for builtin types. + +After this module is imported, the standard library types will declare +that they implement the appropriate interface. + +.. versionadded:: 5.0.0 +""" + +from zope.interface import classImplements +from zope.interface._compat import PY313_OR_OLDER +from zope.interface.common import collections +from zope.interface.common import io +from zope.interface.common import numbers + + +__all__ = [ + 'IList', + 'ITuple', + 'ITextString', + 'IByteString', + 'INativeString', + 'IBool', + 'IDict', + 'IFile', +] + + +# pylint:disable=no-self-argument +class IList(collections.IMutableSequence): + """ + Interface for :class:`list` + """ + extra_classes = (list,) + + def sort(key=None, reverse=False): + """ + Sort the list in place and return None. + + *key* and *reverse* must be passed by name only. + """ + + +class ITuple(collections.ISequence): + """ + Interface for :class:`tuple` + """ + extra_classes = (tuple,) + + +class ITextString(collections.ISequence): + """ + Interface for text ("unicode") strings. + + This is :class:`str` + """ + extra_classes = (str,) + + +if PY313_OR_OLDER: + class IByteString(collections.IByteString): + """ + Interface for immutable byte strings. + + On all Python versions this is :class:`bytes`. + + Unlike :class:`zope.interface.common.collections.IByteString` + (the parent of this interface) this does *not* include + :class:`bytearray`. + """ + extra_classes = (bytes,) + + +class INativeString(ITextString): + """ + Interface for native strings. + + On all Python versions, this is :class:`str`. Tt extends + :class:`ITextString`. + """ + + +# We're not extending ABCInterface so extra_classes won't work +classImplements(str, INativeString) + + +class IBool(numbers.IIntegral): + """ + Interface for :class:`bool` + """ + extra_classes = (bool,) + + +class IDict(collections.IMutableMapping): + """ + Interface for :class:`dict` + """ + extra_classes = (dict,) + + +class IFile(io.IIOBase): + """ + Interface for :class:`file`. + + It is recommended to use the interfaces from + :mod:`zope.interface.common.io` instead of this interface. + + On Python 3, there is no single implementation of this interface; + depending on the arguments, the :func:`open` builtin can return + many different classes that implement different interfaces from + :mod:`zope.interface.common.io`. + """ + extra_classes = () diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope/interface/common/collections.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope/interface/common/collections.py new file mode 100644 index 0000000000000000000000000000000000000000..defa8a15b949d10b2d691feb7f268889d3b2fb12 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope/interface/common/collections.py @@ -0,0 +1,269 @@ +############################################################################## +# Copyright (c) 2020 Zope Foundation and Contributors. +# All Rights Reserved. +# +# This software is subject to the provisions of the Zope Public License, +# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. +# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED +# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS +# FOR A PARTICULAR PURPOSE. +############################################################################## +""" +Interface definitions paralleling the abstract base classes defined in +:mod:`collections.abc`. + +After this module is imported, the standard library types will declare that +they implement the appropriate interface. While most standard library types +will properly implement that interface (that is, ``verifyObject(ISequence, +list()))`` will pass, for example), a few might not: + + - `memoryview` doesn't feature all the defined methods of + ``ISequence`` such as ``count``; it is still declared to provide + ``ISequence`` though. + + - `collections.deque.pop` doesn't accept the ``index`` argument of + `collections.abc.MutableSequence.pop` + + - `range.index` does not accept the ``start`` and ``stop`` arguments. + +.. versionadded:: 5.0.0 +""" + +import sys +from abc import ABCMeta +from collections import OrderedDict +from collections import UserDict +from collections import UserList +from collections import UserString +from collections import abc + +from zope.interface._compat import PY313_OR_OLDER +from zope.interface.common import ABCInterface +from zope.interface.common import optional + + +# pylint:disable=inherit-non-class, +# pylint:disable=no-self-argument,no-method-argument +# pylint:disable=unexpected-special-method-signature +# pylint:disable=no-value-for-parameter + + +def _new_in_ver(name, ver, + bases_if_missing=(ABCMeta,), + register_if_missing=()): + if ver: + return getattr(abc, name) + + # TODO: It's a shame to have to repeat the bases when + # the ABC is missing. Can we DRY that? + missing = ABCMeta(name, bases_if_missing, { + '__doc__': "The ABC %s is not defined in this version of Python." % ( + name + ), + }) + + for c in register_if_missing: + missing.register(c) + + return missing + + +__all__ = [ + 'IAsyncGenerator', + 'IAsyncIterable', + 'IAsyncIterator', + 'IAwaitable', + 'ICollection', + 'IContainer', + 'ICoroutine', + 'IGenerator', + 'IHashable', + 'IItemsView', + 'IIterable', + 'IIterator', + 'IKeysView', + 'IMapping', + 'IMappingView', + 'IMutableMapping', + 'IMutableSequence', + 'IMutableSet', + 'IReversible', + 'ISequence', + 'ISet', + 'ISized', + 'IValuesView', +] + + +class IContainer(ABCInterface): + abc = abc.Container + + @optional + def __contains__(other): + """ + Optional method. If not provided, the interpreter will use + ``__iter__`` or the old ``__getitem__`` protocol + to implement ``in``. + """ + + +class IHashable(ABCInterface): + abc = abc.Hashable + + +class IIterable(ABCInterface): + abc = abc.Iterable + + @optional + def __iter__(): + """ + Optional method. If not provided, the interpreter will + implement `iter` using the old ``__getitem__`` protocol. + """ + + +class IIterator(IIterable): + abc = abc.Iterator + + +class IReversible(IIterable): + abc = _new_in_ver('Reversible', True, (IIterable.getABC(),)) + + @optional + def __reversed__(): + """ + Optional method. If this isn't present, the interpreter + will use ``__len__`` and ``__getitem__`` to implement the + `reversed` builtin. + """ + + +class IGenerator(IIterator): + # New in Python 3.5 + abc = _new_in_ver('Generator', True, (IIterator.getABC(),)) + + +class ISized(ABCInterface): + abc = abc.Sized + + +# ICallable is not defined because there's no standard signature. + + +class ICollection(ISized, + IIterable, + IContainer): + abc = _new_in_ver( + 'Collection', + True, + (ISized.getABC(), IIterable.getABC(), IContainer.getABC()) + ) + + +class ISequence(IReversible, + ICollection): + abc = abc.Sequence + extra_classes = (UserString,) + # On Python 2, basestring was registered as an ISequence, and + # its subclass str is an IByteString. If we also register str as + # an ISequence, that tends to lead to inconsistent resolution order. + ignored_classes = () + + @optional + def __reversed__(): + """ + Optional method. If this isn't present, the interpreter + will use ``__len__`` and ``__getitem__`` to implement the + `reversed` builtin. + """ + + @optional + def __iter__(): + """ + Optional method. If not provided, the interpreter will + implement `iter` using the old ``__getitem__`` protocol. + """ + + +class IMutableSequence(ISequence): + abc = abc.MutableSequence + extra_classes = (UserList,) + + +if PY313_OR_OLDER: + class IByteString(ISequence): + """ + This unifies `bytes` and `bytearray`. + """ + abc = _new_in_ver( + 'ByteString', True, (ISequence.getABC(),), (bytes, bytearray), + ) + + +class ISet(ICollection): + abc = abc.Set + + +class IMutableSet(ISet): + abc = abc.MutableSet + + +class IMapping(ICollection): + abc = abc.Mapping + extra_classes = (dict,) + # OrderedDict is a subclass of dict. On CPython 2, + # it winds up registered as a IMutableMapping, which + # produces an inconsistent IRO if we also try to register it + # here. + ignored_classes = (OrderedDict,) + + +class IMutableMapping(IMapping): + abc = abc.MutableMapping + extra_classes = (dict, UserDict,) + ignored_classes = (OrderedDict,) + + +class IMappingView(ISized): + abc = abc.MappingView + + +class IItemsView(IMappingView, ISet): + abc = abc.ItemsView + + +class IKeysView(IMappingView, ISet): + abc = abc.KeysView + + +class IValuesView(IMappingView, ICollection): + abc = abc.ValuesView + + @optional + def __contains__(other): + """ + Optional method. If not provided, the interpreter will use + ``__iter__`` or the old ``__len__`` and ``__getitem__`` protocol + to implement ``in``. + """ + + +class IAwaitable(ABCInterface): + abc = _new_in_ver('Awaitable', True) + + +class ICoroutine(IAwaitable): + abc = _new_in_ver('Coroutine', True) + + +class IAsyncIterable(ABCInterface): + abc = _new_in_ver('AsyncIterable', True) + + +class IAsyncIterator(IAsyncIterable): + abc = _new_in_ver('AsyncIterator', True) + + +class IAsyncGenerator(IAsyncIterator): + abc = _new_in_ver('AsyncGenerator', True) diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope/interface/common/idatetime.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope/interface/common/idatetime.py new file mode 100644 index 0000000000000000000000000000000000000000..24b2606e80ddc75b3b06b50eed4a2b54b957efd4 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope/interface/common/idatetime.py @@ -0,0 +1,622 @@ +############################################################################## +# Copyright (c) 2002 Zope Foundation and Contributors. +# All Rights Reserved. +# +# This software is subject to the provisions of the Zope Public License, +# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. +# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED +# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS +# FOR A PARTICULAR PURPOSE. +############################################################################## +"""Datetime interfaces. + +This module is called idatetime because if it were called datetime the import +of the real datetime would fail. +""" +from datetime import date +from datetime import datetime +from datetime import time +from datetime import timedelta +from datetime import tzinfo + +from zope.interface import Attribute +from zope.interface import Interface +from zope.interface import classImplements + + +class ITimeDeltaClass(Interface): + """This is the timedelta class interface. + + This is symbolic; this module does **not** make + `datetime.timedelta` provide this interface. + """ + + min = Attribute("The most negative timedelta object") + + max = Attribute("The most positive timedelta object") + + resolution = Attribute( + "The smallest difference between non-equal timedelta objects") + + +class ITimeDelta(ITimeDeltaClass): + """Represent the difference between two datetime objects. + + Implemented by `datetime.timedelta`. + + Supported operators: + + - add, subtract timedelta + - unary plus, minus, abs + - compare to timedelta + - multiply, divide by int/long + + In addition, `.datetime` supports subtraction of two `.datetime` objects + returning a `.timedelta`, and addition or subtraction of a `.datetime` + and a `.timedelta` giving a `.datetime`. + + Representation: (days, seconds, microseconds). + """ + + days = Attribute("Days between -999999999 and 999999999 inclusive") + + seconds = Attribute("Seconds between 0 and 86399 inclusive") + + microseconds = Attribute("Microseconds between 0 and 999999 inclusive") + + +class IDateClass(Interface): + """This is the date class interface. + + This is symbolic; this module does **not** make + `datetime.date` provide this interface. + """ + + min = Attribute("The earliest representable date") + + max = Attribute("The latest representable date") + + resolution = Attribute( + "The smallest difference between non-equal date objects") + + def today(): + """Return the current local time. + + This is equivalent to ``date.fromtimestamp(time.time())``""" + + def fromtimestamp(timestamp): + """Return the local date from a POSIX timestamp (like time.time()) + + This may raise `ValueError`, if the timestamp is out of the range of + values supported by the platform C ``localtime()`` function. It's + common for this to be restricted to years from 1970 through 2038. Note + that on non-POSIX systems that include leap seconds in their notion of + a timestamp, leap seconds are ignored by `fromtimestamp`. + """ + + def fromordinal(ordinal): + """Return the date corresponding to the proleptic Gregorian ordinal. + + January 1 of year 1 has ordinal 1. `ValueError` is raised unless + 1 <= ordinal <= date.max.toordinal(). + + For any date *d*, ``date.fromordinal(d.toordinal()) == d``. + """ + + +class IDate(IDateClass): + """Represents a date (year, month and day) in an idealized calendar. + + Implemented by `datetime.date`. + + Operators: + + __repr__, __str__ + __cmp__, __hash__ + __add__, __radd__, __sub__ (add/radd only with timedelta arg) + """ + + year = Attribute("Between MINYEAR and MAXYEAR inclusive.") + + month = Attribute("Between 1 and 12 inclusive") + + day = Attribute( + "Between 1 and the number of days " + "in the given month of the given year." + ) + + def replace(year, month, day): + """Return a date with the same value. + + Except for those members given new values by whichever keyword + arguments are specified. + + For example, if ``d == date(2002, 12, 31)``, then + ``d.replace(day=26) == date(2000, 12, 26)``. + """ + + def timetuple(): + """Return a 9-element tuple of the form returned by `time.localtime`. + + The hours, minutes and seconds are 0, and the DST flag is -1. + ``d.timetuple()`` is equivalent to + ``(d.year, d.month, d.day, 0, 0, 0, d.weekday(), d.toordinal() - + date(d.year, 1, 1).toordinal() + 1, -1)`` + """ + + def toordinal(): + """Return the proleptic Gregorian ordinal of the date + + January 1 of year 1 has ordinal 1. For any date object *d*, + ``date.fromordinal(d.toordinal()) == d``. + """ + + def weekday(): + """Return the day of the week as an integer. + + Monday is 0 and Sunday is 6. For example, + ``date(2002, 12, 4).weekday() == 2``, a Wednesday. + + .. seealso:: `isoweekday`. + """ + + def isoweekday(): + """Return the day of the week as an integer. + + Monday is 1 and Sunday is 7. For example, + date(2002, 12, 4).isoweekday() == 3, a Wednesday. + + .. seealso:: `weekday`, `isocalendar`. + """ + + def isocalendar(): + """Return a 3-tuple, (ISO year, ISO week number, ISO weekday). + + The ISO calendar is a widely used variant of the Gregorian calendar. + See http://www.phys.uu.nl/~vgent/calendar/isocalendar.htm for a good + explanation. + + The ISO year consists of 52 or 53 full weeks, and where a week starts + on a Monday and ends on a Sunday. The first week of an ISO year is the + first (Gregorian) calendar week of a year containing a Thursday. This + is called week number 1, and the ISO year of that Thursday is the same + as its Gregorian year. + + For example, 2004 begins on a Thursday, so the first week of ISO year + 2004 begins on Monday, 29 Dec 2003 and ends on Sunday, 4 Jan 2004, so + that ``date(2003, 12, 29).isocalendar() == (2004, 1, 1)`` and + ``date(2004, 1, 4).isocalendar() == (2004, 1, 7)``. + """ + + def isoformat(): + """Return a string representing the date in ISO 8601 format. + + This is 'YYYY-MM-DD'. + For example, ``date(2002, 12, 4).isoformat() == '2002-12-04'``. + """ + + def __str__(): + """For a date *d*, ``str(d)`` is equivalent to ``d.isoformat()``.""" + + def ctime(): + """Return a string representing the date. + + For example date(2002, 12, 4).ctime() == 'Wed Dec 4 00:00:00 2002'. + d.ctime() is equivalent to time.ctime(time.mktime(d.timetuple())) + on platforms where the native C ctime() function + (which `time.ctime` invokes, but which date.ctime() does not invoke) + conforms to the C standard. + """ + + def strftime(format): + """Return a string representing the date. + + Controlled by an explicit format string. Format codes referring to + hours, minutes or seconds will see 0 values. + """ + + +class IDateTimeClass(Interface): + """This is the datetime class interface. + + This is symbolic; this module does **not** make + `datetime.datetime` provide this interface. + """ + + min = Attribute("The earliest representable datetime") + + max = Attribute("The latest representable datetime") + + resolution = Attribute( + "The smallest possible difference between non-equal datetime objects") + + def today(): + """Return the current local datetime, with tzinfo None. + + This is equivalent to ``datetime.fromtimestamp(time.time())``. + + .. seealso:: `now`, `fromtimestamp`. + """ + + def now(tz=None): + """Return the current local date and time. + + If optional argument *tz* is None or not specified, this is like + `today`, but, if possible, supplies more precision than can be gotten + from going through a `time.time` timestamp (for example, this may be + possible on platforms supplying the C ``gettimeofday()`` function). + + Else tz must be an instance of a class tzinfo subclass, and the current + date and time are converted to tz's time zone. In this case the result + is equivalent to tz.fromutc(datetime.utcnow().replace(tzinfo=tz)). + + .. seealso:: `today`, `utcnow`. + """ + + def utcnow(): + """Return the current UTC date and time, with tzinfo None. + + This is like `now`, but returns the current UTC date and time, as a + naive datetime object. + + .. seealso:: `now`. + """ + + def fromtimestamp(timestamp, tz=None): + """Return the local date and time corresponding to the POSIX timestamp. + + Same as is returned by time.time(). If optional argument tz is None or + not specified, the timestamp is converted to the platform's local date + and time, and the returned datetime object is naive. + + Else tz must be an instance of a class tzinfo subclass, and the + timestamp is converted to tz's time zone. In this case the result is + equivalent to + ``tz.fromutc(datetime.utcfromtimestamp(timestamp).replace(tzinfo=tz))`` + + fromtimestamp() may raise `ValueError`, if the timestamp is out of the + range of values supported by the platform C localtime() or gmtime() + functions. It's common for this to be restricted to years in 1970 + through 2038. Note that on non-POSIX systems that include leap seconds + in their notion of a timestamp, leap seconds are ignored by + fromtimestamp(), and then it's possible to have two timestamps + differing by a second that yield identical datetime objects. + + .. seealso:: `utcfromtimestamp`. + """ + + def utcfromtimestamp(timestamp): + """Return the UTC datetime from the POSIX timestamp with tzinfo None. + + This may raise `ValueError`, if the timestamp is out of the range of + values supported by the platform C ``gmtime()`` function. It's common + for this to be restricted to years in 1970 through 2038. + + .. seealso:: `fromtimestamp`. + """ + + def fromordinal(ordinal): + """Return the datetime from the proleptic Gregorian ordinal. + + January 1 of year 1 has ordinal 1. `ValueError` is raised unless + 1 <= ordinal <= datetime.max.toordinal(). + The hour, minute, second and microsecond of the result are all 0, and + tzinfo is None. + """ + + def combine(date, time): + """Return a new datetime object. + + Its date members are equal to the given date object's, and whose time + and tzinfo members are equal to the given time object's. For any + datetime object *d*, ``d == datetime.combine(d.date(), d.timetz())``. + If date is a datetime object, its time and tzinfo members are ignored. + """ + + +class IDateTime(IDate, IDateTimeClass): + """Contains all the information from a date object and a time object. + + Implemented by `datetime.datetime`. + """ + + year = Attribute("Year between MINYEAR and MAXYEAR inclusive") + + month = Attribute("Month between 1 and 12 inclusive") + + day = Attribute( + "Day between 1 and the number of days in the given month of the year") + + hour = Attribute("Hour in range(24)") + + minute = Attribute("Minute in range(60)") + + second = Attribute("Second in range(60)") + + microsecond = Attribute("Microsecond in range(1000000)") + + tzinfo = Attribute( + """The object passed as the tzinfo argument to the datetime constructor + or None if none was passed""") + + def date(): + """Return date object with same year, month and day.""" + + def time(): + """Return time object with same hour, minute, second, microsecond. + + tzinfo is None. + + .. seealso:: Method :meth:`timetz`. + """ + + def timetz(): + """Return time object with same hour, minute, second, microsecond, + and tzinfo. + + .. seealso:: Method :meth:`time`. + """ + + def replace(year, month, day, hour, minute, second, microsecond, tzinfo): + """Return a datetime with the same members, except for those members + given new values by whichever keyword arguments are specified. + + Note that ``tzinfo=None`` can be specified to create a naive datetime + from an aware datetime with no conversion of date and time members. + """ + + def astimezone(tz): + """Return a datetime object with new tzinfo member tz, adjusting the + date and time members so the result is the same UTC time as self, but + in tz's local time. + + tz must be an instance of a tzinfo subclass, and its utcoffset() and + dst() methods must not return None. self must be aware (self.tzinfo + must not be None, and self.utcoffset() must not return None). + + If self.tzinfo is tz, self.astimezone(tz) is equal to self: no + adjustment of date or time members is performed. Else the result is + local time in time zone tz, representing the same UTC time as self: + + after astz = dt.astimezone(tz), astz - astz.utcoffset() + + will usually have the same date and time members as dt - + dt.utcoffset(). The discussion of class `datetime.tzinfo` explains + the cases at Daylight Saving Time transition boundaries where this + cannot be achieved (an issue only if tz models both standard and + daylight time). + + If you merely want to attach a time zone object *tz* to a datetime + *dt* without adjustment of date and time members, use + ``dt.replace(tzinfo=tz)``. + + If you merely want to remove the time zone object from an aware + datetime dt without conversion of date and time members, use + ``dt.replace(tzinfo=None)``. + + Note that the default `tzinfo.fromutc` method can be overridden in a + tzinfo subclass to effect the result returned by `astimezone`. + """ + + def utcoffset(): + """Return the timezone offset in minutes east of UTC (negative west of + UTC).""" + + def dst(): + """Return 0 if DST is not in effect, or the DST offset (in minutes + eastward) if DST is in effect. + """ + + def tzname(): + """Return the timezone name.""" + + def timetuple(): + """Return a 9-tuple of the form returned by `time.localtime`.""" + + def utctimetuple(): + """Return UTC time tuple compatilble with `time.gmtime`.""" + + def toordinal(): + """Return the proleptic Gregorian ordinal of the date. + + The same as self.date().toordinal(). + """ + + def weekday(): + """Return the day of the week as an integer. + + Monday is 0 and Sunday is 6. The same as self.date().weekday(). + See also isoweekday(). + """ + + def isoweekday(): + """Return the day of the week as an integer. + + Monday is 1 and Sunday is 7. The same as self.date().isoweekday. + + .. seealso:: `weekday`, `isocalendar`. + """ + + def isocalendar(): + """Return a 3-tuple, (ISO year, ISO week number, ISO weekday). + + The same as self.date().isocalendar(). + """ + + def isoformat(sep='T'): + """Return a string representing the date and time in ISO 8601 format. + + YYYY-MM-DDTHH:MM:SS.mmmmmm or YYYY-MM-DDTHH:MM:SS if microsecond is 0 + + If `utcoffset` does not return None, a 6-character string is appended, + giving the UTC offset in (signed) hours and minutes: + + YYYY-MM-DDTHH:MM:SS.mmmmmm+HH:MM or YYYY-MM-DDTHH:MM:SS+HH:MM + if microsecond is 0. + + The optional argument sep (default 'T') is a one-character separator, + placed between the date and time portions of the result. + """ + + def __str__(): + """Convert to a stirng + + For a datetime instance *d*, ``str(d)`` is equivalent to + ``d.isoformat(' ')``. + """ + + def ctime(): + """Return a string representing the date and time. + + ``datetime(2002, 12, 4, 20, 30, 40).ctime()`` yields + ``'Wed Dec 4 20:30:40 2002'``. + ``d.ctime()`` is equivalent to + ``time.ctime(time.mktime(d.timetuple()))`` on platforms where the + native C ``ctime()`` function (which `time.ctime` invokes, but which + `datetime.ctime` does not invoke) conforms to the C standard. + """ + + def strftime(format): + """Return a string representing the date and time. + + This is controlled by an explicit format string. + """ + + +class ITimeClass(Interface): + """This is the time class interface. + + This is symbolic; this module does **not** make + `datetime.time` provide this interface. + + """ + + min = Attribute("The earliest representable time") + + max = Attribute("The latest representable time") + + resolution = Attribute( + "The smallest possible difference between non-equal time objects") + + +class ITime(ITimeClass): + """Represent time with time zone. + + Implemented by `datetime.time`. + + Operators: + + __repr__, __str__ + __cmp__, __hash__ + """ + + hour = Attribute("Hour in range(24)") + + minute = Attribute("Minute in range(60)") + + second = Attribute("Second in range(60)") + + microsecond = Attribute("Microsecond in range(1000000)") + + tzinfo = Attribute( + """The object passed as the tzinfo argument to the time constructor + or None if none was passed.""") + + def replace(hour, minute, second, microsecond, tzinfo): + """Return a time with the same value. + + Except for those members given new values by whichever keyword + arguments are specified. Note that tzinfo=None can be specified + to create a naive time from an aware time, without conversion of the + time members. + """ + + def isoformat(): + """Return a string representing the time in ISO 8601 format. + + That is HH:MM:SS.mmmmmm or, if self.microsecond is 0, HH:MM:SS + If utcoffset() does not return None, a 6-character string is appended, + giving the UTC offset in (signed) hours and minutes: + HH:MM:SS.mmmmmm+HH:MM or, if self.microsecond is 0, HH:MM:SS+HH:MM + """ + + def __str__(): + """For a time t, str(t) is equivalent to t.isoformat().""" + + def strftime(format): + """Return a string representing the time. + + This is controlled by an explicit format string. + """ + + def utcoffset(): + """Return the timezone offset in minutes east of UTC (negative west of + UTC). + + If tzinfo is None, returns None, else returns + self.tzinfo.utcoffset(None), and raises an exception if the latter + doesn't return None or a timedelta object representing a whole number + of minutes with magnitude less than one day. + """ + + def dst(): + """Return 0 if DST is not in effect, or the DST offset (in minutes + eastward) if DST is in effect. + + If tzinfo is None, returns None, else returns self.tzinfo.dst(None), + and raises an exception if the latter doesn't return None, or a + timedelta object representing a whole number of minutes with + magnitude less than one day. + """ + + def tzname(): + """Return the timezone name. + + If tzinfo is None, returns None, else returns self.tzinfo.tzname(None), + or raises an exception if the latter doesn't return None or a string + object. + """ + + +class ITZInfo(Interface): + """Time zone info class. + """ + + def utcoffset(dt): + """Return offset of local time from UTC, in minutes east of UTC. + + If local time is west of UTC, this should be negative. + Note that this is intended to be the total offset from UTC; + for example, if a tzinfo object represents both time zone and DST + adjustments, utcoffset() should return their sum. If the UTC offset + isn't known, return None. Else the value returned must be a timedelta + object specifying a whole number of minutes in the range -1439 to 1439 + inclusive (1440 = 24*60; the magnitude of the offset must be less + than one day). + """ + + def dst(dt): + """Return the daylight saving time (DST) adjustment, in minutes east + of UTC, or None if DST information isn't known. + """ + + def tzname(dt): + """Return the time zone name corresponding to the datetime object as + a string. + """ + + def fromutc(dt): + """Return an equivalent datetime in self's local time.""" + + +classImplements(timedelta, ITimeDelta) +classImplements(date, IDate) +classImplements(datetime, IDateTime) +classImplements(time, ITime) +classImplements(tzinfo, ITZInfo) + +# directlyProvides(timedelta, ITimeDeltaClass) +# directlyProvides(date, IDateClass) +# directlyProvides(datetime, IDateTimeClass) +# directlyProvides(time, ITimeClass) diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope/interface/common/interfaces.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope/interface/common/interfaces.py new file mode 100644 index 0000000000000000000000000000000000000000..907579582286b12ddeb2576ea88fd2f424071f76 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope/interface/common/interfaces.py @@ -0,0 +1,281 @@ +############################################################################## +# +# Copyright (c) 2003 Zope Foundation and Contributors. +# All Rights Reserved. +# +# This software is subject to the provisions of the Zope Public License, +# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. +# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED +# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS +# FOR A PARTICULAR PURPOSE. +# +############################################################################## +"""Interfaces for standard python exceptions +""" +from zope.interface import Interface +from zope.interface import classImplements + + +class IException(Interface): + "Interface for `Exception`" + + +classImplements(Exception, IException) # noqa E305 + + +class IStandardError(IException): + "Interface for `StandardError` (no longer existing.)" + + +class IWarning(IException): + "Interface for `Warning`" + + +classImplements(Warning, IWarning) # noqa E305 + + +class ISyntaxError(IStandardError): + "Interface for `SyntaxError`" + + +classImplements(SyntaxError, ISyntaxError) # noqa E305 + + +class ILookupError(IStandardError): + "Interface for `LookupError`" + + +classImplements(LookupError, ILookupError) # noqa E305 + + +class IValueError(IStandardError): + "Interface for `ValueError`" + + +classImplements(ValueError, IValueError) # noqa E305 + + +class IRuntimeError(IStandardError): + "Interface for `RuntimeError`" + + +classImplements(RuntimeError, IRuntimeError) # noqa E305 + + +class IArithmeticError(IStandardError): + "Interface for `ArithmeticError`" + + +classImplements(ArithmeticError, IArithmeticError) # noqa E305 + + +class IAssertionError(IStandardError): + "Interface for `AssertionError`" + + +classImplements(AssertionError, IAssertionError) # noqa E305 + + +class IAttributeError(IStandardError): + "Interface for `AttributeError`" + + +classImplements(AttributeError, IAttributeError) # noqa E305 + + +class IDeprecationWarning(IWarning): + "Interface for `DeprecationWarning`" + + +classImplements(DeprecationWarning, IDeprecationWarning) # noqa E305 + + +class IEOFError(IStandardError): + "Interface for `EOFError`" + + +classImplements(EOFError, IEOFError) # noqa E305 + + +class IEnvironmentError(IStandardError): + "Interface for `EnvironmentError`" + + +classImplements(EnvironmentError, IEnvironmentError) # noqa E305 + + +class IFloatingPointError(IArithmeticError): + "Interface for `FloatingPointError`" + + +classImplements(FloatingPointError, IFloatingPointError) # noqa E305 + + +class IIOError(IEnvironmentError): + "Interface for `IOError`" + + +classImplements(IOError, IIOError) # noqa E305 + + +class IImportError(IStandardError): + "Interface for `ImportError`" + + +classImplements(ImportError, IImportError) # noqa E305 + + +class IIndentationError(ISyntaxError): + "Interface for `IndentationError`" + + +classImplements(IndentationError, IIndentationError) # noqa E305 + + +class IIndexError(ILookupError): + "Interface for `IndexError`" + + +classImplements(IndexError, IIndexError) # noqa E305 + + +class IKeyError(ILookupError): + "Interface for `KeyError`" + + +classImplements(KeyError, IKeyError) # noqa E305 + + +class IKeyboardInterrupt(IStandardError): + "Interface for `KeyboardInterrupt`" + + +classImplements(KeyboardInterrupt, IKeyboardInterrupt) # noqa E305 + + +class IMemoryError(IStandardError): + "Interface for `MemoryError`" + + +classImplements(MemoryError, IMemoryError) # noqa E305 + + +class INameError(IStandardError): + "Interface for `NameError`" + + +classImplements(NameError, INameError) # noqa E305 + + +class INotImplementedError(IRuntimeError): + "Interface for `NotImplementedError`" + + +classImplements(NotImplementedError, INotImplementedError) # noqa E305 + + +class IOSError(IEnvironmentError): + "Interface for `OSError`" + + +classImplements(OSError, IOSError) # noqa E305 + + +class IOverflowError(IArithmeticError): + "Interface for `ArithmeticError`" + + +classImplements(OverflowError, IOverflowError) # noqa E305 + + +class IOverflowWarning(IWarning): + """Deprecated, no standard class implements this. + + This was the interface for ``OverflowWarning`` prior to Python 2.5, + but that class was removed for all versions after that. + """ + + +class IReferenceError(IStandardError): + "Interface for `ReferenceError`" + + +classImplements(ReferenceError, IReferenceError) # noqa E305 + + +class IRuntimeWarning(IWarning): + "Interface for `RuntimeWarning`" + + +classImplements(RuntimeWarning, IRuntimeWarning) # noqa E305 + + +class IStopIteration(IException): + "Interface for `StopIteration`" + + +classImplements(StopIteration, IStopIteration) # noqa E305 + + +class ISyntaxWarning(IWarning): + "Interface for `SyntaxWarning`" + + +classImplements(SyntaxWarning, ISyntaxWarning) # noqa E305 + + +class ISystemError(IStandardError): + "Interface for `SystemError`" + + +classImplements(SystemError, ISystemError) # noqa E305 + + +class ISystemExit(IException): + "Interface for `SystemExit`" + + +classImplements(SystemExit, ISystemExit) # noqa E305 + + +class ITabError(IIndentationError): + "Interface for `TabError`" + + +classImplements(TabError, ITabError) # noqa E305 + + +class ITypeError(IStandardError): + "Interface for `TypeError`" + + +classImplements(TypeError, ITypeError) # noqa E305 + + +class IUnboundLocalError(INameError): + "Interface for `UnboundLocalError`" + + +classImplements(UnboundLocalError, IUnboundLocalError) # noqa E305 + + +class IUnicodeError(IValueError): + "Interface for `UnicodeError`" + + +classImplements(UnicodeError, IUnicodeError) # noqa E305 + + +class IUserWarning(IWarning): + "Interface for `UserWarning`" + + +classImplements(UserWarning, IUserWarning) # noqa E305 + + +class IZeroDivisionError(IArithmeticError): + "Interface for `ZeroDivisionError`" + + +classImplements(ZeroDivisionError, IZeroDivisionError) # noqa E305 diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope/interface/common/io.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope/interface/common/io.py new file mode 100644 index 0000000000000000000000000000000000000000..89f1ba8034c30591552287bc408d584d13971f8d --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope/interface/common/io.py @@ -0,0 +1,44 @@ +############################################################################## +# Copyright (c) 2020 Zope Foundation and Contributors. +# All Rights Reserved. +# +# This software is subject to the provisions of the Zope Public License, +# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. +# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED +# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS +# FOR A PARTICULAR PURPOSE. +############################################################################## +""" +Interface definitions paralleling the abstract base classes defined in +:mod:`io`. + +After this module is imported, the standard library types will declare +that they implement the appropriate interface. + +.. versionadded:: 5.0.0 +""" + +import io as abc + +from zope.interface.common import ABCInterface + + +# pylint:disable=inherit-non-class, +# pylint:disable=no-member + +class IIOBase(ABCInterface): + abc = abc.IOBase + + +class IRawIOBase(IIOBase): + abc = abc.RawIOBase + + +class IBufferedIOBase(IIOBase): + abc = abc.BufferedIOBase + extra_classes = () + + +class ITextIOBase(IIOBase): + abc = abc.TextIOBase diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope/interface/common/mapping.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope/interface/common/mapping.py new file mode 100644 index 0000000000000000000000000000000000000000..d8ea0748268153e912c6441d4a73a7875dcab7c5 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope/interface/common/mapping.py @@ -0,0 +1,177 @@ +############################################################################## +# +# Copyright (c) 2001, 2002 Zope Foundation and Contributors. +# All Rights Reserved. +# +# This software is subject to the provisions of the Zope Public License, +# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. +# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED +# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS +# FOR A PARTICULAR PURPOSE. +# +############################################################################## +""" +Mapping Interfaces. + +Importing this module does *not* mark any standard classes as +implementing any of these interfaces. + +While this module is not deprecated, new code should generally use +:mod:`zope.interface.common.collections`, specifically +:class:`~zope.interface.common.collections.IMapping` and +:class:`~zope.interface.common.collections.IMutableMapping`. This +module is occasionally useful for its extremely fine grained breakdown +of interfaces. + +The standard library :class:`dict` and :class:`collections.UserDict` +implement ``IMutableMapping``, but *do not* implement any of the +interfaces in this module. +""" +from zope.interface import Interface +from zope.interface.common import collections + + +class IItemMapping(Interface): + """Simplest readable mapping object + """ + + def __getitem__(key): + """Get a value for a key + + A `KeyError` is raised if there is no value for the key. + """ + + +class IReadMapping(collections.IContainer, IItemMapping): + """ + Basic mapping interface. + + .. versionchanged:: 5.0.0 + Extend ``IContainer`` + """ + + def get(key, default=None): + """Get a value for a key + + The default is returned if there is no value for the key. + """ + + def __contains__(key): + """Tell if a key exists in the mapping.""" + # Optional in IContainer, required by this interface. + + +class IWriteMapping(Interface): + """Mapping methods for changing data""" + + def __delitem__(key): + """Delete a value from the mapping using the key.""" + + def __setitem__(key, value): + """Set a new item in the mapping.""" + + +class IEnumerableMapping(collections.ISized, IReadMapping): + """ + Mapping objects whose items can be enumerated. + + .. versionchanged:: 5.0.0 + Extend ``ISized`` + """ + + def keys(): + """Return the keys of the mapping object. + """ + + def __iter__(): + """Return an iterator for the keys of the mapping object. + """ + + def values(): + """Return the values of the mapping object. + """ + + def items(): + """Return the items of the mapping object. + """ + + +class IMapping(IWriteMapping, IEnumerableMapping): + ''' Simple mapping interface ''' + + +class IIterableMapping(IEnumerableMapping): + """A mapping that has distinct methods for iterating + without copying. + + """ + + +class IClonableMapping(Interface): + """Something that can produce a copy of itself. + + This is available in `dict`. + """ + + def copy(): + "return copy of dict" + + +class IExtendedReadMapping(IIterableMapping): + """ + Something with a particular method equivalent to ``__contains__``. + + On Python 2, `dict` provided the ``has_key`` method, but it was removed + in Python 3. + """ + + +class IExtendedWriteMapping(IWriteMapping): + """Additional mutation methods. + + These are all provided by `dict`. + """ + + def clear(): + "delete all items" + + def update(d): + " Update D from E: for k in E.keys(): D[k] = E[k]" + + def setdefault(key, default=None): + "D.setdefault(k[,d]) -> D.get(k,d), also set D[k]=d if k not in D" + + def pop(k, default=None): + """ + pop(k[,default]) -> value + + Remove specified key and return the corresponding value. + + If key is not found, *default* is returned if given, otherwise + `KeyError` is raised. Note that *default* must not be passed by + name. + """ + + def popitem(): + """remove and return some (key, value) pair as a + 2-tuple; but raise KeyError if mapping is empty""" + + +class IFullMapping( + collections.IMutableMapping, + IExtendedReadMapping, + IExtendedWriteMapping, + IClonableMapping, + IMapping, +): + """ + Full mapping interface. + + Most uses of this interface should instead use + :class:`~zope.interface.commons.collections.IMutableMapping` (one of the + bases of this interface). The required methods are the same. + + .. versionchanged:: 5.0.0 + Extend ``IMutableMapping`` + """ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope/interface/common/numbers.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope/interface/common/numbers.py new file mode 100644 index 0000000000000000000000000000000000000000..6b20e09d324ef4ff2cfcd26a994efea380912c3a --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope/interface/common/numbers.py @@ -0,0 +1,65 @@ +############################################################################## +# Copyright (c) 2020 Zope Foundation and Contributors. +# All Rights Reserved. +# +# This software is subject to the provisions of the Zope Public License, +# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. +# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED +# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS +# FOR A PARTICULAR PURPOSE. +############################################################################## +""" +Interface definitions paralleling the abstract base classes defined in +:mod:`numbers`. + +After this module is imported, the standard library types will declare +that they implement the appropriate interface. + +.. versionadded:: 5.0.0 +""" + +import numbers as abc + +from zope.interface.common import ABCInterface +from zope.interface.common import optional + + +# pylint:disable=inherit-non-class, +# pylint:disable=no-self-argument,no-method-argument +# pylint:disable=unexpected-special-method-signature +# pylint:disable=no-value-for-parameter + + +class INumber(ABCInterface): + abc = abc.Number + + +class IComplex(INumber): + abc = abc.Complex + + @optional + def __complex__(): + """ + Rarely implemented, even in builtin types. + """ + + +class IReal(IComplex): + abc = abc.Real + + @optional + def __complex__(): + """ + Rarely implemented, even in builtin types. + """ + + __floor__ = __ceil__ = __complex__ + + +class IRational(IReal): + abc = abc.Rational + + +class IIntegral(IRational): + abc = abc.Integral diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope/interface/common/sequence.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope/interface/common/sequence.py new file mode 100644 index 0000000000000000000000000000000000000000..c63f5a477ac1f6f01121dc40da1233c637ca8c29 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope/interface/common/sequence.py @@ -0,0 +1,195 @@ +############################################################################## +# +# Copyright (c) 2001, 2002 Zope Foundation and Contributors. +# All Rights Reserved. +# +# This software is subject to the provisions of the Zope Public License, +# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. +# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED +# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS +# FOR A PARTICULAR PURPOSE. +# +############################################################################## +""" +Sequence Interfaces + +Importing this module does *not* mark any standard classes as +implementing any of these interfaces. + +While this module is not deprecated, new code should generally use +:mod:`zope.interface.common.collections`, specifically +:class:`~zope.interface.common.collections.ISequence` and +:class:`~zope.interface.common.collections.IMutableSequence`. This +module is occasionally useful for its fine-grained breakdown of interfaces. + +The standard library :class:`list`, :class:`tuple` and +:class:`collections.UserList`, among others, implement ``ISequence`` +or ``IMutableSequence`` but *do not* implement any of the interfaces +in this module. +""" + +__docformat__ = 'restructuredtext' +from zope.interface import Interface +from zope.interface.common import collections + + +class IMinimalSequence(collections.IIterable): + """Most basic sequence interface. + + All sequences are iterable. This requires at least one of the + following: + + - a `__getitem__()` method that takes a single argument; integer + values starting at 0 must be supported, and `IndexError` should + be raised for the first index for which there is no value, or + + - an `__iter__()` method that returns an iterator as defined in + the Python documentation (http://docs.python.org/lib/typeiter.html). + + """ + + def __getitem__(index): + """``x.__getitem__(index) <==> x[index]`` + + Declaring this interface does not specify whether `__getitem__` + supports slice objects.""" + + +class IFiniteSequence(collections.ISized, IMinimalSequence): + """ + A sequence of bound size. + + .. versionchanged:: 5.0.0 + Extend ``ISized`` + """ + + +class IReadSequence(collections.IContainer, IFiniteSequence): + """ + read interface shared by tuple and list + + This interface is similar to + :class:`~zope.interface.common.collections.ISequence`, but + requires that all instances be totally ordered. Most users + should prefer ``ISequence``. + + .. versionchanged:: 5.0.0 + Extend ``IContainer`` + """ + + def __contains__(item): + """``x.__contains__(item) <==> item in x``""" + # Optional in IContainer, required here. + + def __lt__(other): + """``x.__lt__(other) <==> x < other``""" + + def __le__(other): + """``x.__le__(other) <==> x <= other``""" + + def __eq__(other): + """``x.__eq__(other) <==> x == other``""" + + def __ne__(other): + """``x.__ne__(other) <==> x != other``""" + + def __gt__(other): + """``x.__gt__(other) <==> x > other``""" + + def __ge__(other): + """``x.__ge__(other) <==> x >= other``""" + + def __add__(other): + """``x.__add__(other) <==> x + other``""" + + def __mul__(n): + """``x.__mul__(n) <==> x * n``""" + + def __rmul__(n): + """``x.__rmul__(n) <==> n * x``""" + + +class IExtendedReadSequence(IReadSequence): + """Full read interface for lists""" + + def count(item): + """Return number of occurrences of value""" + + def index(item, *args): + """index(value, [start, [stop]]) -> int + + Return first index of *value* + """ + + +class IUniqueMemberWriteSequence(Interface): + """The write contract for a sequence that may enforce unique members""" + + def __setitem__(index, item): + """``x.__setitem__(index, item) <==> x[index] = item`` + + Declaring this interface does not specify whether `__setitem__` + supports slice objects. + """ + + def __delitem__(index): + """``x.__delitem__(index) <==> del x[index]`` + + Declaring this interface does not specify whether `__delitem__` + supports slice objects. + """ + + def __iadd__(y): + """``x.__iadd__(y) <==> x += y``""" + + def append(item): + """Append item to end""" + + def insert(index, item): + """Insert item before index""" + + def pop(index=-1): + """Remove and return item at index (default last)""" + + def remove(item): + """Remove first occurrence of value""" + + def reverse(): + """Reverse *IN PLACE*""" + + def sort(cmpfunc=None): + """Stable sort *IN PLACE*; `cmpfunc(x, y)` -> -1, 0, 1""" + + def extend(iterable): + """Extend list by appending elements from the iterable""" + + +class IWriteSequence(IUniqueMemberWriteSequence): + """Full write contract for sequences""" + + def __imul__(n): + """``x.__imul__(n) <==> x *= n``""" + + +class ISequence(IReadSequence, IWriteSequence): + """ + Full sequence contract. + + New code should prefer + :class:`~zope.interface.common.collections.IMutableSequence`. + + Compared to that interface, which is implemented by :class:`list` + (:class:`~zope.interface.common.builtins.IList`), among others, + this interface is missing the following methods: + + - clear + + - count + + - index + + This interface adds the following methods: + + - sort + """ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope/interface/common/tests/__init__.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope/interface/common/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..f70a53099907d699b6054ed7f77c454c836aad68 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope/interface/common/tests/__init__.py @@ -0,0 +1,146 @@ +############################################################################## +# Copyright (c) 2020 Zope Foundation and Contributors. +# All Rights Reserved. +# +# This software is subject to the provisions of the Zope Public License, +# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. +# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED +# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS +# FOR A PARTICULAR PURPOSE. +############################################################################## + +import unittest + +from zope.interface.common import ABCInterface +from zope.interface.common import ABCInterfaceClass +from zope.interface.verify import verifyClass +from zope.interface.verify import verifyObject + + +def iter_abc_interfaces(predicate=lambda iface: True): + # Iterate ``(iface, classes)``, where ``iface`` is a descendent of + # the ABCInterfaceClass passing the *predicate* and ``classes`` is + # an iterable of classes registered to conform to that interface. + # + # Note that some builtin classes are registered for two distinct parts of + # the ABC/interface tree. For example, bytearray is both ByteString and + # MutableSequence. + seen = set() + stack = list( + ABCInterface.dependents + ) # subclasses, but also implementedBy objects + + while stack: + iface = stack.pop(0) + if iface in seen or not isinstance(iface, ABCInterfaceClass): + continue + seen.add(iface) + stack.extend(list(iface.dependents)) + if not predicate(iface): + continue + + registered = set(iface.getRegisteredConformers()) + registered -= set(iface._ABCInterfaceClass__ignored_classes) + if registered: + yield iface, registered + + +def add_abc_interface_tests(cls, module): + def predicate(iface): + return iface.__module__ == module + add_verify_tests(cls, iter_abc_interfaces(predicate)) + + +def add_verify_tests(cls, iface_classes_iter): + cls.maxDiff = None + for iface, registered_classes in iface_classes_iter: + for stdlib_class in registered_classes: + def test(self, stdlib_class=stdlib_class, iface=iface): + if ( + stdlib_class in self.UNVERIFIABLE or + stdlib_class.__name__ in self.UNVERIFIABLE + ): + self.skipTest("Unable to verify %s" % stdlib_class) + + self.assertTrue(self.verify(iface, stdlib_class)) + + suffix = "{}_{}_{}_{}".format( + stdlib_class.__module__.replace('.', '_'), + stdlib_class.__name__, + iface.__module__.replace('.', '_'), + iface.__name__ + ) + name = 'test_auto_' + suffix + test.__name__ = name + assert not hasattr(cls, name), (name, list(cls.__dict__)) + setattr(cls, name, test) + + def test_ro(self, stdlib_class=stdlib_class, iface=iface): + from zope.interface import Interface + from zope.interface import implementedBy + from zope.interface import ro + self.assertEqual( + tuple(ro.ro(iface, strict=True)), + iface.__sro__) + implements = implementedBy(stdlib_class) + sro = implements.__sro__ + self.assertIs(sro[-1], Interface) + + if stdlib_class not in self.UNVERIFIABLE_RO: + # Check that we got the strict C3 resolution order, unless + # we know we cannot. Note that 'Interface' is virtual base + # that doesn't necessarily appear at the same place in the + # calculated SRO as in the final SRO. + strict = stdlib_class not in self.NON_STRICT_RO + isro = ro.ro(implements, strict=strict) + isro.remove(Interface) + isro.append(Interface) + + self.assertEqual(tuple(isro), sro) + + name = 'test_auto_ro_' + suffix + test_ro.__name__ = name + assert not hasattr(cls, name) + setattr(cls, name, test_ro) + + +class VerifyClassMixin(unittest.TestCase): + verifier = staticmethod(verifyClass) + UNVERIFIABLE = () + NON_STRICT_RO = () + UNVERIFIABLE_RO = () + + def _adjust_object_before_verify(self, iface, x): + return x + + def verify(self, iface, klass, **kwargs): + return self.verifier(iface, + self._adjust_object_before_verify(iface, klass), + **kwargs) + + +class VerifyObjectMixin(VerifyClassMixin): + verifier = staticmethod(verifyObject) + CONSTRUCTORS = { + } + + def _adjust_object_before_verify(self, iface, x): + constructor = self.CONSTRUCTORS.get(x) + if not constructor: + constructor = self.CONSTRUCTORS.get(iface) + if not constructor: + constructor = self.CONSTRUCTORS.get(x.__name__) + if not constructor: + constructor = x + if constructor is unittest.SkipTest: + self.skipTest("Cannot create " + str(x)) + + try: + result = constructor() + except Exception as e: # pragma: no cover + raise TypeError( + f'Failed to create instance of {constructor}') from e + if hasattr(result, 'close'): + self.addCleanup(result.close) + return result diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope/interface/common/tests/basemapping.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope/interface/common/tests/basemapping.py new file mode 100644 index 0000000000000000000000000000000000000000..f58e32a6aac9dfa1c472a652382b766ce186a71f --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope/interface/common/tests/basemapping.py @@ -0,0 +1,115 @@ +############################################################################## +# +# Copyright (c) 2001, 2002 Zope Foundation and Contributors. +# All Rights Reserved. +# +# This software is subject to the provisions of the Zope Public License, +# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. +# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED +# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS +# FOR A PARTICULAR PURPOSE. +# +############################################################################## +"""Base Mapping tests +""" +from operator import __getitem__ + + +def testIReadMapping(self, inst, state, absent): + for key in state: + self.assertEqual(inst[key], state[key]) + self.assertEqual(inst.get(key, None), state[key]) + self.assertIn(key, inst) + + for key in absent: + self.assertEqual(inst.get(key, None), None) + self.assertEqual(inst.get(key), None) + self.assertEqual(inst.get(key, self), self) + self.assertRaises(KeyError, __getitem__, inst, key) + + +def test_keys(self, inst, state): + # Return the keys of the mapping object + inst_keys = sorted(inst.keys()) + state_keys = sorted(state.keys()) + self.assertEqual(inst_keys, state_keys) + + +def test_iter(self, inst, state): + # Return the keys of the mapping object + inst_keys = sorted(inst) + state_keys = sorted(state.keys()) + self.assertEqual(inst_keys, state_keys) + + +def test_values(self, inst, state): + # Return the values of the mapping object + inst_values = sorted(inst.values()) + state_values = sorted(state.values()) + self.assertEqual(inst_values, state_values) + + +def test_items(self, inst, state): + # Return the items of the mapping object + inst_items = sorted(inst.items()) + state_items = sorted(state.items()) + self.assertEqual(inst_items, state_items) + + +def test___len__(self, inst, state): + # Return the number of items + self.assertEqual(len(inst), len(state)) + + +def testIEnumerableMapping(self, inst, state): + test_keys(self, inst, state) + test_items(self, inst, state) + test_values(self, inst, state) + test___len__(self, inst, state) + + +class BaseTestIReadMapping: + + def testIReadMapping(self): + inst = self._IReadMapping__sample() + state = self._IReadMapping__stateDict() + absent = self._IReadMapping__absentKeys() + testIReadMapping(self, inst, state, absent) + + +class BaseTestIEnumerableMapping(BaseTestIReadMapping): + # Mapping objects whose items can be enumerated + + def test_keys(self): + # Return the keys of the mapping object + inst = self._IEnumerableMapping__sample() + state = self._IEnumerableMapping__stateDict() + test_keys(self, inst, state) + + def test_values(self): + # Return the values of the mapping object + inst = self._IEnumerableMapping__sample() + state = self._IEnumerableMapping__stateDict() + test_values(self, inst, state) + + def test_items(self): + # Return the items of the mapping object + inst = self._IEnumerableMapping__sample() + state = self._IEnumerableMapping__stateDict() + test_items(self, inst, state) + + def test___len__(self): + # Return the number of items + inst = self._IEnumerableMapping__sample() + state = self._IEnumerableMapping__stateDict() + test___len__(self, inst, state) + + def _IReadMapping__stateDict(self): + return self._IEnumerableMapping__stateDict() + + def _IReadMapping__sample(self): + return self._IEnumerableMapping__sample() + + def _IReadMapping__absentKeys(self): + return self._IEnumerableMapping__absentKeys() diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope/interface/common/tests/test_builtins.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope/interface/common/tests/test_builtins.py new file mode 100644 index 0000000000000000000000000000000000000000..3c764392833a00f0a6bccc7ba029e13ef8a25ddc --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope/interface/common/tests/test_builtins.py @@ -0,0 +1,50 @@ +############################################################################## +# Copyright (c) 2020 Zope Foundation and Contributors. +# All Rights Reserved. +# +# This software is subject to the provisions of the Zope Public License, +# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. +# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED +# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS +# FOR A PARTICULAR PURPOSE. +############################################################################## + +import unittest + +from zope.interface._compat import PY313_OR_OLDER +from zope.interface.common import builtins + +from . import VerifyClassMixin +from . import VerifyObjectMixin +from . import add_verify_tests + + +class TestVerifyClass(VerifyClassMixin, + unittest.TestCase): + pass + + +VERIFY_TESTS = [ + (builtins.IList, (list,)), + (builtins.ITuple, (tuple,)), + (builtins.ITextString, (str,)), + (builtins.INativeString, (str,)), + (builtins.IBool, (bool,)), + (builtins.IDict, (dict,)), + (builtins.IFile, ()), + +] +if PY313_OR_OLDER: + VERIFY_TESTS.append( + (builtins.IByteString, (bytes,)) + ) + +add_verify_tests(TestVerifyClass, tuple(VERIFY_TESTS)) + + +class TestVerifyObject(VerifyObjectMixin, + TestVerifyClass): + CONSTRUCTORS = { + builtins.IFile: lambda: open(__file__) + } diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope/interface/common/tests/test_collections.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope/interface/common/tests/test_collections.py new file mode 100644 index 0000000000000000000000000000000000000000..384b033eeb6914a48793879560da82ff7773bc3b --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope/interface/common/tests/test_collections.py @@ -0,0 +1,143 @@ +############################################################################## +# Copyright (c) 2020 Zope Foundation and Contributors. +# All Rights Reserved. +# +# This software is subject to the provisions of the Zope Public License, +# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. +# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED +# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS +# FOR A PARTICULAR PURPOSE. +############################################################################## + + +import array +import sys +import unittest +from collections import OrderedDict +from collections import abc +from collections import deque +from types import MappingProxyType + +from zope.interface import Invalid +from zope.interface._compat import PYPY +# Note that importing z.i.c.collections does work on import. +from zope.interface.common import collections + +from . import VerifyClassMixin +from . import VerifyObjectMixin +from . import add_abc_interface_tests + + +class TestVerifyClass(VerifyClassMixin, unittest.TestCase): + + # Here we test some known builtin classes that are defined to implement + # various collection interfaces as a quick sanity test. + def test_frozenset(self): + self.assertIsInstance(frozenset(), abc.Set) + self.assertTrue(self.verify(collections.ISet, frozenset)) + + def test_list(self): + self.assertIsInstance(list(), abc.MutableSequence) + self.assertTrue(self.verify(collections.IMutableSequence, list)) + + # Here we test some derived classes. + def test_UserList(self): + self.assertTrue(self.verify(collections.IMutableSequence, + collections.UserList)) + + def test_UserDict(self): + self.assertTrue(self.verify(collections.IMutableMapping, + collections.UserDict)) + + def test_UserString(self): + self.assertTrue(self.verify(collections.ISequence, + collections.UserString)) + + # Now we go through the registry, which should have several things, mostly + # builtins, but if we've imported other libraries already, it could + # contain things from outside of there too. We aren't concerned about + # third-party code here, just standard library types. We start with a + # blacklist of things to exclude, but if that gets out of hand we can + # figure out a better whitelisting. + UNVERIFIABLE = { + # This is declared to be an ISequence, but is missing lots of methods, + # including some that aren't part of a language protocol, such as + # ``index`` and ``count``. + memoryview, + # sqlite3.Row claims ISequence but also misses ``index`` and + # ``count``. It's imported because...? Coverage imports it, but why + # do we have it without coverage? + 'Row', + # In Python 3.10 ``array.array`` appears as ``IMutableSequence`` but it + # does not provide a ``clear()`` method and it cannot be instantiated + # using ``array.array()``. + array.array, + } + + if PYPY: + UNVERIFIABLE.update({ + # collections.deque.pop() doesn't support the index= argument to + # MutableSequence.pop(). We can't verify this on CPython because + # we can't get the signature, but on PyPy we /can/ get the + # signature, and of course it doesn't match. + deque, + # Likewise for index + range, + }) + UNVERIFIABLE_RO = { + # ``array.array`` fails the ``test_auto_ro_*`` tests with and + # without strict RO but only on Windows (AppVeyor) on Python 3.10.0 + # (in older versions ``array.array`` does not appear as + # ``IMutableSequence``). + array.array, + } + + +add_abc_interface_tests(TestVerifyClass, collections.ISet.__module__) + + +def _get_FrameLocalsProxy(): + return type(sys._getframe().f_locals) + + +class TestVerifyObject(VerifyObjectMixin, + TestVerifyClass): + CONSTRUCTORS = { + collections.IValuesView: {}.values, + collections.IItemsView: {}.items, + collections.IKeysView: {}.keys, + memoryview: lambda: memoryview(b'abc'), + range: lambda: range(10), + MappingProxyType: lambda: MappingProxyType({}), + collections.UserString: lambda: collections.UserString('abc'), + type(iter(bytearray())): lambda: iter(bytearray()), + type(iter(b'abc')): lambda: iter(b'abc'), + 'coroutine': unittest.SkipTest, + type(iter({}.keys())): lambda: iter({}.keys()), + type(iter({}.items())): lambda: iter({}.items()), + type(iter({}.values())): lambda: iter({}.values()), + type(i for i in range(1)): lambda: (i for i in range(3)), + type(iter([])): lambda: iter([]), + type(reversed([])): lambda: reversed([]), + 'longrange_iterator': unittest.SkipTest, + 'range_iterator': lambda: iter(range(3)), + 'rangeiterator': lambda: iter(range(3)), + type(iter(set())): lambda: iter(set()), + type(iter('')): lambda: iter(''), + 'async_generator': unittest.SkipTest, + type(iter(tuple())): lambda: iter(tuple()), + } + if sys.version_info >= (3, 13): + def FrameLocalsProxy_constructor(): + return _get_FrameLocalsProxy()(sys._getframe()) + FrameLocalsProxy = _get_FrameLocalsProxy() + CONSTRUCTORS[FrameLocalsProxy] = FrameLocalsProxy_constructor + + UNVERIFIABLE_RO = { + # ``array.array`` fails the ``test_auto_ro_*`` tests with and + # without strict RO but only on Windows (AppVeyor) on Python 3.10.0 + # (in older versions ``array.array`` does not appear as + # ``IMutableSequence``). + array.array, + } diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope/interface/common/tests/test_idatetime.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope/interface/common/tests/test_idatetime.py new file mode 100644 index 0000000000000000000000000000000000000000..9550daa1e4240d1b92a5d218516fd0d5a8a44bbd --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope/interface/common/tests/test_idatetime.py @@ -0,0 +1,48 @@ +############################################################################## +# +# Copyright (c) 2003 Zope Foundation and Contributors. +# All Rights Reserved. +# +# This software is subject to the provisions of the Zope Public License, +# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. +# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED +# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS +# FOR A PARTICULAR PURPOSE. +# +############################################################################## +"""Test for datetime interfaces +""" + +import unittest +from datetime import date +from datetime import datetime +from datetime import time +from datetime import timedelta +from datetime import tzinfo + +from zope.interface.common.idatetime import IDate +from zope.interface.common.idatetime import IDateClass +from zope.interface.common.idatetime import IDateTime +from zope.interface.common.idatetime import IDateTimeClass +from zope.interface.common.idatetime import ITime +from zope.interface.common.idatetime import ITimeClass +from zope.interface.common.idatetime import ITimeDelta +from zope.interface.common.idatetime import ITimeDeltaClass +from zope.interface.common.idatetime import ITZInfo +from zope.interface.verify import verifyClass +from zope.interface.verify import verifyObject + + +class TestDateTimeInterfaces(unittest.TestCase): + + def test_interfaces(self): + verifyObject(ITimeDelta, timedelta(minutes=20)) + verifyObject(IDate, date(2000, 1, 2)) + verifyObject(IDateTime, datetime(2000, 1, 2, 10, 20)) + verifyObject(ITime, time(20, 30, 15, 1234)) + verifyObject(ITZInfo, tzinfo()) + verifyClass(ITimeDeltaClass, timedelta) + verifyClass(IDateClass, date) + verifyClass(IDateTimeClass, datetime) + verifyClass(ITimeClass, time) diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope/interface/common/tests/test_import_interfaces.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope/interface/common/tests/test_import_interfaces.py new file mode 100644 index 0000000000000000000000000000000000000000..67d14487a90977dea085288294d24b3e4d7e25f8 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope/interface/common/tests/test_import_interfaces.py @@ -0,0 +1,21 @@ +############################################################################## +# +# Copyright (c) 2006 Zope Foundation and Contributors. +# All Rights Reserved. +# +# This software is subject to the provisions of the Zope Public License, +# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. +# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED +# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS +# FOR A PARTICULAR PURPOSE. +# +############################################################################## +import unittest + + +class TestInterfaceImport(unittest.TestCase): + + def test_import(self): + import zope.interface.common.interfaces as x + self.assertIsNotNone(x) diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope/interface/common/tests/test_io.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope/interface/common/tests/test_io.py new file mode 100644 index 0000000000000000000000000000000000000000..72684bff061d49f623cf6d6a1e27f1d9c41acbc7 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope/interface/common/tests/test_io.py @@ -0,0 +1,46 @@ +############################################################################## +# Copyright (c) 2020 Zope Foundation and Contributors. +# All Rights Reserved. +# +# This software is subject to the provisions of the Zope Public License, +# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. +# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED +# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS +# FOR A PARTICULAR PURPOSE. +############################################################################## + + +import io as abc +import unittest + +# Note that importing z.i.c.io does work on import. +from zope.interface.common import io + +from . import VerifyClassMixin +from . import VerifyObjectMixin +from . import add_abc_interface_tests + + +class TestVerifyClass(VerifyClassMixin, + unittest.TestCase): + pass + + +add_abc_interface_tests(TestVerifyClass, io.IIOBase.__module__) + + +class TestVerifyObject(VerifyObjectMixin, + TestVerifyClass): + CONSTRUCTORS = { + abc.BufferedWriter: lambda: abc.BufferedWriter(abc.StringIO()), + abc.BufferedReader: lambda: abc.BufferedReader(abc.StringIO()), + abc.TextIOWrapper: lambda: abc.TextIOWrapper(abc.BytesIO()), + abc.BufferedRandom: lambda: abc.BufferedRandom(abc.BytesIO()), + abc.BufferedRWPair: lambda: abc.BufferedRWPair( + abc.BytesIO(), abc.BytesIO() + ), + abc.FileIO: lambda: abc.FileIO(__file__), + '_WindowsConsoleIO': unittest.SkipTest, + 'WinConsoleIO': unittest.SkipTest, # breaks on PyPy-3.10 + } diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope/interface/common/tests/test_numbers.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope/interface/common/tests/test_numbers.py new file mode 100644 index 0000000000000000000000000000000000000000..4e86514a1a1ba27f8f6e79ddc9bf792ad6da5093 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope/interface/common/tests/test_numbers.py @@ -0,0 +1,42 @@ +############################################################################## +# Copyright (c) 2020 Zope Foundation and Contributors. +# All Rights Reserved. +# +# This software is subject to the provisions of the Zope Public License, +# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. +# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED +# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS +# FOR A PARTICULAR PURPOSE. +############################################################################## + + +import numbers as abc +import unittest + +# Note that importing z.i.c.numbers does work on import. +from zope.interface.common import numbers + +from . import VerifyClassMixin +from . import VerifyObjectMixin +from . import add_abc_interface_tests + + +class TestVerifyClass(VerifyClassMixin, + unittest.TestCase): + + def test_int(self): + self.assertIsInstance(int(), abc.Integral) + self.assertTrue(self.verify(numbers.IIntegral, int)) + + def test_float(self): + self.assertIsInstance(float(), abc.Real) + self.assertTrue(self.verify(numbers.IReal, float)) + + +add_abc_interface_tests(TestVerifyClass, numbers.INumber.__module__) + + +class TestVerifyObject(VerifyObjectMixin, + TestVerifyClass): + pass diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope/interface/declarations.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope/interface/declarations.py new file mode 100644 index 0000000000000000000000000000000000000000..825c578920521df13629c7ff4df06a05b09b04df --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope/interface/declarations.py @@ -0,0 +1,1219 @@ +############################################################################## +# Copyright (c) 2003 Zope Foundation and Contributors. +# All Rights Reserved. +# +# This software is subject to the provisions of the Zope Public License, +# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. +# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED +# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS +# FOR A PARTICULAR PURPOSE. +############################################################################## +"""Implementation of interface declarations + +There are three flavors of declarations: + + - Declarations are used to simply name declared interfaces. + + - ImplementsDeclarations are used to express the interfaces that a + class implements (that instances of the class provides). + + Implements specifications support inheriting interfaces. + + - ProvidesDeclarations are used to express interfaces directly + provided by objects. + +""" +__docformat__ = 'restructuredtext' + +import sys +import weakref +from types import FunctionType +from types import MethodType +from types import ModuleType + +from zope.interface._compat import _use_c_impl +from zope.interface.interface import Interface +from zope.interface.interface import InterfaceBase +from zope.interface.interface import InterfaceClass +from zope.interface.interface import NameAndModuleComparisonMixin +from zope.interface.interface import Specification +from zope.interface.interface import SpecificationBase + + +__all__ = [ + # None. The public APIs of this module are + # re-exported from zope.interface directly. +] + +# pylint:disable=too-many-lines + +# Registry of class-implementation specifications +BuiltinImplementationSpecifications = {} + + +def _next_super_class(ob): + # When ``ob`` is an instance of ``super``, return + # the next class in the MRO that we should actually be + # looking at. Watch out for diamond inheritance! + self_class = ob.__self_class__ + class_that_invoked_super = ob.__thisclass__ + complete_mro = self_class.__mro__ + next_class = complete_mro[complete_mro.index(class_that_invoked_super) + 1] + return next_class + + +class named: + + def __init__(self, name): + self.name = name + + def __call__(self, ob): + ob.__component_name__ = self.name + return ob + + +class Declaration(Specification): + """Interface declarations""" + + __slots__ = () + + def __init__(self, *bases): + Specification.__init__(self, _normalizeargs(bases)) + + def __contains__(self, interface): + """Test whether an interface is in the specification + """ + + return self.extends(interface) and interface in self.interfaces() + + def __iter__(self): + """Return an iterator for the interfaces in the specification + """ + return self.interfaces() + + def flattened(self): + """Return an iterator of all included and extended interfaces + """ + return iter(self.__iro__) + + def __sub__(self, other): + """Remove interfaces from a specification + """ + return Declaration(*[ + i for i in self.interfaces() + if not [ + j + for j in other.interfaces() + if i.extends(j, 0) # non-strict extends + ] + ]) + + def __add__(self, other): + """ + Add two specifications or a specification and an interface + and produce a new declaration. + + .. versionchanged:: 5.4.0 + Now tries to preserve a consistent resolution order. Interfaces + being added to this object are added to the front of the resulting + resolution order if they already extend an interface in this + object. Previously, they were always added to the end of the order, + which easily resulted in invalid orders. + """ + before = [] + result = list(self.interfaces()) + seen = set(result) + for i in other.interfaces(): + if i in seen: + continue + seen.add(i) + if any(i.extends(x) for x in result): + # It already extends us, e.g., is a subclass, + # so it needs to go at the front of the RO. + before.append(i) + else: + result.append(i) + return Declaration(*(before + result)) + + # XXX: Is __radd__ needed? No tests break if it's removed. + # If it is needed, does it need to handle the C3 ordering differently? + # I (JAM) don't *think* it does. + __radd__ = __add__ + + @staticmethod + def _add_interfaces_to_cls(interfaces, cls): + # Strip redundant interfaces already provided + # by the cls so we don't produce invalid + # resolution orders. + implemented_by_cls = implementedBy(cls) + interfaces = tuple([ + iface + for iface in interfaces + if not implemented_by_cls.isOrExtends(iface) + ]) + return interfaces + (implemented_by_cls,) + + @staticmethod + def _argument_names_for_repr(interfaces): + # These don't actually have to be interfaces, they could be other + # Specification objects like Implements. Also, the first + # one is typically/nominally the cls. + ordered_names = [] + names = set() + for iface in interfaces: + duplicate_transform = repr + if isinstance(iface, InterfaceClass): + # Special case to get 'foo.bar.IFace' + # instead of '' + this_name = iface.__name__ + duplicate_transform = str + elif isinstance(iface, type): + # Likewise for types. (Ignoring legacy old-style + # classes.) + this_name = iface.__name__ + duplicate_transform = _implements_name + elif ( + isinstance(iface, Implements) and + not iface.declared and + iface.inherit in interfaces + ): + # If nothing is declared, there's no need to even print this; + # it would just show as ``classImplements(Class)``, and the + # ``Class`` has typically already. + continue + else: + this_name = repr(iface) + + already_seen = this_name in names + names.add(this_name) + if already_seen: + this_name = duplicate_transform(iface) + + ordered_names.append(this_name) + return ', '.join(ordered_names) + + +class _ImmutableDeclaration(Declaration): + # A Declaration that is immutable. Used as a singleton to + # return empty answers for things like ``implementedBy``. + # We have to define the actual singleton after normalizeargs + # is defined, and that in turn is defined after InterfaceClass and + # Implements. + + __slots__ = () + + __instance = None + + def __new__(cls): + if _ImmutableDeclaration.__instance is None: + _ImmutableDeclaration.__instance = object.__new__(cls) + return _ImmutableDeclaration.__instance + + def __reduce__(self): + return "_empty" + + @property + def __bases__(self): + return () + + @__bases__.setter + def __bases__(self, new_bases): + # We expect the superclass constructor to set ``self.__bases__ = ()``. + # Rather than attempt to special case that in the constructor and + # allow setting __bases__ only at that time, it's easier to just allow + # setting the empty tuple at any time. That makes ``x.__bases__ = + # x.__bases__`` a nice no-op too. (Skipping the superclass constructor + # altogether is a recipe for maintenance headaches.) + if new_bases != (): + raise TypeError( + "Cannot set non-empty bases on shared empty Declaration." + ) + + # As the immutable empty declaration, we cannot be changed. + # This means there's no logical reason for us to have dependents + # or subscriptions: we'll never notify them. So there's no need for + # us to keep track of any of that. + @property + def dependents(self): + return {} + + changed = subscribe = unsubscribe = lambda self, _ignored: None + + def interfaces(self): + # An empty iterator + return iter(()) + + def extends(self, interface, strict=True): + return interface is self._ROOT + + def get(self, name, default=None): + return default + + def weakref(self, callback=None): + # We're a singleton, we never go away. So there's no need to return + # distinct weakref objects here; their callbacks will never be called. + # Instead, we only need to return a callable that returns ourself. The + # easiest one is to return _ImmutableDeclaration itself; testing on + # Python 3.8 shows that's faster than a function that returns _empty. + # (Remember, one goal is to avoid allocating any object, and that + # includes a method.) + return _ImmutableDeclaration + + @property + def _v_attrs(self): + # _v_attrs is not a public, documented property, but some client code + # uses it anyway as a convenient place to cache things. To keep the + # empty declaration truly immutable, we must ignore that. That + # includes ignoring assignments as well. + return {} + + @_v_attrs.setter + def _v_attrs(self, new_attrs): + pass + + +############################################################################## +# +# Implementation specifications +# +# These specify interfaces implemented by instances of classes + +class Implements(NameAndModuleComparisonMixin, + Declaration): + # Inherit from NameAndModuleComparisonMixin to be mutually comparable with + # InterfaceClass objects. (The two must be mutually comparable to be able + # to work in e.g., BTrees.) Instances of this class generally don't have a + # __module__ other than `zope.interface.declarations`, whereas they *do* + # have a __name__ that is the fully qualified name of the object they are + # representing. + + # Note, though, that equality and hashing are still identity based. This + # accounts for things like nested objects that have the same name + # (typically only in tests) and is consistent with pickling. As far as + # comparisons to InterfaceClass goes, we'll never have equal name and + # module to those, so we're still consistent there. Instances of this + # class are essentially intended to be unique and are heavily cached (note + # how our __reduce__ handles this) so having identity based hash and eq + # should also work. + + # We want equality and hashing to be based on identity. However, we can't + # actually implement __eq__/__ne__ to do this because sometimes we get + # wrapped in a proxy. We need to let the proxy types implement these + # methods so they can handle unwrapping and then rely on: (1) the + # interpreter automatically changing `implements == proxy` into `proxy == + # implements` (which will call proxy.__eq__ to do the unwrapping) and then + # (2) the default equality and hashing semantics being identity based. + + # class whose specification should be used as additional base + inherit = None + + # interfaces actually declared for a class + declared = () + + # Weak cache of {class: } for super objects. + # Created on demand. These are rare, as of 5.0 anyway. Using a class + # level default doesn't take space in instances. Using _v_attrs would be + # another place to store this without taking space unless needed. + _super_cache = None + + __name__ = '?' + + @classmethod + def named(cls, name, *bases): + # Implementation method: Produce an Implements interface with a fully + # fleshed out __name__ before calling the constructor, which sets + # bases to the given interfaces and which may pass this object to + # other objects (e.g., to adjust dependents). If they're sorting or + # comparing by name, this needs to be set. + inst = cls.__new__(cls) + inst.__name__ = name + inst.__init__(*bases) + return inst + + def changed(self, originally_changed): + try: + del self._super_cache + except AttributeError: + pass + return super().changed(originally_changed) + + def __repr__(self): + if self.inherit: + name = ( + getattr(self.inherit, '__name__', None) or + _implements_name(self.inherit) + ) + else: + name = self.__name__ + declared_names = self._argument_names_for_repr(self.declared) + if declared_names: + declared_names = ', ' + declared_names + return f'classImplements({name}{declared_names})' + + def __reduce__(self): + return implementedBy, (self.inherit, ) + + +def _implements_name(ob): + # Return the __name__ attribute to be used by its __implemented__ + # property. + # This must be stable for the "same" object across processes + # because it is used for sorting. It needn't be unique, though, in cases + # like nested classes named Foo created by different functions, because + # equality and hashing is still based on identity. + # It might be nice to use __qualname__ on Python 3, but that would produce + # different values between Py2 and Py3. + + # Special-case 'InterfaceBase': its '__module__' member descriptor + # behaves differently across Python 3.x versions. + if ob is InterfaceBase: + return 'zope.interface.interface.InterfaceBase' + + return (getattr(ob, '__module__', '?') or '?') + \ + '.' + (getattr(ob, '__name__', '?') or '?') + + +def _implementedBy_super(sup): + # TODO: This is now simple enough we could probably implement + # in C if needed. + + # If the class MRO is strictly linear, we could just + # follow the normal algorithm for the next class in the + # search order (e.g., just return + # ``implemented_by_next``). But when diamond inheritance + # or mixins + interface declarations are present, we have + # to consider the whole MRO and compute a new Implements + # that excludes the classes being skipped over but + # includes everything else. + implemented_by_self = implementedBy(sup.__self_class__) + cache = implemented_by_self._super_cache # pylint:disable=protected-access + if cache is None: + cache = implemented_by_self._super_cache = weakref.WeakKeyDictionary() + + key = sup.__thisclass__ + try: + return cache[key] + except KeyError: + pass + + next_cls = _next_super_class(sup) + # For ``implementedBy(cls)``: + # .__bases__ is .declared + [implementedBy(b) for b in cls.__bases__] + # .inherit is cls + + implemented_by_next = implementedBy(next_cls) + mro = sup.__self_class__.__mro__ + ix_next_cls = mro.index(next_cls) + classes_to_keep = mro[ix_next_cls:] + new_bases = [implementedBy(c) for c in classes_to_keep] + + new = Implements.named( + implemented_by_self.__name__ + ':' + implemented_by_next.__name__, + *new_bases + ) + new.inherit = implemented_by_next.inherit + new.declared = implemented_by_next.declared + # I don't *think* that new needs to subscribe to ``implemented_by_self``; + # it auto-subscribed to its bases, and that should be good enough. + cache[key] = new + + return new + + +@_use_c_impl +def implementedBy( + cls +): # pylint:disable=too-many-return-statements,too-many-branches + """Return the interfaces implemented for a class' instances + + The value returned is an `~zope.interface.interfaces.IDeclaration`. + """ + try: + if isinstance(cls, super): + # Yes, this needs to be inside the try: block. Some objects + # like security proxies even break isinstance. + return _implementedBy_super(cls) + + spec = cls.__dict__.get('__implemented__') + except AttributeError: + + # we can't get the class dict. This is probably due to a + # security proxy. If this is the case, then probably no + # descriptor was installed for the class. + + # We don't want to depend directly on zope.security in + # zope.interface, but we'll try to make reasonable + # accommodations in an indirect way. + + # We'll check to see if there's an implements: + + spec = getattr(cls, '__implemented__', None) + if spec is None: + # There's no spec stred in the class. Maybe its a builtin: + spec = BuiltinImplementationSpecifications.get(cls) + if spec is not None: + return spec + return _empty + + if spec.__class__ == Implements: + # we defaulted to _empty or there was a spec. Good enough. + # Return it. + return spec + + # TODO: need old style __implements__ compatibility? + # Hm, there's an __implemented__, but it's not a spec. Must be + # an old-style declaration. Just compute a spec for it + return Declaration(*_normalizeargs((spec, ))) + + if isinstance(spec, Implements): + return spec + + if spec is None: + spec = BuiltinImplementationSpecifications.get(cls) + if spec is not None: + return spec + + # TODO: need old style __implements__ compatibility? + spec_name = _implements_name(cls) + if spec is not None: + # old-style __implemented__ = foo declaration + spec = (spec, ) # tuplefy, as it might be just an int + spec = Implements.named(spec_name, *_normalizeargs(spec)) + spec.inherit = None # old-style implies no inherit + del cls.__implemented__ # get rid of the old-style declaration + else: + try: + bases = cls.__bases__ + except AttributeError: + if not callable(cls): + raise TypeError("ImplementedBy called for non-factory", cls) + bases = () + + spec = Implements.named(spec_name, *[implementedBy(c) for c in bases]) + spec.inherit = cls + + try: + cls.__implemented__ = spec + if not hasattr(cls, '__providedBy__'): + cls.__providedBy__ = objectSpecificationDescriptor + + if isinstance(cls, type) and '__provides__' not in cls.__dict__: + # Make sure we get a __provides__ descriptor + cls.__provides__ = ClassProvides( + cls, getattr(cls, '__class__', type(cls)), + ) + + except TypeError: + if not isinstance(cls, type): + raise TypeError("ImplementedBy called for non-type", cls) + BuiltinImplementationSpecifications[cls] = spec + + return spec + + +def classImplementsOnly(cls, *interfaces): + """ + Declare the only interfaces implemented by instances of a class + + The arguments after the class are one or more interfaces or interface + specifications (`~zope.interface.interfaces.IDeclaration` objects). + + The interfaces given (including the interfaces in the specifications) + replace any previous declarations, *including* inherited definitions. If + you wish to preserve inherited declarations, you can pass + ``implementedBy(cls)`` in *interfaces*. This can be used to alter the + interface resolution order. + """ + spec = implementedBy(cls) + # Clear out everything inherited. It's important to + # also clear the bases right now so that we don't improperly discard + # interfaces that are already implemented by *old* bases that we're + # about to get rid of. + spec.declared = () + spec.inherit = None + spec.__bases__ = () + _classImplements_ordered(spec, interfaces, ()) + + +def classImplements(cls, *interfaces): + """ + Declare additional interfaces implemented for instances of a class + + The arguments after the class are one or more interfaces or interface + specifications (`~zope.interface.interfaces.IDeclaration` objects). + + The interfaces given (including the interfaces in the specifications) + are added to any interfaces previously declared. An effort is made to + keep a consistent C3 resolution order, but this cannot be guaranteed. + + .. versionchanged:: 5.0.0 + Each individual interface in *interfaces* may be added to either the + beginning or end of the list of interfaces declared for *cls*, + based on inheritance, in order to try to maintain a consistent + resolution order. Previously, all interfaces were added to the end. + .. versionchanged:: 5.1.0 + If *cls* is already declared to implement an interface (or derived + interface) in *interfaces* through inheritance, the interface is + ignored. Previously, it would redundantly be made direct base of *cls*, + which often produced inconsistent interface resolution orders. Now, the + order will be consistent, but may change. Also, if the ``__bases__`` + of the *cls* are later changed, the *cls* will no longer be considered + to implement such an interface (changing the ``__bases__`` of *cls* has + never been supported). + """ + spec = implementedBy(cls) + interfaces = tuple(_normalizeargs(interfaces)) + + before = [] + after = [] + + # Take steps to try to avoid producing an invalid resolution + # order, while still allowing for BWC (in the past, we always + # appended) + for iface in interfaces: + for b in spec.declared: + if iface.extends(b): + before.append(iface) + break + else: + after.append(iface) + _classImplements_ordered(spec, tuple(before), tuple(after)) + + +def classImplementsFirst(cls, iface): + """ + Declare that instances of *cls* additionally provide *iface*. + + The second argument is an interface or interface specification. + It is added as the highest priority (first in the IRO) interface; + no attempt is made to keep a consistent resolution order. + + .. versionadded:: 5.0.0 + """ + spec = implementedBy(cls) + _classImplements_ordered(spec, (iface,), ()) + + +def _classImplements_ordered(spec, before=(), after=()): + # Elide everything already inherited. + # Except, if it is the root, and we don't already declare anything else + # that would imply it, allow the root through. (TODO: When we disallow + # non-strict IRO, this part of the check can be removed because it's not + # possible to re-declare like that.) + before = [ + x + for x in before + if not spec.isOrExtends(x) or (x is Interface and not spec.declared) + ] + after = [ + x + for x in after + if not spec.isOrExtends(x) or (x is Interface and not spec.declared) + ] + + # eliminate duplicates + new_declared = [] + seen = set() + for lst in before, spec.declared, after: + for b in lst: + if b not in seen: + new_declared.append(b) + seen.add(b) + + spec.declared = tuple(new_declared) + + # compute the bases + bases = new_declared # guaranteed no dupes + + if spec.inherit is not None: + for c in spec.inherit.__bases__: + b = implementedBy(c) + if b not in seen: + seen.add(b) + bases.append(b) + + spec.__bases__ = tuple(bases) + + +def _implements_advice(cls): + interfaces, do_classImplements = cls.__dict__['__implements_advice_data__'] + del cls.__implements_advice_data__ + do_classImplements(cls, *interfaces) + return cls + + +class implementer: + """ + Declare the interfaces implemented by instances of a class. + + This function is called as a class decorator. + + The arguments are one or more interfaces or interface specifications + (`~zope.interface.interfaces.IDeclaration` objects). + + The interfaces given (including the interfaces in the specifications) are + added to any interfaces previously declared, unless the interface is + already implemented. + + Previous declarations include declarations for base classes unless + implementsOnly was used. + + This function is provided for convenience. It provides a more convenient + way to call `classImplements`. For example:: + + @implementer(I1) + class C(object): + pass + + is equivalent to calling:: + + classImplements(C, I1) + + after the class has been created. + + .. seealso:: `classImplements` + The change history provided there applies to this function too. + """ + __slots__ = ('interfaces',) + + def __init__(self, *interfaces): + self.interfaces = interfaces + + def __call__(self, ob): + if isinstance(ob, type): + # This is the common branch for classes. + classImplements(ob, *self.interfaces) + return ob + + spec_name = _implements_name(ob) + spec = Implements.named(spec_name, *self.interfaces) + try: + ob.__implemented__ = spec + except AttributeError: + raise TypeError("Can't declare implements", ob) + return ob + + +class implementer_only: + """Declare the only interfaces implemented by instances of a class + + This function is called as a class decorator. + + The arguments are one or more interfaces or interface + specifications (`~zope.interface.interfaces.IDeclaration` objects). + + Previous declarations including declarations for base classes + are overridden. + + This function is provided for convenience. It provides a more + convenient way to call `classImplementsOnly`. For example:: + + @implementer_only(I1) + class C(object): pass + + is equivalent to calling:: + + classImplementsOnly(I1) + + after the class has been created. + """ + + def __init__(self, *interfaces): + self.interfaces = interfaces + + def __call__(self, ob): + if isinstance(ob, (FunctionType, MethodType)): + # XXX Does this decorator make sense for anything but classes? + # I don't think so. There can be no inheritance of interfaces + # on a method or function.... + raise ValueError('The implementer_only decorator is not ' + 'supported for methods or functions.') + + # Assume it's a class: + classImplementsOnly(ob, *self.interfaces) + return ob + + +############################################################################## +# +# Instance declarations + +class Provides(Declaration): # Really named ProvidesClass + """Implement ``__provides__``, the instance-specific specification + + When an object is pickled, we pickle the interfaces that it implements. + """ + + def __init__(self, cls, *interfaces): + self.__args = (cls, ) + interfaces + self._cls = cls + Declaration.__init__( + self, *self._add_interfaces_to_cls(interfaces, cls) + ) + + # Added to by ``moduleProvides``, et al + _v_module_names = () + + def __repr__(self): + # The typical way to create instances of this object is via calling + # ``directlyProvides(...)`` or ``alsoProvides()``, but that's not the + # only way. Proxies, for example, directly use the ``Provides(...)`` + # function (which is the more generic method, and what we pickle as). + # We're after the most readable, useful repr in the common case, so we + # use the most common name. + # + # We also cooperate with ``moduleProvides`` to attempt to do the right + # thing for that API. See it for details. + function_name = 'directlyProvides' + if self._cls is ModuleType and self._v_module_names: + # See notes in ``moduleProvides``/``directlyProvides`` + providing_on_module = True + interfaces = self.__args[1:] + else: + providing_on_module = False + interfaces = (self._cls,) + self.__bases__ + ordered_names = self._argument_names_for_repr(interfaces) + if providing_on_module: + mod_names = self._v_module_names + if len(mod_names) == 1: + mod_names = "sys.modules[%r]" % mod_names[0] + ordered_names = ( + f'{mod_names}, ' + ) + ordered_names + return "{}({})".format( + function_name, + ordered_names, + ) + + def __reduce__(self): + # This reduces to the Provides *function*, not + # this class. + return Provides, self.__args + + __module__ = 'zope.interface' + + def __get__(self, inst, cls): + """Make sure that a class __provides__ doesn't leak to an instance + """ + if inst is None and cls is self._cls: + # We were accessed through a class, so we are the class' + # provides spec. Just return this object, but only if we are + # being called on the same class that we were defined for: + return self + + raise AttributeError('__provides__') + + +ProvidesClass = Provides + + +# Registry of instance declarations +# This is a memory optimization to allow objects to share specifications. +InstanceDeclarations = weakref.WeakValueDictionary() + + +def Provides(*interfaces): # pylint:disable=function-redefined + """Declaration for an instance of *cls*. + + The correct signature is ``cls, *interfaces``. + The *cls* is necessary to avoid the + construction of inconsistent resolution orders. + + Instance declarations are shared among instances that have the same + declaration. The declarations are cached in a weak value dictionary. + """ + spec = InstanceDeclarations.get(interfaces) + if spec is None: + spec = ProvidesClass(*interfaces) + InstanceDeclarations[interfaces] = spec + + return spec + + +Provides.__safe_for_unpickling__ = True + + +def directlyProvides(object, *interfaces): # pylint:disable=redefined-builtin + """Declare interfaces declared directly for an object + + The arguments after the object are one or more interfaces or interface + specifications (`~zope.interface.interfaces.IDeclaration` objects). + + The interfaces given (including the interfaces in the specifications) + replace interfaces previously declared for the object. + """ + cls = getattr(object, '__class__', None) + if cls is not None and getattr(cls, '__class__', None) is cls: + # It's a meta class (well, at least it it could be an extension class) + # Note that we can't get here from the tests: there is no normal + # class which isn't descriptor aware. + if not isinstance(object, type): + raise TypeError("Attempt to make an interface declaration on a " + "non-descriptor-aware class") + + interfaces = _normalizeargs(interfaces) + if cls is None: + cls = type(object) + + if issubclass(cls, type): + # we have a class or type. We'll use a special descriptor + # that provides some extra caching + object.__provides__ = ClassProvides(object, cls, *interfaces) + else: + provides = object.__provides__ = Provides(cls, *interfaces) + # See notes in ``moduleProvides``. + if issubclass(cls, ModuleType) and hasattr(object, '__name__'): + provides._v_module_names += (object.__name__,) + + +def alsoProvides(object, *interfaces): # pylint:disable=redefined-builtin + """Declare interfaces declared directly for an object + + The arguments after the object are one or more interfaces or interface + specifications (`~zope.interface.interfaces.IDeclaration` objects). + + The interfaces given (including the interfaces in the specifications) are + added to the interfaces previously declared for the object. + """ + directlyProvides(object, directlyProvidedBy(object), *interfaces) + + +def noLongerProvides(object, interface): # pylint:disable=redefined-builtin + """ Removes a directly provided interface from an object. + """ + directlyProvides(object, directlyProvidedBy(object) - interface) + if interface.providedBy(object): + raise ValueError("Can only remove directly provided interfaces.") + + +@_use_c_impl +class ClassProvidesBase(SpecificationBase): + + __slots__ = ( + '_cls', + '_implements', + ) + + def __get__(self, inst, cls): + # member slots are set by subclass + # pylint:disable=no-member + if cls is self._cls: + # We only work if called on the class we were defined for + + if inst is None: + # We were accessed through a class, so we are the class' + # provides spec. Just return this object as is: + return self + + return self._implements + + raise AttributeError('__provides__') + + +class ClassProvides(Declaration, ClassProvidesBase): + """Special descriptor for class ``__provides__`` + + The descriptor caches the implementedBy info, so that + we can get declarations for objects without instance-specific + interfaces a bit quicker. + """ + + __slots__ = ( + '__args', + ) + + def __init__(self, cls, metacls, *interfaces): + self._cls = cls + self._implements = implementedBy(cls) + self.__args = (cls, metacls, ) + interfaces + Declaration.__init__( + self, *self._add_interfaces_to_cls(interfaces, metacls) + ) + + def __repr__(self): + # There are two common ways to get instances of this object: The most + # interesting way is calling ``@provider(..)`` as a decorator of a + # class; this is the same as calling ``directlyProvides(cls, ...)``. + # + # The other way is by default: anything that invokes + # ``implementedBy(x)`` will wind up putting an instance in + # ``type(x).__provides__``; this includes the ``@implementer(...)`` + # decorator. Those instances won't have any interfaces. + # + # Thus, as our repr, we go with the ``directlyProvides()`` syntax. + interfaces = (self._cls, ) + self.__args[2:] + ordered_names = self._argument_names_for_repr(interfaces) + return f"directlyProvides({ordered_names})" + + def __reduce__(self): + return self.__class__, self.__args + + # Copy base-class method for speed + __get__ = ClassProvidesBase.__get__ + + +# autopep8: off (it breaks the statements in the "if") +def directlyProvidedBy(object): # pylint:disable=redefined-builtin + """Return the interfaces directly provided by the given object + + The value returned is an `~zope.interface.interfaces.IDeclaration`. + """ + provides = getattr(object, "__provides__", None) + if ( + provides is None # no spec + # We might have gotten the implements spec, as an + # optimization. If so, it's like having only one base, that we + # lop off to exclude class-supplied declarations: + or isinstance(provides, Implements) # noqa W503 + ): + return _empty + + # Strip off the class part of the spec: + return Declaration(provides.__bases__[:-1]) +# autopep8: on + + +class provider: + """Declare interfaces provided directly by a class + + This function is called in a class definition. + + The arguments are one or more interfaces or interface specifications + (`~zope.interface.interfaces.IDeclaration` objects). + + The given interfaces (including the interfaces in the specifications) + are used to create the class's direct-object interface specification. + An error will be raised if the module class has an direct interface + specification. In other words, it is an error to call this function more + than once in a class definition. + + Note that the given interfaces have nothing to do with the interfaces + implemented by instances of the class. + + This function is provided for convenience. It provides a more convenient + way to call `directlyProvides` for a class. For example:: + + @provider(I1) + class C: + pass + + is equivalent to calling:: + + directlyProvides(C, I1) + + after the class has been created. + """ + + def __init__(self, *interfaces): + self.interfaces = interfaces + + def __call__(self, ob): + directlyProvides(ob, *self.interfaces) + return ob + + +def moduleProvides(*interfaces): + """Declare interfaces provided by a module + + This function is used in a module definition. + + The arguments are one or more interfaces or interface specifications + (`~zope.interface.interfaces.IDeclaration` objects). + + The given interfaces (including the interfaces in the specifications) are + used to create the module's direct-object interface specification. An + error will be raised if the module already has an interface specification. + In other words, it is an error to call this function more than once in a + module definition. + + This function is provided for convenience. It provides a more convenient + way to call directlyProvides. For example:: + + moduleProvides(I1) + + is equivalent to:: + + directlyProvides(sys.modules[__name__], I1) + """ + frame = sys._getframe(1) # pylint:disable=protected-access + locals = frame.f_locals # pylint:disable=redefined-builtin + + # Try to make sure we were called from a module body + if (locals is not frame.f_globals) or ('__name__' not in locals): + raise TypeError( + "moduleProvides can only be used from a module definition.") + + if '__provides__' in locals: + raise TypeError( + "moduleProvides can only be used once in a module definition.") + + # Note: This is cached based on the key ``(ModuleType, *interfaces)``; One + # consequence is that any module that provides the same interfaces gets + # the same ``__repr__``, meaning that you can't tell what module such a + # declaration came from. Adding the module name to ``_v_module_names`` + # attempts to correct for this; it works in some common situations, but + # fails (1) after pickling (the data is lost) and (2) if declarations are + # actually shared and (3) if the alternate spelling of + # ``directlyProvides()`` is used. Problem (3) is fixed by cooperating + # with ``directlyProvides`` to maintain this information, and problem (2) + # is worked around by printing all the names, but (1) is unsolvable + # without introducing new classes or changing the stored data...but it + # doesn't actually matter, because ``ModuleType`` can't be pickled! + p = locals["__provides__"] = Provides(ModuleType, + *_normalizeargs(interfaces)) + p._v_module_names += (locals['__name__'],) + + +############################################################################## +# +# Declaration querying support + +# XXX: is this a fossil? Nobody calls it, no unit tests exercise it, no +# doctests import it, and the package __init__ doesn't import it. +# (Answer: Versions of zope.container prior to 4.4.0 called this, +# and zope.proxy.decorator up through at least 4.3.5 called this.) +def ObjectSpecification(direct, cls): + """Provide object specifications + + These combine information for the object and for it's classes. + """ + return Provides(cls, direct) # pragma: no cover fossil + + +@_use_c_impl +def getObjectSpecification(ob): + try: + provides = ob.__provides__ + except AttributeError: + provides = None + + if provides is not None: + if isinstance(provides, SpecificationBase): + return provides + + try: + cls = ob.__class__ + except AttributeError: + # We can't get the class, so just consider provides + return _empty + return implementedBy(cls) + + +@_use_c_impl +def providedBy(ob): + """ + Return the interfaces provided by *ob*. + + If *ob* is a :class:`super` object, then only interfaces implemented + by the remainder of the classes in the method resolution order are + considered. Interfaces directly provided by the object underlying *ob* + are not. + """ + # Here we have either a special object, an old-style declaration + # or a descriptor + + # Try to get __providedBy__ + try: + if isinstance(ob, super): # Some objects raise errors on isinstance() + return implementedBy(ob) + + r = ob.__providedBy__ + except AttributeError: + # Not set yet. Fall back to lower-level thing that computes it + return getObjectSpecification(ob) + + try: + # We might have gotten a descriptor from an instance of a + # class (like an ExtensionClass) that doesn't support + # descriptors. We'll make sure we got one by trying to get + # the only attribute, which all specs have. + r.extends + except AttributeError: + + # The object's class doesn't understand descriptors. + # Sigh. We need to get an object descriptor, but we have to be + # careful. We want to use the instance's __provides__, if + # there is one, but only if it didn't come from the class. + + try: + r = ob.__provides__ + except AttributeError: + # No __provides__, so just fall back to implementedBy + return implementedBy(ob.__class__) + + # We need to make sure we got the __provides__ from the + # instance. We'll do this by making sure we don't get the same + # thing from the class: + + try: + cp = ob.__class__.__provides__ + except AttributeError: + # The ob doesn't have a class or the class has no + # provides, assume we're done: + return r + + if r is cp: + # Oops, we got the provides from the class. This means + # the object doesn't have it's own. We should use implementedBy + return implementedBy(ob.__class__) + + return r + + +@_use_c_impl +class ObjectSpecificationDescriptor: + """Implement the ``__providedBy__`` attribute + + The ``__providedBy__`` attribute computes the interfaces provided by an + object. If an object has an ``__provides__`` attribute, that is returned. + Otherwise, `implementedBy` the *cls* is returned. + + .. versionchanged:: 5.4.0 + Both the default (C) implementation and the Python implementation + now let exceptions raised by accessing ``__provides__`` propagate. + Previously, the C version ignored all exceptions. + .. versionchanged:: 5.4.0 + The Python implementation now matches the C implementation and lets + a ``__provides__`` of ``None`` override what the class is declared to + implement. + """ + + def __get__(self, inst, cls): + """Get an object specification for an object + """ + if inst is None: + return getObjectSpecification(cls) + + try: + return inst.__provides__ + except AttributeError: + return implementedBy(cls) + + +############################################################################## + +def _normalizeargs(sequence, output=None): + """Normalize declaration arguments + + Normalization arguments might contain Declarions, tuples, or single + interfaces. + + Anything but individual interfaces or implements specs will be expanded. + """ + if output is None: + output = [] + + cls = sequence.__class__ + if InterfaceClass in cls.__mro__ or Implements in cls.__mro__: + output.append(sequence) + else: + for v in sequence: + _normalizeargs(v, output) + + return output + + +_empty = _ImmutableDeclaration() + +objectSpecificationDescriptor = ObjectSpecificationDescriptor() diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope/interface/document.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope/interface/document.py new file mode 100644 index 0000000000000000000000000000000000000000..37250377205234ea9114f82df6561eb3e3d56e06 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope/interface/document.py @@ -0,0 +1,133 @@ +############################################################################## +# +# Copyright (c) 2001, 2002 Zope Foundation and Contributors. +# All Rights Reserved. +# +# This software is subject to the provisions of the Zope Public License, +# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. +# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED +# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS +# FOR A PARTICULAR PURPOSE. +# +############################################################################## +""" Pretty-Print an Interface object as structured text (Yum) + +This module provides a function, asStructuredText, for rendering an +interface as structured text. +""" +import zope.interface + + +__all__ = [ + 'asReStructuredText', + 'asStructuredText', +] + + +def asStructuredText(iface, munge=0, rst=False): + """ Output structured text format. Note, this will whack any existing + 'structured' format of the text. + + If `rst=True`, then the output will quote all code as inline literals in + accordance with 'reStructuredText' markup principles. + """ + + if rst: + def inline_literal(s): + return f"``{s}``" + else: + def inline_literal(s): + return s + + r = [inline_literal(iface.getName())] + outp = r.append + level = 1 + + if iface.getDoc(): + outp(_justify_and_indent(_trim_doc_string(iface.getDoc()), level)) + + bases = [base + for base in iface.__bases__ + if base is not zope.interface.Interface + ] + if bases: + outp(_justify_and_indent("This interface extends:", level, munge)) + level += 1 + for b in bases: + item = "o %s" % inline_literal(b.getName()) + outp(_justify_and_indent(_trim_doc_string(item), level, munge)) + level -= 1 + + namesAndDescriptions = sorted(iface.namesAndDescriptions()) + + outp(_justify_and_indent("Attributes:", level, munge)) + level += 1 + for name, desc in namesAndDescriptions: + if not hasattr(desc, 'getSignatureString'): # ugh... + item = "{} -- {}".format( + inline_literal(desc.getName()), + desc.getDoc() or 'no documentation' + ) + outp(_justify_and_indent(_trim_doc_string(item), level, munge)) + level -= 1 + + outp(_justify_and_indent("Methods:", level, munge)) + level += 1 + for name, desc in namesAndDescriptions: + if hasattr(desc, 'getSignatureString'): # ugh... + _call = f"{desc.getName()}{desc.getSignatureString()}" + item = "{} -- {}".format( + inline_literal(_call), + desc.getDoc() or 'no documentation' + ) + outp(_justify_and_indent(_trim_doc_string(item), level, munge)) + + return "\n\n".join(r) + "\n\n" + + +def asReStructuredText(iface, munge=0): + """ Output reStructuredText format. + + Note, this will whack any existing 'structured' format of the text.""" + return asStructuredText(iface, munge=munge, rst=True) + + +def _trim_doc_string(text): + """ Trims a doc string to make it format + correctly with structured text. """ + + lines = text.replace('\r\n', '\n').split('\n') + nlines = [lines.pop(0)] + if lines: + min_indent = min([len(line) - len(line.lstrip()) + for line in lines]) + for line in lines: + nlines.append(line[min_indent:]) + + return '\n'.join(nlines) + + +def _justify_and_indent(text, level, munge=0, width=72): + """ indent and justify text, rejustify (munge) if specified """ + + indent = " " * level + + if munge: + lines = [] + line = indent + text = text.split() + + for word in text: + line = ' '.join([line, word]) + if len(line) > width: + lines.append(line) + line = indent + else: + lines.append(line) + + return '\n'.join(lines) + + else: + return indent + \ + text.strip().replace("\r\n", "\n") .replace("\n", "\n" + indent) diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope/interface/exceptions.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope/interface/exceptions.py new file mode 100644 index 0000000000000000000000000000000000000000..b86fb1e04c7c7ab2f2e900c445ed6171c8329c6f --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope/interface/exceptions.py @@ -0,0 +1,278 @@ +############################################################################## +# +# Copyright (c) 2002 Zope Foundation and Contributors. +# All Rights Reserved. +# +# This software is subject to the provisions of the Zope Public License, +# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. +# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED +# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS +# FOR A PARTICULAR PURPOSE. +# +############################################################################## +"""Interface-specific exceptions +""" + +__all__ = [ + # Invalid tree + 'Invalid', + 'DoesNotImplement', + 'BrokenImplementation', + 'BrokenMethodImplementation', + 'MultipleInvalid', + # Other + 'BadImplements', + 'InvalidInterface', +] + + +class Invalid(Exception): + """A specification is violated + """ + + +class _TargetInvalid(Invalid): + # Internal use. Subclass this when you're describing + # a particular target object that's invalid according + # to a specific interface. + # + # For backwards compatibility, the *target* and *interface* are + # optional, and the signatures are inconsistent in their ordering. + # + # We deal with the inconsistency in ordering by defining the index + # of the two values in ``self.args``. *target* uses a marker object to + # distinguish "not given" from "given, but None", because the latter + # can be a value that gets passed to validation. For this reason, it must + # always be the last argument (we detect absence by the ``IndexError``). + + _IX_INTERFACE = 0 + _IX_TARGET = 1 + # The exception to catch when indexing self.args indicating that + # an argument was not given. If all arguments are expected, + # a subclass should set this to (). + _NOT_GIVEN_CATCH = IndexError + _NOT_GIVEN = '' + + def _get_arg_or_default(self, ix, default=None): + try: + return self.args[ix] # pylint:disable=unsubscriptable-object + except self._NOT_GIVEN_CATCH: + return default + + @property + def interface(self): + return self._get_arg_or_default(self._IX_INTERFACE) + + @property + def target(self): + return self._get_arg_or_default(self._IX_TARGET, self._NOT_GIVEN) + + ### + # str + # + # The ``__str__`` of self is implemented by concatenating (%s), in order, + # these properties (none of which should have leading or trailing + # whitespace): + # + # - self._str_subject + # Begin the message, including a description of the target. + # - self._str_description + # Provide a general description of the type of error, including + # the interface name if possible and relevant. + # - self._str_conjunction + # Join the description to the details. Defaults to ": ". + # - self._str_details + # Provide details about how this particular instance of the error. + # - self._str_trailer + # End the message. Usually just a period. + ### + + @property + def _str_subject(self): + target = self.target + if target is self._NOT_GIVEN: + return "An object" + return f"The object {target!r}" + + @property + def _str_description(self): + return "has failed to implement interface %s" % ( + self.interface or '' + ) + + _str_conjunction = ": " + _str_details = "" + _str_trailer = '.' + + def __str__(self): + return "{} {}{}{}{}".format( + self._str_subject, + self._str_description, + self._str_conjunction, + self._str_details, + self._str_trailer + ) + + +class DoesNotImplement(_TargetInvalid): + """ + DoesNotImplement(interface[, target]) + + The *target* (optional) does not implement the *interface*. + + .. versionchanged:: 5.0.0 + Add the *target* argument and attribute, and change the resulting + string value of this object accordingly. + """ + + _str_details = "Does not declaratively implement the interface" + + +class BrokenImplementation(_TargetInvalid): + """ + BrokenImplementation(interface, name[, target]) + + The *target* (optional) is missing the attribute *name*. + + .. versionchanged:: 5.0.0 + Add the *target* argument and attribute, and change the resulting + string value of this object accordingly. + + The *name* can either be a simple string or a ``Attribute`` object. + """ + + _IX_NAME = _TargetInvalid._IX_INTERFACE + 1 + _IX_TARGET = _IX_NAME + 1 + + @property + def name(self): + return self.args[1] # pylint:disable=unsubscriptable-object + + @property + def _str_details(self): + return "The %s attribute was not provided" % ( + repr(self.name) if isinstance(self.name, str) else self.name + ) + + +class BrokenMethodImplementation(_TargetInvalid): + """ + BrokenMethodImplementation( + method, message[, implementation, interface, target] + ) + + The *target* (optional) has a *method* in *implementation* that violates + its contract in a way described by *mess*. + + .. versionchanged:: 5.0.0 + Add the *interface* and *target* argument and attribute, + and change the resulting string value of this object accordingly. + + The *method* can either be a simple string or a ``Method`` object. + + .. versionchanged:: 5.0.0 + If *implementation* is given, then the *message* will have the + string "implementation" replaced with an short but informative + representation of *implementation*. + + """ + + _IX_IMPL = 2 + _IX_INTERFACE = _IX_IMPL + 1 + _IX_TARGET = _IX_INTERFACE + 1 + + @property + def method(self): + return self.args[0] # pylint:disable=unsubscriptable-object + + @property + def mess(self): + return self.args[1] # pylint:disable=unsubscriptable-object + + @staticmethod + def __implementation_str(impl): + # It could be a callable or some arbitrary object, we don't + # know yet. + import inspect # Inspect is a heavy-weight dependency, lots of imports + try: + sig = inspect.signature + formatsig = str + except AttributeError: + sig = inspect.getargspec + formatsig = inspect.formatargspec + + try: + sig = sig(impl) + except (ValueError, TypeError): + # Unable to introspect. Darn. + # This could be a non-callable, or a particular builtin, + # or a bound method that doesn't even accept 'self', e.g., + # ``Class.method = lambda: None; Class().method`` + return repr(impl) + + try: + name = impl.__qualname__ + except AttributeError: + name = impl.__name__ + + return name + formatsig(sig) + + @property + def _str_details(self): + impl = self._get_arg_or_default(self._IX_IMPL, self._NOT_GIVEN) + message = self.mess + if impl is not self._NOT_GIVEN and 'implementation' in message: + message = message.replace("implementation", '%r') + message = message % (self.__implementation_str(impl),) + + return 'The contract of {} is violated because {}'.format( + repr(self.method) if isinstance(self.method, str) else self.method, + message, + ) + + +class MultipleInvalid(_TargetInvalid): + """ + The *target* has failed to implement the *interface* in + multiple ways. + + The failures are described by *exceptions*, a collection of + other `Invalid` instances. + + .. versionadded:: 5.0 + """ + + _NOT_GIVEN_CATCH = () + + def __init__(self, interface, target, exceptions): + super().__init__(interface, target, tuple(exceptions)) + + @property + def exceptions(self): + return self.args[2] # pylint:disable=unsubscriptable-object + + @property + def _str_details(self): + # It would be nice to use tabs here, but that + # is hard to represent in doctests. + return '\n ' + '\n '.join( + x._str_details.strip() if isinstance(x, _TargetInvalid) else str(x) + for x in self.exceptions + ) + + _str_conjunction = ':' # no trailing space, messes up doctests + _str_trailer = '' + + +class InvalidInterface(Exception): + """The interface has invalid contents + """ + + +class BadImplements(TypeError): + """An implementation assertion is invalid + + because it doesn't contain an interface or a sequence of valid + implementation assertions. + """ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope/interface/interface.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope/interface/interface.py new file mode 100644 index 0000000000000000000000000000000000000000..1ce44e0f5d3fafdd023aff08028120856e70a3b3 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope/interface/interface.py @@ -0,0 +1,1187 @@ +############################################################################## +# +# Copyright (c) 2001, 2002 Zope Foundation and Contributors. +# All Rights Reserved. +# +# This software is subject to the provisions of the Zope Public License, +# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. +# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED +# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS +# FOR A PARTICULAR PURPOSE. +# +############################################################################## +"""Interface object implementation +""" +# pylint:disable=protected-access +import sys +import weakref +from types import FunctionType +from types import MethodType +from typing import Union + +from zope.interface import ro +from zope.interface._compat import _use_c_impl +from zope.interface.exceptions import Invalid +from zope.interface.ro import ro as calculate_ro + + +__all__ = [ + # Most of the public API from this module is directly exported + # from zope.interface. The only remaining public API intended to + # be imported from here should be those few things documented as + # such. + 'InterfaceClass', + 'Specification', + 'adapter_hooks', +] + +CO_VARARGS = 4 +CO_VARKEYWORDS = 8 +# Put in the attrs dict of an interface by ``taggedValue`` and ``invariants`` +TAGGED_DATA = '__interface_tagged_values__' +# Put in the attrs dict of an interface by ``interfacemethod`` +INTERFACE_METHODS = '__interface_methods__' + +_decorator_non_return = object() +_marker = object() + + +def invariant(call): + f_locals = sys._getframe(1).f_locals + tags = f_locals.setdefault(TAGGED_DATA, {}) + invariants = tags.setdefault('invariants', []) + invariants.append(call) + return _decorator_non_return + + +def taggedValue(key, value): + """Attaches a tagged value to an interface at definition time.""" + f_locals = sys._getframe(1).f_locals + tagged_values = f_locals.setdefault(TAGGED_DATA, {}) + tagged_values[key] = value + return _decorator_non_return + + +class Element: + """ + Default implementation of `zope.interface.interfaces.IElement`. + """ + + # We can't say this yet because we don't have enough + # infrastructure in place. + # + # implements(IElement) + + def __init__( + self, __name__, __doc__='', + ): # pylint:disable=redefined-builtin + if not __doc__ and __name__.find(' ') >= 0: + __doc__ = __name__ + __name__ = None + + self.__name__ = __name__ + self.__doc__ = __doc__ + # Tagged values are rare, especially on methods or attributes. + # Deferring the allocation can save substantial memory. + self.__tagged_values = None + + def getName(self): + """ Returns the name of the object. """ + return self.__name__ + + def getDoc(self): + """ Returns the documentation for the object. """ + return self.__doc__ + + ### + # Tagged values. + # + # Direct tagged values are set only in this instance. Others + # may be inherited (for those subclasses that have that concept). + ### + + def getTaggedValue(self, tag): + """ Returns the value associated with 'tag'. """ + if not self.__tagged_values: + raise KeyError(tag) + return self.__tagged_values[tag] + + def queryTaggedValue(self, tag, default=None): + """ Returns the value associated with 'tag'. """ + return self.__tagged_values.get( + tag, default, + ) if self.__tagged_values else default + + def getTaggedValueTags(self): + """ Returns a collection of all tags. """ + return self.__tagged_values.keys() if self.__tagged_values else () + + def setTaggedValue(self, tag, value): + """ Associates 'value' with 'key'. """ + if self.__tagged_values is None: + self.__tagged_values = {} + self.__tagged_values[tag] = value + + queryDirectTaggedValue = queryTaggedValue + getDirectTaggedValue = getTaggedValue + getDirectTaggedValueTags = getTaggedValueTags + + +SpecificationBasePy = object # filled by _use_c_impl. + + +@_use_c_impl +class SpecificationBase: + # This object is the base of the inheritance hierarchy for ClassProvides: + # + # ClassProvides < ClassProvidesBase, Declaration + # Declaration < Specification < SpecificationBase + # ClassProvidesBase < SpecificationBase + # + # In order to have compatible instance layouts, we need to declare + # the storage used by Specification and Declaration here (and + # those classes must have ``__slots__ = ()``); fortunately this is + # not a waste of space because those are the only two inheritance + # trees. These all translate into tp_members in C. + __slots__ = ( + # Things used here. + '_implied', + # Things used in Specification. + '_dependents', + '_bases', + '_v_attrs', + '__iro__', + '__sro__', + '__weakref__', + ) + + def providedBy(self, ob): + """Is the interface implemented by an object + """ + spec = providedBy(ob) + return self in spec._implied + + def implementedBy(self, cls): + """Test whether the specification is implemented by a class or factory. + + Raise TypeError if argument is neither a class nor a callable. + """ + spec = implementedBy(cls) + return self in spec._implied + + def isOrExtends(self, interface): + """Is the interface the same as or extend the given interface + """ + return interface in self._implied # pylint:disable=no-member + + __call__ = isOrExtends + + +class NameAndModuleComparisonMixin: + # Internal use. Implement the basic sorting operators (but not (in)equality + # or hashing). Subclasses must provide ``__name__`` and ``__module__`` + # attributes. Subclasses will be mutually comparable; but because equality + # and hashing semantics are missing from this class, take care in how + # you define those two attributes: If you stick with the default equality + # and hashing (identity based) you should make sure that all possible + # ``__name__`` and ``__module__`` pairs are unique ACROSS ALL SUBCLASSES. + # (Actually, pretty much the same thing goes if you define equality and + # hashing to be based on those two attributes: they must still be + # consistent ACROSS ALL SUBCLASSES.) + + # pylint:disable=assigning-non-slot + __slots__ = () + + def _compare(self, other): + """ + Compare *self* to *other* based on ``__name__`` and ``__module__``. + + Return 0 if they are equal, return 1 if *self* is + greater than *other*, and return -1 if *self* is less than + *other*. + + If *other* does not have ``__name__`` or ``__module__``, then + return ``NotImplemented``. + + .. caution:: + This allows comparison to things well outside the type hierarchy, + perhaps not symmetrically. + + For example, ``class Foo(object)`` and ``class Foo(Interface)`` + in the same file would compare equal, depending on the order of + operands. Writing code like this by hand would be unusual, but it + could happen with dynamic creation of types and interfaces. + + None is treated as a pseudo interface that implies the loosest + contact possible, no contract. For that reason, all interfaces + sort before None. + """ + if other is self: + return 0 + + if other is None: + return -1 + + n1 = (self.__name__, self.__module__) + try: + n2 = (other.__name__, other.__module__) + except AttributeError: + return NotImplemented + + # This spelling works under Python3, which doesn't have cmp(). + return (n1 > n2) - (n1 < n2) + + def __lt__(self, other): + c = self._compare(other) + if c is NotImplemented: + return c + return c < 0 + + def __le__(self, other): + c = self._compare(other) + if c is NotImplemented: + return c + return c <= 0 + + def __gt__(self, other): + c = self._compare(other) + if c is NotImplemented: + return c + return c > 0 + + def __ge__(self, other): + c = self._compare(other) + if c is NotImplemented: + return c + return c >= 0 + + +@_use_c_impl +class InterfaceBase(NameAndModuleComparisonMixin, SpecificationBasePy): + """Base class that wants to be replaced with a C base :) + """ + + __slots__ = ( + '__name__', + '__ibmodule__', + '_v_cached_hash', + ) + + def __init__(self, name=None, module=None): + self.__name__ = name + self.__ibmodule__ = module + + def _call_conform(self, conform): + raise NotImplementedError + + @property + def __module_property__(self): + # This is for _InterfaceMetaClass + return self.__ibmodule__ + + def __call__(self, obj, alternate=_marker): + """Adapt an object to the interface + """ + try: + conform = obj.__conform__ + except AttributeError: + conform = None + + if conform is not None: + adapter = self._call_conform(conform) + if adapter is not None: + return adapter + + adapter = self.__adapt__(obj) + + if adapter is not None: + return adapter + if alternate is not _marker: + return alternate + raise TypeError("Could not adapt", obj, self) + + def __adapt__(self, obj): + """Adapt an object to the receiver + """ + if self.providedBy(obj): + return obj + + for hook in adapter_hooks: + adapter = hook(self, obj) + if adapter is not None: + return adapter + + return None + + def __hash__(self): + # pylint:disable=assigning-non-slot,attribute-defined-outside-init + try: + return self._v_cached_hash + except AttributeError: + self._v_cached_hash = hash((self.__name__, self.__module__)) + return self._v_cached_hash + + def __eq__(self, other): + c = self._compare(other) + if c is NotImplemented: + return c + return c == 0 + + def __ne__(self, other): + if other is self: + return False + + c = self._compare(other) + if c is NotImplemented: + return c + return c != 0 + + +adapter_hooks = _use_c_impl([], 'adapter_hooks') + + +class Specification(SpecificationBase): + """Specifications + + An interface specification is used to track interface declarations + and component registrations. + + This class is a base class for both interfaces themselves and for + interface specifications (declarations). + + Specifications are mutable. If you reassign their bases, their + relations with other specifications are adjusted accordingly. + """ + __slots__ = () + + # The root of all Specifications. This will be assigned `Interface`, + # once it is defined. + _ROOT = None + + # Copy some base class methods for speed + isOrExtends = SpecificationBase.isOrExtends + providedBy = SpecificationBase.providedBy + + def __init__(self, bases=()): + # There are many leaf interfaces with no dependents, + # and a few with very many. It's a heavily left-skewed + # distribution. In a survey of Plone and Zope related packages + # that loaded 2245 InterfaceClass objects and 2235 ClassProvides + # instances, there were a total of 7000 Specification objects created. + # 4700 had 0 dependents, 1400 had 1, 382 had 2 and so on. Only one + # for had 1664. So there's savings to be had deferring + # the creation of dependents. + self._dependents = None # type: weakref.WeakKeyDictionary + self._bases = () + self._implied = {} + self._v_attrs = None + self.__iro__ = () + self.__sro__ = () + + self.__bases__ = tuple(bases) + + @property + def dependents(self): + if self._dependents is None: + self._dependents = weakref.WeakKeyDictionary() + return self._dependents + + def subscribe(self, dependent): + self._dependents[dependent] = self.dependents.get(dependent, 0) + 1 + + def unsubscribe(self, dependent): + try: + n = self._dependents[dependent] + except TypeError: + raise KeyError(dependent) + n -= 1 + if not n: + del self.dependents[dependent] + else: + assert n > 0 + self.dependents[dependent] = n + + def __setBases(self, bases): + # Remove ourselves as a dependent of our old bases + for b in self.__bases__: + b.unsubscribe(self) + + # Register ourselves as a dependent of our new bases + self._bases = bases + for b in bases: + b.subscribe(self) + + self.changed(self) + + __bases__ = property( + lambda self: self._bases, __setBases, + ) + + # This method exists for tests to override the way we call + # ro.calculate_ro(), usually by adding extra kwargs. We don't + # want to have a mutable dictionary as a class member that we pass + # ourself because mutability is bad, and passing **kw is slower than + # calling the bound function. + _do_calculate_ro = calculate_ro + + def _calculate_sro(self): + """Compute resolution order for this object using its ``__bases__``. + + Ensures that ``Interface`` is always the last (lowest priority) + element. + """ + # We'd like to make Interface the lowest priority as a property of the + # resolution order algorithm. That almost works out naturally, but it + # fails when class inheritance has some bases that DO implement an + # interface, and some that DO NOT. In such a mixed scenario, you wind + # up with a set of bases to consider that look like this: [[..., + # Interface], [..., object], ...]. Depending on the order of + # inheritance, Interface can wind up before or after object, and that + # can happen at any point in the tree, meaning Interface can wind up + # somewhere in the middle of the order. Since Interface is treated as + # something that everything winds up implementing anyway (a catch-all + # for things like adapters), having it high up the order is bad. It's + # also bad to have it at the end, just before some concrete class: + # concrete classes should be HIGHER priority than interfaces (because + # there's only one class, but many implementations). + # + # One technically nice way to fix this would be to have + # ``implementedBy(object).__bases__ = (Interface,)`` + # + # But: (1) That fails for old-style classes and (2) that causes + # everything to appear to *explicitly* implement Interface, when up + # to this point it's been an implicit virtual sort of relationship. + # + # So we force the issue by mutating the resolution order. + + # Note that we let C3 use pre-computed __sro__ for our bases. + # This requires that by the time this method is invoked, our bases + # have settled their SROs. Thus, ``changed()`` must first + # update itself before telling its descendents of changes. + sro = self._do_calculate_ro(base_mros={ + b: b.__sro__ + for b in self.__bases__ + }) + root = self._ROOT + if root is not None and sro and sro[-1] is not root: + # In one dataset of 1823 Interface objects, 1117 ClassProvides + # objects, sro[-1] was root 4496 times, and only not root 118 + # times. So it's probably worth checking. + + # Once we don't have to deal with old-style classes, + # we can add a check and only do this if base_count > 1, + # if we tweak the bootstrapping for ```` + sro = [ + x + for x in sro + if x is not root + ] + sro.append(root) + + return sro + + def changed(self, originally_changed): + """ + We, or something we depend on, have changed. + + By the time this is called, the things we depend on, + such as our bases, should themselves be stable. + """ + self._v_attrs = None + + implied = self._implied + implied.clear() + + ancestors = self._calculate_sro() + self.__sro__ = tuple(ancestors) + self.__iro__ = tuple([ancestor for ancestor in ancestors + if isinstance(ancestor, InterfaceClass) + ]) + + for ancestor in ancestors: + # We directly imply our ancestors: + implied[ancestor] = () + + # Now, advise our dependents of change + # (being careful not to create the WeakKeyDictionary if not needed): + for dependent in tuple( + self._dependents.keys() if self._dependents else () + ): + dependent.changed(originally_changed) + + # Just in case something called get() at some point + # during that process and we have a cycle of some sort + # make sure we didn't cache incomplete results. + self._v_attrs = None + + def interfaces(self): + """Return an iterator for the interfaces in the specification. + """ + seen = {} + for base in self.__bases__: + for interface in base.interfaces(): + if interface not in seen: + seen[interface] = 1 + yield interface + + def extends(self, interface, strict=True): + """Does the specification extend the given interface? + + Test whether an interface in the specification extends the + given interface + """ + return ( + (interface in self._implied) and ( + (not strict) or (self != interface) + ) + ) + + def weakref(self, callback=None): + return weakref.ref(self, callback) + + def get(self, name, default=None): + """Query for an attribute description + """ + attrs = self._v_attrs + if attrs is None: + attrs = self._v_attrs = {} + attr = attrs.get(name) + if attr is None: + for iface in self.__iro__: + attr = iface.direct(name) + if attr is not None: + attrs[name] = attr + break + + return default if attr is None else attr + + +class _InterfaceMetaClass(type): + # Handling ``__module__`` on ``InterfaceClass`` is tricky. We need to be + # able to read it on a type and get the expected string. We also need to + # be able to set it on an instance and get the value we set. So far so + # good. But what gets tricky is that we'd like to store the value in the C + # structure (``InterfaceBase.__ibmodule__``) for direct access during + # equality, sorting, and hashing. "No problem, you think, I'll just use a + # property" (well, the C equivalents, ``PyMemberDef`` or ``PyGetSetDef``). + # + # Except there is a problem. When a subclass is created, the + # metaclass (``type``) always automatically puts the expected + # string in the class's dictionary under ``__module__``, thus + # overriding the property inherited from the superclass. Writing + # ``Subclass.__module__`` still works, but + # ``Subclass().__module__`` fails. + # + # There are multiple ways to work around this: + # + # (1) Define ``InterfaceBase.__getattribute__`` to watch for + # ``__module__`` and return the C storage. + # + # This works, but slows down *all* attribute access (except, + # ironically, to ``__module__``) by about 25% (40ns becomes 50ns) + # (when implemented in C). Since that includes methods like + # ``providedBy``, that's probably not acceptable. + # + # All the other methods involve modifying subclasses. This can be done + # either on the fly in some cases, as instances are constructed, or by + # using a metaclass. These next few can be done on the fly. + # + # (2) Make ``__module__`` a descriptor in each subclass dictionary. It + # can't be a straight up ``@property`` descriptor, though, because + # accessing it on the class returns a ``property`` object, not the desired + # string. + # + # (3) Implement a data descriptor (``__get__`` and ``__set__``) + # that is both a subclass of string, and also does the redirect of + # ``__module__`` to ``__ibmodule__`` and does the correct thing + # with the ``instance`` argument to ``__get__`` is None (returns + # the class's value.) (Why must it be a subclass of string? Because + # when it' s in the class's dict, it's defined on an *instance* of the + # metaclass; descriptors in an instance's dict aren't honored --- their + # ``__get__`` is never invoked --- so it must also *be* the value we want + # returned.) + # + # This works, preserves the ability to read and write + # ``__module__``, and eliminates any penalty accessing other + # attributes. But it slows down accessing ``__module__`` of + # instances by 200% (40ns to 124ns), requires editing class dicts on the + # fly (in InterfaceClass.__init__), thus slightly slowing down all + # interface creation, and is ugly. + # + # (4) As in the last step, but make it a non-data descriptor (no + # ``__set__``). + # + # If you then *also* store a copy of ``__ibmodule__`` in + # ``__module__`` in the instance's dict, reading works for both + # class and instance and is full speed for instances. But the cost + # is storage space, and you can't write to it anymore, not without + # things getting out of sync. + # + # (Actually, ``__module__`` was never meant to be writable. Doing + # so would break BTrees and normal dictionaries, as well as the + # repr, maybe more.) + # + # That leaves us with a metaclass. (Recall that a class is an + # instance of its metaclass, so properties/descriptors defined in + # the metaclass are used when accessing attributes on the + # instance/class. We'll use that to define ``__module__``.) Here + # we can have our cake and eat it too: no extra storage, and + # C-speed access to the underlying storage. The only substantial + # cost is that metaclasses tend to make people's heads hurt. (But + # still less than the descriptor-is-string, hopefully.) + + __slots__ = () + + def __new__(cls, name, bases, attrs): + # Figure out what module defined the interface. + # This is copied from ``InterfaceClass.__init__``; + # reviewers aren't sure how AttributeError or KeyError + # could be raised. + __module__ = sys._getframe(1).f_globals['__name__'] + # Get the C optimized __module__ accessor and give it + # to the new class. + moduledescr = InterfaceBase.__dict__['__module__'] + if isinstance(moduledescr, str): + # We're working with the Python implementation, + # not the C version + moduledescr = InterfaceBase.__dict__['__module_property__'] + attrs['__module__'] = moduledescr + kind = type.__new__(cls, name, bases, attrs) + kind.__module = __module__ + return kind + + @property + def __module__(cls): + return cls.__module + + def __repr__(cls): + return "".format( + cls.__module, + cls.__name__, + ) + + +_InterfaceClassBase = _InterfaceMetaClass( + 'InterfaceClass', + # From least specific to most specific. + (InterfaceBase, Specification, Element), + {'__slots__': ()} +) + + +def interfacemethod(func): + """ + Convert a method specification to an actual method of the interface. + + This is a decorator that functions like `staticmethod` et al. + + The primary use of this decorator is to allow interface definitions to + define the ``__adapt__`` method, but other interface methods can be + overridden this way too. + + .. seealso:: + `zope.interface.interfaces.IInterfaceDeclaration.interfacemethod` + """ + f_locals = sys._getframe(1).f_locals + methods = f_locals.setdefault(INTERFACE_METHODS, {}) + methods[func.__name__] = func + return _decorator_non_return + + +class InterfaceClass(_InterfaceClassBase): + """ + Prototype (scarecrow) Interfaces Implementation. + + Note that it is not possible to change the ``__name__`` or ``__module__`` + after an instance of this object has been constructed. + """ + + # We can't say this yet because we don't have enough + # infrastructure in place. + # + # implements(IInterface) + + def __new__( + cls, + name=None, + bases=(), + attrs=None, + __doc__=None, # pylint:disable=redefined-builtin + __module__=None, + ): + assert isinstance(bases, tuple) + attrs = attrs or {} + needs_custom_class = attrs.pop(INTERFACE_METHODS, None) + if needs_custom_class: + needs_custom_class.update( + {'__classcell__': attrs.pop('__classcell__')} + if '__classcell__' in attrs + else {} + ) + if '__adapt__' in needs_custom_class: + # We need to tell the C code to call this. + needs_custom_class['_CALL_CUSTOM_ADAPT'] = 1 + + if issubclass(cls, _InterfaceClassWithCustomMethods): + cls_bases = (cls,) + elif cls is InterfaceClass: + cls_bases = (_InterfaceClassWithCustomMethods,) + else: + cls_bases = (cls, _InterfaceClassWithCustomMethods) + + cls = type(cls)( # pylint:disable=self-cls-assignment + name + "", + cls_bases, + needs_custom_class + ) + + return _InterfaceClassBase.__new__(cls) + + def __init__( + self, + name, + bases=(), + attrs=None, + __doc__=None, # pylint:disable=redefined-builtin + __module__=None, + ): + # We don't call our metaclass parent directly + # pylint:disable=non-parent-init-called + # pylint:disable=super-init-not-called + if not all(isinstance(base, InterfaceClass) for base in bases): + raise TypeError('Expected base interfaces') + + if attrs is None: + attrs = {} + + if __module__ is None: + __module__ = attrs.get('__module__') + if isinstance(__module__, str): + del attrs['__module__'] + else: + try: + # Figure out what module defined the interface. + # This is how cPython figures out the module of + # a class, but of course it does it in C. :-/ + __module__ = sys._getframe(1).f_globals['__name__'] + except (AttributeError, KeyError): # pragma: no cover + pass + + InterfaceBase.__init__(self, name, __module__) + # These asserts assisted debugging the metaclass + # assert '__module__' not in self.__dict__ + # assert self.__ibmodule__ is self.__module__ is __module__ + + d = attrs.get('__doc__') + if d is not None: + if not isinstance(d, Attribute): + if __doc__ is None: + __doc__ = d + del attrs['__doc__'] + + if __doc__ is None: + __doc__ = '' + + Element.__init__(self, name, __doc__) + + tagged_data = attrs.pop(TAGGED_DATA, None) + if tagged_data is not None: + for key, val in tagged_data.items(): + self.setTaggedValue(key, val) + + Specification.__init__(self, bases) + self.__attrs = self.__compute_attrs(attrs) + + self.__identifier__ = f"{__module__}.{name}" + + def __compute_attrs(self, attrs): + # Make sure that all recorded attributes (and methods) are of type + # `Attribute` and `Method` + def update_value(aname, aval): + if isinstance(aval, Attribute): + aval.interface = self + if not aval.__name__: + aval.__name__ = aname + elif isinstance(aval, FunctionType): + aval = fromFunction(aval, self, name=aname) + else: + raise InvalidInterface("Concrete attribute, " + aname) + return aval + + return { + aname: update_value(aname, aval) + for aname, aval in attrs.items() + if aname not in ( + # __locals__: Python 3 sometimes adds this. + '__locals__', + # __qualname__: PEP 3155 (Python 3.3+) + '__qualname__', + # __annotations__: PEP 3107 (Python 3.0+) + '__annotations__', + # __static_attributes__: Python 3.13a6+ + # https://github.com/python/cpython/pull/115913 + '__static_attributes__', + # __firstlineno__: Python 3.13b1+ + # https://github.com/python/cpython/pull/118475 + '__firstlineno__', + # __classdictcell__: Python 3.14 + '__classdictcell__', + # __annotate_func__: Python 3.14b1+ + '__annotate_func__', + ) and + aval is not _decorator_non_return # noqa W503 + } + + def interfaces(self): + """Return an iterator for the interfaces in the specification. + """ + yield self + + def getBases(self): + return self.__bases__ + + def isEqualOrExtendedBy(self, other): + """Same interface or extends?""" + return self == other or other.extends(self) + + def names(self, all=False): # pylint:disable=redefined-builtin + """Return the attribute names defined by the interface.""" + if not all: + return self.__attrs.keys() + + r = self.__attrs.copy() + + for base in self.__bases__: + r.update(dict.fromkeys(base.names(all))) + + return r.keys() + + def __iter__(self): + return iter(self.names(all=True)) + + def namesAndDescriptions( + self, all=False # pylint:disable=redefined-builtin + ): + """Return attribute names and descriptions defined by interface.""" + if not all: + return self.__attrs.items() + + r = {} + for base in self.__bases__[::-1]: + r.update(dict(base.namesAndDescriptions(all))) + + r.update(self.__attrs) + + return r.items() + + def getDescriptionFor(self, name): + """Return the attribute description for the given name.""" + r = self.get(name) + if r is not None: + return r + + raise KeyError(name) + + __getitem__ = getDescriptionFor + + def __contains__(self, name): + return self.get(name) is not None + + def direct(self, name): + return self.__attrs.get(name) + + def queryDescriptionFor(self, name, default=None): + return self.get(name, default) + + def validateInvariants(self, obj, errors=None): + """validate object to defined invariants.""" + + for iface in self.__iro__: + for invariant in iface.queryDirectTaggedValue('invariants', ()): + try: + invariant(obj) + except Invalid as error: + if errors is not None: + errors.append(error) + else: + raise + + if errors: + raise Invalid(errors) + + def queryTaggedValue(self, tag, default=None): + """ + Queries for the value associated with *tag*, returning it from the + nearest interface in the ``__iro__``. + + If not found, returns *default*. + """ + for iface in self.__iro__: + value = iface.queryDirectTaggedValue(tag, _marker) + if value is not _marker: + return value + return default + + def getTaggedValue(self, tag): + """ Returns the value associated with 'tag'. """ + value = self.queryTaggedValue(tag, default=_marker) + if value is _marker: + raise KeyError(tag) + return value + + def getTaggedValueTags(self): + """ Returns a list of all tags. """ + keys = set() + for base in self.__iro__: + keys.update(base.getDirectTaggedValueTags()) + return keys + + def __repr__(self): + try: + return self._v_repr + except AttributeError: + name = str(self) + r = f"<{self.__class__.__name__} {name}>" + self._v_repr = r # pylint:disable=attribute-defined-outside-init + return r + + def __str__(self): + name = self.__name__ + m = self.__ibmodule__ + if m: + name = f'{m}.{name}' + return name + + def _call_conform(self, conform): + try: + return conform(self) + except TypeError: # pragma: no cover + # We got a TypeError. It might be an error raised by + # the __conform__ implementation, or *we* may have + # made the TypeError by calling an unbound method + # (object is a class). In the later case, we behave + # as though there is no __conform__ method. We can + # detect this case by checking whether there is more + # than one traceback object in the traceback chain: + if sys.exc_info()[2].tb_next is not None: + # There is more than one entry in the chain, so + # reraise the error: + raise + # This clever trick is from Phillip Eby + + return None # pragma: no cover + + def __reduce__(self): + return self.__name__ + + def __or__(self, other): + """Allow type hinting syntax: Interface | None.""" + return Union[self, other] + + def __ror__(self, other): + """Allow type hinting syntax: None | Interface.""" + return Union[other, self] + + +Interface = InterfaceClass("Interface", __module__='zope.interface') +# Interface is the only member of its own SRO. +Interface._calculate_sro = lambda: (Interface,) +Interface.changed(Interface) +assert Interface.__sro__ == (Interface,) +Specification._ROOT = Interface +ro._ROOT = Interface + + +class _InterfaceClassWithCustomMethods(InterfaceClass): + """ + Marker class for interfaces with custom methods that override + InterfaceClass methods. + """ + + +class Attribute(Element): + """Attribute descriptions + """ + + # We can't say this yet because we don't have enough + # infrastructure in place. + # + # implements(IAttribute) + + interface = None + + def _get_str_info(self): + """Return extra data to put at the end of __str__.""" + return "" + + def __str__(self): + of = '' + if self.interface is not None: + of = ( + self.interface.__module__ + + '.' + + self.interface.__name__ + + '.' + ) + # self.__name__ may be None during construction (e.g., debugging) + return of + (self.__name__ or '') + self._get_str_info() + + def __repr__(self): + return "<{}.{} object at 0x{:x} {}>".format( + type(self).__module__, + type(self).__name__, + id(self), + self + ) + + +class Method(Attribute): + """Method interfaces + + The idea here is that you have objects that describe methods. + This provides an opportunity for rich meta-data. + """ + + # We can't say this yet because we don't have enough + # infrastructure in place. + # + # implements(IMethod) + + positional = required = () + _optional = varargs = kwargs = None + + def _get_optional(self): + if self._optional is None: + return {} + return self._optional + + def _set_optional(self, opt): + self._optional = opt + + def _del_optional(self): + self._optional = None + + optional = property(_get_optional, _set_optional, _del_optional) + + def __call__(self, *args, **kw): + raise BrokenImplementation(self.interface, self.__name__) + + def getSignatureInfo(self): + return {'positional': self.positional, + 'required': self.required, + 'optional': self.optional, + 'varargs': self.varargs, + 'kwargs': self.kwargs, + } + + def getSignatureString(self): + sig = [] + for v in self.positional: + sig.append(v) + if v in self.optional.keys(): + sig[-1] += "=" + repr(self.optional[v]) + if self.varargs: + sig.append("*" + self.varargs) + if self.kwargs: + sig.append("**" + self.kwargs) + + return "(%s)" % ", ".join(sig) + + _get_str_info = getSignatureString + + +def fromFunction(func, interface=None, imlevel=0, name=None): + name = name or func.__name__ + method = Method(name, func.__doc__) + defaults = getattr(func, '__defaults__', None) or () + code = func.__code__ + # Number of positional arguments + na = code.co_argcount - imlevel + names = code.co_varnames[imlevel:] + opt = {} + # Number of required arguments + defaults_count = len(defaults) + if not defaults_count: + # PyPy3 uses ``__defaults_count__`` for builtin methods + # like ``dict.pop``. Surprisingly, these don't have recorded + # ``__defaults__`` + defaults_count = getattr(func, '__defaults_count__', 0) + + nr = na - defaults_count + if nr < 0: + defaults = defaults[-nr:] + nr = 0 + + # Determine the optional arguments. + opt.update(dict(zip(names[nr:], defaults))) + + method.positional = names[:na] + method.required = names[:nr] + method.optional = opt + + argno = na + + # Determine the function's variable argument's name (i.e. *args) + if code.co_flags & CO_VARARGS: + method.varargs = names[argno] + argno = argno + 1 + else: + method.varargs = None + + # Determine the function's keyword argument's name (i.e. **kw) + if code.co_flags & CO_VARKEYWORDS: + method.kwargs = names[argno] + else: + method.kwargs = None + + method.interface = interface + + for key, value in func.__dict__.items(): + method.setTaggedValue(key, value) + + return method + + +def fromMethod(meth, interface=None, name=None): + if isinstance(meth, MethodType): + func = meth.__func__ + else: + func = meth + return fromFunction(func, interface, imlevel=1, name=name) + + +# Now we can create the interesting interfaces and wire them up: +def _wire(): + from zope.interface.declarations import classImplements + # From lest specific to most specific. + from zope.interface.interfaces import IElement + classImplements(Element, IElement) + + from zope.interface.interfaces import IAttribute + classImplements(Attribute, IAttribute) + + from zope.interface.interfaces import IMethod + classImplements(Method, IMethod) + + from zope.interface.interfaces import ISpecification + classImplements(Specification, ISpecification) + + from zope.interface.interfaces import IInterface + classImplements(InterfaceClass, IInterface) + + +# We import this here to deal with module dependencies. +# pylint:disable=wrong-import-position +from zope.interface.declarations import implementedBy +from zope.interface.declarations import providedBy +from zope.interface.exceptions import BrokenImplementation +from zope.interface.exceptions import InvalidInterface + + +# This ensures that ``Interface`` winds up in the flattened() +# list of the immutable declaration. It correctly overrides changed() +# as a no-op, so we bypass that. +# pylint:disable=wrong-import-position +from zope.interface.declarations import _empty # isort: skip +Specification.changed(_empty, _empty) diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope/interface/interfaces.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope/interface/interfaces.py new file mode 100644 index 0000000000000000000000000000000000000000..9bafeb58428a8176559fe0cd83c5b56cf7dd58c9 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope/interface/interfaces.py @@ -0,0 +1,1516 @@ +############################################################################## +# +# Copyright (c) 2002 Zope Foundation and Contributors. +# All Rights Reserved. +# +# This software is subject to the provisions of the Zope Public License, +# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. +# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED +# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS +# FOR A PARTICULAR PURPOSE. +# +############################################################################## +"""Interface Package Interfaces +""" +__docformat__ = 'restructuredtext' + +from zope.interface.declarations import implementer +from zope.interface.interface import Attribute +from zope.interface.interface import Interface + + +__all__ = [ + 'ComponentLookupError', + 'IAdapterRegistration', + 'IAdapterRegistry', + 'IAttribute', + 'IComponentLookup', + 'IComponentRegistry', + 'IComponents', + 'IDeclaration', + 'IElement', + 'IHandlerRegistration', + 'IInterface', + 'IInterfaceDeclaration', + 'IMethod', + 'Invalid', + 'IObjectEvent', + 'IRegistered', + 'IRegistration', + 'IRegistrationEvent', + 'ISpecification', + 'ISubscriptionAdapterRegistration', + 'IUnregistered', + 'IUtilityRegistration', + 'ObjectEvent', + 'Registered', + 'Unregistered', +] + +# pylint:disable=inherit-non-class,no-method-argument,no-self-argument +# pylint:disable=unexpected-special-method-signature +# pylint:disable=too-many-lines + + +class IElement(Interface): + """ + Objects that have basic documentation and tagged values. + + Known derivatives include :class:`IAttribute` and its derivative + :class:`IMethod`; these have no notion of inheritance. + :class:`IInterface` is also a derivative, and it does have a + notion of inheritance, expressed through its ``__bases__`` and + ordered in its ``__iro__`` (both defined by + :class:`ISpecification`). + """ + + # pylint:disable=arguments-differ + + # Note that defining __doc__ as an Attribute hides the docstring + # from introspection. When changing it, also change it in the Sphinx + # ReST files. + + __name__ = Attribute('__name__', 'The object name') + __doc__ = Attribute('__doc__', 'The object doc string') + + ### + # Tagged values. + # + # Direct values are established in this instance. Others may be + # inherited. Although ``IElement`` itself doesn't have a notion of + # inheritance, ``IInterface`` *does*. It might have been better to + # make ``IInterface`` define new methods + # ``getIndirectTaggedValue``, etc, to include inheritance instead + # of overriding ``getTaggedValue`` to do that, but that ship has sailed. + # So to keep things nice and symmetric, we define the ``Direct`` methods + # here. + ### + + def getTaggedValue(tag): + """Returns the value associated with *tag*. + + Raise a `KeyError` if the tag isn't set. + + If the object has a notion of inheritance, this searches + through the inheritance hierarchy and returns the nearest result. + If there is no such notion, this looks only at this object. + + .. versionchanged:: 4.7.0 + This method should respect inheritance if present. + """ + + def queryTaggedValue(tag, default=None): + """ + As for `getTaggedValue`, but instead of raising a `KeyError`, returns + *default*. + + + .. versionchanged:: 4.7.0 + This method should respect inheritance if present. + """ + + def getTaggedValueTags(): + """ + Returns a collection of all tags in no particular order. + + If the object has a notion of inheritance, this + includes all the inherited tagged values. If there is + no such notion, this looks only at this object. + + .. versionchanged:: 4.7.0 + This method should respect inheritance if present. + """ + + def setTaggedValue(tag, value): + """ + Associates *value* with *key* directly in this object. + """ + + def getDirectTaggedValue(tag): + """ + As for `getTaggedValue`, but never includes inheritance. + + .. versionadded:: 5.0.0 + """ + + def queryDirectTaggedValue(tag, default=None): + """ + As for `queryTaggedValue`, but never includes inheritance. + + .. versionadded:: 5.0.0 + """ + + def getDirectTaggedValueTags(): + """ + As for `getTaggedValueTags`, but includes only tags directly + set on this object. + + .. versionadded:: 5.0.0 + """ + + +class IAttribute(IElement): + """Attribute descriptors""" + + interface = Attribute('interface', + 'Stores the interface instance in which the ' + 'attribute is located.') + + +class IMethod(IAttribute): + """Method attributes""" + + def getSignatureInfo(): + """Returns the signature information. + + This method returns a dictionary with the following string keys: + + - positional + A sequence of the names of positional arguments. + - required + A sequence of the names of required arguments. + - optional + A dictionary mapping argument names to their default values. + - varargs + The name of the varargs argument (or None). + - kwargs + The name of the kwargs argument (or None). + """ + + def getSignatureString(): + """Return a signature string suitable for inclusion in documentation. + + This method returns the function signature string. For example, if you + have ``def func(a, b, c=1, d='f')``, then the signature string is + ``"(a, b, c=1, d='f')"``. + """ + + +class ISpecification(Interface): + """Object Behavioral specifications""" + # pylint:disable=arguments-differ + def providedBy(object): # pylint:disable=redefined-builtin + """Test whether the interface is implemented by the object + + Return true of the object asserts that it implements the + interface, including asserting that it implements an extended + interface. + """ + + def implementedBy(class_): + """Test whether the interface is implemented by instances of the class + + Return true of the class asserts that its instances implement the + interface, including asserting that they implement an extended + interface. + """ + + def isOrExtends(other): + """Test whether the specification is or extends another + """ + + def extends(other, strict=True): + """Test whether a specification extends another + + The specification extends other if it has other as a base + interface or if one of it's bases extends other. + + If strict is false, then the specification extends itself. + """ + + def weakref(callback=None): + """Return a weakref to the specification + + This method is, regrettably, needed to allow weakrefs to be + computed to security-proxied specifications. While the + zope.interface package does not require zope.security or + zope.proxy, it has to be able to coexist with it. + + """ + + __bases__ = Attribute("""Base specifications + + A tuple of specifications from which this specification is + directly derived. + + """) + + __sro__ = Attribute("""Specification-resolution order + + A tuple of the specification and all of it's ancestor + specifications from most specific to least specific. The specification + itself is the first element. + + (This is similar to the method-resolution order for new-style classes.) + """) + + __iro__ = Attribute("""Interface-resolution order + + A tuple of the specification's ancestor interfaces from + most specific to least specific. The specification itself is + included if it is an interface. + + (This is similar to the method-resolution order for new-style classes.) + """) + + def get(name, default=None): + """Look up the description for a name + + If the named attribute is not defined, the default is + returned. + """ + + +class IInterface(ISpecification, IElement): + """Interface objects + + Interface objects describe the behavior of an object by containing + useful information about the object. This information includes: + + - Prose documentation about the object. In Python terms, this + is called the "doc string" of the interface. In this element, + you describe how the object works in prose language and any + other useful information about the object. + + - Descriptions of attributes. Attribute descriptions include + the name of the attribute and prose documentation describing + the attributes usage. + + - Descriptions of methods. Method descriptions can include: + + - Prose "doc string" documentation about the method and its + usage. + + - A description of the methods arguments; how many arguments + are expected, optional arguments and their default values, + the position or arguments in the signature, whether the + method accepts arbitrary arguments and whether the method + accepts arbitrary keyword arguments. + + - Optional tagged data. Interface objects (and their attributes and + methods) can have optional, application specific tagged data + associated with them. Examples uses for this are examples, + security assertions, pre/post conditions, and other possible + information you may want to associate with an Interface or its + attributes. + + Not all of this information is mandatory. For example, you may + only want the methods of your interface to have prose + documentation and not describe the arguments of the method in + exact detail. Interface objects are flexible and let you give or + take any of these components. + + Interfaces are created with the Python class statement using + either `zope.interface.Interface` or another interface, as in:: + + from zope.interface import Interface + + class IMyInterface(Interface): + '''Interface documentation''' + + def meth(arg1, arg2): + '''Documentation for meth''' + + # Note that there is no self argument + + class IMySubInterface(IMyInterface): + '''Interface documentation''' + + def meth2(): + '''Documentation for meth2''' + + You use interfaces in two ways: + + - You assert that your object implement the interfaces. + + There are several ways that you can declare that an object + provides an interface: + + 1. Call `zope.interface.implementer` on your class definition. + + 2. Call `zope.interface.directlyProvides` on your object. + + 3. Call `zope.interface.classImplements` to declare that instances + of a class implement an interface. + + For example:: + + from zope.interface import classImplements + + classImplements(some_class, some_interface) + + This approach is useful when it is not an option to modify + the class source. Note that this doesn't affect what the + class itself implements, but only what its instances + implement. + + - You query interface meta-data. See the IInterface methods and + attributes for details. + + """ + # pylint:disable=arguments-differ + def names(all=False): # pylint:disable=redefined-builtin + """Get the interface attribute names + + Return a collection of the names of the attributes, including + methods, included in the interface definition. + + Normally, only directly defined attributes are included. If + a true positional or keyword argument is given, then + attributes defined by base classes will be included. + """ + + def namesAndDescriptions(all=False): # pylint:disable=redefined-builtin + """Get the interface attribute names and descriptions + + Return a collection of the names and descriptions of the + attributes, including methods, as name-value pairs, included + in the interface definition. + + Normally, only directly defined attributes are included. If + a true positional or keyword argument is given, then + attributes defined by base classes will be included. + """ + + def __getitem__(name): + """Get the description for a name + + If the named attribute is not defined, a `KeyError` is raised. + """ + + def direct(name): + """Get the description for the name if it was defined by the interface + + If the interface doesn't define the name, returns None. + """ + + def validateInvariants(obj, errors=None): + """Validate invariants + + Validate object to defined invariants. If errors is None, + raises first Invalid error; if errors is a list, appends all errors + to list, then raises Invalid with the errors as the first element + of the "args" tuple.""" + + def __contains__(name): + """Test whether the name is defined by the interface""" + + def __iter__(): + """Return an iterator over the names defined by the interface + + The names iterated include all of the names defined by the + interface directly and indirectly by base interfaces. + """ + + __module__ = Attribute("""The name of the module defining the interface""") + + +class IDeclaration(ISpecification): + """Interface declaration + + Declarations are used to express the interfaces implemented by + classes or provided by objects. + """ + + def __contains__(interface): + """Test whether an interface is in the specification + + Return true if the given interface is one of the interfaces in + the specification and false otherwise. + """ + + def __iter__(): + """Return an iterator for the interfaces in the specification + """ + + def flattened(): + """Return an iterator of all included and extended interfaces + + An iterator is returned for all interfaces either included in + or extended by interfaces included in the specifications + without duplicates. The interfaces are in "interface + resolution order". The interface resolution order is such that + base interfaces are listed after interfaces that extend them + and, otherwise, interfaces are included in the order that they + were defined in the specification. + """ + + def __sub__(interfaces): + """Create an interface specification with some interfaces excluded + + The argument can be an interface or an interface + specifications. The interface or interfaces given in a + specification are subtracted from the interface specification. + + Removing an interface that is not in the specification does + not raise an error. Doing so has no effect. + + Removing an interface also removes sub-interfaces of the interface. + + """ + + def __add__(interfaces): + """Create an interface specification with some interfaces added + + The argument can be an interface or an interface + specifications. The interface or interfaces given in a + specification are added to the interface specification. + + Adding an interface that is already in the specification does + not raise an error. Doing so has no effect. + """ + + def __nonzero__(): + """Return a true value of the interface specification is non-empty + """ + + +class IInterfaceDeclaration(Interface): + """ + Declare and check the interfaces of objects. + + The functions defined in this interface are used to declare the + interfaces that objects provide and to query the interfaces that + have been declared. + + Interfaces can be declared for objects in two ways: + + - Interfaces are declared for instances of the object's class + + - Interfaces are declared for the object directly. + + The interfaces declared for an object are, therefore, the union of + interfaces declared for the object directly and the interfaces + declared for instances of the object's class. + + Note that we say that a class implements the interfaces provided + by it's instances. An instance can also provide interfaces + directly. The interfaces provided by an object are the union of + the interfaces provided directly and the interfaces implemented by + the class. + + This interface is implemented by :mod:`zope.interface`. + """ + # pylint:disable=arguments-differ + ### + # Defining interfaces + ### + + Interface = Attribute("The base class used to create new interfaces") + + def taggedValue(key, value): + """ + Attach a tagged value to an interface while defining the interface. + + This is a way of executing :meth:`IElement.setTaggedValue` from + the definition of the interface. For example:: + + class IFoo(Interface): + taggedValue('key', 'value') + + .. seealso:: `zope.interface.taggedValue` + """ + + def invariant(checker_function): + """ + Attach an invariant checker function to an interface while defining it. + + Invariants can later be validated against particular implementations by + calling :meth:`IInterface.validateInvariants`. + + For example:: + + def check_range(ob): + if ob.max < ob.min: + raise ValueError("max value is less than min value") + + class IRange(Interface): + min = Attribute("The min value") + max = Attribute("The max value") + + invariant(check_range) + + .. seealso:: `zope.interface.invariant` + """ + + def interfacemethod(method): + """ + A decorator that transforms a method specification into an + implementation method. + + This is used to override methods of ``Interface`` or provide new + methods. Definitions using this decorator will not appear in + :meth:`IInterface.names()`. It is possible to have an implementation + method and a method specification of the same name. + + For example:: + + class IRange(Interface): + @interfacemethod + def __adapt__(self, obj): + if isinstance(obj, range): + # Return the builtin ``range`` as-is + return obj + return super(type(IRange), self).__adapt__(obj) + + You can use ``super`` to call the parent class functionality. Note + that the zero-argument version (``super().__adapt__``) works on Python + 3.6 and above, but prior to that the two-argument version must be + used, and the class must be explicitly passed as the first argument. + + .. versionadded:: 5.1.0 + .. seealso:: `zope.interface.interfacemethod` + """ + + ### + # Querying interfaces + ### + + def providedBy(ob): + """ + Return the interfaces provided by an object. + + This is the union of the interfaces directly provided by an + object and interfaces implemented by it's class. + + The value returned is an `IDeclaration`. + + .. seealso:: `zope.interface.providedBy` + """ + + def implementedBy(class_): + """ + Return the interfaces implemented for a class's instances. + + The value returned is an `IDeclaration`. + + .. seealso:: `zope.interface.implementedBy` + """ + + ### + # Declaring interfaces + ### + + def classImplements(class_, *interfaces): + """ + Declare additional interfaces implemented for instances of a class. + + The arguments after the class are one or more interfaces or + interface specifications (`IDeclaration` objects). + + The interfaces given (including the interfaces in the + specifications) are added to any interfaces previously + declared. + + Consider the following example:: + + class C(A, B): + ... + + classImplements(C, I1, I2) + + + Instances of ``C`` provide ``I1``, ``I2``, and whatever interfaces + instances of ``A`` and ``B`` provide. This is equivalent to:: + + @implementer(I1, I2) + class C(A, B): + pass + + .. seealso:: `zope.interface.classImplements` + .. seealso:: `zope.interface.implementer` + """ + + def classImplementsFirst(cls, interface): + """ + See :func:`zope.interface.classImplementsFirst`. + """ + + def implementer(*interfaces): + """ + Create a decorator for declaring interfaces implemented by a + factory. + + A callable is returned that makes an implements declaration on + objects passed to it. + + .. seealso:: :meth:`classImplements` + """ + + def classImplementsOnly(class_, *interfaces): + """ + Declare the only interfaces implemented by instances of a class. + + The arguments after the class are one or more interfaces or + interface specifications (`IDeclaration` objects). + + The interfaces given (including the interfaces in the + specifications) replace any previous declarations. + + Consider the following example:: + + class C(A, B): + ... + + classImplements(C, IA, IB. IC) + classImplementsOnly(C. I1, I2) + + Instances of ``C`` provide only ``I1``, ``I2``, and regardless of + whatever interfaces instances of ``A`` and ``B`` implement. + + .. seealso:: `zope.interface.classImplementsOnly` + """ + + def implementer_only(*interfaces): + """ + Create a decorator for declaring the only interfaces implemented. + + A callable is returned that makes an implements declaration on + objects passed to it. + + .. seealso:: `zope.interface.implementer_only` + """ + + def directlyProvidedBy(object): # pylint:disable=redefined-builtin + """ + Return the interfaces directly provided by the given object. + + The value returned is an `IDeclaration`. + + .. seealso:: `zope.interface.directlyProvidedBy` + """ + + def directlyProvides( + object, *interfaces, + ): # pylint:disable=redefined-builtin + """ + Declare interfaces declared directly for an object. + + The arguments after the object are one or more interfaces or + interface specifications (`IDeclaration` objects). + + .. caution:: + The interfaces given (including the interfaces in the + specifications) *replace* interfaces previously + declared for the object. See :meth:`alsoProvides` to add + additional interfaces. + + Consider the following example:: + + class C(A, B): + ... + + ob = C() + directlyProvides(ob, I1, I2) + + The object, ``ob`` provides ``I1``, ``I2``, and whatever interfaces + instances have been declared for instances of ``C``. + + To remove directly provided interfaces, use `directlyProvidedBy` and + subtract the unwanted interfaces. For example:: + + directlyProvides(ob, directlyProvidedBy(ob)-I2) + + removes I2 from the interfaces directly provided by + ``ob``. The object, ``ob`` no longer directly provides ``I2``, + although it might still provide ``I2`` if it's class + implements ``I2``. + + To add directly provided interfaces, use `directlyProvidedBy` and + include additional interfaces. For example:: + + directlyProvides(ob, directlyProvidedBy(ob), I2) + + adds I2 to the interfaces directly provided by ob. + + .. seealso:: `zope.interface.directlyProvides` + """ + + def alsoProvides(object, *interfaces): # pylint:disable=redefined-builtin + """ + Declare additional interfaces directly for an object. + + For example:: + + alsoProvides(ob, I1) + + is equivalent to:: + + directlyProvides(ob, directlyProvidedBy(ob), I1) + + .. seealso:: `zope.interface.alsoProvides` + """ + + def noLongerProvides( + object, interface, + ): # pylint:disable=redefined-builtin + """ + Remove an interface from the list of an object's directly provided + interfaces. + + For example:: + + noLongerProvides(ob, I1) + + is equivalent to:: + + directlyProvides(ob, directlyProvidedBy(ob) - I1) + + with the exception that if ``I1`` is an interface that is + provided by ``ob`` through the class's implementation, + `ValueError` is raised. + + .. seealso:: `zope.interface.noLongerProvides` + """ + + def provider(*interfaces): + """ + Declare interfaces provided directly by a class. + + .. seealso:: `zope.interface.provider` + """ + + def moduleProvides(*interfaces): + """ + Declare interfaces provided by a module. + + This function is used in a module definition. + + The arguments are one or more interfaces or interface + specifications (`IDeclaration` objects). + + The given interfaces (including the interfaces in the + specifications) are used to create the module's direct-object + interface specification. An error will be raised if the module + already has an interface specification. In other words, it is + an error to call this function more than once in a module + definition. + + This function is provided for convenience. It provides a more + convenient way to call `directlyProvides` for a module. For example:: + + moduleImplements(I1) + + is equivalent to:: + + directlyProvides(sys.modules[__name__], I1) + + .. seealso:: `zope.interface.moduleProvides` + """ + + def Declaration(*interfaces): + """ + Create an interface specification. + + The arguments are one or more interfaces or interface + specifications (`IDeclaration` objects). + + A new interface specification (`IDeclaration`) with the given + interfaces is returned. + + .. seealso:: `zope.interface.Declaration` + """ + + +class IAdapterRegistry(Interface): + """Provide an interface-based registry for adapters + + This registry registers objects that are in some sense "from" a + sequence of specification to an interface and a name. + + No specific semantics are assumed for the registered objects, + however, the most common application will be to register factories + that adapt objects providing required specifications to a provided + interface. + """ + + def register(required, provided, name, value): + """Register a value + + A value is registered for a *sequence* of required specifications, a + provided interface, and a name, which must be text. + """ + + def registered(required, provided, name=''): + """Return the component registered for the given interfaces and name + + name must be text. + + Unlike the lookup method, this methods won't retrieve + components registered for more specific required interfaces or + less specific provided interfaces. + + If no component was registered exactly for the given + interfaces and name, then None is returned. + + """ + + def lookup(required, provided, name='', default=None): + """Lookup a value + + A value is looked up based on a *sequence* of required + specifications, a provided interface, and a name, which must be + text. + """ + + def queryMultiAdapter(objects, provided, name='', default=None): + """Adapt a sequence of objects to a named, provided, interface + """ + + def lookup1(required, provided, name='', default=None): + """Lookup a value using a single required interface + + A value is looked up based on a single required + specifications, a provided interface, and a name, which must be + text. + """ + + def queryAdapter( + object, provided, name='', default=None, + ): # pylint:disable=redefined-builtin + """Adapt an object using a registered adapter factory. + """ + + def adapter_hook( + provided, object, name='', default=None, + ): # pylint:disable=redefined-builtin + """Adapt an object using a registered adapter factory. + + name must be text. + """ + + def lookupAll(required, provided): + """Find all adapters from the required to the provided interfaces + + An iterable object is returned that provides name-value two-tuples. + """ + + def names(required, provided): # pylint:disable=arguments-differ + """Return the names for which there are registered objects + """ + + def subscribe( + required, provided, subscriber, + ): # pylint:disable=arguments-differ + """Register a subscriber + + A subscriber is registered for a *sequence* of required + specifications, a provided interface, and a name. + + Multiple subscribers may be registered for the same (or + equivalent) interfaces. + + .. versionchanged:: 5.1.1 + Correct the method signature to remove the ``name`` parameter. + Subscribers have no names. + """ + + def subscribed(required, provided, subscriber): + """ + Check whether the object *subscriber* is registered directly + with this object via a previous call to + ``subscribe(required, provided, subscriber)``. + + If the *subscriber*, or one equal to it, has been subscribed, + for the given *required* sequence and *provided* interface, + return that object. (This does not guarantee whether the *subscriber* + itself is returned, or an object equal to it.) + + If it has not, return ``None``. + + Unlike :meth:`subscriptions`, this method won't retrieve + components registered for more specific required interfaces or + less specific provided interfaces. + + .. versionadded:: 5.3.0 + """ + + def subscriptions(required, provided): + """ + Get a sequence of subscribers. + + Subscribers for a sequence of *required* interfaces, and a *provided* + interface are returned. This takes into account subscribers + registered with this object, as well as those registered with + base adapter registries in the resolution order, and interfaces that + extend *provided*. + + .. versionchanged:: 5.1.1 + Correct the method signature to remove the ``name`` parameter. + Subscribers have no names. + """ + + def subscribers(objects, provided): + """ + Get a sequence of subscription **adapters**. + + This is like :meth:`subscriptions`, but calls the returned + subscribers with *objects* (and optionally returns the results + of those calls), instead of returning the subscribers directly. + + :param objects: A sequence of objects; they will be used to + determine the *required* argument to :meth:`subscriptions`. + :param provided: A single interface, or ``None``, to pass + as the *provided* parameter to :meth:`subscriptions`. + If an interface is given, the results of calling each returned + subscriber with the the *objects* are collected and returned + from this method; each result should be an object implementing + the *provided* interface. If ``None``, the resulting subscribers + are still called, but the results are ignored. + :return: A sequence of the results of calling the subscribers + if *provided* is not ``None``. If there are no registered + subscribers, or *provided* is ``None``, this will be an empty + sequence. + + .. versionchanged:: 5.1.1 + Correct the method signature to remove the ``name`` parameter. + Subscribers have no names. + """ + +# begin formerly in zope.component + + +class ComponentLookupError(LookupError): + """A component could not be found.""" + + +class Invalid(Exception): + """A component doesn't satisfy a promise.""" + + +class IObjectEvent(Interface): + """An event related to an object. + + The object that generated this event is not necessarily the object + referred to by location. + """ + + object = Attribute("The subject of the event.") + + +@implementer(IObjectEvent) +class ObjectEvent: + + def __init__(self, object): # pylint:disable=redefined-builtin + self.object = object + + +class IComponentLookup(Interface): + """Component Manager for a Site + + This object manages the components registered at a particular site. The + definition of a site is intentionally vague. + """ + + adapters = Attribute( + "Adapter Registry to manage all registered adapters.") + + utilities = Attribute( + "Adapter Registry to manage all registered utilities.") + + def queryAdapter( + object, interface, name='', default=None + ): # pylint:disable=redefined-builtin + """Look for a named adapter to an interface for an object + + If a matching adapter cannot be found, returns the default. + """ + + def getAdapter( + object, interface, name='' + ): # pylint:disable=redefined-builtin + """Look for a named adapter to an interface for an object + + If a matching adapter cannot be found, a `ComponentLookupError` + is raised. + """ + + def queryMultiAdapter(objects, interface, name='', default=None): + """Look for a multi-adapter to an interface for multiple objects + + If a matching adapter cannot be found, returns the default. + """ + + def getMultiAdapter(objects, interface, name=''): + """Look for a multi-adapter to an interface for multiple objects + + If a matching adapter cannot be found, a `ComponentLookupError` + is raised. + """ + + def getAdapters(objects, provided): + """Look for all matching adapters to a provided interface for objects + + Return an iterable of name-adapter pairs for adapters that + provide the given interface. + """ + + def subscribers(objects, provided): + """Get subscribers + + Subscribers are returned that provide the provided interface + and that depend on and are computed from the sequence of + required objects. + """ + + def handle(*objects): + """Call handlers for the given objects + + Handlers registered for the given objects are called. + """ + + def queryUtility(interface, name='', default=None): + """Look up a utility that provides an interface. + + If one is not found, returns default. + """ + + def getUtilitiesFor(interface): + """Look up the registered utilities that provide an interface. + + Returns an iterable of name-utility pairs. + """ + + def getAllUtilitiesRegisteredFor(interface): + """Return all registered utilities for an interface + + This includes overridden utilities. + + An iterable of utility instances is returned. No names are + returned. + """ + + +class IRegistration(Interface): + """A registration-information object + """ + + registry = Attribute("The registry having the registration") + + name = Attribute("The registration name") + + info = Attribute("""Information about the registration + + This is information deemed useful to people browsing the + configuration of a system. It could, for example, include + commentary or information about the source of the configuration. + """) + + +class IUtilityRegistration(IRegistration): + """Information about the registration of a utility + """ + + factory = Attribute("The factory used to create the utility. Optional.") + component = Attribute("The object registered") + provided = Attribute("The interface provided by the component") + + +class _IBaseAdapterRegistration(IRegistration): + """Information about the registration of an adapter + """ + + factory = Attribute("The factory used to create adapters") + + required = Attribute("""The adapted interfaces + + This is a sequence of interfaces adapters by the registered + factory. The factory will be caled with a sequence of objects, as + positional arguments, that provide these interfaces. + """) + + provided = Attribute("""The interface provided by the adapters. + + This interface is implemented by the factory + """) + + +class IAdapterRegistration(_IBaseAdapterRegistration): + """Information about the registration of an adapter + """ + + +class ISubscriptionAdapterRegistration(_IBaseAdapterRegistration): + """Information about the registration of a subscription adapter + """ + + +class IHandlerRegistration(IRegistration): + + handler = Attribute("An object called used to handle an event") + + required = Attribute("""The handled interfaces + + This is a sequence of interfaces handled by the registered + handler. The handler will be caled with a sequence of objects, as + positional arguments, that provide these interfaces. + """) + + +class IRegistrationEvent(IObjectEvent): + """An event that involves a registration""" + + +@implementer(IRegistrationEvent) +class RegistrationEvent(ObjectEvent): + """There has been a change in a registration + """ + + def __repr__(self): + return f"{self.__class__.__name__} event:\n{self.object!r}" + + +class IRegistered(IRegistrationEvent): + """A component or factory was registered + """ + + +@implementer(IRegistered) +class Registered(RegistrationEvent): + pass + + +class IUnregistered(IRegistrationEvent): + """A component or factory was unregistered + """ + + +@implementer(IUnregistered) +class Unregistered(RegistrationEvent): + """A component or factory was unregistered + """ + + +class IComponentRegistry(Interface): + """Register components + """ + + def registerUtility(component=None, provided=None, name='', + info='', factory=None): + """Register a utility + + :param factory: + Factory for the component to be registered. + + :param component: + The registered component + + :param provided: + This is the interface provided by the utility. If the + component provides a single interface, then this + argument is optional and the component-implemented + interface will be used. + + :param name: + The utility name. + + :param info: + An object that can be converted to a string to provide + information about the registration. + + Only one of *component* and *factory* can be used. + + A `IRegistered` event is generated with an `IUtilityRegistration`. + """ + + def unregisterUtility(component=None, provided=None, name='', + factory=None): + """Unregister a utility + + :returns: + A boolean is returned indicating whether the registry was + changed. If the given *component* is None and there is no + component registered, or if the given *component* is not + None and is not registered, then the function returns + False, otherwise it returns True. + + :param factory: + Factory for the component to be unregistered. + + :param component: + The registered component The given component can be + None, in which case any component registered to provide + the given provided interface with the given name is + unregistered. + + :param provided: + This is the interface provided by the utility. If the + component is not None and provides a single interface, + then this argument is optional and the + component-implemented interface will be used. + + :param name: + The utility name. + + Only one of *component* and *factory* can be used. + An `IUnregistered` event is generated with an `IUtilityRegistration`. + """ + + def registeredUtilities(): + """Return an iterable of `IUtilityRegistration` instances. + + These registrations describe the current utility registrations + in the object. + """ + + def registerAdapter(factory, required=None, provided=None, name='', + info=''): + """Register an adapter factory + + :param factory: + The object used to compute the adapter + + :param required: + This is a sequence of specifications for objects to be + adapted. If omitted, then the value of the factory's + ``__component_adapts__`` attribute will be used. The + ``__component_adapts__`` attribute is + normally set in class definitions using + the `.adapter` + decorator. If the factory doesn't have a + ``__component_adapts__`` adapts attribute, then this + argument is required. + + :param provided: + This is the interface provided by the adapter and + implemented by the factory. If the factory + implements a single interface, then this argument is + optional and the factory-implemented interface will be + used. + + :param name: + The adapter name. + + :param info: + An object that can be converted to a string to provide + information about the registration. + + A `IRegistered` event is generated with an `IAdapterRegistration`. + """ + + def unregisterAdapter(factory=None, required=None, + provided=None, name=''): + """Unregister an adapter factory + + :returns: + A boolean is returned indicating whether the registry was + changed. If the given component is None and there is no + component registered, or if the given component is not + None and is not registered, then the function returns + False, otherwise it returns True. + + :param factory: + This is the object used to compute the adapter. The + factory can be None, in which case any factory + registered to implement the given provided interface + for the given required specifications with the given + name is unregistered. + + :param required: + This is a sequence of specifications for objects to be + adapted. If the factory is not None and the required + arguments is omitted, then the value of the factory's + __component_adapts__ attribute will be used. The + __component_adapts__ attribute attribute is normally + set in class definitions using adapts function, or for + callables using the adapter decorator. If the factory + is None or doesn't have a __component_adapts__ adapts + attribute, then this argument is required. + + :param provided: + This is the interface provided by the adapter and + implemented by the factory. If the factory is not + None and implements a single interface, then this + argument is optional and the factory-implemented + interface will be used. + + :param name: + The adapter name. + + An `IUnregistered` event is generated with an `IAdapterRegistration`. + """ + + def registeredAdapters(): + """Return an iterable of `IAdapterRegistration` instances. + + These registrations describe the current adapter registrations + in the object. + """ + + def registerSubscriptionAdapter(factory, required=None, provides=None, + name='', info=''): + """Register a subscriber factory + + :param factory: + The object used to compute the adapter + + :param required: + This is a sequence of specifications for objects to be + adapted. If omitted, then the value of the factory's + ``__component_adapts__`` attribute will be used. The + ``__component_adapts__`` attribute is + normally set using the adapter + decorator. If the factory doesn't have a + ``__component_adapts__`` adapts attribute, then this + argument is required. + + :param provided: + This is the interface provided by the adapter and + implemented by the factory. If the factory implements + a single interface, then this argument is optional and + the factory-implemented interface will be used. + + :param name: + The adapter name. + + Currently, only the empty string is accepted. Other + strings will be accepted in the future when support for + named subscribers is added. + + :param info: + An object that can be converted to a string to provide + information about the registration. + + A `IRegistered` event is generated with an + `ISubscriptionAdapterRegistration`. + """ + + def unregisterSubscriptionAdapter(factory=None, required=None, + provides=None, name=''): + """Unregister a subscriber factory. + + :returns: + A boolean is returned indicating whether the registry was + changed. If the given component is None and there is no + component registered, or if the given component is not + None and is not registered, then the function returns + False, otherwise it returns True. + + :param factory: + This is the object used to compute the adapter. The + factory can be None, in which case any factories + registered to implement the given provided interface + for the given required specifications with the given + name are unregistered. + + :param required: + This is a sequence of specifications for objects to be + adapted. If omitted, then the value of the factory's + ``__component_adapts__`` attribute will be used. The + ``__component_adapts__`` attribute is + normally set using the adapter + decorator. If the factory doesn't have a + ``__component_adapts__`` adapts attribute, then this + argument is required. + + :param provided: + This is the interface provided by the adapter and + implemented by the factory. If the factory is not + None implements a single interface, then this argument + is optional and the factory-implemented interface will + be used. + + :param name: + The adapter name. + + Currently, only the empty string is accepted. Other + strings will be accepted in the future when support for + named subscribers is added. + + An `IUnregistered` event is generated with an + `ISubscriptionAdapterRegistration`. + """ + + def registeredSubscriptionAdapters(): + """Return an iterable of `ISubscriptionAdapterRegistration` instances. + + These registrations describe the current subscription adapter + registrations in the object. + """ + + def registerHandler(handler, required=None, name='', info=''): + """Register a handler. + + A handler is a subscriber that doesn't compute an adapter + but performs some function when called. + + :param handler: + The object used to handle some event represented by + the objects passed to it. + + :param required: + This is a sequence of specifications for objects to be + adapted. If omitted, then the value of the factory's + ``__component_adapts__`` attribute will be used. The + ``__component_adapts__`` attribute is + normally set using the adapter + decorator. If the factory doesn't have a + ``__component_adapts__`` adapts attribute, then this + argument is required. + + :param name: + The handler name. + + Currently, only the empty string is accepted. Other + strings will be accepted in the future when support for + named handlers is added. + + :param info: + An object that can be converted to a string to provide + information about the registration. + + + A `IRegistered` event is generated with an `IHandlerRegistration`. + """ + + def unregisterHandler(handler=None, required=None, name=''): + """Unregister a handler. + + A handler is a subscriber that doesn't compute an adapter + but performs some function when called. + + :returns: A boolean is returned indicating whether the registry was + changed. + + :param handler: + This is the object used to handle some event + represented by the objects passed to it. The handler + can be None, in which case any handlers registered for + the given required specifications with the given are + unregistered. + + :param required: + This is a sequence of specifications for objects to be + adapted. If omitted, then the value of the factory's + ``__component_adapts__`` attribute will be used. The + ``__component_adapts__`` attribute is + normally set using the adapter + decorator. If the factory doesn't have a + ``__component_adapts__`` adapts attribute, then this + argument is required. + + :param name: + The handler name. + + Currently, only the empty string is accepted. Other + strings will be accepted in the future when support for + named handlers is added. + + An `IUnregistered` event is generated with an `IHandlerRegistration`. + """ + + def registeredHandlers(): + """Return an iterable of `IHandlerRegistration` instances. + + These registrations describe the current handler registrations + in the object. + """ + + +class IComponents(IComponentLookup, IComponentRegistry): + """Component registration and access + """ + + +# end formerly in zope.component diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope/interface/registry.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope/interface/registry.py new file mode 100644 index 0000000000000000000000000000000000000000..37c4ec991b1fd4b374147c0a648c624b06d6d654 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope/interface/registry.py @@ -0,0 +1,750 @@ +############################################################################## +# +# Copyright (c) 2006 Zope Foundation and Contributors. +# All Rights Reserved. +# +# This software is subject to the provisions of the Zope Public License, +# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. +# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED +# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS +# FOR A PARTICULAR PURPOSE. +# +############################################################################## +"""Basic components support +""" +from collections import defaultdict + + +try: + from zope.event import notify +except ImportError: # pragma: no cover + def notify(*arg, **kw): + pass + +from zope.interface.adapter import AdapterRegistry +from zope.interface.declarations import implementedBy +from zope.interface.declarations import implementer +from zope.interface.declarations import implementer_only +from zope.interface.declarations import providedBy +from zope.interface.interface import Interface +from zope.interface.interfaces import ComponentLookupError +from zope.interface.interfaces import IAdapterRegistration +from zope.interface.interfaces import IComponents +from zope.interface.interfaces import IHandlerRegistration +from zope.interface.interfaces import ISpecification +from zope.interface.interfaces import ISubscriptionAdapterRegistration +from zope.interface.interfaces import IUtilityRegistration +from zope.interface.interfaces import Registered +from zope.interface.interfaces import Unregistered + + +__all__ = [ + # Components is public API, but + # the *Registration classes are just implementations + # of public interfaces. + 'Components', +] + + +class _UnhashableComponentCounter: + # defaultdict(int)-like object for unhashable components + + def __init__(self, otherdict): + # [(component, count)] + self._data = [item for item in otherdict.items()] + + def __getitem__(self, key): + for component, count in self._data: + if component == key: + return count + return 0 + + def __setitem__(self, component, count): + for i, data in enumerate(self._data): + if data[0] == component: + self._data[i] = component, count + return + self._data.append((component, count)) + + def __delitem__(self, component): + for i, data in enumerate(self._data): + if data[0] == component: + del self._data[i] + return + raise KeyError(component) # pragma: no cover + + +def _defaultdict_int(): + return defaultdict(int) + + +class _UtilityRegistrations: + + def __init__(self, utilities, utility_registrations): + # {provided -> {component: count}} + self._cache = defaultdict(_defaultdict_int) + self._utilities = utilities + self._utility_registrations = utility_registrations + + self.__populate_cache() + + def __populate_cache(self): + for ((p, _), data) in iter(self._utility_registrations.items()): + component = data[0] + self.__cache_utility(p, component) + + def __cache_utility(self, provided, component): + try: + self._cache[provided][component] += 1 + except TypeError: + # The component is not hashable, and we have a dict. Switch to a + # strategy that doesn't use hashing. + prov = self._cache[provided] = _UnhashableComponentCounter( + self._cache[provided] + ) + prov[component] += 1 + + def __uncache_utility(self, provided, component): + provided = self._cache[provided] + # It seems like this line could raise a TypeError if component isn't + # hashable and we haven't yet switched to _UnhashableComponentCounter. + # However, we can't actually get in that situation. In order to get + # here, we would have had to cache the utility already which would + # have switched the datastructure if needed. + count = provided[component] + count -= 1 + if count == 0: + del provided[component] + else: + provided[component] = count + return count > 0 + + def _is_utility_subscribed(self, provided, component): + try: + return self._cache[provided][component] > 0 + except TypeError: + # Not hashable and we're still using a dict + return False + + def registerUtility(self, provided, name, component, info, factory): + subscribed = self._is_utility_subscribed(provided, component) + + self._utility_registrations[ + (provided, name) + ] = component, info, factory + self._utilities.register((), provided, name, component) + + if not subscribed: + self._utilities.subscribe((), provided, component) + + self.__cache_utility(provided, component) + + def unregisterUtility(self, provided, name, component): + del self._utility_registrations[(provided, name)] + self._utilities.unregister((), provided, name) + + subscribed = self.__uncache_utility(provided, component) + + if not subscribed: + self._utilities.unsubscribe((), provided, component) + + +@implementer(IComponents) +class Components: + + _v_utility_registrations_cache = None + + def __init__(self, name='', bases=()): + # __init__ is used for test cleanup as well as initialization. + # XXX add a separate API for test cleanup. + assert isinstance(name, str) + self.__name__ = name + self._init_registries() + self._init_registrations() + self.__bases__ = tuple(bases) + self._v_utility_registrations_cache = None + + def __repr__(self): + return f"<{self.__class__.__name__} {self.__name__}>" + + def __reduce__(self): + # Mimic what a persistent.Persistent object does and elide + # _v_ attributes so that they don't get saved in ZODB. + # This allows us to store things that cannot be pickled in such + # attributes. + reduction = super().__reduce__() + # (callable, args, state, listiter, dictiter) + # We assume the state is always a dict; the last three items + # are technically optional and can be missing or None. + filtered_state = {k: v for k, v in reduction[2].items() + if not k.startswith('_v_')} + reduction = list(reduction) + reduction[2] = filtered_state + return tuple(reduction) + + def _init_registries(self): + # Subclasses have never been required to call this method + # if they override it, merely to fill in these two attributes. + self.adapters = AdapterRegistry() + self.utilities = AdapterRegistry() + + def _init_registrations(self): + self._utility_registrations = {} + self._adapter_registrations = {} + self._subscription_registrations = [] + self._handler_registrations = [] + + @property + def _utility_registrations_cache(self): + # We use a _v_ attribute internally so that data aren't saved in ZODB, + # because this object cannot be pickled. + cache = self._v_utility_registrations_cache + if ( + cache is None or + cache._utilities is not self.utilities or + cache._utility_registrations is not self._utility_registrations + ): + cache = self._v_utility_registrations_cache = ( + _UtilityRegistrations( + self.utilities, self._utility_registrations, + ) + ) + return cache + + def _getBases(self): + # Subclasses might override + return self.__dict__.get('__bases__', ()) + + def _setBases(self, bases): + # Subclasses might override + self.adapters.__bases__ = tuple([ + base.adapters for base in bases]) + self.utilities.__bases__ = tuple([ + base.utilities for base in bases]) + self.__dict__['__bases__'] = tuple(bases) + + __bases__ = property( + lambda self: self._getBases(), + lambda self, bases: self._setBases(bases), + ) + + def registerUtility(self, component=None, provided=None, name='', + info='', event=True, factory=None): + if factory: + if component: + raise TypeError("Can't specify factory and component.") + component = factory() + + if provided is None: + provided = _getUtilityProvided(component) + + if name == '': + name = _getName(component) + + reg = self._utility_registrations.get((provided, name)) + if reg is not None: + if reg[:2] == (component, info): + # already registered + return + self.unregisterUtility(reg[0], provided, name) + + self._utility_registrations_cache.registerUtility( + provided, name, component, info, factory) + + if event: + notify(Registered( + UtilityRegistration( + self, provided, name, component, info, factory) + )) + + def unregisterUtility(self, component=None, provided=None, name='', + factory=None): + if factory: + if component: + raise TypeError("Can't specify factory and component.") + component = factory() + + if provided is None: + if component is None: + raise TypeError("Must specify one of component, factory and " + "provided") + provided = _getUtilityProvided(component) + + old = self._utility_registrations.get((provided, name)) + if (old is None) or ((component is not None) and + (component != old[0])): + return False + + if component is None: + component = old[0] + + # Note that component is now the old thing registered + self._utility_registrations_cache.unregisterUtility( + provided, name, component) + + notify(Unregistered( + UtilityRegistration(self, provided, name, component, *old[1:]) + )) + + return True + + def registeredUtilities(self): + for ((provided, name), data + ) in iter(self._utility_registrations.items()): + yield UtilityRegistration(self, provided, name, *data) + + def queryUtility(self, provided, name='', default=None): + return self.utilities.lookup((), provided, name, default) + + def getUtility(self, provided, name=''): + utility = self.utilities.lookup((), provided, name) + if utility is None: + raise ComponentLookupError(provided, name) + return utility + + def getUtilitiesFor(self, interface): + yield from self.utilities.lookupAll((), interface) + + def getAllUtilitiesRegisteredFor(self, interface): + return self.utilities.subscriptions((), interface) + + def registerAdapter(self, factory, required=None, provided=None, + name='', info='', event=True): + if provided is None: + provided = _getAdapterProvided(factory) + required = _getAdapterRequired(factory, required) + if name == '': + name = _getName(factory) + self._adapter_registrations[(required, provided, name) + ] = factory, info + self.adapters.register(required, provided, name, factory) + + if event: + notify(Registered( + AdapterRegistration( + self, required, provided, name, factory, info + ) + )) + + def unregisterAdapter(self, factory=None, + required=None, provided=None, name='', + ): + if provided is None: + if factory is None: + raise TypeError("Must specify one of factory and provided") + provided = _getAdapterProvided(factory) + + if (required is None) and (factory is None): + raise TypeError("Must specify one of factory and required") + + required = _getAdapterRequired(factory, required) + old = self._adapter_registrations.get((required, provided, name)) + if (old is None) or ((factory is not None) and + (factory != old[0])): + return False + + del self._adapter_registrations[(required, provided, name)] + self.adapters.unregister(required, provided, name) + + notify(Unregistered( + AdapterRegistration(self, required, provided, name, *old) + )) + + return True + + def registeredAdapters(self): + for ((required, provided, name), (component, info) + ) in iter(self._adapter_registrations.items()): + yield AdapterRegistration(self, required, provided, name, + component, info) + + def queryAdapter(self, object, interface, name='', default=None): + return self.adapters.queryAdapter(object, interface, name, default) + + def getAdapter(self, object, interface, name=''): + adapter = self.adapters.queryAdapter(object, interface, name) + if adapter is None: + raise ComponentLookupError(object, interface, name) + return adapter + + def queryMultiAdapter(self, objects, interface, name='', + default=None): + return self.adapters.queryMultiAdapter( + objects, interface, name, default) + + def getMultiAdapter(self, objects, interface, name=''): + adapter = self.adapters.queryMultiAdapter(objects, interface, name) + if adapter is None: + raise ComponentLookupError(objects, interface, name) + return adapter + + def getAdapters(self, objects, provided): + for name, factory in self.adapters.lookupAll( + list(map(providedBy, objects)), provided, + ): + adapter = factory(*objects) + if adapter is not None: + yield name, adapter + + def registerSubscriptionAdapter(self, + factory, required=None, provided=None, + name='', info='', + event=True): + if name: + raise TypeError("Named subscribers are not yet supported") + if provided is None: + provided = _getAdapterProvided(factory) + required = _getAdapterRequired(factory, required) + self._subscription_registrations.append( + (required, provided, name, factory, info) + ) + self.adapters.subscribe(required, provided, factory) + + if event: + notify(Registered( + SubscriptionRegistration( + self, required, provided, name, factory, info, + ) + )) + + def registeredSubscriptionAdapters(self): + for data in self._subscription_registrations: + yield SubscriptionRegistration(self, *data) + + def unregisterSubscriptionAdapter( + self, factory=None, required=None, provided=None, name='', + ): + if name: + raise TypeError("Named subscribers are not yet supported") + if provided is None: + if factory is None: + raise TypeError("Must specify one of factory and provided") + provided = _getAdapterProvided(factory) + + if (required is None) and (factory is None): + raise TypeError("Must specify one of factory and required") + + required = _getAdapterRequired(factory, required) + + if factory is None: + new = [(r, p, n, f, i) + for (r, p, n, f, i) + in self._subscription_registrations + if not (r == required and p == provided) + ] + else: + new = [(r, p, n, f, i) + for (r, p, n, f, i) + in self._subscription_registrations + if not (r == required and p == provided and f == factory) + ] + + if len(new) == len(self._subscription_registrations): + return False + + self._subscription_registrations[:] = new + self.adapters.unsubscribe(required, provided, factory) + + notify(Unregistered( + SubscriptionRegistration( + self, required, provided, name, factory, '', + ) + )) + + return True + + def subscribers(self, objects, provided): + return self.adapters.subscribers(objects, provided) + + def registerHandler(self, + factory, required=None, + name='', info='', + event=True): + if name: + raise TypeError("Named handlers are not yet supported") + required = _getAdapterRequired(factory, required) + self._handler_registrations.append( + (required, name, factory, info) + ) + self.adapters.subscribe(required, None, factory) + + if event: + notify(Registered( + HandlerRegistration(self, required, name, factory, info) + )) + + def registeredHandlers(self): + for data in self._handler_registrations: + yield HandlerRegistration(self, *data) + + def unregisterHandler(self, factory=None, required=None, name=''): + if name: + raise TypeError("Named subscribers are not yet supported") + + if (required is None) and (factory is None): + raise TypeError("Must specify one of factory and required") + + required = _getAdapterRequired(factory, required) + + if factory is None: + new = [(r, n, f, i) + for (r, n, f, i) + in self._handler_registrations + if r != required + ] + else: + new = [(r, n, f, i) + for (r, n, f, i) + in self._handler_registrations + if not (r == required and f == factory) + ] + + if len(new) == len(self._handler_registrations): + return False + + self._handler_registrations[:] = new + self.adapters.unsubscribe(required, None, factory) + + notify(Unregistered( + HandlerRegistration(self, required, name, factory, '') + )) + + return True + + def handle(self, *objects): + self.adapters.subscribers(objects, None) + + def rebuildUtilityRegistryFromLocalCache(self, rebuild=False): + """ + Emergency maintenance method to rebuild the ``.utilities`` + registry from the local copy maintained in this object, or + detect the need to do so. + + Most users will never need to call this, but it can be helpful + in the event of suspected corruption. + + By default, this method only checks for corruption. To make it + actually rebuild the registry, pass `True` for *rebuild*. + + :param bool rebuild: If set to `True` (not the default), + this method will actually register and subscribe utilities + in the registry as needed to synchronize with the local cache. + + :return: A dictionary that's meant as diagnostic data. The keys + and values may change over time. When called with a false + *rebuild*, the keys ``"needed_registered"`` and + ``"needed_subscribed"`` will be non-zero if any corruption was + detected, but that will not be corrected. + + .. versionadded:: 5.3.0 + """ + regs = dict(self._utility_registrations) + utils = self.utilities + needed_registered = 0 + did_not_register = 0 + needed_subscribed = 0 + did_not_subscribe = 0 + + # Avoid the expensive change process during this; we'll call + # it once at the end if needed. + assert 'changed' not in utils.__dict__ + utils.changed = lambda _: None + + if rebuild: + register = utils.register + subscribe = utils.subscribe + else: + register = subscribe = lambda *args: None + + try: + for (provided, name), (value, _info, _factory) in regs.items(): + if utils.registered((), provided, name) != value: + register((), provided, name, value) + needed_registered += 1 + else: + did_not_register += 1 + + if utils.subscribed((), provided, value) is None: + needed_subscribed += 1 + subscribe((), provided, value) + else: + did_not_subscribe += 1 + finally: + del utils.changed + if rebuild and (needed_subscribed or needed_registered): + utils.changed(utils) + + return { + 'needed_registered': needed_registered, + 'did_not_register': did_not_register, + 'needed_subscribed': needed_subscribed, + 'did_not_subscribe': did_not_subscribe + } + + +def _getName(component): + try: + return component.__component_name__ + except AttributeError: + return '' + + +def _getUtilityProvided(component): + provided = list(providedBy(component)) + if len(provided) == 1: + return provided[0] + raise TypeError( + "The utility doesn't provide a single interface " + "and no provided interface was specified." + ) + + +def _getAdapterProvided(factory): + provided = list(implementedBy(factory)) + if len(provided) == 1: + return provided[0] + raise TypeError( + "The adapter factory doesn't implement a single interface " + "and no provided interface was specified." + ) + + +def _getAdapterRequired(factory, required): + if required is None: + try: + required = factory.__component_adapts__ + except AttributeError: + raise TypeError( + "The adapter factory doesn't have a __component_adapts__ " + "attribute and no required specifications were specified" + ) + elif ISpecification.providedBy(required): + raise TypeError( + "the required argument should be a list of " + "interfaces, not a single interface" + ) + + result = [] + for r in required: + if r is None: + r = Interface + elif not ISpecification.providedBy(r): + if isinstance(r, type): + r = implementedBy(r) + else: + raise TypeError( + "Required specification must be a " + "specification or class, not %r" % type(r) + ) + result.append(r) + return tuple(result) + + +@implementer(IUtilityRegistration) +class UtilityRegistration: + + def __init__(self, registry, provided, name, component, doc, factory=None): + self.registry = registry + self.provided = provided + self.name = name + self.component = component + self.info = doc + self.factory = factory + + def __repr__(self): + return '{}({!r}, {}, {!r}, {}, {!r}, {!r})'.format( + self.__class__.__name__, + self.registry, + getattr(self.provided, '__name__', None), self.name, + getattr(self.component, '__name__', repr(self.component)), + self.factory, self.info, + ) + + def __hash__(self): + return id(self) + + def __eq__(self, other): + return repr(self) == repr(other) + + def __ne__(self, other): + return repr(self) != repr(other) + + def __lt__(self, other): + return repr(self) < repr(other) + + def __le__(self, other): + return repr(self) <= repr(other) + + def __gt__(self, other): + return repr(self) > repr(other) + + def __ge__(self, other): + return repr(self) >= repr(other) + + +@implementer(IAdapterRegistration) +class AdapterRegistration: + + def __init__(self, registry, required, provided, name, component, doc): + (self.registry, self.required, self.provided, self.name, + self.factory, self.info + ) = registry, required, provided, name, component, doc + + def __repr__(self): + return '{}({!r}, {}, {}, {!r}, {}, {!r})'.format( + self.__class__.__name__, + self.registry, + '[' + ", ".join([r.__name__ for r in self.required]) + ']', + getattr(self.provided, '__name__', None), self.name, + getattr(self.factory, '__name__', repr(self.factory)), self.info, + ) + + def __hash__(self): + return id(self) + + def __eq__(self, other): + return repr(self) == repr(other) + + def __ne__(self, other): + return repr(self) != repr(other) + + def __lt__(self, other): + return repr(self) < repr(other) + + def __le__(self, other): + return repr(self) <= repr(other) + + def __gt__(self, other): + return repr(self) > repr(other) + + def __ge__(self, other): + return repr(self) >= repr(other) + + +@implementer_only(ISubscriptionAdapterRegistration) +class SubscriptionRegistration(AdapterRegistration): + pass + + +@implementer_only(IHandlerRegistration) +class HandlerRegistration(AdapterRegistration): + + def __init__(self, registry, required, name, handler, doc): + (self.registry, self.required, self.name, self.handler, self.info + ) = registry, required, name, handler, doc + + @property + def factory(self): + return self.handler + + provided = None + + def __repr__(self): + return '{}({!r}, {}, {!r}, {}, {!r})'.format( + self.__class__.__name__, + self.registry, + '[' + ", ".join([r.__name__ for r in self.required]) + ']', + self.name, + getattr(self.factory, '__name__', repr(self.factory)), self.info, + ) diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope/interface/ro.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope/interface/ro.py new file mode 100644 index 0000000000000000000000000000000000000000..5233e49b16447a0539214c16e7b9d2e9b2da0574 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope/interface/ro.py @@ -0,0 +1,722 @@ +############################################################################## +# +# Copyright (c) 2003 Zope Foundation and Contributors. +# All Rights Reserved. +# +# This software is subject to the provisions of the Zope Public License, +# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. +# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED +# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS +# FOR A PARTICULAR PURPOSE. +# +############################################################################## +""" +Compute a resolution order for an object and its bases. + +.. versionchanged:: 5.0 + The resolution order is now based on the same C3 order that Python + uses for classes. In complex instances of multiple inheritance, this + may result in a different ordering. + + In older versions, the ordering wasn't required to be C3 compliant, + and for backwards compatibility, it still isn't. If the ordering + isn't C3 compliant (if it is *inconsistent*), zope.interface will + make a best guess to try to produce a reasonable resolution order. + Still (just as before), the results in such cases may be + surprising. + +.. rubric:: Environment Variables + +Due to the change in 5.0, certain environment variables can be used to control +errors and warnings about inconsistent resolution orders. They are listed in +priority order, with variables at the bottom generally overriding variables +above them. + +ZOPE_INTERFACE_WARN_BAD_IRO + If this is set to "1", then if there is at least one inconsistent + resolution order discovered, a warning + (:class:`InconsistentResolutionOrderWarning`) will be issued. Use the + usual warning mechanisms to control this behaviour. The warning text will + contain additional information on debugging. + +ZOPE_INTERFACE_TRACK_BAD_IRO + If this is set to "1", then zope.interface will log information about each + inconsistent resolution order discovered, and keep those details in memory + in this module for later inspection. + +ZOPE_INTERFACE_STRICT_IRO + If this is set to "1", any attempt to use :func:`ro` that would produce a + non-C3 ordering will fail by raising + :class:`InconsistentResolutionOrderError`. + +.. important:: + + ``ZOPE_INTERFACE_STRICT_IRO`` is intended to become the default in the + future. + +There are two environment variables that are independent. + +ZOPE_INTERFACE_LOG_CHANGED_IRO + If this is set to "1", then if the C3 resolution order is different from + the legacy resolution order for any given object, a message explaining the + differences will be logged. This is intended to be used for debugging + complicated IROs. + +ZOPE_INTERFACE_USE_LEGACY_IRO + If this is set to "1", then the C3 resolution order will *not* be used. + The legacy IRO will be used instead. This is a temporary measure and will + be removed in the future. It is intended to help during the transition. + It implies ``ZOPE_INTERFACE_LOG_CHANGED_IRO``. + +.. rubric:: Debugging Behaviour Changes in zope.interface 5 + +Most behaviour changes from zope.interface 4 to 5 are related to +inconsistent resolution orders. ``ZOPE_INTERFACE_STRICT_IRO`` is the +most effective tool to find such inconsistent resolution orders, and +we recommend running your code with this variable set if at all +possible. Doing so will ensure that all interface resolution orders +are consistent, and if they're not, will immediately point the way to +where this is violated. + +Occasionally, however, this may not be enough. This is because in some +cases, a C3 ordering can be found (the resolution order is fully +consistent) that is substantially different from the ad-hoc legacy +ordering. In such cases, you may find that you get an unexpected value +returned when adapting one or more objects to an interface. To debug +this, *also* enable ``ZOPE_INTERFACE_LOG_CHANGED_IRO`` and examine the +output. The main thing to look for is changes in the relative +positions of interfaces for which there are registered adapters. +""" +__docformat__ = 'restructuredtext' + +import warnings + + +__all__ = [ + 'ro', + 'InconsistentResolutionOrderError', + 'InconsistentResolutionOrderWarning', +] + +__logger = None + + +def _logger(): + global __logger # pylint:disable=global-statement + if __logger is None: + import logging + __logger = logging.getLogger(__name__) + return __logger + + +def _legacy_mergeOrderings(orderings): + """Merge multiple orderings so that within-ordering order is preserved + + Orderings are constrained in such a way that if an object appears + in two or more orderings, then the suffix that begins with the + object must be in both orderings. + + For example: + + >>> _legacy_mergeOrderings([ + ... ['x', 'y', 'z'], + ... ['q', 'z'], + ... [1, 3, 5], + ... ['z'] + ... ]) + ['x', 'y', 'q', 1, 3, 5, 'z'] + + """ + + seen = set() + result = [] + for ordering in reversed(orderings): + for o in reversed(ordering): + if o not in seen: + seen.add(o) + result.insert(0, o) + + return result + + +def _legacy_flatten(begin): + result = [begin] + i = 0 + for ob in iter(result): + i += 1 + # The recursive calls can be avoided by inserting the base classes + # into the dynamically growing list directly after the currently + # considered object; the iterator makes sure this will keep working + # in the future, since it cannot rely on the length of the list + # by definition. + result[i:i] = ob.__bases__ + return result + + +def _legacy_ro(ob): + return _legacy_mergeOrderings([_legacy_flatten(ob)]) + +### +# Compare base objects using identity, not equality. This matches what +# the CPython MRO algorithm does, and is *much* faster to boot: that, +# plus some other small tweaks makes the difference between 25s and 6s +# in loading 446 plone/zope interface.py modules (1925 InterfaceClass, +# 1200 Implements, 1100 ClassProvides objects) +### + + +class InconsistentResolutionOrderWarning(PendingDeprecationWarning): + """ + The warning issued when an invalid IRO is requested. + """ + + +class InconsistentResolutionOrderError(TypeError): + """ + The error raised when an invalid IRO is requested in strict mode. + """ + + def __init__(self, c3, base_tree_remaining): + self.C = c3.leaf + base_tree = c3.base_tree + self.base_ros = { + base: base_tree[i + 1] + for i, base in enumerate(self.C.__bases__) + } + # Unfortunately, this doesn't necessarily directly match + # up to any transformation on C.__bases__, because + # if any were fully used up, they were removed already. + self.base_tree_remaining = base_tree_remaining + + TypeError.__init__(self) + + def __str__(self): + import pprint + return ( + "{}: For object {!r}.\nBase ROs:\n{}\nConflict Location:\n{}" + ).format( + self.__class__.__name__, + self.C, + pprint.pformat(self.base_ros), + pprint.pformat(self.base_tree_remaining), + ) + + +class _NamedBool(int): # cannot actually inherit bool + + def __new__(cls, val, name): + inst = super(cls, _NamedBool).__new__(cls, val) + inst.__name__ = name + return inst + + +class _ClassBoolFromEnv: + """ + Non-data descriptor that reads a transformed environment variable + as a boolean, and caches the result in the class. + """ + + def __get__(self, inst, klass): + import os + for cls in klass.__mro__: + my_name = None + for k in dir(klass): + if k in cls.__dict__ and cls.__dict__[k] is self: + my_name = k + break + if my_name is not None: + break + else: # pragma: no cover + raise RuntimeError("Unable to find self") + + env_name = 'ZOPE_INTERFACE_' + my_name + val = os.environ.get(env_name, '') == '1' + val = _NamedBool(val, my_name) + setattr(klass, my_name, val) + setattr(klass, 'ORIG_' + my_name, self) + return val + + +class _StaticMRO: + # A previously resolved MRO, supplied by the caller. + # Used in place of calculating it. + + had_inconsistency = None # We don't know... + + def __init__(self, C, mro): + self.leaf = C + self.__mro = tuple(mro) + + def mro(self): + return list(self.__mro) + + +_INCONSISTENT_RESOLUTION_ORDER = """\ +An inconsistent resolution order is being requested. (Interfaces should +follow the Python class rules known as C3.) For backwards compatibility, +zope.interface will allow this, making the best guess it can to produce as +meaningful an order as possible. In the future this might be an error. Set +the warning filter to error, or set the environment variable +'ZOPE_INTERFACE_TRACK_BAD_IRO' to '1' and examine ro.C3.BAD_IROS to debug, or +set 'ZOPE_INTERFACE_STRICT_IRO' to raise exceptions.""" + + +class C3: + # Holds the shared state during computation of an MRO. + + @staticmethod + def resolver(C, strict, base_mros): + strict = strict if strict is not None else C3.STRICT_IRO + factory = C3 + if strict: + factory = _StrictC3 + elif C3.TRACK_BAD_IRO: + factory = _TrackingC3 + + memo = {} + base_mros = base_mros or {} + for base, mro in base_mros.items(): + assert base in C.__bases__ + memo[base] = _StaticMRO(base, mro) + + return factory(C, memo) + + __mro = None + __legacy_ro = None + direct_inconsistency = False + + def __init__(self, C, memo): + self.leaf = C + self.memo = memo + kind = self.__class__ + + base_resolvers = [] + for base in C.__bases__: + if base not in memo: + resolver = kind(base, memo) + memo[base] = resolver + base_resolvers.append(memo[base]) + + self.base_tree = [ + [C] + ] + [ + memo[base].mro() for base in C.__bases__ + ] + [ + list(C.__bases__) + ] + + self.bases_had_inconsistency = any( + base.had_inconsistency for base in base_resolvers + ) + + if len(C.__bases__) == 1: + self.__mro = [C] + memo[C.__bases__[0]].mro() + + @property + def had_inconsistency(self): + return self.direct_inconsistency or self.bases_had_inconsistency + + @property + def legacy_ro(self): + if self.__legacy_ro is None: + self.__legacy_ro = tuple(_legacy_ro(self.leaf)) + return list(self.__legacy_ro) + + TRACK_BAD_IRO = _ClassBoolFromEnv() + STRICT_IRO = _ClassBoolFromEnv() + WARN_BAD_IRO = _ClassBoolFromEnv() + LOG_CHANGED_IRO = _ClassBoolFromEnv() + USE_LEGACY_IRO = _ClassBoolFromEnv() + BAD_IROS = () + + def _warn_iro(self): + if not self.WARN_BAD_IRO: + # For the initial release, one must opt-in to see the warning. + # In the future (2021?) seeing at least the first warning will + # be the default + return + warnings.warn( + _INCONSISTENT_RESOLUTION_ORDER, + InconsistentResolutionOrderWarning, + ) + + @staticmethod + def _can_choose_base(base, base_tree_remaining): + # From C3: + # nothead = [s for s in nonemptyseqs if cand in s[1:]] + for bases in base_tree_remaining: + if not bases or bases[0] is base: + continue + + for b in bases: + if b is base: + return False + return True + + @staticmethod + def _nonempty_bases_ignoring(base_tree, ignoring): + return list(filter(None, [ + [b for b in bases if b is not ignoring] + for bases + in base_tree + ])) + + def _choose_next_base(self, base_tree_remaining): + """ + Return the next base. + + The return value will either fit the C3 constraints or be our best + guess about what to do. If we cannot guess, this may raise an + exception. + """ + base = self._find_next_C3_base(base_tree_remaining) + if base is not None: + return base + return self._guess_next_base(base_tree_remaining) + + def _find_next_C3_base(self, base_tree_remaining): + """Return the next base that fits the constraints + + Return ``None`` if there isn't one. + """ + for bases in base_tree_remaining: + base = bases[0] + if self._can_choose_base(base, base_tree_remaining): + return base + return None + + class _UseLegacyRO(Exception): + pass + + def _guess_next_base(self, base_tree_remaining): + # Narf. We may have an inconsistent order (we won't know for + # sure until we check all the bases). Python cannot create + # classes like this: + # + # class B1: + # pass + # class B2(B1): + # pass + # class C(B1, B2): # -> TypeError; this is like saying C(B1, B2, B1). + # pass + # + # However, older versions of zope.interface were fine with this order. + # A good example is ``providedBy(IOError())``. Because of the way + # ``classImplements`` works, it winds up with ``__bases__`` == + # ``[IEnvironmentError, IIOError, IOSError, ]`` (on Python 3). But ``IEnvironmentError`` is a base of + # both ``IIOError`` and ``IOSError``. Previously, we would get a + # resolution order of ``[IIOError, IOSError, IEnvironmentError, + # IStandardError, IException, Interface]`` but the standard Python + # algorithm would forbid creating that order entirely. + + # Unlike Python's MRO, we attempt to resolve the issue. A few + # heuristics have been tried. One was: + # + # Strip off the first (highest priority) base of each direct + # base one at a time and seeing if we can come to an agreement + # with the other bases. (We're trying for a partial ordering + # here.) This often resolves cases (such as the IOSError case + # above), and frequently produces the same ordering as the + # legacy MRO did. If we looked at all the highest priority + # bases and couldn't find any partial ordering, then we strip + # them *all* out and begin the C3 step again. We take care not + # to promote a common root over all others. + # + # If we only did the first part, stripped off the first + # element of the first item, we could resolve simple cases. + # But it tended to fail badly. If we did the whole thing, it + # could be extremely painful from a performance perspective + # for deep/wide things like Zope's OFS.SimpleItem.Item. Plus, + # anytime you get ExtensionClass.Base into the mix, you're + # likely to wind up in trouble, because it messes with the MRO + # of classes. Sigh. + # + # So now, we fall back to the old linearization (fast to compute). + self._warn_iro() + self.direct_inconsistency = InconsistentResolutionOrderError( + self, base_tree_remaining, + ) + raise self._UseLegacyRO + + def _merge(self): + # Returns a merged *list*. + result = self.__mro = [] + base_tree_remaining = self.base_tree + base = None + while 1: + # Take last picked base out of the base tree wherever it is. + # This differs slightly from the standard Python MRO and is needed + # because we have no other step that prevents duplicates + # from coming in (e.g., in the inconsistent fallback path) + base_tree_remaining = self._nonempty_bases_ignoring( + base_tree_remaining, base + ) + + if not base_tree_remaining: + return result + try: + base = self._choose_next_base(base_tree_remaining) + except self._UseLegacyRO: + self.__mro = self.legacy_ro + return self.legacy_ro + + result.append(base) + + def mro(self): + if self.__mro is None: + self.__mro = tuple(self._merge()) + return list(self.__mro) + + +class _StrictC3(C3): + __slots__ = () + + def _guess_next_base(self, base_tree_remaining): + raise InconsistentResolutionOrderError(self, base_tree_remaining) + + +class _TrackingC3(C3): + __slots__ = () + + def _guess_next_base(self, base_tree_remaining): + import traceback + bad_iros = C3.BAD_IROS + if self.leaf not in bad_iros: + if bad_iros == (): + import weakref + + # This is a race condition, but it doesn't matter much. + bad_iros = C3.BAD_IROS = weakref.WeakKeyDictionary() + bad_iros[self.leaf] = t = ( + InconsistentResolutionOrderError(self, base_tree_remaining), + traceback.format_stack() + ) + _logger().warning("Tracking inconsistent IRO: %s", t[0]) + return C3._guess_next_base(self, base_tree_remaining) + + +class _ROComparison: + # Exists to compute and print a pretty string comparison + # for differing ROs. + # Since we're used in a logging context, and may actually never be printed, + # this is a class so we can defer computing the diff until asked. + + # Components we use to build up the comparison report + class Item: + prefix = ' ' + + def __init__(self, item): + self.item = item + + def __str__(self): + return "{}{}".format( + self.prefix, + self.item, + ) + + class Deleted(Item): + prefix = '- ' + + class Inserted(Item): + prefix = '+ ' + + Empty = str + + class ReplacedBy: # pragma: no cover + prefix = '- ' + suffix = '' + + def __init__(self, chunk, total_count): + self.chunk = chunk + self.total_count = total_count + + def __iter__(self): + lines = [ + self.prefix + str(item) + self.suffix + for item in self.chunk + ] + while len(lines) < self.total_count: + lines.append('') + + return iter(lines) + + class Replacing(ReplacedBy): + prefix = "+ " + suffix = '' + + _c3_report = None + _legacy_report = None + + def __init__(self, c3, c3_ro, legacy_ro): + self.c3 = c3 + self.c3_ro = c3_ro + self.legacy_ro = legacy_ro + + def __move(self, from_, to_, chunk, operation): + for x in chunk: + to_.append(operation(x)) + from_.append(self.Empty()) + + def _generate_report(self): + if self._c3_report is None: + import difflib + + # The opcodes we get describe how to turn 'a' into 'b'. So + # the old one (legacy) needs to be first ('a') + matcher = difflib.SequenceMatcher(None, self.legacy_ro, self.c3_ro) + # The reports are equal length sequences. We're going for a + # side-by-side diff. + self._c3_report = c3_report = [] + self._legacy_report = legacy_report = [] + for opcode, leg1, leg2, c31, c32 in matcher.get_opcodes(): + c3_chunk = self.c3_ro[c31:c32] + legacy_chunk = self.legacy_ro[leg1:leg2] + + if opcode == 'equal': + # Guaranteed same length + c3_report.extend(self.Item(x) for x in c3_chunk) + legacy_report.extend(self.Item(x) for x in legacy_chunk) + if opcode == 'delete': + # Guaranteed same length + assert not c3_chunk + self.__move( + c3_report, legacy_report, legacy_chunk, self.Deleted, + ) + if opcode == 'insert': + # Guaranteed same length + assert not legacy_chunk + self.__move( + legacy_report, c3_report, c3_chunk, self.Inserted, + ) + if opcode == 'replace': # pragma: no cover + # (How do you make it output this?) + # Either side could be longer. + chunk_size = max(len(c3_chunk), len(legacy_chunk)) + c3_report.extend(self.Replacing(c3_chunk, chunk_size)) + legacy_report.extend( + self.ReplacedBy(legacy_chunk, chunk_size), + ) + + return self._c3_report, self._legacy_report + + @property + def _inconsistent_label(self): + inconsistent = [] + if self.c3.direct_inconsistency: + inconsistent.append('direct') + if self.c3.bases_had_inconsistency: + inconsistent.append('bases') + return '+'.join(inconsistent) if inconsistent else 'no' + + def __str__(self): + c3_report, legacy_report = self._generate_report() + assert len(c3_report) == len(legacy_report) + + left_lines = [str(x) for x in legacy_report] + right_lines = [str(x) for x in c3_report] + + # We have the same number of lines in the report; this is not + # necessarily the same as the number of items in either RO. + assert len(left_lines) == len(right_lines) + + padding = ' ' * 2 + max_left = max(len(x) for x in left_lines) + max_right = max(len(x) for x in right_lines) + + left_title = f'Legacy RO (len={len(self.legacy_ro)})' + + right_title = 'C3 RO (len={}; inconsistent={})'.format( + len(self.c3_ro), + self._inconsistent_label, + ) + lines = [ + ( + padding + + left_title.ljust(max_left) + + padding + + right_title.ljust(max_right) + ), + padding + '=' * (max_left + len(padding) + max_right) + ] + lines += [ + padding + left.ljust(max_left) + padding + right + for left, right in zip(left_lines, right_lines) + ] + + return '\n'.join(lines) + + +# Set to `Interface` once it is defined. This is used to +# avoid logging false positives about changed ROs. +_ROOT = None + + +def ro( + C, strict=None, base_mros=None, log_changed_ro=None, use_legacy_ro=None, +): + """ + ro(C) -> list + + Compute the precedence list (mro) according to C3. + + :return: A fresh `list` object. + + .. versionchanged:: 5.0.0 + Add the *strict*, *log_changed_ro* and *use_legacy_ro* + keyword arguments. These are provisional and likely to be + removed in the future. They are most useful for testing. + """ + # The ``base_mros`` argument is for internal optimization and + # not documented. + resolver = C3.resolver(C, strict, base_mros) + mro = resolver.mro() + + log_changed = ( + log_changed_ro if log_changed_ro is not None + else resolver.LOG_CHANGED_IRO + ) + use_legacy = ( + use_legacy_ro if use_legacy_ro is not None + else resolver.USE_LEGACY_IRO + ) + + if log_changed or use_legacy: + legacy_ro = resolver.legacy_ro + assert isinstance(legacy_ro, list) + assert isinstance(mro, list) + changed = legacy_ro != mro + if changed: + # Did only Interface move? The fix for issue #8 made that + # somewhat common. It's almost certainly not a problem, though, + # so allow ignoring it. + legacy_without_root = [x for x in legacy_ro if x is not _ROOT] + mro_without_root = [x for x in mro if x is not _ROOT] + changed = legacy_without_root != mro_without_root + + if changed: + comparison = _ROComparison(resolver, mro, legacy_ro) + _logger().warning( + "Object %r has different legacy and C3 MROs:\n%s", + C, comparison + ) + if resolver.had_inconsistency and legacy_ro == mro: + comparison = _ROComparison(resolver, mro, legacy_ro) + _logger().warning( + "Object %r had inconsistent IRO and used the legacy RO:\n%s" + "\nInconsistency entered at:\n%s", + C, comparison, resolver.direct_inconsistency + ) + if use_legacy: + return legacy_ro + + return mro + + +def is_consistent(C): + """Is the resolution order for *C*, consistent according to C3. + + Order as computed by :func:`ro`. + """ + return not C3.resolver(C, False, None).had_inconsistency diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope/interface/tests/__init__.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope/interface/tests/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..c5fe924851ff50cc7611aa414d81c5a25af6bb0c --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope/interface/tests/__init__.py @@ -0,0 +1,130 @@ +from zope.interface._compat import _should_attempt_c_optimizations + + +class OptimizationTestMixin: + """Mixin testing that C optimizations are used when appropriate. + """ + + def _getTargetClass(self): + """Return the implementation in use, without 'Py' or 'Fallback' suffix. + """ + raise NotImplementedError + + def _getFallbackClass(self): + """Return the fallback Python implementation. + """ + # Is there an algorithmic way to do this? The C + # objects all come from the same module so I don't see how we can + # get the Python object from that. + raise NotImplementedError + + def test_optimizations(self): + used = self._getTargetClass() + fallback = self._getFallbackClass() + + if _should_attempt_c_optimizations(): + self.assertIsNot(used, fallback) + else: + self.assertIs(used, fallback) + + +class SubclassableMixin: + + def _getTargetClass(self): + """Return the implementation in use without 'Py' or 'Fallback' suffix. + """ + raise NotImplementedError + + def test_can_subclass(self): + klass = self._getTargetClass() + + class Derived(klass): # no raise + pass + + +class MissingSomeAttrs: + """ + Helper for tests that raises a specific exception + for attributes that are missing. This is usually not + an AttributeError, and this object is used to test that + those errors are not improperly caught and treated like + an AttributeError. + """ + + def __init__(self, exc_kind, **other_attrs): + self.__exc_kind = exc_kind + d = object.__getattribute__(self, '__dict__') + d.update(other_attrs) + + def __getattribute__(self, name): + # Note that we ignore objects found in the class dictionary. + d = object.__getattribute__(self, '__dict__') + try: + return d[name] + except KeyError: + raise d['_MissingSomeAttrs__exc_kind'](name) + + EXCEPTION_CLASSES = ( + TypeError, + RuntimeError, + BaseException, + ValueError, + ) + + @classmethod + def test_raises(cls, unittest, test_func, expected_missing, **other_attrs): + """ + Loop through various exceptions, calling *test_func* inside a + ``assertRaises`` block. + + :param test_func: A callable of one argument, the instance of this + class. + :param str expected_missing: The attribute that should fail with the + exception. This is used to ensure that we're testing the path we + think we are. + :param other_attrs: Attributes that should be provided on the test + object. Must not contain *expected_missing*. + """ + assert isinstance(expected_missing, str) + assert expected_missing not in other_attrs + for exc in cls.EXCEPTION_CLASSES: + ob = cls(exc, **other_attrs) + with unittest.assertRaises(exc) as ex: + test_func(ob) + + unittest.assertEqual(ex.exception.args[0], expected_missing) + + # Now test that the AttributeError for that expected_missing is *not* + # raised. + ob = cls(AttributeError, **other_attrs) + try: + test_func(ob) + except AttributeError as e: + unittest.assertNotIn(expected_missing, str(e)) + except Exception: # pylint:disable=broad-except + pass + +# Be sure cleanup functionality is available; classes that use the adapter hook +# need to be sure to subclass ``CleanUp``. +# +# If zope.component is installed and imported when we run our tests +# (import chain: +# zope.testrunner->zope.security->zope.location->zope.component.api) +# it adds an adapter hook that uses its global site manager. That can cause +# leakage from one test to another unless its cleanup hooks are run. The +# symptoms can be odd, especially if one test used C objects and the next used +# the Python implementation. (For example, you can get strange TypeErrors or +# find inexplicable comparisons being done.) + + +try: + from zope.testing import cleanup +except ImportError: + + class CleanUp: + def cleanUp(self): + pass + + setUp = tearDown = cleanUp +else: + CleanUp = cleanup.CleanUp diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope/interface/tests/advisory_testing.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope/interface/tests/advisory_testing.py new file mode 100644 index 0000000000000000000000000000000000000000..937695520dc9158ec75519a271433930faced186 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope/interface/tests/advisory_testing.py @@ -0,0 +1,29 @@ +############################################################################## +# +# Copyright (c) 2003 Zope Foundation and Contributors. +# All Rights Reserved. +# +# This software is subject to the provisions of the Zope Public License, +# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. +# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED +# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS +# FOR A PARTICULAR PURPOSE. +# +############################################################################## +import sys + +from zope.interface.advice import getFrameInfo + + +my_globals = globals() + +ClassicClass = None + + +class NewStyleClass: + __metaclass__ = type + classLevelFrameInfo = getFrameInfo(sys._getframe()) + + +moduleLevelFrameInfo = getFrameInfo(sys._getframe()) diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope/interface/tests/dummy.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope/interface/tests/dummy.py new file mode 100644 index 0000000000000000000000000000000000000000..8ec85f80e828897c370cf387fa1b16dffc647a12 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope/interface/tests/dummy.py @@ -0,0 +1,25 @@ +############################################################################## +# +# Copyright (c) 2001, 2002 Zope Foundation and Contributors. +# All Rights Reserved. +# +# This software is subject to the provisions of the Zope Public License, +# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. +# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED +# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS +# FOR A PARTICULAR PURPOSE. +# +############################################################################## +""" Dummy Module +""" +from zope.interface import moduleProvides +from zope.interface.tests.idummy import IDummyModule + + +moduleProvides(IDummyModule) + + +def bar(baz): + # Note: no 'self', because the module provides the interface directly. + raise NotImplementedError() diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope/interface/tests/idummy.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope/interface/tests/idummy.py new file mode 100644 index 0000000000000000000000000000000000000000..7855ce7daecd822d24905390bdb1cc31ab1e7a5c --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope/interface/tests/idummy.py @@ -0,0 +1,24 @@ +############################################################################## +# +# Copyright (c) 2001, 2002 Zope Foundation and Contributors. +# All Rights Reserved. +# +# This software is subject to the provisions of the Zope Public License, +# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. +# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED +# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS +# FOR A PARTICULAR PURPOSE. +# +############################################################################## +""" Interface describing API of zope.interface.tests.dummy test module +""" +from zope.interface import Interface + + +class IDummyModule(Interface): + """ Dummy interface for unit tests. + """ + def bar(baz): + """ Just a note. + """ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope/interface/tests/m1.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope/interface/tests/m1.py new file mode 100644 index 0000000000000000000000000000000000000000..8998e46e1f64a6c9a5c453fce348c15572c496a5 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope/interface/tests/m1.py @@ -0,0 +1,28 @@ +############################################################################## +# +# Copyright (c) 2004 Zope Foundation and Contributors. +# All Rights Reserved. +# +# This software is subject to the provisions of the Zope Public License, +# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. +# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED +# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS +# FOR A PARTICULAR PURPOSE. +# +############################################################################## +"""Test module that declares an interface +""" +from zope.interface import Interface +from zope.interface import moduleProvides + + +class I1(Interface): + pass + + +class I2(Interface): + pass + + +moduleProvides(I1, I2) diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope/interface/tests/odd.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope/interface/tests/odd.py new file mode 100644 index 0000000000000000000000000000000000000000..b385beb287a48aebe588b5a052987a7909870877 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope/interface/tests/odd.py @@ -0,0 +1,130 @@ +############################################################################## +# +# Copyright (c) 2003 Zope Foundation and Contributors. +# All Rights Reserved. +# +# This software is subject to the provisions of the Zope Public License, +# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. +# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED +# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS +# FOR A PARTICULAR PURPOSE. +# +############################################################################## +"""Odd meta class that doesn't subclass type. + +This is used for testing support for ExtensionClass in new interfaces. + + >>> class A(object): + ... __metaclass__ = MetaClass + ... a = 1 + ... + >>> A.__name__ + 'A' + >>> A.__bases__ == (object,) + True + >>> class B(object): + ... __metaclass__ = MetaClass + ... b = 1 + ... + >>> class C(A, B): pass + ... + >>> C.__name__ + 'C' + >>> int(C.__bases__ == (A, B)) + 1 + >>> a = A() + >>> aa = A() + >>> a.a + 1 + >>> aa.a + 1 + >>> aa.a = 2 + >>> a.a + 1 + >>> aa.a + 2 + >>> c = C() + >>> c.a + 1 + >>> c.b + 1 + >>> c.b = 2 + >>> c.b + 2 + >>> C.c = 1 + >>> c.c + 1 + + >>> int(C.__class__.__class__ is C.__class__) + 1 +""" + +# class OddClass is an odd meta class + + +class MetaMetaClass(type): + + def __getattribute__(cls, name): + if name == '__class__': + return cls + # Under Python 3.6, __prepare__ gets requested + return type.__getattribute__(cls, name) + + +class MetaClass: + """Odd classes + """ + + def __init__(self, name, bases, dict): + self.__name__ = name + self.__bases__ = bases + self.__dict__.update(dict) + + def __call__(self): + return OddInstance(self) + + def __getattr__(self, name): + for b in self.__bases__: + v = getattr(b, name, self) + if v is not self: + return v + raise AttributeError(name) + + def __repr__(self): # pragma: no cover + return f"" + + +MetaClass = MetaMetaClass( + 'MetaClass', + MetaClass.__bases__, + { + k: v for k, v in MetaClass.__dict__.items() + if k not in ('__dict__',) + } +) + + +class OddInstance: + + def __init__(self, cls): + self.__dict__['__class__'] = cls + + def __getattribute__(self, name): + dict = object.__getattribute__(self, '__dict__') + if name == '__dict__': + return dict + v = dict.get(name, self) + if v is not self: + return v + return getattr(dict['__class__'], name) + + def __setattr__(self, name, v): + self.__dict__[name] = v + + def __delattr__(self, name): + raise NotImplementedError() + + def __repr__(self): # pragma: no cover + return "".format( + self.__class__.__name__, hex(id(self))) diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope/interface/tests/test_adapter.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope/interface/tests/test_adapter.py new file mode 100644 index 0000000000000000000000000000000000000000..ea90732ceca20f4cfa7f79e3f7e32d2f6d04a005 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope/interface/tests/test_adapter.py @@ -0,0 +1,2315 @@ +############################################################################## +# +# Copyright (c) 2003 Zope Foundation and Contributors. +# All Rights Reserved. +# +# This software is subject to the provisions of the Zope Public License, +# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. +# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED +# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS +# FOR A PARTICULAR PURPOSE. +# +############################################################################## +"""Adapter registry tests +""" +import unittest + +from zope.interface.tests import OptimizationTestMixin + + +# pylint:disable=inherit-non-class,protected-access,too-many-lines +# pylint:disable=attribute-defined-outside-init,blacklisted-name + +def _makeInterfaces(): + from zope.interface import Interface + + class IB0(Interface): + pass + + class IB1(IB0): + pass + + class IB2(IB0): + pass + + class IB3(IB2, IB1): + pass + + class IB4(IB1, IB2): + pass + + class IF0(Interface): + pass + + class IF1(IF0): + pass + + class IR0(Interface): + pass + + class IR1(IR0): + pass + + return IB0, IB1, IB2, IB3, IB4, IF0, IF1, IR0, IR1 + + +# Custom types to use as part of the AdapterRegistry data structures. +# Our custom types do strict type checking to make sure +# types propagate through the data tree as expected. +class CustomDataTypeBase: + _data = None + + def __getitem__(self, name): + return self._data[name] + + def __setitem__(self, name, value): + self._data[name] = value + + def __delitem__(self, name): + del self._data[name] + + def __len__(self): + return len(self._data) + + def __contains__(self, name): + return name in self._data + + def __eq__(self, other): + if other is self: + return True + # pylint:disable=unidiomatic-typecheck + if type(other) is not type(self): + return False + return other._data == self._data + + def __repr__(self): + return repr(self._data) + + +class CustomMapping(CustomDataTypeBase): + def __init__(self, other=None): + self._data = {} + if other: + self._data.update(other) + self.get = self._data.get + self.items = self._data.items + + +class CustomSequence(CustomDataTypeBase): + def __init__(self, other=None): + self._data = [] + if other: + self._data.extend(other) + self.append = self._data.append + + +class CustomLeafSequence(CustomSequence): + pass + + +class CustomProvided(CustomMapping): + pass + + +class BaseAdapterRegistryTests(unittest.TestCase): + + maxDiff = None + + def _getBaseAdapterRegistry(self): + from zope.interface.adapter import BaseAdapterRegistry + return BaseAdapterRegistry + + def _getTargetClass(self): + BaseAdapterRegistry = self._getBaseAdapterRegistry() + + class _CUT(BaseAdapterRegistry): + + class LookupClass: + _changed = _extendors = () + + def __init__(self, reg): + pass + + def changed(self, orig): + self._changed += (orig,) + + def add_extendor(self, provided): + self._extendors += (provided,) + + def remove_extendor(self, provided): + self._extendors = tuple([x for x in self._extendors + if x != provided]) + + for name in BaseAdapterRegistry._delegated: + setattr(_CUT.LookupClass, name, object()) + return _CUT + + def _makeOne(self): + return self._getTargetClass()() + + def _getMappingType(self): + return dict + + def _getProvidedType(self): + return dict + + def _getMutableListType(self): + return list + + def _getLeafSequenceType(self): + return tuple + + def test_lookup_delegation(self): + CUT = self._getTargetClass() + registry = CUT() + for name in CUT._delegated: + self.assertIs( + getattr(registry, name), getattr(registry._v_lookup, name) + ) + + def test__generation_on_first_creation(self): + registry = self._makeOne() + # Bumped to 1 in BaseAdapterRegistry.__init__ + self.assertEqual(registry._generation, 1) + + def test__generation_after_calling_changed(self): + registry = self._makeOne() + orig = object() + registry.changed(orig) + # Bumped to 1 in BaseAdapterRegistry.__init__ + self.assertEqual(registry._generation, 2) + self.assertEqual(registry._v_lookup._changed, (registry, orig,)) + + def test__generation_after_changing___bases__(self): + class _Base: + pass + registry = self._makeOne() + registry.__bases__ = (_Base,) + self.assertEqual(registry._generation, 2) + + def _check_basic_types_of_adapters(self, registry, expected_order=2): + self.assertEqual( + len(registry._adapters), expected_order, + ) # order 0 and order 1 + self.assertIsInstance(registry._adapters, self._getMutableListType()) + MT = self._getMappingType() + for mapping in registry._adapters: + self.assertIsInstance(mapping, MT) + self.assertEqual(registry._adapters[0], MT()) + self.assertIsInstance(registry._adapters[1], MT) + self.assertEqual(len(registry._adapters[expected_order - 1]), 1) + + def _check_basic_types_of_subscribers(self, registry, expected_order=2): + self.assertEqual( + len(registry._subscribers), expected_order, + ) # order 0 and order 1 + self.assertIsInstance( + registry._subscribers, self._getMutableListType(), + ) + MT = self._getMappingType() + for mapping in registry._subscribers: + self.assertIsInstance(mapping, MT) + if expected_order: + self.assertEqual(registry._subscribers[0], MT()) + self.assertIsInstance(registry._subscribers[1], MT) + self.assertEqual(len(registry._subscribers[expected_order - 1]), 1) + + def test_register(self): + ( + IB0, IB1, IB2, IB3, IB4, IF0, IF1, IR0, IR1, + ) = _makeInterfaces() # pylint:disable=unused-variable + registry = self._makeOne() + registry.register([IB0], IR0, '', 'A1') + self.assertEqual(registry.registered([IB0], IR0, ''), 'A1') + self.assertEqual(registry._generation, 2) + self._check_basic_types_of_adapters(registry) + MT = self._getMappingType() + self.assertEqual(registry._adapters[1], MT({ + IB0: MT({ + IR0: MT({'': 'A1'}) + }) + })) + PT = self._getProvidedType() + self.assertEqual(registry._provided, PT({ + IR0: 1 + })) + + registered = list(registry.allRegistrations()) + self.assertEqual(registered, [( + (IB0,), # required + IR0, # provided + '', # name + 'A1' # value + )]) + + def test_register_multiple_allRegistrations(self): + ( + IB0, IB1, IB2, IB3, IB4, IF0, IF1, IR0, IR1, + ) = _makeInterfaces() # pylint:disable=unused-variable + registry = self._makeOne() + # Use several different depths and several different names + registry.register([], IR0, '', 'A1') + registry.register([], IR0, 'name1', 'A2') + + registry.register([IB0], IR0, '', 'A1') + registry.register([IB0], IR0, 'name2', 'A2') + registry.register([IB0], IR1, '', 'A3') + registry.register([IB0], IR1, 'name3', 'A4') + + registry.register([IB0, IB1], IR0, '', 'A1') + registry.register([IB0, IB2], IR0, 'name2', 'A2') + registry.register([IB0, IB2], IR1, 'name4', 'A4') + registry.register([IB0, IB3], IR1, '', 'A3') + + def build_adapters(L, MT): + return L([ + # 0 + MT({ + IR0: MT({ + '': 'A1', + 'name1': 'A2' + }) + }), + # 1 + MT({ + IB0: MT({ + IR0: MT({ + '': 'A1', + 'name2': 'A2' + }), + IR1: MT({ + '': 'A3', + 'name3': 'A4' + }) + }) + }), + # 3 + MT({ + IB0: MT({ + IB1: MT({ + IR0: MT({'': 'A1'}) + }), + IB2: MT({ + IR0: MT({'name2': 'A2'}), + IR1: MT({'name4': 'A4'}), + }), + IB3: MT({ + IR1: MT({'': 'A3'}) + }) + }), + }), + ]) + + self.assertEqual(registry._adapters, + build_adapters(L=self._getMutableListType(), + MT=self._getMappingType())) + + registered = sorted(registry.allRegistrations()) + self.assertEqual(registered, [ + ((), IR0, '', 'A1'), + ((), IR0, 'name1', 'A2'), + ((IB0,), IR0, '', 'A1'), + ((IB0,), IR0, 'name2', 'A2'), + ((IB0,), IR1, '', 'A3'), + ((IB0,), IR1, 'name3', 'A4'), + ((IB0, IB1), IR0, '', 'A1'), + ((IB0, IB2), IR0, 'name2', 'A2'), + ((IB0, IB2), IR1, 'name4', 'A4'), + ((IB0, IB3), IR1, '', 'A3') + ]) + + # We can duplicate to another object. + registry2 = self._makeOne() + for args in registered: + registry2.register(*args) + + self.assertEqual(registry2._adapters, registry._adapters) + self.assertEqual(registry2._provided, registry._provided) + + # We can change the types and rebuild the data structures. + registry._mappingType = CustomMapping + registry._leafSequenceType = CustomLeafSequence + registry._sequenceType = CustomSequence + registry._providedType = CustomProvided + + def addValue(existing, new): + existing = ( + existing if existing is not None else CustomLeafSequence() + ) + existing.append(new) + return existing + + registry._addValueToLeaf = addValue + + registry.rebuild() + + self.assertEqual(registry._adapters, + build_adapters( + L=CustomSequence, + MT=CustomMapping + )) + + def test_register_with_invalid_name(self): + ( + IB0, IB1, IB2, IB3, IB4, IF0, IF1, IR0, IR1, + ) = _makeInterfaces() # pylint:disable=unused-variable + registry = self._makeOne() + with self.assertRaises(ValueError): + registry.register([IB0], IR0, object(), 'A1') + + def test_register_with_value_None_unregisters(self): + ( + IB0, IB1, IB2, IB3, IB4, IF0, IF1, IR0, IR1, + ) = _makeInterfaces() # pylint:disable=unused-variable + registry = self._makeOne() + registry.register([None], IR0, '', 'A1') + registry.register([None], IR0, '', None) + self.assertEqual(len(registry._adapters), 0) + self.assertIsInstance(registry._adapters, self._getMutableListType()) + registered = list(registry.allRegistrations()) + self.assertEqual(registered, []) + + def test_register_with_same_value(self): + from zope.interface import Interface + ( + IB0, IB1, IB2, IB3, IB4, IF0, IF1, IR0, IR1, + ) = _makeInterfaces() # pylint:disable=unused-variable + registry = self._makeOne() + _value = object() + registry.register([None], IR0, '', _value) + _before = registry._generation + registry.register([None], IR0, '', _value) + self.assertEqual(registry._generation, _before) # skipped changed() + self._check_basic_types_of_adapters(registry) + MT = self._getMappingType() + self.assertEqual(registry._adapters[1], MT( + { + Interface: MT( + { + IR0: MT({'': _value}) + } + ) + } + )) + registered = list(registry.allRegistrations()) + self.assertEqual(registered, [( + (Interface,), # required + IR0, # provided + '', # name + _value # value + )]) + + def test_registered_empty(self): + registry = self._makeOne() + self.assertEqual(registry.registered([None], None, ''), None) + registered = list(registry.allRegistrations()) + self.assertEqual(registered, []) + + def test_registered_non_empty_miss(self): + ( + IB0, IB1, IB2, IB3, IB4, IF0, IF1, IR0, IR1, + ) = _makeInterfaces() # pylint:disable=unused-variable + registry = self._makeOne() + registry.register([IB1], None, '', 'A1') + self.assertEqual(registry.registered([IB2], None, ''), None) + + def test_registered_non_empty_hit(self): + registry = self._makeOne() + registry.register([None], None, '', 'A1') + self.assertEqual(registry.registered([None], None, ''), 'A1') + + def test_unregister_empty(self): + registry = self._makeOne() + registry.unregister([None], None, '') # doesn't raise + self.assertEqual(registry.registered([None], None, ''), None) + self.assertEqual(len(registry._provided), 0) + + def test_unregister_non_empty_miss_on_required(self): + ( + IB0, IB1, IB2, IB3, IB4, IF0, IF1, IR0, IR1, + ) = _makeInterfaces() # pylint:disable=unused-variable + registry = self._makeOne() + registry.register([IB1], None, '', 'A1') + registry.unregister([IB2], None, '') # doesn't raise + self.assertEqual(registry.registered([IB1], None, ''), 'A1') + self._check_basic_types_of_adapters(registry) + MT = self._getMappingType() + self.assertEqual(registry._adapters[1], MT( + { + IB1: MT( + { + None: MT({'': 'A1'}) + } + ) + } + )) + PT = self._getProvidedType() + self.assertEqual(registry._provided, PT({ + None: 1 + })) + + def test_unregister_non_empty_miss_on_name(self): + ( + IB0, IB1, IB2, IB3, IB4, IF0, IF1, IR0, IR1, + ) = _makeInterfaces() # pylint:disable=unused-variable + registry = self._makeOne() + registry.register([IB1], None, '', 'A1') + registry.unregister([IB1], None, 'nonesuch') # doesn't raise + self.assertEqual(registry.registered([IB1], None, ''), 'A1') + self._check_basic_types_of_adapters(registry) + MT = self._getMappingType() + self.assertEqual(registry._adapters[1], MT( + { + IB1: MT( + { + None: MT({'': 'A1'}) + } + ) + } + )) + PT = self._getProvidedType() + self.assertEqual(registry._provided, PT({ + None: 1 + })) + + def test_unregister_with_value_not_None_miss(self): + ( + IB0, IB1, IB2, IB3, IB4, IF0, IF1, IR0, IR1, + ) = _makeInterfaces() # pylint:disable=unused-variable + registry = self._makeOne() + orig = object() + nomatch = object() + registry.register([IB1], None, '', orig) + registry.unregister([IB1], None, '', nomatch) # doesn't raise + self.assertIs(registry.registered([IB1], None, ''), orig) + + def test_unregister_hit_clears_empty_subcomponents(self): + ( + IB0, IB1, IB2, IB3, IB4, IF0, IF1, IR0, IR1, + ) = _makeInterfaces() # pylint:disable=unused-variable + registry = self._makeOne() + one = object() + another = object() + registry.register([IB1, IB2], None, '', one) + registry.register([IB1, IB3], None, '', another) + self._check_basic_types_of_adapters(registry, expected_order=3) + self.assertIn(IB2, registry._adapters[2][IB1]) + self.assertIn(IB3, registry._adapters[2][IB1]) + MT = self._getMappingType() + self.assertEqual(registry._adapters[2], MT( + { + IB1: MT( + { + IB2: MT({None: MT({'': one})}), + IB3: MT({None: MT({'': another})}) + } + ) + } + )) + PT = self._getProvidedType() + self.assertEqual(registry._provided, PT({ + None: 2 + })) + + registry.unregister([IB1, IB3], None, '', another) + self.assertIn(IB2, registry._adapters[2][IB1]) + self.assertNotIn(IB3, registry._adapters[2][IB1]) + self.assertEqual(registry._adapters[2], MT( + { + IB1: MT( + { + IB2: MT({None: MT({'': one})}), + } + ) + } + )) + self.assertEqual(registry._provided, PT({ + None: 1 + })) + + def test_unsubscribe_empty(self): + registry = self._makeOne() + registry.unsubscribe([None], None, '') # doesn't raise + self.assertEqual(registry.registered([None], None, ''), None) + self._check_basic_types_of_subscribers(registry, expected_order=0) + + def test_unsubscribe_hit(self): + ( + IB0, IB1, IB2, IB3, IB4, IF0, IF1, IR0, IR1, + ) = _makeInterfaces() # pylint:disable=unused-variable + registry = self._makeOne() + orig = object() + registry.subscribe([IB1], None, orig) + MT = self._getMappingType() + L = self._getLeafSequenceType() + PT = self._getProvidedType() + self._check_basic_types_of_subscribers(registry) + self.assertEqual(registry._subscribers[1], MT({ + IB1: MT({ + None: MT({ + '': L((orig,)) + }) + }) + })) + self.assertEqual(registry._provided, PT({})) + registry.unsubscribe([IB1], None, orig) # doesn't raise + self.assertEqual(len(registry._subscribers), 0) + self.assertEqual(registry._provided, PT({})) + + def assertLeafIdentity(self, leaf1, leaf2): + """ + Implementations may choose to use new, immutable objects + instead of mutating existing subscriber leaf objects, or vice versa. + + The default implementation uses immutable tuples, so they are never + the same. Other implementations may use persistent lists so they + should be the same and mutated in place. Subclasses testing this + behaviour need to override this method. + """ + self.assertIsNot(leaf1, leaf2) + + def test_unsubscribe_after_multiple(self): + ( + IB0, IB1, IB2, IB3, IB4, IF0, IF1, IR0, IR1, + ) = _makeInterfaces() # pylint:disable=unused-variable + registry = self._makeOne() + first = object() + second = object() + third = object() + fourth = object() + registry.subscribe([IB1], None, first) + registry.subscribe([IB1], None, second) + registry.subscribe([IB1], IR0, third) + registry.subscribe([IB1], IR0, fourth) + self._check_basic_types_of_subscribers(registry, expected_order=2) + MT = self._getMappingType() + L = self._getLeafSequenceType() + PT = self._getProvidedType() + self.assertEqual(registry._subscribers[1], MT({ + IB1: MT({ + None: MT({'': L((first, second))}), + IR0: MT({'': L((third, fourth))}), + }) + })) + self.assertEqual(registry._provided, PT({ + IR0: 2 + })) + # The leaf objects may or may not stay the same as they are + # unsubscribed, depending on the implementation + IR0_leaf_orig = registry._subscribers[1][IB1][IR0][''] + Non_leaf_orig = registry._subscribers[1][IB1][None][''] + + registry.unsubscribe([IB1], None, first) + registry.unsubscribe([IB1], IR0, third) + + self.assertEqual(registry._subscribers[1], MT({ + IB1: MT({ + None: MT({'': L((second,))}), + IR0: MT({'': L((fourth,))}), + }) + })) + self.assertEqual(registry._provided, PT({ + IR0: 1 + })) + IR0_leaf_new = registry._subscribers[1][IB1][IR0][''] + Non_leaf_new = registry._subscribers[1][IB1][None][''] + + self.assertLeafIdentity(IR0_leaf_orig, IR0_leaf_new) + self.assertLeafIdentity(Non_leaf_orig, Non_leaf_new) + + registry.unsubscribe([IB1], None, second) + registry.unsubscribe([IB1], IR0, fourth) + self.assertEqual(len(registry._subscribers), 0) + self.assertEqual(len(registry._provided), 0) + + def test_subscribe_unsubscribe_identical_objects_provided(self): + # https://github.com/zopefoundation/zope.interface/issues/227 + ( + IB0, IB1, IB2, IB3, IB4, IF0, IF1, IR0, IR1, + ) = _makeInterfaces() # pylint:disable=unused-variable + registry = self._makeOne() + first = object() + registry.subscribe([IB1], IR0, first) + registry.subscribe([IB1], IR0, first) + + MT = self._getMappingType() + L = self._getLeafSequenceType() + PT = self._getProvidedType() + self.assertEqual(registry._subscribers[1], MT({ + IB1: MT({ + IR0: MT({'': L((first, first))}), + }) + })) + self.assertEqual(registry._provided, PT({ + IR0: 2 + })) + + registry.unsubscribe([IB1], IR0, first) + registry.unsubscribe([IB1], IR0, first) + self.assertEqual(len(registry._subscribers), 0) + self.assertEqual(registry._provided, PT()) + + def test_subscribe_unsubscribe_nonequal_objects_provided(self): + # https://github.com/zopefoundation/zope.interface/issues/227 + ( + IB0, IB1, IB2, IB3, IB4, IF0, IF1, IR0, IR1, + ) = _makeInterfaces() # pylint:disable=unused-variable + registry = self._makeOne() + first = object() + second = object() + registry.subscribe([IB1], IR0, first) + registry.subscribe([IB1], IR0, second) + + MT = self._getMappingType() + L = self._getLeafSequenceType() + PT = self._getProvidedType() + self.assertEqual(registry._subscribers[1], MT({ + IB1: MT({ + IR0: MT({'': L((first, second))}), + }) + })) + self.assertEqual(registry._provided, PT({ + IR0: 2 + })) + + registry.unsubscribe([IB1], IR0, first) + registry.unsubscribe([IB1], IR0, second) + self.assertEqual(len(registry._subscribers), 0) + self.assertEqual(registry._provided, PT()) + + def test_subscribed_empty(self): + registry = self._makeOne() + self.assertIsNone(registry.subscribed([None], None, '')) + subscribed = list(registry.allSubscriptions()) + self.assertEqual(subscribed, []) + + def test_subscribed_non_empty_miss(self): + ( + IB0, IB1, IB2, IB3, IB4, IF0, IF1, IR0, IR1, + ) = _makeInterfaces() # pylint:disable=unused-variable + registry = self._makeOne() + registry.subscribe([IB1], IF0, 'A1') + # Mismatch required + self.assertIsNone(registry.subscribed([IB2], IF0, '')) + # Mismatch provided + self.assertIsNone(registry.subscribed([IB1], IF1, '')) + # Mismatch value + self.assertIsNone(registry.subscribed([IB1], IF0, '')) + + def test_subscribed_non_empty_hit(self): + ( + IB0, IB1, IB2, IB3, IB4, IF0, IF1, IR0, IR1, + ) = _makeInterfaces() # pylint:disable=unused-variable + registry = self._makeOne() + registry.subscribe([IB0], IF0, 'A1') + self.assertEqual(registry.subscribed([IB0], IF0, 'A1'), 'A1') + + def test_unsubscribe_w_None_after_multiple(self): + ( + IB0, IB1, IB2, IB3, IB4, IF0, IF1, IR0, IR1, + ) = _makeInterfaces() # pylint:disable=unused-variable + registry = self._makeOne() + first = object() + second = object() + + registry.subscribe([IB1], None, first) + registry.subscribe([IB1], None, second) + self._check_basic_types_of_subscribers(registry, expected_order=2) + registry.unsubscribe([IB1], None) + self.assertEqual(len(registry._subscribers), 0) + + def test_unsubscribe_non_empty_miss_on_required(self): + ( + IB0, IB1, IB2, IB3, IB4, IF0, IF1, IR0, IR1, + ) = _makeInterfaces() # pylint:disable=unused-variable + registry = self._makeOne() + registry.subscribe([IB1], None, 'A1') + self._check_basic_types_of_subscribers(registry, expected_order=2) + registry.unsubscribe([IB2], None, '') # doesn't raise + self.assertEqual(len(registry._subscribers), 2) + MT = self._getMappingType() + L = self._getLeafSequenceType() + self.assertEqual(registry._subscribers[1], MT({ + IB1: MT({ + None: MT({'': L(('A1',))}), + }) + })) + + def test_unsubscribe_non_empty_miss_on_value(self): + ( + IB0, IB1, IB2, IB3, IB4, IF0, IF1, IR0, IR1, + ) = _makeInterfaces() # pylint:disable=unused-variable + registry = self._makeOne() + registry.subscribe([IB1], None, 'A1') + self._check_basic_types_of_subscribers(registry, expected_order=2) + registry.unsubscribe([IB1], None, 'A2') # doesn't raise + self.assertEqual(len(registry._subscribers), 2) + MT = self._getMappingType() + L = self._getLeafSequenceType() + self.assertEqual(registry._subscribers[1], MT({ + IB1: MT({ + None: MT({'': L(('A1',))}), + }) + })) + + def test_unsubscribe_with_value_not_None_miss(self): + ( + IB0, IB1, IB2, IB3, IB4, IF0, IF1, IR0, IR1, + ) = _makeInterfaces() # pylint:disable=unused-variable + registry = self._makeOne() + orig = object() + nomatch = object() + registry.subscribe([IB1], None, orig) + registry.unsubscribe([IB1], None, nomatch) # doesn't raise + self.assertEqual(len(registry._subscribers), 2) + + def _instance_method_notify_target(self): + self.fail("Example method, not intended to be called.") + + def test_unsubscribe_instance_method(self): + # Checking that the values are compared by equality, not identity + ( + IB0, IB1, IB2, IB3, IB4, IF0, IF1, IR0, IR1, + ) = _makeInterfaces() # pylint:disable=unused-variable + registry = self._makeOne() + self.assertEqual(len(registry._subscribers), 0) + registry.subscribe([IB1], None, self._instance_method_notify_target) + registry.unsubscribe([IB1], None, self._instance_method_notify_target) + self.assertEqual(len(registry._subscribers), 0) + + def test_subscribe_multiple_allRegistrations(self): + ( + IB0, IB1, IB2, IB3, IB4, IF0, IF1, IR0, IR1, + ) = _makeInterfaces() # pylint:disable=unused-variable + registry = self._makeOne() + # Use several different depths and several different values + registry.subscribe([], IR0, 'A1') + registry.subscribe([], IR0, 'A2') + + registry.subscribe([IB0], IR0, 'A1') + registry.subscribe([IB0], IR0, 'A2') + registry.subscribe([IB0], IR1, 'A3') + registry.subscribe([IB0], IR1, 'A4') + + registry.subscribe([IB0, IB1], IR0, 'A1') + registry.subscribe([IB0, IB2], IR0, 'A2') + registry.subscribe([IB0, IB2], IR1, 'A4') + registry.subscribe([IB0, IB3], IR1, 'A3') + + def build_subscribers(L, F, MT): + return L([ + # 0 + MT({ + IR0: MT({ + '': F(['A1', 'A2']) + }) + }), + # 1 + MT({ + IB0: MT({ + IR0: MT({ + '': F(['A1', 'A2']) + }), + IR1: MT({ + '': F(['A3', 'A4']) + }) + }) + }), + # 3 + MT({ + IB0: MT({ + IB1: MT({ + IR0: MT({'': F(['A1'])}) + }), + IB2: MT({ + IR0: MT({'': F(['A2'])}), + IR1: MT({'': F(['A4'])}), + }), + IB3: MT({ + IR1: MT({'': F(['A3'])}) + }) + }), + }), + ]) + + self.assertEqual(registry._subscribers, + build_subscribers( + L=self._getMutableListType(), + F=self._getLeafSequenceType(), + MT=self._getMappingType() + )) + + def build_provided(P): + return P({ + IR0: 6, + IR1: 4, + }) + + self.assertEqual(registry._provided, + build_provided(P=self._getProvidedType())) + + registered = sorted(registry.allSubscriptions()) + self.assertEqual(registered, [ + ((), IR0, 'A1'), + ((), IR0, 'A2'), + ((IB0,), IR0, 'A1'), + ((IB0,), IR0, 'A2'), + ((IB0,), IR1, 'A3'), + ((IB0,), IR1, 'A4'), + ((IB0, IB1), IR0, 'A1'), + ((IB0, IB2), IR0, 'A2'), + ((IB0, IB2), IR1, 'A4'), + ((IB0, IB3), IR1, 'A3') + ]) + + # We can duplicate this to another object + registry2 = self._makeOne() + for args in registered: + registry2.subscribe(*args) + + self.assertEqual(registry2._subscribers, registry._subscribers) + self.assertEqual(registry2._provided, registry._provided) + + # We can change the types and rebuild the data structures. + registry._mappingType = CustomMapping + registry._leafSequenceType = CustomLeafSequence + registry._sequenceType = CustomSequence + registry._providedType = CustomProvided + + def addValue(existing, new): + existing = ( + existing if existing is not None else CustomLeafSequence() + ) + existing.append(new) + return existing + + registry._addValueToLeaf = addValue + + registry.rebuild() + + self.assertEqual(registry._subscribers, + build_subscribers( + L=CustomSequence, + F=CustomLeafSequence, + MT=CustomMapping + )) + + +class CustomTypesBaseAdapterRegistryTests(BaseAdapterRegistryTests): + """ + This class may be extended by other packages to test their own + adapter registries that use custom types. (So be cautious about + breaking changes.) + + One known user is ``zope.component.persistentregistry``. + """ + + def _getMappingType(self): + return CustomMapping + + def _getProvidedType(self): + return CustomProvided + + def _getMutableListType(self): + return CustomSequence + + def _getLeafSequenceType(self): + return CustomLeafSequence + + def _getBaseAdapterRegistry(self): + from zope.interface.adapter import BaseAdapterRegistry + + class CustomAdapterRegistry(BaseAdapterRegistry): + _mappingType = self._getMappingType() + _sequenceType = self._getMutableListType() + _leafSequenceType = self._getLeafSequenceType() + _providedType = self._getProvidedType() + + def _addValueToLeaf(self, existing_leaf_sequence, new_item): + if not existing_leaf_sequence: + existing_leaf_sequence = self._leafSequenceType() + existing_leaf_sequence.append(new_item) + return existing_leaf_sequence + + def _removeValueFromLeaf(self, existing_leaf_sequence, to_remove): + without_removed = BaseAdapterRegistry._removeValueFromLeaf( + self, + existing_leaf_sequence, + to_remove) + existing_leaf_sequence[:] = without_removed + assert to_remove not in existing_leaf_sequence + return existing_leaf_sequence + + return CustomAdapterRegistry + + def assertLeafIdentity(self, leaf1, leaf2): + self.assertIs(leaf1, leaf2) + + +class LookupBaseFallbackTests(unittest.TestCase): + + def _getFallbackClass(self): + from zope.interface.adapter import LookupBaseFallback + return LookupBaseFallback + + _getTargetClass = _getFallbackClass + + def _makeOne( + self, uc_lookup=None, uc_lookupAll=None, uc_subscriptions=None, + ): + # pylint:disable=function-redefined + if uc_lookup is None: + + def uc_lookup(self, required, provided, name): + pass + + if uc_lookupAll is None: + + def uc_lookupAll(self, required, provided): + raise NotImplementedError() + + if uc_subscriptions is None: + + def uc_subscriptions(self, required, provided): + raise NotImplementedError() + + class Derived(self._getTargetClass()): + _uncached_lookup = uc_lookup + _uncached_lookupAll = uc_lookupAll + _uncached_subscriptions = uc_subscriptions + + return Derived() + + def test_lookup_w_invalid_name(self): + + def _lookup(self, required, provided, name): + self.fail("This should never be called") + + lb = self._makeOne(uc_lookup=_lookup) + with self.assertRaises(ValueError): + lb.lookup(('A',), 'B', object()) + + def test_lookup_miss_no_default(self): + _called_with = [] + + def _lookup(self, required, provided, name): + _called_with.append((required, provided, name)) + + lb = self._makeOne(uc_lookup=_lookup) + found = lb.lookup(('A',), 'B', 'C') + self.assertIsNone(found) + self.assertEqual(_called_with, [(('A',), 'B', 'C')]) + + def test_lookup_miss_w_default(self): + _called_with = [] + _default = object() + + def _lookup(self, required, provided, name): + _called_with.append((required, provided, name)) + + lb = self._makeOne(uc_lookup=_lookup) + found = lb.lookup(('A',), 'B', 'C', _default) + self.assertIs(found, _default) + self.assertEqual(_called_with, [(('A',), 'B', 'C')]) + + def test_lookup_not_cached(self): + _called_with = [] + a, b, c = object(), object(), object() + _results = [a, b, c] + + def _lookup(self, required, provided, name): + _called_with.append((required, provided, name)) + return _results.pop(0) + + lb = self._makeOne(uc_lookup=_lookup) + found = lb.lookup(('A',), 'B', 'C') + self.assertIs(found, a) + self.assertEqual(_called_with, [(('A',), 'B', 'C')]) + self.assertEqual(_results, [b, c]) + + def test_lookup_cached(self): + _called_with = [] + a, b, c = object(), object(), object() + _results = [a, b, c] + + def _lookup(self, required, provided, name): + _called_with.append((required, provided, name)) + return _results.pop(0) + + lb = self._makeOne(uc_lookup=_lookup) + found = lb.lookup(('A',), 'B', 'C') + found = lb.lookup(('A',), 'B', 'C') + self.assertIs(found, a) + self.assertEqual(_called_with, [(('A',), 'B', 'C')]) + self.assertEqual(_results, [b, c]) + + def test_lookup_not_cached_multi_required(self): + _called_with = [] + a, b, c = object(), object(), object() + _results = [a, b, c] + + def _lookup(self, required, provided, name): + _called_with.append((required, provided, name)) + return _results.pop(0) + + lb = self._makeOne(uc_lookup=_lookup) + found = lb.lookup(('A', 'D'), 'B', 'C') + self.assertIs(found, a) + self.assertEqual(_called_with, [(('A', 'D'), 'B', 'C')]) + self.assertEqual(_results, [b, c]) + + def test_lookup_cached_multi_required(self): + _called_with = [] + a, b, c = object(), object(), object() + _results = [a, b, c] + + def _lookup(self, required, provided, name): + _called_with.append((required, provided, name)) + return _results.pop(0) + + lb = self._makeOne(uc_lookup=_lookup) + found = lb.lookup(('A', 'D'), 'B', 'C') + found = lb.lookup(('A', 'D'), 'B', 'C') + self.assertIs(found, a) + self.assertEqual(_called_with, [(('A', 'D'), 'B', 'C')]) + self.assertEqual(_results, [b, c]) + + def test_lookup_not_cached_after_changed(self): + _called_with = [] + a, b, c = object(), object(), object() + _results = [a, b, c] + + def _lookup(self, required, provided, name): + _called_with.append((required, provided, name)) + return _results.pop(0) + + lb = self._makeOne(uc_lookup=_lookup) + found = lb.lookup(('A',), 'B', 'C') + lb.changed(lb) + found = lb.lookup(('A',), 'B', 'C') + self.assertIs(found, b) + self.assertEqual(_called_with, + [(('A',), 'B', 'C'), (('A',), 'B', 'C')]) + self.assertEqual(_results, [c]) + + def test_lookup1_w_invalid_name(self): + + def _lookup(self, required, provided, name): + self.fail("This should never be called") + + lb = self._makeOne(uc_lookup=_lookup) + with self.assertRaises(ValueError): + lb.lookup1('A', 'B', object()) + + def test_lookup1_miss_no_default(self): + _called_with = [] + + def _lookup(self, required, provided, name): + _called_with.append((required, provided, name)) + + lb = self._makeOne(uc_lookup=_lookup) + found = lb.lookup1('A', 'B', 'C') + self.assertIsNone(found) + self.assertEqual(_called_with, [(('A',), 'B', 'C')]) + + def test_lookup1_miss_w_default(self): + _called_with = [] + _default = object() + + def _lookup(self, required, provided, name): + _called_with.append((required, provided, name)) + + lb = self._makeOne(uc_lookup=_lookup) + found = lb.lookup1('A', 'B', 'C', _default) + self.assertIs(found, _default) + self.assertEqual(_called_with, [(('A',), 'B', 'C')]) + + def test_lookup1_miss_w_default_negative_cache(self): + _called_with = [] + _default = object() + + def _lookup(self, required, provided, name): + _called_with.append((required, provided, name)) + + lb = self._makeOne(uc_lookup=_lookup) + found = lb.lookup1('A', 'B', 'C', _default) + self.assertIs(found, _default) + found = lb.lookup1('A', 'B', 'C', _default) + self.assertIs(found, _default) + self.assertEqual(_called_with, [(('A',), 'B', 'C')]) + + def test_lookup1_not_cached(self): + _called_with = [] + a, b, c = object(), object(), object() + _results = [a, b, c] + + def _lookup(self, required, provided, name): + _called_with.append((required, provided, name)) + return _results.pop(0) + + lb = self._makeOne(uc_lookup=_lookup) + found = lb.lookup1('A', 'B', 'C') + self.assertIs(found, a) + self.assertEqual(_called_with, [(('A',), 'B', 'C')]) + self.assertEqual(_results, [b, c]) + + def test_lookup1_cached(self): + _called_with = [] + a, b, c = object(), object(), object() + _results = [a, b, c] + + def _lookup(self, required, provided, name): + _called_with.append((required, provided, name)) + return _results.pop(0) + + lb = self._makeOne(uc_lookup=_lookup) + found = lb.lookup1('A', 'B', 'C') + found = lb.lookup1('A', 'B', 'C') + self.assertIs(found, a) + self.assertEqual(_called_with, [(('A',), 'B', 'C')]) + self.assertEqual(_results, [b, c]) + + def test_lookup1_not_cached_after_changed(self): + _called_with = [] + a, b, c = object(), object(), object() + _results = [a, b, c] + + def _lookup(self, required, provided, name): + _called_with.append((required, provided, name)) + return _results.pop(0) + + lb = self._makeOne(uc_lookup=_lookup) + found = lb.lookup1('A', 'B', 'C') + lb.changed(lb) + found = lb.lookup1('A', 'B', 'C') + self.assertIs(found, b) + self.assertEqual(_called_with, + [(('A',), 'B', 'C'), (('A',), 'B', 'C')]) + self.assertEqual(_results, [c]) + + def test_adapter_hook_w_invalid_name(self): + req, prv = object(), object() + lb = self._makeOne() + with self.assertRaises(ValueError): + lb.adapter_hook(prv, req, object()) + + def test_adapter_hook_miss_no_default(self): + req, prv = object(), object() + lb = self._makeOne() + found = lb.adapter_hook(prv, req, '') + self.assertIsNone(found) + + def test_adapter_hook_miss_w_default(self): + req, prv, _default = object(), object(), object() + lb = self._makeOne() + found = lb.adapter_hook(prv, req, '', _default) + self.assertIs(found, _default) + + def test_adapter_hook_hit_factory_returns_None(self): + _f_called_with = [] + + def _factory(context): + _f_called_with.append(context) + + def _lookup(self, required, provided, name): + return _factory + + req, prv, _default = object(), object(), object() + lb = self._makeOne(uc_lookup=_lookup) + adapted = lb.adapter_hook(prv, req, 'C', _default) + self.assertIs(adapted, _default) + self.assertEqual(_f_called_with, [req]) + + def test_adapter_hook_hit_factory_returns_adapter(self): + _f_called_with = [] + _adapter = object() + + def _factory(context): + _f_called_with.append(context) + return _adapter + + def _lookup(self, required, provided, name): + return _factory + + req, prv, _default = object(), object(), object() + lb = self._makeOne(uc_lookup=_lookup) + adapted = lb.adapter_hook(prv, req, 'C', _default) + self.assertIs(adapted, _adapter) + self.assertEqual(_f_called_with, [req]) + + def test_adapter_hook_super_unwraps(self): + _f_called_with = [] + + def _factory(context): + _f_called_with.append(context) + return context + + def _lookup(self, required, provided, name=''): + return _factory + + required = super() + provided = object() + lb = self._makeOne(uc_lookup=_lookup) + adapted = lb.adapter_hook(provided, required) + self.assertIs(adapted, self) + self.assertEqual(_f_called_with, [self]) + + def test_queryAdapter(self): + _f_called_with = [] + _adapter = object() + + def _factory(context): + _f_called_with.append(context) + return _adapter + + def _lookup(self, required, provided, name): + return _factory + + req, prv, _default = object(), object(), object() + lb = self._makeOne(uc_lookup=_lookup) + adapted = lb.queryAdapter(req, prv, 'C', _default) + self.assertIs(adapted, _adapter) + self.assertEqual(_f_called_with, [req]) + + def test_lookupAll_uncached(self): + _called_with = [] + _results = [object(), object(), object()] + + def _lookupAll(self, required, provided): + _called_with.append((required, provided)) + return tuple(_results) + + lb = self._makeOne(uc_lookupAll=_lookupAll) + found = lb.lookupAll('A', 'B') + self.assertEqual(found, tuple(_results)) + self.assertEqual(_called_with, [(('A',), 'B')]) + + def test_lookupAll_cached(self): + _called_with = [] + _results = [object(), object(), object()] + + def _lookupAll(self, required, provided): + _called_with.append((required, provided)) + return tuple(_results) + + lb = self._makeOne(uc_lookupAll=_lookupAll) + found = lb.lookupAll('A', 'B') + found = lb.lookupAll('A', 'B') + self.assertEqual(found, tuple(_results)) + self.assertEqual(_called_with, [(('A',), 'B')]) + + def test_subscriptions_uncached(self): + _called_with = [] + _results = [object(), object(), object()] + + def _subscriptions(self, required, provided): + _called_with.append((required, provided)) + return tuple(_results) + + lb = self._makeOne(uc_subscriptions=_subscriptions) + found = lb.subscriptions('A', 'B') + self.assertEqual(found, tuple(_results)) + self.assertEqual(_called_with, [(('A',), 'B')]) + + def test_subscriptions_cached(self): + _called_with = [] + _results = [object(), object(), object()] + + def _subscriptions(self, required, provided): + _called_with.append((required, provided)) + return tuple(_results) + + lb = self._makeOne(uc_subscriptions=_subscriptions) + found = lb.subscriptions('A', 'B') + found = lb.subscriptions('A', 'B') + self.assertEqual(found, tuple(_results)) + self.assertEqual(_called_with, [(('A',), 'B')]) + + +class LookupBaseTests(LookupBaseFallbackTests, + OptimizationTestMixin): + + def _getTargetClass(self): + from zope.interface.adapter import LookupBase + return LookupBase + + +class VerifyingBaseFallbackTests(unittest.TestCase): + + def _getFallbackClass(self): + from zope.interface.adapter import VerifyingBaseFallback + return VerifyingBaseFallback + + _getTargetClass = _getFallbackClass + + def _makeOne(self, registry, uc_lookup=None, uc_lookupAll=None, + uc_subscriptions=None): + # pylint:disable=function-redefined + if uc_lookup is None: + + def uc_lookup(self, required, provided, name): + raise NotImplementedError() + + if uc_lookupAll is None: + + def uc_lookupAll(self, required, provided): + raise NotImplementedError() + + if uc_subscriptions is None: + + def uc_subscriptions(self, required, provided): + raise NotImplementedError() + + class Derived(self._getTargetClass()): + _uncached_lookup = uc_lookup + _uncached_lookupAll = uc_lookupAll + _uncached_subscriptions = uc_subscriptions + + def __init__(self, registry): + super().__init__() + self._registry = registry + + derived = Derived(registry) + derived.changed(derived) # init. '_verify_ro' / '_verify_generations' + return derived + + def _makeRegistry(self, depth): + + class WithGeneration: + _generation = 1 + + class Registry: + def __init__(self, depth): + self.ro = [WithGeneration() for i in range(depth)] + + return Registry(depth) + + def test_lookup(self): + _called_with = [] + a, b, c = object(), object(), object() + _results = [a, b, c] + + def _lookup(self, required, provided, name): + _called_with.append((required, provided, name)) + return _results.pop(0) + + reg = self._makeRegistry(3) + lb = self._makeOne(reg, uc_lookup=_lookup) + found = lb.lookup(('A',), 'B', 'C') + found = lb.lookup(('A',), 'B', 'C') + self.assertIs(found, a) + self.assertEqual(_called_with, [(('A',), 'B', 'C')]) + self.assertEqual(_results, [b, c]) + reg.ro[1]._generation += 1 + found = lb.lookup(('A',), 'B', 'C') + self.assertIs(found, b) + self.assertEqual(_called_with, + [(('A',), 'B', 'C'), (('A',), 'B', 'C')]) + self.assertEqual(_results, [c]) + + def test_lookup1(self): + _called_with = [] + a, b, c = object(), object(), object() + _results = [a, b, c] + + def _lookup(self, required, provided, name): + _called_with.append((required, provided, name)) + return _results.pop(0) + + reg = self._makeRegistry(3) + lb = self._makeOne(reg, uc_lookup=_lookup) + found = lb.lookup1('A', 'B', 'C') + found = lb.lookup1('A', 'B', 'C') + self.assertIs(found, a) + self.assertEqual(_called_with, [(('A',), 'B', 'C')]) + self.assertEqual(_results, [b, c]) + reg.ro[1]._generation += 1 + found = lb.lookup1('A', 'B', 'C') + self.assertIs(found, b) + self.assertEqual(_called_with, + [(('A',), 'B', 'C'), (('A',), 'B', 'C')]) + self.assertEqual(_results, [c]) + + def test_adapter_hook(self): + a, b, _c = [object(), object(), object()] # noqa F841 + + def _factory1(context): + return a + + def _factory2(context): + return b + + def _factory3(context): + self.fail("This should never be called") + + _factories = [_factory1, _factory2, _factory3] + + def _lookup(self, required, provided, name): + return _factories.pop(0) + + req, prv, _default = object(), object(), object() + reg = self._makeRegistry(3) + lb = self._makeOne(reg, uc_lookup=_lookup) + adapted = lb.adapter_hook(prv, req, 'C', _default) + self.assertIs(adapted, a) + adapted = lb.adapter_hook(prv, req, 'C', _default) + self.assertIs(adapted, a) + reg.ro[1]._generation += 1 + adapted = lb.adapter_hook(prv, req, 'C', _default) + self.assertIs(adapted, b) + + def test_queryAdapter(self): + a, b, _c = [object(), object(), object()] # noqa F841 + + def _factory1(context): + return a + + def _factory2(context): + return b + + def _factory3(context): + self.fail("This should never be called") + + _factories = [_factory1, _factory2, _factory3] + + def _lookup(self, required, provided, name): + return _factories.pop(0) + + req, prv, _default = object(), object(), object() + reg = self._makeRegistry(3) + lb = self._makeOne(reg, uc_lookup=_lookup) + adapted = lb.queryAdapter(req, prv, 'C', _default) + self.assertIs(adapted, a) + adapted = lb.queryAdapter(req, prv, 'C', _default) + self.assertIs(adapted, a) + reg.ro[1]._generation += 1 + adapted = lb.adapter_hook(prv, req, 'C', _default) + self.assertIs(adapted, b) + + def test_lookupAll(self): + _results_1 = [object(), object(), object()] + _results_2 = [object(), object(), object()] + _results = [_results_1, _results_2] + + def _lookupAll(self, required, provided): + return tuple(_results.pop(0)) + + reg = self._makeRegistry(3) + lb = self._makeOne(reg, uc_lookupAll=_lookupAll) + found = lb.lookupAll('A', 'B') + self.assertEqual(found, tuple(_results_1)) + found = lb.lookupAll('A', 'B') + self.assertEqual(found, tuple(_results_1)) + reg.ro[1]._generation += 1 + found = lb.lookupAll('A', 'B') + self.assertEqual(found, tuple(_results_2)) + + def test_subscriptions(self): + _results_1 = [object(), object(), object()] + _results_2 = [object(), object(), object()] + _results = [_results_1, _results_2] + + def _subscriptions(self, required, provided): + return tuple(_results.pop(0)) + + reg = self._makeRegistry(3) + lb = self._makeOne(reg, uc_subscriptions=_subscriptions) + found = lb.subscriptions('A', 'B') + self.assertEqual(found, tuple(_results_1)) + found = lb.subscriptions('A', 'B') + self.assertEqual(found, tuple(_results_1)) + reg.ro[1]._generation += 1 + found = lb.subscriptions('A', 'B') + self.assertEqual(found, tuple(_results_2)) + + +class VerifyingBaseTests(VerifyingBaseFallbackTests, + OptimizationTestMixin): + + def _getTargetClass(self): + from zope.interface.adapter import VerifyingBase + return VerifyingBase + + +class AdapterLookupBaseTests(unittest.TestCase): + + def _getTargetClass(self): + from zope.interface.adapter import AdapterLookupBase + return AdapterLookupBase + + def _makeOne(self, registry): + return self._getTargetClass()(registry) + + def _makeSubregistry(self, *provided): + + class Subregistry: + def __init__(self): + self._adapters = [] + self._subscribers = [] + + return Subregistry() + + def _makeRegistry(self, *provided): + + class Registry: + def __init__(self, provided): + self._provided = provided + self.ro = [] + + return Registry(provided) + + def test_ctor_empty_registry(self): + registry = self._makeRegistry() + alb = self._makeOne(registry) + self.assertEqual(alb._extendors, {}) + + def test_ctor_w_registry_provided(self): + from zope.interface import Interface + from zope.interface.interface import InterfaceClass + IFoo = InterfaceClass('IFoo') + IBar = InterfaceClass('IBar', (IFoo,)) + registry = self._makeRegistry(IFoo, IBar) + alb = self._makeOne(registry) + self.assertEqual(sorted(alb._extendors.keys()), + sorted([IBar, IFoo, Interface])) + self.assertEqual(alb._extendors[IFoo], [IFoo, IBar]) + self.assertEqual(alb._extendors[IBar], [IBar]) + self.assertEqual(sorted(alb._extendors[Interface]), + sorted([IFoo, IBar])) + + def test_changed_empty_required(self): + # ALB.changed expects to call a mixed in changed. + + class Mixin: + def changed(self, *other): + pass + + class Derived(self._getTargetClass(), Mixin): + pass + + registry = self._makeRegistry() + alb = Derived(registry) + alb.changed(alb) + + def test_changed_w_required(self): + # ALB.changed expects to call a mixed in changed. + + class Mixin: + def changed(self, *other): + pass + + class Derived(self._getTargetClass(), Mixin): + pass + + class FauxWeakref: + _unsub = None + + def __init__(self, here): + self._here = here + + def __call__(self): + return self if self._here else None + + def unsubscribe(self, target): + self._unsub = target + + gone = FauxWeakref(False) + here = FauxWeakref(True) + registry = self._makeRegistry() + alb = Derived(registry) + alb._required[gone] = 1 + alb._required[here] = 1 + alb.changed(alb) + self.assertEqual(len(alb._required), 0) + self.assertEqual(gone._unsub, None) + self.assertEqual(here._unsub, alb) + + def test_init_extendors_after_registry_update(self): + from zope.interface import Interface + from zope.interface.interface import InterfaceClass + IFoo = InterfaceClass('IFoo') + IBar = InterfaceClass('IBar', (IFoo,)) + registry = self._makeRegistry() + alb = self._makeOne(registry) + registry._provided = [IFoo, IBar] + alb.init_extendors() + self.assertEqual(sorted(alb._extendors.keys()), + sorted([IBar, IFoo, Interface])) + self.assertEqual(alb._extendors[IFoo], [IFoo, IBar]) + self.assertEqual(alb._extendors[IBar], [IBar]) + self.assertEqual(sorted(alb._extendors[Interface]), + sorted([IFoo, IBar])) + + def test_add_extendor(self): + from zope.interface import Interface + from zope.interface.interface import InterfaceClass + IFoo = InterfaceClass('IFoo') + IBar = InterfaceClass('IBar', (IFoo,)) + registry = self._makeRegistry() + alb = self._makeOne(registry) + alb.add_extendor(IFoo) + alb.add_extendor(IBar) + self.assertEqual(sorted(alb._extendors.keys()), + sorted([IBar, IFoo, Interface])) + self.assertEqual(alb._extendors[IFoo], [IFoo, IBar]) + self.assertEqual(alb._extendors[IBar], [IBar]) + self.assertEqual(sorted(alb._extendors[Interface]), + sorted([IFoo, IBar])) + + def test_remove_extendor(self): + from zope.interface import Interface + from zope.interface.interface import InterfaceClass + IFoo = InterfaceClass('IFoo') + IBar = InterfaceClass('IBar', (IFoo,)) + registry = self._makeRegistry(IFoo, IBar) + alb = self._makeOne(registry) + alb.remove_extendor(IFoo) + self.assertEqual(sorted(alb._extendors.keys()), + sorted([IFoo, IBar, Interface])) + self.assertEqual(alb._extendors[IFoo], [IBar]) + self.assertEqual(alb._extendors[IBar], [IBar]) + self.assertEqual(sorted(alb._extendors[Interface]), + sorted([IBar])) + + # test '_subscribe' via its callers, '_uncached_lookup', etc. + + def test__uncached_lookup_empty_ro(self): + from zope.interface.interface import InterfaceClass + IFoo = InterfaceClass('IFoo') + IBar = InterfaceClass('IBar', (IFoo,)) + registry = self._makeRegistry() + alb = self._makeOne(registry) + result = alb._uncached_lookup((IFoo,), IBar) + self.assertEqual(result, None) + self.assertEqual(len(alb._required), 1) + self.assertIn(IFoo.weakref(), alb._required) + + def test__uncached_lookup_order_miss(self): + from zope.interface.interface import InterfaceClass + IFoo = InterfaceClass('IFoo') + IBar = InterfaceClass('IBar', (IFoo,)) + registry = self._makeRegistry(IFoo, IBar) + subr = self._makeSubregistry() + registry.ro.append(subr) + alb = self._makeOne(registry) + result = alb._uncached_lookup((IFoo,), IBar) + self.assertEqual(result, None) + + def test__uncached_lookup_extendors_miss(self): + from zope.interface.interface import InterfaceClass + IFoo = InterfaceClass('IFoo') + IBar = InterfaceClass('IBar', (IFoo,)) + registry = self._makeRegistry() + subr = self._makeSubregistry() + subr._adapters = [{}, {}] # utilities, single adapters + registry.ro.append(subr) + alb = self._makeOne(registry) + subr._v_lookup = alb + result = alb._uncached_lookup((IFoo,), IBar) + self.assertEqual(result, None) + + def test__uncached_lookup_components_miss_wrong_iface(self): + from zope.interface.interface import InterfaceClass + IFoo = InterfaceClass('IFoo') + IBar = InterfaceClass('IBar', (IFoo,)) + IQux = InterfaceClass('IQux') + registry = self._makeRegistry(IFoo, IBar) + subr = self._makeSubregistry() + irrelevant = object() + subr._adapters = [ # utilities, single adapters + {}, + { + IFoo: { + IQux: {'': irrelevant}, + }, + }, + ] + registry.ro.append(subr) + alb = self._makeOne(registry) + subr._v_lookup = alb + result = alb._uncached_lookup((IFoo,), IBar) + self.assertEqual(result, None) + + def test__uncached_lookup_components_miss_wrong_name(self): + from zope.interface.interface import InterfaceClass + IFoo = InterfaceClass('IFoo') + IBar = InterfaceClass('IBar', (IFoo,)) + registry = self._makeRegistry(IFoo, IBar) + subr = self._makeSubregistry() + + wrongname = object() + subr._adapters = [ # utilities, single adapters + {}, + { + IFoo: { + IBar: {'wrongname': wrongname}, + }, + }, + ] + registry.ro.append(subr) + alb = self._makeOne(registry) + subr._v_lookup = alb + result = alb._uncached_lookup((IFoo,), IBar) + self.assertEqual(result, None) + + def test__uncached_lookup_simple_hit(self): + from zope.interface.interface import InterfaceClass + IFoo = InterfaceClass('IFoo') + IBar = InterfaceClass('IBar', (IFoo,)) + registry = self._makeRegistry(IFoo, IBar) + subr = self._makeSubregistry() + _expected = object() + subr._adapters = [ # utilities, single adapters + {}, + {IFoo: {IBar: {'': _expected}}}, + ] + registry.ro.append(subr) + alb = self._makeOne(registry) + subr._v_lookup = alb + result = alb._uncached_lookup((IFoo,), IBar) + self.assertIs(result, _expected) + + def test__uncached_lookup_repeated_hit(self): + from zope.interface.interface import InterfaceClass + IFoo = InterfaceClass('IFoo') + IBar = InterfaceClass('IBar', (IFoo,)) + registry = self._makeRegistry(IFoo, IBar) + subr = self._makeSubregistry() + _expected = object() + subr._adapters = [ # utilities, single adapters + {}, + {IFoo: {IBar: {'': _expected}}}, + ] + registry.ro.append(subr) + alb = self._makeOne(registry) + subr._v_lookup = alb + result = alb._uncached_lookup((IFoo,), IBar) + result2 = alb._uncached_lookup((IFoo,), IBar) + self.assertIs(result, _expected) + self.assertIs(result2, _expected) + + def test_queryMultiAdaptor_lookup_miss(self): + from zope.interface.declarations import implementer + from zope.interface.interface import InterfaceClass + IFoo = InterfaceClass('IFoo') + IBar = InterfaceClass('IBar', (IFoo,)) + + @implementer(IFoo) + class Foo: + pass + + foo = Foo() + registry = self._makeRegistry() + subr = self._makeSubregistry() + subr._adapters = [ # utilities, single adapters + {}, + {}, + ] + registry.ro.append(subr) + alb = self._makeOne(registry) + alb.lookup = alb._uncached_lookup # provided by derived + subr._v_lookup = alb + _default = object() + result = alb.queryMultiAdapter((foo,), IBar, default=_default) + self.assertIs(result, _default) + + def test_queryMultiAdapter_errors_on_attribute_access(self): + # Any error on attribute access previously lead to using the _empty + # singleton as "requires" argument (See + # https://github.com/zopefoundation/zope.interface/issues/162) + # but after https://github.com/zopefoundation/zope.interface/issues/200 + # they get propagated. + from zope.interface.interface import InterfaceClass + from zope.interface.tests import MissingSomeAttrs + + IFoo = InterfaceClass('IFoo') + registry = self._makeRegistry() + alb = self._makeOne(registry) + alb.lookup = alb._uncached_lookup + + def test(ob): + return alb.queryMultiAdapter( + (ob,), + IFoo, + ) + + MissingSomeAttrs.test_raises(self, test, expected_missing='__class__') + + def test_queryMultiAdaptor_factory_miss(self): + from zope.interface.declarations import implementer + from zope.interface.interface import InterfaceClass + IFoo = InterfaceClass('IFoo') + IBar = InterfaceClass('IBar', (IFoo,)) + + @implementer(IFoo) + class Foo: + pass + + foo = Foo() + registry = self._makeRegistry(IFoo, IBar) + subr = self._makeSubregistry() + _called_with = [] + + def _factory(context): + _called_with.append(context) + + subr._adapters = [ # utilities, single adapters + {}, + {IFoo: {IBar: {'': _factory}}}, + ] + registry.ro.append(subr) + alb = self._makeOne(registry) + alb.lookup = alb._uncached_lookup # provided by derived + subr._v_lookup = alb + _default = object() + result = alb.queryMultiAdapter((foo,), IBar, default=_default) + self.assertIs(result, _default) + self.assertEqual(_called_with, [foo]) + + def test_queryMultiAdaptor_factory_hit(self): + from zope.interface.declarations import implementer + from zope.interface.interface import InterfaceClass + IFoo = InterfaceClass('IFoo') + IBar = InterfaceClass('IBar', (IFoo,)) + + @implementer(IFoo) + class Foo: + pass + + foo = Foo() + registry = self._makeRegistry(IFoo, IBar) + subr = self._makeSubregistry() + _expected = object() + _called_with = [] + + def _factory(context): + _called_with.append(context) + return _expected + + subr._adapters = [ # utilities, single adapters + {}, + {IFoo: {IBar: {'': _factory}}}, + ] + registry.ro.append(subr) + alb = self._makeOne(registry) + alb.lookup = alb._uncached_lookup # provided by derived + subr._v_lookup = alb + _default = object() + result = alb.queryMultiAdapter((foo,), IBar, default=_default) + self.assertIs(result, _expected) + self.assertEqual(_called_with, [foo]) + + def test_queryMultiAdapter_super_unwraps(self): + alb = self._makeOne(self._makeRegistry()) + + def lookup(*args): + return factory + + def factory(*args): + return args + + alb.lookup = lookup + + objects = [ + super(), + 42, + "abc", + super(), + ] + + result = alb.queryMultiAdapter(objects, None) + self.assertEqual(result, ( + self, + 42, + "abc", + self, + )) + + def test__uncached_lookupAll_empty_ro(self): + from zope.interface.interface import InterfaceClass + IFoo = InterfaceClass('IFoo') + IBar = InterfaceClass('IBar', (IFoo,)) + registry = self._makeRegistry() + alb = self._makeOne(registry) + result = alb._uncached_lookupAll((IFoo,), IBar) + self.assertEqual(result, ()) + self.assertEqual(len(alb._required), 1) + self.assertIn(IFoo.weakref(), alb._required) + + def test__uncached_lookupAll_order_miss(self): + from zope.interface.interface import InterfaceClass + IFoo = InterfaceClass('IFoo') + IBar = InterfaceClass('IBar', (IFoo,)) + registry = self._makeRegistry(IFoo, IBar) + subr = self._makeSubregistry() + registry.ro.append(subr) + alb = self._makeOne(registry) + subr._v_lookup = alb + result = alb._uncached_lookupAll((IFoo,), IBar) + self.assertEqual(result, ()) + + def test__uncached_lookupAll_extendors_miss(self): + from zope.interface.interface import InterfaceClass + IFoo = InterfaceClass('IFoo') + IBar = InterfaceClass('IBar', (IFoo,)) + registry = self._makeRegistry() + subr = self._makeSubregistry() + subr._adapters = [{}, {}] # utilities, single adapters + registry.ro.append(subr) + alb = self._makeOne(registry) + subr._v_lookup = alb + result = alb._uncached_lookupAll((IFoo,), IBar) + self.assertEqual(result, ()) + + def test__uncached_lookupAll_components_miss(self): + from zope.interface.interface import InterfaceClass + IFoo = InterfaceClass('IFoo') + IBar = InterfaceClass('IBar', (IFoo,)) + IQux = InterfaceClass('IQux') + registry = self._makeRegistry(IFoo, IBar) + subr = self._makeSubregistry() + irrelevant = object() + subr._adapters = [ # utilities, single adapters + {}, + {IFoo: {IQux: {'': irrelevant}}}, + ] + registry.ro.append(subr) + alb = self._makeOne(registry) + subr._v_lookup = alb + result = alb._uncached_lookupAll((IFoo,), IBar) + self.assertEqual(result, ()) + + def test__uncached_lookupAll_simple_hit(self): + from zope.interface.interface import InterfaceClass + IFoo = InterfaceClass('IFoo') + IBar = InterfaceClass('IBar', (IFoo,)) + registry = self._makeRegistry(IFoo, IBar) + subr = self._makeSubregistry() + _expected = object() + _named = object() + subr._adapters = [ # utilities, single adapters + {}, + {IFoo: {IBar: {'': _expected, 'named': _named}}}, + ] + registry.ro.append(subr) + alb = self._makeOne(registry) + subr._v_lookup = alb + result = alb._uncached_lookupAll((IFoo,), IBar) + self.assertEqual(sorted(result), [('', _expected), ('named', _named)]) + + def test_names(self): + from zope.interface.interface import InterfaceClass + IFoo = InterfaceClass('IFoo') + IBar = InterfaceClass('IBar', (IFoo,)) + registry = self._makeRegistry(IFoo, IBar) + subr = self._makeSubregistry() + _expected = object() + _named = object() + subr._adapters = [ # utilities, single adapters + {}, + {IFoo: {IBar: {'': _expected, 'named': _named}}}, + ] + registry.ro.append(subr) + alb = self._makeOne(registry) + alb.lookupAll = alb._uncached_lookupAll + subr._v_lookup = alb + result = alb.names((IFoo,), IBar) + self.assertEqual(sorted(result), ['', 'named']) + + def test__uncached_subscriptions_empty_ro(self): + from zope.interface.interface import InterfaceClass + IFoo = InterfaceClass('IFoo') + IBar = InterfaceClass('IBar', (IFoo,)) + registry = self._makeRegistry() + alb = self._makeOne(registry) + result = alb._uncached_subscriptions((IFoo,), IBar) + self.assertEqual(result, []) + self.assertEqual(len(alb._required), 1) + self.assertIn(IFoo.weakref(), alb._required) + + def test__uncached_subscriptions_order_miss(self): + from zope.interface.interface import InterfaceClass + IFoo = InterfaceClass('IFoo') + IBar = InterfaceClass('IBar', (IFoo,)) + registry = self._makeRegistry(IFoo, IBar) + subr = self._makeSubregistry() + registry.ro.append(subr) + alb = self._makeOne(registry) + subr._v_lookup = alb + result = alb._uncached_subscriptions((IFoo,), IBar) + self.assertEqual(result, []) + + def test__uncached_subscriptions_extendors_miss(self): + from zope.interface.interface import InterfaceClass + IFoo = InterfaceClass('IFoo') + IBar = InterfaceClass('IBar', (IFoo,)) + registry = self._makeRegistry() + subr = self._makeSubregistry() + subr._subscribers = [{}, {}] # utilities, single adapters + registry.ro.append(subr) + alb = self._makeOne(registry) + subr._v_lookup = alb + result = alb._uncached_subscriptions((IFoo,), IBar) + self.assertEqual(result, []) + + def test__uncached_subscriptions_components_miss_wrong_iface(self): + from zope.interface.interface import InterfaceClass + IFoo = InterfaceClass('IFoo') + IBar = InterfaceClass('IBar', (IFoo,)) + IQux = InterfaceClass('IQux') + registry = self._makeRegistry(IFoo, IBar) + subr = self._makeSubregistry() + irrelevant = object() + subr._subscribers = [ # utilities, single adapters + {}, + {IFoo: {IQux: {'': irrelevant}}}, + ] + registry.ro.append(subr) + alb = self._makeOne(registry) + subr._v_lookup = alb + result = alb._uncached_subscriptions((IFoo,), IBar) + self.assertEqual(result, []) + + def test__uncached_subscriptions_components_miss_wrong_name(self): + from zope.interface.interface import InterfaceClass + IFoo = InterfaceClass('IFoo') + IBar = InterfaceClass('IBar', (IFoo,)) + registry = self._makeRegistry(IFoo, IBar) + subr = self._makeSubregistry() + wrongname = object() + subr._subscribers = [ # utilities, single adapters + {}, + {IFoo: {IBar: {'wrongname': wrongname}}}, + ] + registry.ro.append(subr) + alb = self._makeOne(registry) + subr._v_lookup = alb + result = alb._uncached_subscriptions((IFoo,), IBar) + self.assertEqual(result, []) + + def test__uncached_subscriptions_simple_hit(self): + from zope.interface.interface import InterfaceClass + IFoo = InterfaceClass('IFoo') + IBar = InterfaceClass('IBar', (IFoo,)) + registry = self._makeRegistry(IFoo, IBar) + subr = self._makeSubregistry() + + class Foo: + + def __lt__(self, other): + return True + + _exp1, _exp2 = Foo(), Foo() + subr._subscribers = [ # utilities, single adapters + {}, + {IFoo: {IBar: {'': (_exp1, _exp2)}}}, + ] + registry.ro.append(subr) + alb = self._makeOne(registry) + subr._v_lookup = alb + result = alb._uncached_subscriptions((IFoo,), IBar) + self.assertEqual(sorted(result), sorted([_exp1, _exp2])) + + def test_subscribers_wo_provided(self): + from zope.interface.declarations import implementer + from zope.interface.interface import InterfaceClass + IFoo = InterfaceClass('IFoo') + IBar = InterfaceClass('IBar', (IFoo,)) + + @implementer(IFoo) + class Foo: + pass + + foo = Foo() + registry = self._makeRegistry(IFoo, IBar) + registry = self._makeRegistry(IFoo, IBar) + subr = self._makeSubregistry() + _called = {} + + def _factory1(context): + _called.setdefault('_factory1', []).append(context) + + def _factory2(context): + _called.setdefault('_factory2', []).append(context) + + subr._subscribers = [ # utilities, single adapters + {}, + {IFoo: {None: {'': (_factory1, _factory2)}}}, + ] + registry.ro.append(subr) + alb = self._makeOne(registry) + alb.subscriptions = alb._uncached_subscriptions + subr._v_lookup = alb + result = alb.subscribers((foo,), None) + self.assertEqual(result, ()) + self.assertEqual(_called, {'_factory1': [foo], '_factory2': [foo]}) + + def test_subscribers_w_provided(self): + from zope.interface.declarations import implementer + from zope.interface.interface import InterfaceClass + IFoo = InterfaceClass('IFoo') + IBar = InterfaceClass('IBar', (IFoo,)) + + @implementer(IFoo) + class Foo: + pass + + foo = Foo() + registry = self._makeRegistry(IFoo, IBar) + registry = self._makeRegistry(IFoo, IBar) + subr = self._makeSubregistry() + _called = {} + _exp1, _exp2 = object(), object() + + def _factory1(context): + _called.setdefault('_factory1', []).append(context) + return _exp1 + + def _factory2(context): + _called.setdefault('_factory2', []).append(context) + return _exp2 + + def _side_effect_only(context): + _called.setdefault('_side_effect_only', []).append(context) + + subr._subscribers = [ # utilities, single adapters + {}, + {IFoo: {IBar: {'': (_factory1, _factory2, _side_effect_only)}}}, + ] + registry.ro.append(subr) + alb = self._makeOne(registry) + alb.subscriptions = alb._uncached_subscriptions + subr._v_lookup = alb + result = alb.subscribers((foo,), IBar) + self.assertEqual(result, [_exp1, _exp2]) + self.assertEqual( + _called, { + '_factory1': [foo], + '_factory2': [foo], + '_side_effect_only': [foo], + } + ) + + +class VerifyingAdapterRegistryTests(unittest.TestCase): + # This is also the base for AdapterRegistryTests. That makes the + # inheritance seems backwards, but even though they implement the + # same interfaces, VAR and AR each only extend BAR; and neither + # one will pass the test cases for BAR (it uses a special + # LookupClass just for the tests). + + def _getTargetClass(self): + from zope.interface.adapter import VerifyingAdapterRegistry + return VerifyingAdapterRegistry + + def _makeOne(self, *args, **kw): + return self._getTargetClass()(*args, **kw) + + def test_verify_object_provides_IAdapterRegistry(self): + from zope.interface.interfaces import IAdapterRegistry + from zope.interface.verify import verifyObject + registry = self._makeOne() + verifyObject(IAdapterRegistry, registry) + + +class AdapterRegistryTests(VerifyingAdapterRegistryTests): + + def _getTargetClass(self): + from zope.interface.adapter import AdapterRegistry + return AdapterRegistry + + def test_ctor_no_bases(self): + ar = self._makeOne() + self.assertEqual(len(ar._v_subregistries), 0) + + def test_ctor_w_bases(self): + base = self._makeOne() + sub = self._makeOne([base]) + self.assertEqual(len(sub._v_subregistries), 0) + self.assertEqual(len(base._v_subregistries), 1) + self.assertIn(sub, base._v_subregistries) + + # test _addSubregistry / _removeSubregistry via only caller, _setBases + + def test__setBases_removing_existing_subregistry(self): + before = self._makeOne() + after = self._makeOne() + sub = self._makeOne([before]) + sub.__bases__ = [after] + self.assertEqual(len(before._v_subregistries), 0) + self.assertEqual(len(after._v_subregistries), 1) + self.assertIn(sub, after._v_subregistries) + + def test__setBases_wo_stray_entry(self): + before = self._makeOne() + stray = self._makeOne() + after = self._makeOne() + sub = self._makeOne([before]) + sub.__dict__['__bases__'].append(stray) + sub.__bases__ = [after] + self.assertEqual(len(before._v_subregistries), 0) + self.assertEqual(len(after._v_subregistries), 1) + self.assertIn(sub, after._v_subregistries) + + def test__setBases_w_existing_entry_continuing(self): + before = self._makeOne() + after = self._makeOne() + sub = self._makeOne([before]) + sub.__bases__ = [before, after] + self.assertEqual(len(before._v_subregistries), 1) + self.assertEqual(len(after._v_subregistries), 1) + self.assertIn(sub, before._v_subregistries) + self.assertIn(sub, after._v_subregistries) + + def test_changed_w_subregistries(self): + base = self._makeOne() + + class Derived: + _changed = None + + def changed(self, originally_changed): + self._changed = originally_changed + + derived1, derived2 = Derived(), Derived() + base._addSubregistry(derived1) + base._addSubregistry(derived2) + orig = object() + base.changed(orig) + self.assertIs(derived1._changed, orig) + self.assertIs(derived2._changed, orig) + + +class Test_utils(unittest.TestCase): + + def test__convert_None_to_Interface_w_None(self): + from zope.interface.adapter import _convert_None_to_Interface + from zope.interface.interface import Interface + self.assertIs(_convert_None_to_Interface(None), Interface) + + def test__convert_None_to_Interface_w_other(self): + from zope.interface.adapter import _convert_None_to_Interface + other = object() + self.assertIs(_convert_None_to_Interface(other), other) + + def test__normalize_name_str(self): + from zope.interface.adapter import _normalize_name + STR = b'str' + UNICODE = 'str' + norm = _normalize_name(STR) + self.assertEqual(norm, UNICODE) + self.assertIsInstance(norm, type(UNICODE)) + + def test__normalize_name_unicode(self): + from zope.interface.adapter import _normalize_name + + USTR = 'ustr' + self.assertEqual(_normalize_name(USTR), USTR) + + def test__normalize_name_other(self): + from zope.interface.adapter import _normalize_name + for other in 1, 1.0, (), [], {}, object(): + self.assertRaises(TypeError, _normalize_name, other) + + # _lookup, _lookupAll, and _subscriptions tested via their callers + # (AdapterLookupBase.{lookup,lookupAll,subscriptions}). diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope/interface/tests/test_advice.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope/interface/tests/test_advice.py new file mode 100644 index 0000000000000000000000000000000000000000..9612b6f78416085b83559e6f25db035da8da2815 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope/interface/tests/test_advice.py @@ -0,0 +1,217 @@ +############################################################################## +# +# Copyright (c) 2003 Zope Foundation and Contributors. +# All Rights Reserved. +# +# This software is subject to the provisions of the Zope Public License, +# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. +# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED +# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS +# FOR A PARTICULAR PURPOSE. +# +############################################################################## +"""Tests for advice + +This module was adapted from 'protocols.tests.advice', part of the Python +Enterprise Application Kit (PEAK). Please notify the PEAK authors +(pje@telecommunity.com and tsarna@sarna.org) if bugs are found or +Zope-specific changes are required, so that the PEAK version of this module +can be kept in sync. + +PEAK is a Python application framework that interoperates with (but does +not require) Zope 3 and Twisted. It provides tools for manipulating UML +models, object-relational persistence, aspect-oriented programming, and more. +Visit the PEAK home page at http://peak.telecommunity.com for more information. +""" + +import sys +import unittest + + +class FrameInfoTest(unittest.TestCase): + + def test_w_module(self): + from zope.interface.tests import advisory_testing + (kind, module, + f_locals, f_globals) = advisory_testing.moduleLevelFrameInfo + self.assertEqual(kind, "module") + for d in module.__dict__, f_locals, f_globals: + self.assertIs(d, advisory_testing.my_globals) + + def test_w_class(self): + from zope.interface.tests import advisory_testing + (kind, + module, + f_locals, + f_globals) = advisory_testing.NewStyleClass.classLevelFrameInfo + self.assertEqual(kind, "class") + + for d in module.__dict__, f_globals: + self.assertIs(d, advisory_testing.my_globals) + + def test_inside_function_call(self): + from zope.interface.advice import getFrameInfo + kind, module, f_locals, f_globals = getFrameInfo(sys._getframe()) + self.assertEqual(kind, "function call") + + frame = sys._getframe() + self.assertEqual(f_locals, frame.f_locals) + self.assertEqual(f_locals, locals()) + + for d in module.__dict__, f_globals: + self.assertIs(d, globals()) + + def test_inside_exec(self): + from zope.interface.advice import getFrameInfo + _globals = {'getFrameInfo': getFrameInfo} + _locals = {} + exec(_FUNKY_EXEC, _globals, _locals) + self.assertEqual(_locals['kind'], "exec") + self.assertIs(_locals['f_locals'], _locals) + self.assertIsNone(_locals['module']) + self.assertIs(_locals['f_globals'], _globals) + + +_FUNKY_EXEC = """\ +import sys +kind, module, f_locals, f_globals = getFrameInfo(sys._getframe()) +""" + + +class Test_isClassAdvisor(unittest.TestCase): + + def _callFUT(self, *args, **kw): + from zope.interface.advice import isClassAdvisor + return isClassAdvisor(*args, **kw) + + def test_w_non_function(self): + self.assertEqual(self._callFUT(self), False) + + def test_w_normal_function(self): + + def foo(): + raise NotImplementedError() + + self.assertEqual(self._callFUT(foo), False) + + def test_w_advisor_function(self): + + def bar(): + raise NotImplementedError() + + bar.previousMetaclass = object() + self.assertEqual(self._callFUT(bar), True) + + +class Test_determineMetaclass(unittest.TestCase): + + def _callFUT(self, *args, **kw): + from zope.interface.advice import determineMetaclass + return determineMetaclass(*args, **kw) + + def test_empty_w_explicit_metatype(self): + + class Meta(type): + pass + + self.assertEqual(self._callFUT((), Meta), Meta) + + def test_single(self): + + class Meta(type): + pass + + self.assertEqual(self._callFUT((Meta,)), type) + + def test_meta_of_class(self): + + class Metameta(type): + pass + + class Meta(type, metaclass=Metameta): + pass + + self.assertEqual(self._callFUT((Meta, type)), Metameta) + + def test_multiple_in_hierarchy_py3k(self): + + class Meta_A(type): + pass + + class Meta_B(Meta_A): + pass + + class A(type, metaclass=Meta_A): + pass + + class B(type, metaclass=Meta_B): + pass + + self.assertEqual(self._callFUT((A, B)), Meta_B) + + def test_multiple_not_in_hierarchy_py3k(self): + + class Meta_A(type): + pass + + class Meta_B(type): + pass + + class A(type, metaclass=Meta_A): + pass + + class B(type, metaclass=Meta_B): + pass + + self.assertRaises(TypeError, self._callFUT, (A, B)) + + +class Test_minimalBases(unittest.TestCase): + + def _callFUT(self, klasses): + from zope.interface.advice import minimalBases + return minimalBases(klasses) + + def test_empty(self): + self.assertEqual(self._callFUT([]), []) + + def test_w_newstyle_meta(self): + self.assertEqual(self._callFUT([type]), [type]) + + def test_w_newstyle_class(self): + + class C: + pass + + self.assertEqual(self._callFUT([C]), [C]) + + def test_simple_hierarchy_skips_implied(self): + + class A: + pass + + class B(A): + pass + + class C(B): + pass + + class D: + pass + + self.assertEqual(self._callFUT([A, B, C]), [C]) + self.assertEqual(self._callFUT([A, C]), [C]) + self.assertEqual(self._callFUT([B, C]), [C]) + self.assertEqual(self._callFUT([A, B]), [B]) + self.assertEqual(self._callFUT([D, B, D]), [B, D]) + + def test_repeats_kicked_to_end_of_queue(self): + + class A: + pass + + class B: + pass + + self.assertEqual(self._callFUT([A, B, A]), [B, A]) diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope/interface/tests/test_compile_flags.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope/interface/tests/test_compile_flags.py new file mode 100644 index 0000000000000000000000000000000000000000..3455c445f8c0ff318e10402e9e9075c8a0afff45 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope/interface/tests/test_compile_flags.py @@ -0,0 +1,29 @@ +############################################################################## +# +# Copyright (c) 2022 Zope Foundation and Contributors. +# All Rights Reserved. +# +# This software is subject to the provisions of the Zope Public License, +# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. +# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED +# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS +# FOR A PARTICULAR PURPOSE +# +############################################################################## +import struct +import unittest + +import zope.interface # noqa: try to load a C module for side effects + + +class TestFloatingPoint(unittest.TestCase): + + def test_no_fast_math_optimization(self): + # Building with -Ofast enables -ffast-math, which sets certain FPU + # flags that can cause breakage elsewhere. A library such as BTrees + # has no business changing global FPU flags for the entire process. + zero_bits = struct.unpack("!Q", struct.pack("!d", 0.0))[0] + next_up = zero_bits + 1 + smallest_subnormal = struct.unpack("!d", struct.pack("!Q", next_up))[0] + self.assertNotEqual(smallest_subnormal, 0.0) diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope/interface/tests/test_declarations.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope/interface/tests/test_declarations.py new file mode 100644 index 0000000000000000000000000000000000000000..dc0c7fb394d930e6ddaa55c7e01950ca5f96fbe7 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope/interface/tests/test_declarations.py @@ -0,0 +1,2620 @@ +############################################################################## +# +# Copyright (c) 2003 Zope Foundation and Contributors. +# All Rights Reserved. +# +# This software is subject to the provisions of the Zope Public License, +# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. +# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED +# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS +# FOR A PARTICULAR PURPOSE. +# +############################################################################## +"""Test the new API for making and checking interface declarations +""" +import unittest + +from zope.interface.interface import InterfaceClass +from zope.interface.tests import MissingSomeAttrs +from zope.interface.tests import OptimizationTestMixin +from zope.interface.tests import SubclassableMixin +from zope.interface.tests.test_interface import \ + NameAndModuleComparisonTestsMixin + + +# pylint:disable=inherit-non-class,too-many-lines,protected-access +# pylint:disable=blacklisted-name,attribute-defined-outside-init + +IBar = InterfaceClass('IBar') +IFoo = InterfaceClass('IFoo') + + +class Foo: + pass + + +class FooImplementedNone: + __implemented__ = None + + +class FooNoCall: + __implemented__ = None + + def __call__(self): + raise NotImplementedError() + + +class _Py3ClassAdvice: + + def _run_generated_code( + self, code, globs, locs, fails_under_py3k=True, + ): + # pylint:disable=exec-used,no-member + import warnings + with warnings.catch_warnings(record=True) as _: + warnings.resetwarnings() + + try: + exec(code, globs, locs) + except TypeError: + return False + else: + if fails_under_py3k: + self.fail("Didn't raise TypeError") + return None + + +class NamedTests(unittest.TestCase): + + def test_class(self): + from zope.interface.declarations import named + + @named('foo') + class Foo: + pass + + self.assertEqual( + Foo.__component_name__, 'foo' + ) # pylint:disable=no-member + + def test_function(self): + from zope.interface.declarations import named + + @named('foo') + def doFoo(o): + raise NotImplementedError() + + self.assertEqual(doFoo.__component_name__, 'foo') + + def test_instance(self): + from zope.interface.declarations import named + + class Foo: + pass + foo = Foo() + named('foo')(foo) + + self.assertEqual( + foo.__component_name__, 'foo' + ) # pylint:disable=no-member + + +class EmptyDeclarationTests(unittest.TestCase): + # Tests that should pass for all objects that are empty + # declarations. This includes a Declaration explicitly created + # that way, and the empty ImmutableDeclaration. + def _getEmpty(self): + from zope.interface.declarations import Declaration + return Declaration() + + def test___iter___empty(self): + decl = self._getEmpty() + self.assertEqual(list(decl), []) + + def test_flattened_empty(self): + from zope.interface.interface import Interface + decl = self._getEmpty() + self.assertEqual(list(decl.flattened()), [Interface]) + + def test___contains___empty(self): + from zope.interface.interface import Interface + decl = self._getEmpty() + self.assertNotIn(Interface, decl) + + def test_extends_empty(self): + from zope.interface.interface import Interface + decl = self._getEmpty() + self.assertTrue(decl.extends(Interface)) + self.assertTrue(decl.extends(Interface, strict=True)) + + def test_interfaces_empty(self): + decl = self._getEmpty() + iface_list = list(decl.interfaces()) + self.assertEqual(iface_list, []) + + def test___sro___(self): + from zope.interface.interface import Interface + decl = self._getEmpty() + self.assertEqual(decl.__sro__, (decl, Interface,)) + + def test___iro___(self): + from zope.interface.interface import Interface + decl = self._getEmpty() + self.assertEqual(decl.__iro__, (Interface,)) + + def test_get(self): + decl = self._getEmpty() + self.assertIsNone(decl.get('attr')) + self.assertEqual(decl.get('abc', 'def'), 'def') + # It's a positive cache only (when it even exists) + # so this added nothing. + self.assertFalse(decl._v_attrs) + + def test_changed_w_existing__v_attrs(self): + decl = self._getEmpty() + decl._v_attrs = object() + decl.changed(decl) + self.assertFalse(decl._v_attrs) + + +class DeclarationTests(EmptyDeclarationTests): + + def _getTargetClass(self): + from zope.interface.declarations import Declaration + return Declaration + + def _makeOne(self, *args, **kw): + return self._getTargetClass()(*args, **kw) + + def test_ctor_no_bases(self): + decl = self._makeOne() + self.assertEqual(list(decl.__bases__), []) + + def test_ctor_w_interface_in_bases(self): + IFoo = InterfaceClass('IFoo') + decl = self._makeOne(IFoo) + self.assertEqual(list(decl.__bases__), [IFoo]) + + def test_ctor_w_implements_in_bases(self): + from zope.interface.declarations import Implements + impl = Implements() + decl = self._makeOne(impl) + self.assertEqual(list(decl.__bases__), [impl]) + + def test_changed_wo_existing__v_attrs(self): + decl = self._makeOne() + decl.changed(decl) # doesn't raise + self.assertIsNone(decl._v_attrs) + + def test___contains__w_self(self): + decl = self._makeOne() + self.assertNotIn(decl, decl) + + def test___contains__w_unrelated_iface(self): + IFoo = InterfaceClass('IFoo') + decl = self._makeOne() + self.assertNotIn(IFoo, decl) + + def test___contains__w_base_interface(self): + IFoo = InterfaceClass('IFoo') + decl = self._makeOne(IFoo) + self.assertIn(IFoo, decl) + + def test___iter___single_base(self): + IFoo = InterfaceClass('IFoo') + decl = self._makeOne(IFoo) + self.assertEqual(list(decl), [IFoo]) + + def test___iter___multiple_bases(self): + IFoo = InterfaceClass('IFoo') + IBar = InterfaceClass('IBar') + decl = self._makeOne(IFoo, IBar) + self.assertEqual(list(decl), [IFoo, IBar]) + + def test___iter___inheritance(self): + IFoo = InterfaceClass('IFoo') + IBar = InterfaceClass('IBar', (IFoo,)) + decl = self._makeOne(IBar) + self.assertEqual(list(decl), [IBar]) # IBar.interfaces() omits bases + + def test___iter___w_nested_sequence_overlap(self): + IFoo = InterfaceClass('IFoo') + IBar = InterfaceClass('IBar') + decl = self._makeOne(IBar, (IFoo, IBar)) + self.assertEqual(list(decl), [IBar, IFoo]) + + def test_flattened_single_base(self): + from zope.interface.interface import Interface + IFoo = InterfaceClass('IFoo') + decl = self._makeOne(IFoo) + self.assertEqual(list(decl.flattened()), [IFoo, Interface]) + + def test_flattened_multiple_bases(self): + from zope.interface.interface import Interface + IFoo = InterfaceClass('IFoo') + IBar = InterfaceClass('IBar') + decl = self._makeOne(IFoo, IBar) + self.assertEqual(list(decl.flattened()), [IFoo, IBar, Interface]) + + def test_flattened_inheritance(self): + from zope.interface.interface import Interface + IFoo = InterfaceClass('IFoo') + IBar = InterfaceClass('IBar', (IFoo,)) + decl = self._makeOne(IBar) + self.assertEqual(list(decl.flattened()), [IBar, IFoo, Interface]) + + def test_flattened_w_nested_sequence_overlap(self): + from zope.interface.interface import Interface + IFoo = InterfaceClass('IFoo') + IBar = InterfaceClass('IBar') + # This is the same as calling ``Declaration(IBar, IFoo, IBar)`` + # which doesn't make much sense, but here it is. In older + # versions of zope.interface, the __iro__ would have been + # IFoo, IBar, Interface, which especially makes no sense. + decl = self._makeOne(IBar, (IFoo, IBar)) + # Note that decl.__iro__ has IFoo first. + self.assertEqual(list(decl.flattened()), [IBar, IFoo, Interface]) + + def test___sub___unrelated_interface(self): + IFoo = InterfaceClass('IFoo') + IBar = InterfaceClass('IBar') + before = self._makeOne(IFoo) + after = before - IBar + self.assertIsInstance(after, self._getTargetClass()) + self.assertEqual(list(after), [IFoo]) + + def test___sub___related_interface(self): + IFoo = InterfaceClass('IFoo') + before = self._makeOne(IFoo) + after = before - IFoo + self.assertEqual(list(after), []) + + def test___sub___related_interface_by_inheritance(self): + IFoo = InterfaceClass('IFoo') + IBar = InterfaceClass('IBar', (IFoo,)) + before = self._makeOne(IBar) + after = before - IBar + self.assertEqual(list(after), []) + + def test___add___unrelated_interface(self): + IFoo = InterfaceClass('IFoo') + IBar = InterfaceClass('IBar') + before = self._makeOne(IFoo) + after = before + IBar + self.assertIsInstance(after, self._getTargetClass()) + self.assertEqual(list(after), [IFoo, IBar]) + + def test___add___related_interface(self): + IFoo = InterfaceClass('IFoo') + IBar = InterfaceClass('IBar') + IBaz = InterfaceClass('IBaz') + before = self._makeOne(IFoo, IBar) + other = self._makeOne(IBar, IBaz) + after = before + other + self.assertEqual(list(after), [IFoo, IBar, IBaz]) + + def test___add___overlapping_interface(self): + # The derived interfaces end up with higher priority, and + # don't produce a C3 resolution order violation. This + # example produced a C3 error, and the resulting legacy order + # used to be wrong ([IBase, IDerived] instead of + # the other way). + from zope.interface import Interface + from zope.interface import ro + from zope.interface.tests.test_ro import C3Setting + + IBase = InterfaceClass('IBase') + IDerived = InterfaceClass('IDerived', (IBase,)) + + with C3Setting(ro.C3.STRICT_IRO, True): + base = self._makeOne(IBase) + after = base + IDerived + + self.assertEqual(after.__iro__, (IDerived, IBase, Interface)) + self.assertEqual(after.__bases__, (IDerived, IBase)) + self.assertEqual(list(after), [IDerived, IBase]) + + def test___add___overlapping_interface_implementedBy(self): + # Like test___add___overlapping_interface, but pulling + # in a realistic example. This one previously produced a + # C3 error, but the resulting legacy order was (somehow) + # correct. + from zope.interface import Interface + from zope.interface import implementedBy + from zope.interface import implementer + from zope.interface import ro + from zope.interface.tests.test_ro import C3Setting + + class IBase(Interface): + pass + + class IDerived(IBase): + pass + + @implementer(IBase) + class Base: + pass + + with C3Setting(ro.C3.STRICT_IRO, True): + after = implementedBy(Base) + IDerived + + self.assertEqual(after.__sro__, (after, IDerived, IBase, Interface)) + self.assertEqual(after.__bases__, (IDerived, IBase)) + self.assertEqual(list(after), [IDerived, IBase]) + + +class TestImmutableDeclaration(EmptyDeclarationTests): + + def _getTargetClass(self): + from zope.interface.declarations import _ImmutableDeclaration + return _ImmutableDeclaration + + def _getEmpty(self): + from zope.interface.declarations import _empty + return _empty + + def test_pickle(self): + import pickle + copied = pickle.loads(pickle.dumps(self._getEmpty())) + self.assertIs(copied, self._getEmpty()) + + def test_singleton(self): + self.assertIs( + self._getTargetClass()(), + self._getEmpty() + ) + + def test__bases__(self): + self.assertEqual(self._getEmpty().__bases__, ()) + + def test_change__bases__(self): + empty = self._getEmpty() + empty.__bases__ = () + self.assertEqual(self._getEmpty().__bases__, ()) + + with self.assertRaises(TypeError): + empty.__bases__ = (1,) + + def test_dependents(self): + empty = self._getEmpty() + deps = empty.dependents + self.assertEqual({}, deps) + # Doesn't change the return. + deps[1] = 2 + self.assertEqual({}, empty.dependents) + + def test_changed(self): + # Does nothing, has no visible side-effects + self._getEmpty().changed(None) + + def test_extends_always_false(self): + self.assertFalse(self._getEmpty().extends(self)) + self.assertFalse(self._getEmpty().extends(self, strict=True)) + self.assertFalse(self._getEmpty().extends(self, strict=False)) + + def test_get_always_default(self): + self.assertIsNone(self._getEmpty().get('name')) + self.assertEqual(self._getEmpty().get('name', 42), 42) + + def test_v_attrs(self): + decl = self._getEmpty() + self.assertEqual(decl._v_attrs, {}) + + decl._v_attrs['attr'] = 42 + self.assertEqual(decl._v_attrs, {}) + self.assertIsNone(decl.get('attr')) + + attrs = decl._v_attrs = {} + attrs['attr'] = 42 + self.assertEqual(decl._v_attrs, {}) + self.assertIsNone(decl.get('attr')) + + +class TestImplements(NameAndModuleComparisonTestsMixin, + unittest.TestCase): + + def _getTargetClass(self): + from zope.interface.declarations import Implements + return Implements + + def _makeOne(self, *args, **kw): + return self._getTargetClass()(*args, **kw) + + def _makeOneToCompare(self): + from zope.interface.declarations import implementedBy + + class A: + pass + + return implementedBy(A) + + def test_ctor_no_bases(self): + impl = self._makeOne() + self.assertEqual(impl.inherit, None) + self.assertEqual(impl.declared, ()) + self.assertEqual(impl.__name__, '?') + self.assertEqual(list(impl.__bases__), []) + + def test___repr__(self): + impl = self._makeOne() + impl.__name__ = 'Testing' + self.assertEqual(repr(impl), 'classImplements(Testing)') + + def test___reduce__(self): + from zope.interface.declarations import implementedBy + impl = self._makeOne() + self.assertEqual(impl.__reduce__(), (implementedBy, (None,))) + + def test_sort(self): + from zope.interface.declarations import implementedBy + + class A: + pass + + class B: + pass + + IFoo = InterfaceClass('IFoo') + + self.assertEqual(implementedBy(A), implementedBy(A)) + self.assertEqual(hash(implementedBy(A)), hash(implementedBy(A))) + self.assertLess(implementedBy(A), None) + self.assertGreater( + None, + implementedBy(A) + ) + self.assertLess(implementedBy(A), implementedBy(B)) + self.assertGreater(implementedBy(A), IFoo) + self.assertLessEqual(implementedBy(A), implementedBy(B)) + self.assertGreaterEqual(implementedBy(A), IFoo) + self.assertNotEqual(implementedBy(A), IFoo) + + def test_proxy_equality(self): + # https://github.com/zopefoundation/zope.interface/issues/55 + from zope.interface.declarations import implementedBy + + class Proxy: + def __init__(self, wrapped): + self._wrapped = wrapped + + def __getattr__(self, name): + raise NotImplementedError() + + def __eq__(self, other): + return self._wrapped == other + + def __ne__(self, other): + return self._wrapped != other + + class A: + pass + + class B: + pass + + implementedByA = implementedBy(A) + implementedByB = implementedBy(B) + proxy = Proxy(implementedByA) + + # The order of arguments to the operators matters, + # test both + self.assertEqual( + implementedByA, + implementedByA + ) + self.assertNotEqual(implementedByA, implementedByB) + self.assertNotEqual(implementedByB, implementedByA) + + self.assertEqual(proxy, implementedByA) + self.assertEqual(implementedByA, proxy) + self.assertEqual(proxy, implementedByA) + self.assertEqual(implementedByA, proxy) + + self.assertNotEqual(proxy, implementedByB) + self.assertNotEqual(implementedByB, proxy) + + def test_changed_deletes_super_cache(self): + impl = self._makeOne() + self.assertIsNone(impl._super_cache) + self.assertNotIn('_super_cache', impl.__dict__) + + impl._super_cache = 42 + self.assertIn('_super_cache', impl.__dict__) + + impl.changed(None) + self.assertIsNone(impl._super_cache) + self.assertNotIn('_super_cache', impl.__dict__) + + def test_changed_does_not_add_super_cache(self): + impl = self._makeOne() + self.assertIsNone(impl._super_cache) + self.assertNotIn('_super_cache', impl.__dict__) + + impl.changed(None) + self.assertIsNone(impl._super_cache) + self.assertNotIn('_super_cache', impl.__dict__) + + +class Test_implementedByFallback(unittest.TestCase): + + def _getTargetClass(self): + # pylint:disable=no-name-in-module + from zope.interface.declarations import implementedByFallback + return implementedByFallback + + _getFallbackClass = _getTargetClass + + def _callFUT(self, *args, **kw): + return self._getTargetClass()(*args, **kw) + + def test_dictless_wo_existing_Implements_wo_registrations(self): + class Foo: + __slots__ = ('__implemented__',) + foo = Foo() + foo.__implemented__ = None + self.assertEqual(list(self._callFUT(foo)), []) + + def test_dictless_wo_existing_Implements_cant_assign___implemented__(self): + + class Foo: + def _get_impl(self): + raise NotImplementedError() + + def _set_impl(self, val): + raise TypeError + + __implemented__ = property(_get_impl, _set_impl) + + def __call__(self): + # act like a factory + raise NotImplementedError() + + foo = Foo() + self.assertRaises(TypeError, self._callFUT, foo) + + def test_dictless_wo_existing_Implements_w_registrations(self): + from zope.interface import declarations + + class Foo: + __slots__ = ('__implemented__',) + + foo = Foo() + foo.__implemented__ = None + reg = object() + with _MonkeyDict(declarations, + 'BuiltinImplementationSpecifications') as specs: + specs[foo] = reg + self.assertIs(self._callFUT(foo), reg) + + def test_dictless_w_existing_Implements(self): + from zope.interface.declarations import Implements + impl = Implements() + + class Foo: + __slots__ = ('__implemented__',) + + foo = Foo() + foo.__implemented__ = impl + self.assertIs(self._callFUT(foo), impl) + + def test_dictless_w_existing_not_Implements(self): + + class Foo: + __slots__ = ('__implemented__',) + + foo = Foo() + IFoo = InterfaceClass('IFoo') + foo.__implemented__ = (IFoo,) + self.assertEqual(list(self._callFUT(foo)), [IFoo]) + + def test_w_existing_attr_as_Implements(self): + from zope.interface.declarations import Implements + impl = Implements() + + class Foo: + __implemented__ = impl + + self.assertIs(self._callFUT(Foo), impl) + + def test_builtins_added_to_cache(self): + from zope.interface import declarations + from zope.interface.declarations import Implements + with _MonkeyDict(declarations, + 'BuiltinImplementationSpecifications') as specs: + self.assertEqual(list(self._callFUT(tuple)), []) + self.assertEqual(list(self._callFUT(list)), []) + self.assertEqual(list(self._callFUT(dict)), []) + for typ in (tuple, list, dict): + spec = specs[typ] + self.assertIsInstance(spec, Implements) + self.assertEqual(repr(spec), + 'classImplements(%s)' + % (typ.__name__,)) + + def test_builtins_w_existing_cache(self): + from zope.interface import declarations + t_spec, l_spec, d_spec = object(), object(), object() + with _MonkeyDict(declarations, + 'BuiltinImplementationSpecifications') as specs: + specs[tuple] = t_spec + specs[list] = l_spec + specs[dict] = d_spec + self.assertIs(self._callFUT(tuple), t_spec) + self.assertIs(self._callFUT(list), l_spec) + self.assertIs(self._callFUT(dict), d_spec) + + def test_oldstyle_class_no_assertions(self): + # TODO: Figure out P3 story + + class Foo: + pass + + self.assertEqual(list(self._callFUT(Foo)), []) + + def test_no_assertions(self): + # TODO: Figure out P3 story + + class Foo: + pass + + self.assertEqual(list(self._callFUT(Foo)), []) + + def test_w_None_no_bases_not_factory(self): + + class Foo: + __implemented__ = None + + foo = Foo() + self.assertRaises(TypeError, self._callFUT, foo) + + def test_w_None_no_bases_w_factory(self): + from zope.interface.declarations import objectSpecificationDescriptor + from zope.interface.tests.test_declarations import FooNoCall + + foo = FooNoCall() + foo.__name__ = 'foo' + spec = self._callFUT(foo) + self.assertEqual(spec.__name__, + 'zope.interface.tests.test_declarations.foo') + self.assertIs(spec.inherit, foo) + self.assertIs(foo.__implemented__, spec) + self.assertIs( + foo.__providedBy__, objectSpecificationDescriptor + ) # pylint:disable=no-member + self.assertNotIn('__provides__', foo.__dict__) + + def test_w_None_no_bases_w_class(self): + from zope.interface.declarations import ClassProvides + from zope.interface.tests.test_declarations import FooImplementedNone + + spec = self._callFUT(FooImplementedNone) + self.assertEqual( + spec.__name__, + 'zope.interface.tests.test_declarations.FooImplementedNone') + self.assertIs(spec.inherit, FooImplementedNone) + self.assertIs(FooImplementedNone.__implemented__, spec) + self.assertIsInstance( + FooImplementedNone.__providedBy__, ClassProvides + ) # pylint:disable=no-member + self.assertIsInstance( + FooImplementedNone.__provides__, ClassProvides + ) # pylint:disable=no-member + self.assertEqual( + FooImplementedNone.__provides__, FooImplementedNone.__providedBy__ + ) # pylint:disable=no-member + + def test_w_existing_Implements(self): + from zope.interface.declarations import Implements + impl = Implements() + + class Foo: + __implemented__ = impl + + self.assertIs(self._callFUT(Foo), impl) + + def test_super_when_base_implements_interface(self): + from zope.interface import Interface + from zope.interface.declarations import implementer + + class IBase(Interface): + pass + + class IDerived(IBase): + pass + + @implementer(IBase) + class Base: + pass + + @implementer(IDerived) + class Derived(Base): + pass + + self.assertEqual(list(self._callFUT(Derived)), [IDerived, IBase]) + sup = super(Derived, Derived) + self.assertEqual(list(self._callFUT(sup)), [IBase]) + + def test_super_when_base_implements_interface_diamond(self): + from zope.interface import Interface + from zope.interface.declarations import implementer + + class IBase(Interface): + pass + + class IDerived(IBase): + pass + + @implementer(IBase) + class Base: + pass + + class Child1(Base): + pass + + class Child2(Base): + pass + + @implementer(IDerived) + class Derived(Child1, Child2): + pass + + self.assertEqual(list(self._callFUT(Derived)), [IDerived, IBase]) + sup = super(Derived, Derived) + self.assertEqual(list(self._callFUT(sup)), [IBase]) + + def test_super_when_parent_implements_interface_diamond(self): + from zope.interface import Interface + from zope.interface.declarations import implementer + + class IBase(Interface): + pass + + class IDerived(IBase): + pass + + class Base: + pass + + class Child1(Base): + pass + + @implementer(IBase) + class Child2(Base): + pass + + @implementer(IDerived) + class Derived(Child1, Child2): + pass + + self.assertEqual( + Derived.__mro__, (Derived, Child1, Child2, Base, object) + ) + self.assertEqual(list(self._callFUT(Derived)), [IDerived, IBase]) + sup = super(Derived, Derived) + fut = self._callFUT(sup) + self.assertEqual(list(fut), [IBase]) + self.assertIsNone(fut._dependents) + + def test_super_when_base_doesnt_implement_interface(self): + from zope.interface import Interface + from zope.interface.declarations import implementer + + class IBase(Interface): + pass + + class IDerived(IBase): + pass + + class Base: + pass + + @implementer(IDerived) + class Derived(Base): + pass + + self.assertEqual(list(self._callFUT(Derived)), [IDerived]) + + sup = super(Derived, Derived) + self.assertEqual(list(self._callFUT(sup)), []) + + def test_super_when_base_is_object(self): + from zope.interface import Interface + from zope.interface.declarations import implementer + + class IBase(Interface): + pass + + class IDerived(IBase): + pass + + @implementer(IDerived) + class Derived: + pass + + self.assertEqual(list(self._callFUT(Derived)), [IDerived]) + + sup = super(Derived, Derived) + self.assertEqual(list(self._callFUT(sup)), []) + + def test_super_multi_level_multi_inheritance(self): + from zope.interface import Interface + from zope.interface.declarations import implementer + + class IBase(Interface): + pass + + class IM1(Interface): + pass + + class IM2(Interface): + pass + + class IDerived(IBase): + pass + + class IUnrelated(Interface): + pass + + @implementer(IBase) + class Base: + pass + + @implementer(IM1) + class M1(Base): + pass + + @implementer(IM2) + class M2(Base): + pass + + @implementer(IDerived, IUnrelated) + class Derived(M1, M2): + pass + + d = Derived + sd = super(Derived, Derived) + sm1 = super(M1, Derived) + sm2 = super(M2, Derived) + + self.assertEqual(list(self._callFUT(d)), + [IDerived, IUnrelated, IM1, IBase, IM2]) + self.assertEqual(list(self._callFUT(sd)), + [IM1, IBase, IM2]) + self.assertEqual(list(self._callFUT(sm1)), + [IM2, IBase]) + self.assertEqual(list(self._callFUT(sm2)), + [IBase]) + + +class Test_implementedBy(Test_implementedByFallback, + OptimizationTestMixin): + # Repeat tests for C optimizations + + def _getTargetClass(self): + from zope.interface.declarations import implementedBy + return implementedBy + + +class _ImplementsTestMixin: + FUT_SETS_PROVIDED_BY = True + + def _callFUT(self, cls, iface): + # Declare that *cls* implements *iface*; return *cls* + raise NotImplementedError + + def _check_implementer(self, Foo, + orig_spec=None, + spec_name=__name__ + '.Foo', + inherit="not given"): + from zope.interface.declarations import ClassProvides + IFoo = InterfaceClass('IFoo') + + returned = self._callFUT(Foo, IFoo) + + self.assertIs(returned, Foo) + spec = Foo.__implemented__ + if orig_spec is not None: + self.assertIs(spec, orig_spec) + + self.assertEqual(spec.__name__, + spec_name) + inherit = Foo if inherit == "not given" else inherit + self.assertIs(spec.inherit, inherit) + self.assertIs(Foo.__implemented__, spec) + if self.FUT_SETS_PROVIDED_BY: + self.assertIsInstance(Foo.__providedBy__, ClassProvides) + self.assertIsInstance(Foo.__provides__, ClassProvides) + self.assertEqual(Foo.__provides__, Foo.__providedBy__) + + return Foo, IFoo + + def test_class(self): + + class Foo: + pass + + self._check_implementer(Foo) + + +class Test_classImplementsOnly(_ImplementsTestMixin, unittest.TestCase): + FUT_SETS_PROVIDED_BY = False + + def _callFUT(self, cls, iface): + from zope.interface.declarations import classImplementsOnly + classImplementsOnly(cls, iface) + return cls + + def test_w_existing_Implements(self): + from zope.interface.declarations import Implements + IFoo = InterfaceClass('IFoo') + IBar = InterfaceClass('IBar') + impl = Implements(IFoo) + impl.declared = (IFoo,) + + class Foo: + __implemented__ = impl + + impl.inherit = Foo + self._callFUT(Foo, IBar) + # Same spec, now different values + self.assertIs(Foo.__implemented__, impl) + self.assertEqual(impl.inherit, None) + self.assertEqual(impl.declared, (IBar,)) + + def test_class(self): + from zope.interface.declarations import Implements + IBar = InterfaceClass('IBar') + old_spec = Implements(IBar) + + class Foo: + __implemented__ = old_spec + + self._check_implementer(Foo, old_spec, '?', inherit=None) + + def test_redundant_with_super_still_implements(self): + Base, IBase = self._check_implementer( + type('Foo', (object,), {}), + inherit=None, + ) + + class Child(Base): + pass + + self._callFUT(Child, IBase) + self.assertTrue(IBase.implementedBy(Child)) + + +class Test_classImplements(_ImplementsTestMixin, unittest.TestCase): + + def _callFUT(self, cls, iface): + from zope.interface.declarations import classImplements + result = classImplements( + cls, iface + ) # pylint:disable=assignment-from-no-return + self.assertIsNone(result) + return cls + + def __check_implementer_redundant(self, Base): + # If we @implementer exactly what was already present, we write no + # declared attributes on the parent (we still set everything, though) + Base, IBase = self._check_implementer(Base) + + class Child(Base): + pass + + returned = self._callFUT(Child, IBase) + self.assertIn('__implemented__', returned.__dict__) + self.assertNotIn('__providedBy__', returned.__dict__) + self.assertIn('__provides__', returned.__dict__) + + spec = Child.__implemented__ + self.assertEqual(spec.declared, ()) + self.assertEqual(spec.inherit, Child) + + self.assertTrue(IBase.providedBy(Child())) + + def test_redundant_implementer_empty_class_declarations(self): + + class Foo: + pass + + self.__check_implementer_redundant(Foo) + + def test_redundant_implementer_Interface(self): + from zope.interface import Interface + from zope.interface import implementedBy + from zope.interface import ro + from zope.interface.tests.test_ro import C3Setting + + class Foo: + pass + + with C3Setting(ro.C3.STRICT_IRO, False): + self._callFUT(Foo, Interface) + self.assertEqual(list(implementedBy(Foo)), [Interface]) + + class Baz(Foo): + pass + + self._callFUT(Baz, Interface) + self.assertEqual(list(implementedBy(Baz)), [Interface]) + + def _order_for_two(self, applied_first, applied_second): + return (applied_first, applied_second) + + def test_w_existing_Implements(self): + from zope.interface.declarations import Implements + IFoo = InterfaceClass('IFoo') + IBar = InterfaceClass('IBar') + impl = Implements(IFoo) + impl.declared = (IFoo,) + + class Foo: + __implemented__ = impl + + impl.inherit = Foo + self._callFUT(Foo, IBar) + # Same spec, now different values + self.assertIs(Foo.__implemented__, impl) + self.assertEqual(impl.inherit, Foo) + self.assertEqual(impl.declared, + self._order_for_two(IFoo, IBar)) + + def test_w_existing_Implements_w_bases(self): + from zope.interface.declarations import Implements + IRoot = InterfaceClass('IRoot') + ISecondRoot = InterfaceClass('ISecondRoot') + IExtendsRoot = InterfaceClass('IExtendsRoot', (IRoot,)) + + impl_root = Implements.named('Root', IRoot) + impl_root.declared = (IRoot,) + + class Root1: + __implemented__ = impl_root + + class Root2: + __implemented__ = impl_root + + impl_extends_root = Implements.named('ExtendsRoot1', IExtendsRoot) + impl_extends_root.declared = (IExtendsRoot,) + + class ExtendsRoot(Root1, Root2): + __implemented__ = impl_extends_root + + impl_extends_root.inherit = ExtendsRoot + + self._callFUT(ExtendsRoot, ISecondRoot) + # Same spec, now different values + self.assertIs(ExtendsRoot.__implemented__, impl_extends_root) + self.assertEqual(impl_extends_root.inherit, ExtendsRoot) + self.assertEqual(impl_extends_root.declared, + self._order_for_two(IExtendsRoot, ISecondRoot,)) + self.assertEqual( + impl_extends_root.__bases__, + self._order_for_two(IExtendsRoot, ISecondRoot) + (impl_root,) + ) + + +class Test_classImplementsFirst(Test_classImplements): + + def _callFUT(self, cls, iface): + from zope.interface.declarations import classImplementsFirst + result = classImplementsFirst( + cls, iface + ) # pylint:disable=assignment-from-no-return + self.assertIsNone(result) + return cls + + def _order_for_two(self, applied_first, applied_second): + return (applied_second, applied_first) + + +class Test__implements_advice(unittest.TestCase): + + def _callFUT(self, *args, **kw): + from zope.interface.declarations import _implements_advice + return _implements_advice(*args, **kw) + + def test_no_existing_implements(self): + from zope.interface.declarations import Implements + from zope.interface.declarations import classImplements + IFoo = InterfaceClass('IFoo') + + class Foo: + __implements_advice_data__ = ((IFoo,), classImplements) + + self._callFUT(Foo) + self.assertNotIn('__implements_advice_data__', Foo.__dict__) + self.assertIsInstance( + Foo.__implemented__, Implements + ) # pylint:disable=no-member + self.assertEqual( + list(Foo.__implemented__), [IFoo] + ) # pylint:disable=no-member + + +class Test_implementer(Test_classImplements): + + def _getTargetClass(self): + from zope.interface.declarations import implementer + return implementer + + def _makeOne(self, *args, **kw): + return self._getTargetClass()(*args, **kw) + + def _callFUT(self, cls, *ifaces): + decorator = self._makeOne(*ifaces) + return decorator(cls) + + def test_nonclass_cannot_assign_attr(self): + IFoo = InterfaceClass('IFoo') + decorator = self._makeOne(IFoo) + self.assertRaises(TypeError, decorator, object()) + + def test_nonclass_can_assign_attr(self): + IFoo = InterfaceClass('IFoo') + from zope.interface.tests.test_declarations import Foo + foo = Foo() + decorator = self._makeOne(IFoo) + returned = decorator(foo) + self.assertIs(returned, foo) + spec = foo.__implemented__ # pylint:disable=no-member + self.assertEqual( + spec.__name__, 'zope.interface.tests.test_declarations.?' + ) + self.assertIsNone(spec.inherit,) + self.assertIs(foo.__implemented__, spec) # pylint:disable=no-member + + def test_does_not_leak_on_unique_classes(self): + # Make sure nothing is hanging on to the class or Implements + # object after they go out of scope. There was briefly a bug + # in 5.x that caused SpecificationBase._bases (in C) to not be + # traversed or cleared. + # https://github.com/zopefoundation/zope.interface/issues/216 + import gc + + IFoo = InterfaceClass('IFoo') + + begin_count = len(gc.get_objects()) + + for _ in range(1900): + class TestClass: + pass + + self._callFUT(TestClass, IFoo) + + gc.collect() + + end_count = len(gc.get_objects()) + + # How many new objects might still be around? In all currently + # tested interpreters, there aren't any, so our counts should + # match exactly. When the bug existed, in a steady state, the loop + # would grow by two objects each iteration + fudge_factor = 0 + self.assertLessEqual(end_count, begin_count + fudge_factor) + + +class Test_implementer_only(Test_classImplementsOnly): + + def _getTargetClass(self): + from zope.interface.declarations import implementer_only + return implementer_only + + def _makeOne(self, *args, **kw): + return self._getTargetClass()(*args, **kw) + + def _callFUT(self, cls, iface): + decorator = self._makeOne(iface) + return decorator(cls) + + def test_function(self): + IFoo = InterfaceClass('IFoo') + decorator = self._makeOne(IFoo) + + def _function(): + raise NotImplementedError() + + self.assertRaises(ValueError, decorator, _function) + + def test_method(self): + IFoo = InterfaceClass('IFoo') + decorator = self._makeOne(IFoo) + + class Bar: + def _method(self): + raise NotImplementedError() + + self.assertRaises(ValueError, decorator, Bar._method) + + +class ProvidesClassTests(unittest.TestCase): + + def _getTargetClass(self): + from zope.interface.declarations import ProvidesClass + return ProvidesClass + + def _makeOne(self, *args, **kw): + return self._getTargetClass()(*args, **kw) + + def test_simple_class_one_interface(self): + IFoo = InterfaceClass("IFoo") + + class Foo: + pass + + spec = self._makeOne(Foo, IFoo) + self.assertEqual(list(spec), [IFoo]) + + def test___reduce__(self): + from zope.interface.declarations import Provides # the function + IFoo = InterfaceClass("IFoo") + + class Foo: + pass + + spec = self._makeOne(Foo, IFoo) + klass, args = spec.__reduce__() + self.assertIs(klass, Provides) + self.assertEqual(args, (Foo, IFoo)) + + def test___get___class(self): + IFoo = InterfaceClass("IFoo") + + class Foo: + pass + + spec = self._makeOne(Foo, IFoo) + Foo.__provides__ = spec + self.assertIs(Foo.__provides__, spec) + + def test___get___instance(self): + IFoo = InterfaceClass("IFoo") + + class Foo: + pass + + spec = self._makeOne(Foo, IFoo) + Foo.__provides__ = spec + + def _test(): + foo = Foo() + return foo.__provides__ + + self.assertRaises(AttributeError, _test) + + +class ProvidesClassStrictTests(ProvidesClassTests): + # Tests that require the strict C3 resolution order. + + def _getTargetClass(self): + ProvidesClass = super()._getTargetClass() + + class StrictProvides(ProvidesClass): + def _do_calculate_ro(self, base_mros): + return ProvidesClass._do_calculate_ro( + self, base_mros=base_mros, strict=True, + ) + + return StrictProvides + + def test_overlapping_interfaces_corrected(self): + # Giving Provides(cls, IFace), where IFace is already + # provided by cls, doesn't produce invalid resolution orders. + from zope.interface import Interface + from zope.interface import implementedBy + from zope.interface import implementer + + class IBase(Interface): + pass + + @implementer(IBase) + class Base: + pass + + spec = self._makeOne(Base, IBase) + self.assertEqual(spec.__sro__, ( + spec, + implementedBy(Base), + IBase, + implementedBy(object), + Interface + )) + + +class TestProvidesClassRepr(unittest.TestCase): + + def _getTargetClass(self): + from zope.interface.declarations import ProvidesClass + return ProvidesClass + + def _makeOne(self, *args, **kw): + return self._getTargetClass()(*args, **kw) + + def test__repr__(self): + IFoo = InterfaceClass("IFoo") + assert IFoo.__name__ == 'IFoo' + assert IFoo.__module__ == __name__ + assert repr(IFoo) == f'' + + IBar = InterfaceClass("IBar") + + inst = self._makeOne(type(self), IFoo, IBar) + self.assertEqual( + repr(inst), + "directlyProvides(TestProvidesClassRepr, IFoo, IBar)" + ) + + def test__repr__module_provides_typical_use(self): + # as created through a ``moduleProvides()`` statement + # in a module body + from zope.interface.tests import dummy + provides = dummy.__provides__ # pylint:disable=no-member + self.assertEqual( + repr(provides), + "directlyProvides(" + "sys.modules['zope.interface.tests.dummy'], " + "IDummyModule)" + ) + + def test__repr__module_after_pickle(self): + # It doesn't matter, these objects can't be pickled. + import pickle + + from zope.interface.tests import dummy + provides = dummy.__provides__ # pylint:disable=no-member + for proto in range(pickle.HIGHEST_PROTOCOL + 1): + with self.assertRaises(pickle.PicklingError): + pickle.dumps(provides, proto) + + def test__repr__directlyProvides_module(self): + import sys + + from zope.interface.declarations import alsoProvides + from zope.interface.declarations import directlyProvides + from zope.interface.tests import dummy + from zope.interface.tests.test_declarations import IBar + from zope.interface.tests.test_declarations import IFoo + + orig_provides = dummy.__provides__ # pylint:disable=no-member + del dummy.__provides__ # pylint:disable=no-member + self.addCleanup(setattr, dummy, '__provides__', orig_provides) + + directlyProvides(dummy, IFoo) + provides = dummy.__provides__ # pylint:disable=no-member + + self.assertEqual( + repr(provides), + "directlyProvides(sys.modules['zope.interface.tests.dummy'], IFoo)" + ) + + alsoProvides(dummy, IBar) + provides = dummy.__provides__ # pylint:disable=no-member + + self.assertEqual( + repr(provides), + "directlyProvides(" + "sys.modules['zope.interface.tests.dummy'], " + "IFoo, IBar)" + ) + + # If we make this module also provide IFoo and IBar, then the repr + # lists both names. + from zope.interface.tests import test_declarations as my_module + assert not hasattr(my_module, '__provides__') + + directlyProvides(my_module, IFoo, IBar) + self.addCleanup(delattr, my_module, '__provides__') + self.assertIs(my_module.__provides__, provides) + self.assertEqual( + repr(provides), + "directlyProvides(('zope.interface.tests.dummy', " + "'zope.interface.tests.test_declarations'), " + "IFoo, IBar)" + ) + + def test__repr__module_provides_cached_shared(self): + from zope.interface.declarations import ModuleType + IFoo = InterfaceClass("IFoo") + + inst = self._makeOne(ModuleType, IFoo) + inst._v_module_names += ('some.module',) + inst._v_module_names += ('another.module',) + self.assertEqual( + repr(inst), + "directlyProvides(('some.module', 'another.module'), IFoo)" + ) + + def test__repr__duplicate_names(self): + IFoo = InterfaceClass("IFoo", __module__='mod1') + IFoo2 = InterfaceClass("IFoo", __module__='mod2') + IBaz = InterfaceClass("IBaz") + + inst = self._makeOne(type(self), IFoo, IBaz, IFoo2) + self.assertEqual( + repr(inst), + "directlyProvides(TestProvidesClassRepr, IFoo, IBaz, mod2.IFoo)" + ) + + def test__repr__implementedBy_in_interfaces(self): + from zope.interface import Interface + from zope.interface import implementedBy + + class IFoo(Interface): + "Does nothing" + + class Bar: + "Does nothing" + + impl = implementedBy(type(self)) + + inst = self._makeOne(Bar, IFoo, impl) + self.assertEqual( + repr(inst), + 'directlyProvides(' + 'Bar, IFoo, ' + 'classImplements(TestProvidesClassRepr))' + ) + + def test__repr__empty_interfaces(self): + inst = self._makeOne(type(self)) + self.assertEqual( + repr(inst), + 'directlyProvides(TestProvidesClassRepr)', + ) + + def test__repr__non_class(self): + + def str___dont_call_me(): + self.fail("Should not call str") + + class Object: + __bases__ = () + __str__ = str___dont_call_me + + def __repr__(self): + return '' + + inst = self._makeOne(Object()) + self.assertEqual( + repr(inst), + 'directlyProvides()', + ) + + def test__repr__providedBy_from_class(self): + from zope.interface.declarations import implementer + from zope.interface.declarations import providedBy + IFoo = InterfaceClass("IFoo") + + @implementer(IFoo) + class Foo: + pass + + inst = providedBy(Foo()) + self.assertEqual( + repr(inst), + 'classImplements(Foo, IFoo)' + ) + + def test__repr__providedBy_alsoProvides(self): + from zope.interface.declarations import alsoProvides + from zope.interface.declarations import implementer + from zope.interface.declarations import providedBy + IFoo = InterfaceClass("IFoo") + IBar = InterfaceClass("IBar") + + @implementer(IFoo) + class Foo: + pass + + foo = Foo() + alsoProvides(foo, IBar) + + inst = providedBy(foo) + self.assertEqual( + repr(inst), + "directlyProvides(Foo, IBar, classImplements(Foo, IFoo))" + ) + + +class Test_Provides(unittest.TestCase): + + def _callFUT(self, *args, **kw): + from zope.interface.declarations import Provides + return Provides(*args, **kw) + + def test_no_cached_spec(self): + from zope.interface import declarations + IFoo = InterfaceClass("IFoo") + cache = {} + + class Foo: + pass + + with _Monkey(declarations, InstanceDeclarations=cache): + spec = self._callFUT(Foo, IFoo) + self.assertEqual(list(spec), [IFoo]) + self.assertIs(cache[(Foo, IFoo)], spec) + + def test_w_cached_spec(self): + from zope.interface import declarations + IFoo = InterfaceClass("IFoo") + prior = object() + + class Foo: + pass + + cache = {(Foo, IFoo): prior} + with _Monkey(declarations, InstanceDeclarations=cache): + spec = self._callFUT(Foo, IFoo) + self.assertIs(spec, prior) + + +class Test_directlyProvides(unittest.TestCase): + + def _callFUT(self, *args, **kw): + from zope.interface.declarations import directlyProvides + return directlyProvides(*args, **kw) + + def test_w_normal_object(self): + from zope.interface.declarations import ProvidesClass + IFoo = InterfaceClass("IFoo") + + class Foo: + pass + + obj = Foo() + self._callFUT(obj, IFoo) + self.assertIsInstance( + obj.__provides__, ProvidesClass + ) # pylint:disable=no-member + self.assertEqual( + list(obj.__provides__), [IFoo] + ) # pylint:disable=no-member + + def test_w_class(self): + from zope.interface.declarations import ClassProvides + IFoo = InterfaceClass("IFoo") + + class Foo: + pass + + self._callFUT(Foo, IFoo) + self.assertIsInstance( + Foo.__provides__, ClassProvides + ) # pylint:disable=no-member + self.assertEqual( + list(Foo.__provides__), [IFoo] + ) # pylint:disable=no-member + + def test_w_classless_object(self): + from zope.interface.declarations import ProvidesClass + IFoo = InterfaceClass("IFoo") + the_dict = {} + + class Foo: + def __getattribute__(self, name): + # Emulate object w/o any class + if name == '__class__': + return None + raise NotImplementedError(name) + + def __setattr__(self, name, value): + the_dict[name] = value + + obj = Foo() + self._callFUT(obj, IFoo) + self.assertIsInstance(the_dict['__provides__'], ProvidesClass) + self.assertEqual(list(the_dict['__provides__']), [IFoo]) + + +class Test_alsoProvides(unittest.TestCase): + + def _callFUT(self, *args, **kw): + from zope.interface.declarations import alsoProvides + return alsoProvides(*args, **kw) + + def test_wo_existing_provides(self): + from zope.interface.declarations import ProvidesClass + IFoo = InterfaceClass("IFoo") + + class Foo: + pass + + obj = Foo() + self._callFUT(obj, IFoo) + self.assertIsInstance( + obj.__provides__, ProvidesClass + ) # pylint:disable=no-member + self.assertEqual( + list(obj.__provides__), [IFoo] + ) # pylint:disable=no-member + + def test_w_existing_provides(self): + from zope.interface.declarations import ProvidesClass + from zope.interface.declarations import directlyProvides + IFoo = InterfaceClass("IFoo") + IBar = InterfaceClass("IBar") + + class Foo: + pass + + obj = Foo() + directlyProvides(obj, IFoo) + self._callFUT(obj, IBar) + self.assertIsInstance( + obj.__provides__, ProvidesClass + ) # pylint:disable=no-member + self.assertEqual( + list(obj.__provides__), [IFoo, IBar] + ) # pylint:disable=no-member + + +class Test_noLongerProvides(unittest.TestCase): + + def _callFUT(self, *args, **kw): + from zope.interface.declarations import noLongerProvides + return noLongerProvides(*args, **kw) + + def test_wo_existing_provides(self): + IFoo = InterfaceClass("IFoo") + + class Foo: + pass + + obj = Foo() + self._callFUT(obj, IFoo) + self.assertEqual( + list(obj.__provides__), [] + ) # pylint:disable=no-member + + def test_w_existing_provides_hit(self): + from zope.interface.declarations import directlyProvides + IFoo = InterfaceClass("IFoo") + + class Foo: + pass + + obj = Foo() + directlyProvides(obj, IFoo) + self._callFUT(obj, IFoo) + self.assertEqual( + list(obj.__provides__), [] + ) # pylint:disable=no-member + + def test_w_existing_provides_miss(self): + from zope.interface.declarations import directlyProvides + IFoo = InterfaceClass("IFoo") + IBar = InterfaceClass("IBar") + + class Foo: + pass + + obj = Foo() + directlyProvides(obj, IFoo) + self._callFUT(obj, IBar) + self.assertEqual( + list(obj.__provides__), [IFoo] + ) # pylint:disable=no-member + + def test_w_iface_implemented_by_class(self): + from zope.interface.declarations import implementer + IFoo = InterfaceClass("IFoo") + + @implementer(IFoo) + class Foo: + pass + + obj = Foo() + self.assertRaises(ValueError, self._callFUT, obj, IFoo) + + +class ClassProvidesBaseFallbackTests(unittest.TestCase): + + def _getTargetClass(self): + # pylint:disable=no-name-in-module + from zope.interface.declarations import ClassProvidesBaseFallback + return ClassProvidesBaseFallback + + def _makeOne(self, klass, implements): + # Don't instantiate directly: the C version can't have attributes + # assigned. + + class Derived(self._getTargetClass()): + def __init__(self, k, i): + self._cls = k + self._implements = i + + return Derived(klass, implements) + + def test_w_same_class_via_class(self): + IFoo = InterfaceClass("IFoo") + + class Foo: + pass + + cpbp = Foo.__provides__ = self._makeOne(Foo, IFoo) + self.assertIs(Foo.__provides__, cpbp) + + def test_w_same_class_via_instance(self): + IFoo = InterfaceClass("IFoo") + + class Foo: + pass + + foo = Foo() + Foo.__provides__ = self._makeOne(Foo, IFoo) + self.assertIs(foo.__provides__, IFoo) + + def test_w_different_class(self): + IFoo = InterfaceClass("IFoo") + + class Foo: + pass + + class Bar(Foo): + pass + + bar = Bar() + Foo.__provides__ = self._makeOne(Foo, IFoo) + self.assertRaises(AttributeError, getattr, Bar, '__provides__') + self.assertRaises(AttributeError, getattr, bar, '__provides__') + + +class ClassProvidesBaseTests( + OptimizationTestMixin, + ClassProvidesBaseFallbackTests, + SubclassableMixin, +): + # Repeat tests for C optimizations + + def _getTargetClass(self): + from zope.interface.declarations import ClassProvidesBase + return ClassProvidesBase + + def _getFallbackClass(self): + # pylint:disable=no-name-in-module + from zope.interface.declarations import ClassProvidesBaseFallback + return ClassProvidesBaseFallback + + +class ClassProvidesTests(unittest.TestCase): + + def _getTargetClass(self): + from zope.interface.declarations import ClassProvides + return ClassProvides + + def _makeOne(self, *args, **kw): + return self._getTargetClass()(*args, **kw) + + def test_w_simple_metaclass(self): + from zope.interface.declarations import implementer + IFoo = InterfaceClass("IFoo") + IBar = InterfaceClass("IBar") + + @implementer(IFoo) + class Foo: + pass + + cp = Foo.__provides__ = self._makeOne(Foo, type(Foo), IBar) + self.assertIs(Foo.__provides__, cp) + self.assertEqual(list(Foo().__provides__), [IFoo]) + + def test___reduce__(self): + from zope.interface.declarations import implementer + IFoo = InterfaceClass("IFoo") + IBar = InterfaceClass("IBar") + + @implementer(IFoo) + class Foo: + pass + + cp = Foo.__provides__ = self._makeOne(Foo, type(Foo), IBar) + self.assertEqual(cp.__reduce__(), + (type(cp), (Foo, type(Foo), IBar))) + + +class ClassProvidesStrictTests(ClassProvidesTests): + # Tests that require the strict C3 resolution order. + + def _getTargetClass(self): + ClassProvides = super()._getTargetClass() + + class StrictClassProvides(ClassProvides): + def _do_calculate_ro(self, base_mros): + return ClassProvides._do_calculate_ro( + self, base_mros=base_mros, strict=True + ) + + return StrictClassProvides + + def test_overlapping_interfaces_corrected(self): + # Giving ClassProvides(cls, metaclass, IFace), where IFace is already + # provided by metacls, doesn't produce invalid resolution orders. + from zope.interface import Interface + from zope.interface import implementedBy + from zope.interface import implementer + + class IBase(Interface): + pass + + @implementer(IBase) + class metaclass(type): + pass + + cls = metaclass( + 'cls', + (object,), + {} + ) + + spec = self._makeOne(cls, metaclass, IBase) + self.assertEqual(spec.__sro__, ( + spec, + implementedBy(metaclass), + IBase, + implementedBy(type), + implementedBy(object), + Interface + )) + + +class TestClassProvidesRepr(unittest.TestCase): + + def _getTargetClass(self): + from zope.interface.declarations import ClassProvides + return ClassProvides + + def _makeOne(self, *args, **kw): + return self._getTargetClass()(*args, **kw) + + def test__repr__empty(self): + inst = self._makeOne(type(self), type) + self.assertEqual( + repr(inst), + "directlyProvides(TestClassProvidesRepr)" + ) + + def test__repr__providing_one(self): + from zope.interface import Interface + + class IFoo(Interface): + "Does nothing" + + inst = self._makeOne(type(self), type, IFoo) + self.assertEqual( + repr(inst), + "directlyProvides(TestClassProvidesRepr, IFoo)" + ) + + def test__repr__duplicate_names(self): + IFoo = InterfaceClass("IFoo", __module__='mod1') + IFoo2 = InterfaceClass("IFoo", __module__='mod2') + IBaz = InterfaceClass("IBaz") + + inst = self._makeOne(type(self), type, IFoo, IBaz, IFoo2) + self.assertEqual( + repr(inst), + "directlyProvides(TestClassProvidesRepr, IFoo, IBaz, mod2.IFoo)" + ) + + def test__repr__implementedBy(self): + from zope.interface.declarations import implementedBy + from zope.interface.declarations import implementer + IFoo = InterfaceClass("IFoo") + + @implementer(IFoo) + class Foo: + pass + + inst = implementedBy(Foo) + self.assertEqual( + repr(inst), + 'classImplements(Foo, IFoo)' + ) + + def test__repr__implementedBy_generic_callable(self): + from zope.interface.declarations import implementedBy + + # We can't get a __name__ by default, so we get a + # module name and a question mark + class Callable: + def __call__(self): + return self + + inst = implementedBy(Callable()) + self.assertEqual( + repr(inst), + f'classImplements({__name__}.?)' + ) + + c = Callable() + c.__name__ = 'Callable' + inst = implementedBy(c) + self.assertEqual( + repr(inst), + 'classImplements(Callable)' + ) + + +class Test_directlyProvidedBy(unittest.TestCase): + + def _callFUT(self, *args, **kw): + from zope.interface.declarations import directlyProvidedBy + return directlyProvidedBy(*args, **kw) + + def test_wo_declarations_in_class_or_instance(self): + + class Foo: + pass + + foo = Foo() + self.assertEqual(list(self._callFUT(foo)), []) + + def test_w_declarations_in_class_but_not_instance(self): + from zope.interface.declarations import implementer + IFoo = InterfaceClass("IFoo") + + @implementer(IFoo) + class Foo: + pass + + foo = Foo() + self.assertEqual(list(self._callFUT(foo)), []) + + def test_w_declarations_in_instance_but_not_class(self): + from zope.interface.declarations import directlyProvides + IFoo = InterfaceClass("IFoo") + + class Foo: + pass + + foo = Foo() + directlyProvides(foo, IFoo) + self.assertEqual(list(self._callFUT(foo)), [IFoo]) + + def test_w_declarations_in_instance_and_class(self): + from zope.interface.declarations import directlyProvides + from zope.interface.declarations import implementer + IFoo = InterfaceClass("IFoo") + IBar = InterfaceClass("IBar") + + @implementer(IFoo) + class Foo: + pass + + foo = Foo() + directlyProvides(foo, IBar) + self.assertEqual(list(self._callFUT(foo)), [IBar]) + + +class Test_provider(unittest.TestCase): + + def _getTargetClass(self): + from zope.interface.declarations import provider + return provider + + def _makeOne(self, *args, **kw): + return self._getTargetClass()(*args, **kw) + + def test_w_class(self): + from zope.interface.declarations import ClassProvides + IFoo = InterfaceClass("IFoo") + + @self._makeOne(IFoo) + class Foo: + pass + + self.assertIsInstance( + Foo.__provides__, ClassProvides + ) # pylint:disable=no-member + self.assertEqual( + list(Foo.__provides__), [IFoo] + ) # pylint:disable=no-member + + +class Test_moduleProvides(unittest.TestCase): + # pylint:disable=exec-used + + def test_called_from_function(self): + from zope.interface.declarations import moduleProvides + IFoo = InterfaceClass("IFoo") + globs = {'__name__': 'zope.interface.tests.foo', + 'moduleProvides': moduleProvides, 'IFoo': IFoo} + locs = {} + CODE = "\n".join([ + 'def foo():', + ' moduleProvides(IFoo)' + ]) + exec(CODE, globs, locs) + foo = locs['foo'] + self.assertRaises(TypeError, foo) + + def test_called_from_class(self): + from zope.interface.declarations import moduleProvides + IFoo = InterfaceClass("IFoo") + globs = {'__name__': 'zope.interface.tests.foo', + 'moduleProvides': moduleProvides, 'IFoo': IFoo} + locs = {} + CODE = "\n".join([ + 'class Foo(object):', + ' moduleProvides(IFoo)', + ]) + with self.assertRaises(TypeError): + exec(CODE, globs, locs) + + def test_called_once_from_module_scope(self): + from zope.interface.declarations import moduleProvides + IFoo = InterfaceClass("IFoo") + globs = {'__name__': 'zope.interface.tests.foo', + 'moduleProvides': moduleProvides, 'IFoo': IFoo} + CODE = "\n".join([ + 'moduleProvides(IFoo)', + ]) + exec(CODE, globs) + spec = globs['__provides__'] + self.assertEqual(list(spec), [IFoo]) + + def test_called_twice_from_module_scope(self): + from zope.interface.declarations import moduleProvides + IFoo = InterfaceClass("IFoo") + globs = {'__name__': 'zope.interface.tests.foo', + 'moduleProvides': moduleProvides, 'IFoo': IFoo} + + CODE = "\n".join([ + 'moduleProvides(IFoo)', + 'moduleProvides(IFoo)', + ]) + with self.assertRaises(TypeError): + exec(CODE, globs) + + +class Test_getObjectSpecificationFallback(unittest.TestCase): + + def _getFallbackClass(self): + # pylint:disable=no-name-in-module + from zope.interface.declarations import getObjectSpecificationFallback + return getObjectSpecificationFallback + + _getTargetClass = _getFallbackClass + + def _callFUT(self, *args, **kw): + return self._getTargetClass()(*args, **kw) + + def test_wo_existing_provides_classless(self): + the_dict = {} + + class Foo: + def __getattribute__(self, name): + # Emulate object w/o any class + if name == '__class__': + raise AttributeError(name) + try: + return the_dict[name] + except KeyError: + raise AttributeError(name) + + def __setattr__(self, name, value): + raise NotImplementedError() + + foo = Foo() + spec = self._callFUT(foo) + self.assertEqual(list(spec), []) + + def test_existing_provides_is_spec(self): + from zope.interface.declarations import directlyProvides + IFoo = InterfaceClass("IFoo") + + def foo(): + raise NotImplementedError() + + directlyProvides(foo, IFoo) + spec = self._callFUT(foo) + self.assertIs(spec, foo.__provides__) # pylint:disable=no-member + + def test_existing_provides_is_not_spec(self): + + def foo(): + raise NotImplementedError() + + foo.__provides__ = object() # not a valid spec + spec = self._callFUT(foo) + self.assertEqual(list(spec), []) + + def test_existing_provides(self): + from zope.interface.declarations import directlyProvides + IFoo = InterfaceClass("IFoo") + + class Foo: + pass + + foo = Foo() + directlyProvides(foo, IFoo) + spec = self._callFUT(foo) + self.assertEqual(list(spec), [IFoo]) + + def test_wo_provides_on_class_w_implements(self): + from zope.interface.declarations import implementer + IFoo = InterfaceClass("IFoo") + + @implementer(IFoo) + class Foo: + pass + + foo = Foo() + spec = self._callFUT(foo) + self.assertEqual(list(spec), [IFoo]) + + def test_wo_provides_on_class_wo_implements(self): + + class Foo: + pass + + foo = Foo() + spec = self._callFUT(foo) + self.assertEqual(list(spec), []) + + def test_catches_only_AttributeError_on_provides(self): + MissingSomeAttrs.test_raises( + self, self._callFUT, expected_missing='__provides__' + ) + + def test_catches_only_AttributeError_on_class(self): + MissingSomeAttrs.test_raises( + self, + self._callFUT, + expected_missing='__class__', + __provides__=None, + ) + + def test_raises_AttrError_w_provides_fails_type_check_AttrError(self): + # isinstance(ob.__provides__, SpecificationBase) is not + # protected inside any kind of block. + + class Foo: + __provides__ = MissingSomeAttrs(AttributeError) + + # isinstance() ignores AttributeError on __class__ + self._callFUT(Foo()) + + def test_raises_AttrError_w_provides_fails_type_check_RuntimeError(self): + # isinstance(ob.__provides__, SpecificationBase) is not + # protected inside any kind of block. + class Foo: + __provides__ = MissingSomeAttrs(RuntimeError) + + with self.assertRaises(RuntimeError) as exc: + self._callFUT(Foo()) + + self.assertEqual('__class__', exc.exception.args[0]) + + +class Test_getObjectSpecification(Test_getObjectSpecificationFallback, + OptimizationTestMixin): + # Repeat tests for C optimizations + + def _getTargetClass(self): + from zope.interface.declarations import getObjectSpecification + return getObjectSpecification + + +class Test_providedByFallback(unittest.TestCase): + + def _getFallbackClass(self): + # pylint:disable=no-name-in-module + from zope.interface.declarations import providedByFallback + return providedByFallback + + _getTargetClass = _getFallbackClass + + def _callFUT(self, *args, **kw): + return self._getTargetClass()(*args, **kw) + + def test_wo_providedBy_on_class_wo_implements(self): + + class Foo: + pass + + foo = Foo() + spec = self._callFUT(foo) + self.assertEqual(list(spec), []) + + def test_w_providedBy_valid_spec(self): + from zope.interface.declarations import Provides + IFoo = InterfaceClass("IFoo") + + class Foo: + pass + + foo = Foo() + foo.__providedBy__ = Provides(Foo, IFoo) + spec = self._callFUT(foo) + self.assertEqual(list(spec), [IFoo]) + + def test_w_providedBy_invalid_spec(self): + + class Foo: + pass + + foo = Foo() + foo.__providedBy__ = object() + spec = self._callFUT(foo) + self.assertEqual(list(spec), []) + + def test_w_providedBy_invalid_spec_class_w_implements(self): + from zope.interface.declarations import implementer + IFoo = InterfaceClass("IFoo") + + @implementer(IFoo) + class Foo: + pass + + foo = Foo() + foo.__providedBy__ = object() + spec = self._callFUT(foo) + self.assertEqual(list(spec), [IFoo]) + + def test_w_providedBy_invalid_spec_w_provides_no_provides_on_class(self): + + class Foo: + pass + + foo = Foo() + foo.__providedBy__ = object() + expected = foo.__provides__ = object() + spec = self._callFUT(foo) + self.assertIs(spec, expected) + + def test_w_providedBy_invalid_spec_w_provides_diff_provides_on_class(self): + + class Foo: + pass + + foo = Foo() + foo.__providedBy__ = object() + expected = foo.__provides__ = object() + Foo.__provides__ = object() + spec = self._callFUT(foo) + self.assertIs(spec, expected) + + def test_w_providedBy_invalid_spec_w_provides_same_provides_on_class(self): + from zope.interface.declarations import implementer + IFoo = InterfaceClass("IFoo") + + @implementer(IFoo) + class Foo: + pass + + foo = Foo() + foo.__providedBy__ = object() + foo.__provides__ = Foo.__provides__ = object() + spec = self._callFUT(foo) + self.assertEqual(list(spec), [IFoo]) + + def test_super_when_base_implements_interface(self): + from zope.interface import Interface + from zope.interface.declarations import implementer + + class IBase(Interface): + pass + + class IDerived(IBase): + pass + + @implementer(IBase) + class Base: + pass + + @implementer(IDerived) + class Derived(Base): + pass + + derived = Derived() + self.assertEqual(list(self._callFUT(derived)), [IDerived, IBase]) + + sup = super(Derived, derived) + fut = self._callFUT(sup) + self.assertIsNone(fut._dependents) + self.assertEqual(list(fut), [IBase]) + + def test_super_when_base_doesnt_implement_interface(self): + from zope.interface import Interface + from zope.interface.declarations import implementer + + class IBase(Interface): + pass + + class IDerived(IBase): + pass + + class Base: + pass + + @implementer(IDerived) + class Derived(Base): + pass + + derived = Derived() + self.assertEqual(list(self._callFUT(derived)), [IDerived]) + + sup = super(Derived, derived) + self.assertEqual(list(self._callFUT(sup)), []) + + def test_super_when_base_is_object(self): + from zope.interface import Interface + from zope.interface.declarations import implementer + + class IBase(Interface): + pass + + class IDerived(IBase): + pass + + @implementer(IDerived) + class Derived: + pass + + derived = Derived() + self.assertEqual(list(self._callFUT(derived)), [IDerived]) + + sup = super(Derived, derived) + fut = self._callFUT(sup) + self.assertIsNone(fut._dependents) + self.assertEqual(list(fut), []) + + def test_super_when_object_directly_provides(self): + from zope.interface import Interface + from zope.interface.declarations import directlyProvides + from zope.interface.declarations import implementer + + class IBase(Interface): + pass + + class IDerived(IBase): + pass + + @implementer(IBase) + class Base: + pass + + class Derived(Base): + pass + + derived = Derived() + self.assertEqual(list(self._callFUT(derived)), [IBase]) + + directlyProvides(derived, IDerived) + self.assertEqual(list(self._callFUT(derived)), [IDerived, IBase]) + + sup = super(Derived, derived) + fut = self._callFUT(sup) + self.assertIsNone(fut._dependents) + self.assertEqual(list(fut), [IBase]) + + def test_super_multi_level_multi_inheritance(self): + from zope.interface import Interface + from zope.interface.declarations import implementer + + class IBase(Interface): + pass + + class IM1(Interface): + pass + + class IM2(Interface): + pass + + class IDerived(IBase): + pass + + class IUnrelated(Interface): + pass + + @implementer(IBase) + class Base: + pass + + @implementer(IM1) + class M1(Base): + pass + + @implementer(IM2) + class M2(Base): + pass + + @implementer(IDerived, IUnrelated) + class Derived(M1, M2): + pass + + d = Derived() + sd = super(Derived, d) + sm1 = super(M1, d) + sm2 = super(M2, d) + + self.assertEqual(list(self._callFUT(d)), + [IDerived, IUnrelated, IM1, IBase, IM2]) + self.assertEqual(list(self._callFUT(sd)), + [IM1, IBase, IM2]) + self.assertEqual(list(self._callFUT(sm1)), + [IM2, IBase]) + self.assertEqual(list(self._callFUT(sm2)), + [IBase]) + + def test_catches_only_AttributeError_on_providedBy(self): + MissingSomeAttrs.test_raises(self, self._callFUT, + expected_missing='__providedBy__', + __class__=object) + + def test_catches_only_AttributeError_on_class(self): + # isinstance() tries to get the __class__, which is non-obvious, + # so it must be protected too. + MissingSomeAttrs.test_raises( + self, self._callFUT, expected_missing='__class__') + + +class Test_providedBy(Test_providedByFallback, + OptimizationTestMixin): + # Repeat tests for C optimizations + + def _getTargetClass(self): + from zope.interface.declarations import providedBy + return providedBy + + +class ObjectSpecificationDescriptorFallbackTests(unittest.TestCase): + + def _getFallbackClass(self): + # pylint:disable=no-name-in-module + from zope.interface.declarations import \ + ObjectSpecificationDescriptorFallback + return ObjectSpecificationDescriptorFallback + + _getTargetClass = _getFallbackClass + + def _makeOne(self, *args, **kw): + return self._getTargetClass()(*args, **kw) + + def test_accessed_via_class(self): + from zope.interface.declarations import Provides + IFoo = InterfaceClass("IFoo") + + class Foo: + pass + + Foo.__provides__ = Provides(Foo, IFoo) + Foo.__providedBy__ = self._makeOne() + self.assertEqual(list(Foo.__providedBy__), [IFoo]) + + def test_accessed_via_inst_wo_provides(self): + from zope.interface.declarations import Provides + from zope.interface.declarations import implementer + IFoo = InterfaceClass("IFoo") + IBar = InterfaceClass("IBar") + + @implementer(IFoo) + class Foo: + pass + + Foo.__provides__ = Provides(Foo, IBar) + Foo.__providedBy__ = self._makeOne() + foo = Foo() + self.assertEqual(list(foo.__providedBy__), [IFoo]) + + def test_accessed_via_inst_w_provides(self): + from zope.interface.declarations import Provides + from zope.interface.declarations import directlyProvides + from zope.interface.declarations import implementer + IFoo = InterfaceClass("IFoo") + IBar = InterfaceClass("IBar") + IBaz = InterfaceClass("IBaz") + + @implementer(IFoo) + class Foo: + pass + + Foo.__provides__ = Provides(Foo, IBar) + Foo.__providedBy__ = self._makeOne() + foo = Foo() + directlyProvides(foo, IBaz) + self.assertEqual(list(foo.__providedBy__), [IBaz, IFoo]) + + def test_arbitrary_exception_accessing_provides_not_caught(self): + + class MyException(Exception): + pass + + class Foo: + __providedBy__ = self._makeOne() + + @property + def __provides__(self): + raise MyException + + foo = Foo() + with self.assertRaises(MyException): + getattr(foo, '__providedBy__') + + def test_AttributeError_accessing_provides_caught(self): + + class MyException(Exception): + pass + + class Foo: + __providedBy__ = self._makeOne() + + @property + def __provides__(self): + raise AttributeError + + foo = Foo() + provided = getattr(foo, '__providedBy__') + self.assertIsNotNone(provided) + + def test_None_in__provides__overrides(self): + from zope.interface import Interface + from zope.interface import implementer + + class IFoo(Interface): + pass + + @implementer(IFoo) + class Foo: + + @property + def __provides__(self): + return None + + Foo.__providedBy__ = self._makeOne() + + provided = getattr(Foo(), '__providedBy__') + self.assertIsNone(provided) + + +class ObjectSpecificationDescriptorTests( + ObjectSpecificationDescriptorFallbackTests, + OptimizationTestMixin, + SubclassableMixin, +): + # Repeat tests for C optimizations + + def _getTargetClass(self): + from zope.interface.declarations import ObjectSpecificationDescriptor + return ObjectSpecificationDescriptor + + +# Test _normalizeargs through its callers. + + +class _Monkey: + # context-manager for replacing module names in the scope of a test. + def __init__(self, module, **kw): + self.module = module + self.to_restore = {key: getattr(module, key) for key in kw} + for key, value in kw.items(): + setattr(module, key, value) + + def __enter__(self): + return self + + def __exit__(self, exc_type, exc_val, exc_tb): + for key, value in self.to_restore.items(): + setattr(self.module, key, value) + + +class _MonkeyDict: + # context-manager for restoring a dict w/in a module in the scope of a + # test. + def __init__(self, module, attrname, **kw): + self.module = module + self.target = getattr(module, attrname) + self.to_restore = self.target.copy() + self.target.clear() + self.target.update(kw) + + def __enter__(self): + return self.target + + def __exit__(self, exc_type, exc_val, exc_tb): + self.target.clear() + self.target.update(self.to_restore) diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope/interface/tests/test_document.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope/interface/tests/test_document.py new file mode 100644 index 0000000000000000000000000000000000000000..82b175a878d3a3e5ab6aac92c8774831a27f4c1a --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope/interface/tests/test_document.py @@ -0,0 +1,547 @@ +############################################################################## +# +# Copyright (c) 2001, 2002 Zope Foundation and Contributors. +# All Rights Reserved. +# +# This software is subject to the provisions of the Zope Public License, +# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. +# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED +# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS +# FOR A PARTICULAR PURPOSE. +# +############################################################################## +"""Documentation tests. +""" +import sys +import unittest + + +class Test_asStructuredText(unittest.TestCase): + + def _callFUT(self, iface): + from zope.interface.document import asStructuredText + return asStructuredText(iface) + + def test_asStructuredText_no_docstring(self): + from zope.interface import Interface + EXPECTED = '\n\n'.join([ + "INoDocstring", + " Attributes:", + " Methods:", + "" + ]) + + class INoDocstring(Interface): + pass + + self.assertEqual(self._callFUT(INoDocstring), EXPECTED) + + def test_asStructuredText_empty_with_docstring(self): + from zope.interface import Interface + EXPECTED = '\n\n'.join([ + "IEmpty", + " This is an empty interface.", + " Attributes:", + " Methods:", + "" + ]) + + class IEmpty(Interface): + """ This is an empty interface. + """ + + self.assertEqual(self._callFUT(IEmpty), EXPECTED) + + def test_asStructuredText_empty_with_multiline_docstring(self): + from zope.interface import Interface + + # In Python 3.13+, compiler strips indents from docstrings + indent = " " * 12 if sys.version_info < (3, 13) else "" + + EXPECTED = '\n'.join([ + "IEmpty", + "", + " This is an empty interface.", + " ", + (f"{indent} It can be used to annotate any class or object, " + "because it promises"), # noqa E127 + f"{indent} nothing.", + "", + " Attributes:", + "", + " Methods:", + "", + "" + ]) + + class IEmpty(Interface): + """ This is an empty interface. + + It can be used to annotate any class or object, because it promises + nothing. + """ + + self.assertEqual(self._callFUT(IEmpty), EXPECTED) + + def test_asStructuredText_with_attribute_no_docstring(self): + from zope.interface import Attribute + from zope.interface import Interface + EXPECTED = '\n\n'.join([ + "IHasAttribute", + " This interface has an attribute.", + " Attributes:", + " an_attribute -- no documentation", + " Methods:", + "" + ]) + + class IHasAttribute(Interface): + """ This interface has an attribute. + """ + an_attribute = Attribute('an_attribute') + + self.assertEqual(self._callFUT(IHasAttribute), EXPECTED) + + def test_asStructuredText_with_attribute_with_docstring(self): + from zope.interface import Attribute + from zope.interface import Interface + EXPECTED = '\n\n'.join([ + "IHasAttribute", + " This interface has an attribute.", + " Attributes:", + " an_attribute -- This attribute is documented.", + " Methods:", + "" + ]) + + class IHasAttribute(Interface): + """ This interface has an attribute. + """ + an_attribute = Attribute('an_attribute', + 'This attribute is documented.') + + self.assertEqual(self._callFUT(IHasAttribute), EXPECTED) + + def test_asStructuredText_with_method_no_args_no_docstring(self): + from zope.interface import Interface + EXPECTED = '\n\n'.join([ + "IHasMethod", + " This interface has a method.", + " Attributes:", + " Methods:", + " aMethod() -- no documentation", + "" + ]) + + class IHasMethod(Interface): + """ This interface has a method. + """ + def aMethod(): + pass # pragma: no cover + + self.assertEqual(self._callFUT(IHasMethod), EXPECTED) + + def test_asStructuredText_with_method_positional_args_no_docstring(self): + from zope.interface import Interface + EXPECTED = '\n\n'.join([ + "IHasMethod", + " This interface has a method.", + " Attributes:", + " Methods:", + " aMethod(first, second) -- no documentation", + "" + ]) + + class IHasMethod(Interface): + """ This interface has a method. + """ + def aMethod(first, second): + pass # pragma: no cover + + self.assertEqual(self._callFUT(IHasMethod), EXPECTED) + + def test_asStructuredText_with_method_starargs_no_docstring(self): + from zope.interface import Interface + EXPECTED = '\n\n'.join([ + "IHasMethod", + " This interface has a method.", + " Attributes:", + " Methods:", + " aMethod(first, second, *rest) -- no documentation", + "" + ]) + + class IHasMethod(Interface): + """ This interface has a method. + """ + def aMethod(first, second, *rest): + pass # pragma: no cover + + self.assertEqual(self._callFUT(IHasMethod), EXPECTED) + + def test_asStructuredText_with_method_kwargs_no_docstring(self): + from zope.interface import Interface + EXPECTED = '\n\n'.join([ + "IHasMethod", + " This interface has a method.", + " Attributes:", + " Methods:", + " aMethod(first, second, **kw) -- no documentation", + "" + ]) + + class IHasMethod(Interface): + """ This interface has a method. + """ + def aMethod(first, second, **kw): + pass # pragma: no cover + + self.assertEqual(self._callFUT(IHasMethod), EXPECTED) + + def test_asStructuredText_with_method_with_docstring(self): + from zope.interface import Interface + EXPECTED = '\n\n'.join([ + "IHasMethod", + " This interface has a method.", + " Attributes:", + " Methods:", + " aMethod() -- This method is documented.", + "" + ]) + + class IHasMethod(Interface): + """ This interface has a method. + """ + def aMethod(): + """This method is documented. + """ + + self.assertEqual(self._callFUT(IHasMethod), EXPECTED) + + def test_asStructuredText_derived_ignores_base(self): + from zope.interface import Attribute + from zope.interface import Interface + EXPECTED = '\n\n'.join([ + "IDerived", + " IDerived doc", + " This interface extends:", + " o IBase", + " Attributes:", + " attr1 -- no documentation", + " attr2 -- attr2 doc", + " Methods:", + " method3() -- method3 doc", + " method4() -- no documentation", + " method5() -- method5 doc", + "", + ]) + + class IBase(Interface): + def method1(): + """docstring""" + + def method2(): + """docstring""" + + class IDerived(IBase): + "IDerived doc" + attr1 = Attribute('attr1') + attr2 = Attribute('attr2', 'attr2 doc') + + def method3(): + "method3 doc" + + def method4(): + pass # pragma: no cover + + def method5(): + "method5 doc" + + self.assertEqual(self._callFUT(IDerived), EXPECTED) + + +class Test_asReStructuredText(unittest.TestCase): + + def _callFUT(self, iface): + from zope.interface.document import asReStructuredText + return asReStructuredText(iface) + + def test_asReStructuredText_no_docstring(self): + from zope.interface import Interface + EXPECTED = '\n\n'.join([ + "``INoDocstring``", + " Attributes:", + " Methods:", + "" + ]) + + class INoDocstring(Interface): + pass + + self.assertEqual(self._callFUT(INoDocstring), EXPECTED) + + def test_asReStructuredText_empty_with_docstring(self): + from zope.interface import Interface + EXPECTED = '\n\n'.join([ + "``IEmpty``", + " This is an empty interface.", + " Attributes:", + " Methods:", + "" + ]) + + class IEmpty(Interface): + """ This is an empty interface. + """ + + self.assertEqual(self._callFUT(IEmpty), EXPECTED) + + def test_asReStructuredText_empty_with_multiline_docstring(self): + from zope.interface import Interface + + # In Python 3.13+, compiler strips indents from docstrings + indent = " " * 12 if sys.version_info < (3, 13) else "" + + EXPECTED = '\n'.join([ + "``IEmpty``", + "", + " This is an empty interface.", + " ", + (f"{indent} It can be used to annotate any class or object, " + f"because it" + ), # noqa E124 + f"{indent} promises nothing.", + "", + " Attributes:", + "", + " Methods:", + "", + "" + ]) + + class IEmpty(Interface): + """ This is an empty interface. + + It can be used to annotate any class or object, because it + promises nothing. + """ + + self.assertEqual(self._callFUT(IEmpty), EXPECTED) + + def test_asReStructuredText_with_attribute_no_docstring(self): + from zope.interface import Attribute + from zope.interface import Interface + EXPECTED = '\n\n'.join([ + "``IHasAttribute``", + " This interface has an attribute.", + " Attributes:", + " ``an_attribute`` -- no documentation", + " Methods:", + "" + ]) + + class IHasAttribute(Interface): + """ This interface has an attribute. + """ + an_attribute = Attribute('an_attribute') + + self.assertEqual(self._callFUT(IHasAttribute), EXPECTED) + + def test_asReStructuredText_with_attribute_with_docstring(self): + from zope.interface import Attribute + from zope.interface import Interface + EXPECTED = '\n\n'.join([ + "``IHasAttribute``", + " This interface has an attribute.", + " Attributes:", + " ``an_attribute`` -- This attribute is documented.", + " Methods:", + "" + ]) + + class IHasAttribute(Interface): + """ This interface has an attribute. + """ + an_attribute = Attribute('an_attribute', + 'This attribute is documented.') + + self.assertEqual(self._callFUT(IHasAttribute), EXPECTED) + + def test_asReStructuredText_with_method_no_args_no_docstring(self): + from zope.interface import Interface + EXPECTED = '\n\n'.join([ + "``IHasMethod``", + " This interface has a method.", + " Attributes:", + " Methods:", + " ``aMethod()`` -- no documentation", + "" + ]) + + class IHasMethod(Interface): + """ This interface has a method. + """ + def aMethod(): + pass # pragma: no cover + + self.assertEqual(self._callFUT(IHasMethod), EXPECTED) + + def test_asReStructuredText_with_method_positional_args_no_docstring(self): + from zope.interface import Interface + EXPECTED = '\n\n'.join([ + "``IHasMethod``", + " This interface has a method.", + " Attributes:", + " Methods:", + " ``aMethod(first, second)`` -- no documentation", + "" + ]) + + class IHasMethod(Interface): + """ This interface has a method. + """ + def aMethod(first, second): + pass # pragma: no cover + + self.assertEqual(self._callFUT(IHasMethod), EXPECTED) + + def test_asReStructuredText_with_method_starargs_no_docstring(self): + from zope.interface import Interface + EXPECTED = '\n\n'.join([ + "``IHasMethod``", + " This interface has a method.", + " Attributes:", + " Methods:", + " ``aMethod(first, second, *rest)`` -- no documentation", + "" + ]) + + class IHasMethod(Interface): + """ This interface has a method. + """ + def aMethod(first, second, *rest): + pass # pragma: no cover + + self.assertEqual(self._callFUT(IHasMethod), EXPECTED) + + def test_asReStructuredText_with_method_kwargs_no_docstring(self): + from zope.interface import Interface + EXPECTED = '\n\n'.join([ + "``IHasMethod``", + " This interface has a method.", + " Attributes:", + " Methods:", + " ``aMethod(first, second, **kw)`` -- no documentation", + "" + ]) + + class IHasMethod(Interface): + """ This interface has a method. + """ + def aMethod(first, second, **kw): + pass # pragma: no cover + + self.assertEqual(self._callFUT(IHasMethod), EXPECTED) + + def test_asReStructuredText_with_method_with_docstring(self): + from zope.interface import Interface + EXPECTED = '\n\n'.join([ + "``IHasMethod``", + " This interface has a method.", + " Attributes:", + " Methods:", + " ``aMethod()`` -- This method is documented.", + "" + ]) + + class IHasMethod(Interface): + """ This interface has a method. + """ + def aMethod(): + """This method is documented. + """ + + self.assertEqual(self._callFUT(IHasMethod), EXPECTED) + + def test_asReStructuredText_derived_ignores_base(self): + from zope.interface import Attribute + from zope.interface import Interface + EXPECTED = '\n\n'.join([ + "``IDerived``", + " IDerived doc", + " This interface extends:", + " o ``IBase``", + " Attributes:", + " ``attr1`` -- no documentation", + " ``attr2`` -- attr2 doc", + " Methods:", + " ``method3()`` -- method3 doc", + " ``method4()`` -- no documentation", + " ``method5()`` -- method5 doc", + "", + ]) + + class IBase(Interface): + def method1(): + pass # pragma: no cover + + def method2(): + pass # pragma: no cover + + class IDerived(IBase): + "IDerived doc" + attr1 = Attribute('attr1') + attr2 = Attribute('attr2', 'attr2 doc') + + def method3(): + "method3 doc" + + def method4(): + pass # pragma: no cover + + def method5(): + "method5 doc" + + self.assertEqual(self._callFUT(IDerived), EXPECTED) + + +class Test__justify_and_indent(unittest.TestCase): + + def _callFUT(self, text, level, **kw): + from zope.interface.document import _justify_and_indent + return _justify_and_indent(text, level, **kw) + + def test_simple_level_0(self): + LINES = ['Three blind mice', 'See how they run'] + text = '\n'.join(LINES) + self.assertEqual(self._callFUT(text, 0), text) + + def test_simple_level_1(self): + LINES = ['Three blind mice', 'See how they run'] + text = '\n'.join(LINES) + self.assertEqual(self._callFUT(text, 1), + '\n'.join([' ' + line for line in LINES])) + + def test_simple_level_2(self): + LINES = ['Three blind mice', 'See how they run'] + text = '\n'.join(LINES) + self.assertEqual(self._callFUT(text, 1), + '\n'.join([' ' + line for line in LINES])) + + def test_simple_w_CRLF(self): + LINES = ['Three blind mice', 'See how they run'] + text = '\r\n'.join(LINES) + self.assertEqual(self._callFUT(text, 1), + '\n'.join([' ' + line for line in LINES])) + + def test_with_munge(self): + TEXT = ("This is a piece of text longer than 15 characters, \n" + "and split across multiple lines.") + EXPECTED = (" This is a piece\n" + " of text longer\n" + " than 15 characters,\n" + " and split across\n" + " multiple lines.\n" + " ") + self.assertEqual(self._callFUT(TEXT, 1, munge=1, width=15), EXPECTED) diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope/interface/tests/test_element.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope/interface/tests/test_element.py new file mode 100644 index 0000000000000000000000000000000000000000..b47b3b5abac6a22df0f55eeda72aa1d0f87633c4 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope/interface/tests/test_element.py @@ -0,0 +1,33 @@ +############################################################################## +# +# Copyright (c) 2003 Zope Foundation and Contributors. +# All Rights Reserved. +# +# This software is subject to the provisions of the Zope Public License, +# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. +# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED +# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS +# FOR A PARTICULAR PURPOSE. +# +############################################################################## +"""Test Element meta-class. +""" + +import unittest + +from zope.interface.interface import Element + + +class TestElement(unittest.TestCase): + + def test_taggedValues(self): + """Test that we can update tagged values of more than one element + """ + + e1 = Element("foo") + e2 = Element("bar") + e1.setTaggedValue("x", 1) + e2.setTaggedValue("x", 2) + self.assertEqual(e1.getTaggedValue("x"), 1) + self.assertEqual(e2.getTaggedValue("x"), 2) diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope/interface/tests/test_exceptions.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope/interface/tests/test_exceptions.py new file mode 100644 index 0000000000000000000000000000000000000000..ca9f0e1e6415b826a7e837806b8ef7a557e57565 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope/interface/tests/test_exceptions.py @@ -0,0 +1,193 @@ +############################################################################## +# +# Copyright (c) 2010 Zope Foundation and Contributors. +# All Rights Reserved. +# +# This software is subject to the provisions of the Zope Public License, +# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. +# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED +# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS +# FOR A PARTICULAR PURPOSE. +# +############################################################################## +""" zope.interface.exceptions unit tests +""" +import unittest + +import zope.interface + + +class IDummy(zope.interface.Interface): + pass + + +def _makeIface(): + from zope.interface.tests.test_exceptions import IDummy + + return IDummy + + +class DoesNotImplementTests(unittest.TestCase): + + def _getTargetClass(self): + from zope.interface.exceptions import DoesNotImplement + return DoesNotImplement + + def _makeOne(self, *args): + iface = _makeIface() + return self._getTargetClass()(iface, *args) + + def test___str__(self): + dni = self._makeOne() + self.assertEqual( + str(dni), + "An object has failed to implement interface " + "zope.interface.tests.test_exceptions.IDummy: " + "Does not declaratively implement the interface." + ) + + def test___str__w_candidate(self): + dni = self._makeOne('candidate') + self.assertEqual( + str(dni), + "The object 'candidate' has failed to implement interface " + "zope.interface.tests.test_exceptions.IDummy: " + "Does not declaratively implement the interface." + ) + + +class BrokenImplementationTests(unittest.TestCase): + + def _getTargetClass(self): + from zope.interface.exceptions import BrokenImplementation + return BrokenImplementation + + def _makeOne(self, *args): + iface = _makeIface() + return self._getTargetClass()(iface, 'missing', *args) + + def test___str__(self): + dni = self._makeOne() + self.assertEqual( + str(dni), + 'An object has failed to implement interface ' + 'zope.interface.tests.test_exceptions.IDummy: ' + "The 'missing' attribute was not provided.") + + def test___str__w_candidate(self): + dni = self._makeOne('candidate') + self.assertEqual( + str(dni), + 'The object \'candidate\' has failed to implement interface ' + 'zope.interface.tests.test_exceptions.IDummy: ' + "The 'missing' attribute was not provided.") + + +def broken_function(): + """ + This is a global function with a simple argument list. + + It exists to be able to report the same information when + formatting signatures. + """ + + +class BrokenMethodImplementationTests(unittest.TestCase): + + def _getTargetClass(self): + from zope.interface.exceptions import BrokenMethodImplementation + return BrokenMethodImplementation + + message = 'I said so' + + def _makeOne(self, *args): + return self._getTargetClass()('aMethod', self.message, *args) + + def test___str__(self): + dni = self._makeOne() + self.assertEqual( + str(dni), + "An object has failed to implement interface : " + "The contract of 'aMethod' is violated because I said so." + ) + + def test___str__w_candidate_no_implementation(self): + dni = self._makeOne('some_function', '', 'candidate') + self.assertEqual( + str(dni), + "The object 'candidate' has failed to implement interface : " + "The contract of 'aMethod' is violated because I said so." + ) + + def test___str__w_candidate_w_implementation(self): + self.message = 'implementation is wonky' + dni = self._makeOne(broken_function, '', 'candidate') + self.assertEqual( + str(dni), + "The object 'candidate' has failed to implement interface : " + "The contract of 'aMethod' is violated because " + "'broken_function()' is wonky." + ) + + def test___str__w_candidate_w_implementation_not_callable(self): + self.message = 'implementation is not callable' + dni = self._makeOne(42, '', 'candidate') + self.assertEqual( + str(dni), + "The object 'candidate' has failed to implement interface : " + "The contract of 'aMethod' is violated because " + "'42' is not callable." + ) + + def test___repr__w_candidate(self): + dni = self._makeOne(None, 'candidate') + self.assertEqual( + repr(dni), + "BrokenMethodImplementation(" + "'aMethod', 'I said so', None, 'candidate')" + ) + + +class MultipleInvalidTests(unittest.TestCase): + + def _getTargetClass(self): + from zope.interface.exceptions import MultipleInvalid + return MultipleInvalid + + def _makeOne(self, excs): + iface = _makeIface() + return self._getTargetClass()(iface, 'target', excs) + + def test__str__(self): + from zope.interface.exceptions import BrokenMethodImplementation + excs = [ + BrokenMethodImplementation('aMethod', 'I said so'), + Exception("Regular exception") + ] + dni = self._makeOne(excs) + self.assertEqual( + str(dni), + "The object 'target' has failed to implement interface " + "zope.interface.tests.test_exceptions.IDummy:\n" + " The contract of 'aMethod' is violated because I said so\n" + " Regular exception" + ) + + def test__repr__(self): + from zope.interface.exceptions import BrokenMethodImplementation + excs = [ + BrokenMethodImplementation('aMethod', 'I said so'), + # Use multiple arguments to normalize repr; versions of Python + # prior to 3.7 add a trailing comma if there's just one. + Exception("Regular", "exception") + ] + dni = self._makeOne(excs) + self.assertEqual( + repr(dni), + "MultipleInvalid(" + "," + " 'target'," + " (BrokenMethodImplementation('aMethod', 'I said so')," + " Exception('Regular', 'exception')))" + ) diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope/interface/tests/test_interface.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope/interface/tests/test_interface.py new file mode 100644 index 0000000000000000000000000000000000000000..e4ff12720c6d026933e994184eb780b7caa9479b --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope/interface/tests/test_interface.py @@ -0,0 +1,2890 @@ +############################################################################## +# +# Copyright (c) 2001, 2002 Zope Foundation and Contributors. +# All Rights Reserved. +# +# This software is subject to the provisions of the Zope Public License, +# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. +# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED +# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS +# FOR A PARTICULAR PURPOSE. +# +############################################################################## +"""Test Interface implementation +""" +# Things we let slide because it's a test +# pylint:disable=protected-access +# pylint:disable=blacklisted-name +# pylint:disable=attribute-defined-outside-init +# pylint:disable=too-many-public-methods +# pylint:disable=too-many-lines +# pylint:disable=abstract-method +# pylint:disable=redefined-builtin +# pylint:disable=signature-differs +# pylint:disable=arguments-differ +# Things you get inheriting from Interface +# pylint:disable=inherit-non-class +# pylint:disable=no-self-argument +# pylint:disable=no-method-argument +# Things you get using methods of an Interface 'subclass' +# pylint:disable=no-value-for-parameter +import unittest + +import zope.interface.interface +from zope.interface.tests import CleanUp +from zope.interface.tests import MissingSomeAttrs +from zope.interface.tests import OptimizationTestMixin +from zope.interface.tests import SubclassableMixin + + +_marker = object() +HashMe = zope.interface.interface.InterfaceClass('HashMe') + + +class Test_invariant(unittest.TestCase): + + def test_w_single(self): + from zope.interface.interface import TAGGED_DATA + from zope.interface.interface import invariant + + def _check(*args, **kw): + raise NotImplementedError() + + class Foo: + invariant(_check) + + self.assertEqual(getattr(Foo, TAGGED_DATA, None), + {'invariants': [_check]}) + + def test_w_multiple(self): + from zope.interface.interface import TAGGED_DATA + from zope.interface.interface import invariant + + def _check(*args, **kw): + raise NotImplementedError() + + def _another_check(*args, **kw): + raise NotImplementedError() + + class Foo: + invariant(_check) + invariant(_another_check) + + self.assertEqual(getattr(Foo, TAGGED_DATA, None), + {'invariants': [_check, _another_check]}) + + +class Test_taggedValue(unittest.TestCase): + + def test_w_single(self): + from zope.interface.interface import TAGGED_DATA + from zope.interface.interface import taggedValue + + class Foo: + taggedValue('bar', ['baz']) + + self.assertEqual(getattr(Foo, TAGGED_DATA, None), + {'bar': ['baz']}) + + def test_w_multiple(self): + from zope.interface.interface import TAGGED_DATA + from zope.interface.interface import taggedValue + + class Foo: + taggedValue('bar', ['baz']) + taggedValue('qux', 'spam') + + self.assertEqual(getattr(Foo, TAGGED_DATA, None), + {'bar': ['baz'], 'qux': 'spam'}) + + def test_w_multiple_overwriting(self): + from zope.interface.interface import TAGGED_DATA + from zope.interface.interface import taggedValue + + class Foo: + taggedValue('bar', ['baz']) + taggedValue('qux', 'spam') + taggedValue('bar', 'frob') + + self.assertEqual(getattr(Foo, TAGGED_DATA, None), + {'bar': 'frob', 'qux': 'spam'}) + + +class ElementTests(unittest.TestCase): + + DEFAULT_NAME = 'AnElement' + + def _getTargetClass(self): + from zope.interface.interface import Element + return Element + + def _makeOne(self, name=None): + if name is None: + name = self.DEFAULT_NAME + return self._getTargetClass()(name) + + def test_ctor_defaults(self): + element = self._makeOne() + self.assertEqual(element.__name__, self.DEFAULT_NAME) + self.assertEqual(element.getName(), self.DEFAULT_NAME) + self.assertEqual(element.__doc__, '') + self.assertEqual(element.getDoc(), '') + self.assertEqual(list(element.getTaggedValueTags()), []) + + def test_ctor_no_doc_space_in_name(self): + element = self._makeOne('An Element') + self.assertEqual(element.__name__, None) + self.assertEqual(element.__doc__, 'An Element') + + def test_getTaggedValue_miss(self): + element = self._makeOne() + self.assertRaises(KeyError, element.getTaggedValue, 'nonesuch') + + def test_getDirectTaggedValueTags(self): + element = self._makeOne() + self.assertEqual([], list(element.getDirectTaggedValueTags())) + + element.setTaggedValue('foo', 'bar') + self.assertEqual(['foo'], list(element.getDirectTaggedValueTags())) + + def test_queryTaggedValue_miss(self): + element = self._makeOne() + self.assertEqual(element.queryTaggedValue('nonesuch'), None) + + def test_queryTaggedValue_miss_w_default(self): + element = self._makeOne() + self.assertEqual(element.queryTaggedValue('nonesuch', 'bar'), 'bar') + + def test_getDirectTaggedValue_miss(self): + element = self._makeOne() + self.assertRaises(KeyError, element.getDirectTaggedValue, 'nonesuch') + + def test_queryDirectTaggedValue_miss(self): + element = self._makeOne() + self.assertEqual(element.queryDirectTaggedValue('nonesuch'), None) + + def test_queryDirectTaggedValue_miss_w_default(self): + element = self._makeOne() + self.assertEqual( + element.queryDirectTaggedValue('nonesuch', 'bar'), 'bar' + ) + + def test_setTaggedValue(self): + element = self._makeOne() + element.setTaggedValue('foo', 'bar') + self.assertEqual(list(element.getTaggedValueTags()), ['foo']) + self.assertEqual(element.getTaggedValue('foo'), 'bar') + self.assertEqual(element.queryTaggedValue('foo'), 'bar') + + def test_verifies(self): + from zope.interface.interfaces import IElement + from zope.interface.verify import verifyObject + + element = self._makeOne() + verifyObject(IElement, element) + + +class GenericSpecificationBaseTests(unittest.TestCase): + # Tests that work with both implementations + def _getFallbackClass(self): + from zope.interface.interface import SpecificationBasePy + return SpecificationBasePy + + _getTargetClass = _getFallbackClass + + def _makeOne(self): + return self._getTargetClass()() + + def test_providedBy_miss(self): + from zope.interface import interface + from zope.interface.declarations import _empty + sb = self._makeOne() + + def _providedBy(obj): + return _empty + + with _Monkey(interface, providedBy=_providedBy): + self.assertFalse(sb.providedBy(object())) + + def test_implementedBy_miss(self): + from zope.interface import interface + from zope.interface.declarations import _empty + sb = self._makeOne() + + def _implementedBy(obj): + return _empty + + with _Monkey(interface, implementedBy=_implementedBy): + self.assertFalse(sb.implementedBy(object())) + + +class SpecificationBaseTests( + GenericSpecificationBaseTests, + OptimizationTestMixin, + SubclassableMixin, +): + # Tests that use the C implementation + + def _getTargetClass(self): + from zope.interface.interface import SpecificationBase + return SpecificationBase + + +class SpecificationBasePyTests(GenericSpecificationBaseTests): + # Tests that only work with the Python implementation + + def test___call___miss(self): + sb = self._makeOne() + sb._implied = {} # not defined by SpecificationBasePy + self.assertFalse(sb.isOrExtends(object())) + + def test___call___hit(self): + sb = self._makeOne() + testing = object() + sb._implied = {testing: {}} # not defined by SpecificationBasePy + self.assertTrue(sb(testing)) + + def test_isOrExtends_miss(self): + sb = self._makeOne() + sb._implied = {} # not defined by SpecificationBasePy + self.assertFalse(sb.isOrExtends(object())) + + def test_isOrExtends_hit(self): + sb = self._makeOne() + testing = object() + sb._implied = {testing: {}} # not defined by SpecificationBasePy + self.assertTrue(sb(testing)) + + def test_implementedBy_hit(self): + from zope.interface import interface + sb = self._makeOne() + + class _Decl: + _implied = {sb: {}} + + def _implementedBy(obj): + return _Decl() + + with _Monkey(interface, implementedBy=_implementedBy): + self.assertTrue(sb.implementedBy(object())) + + def test_providedBy_hit(self): + from zope.interface import interface + sb = self._makeOne() + + class _Decl: + _implied = {sb: {}} + + def _providedBy(obj): + return _Decl() + + with _Monkey(interface, providedBy=_providedBy): + self.assertTrue(sb.providedBy(object())) + + +class NameAndModuleComparisonTestsMixin(CleanUp): + + def _makeOneToCompare(self): + return self._makeOne('a', 'b') + + def __check_NotImplemented_comparison(self, name): + # Without the correct attributes of __name__ and __module__, + # comparison switches to the reverse direction. + + import operator + ib = self._makeOneToCompare() + op = getattr(operator, name) + meth = getattr(ib, '__%s__' % name) + + # If either the __name__ or __module__ attribute + # is missing from the other object, then we return + # NotImplemented. + class RaisesErrorOnMissing: + Exc = AttributeError + + def __getattribute__(self, name): + try: + return object.__getattribute__(self, name) + except AttributeError: + exc = RaisesErrorOnMissing.Exc + raise exc(name) + + class RaisesErrorOnModule(RaisesErrorOnMissing): + def __init__(self): + self.__name__ = 'foo' + + @property + def __module__(self): + raise AttributeError + + class RaisesErrorOnName(RaisesErrorOnMissing): + def __init__(self): + self.__module__ = 'foo' + + self.assertEqual(RaisesErrorOnModule().__name__, 'foo') + self.assertEqual(RaisesErrorOnName().__module__, 'foo') + with self.assertRaises(AttributeError): + getattr(RaisesErrorOnModule(), '__module__') + with self.assertRaises(AttributeError): + getattr(RaisesErrorOnName(), '__name__') + + for cls in RaisesErrorOnModule, RaisesErrorOnName: + self.assertIs(meth(cls()), NotImplemented) + + # If the other object has a comparison function, returning + # NotImplemented means Python calls it. + + class AllowsAnyComparison(RaisesErrorOnMissing): + def __eq__(self, other): + return True + __lt__ = __eq__ + __le__ = __eq__ + __gt__ = __eq__ + __ge__ = __eq__ + __ne__ = __eq__ + + self.assertTrue(op(ib, AllowsAnyComparison())) + self.assertIs(meth(AllowsAnyComparison()), NotImplemented) + + # If it doesn't have the comparison, Python raises a TypeError. + class AllowsNoComparison: + __eq__ = None + __lt__ = __eq__ + __le__ = __eq__ + __gt__ = __eq__ + __ge__ = __eq__ + __ne__ = __eq__ + + self.assertIs(meth(AllowsNoComparison()), NotImplemented) + with self.assertRaises(TypeError): + op(ib, AllowsNoComparison()) + + # Errors besides AttributeError are passed + class MyException(Exception): + pass + + RaisesErrorOnMissing.Exc = MyException + + with self.assertRaises(MyException): + getattr(RaisesErrorOnModule(), '__module__') + with self.assertRaises(MyException): + getattr(RaisesErrorOnName(), '__name__') + + for cls in RaisesErrorOnModule, RaisesErrorOnName: + with self.assertRaises(MyException): + op(ib, cls()) + with self.assertRaises(MyException): + meth(cls()) + + def test__lt__NotImplemented(self): + self.__check_NotImplemented_comparison('lt') + + def test__le__NotImplemented(self): + self.__check_NotImplemented_comparison('le') + + def test__gt__NotImplemented(self): + self.__check_NotImplemented_comparison('gt') + + def test__ge__NotImplemented(self): + self.__check_NotImplemented_comparison('ge') + + +class InterfaceBaseTestsMixin(NameAndModuleComparisonTestsMixin): + # Tests for both C and Python implementation + + def _getTargetClass(self): + raise NotImplementedError + + def _getFallbackClass(self): + # pylint:disable=no-name-in-module + from zope.interface.interface import InterfaceBasePy + return InterfaceBasePy + + def _makeOne(self, object_should_provide=False, name=None, module=None): + + class IB(self._getTargetClass()): + def _call_conform(self, conform): + return conform(self) + + def providedBy(self, obj): + return object_should_provide + + return IB(name, module) + + def test___call___w___conform___returning_value(self): + ib = self._makeOne(False) + conformed = object() + + class _Adapted: + def __conform__(self, iface): + return conformed + + self.assertIs(ib(_Adapted()), conformed) + + def test___call___wo___conform___ob_no_provides_w_alternate(self): + ib = self._makeOne(False) + __traceback_info__ = ib, self._getTargetClass() + adapted = object() + alternate = object() + self.assertIs(ib(adapted, alternate), alternate) + + def test___call___w___conform___ob_no_provides_wo_alternate(self): + ib = self._makeOne(False) + with self.assertRaises(TypeError) as exc: + ib(object()) + + self.assertIn('Could not adapt', str(exc.exception)) + + def test___call___w_no_conform_catches_only_AttributeError(self): + MissingSomeAttrs.test_raises( + self, self._makeOne(), expected_missing='__conform__' + ) + + +class InterfaceBaseTests( + InterfaceBaseTestsMixin, + OptimizationTestMixin, + SubclassableMixin, + unittest.TestCase, +): + # Tests that work with the C implementation + def _getTargetClass(self): + from zope.interface.interface import InterfaceBase + return InterfaceBase + + +class InterfaceBasePyTests(InterfaceBaseTestsMixin, unittest.TestCase): + # Tests that only work with the Python implementation + + _getTargetClass = InterfaceBaseTestsMixin._getFallbackClass + + def test___call___w___conform___miss_ob_provides(self): + ib = self._makeOne(True) + + class _Adapted: + def __conform__(self, iface): + return None + + adapted = _Adapted() + self.assertIs(ib(adapted), adapted) + + def test___adapt___ob_provides(self): + ib = self._makeOne(True) + adapted = object() + self.assertIs(ib.__adapt__(adapted), adapted) + + def test___adapt___ob_no_provides_uses_hooks(self): + from zope.interface import interface + ib = self._makeOne(False) + adapted = object() + _missed = [] + + def _hook_miss(iface, obj): + _missed.append((iface, obj)) + + def _hook_hit(iface, obj): + return obj + + with _Monkey(interface, adapter_hooks=[_hook_miss, _hook_hit]): + self.assertIs(ib.__adapt__(adapted), adapted) + self.assertEqual(_missed, [(ib, adapted)]) + + +class SpecificationTests(unittest.TestCase): + + def _getTargetClass(self): + from zope.interface.interface import Specification + return Specification + + def _makeOne(self, bases=_marker): + if bases is _marker: + return self._getTargetClass()() + return self._getTargetClass()(bases) + + def test_ctor(self): + from zope.interface.interface import Interface + spec = self._makeOne() + self.assertEqual(spec.__bases__, ()) + self.assertEqual(len(spec._implied), 2) + self.assertIn(spec, spec._implied) + self.assertIn(Interface, spec._implied) + self.assertEqual(len(spec.dependents), 0) + + def test_subscribe_first_time(self): + spec = self._makeOne() + dep = DummyDependent() + spec.subscribe(dep) + self.assertEqual(len(spec.dependents), 1) + self.assertEqual(spec.dependents[dep], 1) + + def test_subscribe_again(self): + spec = self._makeOne() + dep = DummyDependent() + spec.subscribe(dep) + spec.subscribe(dep) + self.assertEqual(spec.dependents[dep], 2) + + def test_unsubscribe_miss(self): + spec = self._makeOne() + dep = DummyDependent() + self.assertRaises(KeyError, spec.unsubscribe, dep) + + def test_unsubscribe(self): + spec = self._makeOne() + dep = DummyDependent() + spec.subscribe(dep) + spec.subscribe(dep) + spec.unsubscribe(dep) + self.assertEqual(spec.dependents[dep], 1) + spec.unsubscribe(dep) + self.assertNotIn(dep, spec.dependents) + + def test___setBases_subscribes_bases_and_notifies_dependents(self): + from zope.interface.interface import Interface + spec = self._makeOne() + dep = DummyDependent() + spec.subscribe(dep) + + class IFoo(Interface): + pass + + class IBar(Interface): + pass + + spec.__bases__ = (IFoo,) + self.assertEqual(dep._changed, [spec]) + self.assertEqual(IFoo.dependents[spec], 1) + spec.__bases__ = (IBar,) + self.assertEqual(IFoo.dependents.get(spec), None) + self.assertEqual(IBar.dependents[spec], 1) + + def test_changed_clears_volatiles_and_implied(self): + from zope.interface.interface import Interface + + class IFoo(Interface): + pass + + spec = self._makeOne() + spec._v_attrs = 'Foo' + spec._implied[IFoo] = () + spec.changed(spec) + self.assertIsNone(spec._v_attrs) + self.assertNotIn(IFoo, spec._implied) + + def test_interfaces_skips_already_seen(self): + from zope.interface.interface import Interface + + class IFoo(Interface): + pass + + spec = self._makeOne([IFoo, IFoo]) + self.assertEqual(list(spec.interfaces()), [IFoo]) + + def test_extends_strict_wo_self(self): + from zope.interface.interface import Interface + + class IFoo(Interface): + pass + + spec = self._makeOne(IFoo) + self.assertFalse(spec.extends(IFoo, strict=True)) + + def test_extends_strict_w_self(self): + spec = self._makeOne() + self.assertFalse(spec.extends(spec, strict=True)) + + def test_extends_non_strict_w_self(self): + spec = self._makeOne() + self.assertTrue(spec.extends(spec, strict=False)) + + def test_get_hit_w__v_attrs(self): + spec = self._makeOne() + foo = object() + spec._v_attrs = {'foo': foo} + self.assertIs(spec.get('foo'), foo) + + def test_get_hit_from_base_wo__v_attrs(self): + from zope.interface.interface import Attribute + from zope.interface.interface import Interface + + class IFoo(Interface): + foo = Attribute('foo') + + class IBar(Interface): + bar = Attribute('bar') + + spec = self._makeOne([IFoo, IBar]) + self.assertIs(spec.get('foo'), IFoo.get('foo')) + self.assertIs(spec.get('bar'), IBar.get('bar')) + + def test_multiple_inheritance_no_interfaces(self): + # If we extend an object that implements interfaces, + # plus one that doesn't, we do not interject `Interface` + # early in the resolution order. It stays at the end, + # like it should. + # See https://github.com/zopefoundation/zope.interface/issues/8 + from zope.interface.declarations import implementedBy + from zope.interface.declarations import implementer + from zope.interface.interface import Interface + + class IDefaultViewName(Interface): + pass + + class Context: + pass + + class RDBModel(Context): + pass + + class IOther(Interface): + pass + + @implementer(IOther) + class OtherBase: + pass + + class Model(OtherBase, Context): + pass + + self.assertEqual( + implementedBy(Model).__sro__, + ( + implementedBy(Model), + implementedBy(OtherBase), + IOther, + implementedBy(Context), + implementedBy(object), + Interface, # This used to be wrong, it used to be 2 too high. + ) + ) + + +class InterfaceClassTests(unittest.TestCase): + + def _getTargetClass(self): + from zope.interface.interface import InterfaceClass + return InterfaceClass + + def _makeOne(self, name='ITest', bases=(), attrs=None, __doc__=None, + __module__=None): + return self._getTargetClass()(name, bases, attrs, __doc__, __module__) + + def test_ctor_defaults(self): + klass = self._getTargetClass() + inst = klass('ITesting') + self.assertEqual(inst.__name__, 'ITesting') + self.assertEqual(inst.__doc__, '') + self.assertEqual(inst.__bases__, ()) + self.assertEqual(inst.getBases(), ()) + + def test_ctor_bad_bases(self): + klass = self._getTargetClass() + self.assertRaises(TypeError, klass, 'ITesting', (object(),)) + + def test_ctor_w_attrs_attrib_methods(self): + from zope.interface.interface import Attribute + from zope.interface.interface import fromFunction + + def _bar(): + """DOCSTRING""" + + ATTRS = { + 'foo': Attribute('Foo', ''), + 'bar': fromFunction(_bar), + } + klass = self._getTargetClass() + inst = klass('ITesting', attrs=ATTRS) + self.assertEqual(inst.__name__, 'ITesting') + self.assertEqual(inst.__doc__, '') + self.assertEqual(inst.__bases__, ()) + self.assertEqual(inst.names(), ATTRS.keys()) + + def test_ctor_attrs_w___locals__(self): + ATTRS = {'__locals__': {}} + klass = self._getTargetClass() + inst = klass('ITesting', attrs=ATTRS) + self.assertEqual(inst.__name__, 'ITesting') + self.assertEqual(inst.__doc__, '') + self.assertEqual(inst.__bases__, ()) + self.assertEqual(list(inst.names()), []) + + def test_ctor_attrs_w___annotations__(self): + ATTRS = {'__annotations__': {}} + klass = self._getTargetClass() + inst = klass('ITesting', attrs=ATTRS) + self.assertEqual(inst.__name__, 'ITesting') + self.assertEqual(inst.__doc__, '') + self.assertEqual(inst.__bases__, ()) + self.assertEqual(list(inst.names()), []) + + def test_ctor_attrs_w___annotate_func__(self) -> None: + from zope.interface import Attribute + from zope.interface import Interface + from zope.interface import directlyProvides + from zope.interface.verify import verifyObject + + class IAnnotated(Interface): + value: int = Attribute("Value") + + class Annotated: + value: int = 0 + + self.assertEqual(list(IAnnotated.names()), ['value']) + annotated = Annotated() + directlyProvides(annotated, IAnnotated) + verifyObject(IAnnotated, annotated) + + def test_ctor_attrs_w__decorator_non_return(self): + from zope.interface.interface import _decorator_non_return + ATTRS = {'dropme': _decorator_non_return} + klass = self._getTargetClass() + inst = klass('ITesting', attrs=ATTRS) + self.assertEqual(inst.__name__, 'ITesting') + self.assertEqual(inst.__doc__, '') + self.assertEqual(inst.__bases__, ()) + self.assertEqual(list(inst.names()), []) + + def test_ctor_attrs_w_invalid_attr_type(self): + from zope.interface.exceptions import InvalidInterface + ATTRS = {'invalid': object()} + klass = self._getTargetClass() + self.assertRaises(InvalidInterface, klass, 'ITesting', attrs=ATTRS) + + def test_ctor_w_explicit___doc__(self): + ATTRS = {'__doc__': 'ATTR'} + klass = self._getTargetClass() + inst = klass('ITesting', attrs=ATTRS, __doc__='EXPLICIT') + self.assertEqual(inst.__doc__, 'EXPLICIT') + + def test_interfaces(self): + iface = self._makeOne() + self.assertEqual(list(iface.interfaces()), [iface]) + + def test_getBases(self): + iface = self._makeOne() + sub = self._makeOne('ISub', bases=(iface,)) + self.assertEqual(sub.getBases(), (iface,)) + + def test_isEqualOrExtendedBy_identity(self): + iface = self._makeOne() + self.assertTrue(iface.isEqualOrExtendedBy(iface)) + + def test_isEqualOrExtendedBy_subiface(self): + iface = self._makeOne() + sub = self._makeOne('ISub', bases=(iface,)) + self.assertTrue(iface.isEqualOrExtendedBy(sub)) + self.assertFalse(sub.isEqualOrExtendedBy(iface)) + + def test_isEqualOrExtendedBy_unrelated(self): + one = self._makeOne('One') + another = self._makeOne('Another') + self.assertFalse(one.isEqualOrExtendedBy(another)) + self.assertFalse(another.isEqualOrExtendedBy(one)) + + def test_names_w_all_False_ignores_bases(self): + from zope.interface.interface import Attribute + from zope.interface.interface import fromFunction + + def _bar(): + """DOCSTRING""" + + BASE_ATTRS = { + 'foo': Attribute('Foo', ''), + 'bar': fromFunction(_bar), + } + DERIVED_ATTRS = { + 'baz': Attribute('Baz', ''), + } + base = self._makeOne('IBase', attrs=BASE_ATTRS) + derived = self._makeOne('IDerived', bases=(base,), attrs=DERIVED_ATTRS) + self.assertEqual(sorted(derived.names(all=False)), ['baz']) + + def test_names_w_all_True_no_bases(self): + from zope.interface.interface import Attribute + from zope.interface.interface import fromFunction + + def _bar(): + """DOCSTRING""" + + ATTRS = { + 'foo': Attribute('Foo', ''), + 'bar': fromFunction(_bar), + } + one = self._makeOne(attrs=ATTRS) + self.assertEqual(sorted(one.names(all=True)), ['bar', 'foo']) + + def test_names_w_all_True_w_bases_simple(self): + from zope.interface.interface import Attribute + from zope.interface.interface import fromFunction + + def _bar(): + """DOCSTRING""" + + BASE_ATTRS = { + 'foo': Attribute('Foo', ''), + 'bar': fromFunction(_bar), + } + DERIVED_ATTRS = { + 'baz': Attribute('Baz', ''), + } + base = self._makeOne('IBase', attrs=BASE_ATTRS) + derived = self._makeOne('IDerived', bases=(base,), attrs=DERIVED_ATTRS) + self.assertEqual( + sorted(derived.names(all=True)), ['bar', 'baz', 'foo'] + ) + + def test_names_w_all_True_bases_w_same_names(self): + from zope.interface.interface import Attribute + from zope.interface.interface import fromFunction + + def _bar(): + """DOCSTRING""" + + def _foo(): + """DOCSTRING""" + + BASE_ATTRS = { + 'foo': Attribute('Foo', ''), + 'bar': fromFunction(_bar), + } + DERIVED_ATTRS = { + 'foo': fromFunction(_foo), + 'baz': Attribute('Baz', ''), + } + base = self._makeOne('IBase', attrs=BASE_ATTRS) + derived = self._makeOne('IDerived', bases=(base,), attrs=DERIVED_ATTRS) + self.assertEqual(sorted( + derived.names(all=True)), ['bar', 'baz', 'foo'] + ) + + def test___iter__(self): + from zope.interface.interface import Attribute + from zope.interface.interface import fromFunction + + def _bar(): + """DOCSTRING""" + + def _foo(): + """DOCSTRING""" + + BASE_ATTRS = { + 'foo': Attribute('Foo', ''), + 'bar': fromFunction(_bar), + } + DERIVED_ATTRS = { + 'foo': fromFunction(_foo), + 'baz': Attribute('Baz', ''), + } + base = self._makeOne('IBase', attrs=BASE_ATTRS) + derived = self._makeOne('IDerived', bases=(base,), attrs=DERIVED_ATTRS) + self.assertEqual(sorted(derived), ['bar', 'baz', 'foo']) + + def test_namesAndDescriptions_w_all_False_ignores_bases(self): + from zope.interface.interface import Attribute + from zope.interface.interface import fromFunction + + def _bar(): + """DOCSTRING""" + + BASE_ATTRS = { + 'foo': Attribute('Foo', ''), + 'bar': fromFunction(_bar), + } + DERIVED_ATTRS = { + 'baz': Attribute('Baz', ''), + } + base = self._makeOne('IBase', attrs=BASE_ATTRS) + derived = self._makeOne('IDerived', bases=(base,), attrs=DERIVED_ATTRS) + self.assertEqual( + sorted(derived.namesAndDescriptions(all=False)), [ + ('baz', DERIVED_ATTRS['baz']), + ] + ) + + def test_namesAndDescriptions_w_all_True_no_bases(self): + from zope.interface.interface import Attribute + from zope.interface.interface import fromFunction + + def _bar(): + """DOCSTRING""" + + ATTRS = { + 'foo': Attribute('Foo', ''), + 'bar': fromFunction(_bar), + } + one = self._makeOne(attrs=ATTRS) + self.assertEqual( + sorted(one.namesAndDescriptions(all=False)), [ + ('bar', ATTRS['bar']), + ('foo', ATTRS['foo']), + ] + ) + + def test_namesAndDescriptions_w_all_True_simple(self): + from zope.interface.interface import Attribute + from zope.interface.interface import fromFunction + + def _bar(): + """DOCSTRING""" + + BASE_ATTRS = { + 'foo': Attribute('Foo', ''), + 'bar': fromFunction(_bar), + } + DERIVED_ATTRS = { + 'baz': Attribute('Baz', ''), + } + base = self._makeOne('IBase', attrs=BASE_ATTRS) + derived = self._makeOne('IDerived', bases=(base,), attrs=DERIVED_ATTRS) + self.assertEqual( + sorted(derived.namesAndDescriptions(all=True)), [ + ('bar', BASE_ATTRS['bar']), + ('baz', DERIVED_ATTRS['baz']), + ('foo', BASE_ATTRS['foo']), + ] + ) + + def test_namesAndDescriptions_w_all_True_bases_w_same_names(self): + from zope.interface.interface import Attribute + from zope.interface.interface import fromFunction + + def _bar(): + """DOCSTRING""" + + def _foo(): + """DOCSTRING""" + + BASE_ATTRS = { + 'foo': Attribute('Foo', ''), + 'bar': fromFunction(_bar), + } + DERIVED_ATTRS = { + 'foo': fromFunction(_foo), + 'baz': Attribute('Baz', ''), + } + base = self._makeOne('IBase', attrs=BASE_ATTRS) + derived = self._makeOne('IDerived', bases=(base,), attrs=DERIVED_ATTRS) + self.assertEqual( + sorted(derived.namesAndDescriptions(all=True)), [ + ('bar', BASE_ATTRS['bar']), + ('baz', DERIVED_ATTRS['baz']), + ('foo', DERIVED_ATTRS['foo']), + ] + ) + + def test_getDescriptionFor_miss(self): + one = self._makeOne() + self.assertRaises(KeyError, one.getDescriptionFor, 'nonesuch') + + def test_getDescriptionFor_hit(self): + from zope.interface.interface import Attribute + from zope.interface.interface import fromFunction + + def _bar(): + """DOCSTRING""" + + ATTRS = { + 'foo': Attribute('Foo', ''), + 'bar': fromFunction(_bar), + } + one = self._makeOne(attrs=ATTRS) + self.assertEqual(one.getDescriptionFor('foo'), ATTRS['foo']) + self.assertEqual(one.getDescriptionFor('bar'), ATTRS['bar']) + + def test___getitem___miss(self): + one = self._makeOne() + + def _test(): + return one['nonesuch'] + + self.assertRaises(KeyError, _test) + + def test___getitem___hit(self): + from zope.interface.interface import Attribute + from zope.interface.interface import fromFunction + + def _bar(): + """DOCSTRING""" + + ATTRS = { + 'foo': Attribute('Foo', ''), + 'bar': fromFunction(_bar), + } + one = self._makeOne(attrs=ATTRS) + self.assertEqual(one['foo'], ATTRS['foo']) + self.assertEqual(one['bar'], ATTRS['bar']) + + def test___contains___miss(self): + one = self._makeOne() + self.assertNotIn('nonesuch', one) + + def test___contains___hit(self): + from zope.interface.interface import Attribute + from zope.interface.interface import fromFunction + + def _bar(): + """DOCSTRING""" + + ATTRS = { + 'foo': Attribute('Foo', ''), + 'bar': fromFunction(_bar), + } + one = self._makeOne(attrs=ATTRS) + self.assertIn('foo', one) + self.assertIn('bar', one) + + def test_direct_miss(self): + one = self._makeOne() + self.assertEqual(one.direct('nonesuch'), None) + + def test_direct_hit_local_miss_bases(self): + from zope.interface.interface import Attribute + from zope.interface.interface import fromFunction + + def _bar(): + """DOCSTRING""" + + def _foo(): + """DOCSTRING""" + + BASE_ATTRS = { + 'foo': Attribute('Foo', ''), + 'bar': fromFunction(_bar), + } + DERIVED_ATTRS = { + 'foo': fromFunction(_foo), + 'baz': Attribute('Baz', ''), + } + base = self._makeOne('IBase', attrs=BASE_ATTRS) + derived = self._makeOne('IDerived', bases=(base,), attrs=DERIVED_ATTRS) + self.assertEqual(derived.direct('foo'), DERIVED_ATTRS['foo']) + self.assertEqual(derived.direct('baz'), DERIVED_ATTRS['baz']) + self.assertEqual(derived.direct('bar'), None) + + def test_queryDescriptionFor_miss(self): + iface = self._makeOne() + self.assertEqual(iface.queryDescriptionFor('nonesuch'), None) + + def test_queryDescriptionFor_hit(self): + from zope.interface import Attribute + ATTRS = {'attr': Attribute('Title', 'Description')} + iface = self._makeOne(attrs=ATTRS) + self.assertEqual(iface.queryDescriptionFor('attr'), ATTRS['attr']) + + def test_validateInvariants_pass(self): + _called_with = [] + + def _passable(*args, **kw): + _called_with.append((args, kw)) + return True + + iface = self._makeOne() + obj = object() + iface.setTaggedValue('invariants', [_passable]) + self.assertEqual(iface.validateInvariants(obj), None) + self.assertEqual(_called_with, [((obj,), {})]) + + def test_validateInvariants_fail_wo_errors_passed(self): + from zope.interface.exceptions import Invalid + _passable_called_with = [] + + def _passable(*args, **kw): + _passable_called_with.append((args, kw)) + return True + + _fail_called_with = [] + + def _fail(*args, **kw): + _fail_called_with.append((args, kw)) + raise Invalid + + iface = self._makeOne() + obj = object() + iface.setTaggedValue('invariants', [_passable, _fail]) + self.assertRaises(Invalid, iface.validateInvariants, obj) + self.assertEqual(_passable_called_with, [((obj,), {})]) + self.assertEqual(_fail_called_with, [((obj,), {})]) + + def test_validateInvariants_fail_w_errors_passed(self): + from zope.interface.exceptions import Invalid + _errors = [] + _fail_called_with = [] + + def _fail(*args, **kw): + _fail_called_with.append((args, kw)) + raise Invalid + + iface = self._makeOne() + obj = object() + iface.setTaggedValue('invariants', [_fail]) + self.assertRaises(Invalid, iface.validateInvariants, obj, _errors) + self.assertEqual(_fail_called_with, [((obj,), {})]) + self.assertEqual(len(_errors), 1) + self.assertIsInstance(_errors[0], Invalid) + + def test_validateInvariants_fail_in_base_wo_errors_passed(self): + from zope.interface.exceptions import Invalid + _passable_called_with = [] + + def _passable(*args, **kw): + _passable_called_with.append((args, kw)) + return True + + _fail_called_with = [] + + def _fail(*args, **kw): + _fail_called_with.append((args, kw)) + raise Invalid + + base = self._makeOne('IBase') + derived = self._makeOne('IDerived', (base,)) + obj = object() + base.setTaggedValue('invariants', [_fail]) + derived.setTaggedValue('invariants', [_passable]) + self.assertRaises(Invalid, derived.validateInvariants, obj) + self.assertEqual(_passable_called_with, [((obj,), {})]) + self.assertEqual(_fail_called_with, [((obj,), {})]) + + def test_validateInvariants_fail_in_base_w_errors_passed(self): + from zope.interface.exceptions import Invalid + _errors = [] + _passable_called_with = [] + + def _passable(*args, **kw): + _passable_called_with.append((args, kw)) + return True + + _fail_called_with = [] + + def _fail(*args, **kw): + _fail_called_with.append((args, kw)) + raise Invalid + + base = self._makeOne('IBase') + derived = self._makeOne('IDerived', (base,)) + obj = object() + base.setTaggedValue('invariants', [_fail]) + derived.setTaggedValue('invariants', [_passable]) + self.assertRaises(Invalid, derived.validateInvariants, obj, _errors) + self.assertEqual(_passable_called_with, [((obj,), {})]) + self.assertEqual(_fail_called_with, [((obj,), {})]) + self.assertEqual(len(_errors), 1) + self.assertIsInstance(_errors[0], Invalid) + + def test_validateInvariants_inherited_not_called_multiple_times(self): + _passable_called_with = [] + + def _passable(*args, **kw): + _passable_called_with.append((args, kw)) + return True + + obj = object() + base = self._makeOne('IBase') + base.setTaggedValue('invariants', [_passable]) + derived = self._makeOne('IDerived', (base,)) + derived.validateInvariants(obj) + self.assertEqual(1, len(_passable_called_with)) + + def test___reduce__(self): + iface = self._makeOne('PickleMe') + self.assertEqual(iface.__reduce__(), 'PickleMe') + + def test___hash___normal(self): + from zope.interface.tests.test_interface import HashMe as iface + self.assertEqual( + hash(iface), + hash(('HashMe', 'zope.interface.tests.test_interface')) + ) + + def test___hash___missing_required_attrs(self): + + class Derived(self._getTargetClass()): + def __init__(self): # pylint:disable=super-init-not-called + pass # Don't call base class. + + derived = Derived() + with self.assertRaises(AttributeError): + hash(derived) + + def test_comparison_with_None(self): + # pylint:disable=singleton-comparison,misplaced-comparison-constant + iface = self._makeOne() + self.assertLess(iface, None) # noqa E711 + self.assertLessEqual(iface, None) # noqa E711 + self.assertNotEqual(iface, None) # noqa E711 + self.assertNotEqual(iface, None) # noqa E711 + self.assertFalse(iface >= None) # noqa E711 + self.assertFalse(iface > None) # noqa E711 + + self.assertFalse(None < iface) # noqa E711 + self.assertFalse(None <= iface) # noqa E711 + self.assertNotEqual(None, iface) # noqa E711 + self.assertNotEqual(None, iface) # noqa E711 + self.assertGreaterEqual(None, iface) # noqa E711 + self.assertGreater(None, iface) # noqa E711 + + def test_comparison_with_same_instance(self): + # pylint:disable=comparison-with-itself + iface = self._makeOne() + + self.assertFalse(iface < iface) + self.assertLessEqual(iface, iface) + self.assertEqual(iface, iface) + self.assertEqual(iface, iface) + self.assertGreaterEqual(iface, iface) + self.assertFalse(iface > iface) + + def test_comparison_with_same_named_instance_in_other_module(self): + + one = self._makeOne('IName', __module__='zope.interface.tests.one') + other = self._makeOne('IName', __module__='zope.interface.tests.other') + + self.assertLess(one, other) + self.assertFalse(other < one) + self.assertLessEqual(one, other) + self.assertFalse(other <= one) + self.assertNotEqual(one, other) + self.assertNotEqual(other, one) + self.assertNotEqual(one, other) + self.assertNotEqual(other, one) + self.assertFalse(one >= other) + self.assertGreaterEqual(other, one) + self.assertFalse(one > other) + self.assertGreater(other, one) + + def test_assignment_to__class__(self): + # https://github.com/zopefoundation/zope.interface/issues/6 + class MyException(Exception): + pass + + class MyInterfaceClass(self._getTargetClass()): + def __call__(self, target): + raise MyException(target) + + IFoo = self._makeOne('IName') + self.assertIsInstance(IFoo, self._getTargetClass()) + self.assertIs(type(IFoo), self._getTargetClass()) + + with self.assertRaises(TypeError): + IFoo(1) + + IFoo.__class__ = MyInterfaceClass + self.assertIsInstance(IFoo, MyInterfaceClass) + self.assertIs(type(IFoo), MyInterfaceClass) + + with self.assertRaises(MyException): + IFoo(1) + + def test_assignment_to__class__2(self): + # https://github.com/zopefoundation/zope.interface/issues/6 + # This is essentially a transcription of the + # test presented in the bug report. + from zope.interface import Interface + + class MyInterfaceClass(self._getTargetClass()): + def __call__(self, *args): + return args + + IFoo = MyInterfaceClass('IFoo', (Interface,)) + self.assertEqual(IFoo(1), (1,)) + + class IBar(IFoo): + pass + + self.assertEqual(IBar(1), (1,)) + + class ISpam(Interface): + pass + + with self.assertRaises(TypeError): + ISpam() + + ISpam.__class__ = MyInterfaceClass + self.assertEqual(ISpam(1), (1,)) + + def test__module__is_readonly(self): + inst = self._makeOne() + with self.assertRaises(AttributeError): + inst.__module__ = 'different.module' + + +class InterfaceTests(unittest.TestCase): + + def test_attributes_link_to_interface(self): + from zope.interface import Attribute + from zope.interface import Interface + + class I1(Interface): + attr = Attribute("My attr") + + self.assertIs(I1['attr'].interface, I1) + + def test_methods_link_to_interface(self): + from zope.interface import Interface + + class I1(Interface): + def method(foo, bar, bingo): + "A method" + + self.assertIs(I1['method'].interface, I1) + + def test_classImplements_simple(self): + from zope.interface import Interface + from zope.interface import implementedBy + from zope.interface import providedBy + + class ICurrent(Interface): + def method1(a, b): + """docstring""" + + def method2(a, b): + """docstring""" + + class IOther(Interface): + pass + + class Current: + __implemented__ = ICurrent + + def method1(self, a, b): + raise NotImplementedError() + + def method2(self, a, b): + raise NotImplementedError() + + current = Current() + + self.assertTrue(ICurrent.implementedBy(Current)) + self.assertFalse(IOther.implementedBy(Current)) + self.assertEqual(ICurrent, ICurrent) + self.assertIn(ICurrent, implementedBy(Current)) + self.assertNotIn(IOther, implementedBy(Current)) + self.assertIn(ICurrent, providedBy(current)) + self.assertNotIn(IOther, providedBy(current)) + + def test_classImplements_base_not_derived(self): + from zope.interface import Interface + from zope.interface import implementedBy + from zope.interface import providedBy + + class IBase(Interface): + def method(): + """docstring""" + + class IDerived(IBase): + pass + + class Current(): + __implemented__ = IBase + + def method(self): + raise NotImplementedError() + + current = Current() + + self.assertTrue(IBase.implementedBy(Current)) + self.assertFalse(IDerived.implementedBy(Current)) + self.assertIn(IBase, implementedBy(Current)) + self.assertNotIn(IDerived, implementedBy(Current)) + self.assertIn(IBase, providedBy(current)) + self.assertNotIn(IDerived, providedBy(current)) + + def test_classImplements_base_and_derived(self): + from zope.interface import Interface + from zope.interface import implementedBy + from zope.interface import providedBy + + class IBase(Interface): + def method(): + """docstring""" + + class IDerived(IBase): + pass + + class Current: + __implemented__ = IDerived + + def method(self): + raise NotImplementedError() + + current = Current() + + self.assertTrue(IBase.implementedBy(Current)) + self.assertTrue(IDerived.implementedBy(Current)) + self.assertNotIn(IBase, implementedBy(Current)) + self.assertIn(IBase, implementedBy(Current).flattened()) + self.assertIn(IDerived, implementedBy(Current)) + self.assertNotIn(IBase, providedBy(current)) + self.assertIn(IBase, providedBy(current).flattened()) + self.assertIn(IDerived, providedBy(current)) + + def test_classImplements_multiple(self): + from zope.interface import Interface + from zope.interface import implementedBy + from zope.interface import providedBy + + class ILeft(Interface): + def method(): + """docstring""" + + class IRight(ILeft): + pass + + class Left: + __implemented__ = ILeft + + def method(self): + raise NotImplementedError() + + class Right: + __implemented__ = IRight + + class Ambi(Left, Right): + pass + + ambi = Ambi() + + self.assertTrue(ILeft.implementedBy(Ambi)) + self.assertTrue(IRight.implementedBy(Ambi)) + self.assertIn(ILeft, implementedBy(Ambi)) + self.assertIn(IRight, implementedBy(Ambi)) + self.assertIn(ILeft, providedBy(ambi)) + self.assertIn(IRight, providedBy(ambi)) + + def test_classImplements_multiple_w_explict_implements(self): + from zope.interface import Interface + from zope.interface import implementedBy + from zope.interface import providedBy + + class ILeft(Interface): + + def method(): + """docstring""" + + class IRight(ILeft): + pass + + class IOther(Interface): + pass + + class Left(): + __implemented__ = ILeft + + def method(self): + raise NotImplementedError() + + class Right: + __implemented__ = IRight + + class Other: + __implemented__ = IOther + + class Mixed(Left, Right): + __implemented__ = Left.__implemented__, Other.__implemented__ + + mixed = Mixed() + + self.assertTrue(ILeft.implementedBy(Mixed)) + self.assertFalse(IRight.implementedBy(Mixed)) + self.assertTrue(IOther.implementedBy(Mixed)) + self.assertIn(ILeft, implementedBy(Mixed)) + self.assertNotIn(IRight, implementedBy(Mixed)) + self.assertIn(IOther, implementedBy(Mixed)) + self.assertIn(ILeft, providedBy(mixed)) + self.assertNotIn(IRight, providedBy(mixed)) + self.assertIn(IOther, providedBy(mixed)) + + def testInterfaceExtendsInterface(self): + from zope.interface import Interface + + new = Interface.__class__ + FunInterface = new('FunInterface') + BarInterface = new('BarInterface', (FunInterface,)) + BobInterface = new('BobInterface') + BazInterface = new('BazInterface', (BobInterface, BarInterface,)) + + self.assertTrue(BazInterface.extends(BobInterface)) + self.assertTrue(BazInterface.extends(BarInterface)) + self.assertTrue(BazInterface.extends(FunInterface)) + self.assertFalse(BobInterface.extends(FunInterface)) + self.assertFalse(BobInterface.extends(BarInterface)) + self.assertTrue(BarInterface.extends(FunInterface)) + self.assertFalse(BarInterface.extends(BazInterface)) + + def test_verifyClass(self): + from zope.interface import Attribute + from zope.interface import Interface + from zope.interface.verify import verifyClass + + class ICheckMe(Interface): + attr = Attribute('My attr') + + def method(): + "A method" + + class CheckMe: + __implemented__ = ICheckMe + attr = 'value' + + def method(self): + raise NotImplementedError() + + self.assertTrue(verifyClass(ICheckMe, CheckMe)) + + def test_verifyObject(self): + from zope.interface import Attribute + from zope.interface import Interface + from zope.interface.verify import verifyObject + + class ICheckMe(Interface): + attr = Attribute('My attr') + + def method(): + "A method" + + class CheckMe: + __implemented__ = ICheckMe + attr = 'value' + + def method(self): + raise NotImplementedError() + + check_me = CheckMe() + + self.assertTrue(verifyObject(ICheckMe, check_me)) + + def test_interface_object_provides_Interface(self): + from zope.interface import Interface + + class AnInterface(Interface): + pass + + self.assertTrue(Interface.providedBy(AnInterface)) + + def test_names_simple(self): + from zope.interface import Attribute + from zope.interface import Interface + + class ISimple(Interface): + attr = Attribute('My attr') + + def method(): + """docstring""" + + self.assertEqual(sorted(ISimple.names()), ['attr', 'method']) + + def test_names_derived(self): + from zope.interface import Attribute + from zope.interface import Interface + + class IBase(Interface): + attr = Attribute('My attr') + + def method(): + """docstring""" + + class IDerived(IBase): + attr2 = Attribute('My attr2') + + def method(): + """docstring""" + + def method2(): + """docstring""" + + self.assertEqual(sorted(IDerived.names()), + ['attr2', 'method', 'method2']) + self.assertEqual(sorted(IDerived.names(all=True)), + ['attr', 'attr2', 'method', 'method2']) + + def test_namesAndDescriptions_simple(self): + from zope.interface import Attribute + from zope.interface import Interface + from zope.interface.interface import Method + + class ISimple(Interface): + attr = Attribute('My attr') + + def method(): + "My method" + + name_values = sorted(ISimple.namesAndDescriptions()) + + self.assertEqual(len(name_values), 2) + self.assertEqual(name_values[0][0], 'attr') + self.assertIsInstance(name_values[0][1], Attribute) + self.assertEqual(name_values[0][1].__name__, 'attr') + self.assertEqual(name_values[0][1].__doc__, 'My attr') + self.assertEqual(name_values[1][0], 'method') + self.assertIsInstance(name_values[1][1], Method) + self.assertEqual(name_values[1][1].__name__, 'method') + self.assertEqual(name_values[1][1].__doc__, 'My method') + + def test_namesAndDescriptions_derived(self): + from zope.interface import Attribute + from zope.interface import Interface + from zope.interface.interface import Method + + class IBase(Interface): + attr = Attribute('My attr') + + def method(): + "My method" + + class IDerived(IBase): + attr2 = Attribute('My attr2') + + def method(): + "My method, overridden" + + def method2(): + "My method2" + + name_values = sorted(IDerived.namesAndDescriptions()) + + self.assertEqual(len(name_values), 3) + self.assertEqual(name_values[0][0], 'attr2') + self.assertIsInstance(name_values[0][1], Attribute) + self.assertEqual(name_values[0][1].__name__, 'attr2') + self.assertEqual(name_values[0][1].__doc__, 'My attr2') + self.assertEqual(name_values[1][0], 'method') + self.assertIsInstance(name_values[1][1], Method) + self.assertEqual(name_values[1][1].__name__, 'method') + self.assertEqual(name_values[1][1].__doc__, 'My method, overridden') + self.assertEqual(name_values[2][0], 'method2') + self.assertIsInstance(name_values[2][1], Method) + self.assertEqual(name_values[2][1].__name__, 'method2') + self.assertEqual(name_values[2][1].__doc__, 'My method2') + + name_values = sorted(IDerived.namesAndDescriptions(all=True)) + + self.assertEqual(len(name_values), 4) + self.assertEqual(name_values[0][0], 'attr') + self.assertIsInstance(name_values[0][1], Attribute) + self.assertEqual(name_values[0][1].__name__, 'attr') + self.assertEqual(name_values[0][1].__doc__, 'My attr') + self.assertEqual(name_values[1][0], 'attr2') + self.assertIsInstance(name_values[1][1], Attribute) + self.assertEqual(name_values[1][1].__name__, 'attr2') + self.assertEqual(name_values[1][1].__doc__, 'My attr2') + self.assertEqual(name_values[2][0], 'method') + self.assertIsInstance(name_values[2][1], Method) + self.assertEqual(name_values[2][1].__name__, 'method') + self.assertEqual(name_values[2][1].__doc__, 'My method, overridden') + self.assertEqual(name_values[3][0], 'method2') + self.assertIsInstance(name_values[3][1], Method) + self.assertEqual(name_values[3][1].__name__, 'method2') + self.assertEqual(name_values[3][1].__doc__, 'My method2') + + def test_getDescriptionFor_nonesuch_no_default(self): + from zope.interface import Interface + + class IEmpty(Interface): + pass + + self.assertRaises(KeyError, IEmpty.getDescriptionFor, 'nonesuch') + + def test_getDescriptionFor_simple(self): + from zope.interface import Attribute + from zope.interface import Interface + from zope.interface.interface import Method + + class ISimple(Interface): + attr = Attribute('My attr') + + def method(): + "My method" + + a_desc = ISimple.getDescriptionFor('attr') + self.assertIsInstance(a_desc, Attribute) + self.assertEqual(a_desc.__name__, 'attr') + self.assertEqual(a_desc.__doc__, 'My attr') + + m_desc = ISimple.getDescriptionFor('method') + self.assertIsInstance(m_desc, Method) + self.assertEqual(m_desc.__name__, 'method') + self.assertEqual(m_desc.__doc__, 'My method') + + def test_getDescriptionFor_derived(self): + from zope.interface import Attribute + from zope.interface import Interface + from zope.interface.interface import Method + + class IBase(Interface): + attr = Attribute('My attr') + + def method(): + "My method" + + class IDerived(IBase): + attr2 = Attribute('My attr2') + + def method(): + "My method, overridden" + + def method2(): + "My method2" + + a_desc = IDerived.getDescriptionFor('attr') + self.assertIsInstance(a_desc, Attribute) + self.assertEqual(a_desc.__name__, 'attr') + self.assertEqual(a_desc.__doc__, 'My attr') + + m_desc = IDerived.getDescriptionFor('method') + self.assertIsInstance(m_desc, Method) + self.assertEqual(m_desc.__name__, 'method') + self.assertEqual(m_desc.__doc__, 'My method, overridden') + + a2_desc = IDerived.getDescriptionFor('attr2') + self.assertIsInstance(a2_desc, Attribute) + self.assertEqual(a2_desc.__name__, 'attr2') + self.assertEqual(a2_desc.__doc__, 'My attr2') + + m2_desc = IDerived.getDescriptionFor('method2') + self.assertIsInstance(m2_desc, Method) + self.assertEqual(m2_desc.__name__, 'method2') + self.assertEqual(m2_desc.__doc__, 'My method2') + + def test___getitem__nonesuch(self): + from zope.interface import Interface + + class IEmpty(Interface): + pass + + self.assertRaises(KeyError, IEmpty.__getitem__, 'nonesuch') + + def test___getitem__simple(self): + from zope.interface import Attribute + from zope.interface import Interface + from zope.interface.interface import Method + + class ISimple(Interface): + attr = Attribute('My attr') + + def method(): + "My method" + + a_desc = ISimple['attr'] + self.assertIsInstance(a_desc, Attribute) + self.assertEqual(a_desc.__name__, 'attr') + self.assertEqual(a_desc.__doc__, 'My attr') + + m_desc = ISimple['method'] + self.assertIsInstance(m_desc, Method) + self.assertEqual(m_desc.__name__, 'method') + self.assertEqual(m_desc.__doc__, 'My method') + + def test___getitem___derived(self): + from zope.interface import Attribute + from zope.interface import Interface + from zope.interface.interface import Method + + class IBase(Interface): + attr = Attribute('My attr') + + def method(): + "My method" + + class IDerived(IBase): + attr2 = Attribute('My attr2') + + def method(): + "My method, overridden" + + def method2(): + "My method2" + + a_desc = IDerived['attr'] + self.assertIsInstance(a_desc, Attribute) + self.assertEqual(a_desc.__name__, 'attr') + self.assertEqual(a_desc.__doc__, 'My attr') + + m_desc = IDerived['method'] + self.assertIsInstance(m_desc, Method) + self.assertEqual(m_desc.__name__, 'method') + self.assertEqual(m_desc.__doc__, 'My method, overridden') + + a2_desc = IDerived['attr2'] + self.assertIsInstance(a2_desc, Attribute) + self.assertEqual(a2_desc.__name__, 'attr2') + self.assertEqual(a2_desc.__doc__, 'My attr2') + + m2_desc = IDerived['method2'] + self.assertIsInstance(m2_desc, Method) + self.assertEqual(m2_desc.__name__, 'method2') + self.assertEqual(m2_desc.__doc__, 'My method2') + + def test___contains__nonesuch(self): + from zope.interface import Interface + + class IEmpty(Interface): + pass + + self.assertNotIn('nonesuch', IEmpty) + + def test___contains__simple(self): + from zope.interface import Attribute + from zope.interface import Interface + + class ISimple(Interface): + attr = Attribute('My attr') + + def method(): + "My method" + + self.assertIn('attr', ISimple) + self.assertIn('method', ISimple) + + def test___contains__derived(self): + from zope.interface import Attribute + from zope.interface import Interface + + class IBase(Interface): + attr = Attribute('My attr') + + def method(): + "My method" + + class IDerived(IBase): + attr2 = Attribute('My attr2') + + def method(): + "My method, overridden" + + def method2(): + "My method2" + + self.assertIn('attr', IDerived) + self.assertIn('method', IDerived) + self.assertIn('attr2', IDerived) + self.assertIn('method2', IDerived) + + def test___iter__empty(self): + from zope.interface import Interface + + class IEmpty(Interface): + pass + + self.assertEqual(list(IEmpty), []) + + def test___iter__simple(self): + from zope.interface import Attribute + from zope.interface import Interface + + class ISimple(Interface): + attr = Attribute('My attr') + + def method(): + "My method" + + self.assertEqual(sorted(list(ISimple)), ['attr', 'method']) + + def test___iter__derived(self): + from zope.interface import Attribute + from zope.interface import Interface + + class IBase(Interface): + attr = Attribute('My attr') + + def method(): + "My method" + + class IDerived(IBase): + attr2 = Attribute('My attr2') + + def method(): + "My method, overridden" + + def method2(): + "My method2" + + self.assertEqual(sorted(list(IDerived)), + ['attr', 'attr2', 'method', 'method2']) + + def test_function_attributes_become_tagged_values(self): + from zope.interface import Interface + + class ITagMe(Interface): + def method(): + """docstring""" + method.optional = 1 + + method = ITagMe['method'] + self.assertEqual(method.getTaggedValue('optional'), 1) + + def test___doc___non_element(self): + from zope.interface import Interface + + class IHaveADocString(Interface): + "xxx" + + self.assertEqual(IHaveADocString.__doc__, "xxx") + self.assertEqual(list(IHaveADocString), []) + + def test___doc___as_element(self): + from zope.interface import Attribute + from zope.interface import Interface + + class IHaveADocString(Interface): + "xxx" + __doc__ = Attribute('the doc') + + self.assertEqual(IHaveADocString.__doc__, "") + self.assertEqual(list(IHaveADocString), ['__doc__']) + + def _errorsEqual(self, has_invariant, error_len, error_msgs, iface): + from zope.interface.exceptions import Invalid + self.assertRaises(Invalid, iface.validateInvariants, has_invariant) + e = [] + try: + iface.validateInvariants(has_invariant, e) + self.fail("validateInvariants should always raise") + except Invalid as error: + self.assertEqual(error.args[0], e) + + self.assertEqual(len(e), error_len) + msgs = [error.args[0] for error in e] + msgs.sort() + for msg in msgs: + self.assertEqual(msg, error_msgs.pop(0)) + + def test_invariant_simple(self): + from zope.interface import Attribute + from zope.interface import Interface + from zope.interface import directlyProvides + from zope.interface import invariant + + class IInvariant(Interface): + foo = Attribute('foo') + bar = Attribute('bar; must eval to Boolean True if foo does') + invariant(_ifFooThenBar) + + class HasInvariant: + pass + + # set up + has_invariant = HasInvariant() + directlyProvides(has_invariant, IInvariant) + + # the tests + self.assertEqual(IInvariant.getTaggedValue('invariants'), + [_ifFooThenBar]) + self.assertEqual(IInvariant.validateInvariants(has_invariant), None) + has_invariant.bar = 27 + self.assertEqual(IInvariant.validateInvariants(has_invariant), None) + has_invariant.foo = 42 + self.assertEqual(IInvariant.validateInvariants(has_invariant), None) + del has_invariant.bar + self._errorsEqual(has_invariant, 1, ['If Foo, then Bar!'], + IInvariant) + + def test_invariant_nested(self): + from zope.interface import Attribute + from zope.interface import Interface + from zope.interface import directlyProvides + from zope.interface import invariant + + class IInvariant(Interface): + foo = Attribute('foo') + bar = Attribute('bar; must eval to Boolean True if foo does') + invariant(_ifFooThenBar) + + class ISubInvariant(IInvariant): + invariant(_barGreaterThanFoo) + + class HasInvariant: + pass + + # nested interfaces with invariants: + self.assertEqual(ISubInvariant.getTaggedValue('invariants'), + [_barGreaterThanFoo]) + has_invariant = HasInvariant() + directlyProvides(has_invariant, ISubInvariant) + has_invariant.foo = 42 + # even though the interface has changed, we should still only have one + # error. + self._errorsEqual(has_invariant, 1, ['If Foo, then Bar!'], + ISubInvariant) + # however, if we set foo to 0 (Boolean False) and bar to a negative + # number then we'll get the new error + has_invariant.foo = 2 + has_invariant.bar = 1 + self._errorsEqual(has_invariant, 1, + ['Please, Boo MUST be greater than Foo!'], + ISubInvariant) + # and if we set foo to a positive number and boo to 0, we'll + # get both errors! + has_invariant.foo = 1 + has_invariant.bar = 0 + self._errorsEqual(has_invariant, 2, + ['If Foo, then Bar!', + 'Please, Boo MUST be greater than Foo!'], + ISubInvariant) + # for a happy ending, we'll make the invariants happy + has_invariant.foo = 1 + has_invariant.bar = 2 + self.assertEqual(IInvariant.validateInvariants(has_invariant), None) + + def test_invariant_mutandis(self): + from zope.interface import Attribute + from zope.interface import Interface + from zope.interface import directlyProvides + from zope.interface import invariant + + class IInvariant(Interface): + foo = Attribute('foo') + bar = Attribute('bar; must eval to Boolean True if foo does') + invariant(_ifFooThenBar) + + class HasInvariant: + pass + + # now we'll do two invariants on the same interface, + # just to make sure that a small + # multi-invariant interface is at least minimally tested. + has_invariant = HasInvariant() + directlyProvides(has_invariant, IInvariant) + has_invariant.foo = 42 + + # if you really need to mutate, then this would be the way to do it. + # Probably a bad idea, though. :-) + old_invariants = IInvariant.getTaggedValue('invariants') + invariants = old_invariants[:] + invariants.append(_barGreaterThanFoo) + IInvariant.setTaggedValue('invariants', invariants) + + # even though the interface has changed, we should still only have one + # error. + self._errorsEqual(has_invariant, 1, ['If Foo, then Bar!'], + IInvariant) + # however, if we set foo to 0 (Boolean False) and bar to a negative + # number then we'll get the new error + has_invariant.foo = 2 + has_invariant.bar = 1 + self._errorsEqual( + has_invariant, + 1, + ['Please, Boo MUST be greater than Foo!'], + IInvariant + ) + # and if we set foo to a positive number and boo to 0, we'll + # get both errors! + has_invariant.foo = 1 + has_invariant.bar = 0 + self._errorsEqual(has_invariant, 2, + ['If Foo, then Bar!', + 'Please, Boo MUST be greater than Foo!'], + IInvariant) + # for another happy ending, we'll make the invariants happy again + has_invariant.foo = 1 + has_invariant.bar = 2 + self.assertEqual(IInvariant.validateInvariants(has_invariant), None) + # clean up + IInvariant.setTaggedValue('invariants', old_invariants) + + def test___doc___element(self): + from zope.interface import Attribute + from zope.interface import Interface + + class IDocstring(Interface): + "xxx" + + self.assertEqual(IDocstring.__doc__, "xxx") + self.assertEqual(list(IDocstring), []) + + class IDocstringAndAttribute(Interface): + "xxx" + + __doc__ = Attribute('the doc') + + self.assertEqual(IDocstringAndAttribute.__doc__, "") + self.assertEqual(list(IDocstringAndAttribute), ['__doc__']) + + def test_invariant_as_decorator(self): + from zope.interface import Attribute + from zope.interface import Interface + from zope.interface import implementer + from zope.interface import invariant + from zope.interface.exceptions import Invalid + + class IRange(Interface): + min = Attribute("Lower bound") + max = Attribute("Upper bound") + + @invariant + def range_invariant(ob): + if ob.max < ob.min: + raise Invalid('max < min') + + @implementer(IRange) + class Range: + + def __init__(self, min, max): + self.min, self.max = min, max + + IRange.validateInvariants(Range(1, 2)) + IRange.validateInvariants(Range(1, 1)) + try: + IRange.validateInvariants(Range(2, 1)) + except Invalid as e: + self.assertEqual(str(e), 'max < min') + + def test_taggedValue(self): + from zope.interface import Attribute + from zope.interface import Interface + from zope.interface import taggedValue + + class ITagged(Interface): + foo = Attribute('foo') + bar = Attribute('bar; must eval to Boolean True if foo does') + taggedValue('qux', 'Spam') + + class IDerived(ITagged): + taggedValue('qux', 'Spam Spam') + taggedValue('foo', 'bar') + + class IDerived2(IDerived): + pass + + self.assertEqual(ITagged.getTaggedValue('qux'), 'Spam') + self.assertRaises(KeyError, ITagged.getTaggedValue, 'foo') + self.assertEqual(list(ITagged.getTaggedValueTags()), ['qux']) + + self.assertEqual(IDerived2.getTaggedValue('qux'), 'Spam Spam') + self.assertEqual(IDerived2.getTaggedValue('foo'), 'bar') + self.assertEqual(set(IDerived2.getTaggedValueTags()), {'qux', 'foo'}) + + def _make_taggedValue_tree(self, base): + from zope.interface import Attribute + from zope.interface import taggedValue + + class F(base): + taggedValue('tag', 'F') + tag = Attribute('F') + + class E(base): + taggedValue('tag', 'E') + tag = Attribute('E') + + class D(base): + taggedValue('tag', 'D') + tag = Attribute('D') + + class C(D, F): + taggedValue('tag', 'C') + tag = Attribute('C') + + class B(D, E): + pass + + class A(B, C): + pass + + return A + + def test_getTaggedValue_follows__iro__(self): + # And not just looks at __bases__. + # https://github.com/zopefoundation/zope.interface/issues/190 + from zope.interface import Interface + + # First, confirm that looking at a true class + # hierarchy follows the __mro__. + class_A = self._make_taggedValue_tree(object) + self.assertEqual(class_A.tag.__name__, 'C') + + # Now check that Interface does, both for attributes... + iface_A = self._make_taggedValue_tree(Interface) + self.assertEqual(iface_A['tag'].__name__, 'C') + # ... and for tagged values. + self.assertEqual(iface_A.getTaggedValue('tag'), 'C') + self.assertEqual(iface_A.queryTaggedValue('tag'), 'C') + # Of course setting something lower overrides it. + assert iface_A.__bases__[0].__name__ == 'B' + iface_A.__bases__[0].setTaggedValue('tag', 'B') + self.assertEqual(iface_A.getTaggedValue('tag'), 'B') + + def test_getDirectTaggedValue_ignores__iro__(self): + # https://github.com/zopefoundation/zope.interface/issues/190 + from zope.interface import Interface + + A = self._make_taggedValue_tree(Interface) + self.assertIsNone(A.queryDirectTaggedValue('tag')) + self.assertEqual([], list(A.getDirectTaggedValueTags())) + + with self.assertRaises(KeyError): + A.getDirectTaggedValue('tag') + + A.setTaggedValue('tag', 'A') + self.assertEqual(A.queryDirectTaggedValue('tag'), 'A') + self.assertEqual(A.getDirectTaggedValue('tag'), 'A') + self.assertEqual(['tag'], list(A.getDirectTaggedValueTags())) + + assert A.__bases__[1].__name__ == 'C' + C = A.__bases__[1] + self.assertEqual(C.queryDirectTaggedValue('tag'), 'C') + self.assertEqual(C.getDirectTaggedValue('tag'), 'C') + self.assertEqual(['tag'], list(C.getDirectTaggedValueTags())) + + def test_description_cache_management(self): + # See https://bugs.launchpad.net/zope.interface/+bug/185974 + # There was a bug where the cache used by Specification.get() was not + # cleared when the bases were changed. + from zope.interface import Attribute + from zope.interface import Interface + + class I1(Interface): + a = Attribute('a') + + class I2(I1): + pass + + class I3(I2): + pass + + self.assertIs(I3.get('a'), I1.get('a')) + + I2.__bases__ = (Interface,) + self.assertIsNone(I3.get('a')) + + def test___call___defers_to___conform___(self): + from zope.interface import Interface + from zope.interface import implementer + + class IFoo(Interface): + pass + + @implementer(IFoo) + class C: + def __conform__(self, proto): + return 0 + + self.assertEqual(IFoo(C()), 0) + + def test___call___object_implements(self): + from zope.interface import Interface + from zope.interface import implementer + + class IFoo(Interface): + pass + + @implementer(IFoo) + class C: + pass + + c = C() + self.assertIs(IFoo(c), c) + + def test___call___miss_wo_alternate(self): + from zope.interface import Interface + + class IFoo(Interface): + pass + + class C: + pass + + c = C() + self.assertRaises(TypeError, IFoo, c) + + def test___call___miss_w_alternate(self): + from zope.interface import Interface + + class IFoo(Interface): + pass + + class C: + pass + + c = C() + self.assertIs(IFoo(c, self), self) + + def test___call___w_adapter_hook(self): + from zope.interface import Interface + from zope.interface.interface import adapter_hooks + + def _miss(iface, obj): + pass + + def _hit(iface, obj): + return self + + class IFoo(Interface): + pass + + class C: + pass + + c = C() + + old_adapter_hooks = adapter_hooks[:] + adapter_hooks[:] = [_miss, _hit] + try: + self.assertIs(IFoo(c), self) + finally: + adapter_hooks[:] = old_adapter_hooks + + def test___call___w_overridden_adapt(self): + from zope.interface import Interface + from zope.interface import implementer + from zope.interface import interfacemethod + + class IFoo(Interface): + + @interfacemethod + def __adapt__(self, obj): + return 42 + + @implementer(IFoo) + class Obj: + pass + + self.assertEqual(42, IFoo(object())) + # __adapt__ can ignore the fact that the object provides + # the interface if it chooses. + self.assertEqual(42, IFoo(Obj())) + + def test___call___w_overridden_adapt_and_conform(self): + # Conform is first, taking precedence over __adapt__, + # *if* it returns non-None + from zope.interface import Interface + from zope.interface import implementer + from zope.interface import interfacemethod + + class IAdapt(Interface): + @interfacemethod + def __adapt__(self, obj): + return 42 + + class ISimple(Interface): + """Nothing special.""" + + @implementer(IAdapt) + class Conform24: + def __conform__(self, iface): + return 24 + + @implementer(IAdapt) + class ConformNone: + def __conform__(self, iface): + return None + + self.assertEqual(42, IAdapt(object())) + + self.assertEqual(24, ISimple(Conform24())) + self.assertEqual(24, IAdapt(Conform24())) + + with self.assertRaises(TypeError): + ISimple(ConformNone()) + + self.assertEqual(42, IAdapt(ConformNone())) + + def test___call___w_overridden_adapt_call_super(self): + import sys + + from zope.interface import Interface + from zope.interface import implementer + from zope.interface import interfacemethod + + class IFoo(Interface): + + @interfacemethod + def __adapt__(self, obj): + if not self.providedBy(obj): + return 42 + return super().__adapt__(obj) + + @implementer(IFoo) + class Obj: + pass + + self.assertEqual(42, IFoo(object())) + obj = Obj() + self.assertIs(obj, IFoo(obj)) + + def test___adapt___as_method_and_implementation(self): + from zope.interface import Interface + from zope.interface import interfacemethod + + class IFoo(Interface): + @interfacemethod + def __adapt__(self, obj): + return 42 + + def __adapt__(to_adapt): # noqa F811 + "This is a protocol" + + self.assertEqual(42, IFoo(object())) + self.assertEqual(IFoo['__adapt__'].getSignatureString(), '(to_adapt)') + + def test___adapt__inheritance_and_type(self): + from zope.interface import Interface + from zope.interface import interfacemethod + + class IRoot(Interface): + """Root""" + + class IWithAdapt(IRoot): + @interfacemethod + def __adapt__(self, obj): + return 42 + + class IOther(IRoot): + """Second branch""" + + class IUnrelated(Interface): + """Unrelated""" + + class IDerivedAdapt(IUnrelated, IWithAdapt, IOther): + """Inherits an adapt""" + # Order of "inheritance" matters here. + + class IDerived2Adapt(IDerivedAdapt): + """Overrides an inherited custom adapt.""" + @interfacemethod + def __adapt__(self, obj): + return 24 + + self.assertEqual(42, IDerivedAdapt(object())) + for iface in IRoot, IWithAdapt, IOther, IUnrelated, IDerivedAdapt: + self.assertEqual(__name__, iface.__module__) + + for iface in IRoot, IOther, IUnrelated: + self.assertEqual(type(IRoot), type(Interface)) + + # But things that implemented __adapt__ got a new type + self.assertNotEqual(type(Interface), type(IWithAdapt)) + self.assertEqual(type(IWithAdapt), type(IDerivedAdapt)) + self.assertIsInstance(IWithAdapt, type(Interface)) + + self.assertEqual(24, IDerived2Adapt(object())) + self.assertNotEqual(type(IDerived2Adapt), type(IDerivedAdapt)) + self.assertIsInstance(IDerived2Adapt, type(IDerivedAdapt)) + + def test_interfacemethod_is_general(self): + from zope.interface import Interface + from zope.interface import interfacemethod + + class IFoo(Interface): + + @interfacemethod + def __call__(self, obj): + """Replace an existing method""" + return 42 + + @interfacemethod + def this_is_new(self): + return 42 + + self.assertEqual(IFoo(self), 42) + self.assertEqual(IFoo.this_is_new(), 42) + + +class AttributeTests(ElementTests): + + DEFAULT_NAME = 'TestAttribute' + + def _getTargetClass(self): + from zope.interface.interface import Attribute + return Attribute + + def test__repr__w_interface(self): + method = self._makeOne() + method.interface = type(self) + r = repr(method) + self.assertTrue( + r.startswith(''), r + ) + + def test__repr__wo_interface(self): + method = self._makeOne() + r = repr(method) + self.assertTrue( + r.startswith(''), r) + + def test__str__w_interface(self): + method = self._makeOne() + method.interface = type(self) + r = str(method) + self.assertEqual(r, __name__ + '.AttributeTests.TestAttribute') + + def test__str__wo_interface(self): + method = self._makeOne() + r = str(method) + self.assertEqual(r, 'TestAttribute') + + +class MethodTests(AttributeTests): + + DEFAULT_NAME = 'TestMethod' + + def _getTargetClass(self): + from zope.interface.interface import Method + return Method + + def test_optional_as_property(self): + method = self._makeOne() + self.assertEqual(method.optional, {}) + method.optional = {'foo': 'bar'} + self.assertEqual(method.optional, {'foo': 'bar'}) + del method.optional + self.assertEqual(method.optional, {}) + + def test___call___raises_BrokenImplementation(self): + from zope.interface.exceptions import BrokenImplementation + method = self._makeOne() + try: + method() + except BrokenImplementation as e: + self.assertEqual(e.interface, None) + self.assertEqual(e.name, self.DEFAULT_NAME) + else: + self.fail('__call__ should raise BrokenImplementation') + + def test_getSignatureInfo_bare(self): + method = self._makeOne() + info = method.getSignatureInfo() + self.assertEqual(list(info['positional']), []) + self.assertEqual(list(info['required']), []) + self.assertEqual(info['optional'], {}) + self.assertEqual(info['varargs'], None) + self.assertEqual(info['kwargs'], None) + + def test_getSignatureString_bare(self): + method = self._makeOne() + self.assertEqual(method.getSignatureString(), '()') + + def test_getSignatureString_w_only_required(self): + method = self._makeOne() + method.positional = method.required = ['foo'] + self.assertEqual(method.getSignatureString(), '(foo)') + + def test_getSignatureString_w_optional(self): + method = self._makeOne() + method.positional = method.required = ['foo'] + method.optional = {'foo': 'bar'} + self.assertEqual(method.getSignatureString(), "(foo='bar')") + + def test_getSignatureString_w_varargs(self): + method = self._makeOne() + method.varargs = 'args' + self.assertEqual(method.getSignatureString(), "(*args)") + + def test_getSignatureString_w_kwargs(self): + method = self._makeOne() + method.kwargs = 'kw' + self.assertEqual(method.getSignatureString(), "(**kw)") + + def test__repr__w_interface(self): + method = self._makeOne() + method.kwargs = 'kw' + method.interface = type(self) + r = repr(method) + self.assertTrue( + r.startswith(''), r + ) + + def test__repr__wo_interface(self): + method = self._makeOne() + method.kwargs = 'kw' + r = repr(method) + self.assertTrue( + r.startswith(''), r) + + def test__str__w_interface(self): + method = self._makeOne() + method.kwargs = 'kw' + method.interface = type(self) + r = str(method) + self.assertEqual(r, __name__ + '.MethodTests.TestMethod(**kw)') + + def test__str__wo_interface(self): + method = self._makeOne() + method.kwargs = 'kw' + r = str(method) + self.assertEqual(r, 'TestMethod(**kw)') + + +class Test_fromFunction(unittest.TestCase): + + def _callFUT(self, *args, **kw): + from zope.interface.interface import fromFunction + return fromFunction(*args, **kw) + + def test_bare(self): + + def _func(): + "DOCSTRING" + + method = self._callFUT(_func) + self.assertEqual(method.getName(), '_func') + self.assertEqual(method.getDoc(), 'DOCSTRING') + self.assertEqual(method.interface, None) + self.assertEqual(list(method.getTaggedValueTags()), []) + info = method.getSignatureInfo() + self.assertEqual(list(info['positional']), []) + self.assertEqual(list(info['required']), []) + self.assertEqual(info['optional'], {}) + self.assertEqual(info['varargs'], None) + self.assertEqual(info['kwargs'], None) + + def test_w_interface(self): + from zope.interface.interface import InterfaceClass + + class IFoo(InterfaceClass): + pass + + def _func(): + "DOCSTRING" + + method = self._callFUT(_func, interface=IFoo) + self.assertEqual(method.interface, IFoo) + + def test_w_name(self): + + def _func(): + "DOCSTRING" + + method = self._callFUT(_func, name='anotherName') + self.assertEqual(method.getName(), 'anotherName') + + def test_w_only_required(self): + + def _func(foo): + "DOCSTRING" + + method = self._callFUT(_func) + info = method.getSignatureInfo() + self.assertEqual(list(info['positional']), ['foo']) + self.assertEqual(list(info['required']), ['foo']) + self.assertEqual(info['optional'], {}) + self.assertEqual(info['varargs'], None) + self.assertEqual(info['kwargs'], None) + + def test_w_optional(self): + + def _func(foo='bar'): + "DOCSTRING" + + method = self._callFUT(_func) + info = method.getSignatureInfo() + self.assertEqual(list(info['positional']), ['foo']) + self.assertEqual(list(info['required']), []) + self.assertEqual(info['optional'], {'foo': 'bar'}) + self.assertEqual(info['varargs'], None) + self.assertEqual(info['kwargs'], None) + + def test_w_optional_self(self): + # This is a weird case, trying to cover the following code in + # FUT:: + # + # nr = na-len(defaults) + # if nr < 0: + # defaults=defaults[-nr:] + # nr = 0 + + def _func(self='bar'): + "DOCSTRING" + + method = self._callFUT(_func, imlevel=1) + info = method.getSignatureInfo() + self.assertEqual(list(info['positional']), []) + self.assertEqual(list(info['required']), []) + self.assertEqual(info['optional'], {}) + self.assertEqual(info['varargs'], None) + self.assertEqual(info['kwargs'], None) + + def test_w_varargs(self): + + def _func(*args): + "DOCSTRING" + + method = self._callFUT(_func) + info = method.getSignatureInfo() + self.assertEqual(list(info['positional']), []) + self.assertEqual(list(info['required']), []) + self.assertEqual(info['optional'], {}) + self.assertEqual(info['varargs'], 'args') + self.assertEqual(info['kwargs'], None) + + def test_w_kwargs(self): + + def _func(**kw): + "DOCSTRING" + + method = self._callFUT(_func) + info = method.getSignatureInfo() + self.assertEqual(list(info['positional']), []) + self.assertEqual(list(info['required']), []) + self.assertEqual(info['optional'], {}) + self.assertEqual(info['varargs'], None) + self.assertEqual(info['kwargs'], 'kw') + + def test_full_spectrum(self): + + def _func( + foo, bar='baz', *args, **kw + ): # pylint:disable=keyword-arg-before-vararg + "DOCSTRING" + + method = self._callFUT(_func) + info = method.getSignatureInfo() + self.assertEqual(list(info['positional']), ['foo', 'bar']) + self.assertEqual(list(info['required']), ['foo']) + self.assertEqual(info['optional'], {'bar': 'baz'}) + self.assertEqual(info['varargs'], 'args') + self.assertEqual(info['kwargs'], 'kw') + + +class Test_fromMethod(unittest.TestCase): + + def _callFUT(self, *args, **kw): + from zope.interface.interface import fromMethod + return fromMethod(*args, **kw) + + def test_no_args(self): + + class Foo: + def bar(self): + "DOCSTRING" + + method = self._callFUT(Foo.bar) + self.assertEqual(method.getName(), 'bar') + self.assertEqual(method.getDoc(), 'DOCSTRING') + self.assertEqual(method.interface, None) + self.assertEqual(list(method.getTaggedValueTags()), []) + info = method.getSignatureInfo() + self.assertEqual(list(info['positional']), []) + self.assertEqual(list(info['required']), []) + self.assertEqual(info['optional'], {}) + self.assertEqual(info['varargs'], None) + self.assertEqual(info['kwargs'], None) + + def test_full_spectrum(self): + + class Foo: + def bar( + self, foo, bar='baz', *args, **kw + ): # pylint:disable=keyword-arg-before-vararg + "DOCSTRING" + + method = self._callFUT(Foo.bar) + info = method.getSignatureInfo() + self.assertEqual(list(info['positional']), ['foo', 'bar']) + self.assertEqual(list(info['required']), ['foo']) + self.assertEqual(info['optional'], {'bar': 'baz'}) + self.assertEqual(info['varargs'], 'args') + self.assertEqual(info['kwargs'], 'kw') + + def test_w_non_method(self): + + def foo(): + "DOCSTRING" + + method = self._callFUT(foo) + self.assertEqual(method.getName(), 'foo') + self.assertEqual(method.getDoc(), 'DOCSTRING') + self.assertEqual(method.interface, None) + self.assertEqual(list(method.getTaggedValueTags()), []) + info = method.getSignatureInfo() + self.assertEqual(list(info['positional']), []) + self.assertEqual(list(info['required']), []) + self.assertEqual(info['optional'], {}) + self.assertEqual(info['varargs'], None) + self.assertEqual(info['kwargs'], None) + + +class DummyDependent: + + def __init__(self): + self._changed = [] + + def changed(self, originally_changed): + self._changed.append(originally_changed) + + +def _barGreaterThanFoo(obj): + from zope.interface.exceptions import Invalid + foo = getattr(obj, 'foo', None) + bar = getattr(obj, 'bar', None) + if foo is not None and isinstance(foo, type(bar)): + # type checking should be handled elsewhere (like, say, + # schema); these invariants should be intra-interface + # constraints. This is a hacky way to do it, maybe, but you + # get the idea + if not bar > foo: + raise Invalid('Please, Boo MUST be greater than Foo!') + + +def _ifFooThenBar(obj): + from zope.interface.exceptions import Invalid + if getattr(obj, 'foo', None) and not getattr(obj, 'bar', None): + raise Invalid('If Foo, then Bar!') + + +class _Monkey: + # context-manager for replacing module names in the scope of a test. + def __init__(self, module, **kw): + self.module = module + self.to_restore = {key: getattr(module, key) for key in kw} + for key, value in kw.items(): + setattr(module, key, value) + + def __enter__(self): + return self + + def __exit__(self, exc_type, exc_val, exc_tb): + for key, value in self.to_restore.items(): + setattr(self.module, key, value) + + +class TestTypeAnnotations(unittest.TestCase): + """Test using Interfaces in type annotations.""" + + def test___or__(self): + from typing import Optional + from typing import Union + + from zope.interface import Interface + + class I1(Interface): + pass + + class I2(Interface): + pass + + class B: + a: I1 | None + b: I1 | I2 + + self.assertEqual( + B.__annotations__, {'a': Optional[I1], 'b': Union[I1, I2]}) + + def test___ror__(self): + from typing import Optional + from typing import Union + + from zope.interface import Interface + + class I1(Interface): + pass + + class A: + pass + + class B: + a: None | I1 + b: A | I1 + + self.assertEqual( + B.__annotations__, {'a': Optional[I1], 'b': Union[A, I1]}) diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope/interface/tests/test_interfaces.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope/interface/tests/test_interfaces.py new file mode 100644 index 0000000000000000000000000000000000000000..a1006493afaf00cb246af9bd1fd8b7184cbb006c --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope/interface/tests/test_interfaces.py @@ -0,0 +1,130 @@ +import unittest + + +class _ConformsToIObjectEvent: + + def _makeOne(self, target=None): + if target is None: + target = object() + return self._getTargetClass()(target) + + def test_class_conforms_to_IObjectEvent(self): + from zope.interface.interfaces import IObjectEvent + from zope.interface.verify import verifyClass + verifyClass(IObjectEvent, self._getTargetClass()) + + def test_instance_conforms_to_IObjectEvent(self): + from zope.interface.interfaces import IObjectEvent + from zope.interface.verify import verifyObject + verifyObject(IObjectEvent, self._makeOne()) + + +class _ConformsToIRegistrationEvent(_ConformsToIObjectEvent): + + def test_class_conforms_to_IRegistrationEvent(self): + from zope.interface.interfaces import IRegistrationEvent + from zope.interface.verify import verifyClass + verifyClass(IRegistrationEvent, self._getTargetClass()) + + def test_instance_conforms_to_IRegistrationEvent(self): + from zope.interface.interfaces import IRegistrationEvent + from zope.interface.verify import verifyObject + verifyObject(IRegistrationEvent, self._makeOne()) + + +class ObjectEventTests(unittest.TestCase, _ConformsToIObjectEvent): + + def _getTargetClass(self): + from zope.interface.interfaces import ObjectEvent + return ObjectEvent + + def test_ctor(self): + target = object() + event = self._makeOne(target) + self.assertIs(event.object, target) + + +class RegistrationEventTests(unittest.TestCase, + _ConformsToIRegistrationEvent): + + def _getTargetClass(self): + from zope.interface.interfaces import RegistrationEvent + return RegistrationEvent + + def test___repr__(self): + target = object() + event = self._makeOne(target) + r = repr(event) + self.assertEqual(r.splitlines(), + ['RegistrationEvent event:', repr(target)]) + + +class RegisteredTests(unittest.TestCase, + _ConformsToIRegistrationEvent): + + def _getTargetClass(self): + from zope.interface.interfaces import Registered + return Registered + + def test_class_conforms_to_IRegistered(self): + from zope.interface.interfaces import IRegistered + from zope.interface.verify import verifyClass + verifyClass(IRegistered, self._getTargetClass()) + + def test_instance_conforms_to_IRegistered(self): + from zope.interface.interfaces import IRegistered + from zope.interface.verify import verifyObject + verifyObject(IRegistered, self._makeOne()) + + +class UnregisteredTests(unittest.TestCase, + _ConformsToIRegistrationEvent): + + def _getTargetClass(self): + from zope.interface.interfaces import Unregistered + return Unregistered + + def test_class_conforms_to_IUnregistered(self): + from zope.interface.interfaces import IUnregistered + from zope.interface.verify import verifyClass + verifyClass(IUnregistered, self._getTargetClass()) + + def test_instance_conforms_to_IUnregistered(self): + from zope.interface.interfaces import IUnregistered + from zope.interface.verify import verifyObject + verifyObject(IUnregistered, self._makeOne()) + + +class InterfaceClassTests(unittest.TestCase): + + def _getTargetClass(self): + from zope.interface.interface import InterfaceClass + return InterfaceClass + + def _getTargetInterface(self): + from zope.interface.interfaces import IInterface + return IInterface + + def _makeOne(self): + from zope.interface.interface import Interface + return Interface + + def test_class_conforms(self): + from zope.interface.verify import verifyClass + verifyClass(self._getTargetInterface(), self._getTargetClass()) + + def test_instance_conforms(self): + from zope.interface.verify import verifyObject + verifyObject(self._getTargetInterface(), self._makeOne()) + + def test_instance_consistent__iro__(self): + from zope.interface import ro + self.assertTrue(ro.is_consistent(self._getTargetInterface())) + + def test_class_consistent__iro__(self): + from zope.interface import implementedBy + from zope.interface import ro + + self.assertTrue( + ro.is_consistent(implementedBy(self._getTargetClass())) + ) diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope/interface/tests/test_odd_declarations.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope/interface/tests/test_odd_declarations.py new file mode 100644 index 0000000000000000000000000000000000000000..09a8de8522b559c5bf30958f0fb9bae135394b51 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope/interface/tests/test_odd_declarations.py @@ -0,0 +1,301 @@ +############################################################################## +# +# Copyright (c) 2003 Zope Foundation and Contributors. +# All Rights Reserved. +# +# This software is subject to the provisions of the Zope Public License, +# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. +# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED +# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS +# FOR A PARTICULAR PURPOSE. +# +############################################################################## +"""Test interface declarations against ExtensionClass-like classes. + +These tests are to make sure we do something sane in the presence of +classic ExtensionClass classes and instances. +""" +import unittest + +from zope.interface import Interface +from zope.interface import classImplements +from zope.interface import classImplementsOnly +from zope.interface import directlyProvidedBy +from zope.interface import directlyProvides +from zope.interface import implementedBy +from zope.interface import implementer +from zope.interface import providedBy +from zope.interface.tests import odd + + +class I1(Interface): + pass + + +class I2(Interface): + pass + + +class I3(Interface): + pass + + +class I31(I3): + pass + + +class I4(Interface): + pass + + +class I5(Interface): + pass + + +class Odd: + pass + + +Odd = odd.MetaClass('Odd', Odd.__bases__, {}) + + +class B(Odd): + __implemented__ = I2 + + +# TODO: We are going to need more magic to make classProvides work with odd +# classes. This will work in the next iteration. For now, we'll use +# a different mechanism. + +# from zope.interface import classProvides +class A(Odd): + pass + + +classImplements(A, I1) + + +class C(A, B): + pass + + +classImplements(C, I31) + + +class Test(unittest.TestCase): + + def test_ObjectSpecification(self): + c = C() + directlyProvides(c, I4) + self.assertEqual([i.getName() for i in providedBy(c)], + ['I4', 'I31', 'I1', 'I2'] + ) + self.assertEqual([i.getName() for i in providedBy(c).flattened()], + ['I4', 'I31', 'I3', 'I1', 'I2', 'Interface'] + ) + self.assertIn(I1, providedBy(c)) + self.assertNotIn(I3, providedBy(c)) + self.assertTrue(providedBy(c).extends(I3)) + self.assertTrue(providedBy(c).extends(I31)) + self.assertFalse(providedBy(c).extends(I5)) + + class COnly(A, B): + pass + classImplementsOnly(COnly, I31) + + class D(COnly): + pass + classImplements(D, I5) + + classImplements(D, I5) + + c = D() + directlyProvides(c, I4) + self.assertEqual([i.getName() for i in providedBy(c)], + ['I4', 'I5', 'I31']) + self.assertEqual([i.getName() for i in providedBy(c).flattened()], + ['I4', 'I5', 'I31', 'I3', 'Interface']) + self.assertNotIn(I1, providedBy(c)) + self.assertNotIn(I3, providedBy(c)) + self.assertTrue(providedBy(c).extends(I3)) + self.assertFalse(providedBy(c).extends(I1)) + self.assertTrue(providedBy(c).extends(I31)) + self.assertTrue(providedBy(c).extends(I5)) + + class COnly(A, B): + __implemented__ = I31 + + class D(COnly): + pass + + classImplements(D, I5) + classImplements(D, I5) + + c = D() + directlyProvides(c, I4) + self.assertEqual([i.getName() for i in providedBy(c)], + ['I4', 'I5', 'I31']) + self.assertEqual([i.getName() for i in providedBy(c).flattened()], + ['I4', 'I5', 'I31', 'I3', 'Interface']) + self.assertNotIn(I1, providedBy(c)) + self.assertNotIn(I3, providedBy(c)) + self.assertTrue(providedBy(c).extends(I3)) + self.assertFalse(providedBy(c).extends(I1)) + self.assertTrue(providedBy(c).extends(I31)) + self.assertTrue(providedBy(c).extends(I5)) + + def test_classImplements(self): + + @implementer(I3) + class A(Odd): + pass + + @implementer(I4) + class B(Odd): + pass + + class C(A, B): + pass + + classImplements(C, I1, I2) + self.assertEqual([i.getName() for i in implementedBy(C)], + ['I1', 'I2', 'I3', 'I4']) + + classImplements(C, I5) + self.assertEqual([i.getName() for i in implementedBy(C)], + ['I1', 'I2', 'I5', 'I3', 'I4']) + + def test_classImplementsOnly(self): + + @implementer(I3) + class A(Odd): + pass + + @implementer(I4) + class B(Odd): + pass + + class C(A, B): + pass + + classImplementsOnly(C, I1, I2) + self.assertEqual([i.__name__ for i in implementedBy(C)], + ['I1', 'I2']) + + def test_directlyProvides(self): + + class IA1(Interface): + pass + + class IA2(Interface): + pass + + class IB(Interface): + pass + + class IC(Interface): + pass + + class A(Odd): + pass + classImplements(A, IA1, IA2) + + class B(Odd): + pass + classImplements(B, IB) + + class C(A, B): + pass + classImplements(C, IC) + + ob = C() + directlyProvides(ob, I1, I2) + self.assertIn(I1, providedBy(ob)) + self.assertIn(I2, providedBy(ob)) + self.assertIn(IA1, providedBy(ob)) + self.assertIn(IA2, providedBy(ob)) + self.assertIn(IB, providedBy(ob)) + self.assertIn(IC, providedBy(ob)) + + directlyProvides(ob, directlyProvidedBy(ob) - I2) + self.assertIn(I1, providedBy(ob)) + self.assertNotIn(I2, providedBy(ob)) + self.assertNotIn(I2, providedBy(ob)) + directlyProvides(ob, directlyProvidedBy(ob), I2) + self.assertIn(I2, providedBy(ob)) + + # see above + # def TODO_test_classProvides_fails_for_odd_class(self): + # try: + # class A(Odd): + # classProvides(I1) + # except TypeError: + # pass # Success + # self.assert_( + # False, + # "Shouldn't be able to use directlyProvides on odd class." + # ) + + def test_implementedBy(self): + + class I2(I1): + pass + + class C1(Odd): + pass + + classImplements(C1, I2) + + class C2(C1): + pass + + classImplements(C2, I3) + + self.assertEqual([i.getName() for i in implementedBy(C2)], + ['I3', 'I2']) + + def test_odd_metaclass_that_doesnt_subclass_type(self): + # This was originally a doctest in odd.py. + # It verifies that the metaclass the rest of these tests use + # works as expected. + + # This is used for testing support for ExtensionClass in new + # interfaces. + + class A: + a = 1 + + A = odd.MetaClass('A', A.__bases__, A.__dict__) + + class B: + b = 1 + + B = odd.MetaClass('B', B.__bases__, B.__dict__) + + class C(A, B): + pass + + self.assertEqual(C.__bases__, (A, B)) + + a = A() + aa = A() + self.assertEqual(a.a, 1) + self.assertEqual(aa.a, 1) + + aa.a = 2 + self.assertEqual(a.a, 1) + self.assertEqual(aa.a, 2) + + c = C() + self.assertEqual(c.a, 1) + self.assertEqual(c.b, 1) + + c.b = 2 + self.assertEqual(c.b, 2) + + C.c = 1 + self.assertEqual(c.c, 1) + c.c + + self.assertIs(C.__class__.__class__, C.__class__) diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope/interface/tests/test_registry.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope/interface/tests/test_registry.py new file mode 100644 index 0000000000000000000000000000000000000000..0da200ebedbb96c95d9f9fa3b22e58fff1c8d051 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope/interface/tests/test_registry.py @@ -0,0 +1,3391 @@ +############################################################################## +# +# Copyright (c) 2001, 2002, 2009 Zope Foundation and Contributors. +# All Rights Reserved. +# +# This software is subject to the provisions of the Zope Public License, +# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. +# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED +# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS +# FOR A PARTICULAR PURPOSE. +# +############################################################################## +"""Component Registry Tests""" +# pylint:disable=protected-access +import unittest + +from zope.interface import Interface +from zope.interface.adapter import VerifyingAdapterRegistry +from zope.interface.registry import Components + + +class ComponentsTests(unittest.TestCase): + + def _getTargetClass(self): + return Components + + def _makeOne(self, name='test', *args, **kw): + return self._getTargetClass()(name, *args, **kw) + + def _wrapEvents(self): + from zope.interface import registry + _events = [] + + def _notify(*args, **kw): + _events.append((args, kw)) + + _monkey = _Monkey(registry, notify=_notify) + return _monkey, _events + + def test_ctor_no_bases(self): + from zope.interface.adapter import AdapterRegistry + comp = self._makeOne('testing') + self.assertEqual(comp.__name__, 'testing') + self.assertEqual(comp.__bases__, ()) + self.assertIsInstance(comp.adapters, AdapterRegistry) + self.assertIsInstance(comp.utilities, AdapterRegistry) + self.assertEqual(comp.adapters.__bases__, ()) + self.assertEqual(comp.utilities.__bases__, ()) + self.assertEqual(comp._utility_registrations, {}) + self.assertEqual(comp._adapter_registrations, {}) + self.assertEqual(comp._subscription_registrations, []) + self.assertEqual(comp._handler_registrations, []) + + def test_ctor_w_base(self): + base = self._makeOne('base') + comp = self._makeOne('testing', (base,)) + self.assertEqual(comp.__name__, 'testing') + self.assertEqual(comp.__bases__, (base,)) + self.assertEqual(comp.adapters.__bases__, (base.adapters,)) + self.assertEqual(comp.utilities.__bases__, (base.utilities,)) + + def test___repr__(self): + comp = self._makeOne('testing') + self.assertEqual(repr(comp), '') + + # test _init_registries / _init_registrations via only caller, __init__. + + def test_assign_to___bases__(self): + base1 = self._makeOne('base1') + base2 = self._makeOne('base2') + comp = self._makeOne() + comp.__bases__ = (base1, base2) + self.assertEqual(comp.__bases__, (base1, base2)) + self.assertEqual(comp.adapters.__bases__, + (base1.adapters, base2.adapters)) + self.assertEqual(comp.utilities.__bases__, + (base1.utilities, base2.utilities)) + + def test_registerUtility_with_component_name(self): + from zope.interface.declarations import InterfaceClass + from zope.interface.declarations import named + + class IFoo(InterfaceClass): + pass + + ifoo = IFoo('IFoo') + + @named('foo') + class Foo: + pass + + foo = Foo() + _info = 'info' + + comp = self._makeOne() + comp.registerUtility(foo, ifoo, info=_info) + self.assertEqual( + comp._utility_registrations[ifoo, 'foo'], + (foo, _info, None)) + + def test_registerUtility_both_factory_and_component(self): + def _factory(): + raise NotImplementedError() + _to_reg = object() + comp = self._makeOne() + self.assertRaises(TypeError, comp.registerUtility, + component=_to_reg, factory=_factory) + + def test_registerUtility_w_component(self): + from zope.interface.declarations import InterfaceClass + from zope.interface.interfaces import Registered + from zope.interface.registry import UtilityRegistration + + class IFoo(InterfaceClass): + pass + + ifoo = IFoo('IFoo') + _info = 'info' + _name = 'name' + _to_reg = object() + comp = self._makeOne() + _monkey, _events = self._wrapEvents() + with _monkey: + comp.registerUtility(_to_reg, ifoo, _name, _info) + self.assertIs(comp.utilities._adapters[0][ifoo][_name], _to_reg) + self.assertEqual(comp._utility_registrations[ifoo, _name], + (_to_reg, _info, None)) + self.assertEqual(comp.utilities._subscribers[0][ifoo][''], (_to_reg,)) + self.assertEqual(len(_events), 1) + args, kw = _events[0] + event, = args + self.assertEqual(kw, {}) + self.assertIsInstance(event, Registered) + self.assertIsInstance(event.object, UtilityRegistration) + self.assertIs(event.object.registry, comp) + self.assertIs(event.object.provided, ifoo) + self.assertIs(event.object.name, _name) + self.assertIs(event.object.component, _to_reg) + self.assertIs(event.object.info, _info) + self.assertIsNone(event.object.factory) + + def test_registerUtility_w_factory(self): + from zope.interface.declarations import InterfaceClass + from zope.interface.interfaces import Registered + from zope.interface.registry import UtilityRegistration + + class IFoo(InterfaceClass): + pass + + ifoo = IFoo('IFoo') + _info = 'info' + _name = 'name' + _to_reg = object() + + def _factory(): + return _to_reg + + comp = self._makeOne() + _monkey, _events = self._wrapEvents() + with _monkey: + comp.registerUtility(None, ifoo, _name, _info, factory=_factory) + self.assertEqual(len(_events), 1) + args, kw = _events[0] + event, = args + self.assertEqual(kw, {}) + self.assertIsInstance(event, Registered) + self.assertIsInstance(event.object, UtilityRegistration) + self.assertIs(event.object.registry, comp) + self.assertIs(event.object.provided, ifoo) + self.assertIs(event.object.name, _name) + self.assertIs(event.object.component, _to_reg) + self.assertIs(event.object.info, _info) + self.assertIs(event.object.factory, _factory) + + def test_registerUtility_no_provided_available(self): + + class Foo: + pass + + _info = 'info' + _name = 'name' + _to_reg = Foo() + comp = self._makeOne() + self.assertRaises(TypeError, + comp.registerUtility, _to_reg, None, _name, _info) + + def test_registerUtility_wo_provided(self): + from zope.interface.declarations import InterfaceClass + from zope.interface.declarations import directlyProvides + from zope.interface.interfaces import Registered + from zope.interface.registry import UtilityRegistration + + class IFoo(InterfaceClass): + pass + + class Foo: + pass + + ifoo = IFoo('IFoo') + _info = 'info' + _name = 'name' + _to_reg = Foo() + directlyProvides(_to_reg, ifoo) + comp = self._makeOne() + _monkey, _events = self._wrapEvents() + with _monkey: + comp.registerUtility(_to_reg, None, _name, _info) + self.assertEqual(len(_events), 1) + args, kw = _events[0] + event, = args + self.assertEqual(kw, {}) + self.assertIsInstance(event, Registered) + self.assertIsInstance(event.object, UtilityRegistration) + self.assertIs(event.object.registry, comp) + self.assertIs(event.object.provided, ifoo) + self.assertIs(event.object.name, _name) + self.assertIs(event.object.component, _to_reg) + self.assertIs(event.object.info, _info) + self.assertIsNone(event.object.factory) + + def test_registerUtility_duplicates_existing_reg(self): + from zope.interface.declarations import InterfaceClass + + class IFoo(InterfaceClass): + pass + + ifoo = IFoo('IFoo') + _info = 'info' + _name = 'name' + _to_reg = object() + comp = self._makeOne() + comp.registerUtility(_to_reg, ifoo, _name, _info) + _monkey, _events = self._wrapEvents() + with _monkey: + comp.registerUtility(_to_reg, ifoo, _name, _info) + self.assertEqual(len(_events), 0) + + def test_registerUtility_w_different_info(self): + from zope.interface.declarations import InterfaceClass + + class IFoo(InterfaceClass): + pass + + ifoo = IFoo('IFoo') + _info1 = 'info1' + _info2 = 'info2' + _name = 'name' + _to_reg = object() + comp = self._makeOne() + comp.registerUtility(_to_reg, ifoo, _name, _info1) + _monkey, _events = self._wrapEvents() + with _monkey: + comp.registerUtility(_to_reg, ifoo, _name, _info2) + self.assertEqual(len(_events), 2) # unreg, reg + self.assertEqual(comp._utility_registrations[(ifoo, _name)], + (_to_reg, _info2, None)) # replaced + self.assertEqual(comp.utilities._subscribers[0][ifoo][''], + (_to_reg,)) + + def test_registerUtility_w_different_names_same_component(self): + from zope.interface.declarations import InterfaceClass + + class IFoo(InterfaceClass): + pass + + ifoo = IFoo('IFoo') + _info = 'info' + _name1 = 'name1' + _name2 = 'name2' + _other_reg = object() + _to_reg = object() + comp = self._makeOne() + comp.registerUtility(_other_reg, ifoo, _name1, _info) + _monkey, _events = self._wrapEvents() + with _monkey: + comp.registerUtility(_to_reg, ifoo, _name2, _info) + self.assertEqual(len(_events), 1) # reg + self.assertEqual(comp._utility_registrations[(ifoo, _name1)], + (_other_reg, _info, None)) + self.assertEqual(comp._utility_registrations[(ifoo, _name2)], + (_to_reg, _info, None)) + self.assertEqual(comp.utilities._subscribers[0][ifoo][''], + (_other_reg, _to_reg,)) + + def test_registerUtility_replaces_existing_reg(self): + from zope.interface.declarations import InterfaceClass + from zope.interface.interfaces import Registered + from zope.interface.interfaces import Unregistered + from zope.interface.registry import UtilityRegistration + + class IFoo(InterfaceClass): + pass + + ifoo = IFoo('IFoo') + _info = 'info' + _name = 'name' + _before, _after = object(), object() + comp = self._makeOne() + comp.registerUtility(_before, ifoo, _name, _info) + _monkey, _events = self._wrapEvents() + with _monkey: + comp.registerUtility(_after, ifoo, _name, _info) + self.assertEqual(len(_events), 2) + args, kw = _events[0] + event, = args + self.assertEqual(kw, {}) + self.assertIsInstance(event, Unregistered) + self.assertIsInstance(event.object, UtilityRegistration) + self.assertIs(event.object.registry, comp) + self.assertIs(event.object.provided, ifoo) + self.assertIs(event.object.name, _name) + self.assertIs(event.object.component, _before) + self.assertIs(event.object.info, _info) + self.assertIsNone(event.object.factory) + args, kw = _events[1] + event, = args + self.assertEqual(kw, {}) + self.assertIsInstance(event, Registered) + self.assertIsInstance(event.object, UtilityRegistration) + self.assertIs(event.object.registry, comp) + self.assertIs(event.object.provided, ifoo) + self.assertIs(event.object.name, _name) + self.assertIs(event.object.component, _after) + self.assertIs(event.object.info, _info) + self.assertIsNone(event.object.factory) + + def test_registerUtility_w_existing_subscr(self): + from zope.interface.declarations import InterfaceClass + + class IFoo(InterfaceClass): + pass + + ifoo = IFoo('IFoo') + _info = 'info' + _name1 = 'name1' + _name2 = 'name2' + _to_reg = object() + comp = self._makeOne() + comp.registerUtility(_to_reg, ifoo, _name1, _info) + _monkey, _events = self._wrapEvents() + with _monkey: + comp.registerUtility(_to_reg, ifoo, _name2, _info) + self.assertEqual(comp.utilities._subscribers[0][ifoo][''], (_to_reg,)) + + def test_registerUtility_wo_event(self): + from zope.interface.declarations import InterfaceClass + + class IFoo(InterfaceClass): + pass + + ifoo = IFoo('IFoo') + _info = 'info' + _name = 'name' + _to_reg = object() + comp = self._makeOne() + _monkey, _events = self._wrapEvents() + with _monkey: + comp.registerUtility(_to_reg, ifoo, _name, _info, False) + self.assertEqual(len(_events), 0) + + def test_registerUtility_changes_object_identity_after(self): + # If a subclass changes the identity of the _utility_registrations, + # the cache is updated and the right thing still happens. + class CompThatChangesAfter1Reg(self._getTargetClass()): + reg_count = 0 + + def registerUtility(self, *args): + self.reg_count += 1 + super().registerUtility(*args) + if self.reg_count == 1: + self._utility_registrations = dict( + self._utility_registrations + ) + + comp = CompThatChangesAfter1Reg() + comp.registerUtility(object(), Interface) + + self.assertEqual(len(list(comp.registeredUtilities())), 1) + + class IFoo(Interface): + pass + + comp.registerUtility(object(), IFoo) + self.assertEqual(len(list(comp.registeredUtilities())), 2) + + def test_registerUtility_changes_object_identity_before(self): + # If a subclass changes the identity of the _utility_registrations, + # the cache is updated and the right thing still happens. + class CompThatChangesAfter2Reg(self._getTargetClass()): + reg_count = 0 + + def registerUtility(self, *args): + self.reg_count += 1 + if self.reg_count == 2: + self._utility_registrations = dict( + self._utility_registrations + ) + + super().registerUtility(*args) + + comp = CompThatChangesAfter2Reg() + comp.registerUtility(object(), Interface) + + self.assertEqual(len(list(comp.registeredUtilities())), 1) + + class IFoo(Interface): + pass + + comp.registerUtility(object(), IFoo) + self.assertEqual(len(list(comp.registeredUtilities())), 2) + + class IBar(Interface): + pass + + comp.registerUtility(object(), IBar) + self.assertEqual(len(list(comp.registeredUtilities())), 3) + + def test_unregisterUtility_wo_factory_nor_component_nor_provided(self): + comp = self._makeOne() + self.assertRaises(TypeError, comp.unregisterUtility, + component=None, provided=None, factory=None) + + def test_unregisterUtility_both_factory_and_component(self): + def _factory(): + raise NotImplementedError() + _to_reg = object() + comp = self._makeOne() + self.assertRaises(TypeError, comp.unregisterUtility, + component=_to_reg, factory=_factory) + + def test_unregisterUtility_w_component_miss(self): + from zope.interface.declarations import InterfaceClass + + class IFoo(InterfaceClass): + pass + + ifoo = IFoo('IFoo') + _name = 'name' + _to_reg = object() + comp = self._makeOne() + _monkey, _events = self._wrapEvents() + with _monkey: + unreg = comp.unregisterUtility(_to_reg, ifoo, _name) + self.assertFalse(unreg) + self.assertFalse(_events) + + def test_unregisterUtility_w_component(self): + from zope.interface.declarations import InterfaceClass + from zope.interface.interfaces import Unregistered + from zope.interface.registry import UtilityRegistration + + class IFoo(InterfaceClass): + pass + + ifoo = IFoo('IFoo') + _name = 'name' + _to_reg = object() + comp = self._makeOne() + comp.registerUtility(_to_reg, ifoo, _name) + _monkey, _events = self._wrapEvents() + with _monkey: + unreg = comp.unregisterUtility(_to_reg, ifoo, _name) + self.assertTrue(unreg) + self.assertFalse(comp.utilities._adapters) # all erased + self.assertNotIn((ifoo, _name), comp._utility_registrations) + self.assertFalse(comp.utilities._subscribers) + self.assertEqual(len(_events), 1) + args, kw = _events[0] + event, = args + self.assertEqual(kw, {}) + self.assertIsInstance(event, Unregistered) + self.assertIsInstance(event.object, UtilityRegistration) + self.assertIs(event.object.registry, comp) + self.assertIs(event.object.provided, ifoo) + self.assertIs(event.object.name, _name) + self.assertIs(event.object.component, _to_reg) + self.assertIsNone(event.object.factory) + + def test_unregisterUtility_w_factory(self): + from zope.interface.declarations import InterfaceClass + from zope.interface.interfaces import Unregistered + from zope.interface.registry import UtilityRegistration + + class IFoo(InterfaceClass): + pass + + ifoo = IFoo('IFoo') + _info = 'info' + _name = 'name' + _to_reg = object() + + def _factory(): + return _to_reg + + comp = self._makeOne() + comp.registerUtility(None, ifoo, _name, _info, factory=_factory) + _monkey, _events = self._wrapEvents() + with _monkey: + unreg = comp.unregisterUtility(None, ifoo, _name, factory=_factory) + self.assertTrue(unreg) + self.assertEqual(len(_events), 1) + args, kw = _events[0] + event, = args + self.assertEqual(kw, {}) + self.assertIsInstance(event, Unregistered) + self.assertIsInstance(event.object, UtilityRegistration) + self.assertIs(event.object.registry, comp) + self.assertIs(event.object.provided, ifoo) + self.assertIs(event.object.name, _name) + self.assertIs(event.object.component, _to_reg) + self.assertIs(event.object.factory, _factory) + + def test_unregisterUtility_wo_explicit_provided(self): + from zope.interface.declarations import InterfaceClass + from zope.interface.declarations import directlyProvides + from zope.interface.interfaces import Unregistered + from zope.interface.registry import UtilityRegistration + + class IFoo(InterfaceClass): + pass + + class Foo: + pass + + ifoo = IFoo('IFoo') + _info = 'info' + _name = 'name' + _to_reg = Foo() + directlyProvides(_to_reg, ifoo) + comp = self._makeOne() + comp.registerUtility(_to_reg, ifoo, _name, _info) + _monkey, _events = self._wrapEvents() + with _monkey: + unreg = comp.unregisterUtility(_to_reg, None, _name) + self.assertTrue(unreg) + self.assertEqual(len(_events), 1) + args, kw = _events[0] + event, = args + self.assertEqual(kw, {}) + self.assertIsInstance(event, Unregistered) + self.assertIsInstance(event.object, UtilityRegistration) + self.assertIs(event.object.registry, comp) + self.assertIs(event.object.provided, ifoo) + self.assertIs(event.object.name, _name) + self.assertIs(event.object.component, _to_reg) + self.assertIs(event.object.info, _info) + self.assertIsNone(event.object.factory) + + def test_unregisterUtility_wo_component_or_factory(self): + from zope.interface.declarations import InterfaceClass + from zope.interface.declarations import directlyProvides + from zope.interface.interfaces import Unregistered + from zope.interface.registry import UtilityRegistration + + class IFoo(InterfaceClass): + pass + + class Foo: + pass + + ifoo = IFoo('IFoo') + _info = 'info' + _name = 'name' + _to_reg = Foo() + directlyProvides(_to_reg, ifoo) + comp = self._makeOne() + comp.registerUtility(_to_reg, ifoo, _name, _info) + _monkey, _events = self._wrapEvents() + with _monkey: + # Just pass the interface / name + unreg = comp.unregisterUtility(provided=ifoo, name=_name) + self.assertTrue(unreg) + self.assertEqual(len(_events), 1) + args, kw = _events[0] + event, = args + self.assertEqual(kw, {}) + self.assertIsInstance(event, Unregistered) + self.assertIsInstance(event.object, UtilityRegistration) + self.assertIs(event.object.registry, comp) + self.assertIs(event.object.provided, ifoo) + self.assertIs(event.object.name, _name) + self.assertIs(event.object.component, _to_reg) + self.assertIs(event.object.info, _info) + self.assertIsNone(event.object.factory) + + def test_unregisterUtility_w_existing_subscr(self): + from zope.interface.declarations import InterfaceClass + + class IFoo(InterfaceClass): + pass + + ifoo = IFoo('IFoo') + _info = 'info' + _name1 = 'name1' + _name2 = 'name2' + _to_reg = object() + comp = self._makeOne() + comp.registerUtility(_to_reg, ifoo, _name1, _info) + comp.registerUtility(_to_reg, ifoo, _name2, _info) + _monkey, _events = self._wrapEvents() + with _monkey: + comp.unregisterUtility(_to_reg, ifoo, _name2) + self.assertEqual(comp.utilities._subscribers[0][ifoo][''], (_to_reg,)) + + def test_unregisterUtility_w_existing_subscr_non_hashable(self): + from zope.interface.declarations import InterfaceClass + + class IFoo(InterfaceClass): + pass + + ifoo = IFoo('IFoo') + _info = 'info' + _name1 = 'name1' + _name2 = 'name2' + _to_reg = dict() + comp = self._makeOne() + comp.registerUtility(_to_reg, ifoo, _name1, _info) + comp.registerUtility(_to_reg, ifoo, _name2, _info) + _monkey, _events = self._wrapEvents() + with _monkey: + comp.unregisterUtility(_to_reg, ifoo, _name2) + self.assertEqual(comp.utilities._subscribers[0][ifoo][''], (_to_reg,)) + + def test_unregisterUtility_w_existing_subs_non_hashable_fresh_cache(self): + # We correctly populate the cache of registrations if it has gone away + # (for example, the Components was unpickled) + from zope.interface.declarations import InterfaceClass + from zope.interface.registry import _UtilityRegistrations + + class IFoo(InterfaceClass): + pass + + ifoo = IFoo('IFoo') + _info = 'info' + _name1 = 'name1' + _name2 = 'name2' + _to_reg = dict() + comp = self._makeOne() + comp.registerUtility(_to_reg, ifoo, _name1, _info) + comp.registerUtility(_to_reg, ifoo, _name2, _info) + + _monkey, _events = self._wrapEvents() + with _monkey: + comp.unregisterUtility(_to_reg, ifoo, _name2) + self.assertEqual(comp.utilities._subscribers[0][ifoo][''], (_to_reg,)) + + def test_unregisterUtility_w_existing_subscr_non_hashable_reinitted(self): + # We correctly populate the cache of registrations if the base objects + # change out from under us + from zope.interface.declarations import InterfaceClass + + class IFoo(InterfaceClass): + pass + + ifoo = IFoo('IFoo') + _info = 'info' + _name1 = 'name1' + _name2 = 'name2' + _to_reg = dict() + comp = self._makeOne() + comp.registerUtility(_to_reg, ifoo, _name1, _info) + comp.registerUtility(_to_reg, ifoo, _name2, _info) + + # zope.component.testing does this + comp.__init__('base') + + comp.registerUtility(_to_reg, ifoo, _name2, _info) + + _monkey, _events = self._wrapEvents() + with _monkey: + # Nothing to do, but we don't break either + comp.unregisterUtility(_to_reg, ifoo, _name2) + self.assertEqual(0, len(comp.utilities._subscribers)) + + def test_unregisterUtility_w_existing_subscr_other_component(self): + from zope.interface.declarations import InterfaceClass + + class IFoo(InterfaceClass): + pass + + ifoo = IFoo('IFoo') + _info = 'info' + _name1 = 'name1' + _name2 = 'name2' + _other_reg = object() + _to_reg = object() + comp = self._makeOne() + comp.registerUtility(_other_reg, ifoo, _name1, _info) + comp.registerUtility(_to_reg, ifoo, _name2, _info) + _monkey, _events = self._wrapEvents() + with _monkey: + comp.unregisterUtility(_to_reg, ifoo, _name2) + self.assertEqual(comp.utilities._subscribers[0][ifoo][''], + (_other_reg,)) + + def test_unregisterUtility_w_existing_subscr_oter_comp_mixed_hash(self): + from zope.interface.declarations import InterfaceClass + + class IFoo(InterfaceClass): + pass + + ifoo = IFoo('IFoo') + _info = 'info' + _name1 = 'name1' + _name2 = 'name2' + # First register something hashable + _other_reg = object() + # Then it transfers to something unhashable + _to_reg = dict() + comp = self._makeOne() + comp.registerUtility(_other_reg, ifoo, _name1, _info) + comp.registerUtility(_to_reg, ifoo, _name2, _info) + _monkey, _events = self._wrapEvents() + with _monkey: + comp.unregisterUtility(_to_reg, ifoo, _name2) + self.assertEqual(comp.utilities._subscribers[0][ifoo][''], + (_other_reg,)) + + def test_registeredUtilities_empty(self): + comp = self._makeOne() + self.assertEqual(list(comp.registeredUtilities()), []) + + def test_registeredUtilities_notempty(self): + from zope.interface.declarations import InterfaceClass + from zope.interface.registry import UtilityRegistration + + class IFoo(InterfaceClass): + pass + + ifoo = IFoo('IFoo') + _info = 'info' + _name1 = 'name1' + _name2 = 'name2' + _to_reg = object() + comp = self._makeOne() + comp.registerUtility(_to_reg, ifoo, _name1, _info) + comp.registerUtility(_to_reg, ifoo, _name2, _info) + reg = sorted(comp.registeredUtilities(), key=lambda r: r.name) + self.assertEqual(len(reg), 2) + self.assertIsInstance(reg[0], UtilityRegistration) + self.assertIs(reg[0].registry, comp) + self.assertIs(reg[0].provided, ifoo) + self.assertIs(reg[0].name, _name1) + self.assertIs(reg[0].component, _to_reg) + self.assertIs(reg[0].info, _info) + self.assertIsNone(reg[0].factory) + self.assertIsInstance(reg[1], UtilityRegistration) + self.assertIs(reg[1].registry, comp) + self.assertIs(reg[1].provided, ifoo) + self.assertIs(reg[1].name, _name2) + self.assertIs(reg[1].component, _to_reg) + self.assertIs(reg[1].info, _info) + self.assertIsNone(reg[1].factory) + + def test_queryUtility_miss_no_default(self): + from zope.interface.declarations import InterfaceClass + + class IFoo(InterfaceClass): + pass + + ifoo = IFoo('IFoo') + comp = self._makeOne() + self.assertIsNone(comp.queryUtility(ifoo)) + + def test_queryUtility_miss_w_default(self): + from zope.interface.declarations import InterfaceClass + + class IFoo(InterfaceClass): + pass + + ifoo = IFoo('IFoo') + comp = self._makeOne() + _default = object() + self.assertIs(comp.queryUtility(ifoo, default=_default), _default) + + def test_queryUtility_hit(self): + from zope.interface.declarations import InterfaceClass + + class IFoo(InterfaceClass): + pass + + ifoo = IFoo('IFoo') + _to_reg = object() + comp = self._makeOne() + comp.registerUtility(_to_reg, ifoo) + self.assertIs(comp.queryUtility(ifoo), _to_reg) + + def test_getUtility_miss(self): + from zope.interface.declarations import InterfaceClass + from zope.interface.interfaces import ComponentLookupError + + class IFoo(InterfaceClass): + pass + + ifoo = IFoo('IFoo') + comp = self._makeOne() + self.assertRaises(ComponentLookupError, comp.getUtility, ifoo) + + def test_getUtility_hit(self): + from zope.interface.declarations import InterfaceClass + + class IFoo(InterfaceClass): + pass + + ifoo = IFoo('IFoo') + _to_reg = object() + comp = self._makeOne() + comp.registerUtility(_to_reg, ifoo) + self.assertIs(comp.getUtility(ifoo), _to_reg) + + def test_getUtilitiesFor_miss(self): + from zope.interface.declarations import InterfaceClass + + class IFoo(InterfaceClass): + pass + + ifoo = IFoo('IFoo') + comp = self._makeOne() + self.assertEqual(list(comp.getUtilitiesFor(ifoo)), []) + + def test_getUtilitiesFor_hit(self): + from zope.interface.declarations import InterfaceClass + + class IFoo(InterfaceClass): + pass + + ifoo = IFoo('IFoo') + _name1 = 'name1' + _name2 = 'name2' + _to_reg = object() + comp = self._makeOne() + comp.registerUtility(_to_reg, ifoo, name=_name1) + comp.registerUtility(_to_reg, ifoo, name=_name2) + self.assertEqual(sorted(comp.getUtilitiesFor(ifoo)), + [(_name1, _to_reg), (_name2, _to_reg)]) + + def test_getAllUtilitiesRegisteredFor_miss(self): + from zope.interface.declarations import InterfaceClass + + class IFoo(InterfaceClass): + pass + + ifoo = IFoo('IFoo') + comp = self._makeOne() + self.assertEqual(list(comp.getAllUtilitiesRegisteredFor(ifoo)), []) + + def test_getAllUtilitiesRegisteredFor_hit(self): + from zope.interface.declarations import InterfaceClass + + class IFoo(InterfaceClass): + pass + + ifoo = IFoo('IFoo') + _name1 = 'name1' + _name2 = 'name2' + _to_reg = object() + comp = self._makeOne() + comp.registerUtility(_to_reg, ifoo, name=_name1) + comp.registerUtility(_to_reg, ifoo, name=_name2) + self.assertEqual(list(comp.getAllUtilitiesRegisteredFor(ifoo)), + [_to_reg]) + + def test_registerAdapter_with_component_name(self): + from zope.interface.declarations import InterfaceClass + from zope.interface.declarations import named + + class IFoo(InterfaceClass): + pass + + ifoo = IFoo('IFoo') + ibar = IFoo('IBar') + + @named('foo') + class Foo: + pass + _info = 'info' + + comp = self._makeOne() + comp.registerAdapter(Foo, (ibar,), ifoo, info=_info) + + self.assertEqual( + comp._adapter_registrations[(ibar,), ifoo, 'foo'], + (Foo, _info)) + + def test_registerAdapter_w_explicit_provided_and_required(self): + from zope.interface.declarations import InterfaceClass + from zope.interface.interfaces import Registered + from zope.interface.registry import AdapterRegistration + + class IFoo(InterfaceClass): + pass + + ifoo = IFoo('IFoo') + ibar = IFoo('IBar') + _info = 'info' + _name = 'name' + + def _factory(context): + raise NotImplementedError() + comp = self._makeOne() + _monkey, _events = self._wrapEvents() + with _monkey: + comp.registerAdapter(_factory, (ibar,), ifoo, _name, _info) + self.assertIs( + comp.adapters._adapters[1][ibar][ifoo][_name], + _factory + ) + self.assertEqual(comp._adapter_registrations[(ibar,), ifoo, _name], + (_factory, _info)) + self.assertEqual(len(_events), 1) + args, kw = _events[0] + event, = args + self.assertEqual(kw, {}) + self.assertIsInstance(event, Registered) + self.assertIsInstance(event.object, AdapterRegistration) + self.assertIs(event.object.registry, comp) + self.assertIs(event.object.provided, ifoo) + self.assertEqual(event.object.required, (ibar,)) + self.assertIs(event.object.name, _name) + self.assertIs(event.object.info, _info) + self.assertIs(event.object.factory, _factory) + + def test_registerAdapter_no_provided_available(self): + from zope.interface.declarations import InterfaceClass + + class IFoo(InterfaceClass): + pass + + ibar = IFoo('IBar') + _info = 'info' + _name = 'name' + + class _Factory: + pass + + comp = self._makeOne() + self.assertRaises(TypeError, comp.registerAdapter, _Factory, (ibar,), + name=_name, info=_info) + + def test_registerAdapter_wo_explicit_provided(self): + from zope.interface.declarations import InterfaceClass + from zope.interface.declarations import implementer + from zope.interface.interfaces import Registered + from zope.interface.registry import AdapterRegistration + + class IFoo(InterfaceClass): + pass + + ifoo = IFoo('IFoo') + ibar = IFoo('IBar') + _info = 'info' + _name = 'name' + + @implementer(ifoo) + class _Factory: + pass + + comp = self._makeOne() + _monkey, _events = self._wrapEvents() + with _monkey: + comp.registerAdapter(_Factory, (ibar,), name=_name, info=_info) + self.assertIs( + comp.adapters._adapters[1][ibar][ifoo][_name], + _Factory + ) + self.assertEqual(comp._adapter_registrations[(ibar,), ifoo, _name], + (_Factory, _info)) + self.assertEqual(len(_events), 1) + args, kw = _events[0] + event, = args + self.assertEqual(kw, {}) + self.assertIsInstance(event, Registered) + self.assertIsInstance(event.object, AdapterRegistration) + self.assertIs(event.object.registry, comp) + self.assertIs(event.object.provided, ifoo) + self.assertEqual(event.object.required, (ibar,)) + self.assertIs(event.object.name, _name) + self.assertIs(event.object.info, _info) + self.assertIs(event.object.factory, _Factory) + + def test_registerAdapter_no_required_available(self): + from zope.interface.declarations import InterfaceClass + + class IFoo(InterfaceClass): + pass + + ifoo = IFoo('IFoo') + + _info = 'info' + _name = 'name' + + class _Factory: + pass + + comp = self._makeOne() + self.assertRaises(TypeError, comp.registerAdapter, _Factory, + provided=ifoo, name=_name, info=_info) + + def test_registerAdapter_w_invalid_required(self): + from zope.interface.declarations import InterfaceClass + + class IFoo(InterfaceClass): + pass + + ifoo = IFoo('IFoo') + ibar = IFoo('IBar') + _info = 'info' + _name = 'name' + + class _Factory: + pass + + comp = self._makeOne() + self.assertRaises(TypeError, comp.registerAdapter, _Factory, + ibar, provided=ifoo, name=_name, info=_info) + + def test_registerAdapter_w_required_containing_None(self): + from zope.interface.declarations import InterfaceClass + from zope.interface.interface import Interface + from zope.interface.interfaces import Registered + from zope.interface.registry import AdapterRegistration + + class IFoo(InterfaceClass): + pass + + ifoo = IFoo('IFoo') + _info = 'info' + _name = 'name' + + class _Factory: + pass + + comp = self._makeOne() + _monkey, _events = self._wrapEvents() + with _monkey: + comp.registerAdapter(_Factory, [None], provided=ifoo, + name=_name, info=_info) + self.assertIs( + comp.adapters._adapters[1][Interface][ifoo][_name], + _Factory + ) + self.assertEqual( + comp._adapter_registrations[(Interface,), ifoo, _name], + (_Factory, _info) + ) + self.assertEqual(len(_events), 1) + args, kw = _events[0] + event, = args + self.assertEqual(kw, {}) + self.assertIsInstance(event, Registered) + self.assertIsInstance(event.object, AdapterRegistration) + self.assertIs(event.object.registry, comp) + self.assertIs(event.object.provided, ifoo) + self.assertEqual(event.object.required, (Interface,)) + self.assertIs(event.object.name, _name) + self.assertIs(event.object.info, _info) + self.assertIs(event.object.factory, _Factory) + + def test_registerAdapter_w_required_containing_class(self): + from zope.interface.declarations import InterfaceClass + from zope.interface.declarations import implementedBy + from zope.interface.declarations import implementer + from zope.interface.interfaces import Registered + from zope.interface.registry import AdapterRegistration + + class IFoo(InterfaceClass): + pass + + ifoo = IFoo('IFoo') + ibar = IFoo('IBar') + _info = 'info' + _name = 'name' + + class _Factory: + pass + + @implementer(ibar) + class _Context: + pass + + _ctx_impl = implementedBy(_Context) + comp = self._makeOne() + _monkey, _events = self._wrapEvents() + with _monkey: + comp.registerAdapter(_Factory, [_Context], provided=ifoo, + name=_name, info=_info) + self.assertIs( + comp.adapters._adapters[1][_ctx_impl][ifoo][_name], + _Factory + ) + self.assertEqual( + comp._adapter_registrations[(_ctx_impl,), ifoo, _name], + (_Factory, _info) + ) + self.assertEqual(len(_events), 1) + args, kw = _events[0] + event, = args + self.assertEqual(kw, {}) + self.assertIsInstance(event, Registered) + self.assertIsInstance(event.object, AdapterRegistration) + self.assertIs(event.object.registry, comp) + self.assertIs(event.object.provided, ifoo) + self.assertEqual(event.object.required, (_ctx_impl,)) + self.assertIs(event.object.name, _name) + self.assertIs(event.object.info, _info) + self.assertIs(event.object.factory, _Factory) + + def test_registerAdapter_w_required_containing_junk(self): + from zope.interface.declarations import InterfaceClass + + class IFoo(InterfaceClass): + pass + + ifoo = IFoo('IFoo') + + _info = 'info' + _name = 'name' + + class _Factory: + pass + + comp = self._makeOne() + with self.assertRaises(TypeError): + comp.registerAdapter( + _Factory, [object()], provided=ifoo, name=_name, info=_info, + ) + + def test_registerAdapter_wo_explicit_required(self): + from zope.interface.declarations import InterfaceClass + from zope.interface.interfaces import Registered + from zope.interface.registry import AdapterRegistration + + class IFoo(InterfaceClass): + pass + + ifoo = IFoo('IFoo') + ibar = IFoo('IBar') + _info = 'info' + _name = 'name' + + class _Factory: + __component_adapts__ = (ibar,) + + comp = self._makeOne() + _monkey, _events = self._wrapEvents() + with _monkey: + comp.registerAdapter(_Factory, provided=ifoo, name=_name, + info=_info) + self.assertIs( + comp.adapters._adapters[1][ibar][ifoo][_name], + _Factory + ) + self.assertEqual(comp._adapter_registrations[(ibar,), ifoo, _name], + (_Factory, _info)) + self.assertEqual(len(_events), 1) + args, kw = _events[0] + event, = args + self.assertEqual(kw, {}) + self.assertIsInstance(event, Registered) + self.assertIsInstance(event.object, AdapterRegistration) + self.assertIs(event.object.registry, comp) + self.assertIs(event.object.provided, ifoo) + self.assertEqual(event.object.required, (ibar,)) + self.assertIs(event.object.name, _name) + self.assertIs(event.object.info, _info) + self.assertIs(event.object.factory, _Factory) + + def test_registerAdapter_wo_event(self): + from zope.interface.declarations import InterfaceClass + + class IFoo(InterfaceClass): + pass + + ifoo = IFoo('IFoo') + ibar = IFoo('IBar') + _info = 'info' + _name = 'name' + + def _factory(context): + raise NotImplementedError() + comp = self._makeOne() + _monkey, _events = self._wrapEvents() + with _monkey: + comp.registerAdapter(_factory, (ibar,), ifoo, _name, _info, + event=False) + self.assertEqual(len(_events), 0) + + def test_unregisterAdapter_neither_factory_nor_provided(self): + comp = self._makeOne() + self.assertRaises(TypeError, comp.unregisterAdapter, + factory=None, provided=None) + + def test_unregisterAdapter_neither_factory_nor_required(self): + from zope.interface.declarations import InterfaceClass + + class IFoo(InterfaceClass): + pass + + ifoo = IFoo('IFoo') + comp = self._makeOne() + self.assertRaises(TypeError, comp.unregisterAdapter, + factory=None, provided=ifoo, required=None) + + def test_unregisterAdapter_miss(self): + from zope.interface.declarations import InterfaceClass + + class IFoo(InterfaceClass): + pass + + ifoo = IFoo('IFoo') + ibar = IFoo('IBar') + + class _Factory: + pass + + comp = self._makeOne() + _monkey, _events = self._wrapEvents() + with _monkey: + unreg = comp.unregisterAdapter(_Factory, (ibar,), ifoo) + self.assertFalse(unreg) + + def test_unregisterAdapter_hit_w_explicit_provided_and_required(self): + from zope.interface.declarations import InterfaceClass + from zope.interface.interfaces import Unregistered + from zope.interface.registry import AdapterRegistration + + class IFoo(InterfaceClass): + pass + + ifoo = IFoo('IFoo') + ibar = IFoo('IBar') + + class _Factory: + pass + + comp = self._makeOne() + comp.registerAdapter(_Factory, (ibar,), ifoo) + _monkey, _events = self._wrapEvents() + with _monkey: + unreg = comp.unregisterAdapter(_Factory, (ibar,), ifoo) + self.assertTrue(unreg) + self.assertFalse(comp.adapters._adapters) + self.assertFalse(comp._adapter_registrations) + self.assertEqual(len(_events), 1) + args, kw = _events[0] + event, = args + self.assertEqual(kw, {}) + self.assertIsInstance(event, Unregistered) + self.assertIsInstance(event.object, AdapterRegistration) + self.assertIs(event.object.registry, comp) + self.assertIs(event.object.provided, ifoo) + self.assertEqual(event.object.required, (ibar,)) + self.assertEqual(event.object.name, '') + self.assertEqual(event.object.info, '') + self.assertIs(event.object.factory, _Factory) + + def test_unregisterAdapter_wo_explicit_provided(self): + from zope.interface.declarations import InterfaceClass + from zope.interface.declarations import implementer + from zope.interface.interfaces import Unregistered + from zope.interface.registry import AdapterRegistration + + class IFoo(InterfaceClass): + pass + + ifoo = IFoo('IFoo') + ibar = IFoo('IBar') + + @implementer(ifoo) + class _Factory: + pass + + comp = self._makeOne() + comp.registerAdapter(_Factory, (ibar,), ifoo) + _monkey, _events = self._wrapEvents() + with _monkey: + unreg = comp.unregisterAdapter(_Factory, (ibar,)) + self.assertTrue(unreg) + self.assertEqual(len(_events), 1) + args, kw = _events[0] + event, = args + self.assertEqual(kw, {}) + self.assertIsInstance(event, Unregistered) + self.assertIsInstance(event.object, AdapterRegistration) + self.assertIs(event.object.registry, comp) + self.assertIs(event.object.provided, ifoo) + self.assertEqual(event.object.required, (ibar,)) + self.assertEqual(event.object.name, '') + self.assertEqual(event.object.info, '') + self.assertIs(event.object.factory, _Factory) + + def test_unregisterAdapter_wo_explicit_required(self): + from zope.interface.declarations import InterfaceClass + from zope.interface.interfaces import Unregistered + from zope.interface.registry import AdapterRegistration + + class IFoo(InterfaceClass): + pass + + ifoo = IFoo('IFoo') + ibar = IFoo('IBar') + + class _Factory: + __component_adapts__ = (ibar,) + + comp = self._makeOne() + comp.registerAdapter(_Factory, (ibar,), ifoo) + _monkey, _events = self._wrapEvents() + with _monkey: + unreg = comp.unregisterAdapter(_Factory, provided=ifoo) + self.assertTrue(unreg) + self.assertEqual(len(_events), 1) + args, kw = _events[0] + event, = args + self.assertEqual(kw, {}) + self.assertIsInstance(event, Unregistered) + self.assertIsInstance(event.object, AdapterRegistration) + self.assertIs(event.object.registry, comp) + self.assertIs(event.object.provided, ifoo) + self.assertEqual(event.object.required, (ibar,)) + self.assertEqual(event.object.name, '') + self.assertEqual(event.object.info, '') + self.assertIs(event.object.factory, _Factory) + + def test_registeredAdapters_empty(self): + comp = self._makeOne() + self.assertEqual(list(comp.registeredAdapters()), []) + + def test_registeredAdapters_notempty(self): + from zope.interface.declarations import InterfaceClass + from zope.interface.registry import AdapterRegistration + + class IFoo(InterfaceClass): + pass + + ifoo = IFoo('IFoo') + ibar = IFoo('IFoo') + _info = 'info' + _name1 = 'name1' + _name2 = 'name2' + + class _Factory: + pass + + comp = self._makeOne() + comp.registerAdapter(_Factory, (ibar,), ifoo, _name1, _info) + comp.registerAdapter(_Factory, (ibar,), ifoo, _name2, _info) + reg = sorted(comp.registeredAdapters(), key=lambda r: r.name) + self.assertEqual(len(reg), 2) + self.assertIsInstance(reg[0], AdapterRegistration) + self.assertIs(reg[0].registry, comp) + self.assertIs(reg[0].provided, ifoo) + self.assertEqual(reg[0].required, (ibar,)) + self.assertIs(reg[0].name, _name1) + self.assertIs(reg[0].info, _info) + self.assertIs(reg[0].factory, _Factory) + self.assertIsInstance(reg[1], AdapterRegistration) + self.assertIs(reg[1].registry, comp) + self.assertIs(reg[1].provided, ifoo) + self.assertEqual(reg[1].required, (ibar,)) + self.assertIs(reg[1].name, _name2) + self.assertIs(reg[1].info, _info) + self.assertIs(reg[1].factory, _Factory) + + def test_queryAdapter_miss_no_default(self): + from zope.interface.declarations import InterfaceClass + + class IFoo(InterfaceClass): + pass + + ifoo = IFoo('IFoo') + comp = self._makeOne() + _context = object() + self.assertIsNone(comp.queryAdapter(_context, ifoo)) + + def test_queryAdapter_miss_w_default(self): + from zope.interface.declarations import InterfaceClass + + class IFoo(InterfaceClass): + pass + + ifoo = IFoo('IFoo') + comp = self._makeOne() + _context = object() + _default = object() + self.assertIs( + comp.queryAdapter(_context, ifoo, default=_default), + _default + ) + + def test_queryAdapter_hit(self): + from zope.interface.declarations import InterfaceClass + from zope.interface.declarations import implementer + + class IFoo(InterfaceClass): + pass + + ifoo = IFoo('IFoo') + ibar = IFoo('IBar') + + class _Factory: + def __init__(self, context): + self.context = context + + @implementer(ibar) + class _Context: + pass + + _context = _Context() + comp = self._makeOne() + comp.registerAdapter(_Factory, (ibar,), ifoo) + adapter = comp.queryAdapter(_context, ifoo) + self.assertIsInstance(adapter, _Factory) + self.assertIs(adapter.context, _context) + + def test_getAdapter_miss(self): + from zope.interface.declarations import InterfaceClass + from zope.interface.declarations import implementer + from zope.interface.interfaces import ComponentLookupError + + class IFoo(InterfaceClass): + pass + + ifoo = IFoo('IFoo') + ibar = IFoo('IBar') + + @implementer(ibar) + class _Context: + pass + + _context = _Context() + comp = self._makeOne() + self.assertRaises(ComponentLookupError, + comp.getAdapter, _context, ifoo) + + def test_getAdapter_hit(self): + from zope.interface.declarations import InterfaceClass + from zope.interface.declarations import implementer + + class IFoo(InterfaceClass): + pass + + ifoo = IFoo('IFoo') + ibar = IFoo('IBar') + + class _Factory: + def __init__(self, context): + self.context = context + + @implementer(ibar) + class _Context: + pass + + _context = _Context() + comp = self._makeOne() + comp.registerAdapter(_Factory, (ibar,), ifoo) + adapter = comp.getAdapter(_context, ifoo) + self.assertIsInstance(adapter, _Factory) + self.assertIs(adapter.context, _context) + + def test_getAdapter_hit_super(self): + from zope.interface import Interface + from zope.interface.declarations import implementer + + class IBase(Interface): + pass + + class IDerived(IBase): + pass + + class IFoo(Interface): + pass + + @implementer(IBase) + class Base: + pass + + @implementer(IDerived) + class Derived(Base): + pass + + class AdapterBase: + def __init__(self, context): + self.context = context + + class AdapterDerived: + def __init__(self, context): + self.context = context + + comp = self._makeOne() + comp.registerAdapter(AdapterDerived, (IDerived,), IFoo) + comp.registerAdapter(AdapterBase, (IBase,), IFoo) + self._should_not_change(comp) + + derived = Derived() + adapter = comp.getAdapter(derived, IFoo) + self.assertIsInstance(adapter, AdapterDerived) + self.assertIs(adapter.context, derived) + + supe = super(Derived, derived) + adapter = comp.getAdapter(supe, IFoo) + self.assertIsInstance(adapter, AdapterBase) + self.assertIs(adapter.context, derived) + + def test_getAdapter_hit_super_w_parent_implements_interface_diamond(self): + from zope.interface import Interface + from zope.interface.declarations import implementer + + class IBase(Interface): + pass + + class IDerived(IBase): + pass + + class IFoo(Interface): + pass + + class Base: + pass + + class Child1(Base): + pass + + @implementer(IBase) + class Child2(Base): + pass + + @implementer(IDerived) + class Derived(Child1, Child2): + pass + + class AdapterBase: + def __init__(self, context): + self.context = context + + class AdapterDerived: + def __init__(self, context): + self.context = context + + comp = self._makeOne() + comp.registerAdapter(AdapterDerived, (IDerived,), IFoo) + comp.registerAdapter(AdapterBase, (IBase,), IFoo) + self._should_not_change(comp) + + derived = Derived() + adapter = comp.getAdapter(derived, IFoo) + self.assertIsInstance(adapter, AdapterDerived) + self.assertIs(adapter.context, derived) + + supe = super(Derived, derived) + adapter = comp.getAdapter(supe, IFoo) + self.assertIsInstance(adapter, AdapterBase) + self.assertIs(adapter.context, derived) + + def test_queryMultiAdapter_miss(self): + from zope.interface.declarations import InterfaceClass + from zope.interface.declarations import implementer + + class IFoo(InterfaceClass): + pass + ifoo = IFoo('IFoo') + ibar = IFoo('IBar') + ibaz = IFoo('IBaz') + + @implementer(ibar) + class _Context1: + pass + + @implementer(ibaz) + class _Context2: + pass + + _context1 = _Context1() + _context2 = _Context2() + comp = self._makeOne() + self.assertEqual(comp.queryMultiAdapter((_context1, _context2), ifoo), + None) + + def test_queryMultiAdapter_miss_w_default(self): + from zope.interface.declarations import InterfaceClass + from zope.interface.declarations import implementer + + class IFoo(InterfaceClass): + pass + + ifoo = IFoo('IFoo') + ibar = IFoo('IBar') + ibaz = IFoo('IBaz') + + @implementer(ibar) + class _Context1: + pass + + @implementer(ibaz) + class _Context2: + pass + + _context1 = _Context1() + _context2 = _Context2() + _default = object() + comp = self._makeOne() + self.assertIs( + comp.queryMultiAdapter((_context1, _context2), ifoo, + default=_default), + _default + ) + + def test_queryMultiAdapter_hit(self): + from zope.interface.declarations import InterfaceClass + from zope.interface.declarations import implementer + + class IFoo(InterfaceClass): + pass + + ifoo = IFoo('IFoo') + ibar = IFoo('IBar') + ibaz = IFoo('IBaz') + + @implementer(ibar) + class _Context1: + pass + + @implementer(ibaz) + class _Context2: + pass + + _context1 = _Context1() + _context2 = _Context2() + + class _Factory: + def __init__(self, context1, context2): + self.context = context1, context2 + + comp = self._makeOne() + comp.registerAdapter(_Factory, (ibar, ibaz), ifoo) + adapter = comp.queryMultiAdapter((_context1, _context2), ifoo) + self.assertIsInstance(adapter, _Factory) + self.assertEqual(adapter.context, (_context1, _context2)) + + def test_getMultiAdapter_miss(self): + from zope.interface.declarations import InterfaceClass + from zope.interface.declarations import implementer + from zope.interface.interfaces import ComponentLookupError + + class IFoo(InterfaceClass): + pass + + ifoo = IFoo('IFoo') + ibar = IFoo('IBar') + ibaz = IFoo('IBaz') + + @implementer(ibar) + class _Context1: + pass + + @implementer(ibaz) + class _Context2: + pass + + _context1 = _Context1() + _context2 = _Context2() + comp = self._makeOne() + self.assertRaises(ComponentLookupError, + comp.getMultiAdapter, (_context1, _context2), ifoo) + + def test_getMultiAdapter_hit(self): + from zope.interface.declarations import InterfaceClass + from zope.interface.declarations import implementer + + class IFoo(InterfaceClass): + pass + + ifoo = IFoo('IFoo') + ibar = IFoo('IBar') + ibaz = IFoo('IBaz') + + @implementer(ibar) + class _Context1: + pass + + @implementer(ibaz) + class _Context2: + pass + + _context1 = _Context1() + _context2 = _Context2() + + class _Factory: + def __init__(self, context1, context2): + self.context = context1, context2 + + comp = self._makeOne() + comp.registerAdapter(_Factory, (ibar, ibaz), ifoo) + adapter = comp.getMultiAdapter((_context1, _context2), ifoo) + self.assertIsInstance(adapter, _Factory) + self.assertEqual(adapter.context, (_context1, _context2)) + + def _should_not_change(self, comp): + # Be sure that none of the underlying structures + # get told that they have changed during this process + # because that invalidates caches. + def no_changes(*args): + self.fail("Nothing should get changed") + comp.changed = no_changes + comp.adapters.changed = no_changes + comp.adapters._v_lookup.changed = no_changes + + def test_getMultiAdapter_hit_super(self): + from zope.interface import Interface + from zope.interface.declarations import implementer + + class IBase(Interface): + pass + + class IDerived(IBase): + pass + + class IFoo(Interface): + pass + + @implementer(IBase) + class Base: + pass + + @implementer(IDerived) + class Derived(Base): + pass + + class AdapterBase: + def __init__(self, context1, context2): + self.context1 = context1 + self.context2 = context2 + + class AdapterDerived(AdapterBase): + pass + + comp = self._makeOne() + comp.registerAdapter(AdapterDerived, (IDerived, IDerived), IFoo) + comp.registerAdapter(AdapterBase, (IBase, IDerived), IFoo) + self._should_not_change(comp) + + derived = Derived() + adapter = comp.getMultiAdapter((derived, derived), IFoo) + self.assertIsInstance(adapter, AdapterDerived) + self.assertIs(adapter.context1, derived) + self.assertIs(adapter.context2, derived) + + supe = super(Derived, derived) + adapter = comp.getMultiAdapter((supe, derived), IFoo) + self.assertIsInstance(adapter, AdapterBase) + self.assertNotIsInstance(adapter, AdapterDerived) + self.assertIs(adapter.context1, derived) + self.assertIs(adapter.context2, derived) + + def test_getAdapters_empty(self): + from zope.interface.declarations import InterfaceClass + from zope.interface.declarations import implementer + + class IFoo(InterfaceClass): + pass + + ifoo = IFoo('IFoo') + ibar = IFoo('IBar') + ibaz = IFoo('IBaz') + + @implementer(ibar) + class _Context1: + pass + + @implementer(ibaz) + class _Context2: + pass + + _context1 = _Context1() + _context2 = _Context2() + comp = self._makeOne() + self.assertEqual( + list(comp.getAdapters((_context1, _context2), ifoo)), []) + + def test_getAdapters_factory_returns_None(self): + from zope.interface.declarations import InterfaceClass + from zope.interface.declarations import implementer + + class IFoo(InterfaceClass): + pass + + ifoo = IFoo('IFoo') + ibar = IFoo('IBar') + ibaz = IFoo('IBaz') + + @implementer(ibar) + class _Context1: + pass + + @implementer(ibaz) + class _Context2: + pass + + _context1 = _Context1() + _context2 = _Context2() + comp = self._makeOne() + _called_with = [] + + def _side_effect_only(context1, context2): + _called_with.append((context1, context2)) + return None + + comp.registerAdapter(_side_effect_only, (ibar, ibaz), ifoo) + self.assertEqual( + list(comp.getAdapters((_context1, _context2), ifoo)), []) + self.assertEqual(_called_with, [(_context1, _context2)]) + + def test_getAdapters_non_empty(self): + from zope.interface.declarations import InterfaceClass + from zope.interface.declarations import implementer + + class IFoo(InterfaceClass): + pass + + ifoo = IFoo('IFoo') + ibar = IFoo('IBar') + ibaz = IFoo('IBaz') + + @implementer(ibar) + class _Context1: + pass + + @implementer(ibaz) + class _Context2: + pass + + _context1 = _Context1() + _context2 = _Context2() + + class _Factory1: + def __init__(self, context1, context2): + self.context = context1, context2 + + class _Factory2: + def __init__(self, context1, context2): + self.context = context1, context2 + + _name1 = 'name1' + _name2 = 'name2' + comp = self._makeOne() + comp.registerAdapter(_Factory1, (ibar, ibaz), ifoo, name=_name1) + comp.registerAdapter(_Factory2, (ibar, ibaz), ifoo, name=_name2) + found = sorted(comp.getAdapters((_context1, _context2), ifoo)) + self.assertEqual(len(found), 2) + self.assertEqual(found[0][0], _name1) + self.assertIsInstance(found[0][1], _Factory1) + self.assertEqual(found[1][0], _name2) + self.assertIsInstance(found[1][1], _Factory2) + + def test_registerSubscriptionAdapter_w_nonblank_name(self): + from zope.interface.declarations import InterfaceClass + + class IFoo(InterfaceClass): + pass + + ifoo = IFoo('IFoo') + ibar = IFoo('IBar') + _name = 'name' + _info = 'info' + + def _factory(context): + raise NotImplementedError() + + comp = self._makeOne() + self.assertRaises(TypeError, comp.registerSubscriptionAdapter, + _factory, (ibar,), ifoo, _name, _info) + + def test_registerSubscriptionAdapter_w_explicit_provided_n_required(self): + from zope.interface.declarations import InterfaceClass + from zope.interface.interfaces import Registered + from zope.interface.registry import SubscriptionRegistration + + class IFoo(InterfaceClass): + pass + + ifoo = IFoo('IFoo') + ibar = IFoo('IBar') + _blank = '' + _info = 'info' + + def _factory(context): + raise NotImplementedError() + + comp = self._makeOne() + _monkey, _events = self._wrapEvents() + with _monkey: + comp.registerSubscriptionAdapter(_factory, (ibar,), ifoo, + info=_info) + reg = comp.adapters._subscribers[1][ibar][ifoo][_blank] + self.assertEqual(len(reg), 1) + self.assertIs(reg[0], _factory) + self.assertEqual(comp._subscription_registrations, + [((ibar,), ifoo, _blank, _factory, _info)]) + self.assertEqual(len(_events), 1) + args, kw = _events[0] + event, = args + self.assertEqual(kw, {}) + self.assertIsInstance(event, Registered) + self.assertIsInstance(event.object, SubscriptionRegistration) + self.assertIs(event.object.registry, comp) + self.assertIs(event.object.provided, ifoo) + self.assertEqual(event.object.required, (ibar,)) + self.assertEqual(event.object.name, _blank) + self.assertIs(event.object.info, _info) + self.assertIs(event.object.factory, _factory) + + def test_registerSubscriptionAdapter_wo_explicit_provided(self): + from zope.interface.declarations import InterfaceClass + from zope.interface.declarations import implementer + from zope.interface.interfaces import Registered + from zope.interface.registry import SubscriptionRegistration + + class IFoo(InterfaceClass): + pass + + ifoo = IFoo('IFoo') + ibar = IFoo('IBar') + _info = 'info' + _blank = '' + + @implementer(ifoo) + class _Factory: + pass + + comp = self._makeOne() + _monkey, _events = self._wrapEvents() + with _monkey: + comp.registerSubscriptionAdapter(_Factory, (ibar,), info=_info) + reg = comp.adapters._subscribers[1][ibar][ifoo][_blank] + self.assertEqual(len(reg), 1) + self.assertIs(reg[0], _Factory) + self.assertEqual(comp._subscription_registrations, + [((ibar,), ifoo, _blank, _Factory, _info)]) + self.assertEqual(len(_events), 1) + args, kw = _events[0] + event, = args + self.assertEqual(kw, {}) + self.assertIsInstance(event, Registered) + self.assertIsInstance(event.object, SubscriptionRegistration) + self.assertIs(event.object.registry, comp) + self.assertIs(event.object.provided, ifoo) + self.assertEqual(event.object.required, (ibar,)) + self.assertEqual(event.object.name, _blank) + self.assertIs(event.object.info, _info) + self.assertIs(event.object.factory, _Factory) + + def test_registerSubscriptionAdapter_wo_explicit_required(self): + from zope.interface.declarations import InterfaceClass + from zope.interface.interfaces import Registered + from zope.interface.registry import SubscriptionRegistration + + class IFoo(InterfaceClass): + pass + + ifoo = IFoo('IFoo') + ibar = IFoo('IBar') + _info = 'info' + _blank = '' + + class _Factory: + __component_adapts__ = (ibar,) + + comp = self._makeOne() + _monkey, _events = self._wrapEvents() + with _monkey: + comp.registerSubscriptionAdapter( + _Factory, provided=ifoo, info=_info, + ) + reg = comp.adapters._subscribers[1][ibar][ifoo][_blank] + self.assertEqual(len(reg), 1) + self.assertIs(reg[0], _Factory) + self.assertEqual(comp._subscription_registrations, + [((ibar,), ifoo, _blank, _Factory, _info)]) + self.assertEqual(len(_events), 1) + args, kw = _events[0] + event, = args + self.assertEqual(kw, {}) + self.assertIsInstance(event, Registered) + self.assertIsInstance(event.object, SubscriptionRegistration) + self.assertIs(event.object.registry, comp) + self.assertIs(event.object.provided, ifoo) + self.assertEqual(event.object.required, (ibar,)) + self.assertEqual(event.object.name, _blank) + self.assertIs(event.object.info, _info) + self.assertIs(event.object.factory, _Factory) + + def test_registerSubscriptionAdapter_wo_event(self): + from zope.interface.declarations import InterfaceClass + + class IFoo(InterfaceClass): + pass + + ifoo = IFoo('IFoo') + ibar = IFoo('IBar') + _info = 'info' + + def _factory(context): + raise NotImplementedError() + + comp = self._makeOne() + _monkey, _events = self._wrapEvents() + with _monkey: + comp.registerSubscriptionAdapter(_factory, (ibar,), ifoo, + info=_info, event=False) + self.assertEqual(len(_events), 0) + + def test_registeredSubscriptionAdapters_empty(self): + comp = self._makeOne() + self.assertEqual(list(comp.registeredSubscriptionAdapters()), []) + + def test_registeredSubscriptionAdapters_notempty(self): + from zope.interface.declarations import InterfaceClass + from zope.interface.registry import SubscriptionRegistration + + class IFoo(InterfaceClass): + pass + + ifoo = IFoo('IFoo') + ibar = IFoo('IFoo') + _info = 'info' + _blank = '' + + class _Factory: + pass + + comp = self._makeOne() + comp.registerSubscriptionAdapter(_Factory, (ibar,), ifoo, info=_info) + comp.registerSubscriptionAdapter(_Factory, (ibar,), ifoo, info=_info) + reg = list(comp.registeredSubscriptionAdapters()) + self.assertEqual(len(reg), 2) + self.assertIsInstance(reg[0], SubscriptionRegistration) + self.assertIs(reg[0].registry, comp) + self.assertIs(reg[0].provided, ifoo) + self.assertEqual(reg[0].required, (ibar,)) + self.assertEqual(reg[0].name, _blank) + self.assertIs(reg[0].info, _info) + self.assertIs(reg[0].factory, _Factory) + self.assertIsInstance(reg[1], SubscriptionRegistration) + self.assertIs(reg[1].registry, comp) + self.assertIs(reg[1].provided, ifoo) + self.assertEqual(reg[1].required, (ibar,)) + self.assertEqual(reg[1].name, _blank) + self.assertIs(reg[1].info, _info) + self.assertIs(reg[1].factory, _Factory) + + def test_unregisterSubscriptionAdapter_w_nonblank_name(self): + from zope.interface.declarations import InterfaceClass + + class IFoo(InterfaceClass): + pass + + ifoo = IFoo('IFoo') + ibar = IFoo('IBar') + _nonblank = 'nonblank' + comp = self._makeOne() + self.assertRaises(TypeError, comp.unregisterSubscriptionAdapter, + required=ifoo, provided=ibar, name=_nonblank) + + def test_unregisterSubscriptionAdapter_neither_factory_nor_provided(self): + comp = self._makeOne() + self.assertRaises(TypeError, comp.unregisterSubscriptionAdapter, + factory=None, provided=None) + + def test_unregisterSubscriptionAdapter_neither_factory_nor_required(self): + from zope.interface.declarations import InterfaceClass + + class IFoo(InterfaceClass): + pass + + ifoo = IFoo('IFoo') + comp = self._makeOne() + self.assertRaises(TypeError, comp.unregisterSubscriptionAdapter, + factory=None, provided=ifoo, required=None) + + def test_unregisterSubscriptionAdapter_miss(self): + from zope.interface.declarations import InterfaceClass + + class IFoo(InterfaceClass): + pass + + ifoo = IFoo('IFoo') + ibar = IFoo('IBar') + + class _Factory: + pass + + comp = self._makeOne() + _monkey, _events = self._wrapEvents() + with _monkey: + unreg = comp.unregisterSubscriptionAdapter(_Factory, (ibar,), ifoo) + self.assertFalse(unreg) + self.assertFalse(_events) + + def test_unregisterSubscriptionAdapter_hit_wo_factory(self): + from zope.interface.declarations import InterfaceClass + from zope.interface.interfaces import Unregistered + from zope.interface.registry import SubscriptionRegistration + + class IFoo(InterfaceClass): + pass + + ifoo = IFoo('IFoo') + ibar = IFoo('IBar') + + class _Factory: + pass + + comp = self._makeOne() + comp.registerSubscriptionAdapter(_Factory, (ibar,), ifoo) + _monkey, _events = self._wrapEvents() + with _monkey: + unreg = comp.unregisterSubscriptionAdapter(None, (ibar,), ifoo) + self.assertTrue(unreg) + self.assertFalse(comp.adapters._subscribers) + self.assertFalse(comp._subscription_registrations) + self.assertEqual(len(_events), 1) + args, kw = _events[0] + event, = args + self.assertEqual(kw, {}) + self.assertIsInstance(event, Unregistered) + self.assertIsInstance(event.object, SubscriptionRegistration) + self.assertIs(event.object.registry, comp) + self.assertIs(event.object.provided, ifoo) + self.assertEqual(event.object.required, (ibar,)) + self.assertEqual(event.object.name, '') + self.assertEqual(event.object.info, '') + self.assertIsNone(event.object.factory) + + def test_unregisterSubscriptionAdapter_hit_w_factory(self): + from zope.interface.declarations import InterfaceClass + from zope.interface.interfaces import Unregistered + from zope.interface.registry import SubscriptionRegistration + + class IFoo(InterfaceClass): + pass + + ifoo = IFoo('IFoo') + ibar = IFoo('IBar') + + class _Factory: + pass + + comp = self._makeOne() + comp.registerSubscriptionAdapter(_Factory, (ibar,), ifoo) + _monkey, _events = self._wrapEvents() + with _monkey: + unreg = comp.unregisterSubscriptionAdapter(_Factory, (ibar,), ifoo) + self.assertTrue(unreg) + self.assertFalse(comp.adapters._subscribers) + self.assertFalse(comp._subscription_registrations) + self.assertEqual(len(_events), 1) + args, kw = _events[0] + event, = args + self.assertEqual(kw, {}) + self.assertIsInstance(event, Unregistered) + self.assertIsInstance(event.object, SubscriptionRegistration) + self.assertIs(event.object.registry, comp) + self.assertIs(event.object.provided, ifoo) + self.assertEqual(event.object.required, (ibar,)) + self.assertEqual(event.object.name, '') + self.assertEqual(event.object.info, '') + self.assertIs(event.object.factory, _Factory) + + def test_unregisterSubscriptionAdapter_wo_explicit_provided(self): + from zope.interface.declarations import InterfaceClass + from zope.interface.declarations import implementer + from zope.interface.interfaces import Unregistered + from zope.interface.registry import SubscriptionRegistration + + class IFoo(InterfaceClass): + pass + + ifoo = IFoo('IFoo') + ibar = IFoo('IBar') + + @implementer(ifoo) + class _Factory: + pass + + comp = self._makeOne() + comp.registerSubscriptionAdapter(_Factory, (ibar,), ifoo) + _monkey, _events = self._wrapEvents() + with _monkey: + unreg = comp.unregisterSubscriptionAdapter(_Factory, (ibar,)) + self.assertTrue(unreg) + self.assertEqual(len(_events), 1) + args, kw = _events[0] + event, = args + self.assertEqual(kw, {}) + self.assertIsInstance(event, Unregistered) + self.assertIsInstance(event.object, SubscriptionRegistration) + self.assertIs(event.object.registry, comp) + self.assertIs(event.object.provided, ifoo) + self.assertEqual(event.object.required, (ibar,)) + self.assertEqual(event.object.name, '') + self.assertEqual(event.object.info, '') + self.assertIs(event.object.factory, _Factory) + + def test_unregisterSubscriptionAdapter_wo_explicit_required(self): + from zope.interface.declarations import InterfaceClass + from zope.interface.interfaces import Unregistered + from zope.interface.registry import SubscriptionRegistration + + class IFoo(InterfaceClass): + pass + + ifoo = IFoo('IFoo') + ibar = IFoo('IBar') + + class _Factory: + __component_adapts__ = (ibar,) + + comp = self._makeOne() + comp.registerSubscriptionAdapter(_Factory, (ibar,), ifoo) + _monkey, _events = self._wrapEvents() + with _monkey: + unreg = comp.unregisterSubscriptionAdapter(_Factory, provided=ifoo) + self.assertTrue(unreg) + self.assertEqual(len(_events), 1) + args, kw = _events[0] + event, = args + self.assertEqual(kw, {}) + self.assertIsInstance(event, Unregistered) + self.assertIsInstance(event.object, SubscriptionRegistration) + self.assertIs(event.object.registry, comp) + self.assertIs(event.object.provided, ifoo) + self.assertEqual(event.object.required, (ibar,)) + self.assertEqual(event.object.name, '') + self.assertEqual(event.object.info, '') + self.assertIs(event.object.factory, _Factory) + + def test_subscribers_empty(self): + from zope.interface.declarations import InterfaceClass + from zope.interface.declarations import implementer + + class IFoo(InterfaceClass): + pass + + ifoo = IFoo('IFoo') + ibar = IFoo('IBar') + comp = self._makeOne() + + @implementer(ibar) + class Bar: + pass + + bar = Bar() + self.assertEqual(list(comp.subscribers((bar,), ifoo)), []) + + def test_subscribers_non_empty(self): + from zope.interface.declarations import InterfaceClass + from zope.interface.declarations import implementer + + class IFoo(InterfaceClass): + pass + + ifoo = IFoo('IFoo') + ibar = IFoo('IBar') + + class _Factory: + __component_adapts__ = (ibar,) + + def __init__(self, context): + self._context = context + + class _Derived(_Factory): + pass + + comp = self._makeOne() + comp.registerSubscriptionAdapter(_Factory, (ibar,), ifoo) + comp.registerSubscriptionAdapter(_Derived, (ibar,), ifoo) + + @implementer(ibar) + class Bar: + pass + + bar = Bar() + subscribers = comp.subscribers((bar,), ifoo) + + def _klassname(x): + return x.__class__.__name__ + + subscribers = sorted(subscribers, key=_klassname) + self.assertEqual(len(subscribers), 2) + self.assertIsInstance(subscribers[0], _Derived) + self.assertIsInstance(subscribers[1], _Factory) + + def test_registerHandler_w_nonblank_name(self): + from zope.interface.declarations import InterfaceClass + + class IFoo(InterfaceClass): + pass + + ifoo = IFoo('IFoo') + _nonblank = 'nonblank' + comp = self._makeOne() + + def _factory(context): + raise NotImplementedError() + + self.assertRaises(TypeError, comp.registerHandler, _factory, + required=ifoo, name=_nonblank) + + def test_registerHandler_w_explicit_required(self): + from zope.interface.declarations import InterfaceClass + from zope.interface.interfaces import Registered + from zope.interface.registry import HandlerRegistration + + class IFoo(InterfaceClass): + pass + + ifoo = IFoo('IFoo') + _blank = '' + _info = 'info' + + def _factory(context): + raise NotImplementedError() + + comp = self._makeOne() + _monkey, _events = self._wrapEvents() + with _monkey: + comp.registerHandler(_factory, (ifoo,), info=_info) + reg = comp.adapters._subscribers[1][ifoo][None][_blank] + self.assertEqual(len(reg), 1) + self.assertIs(reg[0], _factory) + self.assertEqual(comp._handler_registrations, + [((ifoo,), _blank, _factory, _info)]) + self.assertEqual(len(_events), 1) + args, kw = _events[0] + event, = args + self.assertEqual(kw, {}) + self.assertIsInstance(event, Registered) + self.assertIsInstance(event.object, HandlerRegistration) + self.assertIs(event.object.registry, comp) + self.assertEqual(event.object.required, (ifoo,)) + self.assertEqual(event.object.name, _blank) + self.assertIs(event.object.info, _info) + self.assertIs(event.object.factory, _factory) + + def test_registerHandler_wo_explicit_required_no_event(self): + from zope.interface.declarations import InterfaceClass + + class IFoo(InterfaceClass): + pass + + ifoo = IFoo('IFoo') + _info = 'info' + _blank = '' + + class _Factory: + __component_adapts__ = (ifoo,) + pass + + comp = self._makeOne() + _monkey, _events = self._wrapEvents() + with _monkey: + comp.registerHandler(_Factory, info=_info, event=False) + reg = comp.adapters._subscribers[1][ifoo][None][_blank] + self.assertEqual(len(reg), 1) + self.assertIs(reg[0], _Factory) + self.assertEqual(comp._handler_registrations, + [((ifoo,), _blank, _Factory, _info)]) + self.assertEqual(len(_events), 0) + + def test_registeredHandlers_empty(self): + comp = self._makeOne() + self.assertFalse(list(comp.registeredHandlers())) + + def test_registeredHandlers_non_empty(self): + from zope.interface.declarations import InterfaceClass + from zope.interface.registry import HandlerRegistration + + class IFoo(InterfaceClass): + pass + + ifoo = IFoo('IFoo') + + def _factory1(context): + raise NotImplementedError() + + def _factory2(context): + raise NotImplementedError() + + comp = self._makeOne() + comp.registerHandler(_factory1, (ifoo,)) + comp.registerHandler(_factory2, (ifoo,)) + + def _factory_name(x): + return x.factory.__code__.co_name + + subscribers = sorted(comp.registeredHandlers(), key=_factory_name) + self.assertEqual(len(subscribers), 2) + self.assertIsInstance(subscribers[0], HandlerRegistration) + self.assertEqual(subscribers[0].required, (ifoo,)) + self.assertEqual(subscribers[0].name, '') + self.assertEqual(subscribers[0].factory, _factory1) + self.assertEqual(subscribers[0].info, '') + self.assertIsInstance(subscribers[1], HandlerRegistration) + self.assertEqual(subscribers[1].required, (ifoo,)) + self.assertEqual(subscribers[1].name, '') + self.assertEqual(subscribers[1].factory, _factory2) + self.assertEqual(subscribers[1].info, '') + + def test_unregisterHandler_w_nonblank_name(self): + from zope.interface.declarations import InterfaceClass + + class IFoo(InterfaceClass): + pass + + ifoo = IFoo('IFoo') + _nonblank = 'nonblank' + comp = self._makeOne() + self.assertRaises(TypeError, comp.unregisterHandler, + required=(ifoo,), name=_nonblank) + + def test_unregisterHandler_neither_factory_nor_required(self): + comp = self._makeOne() + self.assertRaises(TypeError, comp.unregisterHandler) + + def test_unregisterHandler_miss(self): + from zope.interface.declarations import InterfaceClass + + class IFoo(InterfaceClass): + pass + + ifoo = IFoo('IFoo') + comp = self._makeOne() + unreg = comp.unregisterHandler(required=(ifoo,)) + self.assertFalse(unreg) + + def test_unregisterHandler_hit_w_factory_and_explicit_provided(self): + from zope.interface.declarations import InterfaceClass + from zope.interface.interfaces import Unregistered + from zope.interface.registry import HandlerRegistration + + class IFoo(InterfaceClass): + pass + + ifoo = IFoo('IFoo') + comp = self._makeOne() + + def _factory(context): + raise NotImplementedError() + + comp = self._makeOne() + comp.registerHandler(_factory, (ifoo,)) + _monkey, _events = self._wrapEvents() + with _monkey: + unreg = comp.unregisterHandler(_factory, (ifoo,)) + self.assertTrue(unreg) + self.assertEqual(len(_events), 1) + args, kw = _events[0] + event, = args + self.assertEqual(kw, {}) + self.assertIsInstance(event, Unregistered) + self.assertIsInstance(event.object, HandlerRegistration) + self.assertIs(event.object.registry, comp) + self.assertEqual(event.object.required, (ifoo,)) + self.assertEqual(event.object.name, '') + self.assertIs(event.object.factory, _factory) + + def test_unregisterHandler_hit_w_only_explicit_provided(self): + from zope.interface.declarations import InterfaceClass + from zope.interface.interfaces import Unregistered + from zope.interface.registry import HandlerRegistration + + class IFoo(InterfaceClass): + pass + + ifoo = IFoo('IFoo') + comp = self._makeOne() + + def _factory(context): + raise NotImplementedError() + + comp = self._makeOne() + comp.registerHandler(_factory, (ifoo,)) + _monkey, _events = self._wrapEvents() + with _monkey: + unreg = comp.unregisterHandler(required=(ifoo,)) + self.assertTrue(unreg) + self.assertEqual(len(_events), 1) + args, kw = _events[0] + event, = args + self.assertEqual(kw, {}) + self.assertIsInstance(event, Unregistered) + self.assertIsInstance(event.object, HandlerRegistration) + self.assertIs(event.object.registry, comp) + self.assertEqual(event.object.required, (ifoo,)) + self.assertEqual(event.object.name, '') + self.assertIsNone(event.object.factory) + + def test_unregisterHandler_wo_explicit_required(self): + from zope.interface.declarations import InterfaceClass + from zope.interface.interfaces import Unregistered + from zope.interface.registry import HandlerRegistration + + class IFoo(InterfaceClass): + pass + + ifoo = IFoo('IFoo') + + class _Factory: + __component_adapts__ = (ifoo,) + + comp = self._makeOne() + comp.registerHandler(_Factory) + _monkey, _events = self._wrapEvents() + with _monkey: + unreg = comp.unregisterHandler(_Factory) + self.assertTrue(unreg) + self.assertEqual(len(_events), 1) + args, kw = _events[0] + event, = args + self.assertEqual(kw, {}) + self.assertIsInstance(event, Unregistered) + self.assertIsInstance(event.object, HandlerRegistration) + self.assertIs(event.object.registry, comp) + self.assertEqual(event.object.required, (ifoo,)) + self.assertEqual(event.object.name, '') + self.assertEqual(event.object.info, '') + self.assertIs(event.object.factory, _Factory) + + def test_handle_empty(self): + from zope.interface.declarations import InterfaceClass + from zope.interface.declarations import implementer + + class IFoo(InterfaceClass): + pass + + ifoo = IFoo('IFoo') + comp = self._makeOne() + + @implementer(ifoo) + class Bar: + pass + + bar = Bar() + comp.handle((bar,)) # doesn't raise + + def test_handle_non_empty(self): + from zope.interface.declarations import InterfaceClass + from zope.interface.declarations import implementer + + class IFoo(InterfaceClass): + pass + + ifoo = IFoo('IFoo') + _called_1 = [] + + def _factory_1(context): + _called_1.append(context) + + _called_2 = [] + + def _factory_2(context): + _called_2.append(context) + + comp = self._makeOne() + comp.registerHandler(_factory_1, (ifoo,)) + comp.registerHandler(_factory_2, (ifoo,)) + + @implementer(ifoo) + class Bar: + pass + + bar = Bar() + comp.handle(bar) + self.assertEqual(_called_1, [bar]) + self.assertEqual(_called_2, [bar]) + + def test_register_unregister_identical_objects_provided( + self, identical=True, + ): + # https://github.com/zopefoundation/zope.interface/issues/227 + class IFoo(Interface): + pass + + comp = self._makeOne() + first = object() + second = first if identical else object() + + comp.registerUtility(first, provided=IFoo) + comp.registerUtility(second, provided=IFoo, name='bar') + + self.assertEqual(len(comp.utilities._subscribers), 1) + self.assertEqual(comp.utilities._subscribers, [{ + IFoo: {'': (first, ) if identical else (first, second)} + }]) + self.assertEqual(comp.utilities._provided, { + IFoo: 3 if identical else 4 + }) + + res = comp.unregisterUtility(first, provided=IFoo) + self.assertTrue(res) + res = comp.unregisterUtility(second, provided=IFoo, name='bar') + self.assertTrue(res) + + self.assertEqual(comp.utilities._provided, {}) + self.assertEqual(len(comp.utilities._subscribers), 0) + + def test_register_unregister_nonequal_objects_provided(self): + self.test_register_unregister_identical_objects_provided( + identical=False, + ) + + def test_rebuildUtilityRegistryFromLocalCache(self): + + class IFoo(Interface): + "Does nothing" + + class UtilityImplementingFoo: + "Does nothing" + + comps = self._makeOne() + + for i in range(30): + comps.registerUtility( + UtilityImplementingFoo(), IFoo, name=f'{i}' + ) + + orig_generation = comps.utilities._generation + + orig_adapters = comps.utilities._adapters + self.assertEqual(len(orig_adapters), 1) + self.assertEqual(len(orig_adapters[0]), 1) + self.assertEqual(len(orig_adapters[0][IFoo]), 30) + + orig_subscribers = comps.utilities._subscribers + self.assertEqual(len(orig_subscribers), 1) + self.assertEqual(len(orig_subscribers[0]), 1) + self.assertEqual(len(orig_subscribers[0][IFoo]), 1) + self.assertEqual(len(orig_subscribers[0][IFoo]['']), 30) + + # Blow a bunch of them away, creating artificial corruption + new_adapters = comps.utilities._adapters = type(orig_adapters)() + new_adapters.append({}) + d = new_adapters[0][IFoo] = {} + for name in range(10): + name = str(str(name)) + d[name] = orig_adapters[0][IFoo][name] + + self.assertNotEqual(orig_adapters, new_adapters) + + new_subs = comps.utilities._subscribers = type(orig_subscribers)() + new_subs.append({}) + d = new_subs[0][IFoo] = {} + d[''] = () + + for name in range(5, 12): # 12 - 5 = 7 + name = str(str(name)) + comp = orig_adapters[0][IFoo][name] + d[''] += (comp,) + + # We can preflight (by default) and nothing changes + rebuild_preflight = comps.rebuildUtilityRegistryFromLocalCache() + + self.assertEqual(comps.utilities._generation, orig_generation) + self.assertEqual(rebuild_preflight, { + 'did_not_register': 10, + 'needed_registered': 20, + + 'did_not_subscribe': 7, + 'needed_subscribed': 23, + }) + + # Now for real + rebuild_results = comps.rebuildUtilityRegistryFromLocalCache( + rebuild=True, + ) + + # The generation only got incremented once + self.assertEqual(comps.utilities._generation, orig_generation + 1) + # The result was the same + self.assertEqual(rebuild_preflight, rebuild_results) + self.assertEqual(new_adapters, orig_adapters) + self.assertEqual( + len(new_subs[0][IFoo]['']), + len(orig_subscribers[0][IFoo][''])) + + for orig_subscriber in orig_subscribers[0][IFoo]['']: + self.assertIn(orig_subscriber, new_subs[0][IFoo]['']) + + # Preflighting, rebuilding again produce no changes. + preflight_after = comps.rebuildUtilityRegistryFromLocalCache() + self.assertEqual(preflight_after, { + 'did_not_register': 30, + 'needed_registered': 0, + + 'did_not_subscribe': 30, + 'needed_subscribed': 0, + }) + + rebuild_after = comps.rebuildUtilityRegistryFromLocalCache( + rebuild=True, + ) + self.assertEqual(rebuild_after, preflight_after) + self.assertEqual(comps.utilities._generation, orig_generation + 1) + + +class UnhashableComponentsTests(ComponentsTests): + + def _getTargetClass(self): + # Mimic what pyramid does to create an unhashable + # registry + + class Components( + super(UnhashableComponentsTests, self)._getTargetClass(), dict, + ): + pass + + return Components + +# Test _getUtilityProvided, _getAdapterProvided, _getAdapterRequired via their +# callers (Component.registerUtility, Component.registerAdapter). + + +class UtilityRegistrationTests(unittest.TestCase): + + def _getTargetClass(self): + from zope.interface.registry import UtilityRegistration + return UtilityRegistration + + def _makeOne(self, component=None, factory=None): + from zope.interface.declarations import InterfaceClass + + class InterfaceClassSubclass(InterfaceClass): + pass + + ifoo = InterfaceClassSubclass('IFoo') + + class _Registry: + def __repr__(self): + return '_REGISTRY' + + registry = _Registry() + name = 'name' + doc = 'DOCSTRING' + klass = self._getTargetClass() + return ( + klass(registry, ifoo, name, component, doc, factory), + registry, + name, + ) + + def test_class_conforms_to_IUtilityRegistration(self): + from zope.interface.interfaces import IUtilityRegistration + from zope.interface.verify import verifyClass + verifyClass(IUtilityRegistration, self._getTargetClass()) + + def test_instance_conforms_to_IUtilityRegistration(self): + from zope.interface.interfaces import IUtilityRegistration + from zope.interface.verify import verifyObject + ur, _, _ = self._makeOne() + verifyObject(IUtilityRegistration, ur) + + def test___repr__(self): + + class _Component: + __name__ = 'TEST' + + _component = _Component() + ur, _registry, _name = self._makeOne(_component) + self.assertEqual( + repr(ur), ( + "UtilityRegistration(" + "_REGISTRY, IFoo, %r, TEST, None, 'DOCSTRING')" + ) % (_name) + ) + + def test___repr___provided_wo_name(self): + + class _Component: + def __repr__(self): + return 'TEST' + + _component = _Component() + ur, _registry, _name = self._makeOne(_component) + ur.provided = object() + self.assertEqual( + repr(ur), ( + "UtilityRegistration(" + "_REGISTRY, None, %r, TEST, None, 'DOCSTRING')" + ) % (_name) + ) + + def test___repr___component_wo_name(self): + + class _Component: + def __repr__(self): + return 'TEST' + + _component = _Component() + ur, _registry, _name = self._makeOne(_component) + ur.provided = object() + self.assertEqual( + repr(ur), ( + "UtilityRegistration(" + "_REGISTRY, None, %r, TEST, None, 'DOCSTRING')" + ) % (_name) + ) + + def test___hash__(self): + _component = object() + ur, _registry, _name = self._makeOne(_component) + self.assertEqual(ur.__hash__(), id(ur)) + + def test___eq___identity(self): + _component = object() + ur, _registry, _name = self._makeOne(_component) + self.assertEqual(ur, ur) + + def test___eq___hit(self): + _component = object() + ur, _registry, _name = self._makeOne(_component) + ur2, _, _ = self._makeOne(_component) + self.assertEqual(ur, ur2) + + def test___eq___miss(self): + _component = object() + _component2 = object() + ur, _registry, _name = self._makeOne(_component) + ur2, _, _ = self._makeOne(_component2) + self.assertNotEqual(ur, ur2) + + def test___ne___identity(self): + _component = object() + ur, _registry, _name = self._makeOne(_component) + self.assertEqual(ur, ur) + + def test___ne___hit(self): + _component = object() + ur, _registry, _name = self._makeOne(_component) + ur2, _, _ = self._makeOne(_component) + self.assertEqual(ur, ur2) + + def test___ne___miss(self): + _component = object() + _component2 = object() + ur, _registry, _name = self._makeOne(_component) + ur2, _, _ = self._makeOne(_component2) + self.assertNotEqual(ur, ur2) + + def test___lt___identity(self): + _component = object() + ur, _registry, _name = self._makeOne(_component) + self.assertFalse(ur < ur) + + def test___lt___hit(self): + _component = object() + ur, _registry, _name = self._makeOne(_component) + ur2, _, _ = self._makeOne(_component) + self.assertFalse(ur < ur2) + + def test___lt___miss(self): + _component = object() + _component2 = object() + ur, _registry, _name = self._makeOne(_component) + ur2, _, _ = self._makeOne(_component2) + ur2.name = _name + '2' + self.assertLess(ur, ur2) + + def test___le___identity(self): + _component = object() + ur, _registry, _name = self._makeOne(_component) + self.assertLessEqual(ur, ur) + + def test___le___hit(self): + _component = object() + ur, _registry, _name = self._makeOne(_component) + ur2, _, _ = self._makeOne(_component) + self.assertLessEqual(ur, ur2) + + def test___le___miss(self): + _component = object() + _component2 = object() + ur, _registry, _name = self._makeOne(_component) + ur2, _, _ = self._makeOne(_component2) + ur2.name = _name + '2' + self.assertLessEqual(ur, ur2) + + def test___gt___identity(self): + _component = object() + ur, _registry, _name = self._makeOne(_component) + self.assertFalse(ur > ur) + + def test___gt___hit(self): + _component = object() + _component2 = object() + ur, _registry, _name = self._makeOne(_component) + ur2, _, _ = self._makeOne(_component2) + ur2.name = _name + '2' + self.assertGreater(ur2, ur) + + def test___gt___miss(self): + _component = object() + ur, _registry, _name = self._makeOne(_component) + ur2, _, _ = self._makeOne(_component) + self.assertFalse(ur2 > ur) + + def test___ge___identity(self): + _component = object() + ur, _registry, _name = self._makeOne(_component) + self.assertGreaterEqual(ur, ur) + + def test___ge___miss(self): + _component = object() + _component2 = object() + ur, _registry, _name = self._makeOne(_component) + ur2, _, _ = self._makeOne(_component2) + ur2.name = _name + '2' + self.assertFalse(ur >= ur2) + + def test___ge___hit(self): + _component = object() + ur, _registry, _name = self._makeOne(_component) + ur2, _, _ = self._makeOne(_component) + ur2.name = _name + '2' + self.assertGreaterEqual(ur2, ur) + + +class AdapterRegistrationTests(unittest.TestCase): + + def _getTargetClass(self): + from zope.interface.registry import AdapterRegistration + return AdapterRegistration + + def _makeOne(self, component=None): + from zope.interface.declarations import InterfaceClass + + class IFoo(InterfaceClass): + pass + + ifoo = IFoo('IFoo') + ibar = IFoo('IBar') + + class _Registry: + def __repr__(self): + return '_REGISTRY' + + registry = _Registry() + name = 'name' + doc = 'DOCSTRING' + klass = self._getTargetClass() + return ( + klass(registry, (ibar,), ifoo, name, component, doc), + registry, + name, + ) + + def test_class_conforms_to_IAdapterRegistration(self): + from zope.interface.interfaces import IAdapterRegistration + from zope.interface.verify import verifyClass + verifyClass(IAdapterRegistration, self._getTargetClass()) + + def test_instance_conforms_to_IAdapterRegistration(self): + from zope.interface.interfaces import IAdapterRegistration + from zope.interface.verify import verifyObject + ar, _, _ = self._makeOne() + verifyObject(IAdapterRegistration, ar) + + def test___repr__(self): + + class _Component: + __name__ = 'TEST' + + _component = _Component() + ar, _registry, _name = self._makeOne(_component) + self.assertEqual( + repr(ar), ( + "AdapterRegistration(_REGISTRY, [IBar], IFoo, %r, TEST, " + "'DOCSTRING')" + ) % (_name) + ) + + def test___repr___provided_wo_name(self): + + class _Component: + def __repr__(self): + return 'TEST' + + _component = _Component() + ar, _registry, _name = self._makeOne(_component) + ar.provided = object() + self.assertEqual( + repr(ar), ( + "AdapterRegistration(_REGISTRY, [IBar], None, %r, TEST, " + "'DOCSTRING')" + ) % (_name) + ) + + def test___repr___component_wo_name(self): + + class _Component: + def __repr__(self): + return 'TEST' + + _component = _Component() + ar, _registry, _name = self._makeOne(_component) + ar.provided = object() + self.assertEqual( + repr(ar), ( + "AdapterRegistration(_REGISTRY, [IBar], None, %r, TEST, " + "'DOCSTRING')" + ) % (_name) + ) + + def test___hash__(self): + _component = object() + ar, _registry, _name = self._makeOne(_component) + self.assertEqual(ar.__hash__(), id(ar)) + + def test___eq___identity(self): + _component = object() + ar, _registry, _name = self._makeOne(_component) + self.assertEqual(ar, ar) + + def test___eq___hit(self): + _component = object() + ar, _registry, _name = self._makeOne(_component) + ar2, _, _ = self._makeOne(_component) + self.assertEqual(ar, ar2) + + def test___eq___miss(self): + _component = object() + _component2 = object() + ar, _registry, _name = self._makeOne(_component) + ar2, _, _ = self._makeOne(_component2) + self.assertNotEqual(ar, ar2) + + def test___ne___identity(self): + _component = object() + ar, _registry, _name = self._makeOne(_component) + self.assertEqual(ar, ar) + + def test___ne___miss(self): + _component = object() + ar, _registry, _name = self._makeOne(_component) + ar2, _, _ = self._makeOne(_component) + self.assertEqual(ar, ar2) + + def test___ne___hit_component(self): + _component = object() + _component2 = object() + ar, _registry, _name = self._makeOne(_component) + ar2, _, _ = self._makeOne(_component2) + self.assertNotEqual(ar, ar2) + + def test___ne___hit_provided(self): + from zope.interface.declarations import InterfaceClass + + class IFoo(InterfaceClass): + pass + + ibaz = IFoo('IBaz') + _component = object() + ar, _registry, _name = self._makeOne(_component) + ar2, _, _ = self._makeOne(_component) + ar2.provided = ibaz + self.assertNotEqual(ar, ar2) + + def test___ne___hit_required(self): + from zope.interface.declarations import InterfaceClass + + class IFoo(InterfaceClass): + pass + + ibaz = IFoo('IBaz') + _component = object() + _component2 = object() + ar, _registry, _name = self._makeOne(_component) + ar2, _, _ = self._makeOne(_component2) + ar2.required = (ibaz,) + self.assertNotEqual(ar, ar2) + + def test___lt___identity(self): + _component = object() + ar, _registry, _name = self._makeOne(_component) + self.assertFalse(ar < ar) + + def test___lt___hit(self): + _component = object() + ar, _registry, _name = self._makeOne(_component) + ar2, _, _ = self._makeOne(_component) + self.assertFalse(ar < ar2) + + def test___lt___miss(self): + _component = object() + _component2 = object() + ar, _registry, _name = self._makeOne(_component) + ar2, _, _ = self._makeOne(_component2) + ar2.name = _name + '2' + self.assertLess(ar, ar2) + + def test___le___identity(self): + _component = object() + ar, _registry, _name = self._makeOne(_component) + self.assertLessEqual(ar, ar) + + def test___le___hit(self): + _component = object() + ar, _registry, _name = self._makeOne(_component) + ar2, _, _ = self._makeOne(_component) + self.assertLessEqual(ar, ar2) + + def test___le___miss(self): + _component = object() + _component2 = object() + ar, _registry, _name = self._makeOne(_component) + ar2, _, _ = self._makeOne(_component2) + ar2.name = _name + '2' + self.assertLessEqual(ar, ar2) + + def test___gt___identity(self): + _component = object() + ar, _registry, _name = self._makeOne(_component) + self.assertFalse(ar > ar) + + def test___gt___hit(self): + _component = object() + _component2 = object() + ar, _registry, _name = self._makeOne(_component) + ar2, _, _ = self._makeOne(_component2) + ar2.name = _name + '2' + self.assertGreater(ar2, ar) + + def test___gt___miss(self): + _component = object() + ar, _registry, _name = self._makeOne(_component) + ar2, _, _ = self._makeOne(_component) + self.assertFalse(ar2 > ar) + + def test___ge___identity(self): + _component = object() + ar, _registry, _name = self._makeOne(_component) + self.assertGreaterEqual(ar, ar) + + def test___ge___miss(self): + _component = object() + _component2 = object() + ar, _registry, _name = self._makeOne(_component) + ar2, _, _ = self._makeOne(_component2) + ar2.name = _name + '2' + self.assertFalse(ar >= ar2) + + def test___ge___hit(self): + _component = object() + ar, _registry, _name = self._makeOne(_component) + ar2, _, _ = self._makeOne(_component) + ar2.name = _name + '2' + self.assertGreaterEqual(ar2, ar) + + +class SubscriptionRegistrationTests(unittest.TestCase): + + def _getTargetClass(self): + from zope.interface.registry import SubscriptionRegistration + return SubscriptionRegistration + + def _makeOne(self, component=None): + from zope.interface.declarations import InterfaceClass + + class IFoo(InterfaceClass): + pass + + ifoo = IFoo('IFoo') + ibar = IFoo('IBar') + + class _Registry: + def __repr__(self): # pragma: no cover + return '_REGISTRY' + + registry = _Registry() + name = 'name' + doc = 'DOCSTRING' + klass = self._getTargetClass() + return ( + klass(registry, (ibar,), ifoo, name, component, doc), + registry, + name, + ) + + def test_class_conforms_to_ISubscriptionAdapterRegistration(self): + from zope.interface.interfaces import ISubscriptionAdapterRegistration + from zope.interface.verify import verifyClass + verifyClass(ISubscriptionAdapterRegistration, self._getTargetClass()) + + def test_instance_conforms_to_ISubscriptionAdapterRegistration(self): + from zope.interface.interfaces import ISubscriptionAdapterRegistration + from zope.interface.verify import verifyObject + sar, _, _ = self._makeOne() + verifyObject(ISubscriptionAdapterRegistration, sar) + + +class HandlerRegistrationTests(unittest.TestCase): + + def _getTargetClass(self): + from zope.interface.registry import HandlerRegistration + return HandlerRegistration + + def _makeOne(self, component=None): + from zope.interface.declarations import InterfaceClass + + class IFoo(InterfaceClass): + pass + + ifoo = IFoo('IFoo') + + class _Registry: + def __repr__(self): + return '_REGISTRY' + + registry = _Registry() + name = 'name' + doc = 'DOCSTRING' + klass = self._getTargetClass() + return ( + klass(registry, (ifoo,), name, component, doc), + registry, + name, + ) + + def test_class_conforms_to_IHandlerRegistration(self): + from zope.interface.interfaces import IHandlerRegistration + from zope.interface.verify import verifyClass + verifyClass(IHandlerRegistration, self._getTargetClass()) + + def test_instance_conforms_to_IHandlerRegistration(self): + from zope.interface.interfaces import IHandlerRegistration + from zope.interface.verify import verifyObject + hr, _, _ = self._makeOne() + verifyObject(IHandlerRegistration, hr) + + def test_properties(self): + def _factory(context): + raise NotImplementedError() + hr, _, _ = self._makeOne(_factory) + self.assertIs(hr.handler, _factory) + self.assertIs(hr.factory, hr.handler) + self.assertIsNone(hr.provided) + + def test___repr___factory_w_name(self): + + class _Factory: + __name__ = 'TEST' + + hr, _registry, _name = self._makeOne(_Factory()) + self.assertEqual( + repr(hr), ( + "HandlerRegistration(_REGISTRY, [IFoo], %r, TEST, " + "'DOCSTRING')" + ) % (_name)) + + def test___repr___factory_wo_name(self): + + class _Factory: + def __repr__(self): + return 'TEST' + + hr, _registry, _name = self._makeOne(_Factory()) + self.assertEqual( + repr(hr), ( + "HandlerRegistration(_REGISTRY, [IFoo], %r, TEST, " + "'DOCSTRING')" + ) % (_name) + ) + + +class PersistentAdapterRegistry(VerifyingAdapterRegistry): + + def __getstate__(self): + state = self.__dict__.copy() + for k in list(state): + if k in self._delegated or k.startswith('_v'): + state.pop(k) + state.pop('ro', None) + return state + + def __setstate__(self, state): + bases = state.pop('__bases__', ()) + self.__dict__.update(state) + self._createLookup() + self.__bases__ = bases + self._v_lookup.changed(self) + + +class PersistentComponents(Components): + # Mimic zope.component.persistentregistry.PersistentComponents: + # we should be picklalable, but not persistent.Persistent ourself. + + def _init_registries(self): + self.adapters = PersistentAdapterRegistry() + self.utilities = PersistentAdapterRegistry() + + +class PersistentDictComponents(PersistentComponents, dict): + # Like Pyramid's Registry, we subclass Components and dict + pass + + +class PersistentComponentsDict(dict, PersistentComponents): + # Like the above, but inheritance is flipped + def __init__(self, name): + dict.__init__(self) + PersistentComponents.__init__(self, name) + + +class TestPersistentComponents(unittest.TestCase): + + def _makeOne(self): + return PersistentComponents('test') + + def _check_equality_after_pickle(self, made): + pass + + def test_pickles_empty(self): + import pickle + comp = self._makeOne() + pickle.dumps(comp) + comp2 = pickle.loads(pickle.dumps(comp)) + + self.assertEqual(comp2.__name__, 'test') + + def test_pickles_with_utility_registration(self): + import pickle + comp = self._makeOne() + utility = object() + comp.registerUtility( + utility, + Interface) + + self.assertIs(utility, + comp.getUtility(Interface)) + + comp2 = pickle.loads(pickle.dumps(comp)) + self.assertEqual(comp2.__name__, 'test') + + # The utility is still registered + self.assertIsNotNone(comp2.getUtility(Interface)) + + # We can register another one + comp2.registerUtility( + utility, + Interface) + self.assertIs(utility, + comp2.getUtility(Interface)) + + self._check_equality_after_pickle(comp2) + + +class TestPersistentDictComponents(TestPersistentComponents): + + def _getTargetClass(self): + return PersistentDictComponents + + def _makeOne(self): + comp = self._getTargetClass()(name='test') + comp['key'] = 42 + return comp + + def _check_equality_after_pickle(self, made): + self.assertIn('key', made) + self.assertEqual(made['key'], 42) + + +class TestPersistentComponentsDict(TestPersistentDictComponents): + + def _getTargetClass(self): + return PersistentComponentsDict + + +class _Monkey: + # context-manager for replacing module names in the scope of a test. + def __init__(self, module, **kw): + self.module = module + self.to_restore = {key: getattr(module, key) for key in kw} + for key, value in kw.items(): + setattr(module, key, value) + + def __enter__(self): + return self + + def __exit__(self, exc_type, exc_val, exc_tb): + for key, value in self.to_restore.items(): + setattr(self.module, key, value) diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope/interface/tests/test_ro.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope/interface/tests/test_ro.py new file mode 100644 index 0000000000000000000000000000000000000000..7cf3afdefd226f4c2561f625fc2f06d55daaefd3 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope/interface/tests/test_ro.py @@ -0,0 +1,506 @@ +############################################################################## +# +# Copyright (c) 2014 Zope Foundation and Contributors. +# All Rights Reserved. +# +# This software is subject to the provisions of the Zope Public License, +# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. +# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED +# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS +# FOR A PARTICULAR PURPOSE. +# +############################################################################## +"""Resolution ordering utility tests""" +import doctest +import re +import unittest + +import zope.testing.renormalizing + + +# pylint:disable=blacklisted-name +# pylint:disable=protected-access +# pylint:disable=attribute-defined-outside-init + +class Test__mergeOrderings(unittest.TestCase): + + def _callFUT(self, orderings): + from zope.interface.ro import _legacy_mergeOrderings + return _legacy_mergeOrderings(orderings) + + def test_empty(self): + self.assertEqual(self._callFUT([]), []) + + def test_single(self): + self.assertEqual(self._callFUT(['a', 'b', 'c']), ['a', 'b', 'c']) + + def test_w_duplicates(self): + self.assertEqual(self._callFUT([['a'], ['b', 'a']]), ['b', 'a']) + + def test_suffix_across_multiple_duplicates(self): + O1 = ['x', 'y', 'z'] + O2 = ['q', 'z'] + O3 = [1, 3, 5] + O4 = ['z'] + self.assertEqual(self._callFUT([O1, O2, O3, O4]), + ['x', 'y', 'q', 1, 3, 5, 'z']) + + +class Test__flatten(unittest.TestCase): + + def _callFUT(self, ob): + from zope.interface.ro import _legacy_flatten + return _legacy_flatten(ob) + + def test_w_empty_bases(self): + + class Foo: + pass + + foo = Foo() + foo.__bases__ = () + self.assertEqual(self._callFUT(foo), [foo]) + + def test_w_single_base(self): + + class Foo: + pass + + self.assertEqual(self._callFUT(Foo), [Foo, object]) + + def test_w_bases(self): + + class Foo: + pass + + class Bar(Foo): + pass + + self.assertEqual(self._callFUT(Bar), [Bar, Foo, object]) + + def test_w_diamond(self): + + class Foo: + pass + + class Bar(Foo): + pass + + class Baz(Foo): + pass + + class Qux(Bar, Baz): + pass + + self.assertEqual(self._callFUT(Qux), + [Qux, Bar, Foo, object, Baz, Foo, object]) + + +class Test_ro(unittest.TestCase): + maxDiff = None + + def _callFUT(self, ob, **kwargs): + from zope.interface.ro import _legacy_ro + return _legacy_ro(ob, **kwargs) + + def test_w_empty_bases(self): + + class Foo: + pass + + foo = Foo() + foo.__bases__ = () + self.assertEqual(self._callFUT(foo), [foo]) + + def test_w_single_base(self): + + class Foo: + pass + + self.assertEqual(self._callFUT(Foo), [Foo, object]) + + def test_w_bases(self): + + class Foo: + pass + + class Bar(Foo): + pass + + self.assertEqual(self._callFUT(Bar), [Bar, Foo, object]) + + def test_w_diamond(self): + + class Foo: + pass + + class Bar(Foo): + pass + + class Baz(Foo): + pass + + class Qux(Bar, Baz): + pass + + self.assertEqual(self._callFUT(Qux), + [Qux, Bar, Baz, Foo, object]) + + def _make_IOErr(self): + # This can't be done in the standard C3 ordering. + + class Foo: + def __init__(self, name, *bases): + self.__name__ = name + self.__bases__ = bases + + def __repr__(self): # pragma: no cover + return self.__name__ + + # Mimic what classImplements(IOError, IIOError) + # does. + IEx = Foo('IEx') + IStdErr = Foo('IStdErr', IEx) + IEnvErr = Foo('IEnvErr', IStdErr) + IIOErr = Foo('IIOErr', IEnvErr) + IOSErr = Foo('IOSErr', IEnvErr) + + IOErr = Foo('IOErr', IEnvErr, IIOErr, IOSErr) + return IOErr, [IOErr, IIOErr, IOSErr, IEnvErr, IStdErr, IEx] + + def test_non_orderable(self): + IOErr, bases = self._make_IOErr() + + self.assertEqual(self._callFUT(IOErr), bases) + + def test_mixed_inheritance_and_implementation(self): + # https://github.com/zopefoundation/zope.interface/issues/8 + # This test should fail, but doesn't, as described in that issue. + # pylint:disable=inherit-non-class + from zope.interface import Interface + from zope.interface import implementedBy + from zope.interface import implementer + from zope.interface import providedBy + + class IFoo(Interface): + pass + + @implementer(IFoo) + class ImplementsFoo: + pass + + class ExtendsFoo(ImplementsFoo): + pass + + class ImplementsNothing: + pass + + class ExtendsFooImplementsNothing(ExtendsFoo, ImplementsNothing): + pass + + self.assertEqual( + self._callFUT(providedBy(ExtendsFooImplementsNothing())), + [implementedBy(ExtendsFooImplementsNothing), + implementedBy(ExtendsFoo), + implementedBy(ImplementsFoo), + IFoo, + Interface, + implementedBy(ImplementsNothing), + implementedBy(object)]) + + +class C3Setting: + + def __init__(self, setting, value): + self._setting = setting + self._value = value + + def __enter__(self): + from zope.interface import ro + setattr(ro.C3, self._setting.__name__, self._value) + + def __exit__(self, t, v, tb): + from zope.interface import ro + setattr(ro.C3, self._setting.__name__, self._setting) + + +class Test_c3_ro(Test_ro): + + def setUp(self): + Test_ro.setUp(self) + from zope.testing.loggingsupport import InstalledHandler + self.log_handler = handler = InstalledHandler('zope.interface.ro') + self.addCleanup(handler.uninstall) + + def _callFUT(self, ob, **kwargs): + from zope.interface.ro import ro + return ro(ob, **kwargs) + + def _make_complex_diamond(self, base): + # https://github.com/zopefoundation/zope.interface/issues/21 + + class F(base): + pass + + class E(base): + pass + + class D(base): + pass + + class C(D, F): + pass + + class B(D, E): + pass + + class A(B, C): + pass + + if hasattr(A, 'mro'): + self.assertEqual(A.mro(), self._callFUT(A)) + + return A + + def test_complex_diamond_object(self): + self._make_complex_diamond(object) + + def test_complex_diamond_interface(self): + from zope.interface import Interface + + IA = self._make_complex_diamond(Interface) + + self.assertEqual( + [x.__name__ for x in IA.__iro__], + ['A', 'B', 'C', 'D', 'E', 'F', 'Interface'] + ) + + def test_complex_diamond_use_legacy_argument(self): + from zope.interface import Interface + + A = self._make_complex_diamond(Interface) + legacy_A_iro = self._callFUT(A, use_legacy_ro=True) + self.assertNotEqual(A.__iro__, legacy_A_iro) + + # And logging happened as a side-effect. + self._check_handler_complex_diamond() + + def test_complex_diamond_compare_legacy_argument(self): + from zope.interface import Interface + + A = self._make_complex_diamond(Interface) + computed_A_iro = self._callFUT(A, log_changed_ro=True) + # It matches, of course, but we did log a warning. + self.assertEqual(tuple(computed_A_iro), A.__iro__) + self._check_handler_complex_diamond() + + def _check_handler_complex_diamond(self): + handler = self.log_handler + self.assertEqual(1, len(handler.records)) + record = handler.records[0] + + expected = """\ +Object has different legacy and C3 MROs: + Legacy RO (len=7) C3 RO (len=7; inconsistent=no) + ======================================================== + interface.tests.test_ro.A interface.tests.test_ro.A + interface.tests.test_ro.B interface.tests.test_ro.B + - interface.tests.test_ro.E + interface.tests.test_ro.C interface.tests.test_ro.C + interface.tests.test_ro.D interface.tests.test_ro.D + + interface.tests.test_ro.E + interface.tests.test_ro.F interface.tests.test_ro.F + interface.Interface interface.Interface""".format( + name="interface.tests.test_ro.A" + ) + + checker = zope.testing.renormalizing.OutputChecker([ + (re.compile(r'zope\.'), ''), # zope is not always there + # space in headline is not consistent + (re.compile( + r'Legacy RO \(len=7\) +C3 RO \(len=7; inconsistent=no\)'), + 'Legacy RO (len=7) C3 RO (len=7; inconsistent=no)'), + (re.compile(r'=+'), ''), # header underline length varies + (re.compile(r' +\+'), ' +'), # table column spacing varies + (re.compile(r'interface\.Interface +interface\.Interface'), + 'interface.Interface interface.Interface'), + # spacing varies in last line + ] + ) + got = '\n'.join(ln.rstrip() for ln in record.getMessage().splitlines()) + self.assertTrue( + checker.check_output( + expected, got, 0), checker.output_difference( + doctest.Example( + got, expected), got, 0)) + + def test_ExtendedPathIndex_implement_thing_implementedby_super(self): + # See + # https://github.com/zopefoundation/zope.interface/pull/182#issuecomment-598754056 + from zope.interface import ro + + # pylint:disable=inherit-non-class + class _Based: + __bases__ = () + + def __init__(self, name, bases=(), attrs=None): + self.__name__ = name + self.__bases__ = bases + + def __repr__(self): + return self.__name__ + + Interface = _Based('Interface', (), {}) + + class IPluggableIndex(Interface): + pass + + class ILimitedResultIndex(IPluggableIndex): + pass + + class IQueryIndex(IPluggableIndex): + pass + + class IPathIndex(Interface): + pass + + # A parent class who implements two distinct interfaces whose + # only common ancestor is Interface. An easy case. + # @implementer(IPathIndex, IQueryIndex) + # class PathIndex(object): + # pass + obj = _Based('object') + PathIndex = _Based('PathIndex', (IPathIndex, IQueryIndex, obj)) + + # Child class that tries to put an interface the parent declares + # later ahead of the parent. + # @implementer(ILimitedResultIndex, IQueryIndex) + # class ExtendedPathIndex(PathIndex): + # pass + ExtendedPathIndex = _Based( + 'ExtendedPathIndex', + (ILimitedResultIndex, IQueryIndex, PathIndex) + ) + + # We were able to resolve it, and in exactly the same way as + # the legacy RO did, even though it is inconsistent. + result = self._callFUT( + ExtendedPathIndex, log_changed_ro=True, strict=False + ) + self.assertEqual(result, [ + ExtendedPathIndex, + ILimitedResultIndex, + PathIndex, + IPathIndex, + IQueryIndex, + IPluggableIndex, + Interface, + obj]) + + record, = self.log_handler.records + self.assertIn('used the legacy', record.getMessage()) + + with self.assertRaises(ro.InconsistentResolutionOrderError): + self._callFUT(ExtendedPathIndex, strict=True) + + def test_OSError_IOError(self): + from zope.interface import providedBy + from zope.interface.common import interfaces + + self.assertEqual( + list(providedBy(OSError()).flattened()), + [ + interfaces.IOSError, + interfaces.IIOError, + interfaces.IEnvironmentError, + interfaces.IStandardError, + interfaces.IException, + interfaces.Interface, + ]) + + def test_non_orderable(self): + import warnings + + from zope.interface import ro + try: + # If we've already warned, we must reset that state. + del ro.__warningregistry__ + except AttributeError: + pass + + with warnings.catch_warnings(): + warnings.simplefilter('error') + with C3Setting( + ro.C3.WARN_BAD_IRO, True + ), C3Setting( + ro.C3.STRICT_IRO, False + ): + with self.assertRaises(ro.InconsistentResolutionOrderWarning): + super().test_non_orderable() + + IOErr, _ = self._make_IOErr() + with self.assertRaises(ro.InconsistentResolutionOrderError): + self._callFUT(IOErr, strict=True) + + with C3Setting( + ro.C3.TRACK_BAD_IRO, True + ), C3Setting( + ro.C3.STRICT_IRO, False + ): + with warnings.catch_warnings(): + warnings.simplefilter('ignore') + self._callFUT(IOErr) + self.assertIn(IOErr, ro.C3.BAD_IROS) + + iro = self._callFUT(IOErr, strict=False) + legacy_iro = self._callFUT(IOErr, use_legacy_ro=True, strict=False) + self.assertEqual(iro, legacy_iro) + + +class TestC3(unittest.TestCase): + def _makeOne(self, C, strict=False, base_mros=None): + from zope.interface.ro import C3 + return C3.resolver(C, strict, base_mros) + + def test_base_mros_given(self): + c3 = self._makeOne( + type(self), + base_mros={unittest.TestCase: unittest.TestCase.__mro__} + ) + memo = c3.memo + self.assertIn(unittest.TestCase, memo) + # We used the StaticMRO class + self.assertIsNone(memo[unittest.TestCase].had_inconsistency) + + def test_one_base_optimization(self): + c3 = self._makeOne(type(self)) + # Even though we didn't call .mro() yet, the MRO has been + # computed. + self.assertIsNotNone(c3._C3__mro) # pylint:disable=no-member + c3._merge = None + self.assertEqual(c3.mro(), list(type(self).__mro__)) + + +class Test_ROComparison(unittest.TestCase): + + class MockC3: + direct_inconsistency = False + bases_had_inconsistency = False + + def _makeOne(self, c3=None, c3_ro=(), legacy_ro=()): + from zope.interface.ro import _ROComparison + return _ROComparison(c3 or self.MockC3(), c3_ro, legacy_ro) + + def test_inconsistent_label(self): + comp = self._makeOne() + self.assertEqual('no', comp._inconsistent_label) + + comp.c3.direct_inconsistency = True + self.assertEqual("direct", comp._inconsistent_label) + + comp.c3.bases_had_inconsistency = True + self.assertEqual("direct+bases", comp._inconsistent_label) + + comp.c3.direct_inconsistency = False + self.assertEqual('bases', comp._inconsistent_label) diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope/interface/tests/test_sorting.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope/interface/tests/test_sorting.py new file mode 100644 index 0000000000000000000000000000000000000000..745ad296e30a0d22340603818a7c42d1882dfbbf --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope/interface/tests/test_sorting.py @@ -0,0 +1,86 @@ +############################################################################## +# +# Copyright (c) 2001, 2002 Zope Foundation and Contributors. +# All Rights Reserved. +# +# This software is subject to the provisions of the Zope Public License, +# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. +# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED +# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS +# FOR A PARTICULAR PURPOSE. +# +############################################################################## +"""Test interface sorting +""" + +import unittest + +from zope.interface import Interface + + +class I1(Interface): + pass + + +class I2(I1): + pass + + +class I3(I1): + pass + + +class I4(Interface): + pass + + +class I5(I4): + pass + + +class I6(I2): + pass + + +class Test(unittest.TestCase): + + def test(self): + iface_list = [I1, I3, I5, I6, I4, I2] + iface_list.sort() + self.assertEqual(iface_list, [I1, I2, I3, I4, I5, I6]) + + def test_w_None(self): + iface_list = [I1, None, I3, I5, I6, I4, I2] + iface_list.sort() + self.assertEqual(iface_list, [I1, I2, I3, I4, I5, I6, None]) + + def test_w_equal_names(self): + # interfaces with equal names but different modules should sort by + # module name + from zope.interface.tests.m1 import I1 as m1_I1 + # We need to import I1 again to get a module path starting with `zope` + # instead of `interfaces`. + from zope.interface.tests.test_sorting import I1 + iface_list = [I1, m1_I1] + iface_list.sort() + self.assertEqual(iface_list, [m1_I1, I1]) + + def test_I1_I2(self): + self.assertLess(I1.__name__, I2.__name__) + self.assertEqual(I1.__module__, I2.__module__) + self.assertEqual(I1.__module__, __name__) + self.assertLess(I1, I2) + + def _makeI1(self): + + class I1(Interface): + pass + + return I1 + + def test_nested(self): + nested_I1 = self._makeI1() + self.assertEqual(I1, nested_I1) + self.assertEqual(nested_I1, I1) + self.assertEqual(hash(I1), hash(nested_I1)) diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope/interface/tests/test_verify.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope/interface/tests/test_verify.py new file mode 100644 index 0000000000000000000000000000000000000000..046cb6a827849c5e1b7c9edb0f5ec93c4e29df77 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope/interface/tests/test_verify.py @@ -0,0 +1,656 @@ +############################################################################## +# +# Copyright (c) 2001, 2002 Zope Foundation and Contributors. +# All Rights Reserved. +# +# This software is subject to the provisions of the Zope Public License, +# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. +# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED +# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS +# FOR A PARTICULAR PURPOSE. +# +############################################################################## +""" zope.interface.verify unit tests +""" +import unittest + + +# pylint:disable=inherit-non-class,no-method-argument,no-self-argument + +class Test_verifyClass(unittest.TestCase): + + verifier = None + + def setUp(self): + self.verifier = self._get_FUT() + + @classmethod + def _get_FUT(cls): + from zope.interface.verify import verifyClass + return verifyClass + + def _adjust_object_before_verify(self, x): + return x + + def _callFUT(self, iface, klass, **kwargs): + return self.verifier(iface, + self._adjust_object_before_verify(klass), + **kwargs) + + def test_class_doesnt_implement(self): + from zope.interface import Interface + from zope.interface.exceptions import DoesNotImplement + + class ICurrent(Interface): + pass + + class Current: + pass + + self.assertRaises(DoesNotImplement, self._callFUT, ICurrent, Current) + + def test_class_doesnt_implement_but_classImplements_later(self): + from zope.interface import Interface + from zope.interface import classImplements + + class ICurrent(Interface): + pass + + class Current: + pass + + classImplements(Current, ICurrent) + + self._callFUT(ICurrent, Current) + + def test_class_doesnt_have_required_method_simple(self): + from zope.interface import Interface + from zope.interface import implementer + from zope.interface.exceptions import BrokenImplementation + + class ICurrent(Interface): + def method(): + """docstring""" + + @implementer(ICurrent) + class Current: + pass + + self.assertRaises(BrokenImplementation, + self._callFUT, ICurrent, Current) + + def test_class_has_required_method_simple(self): + from zope.interface import Interface + from zope.interface import implementer + + class ICurrent(Interface): + def method(): + """docstring""" + + @implementer(ICurrent) + class Current: + + def method(self): + raise NotImplementedError() + + self._callFUT(ICurrent, Current) + + def test_class_doesnt_have_required_method_derived(self): + from zope.interface import Interface + from zope.interface import implementer + from zope.interface.exceptions import BrokenImplementation + + class IBase(Interface): + def method(): + """docstring""" + + class IDerived(IBase): + pass + + @implementer(IDerived) + class Current: + pass + + self.assertRaises(BrokenImplementation, + self._callFUT, IDerived, Current) + + def test_class_has_required_method_derived(self): + from zope.interface import Interface + from zope.interface import implementer + + class IBase(Interface): + def method(): + """docstring""" + + class IDerived(IBase): + pass + + @implementer(IDerived) + class Current: + + def method(self): + raise NotImplementedError() + + self._callFUT(IDerived, Current) + + def test_method_takes_wrong_arg_names_but_OK(self): + # We no longer require names to match. + from zope.interface import Interface + from zope.interface import implementer + + class ICurrent(Interface): + + def method(a): + """docstring""" + + @implementer(ICurrent) + class Current: + + def method(self, b): + raise NotImplementedError() + + self._callFUT(ICurrent, Current) + + def test_method_takes_not_enough_args(self): + from zope.interface import Interface + from zope.interface import implementer + from zope.interface.exceptions import BrokenMethodImplementation + + class ICurrent(Interface): + + def method(a): + """docstring""" + + @implementer(ICurrent) + class Current: + + def method(self): + raise NotImplementedError() + + self.assertRaises(BrokenMethodImplementation, + self._callFUT, ICurrent, Current) + + def test_method_doesnt_take_required_starargs(self): + from zope.interface import Interface + from zope.interface import implementer + from zope.interface.exceptions import BrokenMethodImplementation + + class ICurrent(Interface): + + def method(*args): + """docstring""" + + @implementer(ICurrent) + class Current: + + def method(self): + raise NotImplementedError() + + self.assertRaises(BrokenMethodImplementation, + self._callFUT, ICurrent, Current) + + def test_method_doesnt_take_required_only_kwargs(self): + from zope.interface import Interface + from zope.interface import implementer + from zope.interface.exceptions import BrokenMethodImplementation + + class ICurrent(Interface): + + def method(**kw): + """docstring""" + + @implementer(ICurrent) + class Current: + + def method(self): + raise NotImplementedError() + + self.assertRaises(BrokenMethodImplementation, + self._callFUT, ICurrent, Current) + + def test_method_takes_extra_arg(self): + from zope.interface import Interface + from zope.interface import implementer + from zope.interface.exceptions import BrokenMethodImplementation + + class ICurrent(Interface): + + def method(a): + """docstring""" + + @implementer(ICurrent) + class Current: + + def method(self, a, b): + raise NotImplementedError() + + self.assertRaises(BrokenMethodImplementation, + self._callFUT, ICurrent, Current) + + def test_method_takes_extra_arg_with_default(self): + from zope.interface import Interface + from zope.interface import implementer + + class ICurrent(Interface): + + def method(a): + """docstring""" + + @implementer(ICurrent) + class Current: + + def method(self, a, b=None): + raise NotImplementedError() + + self._callFUT(ICurrent, Current) + + def test_method_takes_only_positional_args(self): + from zope.interface import Interface + from zope.interface import implementer + + class ICurrent(Interface): + + def method(a): + """docstring""" + + @implementer(ICurrent) + class Current: + + def method(self, *args): + raise NotImplementedError() + + self._callFUT(ICurrent, Current) + + def test_method_takes_only_kwargs(self): + from zope.interface import Interface + from zope.interface import implementer + from zope.interface.exceptions import BrokenMethodImplementation + + class ICurrent(Interface): + + def method(a): + """docstring""" + + @implementer(ICurrent) + class Current: + + def method(self, **kw): + raise NotImplementedError() + + self.assertRaises(BrokenMethodImplementation, + self._callFUT, ICurrent, Current) + + def test_method_takes_extra_starargs(self): + from zope.interface import Interface + from zope.interface import implementer + + class ICurrent(Interface): + + def method(a): + """docstring""" + + @implementer(ICurrent) + class Current: + + def method(self, a, *args): + raise NotImplementedError() + + self._callFUT(ICurrent, Current) + + def test_method_takes_extra_starargs_and_kwargs(self): + from zope.interface import Interface + from zope.interface import implementer + + class ICurrent(Interface): + + def method(a): + """docstring""" + + @implementer(ICurrent) + class Current: + + def method(self, a, *args, **kw): + raise NotImplementedError() + + self._callFUT(ICurrent, Current) + + def test_method_doesnt_take_required_positional_and_starargs(self): + from zope.interface import Interface + from zope.interface import implementer + from zope.interface.exceptions import BrokenMethodImplementation + + class ICurrent(Interface): + + def method(a, *args): + """docstring""" + + @implementer(ICurrent) + class Current: + + def method(self, a): + raise NotImplementedError() + + self.assertRaises(BrokenMethodImplementation, + self._callFUT, ICurrent, Current) + + def test_method_takes_required_positional_and_starargs(self): + from zope.interface import Interface + from zope.interface import implementer + + class ICurrent(Interface): + + def method(a, *args): + """docstring""" + + @implementer(ICurrent) + class Current: + + def method(self, a, *args): + raise NotImplementedError() + + self._callFUT(ICurrent, Current) + + def test_method_takes_only_starargs(self): + from zope.interface import Interface + from zope.interface import implementer + + class ICurrent(Interface): + + def method(a, *args): + """docstring""" + + @implementer(ICurrent) + class Current: + + def method(self, *args): + raise NotImplementedError() + + self._callFUT(ICurrent, Current) + + def test_method_takes_required_kwargs(self): + from zope.interface import Interface + from zope.interface import implementer + + class ICurrent(Interface): + + def method(**kwargs): + """docstring""" + + @implementer(ICurrent) + class Current: + + def method(self, **kw): + raise NotImplementedError() + + self._callFUT(ICurrent, Current) + + def test_method_takes_positional_plus_required_starargs(self): + from zope.interface import Interface + from zope.interface import implementer + from zope.interface.exceptions import BrokenMethodImplementation + + class ICurrent(Interface): + + def method(*args): + """docstring""" + + @implementer(ICurrent) + class Current: + + def method(self, a, *args): + raise NotImplementedError() + + self.assertRaises(BrokenMethodImplementation, + self._callFUT, ICurrent, Current) + + def test_method_doesnt_take_required_kwargs(self): + from zope.interface import Interface + from zope.interface import implementer + from zope.interface.exceptions import BrokenMethodImplementation + + class ICurrent(Interface): + + def method(**kwargs): + """docstring""" + + @implementer(ICurrent) + class Current: + + def method(self, a): + raise NotImplementedError() + + self.assertRaises(BrokenMethodImplementation, + self._callFUT, ICurrent, Current) + + def test_class_has_method_for_iface_attr(self): + from zope.interface import Attribute + from zope.interface import Interface + from zope.interface import implementer + + class ICurrent(Interface): + attr = Attribute("The foo Attribute") + + @implementer(ICurrent) + class Current: + + def attr(self): + raise NotImplementedError() + + self._callFUT(ICurrent, Current) + + def test_class_has_nonmethod_for_method(self): + from zope.interface import Interface + from zope.interface import implementer + from zope.interface.exceptions import BrokenMethodImplementation + + class ICurrent(Interface): + def method(): + """docstring""" + + @implementer(ICurrent) + class Current: + method = 1 + + self.assertRaises(BrokenMethodImplementation, + self._callFUT, ICurrent, Current) + + def test_class_has_attribute_for_attribute(self): + from zope.interface import Attribute + from zope.interface import Interface + from zope.interface import implementer + + class ICurrent(Interface): + attr = Attribute("The foo Attribute") + + @implementer(ICurrent) + class Current: + + attr = 1 + + self._callFUT(ICurrent, Current) + + def test_class_misses_attribute_for_attribute(self): + # This check *passes* for verifyClass + from zope.interface import Attribute + from zope.interface import Interface + from zope.interface import implementer + + class ICurrent(Interface): + attr = Attribute("The foo Attribute") + + @implementer(ICurrent) + class Current: + pass + + self._callFUT(ICurrent, Current) + + def test_w_callable_non_func_method(self): + from zope.interface import Interface + from zope.interface import implementer + from zope.interface.interface import Method + + class QuasiMethod(Method): + def __call__(self, *args, **kw): + raise NotImplementedError() + + class QuasiCallable: + def __call__(self, *args, **kw): + raise NotImplementedError() + + class ICurrent(Interface): + attr = QuasiMethod('This is callable') + + @implementer(ICurrent) + class Current: + attr = QuasiCallable() + + self._callFUT(ICurrent, Current) + + def test_w_decorated_method(self): + from zope.interface import Interface + from zope.interface import implementer + + def decorator(func): + # this is, in fact, zope.proxy.non_overridable + return property(lambda self: func.__get__(self)) + + class ICurrent(Interface): + + def method(a): + """docstring""" + + @implementer(ICurrent) + class Current: + + @decorator + def method(self, a): + raise NotImplementedError() + + self._callFUT(ICurrent, Current) + + def test_dict_IFullMapping(self): + # A dict should be an IFullMapping, but this exposes two + # issues. First, on CPython, methods of builtin types are + # "method_descriptor" objects, and are harder to introspect. + # Second, on PyPy, the signatures can be just plain wrong, + # specifying as required arguments that are actually optional. + # See https://github.com/zopefoundation/zope.interface/issues/118 + from zope.interface.common.mapping import IFullMapping + self._callFUT(IFullMapping, dict, tentative=True) + + def test_list_ISequence(self): + # As for test_dict_IFullMapping + from zope.interface.common.sequence import ISequence + self._callFUT(ISequence, list, tentative=True) + + def test_tuple_IReadSequence(self): + # As for test_dict_IFullMapping + from zope.interface.common.sequence import IReadSequence + self._callFUT(IReadSequence, tuple, tentative=True) + + def test_multiple_invalid(self): + from zope.interface import Interface + from zope.interface import classImplements + from zope.interface.exceptions import BrokenImplementation + from zope.interface.exceptions import DoesNotImplement + from zope.interface.exceptions import MultipleInvalid + + class ISeveralMethods(Interface): + def meth1(arg1): + "Method 1" + def meth2(arg1): + "Method 2" + + class SeveralMethods: + pass + + with self.assertRaises(MultipleInvalid) as exc: + self._callFUT(ISeveralMethods, SeveralMethods) + + ex = exc.exception + self.assertEqual(3, len(ex.exceptions)) + self.assertIsInstance(ex.exceptions[0], DoesNotImplement) + self.assertIsInstance(ex.exceptions[1], BrokenImplementation) + self.assertIsInstance(ex.exceptions[2], BrokenImplementation) + + # If everything else is correct, only the single error is raised + # without the wrapper. + classImplements(SeveralMethods, ISeveralMethods) + SeveralMethods.meth1 = lambda self, arg1: "Hi" + + with self.assertRaises(BrokenImplementation): + self._callFUT(ISeveralMethods, SeveralMethods) + + +class Test_verifyObject(Test_verifyClass): + + @classmethod + def _get_FUT(cls): + from zope.interface.verify import verifyObject + return verifyObject + + def _adjust_object_before_verify(self, target): + if isinstance(target, (type, type(OldSkool))): + target = target() + return target + + def test_class_misses_attribute_for_attribute(self): + # This check *fails* for verifyObject + from zope.interface import Attribute + from zope.interface import Interface + from zope.interface import implementer + from zope.interface.exceptions import BrokenImplementation + + class ICurrent(Interface): + attr = Attribute("The foo Attribute") + + @implementer(ICurrent) + class Current: + pass + + self.assertRaises(BrokenImplementation, + self._callFUT, ICurrent, Current) + + def test_module_hit(self): + from zope.interface.tests import dummy + from zope.interface.tests.idummy import IDummyModule + + self._callFUT(IDummyModule, dummy) + + def test_module_miss(self): + from zope.interface import Interface + from zope.interface.exceptions import DoesNotImplement + from zope.interface.tests import dummy + + # same name, different object + class IDummyModule(Interface): + pass + + self.assertRaises(DoesNotImplement, + self._callFUT, IDummyModule, dummy) + + def test_staticmethod_hit_on_class(self): + from zope.interface import Interface + from zope.interface import provider + from zope.interface.verify import verifyObject + + class IFoo(Interface): + + def bar(a, b): + "The bar method" + + @provider(IFoo) + class Foo: + + @staticmethod + def bar(a, b): + raise AssertionError("We're never actually called") + + # Don't use self._callFUT, we don't want to instantiate the + # class. + verifyObject(IFoo, Foo) + + +class OldSkool: + pass diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope/interface/verify.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope/interface/verify.py new file mode 100644 index 0000000000000000000000000000000000000000..5bee470be3c5cd2c5ada5d3eb5b01640f3f2a29e --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope/interface/verify.py @@ -0,0 +1,209 @@ +############################################################################## +# +# Copyright (c) 2001, 2002 Zope Foundation and Contributors. +# All Rights Reserved. +# +# This software is subject to the provisions of the Zope Public License, +# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. +# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED +# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS +# FOR A PARTICULAR PURPOSE. +# +############################################################################## +"""Verify interface implementations +""" +import inspect +import sys +from types import FunctionType +from types import MethodType + +from zope.interface.exceptions import BrokenImplementation +from zope.interface.exceptions import BrokenMethodImplementation +from zope.interface.exceptions import DoesNotImplement +from zope.interface.exceptions import Invalid +from zope.interface.exceptions import MultipleInvalid +from zope.interface.interface import Method +from zope.interface.interface import fromFunction +from zope.interface.interface import fromMethod + + +__all__ = [ + 'verifyObject', + 'verifyClass', +] + +# This will be monkey-patched when running under Zope 2, so leave this +# here: +MethodTypes = (MethodType, ) + + +def _verify(iface, candidate, tentative=False, vtype=None): + """ + Verify that *candidate* might correctly provide *iface*. + + This involves: + + - Making sure the candidate claims that it provides the + interface using ``iface.providedBy`` (unless *tentative* is `True`, in + which case this step is skipped). This means that the candidate's class + declares that it `implements ` the + interface, or the candidate itself declares that it `provides + ` + the interface + + - Making sure the candidate defines all the necessary methods + + - Making sure the methods have the correct signature (to the + extent possible) + + - Making sure the candidate defines all the necessary attributes + + :return bool: Returns a true value if everything that could be + checked passed. + :raises zope.interface.Invalid: If any of the previous + conditions does not hold. + + .. versionchanged:: 5.0 + If multiple methods or attributes are invalid, all such errors + are collected and reported. Previously, only the first error was + reported. As a special case, if only one such error is present, it is + raised alone, like before. + """ + + if vtype == 'c': + tester = iface.implementedBy + else: + tester = iface.providedBy + + excs = [] + if not tentative and not tester(candidate): + excs.append(DoesNotImplement(iface, candidate)) + + for name, desc in iface.namesAndDescriptions(all=True): + try: + _verify_element(iface, name, desc, candidate, vtype) + except Invalid as e: + excs.append(e) + + if excs: + if len(excs) == 1: + raise excs[0] + raise MultipleInvalid(iface, candidate, excs) + + return True + + +def _verify_element(iface, name, desc, candidate, vtype): + # Here the `desc` is either an `Attribute` or `Method` instance + try: + attr = getattr(candidate, name) + except AttributeError: + + if (not isinstance(desc, Method)) and vtype == 'c': + # We can't verify non-methods on classes, since the + # class may provide attrs in it's __init__. + return + + # TODO: This should use ``raise...from`` + raise BrokenImplementation(iface, desc, candidate) + + if not isinstance(desc, Method): + # If it's not a method, there's nothing else we can test + return + + if inspect.ismethoddescriptor(attr) or inspect.isbuiltin(attr): + # The first case is what you get for things like ``dict.pop`` + # on CPython (e.g., ``verifyClass(IFullMapping, dict))``). The + # second case is what you get for things like ``dict().pop`` on + # CPython (e.g., ``verifyObject(IFullMapping, dict()))``. + # In neither case can we get a signature, so there's nothing + # to verify. Even the inspect module gives up and raises + # ValueError: no signature found. The ``__text_signature__`` attribute + # isn't typically populated either. + # + # Note that on PyPy 2 or 3 (up through 7.3 at least), these are not + # true for things like ``dict.pop`` (but might be true for C + # extensions?) + return + + if isinstance(attr, FunctionType): + + if isinstance(candidate, type) and vtype == 'c': + # This is an "unbound method". + # Only unwrap this if we're verifying implementedBy; + # otherwise we can unwrap @staticmethod on classes that directly + # provide an interface. + meth = fromFunction(attr, iface, name=name, imlevel=1) + else: + # Nope, just a normal function + meth = fromFunction(attr, iface, name=name) + + elif ( + isinstance(attr, MethodTypes) and + type(attr.__func__) is FunctionType + ): + meth = fromMethod(attr, iface, name) + + elif isinstance(attr, property) and vtype == 'c': + # Without an instance we cannot be sure it's not a + # callable. + # TODO: This should probably check inspect.isdatadescriptor(), + # a more general form than ``property`` + return + + else: + if not callable(attr): + raise BrokenMethodImplementation( + desc, + "implementation is not a method", + attr, + iface, + candidate + ) + # sigh, it's callable, but we don't know how to introspect it, so + # we have to give it a pass. + return + + # Make sure that the required and implemented method signatures are + # the same. + mess = _incompat(desc.getSignatureInfo(), meth.getSignatureInfo()) + if mess: + raise BrokenMethodImplementation(desc, mess, attr, iface, candidate) + + +def verifyClass(iface, candidate, tentative=False): + """ + Verify that the *candidate* might correctly provide *iface*. + """ + return _verify(iface, candidate, tentative, vtype='c') + + +def verifyObject(iface, candidate, tentative=False): + return _verify(iface, candidate, tentative, vtype='o') + + +verifyObject.__doc__ = _verify.__doc__ + +_MSG_TOO_MANY = 'implementation requires too many arguments' + + +def _incompat(required, implemented): + # if (required['positional'] != + # implemented['positional'][:len(required['positional'])] + # and implemented['kwargs'] is None): + # return 'imlementation has different argument names' + if len(implemented['required']) > len(required['required']): + return _MSG_TOO_MANY + + if ( + (len(implemented['positional']) < len(required['positional'])) and + not implemented['varargs'] + ): + return "implementation doesn't allow enough arguments" + + if required['kwargs'] and not implemented['kwargs']: + return "implementation doesn't support keyword arguments" + + if required['varargs'] and not implemented['varargs']: + return "implementation doesn't support variable arguments" diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope/sqlalchemy/README.rst b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope/sqlalchemy/README.rst new file mode 100644 index 0000000000000000000000000000000000000000..bfff1b16c44a693d623bbebeac7b53b40307e27a --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope/sqlalchemy/README.rst @@ -0,0 +1,270 @@ +*************** +zope.sqlalchemy +*************** + +.. contents:: + :local: + +Introduction +============ + +The aim of this package is to unify the plethora of existing packages +integrating SQLAlchemy with Zope's transaction management. As such it seeks +only to provide a data manager and makes no attempt to define a `zopeish` way +to configure engines. + +For WSGI applications, Zope style automatic transaction management is +available with `repoze.tm2`_ (used by `Turbogears 2`_ and other systems). + +This package is also used by `pyramid_tm`_ (an add-on of the `Pyramid`_) web +framework. + +You need to understand `SQLAlchemy`_ and the `Zope transaction manager`_ for +this package and this README to make any sense. + +.. _repoze.tm2: https://repozetm2.readthedocs.io/en/latest/ + +.. _pyramid_tm: https://docs.pylonsproject.org/projects/pyramid_tm/en/latest/ + +.. _Pyramid: https://pylonsproject.org/ + +.. _Turbogears 2: https://turbogears.org/ + +.. _SQLAlchemy: https://sqlalchemy.org/docs/ + +.. _Zope transaction manager: https://www.zodb.org/en/latest/#transactions + +Running the tests +================= + +This package is distributed as a buildout. Using your desired python run: + +$ python bootstrap.py +$ ./bin/buildout + +This will download the dependent packages and setup the test script, which may +be run with: + +$ ./bin/test + +or with the standard setuptools test command: + +$ ./bin/py setup.py test + +To enable testing with your own database set the TEST_DSN environment variable +to your sqlalchemy database dsn. Two-phase commit behaviour may be tested by +setting the TEST_TWOPHASE variable to a non empty string. e.g: + +$ TEST_DSN=postgres://test:test@localhost/test TEST_TWOPHASE=True bin/test + +Usage in short +============== + +The integration between Zope transactions and the SQLAlchemy event system is +done using the ``register()`` function on the session factory class. + +.. code-block:: python + + from zope.sqlalchemy import register + from sqlalchemy import create_engine + from sqlalchemy.orm import sessionmaker, scoped_session + + engine = sqlalchemy.create_engine("postgresql://scott:tiger@localhost/test") + + DBSession = scoped_session(sessionmaker(bind=engine)) + register(DBSession) + +Instantiated sessions commits and rollbacks will now be integrated with Zope +transactions. + +.. code-block:: python + + import transaction + from sqlalchemy.sql import text + + session = DBSession() + + result = session.execute(text("DELETE FROM objects WHERE id=:id"), {"id": 2}) + row = result.fetchone() + + transaction.commit() + + +Full Example +============ + +This example is lifted directly from the SQLAlchemy declarative documentation. +First the necessary imports. + + >>> from sqlalchemy import Column, Integer, String, ForeignKey, create_engine + >>> from sqlalchemy.orm import declarative_base, scoped_session, sessionmaker, relationship + >>> from sqlalchemy.sql import text + >>> from zope.sqlalchemy import register + >>> import transaction + +Now to define the mapper classes. + + >>> Base = declarative_base() + >>> class User(Base): + ... __tablename__ = 'test_users' + ... id = Column('id', Integer, primary_key=True) + ... name = Column('name', String(50)) + ... addresses = relationship("Address", backref="user") + >>> class Address(Base): + ... __tablename__ = 'test_addresses' + ... id = Column('id', Integer, primary_key=True) + ... email = Column('email', String(50)) + ... user_id = Column('user_id', Integer, ForeignKey('test_users.id')) + +Create an engine and setup the tables. Note that for this example to work a +recent version of sqlite/pysqlite is required. 3.4.0 seems to be sufficient. + + >>> engine = create_engine(TEST_DSN) + >>> Base.metadata.create_all(engine) + +Now to create the session itself. As zope is a threaded web server we must use +scoped sessions. Zope and SQLAlchemy sessions are tied together by using the +register + + >>> Session = scoped_session(sessionmaker(bind=engine, + ... twophase=TEST_TWOPHASE)) + +Call the scoped session factory to retrieve a session. You may call this as +many times as you like within a transaction and you will always retrieve the +same session. At present there are no users in the database. + + >>> session = Session() + >>> register(session) + + >>> session.query(User).all() + [] + +We can now create a new user and commit the changes using Zope's transaction +machinery, just as Zope's publisher would. + + >>> session.add(User(id=1, name='bob')) + >>> transaction.commit() + +Engine level connections are outside the scope of the transaction integration. + + >>> conn = engine.connect() + >>> conn.execute(text('SELECT * FROM test_users')).fetchall() + [(1, ...'bob')] + >>> conn.close() + +A new transaction requires a new session. Let's add an address. + + >>> session = Session() + >>> bob = session.query(User).all()[0] + >>> str(bob.name) + 'bob' + >>> bob.addresses + [] + >>> bob.addresses.append(Address(id=1, email='bob@bob.bob')) + >>> transaction.commit() + >>> session = Session() + >>> bob = session.query(User).all()[0] + >>> bob.addresses + [
    ] + >>> str(bob.addresses[0].email) + 'bob@bob.bob' + >>> bob.addresses[0].email = 'wrong@wrong' + +To rollback a transaction, use transaction.abort(). + + >>> transaction.abort() + >>> session = Session() + >>> bob = session.query(User).all()[0] + >>> str(bob.addresses[0].email) + 'bob@bob.bob' + >>> transaction.abort() + +By default, zope.sqlalchemy puts sessions in an 'active' state when they are +first used. ORM write operations automatically move the session into a +'changed' state. This avoids unnecessary database commits. Sometimes it +is necessary to interact with the database directly through SQL. It is not +possible to guess whether such an operation is a read or a write. Therefore we +must manually mark the session as changed when manual SQL statements write +to the DB. + + >>> session = Session() + >>> conn = session.connection() + >>> users = Base.metadata.tables['test_users'] + >>> conn.execute(users.update().where(users.c.name=='bob'), {'name': 'ben'}) + + >>> from zope.sqlalchemy import mark_changed + >>> mark_changed(session) + >>> transaction.commit() + >>> session = Session() + >>> str(session.query(User).all()[0].name) + 'ben' + >>> transaction.abort() + +If this is a problem you may register the events and tell them to place the +session in the 'changed' state initially. + + >>> Session.remove() + >>> register(Session, 'changed') + + >>> session = Session() + >>> conn = session.connection() + >>> conn.execute(users.update().where(users.c.name=='ben'), {'name': 'bob'}) + + >>> transaction.commit() + >>> session = Session() + >>> str(session.query(User).all()[0].name) + 'bob' + >>> transaction.abort() + +The `mark_changed` function accepts a kwarg for `keep_session` which defaults +to `False` and is unaware of the registered extensions `keep_session` +configuration. + +If you intend for `keep_session` to be True, you can specify it explicitly: + + >>> from zope.sqlalchemy import mark_changed + >>> mark_changed(session, keep_session=True) + >>> transaction.commit() + +You can also use a configured extension to preserve this argument: + + >>> sessionExtension = register(session, keep_session=True) + >>> sessionExtension.mark_changed(session) + >>> transaction.commit() + + +Long-lasting session scopes +--------------------------- + +The default behaviour of the transaction integration is to close the session +after a commit. You can tell by trying to access an object after committing: + + >>> bob = session.query(User).all()[0] + >>> transaction.commit() + >>> bob.name + Traceback (most recent call last): + sqlalchemy.orm.exc.DetachedInstanceError: Instance is not bound to a Session; attribute refresh operation cannot proceed... + +To support cases where a session needs to last longer than a transaction (useful +in test suites) you can specify to keep a session when registering the events: + + >>> Session = scoped_session(sessionmaker(bind=engine, + ... twophase=TEST_TWOPHASE)) + >>> register(Session, keep_session=True) + + >>> session = Session() + >>> bob = session.query(User).all()[0] + >>> bob.name = 'bobby' + >>> transaction.commit() + >>> bob.name + 'bobby' + +The session must then be closed manually: + + >>> session.close() + + +Development version +=================== + +`GIT version `_ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope/sqlalchemy/__init__.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope/sqlalchemy/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..86bf768faba455e1295dbd904bebd33768544cc7 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope/sqlalchemy/__init__.py @@ -0,0 +1,27 @@ +############################################################################## +# +# Copyright (c) 2008 Zope Foundation and Contributors. +# All Rights Reserved. +# +# This software is subject to the provisions of the Zope Public License, +# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. +# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED +# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS +# FOR A PARTICULAR PURPOSE +# +############################################################################## + +from zope.sqlalchemy.datamanager import ZopeTransactionEvents +from zope.sqlalchemy.datamanager import mark_changed +from zope.sqlalchemy.datamanager import register + + +invalidate = mark_changed + +__all__ = [ + 'ZopeTransactionEvents', + 'invalidate', + 'mark_changed', + 'register', +] diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope/sqlalchemy/datamanager.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope/sqlalchemy/datamanager.py new file mode 100644 index 0000000000000000000000000000000000000000..c4e375cc55179fb973837d3a10321df6f5175b41 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope/sqlalchemy/datamanager.py @@ -0,0 +1,399 @@ +############################################################################## +# +# Copyright (c) 2008 Zope Foundation and Contributors. +# All Rights Reserved. +# +# This software is subject to the provisions of the Zope Public License, +# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. +# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED +# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS +# FOR A PARTICULAR PURPOSE +# +############################################################################## + + +from weakref import WeakKeyDictionary + +import transaction as zope_transaction +from packaging.version import Version as parse_version +from sqlalchemy import __version__ as sqlalchemy_version +from sqlalchemy.engine.base import Engine +from sqlalchemy.exc import DBAPIError +from sqlalchemy.orm.exc import ConcurrentModificationError +from transaction._transaction import Status as ZopeStatus +from transaction.interfaces import IDataManagerSavepoint +from transaction.interfaces import ISavepointDataManager +from zope.interface import implementer + + +_retryable_errors = [] +try: + import psycopg2.extensions +except ImportError: + pass +else: + _retryable_errors.append( + (psycopg2.extensions.TransactionRollbackError, None)) + +# Error Class 40: Transaction Rollback, for details +# see https://www.psycopg.org/psycopg3/docs/api/errors.html +try: + import psycopg.errors +except ImportError: + pass +else: + _retryable_errors.append( + (psycopg.errors.OperationalError, + lambda e: e.sqlstate and e.sqlstate.startswith('40')) + ) + +# ORA-08177: can't serialize access for this transaction +try: + import cx_Oracle +except ImportError: + pass +else: + _retryable_errors.append( + (cx_Oracle.DatabaseError, lambda e: e.args[0].code == 8177) + ) + +# 1213: Deadlock found when trying to get lock; try restarting transaction +try: + import pymysql +except ImportError: + pass +else: + _retryable_errors.append( + (pymysql.err.OperationalError, lambda e: e.args[0] == 1213) + ) + +# The status of the session is stored on the connection info +STATUS_ACTIVE = "active" # session joined to transaction, writes allowed. +STATUS_CHANGED = "changed" # data has been written +# session joined to transaction, no writes allowed. +STATUS_READONLY = "readonly" +STATUS_INVALIDATED = STATUS_CHANGED # BBB + +NO_SAVEPOINT_SUPPORT = {"sqlite"} + +_SESSION_STATE = WeakKeyDictionary() # a mapping of session -> status +# This is thread safe because you are using scoped sessions + +SA_GE_14 = parse_version(sqlalchemy_version) >= parse_version('1.4.0') + + +# +# The two variants of the DataManager. +# + + +@implementer(ISavepointDataManager) +class SessionDataManager: + """Integrate a top level sqlalchemy session transaction into a + + zope transaction. + + One phase variant. + """ + + def __init__( + self, session, status, transaction_manager, keep_session=False): + self.transaction_manager = transaction_manager + + if SA_GE_14: + root_transaction = session.get_transaction() or session.begin() + else: + # Support both SQLAlchemy 1.0 and 1.1 + # https://github.com/zopefoundation/zope.sqlalchemy/issues/15 + _iterate_parents = ( + getattr(session.transaction, "_iterate_self_and_parents", None) + or session.transaction._iterate_parents + ) + root_transaction = _iterate_parents()[-1] + + self.tx = root_transaction + self.session = session + transaction_manager.get().join(self) + _SESSION_STATE[session] = status + self.state = "init" + self.keep_session = keep_session + + def _finish(self, final_state): + assert self.tx is not None + session = self.session + del _SESSION_STATE[self.session] + self.tx = self.session = None + self.state = final_state + # closing the session is the last thing we do. If it fails the + # transactions don't get wedged and the error propagates + if not self.keep_session: + session.close() + else: + session.expire_all() + + def abort(self, trans): + if self.tx is not None: # there may have been no work to do + self._finish("aborted") + + def tpc_begin(self, trans): + self.session.flush() + + def commit(self, trans): + status = _SESSION_STATE[self.session] + if status is not STATUS_INVALIDATED: + session = self.session + if session.expire_on_commit: + session.expire_all() + self._finish("no work") + + def tpc_vote(self, trans): + # for a one phase data manager commit last in tpc_vote + if self.tx is not None: # there may have been no work to do + self.tx.commit() + self._finish("committed") + + def tpc_finish(self, trans): + pass + + def tpc_abort(self, trans): + assert self.state != "committed" + + def sortKey(self): + # Try to sort last, so that we vote last - we may commit in tpc_vote(), + # which allows Zope to roll back its transaction if the RDBMS + # threw a conflict error. + return "~sqlalchemy:%d" % id(self.tx) + + @property + def savepoint(self): + """Savepoints are only supported when all connections support + + subtransactions. + """ + + # ATT: the following check is weak since the savepoint capability + # of a RDBMS also depends on its version. E.g. Postgres 7.X does not + # support savepoints but Postgres is whitelisted independent of its + # version. Possibly additional version information should be taken + # into account (ajung) + if { + engine.url.drivername + for engine in self.tx._connections.keys() + if isinstance(engine, Engine) + }.intersection(NO_SAVEPOINT_SUPPORT): + raise AttributeError("savepoint") + return self._savepoint + + def _savepoint(self): + return SessionSavepoint(self.session) + + def should_retry(self, error): + if isinstance(error, ConcurrentModificationError): + return True + if isinstance(error, DBAPIError): + orig = error.orig + for error_type, test in _retryable_errors: + if isinstance(orig, error_type): + if test is None: + return True + if test(orig): + return True + + +class TwoPhaseSessionDataManager(SessionDataManager): + """Two phase variant. + """ + + def tpc_vote(self, trans): + if self.tx is not None: # there may have been no work to do + self.tx.prepare() + self.state = "voted" + + def tpc_finish(self, trans): + if self.tx is not None: + self.tx.commit() + self._finish("committed") + + def tpc_abort(self, trans): + # we may not have voted, and been aborted already + if self.tx is not None: + self.tx.rollback() + self._finish("aborted commit") + + def sortKey(self): + # Sort normally + return "sqlalchemy.twophase:%d" % id(self.tx) + + +@implementer(IDataManagerSavepoint) +class SessionSavepoint: + def __init__(self, session): + self.session = session + self.transaction = session.begin_nested() + + def rollback(self): + # no need to check validity, sqlalchemy should raise an exception. + self.transaction.rollback() + + +def join_transaction( + session, + initial_state=STATUS_ACTIVE, + transaction_manager=zope_transaction.manager, + keep_session=False, +): + """Join a session to a transaction using the appropriate datamanager. + + It is safe to call this multiple times, if the session is already joined + then it just returns. + + `initial_state` is either STATUS_ACTIVE, STATUS_INVALIDATED or + STATUS_READONLY + + If using the default initial status of STATUS_ACTIVE, you must ensure that + mark_changed(session) is called when data is written to the database. + + The ZopeTransactionEvents can be used to ensure that this is + called automatically after session write operations. + """ + if _SESSION_STATE.get(session, None) is None: + if session.twophase: + DataManager = TwoPhaseSessionDataManager + else: + DataManager = SessionDataManager + DataManager( + session, initial_state, transaction_manager, + keep_session=keep_session + ) + + +def mark_changed( + session, transaction_manager=zope_transaction.manager, keep_session=False +): + """Mark a session as needing to be committed. + """ + assert ( + _SESSION_STATE.get(session, None) is not STATUS_READONLY + ), "Session already registered as read only" + join_transaction(session, STATUS_CHANGED, + transaction_manager, keep_session) + _SESSION_STATE[session] = STATUS_CHANGED + + +class ZopeTransactionEvents: + """Record that a flush has occurred on a session's connection. This allows + the DataManager to rollback rather than commit on read only transactions. + """ + + def __init__( + self, + initial_state=STATUS_ACTIVE, + transaction_manager=zope_transaction.manager, + keep_session=False, + ): + if initial_state == "invalidated": + initial_state = STATUS_CHANGED # BBB + self.initial_state = initial_state + self.transaction_manager = transaction_manager + self.keep_session = keep_session + + def after_begin(self, session, transaction, connection): + join_transaction( + session, self.initial_state, self.transaction_manager, + self.keep_session + ) + + def after_attach(self, session, instance): + join_transaction( + session, self.initial_state, self.transaction_manager, + self.keep_session + ) + + def after_flush(self, session, flush_context): + mark_changed(session, self.transaction_manager, self.keep_session) + + def after_bulk_update(self, update_context): + mark_changed(update_context.session, + self.transaction_manager, self.keep_session) + + def after_bulk_delete(self, delete_context): + mark_changed(delete_context.session, + self.transaction_manager, self.keep_session) + + def before_commit(self, session): + in_nested_transaction = ( + session.in_nested_transaction() + if SA_GE_14 + # support sqlalchemy 1.3 and below + else session.transaction.nested + ) + assert ( + in_nested_transaction + or self.transaction_manager.get().status == ZopeStatus.COMMITTING + ), "Transaction must be committed using the transaction manager" + + def do_orm_execute(self, execute_state): + dml = any((execute_state.is_update, execute_state.is_insert, + execute_state.is_delete)) + if execute_state.is_orm_statement and dml: + mark_changed(execute_state.session, self.transaction_manager, + self.keep_session) + + def mark_changed(self, session): + """Developer interface to `mark_changed` that preserves the extension's + active configuration. + """ + mark_changed(session, self.transaction_manager, self.keep_session) + + def join_transaction(self, session): + """Developer interface to `join_transaction` that preserves the + extension's active configuration. + """ + join_transaction( + session, self.initial_state, self.transaction_manager, + self.keep_session + ) + + +def register( + session, + initial_state=STATUS_ACTIVE, + transaction_manager=zope_transaction.manager, + keep_session=False, +): + """Register ZopeTransaction listener events on the + given Session or Session factory/class. + + This function requires at least SQLAlchemy 0.7 and makes use + of the newer sqlalchemy.event package in order to register event listeners + on the given Session. + + The session argument here may be a Session class or subclass, a + sessionmaker or scoped_session instance, or a specific Session instance. + Event listening will be specific to the scope of the type of argument + passed, including specificity to its subclass as well as its identity. + + It returns the instance of ZopeTransactionEvents those methods where used + to register the event listeners. + + """ + from sqlalchemy import event + + ext = ZopeTransactionEvents( + initial_state=initial_state, + transaction_manager=transaction_manager, + keep_session=keep_session, + ) + + event.listen(session, "after_begin", ext.after_begin) + event.listen(session, "after_attach", ext.after_attach) + event.listen(session, "after_flush", ext.after_flush) + event.listen(session, "after_bulk_update", ext.after_bulk_update) + event.listen(session, "after_bulk_delete", ext.after_bulk_delete) + event.listen(session, "before_commit", ext.before_commit) + + if SA_GE_14: + event.listen(session, "do_orm_execute", ext.do_orm_execute) + + return ext diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope/sqlalchemy/tests.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope/sqlalchemy/tests.py new file mode 100644 index 0000000000000000000000000000000000000000..74846e18d6560107133048150cf02a5eeb64dcf2 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope/sqlalchemy/tests.py @@ -0,0 +1,912 @@ +############################################################################## +# +# Copyright (c) 2008 Zope Foundation and Contributors. +# All Rights Reserved. +# +# This software is subject to the provisions of the Zope Public License, +# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. +# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED +# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS +# FOR A PARTICULAR PURPOSE +# +############################################################################## + +# Inspiration from z3c.sqlalchemy/src/z3c/sqlalchemy/tests/testSQLAlchemy.py +# +# You may want to run the tests with your database. To do so set the +# environment variable TEST_DSN to the connection url. e.g.: +# export TEST_DSN=postgres://plone:plone@localhost/test +# export TEST_DSN=mssql://plone:plone@/test?dsn=mydsn +# +# To test in twophase commit mode export TEST_TWOPHASE=True +# +# NOTE: The sqlite that ships with Mac OS X 10.4 is buggy. +# Install a newer version (3.5.6) and rebuild pysqlite2 against it. + +import os +import threading +import time +import unittest + +import sqlalchemy as sa +import transaction +from packaging.version import Version as parse_version +from sqlalchemy import __version__ as sqlalchemy_version +from sqlalchemy import exc +from sqlalchemy import orm +from sqlalchemy import sql +from transaction._transaction import Status as ZopeStatus +from transaction.interfaces import TransactionFailedError + +from zope.sqlalchemy import datamanager as tx +from zope.sqlalchemy import mark_changed + + +SA_GE_20 = parse_version(sqlalchemy_version) >= parse_version('2.0.0') +TEST_TWOPHASE = bool(os.environ.get("TEST_TWOPHASE")) +TEST_DSN = os.environ.get("TEST_DSN", "sqlite:///:memory:") + + +class SimpleModel: + def __init__(self, **kw): + for k, v in kw.items(): + setattr(self, k, v) + + def asDict(self): + return {k: v + for k, v in self.__dict__.items() + if not k.startswith("_")} + + +class User(SimpleModel): + pass + + +class Skill(SimpleModel): + pass + + +engine = sa.create_engine(TEST_DSN) + +# See https://code.google.com/p/pysqlite-static-env/ +HAS_PATCHED_PYSQLITE = False +if engine.url.drivername == "sqlite": + try: + from pysqlite2.dbapi2 import Connection + except ImportError: + pass + else: + if hasattr(Connection, "operation_needs_transaction_callback"): + HAS_PATCHED_PYSQLITE = True + +if HAS_PATCHED_PYSQLITE: + from sqlalchemy import event + + from zope.sqlalchemy.datamanager import NO_SAVEPOINT_SUPPORT + + NO_SAVEPOINT_SUPPORT.remove("sqlite") + + @event.listens_for(engine, "connect") + def connect(dbapi_connection, connection_record): + dbapi_connection.operation_needs_transaction_callback = lambda x: True + + +Session = orm.scoped_session(orm.sessionmaker( + bind=engine, twophase=TEST_TWOPHASE)) +tx.register(Session) + +UnboundSession = orm.scoped_session(orm.sessionmaker(twophase=TEST_TWOPHASE)) +tx.register(UnboundSession) + +EventSession = orm.scoped_session( + orm.sessionmaker(bind=engine, twophase=TEST_TWOPHASE)) +tx.register(EventSession) + +KeepSession = orm.scoped_session( + orm.sessionmaker(bind=engine, twophase=TEST_TWOPHASE)) +tx.register(KeepSession, keep_session=True) + + +metadata = sa.MetaData() # best to use unbound metadata + + +test_users = sa.Table( + "test_users", + metadata, + sa.Column("id", sa.Integer, primary_key=True), + # mssql cannot do equality on a text type + sa.Column("firstname", sa.VARCHAR(255)), + sa.Column("lastname", sa.VARCHAR(255)), +) + +test_skills = sa.Table( + "test_skills", + metadata, + sa.Column("id", sa.Integer, primary_key=True), + sa.Column("user_id", sa.Integer), + sa.Column("name", sa.VARCHAR(255)), + sa.ForeignKeyConstraint(("user_id",), ("test_users.id",)), +) + +if SA_GE_20: + # bound metadata does no longer exist in SQLAlchemy 2.0 + test_one = sa.Table( + "test_one", + metadata, + sa.Column("id", sa.Integer, primary_key=True) + ) + test_two = sa.Table( + "test_two", + metadata, + sa.Column("id", sa.Integer, primary_key=True) + ) +else: + engine2 = sa.create_engine(TEST_DSN) + + bound_metadata1 = sa.MetaData(engine) + bound_metadata2 = sa.MetaData(engine2) + + test_one = sa.Table( + "test_one", + bound_metadata1, + sa.Column("id", sa.Integer, primary_key=True) + ) + test_two = sa.Table( + "test_two", + bound_metadata2, + sa.Column("id", sa.Integer, primary_key=True) + ) + + +class TestOne(SimpleModel): + pass + + +class TestTwo(SimpleModel): + pass + + +def setup_mappers(): + orm.clear_mappers() + # Other tests can clear mappers by calling clear_mappers(), + # be more robust by setting up mappers in the test setup. + + if SA_GE_20: + mapper_reg = orm.registry() + mapper = mapper_reg.map_imperatively + else: + mapper = orm.mapper + + m1 = mapper( + User, + test_users, + properties={ + "skills": orm.relationship( + Skill, + primaryjoin=( + test_users.columns["id"] == test_skills.columns["user_id"] + ), + ) + }, + ) + m2 = mapper(Skill, test_skills) + + m3 = mapper(TestOne, test_one) + m4 = mapper(TestTwo, test_two) + return [m1, m2, m3, m4] + + +class DummyException(Exception): + pass + + +class DummyTargetRaised(DummyException): + pass + + +class DummyTargetResult(DummyException): + pass + + +class DummyDataManager: + def __init__(self, key, target=None, args=(), kwargs={}): + self.key = key + self.target = target + self.args = args + self.kwargs = kwargs + + def abort(self, trans): + pass + + def tpc_begin(self, trans): + pass + + def commit(self, trans): + pass + + def tpc_vote(self, trans): + if self.target is not None: + try: + result = self.target(*self.args, **self.kwargs) + except Exception as e: + raise DummyTargetRaised(e) + raise DummyTargetResult(result) + else: + raise DummyException("DummyDataManager cannot commit") + + def tpc_finish(self, trans): + pass + + def tpc_abort(self, trans): + pass + + def sortKey(self): + return self.key + + +class ZopeSQLAlchemyTests(unittest.TestCase): + def setUp(self): + self.mappers = setup_mappers() + metadata.drop_all(engine) + metadata.create_all(engine) + # a connection which bypasses the session/transaction machinery + self.conn = engine.connect() + + def tearDown(self): + transaction.abort() + metadata.drop_all(engine) + orm.clear_mappers() + self.conn.close() + + def testMarkUnknownSession(self): + import zope.sqlalchemy.datamanager + + DummyDataManager(key="dummy.first") + session = Session() + mark_changed(session) + self.assertIn(session, zope.sqlalchemy.datamanager._SESSION_STATE) + + def testAbortBeforeCommit(self): + # Simulate what happens in a conflict error + DummyDataManager(key="dummy.first") + session = Session() + conn = session.connection() + mark_changed(session) + try: + # Thus we could fail in commit + transaction.commit() + except: # noqa: E722 do not use bare 'except' + # But abort must succeed (and rollback the base connection) + transaction.abort() + pass + # Or the next transaction will not be able to start! + transaction.begin() + session = Session() + conn = session.connection() + conn.execute(sql.text("SELECT 1 FROM test_users")) + mark_changed(session) + transaction.commit() + + def testAbortAfterCommit(self): + # This is a regression test which used to wedge the transaction + # machinery when using PostgreSQL (and perhaps other) connections. + # Basically, if a commit failed, there was no way to abort the + # transaction. Leaving the transaction wedged. + transaction.begin() + session = Session() + conn = session.connection() + # At least PostgresSQL requires a rollback after invalid SQL is + # executed + self.assertRaises(Exception, conn.execute, "BAD SQL SYNTAX") + mark_changed(session) + try: + # Thus we could fail in commit + transaction.commit() + except: # noqa: E722 do not use bare 'except' + # But abort must succed (and actually rollback the base connection) + transaction.abort() + pass + # Or the next transaction will not be able to start! + transaction.begin() + session = Session() + conn = session.connection() + conn.execute(sql.text("SELECT 1 FROM test_users")) + mark_changed(session) + transaction.commit() + + def testSimplePopulation(self): + session = Session() + query = session.query(User) + rows = query.all() + self.assertEqual(len(rows), 0) + + session.add(User(id=1, firstname="udo", lastname="juergens")) + session.add(User(id=2, firstname="heino", lastname="n/a")) + session.flush() + + rows = query.order_by(User.id).all() + self.assertEqual(len(rows), 2) + row1 = rows[0] + d = row1.asDict() + self.assertEqual( + d, {"firstname": "udo", "lastname": "juergens", "id": 1}) + + # bypass the session machinery + if SA_GE_20: + stmt = sql.select(*test_users.columns).order_by("id") + else: + stmt = sql.select(test_users.columns).order_by("id") + + conn = session.connection() + results = conn.execute(stmt) + self.assertEqual( + results.fetchall(), [(1, "udo", "juergens"), (2, "heino", "n/a")] + ) + + def testRelations(self): + session = Session() + session.add(User(id=1, firstname="foo", lastname="bar")) + + user = session.query(User).filter_by(firstname="foo")[0] + user.skills.append(Skill(id=1, name="Zope")) + session.flush() + + def testTransactionJoining(self): + transaction.abort() # clean slate + t = transaction.get() + self.assertFalse( + [r for r in t._resources if isinstance(r, tx.SessionDataManager)], + "Joined transaction too early", + ) + session = Session() + session.add(User(id=1, firstname="udo", lastname="juergens")) + t = transaction.get() + # Expect this to fail with SQLAlchemy 0.4 + self.assertTrue( + [r for r in t._resources if isinstance(r, tx.SessionDataManager)], + "Not joined transaction", + ) + + def testTransactionJoiningUsingRegister(self): + transaction.abort() # clean slate + t = transaction.get() + self.assertFalse( + [r for r in t._resources if isinstance(r, tx.SessionDataManager)], + "Joined transaction too early", + ) + session = EventSession() + session.add(User(id=1, firstname="udo", lastname="juergens")) + t = transaction.get() + self.assertTrue( + [r for r in t._resources if isinstance(r, tx.SessionDataManager)], + "Not joined transaction", + ) + + def testSavepoint(self): + use_savepoint = engine.url.drivername not in tx.NO_SAVEPOINT_SUPPORT + t = transaction.get() + session = Session() + query = session.query(User) + self.assertFalse(query.all(), "Users table should be empty") + + t.savepoint(optimistic=True) # this should always work + + if not use_savepoint: + self.assertRaises(TypeError, t.savepoint) + return # sqlite databases do not support savepoints + + s1 = t.savepoint() + session.add(User(id=1, firstname="udo", lastname="juergens")) + session.flush() + self.assertEqual( + len(query.all()), + 1, + "Users table should have one row" + ) + + s2 = t.savepoint() + session.add(User(id=2, firstname="heino", lastname="n/a")) + session.flush() + self.assertEqual( + len(query.all()), + 2, + "Users table should have two rows" + ) + + s2.rollback() + self.assertEqual( + len(query.all()), + 1, + "Users table should have one row" + ) + + s1.rollback() + self.assertFalse(query.all(), "Users table should be empty") + + def testRollbackAttributes(self): + use_savepoint = engine.url.drivername not in tx.NO_SAVEPOINT_SUPPORT + if not use_savepoint: + self.skipTest('No savepoint support') + + t = transaction.get() + session = Session() + query = session.query(User) + self.assertFalse(query.all(), "Users table should be empty") + + t.savepoint() + user = User(id=1, firstname="udo", lastname="juergens") + session.add(user) + session.flush() + + s2 = t.savepoint() + user.firstname = "heino" + session.flush() + s2.rollback() + self.assertEqual( + user.firstname, + "udo", + "User firstname attribute should have been rolled back", + ) + + def testCommit(self): + session = Session() + + query = session.query(User) + rows = query.all() + self.assertEqual(len(rows), 0) + + transaction.commit() # test a none modifying transaction works + + session = Session() + query = session.query(User) + + session.add(User(id=1, firstname="udo", lastname="juergens")) + session.add(User(id=2, firstname="heino", lastname="n/a")) + session.flush() + + rows = query.order_by(User.id).all() + self.assertEqual(len(rows), 2) + + transaction.abort() # test that the abort really aborts + session = Session() + query = session.query(User) + rows = query.order_by(User.id).all() + self.assertEqual(len(rows), 0) + + session.add(User(id=1, firstname="udo", lastname="juergens")) + session.add(User(id=2, firstname="heino", lastname="n/a")) + session.flush() + rows = query.order_by(User.id).all() + row1 = rows[0] + d = row1.asDict() + self.assertEqual( + d, {"firstname": "udo", "lastname": "juergens", "id": 1}) + + transaction.commit() + + rows = query.order_by(User.id).all() + self.assertEqual(len(rows), 2) + row1 = rows[0] + d = row1.asDict() + self.assertEqual( + d, {"firstname": "udo", "lastname": "juergens", "id": 1}) + + # bypass the session (and transaction) machinery + with self.conn.begin(): + results = self.conn.execute(test_users.select()) + self.assertEqual(len(results.fetchall()), 2) + + def testCommitWithSavepoint(self): + if engine.url.drivername in tx.NO_SAVEPOINT_SUPPORT: + self.skipTest('No savepoint support') + session = Session() + session.add(User(id=1, firstname="udo", lastname="juergens")) + session.add(User(id=2, firstname="heino", lastname="n/a")) + session.flush() + transaction.commit() + + session = Session() + query = session.query(User) + # lets just test that savepoints don't affect commits + t = transaction.get() + rows = query.order_by(User.id).all() + + t.savepoint() + session.delete(rows[1]) + session.flush() + transaction.commit() + + # bypass the session machinery + with self.conn.begin(): + results = self.conn.execute(test_users.select()) + self.assertEqual(len(results.fetchall()), 1) + + def testSessionSavepointCommitAllowed(self): + # Existing code might use nested transactions + if engine.url.drivername in tx.NO_SAVEPOINT_SUPPORT: + self.skipTest('No save point support') + session = Session() + session.add(User(id=1, firstname="udo", lastname="juergens")) + savepoint = session.begin_nested() + session.add(User(id=2, firstname="heino", lastname="n/a")) + savepoint.commit() + transaction.commit() + + def testSessionCommitDisallowed(self): + session = Session() + session.add(User(id=1, firstname="udo", lastname="juergens")) + self.assertRaises(AssertionError, session.commit) + + def testTwoPhase(self): + session = Session() + if not session.twophase: + self.skipTest('No two phase transaction support') + session.add(User(id=1, firstname="udo", lastname="juergens")) + session.add(User(id=2, firstname="heino", lastname="n/a")) + session.flush() + transaction.commit() + + # Test that we clean up after a tpc_abort + t = transaction.get() + + def target(): + return engine.connect().recover_twophase() + + dummy = DummyDataManager(key="~~~dummy.last", target=target) + t.join(dummy) + session = Session() + query = session.query(User) + rows = query.all() + session.delete(rows[0]) + session.flush() + result = None + try: + t.commit() + except DummyTargetResult as e: + result = e.args[0] + except DummyTargetRaised as e: + raise e.args[0] + + self.assertEqual( + len(result), + 1, + "Should have been one prepared transaction when dummy aborted", + ) + + transaction.begin() + + self.assertEqual( + len(engine.connect().recover_twophase()), + 0, + "Test no outstanding prepared transactions", + ) + + def testThread(self): + transaction.abort() + global thread_error + thread_error = None + + def target(): + try: + session = Session() + metadata.drop_all(engine) + metadata.create_all(engine) + + query = session.query(User) + rows = query.all() + self.assertEqual(len(rows), 0) + + session.add(User(id=1, firstname="udo", lastname="juergens")) + session.add(User(id=2, firstname="heino", lastname="n/a")) + session.flush() + + rows = query.order_by(User.id).all() + self.assertEqual(len(rows), 2) + row1 = rows[0] + d = row1.asDict() + self.assertEqual( + d, {"firstname": "udo", "lastname": "juergens", "id": 1} + ) + except Exception as err: + global thread_error + thread_error = err + transaction.abort() + + thread = threading.Thread(target=target) + thread.start() + thread.join() + if thread_error is not None: + raise thread_error # reraise in current thread + + def testBulkDelete(self): + session = Session() + session.add(User(id=1, firstname="udo", lastname="juergens")) + session.add(User(id=2, firstname="heino", lastname="n/a")) + transaction.commit() + session = Session() + session.query(User).delete() + transaction.commit() + with self.conn.begin(): + results = self.conn.execute(test_users.select()) + self.assertEqual(len(results.fetchall()), 0) + + def testBulkUpdate(self): + session = Session() + session.add(User(id=1, firstname="udo", lastname="juergens")) + session.add(User(id=2, firstname="heino", lastname="n/a")) + transaction.commit() + session = Session() + session.query(User).update(dict(lastname="smith")) + transaction.commit() + with self.conn.begin(): + results = self.conn.execute( + test_users.select().where(test_users.c.lastname == "smith") + ) + self.assertEqual(len(results.fetchall()), 2) + + def testBulkDeleteUsingRegister(self): + session = EventSession() + session.add(User(id=1, firstname="udo", lastname="juergens")) + session.add(User(id=2, firstname="heino", lastname="n/a")) + transaction.commit() + session = EventSession() + session.query(User).delete() + transaction.commit() + with self.conn.begin(): + results = self.conn.execute(test_users.select()) + self.assertEqual(len(results.fetchall()), 0) + + def testBulkUpdateUsingRegister(self): + session = EventSession() + session.add(User(id=1, firstname="udo", lastname="juergens")) + session.add(User(id=2, firstname="heino", lastname="n/a")) + transaction.commit() + session = EventSession() + session.query(User).update(dict(lastname="smith")) + transaction.commit() + with self.conn.begin(): + results = self.conn.execute( + test_users.select().where(test_users.c.lastname == "smith") + ) + self.assertEqual(len(results.fetchall()), 2) + + def testFailedJoin(self): + # When a join is issued while the transaction is in COMMITFAILED, the + # session is never closed and the session id stays in _SESSION_STATE, + # which means the session won't be joined in the future either. This + # causes the session to stay open forever, potentially accumulating + # data, but never issuing a commit. + dummy = DummyDataManager(key="dummy.first") + transaction.get().join(dummy) + try: + transaction.commit() + except DummyException: + # Commit raised an error, we are now in COMMITFAILED + pass + self.assertEqual(transaction.get().status, ZopeStatus.COMMITFAILED) + + session = Session() + # try to interact with the session while the transaction is still + # in COMMITFAILED + self.assertRaises(TransactionFailedError, session.query(User).all) + transaction.abort() + + # start a new transaction everything should be ok now + transaction.begin() + session = Session() + self.assertEqual([], session.query(User).all()) + session.add(User(id=1, firstname="udo", lastname="juergens")) + + # abort transaction, session should be closed without commit + transaction.abort() + self.assertEqual([], session.query(User).all()) + + def testKeepSession(self): + session = KeepSession() + + try: + with transaction.manager: + session.add(User(id=1, firstname="foo", lastname="bar")) + + if SA_GE_20: + user = session.get(User, 1) + else: + user = session.query(User).get(1) + + # if the keep_session works correctly, this transaction will not + # close the session after commit + with transaction.manager: + user.firstname = "super" + session.flush() + + # make sure the session is still attached to user + self.assertEqual(user.firstname, "super") + + finally: + # KeepSession does not rollback on transaction abort + session.rollback() + + def testExpireAll(self): + session = Session() + session.add(User(id=1, firstname="udo", lastname="juergens")) + transaction.commit() + + session = Session() + if SA_GE_20: + instance = session.get(User, 1) + else: + instance = session.query(User).get(1) + transaction.commit() # No work, session.close() + + self.assertEqual(sa.inspect(instance).expired, True) + + +class RetryTests(unittest.TestCase): + def setUp(self): + self.mappers = setup_mappers() + metadata.drop_all(engine) + metadata.create_all(engine) + self.tm1 = transaction.TransactionManager() + self.tm2 = transaction.TransactionManager() + # With psycopg2 you might supply isolation_level='SERIALIZABLE' here, + # unfortunately that is not supported by cx_Oracle. + self.e1 = sa.create_engine(TEST_DSN) + self.e2 = sa.create_engine(TEST_DSN) + self.s1 = orm.sessionmaker(bind=self.e1, twophase=TEST_TWOPHASE)() + tx.register(self.s1, transaction_manager=self.tm1) + self.s2 = orm.sessionmaker(bind=self.e2, twophase=TEST_TWOPHASE)() + tx.register(self.s2, transaction_manager=self.tm2) + self.tm1.begin() + self.s1.add(User(id=1, firstname="udo", lastname="juergens")) + self.tm1.commit() + + def tearDown(self): + self.tm1.abort() + self.tm2.abort() + metadata.drop_all(engine) + orm.clear_mappers() + # ensure any open connections on the temporary engines get closed + # if we don't do this we get a `ResourceWarning` in psycopg v3 + self.e1.dispose() + self.e2.dispose() + self.e1 = None + self.e2 = None + self.s1 = None + self.s2 = None + + def testRetry(self): + # sqlite is unable to run this test as the databse is locked + tm1, tm2, s1, s2 = self.tm1, self.tm2, self.s1, self.s2 + # make sure we actually start a session. + tm1.begin() + self.assertEqual( + len(s1.query(User).all()), + 1, + "Users table should have one row" + ) + tm2.begin() + self.assertEqual( + len(s2.query(User).all()), + 1, + "Users table should have one row" + ) + s1.query(User).delete() + if SA_GE_20: + user = s2.get(User, 1) + else: + user = s2.query(User).get(1) + user.lastname = "smith" + tm1.commit() + raised = False + try: + s2.flush() + except orm.exc.ConcurrentModificationError as e: + # This error is thrown when the number of updated rows is not as + # expected + raised = True + self.assertTrue(tm2._retryable(type(e), e), + "Error should be retryable") + self.assertTrue(raised, "Did not raise expected error") + + def testRetryThread(self): + tm1, tm2, s1, s2 = self.tm1, self.tm2, self.s1, self.s2 + # make sure we actually start a session. + tm1.begin() + self.assertEqual( + len(s1.query(User).all()), + 1, + "Users table should have one row" + ) + tm2.begin() + s2.connection().execute(sql.text( + "SET TRANSACTION ISOLATION LEVEL SERIALIZABLE" + )) + self.assertEqual( + len(s2.query(User).all()), + 1, + "Users table should have one row" + ) + s1.query(User).delete() + raised = False + + def target(): + time.sleep(0.2) + tm1.commit() + + thread = threading.Thread(target=target) + thread.start() + try: + if SA_GE_20: + s2.query(User).with_for_update().filter(User.id == 1).one() + else: + s2.query(User).with_for_update().get(1) + except exc.DBAPIError as e: + # This error wraps the underlying DBAPI module error, some of which + # are retryable + raised = True + retryable = tm2._retryable(type(e), e) + self.assertTrue(retryable, "Error should be retryable") + self.assertTrue(raised, "Did not raise expected error") + thread.join() # well, we must have joined by now + + +class MultipleEngineTests(unittest.TestCase): + def setUp(self): + if SA_GE_20: + self.skipTest( + 'Bound metadata is not supported in SQLAlchemy 2.0' + ) + + self.mappers = setup_mappers() + bound_metadata1.drop_all() + bound_metadata1.create_all() + bound_metadata2.drop_all() + bound_metadata2.create_all() + + def tearDown(self): + transaction.abort() + bound_metadata1.drop_all() + bound_metadata2.drop_all() + orm.clear_mappers() + + def testTwoEngines(self): + session = UnboundSession() + session.add(TestOne(id=1)) + session.add(TestTwo(id=2)) + session.flush() + transaction.commit() + session = UnboundSession() + rows = session.query(TestOne).all() + self.assertEqual(len(rows), 1) + rows = session.query(TestTwo).all() + self.assertEqual(len(rows), 1) + + +def tearDownReadMe(test): + Base = test.globs["Base"] + engine = test.globs["engine"] + Base.metadata.drop_all(engine) + + +def test_suite(): + import doctest + optionflags = doctest.NORMALIZE_WHITESPACE | doctest.ELLIPSIS + suite = unittest.TestSuite() + testLoader = unittest.defaultTestLoader + suite.addTest(testLoader.loadTestsFromTestCase(ZopeSQLAlchemyTests)) + suite.addTest(testLoader.loadTestsFromTestCase(MultipleEngineTests)) + if TEST_DSN.startswith("postgres") or TEST_DSN.startswith("oracle"): + suite.addTest(testLoader.loadTestsFromTestCase(RetryTests)) + + # examples in docs are only correct for SQLAlchemy >=1.4 + if parse_version(sqlalchemy_version) >= parse_version('1.4.0'): + suite.addTest( + doctest.DocFileSuite( + "README.rst", + optionflags=optionflags, + tearDown=tearDownReadMe, + globs={"TEST_DSN": TEST_DSN, "TEST_TWOPHASE": TEST_TWOPHASE}, + ) + ) + return suite diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope_deprecation-6.0.dist-info/INSTALLER b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope_deprecation-6.0.dist-info/INSTALLER new file mode 100644 index 0000000000000000000000000000000000000000..a1b589e38a32041e49332e5e81c2d363dc418d68 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope_deprecation-6.0.dist-info/INSTALLER @@ -0,0 +1 @@ +pip diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope_deprecation-6.0.dist-info/METADATA b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope_deprecation-6.0.dist-info/METADATA new file mode 100644 index 0000000000000000000000000000000000000000..56cb22d79272e9052d4fbe7240ce467eb7b3c6f9 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope_deprecation-6.0.dist-info/METADATA @@ -0,0 +1,213 @@ +Metadata-Version: 2.4 +Name: zope.deprecation +Version: 6.0 +Summary: Zope Deprecation Infrastructure +Home-page: https://github.com/zopefoundation/zope.deprecation +Author: Zope Foundation and Contributors +Author-email: zope-dev@zope.dev +License: ZPL-2.1 +Keywords: deprecation,deprecated,warning +Classifier: Intended Audience :: Developers +Classifier: License :: OSI Approved :: Zope Public License +Classifier: Programming Language :: Python +Classifier: Programming Language :: Python :: 3 +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 :: Python :: 3.13 +Classifier: Programming Language :: Python :: Implementation :: CPython +Classifier: Programming Language :: Python :: Implementation :: PyPy +Classifier: Framework :: Zope :: 3 +Requires-Python: >= 3.9 +License-File: LICENSE.txt +Requires-Dist: setuptools +Provides-Extra: docs +Requires-Dist: Sphinx; extra == "docs" +Provides-Extra: test +Requires-Dist: zope.testrunner>=6.4; extra == "test" +Dynamic: author +Dynamic: author-email +Dynamic: classifier +Dynamic: description +Dynamic: home-page +Dynamic: keywords +Dynamic: license +Dynamic: license-file +Dynamic: provides-extra +Dynamic: requires-dist +Dynamic: requires-python +Dynamic: summary + +====================== + ``zope.deprecation`` +====================== + +.. image:: https://img.shields.io/pypi/v/zope.deprecation.svg + :target: https://pypi.python.org/pypi/zope.deprecation/ + :alt: Latest release + +.. image:: https://img.shields.io/pypi/pyversions/zope.deprecation.svg + :target: https://pypi.org/project/zope.deprecation/ + :alt: Supported Python versions + +.. image:: https://github.com/zopefoundation/zope.deprecation/actions/workflows/tests.yml/badge.svg + :target: https://github.com/zopefoundation/zope.deprecation/actions/workflows/tests.yml + +.. image:: https://coveralls.io/repos/github/zopefoundation/zope.deprecation/badge.svg?branch=master + :target: https://coveralls.io/github/zopefoundation/zope.deprecation?branch=master + +.. image:: https://readthedocs.org/projects/zopedeprecation/badge/?version=latest + :target: https://zopedeprecation.readthedocs.io/en/latest/ + :alt: Documentation Status + + +This package provides a simple function called ``deprecated(names, reason)`` +to mark deprecated modules, classes, functions, methods and properties. + +Please see https://zopedeprecation.readthedocs.io for the documentation. + + +================================ + ``zope.deprecation`` Changelog +================================ + +6.0 (2025-09-12) +================ + +- Replace ``pkg_resources`` namespace with PEP 420 native namespace. + + +5.1 (2025-01-15) +================ + +- Add support for Python 3.12, 3.13. + +- Drop support for Python 3.7, 3.8. + + +5.0 (2023-03-29) +================ + +- Drop support for Python 2.7, 3.4, 3.5, 3.6. + +- Drop support for deprecated ``python setup.py test``. + +- Add support for Python 3.8, 3.9, 3.10, 3.11. + + +4.4.0 (2018-12-03) +================== + +- Add support for Python 3.7. + + +4.3.0 (2017-08-07) +================== + +- Allow custom warning classes to be specified to override the default + ``DeprecationWarning``. + See https://github.com/zopefoundation/zope.deprecation/pull/7 + +- Add support for Python 3.6. + +- Drop support for Python 3.3. + +4.2.0 (2016-11-07) +================== + +- Drop support for Python 2.6 and 3.2. + +- Add support for Python 3.5. + +4.1.2 (2015-01-13) +================== + +- Do not require a ``self`` parameter for deprecated functions. See: + https://github.com/zopefoundation/zope.deprecation/pull/1 + +4.1.1 (2014-03-19) +================== + +- Added explicit support for Python 3.4. + +4.1.0 (2013-12-20) +================== + +- Added a ``Suppressor`` context manager, allowing scoped suppression of + deprecation warnings. + +- Updated ``boostrap.py`` to version 2.2. + +4.0.2 (2012-12-31) +================== + +- Fleshed out PyPI Trove classifiers. + +4.0.1 (2012-11-21) +================== + +- Added support for Python 3.3. + +4.0.0 (2012-05-16) +================== + +- Automated build of Sphinx HTML docs and running doctest snippets via tox. + +- Added Sphinx documentation: + + - API docs moved from package-data README into ``docs/api.rst``. + + - Snippets can be tested by running 'make doctest'. + +- Updated support for continuous integration using ``tox`` and ``jenkins``. + +- 100% unit test coverage. + +- Added ``setup.py dev`` alias (runs ``setup.py develop`` plus installs + ``nose`` and ``coverage``). + +- Added ``setup.py docs`` alias (installs ``Sphinx`` and dependencies). + +- Removed spurious dependency on ``zope.testing``. + +- Dropped explicit support for Python 2.4 / 2.5 / 3.1. + + +3.5.1 (2012-03-15) +================== + +- Revert a move of `README.txt` to unbreak ``zope.app.apidoc``. + + +3.5.0 (2011-09-05) +================== + +- Replaced doctesting with unit testing. + +- Python 3 compatibility. + + +3.4.1 (2011-06-07) +================== + +- Removed import cycle for ``__show__`` by defining it in the + ``zope.deprecation.deprecation`` module. + +- Added support to bootstrap on Jython. + +- Fix ``zope.deprecation.warn()`` to make the signature identical to + ``warnings.warn()`` and to check for .pyc and .pyo files. + + +3.4.0 (2007-07-19) +================== + +- Release 3.4 final, corresponding to Zope 3.4. + + +3.3.0 (2007-02-18) +================== + +- Corresponds to the version of the ``zope.deprecation`` package shipped as + part of the Zope 3.3.0 release. diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope_deprecation-6.0.dist-info/RECORD b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope_deprecation-6.0.dist-info/RECORD new file mode 100644 index 0000000000000000000000000000000000000000..081fb959706c37193c96ec8200b9d861c387258c --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope_deprecation-6.0.dist-info/RECORD @@ -0,0 +1,14 @@ +zope/deprecation/__init__.py,sha256=vjbH1YsnZeNn_qYshtWPe3PCrDyVVVwWz6caDQOAn58,1014 +zope/deprecation/__pycache__/__init__.cpython-310.pyc,, +zope/deprecation/__pycache__/deprecation.cpython-310.pyc,, +zope/deprecation/__pycache__/fixture.cpython-310.pyc,, +zope/deprecation/__pycache__/tests.cpython-310.pyc,, +zope/deprecation/deprecation.py,sha256=iVBi9qx0SdL1MFwpyCTKMkc9LO2zCvg19mQNV4jgAA8,7090 +zope/deprecation/fixture.py,sha256=8GEX6PYsjhB1QJvcd2jSoxB4O8rJ1w3w3VLwFzDJEbI,25 +zope/deprecation/tests.py,sha256=fLtJnDxP_QEMD_27r2mDkXve4vbzYh0e8uLCyCPmYCA,20449 +zope_deprecation-6.0.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4 +zope_deprecation-6.0.dist-info/METADATA,sha256=uQs3IjI_LihA_08zdpJksAnEY9C0VF_VrrodtWMY1oY,5528 +zope_deprecation-6.0.dist-info/RECORD,, +zope_deprecation-6.0.dist-info/WHEEL,sha256=lTU6B6eIfYoiQJTZNc-fyaR6BpL6ehTzU3xGYxn2n8k,91 +zope_deprecation-6.0.dist-info/licenses/LICENSE.txt,sha256=PmcdsR32h1FswdtbPWXkqjg-rKPCDOo_r1Og9zNdCjw,2070 +zope_deprecation-6.0.dist-info/top_level.txt,sha256=QpUHvpO4wIuZDeEgKY8qZCtD-tAukB0fn_f6utzlb98,5 diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope_deprecation-6.0.dist-info/WHEEL b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope_deprecation-6.0.dist-info/WHEEL new file mode 100644 index 0000000000000000000000000000000000000000..370ec5f1aa3524bfd31a19fd21e907335f48a7f6 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope_deprecation-6.0.dist-info/WHEEL @@ -0,0 +1,5 @@ +Wheel-Version: 1.0 +Generator: setuptools (78.1.1) +Root-Is-Purelib: true +Tag: py3-none-any + diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope_deprecation-6.0.dist-info/licenses/LICENSE.txt b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope_deprecation-6.0.dist-info/licenses/LICENSE.txt new file mode 100644 index 0000000000000000000000000000000000000000..e1f9ad7b3b48377bfbfaa1b380c384ddea24060f --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope_deprecation-6.0.dist-info/licenses/LICENSE.txt @@ -0,0 +1,44 @@ +Zope Public License (ZPL) Version 2.1 + +A copyright notice accompanies this license document that identifies the +copyright holders. + +This license has been certified as open source. It has also been designated as +GPL compatible by the Free Software Foundation (FSF). + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1. Redistributions in source code must retain the accompanying copyright +notice, this list of conditions, and the following disclaimer. + +2. Redistributions in binary form must reproduce the accompanying copyright +notice, this list of conditions, and the following disclaimer in the +documentation and/or other materials provided with the distribution. + +3. Names of the copyright holders must not be used to endorse or promote +products derived from this software without prior written permission from the +copyright holders. + +4. The right to distribute this software or to use it for any purpose does not +give you the right to use Servicemarks (sm) or Trademarks (tm) of the +copyright +holders. Use of them is covered by separate agreement with the copyright +holders. + +5. If any files are modified, you must cause the modified files to carry +prominent notices stating that you changed the files and the date of any +change. + +Disclaimer + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``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 COPYRIGHT HOLDERS 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/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope_deprecation-6.0.dist-info/top_level.txt b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope_deprecation-6.0.dist-info/top_level.txt new file mode 100644 index 0000000000000000000000000000000000000000..66179d49851b253d0014a0c02ad468ff6d89c5db --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope_deprecation-6.0.dist-info/top_level.txt @@ -0,0 +1 @@ +zope diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope_event-6.1.dist-info/INSTALLER b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope_event-6.1.dist-info/INSTALLER new file mode 100644 index 0000000000000000000000000000000000000000..a1b589e38a32041e49332e5e81c2d363dc418d68 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope_event-6.1.dist-info/INSTALLER @@ -0,0 +1 @@ +pip diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope_event-6.1.dist-info/METADATA b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope_event-6.1.dist-info/METADATA new file mode 100644 index 0000000000000000000000000000000000000000..d0da5a2c14d09dfc9909728ae346047989a0b252 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope_event-6.1.dist-info/METADATA @@ -0,0 +1,227 @@ +Metadata-Version: 2.4 +Name: zope.event +Version: 6.1 +Summary: Very basic event publishing system +Home-page: https://github.com/zopefoundation/zope.event +Author: Zope Foundation and Contributors +Author-email: zope-dev@zope.dev +License: ZPL-2.1 +Keywords: event framework dispatch subscribe publish +Classifier: Development Status :: 5 - Production/Stable +Classifier: Intended Audience :: Developers +Classifier: Operating System :: OS Independent +Classifier: Programming Language :: Python +Classifier: Programming Language :: Python :: 3 +Classifier: Programming Language :: Python :: 3.10 +Classifier: Programming Language :: Python :: 3.11 +Classifier: Programming Language :: Python :: 3.12 +Classifier: Programming Language :: Python :: 3.13 +Classifier: Programming Language :: Python :: 3.14 +Classifier: Programming Language :: Python :: Implementation :: CPython +Classifier: Programming Language :: Python :: Implementation :: Jython +Classifier: Programming Language :: Python :: Implementation :: PyPy +Classifier: Framework :: Zope :: 3 +Classifier: Topic :: Software Development :: Libraries :: Python Modules +Requires-Python: >=3.10 +License-File: LICENSE.txt +Provides-Extra: docs +Requires-Dist: Sphinx; extra == "docs" +Provides-Extra: test +Requires-Dist: zope.testrunner>=6.4; extra == "test" +Dynamic: author +Dynamic: author-email +Dynamic: classifier +Dynamic: description +Dynamic: home-page +Dynamic: keywords +Dynamic: license +Dynamic: license-file +Dynamic: provides-extra +Dynamic: requires-python +Dynamic: summary + +========== +zope.event +========== + +.. image:: https://img.shields.io/pypi/v/zope.event.svg + :target: https://pypi.python.org/pypi/zope.event/ + :alt: Latest Version + +.. image:: https://github.com/zopefoundation/zope.event/actions/workflows/tests.yml/badge.svg + :target: https://github.com/zopefoundation/zope.event/actions/workflows/tests.yml + +.. image:: https://readthedocs.org/projects/zopeevent/badge/?version=latest + :target: http://zopeevent.readthedocs.org/en/latest/ + :alt: Documentation Status + +The ``zope.event`` package provides a simple event system, including: + +- An event publishing API, intended for use by applications which are + unaware of any subscribers to their events. + +- A very simple synchronous event-dispatching system, on which more sophisticated + event dispatching systems can be built. For example, a type-based + event dispatching system that builds on ``zope.event`` can be found in + ``zope.component``. + +Please see http://zopeevent.readthedocs.io/ for the documentation. + +========================== + ``zope.event`` Changelog +========================== + + +6.1 (2025-11-07) +================ + +- Add support for Python 3.14. + +- Drop support for Python 3.9. + +- Remove no longer necessary ``setuptools`` runtime dependency. + + +6.0 (2025-09-12) +================ + +- Replace ``pkg_resources`` namespace with PEP 420 native namespace. + +5.1.1 (2025-07-22) +================== + +- Require ``setuptools >= 75.8.2`` to prevent problems with the new packaging + standard. + (`#30 `_) + + +5.1 (2025-06-26) +================ + +- Add support for Python 3.12 and 3.13. + +- Drop support for Python 3.7 and 3.8. + + +5.0 (2023-06-23) +================ + +- Drop support for Python 2.7, 3.5, 3.6. + + +4.6 (2022-12-15) +================ + +- Port documentation to Python 3. + +- Add support for Python 3.10, 3.11. + + +4.5.0 (2020-09-18) +================== + +- Add support for Python 3.8 and 3.9. + +- Remove support for Python 3.4. + + +4.4 (2018-10-05) +================ + +- Add support for Python 3.7 + + +4.3.0 (2017-07-25) +================== + +- Add support for Python 3.6. + +- Drop support for Python 3.3. + + +4.2.0 (2016-02-17) +================== + +- Add support for Python 3.5. + +- Drop support for Python 2.6 and 3.2. + + +4.1.0 (2015-10-18) +================== + +- Require 100% branch (as well as statement) coverage. + +- Add a simple class-based handler implementation. + + +4.0.3 (2014-03-19) +================== + +- Add support for Python 3.4. + +- Update ``boostrap.py`` to version 2.2. + + +4.0.2 (2012-12-31) +================== + +- Flesh out PyPI Trove classifiers. + +- Add support for jython 2.7. + + +4.0.1 (2012-11-21) +================== + +- Add support for Python 3.3. + + +4.0.0 (2012-05-16) +================== + +- Automate build of Sphinx HTML docs and running doctest snippets via tox. + +- Drop explicit support for Python 2.4 / 2.5 / 3.1. + +- Add support for PyPy. + + +3.5.2 (2012-03-30) +================== + +- This release is the last which will maintain support for Python 2.4 / + Python 2.5. + +- Add support for continuous integration using ``tox`` and ``jenkins``. + +- Add 'setup.py dev' alias (runs ``setup.py develop`` plus installs + ``nose`` and ``coverage``). + +- Add 'setup.py docs' alias (installs ``Sphinx`` and dependencies). + + +3.5.1 (2011-08-04) +================== + +- Add Sphinx documentation. + + +3.5.0 (2010-05-01) +================== + +- Add change log to ``long-description``. + +- Add support for Python 3.x. + + +3.4.1 (2009-03-03) +================== + +- A few minor cleanups. + + +3.4.0 (2007-07-14) +================== + +- Initial release as a separate project. diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope_event-6.1.dist-info/RECORD b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope_event-6.1.dist-info/RECORD new file mode 100644 index 0000000000000000000000000000000000000000..f83456f628dee42c7f94aa525f5c7beaca9ed33b --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope_event-6.1.dist-info/RECORD @@ -0,0 +1,12 @@ +zope/event/__init__.py,sha256=wSR1Y_yVzSd97zWmPCf4nLZqWyidlJ8_D85Ur_iYx1s,1142 +zope/event/__pycache__/__init__.cpython-310.pyc,, +zope/event/__pycache__/classhandler.cpython-310.pyc,, +zope/event/__pycache__/tests.cpython-310.pyc,, +zope/event/classhandler.py,sha256=2xh4_ofStVc0an9FlHguXNTJwarIRYrWzR-LHf0Ud1Y,1820 +zope/event/tests.py,sha256=GpIP4EIxUZ0fA8vnT01Qv-B7vI6El2w9_prF0EmDrM8,1871 +zope_event-6.1.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4 +zope_event-6.1.dist-info/METADATA,sha256=u8j0b8UsB8em-J7bZ7VHcGc72lpHIV_dNbhjSAU171Y,5130 +zope_event-6.1.dist-info/RECORD,, +zope_event-6.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91 +zope_event-6.1.dist-info/licenses/LICENSE.txt,sha256=PmcdsR32h1FswdtbPWXkqjg-rKPCDOo_r1Og9zNdCjw,2070 +zope_event-6.1.dist-info/top_level.txt,sha256=QpUHvpO4wIuZDeEgKY8qZCtD-tAukB0fn_f6utzlb98,5 diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope_event-6.1.dist-info/WHEEL b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope_event-6.1.dist-info/WHEEL new file mode 100644 index 0000000000000000000000000000000000000000..e7fa31b6f3f78deb1022c1f7927f07d4d16da822 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope_event-6.1.dist-info/WHEEL @@ -0,0 +1,5 @@ +Wheel-Version: 1.0 +Generator: setuptools (80.9.0) +Root-Is-Purelib: true +Tag: py3-none-any + diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope_event-6.1.dist-info/licenses/LICENSE.txt b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope_event-6.1.dist-info/licenses/LICENSE.txt new file mode 100644 index 0000000000000000000000000000000000000000..e1f9ad7b3b48377bfbfaa1b380c384ddea24060f --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope_event-6.1.dist-info/licenses/LICENSE.txt @@ -0,0 +1,44 @@ +Zope Public License (ZPL) Version 2.1 + +A copyright notice accompanies this license document that identifies the +copyright holders. + +This license has been certified as open source. It has also been designated as +GPL compatible by the Free Software Foundation (FSF). + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1. Redistributions in source code must retain the accompanying copyright +notice, this list of conditions, and the following disclaimer. + +2. Redistributions in binary form must reproduce the accompanying copyright +notice, this list of conditions, and the following disclaimer in the +documentation and/or other materials provided with the distribution. + +3. Names of the copyright holders must not be used to endorse or promote +products derived from this software without prior written permission from the +copyright holders. + +4. The right to distribute this software or to use it for any purpose does not +give you the right to use Servicemarks (sm) or Trademarks (tm) of the +copyright +holders. Use of them is covered by separate agreement with the copyright +holders. + +5. If any files are modified, you must cause the modified files to carry +prominent notices stating that you changed the files and the date of any +change. + +Disclaimer + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``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 COPYRIGHT HOLDERS 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/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope_event-6.1.dist-info/top_level.txt b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope_event-6.1.dist-info/top_level.txt new file mode 100644 index 0000000000000000000000000000000000000000..66179d49851b253d0014a0c02ad468ff6d89c5db --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope_event-6.1.dist-info/top_level.txt @@ -0,0 +1 @@ +zope diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope_interface-8.2.dist-info/INSTALLER b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope_interface-8.2.dist-info/INSTALLER new file mode 100644 index 0000000000000000000000000000000000000000..a1b589e38a32041e49332e5e81c2d363dc418d68 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope_interface-8.2.dist-info/INSTALLER @@ -0,0 +1 @@ +pip diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope_interface-8.2.dist-info/METADATA b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope_interface-8.2.dist-info/METADATA new file mode 100644 index 0000000000000000000000000000000000000000..356ba7e12de227420d30f5abdd6ab466df720f2a --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope_interface-8.2.dist-info/METADATA @@ -0,0 +1,1288 @@ +Metadata-Version: 2.4 +Name: zope.interface +Version: 8.2 +Summary: Interfaces for Python +Author-email: Zope Foundation and contributors +Maintainer-email: Plone Foundation and contributors +License-Expression: ZPL-2.1 +Project-URL: Documentation, https://zopeinterface.readthedocs.io +Project-URL: Issues, https://github.com/zopefoundation/zope.interface/issues +Project-URL: Source, https://github.com/zopefoundation/zope.interface +Project-URL: Changelog, https://github.com/zopefoundation/zope.interface/blob/master/CHANGES.rst +Keywords: interface,components,plugins +Classifier: Development Status :: 5 - Production/Stable +Classifier: Intended Audience :: Developers +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.10 +Classifier: Programming Language :: Python :: 3.11 +Classifier: Programming Language :: Python :: 3.12 +Classifier: Programming Language :: Python :: 3.13 +Classifier: Programming Language :: Python :: 3.14 +Classifier: Programming Language :: Python :: Implementation :: CPython +Classifier: Programming Language :: Python :: Implementation :: PyPy +Requires-Python: >=3.10 +Description-Content-Type: text/x-rst +License-File: LICENSE.txt +Provides-Extra: docs +Requires-Dist: Sphinx; extra == "docs" +Requires-Dist: repoze.sphinx.autointerface; extra == "docs" +Requires-Dist: furo; extra == "docs" +Provides-Extra: test +Requires-Dist: coverage[toml]; extra == "test" +Requires-Dist: zope.event; extra == "test" +Requires-Dist: zope.testing; extra == "test" +Provides-Extra: testing +Requires-Dist: coverage[toml]; extra == "testing" +Requires-Dist: zope.event; extra == "testing" +Requires-Dist: zope.testing; extra == "testing" +Dynamic: license-file + +==================== + ``zope.interface`` +==================== + +.. image:: https://img.shields.io/pypi/v/zope.interface.svg + :target: https://pypi.python.org/pypi/zope.interface/ + :alt: Latest Version + +.. image:: https://img.shields.io/pypi/pyversions/zope.interface.svg + :target: https://pypi.org/project/zope.interface/ + :alt: Supported Python versions + +.. image:: https://github.com/zopefoundation/zope.interface/actions/workflows/tests.yml/badge.svg + :target: https://github.com/zopefoundation/zope.interface/actions/workflows/tests.yml + +.. image:: https://readthedocs.org/projects/zopeinterface/badge/?version=latest + :target: https://zopeinterface.readthedocs.io/en/latest/ + :alt: Documentation Status + +This package is intended to be independently reusable in any Python +project. It is maintained by the `Zope Toolkit project +`_. + +This package provides an implementation of "object interfaces" for Python. +Interfaces are a mechanism for labeling objects as conforming to a given +API or contract. So, this package can be considered as implementation of +the `Design By Contract`_ methodology support in Python. + +.. _Design By Contract: http://en.wikipedia.org/wiki/Design_by_contract + +For detailed documentation, please see https://zopeinterface.readthedocs.io/en/latest/ + +Change log +========== + +8.2 (2026-01-09) +---------------- + +- Move all supported package metadata into ``pyproject.toml``. + +- Ignore ``__annotate_func__`` added in Python 3.14b1. + + +8.1.1 (2025-11-15) +------------------ + +- Fix the GitHub workflow for publishing wheels, which failed for Linux/arm64. + (`#348 `_) + + +8.1 (2025-11-10) +---------------- + +- Drop support for Python 3.9. + +- Add support for Python 3.14. + + +8.0.1 (2025-09-25) +------------------ + +- Make tests resilient against different ways of calling them. + +- Remove run-time dependency on ``setuptools``. + + +8.0 (2025-09-12) +---------------- + +- Replace ``pkg_resources`` namespace with PEP 420 native namespace. + +- Drop support for Python 3.8. + +- Allow using newer ``setuptools`` version. + (`#333 `_) + + +7.2 (2024-11-28) +---------------- + +- Add preliminary support for Python 3.14a2, this means that + ``.common.builtins.IByteString`` and ``.common.collections.IByteString`` are + no longer available from this Python version onwards as Python 3.14 dropped + ``collections.abc.ByteString``. + + +7.1.1 (2024-10-23) +------------------ + +- Fix segmentation faults in `weakrefobject.c` on Python 3.12 and 3.13. + (`#323 `_) + + +7.1.0 (2024-10-10) +------------------ + +- Declare support for Python 3.13. + +- Fix segmentation faults on Python 3.13. + (`#323 `_) + + +7.0.3 (2024-08-27) +------------------ + +- Fix `Assertion 'memb->type -- T_PYSSIZET' failed.` for Python < 3.12. + (`#319 `_) + + +7.0.2 (2024-08-26) +------------------ + +- Fix reference-counting bug in C module initialization (broken in 7.0). + (`#316 `_) + + +7.0.1 (2024-08-06) +------------------ + +- Fix subclassability of ``ObjectSpecificationDescriptor`` (broken in 7.0). + (`#312 `_) + + +7.0 (2024-08-06) +---------------- + +- Enable heap-based types (PEP 384) for Python >= 3.11. + +- Adopt multi-phase module initialization (PEP 489). + +- Drop support for Python 3.7. + + +6.4.post2 (2024-05-24) +---------------------- + +- Publish missing Windows wheels, second attempt. + (`#295 `_) + + +6.4.post1 (2024-05-23) +---------------------- + +- Publish missing Windows wheels. + (`#295 `_) + + +6.4.post0 (2024-05-22) +---------------------- + +- The sdist of version 6.4 was uploaded to PyPI as + ``zope_interface-6.4.tar.gz`` instead of ``zope.interface-6.4-py2.tar.gz`` + which cannot be installed by ``zc.buildout``. This release is a re-release + of version 6.4 with the correct sdist name. + (`#298 `_) + + +6.4 (2024-05-15) +---------------- + +- Adjust for incompatible changes in Python 3.13b1. + (`#292 `_) + +- Build windows wheels on GHA. + + +6.3 (2024-04-12) +---------------- + +- Add preliminary support for Python 3.13 as of 3.13a6. + + +6.2 (2024-02-16) +---------------- + +- Add preliminary support for Python 3.13 as of 3.13a3. + +- Add support to use the pipe (``|``) syntax for ``typing.Union``. + (`#280 `_) + + +6.1 (2023-10-05) +---------------- + +- Build Linux binary wheels for Python 3.12. + +- Add support for Python 3.12. + +- Fix building of the docs for non-final versions. + + +6.0 (2023-03-17) +---------------- + +- Build Linux binary wheels for Python 3.11. + +- Drop support for Python 2.7, 3.5, 3.6. + +- Fix test deprecation warning on Python 3.11. + +- Add preliminary support for Python 3.12 as of 3.12a5. + +- Drop: + + + `zope.interface.implements` + + `zope.interface.implementsOnly` + + `zope.interface.classProvides` + + +5.5.2 (2022-11-17) +------------------ + +- Add support for building arm64 wheels on macOS. + + +5.5.1 (2022-11-03) +------------------ + +- Add support for final Python 3.11 release. + + +5.5.0 (2022-10-10) +------------------ + +- Add support for Python 3.10 and 3.11 (as of 3.11.0rc2). + +- Add missing Trove classifier showing support for Python 3.9. + +- Add some more entries to ``zope.interface.interfaces.__all__``. + +- Disable unsafe math optimizations in C code. See `pull request 262 + `_. + + +5.4.0 (2021-04-15) +------------------ + +- Make the C implementation of the ``__providedBy__`` descriptor stop + ignoring all errors raised when accessing the instance's + ``__provides__``. Now it behaves like the Python version and only + catches ``AttributeError``. The previous behaviour could lead to + crashing the interpreter in cases of recursion and errors. See + `issue 239 `_. + +- Update the ``repr()`` and ``str()`` of various objects to be shorter + and more informative. In many cases, the ``repr()`` is now something + that can be evaluated to produce an equal object. For example, what + was previously printed as ```` is now + shown as ``classImplements(list, IMutableSequence, IIterable)``. See + `issue 236 `_. + +- Make ``Declaration.__add__`` (as in ``implementedBy(Cls) + + ISomething``) try harder to preserve a consistent resolution order + when the two arguments share overlapping pieces of the interface + inheritance hierarchy. Previously, the right hand side was always + put at the end of the resolution order, which could easily produce + invalid orders. See `issue 193 + `_. + + +5.3.0 (2020-03-21) +------------------ + +- No changes from 5.3.0a1 + + +5.3.0a1 (2021-03-18) +-------------------- + +- Improve the repr of ``zope.interface.Provides`` to remove ambiguity + about what is being provided. This is especially helpful diagnosing + IRO issues. + +- Allow subclasses of ``BaseAdapterRegistry`` (including + ``AdapterRegistry`` and ``VerifyingAdapterRegistry``) to have + control over the data structures. This allows persistent + implementations such as those based on ZODB to choose more scalable + options (e.g., BTrees instead of dicts). See `issue 224 + `_. + +- Fix a reference counting issue in ``BaseAdapterRegistry`` that could + lead to references to interfaces being kept around even when all + utilities/adapters/subscribers providing that interface have been + removed. This is mostly an issue for persistent implementations. + Note that this only corrects the issue moving forward, it does not + solve any already corrupted reference counts. See `issue 227 + `_. + +- Add the method ``BaseAdapterRegistry.rebuild()``. This can be used + to fix the reference counting issue mentioned above, as well as to + update the data structures when custom data types have changed. + +- Add the interface method ``IAdapterRegistry.subscribed()`` and + implementation ``BaseAdapterRegistry.subscribed()`` for querying + directly registered subscribers. See `issue 230 + `_. + +- Add the maintenance method + ``Components.rebuildUtilityRegistryFromLocalCache()``. Most users + will not need this, but it can be useful if the ``Components.utilities`` + registry is suspected to be out of sync with the ``Components`` + object itself (this might happen to persistent ``Components`` + implementations in the face of bugs). + +- Fix the ``Provides`` and ``ClassProvides`` descriptors to stop + allowing redundant interfaces (those already implemented by the + underlying class or meta class) to produce an inconsistent + resolution order. This is similar to the change in ``@implementer`` + in 5.1.0, and resolves inconsistent resolution orders with + ``zope.proxy`` and ``zope.location``. See `issue 207 + `_. + + +5.2.0 (2020-11-05) +------------------ + +- Add documentation section ``Persistency and Equality`` + (`#218 `_). + +- Create arm64 wheels. + +- Add support for Python 3.9. + + +5.1.2 (2020-10-01) +------------------ + +- Make sure to call each invariant only once when validating invariants. + Previously, invariants could be called multiple times because when an + invariant is defined in an interface, it's found by in all interfaces + inheriting from that interface. See `pull request 215 + `_. + + +5.1.1 (2020-09-30) +------------------ + +- Fix the method definitions of ``IAdapterRegistry.subscribe``, + ``subscriptions`` and ``subscribers``. Previously, they all were + defined to accept a ``name`` keyword argument, but subscribers have + no names and the implementation of that interface did not accept + that argument. See `issue 208 + `_. + +- Fix a potential reference leak in the C optimizations. Previously, + applications that dynamically created unique ``Specification`` + objects (e.g., used ``@implementer`` on dynamic classes) could + notice a growth of small objects over time leading to increased + garbage collection times. See `issue 216 + `_. + + .. caution:: + + This leak could prevent interfaces used as the bases of + other interfaces from being garbage collected. Those interfaces + will now be collected. + + One way in which this would manifest was that ``weakref.ref`` + objects (and things built upon them, like + ``Weak[Key|Value]Dictionary``) would continue to have access to + the original object even if there were no other visible + references to Python and the original object *should* have been + collected. This could be especially problematic for the + ``WeakKeyDictionary`` when combined with dynamic or local + (created in the scope of a function) interfaces, since interfaces + are hashed based just on their name and module name. See the + linked issue for an example of a resulting ``KeyError``. + + Note that such potential errors are not new, they are just once + again a possibility. + + +5.1.0 (2020-04-08) +------------------ + +- Make ``@implementer(*iface)`` and ``classImplements(cls, *iface)`` + ignore redundant interfaces. If the class already implements an + interface through inheritance, it is no longer redeclared + specifically for *cls*. This solves many instances of inconsistent + resolution orders, while still allowing the interface to be declared + for readability and maintenance purposes. See `issue 199 + `_. + +- Remove all bare ``except:`` statements. Previously, when accessing + special attributes such as ``__provides__``, ``__providedBy__``, + ``__class__`` and ``__conform__``, this package wrapped such access + in a bare ``except:`` statement, meaning that many errors could pass + silently; typically this would result in a fallback path being taken + and sometimes (like with ``providedBy()``) the result would be + non-sensical. This is especially true when those attributes are + implemented with descriptors. Now, only ``AttributeError`` is + caught. This makes errors more obvious. + + Obviously, this means that some exceptions will be propagated + differently than before. In particular, ``RuntimeError`` raised by + Acquisition in the case of circular containment will now be + propagated. Previously, when adapting such a broken object, a + ``TypeError`` would be the common result, but now it will be a more + informative ``RuntimeError``. + + In addition, ZODB errors like ``POSKeyError`` could now be + propagated where previously they would ignored by this package. + + See `issue 200 `_. + +- Require that the second argument (*bases*) to ``InterfaceClass`` is + a tuple. This only matters when directly using ``InterfaceClass`` to + create new interfaces dynamically. Previously, an individual + interface was allowed, but did not work correctly. Now it is + consistent with ``type`` and requires a tuple. + +- Let interfaces define custom ``__adapt__`` methods. This implements + the other side of the :pep:`246` adaptation protocol: objects being + adapted could already implement ``__conform__`` if they know about + the interface, and now interfaces can implement ``__adapt__`` if + they know about particular objects. There is no performance penalty + for interfaces that do not supply custom ``__adapt__`` methods. + + This includes the ability to add new methods, or override existing + interface methods using the new ``@interfacemethod`` decorator. + + See `issue 3 `_. + +- Make the internal singleton object returned by APIs like + ``implementedBy`` and ``directlyProvidedBy`` for objects that + implement or provide no interfaces more immutable. Previously an + internal cache could be mutated. See `issue 204 + `_. + + +5.0.2 (2020-03-30) +------------------ + +- Ensure that objects that implement no interfaces (such as direct + subclasses of ``object``) still include ``Interface`` itself in + their ``__iro___`` and ``__sro___``. This fixes adapter registry + lookups for such objects when the adapter is registered for + ``Interface``. See `issue 197 + `_. + + +5.0.1 (2020-03-21) +------------------ + +- Ensure the resolution order for ``InterfaceClass`` is consistent. + See `issue 192 `_. + +- Ensure the resolution order for ``collections.OrderedDict`` is + consistent on CPython 2. (It was already consistent on Python 3 and PyPy). + +- Fix the handling of the ``ZOPE_INTERFACE_STRICT_IRO`` environment + variable. Previously, ``ZOPE_INTERFACE_STRICT_RO`` was read, in + contrast with the documentation. See `issue 194 + `_. + + +5.0.0 (2020-03-19) +------------------ + +- Make an internal singleton object returned by APIs like + ``implementedBy`` and ``directlyProvidedBy`` immutable. Previously, + it was fully mutable and allowed changing its ``__bases___``. That + could potentially lead to wrong results in pathological corner + cases. See `issue 158 + `_. + +- Support the ``PURE_PYTHON`` environment variable at runtime instead + of just at wheel build time. A value of 0 forces the C extensions to + be used (even on PyPy) failing if they aren't present. Any other + value forces the Python implementation to be used, ignoring the C + extensions. See `PR 151 `_. + +- Cache the result of ``__hash__`` method in ``InterfaceClass`` as a + speed optimization. The method is called very often (i.e several + hundred thousand times during Plone 5.2 startup). Because the hash value never + changes it can be cached. This improves test performance from 0.614s + down to 0.575s (1.07x faster). In a real world Plone case a reindex + index came down from 402s to 320s (1.26x faster). See `PR 156 + `_. + +- Change the C classes ``SpecificationBase`` and its subclass + ``ClassProvidesBase`` to store implementation attributes in their structures + instead of their instance dictionaries. This eliminates the use of + an undocumented private C API function, and helps make some + instances require less memory. See `PR 154 `_. + +- Reduce memory usage in other ways based on observations of usage + patterns in Zope (3) and Plone code bases. + + - Specifications with no dependents are common (more than 50%) so + avoid allocating a ``WeakKeyDictionary`` unless we need it. + - Likewise, tagged values are relatively rare, so don't allocate a + dictionary to hold them until they are used. + - Use ``__slots___`` or the C equivalent ``tp_members`` in more + common places. Note that this removes the ability to set arbitrary + instance variables on certain objects. + See `PR 155 `_. + + The changes in this release resulted in a 7% memory reduction after + loading about 6,000 modules that define about 2,200 interfaces. + + .. caution:: + + Details of many private attributes have changed, and external use + of those private attributes may break. In particular, the + lifetime and default value of ``_v_attrs`` has changed. + +- Remove support for hashing uninitialized interfaces. This could only + be done by subclassing ``InterfaceClass``. This has generated a + warning since it was first added in 2011 (3.6.5). Please call the + ``InterfaceClass`` constructor or otherwise set the appropriate + fields in your subclass before attempting to hash or sort it. See + `issue 157 `_. + +- Remove unneeded override of the ``__hash__`` method from + ``zope.interface.declarations.Implements``. Watching a reindex index + process in ZCatalog with on a Py-Spy after 10k samples the time for + ``.adapter._lookup`` was reduced from 27.5s to 18.8s (~1.5x faster). + Overall reindex index time shrunk from 369s to 293s (1.26x faster). + See `PR 161 + `_. + +- Make the Python implementation closer to the C implementation by + ignoring all exceptions, not just ``AttributeError``, during (parts + of) interface adaptation. See `issue 163 + `_. + +- Micro-optimization in ``.adapter._lookup`` , ``.adapter._lookupAll`` + and ``.adapter._subscriptions``: By loading ``components.get`` into + a local variable before entering the loop a bytcode "LOAD_FAST 0 + (components)" in the loop can be eliminated. In Plone, while running + all tests, average speedup of the "owntime" of ``_lookup`` is ~5x. + See `PR 167 + `_. + +- Add ``__all__`` declarations to all modules. This helps tools that + do auto-completion and documentation and results in less cluttered + results. Wildcard ("*") are not recommended and may be affected. See + `issue 153 + `_. + +- Fix ``verifyClass`` and ``verifyObject`` for builtin types like + ``dict`` that have methods taking an optional, unnamed argument with + no default value like ``dict.pop``. On PyPy3, the verification is + strict, but on PyPy2 (as on all versions of CPython) those methods + cannot be verified and are ignored. See `issue 118 + `_. + +- Update the common interfaces ``IEnumerableMapping``, + ``IExtendedReadMapping``, ``IExtendedWriteMapping``, + ``IReadSequence`` and ``IUniqueMemberWriteSequence`` to no longer + require methods that were removed from Python 3 on Python 3, such as + ``__setslice___``. Now, ``dict``, ``list`` and ``tuple`` properly + verify as ``IFullMapping``, ``ISequence`` and ``IReadSequence,`` + respectively on all versions of Python. + +- Add human-readable ``__str___`` and ``__repr___`` to ``Attribute`` + and ``Method``. These contain the name of the defining interface + and the attribute. For methods, it also includes the signature. + +- Change the error strings raised by ``verifyObject`` and + ``verifyClass``. They now include more human-readable information + and exclude extraneous lines and spaces. See `issue 170 + `_. + + .. caution:: This will break consumers (such as doctests) that + depended on the exact error messages. + +- Make ``verifyObject`` and ``verifyClass`` report all errors, if the + candidate object has multiple detectable violations. Previously they + reported only the first error. See `issue + `_. + + Like the above, this will break consumers depending on the exact + output of error messages if more than one error is present. + +- Add ``zope.interface.common.collections``, + ``zope.interface.common.numbers``, and ``zope.interface.common.io``. + These modules define interfaces based on the ABCs defined in the + standard library ``collections.abc``, ``numbers`` and ``io`` + modules, respectively. Importing these modules will make the + standard library concrete classes that are registered with those + ABCs declare the appropriate interface. See `issue 138 + `_. + +- Add ``zope.interface.common.builtins``. This module defines + interfaces of common builtin types, such as ``ITextString`` and + ``IByteString``, ``IDict``, etc. These interfaces extend the + appropriate interfaces from ``collections`` and ``numbers``, and the + standard library classes implement them after importing this module. + This is intended as a replacement for third-party packages like + `dolmen.builtins `_. + See `issue 138 `_. + +- Make ``providedBy()`` and ``implementedBy()`` respect ``super`` + objects. For instance, if class ``Derived`` implements ``IDerived`` + and extends ``Base`` which in turn implements ``IBase``, then + ``providedBy(super(Derived, derived))`` will return ``[IBase]``. + Previously it would have returned ``[IDerived]`` (in general, it + would previously have returned whatever would have been returned + without ``super``). + + Along with this change, adapter registries will unpack ``super`` + objects into their ``__self___`` before passing it to the factory. + Together, this means that ``component.getAdapter(super(Derived, + self), ITarget)`` is now meaningful. + + See `issue 11 `_. + +- Fix a potential interpreter crash in the low-level adapter + registry lookup functions. See issue 11. + +- Adopt Python's standard `C3 resolution order + `_ to compute the + ``__iro__`` and ``__sro__`` of interfaces, with tweaks to support + additional cases that are common in interfaces but disallowed for + Python classes. Previously, an ad-hoc ordering that made no + particular guarantees was used. + + This has many beneficial properties, including the fact that base + interface and base classes tend to appear near the end of the + resolution order instead of the beginning. The resolution order in + general should be more predictable and consistent. + + .. caution:: + In some cases, especially with complex interface inheritance + trees or when manually providing or implementing interfaces, the + resulting IRO may be quite different. This may affect adapter + lookup. + + The C3 order enforces some constraints in order to be able to + guarantee a sensible ordering. Older versions of zope.interface did + not impose similar constraints, so it was possible to create + interfaces and declarations that are inconsistent with the C3 + constraints. In that event, zope.interface will still produce a + resolution order equal to the old order, but it won't be guaranteed + to be fully C3 compliant. In the future, strict enforcement of C3 + order may be the default. + + A set of environment variables and module constants allows + controlling several aspects of this new behaviour. It is possible to + request warnings about inconsistent resolution orders encountered, + and even to forbid them. Differences between the C3 resolution order + and the previous order can be logged, and, in extreme cases, the + previous order can still be used (this ability will be removed in + the future). For details, see the documentation for + ``zope.interface.ro``. + +- Make inherited tagged values in interfaces respect the resolution + order (``__iro__``), as method and attribute lookup does. Previously + tagged values could give inconsistent results. See `issue 190 + `_. + +- Add ``getDirectTaggedValue`` (and related methods) to interfaces to + allow accessing tagged values irrespective of inheritance. See + `issue 190 + `_. + +- Ensure that ``Interface`` is always the last item in the ``__iro__`` + and ``__sro__``. This is usually the case, but if classes that do + not implement any interfaces are part of a class inheritance + hierarchy, ``Interface`` could be assigned too high a priority. + See `issue 8 `_. + +- Implement sorting, equality, and hashing in C for ``Interface`` + objects. In micro benchmarks, this makes those operations 40% to 80% + faster. This translates to a 20% speed up in querying adapters. + + Note that this changes certain implementation details. In + particular, ``InterfaceClass`` now has a non-default metaclass, and + it is enforced that ``__module__`` in instances of + ``InterfaceClass`` is read-only. + + See `PR 183 `_. + + +4.7.2 (2020-03-10) +------------------ + +- Remove deprecated use of setuptools features. See `issue 30 + `_. + + +4.7.1 (2019-11-11) +------------------ + +- Use Python 3 syntax in the documentation. See `issue 119 + `_. + + +4.7.0 (2019-11-11) +------------------ + +- Drop support for Python 3.4. + +- Change ``queryTaggedValue``, ``getTaggedValue``, + ``getTaggedValueTags`` in interfaces. They now include inherited + values by following ``__bases__``. See `PR 144 + `_. + + .. caution:: This may be a breaking change. + +- Add support for Python 3.8. + + +4.6.0 (2018-10-23) +------------------ + +- Add support for Python 3.7 + +- Fix ``verifyObject`` for class objects with staticmethods on + Python 3. See `issue 126 + `_. + + +4.5.0 (2018-04-19) +------------------ + +- Drop support for 3.3, avoid accidental dependence breakage via setup.py. + See `PR 110 `_. +- Allow registering and unregistering instance methods as listeners. + See `issue 12 `_ + and `PR 102 `_. +- Synchronize and simplify zope/__init__.py. See `issue 114 + `_ + + +4.4.3 (2017-09-22) +------------------ + +- Avoid exceptions when the ``__annotations__`` attribute is added to + interface definitions with Python 3.x type hints. See `issue 98 + `_. +- Fix the possibility of a rare crash in the C extension when + deallocating items. See `issue 100 + `_. + + +4.4.2 (2017-06-14) +------------------ + +- Fix a regression storing + ``zope.component.persistentregistry.PersistentRegistry`` instances. + See `issue 85 `_. + +- Fix a regression that could lead to the utility registration cache + of ``Components`` getting out of sync. See `issue 93 + `_. + + +4.4.1 (2017-05-13) +------------------ + +- Simplify the caching of utility-registration data. In addition to + simplification, avoids spurious test failures when checking for + leaks in tests with persistent registries. See `pull 84 + `_. + +- Raise ``ValueError`` when non-text names are passed to adapter registry + methods: prevents corruption of lookup caches. + + +4.4.0 (2017-04-21) +------------------ + +- Avoid a warning from the C compiler. + (https://github.com/zopefoundation/zope.interface/issues/71) + +- Add support for Python 3.6. + + +4.3.3 (2016-12-13) +------------------ + +- Correct typos and ReST formatting errors in documentation. + +- Add API documentation for the adapter registry. + +- Ensure that the ``LICENSE.txt`` file is included in built wheels. + +- Fix C optimizations broken on Py3k. See the Python bug at: + http://bugs.python.org/issue15657 + (https://github.com/zopefoundation/zope.interface/issues/60) + + +4.3.2 (2016-09-05) +------------------ + +- Fix equality testing of ``implementedBy`` objects and proxies. + (https://github.com/zopefoundation/zope.interface/issues/55) + + +4.3.1 (2016-08-31) +------------------ + +- Support Components subclasses that are not hashable. + (https://github.com/zopefoundation/zope.interface/issues/53) + + +4.3.0 (2016-08-31) +------------------ + +- Add the ability to sort the objects returned by ``implementedBy``. + This is compatible with the way interface classes sort so they can + be used together in ordered containers like BTrees. + (https://github.com/zopefoundation/zope.interface/issues/42) + +- Make ``setuptools`` a hard dependency of ``setup.py``. + (https://github.com/zopefoundation/zope.interface/issues/13) + +- Change a linear algorithm (O(n)) in ``Components.registerUtility`` and + ``Components.unregisterUtility`` into a dictionary lookup (O(1)) for + hashable components. This substantially improves the time taken to + manipulate utilities in large registries at the cost of some + additional memory usage. (https://github.com/zopefoundation/zope.interface/issues/46) + + +4.2.0 (2016-06-10) +------------------ + +- Add support for Python 3.5 + +- Drop support for Python 2.6 and 3.2. + + +4.1.3 (2015-10-05) +------------------ + +- Fix installation without a C compiler on Python 3.5 + (https://github.com/zopefoundation/zope.interface/issues/24). + + +4.1.2 (2014-12-27) +------------------ + +- Add support for PyPy3. + +- Remove unittest assertions deprecated in Python3.x. + +- Add ``zope.interface.document.asReStructuredText``, which formats the + generated text for an interface using ReST double-backtick markers. + + +4.1.1 (2014-03-19) +------------------ + +- Add support for Python 3.4. + + +4.1.0 (2014-02-05) +------------------ + +- Update ``boostrap.py`` to version 2.2. + +- Add ``@named(name)`` declaration, that specifies the component name, so it + does not have to be passed in during registration. + + +4.0.5 (2013-02-28) +------------------ + +- Fix a bug where a decorated method caused false positive failures on + ``verifyClass()``. + + +4.0.4 (2013-02-21) +------------------ + +- Fix a bug that was revealed by porting zope.traversing. During a loop, the + loop body modified a weakref dict causing a ``RuntimeError`` error. + + +4.0.3 (2012-12-31) +------------------ + +- Fleshed out PyPI Trove classifiers. + + +4.0.2 (2012-11-21) +------------------ + +- Add support for Python 3.3. + +- Restored ability to install the package in the absence of ``setuptools``. + +- LP #1055223: Fix test which depended on dictionary order and failed randomly + in Python 3.3. + + +4.0.1 (2012-05-22) +------------------ + +- Drop explicit ``DeprecationWarnings`` for "class advice" APIS (these + APIs are still deprecated under Python 2.x, and still raise an exception + under Python 3.x, but no longer cause a warning to be emitted under + Python 2.x). + + +4.0.0 (2012-05-16) +------------------ + +- Automated build of Sphinx HTML docs and running doctest snippets via tox. + +- Deprecate the "class advice" APIs from ``zope.interface.declarations``: + ``implements``, ``implementsOnly``, and ``classProvides``. In their place, + prefer the equivalent class decorators: ``@implementer``, + ``@implementer_only``, and ``@provider``. Code which uses the deprecated + APIs will not work as expected under Py3k. + +- Remove use of '2to3' and associated fixers when installing under Py3k. + The code is now in a "compatible subset" which supports Python 2.6, 2.7, + and 3.2, including PyPy 1.8 (the version compatible with the 2.7 language + spec). + +- Drop explicit support for Python 2.4 / 2.5 / 3.1. + +- Add support for PyPy. + +- Add support for continuous integration using ``tox`` and ``jenkins``. + +- Add 'setup.py dev' alias (runs ``setup.py develop`` plus installs + ``nose`` and ``coverage``). + +- Add 'setup.py docs' alias (installs ``Sphinx`` and dependencies). + +- Replace all unittest coverage previously accomplished via doctests with + unittests. The doctests have been moved into a ``docs`` section, managed + as a Sphinx collection. + +- LP #910987: Ensure that the semantics of the ``lookup`` method of + ``zope.interface.adapter.LookupBase`` are the same in both the C and + Python implementations. + +- LP #900906: Avoid exceptions due to tne new ``__qualname__`` attribute + added in Python 3.3 (see PEP 3155 for rationale). Thanks to Antoine + Pitrou for the patch. + + +3.8.0 (2011-09-22) +------------------ + +- New module ``zope.interface.registry``. This is code moved from + ``zope.component.registry`` which implements a basic nonperistent component + registry as ``zope.interface.registry.Components``. This class was moved + from ``zope.component`` to make porting systems (such as Pyramid) that rely + only on a basic component registry to Python 3 possible without needing to + port the entirety of the ``zope.component`` package. Backwards + compatibility import shims have been left behind in ``zope.component``, so + this change will not break any existing code. + +- New ``tests_require`` dependency: ``zope.event`` to test events sent by + Components implementation. The ``zope.interface`` package does not have a + hard dependency on ``zope.event``, but if ``zope.event`` is importable, it + will send component registration events when methods of an instance of + ``zope.interface.registry.Components`` are called. + +- New interfaces added to support ``zope.interface.registry.Components`` + addition: ``ComponentLookupError``, ``Invalid``, ``IObjectEvent``, + ``ObjectEvent``, ``IComponentLookup``, ``IRegistration``, + ``IUtilityRegistration``, ``IAdapterRegistration``, + ``ISubscriptionAdapterRegistration``, ``IHandlerRegistration``, + ``IRegistrationEvent``, ``RegistrationEvent``, ``IRegistered``, + ``Registered``, ``IUnregistered``, ``Unregistered``, + ``IComponentRegistry``, and ``IComponents``. + +- No longer Python 2.4 compatible (tested under 2.5, 2.6, 2.7, and 3.2). + + +3.7.0 (2011-08-13) +------------------ + +- Move changes from 3.6.2 - 3.6.5 to a new 3.7.x release line. + + +3.6.7 (2011-08-20) +------------------ + +- Fix sporadic failures on x86-64 platforms in tests of rich comparisons + of interfaces. + + +3.6.6 (2011-08-13) +------------------ + +- LP #570942: Now correctly compare interfaces from different modules but + with the same names. + + N.B.: This is a less intrusive / destabilizing fix than the one applied in + 3.6.3: we only fix the underlying cmp-alike function, rather than adding + the other "rich comparison" functions. + +- Revert to software as released with 3.6.1 for "stable" 3.6 release branch. + + +3.6.5 (2011-08-11) +------------------ + +- LP #811792: work around buggy behavior in some subclasses of + ``zope.interface.interface.InterfaceClass``, which invoke ``__hash__`` + before initializing ``__module__`` and ``__name__``. The workaround + returns a fixed constant hash in such cases, and issues a ``UserWarning``. + +- LP #804832: Under PyPy, ``zope.interface`` should not build its C + extension. Also, prevent attempting to build it under Jython. + +- Add a tox.ini for easier xplatform testing. + +- Fix testing deprecation warnings issued when tested under Py3K. + + +3.6.4 (2011-07-04) +------------------ + +- LP 804951: InterfaceClass instances were unhashable under Python 3.x. + + +3.6.3 (2011-05-26) +------------------ + +- LP #570942: Now correctly compare interfaces from different modules but + with the same names. + + +3.6.2 (2011-05-17) +------------------ + +- Moved detailed documentation out-of-line from PyPI page, linking instead to + http://docs.zope.org/zope.interface . + +- Fixes for small issues when running tests under Python 3.2 using + ``zope.testrunner``. + +- LP # 675064: Specify return value type for C optimizations module init + under Python 3: undeclared value caused warnings, and segfaults on some + 64 bit architectures. + +- setup.py now raises RuntimeError if you don't have Distutils installed when + running under Python 3. + + +3.6.1 (2010-05-03) +------------------ + +- A non-ASCII character in the changelog made 3.6.0 uninstallable on + Python 3 systems with another default encoding than UTF-8. + +- Fix compiler warnings under GCC 4.3.3. + + +3.6.0 (2010-04-29) +------------------ + +- LP #185974: Clear the cache used by ``Specificaton.get`` inside + ``Specification.changed``. Thanks to Jacob Holm for the patch. + +- Add support for Python 3.1. Contributors: + + Lennart Regebro + Martin v Loewis + Thomas Lotze + Wolfgang Schnerring + + The 3.1 support is completely backwards compatible. However, the implements + syntax used under Python 2.X does not work under 3.X, since it depends on + how metaclasses are implemented and this has changed. Instead it now supports + a decorator syntax (also under Python 2.X):: + + class Foo: + implements(IFoo) + ... + + can now also be written:: + + @implementer(IFoo): + class Foo: + ... + + There are 2to3 fixers available to do this change automatically in the + zope.fixers package. + +- Python 2.3 is no longer supported. + + +3.5.4 (2009-12-23) +------------------ + +- Use the standard Python doctest module instead of zope.testing.doctest, which + has been deprecated. + + +3.5.3 (2009-12-08) +------------------ + +- Fix an edge case: make providedBy() work when a class has '__provides__' in + its __slots__ (see http://thread.gmane.org/gmane.comp.web.zope.devel/22490) + + +3.5.2 (2009-07-01) +------------------ + +- BaseAdapterRegistry.unregister, unsubscribe: Remove empty portions of + the data structures when something is removed. This avoids leaving + references to global objects (interfaces) that may be slated for + removal from the calling application. + + +3.5.1 (2009-03-18) +------------------ + +- verifyObject: use getattr instead of hasattr to test for object attributes + in order to let exceptions other than AttributeError raised by properties + propagate to the caller + +- Add Sphinx-based documentation building to the package buildout + configuration. Use the ``bin/docs`` command after buildout. + +- Improve package description a bit. Unify changelog entries formatting. + +- Change package's mailing list address to zope-dev at zope.org as + zope3-dev at zope.org is now retired. + + +3.5.0 (2008-10-26) +------------------ + +- Fix declaration of _zope_interface_coptimizations, it's not a top level + package. + +- Add a DocTestSuite for odd.py module, so their tests are run. + +- Allow to bootstrap on Jython. + +- Fix https://bugs.launchpad.net/zope3/3.3/+bug/98388: ISpecification + was missing a declaration for __iro__. + +- Add optional code optimizations support, which allows the building + of C code optimizations to fail (Jython). + +- Replace `_flatten` with a non-recursive implementation, effectively making + it 3x faster. + + +3.4.1 (2007-10-02) +------------------ + +- Fix a setup bug that prevented installation from source on systems + without setuptools. + + +3.4.0 (2007-07-19) +------------------ + +- Final release for 3.4.0. + + +3.4.0b3 (2007-05-22) +-------------------- + + +- When checking whether an object is already registered, use identity + comparison, to allow adding registering with picky custom comparison methods. + + +3.3.0.1 (2007-01-03) +-------------------- + +- Made a reference to OverflowWarning, which disappeared in Python + 2.5, conditional. + + +3.3.0 (2007/01/03) +------------------ + +New Features +------------ + +- Refactor the adapter-lookup algorithim to make it much simpler and faster. + + Also, implement more of the adapter-lookup logic in C, making + debugging of application code easier, since there is less + infrastructre code to step through. + +- Treat objects without interface declarations as if they + declared that they provide ``zope.interface.Interface``. + +- Add a number of richer new adapter-registration interfaces + that provide greater control and introspection. + +- Add a new interface decorator to zope.interface that allows the + setting of tagged values on an interface at definition time (see + zope.interface.taggedValue). + +Bug Fixes +--------- + +- A bug in multi-adapter lookup sometimes caused incorrect adapters to + be returned. + + +3.2.0.2 (2006-04-15) +-------------------- + +- Fix packaging bug: 'package_dir' must be a *relative* path. + + +3.2.0.1 (2006-04-14) +-------------------- + +- Packaging change: suppress inclusion of 'setup.cfg' in 'sdist' builds. + + +3.2.0 (2006-01-05) +------------------ + +- Corresponds to the version of the zope.interface package shipped as part of + the Zope 3.2.0 release. + + +3.1.0 (2005-10-03) +------------------ + +- Corresponds to the version of the zope.interface package shipped as part of + the Zope 3.1.0 release. + +- Made attribute resolution order consistent with component lookup order, + i.e. new-style class MRO semantics. + +- Deprecate 'isImplementedBy' and 'isImplementedByInstancesOf' APIs in + favor of 'implementedBy' and 'providedBy'. + + +3.0.1 (2005-07-27) +------------------ + +- Corresponds to the version of the zope.interface package shipped as part of + the Zope X3.0.1 release. + +- Fix a bug reported by James Knight, which caused adapter registries + to fail occasionally to reflect declaration changes. + + +3.0.0 (2004-11-07) +------------------ + +- Corresponds to the version of the zope.interface package shipped as part of + the Zope X3.0.0 release. diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope_interface-8.2.dist-info/RECORD b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope_interface-8.2.dist-info/RECORD new file mode 100644 index 0000000000000000000000000000000000000000..c6631a2db635bfe3cb701d9e3478c308ca6845f1 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope_interface-8.2.dist-info/RECORD @@ -0,0 +1,108 @@ +zope/interface/__init__.py,sha256=9Euz0jFaHg3kT84m2HzikMt7s_JIAjM8BlVctyUfNTk,3475 +zope/interface/__pycache__/__init__.cpython-310.pyc,, +zope/interface/__pycache__/_compat.cpython-310.pyc,, +zope/interface/__pycache__/_flatten.cpython-310.pyc,, +zope/interface/__pycache__/adapter.cpython-310.pyc,, +zope/interface/__pycache__/advice.cpython-310.pyc,, +zope/interface/__pycache__/declarations.cpython-310.pyc,, +zope/interface/__pycache__/document.cpython-310.pyc,, +zope/interface/__pycache__/exceptions.cpython-310.pyc,, +zope/interface/__pycache__/interface.cpython-310.pyc,, +zope/interface/__pycache__/interfaces.cpython-310.pyc,, +zope/interface/__pycache__/registry.cpython-310.pyc,, +zope/interface/__pycache__/ro.cpython-310.pyc,, +zope/interface/__pycache__/verify.cpython-310.pyc,, +zope/interface/_compat.py,sha256=8FPCPdRAl2Mlkc45-FBvuN8i1kvYLEkIionVgjk2AP0,4413 +zope/interface/_flatten.py,sha256=NKviK4ZyLBCjxXvz5voI9pV_ui2SLqUhubbqZkvgEcg,1059 +zope/interface/_zope_interface_coptimizations.c,sha256=oCYrpT2efApCO-EbKs71YXyaSohAbTqdWQ7QEh49SNA,71198 +zope/interface/_zope_interface_coptimizations.cpython-310-x86_64-linux-gnu.so,sha256=fL-GPybY5zXa7KJX1h9knqbxounbao8cR2hZ054Bjz8,186360 +zope/interface/adapter.py,sha256=XN9PD8OrRmP1ZJy2gPvAMXtiOnKcHL34doH0HaKHguQ,36647 +zope/interface/advice.py,sha256=YftOBzbXuWQ3AuJImMtYv4SYbE7ubJrjodXzTgYR-dk,3918 +zope/interface/common/__init__.py,sha256=ho-q_3jeKVq-jO-5xrN9_Q4PR0o8PDwja5NYsO7qTI0,10644 +zope/interface/common/__pycache__/__init__.cpython-310.pyc,, +zope/interface/common/__pycache__/builtins.cpython-310.pyc,, +zope/interface/common/__pycache__/collections.cpython-310.pyc,, +zope/interface/common/__pycache__/idatetime.cpython-310.pyc,, +zope/interface/common/__pycache__/interfaces.cpython-310.pyc,, +zope/interface/common/__pycache__/io.cpython-310.pyc,, +zope/interface/common/__pycache__/mapping.cpython-310.pyc,, +zope/interface/common/__pycache__/numbers.cpython-310.pyc,, +zope/interface/common/__pycache__/sequence.cpython-310.pyc,, +zope/interface/common/builtins.py,sha256=WRHf0D-xo2yWu4uP0zvpISdfuwBqwFFYiYuPLNiIYvQ,3135 +zope/interface/common/collections.py,sha256=duvGnbFpUHwri5idqhYblEJrdDYuUvL3vIsZtXggQC4,6809 +zope/interface/common/idatetime.py,sha256=sn5ccP9CiQAYzn6mptWf05uInZFp9o_DRu9_MaDXM5c,21039 +zope/interface/common/interfaces.py,sha256=fT2pigpAZuqcm0bqVVNDlvSWtv9oKfsJ73ewrymUpIE,5908 +zope/interface/common/io.py,sha256=if6Yzclu_T7qeUQNsXeIqREqgVTu-rjYB_VGZfYyz3Y,1242 +zope/interface/common/mapping.py,sha256=XI9lO7Uwt_9sWDFyhDIk0Rjcr5nlu7SlD2KDyqdupdw,4687 +zope/interface/common/numbers.py,sha256=D4kUnF5OgAk6CKcxaW86VH_OPLh1OXt_cF6WaOfvjLk,1682 +zope/interface/common/sequence.py,sha256=SYvqSZpKRaX11vCADK6zGn0LqogPQ0u7INbqgTJ4sg8,5531 +zope/interface/common/tests/__init__.py,sha256=Am8tpD6HZQx6pfW7N22-dloC83-dKLA45NiM9Lx7Xss,5553 +zope/interface/common/tests/__pycache__/__init__.cpython-310.pyc,, +zope/interface/common/tests/__pycache__/basemapping.cpython-310.pyc,, +zope/interface/common/tests/__pycache__/test_builtins.cpython-310.pyc,, +zope/interface/common/tests/__pycache__/test_collections.cpython-310.pyc,, +zope/interface/common/tests/__pycache__/test_idatetime.cpython-310.pyc,, +zope/interface/common/tests/__pycache__/test_import_interfaces.cpython-310.pyc,, +zope/interface/common/tests/__pycache__/test_io.cpython-310.pyc,, +zope/interface/common/tests/__pycache__/test_numbers.cpython-310.pyc,, +zope/interface/common/tests/basemapping.py,sha256=iitIJEMm7LlS3vQU51RjoN3AeBUNNf0EGLXi_VklJAs,3768 +zope/interface/common/tests/test_builtins.py,sha256=eftbVFY5-e7r310YTuf6LlL1Jl5HJ0EXTWZ2icAmrnY,1485 +zope/interface/common/tests/test_collections.py,sha256=XlATWN4tuHLpl_4o0eocWiPV7GGFu5xH3RUN0fPZs0s,5829 +zope/interface/common/tests/test_idatetime.py,sha256=qGr8FDbiVuDZHjyDIKcz7Vz6qNfoFzd9eHejMTfIyAg,1923 +zope/interface/common/tests/test_import_interfaces.py,sha256=wCFk-2kc7r-kAeOXZn5th5Qw_6k_-pMvdguk5b4NstM,813 +zope/interface/common/tests/test_io.py,sha256=gYJnFT52De1JAJruKK6dzyQIdLgYdQME9Yn6QTn2QyI,1686 +zope/interface/common/tests/test_numbers.py,sha256=tPrvkFVYa2kSSxf8_j7XYctupfS4BI-ee_jQ5yU8zRM,1395 +zope/interface/declarations.py,sha256=csCgY3nsiTjpkjdHs53DJGoeIGSeI_mUaTISYQB_9dQ,43512 +zope/interface/document.py,sha256=mhSCJoxw7Whl-q-EMSkys--z3C7IyJ6TEsZ3psMqyJE,4139 +zope/interface/exceptions.py,sha256=lW7SnsOT73LZI8w3aRdCRVUubfSy-CGztchnKqv1-5A,8566 +zope/interface/interface.py,sha256=IXDKNZL0W_qG9nHYwXZ4RVhrMC-pkW5arnbbxrhJo38,39859 +zope/interface/interfaces.py,sha256=9abPucc_lYWpELDFt28wnbjRVtQ8pS48srV8toZmLgk,50268 +zope/interface/registry.py,sha256=eDnfUtTFp1z9f-4F-4ZQ9EATLheAYuCP9_coZ3XLdVw,25812 +zope/interface/ro.py,sha256=NeImEPsautGBC1VtQAQ1J1BGXmksw6hoSNWD7gVmEaQ,24577 +zope/interface/tests/__init__.py,sha256=Vu2CALgC5nADbRAZFb99LcDSXECcPCNdJDL-nv_6mZA,4242 +zope/interface/tests/__pycache__/__init__.cpython-310.pyc,, +zope/interface/tests/__pycache__/advisory_testing.cpython-310.pyc,, +zope/interface/tests/__pycache__/dummy.cpython-310.pyc,, +zope/interface/tests/__pycache__/idummy.cpython-310.pyc,, +zope/interface/tests/__pycache__/m1.cpython-310.pyc,, +zope/interface/tests/__pycache__/odd.cpython-310.pyc,, +zope/interface/tests/__pycache__/test_adapter.cpython-310.pyc,, +zope/interface/tests/__pycache__/test_advice.cpython-310.pyc,, +zope/interface/tests/__pycache__/test_compile_flags.cpython-310.pyc,, +zope/interface/tests/__pycache__/test_declarations.cpython-310.pyc,, +zope/interface/tests/__pycache__/test_document.cpython-310.pyc,, +zope/interface/tests/__pycache__/test_element.cpython-310.pyc,, +zope/interface/tests/__pycache__/test_exceptions.cpython-310.pyc,, +zope/interface/tests/__pycache__/test_interface.cpython-310.pyc,, +zope/interface/tests/__pycache__/test_interfaces.cpython-310.pyc,, +zope/interface/tests/__pycache__/test_odd_declarations.cpython-310.pyc,, +zope/interface/tests/__pycache__/test_registry.cpython-310.pyc,, +zope/interface/tests/__pycache__/test_ro.cpython-310.pyc,, +zope/interface/tests/__pycache__/test_sorting.cpython-310.pyc,, +zope/interface/tests/__pycache__/test_verify.cpython-310.pyc,, +zope/interface/tests/advisory_testing.py,sha256=T2XF0DT8t9zi1JxnvR1u0WXpRtyOn5027VMyEcN7Ldc,900 +zope/interface/tests/dummy.py,sha256=dd_cYIiPvYJDrEMQD0m2cl9SpkVMrQzMMu1yglSrnb8,913 +zope/interface/tests/idummy.py,sha256=ESC_l4UqjCkiCeXWfcphVGtrP7PoNwwTTGzLpp6Doo4,890 +zope/interface/tests/m1.py,sha256=clhSXmtaT8liCnM87Kp0bzAHfxIxr6gUBjXnVuxaUNI,850 +zope/interface/tests/odd.py,sha256=nwjmxbHCFuI2UvY3Pwc7CfkmZWfXsn3oCb7r7C34DxU,2967 +zope/interface/tests/test_adapter.py,sha256=pB3Y_oXXtdtDsKf0BYlvpW281nT1yendxtzWgWp9o_0,80508 +zope/interface/tests/test_advice.py,sha256=gFhlbHvSWuC9kdlBPeXO_8_9ihkSU-ih0pVhoocdp4U,6036 +zope/interface/tests/test_compile_flags.py,sha256=wU3vtmqgzll6HMPbzFErMpORoVghrcZ5krIV4x6rfo4,1290 +zope/interface/tests/test_declarations.py,sha256=gzATuEoy4KZLB3gyZDV6YD5yv5hdVaBqJIRMFdC2U7E,79081 +zope/interface/tests/test_document.py,sha256=0JIYe0GWvDPkr_IBACPw-8HsHNJyNNHBU_lUHYOXd9M,17220 +zope/interface/tests/test_element.py,sha256=z9Q2hYwPVzMX05NpA_IeiHoAb4qhTiHI57XQI38w4zQ,1120 +zope/interface/tests/test_exceptions.py,sha256=axXG_D_Ug3wdk1r3C_4dHOsOF4h-IvTt1RFyJfkAUz8,6495 +zope/interface/tests/test_interface.py,sha256=aWQAkBNgvA2M_s-gPac1XOwpi5ltkcDFy5KHyy2Gga0,93419 +zope/interface/tests/test_interfaces.py,sha256=l4SCfUmVfBO1UoZLsTOOvDyoYUM7Wex3J67uR7taFpQ,4395 +zope/interface/tests/test_odd_declarations.py,sha256=0DBSBIoOUdSRcDnhiScexGhZ2mVydYWnlJOBvny76Uo,7660 +zope/interface/tests/test_registry.py,sha256=8CyxRkJ46ITauSGp86y1gSN4KHvZNVPTVKgjD13aXBk,112599 +zope/interface/tests/test_ro.py,sha256=Z1K4CbcTkTtuEOc3y3ceXLsKjwkmO_GqYqqwzqFgvms,15257 +zope/interface/tests/test_sorting.py,sha256=-lMIltkIv7Dxu_HRuYtsa6HXVf1fk_jM0gUYHEvj0ac,2222 +zope/interface/tests/test_verify.py,sha256=JnVLFlHGgVn8fC6u-WPW-mDtfmSuDA2PC0sglWuVBjI,19200 +zope/interface/verify.py,sha256=cEaIWPcS6gT97RkQW2SQJxxuUP7wRrwYwsJtXqo8jdE,7333 +zope_interface-8.2.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4 +zope_interface-8.2.dist-info/METADATA,sha256=D9pYt0cVkYFNPORUIJYIH82HONTG8GJaz1Hr9j7PbQc,45392 +zope_interface-8.2.dist-info/RECORD,, +zope_interface-8.2.dist-info/WHEEL,sha256=Aiu96bhtsfzw3NvQvzxQNkf7f9Xl2wW2dtqHpSc6fW0,224 +zope_interface-8.2.dist-info/licenses/LICENSE.txt,sha256=PmcdsR32h1FswdtbPWXkqjg-rKPCDOo_r1Og9zNdCjw,2070 +zope_interface-8.2.dist-info/top_level.txt,sha256=QpUHvpO4wIuZDeEgKY8qZCtD-tAukB0fn_f6utzlb98,5 diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope_interface-8.2.dist-info/WHEEL b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope_interface-8.2.dist-info/WHEEL new file mode 100644 index 0000000000000000000000000000000000000000..25115084e0a688d615575d00b021da59fd274e1f --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope_interface-8.2.dist-info/WHEEL @@ -0,0 +1,8 @@ +Wheel-Version: 1.0 +Generator: setuptools (80.9.0) +Root-Is-Purelib: false +Tag: cp310-cp310-manylinux_2_5_x86_64 +Tag: cp310-cp310-manylinux1_x86_64 +Tag: cp310-cp310-manylinux_2_17_x86_64 +Tag: cp310-cp310-manylinux2014_x86_64 + diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope_interface-8.2.dist-info/licenses/LICENSE.txt b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope_interface-8.2.dist-info/licenses/LICENSE.txt new file mode 100644 index 0000000000000000000000000000000000000000..e1f9ad7b3b48377bfbfaa1b380c384ddea24060f --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope_interface-8.2.dist-info/licenses/LICENSE.txt @@ -0,0 +1,44 @@ +Zope Public License (ZPL) Version 2.1 + +A copyright notice accompanies this license document that identifies the +copyright holders. + +This license has been certified as open source. It has also been designated as +GPL compatible by the Free Software Foundation (FSF). + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1. Redistributions in source code must retain the accompanying copyright +notice, this list of conditions, and the following disclaimer. + +2. Redistributions in binary form must reproduce the accompanying copyright +notice, this list of conditions, and the following disclaimer in the +documentation and/or other materials provided with the distribution. + +3. Names of the copyright holders must not be used to endorse or promote +products derived from this software without prior written permission from the +copyright holders. + +4. The right to distribute this software or to use it for any purpose does not +give you the right to use Servicemarks (sm) or Trademarks (tm) of the +copyright +holders. Use of them is covered by separate agreement with the copyright +holders. + +5. If any files are modified, you must cause the modified files to carry +prominent notices stating that you changed the files and the date of any +change. + +Disclaimer + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``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 COPYRIGHT HOLDERS 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/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope_interface-8.2.dist-info/top_level.txt b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope_interface-8.2.dist-info/top_level.txt new file mode 100644 index 0000000000000000000000000000000000000000..66179d49851b253d0014a0c02ad468ff6d89c5db --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope_interface-8.2.dist-info/top_level.txt @@ -0,0 +1 @@ +zope diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope_sqlalchemy-4.1.dist-info/INSTALLER b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope_sqlalchemy-4.1.dist-info/INSTALLER new file mode 100644 index 0000000000000000000000000000000000000000..a1b589e38a32041e49332e5e81c2d363dc418d68 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope_sqlalchemy-4.1.dist-info/INSTALLER @@ -0,0 +1 @@ +pip diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope_sqlalchemy-4.1.dist-info/METADATA b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope_sqlalchemy-4.1.dist-info/METADATA new file mode 100644 index 0000000000000000000000000000000000000000..2be84d1c244739b2e26193bf40f9b75c699008f6 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope_sqlalchemy-4.1.dist-info/METADATA @@ -0,0 +1,633 @@ +Metadata-Version: 2.4 +Name: zope.sqlalchemy +Version: 4.1 +Summary: Minimal Zope/SQLAlchemy transaction integration +Home-page: https://github.com/zopefoundation/zope.sqlalchemy +Author: Laurence Rowe +Author-email: laurence@lrowe.co.uk +License: ZPL-2.1 +Keywords: zope zope3 sqlalchemy +Classifier: Development Status :: 5 - Production/Stable +Classifier: Framework :: Pyramid +Classifier: Framework :: Zope :: 3 +Classifier: Framework :: Zope :: 5 +Classifier: Intended Audience :: Developers +Classifier: License :: OSI Approved :: Zope Public License +Classifier: Programming Language :: Python +Classifier: Programming Language :: Python :: 3 +Classifier: Programming Language :: Python :: 3.10 +Classifier: Programming Language :: Python :: 3.11 +Classifier: Programming Language :: Python :: 3.12 +Classifier: Programming Language :: Python :: 3.13 +Classifier: Programming Language :: Python :: 3.14 +Classifier: Programming Language :: Python :: Implementation :: CPython +Classifier: Topic :: Database +Classifier: Topic :: Software Development :: Libraries :: Python Modules +Requires-Python: >=3.10 +License-File: LICENSE.txt +Requires-Dist: packaging +Requires-Dist: SQLAlchemy!=1.4.0,!=1.4.1,!=1.4.2,!=1.4.3,!=1.4.4,!=1.4.5,!=1.4.6,!=2.0.32,!=2.0.33,!=2.0.34,!=2.0.35,>=1.2 +Requires-Dist: transaction>=1.6.0 +Requires-Dist: zope.interface>=3.6.0 +Provides-Extra: test +Requires-Dist: zope.testing; extra == "test" +Dynamic: author +Dynamic: author-email +Dynamic: classifier +Dynamic: description +Dynamic: home-page +Dynamic: keywords +Dynamic: license +Dynamic: license-file +Dynamic: provides-extra +Dynamic: requires-dist +Dynamic: requires-python +Dynamic: summary + +*************** +zope.sqlalchemy +*************** + +.. contents:: + :local: + +Introduction +============ + +The aim of this package is to unify the plethora of existing packages +integrating SQLAlchemy with Zope's transaction management. As such it seeks +only to provide a data manager and makes no attempt to define a `zopeish` way +to configure engines. + +For WSGI applications, Zope style automatic transaction management is +available with `repoze.tm2`_ (used by `Turbogears 2`_ and other systems). + +This package is also used by `pyramid_tm`_ (an add-on of the `Pyramid`_) web +framework. + +You need to understand `SQLAlchemy`_ and the `Zope transaction manager`_ for +this package and this README to make any sense. + +.. _repoze.tm2: https://repozetm2.readthedocs.io/en/latest/ + +.. _pyramid_tm: https://docs.pylonsproject.org/projects/pyramid_tm/en/latest/ + +.. _Pyramid: https://pylonsproject.org/ + +.. _Turbogears 2: https://turbogears.org/ + +.. _SQLAlchemy: https://sqlalchemy.org/docs/ + +.. _Zope transaction manager: https://www.zodb.org/en/latest/#transactions + +Running the tests +================= + +This package is distributed as a buildout. Using your desired python run: + +$ python bootstrap.py +$ ./bin/buildout + +This will download the dependent packages and setup the test script, which may +be run with: + +$ ./bin/test + +or with the standard setuptools test command: + +$ ./bin/py setup.py test + +To enable testing with your own database set the TEST_DSN environment variable +to your sqlalchemy database dsn. Two-phase commit behaviour may be tested by +setting the TEST_TWOPHASE variable to a non empty string. e.g: + +$ TEST_DSN=postgres://test:test@localhost/test TEST_TWOPHASE=True bin/test + +Usage in short +============== + +The integration between Zope transactions and the SQLAlchemy event system is +done using the ``register()`` function on the session factory class. + +.. code-block:: python + + from zope.sqlalchemy import register + from sqlalchemy import create_engine + from sqlalchemy.orm import sessionmaker, scoped_session + + engine = sqlalchemy.create_engine("postgresql://scott:tiger@localhost/test") + + DBSession = scoped_session(sessionmaker(bind=engine)) + register(DBSession) + +Instantiated sessions commits and rollbacks will now be integrated with Zope +transactions. + +.. code-block:: python + + import transaction + from sqlalchemy.sql import text + + session = DBSession() + + result = session.execute(text("DELETE FROM objects WHERE id=:id"), {"id": 2}) + row = result.fetchone() + + transaction.commit() + + +Full Example +============ + +This example is lifted directly from the SQLAlchemy declarative documentation. +First the necessary imports. + + >>> from sqlalchemy import Column, Integer, String, ForeignKey, create_engine + >>> from sqlalchemy.orm import declarative_base, scoped_session, sessionmaker, relationship + >>> from sqlalchemy.sql import text + >>> from zope.sqlalchemy import register + >>> import transaction + +Now to define the mapper classes. + + >>> Base = declarative_base() + >>> class User(Base): + ... __tablename__ = 'test_users' + ... id = Column('id', Integer, primary_key=True) + ... name = Column('name', String(50)) + ... addresses = relationship("Address", backref="user") + >>> class Address(Base): + ... __tablename__ = 'test_addresses' + ... id = Column('id', Integer, primary_key=True) + ... email = Column('email', String(50)) + ... user_id = Column('user_id', Integer, ForeignKey('test_users.id')) + +Create an engine and setup the tables. Note that for this example to work a +recent version of sqlite/pysqlite is required. 3.4.0 seems to be sufficient. + + >>> engine = create_engine(TEST_DSN) + >>> Base.metadata.create_all(engine) + +Now to create the session itself. As zope is a threaded web server we must use +scoped sessions. Zope and SQLAlchemy sessions are tied together by using the +register + + >>> Session = scoped_session(sessionmaker(bind=engine, + ... twophase=TEST_TWOPHASE)) + +Call the scoped session factory to retrieve a session. You may call this as +many times as you like within a transaction and you will always retrieve the +same session. At present there are no users in the database. + + >>> session = Session() + >>> register(session) + + >>> session.query(User).all() + [] + +We can now create a new user and commit the changes using Zope's transaction +machinery, just as Zope's publisher would. + + >>> session.add(User(id=1, name='bob')) + >>> transaction.commit() + +Engine level connections are outside the scope of the transaction integration. + + >>> conn = engine.connect() + >>> conn.execute(text('SELECT * FROM test_users')).fetchall() + [(1, ...'bob')] + >>> conn.close() + +A new transaction requires a new session. Let's add an address. + + >>> session = Session() + >>> bob = session.query(User).all()[0] + >>> str(bob.name) + 'bob' + >>> bob.addresses + [] + >>> bob.addresses.append(Address(id=1, email='bob@bob.bob')) + >>> transaction.commit() + >>> session = Session() + >>> bob = session.query(User).all()[0] + >>> bob.addresses + [
    ] + >>> str(bob.addresses[0].email) + 'bob@bob.bob' + >>> bob.addresses[0].email = 'wrong@wrong' + +To rollback a transaction, use transaction.abort(). + + >>> transaction.abort() + >>> session = Session() + >>> bob = session.query(User).all()[0] + >>> str(bob.addresses[0].email) + 'bob@bob.bob' + >>> transaction.abort() + +By default, zope.sqlalchemy puts sessions in an 'active' state when they are +first used. ORM write operations automatically move the session into a +'changed' state. This avoids unnecessary database commits. Sometimes it +is necessary to interact with the database directly through SQL. It is not +possible to guess whether such an operation is a read or a write. Therefore we +must manually mark the session as changed when manual SQL statements write +to the DB. + + >>> session = Session() + >>> conn = session.connection() + >>> users = Base.metadata.tables['test_users'] + >>> conn.execute(users.update().where(users.c.name=='bob'), {'name': 'ben'}) + + >>> from zope.sqlalchemy import mark_changed + >>> mark_changed(session) + >>> transaction.commit() + >>> session = Session() + >>> str(session.query(User).all()[0].name) + 'ben' + >>> transaction.abort() + +If this is a problem you may register the events and tell them to place the +session in the 'changed' state initially. + + >>> Session.remove() + >>> register(Session, 'changed') + + >>> session = Session() + >>> conn = session.connection() + >>> conn.execute(users.update().where(users.c.name=='ben'), {'name': 'bob'}) + + >>> transaction.commit() + >>> session = Session() + >>> str(session.query(User).all()[0].name) + 'bob' + >>> transaction.abort() + +The `mark_changed` function accepts a kwarg for `keep_session` which defaults +to `False` and is unaware of the registered extensions `keep_session` +configuration. + +If you intend for `keep_session` to be True, you can specify it explicitly: + + >>> from zope.sqlalchemy import mark_changed + >>> mark_changed(session, keep_session=True) + >>> transaction.commit() + +You can also use a configured extension to preserve this argument: + + >>> sessionExtension = register(session, keep_session=True) + >>> sessionExtension.mark_changed(session) + >>> transaction.commit() + + +Long-lasting session scopes +--------------------------- + +The default behaviour of the transaction integration is to close the session +after a commit. You can tell by trying to access an object after committing: + + >>> bob = session.query(User).all()[0] + >>> transaction.commit() + >>> bob.name + Traceback (most recent call last): + sqlalchemy.orm.exc.DetachedInstanceError: Instance is not bound to a Session; attribute refresh operation cannot proceed... + +To support cases where a session needs to last longer than a transaction (useful +in test suites) you can specify to keep a session when registering the events: + + >>> Session = scoped_session(sessionmaker(bind=engine, + ... twophase=TEST_TWOPHASE)) + >>> register(Session, keep_session=True) + + >>> session = Session() + >>> bob = session.query(User).all()[0] + >>> bob.name = 'bobby' + >>> transaction.commit() + >>> bob.name + 'bobby' + +The session must then be closed manually: + + >>> session.close() + + +Development version +=================== + +`GIT version `_ + + +Changes +======= + +4.1 (2025-11-25) +---------------- + +- Add support for Python 3.12, 3.13, 3.14. + +- Drop support for Python 3.7, 3.8, 3.9. + +- Remove no longer necessary ``setuptools`` runtime dependency. + + +4.0 (2025-09-12) +---------------- + +- Replace ``pkg_resources`` namespace with PEP 420 native namespace. + +- SQLAlchemy's versions 2.0.32 up to 2.0.35 run into dead locks when running + the tests on Python 3.11+, so excluding them from the list of supported + versions. + (`#84 `_) + +3.1 (2023-09-12) +---------------- + +- Fix ``psycopg.errors.OperationalError.sqlstate`` can be ``None``. + (`#81 `_) + + +3.0 (2023-06-01) +---------------- + +- Add support for SQLAlchemy 2.0 and for new psycopg v3 backend. + (`#79 `_) + +**Breaking Changes** + +- No longer allow calling ``session.commit()`` within a manual nested database + transaction (a savepoint). If you want to use savepoints directly in code that is + not aware of ``transaction.savepoint()`` with ``session.begin_nested()`` then + use the savepoint returned by the function to commit just the nested transaction + i.e. ``savepoint = session.begin_nested(); savepoint.commit()`` or use it as a + context manager i.e. ``with session.begin_nested():``. + (`for details see #79 `_) + + +2.0 (2023-02-06) +---------------- + +- Drop support for Python 2.7, 3.5, 3.6. + +- Drop support for ``SQLAlchemy < 1.1`` + (`#65 `_) + +- Add support for Python 3.10, 3.11. + + +1.6 (2021-09-06) +---------------- + +- Add support for Python 2.7 on SQLAlchemy 1.4. + (`#71 `_) + + +1.5 (2021-07-14) +---------------- + +- Call ``mark_changed`` also on the ``do_orm_execute`` event if the operation + is an insert, update or delete. This is SQLAlchemy >= 1.4 only, as it + introduced that event. + (`#67 `_) + +- Fixup get transaction. There was regression introduced in 1.4. + (`#66 `_) + + +1.4 (2021-04-26) +---------------- + +- Add ``mark_changed`` and ``join_transaction`` methods to + ``ZopeTransactionEvents``. + (`#46 `_) + +- Reduce DeprecationWarnings with SQLAlchemy 1.4 and require at least + SQLAlchemy >= 0.9. + (`#54 `_) + +- Add support for SQLAlchemy 1.4. + (`#58 `_) + +- Prevent using an SQLAlchemy 1.4 version with broken flush support. + (`#57 `_) + + +1.3 (2020-02-17) +---------------- + +* ``.datamanager.register()`` now returns the ``ZopeTransactionEvents`` + instance which was used to register the events. This allows to change its + parameters afterwards. + (`#40 `_) + +* Add preliminary support for Python 3.9a3. + + +1.2 (2019-10-17) +---------------- + +**Breaking Changes** + +* Drop support for Python 3.4. + +* Add support for Python 3.7 and 3.8. + +* Fix deprecation warnings for the event system. We already used it in general + but still leveraged the old extension mechanism in some places. + (`#31 `_) + + To make things clearer we renamed the ``ZopeTransactionExtension`` class + to ``ZopeTransactionEvents``. Existing code using the 'register' version + stays compatible. + +**Upgrade from 1.1** + +Your old code like this: + +.. code-block:: python + + from zope.sqlalchemy import ZopeTransactionExtension + + DBSession = scoped_session(sessionmaker(extension=ZopeTransactionExtension(), **options)) + +becomes: + +.. code-block:: python + + from zope.sqlalchemy import register + + DBSession = scoped_session(sessionmaker(**options)) + register(DBSession) + + + +1.1 (2019-01-03) +---------------- + +* Add support to MySQL using pymysql. + + +1.0 (2018-01-31) +---------------- + +* Add support for Python 3.4 up to 3.6. + +* Support SQLAlchemy 1.2. + +* Drop support for Python 2.6, 3.2 and 3.3. + +* Drop support for transaction < 1.6.0. + +* Fix hazard that could cause SQLAlchemy session not to be committed when + transaction is committed in rare situations. + (`#23 `_) + + +0.7.7 (2016-06-23) +------------------ + +* Support SQLAlchemy 1.1. + (`#15 `_) + + +0.7.6 (2015-03-20) +------------------ + +* Make version check in register compatible with prereleases. + +0.7.5 (2014-06-17) +------------------ + +* Ensure mapped objects are expired following a ``transaction.commit()`` when + no database commit was required. + (`#8 `_) + + +0.7.4 (2014-01-06) +------------------ + +* Allow ``session.commit()`` on nested transactions to facilitate integration + of existing code that might not use ``transaction.savepoint()``. + (`#1 `_) + +* Add a new function zope.sqlalchemy.register(), which replaces the + direct use of ZopeTransactionExtension to make use + of the newer SQLAlchemy event system to establish instrumentation on + the given Session instance/class/factory. Requires at least + SQLAlchemy 0.7. + (`#4 `_) + +* Fix `keep_session=True` doesn't work when a transaction is joined by flush + and other manngers bug. + (`#5 `_) + + +0.7.3 (2013-09-25) +------------------ + +* Prevent the ``Session`` object from getting into a "wedged" state if joining + a transaction fails. With thread scoped sessions that are reused this can cause + persistent errors requiring a server restart. + (`#2 `_) + +0.7.2 (2013-02-19) +------------------ + +* Make life-time of sessions configurable. Specify `keep_session=True` when + setting up the SA extension. + +* Python 3.3 compatibility. + +0.7.1 (2012-05-19) +------------------ + +* Use ``@implementer`` as a class decorator instead of ``implements()`` at + class scope for compatibility with ``zope.interface`` 4.0. This requires + ``zope.interface`` >= 3.6.0. + +0.7 (2011-12-06) +---------------- + +* Python 3.2 compatibility. + +0.6.1 (2011-01-08) +------------------ + +* Update datamanager.mark_changed to handle sessions which have not yet logged + a (ORM) query. + + +0.6 (2010-07-24) +---------------- + +* Implement should_retry for sqlalchemy.orm.exc.ConcurrentModificationError + and serialization errors from PostgreSQL and Oracle. + (Specify transaction>=1.1 to use this functionality.) + +* Include license files. + +* Add ``transaction_manager`` attribute to data managers for compliance with + IDataManager interface. + +0.5 (2010-06-07) +---------------- + +* Remove redundant session.flush() / session.clear() on savepoint operations. + These were only needed with SQLAlchemy 0.4.x. + +* SQLAlchemy 0.6.x support. Require SQLAlchemy >= 0.5.1. + +* Add support for running ``python setup.py test``. + +* Pull in pysqlite explicitly as a test dependency. + +* Setup sqlalchemy mappers in test setup and clear them in tear down. This + makes the tests more robust and clears up the global state after. It + caused the tests to fail when other tests in the same run called + clear_mappers. + +0.4 (2009-01-20) +---------------- + +Bugs fixed: + +* Only raise errors in tpc_abort if we have committed. + +* Remove the session id from the SESSION_STATE just before we de-reference the + session (i.e. all work is already successfuly completed). This fixes cases + where the transaction commit failed but SESSION_STATE was already cleared. In + those cases, the transaction was wedeged as abort would always error. This + happened on PostgreSQL where invalid SQL was used and the error caught. + +* Call session.flush() unconditionally in tpc_begin. + +* Change error message on session.commit() to be friendlier to non zope users. + +Feature changes: + +* Support for bulk update and delete with SQLAlchemy 0.5.1 + +0.3 (2008-07-29) +---------------- + +Bugs fixed: + +* New objects added to a session did not cause a transaction join, so were not + committed at the end of the transaction unless the database was accessed. + SQLAlchemy 0.4.7 or 0.5beta3 now required. + +Feature changes: + +* For correctness and consistency with ZODB, renamed the function 'invalidate' + to 'mark_changed' and the status 'invalidated' to 'changed'. + +0.2 (2008-06-28) +---------------- + +Feature changes: + +* Updated to support SQLAlchemy 0.5. (0.4.6 is still supported). + +0.1 (2008-05-15) +---------------- + +* Initial public release. diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope_sqlalchemy-4.1.dist-info/RECORD b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope_sqlalchemy-4.1.dist-info/RECORD new file mode 100644 index 0000000000000000000000000000000000000000..aacd173e92ddcabb0590ef06c32c89d12671fed3 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope_sqlalchemy-4.1.dist-info/RECORD @@ -0,0 +1,13 @@ +zope/sqlalchemy/README.rst,sha256=mEx2oKdioh9Q2xZvoUtCrBYLZD1-QzDPctcwWtlegOw,8829 +zope/sqlalchemy/__init__.py,sha256=9MKwj5W0XbBR3RDgZgq8sBg_Xp_14_xO7UZcN_KOLDM,926 +zope/sqlalchemy/__pycache__/__init__.cpython-310.pyc,, +zope/sqlalchemy/__pycache__/datamanager.cpython-310.pyc,, +zope/sqlalchemy/__pycache__/tests.cpython-310.pyc,, +zope/sqlalchemy/datamanager.py,sha256=d2IaZc0o-PML_SLNoez1h6LPkmG-ZerqYmtkyVMw1ug,13239 +zope/sqlalchemy/tests.py,sha256=OGuyXHMxnSY_IKWcS3RvjMWRTROH9koEjSKgn2hZlAY,29419 +zope_sqlalchemy-4.1.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4 +zope_sqlalchemy-4.1.dist-info/METADATA,sha256=IrgaHmGTH597O9cHvT1BLeYddcSKjJft7dENDfLAoSs,19452 +zope_sqlalchemy-4.1.dist-info/RECORD,, +zope_sqlalchemy-4.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91 +zope_sqlalchemy-4.1.dist-info/licenses/LICENSE.txt,sha256=PmcdsR32h1FswdtbPWXkqjg-rKPCDOo_r1Og9zNdCjw,2070 +zope_sqlalchemy-4.1.dist-info/top_level.txt,sha256=QpUHvpO4wIuZDeEgKY8qZCtD-tAukB0fn_f6utzlb98,5 diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope_sqlalchemy-4.1.dist-info/WHEEL b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope_sqlalchemy-4.1.dist-info/WHEEL new file mode 100644 index 0000000000000000000000000000000000000000..e7fa31b6f3f78deb1022c1f7927f07d4d16da822 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope_sqlalchemy-4.1.dist-info/WHEEL @@ -0,0 +1,5 @@ +Wheel-Version: 1.0 +Generator: setuptools (80.9.0) +Root-Is-Purelib: true +Tag: py3-none-any + diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope_sqlalchemy-4.1.dist-info/licenses/LICENSE.txt b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope_sqlalchemy-4.1.dist-info/licenses/LICENSE.txt new file mode 100644 index 0000000000000000000000000000000000000000..e1f9ad7b3b48377bfbfaa1b380c384ddea24060f --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope_sqlalchemy-4.1.dist-info/licenses/LICENSE.txt @@ -0,0 +1,44 @@ +Zope Public License (ZPL) Version 2.1 + +A copyright notice accompanies this license document that identifies the +copyright holders. + +This license has been certified as open source. It has also been designated as +GPL compatible by the Free Software Foundation (FSF). + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1. Redistributions in source code must retain the accompanying copyright +notice, this list of conditions, and the following disclaimer. + +2. Redistributions in binary form must reproduce the accompanying copyright +notice, this list of conditions, and the following disclaimer in the +documentation and/or other materials provided with the distribution. + +3. Names of the copyright holders must not be used to endorse or promote +products derived from this software without prior written permission from the +copyright holders. + +4. The right to distribute this software or to use it for any purpose does not +give you the right to use Servicemarks (sm) or Trademarks (tm) of the +copyright +holders. Use of them is covered by separate agreement with the copyright +holders. + +5. If any files are modified, you must cause the modified files to carry +prominent notices stating that you changed the files and the date of any +change. + +Disclaimer + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``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 COPYRIGHT HOLDERS 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/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope_sqlalchemy-4.1.dist-info/top_level.txt b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope_sqlalchemy-4.1.dist-info/top_level.txt new file mode 100644 index 0000000000000000000000000000000000000000..66179d49851b253d0014a0c02ad468ff6d89c5db --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/zope_sqlalchemy-4.1.dist-info/top_level.txt @@ -0,0 +1 @@ +zope diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/ztijwthelper/__init__.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/ztijwthelper/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..4d4a4f50fc9444ca30ae9f17cc61fdbfb6933c10 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/ztijwthelper/__init__.py @@ -0,0 +1,23 @@ +from .__version__ import __version__ +from .exception import ZtiJwtError +from .zti_jwt_helper import ( + ZTIJwtHelper, + jwt_helper, + is_token_zti, + decode_jwt_svid, + decode_gdpr_or_jwt_svid, +) + +__author__ = "Jeff Li" +__email__ = "jeff.li@byteddance.com" + + +__all__ = [ + "__version__", + "ZtiJwtError", + "ZTIJwtHelper", + "jwt_helper", + "is_token_zti", + "decode_jwt_svid", + "decode_gdpr_or_jwt_svid", +] diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/ztijwthelper/__version__.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/ztijwthelper/__version__.py new file mode 100644 index 0000000000000000000000000000000000000000..03ca2cf626a7d04638626cefa5ce4988a4d4457f --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/ztijwthelper/__version__.py @@ -0,0 +1,3 @@ +VERSION = (0, 0, 24) + +__version__ = ".".join(map(str, VERSION)) diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/ztijwthelper/exception.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/ztijwthelper/exception.py new file mode 100644 index 0000000000000000000000000000000000000000..9250cba7de1ec88d5b618d89bcca77d2758184f5 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/ztijwthelper/exception.py @@ -0,0 +1,4 @@ +class ZtiJwtError(Exception): + def __init__(self, message=None): + Exception.__init__(self, message) + self.message = message diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/ztijwthelper/memfd.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/ztijwthelper/memfd.py new file mode 100644 index 0000000000000000000000000000000000000000..0c84a70a5b932c7f90c35c2fe789fab8d5083492 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/ztijwthelper/memfd.py @@ -0,0 +1,40 @@ +import io +import os +from .rw_lock import RWLock + +try: + from bytedmemfd import memfd +except ImportError: + memfd = None + +MEMFD_DEFAULT_NAME = "zti_jwt_helper" + +class Memfd(object): + def __init__(self): + self.lock = RWLock() + self.memfd_fd = None + + def unwrap_memfd(self): + if memfd is None or self.memfd_fd is None: + return + try: + self.lock.lock() + os.close(self.memfd_fd) + finally: + self.lock.un_lock() + + def write_content_to_memfd(self, content): + if memfd is None: + return + try: + self.lock.lock() + if self.memfd_fd is not None: + os.close(self.memfd_fd) + self.memfd_fd = None + self.memfd_fd = memfd.memfd_create(MEMFD_DEFAULT_NAME, memfd.MFD_ALLOW_SEALING) + with io.open(self.memfd_fd, mode="wb+", buffering=0, closefd=False) as f: + f.write(content) + f.seek(0) + memfd.addseals(self.memfd_fd, memfd.F_SEAL_ALL) + finally: + self.lock.un_lock() \ No newline at end of file diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/ztijwthelper/metric.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/ztijwthelper/metric.py new file mode 100644 index 0000000000000000000000000000000000000000..7f5cc83f68192e947adac12282c8cbe16a8b90f7 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/ztijwthelper/metric.py @@ -0,0 +1,41 @@ +import logging + +from bytedance import metrics +from ztijwthelper.__version__ import __version__ + +logger = logging.getLogger(__name__) +ZTI_METRICS_PREFIX = "security.zti.jwt_helper" +GET_TOKEN_FAILED = "get_token_error" +GET_TOKEN_SUCCEED = "get_token" +GET_TOKEN_FROM_STRING = "get_token_from_string" +FETCH_TOKEN_FROM_PATH_FAILED = "fetch_token_path_error" +GET_TOKEN_FROM_AGENT_FAIL = "get_token_from_agent_fail" + +# backward compatible with dps agent: need to deprecate in future version +GET_TOKEN_FROM_DPS_AGENT_SUCCEED = "get_token_from_dps_agent" +GET_TOKEN_FROM_DPS_AGENT_FAIL = "get_token_from_dps_agent_fail" + + +class MetricsClient(object): + def __init__(self): + self.mcli = metrics.Client(prefix=ZTI_METRICS_PREFIX) + + def count(self, metric_name, **kwargs): + if metric_name == "": + return + try: + kwargs.update( + { + "ver": __version__, + "language": "python", + } + ) + self.mcli.emit_counter(metric_name, 1, tags=kwargs) + except Exception as e: + logger.error("jwt metric emit count failed: {}".format(e)) + + def flush(self): + self.mcli.flush() + + +metrics_client = MetricsClient() diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/ztijwthelper/models.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/ztijwthelper/models.py new file mode 100644 index 0000000000000000000000000000000000000000..46b5e5268a2872050415b78bf4466be9d820893b --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/ztijwthelper/models.py @@ -0,0 +1,183 @@ +# coding: utf-8 + +import time +import jwt +from .spiffe_id import ID + + +class ZeroTrustIdentity(object): + def __init__( + self, + spiffe_id=None, + expiry=None, + namespace=None, + region=None, + vdc=None, + identity=None, + legacy_id=None, + ): + self.spiffeID = spiffe_id + self.expiry = expiry + self.namespace = namespace + self.region = region + self.vdc = vdc + self.id = identity + self.legacyID = legacy_id + + def __str__(self): + return ( + "{ From str method of ZeroTrustIdentity: spiffeID = %s, " + "expiry = %s, namespace = %s, region = %s, " + "vdc = %s, id = %s, legacyID = %s }" + % ( + self.spiffeID, + self.expiry, + self.namespace, + self.region, + self.vdc, + self.id, + self.legacyID, + ) + ) + + def get_id(self): + return self.id + + def map2identity(self, params): + spiffe_id_str = params.get("sub") + self.spiffeID = ID().from_str(spiffe_id_str) + self.expiry = params.get("exp") + legid_map = params.get("legid") + if legid_map: + self.legacyID = LegacyIdentity(**legid_map) + else: + self.legacyID = None + + for schemas in self.spiffeID.get_path().split("/"): + schema = schemas.split(":") + if len(schema) != 2: + continue + if schema[0].lower() == "id": + self.id = schema[1] + if schema[0].lower() == "r": + self.region = schema[1] + if schema[0].lower() == "vdc": + self.vdc = schema[1] + if schema[0].lower() == "ns": + self.namespace = schema[1] + return self + + def get_legacy_identity_from_zti(self): + if self.legacyID is not None: + return self.legacyID + # build up a new legacy identity from zti + identity = LegacyIdentity( + version=0, authority=self.namespace, expireTime=self.expiry + ) + if self.namespace == "user": + identity.primary_auth_type = "user" + identity.user = self.id + else: + identity.primary_auth_type = "psm" + identity.psm = self.id + return identity + + +class LegacyIdentity(object): + def __init__(self, **kwargs): + self.version = kwargs.get("version") + self.authority = kwargs.get("authority") + self.authority_chain = kwargs.get("authorityChain") + self.primary_auth_type = kwargs.get("primaryAuthType") + self.psm = kwargs.get("psm") + self.user = kwargs.get("user") + self.expire_time = kwargs.get("expireTime") + self.extension = kwargs.get("extension") + + def __str__(self): + return ( + "{ From str method of LegacyIdentity: version = %s, " + "authority = %s, authorityChain = %s, primaryAuthType = %s, " + "psm = %s, user = %s, expireTime = %s, " + "extension = %s }" + % ( + self.version, + self.authority, + self.authority_chain, + self.primary_auth_type, + self.psm, + self.user, + self.expire_time, + self.extension, + ) + ) + + def to_json(self): + return { + "version": self.version, + "authority": self.authority, + "authorityChain": self.authority_chain or [], + "primaryAuthType": self.primary_auth_type, + "psm": self.psm, + "user": self.user, + "expireTime": str(self.expire_time), + "extension": self.extension or {}, + } + +class SyncInformation(object): + def __init__(self, token, token_source): + self.last_sync_time = time.strftime( + "%Y-%m-%dT%H:%M:%S.000000000%z", time.localtime() + ) + self.token_source = token_source + header = jwt.get_unverified_header(token) + if "kid" not in header: + self.token_type = "gdpr" + claims = jwt.decode(token, verify=False, options={"verify_signature": False}) + self.legacy_identity = LegacyIdentity(**claims) + return + claim = jwt.decode( + token, + options={ + "verify_signature": False, + "verify_aud": False, + "verify_exp": False, + }, + ) + zti = ZeroTrustIdentity().map2identity(claim) + self.token_type = "zti" + + self.legacy_identity = zti.get_legacy_identity_from_zti() + self.key_id = header["kid"] + self.trust_domain = zti.spiffeID.get_trust_domain() + + def __str__(self): + return ( + "{ From str method of SyncInformation: tokenType = %s, " + " tokenSource = %s, lastSyncTime = %s, keyID = %s, " + "trustDomain = %s, legacyIdentity = %s }" + % ( + self.token_type, + self.token_source, + self.last_sync_time, + self.key_id, + self.trust_domain, + self.legacy_identity, + ) + ) + + def to_json(self): + if self.token_type == "gdpr": + return { + "tokenType": self.token_type, + "tokenSource": self.token_source, + "lastSyncTime": self.last_sync_time, + } + return { + "tokenType": self.token_type, + "tokenSource": self.token_source, + "lastSyncTime": self.last_sync_time, + "keyID": self.key_id, + "trustDomain": self.trust_domain, + "legacyIdentity": self.legacy_identity.to_json(), + } diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/ztijwthelper/rw_lock.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/ztijwthelper/rw_lock.py new file mode 100644 index 0000000000000000000000000000000000000000..01fe3f4dbe00b30fe544d544b2361945ae45b724 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/ztijwthelper/rw_lock.py @@ -0,0 +1,32 @@ +# coding: utf-8 + +from __future__ import absolute_import +from __future__ import division +from __future__ import print_function +from __future__ import unicode_literals +import threading + + +class RWLock(object): + def __init__(self): + self.__monitor = threading.Lock() + self.__exclude = threading.Lock() + self.readers = 0 + + def r_lock(self): + with self.__monitor: + self.readers += 1 + if self.readers == 1: + self.__exclude.acquire() + + def r_un_lock(self): + with self.__monitor: + self.readers -= 1 + if self.readers == 0: + self.__exclude.release() + + def lock(self): + self.__exclude.acquire() + + def un_lock(self): + self.__exclude.release() diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/ztijwthelper/spiffe_id.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/ztijwthelper/spiffe_id.py new file mode 100644 index 0000000000000000000000000000000000000000..7c617fdc2cbf45602cbdcf2fba446544afb7835b --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/ztijwthelper/spiffe_id.py @@ -0,0 +1,35 @@ +from urllib3.util import url + + +class ID(object): + def __init__(self, trust_domain=None, path=None): + self.trust_domain = trust_domain + self.path = path + + def __str__(self): + return "{ From str method of ID: trust_domain = %s, path = %s }" % ( + self.trust_domain, + self.path, + ) + + def from_str(self, id_str): + uri = url.parse_url(id_str) + self.trust_domain = str(uri.hostname) + self.path = str(uri.path).lstrip("/").rstrip("/") + return self + + def is_zero(self): + if not self.trust_domain: + return True + return False + + def to_str(self): + if self.is_zero(): + return "" + return self.trust_domain + "/" + self.path + + def get_trust_domain(self): + return str(self.trust_domain) + + def get_path(self): + return str(self.path) diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/ztijwthelper/zti_jwt_helper.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/ztijwthelper/zti_jwt_helper.py new file mode 100644 index 0000000000000000000000000000000000000000..5084546cd20bd42c5d36295378583b59759c6f61 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/ztijwthelper/zti_jwt_helper.py @@ -0,0 +1,478 @@ +import stat +import threading +from .models import ZeroTrustIdentity, LegacyIdentity, SyncInformation +from .rw_lock import RWLock +from .exception import ZtiJwtError +from ztispiffe.spire.api.workload import JWTClientConfig, JWTClient +from .memfd import Memfd +from .metric import ( + metrics_client, + GET_TOKEN_FROM_STRING, + FETCH_TOKEN_FROM_PATH_FAILED, + GET_TOKEN_FROM_AGENT_FAIL, + GET_TOKEN_FAILED, + GET_TOKEN_SUCCEED, + GET_TOKEN_FROM_DPS_AGENT_SUCCEED, + GET_TOKEN_FROM_DPS_AGENT_FAIL, +) + +json_lib = True +try: + import ujson as json +except ImportError: + try: + import json + except ImportError: + try: + import simplejson as json + except ImportError: + json_lib = False + +import os +import socket +import time +import logging +import jwt +import bytedenv +import six +from deprecated import deprecated + +_LOGGER = logging.getLogger(__name__) +DEFAULT_AGENT_SOCKET_PATH = [ + "/var/run/zti-agent.sock", + "/var/run/zti-agent/sockets/agent.sock", +] +DEFAULT_TIMEOUT_SECONDS = 5 +SEC_TOKEN_PATH = "SEC_TOKEN_PATH" +SEC_TOKEN_STRING = "SEC_TOKEN_STRING" +ZTI_AGENT_SOCKET_PATH = "ZTI_AGENT_SOCKET_PATH" +METADATA = [("workload.spiffe.io", "true")] + +# backward compatible with dps agent: need to deprecate in future version +DPS_AGENT_SOCKET_PATH = "/opt/tmp/sock/.unix_sock_agent_1234567890.sock" +DPS_AGENT_USER_ENV = "INFSEC_SEC_USER" +DPS_AGENT_PSM_ENV = "INFSEC_SEC_PSM" +DPS_AGENT_ENABLE_ENV = "GET_SEC_TOKEN_STRING_FROM_DAEMON" + +DPS_DEFAULT_TIMEOUT_SECONDS = 1 + +DAEMON_UPDATE_INTERVAL = 2 * 60 * 60 + +TOKEN_SOURCE_STRING = "sec_token_string" +TOKEN_SOURCE_PATH = "sec_token_path" +TOKEN_SOURCE_DPS = "dps_agent" +TOKEN_SOURCE_ZTI = "zti_agent" + +# Used to determine whether to fallback zti-agent +FALLBACK_ZTI_AGENT_ENV = "FALLBACK_ZTI_AGENT" + + +def singleton(cls, *args, **kw): + instances = {} + + def _singleton(*args, **kw): + if cls not in instances: + instances[cls] = cls(*args, **kw) + # Allows instance variables to be modified by instantiation + instances[cls].__dict__.update(kw) + return instances[cls] + + return _singleton + + +def decode_jwt_svid(token_str): + try: + claim = jwt.decode( + token_str, + options={ + "verify_signature": False, + "verify_aud": False, + "verify_exp": False, + }, + ) + except Exception as e: + raise ZtiJwtError(e) + + zti = ZeroTrustIdentity().map2identity(claim) + return zti + + +def decode_gdpr_or_jwt_svid(token_str): + if is_token_zti(token_str): + zti = decode_jwt_svid(token_str) + return zti.get_legacy_identity_from_zti() + else: + return __decode_gdpr(token_str) + + +def is_token_zti(token_str): + try: + header = jwt.get_unverified_header(token_str) + except Exception as e: + return False + kid = "kid" + if kid in header: + return True + return False + + +# Trim token string to remove special characters +def _trim_token(token_str): + if token_str is None: + return None + + if six.PY3: + return "".join( + [ + char + for char in token_str + if char not in ["\r", "\n", "\t", " ", '"', "'"] + ] + ) + + return "".join( + [filter(lambda char: char not in ["\r", "\n", "\t", " ", '"', "'"], token_str)] + ) + + +def __decode_gdpr(token_str): + try: + claims = jwt.decode( + token_str, verify=False, options={"verify_signature": False} + ) + except Exception as e: + raise ZtiJwtError(e) + return LegacyIdentity(**claims) + + +@singleton +class ZTIJwtHelper(object): + + def __init__(self, update_interval_secs=180): + self.lock = RWLock() + self.thread_lock = threading.Lock() + + # Global JWT SVID Token + self._global_token = None + + self._token_path = None + self._token_string = None + self._jwt_client = None + self._agent_socket_path = None + self._last_update_time = 0 + self.update_interval_secs = update_interval_secs + + # backward compatible with dps agent: need to deprecate in future version + self.dps_agent_enabled = False + self.dps_agent_infsec_psm = None + self.dps_agent_infsec_user = None + + self._service_identity = None + self._token_source = None + + self._memfd = Memfd() + + self._poll_every() + + def __del__(self): + try: + self._memfd.unwrap_memfd() + self.daemon_thread.cancel() + except Exception: + pass + finally: + _LOGGER.info("ZTIJwtHelper is deleted") + + def _run_refresh_once(self): + self._fresh() + threading.Timer(DAEMON_UPDATE_INTERVAL, self._run_refresh_once).start() + + def _poll_every(self): + self.daemon_thread = threading.Timer( + DAEMON_UPDATE_INTERVAL, self._run_refresh_once + ) + self.daemon_thread.daemon = True + self.daemon_thread.start() + + def get_jwt_svid(self): + now = time.time() + if now - self._last_update_time > self.update_interval_secs: + self._fresh() + + return self._get_token() + + def _refresh_agent_socket_path(self): + agent_socket_path = os.getenv(ZTI_AGENT_SOCKET_PATH, None) + if ( + agent_socket_path + and os.path.exists(agent_socket_path) + and os.stat(agent_socket_path).st_mode & stat.S_IFSOCK != 0 + ): + if agent_socket_path != self._agent_socket_path: + self._set_agent_socket_path(agent_socket_path) + return + for path in DEFAULT_AGENT_SOCKET_PATH: + if os.path.exists(path) and os.stat(path).st_mode & stat.S_IFSOCK != 0: + if path != self._agent_socket_path: + self._set_agent_socket_path(path) + return + + def _set_agent_socket_path(self, path): + try: + self.lock.lock() + _LOGGER.info("ZTI agent socket path is set to %s", path) + self._agent_socket_path = path + self._fresh_jwt_client() + finally: + self.lock.un_lock() + + def get_token_string(self): + try: + self.lock.r_lock() + return ( + self._token_string + if self._token_string + else os.getenv(SEC_TOKEN_STRING, None) + ) + finally: + self.lock.r_un_lock() + + def set_token_string(self, token): + try: + self.lock.lock() + self._token_string = token + finally: + self.lock.un_lock() + + def get_token_path(self): + try: + self.lock.r_lock() + return ( + self._token_path + if self._token_path + else os.getenv(SEC_TOKEN_PATH, None) + ) + finally: + self.lock.r_un_lock() + + def set_token_path(self, path): + try: + self.lock.lock() + self._token_path = path + finally: + self.lock.un_lock() + + def set_service_identity(self, service_identity): + try: + self.lock.lock() + self._service_identity = service_identity + finally: + self.lock.un_lock() + + def get_service_identity(self): + try: + self.lock.r_lock() + return self._service_identity + finally: + self.lock.r_un_lock() + + def get_token_source(self): + try: + self.lock.r_lock() + return self._token_source + finally: + self.lock.r_un_lock() + + def _fresh_env(self): + self._token_string = self.get_token_string() + self._token_path = self.get_token_path() + + # backward compatible with dps agent: need to deprecate in future version + self.dps_agent_enabled = os.getenv(DPS_AGENT_ENABLE_ENV, None) == "1" + self.dps_agent_infsec_psm = os.getenv(DPS_AGENT_PSM_ENV, "") + self.dps_agent_infsec_user = os.getenv(DPS_AGENT_USER_ENV, "") + + def _fresh_jwt_client(self): + config = JWTClientConfig(socket_addr="unix://" + self._agent_socket_path) + self._jwt_client = JWTClient(config) + + def _fresh(self): + try: + self.thread_lock.acquire() + # dynamically update the token_path value + self._fresh_env() + fall_back_agent = False + token = None + if self._token_string: + self._token_source = TOKEN_SOURCE_STRING + token = self._token_string + metrics_client.count(metric_name=GET_TOKEN_FROM_STRING) + elif self.dps_agent_enabled and ( + self.dps_agent_infsec_psm or self.dps_agent_infsec_user + ): + token = self._get_from_dps_agent() + self._token_source = TOKEN_SOURCE_DPS + metrics_client.count(metric_name=GET_TOKEN_FROM_DPS_AGENT_SUCCEED) + elif self._token_path: + token, fall_back_agent = self._get_from_file() + self._token_source = TOKEN_SOURCE_PATH + + if not token or fall_back_agent: + self._refresh_agent_socket_path() + if self._agent_socket_path is not None: + token = self._get_from_agent() + self._token_source = TOKEN_SOURCE_ZTI + + if token: + self._set_token(token) + self._refresh_identity(token) + except Exception as ex: + metrics_client.count(metric_name=GET_TOKEN_FAILED) + _LOGGER.warning("fresh failed, ex is %s" % ex) + finally: + self.thread_lock.release() + + def _get_from_file(self): + try: + self.lock.r_lock() + # check if token file exists + if not os.path.exists(self._token_path): + metrics_client.count(metric_name=FETCH_TOKEN_FROM_PATH_FAILED) + if self._enable_fall_back(): + return ("", True) + raise IOError("token file %s not exist" % self._token_path) + + # check if token file is readable + if not os.access(self._token_path, os.R_OK): + metrics_client.count(metric_name=FETCH_TOKEN_FROM_PATH_FAILED) + if self._enable_fall_back(): + return ("", True) + raise IOError("token file %s not readable" % self._token_path) + + with open(self._token_path) as f: + data = f.read() + token_string = data.strip() + + return ( + (token_string, False) + if not self._enable_fall_back(token_string) + else ("", True) + ) + + finally: + self.lock.r_un_lock() + + def _get_from_agent(self): + try: + serviceIdentity = self.get_service_identity() or bytedenv.get_psm() + jwt_resp = self._jwt_client.fetch_jwt_svid() + # we assume one workload should only have one identity + for ids in jwt_resp.svids: + # Parse the identity from the JWT SVID + if ( + serviceIdentity == bytedenv.service.PSM_UNKNOWN + or serviceIdentity + == ZeroTrustIdentity() + .map2identity( + jwt.decode( + ids.svid, + options={ + "verify_signature": False, + "verify_aud": False, + "verify_exp": False, + }, + ) + ) + .id + ): + return ids.svid + return jwt_resp.svids[0].svid if len(jwt_resp.svids) > 0 else None + except Exception as e: + metrics_client.count(metric_name=GET_TOKEN_FROM_AGENT_FAIL) + _LOGGER.error("fail to fetch token from workload api with err: %s" % e) + + @deprecated( + reason="backward compatible with dps agent: need to deprecate in future version" + ) + def _get_from_dps_agent(self): + if not json_lib: + _LOGGER.error("none json lib is not installed, please install it") + return + sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) + sock.settimeout(DPS_DEFAULT_TIMEOUT_SECONDS) + try: + sock.connect(DPS_AGENT_SOCKET_PATH) + except socket.error: + metrics_client.count(metric_name=GET_TOKEN_FROM_DPS_AGENT_FAIL) + raise ZtiJwtError("fail to connect to unix domain socket!") + + req = json.dumps( + { + "cmd": 1, + "psm": self.dps_agent_infsec_psm, + "user": self.dps_agent_infsec_user, + } + ) + try: + sock.sendall(req.encode("utf-8") + b"\n") + data = sock.recv(2048) + data = data.decode("utf-8") + return data.split("\n")[0] + + except Exception as ex: + metrics_client.count(metric_name=GET_TOKEN_FROM_DPS_AGENT_FAIL) + raise ZtiJwtError("get from agent failed, ex is %s", ex) + finally: + sock.close() + + def _set_token(self, token_str): + try: + self.lock.lock() + # Trim JWT Token by removing the special characters + self._global_token = _trim_token(token_str) + self._last_update_time = time.time() + finally: + self.lock.un_lock() + + def _get_token(self): + try: + self.lock.r_lock() + token_str = self._global_token + ( + metrics_client.count(metric_name=GET_TOKEN_FAILED) + if not token_str + else metrics_client.count(metric_name=GET_TOKEN_SUCCEED) + ) + + finally: + self.lock.r_un_lock() + + return token_str + + def _refresh_identity(self, token): + try: + self.lock.r_lock() + self._memfd.write_content_to_memfd( + json.dumps( + SyncInformation(token, token_source=self._token_source).to_json() + ).encode("utf-8") + ) + except Exception as ex: + _LOGGER.error("refresh identity failed, ex is %s", ex) + finally: + self.lock.r_un_lock() + + def _enable_fall_back(self, context=None): + if not context: + return False + + if context != FALLBACK_ZTI_AGENT_ENV: + try: + jwt.decode(context, verify=False, options={"verify_signature": False}) + return False + except: + return os.getenv(FALLBACK_ZTI_AGENT_ENV, "false") == "1" + return True + + +jwt_helper = ZTIJwtHelper() diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/ztispiffe/__init__.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/ztispiffe/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..ffcaae26813501ac3d5b6c86444c1ae109df7547 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/ztispiffe/__init__.py @@ -0,0 +1 @@ +from .error import SpiffeError diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/ztispiffe/__version__.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/ztispiffe/__version__.py new file mode 100644 index 0000000000000000000000000000000000000000..f86bfa70978a9aedea5471e339ea65504a509a22 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/ztispiffe/__version__.py @@ -0,0 +1,3 @@ +VERSION = (0, 0, 17) + +__version__ = ".".join(map(str, VERSION)) diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/ztispiffe/error.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/ztispiffe/error.py new file mode 100644 index 0000000000000000000000000000000000000000..e75c449e86f241883dcfb98ed778b5a3eb1780eb --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/ztispiffe/error.py @@ -0,0 +1,2 @@ +class SpiffeError(Exception): + pass diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/ztispiffe/spiffe/__init__.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/ztispiffe/spiffe/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/ztispiffe/spiffe/proto/__init__.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/ztispiffe/spiffe/proto/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/ztispiffe/spiffe/proto/workload/__init__.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/ztispiffe/spiffe/proto/workload/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..b8a67b28886ad071145d5e9f4f06d0583f4ce62a --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/ztispiffe/spiffe/proto/workload/__init__.py @@ -0,0 +1,2 @@ +from .workload_pb2 import * +from .workload_pb2_grpc import SpiffeWorkloadAPIStub diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/ztispiffe/spiffe/proto/workload/workload_pb2.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/ztispiffe/spiffe/proto/workload/workload_pb2.py new file mode 100644 index 0000000000000000000000000000000000000000..a4aeb30ec591a6d55f7aeb9a5f053d7c7daa2985 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/ztispiffe/spiffe/proto/workload/workload_pb2.py @@ -0,0 +1,59 @@ +# -*- coding: utf-8 -*- +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: workload.proto +# Protobuf Python Version: 4.25.1 +"""Generated protocol buffer code.""" +from google.protobuf import descriptor as _descriptor +from google.protobuf import descriptor_pool as _descriptor_pool +from google.protobuf import symbol_database as _symbol_database +from google.protobuf.internal import builder as _builder +# @@protoc_insertion_point(imports) + +_sym_db = _symbol_database.Default() + + +from google.protobuf import struct_pb2 as google_dot_protobuf_dot_struct__pb2 + + +DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x0eworkload.proto\x1a\x1cgoogle/protobuf/struct.proto\"\x11\n\x0fX509SVIDRequest\"\xb6\x01\n\x10X509SVIDResponse\x12\x18\n\x05svids\x18\x01 \x03(\x0b\x32\t.X509SVID\x12\x0b\n\x03\x63rl\x18\x02 \x03(\x0c\x12\x42\n\x11\x66\x65\x64\x65rated_bundles\x18\x03 \x03(\x0b\x32\'.X509SVIDResponse.FederatedBundlesEntry\x1a\x37\n\x15\x46\x65\x64\x65ratedBundlesEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\x0c:\x02\x38\x01\"W\n\x08X509SVID\x12\x11\n\tspiffe_id\x18\x01 \x01(\t\x12\x11\n\tx509_svid\x18\x02 \x01(\x0c\x12\x15\n\rx509_svid_key\x18\x03 \x01(\x0c\x12\x0e\n\x06\x62undle\x18\x04 \x01(\x0c\"\x14\n\x12X509BundlesRequest\"y\n\x13X509BundlesResponse\x12\x32\n\x07\x62undles\x18\x01 \x03(\x0b\x32!.X509BundlesResponse.BundlesEntry\x1a.\n\x0c\x42undlesEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\x0c:\x02\x38\x01\"*\n\x07JWTSVID\x12\x11\n\tspiffe_id\x18\x01 \x01(\t\x12\x0c\n\x04svid\x18\x02 \x01(\t\"5\n\x0eJWTSVIDRequest\x12\x10\n\x08\x61udience\x18\x01 \x03(\t\x12\x11\n\tspiffe_id\x18\x02 \x01(\t\"*\n\x0fJWTSVIDResponse\x12\x17\n\x05svids\x18\x01 \x03(\x0b\x32\x08.JWTSVID\"\x13\n\x11JWTBundlesRequest\"w\n\x12JWTBundlesResponse\x12\x31\n\x07\x62undles\x18\x01 \x03(\x0b\x32 .JWTBundlesResponse.BundlesEntry\x1a.\n\x0c\x42undlesEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\x0c:\x02\x38\x01\x32\xfd\x01\n\x11SpiffeWorkloadAPI\x12\x36\n\rFetchX509SVID\x12\x10.X509SVIDRequest\x1a\x11.X509SVIDResponse0\x01\x12?\n\x10\x46\x65tchX509Bundles\x12\x13.X509BundlesRequest\x1a\x14.X509BundlesResponse0\x01\x12\x31\n\x0c\x46\x65tchJWTSVID\x12\x0f.JWTSVIDRequest\x1a\x10.JWTSVIDResponse\x12<\n\x0f\x46\x65tchJWTBundles\x12\x12.JWTBundlesRequest\x1a\x13.JWTBundlesResponse0\x01\x62\x06proto3') + +_globals = globals() +_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals) +_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'workload_pb2', _globals) +if _descriptor._USE_C_DESCRIPTORS == False: + DESCRIPTOR._options = None + _globals['_X509SVIDRESPONSE_FEDERATEDBUNDLESENTRY']._options = None + _globals['_X509SVIDRESPONSE_FEDERATEDBUNDLESENTRY']._serialized_options = b'8\001' + _globals['_X509BUNDLESRESPONSE_BUNDLESENTRY']._options = None + _globals['_X509BUNDLESRESPONSE_BUNDLESENTRY']._serialized_options = b'8\001' + _globals['_JWTBUNDLESRESPONSE_BUNDLESENTRY']._options = None + _globals['_JWTBUNDLESRESPONSE_BUNDLESENTRY']._serialized_options = b'8\001' + _globals['_X509SVIDREQUEST']._serialized_start=48 + _globals['_X509SVIDREQUEST']._serialized_end=65 + _globals['_X509SVIDRESPONSE']._serialized_start=68 + _globals['_X509SVIDRESPONSE']._serialized_end=250 + _globals['_X509SVIDRESPONSE_FEDERATEDBUNDLESENTRY']._serialized_start=195 + _globals['_X509SVIDRESPONSE_FEDERATEDBUNDLESENTRY']._serialized_end=250 + _globals['_X509SVID']._serialized_start=252 + _globals['_X509SVID']._serialized_end=339 + _globals['_X509BUNDLESREQUEST']._serialized_start=341 + _globals['_X509BUNDLESREQUEST']._serialized_end=361 + _globals['_X509BUNDLESRESPONSE']._serialized_start=363 + _globals['_X509BUNDLESRESPONSE']._serialized_end=484 + _globals['_X509BUNDLESRESPONSE_BUNDLESENTRY']._serialized_start=438 + _globals['_X509BUNDLESRESPONSE_BUNDLESENTRY']._serialized_end=484 + _globals['_JWTSVID']._serialized_start=486 + _globals['_JWTSVID']._serialized_end=528 + _globals['_JWTSVIDREQUEST']._serialized_start=530 + _globals['_JWTSVIDREQUEST']._serialized_end=583 + _globals['_JWTSVIDRESPONSE']._serialized_start=585 + _globals['_JWTSVIDRESPONSE']._serialized_end=627 + _globals['_JWTBUNDLESREQUEST']._serialized_start=629 + _globals['_JWTBUNDLESREQUEST']._serialized_end=648 + _globals['_JWTBUNDLESRESPONSE']._serialized_start=650 + _globals['_JWTBUNDLESRESPONSE']._serialized_end=769 + _globals['_JWTBUNDLESRESPONSE_BUNDLESENTRY']._serialized_start=438 + _globals['_JWTBUNDLESRESPONSE_BUNDLESENTRY']._serialized_end=484 + _globals['_SPIFFEWORKLOADAPI']._serialized_start=772 + _globals['_SPIFFEWORKLOADAPI']._serialized_end=1025 +# @@protoc_insertion_point(module_scope) diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/ztispiffe/spiffe/proto/workload/workload_pb2_grpc.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/ztispiffe/spiffe/proto/workload/workload_pb2_grpc.py new file mode 100644 index 0000000000000000000000000000000000000000..afcf10b8a05f7ffc111851ad5af7280fbe24e8ec --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/ztispiffe/spiffe/proto/workload/workload_pb2_grpc.py @@ -0,0 +1,170 @@ +# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! +"""Client and server classes corresponding to protobuf-defined services.""" +import grpc + +from . import workload_pb2 as workload__pb2 + + +class SpiffeWorkloadAPIStub(object): + """Missing associated documentation comment in .proto file.""" + + def __init__(self, channel): + """Constructor. + + Args: + channel: A grpc.Channel. + """ + self.FetchX509SVID = channel.unary_stream( + '/SpiffeWorkloadAPI/FetchX509SVID', + request_serializer=workload__pb2.X509SVIDRequest.SerializeToString, + response_deserializer=workload__pb2.X509SVIDResponse.FromString, + ) + self.FetchX509Bundles = channel.unary_stream( + '/SpiffeWorkloadAPI/FetchX509Bundles', + request_serializer=workload__pb2.X509BundlesRequest.SerializeToString, + response_deserializer=workload__pb2.X509BundlesResponse.FromString, + ) + self.FetchJWTSVID = channel.unary_unary( + '/SpiffeWorkloadAPI/FetchJWTSVID', + request_serializer=workload__pb2.JWTSVIDRequest.SerializeToString, + response_deserializer=workload__pb2.JWTSVIDResponse.FromString, + ) + self.FetchJWTBundles = channel.unary_stream( + '/SpiffeWorkloadAPI/FetchJWTBundles', + request_serializer=workload__pb2.JWTBundlesRequest.SerializeToString, + response_deserializer=workload__pb2.JWTBundlesResponse.FromString, + ) + + +class SpiffeWorkloadAPIServicer(object): + """Missing associated documentation comment in .proto file.""" + + def FetchX509SVID(self, request, context): + """X.509-SVID Profile + Fetch all SPIFFE identities the workload is entitled to, as + well as related information like trust bundles and CRLs. As + this information changes, subsequent messages will be sent. + """ + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def FetchX509Bundles(self, request, context): + """Missing associated documentation comment in .proto file.""" + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def FetchJWTSVID(self, request, context): + """JWT-SVID Profile + """ + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def FetchJWTBundles(self, request, context): + """Missing associated documentation comment in .proto file.""" + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + +def add_SpiffeWorkloadAPIServicer_to_server(servicer, server): + rpc_method_handlers = { + 'FetchX509SVID': grpc.unary_stream_rpc_method_handler( + servicer.FetchX509SVID, + request_deserializer=workload__pb2.X509SVIDRequest.FromString, + response_serializer=workload__pb2.X509SVIDResponse.SerializeToString, + ), + 'FetchX509Bundles': grpc.unary_stream_rpc_method_handler( + servicer.FetchX509Bundles, + request_deserializer=workload__pb2.X509BundlesRequest.FromString, + response_serializer=workload__pb2.X509BundlesResponse.SerializeToString, + ), + 'FetchJWTSVID': grpc.unary_unary_rpc_method_handler( + servicer.FetchJWTSVID, + request_deserializer=workload__pb2.JWTSVIDRequest.FromString, + response_serializer=workload__pb2.JWTSVIDResponse.SerializeToString, + ), + 'FetchJWTBundles': grpc.unary_stream_rpc_method_handler( + servicer.FetchJWTBundles, + request_deserializer=workload__pb2.JWTBundlesRequest.FromString, + response_serializer=workload__pb2.JWTBundlesResponse.SerializeToString, + ), + } + generic_handler = grpc.method_handlers_generic_handler( + 'SpiffeWorkloadAPI', rpc_method_handlers) + server.add_generic_rpc_handlers((generic_handler,)) + + + # This class is part of an EXPERIMENTAL API. +class SpiffeWorkloadAPI(object): + """Missing associated documentation comment in .proto file.""" + + @staticmethod + def FetchX509SVID(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_stream(request, target, '/SpiffeWorkloadAPI/FetchX509SVID', + workload__pb2.X509SVIDRequest.SerializeToString, + workload__pb2.X509SVIDResponse.FromString, + options, channel_credentials, + insecure, call_credentials, compression, wait_for_ready, timeout, metadata) + + @staticmethod + def FetchX509Bundles(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_stream(request, target, '/SpiffeWorkloadAPI/FetchX509Bundles', + workload__pb2.X509BundlesRequest.SerializeToString, + workload__pb2.X509BundlesResponse.FromString, + options, channel_credentials, + insecure, call_credentials, compression, wait_for_ready, timeout, metadata) + + @staticmethod + def FetchJWTSVID(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_unary(request, target, '/SpiffeWorkloadAPI/FetchJWTSVID', + workload__pb2.JWTSVIDRequest.SerializeToString, + workload__pb2.JWTSVIDResponse.FromString, + options, channel_credentials, + insecure, call_credentials, compression, wait_for_ready, timeout, metadata) + + @staticmethod + def FetchJWTBundles(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_stream(request, target, '/SpiffeWorkloadAPI/FetchJWTBundles', + workload__pb2.JWTBundlesRequest.SerializeToString, + workload__pb2.JWTBundlesResponse.FromString, + options, channel_credentials, + insecure, call_credentials, compression, wait_for_ready, timeout, metadata) diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/ztispiffe/spiffe/proto/workload_py2/__init__.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/ztispiffe/spiffe/proto/workload_py2/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..b8a67b28886ad071145d5e9f4f06d0583f4ce62a --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/ztispiffe/spiffe/proto/workload_py2/__init__.py @@ -0,0 +1,2 @@ +from .workload_pb2 import * +from .workload_pb2_grpc import SpiffeWorkloadAPIStub diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/ztispiffe/spiffe/proto/workload_py2/workload_pb2.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/ztispiffe/spiffe/proto/workload_py2/workload_pb2.py new file mode 100644 index 0000000000000000000000000000000000000000..0397dd2f7addcd26ad106c24b83292d5d31bb80f --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/ztispiffe/spiffe/proto/workload_py2/workload_pb2.py @@ -0,0 +1,665 @@ +# -*- coding: utf-8 -*- +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: workload.proto +"""Generated protocol buffer code.""" +from google.protobuf import descriptor as _descriptor +from google.protobuf import message as _message +from google.protobuf import reflection as _reflection +from google.protobuf import symbol_database as _symbol_database +# @@protoc_insertion_point(imports) + +_sym_db = _symbol_database.Default() + + +from google.protobuf import struct_pb2 as google_dot_protobuf_dot_struct__pb2 + + +DESCRIPTOR = _descriptor.FileDescriptor( + name='workload.proto', + package='', + syntax='proto3', + serialized_options=None, + create_key=_descriptor._internal_create_key, + serialized_pb=b'\n\x0eworkload.proto\x1a\x1cgoogle/protobuf/struct.proto\"\x11\n\x0fX509SVIDRequest\"\xb6\x01\n\x10X509SVIDResponse\x12\x18\n\x05svids\x18\x01 \x03(\x0b\x32\t.X509SVID\x12\x0b\n\x03\x63rl\x18\x02 \x03(\x0c\x12\x42\n\x11\x66\x65\x64\x65rated_bundles\x18\x03 \x03(\x0b\x32\'.X509SVIDResponse.FederatedBundlesEntry\x1a\x37\n\x15\x46\x65\x64\x65ratedBundlesEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\x0c:\x02\x38\x01\"W\n\x08X509SVID\x12\x11\n\tspiffe_id\x18\x01 \x01(\t\x12\x11\n\tx509_svid\x18\x02 \x01(\x0c\x12\x15\n\rx509_svid_key\x18\x03 \x01(\x0c\x12\x0e\n\x06\x62undle\x18\x04 \x01(\x0c\"\x14\n\x12X509BundlesRequest\"y\n\x13X509BundlesResponse\x12\x32\n\x07\x62undles\x18\x01 \x03(\x0b\x32!.X509BundlesResponse.BundlesEntry\x1a.\n\x0c\x42undlesEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\x0c:\x02\x38\x01\"*\n\x07JWTSVID\x12\x11\n\tspiffe_id\x18\x01 \x01(\t\x12\x0c\n\x04svid\x18\x02 \x01(\t\"5\n\x0eJWTSVIDRequest\x12\x10\n\x08\x61udience\x18\x01 \x03(\t\x12\x11\n\tspiffe_id\x18\x02 \x01(\t\"*\n\x0fJWTSVIDResponse\x12\x17\n\x05svids\x18\x01 \x03(\x0b\x32\x08.JWTSVID\"\x13\n\x11JWTBundlesRequest\"w\n\x12JWTBundlesResponse\x12\x31\n\x07\x62undles\x18\x01 \x03(\x0b\x32 .JWTBundlesResponse.BundlesEntry\x1a.\n\x0c\x42undlesEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\x0c:\x02\x38\x01\x32\xfd\x01\n\x11SpiffeWorkloadAPI\x12\x36\n\rFetchX509SVID\x12\x10.X509SVIDRequest\x1a\x11.X509SVIDResponse0\x01\x12?\n\x10\x46\x65tchX509Bundles\x12\x13.X509BundlesRequest\x1a\x14.X509BundlesResponse0\x01\x12\x31\n\x0c\x46\x65tchJWTSVID\x12\x0f.JWTSVIDRequest\x1a\x10.JWTSVIDResponse\x12<\n\x0f\x46\x65tchJWTBundles\x12\x12.JWTBundlesRequest\x1a\x13.JWTBundlesResponse0\x01\x62\x06proto3' + , + dependencies=[google_dot_protobuf_dot_struct__pb2.DESCRIPTOR,]) + + + + +_X509SVIDREQUEST = _descriptor.Descriptor( + name='X509SVIDRequest', + full_name='X509SVIDRequest', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=48, + serialized_end=65, +) + + +_X509SVIDRESPONSE_FEDERATEDBUNDLESENTRY = _descriptor.Descriptor( + name='FederatedBundlesEntry', + full_name='X509SVIDResponse.FederatedBundlesEntry', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='key', full_name='X509SVIDResponse.FederatedBundlesEntry.key', index=0, + number=1, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=b"".decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='value', full_name='X509SVIDResponse.FederatedBundlesEntry.value', index=1, + number=2, type=12, cpp_type=9, label=1, + has_default_value=False, default_value=b"", + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=b'8\001', + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=195, + serialized_end=250, +) + +_X509SVIDRESPONSE = _descriptor.Descriptor( + name='X509SVIDResponse', + full_name='X509SVIDResponse', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='svids', full_name='X509SVIDResponse.svids', index=0, + number=1, type=11, cpp_type=10, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='crl', full_name='X509SVIDResponse.crl', index=1, + number=2, type=12, cpp_type=9, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='federated_bundles', full_name='X509SVIDResponse.federated_bundles', index=2, + number=3, type=11, cpp_type=10, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[_X509SVIDRESPONSE_FEDERATEDBUNDLESENTRY, ], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=68, + serialized_end=250, +) + + +_X509SVID = _descriptor.Descriptor( + name='X509SVID', + full_name='X509SVID', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='spiffe_id', full_name='X509SVID.spiffe_id', index=0, + number=1, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=b"".decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='x509_svid', full_name='X509SVID.x509_svid', index=1, + number=2, type=12, cpp_type=9, label=1, + has_default_value=False, default_value=b"", + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='x509_svid_key', full_name='X509SVID.x509_svid_key', index=2, + number=3, type=12, cpp_type=9, label=1, + has_default_value=False, default_value=b"", + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='bundle', full_name='X509SVID.bundle', index=3, + number=4, type=12, cpp_type=9, label=1, + has_default_value=False, default_value=b"", + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=252, + serialized_end=339, +) + + +_X509BUNDLESREQUEST = _descriptor.Descriptor( + name='X509BundlesRequest', + full_name='X509BundlesRequest', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=341, + serialized_end=361, +) + + +_X509BUNDLESRESPONSE_BUNDLESENTRY = _descriptor.Descriptor( + name='BundlesEntry', + full_name='X509BundlesResponse.BundlesEntry', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='key', full_name='X509BundlesResponse.BundlesEntry.key', index=0, + number=1, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=b"".decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='value', full_name='X509BundlesResponse.BundlesEntry.value', index=1, + number=2, type=12, cpp_type=9, label=1, + has_default_value=False, default_value=b"", + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=b'8\001', + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=438, + serialized_end=484, +) + +_X509BUNDLESRESPONSE = _descriptor.Descriptor( + name='X509BundlesResponse', + full_name='X509BundlesResponse', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='bundles', full_name='X509BundlesResponse.bundles', index=0, + number=1, type=11, cpp_type=10, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[_X509BUNDLESRESPONSE_BUNDLESENTRY, ], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=363, + serialized_end=484, +) + + +_JWTSVID = _descriptor.Descriptor( + name='JWTSVID', + full_name='JWTSVID', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='spiffe_id', full_name='JWTSVID.spiffe_id', index=0, + number=1, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=b"".decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='svid', full_name='JWTSVID.svid', index=1, + number=2, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=b"".decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=486, + serialized_end=528, +) + + +_JWTSVIDREQUEST = _descriptor.Descriptor( + name='JWTSVIDRequest', + full_name='JWTSVIDRequest', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='audience', full_name='JWTSVIDRequest.audience', index=0, + number=1, type=9, cpp_type=9, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='spiffe_id', full_name='JWTSVIDRequest.spiffe_id', index=1, + number=2, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=b"".decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=530, + serialized_end=583, +) + + +_JWTSVIDRESPONSE = _descriptor.Descriptor( + name='JWTSVIDResponse', + full_name='JWTSVIDResponse', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='svids', full_name='JWTSVIDResponse.svids', index=0, + number=1, type=11, cpp_type=10, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=585, + serialized_end=627, +) + + +_JWTBUNDLESREQUEST = _descriptor.Descriptor( + name='JWTBundlesRequest', + full_name='JWTBundlesRequest', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=629, + serialized_end=648, +) + + +_JWTBUNDLESRESPONSE_BUNDLESENTRY = _descriptor.Descriptor( + name='BundlesEntry', + full_name='JWTBundlesResponse.BundlesEntry', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='key', full_name='JWTBundlesResponse.BundlesEntry.key', index=0, + number=1, type=9, cpp_type=9, label=1, + has_default_value=False, default_value=b"".decode('utf-8'), + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + _descriptor.FieldDescriptor( + name='value', full_name='JWTBundlesResponse.BundlesEntry.value', index=1, + number=2, type=12, cpp_type=9, label=1, + has_default_value=False, default_value=b"", + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[], + enum_types=[ + ], + serialized_options=b'8\001', + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=438, + serialized_end=484, +) + +_JWTBUNDLESRESPONSE = _descriptor.Descriptor( + name='JWTBundlesResponse', + full_name='JWTBundlesResponse', + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name='bundles', full_name='JWTBundlesResponse.bundles', index=0, + number=1, type=11, cpp_type=10, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), + ], + extensions=[ + ], + nested_types=[_JWTBUNDLESRESPONSE_BUNDLESENTRY, ], + enum_types=[ + ], + serialized_options=None, + is_extendable=False, + syntax='proto3', + extension_ranges=[], + oneofs=[ + ], + serialized_start=650, + serialized_end=769, +) + +_X509SVIDRESPONSE_FEDERATEDBUNDLESENTRY.containing_type = _X509SVIDRESPONSE +_X509SVIDRESPONSE.fields_by_name['svids'].message_type = _X509SVID +_X509SVIDRESPONSE.fields_by_name['federated_bundles'].message_type = _X509SVIDRESPONSE_FEDERATEDBUNDLESENTRY +_X509BUNDLESRESPONSE_BUNDLESENTRY.containing_type = _X509BUNDLESRESPONSE +_X509BUNDLESRESPONSE.fields_by_name['bundles'].message_type = _X509BUNDLESRESPONSE_BUNDLESENTRY +_JWTSVIDRESPONSE.fields_by_name['svids'].message_type = _JWTSVID +_JWTBUNDLESRESPONSE_BUNDLESENTRY.containing_type = _JWTBUNDLESRESPONSE +_JWTBUNDLESRESPONSE.fields_by_name['bundles'].message_type = _JWTBUNDLESRESPONSE_BUNDLESENTRY +DESCRIPTOR.message_types_by_name['X509SVIDRequest'] = _X509SVIDREQUEST +DESCRIPTOR.message_types_by_name['X509SVIDResponse'] = _X509SVIDRESPONSE +DESCRIPTOR.message_types_by_name['X509SVID'] = _X509SVID +DESCRIPTOR.message_types_by_name['X509BundlesRequest'] = _X509BUNDLESREQUEST +DESCRIPTOR.message_types_by_name['X509BundlesResponse'] = _X509BUNDLESRESPONSE +DESCRIPTOR.message_types_by_name['JWTSVID'] = _JWTSVID +DESCRIPTOR.message_types_by_name['JWTSVIDRequest'] = _JWTSVIDREQUEST +DESCRIPTOR.message_types_by_name['JWTSVIDResponse'] = _JWTSVIDRESPONSE +DESCRIPTOR.message_types_by_name['JWTBundlesRequest'] = _JWTBUNDLESREQUEST +DESCRIPTOR.message_types_by_name['JWTBundlesResponse'] = _JWTBUNDLESRESPONSE +_sym_db.RegisterFileDescriptor(DESCRIPTOR) + +X509SVIDRequest = _reflection.GeneratedProtocolMessageType('X509SVIDRequest', (_message.Message,), { + 'DESCRIPTOR' : _X509SVIDREQUEST, + '__module__' : 'workload_pb2' + # @@protoc_insertion_point(class_scope:X509SVIDRequest) + }) +_sym_db.RegisterMessage(X509SVIDRequest) + +X509SVIDResponse = _reflection.GeneratedProtocolMessageType('X509SVIDResponse', (_message.Message,), { + + 'FederatedBundlesEntry' : _reflection.GeneratedProtocolMessageType('FederatedBundlesEntry', (_message.Message,), { + 'DESCRIPTOR' : _X509SVIDRESPONSE_FEDERATEDBUNDLESENTRY, + '__module__' : 'workload_pb2' + # @@protoc_insertion_point(class_scope:X509SVIDResponse.FederatedBundlesEntry) + }) + , + 'DESCRIPTOR' : _X509SVIDRESPONSE, + '__module__' : 'workload_pb2' + # @@protoc_insertion_point(class_scope:X509SVIDResponse) + }) +_sym_db.RegisterMessage(X509SVIDResponse) +_sym_db.RegisterMessage(X509SVIDResponse.FederatedBundlesEntry) + +X509SVID = _reflection.GeneratedProtocolMessageType('X509SVID', (_message.Message,), { + 'DESCRIPTOR' : _X509SVID, + '__module__' : 'workload_pb2' + # @@protoc_insertion_point(class_scope:X509SVID) + }) +_sym_db.RegisterMessage(X509SVID) + +X509BundlesRequest = _reflection.GeneratedProtocolMessageType('X509BundlesRequest', (_message.Message,), { + 'DESCRIPTOR' : _X509BUNDLESREQUEST, + '__module__' : 'workload_pb2' + # @@protoc_insertion_point(class_scope:X509BundlesRequest) + }) +_sym_db.RegisterMessage(X509BundlesRequest) + +X509BundlesResponse = _reflection.GeneratedProtocolMessageType('X509BundlesResponse', (_message.Message,), { + + 'BundlesEntry' : _reflection.GeneratedProtocolMessageType('BundlesEntry', (_message.Message,), { + 'DESCRIPTOR' : _X509BUNDLESRESPONSE_BUNDLESENTRY, + '__module__' : 'workload_pb2' + # @@protoc_insertion_point(class_scope:X509BundlesResponse.BundlesEntry) + }) + , + 'DESCRIPTOR' : _X509BUNDLESRESPONSE, + '__module__' : 'workload_pb2' + # @@protoc_insertion_point(class_scope:X509BundlesResponse) + }) +_sym_db.RegisterMessage(X509BundlesResponse) +_sym_db.RegisterMessage(X509BundlesResponse.BundlesEntry) + +JWTSVID = _reflection.GeneratedProtocolMessageType('JWTSVID', (_message.Message,), { + 'DESCRIPTOR' : _JWTSVID, + '__module__' : 'workload_pb2' + # @@protoc_insertion_point(class_scope:JWTSVID) + }) +_sym_db.RegisterMessage(JWTSVID) + +JWTSVIDRequest = _reflection.GeneratedProtocolMessageType('JWTSVIDRequest', (_message.Message,), { + 'DESCRIPTOR' : _JWTSVIDREQUEST, + '__module__' : 'workload_pb2' + # @@protoc_insertion_point(class_scope:JWTSVIDRequest) + }) +_sym_db.RegisterMessage(JWTSVIDRequest) + +JWTSVIDResponse = _reflection.GeneratedProtocolMessageType('JWTSVIDResponse', (_message.Message,), { + 'DESCRIPTOR' : _JWTSVIDRESPONSE, + '__module__' : 'workload_pb2' + # @@protoc_insertion_point(class_scope:JWTSVIDResponse) + }) +_sym_db.RegisterMessage(JWTSVIDResponse) + +JWTBundlesRequest = _reflection.GeneratedProtocolMessageType('JWTBundlesRequest', (_message.Message,), { + 'DESCRIPTOR' : _JWTBUNDLESREQUEST, + '__module__' : 'workload_pb2' + # @@protoc_insertion_point(class_scope:JWTBundlesRequest) + }) +_sym_db.RegisterMessage(JWTBundlesRequest) + +JWTBundlesResponse = _reflection.GeneratedProtocolMessageType('JWTBundlesResponse', (_message.Message,), { + + 'BundlesEntry' : _reflection.GeneratedProtocolMessageType('BundlesEntry', (_message.Message,), { + 'DESCRIPTOR' : _JWTBUNDLESRESPONSE_BUNDLESENTRY, + '__module__' : 'workload_pb2' + # @@protoc_insertion_point(class_scope:JWTBundlesResponse.BundlesEntry) + }) + , + 'DESCRIPTOR' : _JWTBUNDLESRESPONSE, + '__module__' : 'workload_pb2' + # @@protoc_insertion_point(class_scope:JWTBundlesResponse) + }) +_sym_db.RegisterMessage(JWTBundlesResponse) +_sym_db.RegisterMessage(JWTBundlesResponse.BundlesEntry) + + +_X509SVIDRESPONSE_FEDERATEDBUNDLESENTRY._options = None +_X509BUNDLESRESPONSE_BUNDLESENTRY._options = None +_JWTBUNDLESRESPONSE_BUNDLESENTRY._options = None + +_SPIFFEWORKLOADAPI = _descriptor.ServiceDescriptor( + name='SpiffeWorkloadAPI', + full_name='SpiffeWorkloadAPI', + file=DESCRIPTOR, + index=0, + serialized_options=None, + create_key=_descriptor._internal_create_key, + serialized_start=772, + serialized_end=1025, + methods=[ + _descriptor.MethodDescriptor( + name='FetchX509SVID', + full_name='SpiffeWorkloadAPI.FetchX509SVID', + index=0, + containing_service=None, + input_type=_X509SVIDREQUEST, + output_type=_X509SVIDRESPONSE, + serialized_options=None, + create_key=_descriptor._internal_create_key, + ), + _descriptor.MethodDescriptor( + name='FetchX509Bundles', + full_name='SpiffeWorkloadAPI.FetchX509Bundles', + index=1, + containing_service=None, + input_type=_X509BUNDLESREQUEST, + output_type=_X509BUNDLESRESPONSE, + serialized_options=None, + create_key=_descriptor._internal_create_key, + ), + _descriptor.MethodDescriptor( + name='FetchJWTSVID', + full_name='SpiffeWorkloadAPI.FetchJWTSVID', + index=2, + containing_service=None, + input_type=_JWTSVIDREQUEST, + output_type=_JWTSVIDRESPONSE, + serialized_options=None, + create_key=_descriptor._internal_create_key, + ), + _descriptor.MethodDescriptor( + name='FetchJWTBundles', + full_name='SpiffeWorkloadAPI.FetchJWTBundles', + index=3, + containing_service=None, + input_type=_JWTBUNDLESREQUEST, + output_type=_JWTBUNDLESRESPONSE, + serialized_options=None, + create_key=_descriptor._internal_create_key, + ), +]) +_sym_db.RegisterServiceDescriptor(_SPIFFEWORKLOADAPI) + +DESCRIPTOR.services_by_name['SpiffeWorkloadAPI'] = _SPIFFEWORKLOADAPI + +# @@protoc_insertion_point(module_scope) diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/ztispiffe/spiffe/proto/workload_py2/workload_pb2_grpc.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/ztispiffe/spiffe/proto/workload_py2/workload_pb2_grpc.py new file mode 100644 index 0000000000000000000000000000000000000000..579229e7b1ef42558e2d9571bed804901e487333 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/ztispiffe/spiffe/proto/workload_py2/workload_pb2_grpc.py @@ -0,0 +1,170 @@ +# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! +"""Client and server classes corresponding to protobuf-defined services.""" +import grpc + +from ..workload_py2 import workload_pb2 as workload__pb2 + + +class SpiffeWorkloadAPIStub(object): + """Missing associated documentation comment in .proto file.""" + + def __init__(self, channel): + """Constructor. + + Args: + channel: A grpc.Channel. + """ + self.FetchX509SVID = channel.unary_stream( + '/SpiffeWorkloadAPI/FetchX509SVID', + request_serializer=workload__pb2.X509SVIDRequest.SerializeToString, + response_deserializer=workload__pb2.X509SVIDResponse.FromString, + ) + self.FetchX509Bundles = channel.unary_stream( + '/SpiffeWorkloadAPI/FetchX509Bundles', + request_serializer=workload__pb2.X509BundlesRequest.SerializeToString, + response_deserializer=workload__pb2.X509BundlesResponse.FromString, + ) + self.FetchJWTSVID = channel.unary_unary( + '/SpiffeWorkloadAPI/FetchJWTSVID', + request_serializer=workload__pb2.JWTSVIDRequest.SerializeToString, + response_deserializer=workload__pb2.JWTSVIDResponse.FromString, + ) + self.FetchJWTBundles = channel.unary_stream( + '/SpiffeWorkloadAPI/FetchJWTBundles', + request_serializer=workload__pb2.JWTBundlesRequest.SerializeToString, + response_deserializer=workload__pb2.JWTBundlesResponse.FromString, + ) + + +class SpiffeWorkloadAPIServicer(object): + """Missing associated documentation comment in .proto file.""" + + def FetchX509SVID(self, request, context): + """X.509-SVID Profile + Fetch all SPIFFE identities the workload is entitled to, as + well as related information like trust bundles and CRLs. As + this information changes, subsequent messages will be sent. + """ + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def FetchX509Bundles(self, request, context): + """Missing associated documentation comment in .proto file.""" + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def FetchJWTSVID(self, request, context): + """JWT-SVID Profile + """ + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + def FetchJWTBundles(self, request, context): + """Missing associated documentation comment in .proto file.""" + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details('Method not implemented!') + raise NotImplementedError('Method not implemented!') + + +def add_SpiffeWorkloadAPIServicer_to_server(servicer, server): + rpc_method_handlers = { + 'FetchX509SVID': grpc.unary_stream_rpc_method_handler( + servicer.FetchX509SVID, + request_deserializer=workload__pb2.X509SVIDRequest.FromString, + response_serializer=workload__pb2.X509SVIDResponse.SerializeToString, + ), + 'FetchX509Bundles': grpc.unary_stream_rpc_method_handler( + servicer.FetchX509Bundles, + request_deserializer=workload__pb2.X509BundlesRequest.FromString, + response_serializer=workload__pb2.X509BundlesResponse.SerializeToString, + ), + 'FetchJWTSVID': grpc.unary_unary_rpc_method_handler( + servicer.FetchJWTSVID, + request_deserializer=workload__pb2.JWTSVIDRequest.FromString, + response_serializer=workload__pb2.JWTSVIDResponse.SerializeToString, + ), + 'FetchJWTBundles': grpc.unary_stream_rpc_method_handler( + servicer.FetchJWTBundles, + request_deserializer=workload__pb2.JWTBundlesRequest.FromString, + response_serializer=workload__pb2.JWTBundlesResponse.SerializeToString, + ), + } + generic_handler = grpc.method_handlers_generic_handler( + 'SpiffeWorkloadAPI', rpc_method_handlers) + server.add_generic_rpc_handlers((generic_handler,)) + + + # This class is part of an EXPERIMENTAL API. +class SpiffeWorkloadAPI(object): + """Missing associated documentation comment in .proto file.""" + + @staticmethod + def FetchX509SVID(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_stream(request, target, '/SpiffeWorkloadAPI/FetchX509SVID', + workload__pb2.X509SVIDRequest.SerializeToString, + workload__pb2.X509SVIDResponse.FromString, + options, channel_credentials, + insecure, call_credentials, compression, wait_for_ready, timeout, metadata) + + @staticmethod + def FetchX509Bundles(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_stream(request, target, '/SpiffeWorkloadAPI/FetchX509Bundles', + workload__pb2.X509BundlesRequest.SerializeToString, + workload__pb2.X509BundlesResponse.FromString, + options, channel_credentials, + insecure, call_credentials, compression, wait_for_ready, timeout, metadata) + + @staticmethod + def FetchJWTSVID(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_unary(request, target, '/SpiffeWorkloadAPI/FetchJWTSVID', + workload__pb2.JWTSVIDRequest.SerializeToString, + workload__pb2.JWTSVIDResponse.FromString, + options, channel_credentials, + insecure, call_credentials, compression, wait_for_ready, timeout, metadata) + + @staticmethod + def FetchJWTBundles(request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None): + return grpc.experimental.unary_stream(request, target, '/SpiffeWorkloadAPI/FetchJWTBundles', + workload__pb2.JWTBundlesRequest.SerializeToString, + workload__pb2.JWTBundlesResponse.FromString, + options, channel_credentials, + insecure, call_credentials, compression, wait_for_ready, timeout, metadata) diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/ztispiffe/spiffe/spiffeid/__init__.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/ztispiffe/spiffe/spiffeid/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..5ba311ca7dd54e7e62a2144a6a9b1051151448fe --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/ztispiffe/spiffe/spiffeid/__init__.py @@ -0,0 +1 @@ +from .id import ID diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/ztispiffe/spiffe/spiffeid/id.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/ztispiffe/spiffe/spiffeid/id.py new file mode 100644 index 0000000000000000000000000000000000000000..1f3374579aec181072af259bf94b036813dedf67 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/ztispiffe/spiffe/spiffeid/id.py @@ -0,0 +1,87 @@ +from enum import Enum + +from cryptography import x509 +from urllib3.util import url + +from ... import SpiffeError + + +class ID(object): + def __init__(self, trust_domain=None, path=None): + self.trust_domain = trust_domain + self.path = path + + def __str__(self): + return "{ From str method of ID: trust_domain = %s, path = %s }" % (self.trust_domain, self.path) + + @classmethod + def from_str(cls, id_str): + return cls.from_uri(id_str) + + @classmethod + def from_uri(cls, uri): + if not hasattr(uri, 'hostname') or not hasattr(uri, 'path'): + uri = url.parse_url(uri) + trust_domain = str(uri.hostname) + path = str(uri.path).lstrip('/').rstrip('/') + return cls(trust_domain, path) + + def is_zero(self): + if not self.trust_domain: + return True + return False + + def to_str(self): + if self.is_zero(): + return "" + return self.trust_domain + '/' + self.path + + def get_trust_domain(self): + return str(self.trust_domain) + + def get_path(self): + return str(self.path) + + +class IdType(Enum): + ANY_TYPE = 1 + TRUST_DOMAIN_ID = 2 + WORKLOAD_ID = 3 + + +class ValidationOptions: + def __init__(self, trust_domain='', trust_domain_required=False, id_type=IdType.ANY_TYPE): + self.trust_domain = trust_domain + self.trust_domain_required = trust_domain_required + self.id_type = id_type + + +def validate_uri(uri, options): + # type: (url.Url, ValidationOptions) -> None + if uri is None: + raise SpiffeError('spiffe id is empty') + if not isinstance(uri, url.Url): + raise SpiffeError('not a uri ({type})'.format(type=type(uri))) + if uri.scheme.lower() != 'spiffe': + raise SpiffeError('invalid scheme') + if not uri.host: + raise SpiffeError('trust domain is empty') + if uri.port is not None: + raise SpiffeError('port is not allowed') + if uri.fragment is not None: + raise SpiffeError('fragment is not allowed') + if uri.query is not None: + raise SpiffeError('query is not allowed') + + if options.trust_domain_required: + if not options.trust_domain: + raise SpiffeError('trust domain to validate against cannot be empty') + if uri.host != options.trust_domain: + raise SpiffeError('{id} does not belong to trust domain {td}'.format(id=uri, td=options.trust_domain)) + + if options.id_type == IdType.TRUST_DOMAIN_ID: + if uri.path: + raise SpiffeError('path is not empty') + if options.id_type == IdType.WORKLOAD_ID: + if not uri.path: + raise SpiffeError('path is empty') diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/ztispiffe/spiffe/svid/__init__.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/ztispiffe/spiffe/svid/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/ztispiffe/spiffe/svid/x509svid/__init__.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/ztispiffe/spiffe/svid/x509svid/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..901d8c6416529d6f65a249827ba0ee99c9900fb1 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/ztispiffe/spiffe/svid/x509svid/__init__.py @@ -0,0 +1,2 @@ +from .svid import * +from .verify import * diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/ztispiffe/spiffe/svid/x509svid/svid.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/ztispiffe/spiffe/svid/x509svid/svid.py new file mode 100644 index 0000000000000000000000000000000000000000..aca9231709b90e5a4bceadc8a34e554267546226 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/ztispiffe/spiffe/svid/x509svid/svid.py @@ -0,0 +1,83 @@ +from typing import List + +from cryptography import x509 + +from ... import spiffeid +from .... import SpiffeError + + +class SvidError(SpiffeError): + pass + + +def id_from_cert(cert): + # type: (x509.Certificate) -> spiffeid.ID + sans = cert.extensions.get_extension_for_class(x509.SubjectAlternativeName).value + uris = [san for san in sans if type(san) == x509.UniformResourceIdentifier] + if len(uris) == 0: + raise SpiffeError("certificate contains no URI SAN") + elif len(uris) > 1: + raise SpiffeError("certificate contains more than one URI SAN") + return spiffeid.ID().from_str(uris[0].value) + + +def validate_certificates(certs): + # type: (List[x509.Certificate]) -> spiffeid.ID + if len(certs) == 0: + raise SvidError('no certificates found') + + leaf_id = validate_leaf_certificate(certs[0]) + + validate_signing_certificates(certs[1:]) + + return leaf_id + + +def validate_leaf_certificate(leaf): + # type: (x509.Certificate) -> spiffeid.ID + try: + leaf_id = id_from_cert(leaf) + except Exception as e: + raise SvidError('cannot get leaf certificate SPIFFE ID').with_traceback(e.__traceback__) + + if is_ca(leaf): + raise SvidError('leaf certificate must not have CA flag set to true') + + validate_leaf_cert_key_usage(leaf) + + return leaf_id + + +def validate_signing_certificates(certs): + # type: (List[x509.Certificate]) -> None + for cert in certs: + if not is_ca(cert): + raise SvidError('signing certificate must have CA flag set to true') + validate_signing_cert_key_usage(cert) + + +def is_ca(cert): + # type: (x509.Certificate) -> bool + basic_constraints = cert.extensions.get_extension_for_class(x509.BasicConstraints).value + # type: x509.BasicConstraints + return basic_constraints.ca + + +def validate_leaf_cert_key_usage(leaf): + # type: (x509.Certificate) -> None + key_usage = leaf.extensions.get_extension_for_class(x509.KeyUsage).value + # type: x509.KeyUsage + if not key_usage.digital_signature: + raise SvidError('leaf certificate must have \'digital_signature\' set as key usage') + if key_usage.key_cert_sign: + raise SvidError('leaf certificate must not have \'key_cert_sign\' set as key usage') + if key_usage.crl_sign: + raise SvidError('leaf certificate must not have \'crl_sign\' set as key usage') + + +def validate_signing_cert_key_usage(leaf): + # type: (x509.Certificate) -> None + key_usage = leaf.extensions.get_extension_for_class(x509.KeyUsage).value + # type: x509.KeyUsage + if not key_usage.key_cert_sign: + raise SvidError('signing certificate must have \'key_cert_sign\' set as key usage') \ No newline at end of file diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/ztispiffe/spiffe/svid/x509svid/verify.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/ztispiffe/spiffe/svid/x509svid/verify.py new file mode 100644 index 0000000000000000000000000000000000000000..5018f52b0c7d5b358ba5a8b6299adb76ed0cbb21 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/ztispiffe/spiffe/svid/x509svid/verify.py @@ -0,0 +1,43 @@ +from typing import List, Dict, Tuple + +from OpenSSL import crypto +from cryptography import x509 + + +from ...spiffeid import ID +from .svid import validate_leaf_certificate, SvidError + + +def verify(certs, bundle_source): + # type: (List[x509.Certificate], Dict[str, List[x509.Certificate]]) -> Tuple[ID, List[x509.Certificate]] + """ + Verifies an X.509-SVID chain using the X.509 bundle source. It returns the SPIFFE ID of the X.509-SVID and + one or more chains back to a root in the bundle. + + :param certs: the X.509-SVID chain to verify. + :param bundle_source: the X.509 bundle source to verify against. + :return: the SPIFFE ID of the X.509-SVID and verified chains back to a root in the bundle. + """ + if len(certs) == 0: + raise SvidError('empty certificates chain') + if len(bundle_source) == 0: + raise SvidError('bundle source is required') + + leaf_cert = certs[0] + leaf_id = validate_leaf_certificate(leaf_cert) + + try: + bundle = bundle_source[leaf_id.get_trust_domain()] + except Exception as e: + raise SvidError('could not get X509 bundle: {name}'.format(name=leaf_id.get_trust_domain())).with_traceback(e.__traceback__) + + store = crypto.X509Store() + for root in bundle: + store.add_cert(crypto.X509.from_cryptography(root)) + for intermediate in certs[1:]: + store.add_cert(crypto.X509.from_cryptography(intermediate)) + + store_ctx = crypto.X509StoreContext(store, crypto.X509.from_cryptography(leaf_cert)) + verified_chains = [cert.to_cryptography() for cert in store_ctx.get_verified_chain()] + + return leaf_id, verified_chains diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/ztispiffe/spire/__init__.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/ztispiffe/spire/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/ztispiffe/spire/api/__init__.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/ztispiffe/spire/api/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/ztispiffe/spire/api/workload/__init__.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/ztispiffe/spire/api/workload/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e087faa89c45ee33e62ae93dfa7be3bcc98ce978 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/ztispiffe/spire/api/workload/__init__.py @@ -0,0 +1,2 @@ +from .x509_client import X509ClientConfig, X509Client +from .jwt_client import JWTClientConfig, JWTClient \ No newline at end of file diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/ztispiffe/spire/api/workload/jwt_client.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/ztispiffe/spire/api/workload/jwt_client.py new file mode 100644 index 0000000000000000000000000000000000000000..e8acdbc541fa9470c95a9ba0247c048e9a11f42f --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/ztispiffe/spire/api/workload/jwt_client.py @@ -0,0 +1,49 @@ +import logging +import grpc + +has_builder = False +try: + from google.protobuf.internal import builder as _ + has_builder = True +except: + pass + +import sys +if sys.version_info[0:2] >= (3, 5) and has_builder: + from ....spiffe.proto import workload +else: + from ....spiffe.proto import workload_py2 as workload + + +DEFAULT_AGENT_SOCKET_ADDR = "unix:///var/run/zti-agent.sock" +DEFAULT_TIMEOUT_SECONDS = 5 +METADATA = [("workload.spiffe.io", "true")] + + +class JWTClientConfig(object): + def __init__(self, socket_addr=DEFAULT_AGENT_SOCKET_ADDR, logger=logging): + self.socket_addr = socket_addr + self.logger = logger + + +class JWTClient(object): + def __init__(self, config, grpc_options=None): + self.config = config + self.grpc_channel = grpc.insecure_channel(self.config.socket_addr, options=grpc_options) + self.stub = workload.SpiffeWorkloadAPIStub(self.grpc_channel) + + def fetch_jwt_svid(self): + # type: () -> workload.JWTSVIDResponse + return self.stub.FetchJWTSVID( + workload.JWTSVIDRequest(audience=["zti"]), + metadata=METADATA, + timeout=DEFAULT_TIMEOUT_SECONDS, + ) + + def get_jwt_bundle(self): + # type: () -> workload.JWTBundlesResponse + return self.stub.FetchJWTBundles( + workload.JWTBundlesRequest(), + metadata=METADATA, + timeout=DEFAULT_TIMEOUT_SECONDS, + ) diff --git a/miniconda3/envs/active_proaction/lib/python3.10/site-packages/ztispiffe/spire/api/workload/x509_client.py b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/ztispiffe/spire/api/workload/x509_client.py new file mode 100644 index 0000000000000000000000000000000000000000..7572b33f375fcfc8eaf1c39dc5e7f4ac71de3140 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/site-packages/ztispiffe/spire/api/workload/x509_client.py @@ -0,0 +1,200 @@ +try: + import queue +except ImportError: + import Queue as queue + +import logging +import threading +import time +from threading import Lock +from typing import List, Optional +import grpc + +from .... import SpiffeError + +has_builder = False +try: + from google.protobuf.internal import builder as _ + has_builder = True +except: + pass + +import sys +if sys.version_info[0:2] >= (3, 5) and has_builder: + from ....spiffe.proto import workload +else: + from ....spiffe.proto import workload_py2 as workload + + +class X509ClientError(SpiffeError): + pass + + +class X509ClientConfig(object): + def __init__(self, addr='', fail_on_error=False, timeout=300, backoff_cap=30, logger=logging): + self.__backoff_min__ = 1 + + self.addr = addr + self.fail_on_error = fail_on_error + self.timeout = timeout + self.backoff_cap = backoff_cap + self.logger = logger + + +class X509Client(object): + def __init__(self, config, grpc_options=None): # type: (X509ClientConfig, Optional[List[grpc.ChannelOption]]) -> None + self.config = config + # grpc options + self.grpc_options = grpc_options # type: Optional[List[grpc.ChannelOption]] + # type: queue.Queue[workload.X509SVIDResponse] + self.__update_queue = queue.Queue(1) + self.__lock = Lock() + + self._current_svid = None + + self._stream = None + # type: threading.Thread + self._stream_thread = None + + # type: queue.Queue + self._stop_signal = None + self._error = None + + def start(self, block=False): + self.__lock.acquire() + + # raise exception if client has already started + if self._stream_thread is not None: + self.__lock.release() + raise X509ClientError("already started") + + self._stop_signal = queue.Queue(1) + error_queue = queue.Queue(1) + + self._stream_thread = threading.Thread(target=self._stream_x509_svid, + args=(self.__update_queue, self._stop_signal, error_queue)) + self._stream_thread.start() + self.__lock.release() + + if block: + error = error_queue.get() + self.stop() + if error is not None: + raise X509ClientError('X509Client exited').with_traceback(error.__traceback__) + + def stop(self): + self.__lock.acquire() + + # return if client has not started + if self._stream_thread is None: + self.__lock.release() + return + + # stop the x509 streaming thread + self._stop_signal.put(1) + while True: + # if thread fails to join, try re-cancelling grpc stream channel because it blocks thread to finish + if self._stream is not None: + self._stream.cancel() + self._stream_thread.join(1) + if not self._stream_thread.is_alive(): + break + + self._stream_thread = None + self.__lock.release() + + def is_alive(self): + self.__lock.acquire() + res = self._stream_thread is not None and self._stream_thread.is_alive() + self.__lock.release() + return res + + def current_svid(self): + # type: () -> workload.X509SVIDResponse + resp = None + self.__lock.acquire() + if self._current_svid is not None: + resp = self._current_svid + else: + self.config.logger.error("no SVID received yet") + self.__lock.release() + return resp + + def update_queue(self): + # type: () -> 'queue.Queue[workload.X509SVIDResponse]' + return self.__update_queue + + def _stream_x509_svid(self, out, stop, exit_error): + # type: (queue.Queue, queue.Queue, queue.Queue) -> None + metadata = [("workload.spiffe.io", 'true')] + last_success = [time.time(), False] + backoff = [self.config.__backoff_min__] + + def handle_exception(op, ex): + if ex.code() == grpc.StatusCode.INVALID_ARGUMENT: + self.config.logger.error("{op} failed with {ex}; aborting".format(op=op, ex=repr(str(ex)))) + return ex + if self.config.fail_on_error: + self.config.logger.error("{op} failed with {ex}; aborting".format(op=op, ex=repr(str(ex)))) + return ex + + if last_success[1]: + last_success[1] = False + last_success[0] = time.time() + + if self.config.timeout > 0: + elapsed_time = time.time() - last_success[0] + timeout_left = self.config.timeout - elapsed_time + if timeout_left <= 0: + self.config.logger.error( + "{op} failed with {ex}; aborting due to timeout (last success {time: .2f} seconds ago)".format( + op=op, ex=repr(str(ex)), time=elapsed_time)) + return X509ClientError("timeout exceeded") + if backoff[0] > timeout_left: + backoff[0] = timeout_left + + self.config.logger.error(msg="{op} failed with {ex}; retrying in {time:.2f} seconds" + .format(op=op, ex=repr(str(ex)), time=backoff[0])) + time.sleep(backoff[0]) + + backoff[0] = backoff[0] * 1.5 + if backoff[0] > self.config.backoff_cap: + backoff[0] = self.config.backoff_cap + return None + + channel = grpc.insecure_channel(self.config.addr, options=self.grpc_options) + stub = workload.SpiffeWorkloadAPIStub(channel) + self._stream = stub.FetchX509SVID(workload.X509SVIDRequest(), metadata=metadata) + while True: + try: + update = self._stream.next() + while True: + try: + if not out.empty(): + out.get_nowait() + out.put_nowait(update) + break + except queue.Full or queue.Empty: + pass + self._current_svid = update + last_success[0] = time.time() + last_success[1] = True + backoff = [self.config.__backoff_min__] + except Exception as e: + # return successfully if the exception is triggered by stop signal + if not stop.empty(): + exit_error.put(None) + return + # return exception if critical + ee = handle_exception("FetchX509SVID", e) + if ee is not None: + exit_error.put(ee) + return + # if grpc status code is 'UNAVAILABLE', recreate the grpc channel and stub + if hasattr(e, 'code') and callable(e.code): + if e.code() is grpc.StatusCode.UNAVAILABLE: + channel.close() + channel = grpc.insecure_channel(self.config.addr, options=self.grpc_options) + stub = workload.SpiffeWorkloadAPIStub(channel) + self._stream = stub.FetchX509SVID(workload.X509SVIDRequest(), metadata=metadata) + diff --git a/miniconda3/envs/active_proaction/lib/python3.10/sqlite3/__init__.py b/miniconda3/envs/active_proaction/lib/python3.10/sqlite3/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..5a2dbd360fb49f5189206f811d36543e5782ee16 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/sqlite3/__init__.py @@ -0,0 +1,71 @@ +# pysqlite2/__init__.py: the pysqlite2 package. +# +# Copyright (C) 2005 Gerhard Häring +# +# This file is part of pysqlite. +# +# 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. + +""" +The sqlite3 extension module provides a DB-API 2.0 (PEP 249) compliant +interface to the SQLite library, and requires SQLite 3.7.15 or newer. + +To use the module, start by creating a database Connection object: + + import sqlite3 + cx = sqlite3.connect("test.db") # test.db will be created or opened + +The special path name ":memory:" can be provided to connect to a transient +in-memory database: + + cx = sqlite3.connect(":memory:") # connect to a database in RAM + +Once a connection has been established, create a Cursor object and call +its execute() method to perform SQL queries: + + cu = cx.cursor() + + # create a table + cu.execute("create table lang(name, first_appeared)") + + # insert values into a table + cu.execute("insert into lang values (?, ?)", ("C", 1972)) + + # execute a query and iterate over the result + for row in cu.execute("select * from lang"): + print(row) + + cx.close() + +The sqlite3 module is written by Gerhard Häring . +""" + +from sqlite3.dbapi2 import * + + +# bpo-42264: OptimizedUnicode was deprecated in Python 3.10. It's scheduled +# for removal in Python 3.12. +def __getattr__(name): + if name == "OptimizedUnicode": + import warnings + msg = (""" + OptimizedUnicode is deprecated and will be removed in Python 3.12. + Since Python 3.3 it has simply been an alias for 'str'. + """) + warnings.warn(msg, DeprecationWarning, stacklevel=2) + return str + raise AttributeError(f"module 'sqlite3' has no attribute '{name}'") diff --git a/miniconda3/envs/active_proaction/lib/python3.10/sqlite3/dbapi2.py b/miniconda3/envs/active_proaction/lib/python3.10/sqlite3/dbapi2.py new file mode 100644 index 0000000000000000000000000000000000000000..cfe6225f46efc0ab6a82474de33499bfc909610e --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/sqlite3/dbapi2.py @@ -0,0 +1,103 @@ +# pysqlite2/dbapi2.py: the DB-API 2.0 interface +# +# Copyright (C) 2004-2005 Gerhard Häring +# +# This file is part of pysqlite. +# +# 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. + +import datetime +import time +import collections.abc + +from _sqlite3 import * + +paramstyle = "qmark" + +threadsafety = 1 + +apilevel = "2.0" + +Date = datetime.date + +Time = datetime.time + +Timestamp = datetime.datetime + +def DateFromTicks(ticks): + return Date(*time.localtime(ticks)[:3]) + +def TimeFromTicks(ticks): + return Time(*time.localtime(ticks)[3:6]) + +def TimestampFromTicks(ticks): + return Timestamp(*time.localtime(ticks)[:6]) + +version_info = tuple([int(x) for x in version.split(".")]) +sqlite_version_info = tuple([int(x) for x in sqlite_version.split(".")]) + +Binary = memoryview +collections.abc.Sequence.register(Row) + +def register_adapters_and_converters(): + def adapt_date(val): + return val.isoformat() + + def adapt_datetime(val): + return val.isoformat(" ") + + def convert_date(val): + return datetime.date(*map(int, val.split(b"-"))) + + def convert_timestamp(val): + datepart, timepart = val.split(b" ") + year, month, day = map(int, datepart.split(b"-")) + timepart_full = timepart.split(b".") + hours, minutes, seconds = map(int, timepart_full[0].split(b":")) + if len(timepart_full) == 2: + microseconds = int('{:0<6.6}'.format(timepart_full[1].decode())) + else: + microseconds = 0 + + val = datetime.datetime(year, month, day, hours, minutes, seconds, microseconds) + return val + + + register_adapter(datetime.date, adapt_date) + register_adapter(datetime.datetime, adapt_datetime) + register_converter("date", convert_date) + register_converter("timestamp", convert_timestamp) + +register_adapters_and_converters() + +# bpo-24464: enable_shared_cache was deprecated in Python 3.10. It's +# scheduled for removal in Python 3.12. +def enable_shared_cache(enable): + from _sqlite3 import enable_shared_cache as _old_enable_shared_cache + import warnings + msg = ( + "enable_shared_cache is deprecated and will be removed in Python 3.12. " + "Shared cache is strongly discouraged by the SQLite 3 documentation. " + "If shared cache must be used, open the database in URI mode using" + "the cache=shared query parameter." + ) + warnings.warn(msg, DeprecationWarning, stacklevel=2) + return _old_enable_shared_cache(enable) + +# Clean up namespace + +del(register_adapters_and_converters) diff --git a/miniconda3/envs/active_proaction/lib/python3.10/sqlite3/dump.py b/miniconda3/envs/active_proaction/lib/python3.10/sqlite3/dump.py new file mode 100644 index 0000000000000000000000000000000000000000..07b9da10b920f937ea2edcdfe2d6ea3d5a23c150 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/sqlite3/dump.py @@ -0,0 +1,82 @@ +# Mimic the sqlite3 console shell's .dump command +# Author: Paul Kippes + +# Every identifier in sql is quoted based on a comment in sqlite +# documentation "SQLite adds new keywords from time to time when it +# takes on new features. So to prevent your code from being broken by +# future enhancements, you should normally quote any identifier that +# is an English language word, even if you do not have to." + +def _iterdump(connection): + """ + Returns an iterator to the dump of the database in an SQL text format. + + Used to produce an SQL dump of the database. Useful to save an in-memory + database for later restoration. This function should not be called + directly but instead called from the Connection method, iterdump(). + """ + + cu = connection.cursor() + yield('BEGIN TRANSACTION;') + + # sqlite_master table contains the SQL CREATE statements for the database. + q = """ + SELECT "name", "type", "sql" + FROM "sqlite_master" + WHERE "sql" NOT NULL AND + "type" == 'table' + ORDER BY "name" + """ + schema_res = cu.execute(q) + sqlite_sequence = [] + for table_name, type, sql in schema_res.fetchall(): + if table_name == 'sqlite_sequence': + rows = cu.execute('SELECT * FROM "sqlite_sequence";').fetchall() + sqlite_sequence = ['DELETE FROM "sqlite_sequence"'] + sqlite_sequence += [ + f'INSERT INTO "sqlite_sequence" VALUES(\'{row[0]}\',{row[1]})' + for row in rows + ] + continue + elif table_name == 'sqlite_stat1': + yield('ANALYZE "sqlite_master";') + elif table_name.startswith('sqlite_'): + continue + # NOTE: Virtual table support not implemented + #elif sql.startswith('CREATE VIRTUAL TABLE'): + # qtable = table_name.replace("'", "''") + # yield("INSERT INTO sqlite_master(type,name,tbl_name,rootpage,sql)"\ + # "VALUES('table','{0}','{0}',0,'{1}');".format( + # qtable, + # sql.replace("''"))) + else: + yield('{0};'.format(sql)) + + # Build the insert statement for each row of the current table + table_name_ident = table_name.replace('"', '""') + res = cu.execute('PRAGMA table_info("{0}")'.format(table_name_ident)) + column_names = [str(table_info[1]) for table_info in res.fetchall()] + q = """SELECT 'INSERT INTO "{0}" VALUES({1})' FROM "{0}";""".format( + table_name_ident, + ",".join("""'||quote("{0}")||'""".format(col.replace('"', '""')) for col in column_names)) + query_res = cu.execute(q) + for row in query_res: + yield("{0};".format(row[0])) + + # Now when the type is 'index', 'trigger', or 'view' + q = """ + SELECT "name", "type", "sql" + FROM "sqlite_master" + WHERE "sql" NOT NULL AND + "type" IN ('index', 'trigger', 'view') + """ + schema_res = cu.execute(q) + for name, type, sql in schema_res.fetchall(): + yield('{0};'.format(sql)) + + # gh-79009: Yield statements concerning the sqlite_sequence table at the + # end of the transaction. + for row in sqlite_sequence: + yield('{0};'.format(row)) + + yield('COMMIT;') diff --git a/miniconda3/envs/active_proaction/lib/python3.10/test/__init__.py b/miniconda3/envs/active_proaction/lib/python3.10/test/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..b93054b3ecf3a5af96f4772e7208e7a18b5dd4a4 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/test/__init__.py @@ -0,0 +1 @@ +# Dummy file to make this directory a package. diff --git a/miniconda3/envs/active_proaction/lib/python3.10/test/support/__init__.py b/miniconda3/envs/active_proaction/lib/python3.10/test/support/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..d0492fe1914343f1d9c4d7b7a505cc8293a0dc9b --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/test/support/__init__.py @@ -0,0 +1,2166 @@ +"""Supporting definitions for the Python regression tests.""" + +if __name__ != 'test.support': + raise ImportError('support must be imported from the test package') + +import contextlib +import functools +import os +import re +import stat +import sys +import sysconfig +import time +import types +import unittest +import warnings + +from .testresult import get_test_runner + + +try: + from _testcapi import unicode_legacy_string +except ImportError: + unicode_legacy_string = None + +__all__ = [ + # globals + "PIPE_MAX_SIZE", "verbose", "max_memuse", "use_resources", "failfast", + # exceptions + "Error", "TestFailed", "TestDidNotRun", "ResourceDenied", + # io + "record_original_stdout", "get_original_stdout", "captured_stdout", + "captured_stdin", "captured_stderr", + # unittest + "is_resource_enabled", "requires", "requires_freebsd_version", + "requires_linux_version", "requires_mac_ver", + "check_syntax_error", + "BasicTestRunner", "run_unittest", "run_doctest", + "requires_gzip", "requires_bz2", "requires_lzma", + "bigmemtest", "bigaddrspacetest", "cpython_only", "get_attribute", + "requires_IEEE_754", "requires_zlib", + "anticipate_failure", "load_package_tests", "detect_api_mismatch", + "check__all__", "skip_if_buggy_ucrt_strfptime", + "check_disallow_instantiation", "check_sanitizer", "skip_if_sanitizer", + # sys + "is_jython", "is_android", "check_impl_detail", "unix_shell", + "setswitchinterval", + # network + "open_urlresource", + # processes + "reap_children", + # miscellaneous + "run_with_locale", "swap_item", "findfile", + "swap_attr", "Matcher", "set_memlimit", "SuppressCrashReport", "sortdict", + "run_with_tz", "PGO", "missing_compiler_executable", + "ALWAYS_EQ", "NEVER_EQ", "LARGEST", "SMALLEST", + "LOOPBACK_TIMEOUT", "INTERNET_TIMEOUT", "SHORT_TIMEOUT", "LONG_TIMEOUT", + ] + + +# Timeout in seconds for tests using a network server listening on the network +# local loopback interface like 127.0.0.1. +# +# The timeout is long enough to prevent test failure: it takes into account +# that the client and the server can run in different threads or even different +# processes. +# +# The timeout should be long enough for connect(), recv() and send() methods +# of socket.socket. +LOOPBACK_TIMEOUT = 5.0 +if sys.platform == 'win32' and ' 32 bit (ARM)' in sys.version: + # bpo-37553: test_socket.SendfileUsingSendTest is taking longer than 2 + # seconds on Windows ARM32 buildbot + LOOPBACK_TIMEOUT = 10 +elif sys.platform == 'vxworks': + LOOPBACK_TIMEOUT = 10 + +# Timeout in seconds for network requests going to the internet. The timeout is +# short enough to prevent a test to wait for too long if the internet request +# is blocked for whatever reason. +# +# Usually, a timeout using INTERNET_TIMEOUT should not mark a test as failed, +# but skip the test instead: see transient_internet(). +INTERNET_TIMEOUT = 60.0 + +# Timeout in seconds to mark a test as failed if the test takes "too long". +# +# The timeout value depends on the regrtest --timeout command line option. +# +# If a test using SHORT_TIMEOUT starts to fail randomly on slow buildbots, use +# LONG_TIMEOUT instead. +SHORT_TIMEOUT = 30.0 + +# Timeout in seconds to detect when a test hangs. +# +# It is long enough to reduce the risk of test failure on the slowest Python +# buildbots. It should not be used to mark a test as failed if the test takes +# "too long". The timeout value depends on the regrtest --timeout command line +# option. +LONG_TIMEOUT = 5 * 60.0 + + +class Error(Exception): + """Base class for regression test exceptions.""" + +class TestFailed(Error): + """Test failed.""" + +class TestFailedWithDetails(TestFailed): + """Test failed.""" + def __init__(self, msg, errors, failures): + self.msg = msg + self.errors = errors + self.failures = failures + super().__init__(msg, errors, failures) + + def __str__(self): + return self.msg + +class TestDidNotRun(Error): + """Test did not run any subtests.""" + +class ResourceDenied(unittest.SkipTest): + """Test skipped because it requested a disallowed resource. + + This is raised when a test calls requires() for a resource that + has not be enabled. It is used to distinguish between expected + and unexpected skips. + """ + +def anticipate_failure(condition): + """Decorator to mark a test that is known to be broken in some cases + + Any use of this decorator should have a comment identifying the + associated tracker issue. + """ + if condition: + return unittest.expectedFailure + return lambda f: f + +def load_package_tests(pkg_dir, loader, standard_tests, pattern): + """Generic load_tests implementation for simple test packages. + + Most packages can implement load_tests using this function as follows: + + def load_tests(*args): + return load_package_tests(os.path.dirname(__file__), *args) + """ + if pattern is None: + pattern = "test*" + top_dir = os.path.dirname( # Lib + os.path.dirname( # test + os.path.dirname(__file__))) # support + package_tests = loader.discover(start_dir=pkg_dir, + top_level_dir=top_dir, + pattern=pattern) + standard_tests.addTests(package_tests) + return standard_tests + + +def get_attribute(obj, name): + """Get an attribute, raising SkipTest if AttributeError is raised.""" + try: + attribute = getattr(obj, name) + except AttributeError: + raise unittest.SkipTest("object %r has no attribute %r" % (obj, name)) + else: + return attribute + +verbose = 1 # Flag set to 0 by regrtest.py +use_resources = None # Flag set to [] by regrtest.py +max_memuse = 0 # Disable bigmem tests (they will still be run with + # small sizes, to make sure they work.) +real_max_memuse = 0 +junit_xml_list = None # list of testsuite XML elements +failfast = False + +# _original_stdout is meant to hold stdout at the time regrtest began. +# This may be "the real" stdout, or IDLE's emulation of stdout, or whatever. +# The point is to have some flavor of stdout the user can actually see. +_original_stdout = None +def record_original_stdout(stdout): + global _original_stdout + _original_stdout = stdout + +def get_original_stdout(): + return _original_stdout or sys.stdout + + +def _force_run(path, func, *args): + try: + return func(*args) + except OSError as err: + if verbose >= 2: + print('%s: %s' % (err.__class__.__name__, err)) + print('re-run %s%r' % (func.__name__, args)) + os.chmod(path, stat.S_IRWXU) + return func(*args) + + +# Check whether a gui is actually available +def _is_gui_available(): + if hasattr(_is_gui_available, 'result'): + return _is_gui_available.result + import platform + reason = None + if sys.platform.startswith('win') and platform.win32_is_iot(): + reason = "gui is not available on Windows IoT Core" + elif sys.platform.startswith('win'): + # if Python is running as a service (such as the buildbot service), + # gui interaction may be disallowed + import ctypes + import ctypes.wintypes + UOI_FLAGS = 1 + WSF_VISIBLE = 0x0001 + class USEROBJECTFLAGS(ctypes.Structure): + _fields_ = [("fInherit", ctypes.wintypes.BOOL), + ("fReserved", ctypes.wintypes.BOOL), + ("dwFlags", ctypes.wintypes.DWORD)] + dll = ctypes.windll.user32 + h = dll.GetProcessWindowStation() + if not h: + raise ctypes.WinError() + uof = USEROBJECTFLAGS() + needed = ctypes.wintypes.DWORD() + res = dll.GetUserObjectInformationW(h, + UOI_FLAGS, + ctypes.byref(uof), + ctypes.sizeof(uof), + ctypes.byref(needed)) + if not res: + raise ctypes.WinError() + if not bool(uof.dwFlags & WSF_VISIBLE): + reason = "gui not available (WSF_VISIBLE flag not set)" + elif sys.platform == 'darwin': + # The Aqua Tk implementations on OS X can abort the process if + # being called in an environment where a window server connection + # cannot be made, for instance when invoked by a buildbot or ssh + # process not running under the same user id as the current console + # user. To avoid that, raise an exception if the window manager + # connection is not available. + from ctypes import cdll, c_int, pointer, Structure + from ctypes.util import find_library + + app_services = cdll.LoadLibrary(find_library("ApplicationServices")) + + if app_services.CGMainDisplayID() == 0: + reason = "gui tests cannot run without OS X window manager" + else: + class ProcessSerialNumber(Structure): + _fields_ = [("highLongOfPSN", c_int), + ("lowLongOfPSN", c_int)] + psn = ProcessSerialNumber() + psn_p = pointer(psn) + if ( (app_services.GetCurrentProcess(psn_p) < 0) or + (app_services.SetFrontProcess(psn_p) < 0) ): + reason = "cannot run without OS X gui process" + + # check on every platform whether tkinter can actually do anything + if not reason: + try: + from tkinter import Tk + root = Tk() + root.withdraw() + root.update() + root.destroy() + except Exception as e: + err_string = str(e) + if len(err_string) > 50: + err_string = err_string[:50] + ' [...]' + reason = 'Tk unavailable due to {}: {}'.format(type(e).__name__, + err_string) + + _is_gui_available.reason = reason + _is_gui_available.result = not reason + + return _is_gui_available.result + +def is_resource_enabled(resource): + """Test whether a resource is enabled. + + Known resources are set by regrtest.py. If not running under regrtest.py, + all resources are assumed enabled unless use_resources has been set. + """ + return use_resources is None or resource in use_resources + +def requires(resource, msg=None): + """Raise ResourceDenied if the specified resource is not available.""" + if not is_resource_enabled(resource): + if msg is None: + msg = "Use of the %r resource not enabled" % resource + raise ResourceDenied(msg) + if resource == 'gui' and not _is_gui_available(): + raise ResourceDenied(_is_gui_available.reason) + +def _get_kernel_version(sysname="Linux"): + import platform + if platform.system() != sysname: + return None + version_txt = platform.release().split('-', 1)[0] + try: + return tuple(map(int, version_txt.split('.'))) + except ValueError: + return None + +def _requires_unix_version(sysname, min_version): + """Decorator raising SkipTest if the OS is `sysname` and the version is less + than `min_version`. + + For example, @_requires_unix_version('FreeBSD', (7, 2)) raises SkipTest if + the FreeBSD version is less than 7.2. + """ + import platform + min_version_txt = '.'.join(map(str, min_version)) + version_txt = platform.release().split('-', 1)[0] + if platform.system() == sysname: + try: + version = tuple(map(int, version_txt.split('.'))) + except ValueError: + skip = False + else: + skip = version < min_version + else: + skip = False + + return unittest.skipIf( + skip, + f"{sysname} version {min_version_txt} or higher required, not " + f"{version_txt}" + ) + + +def requires_freebsd_version(*min_version): + """Decorator raising SkipTest if the OS is FreeBSD and the FreeBSD version is + less than `min_version`. + + For example, @requires_freebsd_version(7, 2) raises SkipTest if the FreeBSD + version is less than 7.2. + """ + return _requires_unix_version('FreeBSD', min_version) + +def requires_linux_version(*min_version): + """Decorator raising SkipTest if the OS is Linux and the Linux version is + less than `min_version`. + + For example, @requires_linux_version(2, 6, 32) raises SkipTest if the Linux + version is less than 2.6.32. + """ + return _requires_unix_version('Linux', min_version) + +def requires_mac_ver(*min_version): + """Decorator raising SkipTest if the OS is Mac OS X and the OS X + version if less than min_version. + + For example, @requires_mac_ver(10, 5) raises SkipTest if the OS X version + is lesser than 10.5. + """ + def decorator(func): + @functools.wraps(func) + def wrapper(*args, **kw): + if sys.platform == 'darwin': + import platform + version_txt = platform.mac_ver()[0] + try: + version = tuple(map(int, version_txt.split('.'))) + except ValueError: + pass + else: + if version < min_version: + min_version_txt = '.'.join(map(str, min_version)) + raise unittest.SkipTest( + "Mac OS X %s or higher required, not %s" + % (min_version_txt, version_txt)) + return func(*args, **kw) + wrapper.min_version = min_version + return wrapper + return decorator + + +def check_sanitizer(*, address=False, memory=False, ub=False): + """Returns True if Python is compiled with sanitizer support""" + if not (address or memory or ub): + raise ValueError('At least one of address, memory, or ub must be True') + + + _cflags = sysconfig.get_config_var('CFLAGS') or '' + _config_args = sysconfig.get_config_var('CONFIG_ARGS') or '' + memory_sanitizer = ( + '-fsanitize=memory' in _cflags or + '--with-memory-sanitizer' in _config_args + ) + address_sanitizer = ( + '-fsanitize=address' in _cflags or + '--with-memory-sanitizer' in _config_args + ) + ub_sanitizer = ( + '-fsanitize=undefined' in _cflags or + '--with-undefined-behavior-sanitizer' in _config_args + ) + return ( + (memory and memory_sanitizer) or + (address and address_sanitizer) or + (ub and ub_sanitizer) + ) + + +def skip_if_sanitizer(reason=None, *, address=False, memory=False, ub=False): + """Decorator raising SkipTest if running with a sanitizer active.""" + if not reason: + reason = 'not working with sanitizers active' + skip = check_sanitizer(address=address, memory=memory, ub=ub) + return unittest.skipIf(skip, reason) + + +def system_must_validate_cert(f): + """Skip the test on TLS certificate validation failures.""" + @functools.wraps(f) + def dec(*args, **kwargs): + try: + f(*args, **kwargs) + except OSError as e: + if "CERTIFICATE_VERIFY_FAILED" in str(e): + raise unittest.SkipTest("system does not contain " + "necessary certificates") + raise + return dec + +# A constant likely larger than the underlying OS pipe buffer size, to +# make writes blocking. +# Windows limit seems to be around 512 B, and many Unix kernels have a +# 64 KiB pipe buffer size or 16 * PAGE_SIZE: take a few megs to be sure. +# (see issue #17835 for a discussion of this number). +PIPE_MAX_SIZE = 4 * 1024 * 1024 + 1 + +# A constant likely larger than the underlying OS socket buffer size, to make +# writes blocking. +# The socket buffer sizes can usually be tuned system-wide (e.g. through sysctl +# on Linux), or on a per-socket basis (SO_SNDBUF/SO_RCVBUF). See issue #18643 +# for a discussion of this number. +SOCK_MAX_SIZE = 16 * 1024 * 1024 + 1 + +# decorator for skipping tests on non-IEEE 754 platforms +requires_IEEE_754 = unittest.skipUnless( + float.__getformat__("double").startswith("IEEE"), + "test requires IEEE 754 doubles") + +def requires_zlib(reason='requires zlib'): + try: + import zlib + except ImportError: + zlib = None + return unittest.skipUnless(zlib, reason) + +def requires_gzip(reason='requires gzip'): + try: + import gzip + except ImportError: + gzip = None + return unittest.skipUnless(gzip, reason) + +def requires_bz2(reason='requires bz2'): + try: + import bz2 + except ImportError: + bz2 = None + return unittest.skipUnless(bz2, reason) + +def requires_lzma(reason='requires lzma'): + try: + import lzma + except ImportError: + lzma = None + return unittest.skipUnless(lzma, reason) + +requires_legacy_unicode_capi = unittest.skipUnless(unicode_legacy_string, + 'requires legacy Unicode C API') + +is_jython = sys.platform.startswith('java') + +is_android = hasattr(sys, 'getandroidapilevel') + +if sys.platform not in ('win32', 'vxworks'): + unix_shell = '/system/bin/sh' if is_android else '/bin/sh' +else: + unix_shell = None + +# Define the URL of a dedicated HTTP server for the network tests. +# The URL must use clear-text HTTP: no redirection to encrypted HTTPS. +TEST_HTTP_URL = "http://www.pythontest.net" + +# Set by libregrtest/main.py so we can skip tests that are not +# useful for PGO +PGO = False + +# Set by libregrtest/main.py if we are running the extended (time consuming) +# PGO task. If this is True, PGO is also True. +PGO_EXTENDED = False + +# TEST_HOME_DIR refers to the top level directory of the "test" package +# that contains Python's regression test suite +TEST_SUPPORT_DIR = os.path.dirname(os.path.abspath(__file__)) +TEST_HOME_DIR = os.path.dirname(TEST_SUPPORT_DIR) + +# TEST_DATA_DIR is used as a target download location for remote resources +TEST_DATA_DIR = os.path.join(TEST_HOME_DIR, "data") + + +def darwin_malloc_err_warning(test_name): + """Assure user that loud errors generated by macOS libc's malloc are + expected.""" + if sys.platform != 'darwin': + return + + import shutil + msg = ' NOTICE ' + detail = (f'{test_name} may generate "malloc can\'t allocate region"\n' + 'warnings on macOS systems. This behavior is known. Do not\n' + 'report a bug unless tests are also failing. See bpo-40928.') + + padding, _ = shutil.get_terminal_size() + print(msg.center(padding, '-')) + print(detail) + print('-' * padding) + + +def findfile(filename, subdir=None): + """Try to find a file on sys.path or in the test directory. If it is not + found the argument passed to the function is returned (this does not + necessarily signal failure; could still be the legitimate path). + + Setting *subdir* indicates a relative path to use to find the file + rather than looking directly in the path directories. + """ + if os.path.isabs(filename): + return filename + if subdir is not None: + filename = os.path.join(subdir, filename) + path = [TEST_HOME_DIR] + sys.path + for dn in path: + fn = os.path.join(dn, filename) + if os.path.exists(fn): return fn + return filename + + +def sortdict(dict): + "Like repr(dict), but in sorted order." + items = sorted(dict.items()) + reprpairs = ["%r: %r" % pair for pair in items] + withcommas = ", ".join(reprpairs) + return "{%s}" % withcommas + +def check_syntax_error(testcase, statement, errtext='', *, lineno=None, offset=None): + with testcase.assertRaisesRegex(SyntaxError, errtext) as cm: + compile(statement, '', 'exec') + err = cm.exception + testcase.assertIsNotNone(err.lineno) + if lineno is not None: + testcase.assertEqual(err.lineno, lineno) + testcase.assertIsNotNone(err.offset) + if offset is not None: + testcase.assertEqual(err.offset, offset) + + +def open_urlresource(url, *args, **kw): + import urllib.request, urllib.parse + from .os_helper import unlink + try: + import gzip + except ImportError: + gzip = None + + check = kw.pop('check', None) + + filename = urllib.parse.urlparse(url)[2].split('/')[-1] # '/': it's URL! + + fn = os.path.join(TEST_DATA_DIR, filename) + + def check_valid_file(fn): + f = open(fn, *args, **kw) + if check is None: + return f + elif check(f): + f.seek(0) + return f + f.close() + + if os.path.exists(fn): + f = check_valid_file(fn) + if f is not None: + return f + unlink(fn) + + # Verify the requirement before downloading the file + requires('urlfetch') + + if verbose: + print('\tfetching %s ...' % url, file=get_original_stdout()) + opener = urllib.request.build_opener() + if gzip: + opener.addheaders.append(('Accept-Encoding', 'gzip')) + f = opener.open(url, timeout=INTERNET_TIMEOUT) + if gzip and f.headers.get('Content-Encoding') == 'gzip': + f = gzip.GzipFile(fileobj=f) + try: + with open(fn, "wb") as out: + s = f.read() + while s: + out.write(s) + s = f.read() + finally: + f.close() + + f = check_valid_file(fn) + if f is not None: + return f + raise TestFailed('invalid resource %r' % fn) + + +@contextlib.contextmanager +def captured_output(stream_name): + """Return a context manager used by captured_stdout/stdin/stderr + that temporarily replaces the sys stream *stream_name* with a StringIO.""" + import io + orig_stdout = getattr(sys, stream_name) + setattr(sys, stream_name, io.StringIO()) + try: + yield getattr(sys, stream_name) + finally: + setattr(sys, stream_name, orig_stdout) + +def captured_stdout(): + """Capture the output of sys.stdout: + + with captured_stdout() as stdout: + print("hello") + self.assertEqual(stdout.getvalue(), "hello\\n") + """ + return captured_output("stdout") + +def captured_stderr(): + """Capture the output of sys.stderr: + + with captured_stderr() as stderr: + print("hello", file=sys.stderr) + self.assertEqual(stderr.getvalue(), "hello\\n") + """ + return captured_output("stderr") + +def captured_stdin(): + """Capture the input to sys.stdin: + + with captured_stdin() as stdin: + stdin.write('hello\\n') + stdin.seek(0) + # call test code that consumes from sys.stdin + captured = input() + self.assertEqual(captured, "hello") + """ + return captured_output("stdin") + + +def gc_collect(): + """Force as many objects as possible to be collected. + + In non-CPython implementations of Python, this is needed because timely + deallocation is not guaranteed by the garbage collector. (Even in CPython + this can be the case in case of reference cycles.) This means that __del__ + methods may be called later than expected and weakrefs may remain alive for + longer than expected. This function tries its best to force all garbage + objects to disappear. + """ + import gc + gc.collect() + if is_jython: + time.sleep(0.1) + gc.collect() + gc.collect() + +@contextlib.contextmanager +def disable_gc(): + import gc + have_gc = gc.isenabled() + gc.disable() + try: + yield + finally: + if have_gc: + gc.enable() + + +def python_is_optimized(): + """Find if Python was built with optimizations.""" + cflags = sysconfig.get_config_var('PY_CFLAGS') or '' + final_opt = "" + for opt in cflags.split(): + if opt.startswith('-O'): + final_opt = opt + return final_opt not in ('', '-O0', '-Og') + + +_header = 'nP' +_align = '0n' +if hasattr(sys, "getobjects"): + _header = '2P' + _header + _align = '0P' +_vheader = _header + 'n' + +def calcobjsize(fmt): + import struct + return struct.calcsize(_header + fmt + _align) + +def calcvobjsize(fmt): + import struct + return struct.calcsize(_vheader + fmt + _align) + + +_TPFLAGS_HAVE_GC = 1<<14 +_TPFLAGS_HEAPTYPE = 1<<9 + +def check_sizeof(test, o, size): + import _testinternalcapi + result = sys.getsizeof(o) + # add GC header size + if ((type(o) == type) and (o.__flags__ & _TPFLAGS_HEAPTYPE) or\ + ((type(o) != type) and (type(o).__flags__ & _TPFLAGS_HAVE_GC))): + size += _testinternalcapi.SIZEOF_PYGC_HEAD + msg = 'wrong size for %s: got %d, expected %d' \ + % (type(o), result, size) + test.assertEqual(result, size, msg) + +def subTests(arg_names, arg_values, /, *, _do_cleanups=False): + """Run multiple subtests with different parameters. + """ + single_param = False + if isinstance(arg_names, str): + arg_names = arg_names.replace(',',' ').split() + if len(arg_names) == 1: + single_param = True + arg_values = tuple(arg_values) + def decorator(func): + if isinstance(func, type): + raise TypeError('subTests() can only decorate methods, not classes') + @functools.wraps(func) + def wrapper(self, /, *args, **kwargs): + for values in arg_values: + if single_param: + values = (values,) + subtest_kwargs = dict(zip(arg_names, values)) + with self.subTest(**subtest_kwargs): + func(self, *args, **kwargs, **subtest_kwargs) + if _do_cleanups: + self.doCleanups() + return wrapper + return decorator + +#======================================================================= +# Decorator for running a function in a different locale, correctly resetting +# it afterwards. + +@contextlib.contextmanager +def run_with_locale(catstr, *locales): + try: + import locale + category = getattr(locale, catstr) + orig_locale = locale.setlocale(category) + except AttributeError: + # if the test author gives us an invalid category string + raise + except: + # cannot retrieve original locale, so do nothing + locale = orig_locale = None + else: + for loc in locales: + try: + locale.setlocale(category, loc) + break + except: + pass + + try: + yield + finally: + if locale and orig_locale: + locale.setlocale(category, orig_locale) + +#======================================================================= +# Decorator for running a function in a specific timezone, correctly +# resetting it afterwards. + +def run_with_tz(tz): + def decorator(func): + def inner(*args, **kwds): + try: + tzset = time.tzset + except AttributeError: + raise unittest.SkipTest("tzset required") + if 'TZ' in os.environ: + orig_tz = os.environ['TZ'] + else: + orig_tz = None + os.environ['TZ'] = tz + tzset() + + # now run the function, resetting the tz on exceptions + try: + return func(*args, **kwds) + finally: + if orig_tz is None: + del os.environ['TZ'] + else: + os.environ['TZ'] = orig_tz + time.tzset() + + inner.__name__ = func.__name__ + inner.__doc__ = func.__doc__ + return inner + return decorator + +#======================================================================= +# Big-memory-test support. Separate from 'resources' because memory use +# should be configurable. + +# Some handy shorthands. Note that these are used for byte-limits as well +# as size-limits, in the various bigmem tests +_1M = 1024*1024 +_1G = 1024 * _1M +_2G = 2 * _1G +_4G = 4 * _1G + +MAX_Py_ssize_t = sys.maxsize + +def set_memlimit(limit): + global max_memuse + global real_max_memuse + sizes = { + 'k': 1024, + 'm': _1M, + 'g': _1G, + 't': 1024*_1G, + } + m = re.match(r'(\d+(\.\d+)?) (K|M|G|T)b?$', limit, + re.IGNORECASE | re.VERBOSE) + if m is None: + raise ValueError('Invalid memory limit %r' % (limit,)) + memlimit = int(float(m.group(1)) * sizes[m.group(3).lower()]) + real_max_memuse = memlimit + if memlimit > MAX_Py_ssize_t: + memlimit = MAX_Py_ssize_t + if memlimit < _2G - 1: + raise ValueError('Memory limit %r too low to be useful' % (limit,)) + max_memuse = memlimit + +class _MemoryWatchdog: + """An object which periodically watches the process' memory consumption + and prints it out. + """ + + def __init__(self): + self.procfile = '/proc/{pid}/statm'.format(pid=os.getpid()) + self.started = False + + def start(self): + import warnings + try: + f = open(self.procfile, 'r') + except OSError as e: + warnings.warn('/proc not available for stats: {}'.format(e), + RuntimeWarning) + sys.stderr.flush() + return + + import subprocess + with f: + watchdog_script = findfile("memory_watchdog.py") + self.mem_watchdog = subprocess.Popen([sys.executable, watchdog_script], + stdin=f, + stderr=subprocess.DEVNULL) + self.started = True + + def stop(self): + if self.started: + self.mem_watchdog.terminate() + self.mem_watchdog.wait() + + +def bigmemtest(size, memuse, dry_run=True): + """Decorator for bigmem tests. + + 'size' is a requested size for the test (in arbitrary, test-interpreted + units.) 'memuse' is the number of bytes per unit for the test, or a good + estimate of it. For example, a test that needs two byte buffers, of 4 GiB + each, could be decorated with @bigmemtest(size=_4G, memuse=2). + + The 'size' argument is normally passed to the decorated test method as an + extra argument. If 'dry_run' is true, the value passed to the test method + may be less than the requested value. If 'dry_run' is false, it means the + test doesn't support dummy runs when -M is not specified. + """ + def decorator(f): + def wrapper(self): + size = wrapper.size + memuse = wrapper.memuse + if not real_max_memuse: + maxsize = 5147 + else: + maxsize = size + + if ((real_max_memuse or not dry_run) + and real_max_memuse < maxsize * memuse): + raise unittest.SkipTest( + "not enough memory: %.1fG minimum needed" + % (size * memuse / (1024 ** 3))) + + if real_max_memuse and verbose: + print() + print(" ... expected peak memory use: {peak:.1f}G" + .format(peak=size * memuse / (1024 ** 3))) + watchdog = _MemoryWatchdog() + watchdog.start() + else: + watchdog = None + + try: + return f(self, maxsize) + finally: + if watchdog: + watchdog.stop() + + wrapper.size = size + wrapper.memuse = memuse + return wrapper + return decorator + +def bigaddrspacetest(f): + """Decorator for tests that fill the address space.""" + def wrapper(self): + if max_memuse < MAX_Py_ssize_t: + if MAX_Py_ssize_t >= 2**63 - 1 and max_memuse >= 2**31: + raise unittest.SkipTest( + "not enough memory: try a 32-bit build instead") + else: + raise unittest.SkipTest( + "not enough memory: %.1fG minimum needed" + % (MAX_Py_ssize_t / (1024 ** 3))) + else: + return f(self) + return wrapper + +#======================================================================= +# unittest integration. + +class BasicTestRunner: + def run(self, test): + result = unittest.TestResult() + test(result) + return result + +def _id(obj): + return obj + +def requires_resource(resource): + if resource == 'gui' and not _is_gui_available(): + return unittest.skip(_is_gui_available.reason) + if is_resource_enabled(resource): + return _id + else: + return unittest.skip("resource {0!r} is not enabled".format(resource)) + +def cpython_only(test): + """ + Decorator for tests only applicable on CPython. + """ + return impl_detail(cpython=True)(test) + +def impl_detail(msg=None, **guards): + if check_impl_detail(**guards): + return _id + if msg is None: + guardnames, default = _parse_guards(guards) + if default: + msg = "implementation detail not available on {0}" + else: + msg = "implementation detail specific to {0}" + guardnames = sorted(guardnames.keys()) + msg = msg.format(' or '.join(guardnames)) + return unittest.skip(msg) + +def _parse_guards(guards): + # Returns a tuple ({platform_name: run_me}, default_value) + if not guards: + return ({'cpython': True}, False) + is_true = list(guards.values())[0] + assert list(guards.values()) == [is_true] * len(guards) # all True or all False + return (guards, not is_true) + +# Use the following check to guard CPython's implementation-specific tests -- +# or to run them only on the implementation(s) guarded by the arguments. +def check_impl_detail(**guards): + """This function returns True or False depending on the host platform. + Examples: + if check_impl_detail(): # only on CPython (default) + if check_impl_detail(jython=True): # only on Jython + if check_impl_detail(cpython=False): # everywhere except on CPython + """ + guards, default = _parse_guards(guards) + return guards.get(sys.implementation.name, default) + + +def no_tracing(func): + """Decorator to temporarily turn off tracing for the duration of a test.""" + if not hasattr(sys, 'gettrace'): + return func + else: + @functools.wraps(func) + def wrapper(*args, **kwargs): + original_trace = sys.gettrace() + try: + sys.settrace(None) + return func(*args, **kwargs) + finally: + sys.settrace(original_trace) + return wrapper + + +def refcount_test(test): + """Decorator for tests which involve reference counting. + + To start, the decorator does not run the test if is not run by CPython. + After that, any trace function is unset during the test to prevent + unexpected refcounts caused by the trace function. + + """ + return no_tracing(cpython_only(test)) + + +def _filter_suite(suite, pred): + """Recursively filter test cases in a suite based on a predicate.""" + newtests = [] + for test in suite._tests: + if isinstance(test, unittest.TestSuite): + _filter_suite(test, pred) + newtests.append(test) + else: + if pred(test): + newtests.append(test) + suite._tests = newtests + +def _run_suite(suite): + """Run tests from a unittest.TestSuite-derived class.""" + runner = get_test_runner(sys.stdout, + verbosity=verbose, + capture_output=(junit_xml_list is not None)) + + result = runner.run(suite) + + if junit_xml_list is not None: + junit_xml_list.append(result.get_xml_element()) + + if not result.testsRun and not result.skipped: + raise TestDidNotRun + if not result.wasSuccessful(): + if len(result.errors) == 1 and not result.failures: + err = result.errors[0][1] + elif len(result.failures) == 1 and not result.errors: + err = result.failures[0][1] + else: + err = "multiple errors occurred" + if not verbose: err += "; run in verbose mode for details" + errors = [(str(tc), exc_str) for tc, exc_str in result.errors] + failures = [(str(tc), exc_str) for tc, exc_str in result.failures] + raise TestFailedWithDetails(err, errors, failures) + + +# By default, don't filter tests +_match_test_func = None + +_accept_test_patterns = None +_ignore_test_patterns = None + + +def match_test(test): + # Function used by support.run_unittest() and regrtest --list-cases + if _match_test_func is None: + return True + else: + return _match_test_func(test.id()) + + +def _is_full_match_test(pattern): + # If a pattern contains at least one dot, it's considered + # as a full test identifier. + # Example: 'test.test_os.FileTests.test_access'. + # + # ignore patterns which contain fnmatch patterns: '*', '?', '[...]' + # or '[!...]'. For example, ignore 'test_access*'. + return ('.' in pattern) and (not re.search(r'[?*\[\]]', pattern)) + + +def set_match_tests(accept_patterns=None, ignore_patterns=None): + global _match_test_func, _accept_test_patterns, _ignore_test_patterns + + + if accept_patterns is None: + accept_patterns = () + if ignore_patterns is None: + ignore_patterns = () + + accept_func = ignore_func = None + + if accept_patterns != _accept_test_patterns: + accept_patterns, accept_func = _compile_match_function(accept_patterns) + if ignore_patterns != _ignore_test_patterns: + ignore_patterns, ignore_func = _compile_match_function(ignore_patterns) + + # Create a copy since patterns can be mutable and so modified later + _accept_test_patterns = tuple(accept_patterns) + _ignore_test_patterns = tuple(ignore_patterns) + + if accept_func is not None or ignore_func is not None: + def match_function(test_id): + accept = True + ignore = False + if accept_func: + accept = accept_func(test_id) + if ignore_func: + ignore = ignore_func(test_id) + return accept and not ignore + + _match_test_func = match_function + + +def _compile_match_function(patterns): + if not patterns: + func = None + # set_match_tests(None) behaves as set_match_tests(()) + patterns = () + elif all(map(_is_full_match_test, patterns)): + # Simple case: all patterns are full test identifier. + # The test.bisect_cmd utility only uses such full test identifiers. + func = set(patterns).__contains__ + else: + import fnmatch + regex = '|'.join(map(fnmatch.translate, patterns)) + # The search *is* case sensitive on purpose: + # don't use flags=re.IGNORECASE + regex_match = re.compile(regex).match + + def match_test_regex(test_id): + if regex_match(test_id): + # The regex matches the whole identifier, for example + # 'test.test_os.FileTests.test_access'. + return True + else: + # Try to match parts of the test identifier. + # For example, split 'test.test_os.FileTests.test_access' + # into: 'test', 'test_os', 'FileTests' and 'test_access'. + return any(map(regex_match, test_id.split("."))) + + func = match_test_regex + + return patterns, func + + +def run_unittest(*classes): + """Run tests from unittest.TestCase-derived classes.""" + valid_types = (unittest.TestSuite, unittest.TestCase) + suite = unittest.TestSuite() + for cls in classes: + if isinstance(cls, str): + if cls in sys.modules: + suite.addTest(unittest.findTestCases(sys.modules[cls])) + else: + raise ValueError("str arguments must be keys in sys.modules") + elif isinstance(cls, valid_types): + suite.addTest(cls) + else: + suite.addTest(unittest.makeSuite(cls)) + _filter_suite(suite, match_test) + _run_suite(suite) + +#======================================================================= +# Check for the presence of docstrings. + +# Rather than trying to enumerate all the cases where docstrings may be +# disabled, we just check for that directly + +def _check_docstrings(): + """Just used to check if docstrings are enabled""" + +MISSING_C_DOCSTRINGS = (check_impl_detail() and + sys.platform != 'win32' and + not sysconfig.get_config_var('WITH_DOC_STRINGS')) + +HAVE_DOCSTRINGS = (_check_docstrings.__doc__ is not None and + not MISSING_C_DOCSTRINGS) + +requires_docstrings = unittest.skipUnless(HAVE_DOCSTRINGS, + "test requires docstrings") + + +#======================================================================= +# doctest driver. + +def run_doctest(module, verbosity=None, optionflags=0): + """Run doctest on the given module. Return (#failures, #tests). + + If optional argument verbosity is not specified (or is None), pass + support's belief about verbosity on to doctest. Else doctest's + usual behavior is used (it searches sys.argv for -v). + """ + + import doctest + + if verbosity is None: + verbosity = verbose + else: + verbosity = None + + f, t = doctest.testmod(module, verbose=verbosity, optionflags=optionflags) + if f: + raise TestFailed("%d of %d doctests failed" % (f, t)) + if verbose: + print('doctest (%s) ... %d tests with zero failures' % + (module.__name__, t)) + return f, t + + +#======================================================================= +# Support for saving and restoring the imported modules. + +def print_warning(msg): + # bpo-39983: Print into sys.__stderr__ to display the warning even + # when sys.stderr is captured temporarily by a test + for line in msg.splitlines(): + print(f"Warning -- {line}", file=sys.__stderr__, flush=True) + + +# Flag used by saved_test_environment of test.libregrtest.save_env, +# to check if a test modified the environment. The flag should be set to False +# before running a new test. +# +# For example, threading_helper.threading_cleanup() sets the flag is the function fails +# to cleanup threads. +environment_altered = False + +def reap_children(): + """Use this function at the end of test_main() whenever sub-processes + are started. This will help ensure that no extra children (zombies) + stick around to hog resources and create problems when looking + for refleaks. + """ + global environment_altered + + # Need os.waitpid(-1, os.WNOHANG): Windows is not supported + if not (hasattr(os, 'waitpid') and hasattr(os, 'WNOHANG')): + return + + # Reap all our dead child processes so we don't leave zombies around. + # These hog resources and might be causing some of the buildbots to die. + while True: + try: + # Read the exit status of any child process which already completed + pid, status = os.waitpid(-1, os.WNOHANG) + except OSError: + break + + if pid == 0: + break + + print_warning(f"reap_children() reaped child process {pid}") + environment_altered = True + + +@contextlib.contextmanager +def swap_attr(obj, attr, new_val): + """Temporary swap out an attribute with a new object. + + Usage: + with swap_attr(obj, "attr", 5): + ... + + This will set obj.attr to 5 for the duration of the with: block, + restoring the old value at the end of the block. If `attr` doesn't + exist on `obj`, it will be created and then deleted at the end of the + block. + + The old value (or None if it doesn't exist) will be assigned to the + target of the "as" clause, if there is one. + """ + if hasattr(obj, attr): + real_val = getattr(obj, attr) + setattr(obj, attr, new_val) + try: + yield real_val + finally: + setattr(obj, attr, real_val) + else: + setattr(obj, attr, new_val) + try: + yield + finally: + if hasattr(obj, attr): + delattr(obj, attr) + +@contextlib.contextmanager +def swap_item(obj, item, new_val): + """Temporary swap out an item with a new object. + + Usage: + with swap_item(obj, "item", 5): + ... + + This will set obj["item"] to 5 for the duration of the with: block, + restoring the old value at the end of the block. If `item` doesn't + exist on `obj`, it will be created and then deleted at the end of the + block. + + The old value (or None if it doesn't exist) will be assigned to the + target of the "as" clause, if there is one. + """ + if item in obj: + real_val = obj[item] + obj[item] = new_val + try: + yield real_val + finally: + obj[item] = real_val + else: + obj[item] = new_val + try: + yield + finally: + if item in obj: + del obj[item] + +def args_from_interpreter_flags(): + """Return a list of command-line arguments reproducing the current + settings in sys.flags and sys.warnoptions.""" + import subprocess + return subprocess._args_from_interpreter_flags() + +def optim_args_from_interpreter_flags(): + """Return a list of command-line arguments reproducing the current + optimization settings in sys.flags.""" + import subprocess + return subprocess._optim_args_from_interpreter_flags() + + +class Matcher(object): + + _partial_matches = ('msg', 'message') + + def matches(self, d, **kwargs): + """ + Try to match a single dict with the supplied arguments. + + Keys whose values are strings and which are in self._partial_matches + will be checked for partial (i.e. substring) matches. You can extend + this scheme to (for example) do regular expression matching, etc. + """ + result = True + for k in kwargs: + v = kwargs[k] + dv = d.get(k) + if not self.match_value(k, dv, v): + result = False + break + return result + + def match_value(self, k, dv, v): + """ + Try to match a single stored value (dv) with a supplied value (v). + """ + if type(v) != type(dv): + result = False + elif type(dv) is not str or k not in self._partial_matches: + result = (v == dv) + else: + result = dv.find(v) >= 0 + return result + + +_buggy_ucrt = None +def skip_if_buggy_ucrt_strfptime(test): + """ + Skip decorator for tests that use buggy strptime/strftime + + If the UCRT bugs are present time.localtime().tm_zone will be + an empty string, otherwise we assume the UCRT bugs are fixed + + See bpo-37552 [Windows] strptime/strftime return invalid + results with UCRT version 17763.615 + """ + import locale + global _buggy_ucrt + if _buggy_ucrt is None: + if(sys.platform == 'win32' and + locale.getdefaultlocale()[1] == 'cp65001' and + time.localtime().tm_zone == ''): + _buggy_ucrt = True + else: + _buggy_ucrt = False + return unittest.skip("buggy MSVC UCRT strptime/strftime")(test) if _buggy_ucrt else test + +class PythonSymlink: + """Creates a symlink for the current Python executable""" + def __init__(self, link=None): + from .os_helper import TESTFN + + self.link = link or os.path.abspath(TESTFN) + self._linked = [] + self.real = os.path.realpath(sys.executable) + self._also_link = [] + + self._env = None + + self._platform_specific() + + if sys.platform == "win32": + def _platform_specific(self): + import glob + import _winapi + + if os.path.lexists(self.real) and not os.path.exists(self.real): + # App symlink appears to not exist, but we want the + # real executable here anyway + self.real = _winapi.GetModuleFileName(0) + + dll = _winapi.GetModuleFileName(sys.dllhandle) + src_dir = os.path.dirname(dll) + dest_dir = os.path.dirname(self.link) + self._also_link.append(( + dll, + os.path.join(dest_dir, os.path.basename(dll)) + )) + for runtime in glob.glob(os.path.join(glob.escape(src_dir), "vcruntime*.dll")): + self._also_link.append(( + runtime, + os.path.join(dest_dir, os.path.basename(runtime)) + )) + + self._env = {k.upper(): os.getenv(k) for k in os.environ} + self._env["PYTHONHOME"] = os.path.dirname(self.real) + if sysconfig.is_python_build(True): + self._env["PYTHONPATH"] = os.path.dirname(os.__file__) + else: + def _platform_specific(self): + pass + + def __enter__(self): + os.symlink(self.real, self.link) + self._linked.append(self.link) + for real, link in self._also_link: + os.symlink(real, link) + self._linked.append(link) + return self + + def __exit__(self, exc_type, exc_value, exc_tb): + for link in self._linked: + try: + os.remove(link) + except IOError as ex: + if verbose: + print("failed to clean up {}: {}".format(link, ex)) + + def _call(self, python, args, env, returncode): + import subprocess + cmd = [python, *args] + p = subprocess.Popen(cmd, stdout=subprocess.PIPE, + stderr=subprocess.PIPE, env=env) + r = p.communicate() + if p.returncode != returncode: + if verbose: + print(repr(r[0])) + print(repr(r[1]), file=sys.stderr) + raise RuntimeError( + 'unexpected return code: {0} (0x{0:08X})'.format(p.returncode)) + return r + + def call_real(self, *args, returncode=0): + return self._call(self.real, args, None, returncode) + + def call_link(self, *args, returncode=0): + return self._call(self.link, args, self._env, returncode) + + +def skip_if_pgo_task(test): + """Skip decorator for tests not run in (non-extended) PGO task""" + ok = not PGO or PGO_EXTENDED + msg = "Not run for (non-extended) PGO task" + return test if ok else unittest.skip(msg)(test) + + +def detect_api_mismatch(ref_api, other_api, *, ignore=()): + """Returns the set of items in ref_api not in other_api, except for a + defined list of items to be ignored in this check. + + By default this skips private attributes beginning with '_' but + includes all magic methods, i.e. those starting and ending in '__'. + """ + missing_items = set(dir(ref_api)) - set(dir(other_api)) + if ignore: + missing_items -= set(ignore) + missing_items = set(m for m in missing_items + if not m.startswith('_') or m.endswith('__')) + return missing_items + + +def check__all__(test_case, module, name_of_module=None, extra=(), + not_exported=()): + """Assert that the __all__ variable of 'module' contains all public names. + + The module's public names (its API) are detected automatically based on + whether they match the public name convention and were defined in + 'module'. + + The 'name_of_module' argument can specify (as a string or tuple thereof) + what module(s) an API could be defined in in order to be detected as a + public API. One case for this is when 'module' imports part of its public + API from other modules, possibly a C backend (like 'csv' and its '_csv'). + + The 'extra' argument can be a set of names that wouldn't otherwise be + automatically detected as "public", like objects without a proper + '__module__' attribute. If provided, it will be added to the + automatically detected ones. + + The 'not_exported' argument can be a set of names that must not be treated + as part of the public API even though their names indicate otherwise. + + Usage: + import bar + import foo + import unittest + from test import support + + class MiscTestCase(unittest.TestCase): + def test__all__(self): + support.check__all__(self, foo) + + class OtherTestCase(unittest.TestCase): + def test__all__(self): + extra = {'BAR_CONST', 'FOO_CONST'} + not_exported = {'baz'} # Undocumented name. + # bar imports part of its API from _bar. + support.check__all__(self, bar, ('bar', '_bar'), + extra=extra, not_exported=not_exported) + + """ + + if name_of_module is None: + name_of_module = (module.__name__, ) + elif isinstance(name_of_module, str): + name_of_module = (name_of_module, ) + + expected = set(extra) + + for name in dir(module): + if name.startswith('_') or name in not_exported: + continue + obj = getattr(module, name) + if (getattr(obj, '__module__', None) in name_of_module or + (not hasattr(obj, '__module__') and + not isinstance(obj, types.ModuleType))): + expected.add(name) + test_case.assertCountEqual(module.__all__, expected) + + +def suppress_msvcrt_asserts(verbose=False): + try: + import msvcrt + except ImportError: + return + + msvcrt.SetErrorMode(msvcrt.SEM_FAILCRITICALERRORS + | msvcrt.SEM_NOALIGNMENTFAULTEXCEPT + | msvcrt.SEM_NOGPFAULTERRORBOX + | msvcrt.SEM_NOOPENFILEERRORBOX) + + # CrtSetReportMode() is only available in debug build + if hasattr(msvcrt, 'CrtSetReportMode'): + for m in [msvcrt.CRT_WARN, msvcrt.CRT_ERROR, msvcrt.CRT_ASSERT]: + if verbose: + msvcrt.CrtSetReportMode(m, msvcrt.CRTDBG_MODE_FILE) + msvcrt.CrtSetReportFile(m, msvcrt.CRTDBG_FILE_STDERR) + else: + msvcrt.CrtSetReportMode(m, 0) + + +class SuppressCrashReport: + """Try to prevent a crash report from popping up. + + On Windows, don't display the Windows Error Reporting dialog. On UNIX, + disable the creation of coredump file. + """ + old_value = None + old_modes = None + + def __enter__(self): + """On Windows, disable Windows Error Reporting dialogs using + SetErrorMode() and CrtSetReportMode(). + + On UNIX, try to save the previous core file size limit, then set + soft limit to 0. + """ + if sys.platform.startswith('win'): + # see http://msdn.microsoft.com/en-us/library/windows/desktop/ms680621.aspx + try: + import msvcrt + except ImportError: + return + + self.old_value = msvcrt.GetErrorMode() + + msvcrt.SetErrorMode(self.old_value | msvcrt.SEM_NOGPFAULTERRORBOX) + + # bpo-23314: Suppress assert dialogs in debug builds. + # CrtSetReportMode() is only available in debug build. + if hasattr(msvcrt, 'CrtSetReportMode'): + self.old_modes = {} + for report_type in [msvcrt.CRT_WARN, + msvcrt.CRT_ERROR, + msvcrt.CRT_ASSERT]: + old_mode = msvcrt.CrtSetReportMode(report_type, + msvcrt.CRTDBG_MODE_FILE) + old_file = msvcrt.CrtSetReportFile(report_type, + msvcrt.CRTDBG_FILE_STDERR) + self.old_modes[report_type] = old_mode, old_file + + else: + try: + import resource + self.resource = resource + except ImportError: + self.resource = None + if self.resource is not None: + try: + self.old_value = self.resource.getrlimit(self.resource.RLIMIT_CORE) + self.resource.setrlimit(self.resource.RLIMIT_CORE, + (0, self.old_value[1])) + except (ValueError, OSError): + pass + + if sys.platform == 'darwin': + import subprocess + # Check if the 'Crash Reporter' on OSX was configured + # in 'Developer' mode and warn that it will get triggered + # when it is. + # + # This assumes that this context manager is used in tests + # that might trigger the next manager. + cmd = ['/usr/bin/defaults', 'read', + 'com.apple.CrashReporter', 'DialogType'] + proc = subprocess.Popen(cmd, + stdout=subprocess.PIPE, + stderr=subprocess.PIPE) + with proc: + stdout = proc.communicate()[0] + if stdout.strip() == b'developer': + print("this test triggers the Crash Reporter, " + "that is intentional", end='', flush=True) + + return self + + def __exit__(self, *ignore_exc): + """Restore Windows ErrorMode or core file behavior to initial value.""" + if self.old_value is None: + return + + if sys.platform.startswith('win'): + import msvcrt + msvcrt.SetErrorMode(self.old_value) + + if self.old_modes: + for report_type, (old_mode, old_file) in self.old_modes.items(): + msvcrt.CrtSetReportMode(report_type, old_mode) + msvcrt.CrtSetReportFile(report_type, old_file) + else: + if self.resource is not None: + try: + self.resource.setrlimit(self.resource.RLIMIT_CORE, self.old_value) + except (ValueError, OSError): + pass + + +def patch(test_instance, object_to_patch, attr_name, new_value): + """Override 'object_to_patch'.'attr_name' with 'new_value'. + + Also, add a cleanup procedure to 'test_instance' to restore + 'object_to_patch' value for 'attr_name'. + The 'attr_name' should be a valid attribute for 'object_to_patch'. + + """ + # check that 'attr_name' is a real attribute for 'object_to_patch' + # will raise AttributeError if it does not exist + getattr(object_to_patch, attr_name) + + # keep a copy of the old value + attr_is_local = False + try: + old_value = object_to_patch.__dict__[attr_name] + except (AttributeError, KeyError): + old_value = getattr(object_to_patch, attr_name, None) + else: + attr_is_local = True + + # restore the value when the test is done + def cleanup(): + if attr_is_local: + setattr(object_to_patch, attr_name, old_value) + else: + delattr(object_to_patch, attr_name) + + test_instance.addCleanup(cleanup) + + # actually override the attribute + setattr(object_to_patch, attr_name, new_value) + + +@contextlib.contextmanager +def patch_list(orig): + """Like unittest.mock.patch.dict, but for lists.""" + try: + saved = orig[:] + yield + finally: + orig[:] = saved + + +def run_in_subinterp(code): + """ + Run code in a subinterpreter. Raise unittest.SkipTest if the tracemalloc + module is enabled. + """ + # Issue #10915, #15751: PyGILState_*() functions don't work with + # sub-interpreters, the tracemalloc module uses these functions internally + try: + import tracemalloc + except ImportError: + pass + else: + if tracemalloc.is_tracing(): + raise unittest.SkipTest("run_in_subinterp() cannot be used " + "if tracemalloc module is tracing " + "memory allocations") + import _testcapi + return _testcapi.run_in_subinterp(code) + + +def check_free_after_iterating(test, iter, cls, args=()): + class A(cls): + def __del__(self): + nonlocal done + done = True + try: + next(it) + except StopIteration: + pass + + done = False + it = iter(A(*args)) + # Issue 26494: Shouldn't crash + test.assertRaises(StopIteration, next, it) + # The sequence should be deallocated just after the end of iterating + gc_collect() + test.assertTrue(done) + + +def missing_compiler_executable(cmd_names=[]): + """Check if the compiler components used to build the interpreter exist. + + Check for the existence of the compiler executables whose names are listed + in 'cmd_names' or all the compiler executables when 'cmd_names' is empty + and return the first missing executable or None when none is found + missing. + + """ + # TODO (PEP 632): alternate check without using distutils + from distutils import ccompiler, sysconfig, spawn, errors + compiler = ccompiler.new_compiler() + sysconfig.customize_compiler(compiler) + if compiler.compiler_type == "msvc": + # MSVC has no executables, so check whether initialization succeeds + try: + compiler.initialize() + except errors.DistutilsPlatformError: + return "msvc" + for name in compiler.executables: + if cmd_names and name not in cmd_names: + continue + cmd = getattr(compiler, name) + if cmd_names: + assert cmd is not None, \ + "the '%s' executable is not configured" % name + elif not cmd: + continue + if spawn.find_executable(cmd[0]) is None: + return cmd[0] + + +_is_android_emulator = None +def setswitchinterval(interval): + # Setting a very low gil interval on the Android emulator causes python + # to hang (issue #26939). + minimum_interval = 1e-5 + if is_android and interval < minimum_interval: + global _is_android_emulator + if _is_android_emulator is None: + import subprocess + _is_android_emulator = (subprocess.check_output( + ['getprop', 'ro.kernel.qemu']).strip() == b'1') + if _is_android_emulator: + interval = minimum_interval + return sys.setswitchinterval(interval) + + +@contextlib.contextmanager +def disable_faulthandler(): + import faulthandler + + # use sys.__stderr__ instead of sys.stderr, since regrtest replaces + # sys.stderr with a StringIO which has no file descriptor when a test + # is run with -W/--verbose3. + fd = sys.__stderr__.fileno() + + is_enabled = faulthandler.is_enabled() + try: + faulthandler.disable() + yield + finally: + if is_enabled: + faulthandler.enable(file=fd, all_threads=True) + + +class SaveSignals: + """ + Save and restore signal handlers. + + This class is only able to save/restore signal handlers registered + by the Python signal module: see bpo-13285 for "external" signal + handlers. + """ + + def __init__(self): + import signal + self.signal = signal + self.signals = signal.valid_signals() + # SIGKILL and SIGSTOP signals cannot be ignored nor caught + for signame in ('SIGKILL', 'SIGSTOP'): + try: + signum = getattr(signal, signame) + except AttributeError: + continue + self.signals.remove(signum) + self.handlers = {} + + def save(self): + for signum in self.signals: + handler = self.signal.getsignal(signum) + if handler is None: + # getsignal() returns None if a signal handler was not + # registered by the Python signal module, + # and the handler is not SIG_DFL nor SIG_IGN. + # + # Ignore the signal: we cannot restore the handler. + continue + self.handlers[signum] = handler + + def restore(self): + for signum, handler in self.handlers.items(): + self.signal.signal(signum, handler) + + +def with_pymalloc(): + import _testcapi + return _testcapi.WITH_PYMALLOC + + +class _ALWAYS_EQ: + """ + Object that is equal to anything. + """ + def __eq__(self, other): + return True + def __ne__(self, other): + return False + +ALWAYS_EQ = _ALWAYS_EQ() + +class _NEVER_EQ: + """ + Object that is not equal to anything. + """ + def __eq__(self, other): + return False + def __ne__(self, other): + return True + def __hash__(self): + return 1 + +NEVER_EQ = _NEVER_EQ() + +@functools.total_ordering +class _LARGEST: + """ + Object that is greater than anything (except itself). + """ + def __eq__(self, other): + return isinstance(other, _LARGEST) + def __lt__(self, other): + return False + +LARGEST = _LARGEST() + +@functools.total_ordering +class _SMALLEST: + """ + Object that is less than anything (except itself). + """ + def __eq__(self, other): + return isinstance(other, _SMALLEST) + def __gt__(self, other): + return False + +SMALLEST = _SMALLEST() + +def maybe_get_event_loop_policy(): + """Return the global event loop policy if one is set, else return None.""" + import asyncio.events + return asyncio.events._event_loop_policy + +# Helpers for testing hashing. +NHASHBITS = sys.hash_info.width # number of bits in hash() result +assert NHASHBITS in (32, 64) + +# Return mean and sdev of number of collisions when tossing nballs balls +# uniformly at random into nbins bins. By definition, the number of +# collisions is the number of balls minus the number of occupied bins at +# the end. +def collision_stats(nbins, nballs): + n, k = nbins, nballs + # prob a bin empty after k trials = (1 - 1/n)**k + # mean # empty is then n * (1 - 1/n)**k + # so mean # occupied is n - n * (1 - 1/n)**k + # so collisions = k - (n - n*(1 - 1/n)**k) + # + # For the variance: + # n*(n-1)*(1-2/n)**k + meanempty - meanempty**2 = + # n*(n-1)*(1-2/n)**k + meanempty * (1 - meanempty) + # + # Massive cancellation occurs, and, e.g., for a 64-bit hash code + # 1-1/2**64 rounds uselessly to 1.0. Rather than make heroic (and + # error-prone) efforts to rework the naive formulas to avoid those, + # we use the `decimal` module to get plenty of extra precision. + # + # Note: the exact values are straightforward to compute with + # rationals, but in context that's unbearably slow, requiring + # multi-million bit arithmetic. + import decimal + with decimal.localcontext() as ctx: + bits = n.bit_length() * 2 # bits in n**2 + # At least that many bits will likely cancel out. + # Use that many decimal digits instead. + ctx.prec = max(bits, 30) + dn = decimal.Decimal(n) + p1empty = ((dn - 1) / dn) ** k + meanempty = n * p1empty + occupied = n - meanempty + collisions = k - occupied + var = dn*(dn-1)*((dn-2)/dn)**k + meanempty * (1 - meanempty) + return float(collisions), float(var.sqrt()) + + +class catch_unraisable_exception: + """ + Context manager catching unraisable exception using sys.unraisablehook. + + Storing the exception value (cm.unraisable.exc_value) creates a reference + cycle. The reference cycle is broken explicitly when the context manager + exits. + + Storing the object (cm.unraisable.object) can resurrect it if it is set to + an object which is being finalized. Exiting the context manager clears the + stored object. + + Usage: + + with support.catch_unraisable_exception() as cm: + # code creating an "unraisable exception" + ... + + # check the unraisable exception: use cm.unraisable + ... + + # cm.unraisable attribute no longer exists at this point + # (to break a reference cycle) + """ + + def __init__(self): + self.unraisable = None + self._old_hook = None + + def _hook(self, unraisable): + # Storing unraisable.object can resurrect an object which is being + # finalized. Storing unraisable.exc_value creates a reference cycle. + self.unraisable = unraisable + + def __enter__(self): + self._old_hook = sys.unraisablehook + sys.unraisablehook = self._hook + return self + + def __exit__(self, *exc_info): + sys.unraisablehook = self._old_hook + del self.unraisable + + +def wait_process(pid, *, exitcode, timeout=None): + """ + Wait until process pid completes and check that the process exit code is + exitcode. + + Raise an AssertionError if the process exit code is not equal to exitcode. + + If the process runs longer than timeout seconds (LONG_TIMEOUT by default), + kill the process (if signal.SIGKILL is available) and raise an + AssertionError. The timeout feature is not available on Windows. + """ + if os.name != "nt": + import signal + + if timeout is None: + timeout = LONG_TIMEOUT + t0 = time.monotonic() + sleep = 0.001 + max_sleep = 0.1 + while True: + pid2, status = os.waitpid(pid, os.WNOHANG) + if pid2 != 0: + break + # process is still running + + dt = time.monotonic() - t0 + if dt > timeout: + try: + os.kill(pid, signal.SIGKILL) + os.waitpid(pid, 0) + except OSError: + # Ignore errors like ChildProcessError or PermissionError + pass + + raise AssertionError(f"process {pid} is still running " + f"after {dt:.1f} seconds") + + sleep = min(sleep * 2, max_sleep) + time.sleep(sleep) + else: + # Windows implementation + pid2, status = os.waitpid(pid, 0) + + exitcode2 = os.waitstatus_to_exitcode(status) + if exitcode2 != exitcode: + raise AssertionError(f"process {pid} exited with code {exitcode2}, " + f"but exit code {exitcode} is expected") + + # sanity check: it should not fail in practice + if pid2 != pid: + raise AssertionError(f"pid {pid2} != pid {pid}") + +def skip_if_broken_multiprocessing_synchronize(): + """ + Skip tests if the multiprocessing.synchronize module is missing, if there + is no available semaphore implementation, or if creating a lock raises an + OSError (on Linux only). + """ + from .import_helper import import_module + + # Skip tests if the _multiprocessing extension is missing. + import_module('_multiprocessing') + + # Skip tests if there is no available semaphore implementation: + # multiprocessing.synchronize requires _multiprocessing.SemLock. + synchronize = import_module('multiprocessing.synchronize') + + if sys.platform == "linux": + try: + # bpo-38377: On Linux, creating a semaphore fails with OSError + # if the current user does not have the permission to create + # a file in /dev/shm/ directory. + synchronize.Lock(ctx=None) + except OSError as exc: + raise unittest.SkipTest(f"broken multiprocessing SemLock: {exc!r}") + + +@contextlib.contextmanager +def infinite_recursion(max_depth=75): + original_depth = sys.getrecursionlimit() + try: + sys.setrecursionlimit(max_depth) + yield + finally: + sys.setrecursionlimit(original_depth) + + +def check_disallow_instantiation(testcase, tp, *args, **kwds): + """ + Check that given type cannot be instantiated using *args and **kwds. + + See bpo-43916: Add Py_TPFLAGS_DISALLOW_INSTANTIATION type flag. + """ + mod = tp.__module__ + name = tp.__name__ + if mod != 'builtins': + qualname = f"{mod}.{name}" + else: + qualname = f"{name}" + msg = f"cannot create '{re.escape(qualname)}' instances" + testcase.assertRaisesRegex(TypeError, msg, tp, *args, **kwds) + + +def ignore_deprecations_from(module: str, *, like: str) -> object: + token = object() + warnings.filterwarnings( + "ignore", + category=DeprecationWarning, + module=module, + message=like + fr"(?#support{id(token)})", + ) + return token + + +def clear_ignored_deprecations(*tokens: object) -> None: + if not tokens: + raise ValueError("Provide token or tokens returned by ignore_deprecations_from") + + new_filters = [] + endswith = tuple(rf"(?#support{id(token)})" for token in tokens) + for action, message, category, module, lineno in warnings.filters: + if action == "ignore" and category is DeprecationWarning: + if isinstance(message, re.Pattern): + msg = message.pattern + else: + msg = message or "" + if msg.endswith(endswith): + continue + new_filters.append((action, message, category, module, lineno)) + if warnings.filters != new_filters: + warnings.filters[:] = new_filters + warnings._filters_mutated() + + +@contextlib.contextmanager +def adjust_int_max_str_digits(max_digits): + """Temporarily change the integer string conversion length limit.""" + current = sys.get_int_max_str_digits() + try: + sys.set_int_max_str_digits(max_digits) + yield + finally: + sys.set_int_max_str_digits(current) + + +def control_characters_c0() -> list[str]: + """Returns a list of C0 control characters as strings. + C0 control characters defined as the byte range 0x00-0x1F, and 0x7F. + """ + return [chr(c) for c in range(0x00, 0x20)] + ["\x7F"] diff --git a/miniconda3/envs/active_proaction/lib/python3.10/test/support/bytecode_helper.py b/miniconda3/envs/active_proaction/lib/python3.10/test/support/bytecode_helper.py new file mode 100644 index 0000000000000000000000000000000000000000..471d4a68f915aab082591921ebdc3fcfb0996426 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/test/support/bytecode_helper.py @@ -0,0 +1,42 @@ +"""bytecode_helper - support tools for testing correct bytecode generation""" + +import unittest +import dis +import io + +_UNSPECIFIED = object() + +class BytecodeTestCase(unittest.TestCase): + """Custom assertion methods for inspecting bytecode.""" + + def get_disassembly_as_string(self, co): + s = io.StringIO() + dis.dis(co, file=s) + return s.getvalue() + + def assertInBytecode(self, x, opname, argval=_UNSPECIFIED): + """Returns instr if opname is found, otherwise throws AssertionError""" + for instr in dis.get_instructions(x): + if instr.opname == opname: + if argval is _UNSPECIFIED or instr.argval == argval: + return instr + disassembly = self.get_disassembly_as_string(x) + if argval is _UNSPECIFIED: + msg = '%s not found in bytecode:\n%s' % (opname, disassembly) + else: + msg = '(%s,%r) not found in bytecode:\n%s' + msg = msg % (opname, argval, disassembly) + self.fail(msg) + + def assertNotInBytecode(self, x, opname, argval=_UNSPECIFIED): + """Throws AssertionError if opname is found""" + for instr in dis.get_instructions(x): + if instr.opname == opname: + disassembly = self.get_disassembly_as_string(x) + if argval is _UNSPECIFIED: + msg = '%s occurs in bytecode:\n%s' % (opname, disassembly) + self.fail(msg) + elif instr.argval == argval: + msg = '(%s,%r) occurs in bytecode:\n%s' + msg = msg % (opname, argval, disassembly) + self.fail(msg) diff --git a/miniconda3/envs/active_proaction/lib/python3.10/test/support/hashlib_helper.py b/miniconda3/envs/active_proaction/lib/python3.10/test/support/hashlib_helper.py new file mode 100644 index 0000000000000000000000000000000000000000..a4e6c92203ab5004d564d47bf7437f07e7a5813f --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/test/support/hashlib_helper.py @@ -0,0 +1,51 @@ +import functools +import hashlib +import unittest + +try: + import _hashlib +except ImportError: + _hashlib = None + + +def requires_hashdigest(digestname, openssl=None, usedforsecurity=True): + """Decorator raising SkipTest if a hashing algorithm is not available + + The hashing algorithm could be missing or blocked by a strict crypto + policy. + + If 'openssl' is True, then the decorator checks that OpenSSL provides + the algorithm. Otherwise the check falls back to built-in + implementations. The usedforsecurity flag is passed to the constructor. + + ValueError: [digital envelope routines: EVP_DigestInit_ex] disabled for FIPS + ValueError: unsupported hash type md4 + """ + def decorator(func_or_class): + if isinstance(func_or_class, type): + setUpClass = func_or_class.__dict__.get('setUpClass') + if setUpClass is None: + def setUpClass(cls): + super(func_or_class, cls).setUpClass() + setUpClass.__qualname__ = func_or_class.__qualname__ + '.setUpClass' + setUpClass.__module__ = func_or_class.__module__ + else: + setUpClass = setUpClass.__func__ + setUpClass = classmethod(decorator(setUpClass)) + func_or_class.setUpClass = setUpClass + return func_or_class + + @functools.wraps(func_or_class) + def wrapper(*args, **kwargs): + try: + if openssl and _hashlib is not None: + _hashlib.new(digestname, usedforsecurity=usedforsecurity) + else: + hashlib.new(digestname, usedforsecurity=usedforsecurity) + except ValueError: + raise unittest.SkipTest( + f"hash digest '{digestname}' is not available." + ) + return func_or_class(*args, **kwargs) + return wrapper + return decorator diff --git a/miniconda3/envs/active_proaction/lib/python3.10/test/support/import_helper.py b/miniconda3/envs/active_proaction/lib/python3.10/test/support/import_helper.py new file mode 100644 index 0000000000000000000000000000000000000000..efa8ffad6a8e0bea33aa417b830f2e85f98a03b2 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/test/support/import_helper.py @@ -0,0 +1,220 @@ +import contextlib +import importlib +import importlib.util +import os +import shutil +import sys +import unittest +import warnings + +from .os_helper import unlink + + +@contextlib.contextmanager +def _ignore_deprecated_imports(ignore=True): + """Context manager to suppress package and module deprecation + warnings when importing them. + + If ignore is False, this context manager has no effect. + """ + if ignore: + with warnings.catch_warnings(): + warnings.filterwarnings("ignore", ".+ (module|package)", + DeprecationWarning) + yield + else: + yield + + +def unload(name): + try: + del sys.modules[name] + except KeyError: + pass + + +def forget(modname): + """'Forget' a module was ever imported. + + This removes the module from sys.modules and deletes any PEP 3147/488 or + legacy .pyc files. + """ + unload(modname) + for dirname in sys.path: + source = os.path.join(dirname, modname + '.py') + # It doesn't matter if they exist or not, unlink all possible + # combinations of PEP 3147/488 and legacy pyc files. + unlink(source + 'c') + for opt in ('', 1, 2): + unlink(importlib.util.cache_from_source(source, optimization=opt)) + + +def make_legacy_pyc(source): + """Move a PEP 3147/488 pyc file to its legacy pyc location. + + :param source: The file system path to the source file. The source file + does not need to exist, however the PEP 3147/488 pyc file must exist. + :return: The file system path to the legacy pyc file. + """ + pyc_file = importlib.util.cache_from_source(source) + up_one = os.path.dirname(os.path.abspath(source)) + legacy_pyc = os.path.join(up_one, source + 'c') + shutil.move(pyc_file, legacy_pyc) + return legacy_pyc + + +def import_module(name, deprecated=False, *, required_on=()): + """Import and return the module to be tested, raising SkipTest if + it is not available. + + If deprecated is True, any module or package deprecation messages + will be suppressed. If a module is required on a platform but optional for + others, set required_on to an iterable of platform prefixes which will be + compared against sys.platform. + """ + with _ignore_deprecated_imports(deprecated): + try: + return importlib.import_module(name) + except ImportError as msg: + if sys.platform.startswith(tuple(required_on)): + raise + raise unittest.SkipTest(str(msg)) + + +def _save_and_remove_modules(names): + orig_modules = {} + prefixes = tuple(name + '.' for name in names) + for modname in list(sys.modules): + if modname in names or modname.startswith(prefixes): + orig_modules[modname] = sys.modules.pop(modname) + return orig_modules + + +def import_fresh_module(name, fresh=(), blocked=(), deprecated=False): + """Import and return a module, deliberately bypassing sys.modules. + + This function imports and returns a fresh copy of the named Python module + by removing the named module from sys.modules before doing the import. + Note that unlike reload, the original module is not affected by + this operation. + + *fresh* is an iterable of additional module names that are also removed + from the sys.modules cache before doing the import. If one of these + modules can't be imported, None is returned. + + *blocked* is an iterable of module names that are replaced with None + in the module cache during the import to ensure that attempts to import + them raise ImportError. + + The named module and any modules named in the *fresh* and *blocked* + parameters are saved before starting the import and then reinserted into + sys.modules when the fresh import is complete. + + Module and package deprecation messages are suppressed during this import + if *deprecated* is True. + + This function will raise ImportError if the named module cannot be + imported. + """ + # NOTE: test_heapq, test_json and test_warnings include extra sanity checks + # to make sure that this utility function is working as expected + with _ignore_deprecated_imports(deprecated): + # Keep track of modules saved for later restoration as well + # as those which just need a blocking entry removed + fresh = list(fresh) + blocked = list(blocked) + names = {name, *fresh, *blocked} + orig_modules = _save_and_remove_modules(names) + for modname in blocked: + sys.modules[modname] = None + + try: + # Return None when one of the "fresh" modules can not be imported. + try: + for modname in fresh: + __import__(modname) + except ImportError: + return None + return importlib.import_module(name) + finally: + _save_and_remove_modules(names) + sys.modules.update(orig_modules) + + +class CleanImport(object): + """Context manager to force import to return a new module reference. + + This is useful for testing module-level behaviours, such as + the emission of a DeprecationWarning on import. + + Use like this: + + with CleanImport("foo"): + importlib.import_module("foo") # new reference + """ + + def __init__(self, *module_names): + self.original_modules = sys.modules.copy() + for module_name in module_names: + if module_name in sys.modules: + module = sys.modules[module_name] + # It is possible that module_name is just an alias for + # another module (e.g. stub for modules renamed in 3.x). + # In that case, we also need delete the real module to clear + # the import cache. + if module.__name__ != module_name: + del sys.modules[module.__name__] + del sys.modules[module_name] + + def __enter__(self): + return self + + def __exit__(self, *ignore_exc): + sys.modules.update(self.original_modules) + + +class DirsOnSysPath(object): + """Context manager to temporarily add directories to sys.path. + + This makes a copy of sys.path, appends any directories given + as positional arguments, then reverts sys.path to the copied + settings when the context ends. + + Note that *all* sys.path modifications in the body of the + context manager, including replacement of the object, + will be reverted at the end of the block. + """ + + def __init__(self, *paths): + self.original_value = sys.path[:] + self.original_object = sys.path + sys.path.extend(paths) + + def __enter__(self): + return self + + def __exit__(self, *ignore_exc): + sys.path = self.original_object + sys.path[:] = self.original_value + + +def modules_setup(): + return sys.modules.copy(), + + +def modules_cleanup(oldmodules): + # Encoders/decoders are registered permanently within the internal + # codec cache. If we destroy the corresponding modules their + # globals will be set to None which will trip up the cached functions. + encodings = [(k, v) for k, v in sys.modules.items() + if k.startswith('encodings.')] + sys.modules.clear() + sys.modules.update(encodings) + # XXX: This kind of problem can affect more than just encodings. + # In particular extension modules (such as _ssl) don't cope + # with reloading properly. Really, test modules should be cleaning + # out the test specific modules they know they added (ala test_runpy) + # rather than relying on this function (as test_importhooks and test_pkg + # do currently). Implicitly imported *real* modules should be left alone + # (see issue 10556). + sys.modules.update(oldmodules) diff --git a/miniconda3/envs/active_proaction/lib/python3.10/test/support/interpreters.py b/miniconda3/envs/active_proaction/lib/python3.10/test/support/interpreters.py new file mode 100644 index 0000000000000000000000000000000000000000..2935708f9df1a5fd6b83e82418c6ec1471fb8832 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/test/support/interpreters.py @@ -0,0 +1,197 @@ +"""Subinterpreters High Level Module.""" + +import time +import _xxsubinterpreters as _interpreters + +# aliases: +from _xxsubinterpreters import ( + ChannelError, ChannelNotFoundError, ChannelEmptyError, + is_shareable, +) + + +__all__ = [ + 'Interpreter', 'get_current', 'get_main', 'create', 'list_all', + 'SendChannel', 'RecvChannel', + 'create_channel', 'list_all_channels', 'is_shareable', + 'ChannelError', 'ChannelNotFoundError', + 'ChannelEmptyError', + ] + + +def create(*, isolated=True): + """Return a new (idle) Python interpreter.""" + id = _interpreters.create(isolated=isolated) + return Interpreter(id, isolated=isolated) + + +def list_all(): + """Return all existing interpreters.""" + return [Interpreter(id) for id in _interpreters.list_all()] + + +def get_current(): + """Return the currently running interpreter.""" + id = _interpreters.get_current() + return Interpreter(id) + + +def get_main(): + """Return the main interpreter.""" + id = _interpreters.get_main() + return Interpreter(id) + + +class Interpreter: + """A single Python interpreter.""" + + def __init__(self, id, *, isolated=None): + if not isinstance(id, (int, _interpreters.InterpreterID)): + raise TypeError(f'id must be an int, got {id!r}') + self._id = id + self._isolated = isolated + + def __repr__(self): + data = dict(id=int(self._id), isolated=self._isolated) + kwargs = (f'{k}={v!r}' for k, v in data.items()) + return f'{type(self).__name__}({", ".join(kwargs)})' + + def __hash__(self): + return hash(self._id) + + def __eq__(self, other): + if not isinstance(other, Interpreter): + return NotImplemented + else: + return other._id == self._id + + @property + def id(self): + return self._id + + @property + def isolated(self): + if self._isolated is None: + # XXX The low-level function has not been added yet. + # See bpo-.... + self._isolated = _interpreters.is_isolated(self._id) + return self._isolated + + def is_running(self): + """Return whether or not the identified interpreter is running.""" + return _interpreters.is_running(self._id) + + def close(self): + """Finalize and destroy the interpreter. + + Attempting to destroy the current interpreter results + in a RuntimeError. + """ + return _interpreters.destroy(self._id) + + def run(self, src_str, /, *, channels=None): + """Run the given source code in the interpreter. + + This blocks the current Python thread until done. + """ + _interpreters.run_string(self._id, src_str, channels) + + +def create_channel(): + """Return (recv, send) for a new cross-interpreter channel. + + The channel may be used to pass data safely between interpreters. + """ + cid = _interpreters.channel_create() + recv, send = RecvChannel(cid), SendChannel(cid) + return recv, send + + +def list_all_channels(): + """Return a list of (recv, send) for all open channels.""" + return [(RecvChannel(cid), SendChannel(cid)) + for cid in _interpreters.channel_list_all()] + + +class _ChannelEnd: + """The base class for RecvChannel and SendChannel.""" + + def __init__(self, id): + if not isinstance(id, (int, _interpreters.ChannelID)): + raise TypeError(f'id must be an int, got {id!r}') + self._id = id + + def __repr__(self): + return f'{type(self).__name__}(id={int(self._id)})' + + def __hash__(self): + return hash(self._id) + + def __eq__(self, other): + if isinstance(self, RecvChannel): + if not isinstance(other, RecvChannel): + return NotImplemented + elif not isinstance(other, SendChannel): + return NotImplemented + return other._id == self._id + + @property + def id(self): + return self._id + + +_NOT_SET = object() + + +class RecvChannel(_ChannelEnd): + """The receiving end of a cross-interpreter channel.""" + + def recv(self, *, _sentinel=object(), _delay=10 / 1000): # 10 milliseconds + """Return the next object from the channel. + + This blocks until an object has been sent, if none have been + sent already. + """ + obj = _interpreters.channel_recv(self._id, _sentinel) + while obj is _sentinel: + time.sleep(_delay) + obj = _interpreters.channel_recv(self._id, _sentinel) + return obj + + def recv_nowait(self, default=_NOT_SET): + """Return the next object from the channel. + + If none have been sent then return the default if one + is provided or fail with ChannelEmptyError. Otherwise this + is the same as recv(). + """ + if default is _NOT_SET: + return _interpreters.channel_recv(self._id) + else: + return _interpreters.channel_recv(self._id, default) + + +class SendChannel(_ChannelEnd): + """The sending end of a cross-interpreter channel.""" + + def send(self, obj): + """Send the object (i.e. its data) to the channel's receiving end. + + This blocks until the object is received. + """ + _interpreters.channel_send(self._id, obj) + # XXX We are missing a low-level channel_send_wait(). + # See bpo-32604 and gh-19829. + # Until that shows up we fake it: + time.sleep(2) + + def send_nowait(self, obj): + """Send the object to the channel's receiving end. + + If the object is immediately received then return True + (else False). Otherwise this is the same as send(). + """ + # XXX Note that at the moment channel_send() only ever returns + # None. This should be fixed when channel_send_wait() is added. + # See bpo-32604 and gh-19829. + return _interpreters.channel_send(self._id, obj) diff --git a/miniconda3/envs/active_proaction/lib/python3.10/test/support/logging_helper.py b/miniconda3/envs/active_proaction/lib/python3.10/test/support/logging_helper.py new file mode 100644 index 0000000000000000000000000000000000000000..12fcca4f0f08d9b445ac84f6a1920c8bcb3badf4 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/test/support/logging_helper.py @@ -0,0 +1,29 @@ +import logging.handlers + +class TestHandler(logging.handlers.BufferingHandler): + def __init__(self, matcher): + # BufferingHandler takes a "capacity" argument + # so as to know when to flush. As we're overriding + # shouldFlush anyway, we can set a capacity of zero. + # You can call flush() manually to clear out the + # buffer. + logging.handlers.BufferingHandler.__init__(self, 0) + self.matcher = matcher + + def shouldFlush(self): + return False + + def emit(self, record): + self.format(record) + self.buffer.append(record.__dict__) + + def matches(self, **kwargs): + """ + Look for a saved dict whose keys/values match the supplied arguments. + """ + result = False + for d in self.buffer: + if self.matcher.matches(d, **kwargs): + result = True + break + return result diff --git a/miniconda3/envs/active_proaction/lib/python3.10/test/support/os_helper.py b/miniconda3/envs/active_proaction/lib/python3.10/test/support/os_helper.py new file mode 100644 index 0000000000000000000000000000000000000000..82a6de789c866e58b3c574e023d7eaaf078898e1 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/test/support/os_helper.py @@ -0,0 +1,623 @@ +import collections.abc +import contextlib +import errno +import os +import re +import stat +import sys +import time +import unittest +import warnings + + +# Filename used for testing +if os.name == 'java': + # Jython disallows @ in module names + TESTFN_ASCII = '$test' +else: + TESTFN_ASCII = '@test' + +# Disambiguate TESTFN for parallel testing, while letting it remain a valid +# module name. +TESTFN_ASCII = "{}_{}_tmp".format(TESTFN_ASCII, os.getpid()) + +# TESTFN_UNICODE is a non-ascii filename +TESTFN_UNICODE = TESTFN_ASCII + "-\xe0\xf2\u0258\u0141\u011f" +if sys.platform == 'darwin': + # In Mac OS X's VFS API file names are, by definition, canonically + # decomposed Unicode, encoded using UTF-8. See QA1173: + # http://developer.apple.com/mac/library/qa/qa2001/qa1173.html + import unicodedata + TESTFN_UNICODE = unicodedata.normalize('NFD', TESTFN_UNICODE) + +# TESTFN_UNENCODABLE is a filename (str type) that should *not* be able to be +# encoded by the filesystem encoding (in strict mode). It can be None if we +# cannot generate such filename. +TESTFN_UNENCODABLE = None +if os.name == 'nt': + # skip win32s (0) or Windows 9x/ME (1) + if sys.getwindowsversion().platform >= 2: + # Different kinds of characters from various languages to minimize the + # probability that the whole name is encodable to MBCS (issue #9819) + TESTFN_UNENCODABLE = TESTFN_ASCII + "-\u5171\u0141\u2661\u0363\uDC80" + try: + TESTFN_UNENCODABLE.encode(sys.getfilesystemencoding()) + except UnicodeEncodeError: + pass + else: + print('WARNING: The filename %r CAN be encoded by the filesystem ' + 'encoding (%s). Unicode filename tests may not be effective' + % (TESTFN_UNENCODABLE, sys.getfilesystemencoding())) + TESTFN_UNENCODABLE = None +# Mac OS X denies unencodable filenames (invalid utf-8) +elif sys.platform != 'darwin': + try: + # ascii and utf-8 cannot encode the byte 0xff + b'\xff'.decode(sys.getfilesystemencoding()) + except UnicodeDecodeError: + # 0xff will be encoded using the surrogate character u+DCFF + TESTFN_UNENCODABLE = TESTFN_ASCII \ + + b'-\xff'.decode(sys.getfilesystemencoding(), 'surrogateescape') + else: + # File system encoding (eg. ISO-8859-* encodings) can encode + # the byte 0xff. Skip some unicode filename tests. + pass + +# FS_NONASCII: non-ASCII character encodable by os.fsencode(), +# or an empty string if there is no such character. +FS_NONASCII = '' +for character in ( + # First try printable and common characters to have a readable filename. + # For each character, the encoding list are just example of encodings able + # to encode the character (the list is not exhaustive). + + # U+00E6 (Latin Small Letter Ae): cp1252, iso-8859-1 + '\u00E6', + # U+0130 (Latin Capital Letter I With Dot Above): cp1254, iso8859_3 + '\u0130', + # U+0141 (Latin Capital Letter L With Stroke): cp1250, cp1257 + '\u0141', + # U+03C6 (Greek Small Letter Phi): cp1253 + '\u03C6', + # U+041A (Cyrillic Capital Letter Ka): cp1251 + '\u041A', + # U+05D0 (Hebrew Letter Alef): Encodable to cp424 + '\u05D0', + # U+060C (Arabic Comma): cp864, cp1006, iso8859_6, mac_arabic + '\u060C', + # U+062A (Arabic Letter Teh): cp720 + '\u062A', + # U+0E01 (Thai Character Ko Kai): cp874 + '\u0E01', + + # Then try more "special" characters. "special" because they may be + # interpreted or displayed differently depending on the exact locale + # encoding and the font. + + # U+00A0 (No-Break Space) + '\u00A0', + # U+20AC (Euro Sign) + '\u20AC', +): + try: + # If Python is set up to use the legacy 'mbcs' in Windows, + # 'replace' error mode is used, and encode() returns b'?' + # for characters missing in the ANSI codepage + if os.fsdecode(os.fsencode(character)) != character: + raise UnicodeError + except UnicodeError: + pass + else: + FS_NONASCII = character + break + +# Save the initial cwd +SAVEDCWD = os.getcwd() + +# TESTFN_UNDECODABLE is a filename (bytes type) that should *not* be able to be +# decoded from the filesystem encoding (in strict mode). It can be None if we +# cannot generate such filename (ex: the latin1 encoding can decode any byte +# sequence). On UNIX, TESTFN_UNDECODABLE can be decoded by os.fsdecode() thanks +# to the surrogateescape error handler (PEP 383), but not from the filesystem +# encoding in strict mode. +TESTFN_UNDECODABLE = None +for name in ( + # b'\xff' is not decodable by os.fsdecode() with code page 932. Windows + # accepts it to create a file or a directory, or don't accept to enter to + # such directory (when the bytes name is used). So test b'\xe7' first: + # it is not decodable from cp932. + b'\xe7w\xf0', + # undecodable from ASCII, UTF-8 + b'\xff', + # undecodable from iso8859-3, iso8859-6, iso8859-7, cp424, iso8859-8, cp856 + # and cp857 + b'\xae\xd5' + # undecodable from UTF-8 (UNIX and Mac OS X) + b'\xed\xb2\x80', b'\xed\xb4\x80', + # undecodable from shift_jis, cp869, cp874, cp932, cp1250, cp1251, cp1252, + # cp1253, cp1254, cp1255, cp1257, cp1258 + b'\x81\x98', +): + try: + name.decode(sys.getfilesystemencoding()) + except UnicodeDecodeError: + TESTFN_UNDECODABLE = os.fsencode(TESTFN_ASCII) + name + break + +if FS_NONASCII: + TESTFN_NONASCII = TESTFN_ASCII + FS_NONASCII +else: + TESTFN_NONASCII = None +TESTFN = TESTFN_NONASCII or TESTFN_ASCII + + +def make_bad_fd(): + """ + Create an invalid file descriptor by opening and closing a file and return + its fd. + """ + file = open(TESTFN, "wb") + try: + return file.fileno() + finally: + file.close() + unlink(TESTFN) + + +_can_symlink = None + + +def can_symlink(): + global _can_symlink + if _can_symlink is not None: + return _can_symlink + symlink_path = TESTFN + "can_symlink" + try: + os.symlink(TESTFN, symlink_path) + can = True + except (OSError, NotImplementedError, AttributeError): + can = False + else: + os.remove(symlink_path) + _can_symlink = can + return can + + +def skip_unless_symlink(test): + """Skip decorator for tests that require functional symlink""" + ok = can_symlink() + msg = "Requires functional symlink implementation" + return test if ok else unittest.skip(msg)(test) + + +_can_xattr = None + + +def can_xattr(): + import tempfile + global _can_xattr + if _can_xattr is not None: + return _can_xattr + if not hasattr(os, "setxattr"): + can = False + else: + import platform + tmp_dir = tempfile.mkdtemp() + tmp_fp, tmp_name = tempfile.mkstemp(dir=tmp_dir) + try: + with open(TESTFN, "wb") as fp: + try: + # TESTFN & tempfile may use different file systems with + # different capabilities + os.setxattr(tmp_fp, b"user.test", b"") + os.setxattr(tmp_name, b"trusted.foo", b"42") + os.setxattr(fp.fileno(), b"user.test", b"") + # Kernels < 2.6.39 don't respect setxattr flags. + kernel_version = platform.release() + m = re.match(r"2.6.(\d{1,2})", kernel_version) + can = m is None or int(m.group(1)) >= 39 + except OSError: + can = False + finally: + unlink(TESTFN) + unlink(tmp_name) + rmdir(tmp_dir) + _can_xattr = can + return can + + +def skip_unless_xattr(test): + """Skip decorator for tests that require functional extended attributes""" + ok = can_xattr() + msg = "no non-broken extended attribute support" + return test if ok else unittest.skip(msg)(test) + + +def unlink(filename): + try: + _unlink(filename) + except (FileNotFoundError, NotADirectoryError): + pass + + +if sys.platform.startswith("win"): + def _waitfor(func, pathname, waitall=False): + # Perform the operation + func(pathname) + # Now setup the wait loop + if waitall: + dirname = pathname + else: + dirname, name = os.path.split(pathname) + dirname = dirname or '.' + # Check for `pathname` to be removed from the filesystem. + # The exponential backoff of the timeout amounts to a total + # of ~1 second after which the deletion is probably an error + # anyway. + # Testing on an i7@4.3GHz shows that usually only 1 iteration is + # required when contention occurs. + timeout = 0.001 + while timeout < 1.0: + # Note we are only testing for the existence of the file(s) in + # the contents of the directory regardless of any security or + # access rights. If we have made it this far, we have sufficient + # permissions to do that much using Python's equivalent of the + # Windows API FindFirstFile. + # Other Windows APIs can fail or give incorrect results when + # dealing with files that are pending deletion. + L = os.listdir(dirname) + if not (L if waitall else name in L): + return + # Increase the timeout and try again + time.sleep(timeout) + timeout *= 2 + warnings.warn('tests may fail, delete still pending for ' + pathname, + RuntimeWarning, stacklevel=4) + + def _unlink(filename): + _waitfor(os.unlink, filename) + + def _rmdir(dirname): + _waitfor(os.rmdir, dirname) + + def _rmtree(path): + from test.support import _force_run + + def _rmtree_inner(path): + for name in _force_run(path, os.listdir, path): + fullname = os.path.join(path, name) + try: + mode = os.lstat(fullname).st_mode + except OSError as exc: + print("support.rmtree(): os.lstat(%r) failed with %s" + % (fullname, exc), + file=sys.__stderr__) + mode = 0 + if stat.S_ISDIR(mode): + _waitfor(_rmtree_inner, fullname, waitall=True) + _force_run(fullname, os.rmdir, fullname) + else: + _force_run(fullname, os.unlink, fullname) + _waitfor(_rmtree_inner, path, waitall=True) + _waitfor(lambda p: _force_run(p, os.rmdir, p), path) + + def _longpath(path): + try: + import ctypes + except ImportError: + # No ctypes means we can't expands paths. + pass + else: + buffer = ctypes.create_unicode_buffer(len(path) * 2) + length = ctypes.windll.kernel32.GetLongPathNameW(path, buffer, + len(buffer)) + if length: + return buffer[:length] + return path +else: + _unlink = os.unlink + _rmdir = os.rmdir + + def _rmtree(path): + import shutil + try: + shutil.rmtree(path) + return + except OSError: + pass + + def _rmtree_inner(path): + from test.support import _force_run + for name in _force_run(path, os.listdir, path): + fullname = os.path.join(path, name) + try: + mode = os.lstat(fullname).st_mode + except OSError: + mode = 0 + if stat.S_ISDIR(mode): + _rmtree_inner(fullname) + _force_run(path, os.rmdir, fullname) + else: + _force_run(path, os.unlink, fullname) + _rmtree_inner(path) + os.rmdir(path) + + def _longpath(path): + return path + + +def rmdir(dirname): + try: + _rmdir(dirname) + except FileNotFoundError: + pass + + +def rmtree(path): + try: + _rmtree(path) + except FileNotFoundError: + pass + + +@contextlib.contextmanager +def temp_dir(path=None, quiet=False): + """Return a context manager that creates a temporary directory. + + Arguments: + + path: the directory to create temporarily. If omitted or None, + defaults to creating a temporary directory using tempfile.mkdtemp. + + quiet: if False (the default), the context manager raises an exception + on error. Otherwise, if the path is specified and cannot be + created, only a warning is issued. + + """ + import tempfile + dir_created = False + if path is None: + path = tempfile.mkdtemp() + dir_created = True + path = os.path.realpath(path) + else: + try: + os.mkdir(path) + dir_created = True + except OSError as exc: + if not quiet: + raise + warnings.warn(f'tests may fail, unable to create ' + f'temporary directory {path!r}: {exc}', + RuntimeWarning, stacklevel=3) + if dir_created: + pid = os.getpid() + try: + yield path + finally: + # In case the process forks, let only the parent remove the + # directory. The child has a different process id. (bpo-30028) + if dir_created and pid == os.getpid(): + rmtree(path) + + +@contextlib.contextmanager +def change_cwd(path, quiet=False): + """Return a context manager that changes the current working directory. + + Arguments: + + path: the directory to use as the temporary current working directory. + + quiet: if False (the default), the context manager raises an exception + on error. Otherwise, it issues only a warning and keeps the current + working directory the same. + + """ + saved_dir = os.getcwd() + try: + os.chdir(os.path.realpath(path)) + except OSError as exc: + if not quiet: + raise + warnings.warn(f'tests may fail, unable to change the current working ' + f'directory to {path!r}: {exc}', + RuntimeWarning, stacklevel=3) + try: + yield os.getcwd() + finally: + os.chdir(saved_dir) + + +@contextlib.contextmanager +def temp_cwd(name='tempcwd', quiet=False): + """ + Context manager that temporarily creates and changes the CWD. + + The function temporarily changes the current working directory + after creating a temporary directory in the current directory with + name *name*. If *name* is None, the temporary directory is + created using tempfile.mkdtemp. + + If *quiet* is False (default) and it is not possible to + create or change the CWD, an error is raised. If *quiet* is True, + only a warning is raised and the original CWD is used. + + """ + with temp_dir(path=name, quiet=quiet) as temp_path: + with change_cwd(temp_path, quiet=quiet) as cwd_dir: + yield cwd_dir + + +def create_empty_file(filename): + """Create an empty file. If the file already exists, truncate it.""" + fd = os.open(filename, os.O_WRONLY | os.O_CREAT | os.O_TRUNC) + os.close(fd) + + +@contextlib.contextmanager +def open_dir_fd(path): + """Open a file descriptor to a directory.""" + assert os.path.isdir(path) + dir_fd = os.open(path, os.O_RDONLY) + try: + yield dir_fd + finally: + os.close(dir_fd) + + +def fs_is_case_insensitive(directory): + """Detects if the file system for the specified directory + is case-insensitive.""" + import tempfile + with tempfile.NamedTemporaryFile(dir=directory) as base: + base_path = base.name + case_path = base_path.upper() + if case_path == base_path: + case_path = base_path.lower() + try: + return os.path.samefile(base_path, case_path) + except FileNotFoundError: + return False + + +class FakePath: + """Simple implementing of the path protocol. + """ + def __init__(self, path): + self.path = path + + def __repr__(self): + return f'' + + def __fspath__(self): + if (isinstance(self.path, BaseException) or + isinstance(self.path, type) and + issubclass(self.path, BaseException)): + raise self.path + else: + return self.path + + +def fd_count(): + """Count the number of open file descriptors. + """ + if sys.platform.startswith(('linux', 'freebsd')): + try: + names = os.listdir("/proc/self/fd") + # Subtract one because listdir() internally opens a file + # descriptor to list the content of the /proc/self/fd/ directory. + return len(names) - 1 + except FileNotFoundError: + pass + + MAXFD = 256 + if hasattr(os, 'sysconf'): + try: + MAXFD = os.sysconf("SC_OPEN_MAX") + except OSError: + pass + + old_modes = None + if sys.platform == 'win32': + # bpo-25306, bpo-31009: Call CrtSetReportMode() to not kill the process + # on invalid file descriptor if Python is compiled in debug mode + try: + import msvcrt + msvcrt.CrtSetReportMode + except (AttributeError, ImportError): + # no msvcrt or a release build + pass + else: + old_modes = {} + for report_type in (msvcrt.CRT_WARN, + msvcrt.CRT_ERROR, + msvcrt.CRT_ASSERT): + old_modes[report_type] = msvcrt.CrtSetReportMode(report_type, + 0) + + try: + count = 0 + for fd in range(MAXFD): + try: + # Prefer dup() over fstat(). fstat() can require input/output + # whereas dup() doesn't. + fd2 = os.dup(fd) + except OSError as e: + if e.errno != errno.EBADF: + raise + else: + os.close(fd2) + count += 1 + finally: + if old_modes is not None: + for report_type in (msvcrt.CRT_WARN, + msvcrt.CRT_ERROR, + msvcrt.CRT_ASSERT): + msvcrt.CrtSetReportMode(report_type, old_modes[report_type]) + + return count + + +if hasattr(os, "umask"): + @contextlib.contextmanager + def temp_umask(umask): + """Context manager that temporarily sets the process umask.""" + oldmask = os.umask(umask) + try: + yield + finally: + os.umask(oldmask) + + +class EnvironmentVarGuard(collections.abc.MutableMapping): + + """Class to help protect the environment variable properly. Can be used as + a context manager.""" + + def __init__(self): + self._environ = os.environ + self._changed = {} + + def __getitem__(self, envvar): + return self._environ[envvar] + + def __setitem__(self, envvar, value): + # Remember the initial value on the first access + if envvar not in self._changed: + self._changed[envvar] = self._environ.get(envvar) + self._environ[envvar] = value + + def __delitem__(self, envvar): + # Remember the initial value on the first access + if envvar not in self._changed: + self._changed[envvar] = self._environ.get(envvar) + if envvar in self._environ: + del self._environ[envvar] + + def keys(self): + return self._environ.keys() + + def __iter__(self): + return iter(self._environ) + + def __len__(self): + return len(self._environ) + + def set(self, envvar, value): + self[envvar] = value + + def unset(self, envvar): + del self[envvar] + + def __enter__(self): + return self + + def __exit__(self, *ignore_exc): + for (k, v) in self._changed.items(): + if v is None: + if k in self._environ: + del self._environ[k] + else: + self._environ[k] = v + os.environ = self._environ diff --git a/miniconda3/envs/active_proaction/lib/python3.10/test/support/script_helper.py b/miniconda3/envs/active_proaction/lib/python3.10/test/support/script_helper.py new file mode 100644 index 0000000000000000000000000000000000000000..6d699c8486cd20daa8f0b906089e61978cf61ade --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/test/support/script_helper.py @@ -0,0 +1,294 @@ +# Common utility functions used by various script execution tests +# e.g. test_cmd_line, test_cmd_line_script and test_runpy + +import collections +import importlib +import sys +import os +import os.path +import subprocess +import py_compile +import zipfile + +from importlib.util import source_from_cache +from test import support +from test.support.import_helper import make_legacy_pyc + + +# Cached result of the expensive test performed in the function below. +__cached_interp_requires_environment = None + + +def interpreter_requires_environment(): + """ + Returns True if our sys.executable interpreter requires environment + variables in order to be able to run at all. + + This is designed to be used with @unittest.skipIf() to annotate tests + that need to use an assert_python*() function to launch an isolated + mode (-I) or no environment mode (-E) sub-interpreter process. + + A normal build & test does not run into this situation but it can happen + when trying to run the standard library test suite from an interpreter that + doesn't have an obvious home with Python's current home finding logic. + + Setting PYTHONHOME is one way to get most of the testsuite to run in that + situation. PYTHONPATH or PYTHONUSERSITE are other common environment + variables that might impact whether or not the interpreter can start. + """ + global __cached_interp_requires_environment + if __cached_interp_requires_environment is None: + # If PYTHONHOME is set, assume that we need it + if 'PYTHONHOME' in os.environ: + __cached_interp_requires_environment = True + return True + + # Try running an interpreter with -E to see if it works or not. + try: + subprocess.check_call([sys.executable, '-E', + '-c', 'import sys; sys.exit(0)']) + except subprocess.CalledProcessError: + __cached_interp_requires_environment = True + else: + __cached_interp_requires_environment = False + + return __cached_interp_requires_environment + + +class _PythonRunResult(collections.namedtuple("_PythonRunResult", + ("rc", "out", "err"))): + """Helper for reporting Python subprocess run results""" + def fail(self, cmd_line): + """Provide helpful details about failed subcommand runs""" + # Limit to 80 lines to ASCII characters + maxlen = 80 * 100 + out, err = self.out, self.err + if len(out) > maxlen: + out = b'(... truncated stdout ...)' + out[-maxlen:] + if len(err) > maxlen: + err = b'(... truncated stderr ...)' + err[-maxlen:] + out = out.decode('ascii', 'replace').rstrip() + err = err.decode('ascii', 'replace').rstrip() + raise AssertionError("Process return code is %d\n" + "command line: %r\n" + "\n" + "stdout:\n" + "---\n" + "%s\n" + "---\n" + "\n" + "stderr:\n" + "---\n" + "%s\n" + "---" + % (self.rc, cmd_line, + out, + err)) + + +# Executing the interpreter in a subprocess +def run_python_until_end(*args, **env_vars): + env_required = interpreter_requires_environment() + cwd = env_vars.pop('__cwd', None) + if '__isolated' in env_vars: + isolated = env_vars.pop('__isolated') + else: + isolated = not env_vars and not env_required + cmd_line = [sys.executable, '-X', 'faulthandler'] + if isolated: + # isolated mode: ignore Python environment variables, ignore user + # site-packages, and don't add the current directory to sys.path + cmd_line.append('-I') + elif not env_vars and not env_required: + # ignore Python environment variables + cmd_line.append('-E') + + # But a special flag that can be set to override -- in this case, the + # caller is responsible to pass the full environment. + if env_vars.pop('__cleanenv', None): + env = {} + if sys.platform == 'win32': + # Windows requires at least the SYSTEMROOT environment variable to + # start Python. + env['SYSTEMROOT'] = os.environ['SYSTEMROOT'] + + # Other interesting environment variables, not copied currently: + # COMSPEC, HOME, PATH, TEMP, TMPDIR, TMP. + else: + # Need to preserve the original environment, for in-place testing of + # shared library builds. + env = os.environ.copy() + + # set TERM='' unless the TERM environment variable is passed explicitly + # see issues #11390 and #18300 + if 'TERM' not in env_vars: + env['TERM'] = '' + + env.update(env_vars) + cmd_line.extend(args) + proc = subprocess.Popen(cmd_line, stdin=subprocess.PIPE, + stdout=subprocess.PIPE, stderr=subprocess.PIPE, + env=env, cwd=cwd) + with proc: + try: + out, err = proc.communicate() + finally: + proc.kill() + subprocess._cleanup() + rc = proc.returncode + return _PythonRunResult(rc, out, err), cmd_line + + +def _assert_python(expected_success, /, *args, **env_vars): + res, cmd_line = run_python_until_end(*args, **env_vars) + if (res.rc and expected_success) or (not res.rc and not expected_success): + res.fail(cmd_line) + return res + + +def assert_python_ok(*args, **env_vars): + """ + Assert that running the interpreter with `args` and optional environment + variables `env_vars` succeeds (rc == 0) and return a (return code, stdout, + stderr) tuple. + + If the __cleanenv keyword is set, env_vars is used as a fresh environment. + + Python is started in isolated mode (command line option -I), + except if the __isolated keyword is set to False. + """ + return _assert_python(True, *args, **env_vars) + + +def assert_python_failure(*args, **env_vars): + """ + Assert that running the interpreter with `args` and optional environment + variables `env_vars` fails (rc != 0) and return a (return code, stdout, + stderr) tuple. + + See assert_python_ok() for more options. + """ + return _assert_python(False, *args, **env_vars) + + +def spawn_python(*args, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, **kw): + """Run a Python subprocess with the given arguments. + + kw is extra keyword args to pass to subprocess.Popen. Returns a Popen + object. + """ + cmd_line = [sys.executable] + if not interpreter_requires_environment(): + cmd_line.append('-E') + cmd_line.extend(args) + # Under Fedora (?), GNU readline can output junk on stderr when initialized, + # depending on the TERM setting. Setting TERM=vt100 is supposed to disable + # that. References: + # - http://reinout.vanrees.org/weblog/2009/08/14/readline-invisible-character-hack.html + # - http://stackoverflow.com/questions/15760712/python-readline-module-prints-escape-character-during-import + # - http://lists.gnu.org/archive/html/bug-readline/2007-08/msg00004.html + env = kw.setdefault('env', dict(os.environ)) + env['TERM'] = 'vt100' + return subprocess.Popen(cmd_line, stdin=subprocess.PIPE, + stdout=stdout, stderr=stderr, + **kw) + + +def kill_python(p): + """Run the given Popen process until completion and return stdout.""" + p.stdin.close() + data = p.stdout.read() + p.stdout.close() + # try to cleanup the child so we don't appear to leak when running + # with regrtest -R. + p.wait() + subprocess._cleanup() + return data + + +def make_script(script_dir, script_basename, source, omit_suffix=False): + script_filename = script_basename + if not omit_suffix: + script_filename += os.extsep + 'py' + script_name = os.path.join(script_dir, script_filename) + # The script should be encoded to UTF-8, the default string encoding + with open(script_name, 'w', encoding='utf-8') as script_file: + script_file.write(source) + importlib.invalidate_caches() + return script_name + + +def make_zip_script(zip_dir, zip_basename, script_name, name_in_zip=None): + zip_filename = zip_basename+os.extsep+'zip' + zip_name = os.path.join(zip_dir, zip_filename) + with zipfile.ZipFile(zip_name, 'w') as zip_file: + if name_in_zip is None: + parts = script_name.split(os.sep) + if len(parts) >= 2 and parts[-2] == '__pycache__': + legacy_pyc = make_legacy_pyc(source_from_cache(script_name)) + name_in_zip = os.path.basename(legacy_pyc) + script_name = legacy_pyc + else: + name_in_zip = os.path.basename(script_name) + zip_file.write(script_name, name_in_zip) + #if test.support.verbose: + # with zipfile.ZipFile(zip_name, 'r') as zip_file: + # print 'Contents of %r:' % zip_name + # zip_file.printdir() + return zip_name, os.path.join(zip_name, name_in_zip) + + +def make_pkg(pkg_dir, init_source=''): + os.mkdir(pkg_dir) + make_script(pkg_dir, '__init__', init_source) + + +def make_zip_pkg(zip_dir, zip_basename, pkg_name, script_basename, + source, depth=1, compiled=False): + unlink = [] + init_name = make_script(zip_dir, '__init__', '') + unlink.append(init_name) + init_basename = os.path.basename(init_name) + script_name = make_script(zip_dir, script_basename, source) + unlink.append(script_name) + if compiled: + init_name = py_compile.compile(init_name, doraise=True) + script_name = py_compile.compile(script_name, doraise=True) + unlink.extend((init_name, script_name)) + pkg_names = [os.sep.join([pkg_name]*i) for i in range(1, depth+1)] + script_name_in_zip = os.path.join(pkg_names[-1], os.path.basename(script_name)) + zip_filename = zip_basename+os.extsep+'zip' + zip_name = os.path.join(zip_dir, zip_filename) + with zipfile.ZipFile(zip_name, 'w') as zip_file: + for name in pkg_names: + init_name_in_zip = os.path.join(name, init_basename) + zip_file.write(init_name, init_name_in_zip) + zip_file.write(script_name, script_name_in_zip) + for name in unlink: + os.unlink(name) + #if test.support.verbose: + # with zipfile.ZipFile(zip_name, 'r') as zip_file: + # print 'Contents of %r:' % zip_name + # zip_file.printdir() + return zip_name, os.path.join(zip_name, script_name_in_zip) + + +def run_test_script(script): + # use -u to try to get the full output if the test hangs or crash + if support.verbose: + def title(text): + return f"===== {text} ======" + + name = f"script {os.path.basename(script)}" + print() + print(title(name), flush=True) + # In verbose mode, the child process inherit stdout and stdout, + # to see output in realtime and reduce the risk of losing output. + args = [sys.executable, "-E", "-X", "faulthandler", "-u", script, "-v"] + proc = subprocess.run(args) + print(title(f"{name} completed: exit code {proc.returncode}"), + flush=True) + if proc.returncode: + raise AssertionError(f"{name} failed") + else: + assert_python_ok("-u", script, "-v") diff --git a/miniconda3/envs/active_proaction/lib/python3.10/test/support/socket_helper.py b/miniconda3/envs/active_proaction/lib/python3.10/test/support/socket_helper.py new file mode 100644 index 0000000000000000000000000000000000000000..38c499bf722e85c0a2a198bf51b48d4830d44482 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/test/support/socket_helper.py @@ -0,0 +1,269 @@ +import contextlib +import errno +import socket +import unittest +import sys + +from .. import support + + +HOST = "localhost" +HOSTv4 = "127.0.0.1" +HOSTv6 = "::1" + + +def find_unused_port(family=socket.AF_INET, socktype=socket.SOCK_STREAM): + """Returns an unused port that should be suitable for binding. This is + achieved by creating a temporary socket with the same family and type as + the 'sock' parameter (default is AF_INET, SOCK_STREAM), and binding it to + the specified host address (defaults to 0.0.0.0) with the port set to 0, + eliciting an unused ephemeral port from the OS. The temporary socket is + then closed and deleted, and the ephemeral port is returned. + + Either this method or bind_port() should be used for any tests where a + server socket needs to be bound to a particular port for the duration of + the test. Which one to use depends on whether the calling code is creating + a python socket, or if an unused port needs to be provided in a constructor + or passed to an external program (i.e. the -accept argument to openssl's + s_server mode). Always prefer bind_port() over find_unused_port() where + possible. Hard coded ports should *NEVER* be used. As soon as a server + socket is bound to a hard coded port, the ability to run multiple instances + of the test simultaneously on the same host is compromised, which makes the + test a ticking time bomb in a buildbot environment. On Unix buildbots, this + may simply manifest as a failed test, which can be recovered from without + intervention in most cases, but on Windows, the entire python process can + completely and utterly wedge, requiring someone to log in to the buildbot + and manually kill the affected process. + + (This is easy to reproduce on Windows, unfortunately, and can be traced to + the SO_REUSEADDR socket option having different semantics on Windows versus + Unix/Linux. On Unix, you can't have two AF_INET SOCK_STREAM sockets bind, + listen and then accept connections on identical host/ports. An EADDRINUSE + OSError will be raised at some point (depending on the platform and + the order bind and listen were called on each socket). + + However, on Windows, if SO_REUSEADDR is set on the sockets, no EADDRINUSE + will ever be raised when attempting to bind two identical host/ports. When + accept() is called on each socket, the second caller's process will steal + the port from the first caller, leaving them both in an awkwardly wedged + state where they'll no longer respond to any signals or graceful kills, and + must be forcibly killed via OpenProcess()/TerminateProcess(). + + The solution on Windows is to use the SO_EXCLUSIVEADDRUSE socket option + instead of SO_REUSEADDR, which effectively affords the same semantics as + SO_REUSEADDR on Unix. Given the propensity of Unix developers in the Open + Source world compared to Windows ones, this is a common mistake. A quick + look over OpenSSL's 0.9.8g source shows that they use SO_REUSEADDR when + openssl.exe is called with the 's_server' option, for example. See + http://bugs.python.org/issue2550 for more info. The following site also + has a very thorough description about the implications of both REUSEADDR + and EXCLUSIVEADDRUSE on Windows: + https://learn.microsoft.com/windows/win32/winsock/using-so-reuseaddr-and-so-exclusiveaddruse + + XXX: although this approach is a vast improvement on previous attempts to + elicit unused ports, it rests heavily on the assumption that the ephemeral + port returned to us by the OS won't immediately be dished back out to some + other process when we close and delete our temporary socket but before our + calling code has a chance to bind the returned port. We can deal with this + issue if/when we come across it. + """ + + with socket.socket(family, socktype) as tempsock: + port = bind_port(tempsock) + del tempsock + return port + +def bind_port(sock, host=HOST): + """Bind the socket to a free port and return the port number. Relies on + ephemeral ports in order to ensure we are using an unbound port. This is + important as many tests may be running simultaneously, especially in a + buildbot environment. This method raises an exception if the sock.family + is AF_INET and sock.type is SOCK_STREAM, *and* the socket has SO_REUSEADDR + or SO_REUSEPORT set on it. Tests should *never* set these socket options + for TCP/IP sockets. The only case for setting these options is testing + multicasting via multiple UDP sockets. + + Additionally, if the SO_EXCLUSIVEADDRUSE socket option is available (i.e. + on Windows), it will be set on the socket. This will prevent anyone else + from bind()'ing to our host/port for the duration of the test. + """ + + if sock.family == socket.AF_INET and sock.type == socket.SOCK_STREAM: + if hasattr(socket, 'SO_REUSEADDR'): + if sock.getsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR) == 1: + raise support.TestFailed("tests should never set the " + "SO_REUSEADDR socket option on " + "TCP/IP sockets!") + if hasattr(socket, 'SO_REUSEPORT'): + try: + if sock.getsockopt(socket.SOL_SOCKET, socket.SO_REUSEPORT) == 1: + raise support.TestFailed("tests should never set the " + "SO_REUSEPORT socket option on " + "TCP/IP sockets!") + except OSError: + # Python's socket module was compiled using modern headers + # thus defining SO_REUSEPORT but this process is running + # under an older kernel that does not support SO_REUSEPORT. + pass + if hasattr(socket, 'SO_EXCLUSIVEADDRUSE'): + sock.setsockopt(socket.SOL_SOCKET, socket.SO_EXCLUSIVEADDRUSE, 1) + + sock.bind((host, 0)) + port = sock.getsockname()[1] + return port + +def bind_unix_socket(sock, addr): + """Bind a unix socket, raising SkipTest if PermissionError is raised.""" + assert sock.family == socket.AF_UNIX + try: + sock.bind(addr) + except PermissionError: + sock.close() + raise unittest.SkipTest('cannot bind AF_UNIX sockets') + +def _is_ipv6_enabled(): + """Check whether IPv6 is enabled on this host.""" + if socket.has_ipv6: + sock = None + try: + sock = socket.socket(socket.AF_INET6, socket.SOCK_STREAM) + sock.bind((HOSTv6, 0)) + return True + except OSError: + pass + finally: + if sock: + sock.close() + return False + +IPV6_ENABLED = _is_ipv6_enabled() + + +_bind_nix_socket_error = None +def skip_unless_bind_unix_socket(test): + """Decorator for tests requiring a functional bind() for unix sockets.""" + if not hasattr(socket, 'AF_UNIX'): + return unittest.skip('No UNIX Sockets')(test) + global _bind_nix_socket_error + if _bind_nix_socket_error is None: + from .os_helper import TESTFN, unlink + path = TESTFN + "can_bind_unix_socket" + with socket.socket(socket.AF_UNIX) as sock: + try: + sock.bind(path) + _bind_nix_socket_error = False + except OSError as e: + _bind_nix_socket_error = e + finally: + unlink(path) + if _bind_nix_socket_error: + msg = 'Requires a functional unix bind(): %s' % _bind_nix_socket_error + return unittest.skip(msg)(test) + else: + return test + + +def get_socket_conn_refused_errs(): + """ + Get the different socket error numbers ('errno') which can be received + when a connection is refused. + """ + errors = [errno.ECONNREFUSED] + if hasattr(errno, 'ENETUNREACH'): + # On Solaris, ENETUNREACH is returned sometimes instead of ECONNREFUSED + errors.append(errno.ENETUNREACH) + if hasattr(errno, 'EADDRNOTAVAIL'): + # bpo-31910: socket.create_connection() fails randomly + # with EADDRNOTAVAIL on Travis CI + errors.append(errno.EADDRNOTAVAIL) + if hasattr(errno, 'EHOSTUNREACH'): + # bpo-37583: The destination host cannot be reached + errors.append(errno.EHOSTUNREACH) + if not IPV6_ENABLED: + errors.append(errno.EAFNOSUPPORT) + return errors + + +_NOT_SET = object() + +@contextlib.contextmanager +def transient_internet(resource_name, *, timeout=_NOT_SET, errnos=()): + """Return a context manager that raises ResourceDenied when various issues + with the internet connection manifest themselves as exceptions.""" + import nntplib + import urllib.error + if timeout is _NOT_SET: + timeout = support.INTERNET_TIMEOUT + + default_errnos = [ + ('ECONNREFUSED', 111), + ('ECONNRESET', 104), + ('EHOSTUNREACH', 113), + ('ENETUNREACH', 101), + ('ETIMEDOUT', 110), + # socket.create_connection() fails randomly with + # EADDRNOTAVAIL on Travis CI. + ('EADDRNOTAVAIL', 99), + ] + default_gai_errnos = [ + ('EAI_AGAIN', -3), + ('EAI_FAIL', -4), + ('EAI_NONAME', -2), + ('EAI_NODATA', -5), + # Encountered when trying to resolve IPv6-only hostnames + ('WSANO_DATA', 11004), + ] + + denied = support.ResourceDenied("Resource %r is not available" % resource_name) + captured_errnos = errnos + gai_errnos = [] + if not captured_errnos: + captured_errnos = [getattr(errno, name, num) + for (name, num) in default_errnos] + gai_errnos = [getattr(socket, name, num) + for (name, num) in default_gai_errnos] + + def filter_error(err): + n = getattr(err, 'errno', None) + if (isinstance(err, TimeoutError) or + (isinstance(err, socket.gaierror) and n in gai_errnos) or + (isinstance(err, urllib.error.HTTPError) and + 500 <= err.code <= 599) or + (isinstance(err, urllib.error.URLError) and + (("ConnectionRefusedError" in err.reason) or + ("TimeoutError" in err.reason) or + ("EOFError" in err.reason))) or + n in captured_errnos): + if not support.verbose: + sys.stderr.write(denied.args[0] + "\n") + raise denied from err + + old_timeout = socket.getdefaulttimeout() + try: + if timeout is not None: + socket.setdefaulttimeout(timeout) + yield + except nntplib.NNTPTemporaryError as err: + if support.verbose: + sys.stderr.write(denied.args[0] + "\n") + raise denied from err + except OSError as err: + # urllib can wrap original socket errors multiple times (!), we must + # unwrap to get at the original error. + while True: + a = err.args + if len(a) >= 1 and isinstance(a[0], OSError): + err = a[0] + # The error can also be wrapped as args[1]: + # except socket.error as msg: + # raise OSError('socket error', msg).with_traceback(sys.exc_info()[2]) + elif len(a) >= 2 and isinstance(a[1], OSError): + err = a[1] + else: + break + filter_error(err) + raise + # XXX should we catch generic exceptions and look for their + # __cause__ or __context__? + finally: + socket.setdefaulttimeout(old_timeout) diff --git a/miniconda3/envs/active_proaction/lib/python3.10/test/support/testresult.py b/miniconda3/envs/active_proaction/lib/python3.10/test/support/testresult.py new file mode 100644 index 0000000000000000000000000000000000000000..6f2edda0f580ab55d2e49296433f5dbf419d69d4 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/test/support/testresult.py @@ -0,0 +1,185 @@ +'''Test runner and result class for the regression test suite. + +''' + +import functools +import io +import sys +import time +import traceback +import unittest + +class RegressionTestResult(unittest.TextTestResult): + USE_XML = False + + def __init__(self, stream, descriptions, verbosity): + super().__init__(stream=stream, descriptions=descriptions, + verbosity=2 if verbosity else 0) + self.buffer = True + if self.USE_XML: + from xml.etree import ElementTree as ET + from datetime import datetime + self.__ET = ET + self.__suite = ET.Element('testsuite') + self.__suite.set('start', datetime.utcnow().isoformat(' ')) + self.__e = None + self.__start_time = None + + @classmethod + def __getId(cls, test): + try: + test_id = test.id + except AttributeError: + return str(test) + try: + return test_id() + except TypeError: + return str(test_id) + return repr(test) + + def startTest(self, test): + super().startTest(test) + if self.USE_XML: + self.__e = e = self.__ET.SubElement(self.__suite, 'testcase') + self.__start_time = time.perf_counter() + + def _add_result(self, test, capture=False, **args): + if not self.USE_XML: + return + e = self.__e + self.__e = None + if e is None: + return + ET = self.__ET + + e.set('name', args.pop('name', self.__getId(test))) + e.set('status', args.pop('status', 'run')) + e.set('result', args.pop('result', 'completed')) + if self.__start_time: + e.set('time', f'{time.perf_counter() - self.__start_time:0.6f}') + + if capture: + if self._stdout_buffer is not None: + stdout = self._stdout_buffer.getvalue().rstrip() + ET.SubElement(e, 'system-out').text = stdout + if self._stderr_buffer is not None: + stderr = self._stderr_buffer.getvalue().rstrip() + ET.SubElement(e, 'system-err').text = stderr + + for k, v in args.items(): + if not k or not v: + continue + e2 = ET.SubElement(e, k) + if hasattr(v, 'items'): + for k2, v2 in v.items(): + if k2: + e2.set(k2, str(v2)) + else: + e2.text = str(v2) + else: + e2.text = str(v) + + @classmethod + def __makeErrorDict(cls, err_type, err_value, err_tb): + if isinstance(err_type, type): + if err_type.__module__ == 'builtins': + typename = err_type.__name__ + else: + typename = f'{err_type.__module__}.{err_type.__name__}' + else: + typename = repr(err_type) + + msg = traceback.format_exception(err_type, err_value, None) + tb = traceback.format_exception(err_type, err_value, err_tb) + + return { + 'type': typename, + 'message': ''.join(msg), + '': ''.join(tb), + } + + def addError(self, test, err): + self._add_result(test, True, error=self.__makeErrorDict(*err)) + super().addError(test, err) + + def addExpectedFailure(self, test, err): + self._add_result(test, True, output=self.__makeErrorDict(*err)) + super().addExpectedFailure(test, err) + + def addFailure(self, test, err): + self._add_result(test, True, failure=self.__makeErrorDict(*err)) + super().addFailure(test, err) + + def addSkip(self, test, reason): + self._add_result(test, skipped=reason) + super().addSkip(test, reason) + + def addSuccess(self, test): + self._add_result(test) + super().addSuccess(test) + + def addUnexpectedSuccess(self, test): + self._add_result(test, outcome='UNEXPECTED_SUCCESS') + super().addUnexpectedSuccess(test) + + def get_xml_element(self): + if not self.USE_XML: + raise ValueError("USE_XML is false") + e = self.__suite + e.set('tests', str(self.testsRun)) + e.set('errors', str(len(self.errors))) + e.set('failures', str(len(self.failures))) + return e + +class QuietRegressionTestRunner: + def __init__(self, stream, buffer=False): + self.result = RegressionTestResult(stream, None, 0) + self.result.buffer = buffer + + def run(self, test): + test(self.result) + return self.result + +def get_test_runner_class(verbosity, buffer=False): + if verbosity: + return functools.partial(unittest.TextTestRunner, + resultclass=RegressionTestResult, + buffer=buffer, + verbosity=verbosity) + return functools.partial(QuietRegressionTestRunner, buffer=buffer) + +def get_test_runner(stream, verbosity, capture_output=False): + return get_test_runner_class(verbosity, capture_output)(stream) + +if __name__ == '__main__': + import xml.etree.ElementTree as ET + RegressionTestResult.USE_XML = True + + class TestTests(unittest.TestCase): + def test_pass(self): + pass + + def test_pass_slow(self): + time.sleep(1.0) + + def test_fail(self): + print('stdout', file=sys.stdout) + print('stderr', file=sys.stderr) + self.fail('failure message') + + def test_error(self): + print('stdout', file=sys.stdout) + print('stderr', file=sys.stderr) + raise RuntimeError('error message') + + suite = unittest.TestSuite() + suite.addTest(unittest.makeSuite(TestTests)) + stream = io.StringIO() + runner_cls = get_test_runner_class(sum(a == '-v' for a in sys.argv)) + runner = runner_cls(sys.stdout) + result = runner.run(suite) + print('Output:', stream.getvalue()) + print('XML: ', end='') + for s in ET.tostringlist(result.get_xml_element()): + print(s.decode(), end='') + print() diff --git a/miniconda3/envs/active_proaction/lib/python3.10/test/support/threading_helper.py b/miniconda3/envs/active_proaction/lib/python3.10/test/support/threading_helper.py new file mode 100644 index 0000000000000000000000000000000000000000..92a64e8354acbce5aa0762a2b84c6552103c7269 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/test/support/threading_helper.py @@ -0,0 +1,209 @@ +import _thread +import contextlib +import functools +import sys +import threading +import time + +from test import support + + +#======================================================================= +# Threading support to prevent reporting refleaks when running regrtest.py -R + +# NOTE: we use thread._count() rather than threading.enumerate() (or the +# moral equivalent thereof) because a threading.Thread object is still alive +# until its __bootstrap() method has returned, even after it has been +# unregistered from the threading module. +# thread._count(), on the other hand, only gets decremented *after* the +# __bootstrap() method has returned, which gives us reliable reference counts +# at the end of a test run. + + +def threading_setup(): + return _thread._count(), threading._dangling.copy() + + +def threading_cleanup(*original_values): + _MAX_COUNT = 100 + + for count in range(_MAX_COUNT): + values = _thread._count(), threading._dangling + if values == original_values: + break + + if not count: + # Display a warning at the first iteration + support.environment_altered = True + dangling_threads = values[1] + support.print_warning(f"threading_cleanup() failed to cleanup " + f"{values[0] - original_values[0]} threads " + f"(count: {values[0]}, " + f"dangling: {len(dangling_threads)})") + for thread in dangling_threads: + support.print_warning(f"Dangling thread: {thread!r}") + + # Don't hold references to threads + dangling_threads = None + values = None + + time.sleep(0.01) + support.gc_collect() + + +def reap_threads(func): + """Use this function when threads are being used. This will + ensure that the threads are cleaned up even when the test fails. + """ + @functools.wraps(func) + def decorator(*args): + key = threading_setup() + try: + return func(*args) + finally: + threading_cleanup(*key) + return decorator + + +@contextlib.contextmanager +def wait_threads_exit(timeout=None): + """ + bpo-31234: Context manager to wait until all threads created in the with + statement exit. + + Use _thread.count() to check if threads exited. Indirectly, wait until + threads exit the internal t_bootstrap() C function of the _thread module. + + threading_setup() and threading_cleanup() are designed to emit a warning + if a test leaves running threads in the background. This context manager + is designed to cleanup threads started by the _thread.start_new_thread() + which doesn't allow to wait for thread exit, whereas thread.Thread has a + join() method. + """ + if timeout is None: + timeout = support.SHORT_TIMEOUT + old_count = _thread._count() + try: + yield + finally: + start_time = time.monotonic() + deadline = start_time + timeout + while True: + count = _thread._count() + if count <= old_count: + break + if time.monotonic() > deadline: + dt = time.monotonic() - start_time + msg = (f"wait_threads() failed to cleanup {count - old_count} " + f"threads after {dt:.1f} seconds " + f"(count: {count}, old count: {old_count})") + raise AssertionError(msg) + time.sleep(0.010) + support.gc_collect() + + +def join_thread(thread, timeout=None): + """Join a thread. Raise an AssertionError if the thread is still alive + after timeout seconds. + """ + if timeout is None: + timeout = support.SHORT_TIMEOUT + thread.join(timeout) + if thread.is_alive(): + msg = f"failed to join the thread in {timeout:.1f} seconds" + raise AssertionError(msg) + + +@contextlib.contextmanager +def start_threads(threads, unlock=None): + import faulthandler + threads = list(threads) + started = [] + try: + try: + for t in threads: + t.start() + started.append(t) + except: + if support.verbose: + print("Can't start %d threads, only %d threads started" % + (len(threads), len(started))) + raise + yield + finally: + try: + if unlock: + unlock() + endtime = time.monotonic() + for timeout in range(1, 16): + endtime += 60 + for t in started: + t.join(max(endtime - time.monotonic(), 0.01)) + started = [t for t in started if t.is_alive()] + if not started: + break + if support.verbose: + print('Unable to join %d threads during a period of ' + '%d minutes' % (len(started), timeout)) + finally: + started = [t for t in started if t.is_alive()] + if started: + faulthandler.dump_traceback(sys.stdout) + raise AssertionError('Unable to join %d threads' % len(started)) + + +class catch_threading_exception: + """ + Context manager catching threading.Thread exception using + threading.excepthook. + + Attributes set when an exception is caught: + + * exc_type + * exc_value + * exc_traceback + * thread + + See threading.excepthook() documentation for these attributes. + + These attributes are deleted at the context manager exit. + + Usage: + + with threading_helper.catch_threading_exception() as cm: + # code spawning a thread which raises an exception + ... + + # check the thread exception, use cm attributes: + # exc_type, exc_value, exc_traceback, thread + ... + + # exc_type, exc_value, exc_traceback, thread attributes of cm no longer + # exists at this point + # (to avoid reference cycles) + """ + + def __init__(self): + self.exc_type = None + self.exc_value = None + self.exc_traceback = None + self.thread = None + self._old_hook = None + + def _hook(self, args): + self.exc_type = args.exc_type + self.exc_value = args.exc_value + self.exc_traceback = args.exc_traceback + self.thread = args.thread + + def __enter__(self): + self._old_hook = threading.excepthook + threading.excepthook = self._hook + return self + + def __exit__(self, *exc_info): + threading.excepthook = self._old_hook + del self.exc_type + del self.exc_value + del self.exc_traceback + del self.thread diff --git a/miniconda3/envs/active_proaction/lib/python3.10/test/support/warnings_helper.py b/miniconda3/envs/active_proaction/lib/python3.10/test/support/warnings_helper.py new file mode 100644 index 0000000000000000000000000000000000000000..93a91e6d99f955e20f679b0da0a90525938e32ef --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/test/support/warnings_helper.py @@ -0,0 +1,199 @@ +import contextlib +import functools +import re +import sys +import warnings + + +def check_syntax_warning(testcase, statement, errtext='', + *, lineno=1, offset=None): + # Test also that a warning is emitted only once. + from test.support import check_syntax_error + with warnings.catch_warnings(record=True) as warns: + warnings.simplefilter('always', SyntaxWarning) + compile(statement, '', 'exec') + testcase.assertEqual(len(warns), 1, warns) + + warn, = warns + testcase.assertTrue(issubclass(warn.category, SyntaxWarning), + warn.category) + if errtext: + testcase.assertRegex(str(warn.message), errtext) + testcase.assertEqual(warn.filename, '') + testcase.assertIsNotNone(warn.lineno) + if lineno is not None: + testcase.assertEqual(warn.lineno, lineno) + + # SyntaxWarning should be converted to SyntaxError when raised, + # since the latter contains more information and provides better + # error report. + with warnings.catch_warnings(record=True) as warns: + warnings.simplefilter('error', SyntaxWarning) + check_syntax_error(testcase, statement, errtext, + lineno=lineno, offset=offset) + # No warnings are leaked when a SyntaxError is raised. + testcase.assertEqual(warns, []) + + +def ignore_warnings(*, category): + """Decorator to suppress warnings. + + Use of context managers to hide warnings make diffs + more noisy and tools like 'git blame' less useful. + """ + def decorator(test): + @functools.wraps(test) + def wrapper(self, *args, **kwargs): + with warnings.catch_warnings(): + warnings.simplefilter('ignore', category=category) + return test(self, *args, **kwargs) + return wrapper + return decorator + + +class WarningsRecorder(object): + """Convenience wrapper for the warnings list returned on + entry to the warnings.catch_warnings() context manager. + """ + def __init__(self, warnings_list): + self._warnings = warnings_list + self._last = 0 + + def __getattr__(self, attr): + if len(self._warnings) > self._last: + return getattr(self._warnings[-1], attr) + elif attr in warnings.WarningMessage._WARNING_DETAILS: + return None + raise AttributeError("%r has no attribute %r" % (self, attr)) + + @property + def warnings(self): + return self._warnings[self._last:] + + def reset(self): + self._last = len(self._warnings) + + +@contextlib.contextmanager +def check_warnings(*filters, **kwargs): + """Context manager to silence warnings. + + Accept 2-tuples as positional arguments: + ("message regexp", WarningCategory) + + Optional argument: + - if 'quiet' is True, it does not fail if a filter catches nothing + (default True without argument, + default False if some filters are defined) + + Without argument, it defaults to: + check_warnings(("", Warning), quiet=True) + """ + quiet = kwargs.get('quiet') + if not filters: + filters = (("", Warning),) + # Preserve backward compatibility + if quiet is None: + quiet = True + return _filterwarnings(filters, quiet) + + +@contextlib.contextmanager +def check_no_warnings(testcase, message='', category=Warning, force_gc=False): + """Context manager to check that no warnings are emitted. + + This context manager enables a given warning within its scope + and checks that no warnings are emitted even with that warning + enabled. + + If force_gc is True, a garbage collection is attempted before checking + for warnings. This may help to catch warnings emitted when objects + are deleted, such as ResourceWarning. + + Other keyword arguments are passed to warnings.filterwarnings(). + """ + from test.support import gc_collect + with warnings.catch_warnings(record=True) as warns: + warnings.filterwarnings('always', + message=message, + category=category) + yield + if force_gc: + gc_collect() + testcase.assertEqual(warns, []) + + +@contextlib.contextmanager +def check_no_resource_warning(testcase): + """Context manager to check that no ResourceWarning is emitted. + + Usage: + + with check_no_resource_warning(self): + f = open(...) + ... + del f + + You must remove the object which may emit ResourceWarning before + the end of the context manager. + """ + with check_no_warnings(testcase, category=ResourceWarning, force_gc=True): + yield + + +def _filterwarnings(filters, quiet=False): + """Catch the warnings, then check if all the expected + warnings have been raised and re-raise unexpected warnings. + If 'quiet' is True, only re-raise the unexpected warnings. + """ + # Clear the warning registry of the calling module + # in order to re-raise the warnings. + frame = sys._getframe(2) + registry = frame.f_globals.get('__warningregistry__') + if registry: + registry.clear() + with warnings.catch_warnings(record=True) as w: + # Set filter "always" to record all warnings. Because + # test_warnings swap the module, we need to look up in + # the sys.modules dictionary. + sys.modules['warnings'].simplefilter("always") + yield WarningsRecorder(w) + # Filter the recorded warnings + reraise = list(w) + missing = [] + for msg, cat in filters: + seen = False + for w in reraise[:]: + warning = w.message + # Filter out the matching messages + if (re.match(msg, str(warning), re.I) and + issubclass(warning.__class__, cat)): + seen = True + reraise.remove(w) + if not seen and not quiet: + # This filter caught nothing + missing.append((msg, cat.__name__)) + if reraise: + raise AssertionError("unhandled warning %s" % reraise[0]) + if missing: + raise AssertionError("filter (%r, %s) did not catch any warning" % + missing[0]) + + +@contextlib.contextmanager +def save_restore_warnings_filters(): + old_filters = warnings.filters[:] + try: + yield + finally: + warnings.filters[:] = old_filters + + +def _warn_about_deprecation(): + warnings.warn( + "This is used in test_support test to ensure" + " support.ignore_deprecations_from() works as expected." + " You should not be seeing this.", + DeprecationWarning, + stacklevel=0, + ) diff --git a/miniconda3/envs/active_proaction/lib/python3.10/test/test_script_helper.py b/miniconda3/envs/active_proaction/lib/python3.10/test/test_script_helper.py new file mode 100644 index 0000000000000000000000000000000000000000..4ade2cbc0d4b18467be012b511b7ee442d9828f1 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/test/test_script_helper.py @@ -0,0 +1,125 @@ +"""Unittests for test.support.script_helper. Who tests the test helper?""" + +import subprocess +import sys +import os +from test.support import script_helper +import unittest +from unittest import mock + + +class TestScriptHelper(unittest.TestCase): + + def test_assert_python_ok(self): + t = script_helper.assert_python_ok('-c', 'import sys; sys.exit(0)') + self.assertEqual(0, t[0], 'return code was not 0') + + def test_assert_python_failure(self): + # I didn't import the sys module so this child will fail. + rc, out, err = script_helper.assert_python_failure('-c', 'sys.exit(0)') + self.assertNotEqual(0, rc, 'return code should not be 0') + + def test_assert_python_ok_raises(self): + # I didn't import the sys module so this child will fail. + with self.assertRaises(AssertionError) as error_context: + script_helper.assert_python_ok('-c', 'sys.exit(0)') + error_msg = str(error_context.exception) + self.assertIn('command line:', error_msg) + self.assertIn('sys.exit(0)', error_msg, msg='unexpected command line') + + def test_assert_python_failure_raises(self): + with self.assertRaises(AssertionError) as error_context: + script_helper.assert_python_failure('-c', 'import sys; sys.exit(0)') + error_msg = str(error_context.exception) + self.assertIn('Process return code is 0\n', error_msg) + self.assertIn('import sys; sys.exit(0)', error_msg, + msg='unexpected command line.') + + @mock.patch('subprocess.Popen') + def test_assert_python_isolated_when_env_not_required(self, mock_popen): + with mock.patch.object(script_helper, + 'interpreter_requires_environment', + return_value=False) as mock_ire_func: + mock_popen.side_effect = RuntimeError('bail out of unittest') + try: + script_helper._assert_python(True, '-c', 'None') + except RuntimeError as err: + self.assertEqual('bail out of unittest', err.args[0]) + self.assertEqual(1, mock_popen.call_count) + self.assertEqual(1, mock_ire_func.call_count) + popen_command = mock_popen.call_args[0][0] + self.assertEqual(sys.executable, popen_command[0]) + self.assertIn('None', popen_command) + self.assertIn('-I', popen_command) + self.assertNotIn('-E', popen_command) # -I overrides this + + @mock.patch('subprocess.Popen') + def test_assert_python_not_isolated_when_env_is_required(self, mock_popen): + """Ensure that -I is not passed when the environment is required.""" + with mock.patch.object(script_helper, + 'interpreter_requires_environment', + return_value=True) as mock_ire_func: + mock_popen.side_effect = RuntimeError('bail out of unittest') + try: + script_helper._assert_python(True, '-c', 'None') + except RuntimeError as err: + self.assertEqual('bail out of unittest', err.args[0]) + popen_command = mock_popen.call_args[0][0] + self.assertNotIn('-I', popen_command) + self.assertNotIn('-E', popen_command) + + +class TestScriptHelperEnvironment(unittest.TestCase): + """Code coverage for interpreter_requires_environment().""" + + def setUp(self): + self.assertTrue( + hasattr(script_helper, '__cached_interp_requires_environment')) + # Reset the private cached state. + script_helper.__dict__['__cached_interp_requires_environment'] = None + + def tearDown(self): + # Reset the private cached state. + script_helper.__dict__['__cached_interp_requires_environment'] = None + + @mock.patch('subprocess.check_call') + def test_interpreter_requires_environment_true(self, mock_check_call): + with mock.patch.dict(os.environ): + os.environ.pop('PYTHONHOME', None) + mock_check_call.side_effect = subprocess.CalledProcessError('', '') + self.assertTrue(script_helper.interpreter_requires_environment()) + self.assertTrue(script_helper.interpreter_requires_environment()) + self.assertEqual(1, mock_check_call.call_count) + + @mock.patch('subprocess.check_call') + def test_interpreter_requires_environment_false(self, mock_check_call): + with mock.patch.dict(os.environ): + os.environ.pop('PYTHONHOME', None) + # The mocked subprocess.check_call fakes a no-error process. + script_helper.interpreter_requires_environment() + self.assertFalse(script_helper.interpreter_requires_environment()) + self.assertEqual(1, mock_check_call.call_count) + + @mock.patch('subprocess.check_call') + def test_interpreter_requires_environment_details(self, mock_check_call): + with mock.patch.dict(os.environ): + os.environ.pop('PYTHONHOME', None) + script_helper.interpreter_requires_environment() + self.assertFalse(script_helper.interpreter_requires_environment()) + self.assertFalse(script_helper.interpreter_requires_environment()) + self.assertEqual(1, mock_check_call.call_count) + check_call_command = mock_check_call.call_args[0][0] + self.assertEqual(sys.executable, check_call_command[0]) + self.assertIn('-E', check_call_command) + + @mock.patch('subprocess.check_call') + def test_interpreter_requires_environment_with_pythonhome(self, mock_check_call): + with mock.patch.dict(os.environ): + os.environ['PYTHONHOME'] = 'MockedHome' + self.assertTrue(script_helper.interpreter_requires_environment()) + self.assertTrue(script_helper.interpreter_requires_environment()) + self.assertEqual(0, mock_check_call.call_count) + + +if __name__ == '__main__': + unittest.main() diff --git a/miniconda3/envs/active_proaction/lib/python3.10/test/test_support.py b/miniconda3/envs/active_proaction/lib/python3.10/test/test_support.py new file mode 100644 index 0000000000000000000000000000000000000000..79290986c494d500af1a86d8ad57efbd1b7cbb2b --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/test/test_support.py @@ -0,0 +1,713 @@ +import errno +import importlib +import io +import os +import shutil +import socket +import stat +import subprocess +import sys +import tempfile +import textwrap +import time +import unittest +import warnings + +from test import support +from test.support import import_helper +from test.support import os_helper +from test.support import script_helper +from test.support import socket_helper +from test.support import warnings_helper + +TESTFN = os_helper.TESTFN + + +class TestSupport(unittest.TestCase): + @classmethod + def setUpClass(cls): + orig_filter_len = len(warnings.filters) + cls._warnings_helper_token = support.ignore_deprecations_from( + "test.support.warnings_helper", like=".*used in test_support.*" + ) + cls._test_support_token = support.ignore_deprecations_from( + "test.test_support", like=".*You should NOT be seeing this.*" + ) + assert len(warnings.filters) == orig_filter_len + 2 + + @classmethod + def tearDownClass(cls): + orig_filter_len = len(warnings.filters) + support.clear_ignored_deprecations( + cls._warnings_helper_token, + cls._test_support_token, + ) + assert len(warnings.filters) == orig_filter_len - 2 + + def test_ignored_deprecations_are_silent(self): + """Test support.ignore_deprecations_from() silences warnings""" + with warnings.catch_warnings(record=True) as warning_objs: + warnings_helper._warn_about_deprecation() + warnings.warn("You should NOT be seeing this.", DeprecationWarning) + messages = [str(w.message) for w in warning_objs] + self.assertEqual(len(messages), 0, messages) + + def test_import_module(self): + import_helper.import_module("ftplib") + self.assertRaises(unittest.SkipTest, + import_helper.import_module, "foo") + + def test_import_fresh_module(self): + import_helper.import_fresh_module("ftplib") + + def test_get_attribute(self): + self.assertEqual(support.get_attribute(self, "test_get_attribute"), + self.test_get_attribute) + self.assertRaises(unittest.SkipTest, support.get_attribute, self, "foo") + + @unittest.skip("failing buildbots") + def test_get_original_stdout(self): + self.assertEqual(support.get_original_stdout(), sys.stdout) + + def test_unload(self): + import sched + self.assertIn("sched", sys.modules) + import_helper.unload("sched") + self.assertNotIn("sched", sys.modules) + + def test_unlink(self): + with open(TESTFN, "w", encoding="utf-8") as f: + pass + os_helper.unlink(TESTFN) + self.assertFalse(os.path.exists(TESTFN)) + os_helper.unlink(TESTFN) + + def test_rmtree(self): + dirpath = os_helper.TESTFN + 'd' + subdirpath = os.path.join(dirpath, 'subdir') + os.mkdir(dirpath) + os.mkdir(subdirpath) + os_helper.rmtree(dirpath) + self.assertFalse(os.path.exists(dirpath)) + with support.swap_attr(support, 'verbose', 0): + os_helper.rmtree(dirpath) + + os.mkdir(dirpath) + os.mkdir(subdirpath) + os.chmod(dirpath, stat.S_IRUSR|stat.S_IXUSR) + with support.swap_attr(support, 'verbose', 0): + os_helper.rmtree(dirpath) + self.assertFalse(os.path.exists(dirpath)) + + os.mkdir(dirpath) + os.mkdir(subdirpath) + os.chmod(dirpath, 0) + with support.swap_attr(support, 'verbose', 0): + os_helper.rmtree(dirpath) + self.assertFalse(os.path.exists(dirpath)) + + def test_forget(self): + mod_filename = TESTFN + '.py' + with open(mod_filename, 'w', encoding="utf-8") as f: + print('foo = 1', file=f) + sys.path.insert(0, os.curdir) + importlib.invalidate_caches() + try: + mod = __import__(TESTFN) + self.assertIn(TESTFN, sys.modules) + + import_helper.forget(TESTFN) + self.assertNotIn(TESTFN, sys.modules) + finally: + del sys.path[0] + os_helper.unlink(mod_filename) + os_helper.rmtree('__pycache__') + + def test_HOST(self): + s = socket.create_server((socket_helper.HOST, 0)) + s.close() + + def test_find_unused_port(self): + port = socket_helper.find_unused_port() + s = socket.create_server((socket_helper.HOST, port)) + s.close() + + def test_bind_port(self): + s = socket.socket() + socket_helper.bind_port(s) + s.listen() + s.close() + + # Tests for temp_dir() + + def test_temp_dir(self): + """Test that temp_dir() creates and destroys its directory.""" + parent_dir = tempfile.mkdtemp() + parent_dir = os.path.realpath(parent_dir) + + try: + path = os.path.join(parent_dir, 'temp') + self.assertFalse(os.path.isdir(path)) + with os_helper.temp_dir(path) as temp_path: + self.assertEqual(temp_path, path) + self.assertTrue(os.path.isdir(path)) + self.assertFalse(os.path.isdir(path)) + finally: + os_helper.rmtree(parent_dir) + + def test_temp_dir__path_none(self): + """Test passing no path.""" + with os_helper.temp_dir() as temp_path: + self.assertTrue(os.path.isdir(temp_path)) + self.assertFalse(os.path.isdir(temp_path)) + + def test_temp_dir__existing_dir__quiet_default(self): + """Test passing a directory that already exists.""" + def call_temp_dir(path): + with os_helper.temp_dir(path) as temp_path: + raise Exception("should not get here") + + path = tempfile.mkdtemp() + path = os.path.realpath(path) + try: + self.assertTrue(os.path.isdir(path)) + self.assertRaises(FileExistsError, call_temp_dir, path) + # Make sure temp_dir did not delete the original directory. + self.assertTrue(os.path.isdir(path)) + finally: + shutil.rmtree(path) + + def test_temp_dir__existing_dir__quiet_true(self): + """Test passing a directory that already exists with quiet=True.""" + path = tempfile.mkdtemp() + path = os.path.realpath(path) + + try: + with warnings_helper.check_warnings() as recorder: + with os_helper.temp_dir(path, quiet=True) as temp_path: + self.assertEqual(path, temp_path) + warnings = [str(w.message) for w in recorder.warnings] + # Make sure temp_dir did not delete the original directory. + self.assertTrue(os.path.isdir(path)) + finally: + shutil.rmtree(path) + + self.assertEqual(len(warnings), 1, warnings) + warn = warnings[0] + self.assertTrue(warn.startswith(f'tests may fail, unable to create ' + f'temporary directory {path!r}: '), + warn) + + @unittest.skipUnless(hasattr(os, "fork"), "test requires os.fork") + def test_temp_dir__forked_child(self): + """Test that a forked child process does not remove the directory.""" + # See bpo-30028 for details. + # Run the test as an external script, because it uses fork. + script_helper.assert_python_ok("-c", textwrap.dedent(""" + import os + from test import support + from test.support import os_helper + with os_helper.temp_cwd() as temp_path: + pid = os.fork() + if pid != 0: + # parent process + + # wait for the child to terminate + support.wait_process(pid, exitcode=0) + + # Make sure that temp_path is still present. When the child + # process leaves the 'temp_cwd'-context, the __exit__()- + # method of the context must not remove the temporary + # directory. + if not os.path.isdir(temp_path): + raise AssertionError("Child removed temp_path.") + """)) + + # Tests for change_cwd() + + def test_change_cwd(self): + original_cwd = os.getcwd() + + with os_helper.temp_dir() as temp_path: + with os_helper.change_cwd(temp_path) as new_cwd: + self.assertEqual(new_cwd, temp_path) + self.assertEqual(os.getcwd(), new_cwd) + + self.assertEqual(os.getcwd(), original_cwd) + + def test_change_cwd__non_existent_dir(self): + """Test passing a non-existent directory.""" + original_cwd = os.getcwd() + + def call_change_cwd(path): + with os_helper.change_cwd(path) as new_cwd: + raise Exception("should not get here") + + with os_helper.temp_dir() as parent_dir: + non_existent_dir = os.path.join(parent_dir, 'does_not_exist') + self.assertRaises(FileNotFoundError, call_change_cwd, + non_existent_dir) + + self.assertEqual(os.getcwd(), original_cwd) + + def test_change_cwd__non_existent_dir__quiet_true(self): + """Test passing a non-existent directory with quiet=True.""" + original_cwd = os.getcwd() + + with os_helper.temp_dir() as parent_dir: + bad_dir = os.path.join(parent_dir, 'does_not_exist') + with warnings_helper.check_warnings() as recorder: + with os_helper.change_cwd(bad_dir, quiet=True) as new_cwd: + self.assertEqual(new_cwd, original_cwd) + self.assertEqual(os.getcwd(), new_cwd) + warnings = [str(w.message) for w in recorder.warnings] + + self.assertEqual(len(warnings), 1, warnings) + warn = warnings[0] + self.assertTrue(warn.startswith(f'tests may fail, unable to change ' + f'the current working directory ' + f'to {bad_dir!r}: '), + warn) + + # Tests for change_cwd() + + def test_change_cwd__chdir_warning(self): + """Check the warning message when os.chdir() fails.""" + path = TESTFN + '_does_not_exist' + with warnings_helper.check_warnings() as recorder: + with os_helper.change_cwd(path=path, quiet=True): + pass + messages = [str(w.message) for w in recorder.warnings] + + self.assertEqual(len(messages), 1, messages) + msg = messages[0] + self.assertTrue(msg.startswith(f'tests may fail, unable to change ' + f'the current working directory ' + f'to {path!r}: '), + msg) + + # Tests for temp_cwd() + + def test_temp_cwd(self): + here = os.getcwd() + with os_helper.temp_cwd(name=TESTFN): + self.assertEqual(os.path.basename(os.getcwd()), TESTFN) + self.assertFalse(os.path.exists(TESTFN)) + self.assertEqual(os.getcwd(), here) + + + def test_temp_cwd__name_none(self): + """Test passing None to temp_cwd().""" + original_cwd = os.getcwd() + with os_helper.temp_cwd(name=None) as new_cwd: + self.assertNotEqual(new_cwd, original_cwd) + self.assertTrue(os.path.isdir(new_cwd)) + self.assertEqual(os.getcwd(), new_cwd) + self.assertEqual(os.getcwd(), original_cwd) + + def test_sortdict(self): + self.assertEqual(support.sortdict({3:3, 2:2, 1:1}), "{1: 1, 2: 2, 3: 3}") + + def test_make_bad_fd(self): + fd = os_helper.make_bad_fd() + with self.assertRaises(OSError) as cm: + os.write(fd, b"foo") + self.assertEqual(cm.exception.errno, errno.EBADF) + + def test_check_syntax_error(self): + support.check_syntax_error(self, "def class", lineno=1, offset=5) + with self.assertRaises(AssertionError): + support.check_syntax_error(self, "x=1") + + def test_CleanImport(self): + import importlib + with import_helper.CleanImport("pprint"): + importlib.import_module("pprint") + + def test_DirsOnSysPath(self): + with import_helper.DirsOnSysPath('foo', 'bar'): + self.assertIn("foo", sys.path) + self.assertIn("bar", sys.path) + self.assertNotIn("foo", sys.path) + self.assertNotIn("bar", sys.path) + + def test_captured_stdout(self): + with support.captured_stdout() as stdout: + print("hello") + self.assertEqual(stdout.getvalue(), "hello\n") + + def test_captured_stderr(self): + with support.captured_stderr() as stderr: + print("hello", file=sys.stderr) + self.assertEqual(stderr.getvalue(), "hello\n") + + def test_captured_stdin(self): + with support.captured_stdin() as stdin: + stdin.write('hello\n') + stdin.seek(0) + # call test code that consumes from sys.stdin + captured = input() + self.assertEqual(captured, "hello") + + def test_gc_collect(self): + support.gc_collect() + + def test_python_is_optimized(self): + self.assertIsInstance(support.python_is_optimized(), bool) + + def test_swap_attr(self): + class Obj: + pass + obj = Obj() + obj.x = 1 + with support.swap_attr(obj, "x", 5) as x: + self.assertEqual(obj.x, 5) + self.assertEqual(x, 1) + self.assertEqual(obj.x, 1) + with support.swap_attr(obj, "y", 5) as y: + self.assertEqual(obj.y, 5) + self.assertIsNone(y) + self.assertFalse(hasattr(obj, 'y')) + with support.swap_attr(obj, "y", 5): + del obj.y + self.assertFalse(hasattr(obj, 'y')) + + def test_swap_item(self): + D = {"x":1} + with support.swap_item(D, "x", 5) as x: + self.assertEqual(D["x"], 5) + self.assertEqual(x, 1) + self.assertEqual(D["x"], 1) + with support.swap_item(D, "y", 5) as y: + self.assertEqual(D["y"], 5) + self.assertIsNone(y) + self.assertNotIn("y", D) + with support.swap_item(D, "y", 5): + del D["y"] + self.assertNotIn("y", D) + + class RefClass: + attribute1 = None + attribute2 = None + _hidden_attribute1 = None + __magic_1__ = None + + class OtherClass: + attribute2 = None + attribute3 = None + __magic_1__ = None + __magic_2__ = None + + def test_detect_api_mismatch(self): + missing_items = support.detect_api_mismatch(self.RefClass, + self.OtherClass) + self.assertEqual({'attribute1'}, missing_items) + + missing_items = support.detect_api_mismatch(self.OtherClass, + self.RefClass) + self.assertEqual({'attribute3', '__magic_2__'}, missing_items) + + def test_detect_api_mismatch__ignore(self): + ignore = ['attribute1', 'attribute3', '__magic_2__', 'not_in_either'] + + missing_items = support.detect_api_mismatch( + self.RefClass, self.OtherClass, ignore=ignore) + self.assertEqual(set(), missing_items) + + missing_items = support.detect_api_mismatch( + self.OtherClass, self.RefClass, ignore=ignore) + self.assertEqual(set(), missing_items) + + def test_check__all__(self): + extra = {'tempdir'} + not_exported = {'template'} + support.check__all__(self, + tempfile, + extra=extra, + not_exported=not_exported) + + extra = {'TextTestResult', 'installHandler'} + not_exported = {'load_tests', "TestProgram", "BaseTestSuite"} + + support.check__all__(self, + unittest, + ("unittest.result", "unittest.case", + "unittest.suite", "unittest.loader", + "unittest.main", "unittest.runner", + "unittest.signals", "unittest.async_case"), + extra=extra, + not_exported=not_exported) + + self.assertRaises(AssertionError, support.check__all__, self, unittest) + + @unittest.skipUnless(hasattr(os, 'waitpid') and hasattr(os, 'WNOHANG'), + 'need os.waitpid() and os.WNOHANG') + def test_reap_children(self): + # Make sure that there is no other pending child process + support.reap_children() + + # Create a child process + pid = os.fork() + if pid == 0: + # child process: do nothing, just exit + os._exit(0) + + t0 = time.monotonic() + deadline = time.monotonic() + support.SHORT_TIMEOUT + + was_altered = support.environment_altered + try: + support.environment_altered = False + stderr = io.StringIO() + + while True: + if time.monotonic() > deadline: + self.fail("timeout") + + old_stderr = sys.__stderr__ + try: + sys.__stderr__ = stderr + support.reap_children() + finally: + sys.__stderr__ = old_stderr + + # Use environment_altered to check if reap_children() found + # the child process + if support.environment_altered: + break + + # loop until the child process completed + time.sleep(0.100) + + msg = "Warning -- reap_children() reaped child process %s" % pid + self.assertIn(msg, stderr.getvalue()) + self.assertTrue(support.environment_altered) + finally: + support.environment_altered = was_altered + + # Just in case, check again that there is no other + # pending child process + support.reap_children() + + def check_options(self, args, func, expected=None): + code = f'from test.support import {func}; print(repr({func}()))' + cmd = [sys.executable, *args, '-c', code] + env = {key: value for key, value in os.environ.items() + if not key.startswith('PYTHON')} + proc = subprocess.run(cmd, + stdout=subprocess.PIPE, + stderr=subprocess.DEVNULL, + universal_newlines=True, + env=env) + if expected is None: + expected = args + self.assertEqual(proc.stdout.rstrip(), repr(expected)) + self.assertEqual(proc.returncode, 0) + + def test_args_from_interpreter_flags(self): + # Test test.support.args_from_interpreter_flags() + for opts in ( + # no option + [], + # single option + ['-B'], + ['-s'], + ['-S'], + ['-E'], + ['-v'], + ['-b'], + ['-q'], + ['-I'], + # same option multiple times + ['-bb'], + ['-vvv'], + # -W options + ['-Wignore'], + # -X options + ['-X', 'dev'], + ['-Wignore', '-X', 'dev'], + ['-X', 'faulthandler'], + ['-X', 'importtime'], + ['-X', 'showrefcount'], + ['-X', 'tracemalloc'], + ['-X', 'tracemalloc=3'], + ): + with self.subTest(opts=opts): + self.check_options(opts, 'args_from_interpreter_flags') + + self.check_options(['-I', '-E', '-s'], 'args_from_interpreter_flags', + ['-I']) + + def test_optim_args_from_interpreter_flags(self): + # Test test.support.optim_args_from_interpreter_flags() + for opts in ( + # no option + [], + ['-O'], + ['-OO'], + ['-OOOO'], + ): + with self.subTest(opts=opts): + self.check_options(opts, 'optim_args_from_interpreter_flags') + + def test_match_test(self): + class Test: + def __init__(self, test_id): + self.test_id = test_id + + def id(self): + return self.test_id + + test_access = Test('test.test_os.FileTests.test_access') + test_chdir = Test('test.test_os.Win32ErrorTests.test_chdir') + + # Test acceptance + with support.swap_attr(support, '_match_test_func', None): + # match all + support.set_match_tests([]) + self.assertTrue(support.match_test(test_access)) + self.assertTrue(support.match_test(test_chdir)) + + # match all using None + support.set_match_tests(None, None) + self.assertTrue(support.match_test(test_access)) + self.assertTrue(support.match_test(test_chdir)) + + # match the full test identifier + support.set_match_tests([test_access.id()], None) + self.assertTrue(support.match_test(test_access)) + self.assertFalse(support.match_test(test_chdir)) + + # match the module name + support.set_match_tests(['test_os'], None) + self.assertTrue(support.match_test(test_access)) + self.assertTrue(support.match_test(test_chdir)) + + # Test '*' pattern + support.set_match_tests(['test_*'], None) + self.assertTrue(support.match_test(test_access)) + self.assertTrue(support.match_test(test_chdir)) + + # Test case sensitivity + support.set_match_tests(['filetests'], None) + self.assertFalse(support.match_test(test_access)) + support.set_match_tests(['FileTests'], None) + self.assertTrue(support.match_test(test_access)) + + # Test pattern containing '.' and a '*' metacharacter + support.set_match_tests(['*test_os.*.test_*'], None) + self.assertTrue(support.match_test(test_access)) + self.assertTrue(support.match_test(test_chdir)) + + # Multiple patterns + support.set_match_tests([test_access.id(), test_chdir.id()], None) + self.assertTrue(support.match_test(test_access)) + self.assertTrue(support.match_test(test_chdir)) + + support.set_match_tests(['test_access', 'DONTMATCH'], None) + self.assertTrue(support.match_test(test_access)) + self.assertFalse(support.match_test(test_chdir)) + + # Test rejection + with support.swap_attr(support, '_match_test_func', None): + # match all + support.set_match_tests(ignore_patterns=[]) + self.assertTrue(support.match_test(test_access)) + self.assertTrue(support.match_test(test_chdir)) + + # match all using None + support.set_match_tests(None, None) + self.assertTrue(support.match_test(test_access)) + self.assertTrue(support.match_test(test_chdir)) + + # match the full test identifier + support.set_match_tests(None, [test_access.id()]) + self.assertFalse(support.match_test(test_access)) + self.assertTrue(support.match_test(test_chdir)) + + # match the module name + support.set_match_tests(None, ['test_os']) + self.assertFalse(support.match_test(test_access)) + self.assertFalse(support.match_test(test_chdir)) + + # Test '*' pattern + support.set_match_tests(None, ['test_*']) + self.assertFalse(support.match_test(test_access)) + self.assertFalse(support.match_test(test_chdir)) + + # Test case sensitivity + support.set_match_tests(None, ['filetests']) + self.assertTrue(support.match_test(test_access)) + support.set_match_tests(None, ['FileTests']) + self.assertFalse(support.match_test(test_access)) + + # Test pattern containing '.' and a '*' metacharacter + support.set_match_tests(None, ['*test_os.*.test_*']) + self.assertFalse(support.match_test(test_access)) + self.assertFalse(support.match_test(test_chdir)) + + # Multiple patterns + support.set_match_tests(None, [test_access.id(), test_chdir.id()]) + self.assertFalse(support.match_test(test_access)) + self.assertFalse(support.match_test(test_chdir)) + + support.set_match_tests(None, ['test_access', 'DONTMATCH']) + self.assertFalse(support.match_test(test_access)) + self.assertTrue(support.match_test(test_chdir)) + + def test_fd_count(self): + # We cannot test the absolute value of fd_count(): on old Linux + # kernel or glibc versions, os.urandom() keeps a FD open on + # /dev/urandom device and Python has 4 FD opens instead of 3. + start = os_helper.fd_count() + fd = os.open(__file__, os.O_RDONLY) + try: + more = os_helper.fd_count() + finally: + os.close(fd) + self.assertEqual(more - start, 1) + + def check_print_warning(self, msg, expected): + stderr = io.StringIO() + + old_stderr = sys.__stderr__ + try: + sys.__stderr__ = stderr + support.print_warning(msg) + finally: + sys.__stderr__ = old_stderr + + self.assertEqual(stderr.getvalue(), expected) + + def test_print_warning(self): + self.check_print_warning("msg", + "Warning -- msg\n") + self.check_print_warning("a\nb", + 'Warning -- a\nWarning -- b\n') + + # XXX -follows a list of untested API + # make_legacy_pyc + # is_resource_enabled + # requires + # fcmp + # umaks + # findfile + # check_warnings + # EnvironmentVarGuard + # transient_internet + # run_with_locale + # set_memlimit + # bigmemtest + # precisionbigmemtest + # bigaddrspacetest + # requires_resource + # run_doctest + # threading_cleanup + # reap_threads + # can_symlink + # skip_unless_symlink + # SuppressCrashReport + + +if __name__ == '__main__': + unittest.main() diff --git a/miniconda3/envs/active_proaction/lib/python3.10/tkinter/__init__.py b/miniconda3/envs/active_proaction/lib/python3.10/tkinter/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..7b8dc7bdcd8c7b5b2138aba164ceb3da721ffeda --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/tkinter/__init__.py @@ -0,0 +1,4621 @@ +"""Wrapper functions for Tcl/Tk. + +Tkinter provides classes which allow the display, positioning and +control of widgets. Toplevel widgets are Tk and Toplevel. Other +widgets are Frame, Label, Entry, Text, Canvas, Button, Radiobutton, +Checkbutton, Scale, Listbox, Scrollbar, OptionMenu, Spinbox +LabelFrame and PanedWindow. + +Properties of the widgets are specified with keyword arguments. +Keyword arguments have the same name as the corresponding resource +under Tk. + +Widgets are positioned with one of the geometry managers Place, Pack +or Grid. These managers can be called with methods place, pack, grid +available in every Widget. + +Actions are bound to events by resources (e.g. keyword argument +command) or with the method bind. + +Example (Hello, World): +import tkinter +from tkinter.constants import * +tk = tkinter.Tk() +frame = tkinter.Frame(tk, relief=RIDGE, borderwidth=2) +frame.pack(fill=BOTH,expand=1) +label = tkinter.Label(frame, text="Hello, World") +label.pack(fill=X, expand=1) +button = tkinter.Button(frame,text="Exit",command=tk.destroy) +button.pack(side=BOTTOM) +tk.mainloop() +""" + +import enum +import sys +import types + +import _tkinter # If this fails your Python may not be configured for Tk +TclError = _tkinter.TclError +from tkinter.constants import * +import re + +wantobjects = 1 + +TkVersion = float(_tkinter.TK_VERSION) +TclVersion = float(_tkinter.TCL_VERSION) + +READABLE = _tkinter.READABLE +WRITABLE = _tkinter.WRITABLE +EXCEPTION = _tkinter.EXCEPTION + + +_magic_re = re.compile(r'([\\{}])') +_space_re = re.compile(r'([\s])', re.ASCII) + + +def _join(value): + """Internal function.""" + return ' '.join(map(_stringify, value)) + + +def _stringify(value): + """Internal function.""" + if isinstance(value, (list, tuple)): + if len(value) == 1: + value = _stringify(value[0]) + if _magic_re.search(value): + value = '{%s}' % value + else: + value = '{%s}' % _join(value) + else: + value = str(value) + if not value: + value = '{}' + elif _magic_re.search(value): + # add '\' before special characters and spaces + value = _magic_re.sub(r'\\\1', value) + value = value.replace('\n', r'\n') + value = _space_re.sub(r'\\\1', value) + if value[0] == '"': + value = '\\' + value + elif value[0] == '"' or _space_re.search(value): + value = '{%s}' % value + return value + + +def _flatten(seq): + """Internal function.""" + res = () + for item in seq: + if isinstance(item, (tuple, list)): + res = res + _flatten(item) + elif item is not None: + res = res + (item,) + return res + + +try: _flatten = _tkinter._flatten +except AttributeError: pass + + +def _cnfmerge(cnfs): + """Internal function.""" + if isinstance(cnfs, dict): + return cnfs + elif isinstance(cnfs, (type(None), str)): + return cnfs + else: + cnf = {} + for c in _flatten(cnfs): + try: + cnf.update(c) + except (AttributeError, TypeError) as msg: + print("_cnfmerge: fallback due to:", msg) + for k, v in c.items(): + cnf[k] = v + return cnf + + +try: _cnfmerge = _tkinter._cnfmerge +except AttributeError: pass + + +def _splitdict(tk, v, cut_minus=True, conv=None): + """Return a properly formatted dict built from Tcl list pairs. + + If cut_minus is True, the supposed '-' prefix will be removed from + keys. If conv is specified, it is used to convert values. + + Tcl list is expected to contain an even number of elements. + """ + t = tk.splitlist(v) + if len(t) % 2: + raise RuntimeError('Tcl list representing a dict is expected ' + 'to contain an even number of elements') + it = iter(t) + dict = {} + for key, value in zip(it, it): + key = str(key) + if cut_minus and key[0] == '-': + key = key[1:] + if conv: + value = conv(value) + dict[key] = value + return dict + + +class EventType(str, enum.Enum): + KeyPress = '2' + Key = KeyPress + KeyRelease = '3' + ButtonPress = '4' + Button = ButtonPress + ButtonRelease = '5' + Motion = '6' + Enter = '7' + Leave = '8' + FocusIn = '9' + FocusOut = '10' + Keymap = '11' # undocumented + Expose = '12' + GraphicsExpose = '13' # undocumented + NoExpose = '14' # undocumented + Visibility = '15' + Create = '16' + Destroy = '17' + Unmap = '18' + Map = '19' + MapRequest = '20' + Reparent = '21' + Configure = '22' + ConfigureRequest = '23' + Gravity = '24' + ResizeRequest = '25' + Circulate = '26' + CirculateRequest = '27' + Property = '28' + SelectionClear = '29' # undocumented + SelectionRequest = '30' # undocumented + Selection = '31' # undocumented + Colormap = '32' + ClientMessage = '33' # undocumented + Mapping = '34' # undocumented + VirtualEvent = '35' # undocumented + Activate = '36' + Deactivate = '37' + MouseWheel = '38' + + __str__ = str.__str__ + + +class Event: + """Container for the properties of an event. + + Instances of this type are generated if one of the following events occurs: + + KeyPress, KeyRelease - for keyboard events + ButtonPress, ButtonRelease, Motion, Enter, Leave, MouseWheel - for mouse events + Visibility, Unmap, Map, Expose, FocusIn, FocusOut, Circulate, + Colormap, Gravity, Reparent, Property, Destroy, Activate, + Deactivate - for window events. + + If a callback function for one of these events is registered + using bind, bind_all, bind_class, or tag_bind, the callback is + called with an Event as first argument. It will have the + following attributes (in braces are the event types for which + the attribute is valid): + + serial - serial number of event + num - mouse button pressed (ButtonPress, ButtonRelease) + focus - whether the window has the focus (Enter, Leave) + height - height of the exposed window (Configure, Expose) + width - width of the exposed window (Configure, Expose) + keycode - keycode of the pressed key (KeyPress, KeyRelease) + state - state of the event as a number (ButtonPress, ButtonRelease, + Enter, KeyPress, KeyRelease, + Leave, Motion) + state - state as a string (Visibility) + time - when the event occurred + x - x-position of the mouse + y - y-position of the mouse + x_root - x-position of the mouse on the screen + (ButtonPress, ButtonRelease, KeyPress, KeyRelease, Motion) + y_root - y-position of the mouse on the screen + (ButtonPress, ButtonRelease, KeyPress, KeyRelease, Motion) + char - pressed character (KeyPress, KeyRelease) + send_event - see X/Windows documentation + keysym - keysym of the event as a string (KeyPress, KeyRelease) + keysym_num - keysym of the event as a number (KeyPress, KeyRelease) + type - type of the event as a number + widget - widget in which the event occurred + delta - delta of wheel movement (MouseWheel) + """ + + def __repr__(self): + attrs = {k: v for k, v in self.__dict__.items() if v != '??'} + if not self.char: + del attrs['char'] + elif self.char != '??': + attrs['char'] = repr(self.char) + if not getattr(self, 'send_event', True): + del attrs['send_event'] + if self.state == 0: + del attrs['state'] + elif isinstance(self.state, int): + state = self.state + mods = ('Shift', 'Lock', 'Control', + 'Mod1', 'Mod2', 'Mod3', 'Mod4', 'Mod5', + 'Button1', 'Button2', 'Button3', 'Button4', 'Button5') + s = [] + for i, n in enumerate(mods): + if state & (1 << i): + s.append(n) + state = state & ~((1<< len(mods)) - 1) + if state or not s: + s.append(hex(state)) + attrs['state'] = '|'.join(s) + if self.delta == 0: + del attrs['delta'] + # widget usually is known + # serial and time are not very interesting + # keysym_num duplicates keysym + # x_root and y_root mostly duplicate x and y + keys = ('send_event', + 'state', 'keysym', 'keycode', 'char', + 'num', 'delta', 'focus', + 'x', 'y', 'width', 'height') + return '<%s event%s>' % ( + getattr(self.type, 'name', self.type), + ''.join(' %s=%s' % (k, attrs[k]) for k in keys if k in attrs) + ) + + +_support_default_root = True +_default_root = None + + +def NoDefaultRoot(): + """Inhibit setting of default root window. + + Call this function to inhibit that the first instance of + Tk is used for windows without an explicit parent window. + """ + global _support_default_root, _default_root + _support_default_root = False + # Delete, so any use of _default_root will immediately raise an exception. + # Rebind before deletion, so repeated calls will not fail. + _default_root = None + del _default_root + + +def _get_default_root(what=None): + if not _support_default_root: + raise RuntimeError("No master specified and tkinter is " + "configured to not support default root") + if _default_root is None: + if what: + raise RuntimeError(f"Too early to {what}: no default root window") + root = Tk() + assert _default_root is root + return _default_root + + +def _get_temp_root(): + global _support_default_root + if not _support_default_root: + raise RuntimeError("No master specified and tkinter is " + "configured to not support default root") + root = _default_root + if root is None: + assert _support_default_root + _support_default_root = False + root = Tk() + _support_default_root = True + assert _default_root is None + root.withdraw() + root._temporary = True + return root + + +def _destroy_temp_root(master): + if getattr(master, '_temporary', False): + try: + master.destroy() + except TclError: + pass + + +def _tkerror(err): + """Internal function.""" + pass + + +def _exit(code=0): + """Internal function. Calling it will raise the exception SystemExit.""" + try: + code = int(code) + except ValueError: + pass + raise SystemExit(code) + + +_varnum = 0 + + +class Variable: + """Class to define value holders for e.g. buttons. + + Subclasses StringVar, IntVar, DoubleVar, BooleanVar are specializations + that constrain the type of the value returned from get().""" + _default = "" + _tk = None + _tclCommands = None + + def __init__(self, master=None, value=None, name=None): + """Construct a variable + + MASTER can be given as master widget. + VALUE is an optional value (defaults to "") + NAME is an optional Tcl name (defaults to PY_VARnum). + + If NAME matches an existing variable and VALUE is omitted + then the existing value is retained. + """ + # check for type of NAME parameter to override weird error message + # raised from Modules/_tkinter.c:SetVar like: + # TypeError: setvar() takes exactly 3 arguments (2 given) + if name is not None and not isinstance(name, str): + raise TypeError("name must be a string") + global _varnum + if master is None: + master = _get_default_root('create variable') + self._root = master._root() + self._tk = master.tk + if name: + self._name = name + else: + self._name = 'PY_VAR' + repr(_varnum) + _varnum += 1 + if value is not None: + self.initialize(value) + elif not self._tk.getboolean(self._tk.call("info", "exists", self._name)): + self.initialize(self._default) + + def __del__(self): + """Unset the variable in Tcl.""" + if self._tk is None: + return + if self._tk.getboolean(self._tk.call("info", "exists", self._name)): + self._tk.globalunsetvar(self._name) + if self._tclCommands is not None: + for name in self._tclCommands: + #print '- Tkinter: deleted command', name + self._tk.deletecommand(name) + self._tclCommands = None + + def __str__(self): + """Return the name of the variable in Tcl.""" + return self._name + + def set(self, value): + """Set the variable to VALUE.""" + return self._tk.globalsetvar(self._name, value) + + initialize = set + + def get(self): + """Return value of variable.""" + return self._tk.globalgetvar(self._name) + + def _register(self, callback): + f = CallWrapper(callback, None, self._root).__call__ + cbname = repr(id(f)) + try: + callback = callback.__func__ + except AttributeError: + pass + try: + cbname = cbname + callback.__name__ + except AttributeError: + pass + self._tk.createcommand(cbname, f) + if self._tclCommands is None: + self._tclCommands = [] + self._tclCommands.append(cbname) + return cbname + + def trace_add(self, mode, callback): + """Define a trace callback for the variable. + + Mode is one of "read", "write", "unset", or a list or tuple of + such strings. + Callback must be a function which is called when the variable is + read, written or unset. + + Return the name of the callback. + """ + cbname = self._register(callback) + self._tk.call('trace', 'add', 'variable', + self._name, mode, (cbname,)) + return cbname + + def trace_remove(self, mode, cbname): + """Delete the trace callback for a variable. + + Mode is one of "read", "write", "unset" or a list or tuple of + such strings. Must be same as were specified in trace_add(). + cbname is the name of the callback returned from trace_add(). + """ + self._tk.call('trace', 'remove', 'variable', + self._name, mode, cbname) + for m, ca in self.trace_info(): + if self._tk.splitlist(ca)[0] == cbname: + break + else: + self._tk.deletecommand(cbname) + try: + self._tclCommands.remove(cbname) + except ValueError: + pass + + def trace_info(self): + """Return all trace callback information.""" + splitlist = self._tk.splitlist + return [(splitlist(k), v) for k, v in map(splitlist, + splitlist(self._tk.call('trace', 'info', 'variable', self._name)))] + + def trace_variable(self, mode, callback): + """Define a trace callback for the variable. + + MODE is one of "r", "w", "u" for read, write, undefine. + CALLBACK must be a function which is called when + the variable is read, written or undefined. + + Return the name of the callback. + + This deprecated method wraps a deprecated Tcl method that will + likely be removed in the future. Use trace_add() instead. + """ + # TODO: Add deprecation warning + cbname = self._register(callback) + self._tk.call("trace", "variable", self._name, mode, cbname) + return cbname + + trace = trace_variable + + def trace_vdelete(self, mode, cbname): + """Delete the trace callback for a variable. + + MODE is one of "r", "w", "u" for read, write, undefine. + CBNAME is the name of the callback returned from trace_variable or trace. + + This deprecated method wraps a deprecated Tcl method that will + likely be removed in the future. Use trace_remove() instead. + """ + # TODO: Add deprecation warning + self._tk.call("trace", "vdelete", self._name, mode, cbname) + cbname = self._tk.splitlist(cbname)[0] + for m, ca in self.trace_info(): + if self._tk.splitlist(ca)[0] == cbname: + break + else: + self._tk.deletecommand(cbname) + try: + self._tclCommands.remove(cbname) + except ValueError: + pass + + def trace_vinfo(self): + """Return all trace callback information. + + This deprecated method wraps a deprecated Tcl method that will + likely be removed in the future. Use trace_info() instead. + """ + # TODO: Add deprecation warning + return [self._tk.splitlist(x) for x in self._tk.splitlist( + self._tk.call("trace", "vinfo", self._name))] + + def __eq__(self, other): + if not isinstance(other, Variable): + return NotImplemented + return (self._name == other._name + and self.__class__.__name__ == other.__class__.__name__ + and self._tk == other._tk) + + +class StringVar(Variable): + """Value holder for strings variables.""" + _default = "" + + def __init__(self, master=None, value=None, name=None): + """Construct a string variable. + + MASTER can be given as master widget. + VALUE is an optional value (defaults to "") + NAME is an optional Tcl name (defaults to PY_VARnum). + + If NAME matches an existing variable and VALUE is omitted + then the existing value is retained. + """ + Variable.__init__(self, master, value, name) + + def get(self): + """Return value of variable as string.""" + value = self._tk.globalgetvar(self._name) + if isinstance(value, str): + return value + return str(value) + + +class IntVar(Variable): + """Value holder for integer variables.""" + _default = 0 + + def __init__(self, master=None, value=None, name=None): + """Construct an integer variable. + + MASTER can be given as master widget. + VALUE is an optional value (defaults to 0) + NAME is an optional Tcl name (defaults to PY_VARnum). + + If NAME matches an existing variable and VALUE is omitted + then the existing value is retained. + """ + Variable.__init__(self, master, value, name) + + def get(self): + """Return the value of the variable as an integer.""" + value = self._tk.globalgetvar(self._name) + try: + return self._tk.getint(value) + except (TypeError, TclError): + return int(self._tk.getdouble(value)) + + +class DoubleVar(Variable): + """Value holder for float variables.""" + _default = 0.0 + + def __init__(self, master=None, value=None, name=None): + """Construct a float variable. + + MASTER can be given as master widget. + VALUE is an optional value (defaults to 0.0) + NAME is an optional Tcl name (defaults to PY_VARnum). + + If NAME matches an existing variable and VALUE is omitted + then the existing value is retained. + """ + Variable.__init__(self, master, value, name) + + def get(self): + """Return the value of the variable as a float.""" + return self._tk.getdouble(self._tk.globalgetvar(self._name)) + + +class BooleanVar(Variable): + """Value holder for boolean variables.""" + _default = False + + def __init__(self, master=None, value=None, name=None): + """Construct a boolean variable. + + MASTER can be given as master widget. + VALUE is an optional value (defaults to False) + NAME is an optional Tcl name (defaults to PY_VARnum). + + If NAME matches an existing variable and VALUE is omitted + then the existing value is retained. + """ + Variable.__init__(self, master, value, name) + + def set(self, value): + """Set the variable to VALUE.""" + return self._tk.globalsetvar(self._name, self._tk.getboolean(value)) + + initialize = set + + def get(self): + """Return the value of the variable as a bool.""" + try: + return self._tk.getboolean(self._tk.globalgetvar(self._name)) + except TclError: + raise ValueError("invalid literal for getboolean()") + + +def mainloop(n=0): + """Run the main loop of Tcl.""" + _get_default_root('run the main loop').tk.mainloop(n) + + +getint = int + +getdouble = float + + +def getboolean(s): + """Convert Tcl object to True or False.""" + try: + return _get_default_root('use getboolean()').tk.getboolean(s) + except TclError: + raise ValueError("invalid literal for getboolean()") + + +# Methods defined on both toplevel and interior widgets + +class Misc: + """Internal class. + + Base class which defines methods common for interior widgets.""" + + # used for generating child widget names + _last_child_ids = None + + # XXX font command? + _tclCommands = None + + def destroy(self): + """Internal function. + + Delete all Tcl commands created for + this widget in the Tcl interpreter.""" + if self._tclCommands is not None: + for name in self._tclCommands: + #print '- Tkinter: deleted command', name + self.tk.deletecommand(name) + self._tclCommands = None + + def deletecommand(self, name): + """Internal function. + + Delete the Tcl command provided in NAME.""" + #print '- Tkinter: deleted command', name + self.tk.deletecommand(name) + try: + self._tclCommands.remove(name) + except ValueError: + pass + + def tk_strictMotif(self, boolean=None): + """Set Tcl internal variable, whether the look and feel + should adhere to Motif. + + A parameter of 1 means adhere to Motif (e.g. no color + change if mouse passes over slider). + Returns the set value.""" + return self.tk.getboolean(self.tk.call( + 'set', 'tk_strictMotif', boolean)) + + def tk_bisque(self): + """Change the color scheme to light brown as used in Tk 3.6 and before.""" + self.tk.call('tk_bisque') + + def tk_setPalette(self, *args, **kw): + """Set a new color scheme for all widget elements. + + A single color as argument will cause that all colors of Tk + widget elements are derived from this. + Alternatively several keyword parameters and its associated + colors can be given. The following keywords are valid: + activeBackground, foreground, selectColor, + activeForeground, highlightBackground, selectBackground, + background, highlightColor, selectForeground, + disabledForeground, insertBackground, troughColor.""" + self.tk.call(('tk_setPalette',) + + _flatten(args) + _flatten(list(kw.items()))) + + def wait_variable(self, name='PY_VAR'): + """Wait until the variable is modified. + + A parameter of type IntVar, StringVar, DoubleVar or + BooleanVar must be given.""" + self.tk.call('tkwait', 'variable', name) + waitvar = wait_variable # XXX b/w compat + + def wait_window(self, window=None): + """Wait until a WIDGET is destroyed. + + If no parameter is given self is used.""" + if window is None: + window = self + self.tk.call('tkwait', 'window', window._w) + + def wait_visibility(self, window=None): + """Wait until the visibility of a WIDGET changes + (e.g. it appears). + + If no parameter is given self is used.""" + if window is None: + window = self + self.tk.call('tkwait', 'visibility', window._w) + + def setvar(self, name='PY_VAR', value='1'): + """Set Tcl variable NAME to VALUE.""" + self.tk.setvar(name, value) + + def getvar(self, name='PY_VAR'): + """Return value of Tcl variable NAME.""" + return self.tk.getvar(name) + + def getint(self, s): + try: + return self.tk.getint(s) + except TclError as exc: + raise ValueError(str(exc)) + + def getdouble(self, s): + try: + return self.tk.getdouble(s) + except TclError as exc: + raise ValueError(str(exc)) + + def getboolean(self, s): + """Return a boolean value for Tcl boolean values true and false given as parameter.""" + try: + return self.tk.getboolean(s) + except TclError: + raise ValueError("invalid literal for getboolean()") + + def focus_set(self): + """Direct input focus to this widget. + + If the application currently does not have the focus + this widget will get the focus if the application gets + the focus through the window manager.""" + self.tk.call('focus', self._w) + focus = focus_set # XXX b/w compat? + + def focus_force(self): + """Direct input focus to this widget even if the + application does not have the focus. Use with + caution!""" + self.tk.call('focus', '-force', self._w) + + def focus_get(self): + """Return the widget which has currently the focus in the + application. + + Use focus_displayof to allow working with several + displays. Return None if application does not have + the focus.""" + name = self.tk.call('focus') + if name == 'none' or not name: return None + return self._nametowidget(name) + + def focus_displayof(self): + """Return the widget which has currently the focus on the + display where this widget is located. + + Return None if the application does not have the focus.""" + name = self.tk.call('focus', '-displayof', self._w) + if name == 'none' or not name: return None + return self._nametowidget(name) + + def focus_lastfor(self): + """Return the widget which would have the focus if top level + for this widget gets the focus from the window manager.""" + name = self.tk.call('focus', '-lastfor', self._w) + if name == 'none' or not name: return None + return self._nametowidget(name) + + def tk_focusFollowsMouse(self): + """The widget under mouse will get automatically focus. Can not + be disabled easily.""" + self.tk.call('tk_focusFollowsMouse') + + def tk_focusNext(self): + """Return the next widget in the focus order which follows + widget which has currently the focus. + + The focus order first goes to the next child, then to + the children of the child recursively and then to the + next sibling which is higher in the stacking order. A + widget is omitted if it has the takefocus resource set + to 0.""" + name = self.tk.call('tk_focusNext', self._w) + if not name: return None + return self._nametowidget(name) + + def tk_focusPrev(self): + """Return previous widget in the focus order. See tk_focusNext for details.""" + name = self.tk.call('tk_focusPrev', self._w) + if not name: return None + return self._nametowidget(name) + + def after(self, ms, func=None, *args): + """Call function once after given time. + + MS specifies the time in milliseconds. FUNC gives the + function which shall be called. Additional parameters + are given as parameters to the function call. Return + identifier to cancel scheduling with after_cancel.""" + if func is None: + # I'd rather use time.sleep(ms*0.001) + self.tk.call('after', ms) + return None + else: + def callit(): + try: + func(*args) + finally: + try: + self.deletecommand(name) + except TclError: + pass + try: + callit.__name__ = func.__name__ + except AttributeError: + # Required for callable classes (bpo-44404) + callit.__name__ = type(func).__name__ + name = self._register(callit) + return self.tk.call('after', ms, name) + + def after_idle(self, func, *args): + """Call FUNC once if the Tcl main loop has no event to + process. + + Return an identifier to cancel the scheduling with + after_cancel.""" + return self.after('idle', func, *args) + + def after_cancel(self, id): + """Cancel scheduling of function identified with ID. + + Identifier returned by after or after_idle must be + given as first parameter. + """ + if not id: + raise ValueError('id must be a valid identifier returned from ' + 'after or after_idle') + try: + data = self.tk.call('after', 'info', id) + script = self.tk.splitlist(data)[0] + self.deletecommand(script) + except TclError: + pass + self.tk.call('after', 'cancel', id) + + def bell(self, displayof=0): + """Ring a display's bell.""" + self.tk.call(('bell',) + self._displayof(displayof)) + + # Clipboard handling: + def clipboard_get(self, **kw): + """Retrieve data from the clipboard on window's display. + + The window keyword defaults to the root window of the Tkinter + application. + + The type keyword specifies the form in which the data is + to be returned and should be an atom name such as STRING + or FILE_NAME. Type defaults to STRING, except on X11, where the default + is to try UTF8_STRING and fall back to STRING. + + This command is equivalent to: + + selection_get(CLIPBOARD) + """ + if 'type' not in kw and self._windowingsystem == 'x11': + try: + kw['type'] = 'UTF8_STRING' + return self.tk.call(('clipboard', 'get') + self._options(kw)) + except TclError: + del kw['type'] + return self.tk.call(('clipboard', 'get') + self._options(kw)) + + def clipboard_clear(self, **kw): + """Clear the data in the Tk clipboard. + + A widget specified for the optional displayof keyword + argument specifies the target display.""" + if 'displayof' not in kw: kw['displayof'] = self._w + self.tk.call(('clipboard', 'clear') + self._options(kw)) + + def clipboard_append(self, string, **kw): + """Append STRING to the Tk clipboard. + + A widget specified at the optional displayof keyword + argument specifies the target display. The clipboard + can be retrieved with selection_get.""" + if 'displayof' not in kw: kw['displayof'] = self._w + self.tk.call(('clipboard', 'append') + self._options(kw) + + ('--', string)) + # XXX grab current w/o window argument + + def grab_current(self): + """Return widget which has currently the grab in this application + or None.""" + name = self.tk.call('grab', 'current', self._w) + if not name: return None + return self._nametowidget(name) + + def grab_release(self): + """Release grab for this widget if currently set.""" + self.tk.call('grab', 'release', self._w) + + def grab_set(self): + """Set grab for this widget. + + A grab directs all events to this and descendant + widgets in the application.""" + self.tk.call('grab', 'set', self._w) + + def grab_set_global(self): + """Set global grab for this widget. + + A global grab directs all events to this and + descendant widgets on the display. Use with caution - + other applications do not get events anymore.""" + self.tk.call('grab', 'set', '-global', self._w) + + def grab_status(self): + """Return None, "local" or "global" if this widget has + no, a local or a global grab.""" + status = self.tk.call('grab', 'status', self._w) + if status == 'none': status = None + return status + + def option_add(self, pattern, value, priority = None): + """Set a VALUE (second parameter) for an option + PATTERN (first parameter). + + An optional third parameter gives the numeric priority + (defaults to 80).""" + self.tk.call('option', 'add', pattern, value, priority) + + def option_clear(self): + """Clear the option database. + + It will be reloaded if option_add is called.""" + self.tk.call('option', 'clear') + + def option_get(self, name, className): + """Return the value for an option NAME for this widget + with CLASSNAME. + + Values with higher priority override lower values.""" + return self.tk.call('option', 'get', self._w, name, className) + + def option_readfile(self, fileName, priority = None): + """Read file FILENAME into the option database. + + An optional second parameter gives the numeric + priority.""" + self.tk.call('option', 'readfile', fileName, priority) + + def selection_clear(self, **kw): + """Clear the current X selection.""" + if 'displayof' not in kw: kw['displayof'] = self._w + self.tk.call(('selection', 'clear') + self._options(kw)) + + def selection_get(self, **kw): + """Return the contents of the current X selection. + + A keyword parameter selection specifies the name of + the selection and defaults to PRIMARY. A keyword + parameter displayof specifies a widget on the display + to use. A keyword parameter type specifies the form of data to be + fetched, defaulting to STRING except on X11, where UTF8_STRING is tried + before STRING.""" + if 'displayof' not in kw: kw['displayof'] = self._w + if 'type' not in kw and self._windowingsystem == 'x11': + try: + kw['type'] = 'UTF8_STRING' + return self.tk.call(('selection', 'get') + self._options(kw)) + except TclError: + del kw['type'] + return self.tk.call(('selection', 'get') + self._options(kw)) + + def selection_handle(self, command, **kw): + """Specify a function COMMAND to call if the X + selection owned by this widget is queried by another + application. + + This function must return the contents of the + selection. The function will be called with the + arguments OFFSET and LENGTH which allows the chunking + of very long selections. The following keyword + parameters can be provided: + selection - name of the selection (default PRIMARY), + type - type of the selection (e.g. STRING, FILE_NAME).""" + name = self._register(command) + self.tk.call(('selection', 'handle') + self._options(kw) + + (self._w, name)) + + def selection_own(self, **kw): + """Become owner of X selection. + + A keyword parameter selection specifies the name of + the selection (default PRIMARY).""" + self.tk.call(('selection', 'own') + + self._options(kw) + (self._w,)) + + def selection_own_get(self, **kw): + """Return owner of X selection. + + The following keyword parameter can + be provided: + selection - name of the selection (default PRIMARY), + type - type of the selection (e.g. STRING, FILE_NAME).""" + if 'displayof' not in kw: kw['displayof'] = self._w + name = self.tk.call(('selection', 'own') + self._options(kw)) + if not name: return None + return self._nametowidget(name) + + def send(self, interp, cmd, *args): + """Send Tcl command CMD to different interpreter INTERP to be executed.""" + return self.tk.call(('send', interp, cmd) + args) + + def lower(self, belowThis=None): + """Lower this widget in the stacking order.""" + self.tk.call('lower', self._w, belowThis) + + def tkraise(self, aboveThis=None): + """Raise this widget in the stacking order.""" + self.tk.call('raise', self._w, aboveThis) + + lift = tkraise + + def winfo_atom(self, name, displayof=0): + """Return integer which represents atom NAME.""" + args = ('winfo', 'atom') + self._displayof(displayof) + (name,) + return self.tk.getint(self.tk.call(args)) + + def winfo_atomname(self, id, displayof=0): + """Return name of atom with identifier ID.""" + args = ('winfo', 'atomname') \ + + self._displayof(displayof) + (id,) + return self.tk.call(args) + + def winfo_cells(self): + """Return number of cells in the colormap for this widget.""" + return self.tk.getint( + self.tk.call('winfo', 'cells', self._w)) + + def winfo_children(self): + """Return a list of all widgets which are children of this widget.""" + result = [] + for child in self.tk.splitlist( + self.tk.call('winfo', 'children', self._w)): + try: + # Tcl sometimes returns extra windows, e.g. for + # menus; those need to be skipped + result.append(self._nametowidget(child)) + except KeyError: + pass + return result + + def winfo_class(self): + """Return window class name of this widget.""" + return self.tk.call('winfo', 'class', self._w) + + def winfo_colormapfull(self): + """Return True if at the last color request the colormap was full.""" + return self.tk.getboolean( + self.tk.call('winfo', 'colormapfull', self._w)) + + def winfo_containing(self, rootX, rootY, displayof=0): + """Return the widget which is at the root coordinates ROOTX, ROOTY.""" + args = ('winfo', 'containing') \ + + self._displayof(displayof) + (rootX, rootY) + name = self.tk.call(args) + if not name: return None + return self._nametowidget(name) + + def winfo_depth(self): + """Return the number of bits per pixel.""" + return self.tk.getint(self.tk.call('winfo', 'depth', self._w)) + + def winfo_exists(self): + """Return true if this widget exists.""" + return self.tk.getint( + self.tk.call('winfo', 'exists', self._w)) + + def winfo_fpixels(self, number): + """Return the number of pixels for the given distance NUMBER + (e.g. "3c") as float.""" + return self.tk.getdouble(self.tk.call( + 'winfo', 'fpixels', self._w, number)) + + def winfo_geometry(self): + """Return geometry string for this widget in the form "widthxheight+X+Y".""" + return self.tk.call('winfo', 'geometry', self._w) + + def winfo_height(self): + """Return height of this widget.""" + return self.tk.getint( + self.tk.call('winfo', 'height', self._w)) + + def winfo_id(self): + """Return identifier ID for this widget.""" + return int(self.tk.call('winfo', 'id', self._w), 0) + + def winfo_interps(self, displayof=0): + """Return the name of all Tcl interpreters for this display.""" + args = ('winfo', 'interps') + self._displayof(displayof) + return self.tk.splitlist(self.tk.call(args)) + + def winfo_ismapped(self): + """Return true if this widget is mapped.""" + return self.tk.getint( + self.tk.call('winfo', 'ismapped', self._w)) + + def winfo_manager(self): + """Return the window manager name for this widget.""" + return self.tk.call('winfo', 'manager', self._w) + + def winfo_name(self): + """Return the name of this widget.""" + return self.tk.call('winfo', 'name', self._w) + + def winfo_parent(self): + """Return the name of the parent of this widget.""" + return self.tk.call('winfo', 'parent', self._w) + + def winfo_pathname(self, id, displayof=0): + """Return the pathname of the widget given by ID.""" + args = ('winfo', 'pathname') \ + + self._displayof(displayof) + (id,) + return self.tk.call(args) + + def winfo_pixels(self, number): + """Rounded integer value of winfo_fpixels.""" + return self.tk.getint( + self.tk.call('winfo', 'pixels', self._w, number)) + + def winfo_pointerx(self): + """Return the x coordinate of the pointer on the root window.""" + return self.tk.getint( + self.tk.call('winfo', 'pointerx', self._w)) + + def winfo_pointerxy(self): + """Return a tuple of x and y coordinates of the pointer on the root window.""" + return self._getints( + self.tk.call('winfo', 'pointerxy', self._w)) + + def winfo_pointery(self): + """Return the y coordinate of the pointer on the root window.""" + return self.tk.getint( + self.tk.call('winfo', 'pointery', self._w)) + + def winfo_reqheight(self): + """Return requested height of this widget.""" + return self.tk.getint( + self.tk.call('winfo', 'reqheight', self._w)) + + def winfo_reqwidth(self): + """Return requested width of this widget.""" + return self.tk.getint( + self.tk.call('winfo', 'reqwidth', self._w)) + + def winfo_rgb(self, color): + """Return a tuple of integer RGB values in range(65536) for color in this widget.""" + return self._getints( + self.tk.call('winfo', 'rgb', self._w, color)) + + def winfo_rootx(self): + """Return x coordinate of upper left corner of this widget on the + root window.""" + return self.tk.getint( + self.tk.call('winfo', 'rootx', self._w)) + + def winfo_rooty(self): + """Return y coordinate of upper left corner of this widget on the + root window.""" + return self.tk.getint( + self.tk.call('winfo', 'rooty', self._w)) + + def winfo_screen(self): + """Return the screen name of this widget.""" + return self.tk.call('winfo', 'screen', self._w) + + def winfo_screencells(self): + """Return the number of the cells in the colormap of the screen + of this widget.""" + return self.tk.getint( + self.tk.call('winfo', 'screencells', self._w)) + + def winfo_screendepth(self): + """Return the number of bits per pixel of the root window of the + screen of this widget.""" + return self.tk.getint( + self.tk.call('winfo', 'screendepth', self._w)) + + def winfo_screenheight(self): + """Return the number of pixels of the height of the screen of this widget + in pixel.""" + return self.tk.getint( + self.tk.call('winfo', 'screenheight', self._w)) + + def winfo_screenmmheight(self): + """Return the number of pixels of the height of the screen of + this widget in mm.""" + return self.tk.getint( + self.tk.call('winfo', 'screenmmheight', self._w)) + + def winfo_screenmmwidth(self): + """Return the number of pixels of the width of the screen of + this widget in mm.""" + return self.tk.getint( + self.tk.call('winfo', 'screenmmwidth', self._w)) + + def winfo_screenvisual(self): + """Return one of the strings directcolor, grayscale, pseudocolor, + staticcolor, staticgray, or truecolor for the default + colormodel of this screen.""" + return self.tk.call('winfo', 'screenvisual', self._w) + + def winfo_screenwidth(self): + """Return the number of pixels of the width of the screen of + this widget in pixel.""" + return self.tk.getint( + self.tk.call('winfo', 'screenwidth', self._w)) + + def winfo_server(self): + """Return information of the X-Server of the screen of this widget in + the form "XmajorRminor vendor vendorVersion".""" + return self.tk.call('winfo', 'server', self._w) + + def winfo_toplevel(self): + """Return the toplevel widget of this widget.""" + return self._nametowidget(self.tk.call( + 'winfo', 'toplevel', self._w)) + + def winfo_viewable(self): + """Return true if the widget and all its higher ancestors are mapped.""" + return self.tk.getint( + self.tk.call('winfo', 'viewable', self._w)) + + def winfo_visual(self): + """Return one of the strings directcolor, grayscale, pseudocolor, + staticcolor, staticgray, or truecolor for the + colormodel of this widget.""" + return self.tk.call('winfo', 'visual', self._w) + + def winfo_visualid(self): + """Return the X identifier for the visual for this widget.""" + return self.tk.call('winfo', 'visualid', self._w) + + def winfo_visualsavailable(self, includeids=False): + """Return a list of all visuals available for the screen + of this widget. + + Each item in the list consists of a visual name (see winfo_visual), a + depth and if includeids is true is given also the X identifier.""" + data = self.tk.call('winfo', 'visualsavailable', self._w, + 'includeids' if includeids else None) + data = [self.tk.splitlist(x) for x in self.tk.splitlist(data)] + return [self.__winfo_parseitem(x) for x in data] + + def __winfo_parseitem(self, t): + """Internal function.""" + return t[:1] + tuple(map(self.__winfo_getint, t[1:])) + + def __winfo_getint(self, x): + """Internal function.""" + return int(x, 0) + + def winfo_vrootheight(self): + """Return the height of the virtual root window associated with this + widget in pixels. If there is no virtual root window return the + height of the screen.""" + return self.tk.getint( + self.tk.call('winfo', 'vrootheight', self._w)) + + def winfo_vrootwidth(self): + """Return the width of the virtual root window associated with this + widget in pixel. If there is no virtual root window return the + width of the screen.""" + return self.tk.getint( + self.tk.call('winfo', 'vrootwidth', self._w)) + + def winfo_vrootx(self): + """Return the x offset of the virtual root relative to the root + window of the screen of this widget.""" + return self.tk.getint( + self.tk.call('winfo', 'vrootx', self._w)) + + def winfo_vrooty(self): + """Return the y offset of the virtual root relative to the root + window of the screen of this widget.""" + return self.tk.getint( + self.tk.call('winfo', 'vrooty', self._w)) + + def winfo_width(self): + """Return the width of this widget.""" + return self.tk.getint( + self.tk.call('winfo', 'width', self._w)) + + def winfo_x(self): + """Return the x coordinate of the upper left corner of this widget + in the parent.""" + return self.tk.getint( + self.tk.call('winfo', 'x', self._w)) + + def winfo_y(self): + """Return the y coordinate of the upper left corner of this widget + in the parent.""" + return self.tk.getint( + self.tk.call('winfo', 'y', self._w)) + + def update(self): + """Enter event loop until all pending events have been processed by Tcl.""" + self.tk.call('update') + + def update_idletasks(self): + """Enter event loop until all idle callbacks have been called. This + will update the display of windows but not process events caused by + the user.""" + self.tk.call('update', 'idletasks') + + def bindtags(self, tagList=None): + """Set or get the list of bindtags for this widget. + + With no argument return the list of all bindtags associated with + this widget. With a list of strings as argument the bindtags are + set to this list. The bindtags determine in which order events are + processed (see bind).""" + if tagList is None: + return self.tk.splitlist( + self.tk.call('bindtags', self._w)) + else: + self.tk.call('bindtags', self._w, tagList) + + def _bind(self, what, sequence, func, add, needcleanup=1): + """Internal function.""" + if isinstance(func, str): + self.tk.call(what + (sequence, func)) + elif func: + funcid = self._register(func, self._substitute, + needcleanup) + cmd = ('%sif {"[%s %s]" == "break"} break\n' + % + (add and '+' or '', + funcid, self._subst_format_str)) + self.tk.call(what + (sequence, cmd)) + return funcid + elif sequence: + return self.tk.call(what + (sequence,)) + else: + return self.tk.splitlist(self.tk.call(what)) + + def bind(self, sequence=None, func=None, add=None): + """Bind to this widget at event SEQUENCE a call to function FUNC. + + SEQUENCE is a string of concatenated event + patterns. An event pattern is of the form + where MODIFIER is one + of Control, Mod2, M2, Shift, Mod3, M3, Lock, Mod4, M4, + Button1, B1, Mod5, M5 Button2, B2, Meta, M, Button3, + B3, Alt, Button4, B4, Double, Button5, B5 Triple, + Mod1, M1. TYPE is one of Activate, Enter, Map, + ButtonPress, Button, Expose, Motion, ButtonRelease + FocusIn, MouseWheel, Circulate, FocusOut, Property, + Colormap, Gravity Reparent, Configure, KeyPress, Key, + Unmap, Deactivate, KeyRelease Visibility, Destroy, + Leave and DETAIL is the button number for ButtonPress, + ButtonRelease and DETAIL is the Keysym for KeyPress and + KeyRelease. Examples are + for pressing Control and mouse button 1 or + for pressing A and the Alt key (KeyPress can be omitted). + An event pattern can also be a virtual event of the form + <> where AString can be arbitrary. This + event can be generated by event_generate. + If events are concatenated they must appear shortly + after each other. + + FUNC will be called if the event sequence occurs with an + instance of Event as argument. If the return value of FUNC is + "break" no further bound function is invoked. + + An additional boolean parameter ADD specifies whether FUNC will + be called additionally to the other bound function or whether + it will replace the previous function. + + Bind will return an identifier to allow deletion of the bound function with + unbind without memory leak. + + If FUNC or SEQUENCE is omitted the bound function or list + of bound events are returned.""" + + return self._bind(('bind', self._w), sequence, func, add) + + def unbind(self, sequence, funcid=None): + """Unbind for this widget for event SEQUENCE the + function identified with FUNCID.""" + self.tk.call('bind', self._w, sequence, '') + if funcid: + self.deletecommand(funcid) + + def bind_all(self, sequence=None, func=None, add=None): + """Bind to all widgets at an event SEQUENCE a call to function FUNC. + An additional boolean parameter ADD specifies whether FUNC will + be called additionally to the other bound function or whether + it will replace the previous function. See bind for the return value.""" + return self._bind(('bind', 'all'), sequence, func, add, 0) + + def unbind_all(self, sequence): + """Unbind for all widgets for event SEQUENCE all functions.""" + self.tk.call('bind', 'all' , sequence, '') + + def bind_class(self, className, sequence=None, func=None, add=None): + """Bind to widgets with bindtag CLASSNAME at event + SEQUENCE a call of function FUNC. An additional + boolean parameter ADD specifies whether FUNC will be + called additionally to the other bound function or + whether it will replace the previous function. See bind for + the return value.""" + + return self._bind(('bind', className), sequence, func, add, 0) + + def unbind_class(self, className, sequence): + """Unbind for all widgets with bindtag CLASSNAME for event SEQUENCE + all functions.""" + self.tk.call('bind', className , sequence, '') + + def mainloop(self, n=0): + """Call the mainloop of Tk.""" + self.tk.mainloop(n) + + def quit(self): + """Quit the Tcl interpreter. All widgets will be destroyed.""" + self.tk.quit() + + def _getints(self, string): + """Internal function.""" + if string: + return tuple(map(self.tk.getint, self.tk.splitlist(string))) + + def _getdoubles(self, string): + """Internal function.""" + if string: + return tuple(map(self.tk.getdouble, self.tk.splitlist(string))) + + def _getboolean(self, string): + """Internal function.""" + if string: + return self.tk.getboolean(string) + + def _displayof(self, displayof): + """Internal function.""" + if displayof: + return ('-displayof', displayof) + if displayof is None: + return ('-displayof', self._w) + return () + + @property + def _windowingsystem(self): + """Internal function.""" + try: + return self._root()._windowingsystem_cached + except AttributeError: + ws = self._root()._windowingsystem_cached = \ + self.tk.call('tk', 'windowingsystem') + return ws + + def _options(self, cnf, kw = None): + """Internal function.""" + if kw: + cnf = _cnfmerge((cnf, kw)) + else: + cnf = _cnfmerge(cnf) + res = () + for k, v in cnf.items(): + if v is not None: + if k[-1] == '_': k = k[:-1] + if callable(v): + v = self._register(v) + elif isinstance(v, (tuple, list)): + nv = [] + for item in v: + if isinstance(item, int): + nv.append(str(item)) + elif isinstance(item, str): + nv.append(_stringify(item)) + else: + break + else: + v = ' '.join(nv) + res = res + ('-'+k, v) + return res + + def nametowidget(self, name): + """Return the Tkinter instance of a widget identified by + its Tcl name NAME.""" + name = str(name).split('.') + w = self + + if not name[0]: + w = w._root() + name = name[1:] + + for n in name: + if not n: + break + w = w.children[n] + + return w + + _nametowidget = nametowidget + + def _register(self, func, subst=None, needcleanup=1): + """Return a newly created Tcl function. If this + function is called, the Python function FUNC will + be executed. An optional function SUBST can + be given which will be executed before FUNC.""" + f = CallWrapper(func, subst, self).__call__ + name = repr(id(f)) + try: + func = func.__func__ + except AttributeError: + pass + try: + name = name + func.__name__ + except AttributeError: + pass + self.tk.createcommand(name, f) + if needcleanup: + if self._tclCommands is None: + self._tclCommands = [] + self._tclCommands.append(name) + return name + + register = _register + + def _root(self): + """Internal function.""" + w = self + while w.master is not None: w = w.master + return w + _subst_format = ('%#', '%b', '%f', '%h', '%k', + '%s', '%t', '%w', '%x', '%y', + '%A', '%E', '%K', '%N', '%W', '%T', '%X', '%Y', '%D') + _subst_format_str = " ".join(_subst_format) + + def _substitute(self, *args): + """Internal function.""" + if len(args) != len(self._subst_format): return args + getboolean = self.tk.getboolean + + getint = self.tk.getint + def getint_event(s): + """Tk changed behavior in 8.4.2, returning "??" rather more often.""" + try: + return getint(s) + except (ValueError, TclError): + return s + + nsign, b, f, h, k, s, t, w, x, y, A, E, K, N, W, T, X, Y, D = args + # Missing: (a, c, d, m, o, v, B, R) + e = Event() + # serial field: valid for all events + # number of button: ButtonPress and ButtonRelease events only + # height field: Configure, ConfigureRequest, Create, + # ResizeRequest, and Expose events only + # keycode field: KeyPress and KeyRelease events only + # time field: "valid for events that contain a time field" + # width field: Configure, ConfigureRequest, Create, ResizeRequest, + # and Expose events only + # x field: "valid for events that contain an x field" + # y field: "valid for events that contain a y field" + # keysym as decimal: KeyPress and KeyRelease events only + # x_root, y_root fields: ButtonPress, ButtonRelease, KeyPress, + # KeyRelease, and Motion events + e.serial = getint(nsign) + e.num = getint_event(b) + try: e.focus = getboolean(f) + except TclError: pass + e.height = getint_event(h) + e.keycode = getint_event(k) + e.state = getint_event(s) + e.time = getint_event(t) + e.width = getint_event(w) + e.x = getint_event(x) + e.y = getint_event(y) + e.char = A + try: e.send_event = getboolean(E) + except TclError: pass + e.keysym = K + e.keysym_num = getint_event(N) + try: + e.type = EventType(T) + except ValueError: + e.type = T + try: + e.widget = self._nametowidget(W) + except KeyError: + e.widget = W + e.x_root = getint_event(X) + e.y_root = getint_event(Y) + try: + e.delta = getint(D) + except (ValueError, TclError): + e.delta = 0 + return (e,) + + def _report_exception(self): + """Internal function.""" + exc, val, tb = sys.exc_info() + root = self._root() + root.report_callback_exception(exc, val, tb) + + def _getconfigure(self, *args): + """Call Tcl configure command and return the result as a dict.""" + cnf = {} + for x in self.tk.splitlist(self.tk.call(*args)): + x = self.tk.splitlist(x) + cnf[x[0][1:]] = (x[0][1:],) + x[1:] + return cnf + + def _getconfigure1(self, *args): + x = self.tk.splitlist(self.tk.call(*args)) + return (x[0][1:],) + x[1:] + + def _configure(self, cmd, cnf, kw): + """Internal function.""" + if kw: + cnf = _cnfmerge((cnf, kw)) + elif cnf: + cnf = _cnfmerge(cnf) + if cnf is None: + return self._getconfigure(_flatten((self._w, cmd))) + if isinstance(cnf, str): + return self._getconfigure1(_flatten((self._w, cmd, '-'+cnf))) + self.tk.call(_flatten((self._w, cmd)) + self._options(cnf)) + # These used to be defined in Widget: + + def configure(self, cnf=None, **kw): + """Configure resources of a widget. + + The values for resources are specified as keyword + arguments. To get an overview about + the allowed keyword arguments call the method keys. + """ + return self._configure('configure', cnf, kw) + + config = configure + + def cget(self, key): + """Return the resource value for a KEY given as string.""" + return self.tk.call(self._w, 'cget', '-' + key) + + __getitem__ = cget + + def __setitem__(self, key, value): + self.configure({key: value}) + + def keys(self): + """Return a list of all resource names of this widget.""" + splitlist = self.tk.splitlist + return [splitlist(x)[0][1:] for x in + splitlist(self.tk.call(self._w, 'configure'))] + + def __str__(self): + """Return the window path name of this widget.""" + return self._w + + def __repr__(self): + return '<%s.%s object %s>' % ( + self.__class__.__module__, self.__class__.__qualname__, self._w) + + # Pack methods that apply to the master + _noarg_ = ['_noarg_'] + + def pack_propagate(self, flag=_noarg_): + """Set or get the status for propagation of geometry information. + + A boolean argument specifies whether the geometry information + of the slaves will determine the size of this widget. If no argument + is given the current setting will be returned. + """ + if flag is Misc._noarg_: + return self._getboolean(self.tk.call( + 'pack', 'propagate', self._w)) + else: + self.tk.call('pack', 'propagate', self._w, flag) + + propagate = pack_propagate + + def pack_slaves(self): + """Return a list of all slaves of this widget + in its packing order.""" + return [self._nametowidget(x) for x in + self.tk.splitlist( + self.tk.call('pack', 'slaves', self._w))] + + slaves = pack_slaves + + # Place method that applies to the master + def place_slaves(self): + """Return a list of all slaves of this widget + in its packing order.""" + return [self._nametowidget(x) for x in + self.tk.splitlist( + self.tk.call( + 'place', 'slaves', self._w))] + + # Grid methods that apply to the master + + def grid_anchor(self, anchor=None): # new in Tk 8.5 + """The anchor value controls how to place the grid within the + master when no row/column has any weight. + + The default anchor is nw.""" + self.tk.call('grid', 'anchor', self._w, anchor) + + anchor = grid_anchor + + def grid_bbox(self, column=None, row=None, col2=None, row2=None): + """Return a tuple of integer coordinates for the bounding + box of this widget controlled by the geometry manager grid. + + If COLUMN, ROW is given the bounding box applies from + the cell with row and column 0 to the specified + cell. If COL2 and ROW2 are given the bounding box + starts at that cell. + + The returned integers specify the offset of the upper left + corner in the master widget and the width and height. + """ + args = ('grid', 'bbox', self._w) + if column is not None and row is not None: + args = args + (column, row) + if col2 is not None and row2 is not None: + args = args + (col2, row2) + return self._getints(self.tk.call(*args)) or None + + bbox = grid_bbox + + def _gridconvvalue(self, value): + if isinstance(value, (str, _tkinter.Tcl_Obj)): + try: + svalue = str(value) + if not svalue: + return None + elif '.' in svalue: + return self.tk.getdouble(svalue) + else: + return self.tk.getint(svalue) + except (ValueError, TclError): + pass + return value + + def _grid_configure(self, command, index, cnf, kw): + """Internal function.""" + if isinstance(cnf, str) and not kw: + if cnf[-1:] == '_': + cnf = cnf[:-1] + if cnf[:1] != '-': + cnf = '-'+cnf + options = (cnf,) + else: + options = self._options(cnf, kw) + if not options: + return _splitdict( + self.tk, + self.tk.call('grid', command, self._w, index), + conv=self._gridconvvalue) + res = self.tk.call( + ('grid', command, self._w, index) + + options) + if len(options) == 1: + return self._gridconvvalue(res) + + def grid_columnconfigure(self, index, cnf={}, **kw): + """Configure column INDEX of a grid. + + Valid resources are minsize (minimum size of the column), + weight (how much does additional space propagate to this column) + and pad (how much space to let additionally).""" + return self._grid_configure('columnconfigure', index, cnf, kw) + + columnconfigure = grid_columnconfigure + + def grid_location(self, x, y): + """Return a tuple of column and row which identify the cell + at which the pixel at position X and Y inside the master + widget is located.""" + return self._getints( + self.tk.call( + 'grid', 'location', self._w, x, y)) or None + + def grid_propagate(self, flag=_noarg_): + """Set or get the status for propagation of geometry information. + + A boolean argument specifies whether the geometry information + of the slaves will determine the size of this widget. If no argument + is given, the current setting will be returned. + """ + if flag is Misc._noarg_: + return self._getboolean(self.tk.call( + 'grid', 'propagate', self._w)) + else: + self.tk.call('grid', 'propagate', self._w, flag) + + def grid_rowconfigure(self, index, cnf={}, **kw): + """Configure row INDEX of a grid. + + Valid resources are minsize (minimum size of the row), + weight (how much does additional space propagate to this row) + and pad (how much space to let additionally).""" + return self._grid_configure('rowconfigure', index, cnf, kw) + + rowconfigure = grid_rowconfigure + + def grid_size(self): + """Return a tuple of the number of column and rows in the grid.""" + return self._getints( + self.tk.call('grid', 'size', self._w)) or None + + size = grid_size + + def grid_slaves(self, row=None, column=None): + """Return a list of all slaves of this widget + in its packing order.""" + args = () + if row is not None: + args = args + ('-row', row) + if column is not None: + args = args + ('-column', column) + return [self._nametowidget(x) for x in + self.tk.splitlist(self.tk.call( + ('grid', 'slaves', self._w) + args))] + + # Support for the "event" command, new in Tk 4.2. + # By Case Roole. + + def event_add(self, virtual, *sequences): + """Bind a virtual event VIRTUAL (of the form <>) + to an event SEQUENCE such that the virtual event is triggered + whenever SEQUENCE occurs.""" + args = ('event', 'add', virtual) + sequences + self.tk.call(args) + + def event_delete(self, virtual, *sequences): + """Unbind a virtual event VIRTUAL from SEQUENCE.""" + args = ('event', 'delete', virtual) + sequences + self.tk.call(args) + + def event_generate(self, sequence, **kw): + """Generate an event SEQUENCE. Additional + keyword arguments specify parameter of the event + (e.g. x, y, rootx, rooty).""" + args = ('event', 'generate', self._w, sequence) + for k, v in kw.items(): + args = args + ('-%s' % k, str(v)) + self.tk.call(args) + + def event_info(self, virtual=None): + """Return a list of all virtual events or the information + about the SEQUENCE bound to the virtual event VIRTUAL.""" + return self.tk.splitlist( + self.tk.call('event', 'info', virtual)) + + # Image related commands + + def image_names(self): + """Return a list of all existing image names.""" + return self.tk.splitlist(self.tk.call('image', 'names')) + + def image_types(self): + """Return a list of all available image types (e.g. photo bitmap).""" + return self.tk.splitlist(self.tk.call('image', 'types')) + + +class CallWrapper: + """Internal class. Stores function to call when some user + defined Tcl function is called e.g. after an event occurred.""" + + def __init__(self, func, subst, widget): + """Store FUNC, SUBST and WIDGET as members.""" + self.func = func + self.subst = subst + self.widget = widget + + def __call__(self, *args): + """Apply first function SUBST to arguments, than FUNC.""" + try: + if self.subst: + args = self.subst(*args) + return self.func(*args) + except SystemExit: + raise + except: + self.widget._report_exception() + + +class XView: + """Mix-in class for querying and changing the horizontal position + of a widget's window.""" + + def xview(self, *args): + """Query and change the horizontal position of the view.""" + res = self.tk.call(self._w, 'xview', *args) + if not args: + return self._getdoubles(res) + + def xview_moveto(self, fraction): + """Adjusts the view in the window so that FRACTION of the + total width of the canvas is off-screen to the left.""" + self.tk.call(self._w, 'xview', 'moveto', fraction) + + def xview_scroll(self, number, what): + """Shift the x-view according to NUMBER which is measured in "units" + or "pages" (WHAT).""" + self.tk.call(self._w, 'xview', 'scroll', number, what) + + +class YView: + """Mix-in class for querying and changing the vertical position + of a widget's window.""" + + def yview(self, *args): + """Query and change the vertical position of the view.""" + res = self.tk.call(self._w, 'yview', *args) + if not args: + return self._getdoubles(res) + + def yview_moveto(self, fraction): + """Adjusts the view in the window so that FRACTION of the + total height of the canvas is off-screen to the top.""" + self.tk.call(self._w, 'yview', 'moveto', fraction) + + def yview_scroll(self, number, what): + """Shift the y-view according to NUMBER which is measured in + "units" or "pages" (WHAT).""" + self.tk.call(self._w, 'yview', 'scroll', number, what) + + +class Wm: + """Provides functions for the communication with the window manager.""" + + def wm_aspect(self, + minNumer=None, minDenom=None, + maxNumer=None, maxDenom=None): + """Instruct the window manager to set the aspect ratio (width/height) + of this widget to be between MINNUMER/MINDENOM and MAXNUMER/MAXDENOM. Return a tuple + of the actual values if no argument is given.""" + return self._getints( + self.tk.call('wm', 'aspect', self._w, + minNumer, minDenom, + maxNumer, maxDenom)) + + aspect = wm_aspect + + def wm_attributes(self, *args): + """This subcommand returns or sets platform specific attributes + + The first form returns a list of the platform specific flags and + their values. The second form returns the value for the specific + option. The third form sets one or more of the values. The values + are as follows: + + On Windows, -disabled gets or sets whether the window is in a + disabled state. -toolwindow gets or sets the style of the window + to toolwindow (as defined in the MSDN). -topmost gets or sets + whether this is a topmost window (displays above all other + windows). + + On Macintosh, XXXXX + + On Unix, there are currently no special attribute values. + """ + args = ('wm', 'attributes', self._w) + args + return self.tk.call(args) + + attributes = wm_attributes + + def wm_client(self, name=None): + """Store NAME in WM_CLIENT_MACHINE property of this widget. Return + current value.""" + return self.tk.call('wm', 'client', self._w, name) + + client = wm_client + + def wm_colormapwindows(self, *wlist): + """Store list of window names (WLIST) into WM_COLORMAPWINDOWS property + of this widget. This list contains windows whose colormaps differ from their + parents. Return current list of widgets if WLIST is empty.""" + if len(wlist) > 1: + wlist = (wlist,) # Tk needs a list of windows here + args = ('wm', 'colormapwindows', self._w) + wlist + if wlist: + self.tk.call(args) + else: + return [self._nametowidget(x) + for x in self.tk.splitlist(self.tk.call(args))] + + colormapwindows = wm_colormapwindows + + def wm_command(self, value=None): + """Store VALUE in WM_COMMAND property. It is the command + which shall be used to invoke the application. Return current + command if VALUE is None.""" + return self.tk.call('wm', 'command', self._w, value) + + command = wm_command + + def wm_deiconify(self): + """Deiconify this widget. If it was never mapped it will not be mapped. + On Windows it will raise this widget and give it the focus.""" + return self.tk.call('wm', 'deiconify', self._w) + + deiconify = wm_deiconify + + def wm_focusmodel(self, model=None): + """Set focus model to MODEL. "active" means that this widget will claim + the focus itself, "passive" means that the window manager shall give + the focus. Return current focus model if MODEL is None.""" + return self.tk.call('wm', 'focusmodel', self._w, model) + + focusmodel = wm_focusmodel + + def wm_forget(self, window): # new in Tk 8.5 + """The window will be unmapped from the screen and will no longer + be managed by wm. toplevel windows will be treated like frame + windows once they are no longer managed by wm, however, the menu + option configuration will be remembered and the menus will return + once the widget is managed again.""" + self.tk.call('wm', 'forget', window) + + forget = wm_forget + + def wm_frame(self): + """Return identifier for decorative frame of this widget if present.""" + return self.tk.call('wm', 'frame', self._w) + + frame = wm_frame + + def wm_geometry(self, newGeometry=None): + """Set geometry to NEWGEOMETRY of the form =widthxheight+x+y. Return + current value if None is given.""" + return self.tk.call('wm', 'geometry', self._w, newGeometry) + + geometry = wm_geometry + + def wm_grid(self, + baseWidth=None, baseHeight=None, + widthInc=None, heightInc=None): + """Instruct the window manager that this widget shall only be + resized on grid boundaries. WIDTHINC and HEIGHTINC are the width and + height of a grid unit in pixels. BASEWIDTH and BASEHEIGHT are the + number of grid units requested in Tk_GeometryRequest.""" + return self._getints(self.tk.call( + 'wm', 'grid', self._w, + baseWidth, baseHeight, widthInc, heightInc)) + + grid = wm_grid + + def wm_group(self, pathName=None): + """Set the group leader widgets for related widgets to PATHNAME. Return + the group leader of this widget if None is given.""" + return self.tk.call('wm', 'group', self._w, pathName) + + group = wm_group + + def wm_iconbitmap(self, bitmap=None, default=None): + """Set bitmap for the iconified widget to BITMAP. Return + the bitmap if None is given. + + Under Windows, the DEFAULT parameter can be used to set the icon + for the widget and any descendants that don't have an icon set + explicitly. DEFAULT can be the relative path to a .ico file + (example: root.iconbitmap(default='myicon.ico') ). See Tk + documentation for more information.""" + if default: + return self.tk.call('wm', 'iconbitmap', self._w, '-default', default) + else: + return self.tk.call('wm', 'iconbitmap', self._w, bitmap) + + iconbitmap = wm_iconbitmap + + def wm_iconify(self): + """Display widget as icon.""" + return self.tk.call('wm', 'iconify', self._w) + + iconify = wm_iconify + + def wm_iconmask(self, bitmap=None): + """Set mask for the icon bitmap of this widget. Return the + mask if None is given.""" + return self.tk.call('wm', 'iconmask', self._w, bitmap) + + iconmask = wm_iconmask + + def wm_iconname(self, newName=None): + """Set the name of the icon for this widget. Return the name if + None is given.""" + return self.tk.call('wm', 'iconname', self._w, newName) + + iconname = wm_iconname + + def wm_iconphoto(self, default=False, *args): # new in Tk 8.5 + """Sets the titlebar icon for this window based on the named photo + images passed through args. If default is True, this is applied to + all future created toplevels as well. + + The data in the images is taken as a snapshot at the time of + invocation. If the images are later changed, this is not reflected + to the titlebar icons. Multiple images are accepted to allow + different images sizes to be provided. The window manager may scale + provided icons to an appropriate size. + + On Windows, the images are packed into a Windows icon structure. + This will override an icon specified to wm_iconbitmap, and vice + versa. + + On X, the images are arranged into the _NET_WM_ICON X property, + which most modern window managers support. An icon specified by + wm_iconbitmap may exist simultaneously. + + On Macintosh, this currently does nothing.""" + if default: + self.tk.call('wm', 'iconphoto', self._w, "-default", *args) + else: + self.tk.call('wm', 'iconphoto', self._w, *args) + + iconphoto = wm_iconphoto + + def wm_iconposition(self, x=None, y=None): + """Set the position of the icon of this widget to X and Y. Return + a tuple of the current values of X and X if None is given.""" + return self._getints(self.tk.call( + 'wm', 'iconposition', self._w, x, y)) + + iconposition = wm_iconposition + + def wm_iconwindow(self, pathName=None): + """Set widget PATHNAME to be displayed instead of icon. Return the current + value if None is given.""" + return self.tk.call('wm', 'iconwindow', self._w, pathName) + + iconwindow = wm_iconwindow + + def wm_manage(self, widget): # new in Tk 8.5 + """The widget specified will become a stand alone top-level window. + The window will be decorated with the window managers title bar, + etc.""" + self.tk.call('wm', 'manage', widget) + + manage = wm_manage + + def wm_maxsize(self, width=None, height=None): + """Set max WIDTH and HEIGHT for this widget. If the window is gridded + the values are given in grid units. Return the current values if None + is given.""" + return self._getints(self.tk.call( + 'wm', 'maxsize', self._w, width, height)) + + maxsize = wm_maxsize + + def wm_minsize(self, width=None, height=None): + """Set min WIDTH and HEIGHT for this widget. If the window is gridded + the values are given in grid units. Return the current values if None + is given.""" + return self._getints(self.tk.call( + 'wm', 'minsize', self._w, width, height)) + + minsize = wm_minsize + + def wm_overrideredirect(self, boolean=None): + """Instruct the window manager to ignore this widget + if BOOLEAN is given with 1. Return the current value if None + is given.""" + return self._getboolean(self.tk.call( + 'wm', 'overrideredirect', self._w, boolean)) + + overrideredirect = wm_overrideredirect + + def wm_positionfrom(self, who=None): + """Instruct the window manager that the position of this widget shall + be defined by the user if WHO is "user", and by its own policy if WHO is + "program".""" + return self.tk.call('wm', 'positionfrom', self._w, who) + + positionfrom = wm_positionfrom + + def wm_protocol(self, name=None, func=None): + """Bind function FUNC to command NAME for this widget. + Return the function bound to NAME if None is given. NAME could be + e.g. "WM_SAVE_YOURSELF" or "WM_DELETE_WINDOW".""" + if callable(func): + command = self._register(func) + else: + command = func + return self.tk.call( + 'wm', 'protocol', self._w, name, command) + + protocol = wm_protocol + + def wm_resizable(self, width=None, height=None): + """Instruct the window manager whether this width can be resized + in WIDTH or HEIGHT. Both values are boolean values.""" + return self.tk.call('wm', 'resizable', self._w, width, height) + + resizable = wm_resizable + + def wm_sizefrom(self, who=None): + """Instruct the window manager that the size of this widget shall + be defined by the user if WHO is "user", and by its own policy if WHO is + "program".""" + return self.tk.call('wm', 'sizefrom', self._w, who) + + sizefrom = wm_sizefrom + + def wm_state(self, newstate=None): + """Query or set the state of this widget as one of normal, icon, + iconic (see wm_iconwindow), withdrawn, or zoomed (Windows only).""" + return self.tk.call('wm', 'state', self._w, newstate) + + state = wm_state + + def wm_title(self, string=None): + """Set the title of this widget.""" + return self.tk.call('wm', 'title', self._w, string) + + title = wm_title + + def wm_transient(self, master=None): + """Instruct the window manager that this widget is transient + with regard to widget MASTER.""" + return self.tk.call('wm', 'transient', self._w, master) + + transient = wm_transient + + def wm_withdraw(self): + """Withdraw this widget from the screen such that it is unmapped + and forgotten by the window manager. Re-draw it with wm_deiconify.""" + return self.tk.call('wm', 'withdraw', self._w) + + withdraw = wm_withdraw + + +class Tk(Misc, Wm): + """Toplevel widget of Tk which represents mostly the main window + of an application. It has an associated Tcl interpreter.""" + _w = '.' + + def __init__(self, screenName=None, baseName=None, className='Tk', + useTk=True, sync=False, use=None): + """Return a new top level widget on screen SCREENNAME. A new Tcl interpreter will + be created. BASENAME will be used for the identification of the profile file (see + readprofile). + It is constructed from sys.argv[0] without extensions if None is given. CLASSNAME + is the name of the widget class.""" + self.master = None + self.children = {} + self._tkloaded = False + # to avoid recursions in the getattr code in case of failure, we + # ensure that self.tk is always _something_. + self.tk = None + if baseName is None: + import os + baseName = os.path.basename(sys.argv[0]) + baseName, ext = os.path.splitext(baseName) + if ext not in ('.py', '.pyc'): + baseName = baseName + ext + interactive = False + self.tk = _tkinter.create(screenName, baseName, className, interactive, wantobjects, useTk, sync, use) + if useTk: + self._loadtk() + if not sys.flags.ignore_environment: + # Issue #16248: Honor the -E flag to avoid code injection. + self.readprofile(baseName, className) + + def loadtk(self): + if not self._tkloaded: + self.tk.loadtk() + self._loadtk() + + def _loadtk(self): + self._tkloaded = True + global _default_root + # Version sanity checks + tk_version = self.tk.getvar('tk_version') + if tk_version != _tkinter.TK_VERSION: + raise RuntimeError("tk.h version (%s) doesn't match libtk.a version (%s)" + % (_tkinter.TK_VERSION, tk_version)) + # Under unknown circumstances, tcl_version gets coerced to float + tcl_version = str(self.tk.getvar('tcl_version')) + if tcl_version != _tkinter.TCL_VERSION: + raise RuntimeError("tcl.h version (%s) doesn't match libtcl.a version (%s)" \ + % (_tkinter.TCL_VERSION, tcl_version)) + # Create and register the tkerror and exit commands + # We need to inline parts of _register here, _ register + # would register differently-named commands. + if self._tclCommands is None: + self._tclCommands = [] + self.tk.createcommand('tkerror', _tkerror) + self.tk.createcommand('exit', _exit) + self._tclCommands.append('tkerror') + self._tclCommands.append('exit') + if _support_default_root and _default_root is None: + _default_root = self + self.protocol("WM_DELETE_WINDOW", self.destroy) + + def destroy(self): + """Destroy this and all descendants widgets. This will + end the application of this Tcl interpreter.""" + for c in list(self.children.values()): c.destroy() + self.tk.call('destroy', self._w) + Misc.destroy(self) + global _default_root + if _support_default_root and _default_root is self: + _default_root = None + + def readprofile(self, baseName, className): + """Internal function. It reads .BASENAME.tcl and .CLASSNAME.tcl into + the Tcl Interpreter and calls exec on the contents of .BASENAME.py and + .CLASSNAME.py if such a file exists in the home directory.""" + import os + if 'HOME' in os.environ: home = os.environ['HOME'] + else: home = os.curdir + class_tcl = os.path.join(home, '.%s.tcl' % className) + class_py = os.path.join(home, '.%s.py' % className) + base_tcl = os.path.join(home, '.%s.tcl' % baseName) + base_py = os.path.join(home, '.%s.py' % baseName) + dir = {'self': self} + exec('from tkinter import *', dir) + if os.path.isfile(class_tcl): + self.tk.call('source', class_tcl) + if os.path.isfile(class_py): + exec(open(class_py).read(), dir) + if os.path.isfile(base_tcl): + self.tk.call('source', base_tcl) + if os.path.isfile(base_py): + exec(open(base_py).read(), dir) + + def report_callback_exception(self, exc, val, tb): + """Report callback exception on sys.stderr. + + Applications may want to override this internal function, and + should when sys.stderr is None.""" + import traceback + print("Exception in Tkinter callback", file=sys.stderr) + sys.last_type = exc + sys.last_value = val + sys.last_traceback = tb + traceback.print_exception(exc, val, tb) + + def __getattr__(self, attr): + "Delegate attribute access to the interpreter object" + return getattr(self.tk, attr) + +# Ideally, the classes Pack, Place and Grid disappear, the +# pack/place/grid methods are defined on the Widget class, and +# everybody uses w.pack_whatever(...) instead of Pack.whatever(w, +# ...), with pack(), place() and grid() being short for +# pack_configure(), place_configure() and grid_columnconfigure(), and +# forget() being short for pack_forget(). As a practical matter, I'm +# afraid that there is too much code out there that may be using the +# Pack, Place or Grid class, so I leave them intact -- but only as +# backwards compatibility features. Also note that those methods that +# take a master as argument (e.g. pack_propagate) have been moved to +# the Misc class (which now incorporates all methods common between +# toplevel and interior widgets). Again, for compatibility, these are +# copied into the Pack, Place or Grid class. + + +def Tcl(screenName=None, baseName=None, className='Tk', useTk=False): + return Tk(screenName, baseName, className, useTk) + + +class Pack: + """Geometry manager Pack. + + Base class to use the methods pack_* in every widget.""" + + def pack_configure(self, cnf={}, **kw): + """Pack a widget in the parent widget. Use as options: + after=widget - pack it after you have packed widget + anchor=NSEW (or subset) - position widget according to + given direction + before=widget - pack it before you will pack widget + expand=bool - expand widget if parent size grows + fill=NONE or X or Y or BOTH - fill widget if widget grows + in=master - use master to contain this widget + in_=master - see 'in' option description + ipadx=amount - add internal padding in x direction + ipady=amount - add internal padding in y direction + padx=amount - add padding in x direction + pady=amount - add padding in y direction + side=TOP or BOTTOM or LEFT or RIGHT - where to add this widget. + """ + self.tk.call( + ('pack', 'configure', self._w) + + self._options(cnf, kw)) + + pack = configure = config = pack_configure + + def pack_forget(self): + """Unmap this widget and do not use it for the packing order.""" + self.tk.call('pack', 'forget', self._w) + + forget = pack_forget + + def pack_info(self): + """Return information about the packing options + for this widget.""" + d = _splitdict(self.tk, self.tk.call('pack', 'info', self._w)) + if 'in' in d: + d['in'] = self.nametowidget(d['in']) + return d + + info = pack_info + propagate = pack_propagate = Misc.pack_propagate + slaves = pack_slaves = Misc.pack_slaves + + +class Place: + """Geometry manager Place. + + Base class to use the methods place_* in every widget.""" + + def place_configure(self, cnf={}, **kw): + """Place a widget in the parent widget. Use as options: + in=master - master relative to which the widget is placed + in_=master - see 'in' option description + x=amount - locate anchor of this widget at position x of master + y=amount - locate anchor of this widget at position y of master + relx=amount - locate anchor of this widget between 0.0 and 1.0 + relative to width of master (1.0 is right edge) + rely=amount - locate anchor of this widget between 0.0 and 1.0 + relative to height of master (1.0 is bottom edge) + anchor=NSEW (or subset) - position anchor according to given direction + width=amount - width of this widget in pixel + height=amount - height of this widget in pixel + relwidth=amount - width of this widget between 0.0 and 1.0 + relative to width of master (1.0 is the same width + as the master) + relheight=amount - height of this widget between 0.0 and 1.0 + relative to height of master (1.0 is the same + height as the master) + bordermode="inside" or "outside" - whether to take border width of + master widget into account + """ + self.tk.call( + ('place', 'configure', self._w) + + self._options(cnf, kw)) + + place = configure = config = place_configure + + def place_forget(self): + """Unmap this widget.""" + self.tk.call('place', 'forget', self._w) + + forget = place_forget + + def place_info(self): + """Return information about the placing options + for this widget.""" + d = _splitdict(self.tk, self.tk.call('place', 'info', self._w)) + if 'in' in d: + d['in'] = self.nametowidget(d['in']) + return d + + info = place_info + slaves = place_slaves = Misc.place_slaves + + +class Grid: + """Geometry manager Grid. + + Base class to use the methods grid_* in every widget.""" + # Thanks to Masazumi Yoshikawa (yosikawa@isi.edu) + + def grid_configure(self, cnf={}, **kw): + """Position a widget in the parent widget in a grid. Use as options: + column=number - use cell identified with given column (starting with 0) + columnspan=number - this widget will span several columns + in=master - use master to contain this widget + in_=master - see 'in' option description + ipadx=amount - add internal padding in x direction + ipady=amount - add internal padding in y direction + padx=amount - add padding in x direction + pady=amount - add padding in y direction + row=number - use cell identified with given row (starting with 0) + rowspan=number - this widget will span several rows + sticky=NSEW - if cell is larger on which sides will this + widget stick to the cell boundary + """ + self.tk.call( + ('grid', 'configure', self._w) + + self._options(cnf, kw)) + + grid = configure = config = grid_configure + bbox = grid_bbox = Misc.grid_bbox + columnconfigure = grid_columnconfigure = Misc.grid_columnconfigure + + def grid_forget(self): + """Unmap this widget.""" + self.tk.call('grid', 'forget', self._w) + + forget = grid_forget + + def grid_remove(self): + """Unmap this widget but remember the grid options.""" + self.tk.call('grid', 'remove', self._w) + + def grid_info(self): + """Return information about the options + for positioning this widget in a grid.""" + d = _splitdict(self.tk, self.tk.call('grid', 'info', self._w)) + if 'in' in d: + d['in'] = self.nametowidget(d['in']) + return d + + info = grid_info + location = grid_location = Misc.grid_location + propagate = grid_propagate = Misc.grid_propagate + rowconfigure = grid_rowconfigure = Misc.grid_rowconfigure + size = grid_size = Misc.grid_size + slaves = grid_slaves = Misc.grid_slaves + + +class BaseWidget(Misc): + """Internal class.""" + + def _setup(self, master, cnf): + """Internal function. Sets up information about children.""" + if master is None: + master = _get_default_root() + self.master = master + self.tk = master.tk + name = None + if 'name' in cnf: + name = cnf['name'] + del cnf['name'] + if not name: + name = self.__class__.__name__.lower() + if master._last_child_ids is None: + master._last_child_ids = {} + count = master._last_child_ids.get(name, 0) + 1 + master._last_child_ids[name] = count + if count == 1: + name = '!%s' % (name,) + else: + name = '!%s%d' % (name, count) + self._name = name + if master._w=='.': + self._w = '.' + name + else: + self._w = master._w + '.' + name + self.children = {} + if self._name in self.master.children: + self.master.children[self._name].destroy() + self.master.children[self._name] = self + + def __init__(self, master, widgetName, cnf={}, kw={}, extra=()): + """Construct a widget with the parent widget MASTER, a name WIDGETNAME + and appropriate options.""" + if kw: + cnf = _cnfmerge((cnf, kw)) + self.widgetName = widgetName + self._setup(master, cnf) + if self._tclCommands is None: + self._tclCommands = [] + classes = [(k, v) for k, v in cnf.items() if isinstance(k, type)] + for k, v in classes: + del cnf[k] + self.tk.call( + (widgetName, self._w) + extra + self._options(cnf)) + for k, v in classes: + k.configure(self, v) + + def destroy(self): + """Destroy this and all descendants widgets.""" + for c in list(self.children.values()): c.destroy() + self.tk.call('destroy', self._w) + if self._name in self.master.children: + del self.master.children[self._name] + Misc.destroy(self) + + def _do(self, name, args=()): + # XXX Obsolete -- better use self.tk.call directly! + return self.tk.call((self._w, name) + args) + + +class Widget(BaseWidget, Pack, Place, Grid): + """Internal class. + + Base class for a widget which can be positioned with the geometry managers + Pack, Place or Grid.""" + pass + + +class Toplevel(BaseWidget, Wm): + """Toplevel widget, e.g. for dialogs.""" + + def __init__(self, master=None, cnf={}, **kw): + """Construct a toplevel widget with the parent MASTER. + + Valid resource names: background, bd, bg, borderwidth, class, + colormap, container, cursor, height, highlightbackground, + highlightcolor, highlightthickness, menu, relief, screen, takefocus, + use, visual, width.""" + if kw: + cnf = _cnfmerge((cnf, kw)) + extra = () + for wmkey in ['screen', 'class_', 'class', 'visual', + 'colormap']: + if wmkey in cnf: + val = cnf[wmkey] + # TBD: a hack needed because some keys + # are not valid as keyword arguments + if wmkey[-1] == '_': opt = '-'+wmkey[:-1] + else: opt = '-'+wmkey + extra = extra + (opt, val) + del cnf[wmkey] + BaseWidget.__init__(self, master, 'toplevel', cnf, {}, extra) + root = self._root() + self.iconname(root.iconname()) + self.title(root.title()) + self.protocol("WM_DELETE_WINDOW", self.destroy) + + +class Button(Widget): + """Button widget.""" + + def __init__(self, master=None, cnf={}, **kw): + """Construct a button widget with the parent MASTER. + + STANDARD OPTIONS + + activebackground, activeforeground, anchor, + background, bitmap, borderwidth, cursor, + disabledforeground, font, foreground + highlightbackground, highlightcolor, + highlightthickness, image, justify, + padx, pady, relief, repeatdelay, + repeatinterval, takefocus, text, + textvariable, underline, wraplength + + WIDGET-SPECIFIC OPTIONS + + command, compound, default, height, + overrelief, state, width + """ + Widget.__init__(self, master, 'button', cnf, kw) + + def flash(self): + """Flash the button. + + This is accomplished by redisplaying + the button several times, alternating between active and + normal colors. At the end of the flash the button is left + in the same normal/active state as when the command was + invoked. This command is ignored if the button's state is + disabled. + """ + self.tk.call(self._w, 'flash') + + def invoke(self): + """Invoke the command associated with the button. + + The return value is the return value from the command, + or an empty string if there is no command associated with + the button. This command is ignored if the button's state + is disabled. + """ + return self.tk.call(self._w, 'invoke') + + +class Canvas(Widget, XView, YView): + """Canvas widget to display graphical elements like lines or text.""" + + def __init__(self, master=None, cnf={}, **kw): + """Construct a canvas widget with the parent MASTER. + + Valid resource names: background, bd, bg, borderwidth, closeenough, + confine, cursor, height, highlightbackground, highlightcolor, + highlightthickness, insertbackground, insertborderwidth, + insertofftime, insertontime, insertwidth, offset, relief, + scrollregion, selectbackground, selectborderwidth, selectforeground, + state, takefocus, width, xscrollcommand, xscrollincrement, + yscrollcommand, yscrollincrement.""" + Widget.__init__(self, master, 'canvas', cnf, kw) + + def addtag(self, *args): + """Internal function.""" + self.tk.call((self._w, 'addtag') + args) + + def addtag_above(self, newtag, tagOrId): + """Add tag NEWTAG to all items above TAGORID.""" + self.addtag(newtag, 'above', tagOrId) + + def addtag_all(self, newtag): + """Add tag NEWTAG to all items.""" + self.addtag(newtag, 'all') + + def addtag_below(self, newtag, tagOrId): + """Add tag NEWTAG to all items below TAGORID.""" + self.addtag(newtag, 'below', tagOrId) + + def addtag_closest(self, newtag, x, y, halo=None, start=None): + """Add tag NEWTAG to item which is closest to pixel at X, Y. + If several match take the top-most. + All items closer than HALO are considered overlapping (all are + closest). If START is specified the next below this tag is taken.""" + self.addtag(newtag, 'closest', x, y, halo, start) + + def addtag_enclosed(self, newtag, x1, y1, x2, y2): + """Add tag NEWTAG to all items in the rectangle defined + by X1,Y1,X2,Y2.""" + self.addtag(newtag, 'enclosed', x1, y1, x2, y2) + + def addtag_overlapping(self, newtag, x1, y1, x2, y2): + """Add tag NEWTAG to all items which overlap the rectangle + defined by X1,Y1,X2,Y2.""" + self.addtag(newtag, 'overlapping', x1, y1, x2, y2) + + def addtag_withtag(self, newtag, tagOrId): + """Add tag NEWTAG to all items with TAGORID.""" + self.addtag(newtag, 'withtag', tagOrId) + + def bbox(self, *args): + """Return a tuple of X1,Y1,X2,Y2 coordinates for a rectangle + which encloses all items with tags specified as arguments.""" + return self._getints( + self.tk.call((self._w, 'bbox') + args)) or None + + def tag_unbind(self, tagOrId, sequence, funcid=None): + """Unbind for all items with TAGORID for event SEQUENCE the + function identified with FUNCID.""" + self.tk.call(self._w, 'bind', tagOrId, sequence, '') + if funcid: + self.deletecommand(funcid) + + def tag_bind(self, tagOrId, sequence=None, func=None, add=None): + """Bind to all items with TAGORID at event SEQUENCE a call to function FUNC. + + An additional boolean parameter ADD specifies whether FUNC will be + called additionally to the other bound function or whether it will + replace the previous function. See bind for the return value.""" + return self._bind((self._w, 'bind', tagOrId), + sequence, func, add) + + def canvasx(self, screenx, gridspacing=None): + """Return the canvas x coordinate of pixel position SCREENX rounded + to nearest multiple of GRIDSPACING units.""" + return self.tk.getdouble(self.tk.call( + self._w, 'canvasx', screenx, gridspacing)) + + def canvasy(self, screeny, gridspacing=None): + """Return the canvas y coordinate of pixel position SCREENY rounded + to nearest multiple of GRIDSPACING units.""" + return self.tk.getdouble(self.tk.call( + self._w, 'canvasy', screeny, gridspacing)) + + def coords(self, *args): + """Return a list of coordinates for the item given in ARGS.""" + # XXX Should use _flatten on args + return [self.tk.getdouble(x) for x in + self.tk.splitlist( + self.tk.call((self._w, 'coords') + args))] + + def _create(self, itemType, args, kw): # Args: (val, val, ..., cnf={}) + """Internal function.""" + args = _flatten(args) + cnf = args[-1] + if isinstance(cnf, (dict, tuple)): + args = args[:-1] + else: + cnf = {} + return self.tk.getint(self.tk.call( + self._w, 'create', itemType, + *(args + self._options(cnf, kw)))) + + def create_arc(self, *args, **kw): + """Create arc shaped region with coordinates x1,y1,x2,y2.""" + return self._create('arc', args, kw) + + def create_bitmap(self, *args, **kw): + """Create bitmap with coordinates x1,y1.""" + return self._create('bitmap', args, kw) + + def create_image(self, *args, **kw): + """Create image item with coordinates x1,y1.""" + return self._create('image', args, kw) + + def create_line(self, *args, **kw): + """Create line with coordinates x1,y1,...,xn,yn.""" + return self._create('line', args, kw) + + def create_oval(self, *args, **kw): + """Create oval with coordinates x1,y1,x2,y2.""" + return self._create('oval', args, kw) + + def create_polygon(self, *args, **kw): + """Create polygon with coordinates x1,y1,...,xn,yn.""" + return self._create('polygon', args, kw) + + def create_rectangle(self, *args, **kw): + """Create rectangle with coordinates x1,y1,x2,y2.""" + return self._create('rectangle', args, kw) + + def create_text(self, *args, **kw): + """Create text with coordinates x1,y1.""" + return self._create('text', args, kw) + + def create_window(self, *args, **kw): + """Create window with coordinates x1,y1,x2,y2.""" + return self._create('window', args, kw) + + def dchars(self, *args): + """Delete characters of text items identified by tag or id in ARGS (possibly + several times) from FIRST to LAST character (including).""" + self.tk.call((self._w, 'dchars') + args) + + def delete(self, *args): + """Delete items identified by all tag or ids contained in ARGS.""" + self.tk.call((self._w, 'delete') + args) + + def dtag(self, *args): + """Delete tag or id given as last arguments in ARGS from items + identified by first argument in ARGS.""" + self.tk.call((self._w, 'dtag') + args) + + def find(self, *args): + """Internal function.""" + return self._getints( + self.tk.call((self._w, 'find') + args)) or () + + def find_above(self, tagOrId): + """Return items above TAGORID.""" + return self.find('above', tagOrId) + + def find_all(self): + """Return all items.""" + return self.find('all') + + def find_below(self, tagOrId): + """Return all items below TAGORID.""" + return self.find('below', tagOrId) + + def find_closest(self, x, y, halo=None, start=None): + """Return item which is closest to pixel at X, Y. + If several match take the top-most. + All items closer than HALO are considered overlapping (all are + closest). If START is specified the next below this tag is taken.""" + return self.find('closest', x, y, halo, start) + + def find_enclosed(self, x1, y1, x2, y2): + """Return all items in rectangle defined + by X1,Y1,X2,Y2.""" + return self.find('enclosed', x1, y1, x2, y2) + + def find_overlapping(self, x1, y1, x2, y2): + """Return all items which overlap the rectangle + defined by X1,Y1,X2,Y2.""" + return self.find('overlapping', x1, y1, x2, y2) + + def find_withtag(self, tagOrId): + """Return all items with TAGORID.""" + return self.find('withtag', tagOrId) + + def focus(self, *args): + """Set focus to the first item specified in ARGS.""" + return self.tk.call((self._w, 'focus') + args) + + def gettags(self, *args): + """Return tags associated with the first item specified in ARGS.""" + return self.tk.splitlist( + self.tk.call((self._w, 'gettags') + args)) + + def icursor(self, *args): + """Set cursor at position POS in the item identified by TAGORID. + In ARGS TAGORID must be first.""" + self.tk.call((self._w, 'icursor') + args) + + def index(self, *args): + """Return position of cursor as integer in item specified in ARGS.""" + return self.tk.getint(self.tk.call((self._w, 'index') + args)) + + def insert(self, *args): + """Insert TEXT in item TAGORID at position POS. ARGS must + be TAGORID POS TEXT.""" + self.tk.call((self._w, 'insert') + args) + + def itemcget(self, tagOrId, option): + """Return the resource value for an OPTION for item TAGORID.""" + return self.tk.call( + (self._w, 'itemcget') + (tagOrId, '-'+option)) + + def itemconfigure(self, tagOrId, cnf=None, **kw): + """Configure resources of an item TAGORID. + + The values for resources are specified as keyword + arguments. To get an overview about + the allowed keyword arguments call the method without arguments. + """ + return self._configure(('itemconfigure', tagOrId), cnf, kw) + + itemconfig = itemconfigure + + # lower, tkraise/lift hide Misc.lower, Misc.tkraise/lift, + # so the preferred name for them is tag_lower, tag_raise + # (similar to tag_bind, and similar to the Text widget); + # unfortunately can't delete the old ones yet (maybe in 1.6) + def tag_lower(self, *args): + """Lower an item TAGORID given in ARGS + (optional below another item).""" + self.tk.call((self._w, 'lower') + args) + + lower = tag_lower + + def move(self, *args): + """Move an item TAGORID given in ARGS.""" + self.tk.call((self._w, 'move') + args) + + def moveto(self, tagOrId, x='', y=''): + """Move the items given by TAGORID in the canvas coordinate + space so that the first coordinate pair of the bottommost + item with tag TAGORID is located at position (X,Y). + X and Y may be the empty string, in which case the + corresponding coordinate will be unchanged. All items matching + TAGORID remain in the same positions relative to each other.""" + self.tk.call(self._w, 'moveto', tagOrId, x, y) + + def postscript(self, cnf={}, **kw): + """Print the contents of the canvas to a postscript + file. Valid options: colormap, colormode, file, fontmap, + height, pageanchor, pageheight, pagewidth, pagex, pagey, + rotate, width, x, y.""" + return self.tk.call((self._w, 'postscript') + + self._options(cnf, kw)) + + def tag_raise(self, *args): + """Raise an item TAGORID given in ARGS + (optional above another item).""" + self.tk.call((self._w, 'raise') + args) + + lift = tkraise = tag_raise + + def scale(self, *args): + """Scale item TAGORID with XORIGIN, YORIGIN, XSCALE, YSCALE.""" + self.tk.call((self._w, 'scale') + args) + + def scan_mark(self, x, y): + """Remember the current X, Y coordinates.""" + self.tk.call(self._w, 'scan', 'mark', x, y) + + def scan_dragto(self, x, y, gain=10): + """Adjust the view of the canvas to GAIN times the + difference between X and Y and the coordinates given in + scan_mark.""" + self.tk.call(self._w, 'scan', 'dragto', x, y, gain) + + def select_adjust(self, tagOrId, index): + """Adjust the end of the selection near the cursor of an item TAGORID to index.""" + self.tk.call(self._w, 'select', 'adjust', tagOrId, index) + + def select_clear(self): + """Clear the selection if it is in this widget.""" + self.tk.call(self._w, 'select', 'clear') + + def select_from(self, tagOrId, index): + """Set the fixed end of a selection in item TAGORID to INDEX.""" + self.tk.call(self._w, 'select', 'from', tagOrId, index) + + def select_item(self): + """Return the item which has the selection.""" + return self.tk.call(self._w, 'select', 'item') or None + + def select_to(self, tagOrId, index): + """Set the variable end of a selection in item TAGORID to INDEX.""" + self.tk.call(self._w, 'select', 'to', tagOrId, index) + + def type(self, tagOrId): + """Return the type of the item TAGORID.""" + return self.tk.call(self._w, 'type', tagOrId) or None + + +_checkbutton_count = 0 + +class Checkbutton(Widget): + """Checkbutton widget which is either in on- or off-state.""" + + def __init__(self, master=None, cnf={}, **kw): + """Construct a checkbutton widget with the parent MASTER. + + Valid resource names: activebackground, activeforeground, anchor, + background, bd, bg, bitmap, borderwidth, command, cursor, + disabledforeground, fg, font, foreground, height, + highlightbackground, highlightcolor, highlightthickness, image, + indicatoron, justify, offvalue, onvalue, padx, pady, relief, + selectcolor, selectimage, state, takefocus, text, textvariable, + underline, variable, width, wraplength.""" + Widget.__init__(self, master, 'checkbutton', cnf, kw) + + def _setup(self, master, cnf): + if not cnf.get('name'): + global _checkbutton_count + name = self.__class__.__name__.lower() + _checkbutton_count += 1 + cnf['name'] = f'!{name}{_checkbutton_count}' + super()._setup(master, cnf) + + def deselect(self): + """Put the button in off-state.""" + self.tk.call(self._w, 'deselect') + + def flash(self): + """Flash the button.""" + self.tk.call(self._w, 'flash') + + def invoke(self): + """Toggle the button and invoke a command if given as resource.""" + return self.tk.call(self._w, 'invoke') + + def select(self): + """Put the button in on-state.""" + self.tk.call(self._w, 'select') + + def toggle(self): + """Toggle the button.""" + self.tk.call(self._w, 'toggle') + + +class Entry(Widget, XView): + """Entry widget which allows displaying simple text.""" + + def __init__(self, master=None, cnf={}, **kw): + """Construct an entry widget with the parent MASTER. + + Valid resource names: background, bd, bg, borderwidth, cursor, + exportselection, fg, font, foreground, highlightbackground, + highlightcolor, highlightthickness, insertbackground, + insertborderwidth, insertofftime, insertontime, insertwidth, + invalidcommand, invcmd, justify, relief, selectbackground, + selectborderwidth, selectforeground, show, state, takefocus, + textvariable, validate, validatecommand, vcmd, width, + xscrollcommand.""" + Widget.__init__(self, master, 'entry', cnf, kw) + + def delete(self, first, last=None): + """Delete text from FIRST to LAST (not included).""" + self.tk.call(self._w, 'delete', first, last) + + def get(self): + """Return the text.""" + return self.tk.call(self._w, 'get') + + def icursor(self, index): + """Insert cursor at INDEX.""" + self.tk.call(self._w, 'icursor', index) + + def index(self, index): + """Return position of cursor.""" + return self.tk.getint(self.tk.call( + self._w, 'index', index)) + + def insert(self, index, string): + """Insert STRING at INDEX.""" + self.tk.call(self._w, 'insert', index, string) + + def scan_mark(self, x): + """Remember the current X, Y coordinates.""" + self.tk.call(self._w, 'scan', 'mark', x) + + def scan_dragto(self, x): + """Adjust the view of the canvas to 10 times the + difference between X and Y and the coordinates given in + scan_mark.""" + self.tk.call(self._w, 'scan', 'dragto', x) + + def selection_adjust(self, index): + """Adjust the end of the selection near the cursor to INDEX.""" + self.tk.call(self._w, 'selection', 'adjust', index) + + select_adjust = selection_adjust + + def selection_clear(self): + """Clear the selection if it is in this widget.""" + self.tk.call(self._w, 'selection', 'clear') + + select_clear = selection_clear + + def selection_from(self, index): + """Set the fixed end of a selection to INDEX.""" + self.tk.call(self._w, 'selection', 'from', index) + + select_from = selection_from + + def selection_present(self): + """Return True if there are characters selected in the entry, False + otherwise.""" + return self.tk.getboolean( + self.tk.call(self._w, 'selection', 'present')) + + select_present = selection_present + + def selection_range(self, start, end): + """Set the selection from START to END (not included).""" + self.tk.call(self._w, 'selection', 'range', start, end) + + select_range = selection_range + + def selection_to(self, index): + """Set the variable end of a selection to INDEX.""" + self.tk.call(self._w, 'selection', 'to', index) + + select_to = selection_to + + +class Frame(Widget): + """Frame widget which may contain other widgets and can have a 3D border.""" + + def __init__(self, master=None, cnf={}, **kw): + """Construct a frame widget with the parent MASTER. + + Valid resource names: background, bd, bg, borderwidth, class, + colormap, container, cursor, height, highlightbackground, + highlightcolor, highlightthickness, relief, takefocus, visual, width.""" + cnf = _cnfmerge((cnf, kw)) + extra = () + if 'class_' in cnf: + extra = ('-class', cnf['class_']) + del cnf['class_'] + elif 'class' in cnf: + extra = ('-class', cnf['class']) + del cnf['class'] + Widget.__init__(self, master, 'frame', cnf, {}, extra) + + +class Label(Widget): + """Label widget which can display text and bitmaps.""" + + def __init__(self, master=None, cnf={}, **kw): + """Construct a label widget with the parent MASTER. + + STANDARD OPTIONS + + activebackground, activeforeground, anchor, + background, bitmap, borderwidth, cursor, + disabledforeground, font, foreground, + highlightbackground, highlightcolor, + highlightthickness, image, justify, + padx, pady, relief, takefocus, text, + textvariable, underline, wraplength + + WIDGET-SPECIFIC OPTIONS + + height, state, width + + """ + Widget.__init__(self, master, 'label', cnf, kw) + + +class Listbox(Widget, XView, YView): + """Listbox widget which can display a list of strings.""" + + def __init__(self, master=None, cnf={}, **kw): + """Construct a listbox widget with the parent MASTER. + + Valid resource names: background, bd, bg, borderwidth, cursor, + exportselection, fg, font, foreground, height, highlightbackground, + highlightcolor, highlightthickness, relief, selectbackground, + selectborderwidth, selectforeground, selectmode, setgrid, takefocus, + width, xscrollcommand, yscrollcommand, listvariable.""" + Widget.__init__(self, master, 'listbox', cnf, kw) + + def activate(self, index): + """Activate item identified by INDEX.""" + self.tk.call(self._w, 'activate', index) + + def bbox(self, index): + """Return a tuple of X1,Y1,X2,Y2 coordinates for a rectangle + which encloses the item identified by the given index.""" + return self._getints(self.tk.call(self._w, 'bbox', index)) or None + + def curselection(self): + """Return the indices of currently selected item.""" + return self._getints(self.tk.call(self._w, 'curselection')) or () + + def delete(self, first, last=None): + """Delete items from FIRST to LAST (included).""" + self.tk.call(self._w, 'delete', first, last) + + def get(self, first, last=None): + """Get list of items from FIRST to LAST (included).""" + if last is not None: + return self.tk.splitlist(self.tk.call( + self._w, 'get', first, last)) + else: + return self.tk.call(self._w, 'get', first) + + def index(self, index): + """Return index of item identified with INDEX.""" + i = self.tk.call(self._w, 'index', index) + if i == 'none': return None + return self.tk.getint(i) + + def insert(self, index, *elements): + """Insert ELEMENTS at INDEX.""" + self.tk.call((self._w, 'insert', index) + elements) + + def nearest(self, y): + """Get index of item which is nearest to y coordinate Y.""" + return self.tk.getint(self.tk.call( + self._w, 'nearest', y)) + + def scan_mark(self, x, y): + """Remember the current X, Y coordinates.""" + self.tk.call(self._w, 'scan', 'mark', x, y) + + def scan_dragto(self, x, y): + """Adjust the view of the listbox to 10 times the + difference between X and Y and the coordinates given in + scan_mark.""" + self.tk.call(self._w, 'scan', 'dragto', x, y) + + def see(self, index): + """Scroll such that INDEX is visible.""" + self.tk.call(self._w, 'see', index) + + def selection_anchor(self, index): + """Set the fixed end oft the selection to INDEX.""" + self.tk.call(self._w, 'selection', 'anchor', index) + + select_anchor = selection_anchor + + def selection_clear(self, first, last=None): + """Clear the selection from FIRST to LAST (included).""" + self.tk.call(self._w, + 'selection', 'clear', first, last) + + select_clear = selection_clear + + def selection_includes(self, index): + """Return True if INDEX is part of the selection.""" + return self.tk.getboolean(self.tk.call( + self._w, 'selection', 'includes', index)) + + select_includes = selection_includes + + def selection_set(self, first, last=None): + """Set the selection from FIRST to LAST (included) without + changing the currently selected elements.""" + self.tk.call(self._w, 'selection', 'set', first, last) + + select_set = selection_set + + def size(self): + """Return the number of elements in the listbox.""" + return self.tk.getint(self.tk.call(self._w, 'size')) + + def itemcget(self, index, option): + """Return the resource value for an ITEM and an OPTION.""" + return self.tk.call( + (self._w, 'itemcget') + (index, '-'+option)) + + def itemconfigure(self, index, cnf=None, **kw): + """Configure resources of an ITEM. + + The values for resources are specified as keyword arguments. + To get an overview about the allowed keyword arguments + call the method without arguments. + Valid resource names: background, bg, foreground, fg, + selectbackground, selectforeground.""" + return self._configure(('itemconfigure', index), cnf, kw) + + itemconfig = itemconfigure + + +class Menu(Widget): + """Menu widget which allows displaying menu bars, pull-down menus and pop-up menus.""" + + def __init__(self, master=None, cnf={}, **kw): + """Construct menu widget with the parent MASTER. + + Valid resource names: activebackground, activeborderwidth, + activeforeground, background, bd, bg, borderwidth, cursor, + disabledforeground, fg, font, foreground, postcommand, relief, + selectcolor, takefocus, tearoff, tearoffcommand, title, type.""" + Widget.__init__(self, master, 'menu', cnf, kw) + + def tk_popup(self, x, y, entry=""): + """Post the menu at position X,Y with entry ENTRY.""" + self.tk.call('tk_popup', self._w, x, y, entry) + + def activate(self, index): + """Activate entry at INDEX.""" + self.tk.call(self._w, 'activate', index) + + def add(self, itemType, cnf={}, **kw): + """Internal function.""" + self.tk.call((self._w, 'add', itemType) + + self._options(cnf, kw)) + + def add_cascade(self, cnf={}, **kw): + """Add hierarchical menu item.""" + self.add('cascade', cnf or kw) + + def add_checkbutton(self, cnf={}, **kw): + """Add checkbutton menu item.""" + self.add('checkbutton', cnf or kw) + + def add_command(self, cnf={}, **kw): + """Add command menu item.""" + self.add('command', cnf or kw) + + def add_radiobutton(self, cnf={}, **kw): + """Add radio menu item.""" + self.add('radiobutton', cnf or kw) + + def add_separator(self, cnf={}, **kw): + """Add separator.""" + self.add('separator', cnf or kw) + + def insert(self, index, itemType, cnf={}, **kw): + """Internal function.""" + self.tk.call((self._w, 'insert', index, itemType) + + self._options(cnf, kw)) + + def insert_cascade(self, index, cnf={}, **kw): + """Add hierarchical menu item at INDEX.""" + self.insert(index, 'cascade', cnf or kw) + + def insert_checkbutton(self, index, cnf={}, **kw): + """Add checkbutton menu item at INDEX.""" + self.insert(index, 'checkbutton', cnf or kw) + + def insert_command(self, index, cnf={}, **kw): + """Add command menu item at INDEX.""" + self.insert(index, 'command', cnf or kw) + + def insert_radiobutton(self, index, cnf={}, **kw): + """Add radio menu item at INDEX.""" + self.insert(index, 'radiobutton', cnf or kw) + + def insert_separator(self, index, cnf={}, **kw): + """Add separator at INDEX.""" + self.insert(index, 'separator', cnf or kw) + + def delete(self, index1, index2=None): + """Delete menu items between INDEX1 and INDEX2 (included).""" + if index2 is None: + index2 = index1 + + num_index1, num_index2 = self.index(index1), self.index(index2) + if (num_index1 is None) or (num_index2 is None): + num_index1, num_index2 = 0, -1 + + for i in range(num_index1, num_index2 + 1): + if 'command' in self.entryconfig(i): + c = str(self.entrycget(i, 'command')) + if c: + self.deletecommand(c) + self.tk.call(self._w, 'delete', index1, index2) + + def entrycget(self, index, option): + """Return the resource value of a menu item for OPTION at INDEX.""" + return self.tk.call(self._w, 'entrycget', index, '-' + option) + + def entryconfigure(self, index, cnf=None, **kw): + """Configure a menu item at INDEX.""" + return self._configure(('entryconfigure', index), cnf, kw) + + entryconfig = entryconfigure + + def index(self, index): + """Return the index of a menu item identified by INDEX.""" + i = self.tk.call(self._w, 'index', index) + if i == 'none': return None + return self.tk.getint(i) + + def invoke(self, index): + """Invoke a menu item identified by INDEX and execute + the associated command.""" + return self.tk.call(self._w, 'invoke', index) + + def post(self, x, y): + """Display a menu at position X,Y.""" + self.tk.call(self._w, 'post', x, y) + + def type(self, index): + """Return the type of the menu item at INDEX.""" + return self.tk.call(self._w, 'type', index) + + def unpost(self): + """Unmap a menu.""" + self.tk.call(self._w, 'unpost') + + def xposition(self, index): # new in Tk 8.5 + """Return the x-position of the leftmost pixel of the menu item + at INDEX.""" + return self.tk.getint(self.tk.call(self._w, 'xposition', index)) + + def yposition(self, index): + """Return the y-position of the topmost pixel of the menu item at INDEX.""" + return self.tk.getint(self.tk.call( + self._w, 'yposition', index)) + + +class Menubutton(Widget): + """Menubutton widget, obsolete since Tk8.0.""" + + def __init__(self, master=None, cnf={}, **kw): + Widget.__init__(self, master, 'menubutton', cnf, kw) + + +class Message(Widget): + """Message widget to display multiline text. Obsolete since Label does it too.""" + + def __init__(self, master=None, cnf={}, **kw): + Widget.__init__(self, master, 'message', cnf, kw) + + +class Radiobutton(Widget): + """Radiobutton widget which shows only one of several buttons in on-state.""" + + def __init__(self, master=None, cnf={}, **kw): + """Construct a radiobutton widget with the parent MASTER. + + Valid resource names: activebackground, activeforeground, anchor, + background, bd, bg, bitmap, borderwidth, command, cursor, + disabledforeground, fg, font, foreground, height, + highlightbackground, highlightcolor, highlightthickness, image, + indicatoron, justify, padx, pady, relief, selectcolor, selectimage, + state, takefocus, text, textvariable, underline, value, variable, + width, wraplength.""" + Widget.__init__(self, master, 'radiobutton', cnf, kw) + + def deselect(self): + """Put the button in off-state.""" + + self.tk.call(self._w, 'deselect') + + def flash(self): + """Flash the button.""" + self.tk.call(self._w, 'flash') + + def invoke(self): + """Toggle the button and invoke a command if given as resource.""" + return self.tk.call(self._w, 'invoke') + + def select(self): + """Put the button in on-state.""" + self.tk.call(self._w, 'select') + + +class Scale(Widget): + """Scale widget which can display a numerical scale.""" + + def __init__(self, master=None, cnf={}, **kw): + """Construct a scale widget with the parent MASTER. + + Valid resource names: activebackground, background, bigincrement, bd, + bg, borderwidth, command, cursor, digits, fg, font, foreground, from, + highlightbackground, highlightcolor, highlightthickness, label, + length, orient, relief, repeatdelay, repeatinterval, resolution, + showvalue, sliderlength, sliderrelief, state, takefocus, + tickinterval, to, troughcolor, variable, width.""" + Widget.__init__(self, master, 'scale', cnf, kw) + + def get(self): + """Get the current value as integer or float.""" + value = self.tk.call(self._w, 'get') + try: + return self.tk.getint(value) + except (ValueError, TypeError, TclError): + return self.tk.getdouble(value) + + def set(self, value): + """Set the value to VALUE.""" + self.tk.call(self._w, 'set', value) + + def coords(self, value=None): + """Return a tuple (X,Y) of the point along the centerline of the + trough that corresponds to VALUE or the current value if None is + given.""" + + return self._getints(self.tk.call(self._w, 'coords', value)) + + def identify(self, x, y): + """Return where the point X,Y lies. Valid return values are "slider", + "though1" and "though2".""" + return self.tk.call(self._w, 'identify', x, y) + + +class Scrollbar(Widget): + """Scrollbar widget which displays a slider at a certain position.""" + + def __init__(self, master=None, cnf={}, **kw): + """Construct a scrollbar widget with the parent MASTER. + + Valid resource names: activebackground, activerelief, + background, bd, bg, borderwidth, command, cursor, + elementborderwidth, highlightbackground, + highlightcolor, highlightthickness, jump, orient, + relief, repeatdelay, repeatinterval, takefocus, + troughcolor, width.""" + Widget.__init__(self, master, 'scrollbar', cnf, kw) + + def activate(self, index=None): + """Marks the element indicated by index as active. + The only index values understood by this method are "arrow1", + "slider", or "arrow2". If any other value is specified then no + element of the scrollbar will be active. If index is not specified, + the method returns the name of the element that is currently active, + or None if no element is active.""" + return self.tk.call(self._w, 'activate', index) or None + + def delta(self, deltax, deltay): + """Return the fractional change of the scrollbar setting if it + would be moved by DELTAX or DELTAY pixels.""" + return self.tk.getdouble( + self.tk.call(self._w, 'delta', deltax, deltay)) + + def fraction(self, x, y): + """Return the fractional value which corresponds to a slider + position of X,Y.""" + return self.tk.getdouble(self.tk.call(self._w, 'fraction', x, y)) + + def identify(self, x, y): + """Return the element under position X,Y as one of + "arrow1","slider","arrow2" or "".""" + return self.tk.call(self._w, 'identify', x, y) + + def get(self): + """Return the current fractional values (upper and lower end) + of the slider position.""" + return self._getdoubles(self.tk.call(self._w, 'get')) + + def set(self, first, last): + """Set the fractional values of the slider position (upper and + lower ends as value between 0 and 1).""" + self.tk.call(self._w, 'set', first, last) + + +class Text(Widget, XView, YView): + """Text widget which can display text in various forms.""" + + def __init__(self, master=None, cnf={}, **kw): + """Construct a text widget with the parent MASTER. + + STANDARD OPTIONS + + background, borderwidth, cursor, + exportselection, font, foreground, + highlightbackground, highlightcolor, + highlightthickness, insertbackground, + insertborderwidth, insertofftime, + insertontime, insertwidth, padx, pady, + relief, selectbackground, + selectborderwidth, selectforeground, + setgrid, takefocus, + xscrollcommand, yscrollcommand, + + WIDGET-SPECIFIC OPTIONS + + autoseparators, height, maxundo, + spacing1, spacing2, spacing3, + state, tabs, undo, width, wrap, + + """ + Widget.__init__(self, master, 'text', cnf, kw) + + def bbox(self, index): + """Return a tuple of (x,y,width,height) which gives the bounding + box of the visible part of the character at the given index.""" + return self._getints( + self.tk.call(self._w, 'bbox', index)) or None + + def compare(self, index1, op, index2): + """Return whether between index INDEX1 and index INDEX2 the + relation OP is satisfied. OP is one of <, <=, ==, >=, >, or !=.""" + return self.tk.getboolean(self.tk.call( + self._w, 'compare', index1, op, index2)) + + def count(self, index1, index2, *args): # new in Tk 8.5 + """Counts the number of relevant things between the two indices. + If index1 is after index2, the result will be a negative number + (and this holds for each of the possible options). + + The actual items which are counted depends on the options given by + args. The result is a list of integers, one for the result of each + counting option given. Valid counting options are "chars", + "displaychars", "displayindices", "displaylines", "indices", + "lines", "xpixels" and "ypixels". There is an additional possible + option "update", which if given then all subsequent options ensure + that any possible out of date information is recalculated.""" + args = ['-%s' % arg for arg in args] + args += [index1, index2] + res = self.tk.call(self._w, 'count', *args) or None + if res is not None and len(args) <= 3: + return (res, ) + else: + return res + + def debug(self, boolean=None): + """Turn on the internal consistency checks of the B-Tree inside the text + widget according to BOOLEAN.""" + if boolean is None: + return self.tk.getboolean(self.tk.call(self._w, 'debug')) + self.tk.call(self._w, 'debug', boolean) + + def delete(self, index1, index2=None): + """Delete the characters between INDEX1 and INDEX2 (not included).""" + self.tk.call(self._w, 'delete', index1, index2) + + def dlineinfo(self, index): + """Return tuple (x,y,width,height,baseline) giving the bounding box + and baseline position of the visible part of the line containing + the character at INDEX.""" + return self._getints(self.tk.call(self._w, 'dlineinfo', index)) + + def dump(self, index1, index2=None, command=None, **kw): + """Return the contents of the widget between index1 and index2. + + The type of contents returned in filtered based on the keyword + parameters; if 'all', 'image', 'mark', 'tag', 'text', or 'window' are + given and true, then the corresponding items are returned. The result + is a list of triples of the form (key, value, index). If none of the + keywords are true then 'all' is used by default. + + If the 'command' argument is given, it is called once for each element + of the list of triples, with the values of each triple serving as the + arguments to the function. In this case the list is not returned.""" + args = [] + func_name = None + result = None + if not command: + # Never call the dump command without the -command flag, since the + # output could involve Tcl quoting and would be a pain to parse + # right. Instead just set the command to build a list of triples + # as if we had done the parsing. + result = [] + def append_triple(key, value, index, result=result): + result.append((key, value, index)) + command = append_triple + try: + if not isinstance(command, str): + func_name = command = self._register(command) + args += ["-command", command] + for key in kw: + if kw[key]: args.append("-" + key) + args.append(index1) + if index2: + args.append(index2) + self.tk.call(self._w, "dump", *args) + return result + finally: + if func_name: + self.deletecommand(func_name) + + ## new in tk8.4 + def edit(self, *args): + """Internal method + + This method controls the undo mechanism and + the modified flag. The exact behavior of the + command depends on the option argument that + follows the edit argument. The following forms + of the command are currently supported: + + edit_modified, edit_redo, edit_reset, edit_separator + and edit_undo + + """ + return self.tk.call(self._w, 'edit', *args) + + def edit_modified(self, arg=None): + """Get or Set the modified flag + + If arg is not specified, returns the modified + flag of the widget. The insert, delete, edit undo and + edit redo commands or the user can set or clear the + modified flag. If boolean is specified, sets the + modified flag of the widget to arg. + """ + return self.edit("modified", arg) + + def edit_redo(self): + """Redo the last undone edit + + When the undo option is true, reapplies the last + undone edits provided no other edits were done since + then. Generates an error when the redo stack is empty. + Does nothing when the undo option is false. + """ + return self.edit("redo") + + def edit_reset(self): + """Clears the undo and redo stacks + """ + return self.edit("reset") + + def edit_separator(self): + """Inserts a separator (boundary) on the undo stack. + + Does nothing when the undo option is false + """ + return self.edit("separator") + + def edit_undo(self): + """Undoes the last edit action + + If the undo option is true. An edit action is defined + as all the insert and delete commands that are recorded + on the undo stack in between two separators. Generates + an error when the undo stack is empty. Does nothing + when the undo option is false + """ + return self.edit("undo") + + def get(self, index1, index2=None): + """Return the text from INDEX1 to INDEX2 (not included).""" + return self.tk.call(self._w, 'get', index1, index2) + # (Image commands are new in 8.0) + + def image_cget(self, index, option): + """Return the value of OPTION of an embedded image at INDEX.""" + if option[:1] != "-": + option = "-" + option + if option[-1:] == "_": + option = option[:-1] + return self.tk.call(self._w, "image", "cget", index, option) + + def image_configure(self, index, cnf=None, **kw): + """Configure an embedded image at INDEX.""" + return self._configure(('image', 'configure', index), cnf, kw) + + def image_create(self, index, cnf={}, **kw): + """Create an embedded image at INDEX.""" + return self.tk.call( + self._w, "image", "create", index, + *self._options(cnf, kw)) + + def image_names(self): + """Return all names of embedded images in this widget.""" + return self.tk.call(self._w, "image", "names") + + def index(self, index): + """Return the index in the form line.char for INDEX.""" + return str(self.tk.call(self._w, 'index', index)) + + def insert(self, index, chars, *args): + """Insert CHARS before the characters at INDEX. An additional + tag can be given in ARGS. Additional CHARS and tags can follow in ARGS.""" + self.tk.call((self._w, 'insert', index, chars) + args) + + def mark_gravity(self, markName, direction=None): + """Change the gravity of a mark MARKNAME to DIRECTION (LEFT or RIGHT). + Return the current value if None is given for DIRECTION.""" + return self.tk.call( + (self._w, 'mark', 'gravity', markName, direction)) + + def mark_names(self): + """Return all mark names.""" + return self.tk.splitlist(self.tk.call( + self._w, 'mark', 'names')) + + def mark_set(self, markName, index): + """Set mark MARKNAME before the character at INDEX.""" + self.tk.call(self._w, 'mark', 'set', markName, index) + + def mark_unset(self, *markNames): + """Delete all marks in MARKNAMES.""" + self.tk.call((self._w, 'mark', 'unset') + markNames) + + def mark_next(self, index): + """Return the name of the next mark after INDEX.""" + return self.tk.call(self._w, 'mark', 'next', index) or None + + def mark_previous(self, index): + """Return the name of the previous mark before INDEX.""" + return self.tk.call(self._w, 'mark', 'previous', index) or None + + def peer_create(self, newPathName, cnf={}, **kw): # new in Tk 8.5 + """Creates a peer text widget with the given newPathName, and any + optional standard configuration options. By default the peer will + have the same start and end line as the parent widget, but + these can be overridden with the standard configuration options.""" + self.tk.call(self._w, 'peer', 'create', newPathName, + *self._options(cnf, kw)) + + def peer_names(self): # new in Tk 8.5 + """Returns a list of peers of this widget (this does not include + the widget itself).""" + return self.tk.splitlist(self.tk.call(self._w, 'peer', 'names')) + + def replace(self, index1, index2, chars, *args): # new in Tk 8.5 + """Replaces the range of characters between index1 and index2 with + the given characters and tags specified by args. + + See the method insert for some more information about args, and the + method delete for information about the indices.""" + self.tk.call(self._w, 'replace', index1, index2, chars, *args) + + def scan_mark(self, x, y): + """Remember the current X, Y coordinates.""" + self.tk.call(self._w, 'scan', 'mark', x, y) + + def scan_dragto(self, x, y): + """Adjust the view of the text to 10 times the + difference between X and Y and the coordinates given in + scan_mark.""" + self.tk.call(self._w, 'scan', 'dragto', x, y) + + def search(self, pattern, index, stopindex=None, + forwards=None, backwards=None, exact=None, + regexp=None, nocase=None, count=None, elide=None): + """Search PATTERN beginning from INDEX until STOPINDEX. + Return the index of the first character of a match or an + empty string.""" + args = [self._w, 'search'] + if forwards: args.append('-forwards') + if backwards: args.append('-backwards') + if exact: args.append('-exact') + if regexp: args.append('-regexp') + if nocase: args.append('-nocase') + if elide: args.append('-elide') + if count: args.append('-count'); args.append(count) + if pattern and pattern[0] == '-': args.append('--') + args.append(pattern) + args.append(index) + if stopindex: args.append(stopindex) + return str(self.tk.call(tuple(args))) + + def see(self, index): + """Scroll such that the character at INDEX is visible.""" + self.tk.call(self._w, 'see', index) + + def tag_add(self, tagName, index1, *args): + """Add tag TAGNAME to all characters between INDEX1 and index2 in ARGS. + Additional pairs of indices may follow in ARGS.""" + self.tk.call( + (self._w, 'tag', 'add', tagName, index1) + args) + + def tag_unbind(self, tagName, sequence, funcid=None): + """Unbind for all characters with TAGNAME for event SEQUENCE the + function identified with FUNCID.""" + self.tk.call(self._w, 'tag', 'bind', tagName, sequence, '') + if funcid: + self.deletecommand(funcid) + + def tag_bind(self, tagName, sequence, func, add=None): + """Bind to all characters with TAGNAME at event SEQUENCE a call to function FUNC. + + An additional boolean parameter ADD specifies whether FUNC will be + called additionally to the other bound function or whether it will + replace the previous function. See bind for the return value.""" + return self._bind((self._w, 'tag', 'bind', tagName), + sequence, func, add) + + def tag_cget(self, tagName, option): + """Return the value of OPTION for tag TAGNAME.""" + if option[:1] != '-': + option = '-' + option + if option[-1:] == '_': + option = option[:-1] + return self.tk.call(self._w, 'tag', 'cget', tagName, option) + + def tag_configure(self, tagName, cnf=None, **kw): + """Configure a tag TAGNAME.""" + return self._configure(('tag', 'configure', tagName), cnf, kw) + + tag_config = tag_configure + + def tag_delete(self, *tagNames): + """Delete all tags in TAGNAMES.""" + self.tk.call((self._w, 'tag', 'delete') + tagNames) + + def tag_lower(self, tagName, belowThis=None): + """Change the priority of tag TAGNAME such that it is lower + than the priority of BELOWTHIS.""" + self.tk.call(self._w, 'tag', 'lower', tagName, belowThis) + + def tag_names(self, index=None): + """Return a list of all tag names.""" + return self.tk.splitlist( + self.tk.call(self._w, 'tag', 'names', index)) + + def tag_nextrange(self, tagName, index1, index2=None): + """Return a list of start and end index for the first sequence of + characters between INDEX1 and INDEX2 which all have tag TAGNAME. + The text is searched forward from INDEX1.""" + return self.tk.splitlist(self.tk.call( + self._w, 'tag', 'nextrange', tagName, index1, index2)) + + def tag_prevrange(self, tagName, index1, index2=None): + """Return a list of start and end index for the first sequence of + characters between INDEX1 and INDEX2 which all have tag TAGNAME. + The text is searched backwards from INDEX1.""" + return self.tk.splitlist(self.tk.call( + self._w, 'tag', 'prevrange', tagName, index1, index2)) + + def tag_raise(self, tagName, aboveThis=None): + """Change the priority of tag TAGNAME such that it is higher + than the priority of ABOVETHIS.""" + self.tk.call( + self._w, 'tag', 'raise', tagName, aboveThis) + + def tag_ranges(self, tagName): + """Return a list of ranges of text which have tag TAGNAME.""" + return self.tk.splitlist(self.tk.call( + self._w, 'tag', 'ranges', tagName)) + + def tag_remove(self, tagName, index1, index2=None): + """Remove tag TAGNAME from all characters between INDEX1 and INDEX2.""" + self.tk.call( + self._w, 'tag', 'remove', tagName, index1, index2) + + def window_cget(self, index, option): + """Return the value of OPTION of an embedded window at INDEX.""" + if option[:1] != '-': + option = '-' + option + if option[-1:] == '_': + option = option[:-1] + return self.tk.call(self._w, 'window', 'cget', index, option) + + def window_configure(self, index, cnf=None, **kw): + """Configure an embedded window at INDEX.""" + return self._configure(('window', 'configure', index), cnf, kw) + + window_config = window_configure + + def window_create(self, index, cnf={}, **kw): + """Create a window at INDEX.""" + self.tk.call( + (self._w, 'window', 'create', index) + + self._options(cnf, kw)) + + def window_names(self): + """Return all names of embedded windows in this widget.""" + return self.tk.splitlist( + self.tk.call(self._w, 'window', 'names')) + + def yview_pickplace(self, *what): + """Obsolete function, use see.""" + self.tk.call((self._w, 'yview', '-pickplace') + what) + + +class _setit: + """Internal class. It wraps the command in the widget OptionMenu.""" + + def __init__(self, var, value, callback=None): + self.__value = value + self.__var = var + self.__callback = callback + + def __call__(self, *args): + self.__var.set(self.__value) + if self.__callback is not None: + self.__callback(self.__value, *args) + + +class OptionMenu(Menubutton): + """OptionMenu which allows the user to select a value from a menu.""" + + def __init__(self, master, variable, value, *values, **kwargs): + """Construct an optionmenu widget with the parent MASTER, with + the resource textvariable set to VARIABLE, the initially selected + value VALUE, the other menu values VALUES and an additional + keyword argument command.""" + kw = {"borderwidth": 2, "textvariable": variable, + "indicatoron": 1, "relief": RAISED, "anchor": "c", + "highlightthickness": 2} + Widget.__init__(self, master, "menubutton", kw) + self.widgetName = 'tk_optionMenu' + menu = self.__menu = Menu(self, name="menu", tearoff=0) + self.menuname = menu._w + # 'command' is the only supported keyword + callback = kwargs.get('command') + if 'command' in kwargs: + del kwargs['command'] + if kwargs: + raise TclError('unknown option -'+next(iter(kwargs))) + menu.add_command(label=value, + command=_setit(variable, value, callback)) + for v in values: + menu.add_command(label=v, + command=_setit(variable, v, callback)) + self["menu"] = menu + + def __getitem__(self, name): + if name == 'menu': + return self.__menu + return Widget.__getitem__(self, name) + + def destroy(self): + """Destroy this widget and the associated menu.""" + Menubutton.destroy(self) + self.__menu = None + + +class Image: + """Base class for images.""" + _last_id = 0 + + def __init__(self, imgtype, name=None, cnf={}, master=None, **kw): + self.name = None + if master is None: + master = _get_default_root('create image') + self.tk = getattr(master, 'tk', master) + if not name: + Image._last_id += 1 + name = "pyimage%r" % (Image._last_id,) # tk itself would use image + if kw and cnf: cnf = _cnfmerge((cnf, kw)) + elif kw: cnf = kw + options = () + for k, v in cnf.items(): + if callable(v): + v = self._register(v) + options = options + ('-'+k, v) + self.tk.call(('image', 'create', imgtype, name,) + options) + self.name = name + + def __str__(self): return self.name + + def __del__(self): + if self.name: + try: + self.tk.call('image', 'delete', self.name) + except TclError: + # May happen if the root was destroyed + pass + + def __setitem__(self, key, value): + self.tk.call(self.name, 'configure', '-'+key, value) + + def __getitem__(self, key): + return self.tk.call(self.name, 'configure', '-'+key) + + def configure(self, **kw): + """Configure the image.""" + res = () + for k, v in _cnfmerge(kw).items(): + if v is not None: + if k[-1] == '_': k = k[:-1] + if callable(v): + v = self._register(v) + res = res + ('-'+k, v) + self.tk.call((self.name, 'config') + res) + + config = configure + + def height(self): + """Return the height of the image.""" + return self.tk.getint( + self.tk.call('image', 'height', self.name)) + + def type(self): + """Return the type of the image, e.g. "photo" or "bitmap".""" + return self.tk.call('image', 'type', self.name) + + def width(self): + """Return the width of the image.""" + return self.tk.getint( + self.tk.call('image', 'width', self.name)) + + +class PhotoImage(Image): + """Widget which can display images in PGM, PPM, GIF, PNG format.""" + + def __init__(self, name=None, cnf={}, master=None, **kw): + """Create an image with NAME. + + Valid resource names: data, format, file, gamma, height, palette, + width.""" + Image.__init__(self, 'photo', name, cnf, master, **kw) + + def blank(self): + """Display a transparent image.""" + self.tk.call(self.name, 'blank') + + def cget(self, option): + """Return the value of OPTION.""" + return self.tk.call(self.name, 'cget', '-' + option) + # XXX config + + def __getitem__(self, key): + return self.tk.call(self.name, 'cget', '-' + key) + # XXX copy -from, -to, ...? + + def copy(self): + """Return a new PhotoImage with the same image as this widget.""" + destImage = PhotoImage(master=self.tk) + self.tk.call(destImage, 'copy', self.name) + return destImage + + def zoom(self, x, y=''): + """Return a new PhotoImage with the same image as this widget + but zoom it with a factor of x in the X direction and y in the Y + direction. If y is not given, the default value is the same as x. + """ + destImage = PhotoImage(master=self.tk) + if y=='': y=x + self.tk.call(destImage, 'copy', self.name, '-zoom',x,y) + return destImage + + def subsample(self, x, y=''): + """Return a new PhotoImage based on the same image as this widget + but use only every Xth or Yth pixel. If y is not given, the + default value is the same as x. + """ + destImage = PhotoImage(master=self.tk) + if y=='': y=x + self.tk.call(destImage, 'copy', self.name, '-subsample',x,y) + return destImage + + def get(self, x, y): + """Return the color (red, green, blue) of the pixel at X,Y.""" + return self.tk.call(self.name, 'get', x, y) + + def put(self, data, to=None): + """Put row formatted colors to image starting from + position TO, e.g. image.put("{red green} {blue yellow}", to=(4,6))""" + args = (self.name, 'put', data) + if to: + if to[0] == '-to': + to = to[1:] + args = args + ('-to',) + tuple(to) + self.tk.call(args) + # XXX read + + def write(self, filename, format=None, from_coords=None): + """Write image to file FILENAME in FORMAT starting from + position FROM_COORDS.""" + args = (self.name, 'write', filename) + if format: + args = args + ('-format', format) + if from_coords: + args = args + ('-from',) + tuple(from_coords) + self.tk.call(args) + + def transparency_get(self, x, y): + """Return True if the pixel at x,y is transparent.""" + return self.tk.getboolean(self.tk.call( + self.name, 'transparency', 'get', x, y)) + + def transparency_set(self, x, y, boolean): + """Set the transparency of the pixel at x,y.""" + self.tk.call(self.name, 'transparency', 'set', x, y, boolean) + + +class BitmapImage(Image): + """Widget which can display images in XBM format.""" + + def __init__(self, name=None, cnf={}, master=None, **kw): + """Create a bitmap with NAME. + + Valid resource names: background, data, file, foreground, maskdata, maskfile.""" + Image.__init__(self, 'bitmap', name, cnf, master, **kw) + + +def image_names(): + tk = _get_default_root('use image_names()').tk + return tk.splitlist(tk.call('image', 'names')) + + +def image_types(): + tk = _get_default_root('use image_types()').tk + return tk.splitlist(tk.call('image', 'types')) + + +class Spinbox(Widget, XView): + """spinbox widget.""" + + def __init__(self, master=None, cnf={}, **kw): + """Construct a spinbox widget with the parent MASTER. + + STANDARD OPTIONS + + activebackground, background, borderwidth, + cursor, exportselection, font, foreground, + highlightbackground, highlightcolor, + highlightthickness, insertbackground, + insertborderwidth, insertofftime, + insertontime, insertwidth, justify, relief, + repeatdelay, repeatinterval, + selectbackground, selectborderwidth + selectforeground, takefocus, textvariable + xscrollcommand. + + WIDGET-SPECIFIC OPTIONS + + buttonbackground, buttoncursor, + buttondownrelief, buttonuprelief, + command, disabledbackground, + disabledforeground, format, from, + invalidcommand, increment, + readonlybackground, state, to, + validate, validatecommand values, + width, wrap, + """ + Widget.__init__(self, master, 'spinbox', cnf, kw) + + def bbox(self, index): + """Return a tuple of X1,Y1,X2,Y2 coordinates for a + rectangle which encloses the character given by index. + + The first two elements of the list give the x and y + coordinates of the upper-left corner of the screen + area covered by the character (in pixels relative + to the widget) and the last two elements give the + width and height of the character, in pixels. The + bounding box may refer to a region outside the + visible area of the window. + """ + return self._getints(self.tk.call(self._w, 'bbox', index)) or None + + def delete(self, first, last=None): + """Delete one or more elements of the spinbox. + + First is the index of the first character to delete, + and last is the index of the character just after + the last one to delete. If last isn't specified it + defaults to first+1, i.e. a single character is + deleted. This command returns an empty string. + """ + return self.tk.call(self._w, 'delete', first, last) + + def get(self): + """Returns the spinbox's string""" + return self.tk.call(self._w, 'get') + + def icursor(self, index): + """Alter the position of the insertion cursor. + + The insertion cursor will be displayed just before + the character given by index. Returns an empty string + """ + return self.tk.call(self._w, 'icursor', index) + + def identify(self, x, y): + """Returns the name of the widget at position x, y + + Return value is one of: none, buttondown, buttonup, entry + """ + return self.tk.call(self._w, 'identify', x, y) + + def index(self, index): + """Returns the numerical index corresponding to index + """ + return self.tk.call(self._w, 'index', index) + + def insert(self, index, s): + """Insert string s at index + + Returns an empty string. + """ + return self.tk.call(self._w, 'insert', index, s) + + def invoke(self, element): + """Causes the specified element to be invoked + + The element could be buttondown or buttonup + triggering the action associated with it. + """ + return self.tk.call(self._w, 'invoke', element) + + def scan(self, *args): + """Internal function.""" + return self._getints( + self.tk.call((self._w, 'scan') + args)) or () + + def scan_mark(self, x): + """Records x and the current view in the spinbox window; + + used in conjunction with later scan dragto commands. + Typically this command is associated with a mouse button + press in the widget. It returns an empty string. + """ + return self.scan("mark", x) + + def scan_dragto(self, x): + """Compute the difference between the given x argument + and the x argument to the last scan mark command + + It then adjusts the view left or right by 10 times the + difference in x-coordinates. This command is typically + associated with mouse motion events in the widget, to + produce the effect of dragging the spinbox at high speed + through the window. The return value is an empty string. + """ + return self.scan("dragto", x) + + def selection(self, *args): + """Internal function.""" + return self._getints( + self.tk.call((self._w, 'selection') + args)) or () + + def selection_adjust(self, index): + """Locate the end of the selection nearest to the character + given by index, + + Then adjust that end of the selection to be at index + (i.e including but not going beyond index). The other + end of the selection is made the anchor point for future + select to commands. If the selection isn't currently in + the spinbox, then a new selection is created to include + the characters between index and the most recent selection + anchor point, inclusive. + """ + return self.selection("adjust", index) + + def selection_clear(self): + """Clear the selection + + If the selection isn't in this widget then the + command has no effect. + """ + return self.selection("clear") + + def selection_element(self, element=None): + """Sets or gets the currently selected element. + + If a spinbutton element is specified, it will be + displayed depressed. + """ + return self.tk.call(self._w, 'selection', 'element', element) + + def selection_from(self, index): + """Set the fixed end of a selection to INDEX.""" + self.selection('from', index) + + def selection_present(self): + """Return True if there are characters selected in the spinbox, False + otherwise.""" + return self.tk.getboolean( + self.tk.call(self._w, 'selection', 'present')) + + def selection_range(self, start, end): + """Set the selection from START to END (not included).""" + self.selection('range', start, end) + + def selection_to(self, index): + """Set the variable end of a selection to INDEX.""" + self.selection('to', index) + +########################################################################### + + +class LabelFrame(Widget): + """labelframe widget.""" + + def __init__(self, master=None, cnf={}, **kw): + """Construct a labelframe widget with the parent MASTER. + + STANDARD OPTIONS + + borderwidth, cursor, font, foreground, + highlightbackground, highlightcolor, + highlightthickness, padx, pady, relief, + takefocus, text + + WIDGET-SPECIFIC OPTIONS + + background, class, colormap, container, + height, labelanchor, labelwidget, + visual, width + """ + Widget.__init__(self, master, 'labelframe', cnf, kw) + +######################################################################## + + +class PanedWindow(Widget): + """panedwindow widget.""" + + def __init__(self, master=None, cnf={}, **kw): + """Construct a panedwindow widget with the parent MASTER. + + STANDARD OPTIONS + + background, borderwidth, cursor, height, + orient, relief, width + + WIDGET-SPECIFIC OPTIONS + + handlepad, handlesize, opaqueresize, + sashcursor, sashpad, sashrelief, + sashwidth, showhandle, + """ + Widget.__init__(self, master, 'panedwindow', cnf, kw) + + def add(self, child, **kw): + """Add a child widget to the panedwindow in a new pane. + + The child argument is the name of the child widget + followed by pairs of arguments that specify how to + manage the windows. The possible options and values + are the ones accepted by the paneconfigure method. + """ + self.tk.call((self._w, 'add', child) + self._options(kw)) + + def remove(self, child): + """Remove the pane containing child from the panedwindow + + All geometry management options for child will be forgotten. + """ + self.tk.call(self._w, 'forget', child) + + forget = remove + + def identify(self, x, y): + """Identify the panedwindow component at point x, y + + If the point is over a sash or a sash handle, the result + is a two element list containing the index of the sash or + handle, and a word indicating whether it is over a sash + or a handle, such as {0 sash} or {2 handle}. If the point + is over any other part of the panedwindow, the result is + an empty list. + """ + return self.tk.call(self._w, 'identify', x, y) + + def proxy(self, *args): + """Internal function.""" + return self._getints( + self.tk.call((self._w, 'proxy') + args)) or () + + def proxy_coord(self): + """Return the x and y pair of the most recent proxy location + """ + return self.proxy("coord") + + def proxy_forget(self): + """Remove the proxy from the display. + """ + return self.proxy("forget") + + def proxy_place(self, x, y): + """Place the proxy at the given x and y coordinates. + """ + return self.proxy("place", x, y) + + def sash(self, *args): + """Internal function.""" + return self._getints( + self.tk.call((self._w, 'sash') + args)) or () + + def sash_coord(self, index): + """Return the current x and y pair for the sash given by index. + + Index must be an integer between 0 and 1 less than the + number of panes in the panedwindow. The coordinates given are + those of the top left corner of the region containing the sash. + pathName sash dragto index x y This command computes the + difference between the given coordinates and the coordinates + given to the last sash coord command for the given sash. It then + moves that sash the computed difference. The return value is the + empty string. + """ + return self.sash("coord", index) + + def sash_mark(self, index): + """Records x and y for the sash given by index; + + Used in conjunction with later dragto commands to move the sash. + """ + return self.sash("mark", index) + + def sash_place(self, index, x, y): + """Place the sash given by index at the given coordinates + """ + return self.sash("place", index, x, y) + + def panecget(self, child, option): + """Query a management option for window. + + Option may be any value allowed by the paneconfigure subcommand + """ + return self.tk.call( + (self._w, 'panecget') + (child, '-'+option)) + + def paneconfigure(self, tagOrId, cnf=None, **kw): + """Query or modify the management options for window. + + If no option is specified, returns a list describing all + of the available options for pathName. If option is + specified with no value, then the command returns a list + describing the one named option (this list will be identical + to the corresponding sublist of the value returned if no + option is specified). If one or more option-value pairs are + specified, then the command modifies the given widget + option(s) to have the given value(s); in this case the + command returns an empty string. The following options + are supported: + + after window + Insert the window after the window specified. window + should be the name of a window already managed by pathName. + before window + Insert the window before the window specified. window + should be the name of a window already managed by pathName. + height size + Specify a height for the window. The height will be the + outer dimension of the window including its border, if + any. If size is an empty string, or if -height is not + specified, then the height requested internally by the + window will be used initially; the height may later be + adjusted by the movement of sashes in the panedwindow. + Size may be any value accepted by Tk_GetPixels. + minsize n + Specifies that the size of the window cannot be made + less than n. This constraint only affects the size of + the widget in the paned dimension -- the x dimension + for horizontal panedwindows, the y dimension for + vertical panedwindows. May be any value accepted by + Tk_GetPixels. + padx n + Specifies a non-negative value indicating how much + extra space to leave on each side of the window in + the X-direction. The value may have any of the forms + accepted by Tk_GetPixels. + pady n + Specifies a non-negative value indicating how much + extra space to leave on each side of the window in + the Y-direction. The value may have any of the forms + accepted by Tk_GetPixels. + sticky style + If a window's pane is larger than the requested + dimensions of the window, this option may be used + to position (or stretch) the window within its pane. + Style is a string that contains zero or more of the + characters n, s, e or w. The string can optionally + contains spaces or commas, but they are ignored. Each + letter refers to a side (north, south, east, or west) + that the window will "stick" to. If both n and s + (or e and w) are specified, the window will be + stretched to fill the entire height (or width) of + its cavity. + width size + Specify a width for the window. The width will be + the outer dimension of the window including its + border, if any. If size is an empty string, or + if -width is not specified, then the width requested + internally by the window will be used initially; the + width may later be adjusted by the movement of sashes + in the panedwindow. Size may be any value accepted by + Tk_GetPixels. + + """ + if cnf is None and not kw: + return self._getconfigure(self._w, 'paneconfigure', tagOrId) + if isinstance(cnf, str) and not kw: + return self._getconfigure1( + self._w, 'paneconfigure', tagOrId, '-'+cnf) + self.tk.call((self._w, 'paneconfigure', tagOrId) + + self._options(cnf, kw)) + + paneconfig = paneconfigure + + def panes(self): + """Returns an ordered list of the child panes.""" + return self.tk.splitlist(self.tk.call(self._w, 'panes')) + +# Test: + + +def _test(): + root = Tk() + text = "This is Tcl/Tk version %s" % TclVersion + text += "\nThis should be a cedilla: \xe7" + label = Label(root, text=text) + label.pack() + test = Button(root, text="Click me!", + command=lambda root=root: root.test.configure( + text="[%s]" % root.test['text'])) + test.pack() + root.test = test + quit = Button(root, text="QUIT", command=root.destroy) + quit.pack() + # The following three commands are needed so the window pops + # up on top on Windows... + root.iconify() + root.update() + root.deiconify() + root.mainloop() + + +__all__ = [name for name, obj in globals().items() + if not name.startswith('_') and not isinstance(obj, types.ModuleType) + and name not in {'wantobjects'}] + +if __name__ == '__main__': + _test() diff --git a/miniconda3/envs/active_proaction/lib/python3.10/tkinter/__main__.py b/miniconda3/envs/active_proaction/lib/python3.10/tkinter/__main__.py new file mode 100644 index 0000000000000000000000000000000000000000..757880d439c02c359378c42becaf243c60484cb3 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/tkinter/__main__.py @@ -0,0 +1,7 @@ +"""Main entry point""" + +import sys +if sys.argv[0].endswith("__main__.py"): + sys.argv[0] = "python -m tkinter" +from . import _test as main +main() diff --git a/miniconda3/envs/active_proaction/lib/python3.10/tkinter/colorchooser.py b/miniconda3/envs/active_proaction/lib/python3.10/tkinter/colorchooser.py new file mode 100644 index 0000000000000000000000000000000000000000..e2fb69dba927633e614d9438a20ecee6de6b7260 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/tkinter/colorchooser.py @@ -0,0 +1,86 @@ +# tk common color chooser dialogue +# +# this module provides an interface to the native color dialogue +# available in Tk 4.2 and newer. +# +# written by Fredrik Lundh, May 1997 +# +# fixed initialcolor handling in August 1998 +# + + +from tkinter.commondialog import Dialog + +__all__ = ["Chooser", "askcolor"] + + +class Chooser(Dialog): + """Create a dialog for the tk_chooseColor command. + + Args: + master: The master widget for this dialog. If not provided, + defaults to options['parent'] (if defined). + options: Dictionary of options for the tk_chooseColor call. + initialcolor: Specifies the selected color when the + dialog is first displayed. This can be a tk color + string or a 3-tuple of ints in the range (0, 255) + for an RGB triplet. + parent: The parent window of the color dialog. The + color dialog is displayed on top of this. + title: A string for the title of the dialog box. + """ + + command = "tk_chooseColor" + + def _fixoptions(self): + """Ensure initialcolor is a tk color string. + + Convert initialcolor from a RGB triplet to a color string. + """ + try: + color = self.options["initialcolor"] + if isinstance(color, tuple): + # Assume an RGB triplet. + self.options["initialcolor"] = "#%02x%02x%02x" % color + except KeyError: + pass + + def _fixresult(self, widget, result): + """Adjust result returned from call to tk_chooseColor. + + Return both an RGB tuple of ints in the range (0, 255) and the + tk color string in the form #rrggbb. + """ + # Result can be many things: an empty tuple, an empty string, or + # a _tkinter.Tcl_Obj, so this somewhat weird check handles that. + if not result or not str(result): + return None, None # canceled + + # To simplify application code, the color chooser returns + # an RGB tuple together with the Tk color string. + r, g, b = widget.winfo_rgb(result) + return (r//256, g//256, b//256), str(result) + + +# +# convenience stuff + +def askcolor(color=None, **options): + """Display dialog window for selection of a color. + + Convenience wrapper for the Chooser class. Displays the color + chooser dialog with color as the initial value. + """ + + if color: + options = options.copy() + options["initialcolor"] = color + + return Chooser(**options).show() + + +# -------------------------------------------------------------------- +# test stuff + +if __name__ == "__main__": + print("color", askcolor()) diff --git a/miniconda3/envs/active_proaction/lib/python3.10/tkinter/commondialog.py b/miniconda3/envs/active_proaction/lib/python3.10/tkinter/commondialog.py new file mode 100644 index 0000000000000000000000000000000000000000..e595c99defb9910fd67f1d8636d6a4aeb0f6a908 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/tkinter/commondialog.py @@ -0,0 +1,53 @@ +# base class for tk common dialogues +# +# this module provides a base class for accessing the common +# dialogues available in Tk 4.2 and newer. use filedialog, +# colorchooser, and messagebox to access the individual +# dialogs. +# +# written by Fredrik Lundh, May 1997 +# + +__all__ = ["Dialog"] + +from tkinter import Frame, _get_temp_root, _destroy_temp_root + + +class Dialog: + + command = None + + def __init__(self, master=None, **options): + if master is None: + master = options.get('parent') + self.master = master + self.options = options + + def _fixoptions(self): + pass # hook + + def _fixresult(self, widget, result): + return result # hook + + def show(self, **options): + + # update instance options + for k, v in options.items(): + self.options[k] = v + + self._fixoptions() + + master = self.master + if master is None: + master = _get_temp_root() + try: + self._test_callback(master) # The function below is replaced for some tests. + s = master.tk.call(self.command, *master._options(self.options)) + s = self._fixresult(master, s) + finally: + _destroy_temp_root(master) + + return s + + def _test_callback(self, master): + pass diff --git a/miniconda3/envs/active_proaction/lib/python3.10/tkinter/constants.py b/miniconda3/envs/active_proaction/lib/python3.10/tkinter/constants.py new file mode 100644 index 0000000000000000000000000000000000000000..63eee33d24d6c7e2a3bfb504999a74ec34b53d07 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/tkinter/constants.py @@ -0,0 +1,110 @@ +# Symbolic constants for Tk + +# Booleans +NO=FALSE=OFF=0 +YES=TRUE=ON=1 + +# -anchor and -sticky +N='n' +S='s' +W='w' +E='e' +NW='nw' +SW='sw' +NE='ne' +SE='se' +NS='ns' +EW='ew' +NSEW='nsew' +CENTER='center' + +# -fill +NONE='none' +X='x' +Y='y' +BOTH='both' + +# -side +LEFT='left' +TOP='top' +RIGHT='right' +BOTTOM='bottom' + +# -relief +RAISED='raised' +SUNKEN='sunken' +FLAT='flat' +RIDGE='ridge' +GROOVE='groove' +SOLID = 'solid' + +# -orient +HORIZONTAL='horizontal' +VERTICAL='vertical' + +# -tabs +NUMERIC='numeric' + +# -wrap +CHAR='char' +WORD='word' + +# -align +BASELINE='baseline' + +# -bordermode +INSIDE='inside' +OUTSIDE='outside' + +# Special tags, marks and insert positions +SEL='sel' +SEL_FIRST='sel.first' +SEL_LAST='sel.last' +END='end' +INSERT='insert' +CURRENT='current' +ANCHOR='anchor' +ALL='all' # e.g. Canvas.delete(ALL) + +# Text widget and button states +NORMAL='normal' +DISABLED='disabled' +ACTIVE='active' +# Canvas state +HIDDEN='hidden' + +# Menu item types +CASCADE='cascade' +CHECKBUTTON='checkbutton' +COMMAND='command' +RADIOBUTTON='radiobutton' +SEPARATOR='separator' + +# Selection modes for list boxes +SINGLE='single' +BROWSE='browse' +MULTIPLE='multiple' +EXTENDED='extended' + +# Activestyle for list boxes +# NONE='none' is also valid +DOTBOX='dotbox' +UNDERLINE='underline' + +# Various canvas styles +PIESLICE='pieslice' +CHORD='chord' +ARC='arc' +FIRST='first' +LAST='last' +BUTT='butt' +PROJECTING='projecting' +ROUND='round' +BEVEL='bevel' +MITER='miter' + +# Arguments to xview/yview +MOVETO='moveto' +SCROLL='scroll' +UNITS='units' +PAGES='pages' diff --git a/miniconda3/envs/active_proaction/lib/python3.10/tkinter/dialog.py b/miniconda3/envs/active_proaction/lib/python3.10/tkinter/dialog.py new file mode 100644 index 0000000000000000000000000000000000000000..36ae6c277cb66ac86a48f42d07ce4c08dce10738 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/tkinter/dialog.py @@ -0,0 +1,49 @@ +# dialog.py -- Tkinter interface to the tk_dialog script. + +from tkinter import _cnfmerge, Widget, TclError, Button, Pack + +__all__ = ["Dialog"] + +DIALOG_ICON = 'questhead' + + +class Dialog(Widget): + def __init__(self, master=None, cnf={}, **kw): + cnf = _cnfmerge((cnf, kw)) + self.widgetName = '__dialog__' + self._setup(master, cnf) + self.num = self.tk.getint( + self.tk.call( + 'tk_dialog', self._w, + cnf['title'], cnf['text'], + cnf['bitmap'], cnf['default'], + *cnf['strings'])) + try: Widget.destroy(self) + except TclError: pass + + def destroy(self): pass + + +def _test(): + d = Dialog(None, {'title': 'File Modified', + 'text': + 'File "Python.h" has been modified' + ' since the last time it was saved.' + ' Do you want to save it before' + ' exiting the application.', + 'bitmap': DIALOG_ICON, + 'default': 0, + 'strings': ('Save File', + 'Discard Changes', + 'Return to Editor')}) + print(d.num) + + +if __name__ == '__main__': + t = Button(None, {'text': 'Test', + 'command': _test, + Pack: {}}) + q = Button(None, {'text': 'Quit', + 'command': t.quit, + Pack: {}}) + t.mainloop() diff --git a/miniconda3/envs/active_proaction/lib/python3.10/tkinter/dnd.py b/miniconda3/envs/active_proaction/lib/python3.10/tkinter/dnd.py new file mode 100644 index 0000000000000000000000000000000000000000..acec61ba71f1c9f58597de27ee292176a6a23a1e --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/tkinter/dnd.py @@ -0,0 +1,324 @@ +"""Drag-and-drop support for Tkinter. + +This is very preliminary. I currently only support dnd *within* one +application, between different windows (or within the same window). + +I am trying to make this as generic as possible -- not dependent on +the use of a particular widget or icon type, etc. I also hope that +this will work with Pmw. + +To enable an object to be dragged, you must create an event binding +for it that starts the drag-and-drop process. Typically, you should +bind to a callback function that you write. The function +should call Tkdnd.dnd_start(source, event), where 'source' is the +object to be dragged, and 'event' is the event that invoked the call +(the argument to your callback function). Even though this is a class +instantiation, the returned instance should not be stored -- it will +be kept alive automatically for the duration of the drag-and-drop. + +When a drag-and-drop is already in process for the Tk interpreter, the +call is *ignored*; this normally averts starting multiple simultaneous +dnd processes, e.g. because different button callbacks all +dnd_start(). + +The object is *not* necessarily a widget -- it can be any +application-specific object that is meaningful to potential +drag-and-drop targets. + +Potential drag-and-drop targets are discovered as follows. Whenever +the mouse moves, and at the start and end of a drag-and-drop move, the +Tk widget directly under the mouse is inspected. This is the target +widget (not to be confused with the target object, yet to be +determined). If there is no target widget, there is no dnd target +object. If there is a target widget, and it has an attribute +dnd_accept, this should be a function (or any callable object). The +function is called as dnd_accept(source, event), where 'source' is the +object being dragged (the object passed to dnd_start() above), and +'event' is the most recent event object (generally a event; +it can also be or ). If the dnd_accept() +function returns something other than None, this is the new dnd target +object. If dnd_accept() returns None, or if the target widget has no +dnd_accept attribute, the target widget's parent is considered as the +target widget, and the search for a target object is repeated from +there. If necessary, the search is repeated all the way up to the +root widget. If none of the target widgets can produce a target +object, there is no target object (the target object is None). + +The target object thus produced, if any, is called the new target +object. It is compared with the old target object (or None, if there +was no old target widget). There are several cases ('source' is the +source object, and 'event' is the most recent event object): + +- Both the old and new target objects are None. Nothing happens. + +- The old and new target objects are the same object. Its method +dnd_motion(source, event) is called. + +- The old target object was None, and the new target object is not +None. The new target object's method dnd_enter(source, event) is +called. + +- The new target object is None, and the old target object is not +None. The old target object's method dnd_leave(source, event) is +called. + +- The old and new target objects differ and neither is None. The old +target object's method dnd_leave(source, event), and then the new +target object's method dnd_enter(source, event) is called. + +Once this is done, the new target object replaces the old one, and the +Tk mainloop proceeds. The return value of the methods mentioned above +is ignored; if they raise an exception, the normal exception handling +mechanisms take over. + +The drag-and-drop processes can end in two ways: a final target object +is selected, or no final target object is selected. When a final +target object is selected, it will always have been notified of the +potential drop by a call to its dnd_enter() method, as described +above, and possibly one or more calls to its dnd_motion() method; its +dnd_leave() method has not been called since the last call to +dnd_enter(). The target is notified of the drop by a call to its +method dnd_commit(source, event). + +If no final target object is selected, and there was an old target +object, its dnd_leave(source, event) method is called to complete the +dnd sequence. + +Finally, the source object is notified that the drag-and-drop process +is over, by a call to source.dnd_end(target, event), specifying either +the selected target object, or None if no target object was selected. +The source object can use this to implement the commit action; this is +sometimes simpler than to do it in the target's dnd_commit(). The +target's dnd_commit() method could then simply be aliased to +dnd_leave(). + +At any time during a dnd sequence, the application can cancel the +sequence by calling the cancel() method on the object returned by +dnd_start(). This will call dnd_leave() if a target is currently +active; it will never call dnd_commit(). + +""" + +import tkinter + +__all__ = ["dnd_start", "DndHandler"] + + +# The factory function + +def dnd_start(source, event): + h = DndHandler(source, event) + if h.root is not None: + return h + else: + return None + + +# The class that does the work + +class DndHandler: + + root = None + + def __init__(self, source, event): + if event.num > 5: + return + root = event.widget._root() + try: + root.__dnd + return # Don't start recursive dnd + except AttributeError: + root.__dnd = self + self.root = root + self.source = source + self.target = None + self.initial_button = button = event.num + self.initial_widget = widget = event.widget + self.release_pattern = "" % (button, button) + self.save_cursor = widget['cursor'] or "" + widget.bind(self.release_pattern, self.on_release) + widget.bind("", self.on_motion) + widget['cursor'] = "hand2" + + def __del__(self): + root = self.root + self.root = None + if root is not None: + try: + del root.__dnd + except AttributeError: + pass + + def on_motion(self, event): + x, y = event.x_root, event.y_root + target_widget = self.initial_widget.winfo_containing(x, y) + source = self.source + new_target = None + while target_widget is not None: + try: + attr = target_widget.dnd_accept + except AttributeError: + pass + else: + new_target = attr(source, event) + if new_target is not None: + break + target_widget = target_widget.master + old_target = self.target + if old_target is new_target: + if old_target is not None: + old_target.dnd_motion(source, event) + else: + if old_target is not None: + self.target = None + old_target.dnd_leave(source, event) + if new_target is not None: + new_target.dnd_enter(source, event) + self.target = new_target + + def on_release(self, event): + self.finish(event, 1) + + def cancel(self, event=None): + self.finish(event, 0) + + def finish(self, event, commit=0): + target = self.target + source = self.source + widget = self.initial_widget + root = self.root + try: + del root.__dnd + self.initial_widget.unbind(self.release_pattern) + self.initial_widget.unbind("") + widget['cursor'] = self.save_cursor + self.target = self.source = self.initial_widget = self.root = None + if target is not None: + if commit: + target.dnd_commit(source, event) + else: + target.dnd_leave(source, event) + finally: + source.dnd_end(target, event) + + +# ---------------------------------------------------------------------- +# The rest is here for testing and demonstration purposes only! + +class Icon: + + def __init__(self, name): + self.name = name + self.canvas = self.label = self.id = None + + def attach(self, canvas, x=10, y=10): + if canvas is self.canvas: + self.canvas.coords(self.id, x, y) + return + if self.canvas is not None: + self.detach() + if canvas is None: + return + label = tkinter.Label(canvas, text=self.name, + borderwidth=2, relief="raised") + id = canvas.create_window(x, y, window=label, anchor="nw") + self.canvas = canvas + self.label = label + self.id = id + label.bind("", self.press) + + def detach(self): + canvas = self.canvas + if canvas is None: + return + id = self.id + label = self.label + self.canvas = self.label = self.id = None + canvas.delete(id) + label.destroy() + + def press(self, event): + if dnd_start(self, event): + # where the pointer is relative to the label widget: + self.x_off = event.x + self.y_off = event.y + # where the widget is relative to the canvas: + self.x_orig, self.y_orig = self.canvas.coords(self.id) + + def move(self, event): + x, y = self.where(self.canvas, event) + self.canvas.coords(self.id, x, y) + + def putback(self): + self.canvas.coords(self.id, self.x_orig, self.y_orig) + + def where(self, canvas, event): + # where the corner of the canvas is relative to the screen: + x_org = canvas.winfo_rootx() + y_org = canvas.winfo_rooty() + # where the pointer is relative to the canvas widget: + x = event.x_root - x_org + y = event.y_root - y_org + # compensate for initial pointer offset + return x - self.x_off, y - self.y_off + + def dnd_end(self, target, event): + pass + + +class Tester: + + def __init__(self, root): + self.top = tkinter.Toplevel(root) + self.canvas = tkinter.Canvas(self.top, width=100, height=100) + self.canvas.pack(fill="both", expand=1) + self.canvas.dnd_accept = self.dnd_accept + + def dnd_accept(self, source, event): + return self + + def dnd_enter(self, source, event): + self.canvas.focus_set() # Show highlight border + x, y = source.where(self.canvas, event) + x1, y1, x2, y2 = source.canvas.bbox(source.id) + dx, dy = x2-x1, y2-y1 + self.dndid = self.canvas.create_rectangle(x, y, x+dx, y+dy) + self.dnd_motion(source, event) + + def dnd_motion(self, source, event): + x, y = source.where(self.canvas, event) + x1, y1, x2, y2 = self.canvas.bbox(self.dndid) + self.canvas.move(self.dndid, x-x1, y-y1) + + def dnd_leave(self, source, event): + self.top.focus_set() # Hide highlight border + self.canvas.delete(self.dndid) + self.dndid = None + + def dnd_commit(self, source, event): + self.dnd_leave(source, event) + x, y = source.where(self.canvas, event) + source.attach(self.canvas, x, y) + + +def test(): + root = tkinter.Tk() + root.geometry("+1+1") + tkinter.Button(command=root.quit, text="Quit").pack() + t1 = Tester(root) + t1.top.geometry("+1+60") + t2 = Tester(root) + t2.top.geometry("+120+60") + t3 = Tester(root) + t3.top.geometry("+240+60") + i1 = Icon("ICON1") + i2 = Icon("ICON2") + i3 = Icon("ICON3") + i1.attach(t1.canvas) + i2.attach(t2.canvas) + i3.attach(t3.canvas) + root.mainloop() + + +if __name__ == '__main__': + test() diff --git a/miniconda3/envs/active_proaction/lib/python3.10/tkinter/filedialog.py b/miniconda3/envs/active_proaction/lib/python3.10/tkinter/filedialog.py new file mode 100644 index 0000000000000000000000000000000000000000..600d0bd49fe2cf6095511a889db6477ad3bfa321 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/tkinter/filedialog.py @@ -0,0 +1,493 @@ +"""File selection dialog classes. + +Classes: + +- FileDialog +- LoadFileDialog +- SaveFileDialog + +This module also presents tk common file dialogues, it provides interfaces +to the native file dialogues available in Tk 4.2 and newer, and the +directory dialogue available in Tk 8.3 and newer. +These interfaces were written by Fredrik Lundh, May 1997. +""" +__all__ = ["FileDialog", "LoadFileDialog", "SaveFileDialog", + "Open", "SaveAs", "Directory", + "askopenfilename", "asksaveasfilename", "askopenfilenames", + "askopenfile", "askopenfiles", "asksaveasfile", "askdirectory"] + +import fnmatch +import os +from tkinter import ( + Frame, LEFT, YES, BOTTOM, Entry, TOP, Button, Tk, X, + Toplevel, RIGHT, Y, END, Listbox, BOTH, Scrollbar, +) +from tkinter.dialog import Dialog +from tkinter import commondialog +from tkinter.simpledialog import _setup_dialog + + +dialogstates = {} + + +class FileDialog: + + """Standard file selection dialog -- no checks on selected file. + + Usage: + + d = FileDialog(master) + fname = d.go(dir_or_file, pattern, default, key) + if fname is None: ...canceled... + else: ...open file... + + All arguments to go() are optional. + + The 'key' argument specifies a key in the global dictionary + 'dialogstates', which keeps track of the values for the directory + and pattern arguments, overriding the values passed in (it does + not keep track of the default argument!). If no key is specified, + the dialog keeps no memory of previous state. Note that memory is + kept even when the dialog is canceled. (All this emulates the + behavior of the Macintosh file selection dialogs.) + + """ + + title = "File Selection Dialog" + + def __init__(self, master, title=None): + if title is None: title = self.title + self.master = master + self.directory = None + + self.top = Toplevel(master) + self.top.title(title) + self.top.iconname(title) + _setup_dialog(self.top) + + self.botframe = Frame(self.top) + self.botframe.pack(side=BOTTOM, fill=X) + + self.selection = Entry(self.top) + self.selection.pack(side=BOTTOM, fill=X) + self.selection.bind('', self.ok_event) + + self.filter = Entry(self.top) + self.filter.pack(side=TOP, fill=X) + self.filter.bind('', self.filter_command) + + self.midframe = Frame(self.top) + self.midframe.pack(expand=YES, fill=BOTH) + + self.filesbar = Scrollbar(self.midframe) + self.filesbar.pack(side=RIGHT, fill=Y) + self.files = Listbox(self.midframe, exportselection=0, + yscrollcommand=(self.filesbar, 'set')) + self.files.pack(side=RIGHT, expand=YES, fill=BOTH) + btags = self.files.bindtags() + self.files.bindtags(btags[1:] + btags[:1]) + self.files.bind('', self.files_select_event) + self.files.bind('', self.files_double_event) + self.filesbar.config(command=(self.files, 'yview')) + + self.dirsbar = Scrollbar(self.midframe) + self.dirsbar.pack(side=LEFT, fill=Y) + self.dirs = Listbox(self.midframe, exportselection=0, + yscrollcommand=(self.dirsbar, 'set')) + self.dirs.pack(side=LEFT, expand=YES, fill=BOTH) + self.dirsbar.config(command=(self.dirs, 'yview')) + btags = self.dirs.bindtags() + self.dirs.bindtags(btags[1:] + btags[:1]) + self.dirs.bind('', self.dirs_select_event) + self.dirs.bind('', self.dirs_double_event) + + self.ok_button = Button(self.botframe, + text="OK", + command=self.ok_command) + self.ok_button.pack(side=LEFT) + self.filter_button = Button(self.botframe, + text="Filter", + command=self.filter_command) + self.filter_button.pack(side=LEFT, expand=YES) + self.cancel_button = Button(self.botframe, + text="Cancel", + command=self.cancel_command) + self.cancel_button.pack(side=RIGHT) + + self.top.protocol('WM_DELETE_WINDOW', self.cancel_command) + # XXX Are the following okay for a general audience? + self.top.bind('', self.cancel_command) + self.top.bind('', self.cancel_command) + + def go(self, dir_or_file=os.curdir, pattern="*", default="", key=None): + if key and key in dialogstates: + self.directory, pattern = dialogstates[key] + else: + dir_or_file = os.path.expanduser(dir_or_file) + if os.path.isdir(dir_or_file): + self.directory = dir_or_file + else: + self.directory, default = os.path.split(dir_or_file) + self.set_filter(self.directory, pattern) + self.set_selection(default) + self.filter_command() + self.selection.focus_set() + self.top.wait_visibility() # window needs to be visible for the grab + self.top.grab_set() + self.how = None + self.master.mainloop() # Exited by self.quit(how) + if key: + directory, pattern = self.get_filter() + if self.how: + directory = os.path.dirname(self.how) + dialogstates[key] = directory, pattern + self.top.destroy() + return self.how + + def quit(self, how=None): + self.how = how + self.master.quit() # Exit mainloop() + + def dirs_double_event(self, event): + self.filter_command() + + def dirs_select_event(self, event): + dir, pat = self.get_filter() + subdir = self.dirs.get('active') + dir = os.path.normpath(os.path.join(self.directory, subdir)) + self.set_filter(dir, pat) + + def files_double_event(self, event): + self.ok_command() + + def files_select_event(self, event): + file = self.files.get('active') + self.set_selection(file) + + def ok_event(self, event): + self.ok_command() + + def ok_command(self): + self.quit(self.get_selection()) + + def filter_command(self, event=None): + dir, pat = self.get_filter() + try: + names = os.listdir(dir) + except OSError: + self.master.bell() + return + self.directory = dir + self.set_filter(dir, pat) + names.sort() + subdirs = [os.pardir] + matchingfiles = [] + for name in names: + fullname = os.path.join(dir, name) + if os.path.isdir(fullname): + subdirs.append(name) + elif fnmatch.fnmatch(name, pat): + matchingfiles.append(name) + self.dirs.delete(0, END) + for name in subdirs: + self.dirs.insert(END, name) + self.files.delete(0, END) + for name in matchingfiles: + self.files.insert(END, name) + head, tail = os.path.split(self.get_selection()) + if tail == os.curdir: tail = '' + self.set_selection(tail) + + def get_filter(self): + filter = self.filter.get() + filter = os.path.expanduser(filter) + if filter[-1:] == os.sep or os.path.isdir(filter): + filter = os.path.join(filter, "*") + return os.path.split(filter) + + def get_selection(self): + file = self.selection.get() + file = os.path.expanduser(file) + return file + + def cancel_command(self, event=None): + self.quit() + + def set_filter(self, dir, pat): + if not os.path.isabs(dir): + try: + pwd = os.getcwd() + except OSError: + pwd = None + if pwd: + dir = os.path.join(pwd, dir) + dir = os.path.normpath(dir) + self.filter.delete(0, END) + self.filter.insert(END, os.path.join(dir or os.curdir, pat or "*")) + + def set_selection(self, file): + self.selection.delete(0, END) + self.selection.insert(END, os.path.join(self.directory, file)) + + +class LoadFileDialog(FileDialog): + + """File selection dialog which checks that the file exists.""" + + title = "Load File Selection Dialog" + + def ok_command(self): + file = self.get_selection() + if not os.path.isfile(file): + self.master.bell() + else: + self.quit(file) + + +class SaveFileDialog(FileDialog): + + """File selection dialog which checks that the file may be created.""" + + title = "Save File Selection Dialog" + + def ok_command(self): + file = self.get_selection() + if os.path.exists(file): + if os.path.isdir(file): + self.master.bell() + return + d = Dialog(self.top, + title="Overwrite Existing File Question", + text="Overwrite existing file %r?" % (file,), + bitmap='questhead', + default=1, + strings=("Yes", "Cancel")) + if d.num != 0: + return + else: + head, tail = os.path.split(file) + if not os.path.isdir(head): + self.master.bell() + return + self.quit(file) + + +# For the following classes and modules: +# +# options (all have default values): +# +# - defaultextension: added to filename if not explicitly given +# +# - filetypes: sequence of (label, pattern) tuples. the same pattern +# may occur with several patterns. use "*" as pattern to indicate +# all files. +# +# - initialdir: initial directory. preserved by dialog instance. +# +# - initialfile: initial file (ignored by the open dialog). preserved +# by dialog instance. +# +# - parent: which window to place the dialog on top of +# +# - title: dialog title +# +# - multiple: if true user may select more than one file +# +# options for the directory chooser: +# +# - initialdir, parent, title: see above +# +# - mustexist: if true, user must pick an existing directory +# + + +class _Dialog(commondialog.Dialog): + + def _fixoptions(self): + try: + # make sure "filetypes" is a tuple + self.options["filetypes"] = tuple(self.options["filetypes"]) + except KeyError: + pass + + def _fixresult(self, widget, result): + if result: + # keep directory and filename until next time + # convert Tcl path objects to strings + try: + result = result.string + except AttributeError: + # it already is a string + pass + path, file = os.path.split(result) + self.options["initialdir"] = path + self.options["initialfile"] = file + self.filename = result # compatibility + return result + + +# +# file dialogs + +class Open(_Dialog): + "Ask for a filename to open" + + command = "tk_getOpenFile" + + def _fixresult(self, widget, result): + if isinstance(result, tuple): + # multiple results: + result = tuple([getattr(r, "string", r) for r in result]) + if result: + path, file = os.path.split(result[0]) + self.options["initialdir"] = path + # don't set initialfile or filename, as we have multiple of these + return result + if not widget.tk.wantobjects() and "multiple" in self.options: + # Need to split result explicitly + return self._fixresult(widget, widget.tk.splitlist(result)) + return _Dialog._fixresult(self, widget, result) + + +class SaveAs(_Dialog): + "Ask for a filename to save as" + + command = "tk_getSaveFile" + + +# the directory dialog has its own _fix routines. +class Directory(commondialog.Dialog): + "Ask for a directory" + + command = "tk_chooseDirectory" + + def _fixresult(self, widget, result): + if result: + # convert Tcl path objects to strings + try: + result = result.string + except AttributeError: + # it already is a string + pass + # keep directory until next time + self.options["initialdir"] = result + self.directory = result # compatibility + return result + +# +# convenience stuff + + +def askopenfilename(**options): + "Ask for a filename to open" + + return Open(**options).show() + + +def asksaveasfilename(**options): + "Ask for a filename to save as" + + return SaveAs(**options).show() + + +def askopenfilenames(**options): + """Ask for multiple filenames to open + + Returns a list of filenames or empty list if + cancel button selected + """ + options["multiple"]=1 + return Open(**options).show() + +# FIXME: are the following perhaps a bit too convenient? + + +def askopenfile(mode = "r", **options): + "Ask for a filename to open, and returned the opened file" + + filename = Open(**options).show() + if filename: + return open(filename, mode) + return None + + +def askopenfiles(mode = "r", **options): + """Ask for multiple filenames and return the open file + objects + + returns a list of open file objects or an empty list if + cancel selected + """ + + files = askopenfilenames(**options) + if files: + ofiles=[] + for filename in files: + ofiles.append(open(filename, mode)) + files=ofiles + return files + + +def asksaveasfile(mode = "w", **options): + "Ask for a filename to save as, and returned the opened file" + + filename = SaveAs(**options).show() + if filename: + return open(filename, mode) + return None + + +def askdirectory (**options): + "Ask for a directory, and return the file name" + return Directory(**options).show() + + +# -------------------------------------------------------------------- +# test stuff + +def test(): + """Simple test program.""" + root = Tk() + root.withdraw() + fd = LoadFileDialog(root) + loadfile = fd.go(key="test") + fd = SaveFileDialog(root) + savefile = fd.go(key="test") + print(loadfile, savefile) + + # Since the file name may contain non-ASCII characters, we need + # to find an encoding that likely supports the file name, and + # displays correctly on the terminal. + + # Start off with UTF-8 + enc = "utf-8" + import sys + + # See whether CODESET is defined + try: + import locale + locale.setlocale(locale.LC_ALL,'') + enc = locale.nl_langinfo(locale.CODESET) + except (ImportError, AttributeError): + pass + + # dialog for opening files + + openfilename=askopenfilename(filetypes=[("all files", "*")]) + try: + fp=open(openfilename,"r") + fp.close() + except: + print("Could not open File: ") + print(sys.exc_info()[1]) + + print("open", openfilename.encode(enc)) + + # dialog for saving files + + saveasfilename=asksaveasfilename() + print("saveas", saveasfilename.encode(enc)) + + +if __name__ == '__main__': + test() diff --git a/miniconda3/envs/active_proaction/lib/python3.10/tkinter/font.py b/miniconda3/envs/active_proaction/lib/python3.10/tkinter/font.py new file mode 100644 index 0000000000000000000000000000000000000000..3e24e28ef58cde90dafe78016ce38867a008b450 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/tkinter/font.py @@ -0,0 +1,239 @@ +# Tkinter font wrapper +# +# written by Fredrik Lundh, February 1998 +# + +import itertools +import tkinter + +__version__ = "0.9" +__all__ = ["NORMAL", "ROMAN", "BOLD", "ITALIC", + "nametofont", "Font", "families", "names"] + +# weight/slant +NORMAL = "normal" +ROMAN = "roman" +BOLD = "bold" +ITALIC = "italic" + + +def nametofont(name, root=None): + """Given the name of a tk named font, returns a Font representation. + """ + return Font(name=name, exists=True, root=root) + + +class Font: + """Represents a named font. + + Constructor options are: + + font -- font specifier (name, system font, or (family, size, style)-tuple) + name -- name to use for this font configuration (defaults to a unique name) + exists -- does a named font by this name already exist? + Creates a new named font if False, points to the existing font if True. + Raises _tkinter.TclError if the assertion is false. + + the following are ignored if font is specified: + + family -- font 'family', e.g. Courier, Times, Helvetica + size -- font size in points + weight -- font thickness: NORMAL, BOLD + slant -- font slant: ROMAN, ITALIC + underline -- font underlining: false (0), true (1) + overstrike -- font strikeout: false (0), true (1) + + """ + + counter = itertools.count(1) + + def _set(self, kw): + options = [] + for k, v in kw.items(): + options.append("-"+k) + options.append(str(v)) + return tuple(options) + + def _get(self, args): + options = [] + for k in args: + options.append("-"+k) + return tuple(options) + + def _mkdict(self, args): + options = {} + for i in range(0, len(args), 2): + options[args[i][1:]] = args[i+1] + return options + + def __init__(self, root=None, font=None, name=None, exists=False, + **options): + if root is None: + root = tkinter._get_default_root('use font') + tk = getattr(root, 'tk', root) + if font: + # get actual settings corresponding to the given font + font = tk.splitlist(tk.call("font", "actual", font)) + else: + font = self._set(options) + if not name: + name = "font" + str(next(self.counter)) + self.name = name + + if exists: + self.delete_font = False + # confirm font exists + if self.name not in tk.splitlist(tk.call("font", "names")): + raise tkinter._tkinter.TclError( + "named font %s does not already exist" % (self.name,)) + # if font config info supplied, apply it + if font: + tk.call("font", "configure", self.name, *font) + else: + # create new font (raises TclError if the font exists) + tk.call("font", "create", self.name, *font) + self.delete_font = True + self._tk = tk + self._split = tk.splitlist + self._call = tk.call + + def __str__(self): + return self.name + + def __repr__(self): + return f"<{self.__class__.__module__}.{self.__class__.__qualname__}" \ + f" object {self.name!r}>" + + def __eq__(self, other): + if not isinstance(other, Font): + return NotImplemented + return self.name == other.name and self._tk == other._tk + + def __getitem__(self, key): + return self.cget(key) + + def __setitem__(self, key, value): + self.configure(**{key: value}) + + def __del__(self): + try: + if self.delete_font: + self._call("font", "delete", self.name) + except Exception: + pass + + def copy(self): + "Return a distinct copy of the current font" + return Font(self._tk, **self.actual()) + + def actual(self, option=None, displayof=None): + "Return actual font attributes" + args = () + if displayof: + args = ('-displayof', displayof) + if option: + args = args + ('-' + option, ) + return self._call("font", "actual", self.name, *args) + else: + return self._mkdict( + self._split(self._call("font", "actual", self.name, *args))) + + def cget(self, option): + "Get font attribute" + return self._call("font", "config", self.name, "-"+option) + + def config(self, **options): + "Modify font attributes" + if options: + self._call("font", "config", self.name, + *self._set(options)) + else: + return self._mkdict( + self._split(self._call("font", "config", self.name))) + + configure = config + + def measure(self, text, displayof=None): + "Return text width" + args = (text,) + if displayof: + args = ('-displayof', displayof, text) + return self._tk.getint(self._call("font", "measure", self.name, *args)) + + def metrics(self, *options, **kw): + """Return font metrics. + + For best performance, create a dummy widget + using this font before calling this method.""" + args = () + displayof = kw.pop('displayof', None) + if displayof: + args = ('-displayof', displayof) + if options: + args = args + self._get(options) + return self._tk.getint( + self._call("font", "metrics", self.name, *args)) + else: + res = self._split(self._call("font", "metrics", self.name, *args)) + options = {} + for i in range(0, len(res), 2): + options[res[i][1:]] = self._tk.getint(res[i+1]) + return options + + +def families(root=None, displayof=None): + "Get font families (as a tuple)" + if root is None: + root = tkinter._get_default_root('use font.families()') + args = () + if displayof: + args = ('-displayof', displayof) + return root.tk.splitlist(root.tk.call("font", "families", *args)) + + +def names(root=None): + "Get names of defined fonts (as a tuple)" + if root is None: + root = tkinter._get_default_root('use font.names()') + return root.tk.splitlist(root.tk.call("font", "names")) + + +# -------------------------------------------------------------------- +# test stuff + +if __name__ == "__main__": + + root = tkinter.Tk() + + # create a font + f = Font(family="times", size=30, weight=NORMAL) + + print(f.actual()) + print(f.actual("family")) + print(f.actual("weight")) + + print(f.config()) + print(f.cget("family")) + print(f.cget("weight")) + + print(names()) + + print(f.measure("hello"), f.metrics("linespace")) + + print(f.metrics(displayof=root)) + + f = Font(font=("Courier", 20, "bold")) + print(f.measure("hello"), f.metrics("linespace", displayof=root)) + + w = tkinter.Label(root, text="Hello, world", font=f) + w.pack() + + w = tkinter.Button(root, text="Quit!", command=root.destroy) + w.pack() + + fb = Font(font=w["font"]).copy() + fb.config(weight=BOLD) + + w.config(font=fb) + + tkinter.mainloop() diff --git a/miniconda3/envs/active_proaction/lib/python3.10/tkinter/messagebox.py b/miniconda3/envs/active_proaction/lib/python3.10/tkinter/messagebox.py new file mode 100644 index 0000000000000000000000000000000000000000..5f0343b660c68c5a884f38ca78291caf14936231 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/tkinter/messagebox.py @@ -0,0 +1,146 @@ +# tk common message boxes +# +# this module provides an interface to the native message boxes +# available in Tk 4.2 and newer. +# +# written by Fredrik Lundh, May 1997 +# + +# +# options (all have default values): +# +# - default: which button to make default (one of the reply codes) +# +# - icon: which icon to display (see below) +# +# - message: the message to display +# +# - parent: which window to place the dialog on top of +# +# - title: dialog title +# +# - type: dialog type; that is, which buttons to display (see below) +# + +from tkinter.commondialog import Dialog + +__all__ = ["showinfo", "showwarning", "showerror", + "askquestion", "askokcancel", "askyesno", + "askyesnocancel", "askretrycancel"] + +# +# constants + +# icons +ERROR = "error" +INFO = "info" +QUESTION = "question" +WARNING = "warning" + +# types +ABORTRETRYIGNORE = "abortretryignore" +OK = "ok" +OKCANCEL = "okcancel" +RETRYCANCEL = "retrycancel" +YESNO = "yesno" +YESNOCANCEL = "yesnocancel" + +# replies +ABORT = "abort" +RETRY = "retry" +IGNORE = "ignore" +OK = "ok" +CANCEL = "cancel" +YES = "yes" +NO = "no" + + +# +# message dialog class + +class Message(Dialog): + "A message box" + + command = "tk_messageBox" + + +# +# convenience stuff + +# Rename _icon and _type options to allow overriding them in options +def _show(title=None, message=None, _icon=None, _type=None, **options): + if _icon and "icon" not in options: options["icon"] = _icon + if _type and "type" not in options: options["type"] = _type + if title: options["title"] = title + if message: options["message"] = message + res = Message(**options).show() + # In some Tcl installations, yes/no is converted into a boolean. + if isinstance(res, bool): + if res: + return YES + return NO + # In others we get a Tcl_Obj. + return str(res) + + +def showinfo(title=None, message=None, **options): + "Show an info message" + return _show(title, message, INFO, OK, **options) + + +def showwarning(title=None, message=None, **options): + "Show a warning message" + return _show(title, message, WARNING, OK, **options) + + +def showerror(title=None, message=None, **options): + "Show an error message" + return _show(title, message, ERROR, OK, **options) + + +def askquestion(title=None, message=None, **options): + "Ask a question" + return _show(title, message, QUESTION, YESNO, **options) + + +def askokcancel(title=None, message=None, **options): + "Ask if operation should proceed; return true if the answer is ok" + s = _show(title, message, QUESTION, OKCANCEL, **options) + return s == OK + + +def askyesno(title=None, message=None, **options): + "Ask a question; return true if the answer is yes" + s = _show(title, message, QUESTION, YESNO, **options) + return s == YES + + +def askyesnocancel(title=None, message=None, **options): + "Ask a question; return true if the answer is yes, None if cancelled." + s = _show(title, message, QUESTION, YESNOCANCEL, **options) + # s might be a Tcl index object, so convert it to a string + s = str(s) + if s == CANCEL: + return None + return s == YES + + +def askretrycancel(title=None, message=None, **options): + "Ask if operation should be retried; return true if the answer is yes" + s = _show(title, message, WARNING, RETRYCANCEL, **options) + return s == RETRY + + +# -------------------------------------------------------------------- +# test stuff + +if __name__ == "__main__": + + print("info", showinfo("Spam", "Egg Information")) + print("warning", showwarning("Spam", "Egg Warning")) + print("error", showerror("Spam", "Egg Alert")) + print("question", askquestion("Spam", "Question?")) + print("proceed", askokcancel("Spam", "Proceed?")) + print("yes/no", askyesno("Spam", "Got it?")) + print("yes/no/cancel", askyesnocancel("Spam", "Want it?")) + print("try again", askretrycancel("Spam", "Try again?")) diff --git a/miniconda3/envs/active_proaction/lib/python3.10/tkinter/scrolledtext.py b/miniconda3/envs/active_proaction/lib/python3.10/tkinter/scrolledtext.py new file mode 100644 index 0000000000000000000000000000000000000000..4f9a8815b6184b2209305c91a1402267f78e81a6 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/tkinter/scrolledtext.py @@ -0,0 +1,56 @@ +"""A ScrolledText widget feels like a text widget but also has a +vertical scroll bar on its right. (Later, options may be added to +add a horizontal bar as well, to make the bars disappear +automatically when not needed, to move them to the other side of the +window, etc.) + +Configuration options are passed to the Text widget. +A Frame widget is inserted between the master and the text, to hold +the Scrollbar widget. +Most methods calls are inherited from the Text widget; Pack, Grid and +Place methods are redirected to the Frame widget however. +""" + +from tkinter import Frame, Text, Scrollbar, Pack, Grid, Place +from tkinter.constants import RIGHT, LEFT, Y, BOTH + +__all__ = ['ScrolledText'] + + +class ScrolledText(Text): + def __init__(self, master=None, **kw): + self.frame = Frame(master) + self.vbar = Scrollbar(self.frame) + self.vbar.pack(side=RIGHT, fill=Y) + + kw.update({'yscrollcommand': self.vbar.set}) + Text.__init__(self, self.frame, **kw) + self.pack(side=LEFT, fill=BOTH, expand=True) + self.vbar['command'] = self.yview + + # Copy geometry methods of self.frame without overriding Text + # methods -- hack! + text_meths = vars(Text).keys() + methods = vars(Pack).keys() | vars(Grid).keys() | vars(Place).keys() + methods = methods.difference(text_meths) + + for m in methods: + if m[0] != '_' and m != 'config' and m != 'configure': + setattr(self, m, getattr(self.frame, m)) + + def __str__(self): + return str(self.frame) + + +def example(): + from tkinter.constants import END + + stext = ScrolledText(bg='white', height=10) + stext.insert(END, __doc__) + stext.pack(fill=BOTH, side=LEFT, expand=True) + stext.focus_set() + stext.mainloop() + + +if __name__ == "__main__": + example() diff --git a/miniconda3/envs/active_proaction/lib/python3.10/tkinter/simpledialog.py b/miniconda3/envs/active_proaction/lib/python3.10/tkinter/simpledialog.py new file mode 100644 index 0000000000000000000000000000000000000000..538bbfc318d704419884abdfe251872cf075ad33 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/tkinter/simpledialog.py @@ -0,0 +1,441 @@ +# +# An Introduction to Tkinter +# +# Copyright (c) 1997 by Fredrik Lundh +# +# This copyright applies to Dialog, askinteger, askfloat and asktring +# +# fredrik@pythonware.com +# http://www.pythonware.com +# +"""This modules handles dialog boxes. + +It contains the following public symbols: + +SimpleDialog -- A simple but flexible modal dialog box + +Dialog -- a base class for dialogs + +askinteger -- get an integer from the user + +askfloat -- get a float from the user + +askstring -- get a string from the user +""" + +from tkinter import * +from tkinter import _get_temp_root, _destroy_temp_root +from tkinter import messagebox + + +class SimpleDialog: + + def __init__(self, master, + text='', buttons=[], default=None, cancel=None, + title=None, class_=None): + if class_: + self.root = Toplevel(master, class_=class_) + else: + self.root = Toplevel(master) + if title: + self.root.title(title) + self.root.iconname(title) + + _setup_dialog(self.root) + + self.message = Message(self.root, text=text, aspect=400) + self.message.pack(expand=1, fill=BOTH) + self.frame = Frame(self.root) + self.frame.pack() + self.num = default + self.cancel = cancel + self.default = default + self.root.bind('', self.return_event) + for num in range(len(buttons)): + s = buttons[num] + b = Button(self.frame, text=s, + command=(lambda self=self, num=num: self.done(num))) + if num == default: + b.config(relief=RIDGE, borderwidth=8) + b.pack(side=LEFT, fill=BOTH, expand=1) + self.root.protocol('WM_DELETE_WINDOW', self.wm_delete_window) + self.root.transient(master) + _place_window(self.root, master) + + def go(self): + self.root.wait_visibility() + self.root.grab_set() + self.root.mainloop() + self.root.destroy() + return self.num + + def return_event(self, event): + if self.default is None: + self.root.bell() + else: + self.done(self.default) + + def wm_delete_window(self): + if self.cancel is None: + self.root.bell() + else: + self.done(self.cancel) + + def done(self, num): + self.num = num + self.root.quit() + + +class Dialog(Toplevel): + + '''Class to open dialogs. + + This class is intended as a base class for custom dialogs + ''' + + def __init__(self, parent, title = None): + '''Initialize a dialog. + + Arguments: + + parent -- a parent window (the application window) + + title -- the dialog title + ''' + master = parent + if master is None: + master = _get_temp_root() + + Toplevel.__init__(self, master) + + self.withdraw() # remain invisible for now + # If the parent is not viewable, don't + # make the child transient, or else it + # would be opened withdrawn + if parent is not None and parent.winfo_viewable(): + self.transient(parent) + + if title: + self.title(title) + + _setup_dialog(self) + + self.parent = parent + + self.result = None + + body = Frame(self) + self.initial_focus = self.body(body) + body.pack(padx=5, pady=5) + + self.buttonbox() + + if self.initial_focus is None: + self.initial_focus = self + + self.protocol("WM_DELETE_WINDOW", self.cancel) + + _place_window(self, parent) + + self.initial_focus.focus_set() + + # wait for window to appear on screen before calling grab_set + self.wait_visibility() + self.grab_set() + self.wait_window(self) + + def destroy(self): + '''Destroy the window''' + self.initial_focus = None + Toplevel.destroy(self) + _destroy_temp_root(self.master) + + # + # construction hooks + + def body(self, master): + '''create dialog body. + + return widget that should have initial focus. + This method should be overridden, and is called + by the __init__ method. + ''' + pass + + def buttonbox(self): + '''add standard button box. + + override if you do not want the standard buttons + ''' + + box = Frame(self) + + w = Button(box, text="OK", width=10, command=self.ok, default=ACTIVE) + w.pack(side=LEFT, padx=5, pady=5) + w = Button(box, text="Cancel", width=10, command=self.cancel) + w.pack(side=LEFT, padx=5, pady=5) + + self.bind("", self.ok) + self.bind("", self.cancel) + + box.pack() + + # + # standard button semantics + + def ok(self, event=None): + + if not self.validate(): + self.initial_focus.focus_set() # put focus back + return + + self.withdraw() + self.update_idletasks() + + try: + self.apply() + finally: + self.cancel() + + def cancel(self, event=None): + + # put focus back to the parent window + if self.parent is not None: + self.parent.focus_set() + self.destroy() + + # + # command hooks + + def validate(self): + '''validate the data + + This method is called automatically to validate the data before the + dialog is destroyed. By default, it always validates OK. + ''' + + return 1 # override + + def apply(self): + '''process the data + + This method is called automatically to process the data, *after* + the dialog is destroyed. By default, it does nothing. + ''' + + pass # override + + +# Place a toplevel window at the center of parent or screen +# It is a Python implementation of ::tk::PlaceWindow. +def _place_window(w, parent=None): + w.wm_withdraw() # Remain invisible while we figure out the geometry + w.update_idletasks() # Actualize geometry information + + minwidth = w.winfo_reqwidth() + minheight = w.winfo_reqheight() + maxwidth = w.winfo_vrootwidth() + maxheight = w.winfo_vrootheight() + if parent is not None and parent.winfo_ismapped(): + x = parent.winfo_rootx() + (parent.winfo_width() - minwidth) // 2 + y = parent.winfo_rooty() + (parent.winfo_height() - minheight) // 2 + vrootx = w.winfo_vrootx() + vrooty = w.winfo_vrooty() + x = min(x, vrootx + maxwidth - minwidth) + x = max(x, vrootx) + y = min(y, vrooty + maxheight - minheight) + y = max(y, vrooty) + if w._windowingsystem == 'aqua': + # Avoid the native menu bar which sits on top of everything. + y = max(y, 22) + else: + x = (w.winfo_screenwidth() - minwidth) // 2 + y = (w.winfo_screenheight() - minheight) // 2 + + w.wm_maxsize(maxwidth, maxheight) + w.wm_geometry('+%d+%d' % (x, y)) + w.wm_deiconify() # Become visible at the desired location + + +def _setup_dialog(w): + if w._windowingsystem == "aqua": + w.tk.call("::tk::unsupported::MacWindowStyle", "style", + w, "moveableModal", "") + elif w._windowingsystem == "x11": + w.wm_attributes("-type", "dialog") + +# -------------------------------------------------------------------- +# convenience dialogues + +class _QueryDialog(Dialog): + + def __init__(self, title, prompt, + initialvalue=None, + minvalue = None, maxvalue = None, + parent = None): + + self.prompt = prompt + self.minvalue = minvalue + self.maxvalue = maxvalue + + self.initialvalue = initialvalue + + Dialog.__init__(self, parent, title) + + def destroy(self): + self.entry = None + Dialog.destroy(self) + + def body(self, master): + + w = Label(master, text=self.prompt, justify=LEFT) + w.grid(row=0, padx=5, sticky=W) + + self.entry = Entry(master, name="entry") + self.entry.grid(row=1, padx=5, sticky=W+E) + + if self.initialvalue is not None: + self.entry.insert(0, self.initialvalue) + self.entry.select_range(0, END) + + return self.entry + + def validate(self): + try: + result = self.getresult() + except ValueError: + messagebox.showwarning( + "Illegal value", + self.errormessage + "\nPlease try again", + parent = self + ) + return 0 + + if self.minvalue is not None and result < self.minvalue: + messagebox.showwarning( + "Too small", + "The allowed minimum value is %s. " + "Please try again." % self.minvalue, + parent = self + ) + return 0 + + if self.maxvalue is not None and result > self.maxvalue: + messagebox.showwarning( + "Too large", + "The allowed maximum value is %s. " + "Please try again." % self.maxvalue, + parent = self + ) + return 0 + + self.result = result + + return 1 + + +class _QueryInteger(_QueryDialog): + errormessage = "Not an integer." + + def getresult(self): + return self.getint(self.entry.get()) + + +def askinteger(title, prompt, **kw): + '''get an integer from the user + + Arguments: + + title -- the dialog title + prompt -- the label text + **kw -- see SimpleDialog class + + Return value is an integer + ''' + d = _QueryInteger(title, prompt, **kw) + return d.result + + +class _QueryFloat(_QueryDialog): + errormessage = "Not a floating point value." + + def getresult(self): + return self.getdouble(self.entry.get()) + + +def askfloat(title, prompt, **kw): + '''get a float from the user + + Arguments: + + title -- the dialog title + prompt -- the label text + **kw -- see SimpleDialog class + + Return value is a float + ''' + d = _QueryFloat(title, prompt, **kw) + return d.result + + +class _QueryString(_QueryDialog): + def __init__(self, *args, **kw): + if "show" in kw: + self.__show = kw["show"] + del kw["show"] + else: + self.__show = None + _QueryDialog.__init__(self, *args, **kw) + + def body(self, master): + entry = _QueryDialog.body(self, master) + if self.__show is not None: + entry.configure(show=self.__show) + return entry + + def getresult(self): + return self.entry.get() + + +def askstring(title, prompt, **kw): + '''get a string from the user + + Arguments: + + title -- the dialog title + prompt -- the label text + **kw -- see SimpleDialog class + + Return value is a string + ''' + d = _QueryString(title, prompt, **kw) + return d.result + + +if __name__ == '__main__': + + def test(): + root = Tk() + def doit(root=root): + d = SimpleDialog(root, + text="This is a test dialog. " + "Would this have been an actual dialog, " + "the buttons below would have been glowing " + "in soft pink light.\n" + "Do you believe this?", + buttons=["Yes", "No", "Cancel"], + default=0, + cancel=2, + title="Test Dialog") + print(d.go()) + print(askinteger("Spam", "Egg count", initialvalue=12*12)) + print(askfloat("Spam", "Egg weight\n(in tons)", minvalue=1, + maxvalue=100)) + print(askstring("Spam", "Egg label")) + t = Button(root, text='Test', command=doit) + t.pack() + q = Button(root, text='Quit', command=t.quit) + q.pack() + t.mainloop() + + test() diff --git a/miniconda3/envs/active_proaction/lib/python3.10/tkinter/tix.py b/miniconda3/envs/active_proaction/lib/python3.10/tkinter/tix.py new file mode 100644 index 0000000000000000000000000000000000000000..ce218265d4a824c717565e4390387c97c0f1519b --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/tkinter/tix.py @@ -0,0 +1,1948 @@ +# Tix.py -- Tix widget wrappers. +# +# For Tix, see http://tix.sourceforge.net +# +# - Sudhir Shenoy (sshenoy@gol.com), Dec. 1995. +# based on an idea of Jean-Marc Lugrin (lugrin@ms.com) +# +# NOTE: In order to minimize changes to Tkinter.py, some of the code here +# (TixWidget.__init__) has been taken from Tkinter (Widget.__init__) +# and will break if there are major changes in Tkinter. +# +# The Tix widgets are represented by a class hierarchy in python with proper +# inheritance of base classes. +# +# As a result after creating a 'w = StdButtonBox', I can write +# w.ok['text'] = 'Who Cares' +# or w.ok['bg'] = w['bg'] +# or even w.ok.invoke() +# etc. +# +# Compare the demo tixwidgets.py to the original Tcl program and you will +# appreciate the advantages. +# +# NOTE: This module is deprecated since Python 3.6. + +import os +import warnings +import tkinter +from tkinter import * +from tkinter import _cnfmerge + +warnings.warn( + 'The Tix Tk extension is unmaintained, and the tkinter.tix wrapper module' + ' is deprecated in favor of tkinter.ttk', + DeprecationWarning, + stacklevel=2, + ) + +# Some more constants (for consistency with Tkinter) +WINDOW = 'window' +TEXT = 'text' +STATUS = 'status' +IMMEDIATE = 'immediate' +IMAGE = 'image' +IMAGETEXT = 'imagetext' +BALLOON = 'balloon' +AUTO = 'auto' +ACROSSTOP = 'acrosstop' + +# A few useful constants for the Grid widget +ASCII = 'ascii' +CELL = 'cell' +COLUMN = 'column' +DECREASING = 'decreasing' +INCREASING = 'increasing' +INTEGER = 'integer' +MAIN = 'main' +MAX = 'max' +REAL = 'real' +ROW = 'row' +S_REGION = 's-region' +X_REGION = 'x-region' +Y_REGION = 'y-region' + +# Some constants used by Tkinter dooneevent() +TCL_DONT_WAIT = 1 << 1 +TCL_WINDOW_EVENTS = 1 << 2 +TCL_FILE_EVENTS = 1 << 3 +TCL_TIMER_EVENTS = 1 << 4 +TCL_IDLE_EVENTS = 1 << 5 +TCL_ALL_EVENTS = 0 + +# BEWARE - this is implemented by copying some code from the Widget class +# in Tkinter (to override Widget initialization) and is therefore +# liable to break. + +# Could probably add this to Tkinter.Misc +class tixCommand: + """The tix commands provide access to miscellaneous elements + of Tix's internal state and the Tix application context. + Most of the information manipulated by these commands pertains + to the application as a whole, or to a screen or + display, rather than to a particular window. + + This is a mixin class, assumed to be mixed to Tkinter.Tk + that supports the self.tk.call method. + """ + + def tix_addbitmapdir(self, directory): + """Tix maintains a list of directories under which + the tix_getimage and tix_getbitmap commands will + search for image files. The standard bitmap directory + is $TIX_LIBRARY/bitmaps. The addbitmapdir command + adds directory into this list. By using this + command, the image files of an applications can + also be located using the tix_getimage or tix_getbitmap + command. + """ + return self.tk.call('tix', 'addbitmapdir', directory) + + def tix_cget(self, option): + """Returns the current value of the configuration + option given by option. Option may be any of the + options described in the CONFIGURATION OPTIONS section. + """ + return self.tk.call('tix', 'cget', option) + + def tix_configure(self, cnf=None, **kw): + """Query or modify the configuration options of the Tix application + context. If no option is specified, returns a dictionary all of the + available options. If option is specified with no value, then the + command returns a list describing the one named option (this list + will be identical to the corresponding sublist of the value + returned if no option is specified). If one or more option-value + pairs are specified, then the command modifies the given option(s) + to have the given value(s); in this case the command returns an + empty string. Option may be any of the configuration options. + """ + # Copied from Tkinter.py + if kw: + cnf = _cnfmerge((cnf, kw)) + elif cnf: + cnf = _cnfmerge(cnf) + if cnf is None: + return self._getconfigure('tix', 'configure') + if isinstance(cnf, str): + return self._getconfigure1('tix', 'configure', '-'+cnf) + return self.tk.call(('tix', 'configure') + self._options(cnf)) + + def tix_filedialog(self, dlgclass=None): + """Returns the file selection dialog that may be shared among + different calls from this application. This command will create a + file selection dialog widget when it is called the first time. This + dialog will be returned by all subsequent calls to tix_filedialog. + An optional dlgclass parameter can be passed to specified what type + of file selection dialog widget is desired. Possible options are + tix FileSelectDialog or tixExFileSelectDialog. + """ + if dlgclass is not None: + return self.tk.call('tix', 'filedialog', dlgclass) + else: + return self.tk.call('tix', 'filedialog') + + def tix_getbitmap(self, name): + """Locates a bitmap file of the name name.xpm or name in one of the + bitmap directories (see the tix_addbitmapdir command above). By + using tix_getbitmap, you can avoid hard coding the pathnames of the + bitmap files in your application. When successful, it returns the + complete pathname of the bitmap file, prefixed with the character + '@'. The returned value can be used to configure the -bitmap + option of the TK and Tix widgets. + """ + return self.tk.call('tix', 'getbitmap', name) + + def tix_getimage(self, name): + """Locates an image file of the name name.xpm, name.xbm or name.ppm + in one of the bitmap directories (see the addbitmapdir command + above). If more than one file with the same name (but different + extensions) exist, then the image type is chosen according to the + depth of the X display: xbm images are chosen on monochrome + displays and color images are chosen on color displays. By using + tix_ getimage, you can avoid hard coding the pathnames of the + image files in your application. When successful, this command + returns the name of the newly created image, which can be used to + configure the -image option of the Tk and Tix widgets. + """ + return self.tk.call('tix', 'getimage', name) + + def tix_option_get(self, name): + """Gets the options maintained by the Tix + scheme mechanism. Available options include: + + active_bg active_fg bg + bold_font dark1_bg dark1_fg + dark2_bg dark2_fg disabled_fg + fg fixed_font font + inactive_bg inactive_fg input1_bg + input2_bg italic_font light1_bg + light1_fg light2_bg light2_fg + menu_font output1_bg output2_bg + select_bg select_fg selector + """ + # could use self.tk.globalgetvar('tixOption', name) + return self.tk.call('tix', 'option', 'get', name) + + def tix_resetoptions(self, newScheme, newFontSet, newScmPrio=None): + """Resets the scheme and fontset of the Tix application to + newScheme and newFontSet, respectively. This affects only those + widgets created after this call. Therefore, it is best to call the + resetoptions command before the creation of any widgets in a Tix + application. + + The optional parameter newScmPrio can be given to reset the + priority level of the Tk options set by the Tix schemes. + + Because of the way Tk handles the X option database, after Tix has + been has imported and inited, it is not possible to reset the color + schemes and font sets using the tix config command. Instead, the + tix_resetoptions command must be used. + """ + if newScmPrio is not None: + return self.tk.call('tix', 'resetoptions', newScheme, newFontSet, newScmPrio) + else: + return self.tk.call('tix', 'resetoptions', newScheme, newFontSet) + +class Tk(tkinter.Tk, tixCommand): + """Toplevel widget of Tix which represents mostly the main window + of an application. It has an associated Tcl interpreter.""" + def __init__(self, screenName=None, baseName=None, className='Tix'): + tkinter.Tk.__init__(self, screenName, baseName, className) + tixlib = os.environ.get('TIX_LIBRARY') + self.tk.eval('global auto_path; lappend auto_path [file dir [info nameof]]') + if tixlib is not None: + self.tk.eval('global auto_path; lappend auto_path {%s}' % tixlib) + self.tk.eval('global tcl_pkgPath; lappend tcl_pkgPath {%s}' % tixlib) + # Load Tix - this should work dynamically or statically + # If it's static, tcl/tix8.1/pkgIndex.tcl should have + # 'load {} Tix' + # If it's dynamic under Unix, tcl/tix8.1/pkgIndex.tcl should have + # 'load libtix8.1.8.3.so Tix' + self.tk.eval('package require Tix') + + def destroy(self): + # For safety, remove the delete_window binding before destroy + self.protocol("WM_DELETE_WINDOW", "") + tkinter.Tk.destroy(self) + +# The Tix 'tixForm' geometry manager +class Form: + """The Tix Form geometry manager + + Widgets can be arranged by specifying attachments to other widgets. + See Tix documentation for complete details""" + + def config(self, cnf={}, **kw): + self.tk.call('tixForm', self._w, *self._options(cnf, kw)) + + form = config + + def __setitem__(self, key, value): + Form.form(self, {key: value}) + + def check(self): + return self.tk.call('tixForm', 'check', self._w) + + def forget(self): + self.tk.call('tixForm', 'forget', self._w) + + def grid(self, xsize=0, ysize=0): + if (not xsize) and (not ysize): + x = self.tk.call('tixForm', 'grid', self._w) + y = self.tk.splitlist(x) + z = () + for x in y: + z = z + (self.tk.getint(x),) + return z + return self.tk.call('tixForm', 'grid', self._w, xsize, ysize) + + def info(self, option=None): + if not option: + return self.tk.call('tixForm', 'info', self._w) + if option[0] != '-': + option = '-' + option + return self.tk.call('tixForm', 'info', self._w, option) + + def slaves(self): + return [self._nametowidget(x) for x in + self.tk.splitlist( + self.tk.call( + 'tixForm', 'slaves', self._w))] + + + +tkinter.Widget.__bases__ = tkinter.Widget.__bases__ + (Form,) + +class TixWidget(tkinter.Widget): + """A TixWidget class is used to package all (or most) Tix widgets. + + Widget initialization is extended in two ways: + 1) It is possible to give a list of options which must be part of + the creation command (so called Tix 'static' options). These cannot be + given as a 'config' command later. + 2) It is possible to give the name of an existing TK widget. These are + child widgets created automatically by a Tix mega-widget. The Tk call + to create these widgets is therefore bypassed in TixWidget.__init__ + + Both options are for use by subclasses only. + """ + def __init__ (self, master=None, widgetName=None, + static_options=None, cnf={}, kw={}): + # Merge keywords and dictionary arguments + if kw: + cnf = _cnfmerge((cnf, kw)) + else: + cnf = _cnfmerge(cnf) + + # Move static options into extra. static_options must be + # a list of keywords (or None). + extra=() + + # 'options' is always a static option + if static_options: + static_options.append('options') + else: + static_options = ['options'] + + for k,v in list(cnf.items()): + if k in static_options: + extra = extra + ('-' + k, v) + del cnf[k] + + self.widgetName = widgetName + self._setup(master, cnf) + + # If widgetName is None, this is a dummy creation call where the + # corresponding Tk widget has already been created by Tix + if widgetName: + self.tk.call(widgetName, self._w, *extra) + + # Non-static options - to be done via a 'config' command + if cnf: + Widget.config(self, cnf) + + # Dictionary to hold subwidget names for easier access. We can't + # use the children list because the public Tix names may not be the + # same as the pathname component + self.subwidget_list = {} + + # We set up an attribute access function so that it is possible to + # do w.ok['text'] = 'Hello' rather than w.subwidget('ok')['text'] = 'Hello' + # when w is a StdButtonBox. + # We can even do w.ok.invoke() because w.ok is subclassed from the + # Button class if you go through the proper constructors + def __getattr__(self, name): + if name in self.subwidget_list: + return self.subwidget_list[name] + raise AttributeError(name) + + def set_silent(self, value): + """Set a variable without calling its action routine""" + self.tk.call('tixSetSilent', self._w, value) + + def subwidget(self, name): + """Return the named subwidget (which must have been created by + the sub-class).""" + n = self._subwidget_name(name) + if not n: + raise TclError("Subwidget " + name + " not child of " + self._name) + # Remove header of name and leading dot + n = n[len(self._w)+1:] + return self._nametowidget(n) + + def subwidgets_all(self): + """Return all subwidgets.""" + names = self._subwidget_names() + if not names: + return [] + retlist = [] + for name in names: + name = name[len(self._w)+1:] + try: + retlist.append(self._nametowidget(name)) + except: + # some of the widgets are unknown e.g. border in LabelFrame + pass + return retlist + + def _subwidget_name(self,name): + """Get a subwidget name (returns a String, not a Widget !)""" + try: + return self.tk.call(self._w, 'subwidget', name) + except TclError: + return None + + def _subwidget_names(self): + """Return the name of all subwidgets.""" + try: + x = self.tk.call(self._w, 'subwidgets', '-all') + return self.tk.splitlist(x) + except TclError: + return None + + def config_all(self, option, value): + """Set configuration options for all subwidgets (and self).""" + if option == '': + return + elif not isinstance(option, str): + option = repr(option) + if not isinstance(value, str): + value = repr(value) + names = self._subwidget_names() + for name in names: + self.tk.call(name, 'configure', '-' + option, value) + # These are missing from Tkinter + def image_create(self, imgtype, cnf={}, master=None, **kw): + if master is None: + master = self + if kw and cnf: cnf = _cnfmerge((cnf, kw)) + elif kw: cnf = kw + options = () + for k, v in cnf.items(): + if callable(v): + v = self._register(v) + options = options + ('-'+k, v) + return master.tk.call(('image', 'create', imgtype,) + options) + def image_delete(self, imgname): + try: + self.tk.call('image', 'delete', imgname) + except TclError: + # May happen if the root was destroyed + pass + +# Subwidgets are child widgets created automatically by mega-widgets. +# In python, we have to create these subwidgets manually to mirror their +# existence in Tk/Tix. +class TixSubWidget(TixWidget): + """Subwidget class. + + This is used to mirror child widgets automatically created + by Tix/Tk as part of a mega-widget in Python (which is not informed + of this)""" + + def __init__(self, master, name, + destroy_physically=1, check_intermediate=1): + if check_intermediate: + path = master._subwidget_name(name) + try: + path = path[len(master._w)+1:] + plist = path.split('.') + except: + plist = [] + + if not check_intermediate: + # immediate descendant + TixWidget.__init__(self, master, None, None, {'name' : name}) + else: + # Ensure that the intermediate widgets exist + parent = master + for i in range(len(plist) - 1): + n = '.'.join(plist[:i+1]) + try: + w = master._nametowidget(n) + parent = w + except KeyError: + # Create the intermediate widget + parent = TixSubWidget(parent, plist[i], + destroy_physically=0, + check_intermediate=0) + # The Tk widget name is in plist, not in name + if plist: + name = plist[-1] + TixWidget.__init__(self, parent, None, None, {'name' : name}) + self.destroy_physically = destroy_physically + + def destroy(self): + # For some widgets e.g., a NoteBook, when we call destructors, + # we must be careful not to destroy the frame widget since this + # also destroys the parent NoteBook thus leading to an exception + # in Tkinter when it finally calls Tcl to destroy the NoteBook + for c in list(self.children.values()): c.destroy() + if self._name in self.master.children: + del self.master.children[self._name] + if self._name in self.master.subwidget_list: + del self.master.subwidget_list[self._name] + if self.destroy_physically: + # This is bypassed only for a few widgets + self.tk.call('destroy', self._w) + + +# Useful class to create a display style - later shared by many items. +# Contributed by Steffen Kremser +class DisplayStyle: + """DisplayStyle - handle configuration options shared by + (multiple) Display Items""" + + def __init__(self, itemtype, cnf={}, *, master=None, **kw): + if master is None: + if 'refwindow' in kw: + master = kw['refwindow'] + elif 'refwindow' in cnf: + master = cnf['refwindow'] + else: + master = tkinter._get_default_root('create display style') + self.tk = master.tk + self.stylename = self.tk.call('tixDisplayStyle', itemtype, + *self._options(cnf,kw) ) + + def __str__(self): + return self.stylename + + def _options(self, cnf, kw): + if kw and cnf: + cnf = _cnfmerge((cnf, kw)) + elif kw: + cnf = kw + opts = () + for k, v in cnf.items(): + opts = opts + ('-'+k, v) + return opts + + def delete(self): + self.tk.call(self.stylename, 'delete') + + def __setitem__(self,key,value): + self.tk.call(self.stylename, 'configure', '-%s'%key, value) + + def config(self, cnf={}, **kw): + return self._getconfigure( + self.stylename, 'configure', *self._options(cnf,kw)) + + def __getitem__(self,key): + return self.tk.call(self.stylename, 'cget', '-%s'%key) + + +###################################################### +### The Tix Widget classes - in alphabetical order ### +###################################################### + +class Balloon(TixWidget): + """Balloon help widget. + + Subwidget Class + --------- ----- + label Label + message Message""" + + # FIXME: It should inherit -superclass tixShell + def __init__(self, master=None, cnf={}, **kw): + # static seem to be -installcolormap -initwait -statusbar -cursor + static = ['options', 'installcolormap', 'initwait', 'statusbar', + 'cursor'] + TixWidget.__init__(self, master, 'tixBalloon', static, cnf, kw) + self.subwidget_list['label'] = _dummyLabel(self, 'label', + destroy_physically=0) + self.subwidget_list['message'] = _dummyLabel(self, 'message', + destroy_physically=0) + + def bind_widget(self, widget, cnf={}, **kw): + """Bind balloon widget to another. + One balloon widget may be bound to several widgets at the same time""" + self.tk.call(self._w, 'bind', widget._w, *self._options(cnf, kw)) + + def unbind_widget(self, widget): + self.tk.call(self._w, 'unbind', widget._w) + +class ButtonBox(TixWidget): + """ButtonBox - A container for pushbuttons. + Subwidgets are the buttons added with the add method. + """ + def __init__(self, master=None, cnf={}, **kw): + TixWidget.__init__(self, master, 'tixButtonBox', + ['orientation', 'options'], cnf, kw) + + def add(self, name, cnf={}, **kw): + """Add a button with given name to box.""" + + btn = self.tk.call(self._w, 'add', name, *self._options(cnf, kw)) + self.subwidget_list[name] = _dummyButton(self, name) + return btn + + def invoke(self, name): + if name in self.subwidget_list: + self.tk.call(self._w, 'invoke', name) + +class ComboBox(TixWidget): + """ComboBox - an Entry field with a dropdown menu. The user can select a + choice by either typing in the entry subwidget or selecting from the + listbox subwidget. + + Subwidget Class + --------- ----- + entry Entry + arrow Button + slistbox ScrolledListBox + tick Button + cross Button : present if created with the fancy option""" + + # FIXME: It should inherit -superclass tixLabelWidget + def __init__ (self, master=None, cnf={}, **kw): + TixWidget.__init__(self, master, 'tixComboBox', + ['editable', 'dropdown', 'fancy', 'options'], + cnf, kw) + self.subwidget_list['label'] = _dummyLabel(self, 'label') + self.subwidget_list['entry'] = _dummyEntry(self, 'entry') + self.subwidget_list['arrow'] = _dummyButton(self, 'arrow') + self.subwidget_list['slistbox'] = _dummyScrolledListBox(self, + 'slistbox') + try: + self.subwidget_list['tick'] = _dummyButton(self, 'tick') + self.subwidget_list['cross'] = _dummyButton(self, 'cross') + except TypeError: + # unavailable when -fancy not specified + pass + + # align + + def add_history(self, str): + self.tk.call(self._w, 'addhistory', str) + + def append_history(self, str): + self.tk.call(self._w, 'appendhistory', str) + + def insert(self, index, str): + self.tk.call(self._w, 'insert', index, str) + + def pick(self, index): + self.tk.call(self._w, 'pick', index) + +class Control(TixWidget): + """Control - An entry field with value change arrows. The user can + adjust the value by pressing the two arrow buttons or by entering + the value directly into the entry. The new value will be checked + against the user-defined upper and lower limits. + + Subwidget Class + --------- ----- + incr Button + decr Button + entry Entry + label Label""" + + # FIXME: It should inherit -superclass tixLabelWidget + def __init__ (self, master=None, cnf={}, **kw): + TixWidget.__init__(self, master, 'tixControl', ['options'], cnf, kw) + self.subwidget_list['incr'] = _dummyButton(self, 'incr') + self.subwidget_list['decr'] = _dummyButton(self, 'decr') + self.subwidget_list['label'] = _dummyLabel(self, 'label') + self.subwidget_list['entry'] = _dummyEntry(self, 'entry') + + def decrement(self): + self.tk.call(self._w, 'decr') + + def increment(self): + self.tk.call(self._w, 'incr') + + def invoke(self): + self.tk.call(self._w, 'invoke') + + def update(self): + self.tk.call(self._w, 'update') + +class DirList(TixWidget): + """DirList - displays a list view of a directory, its previous + directories and its sub-directories. The user can choose one of + the directories displayed in the list or change to another directory. + + Subwidget Class + --------- ----- + hlist HList + hsb Scrollbar + vsb Scrollbar""" + + # FIXME: It should inherit -superclass tixScrolledHList + def __init__(self, master, cnf={}, **kw): + TixWidget.__init__(self, master, 'tixDirList', ['options'], cnf, kw) + self.subwidget_list['hlist'] = _dummyHList(self, 'hlist') + self.subwidget_list['vsb'] = _dummyScrollbar(self, 'vsb') + self.subwidget_list['hsb'] = _dummyScrollbar(self, 'hsb') + + def chdir(self, dir): + self.tk.call(self._w, 'chdir', dir) + +class DirTree(TixWidget): + """DirTree - Directory Listing in a hierarchical view. + Displays a tree view of a directory, its previous directories and its + sub-directories. The user can choose one of the directories displayed + in the list or change to another directory. + + Subwidget Class + --------- ----- + hlist HList + hsb Scrollbar + vsb Scrollbar""" + + # FIXME: It should inherit -superclass tixScrolledHList + def __init__(self, master, cnf={}, **kw): + TixWidget.__init__(self, master, 'tixDirTree', ['options'], cnf, kw) + self.subwidget_list['hlist'] = _dummyHList(self, 'hlist') + self.subwidget_list['vsb'] = _dummyScrollbar(self, 'vsb') + self.subwidget_list['hsb'] = _dummyScrollbar(self, 'hsb') + + def chdir(self, dir): + self.tk.call(self._w, 'chdir', dir) + +class DirSelectBox(TixWidget): + """DirSelectBox - Motif style file select box. + It is generally used for + the user to choose a file. FileSelectBox stores the files mostly + recently selected into a ComboBox widget so that they can be quickly + selected again. + + Subwidget Class + --------- ----- + selection ComboBox + filter ComboBox + dirlist ScrolledListBox + filelist ScrolledListBox""" + + def __init__(self, master, cnf={}, **kw): + TixWidget.__init__(self, master, 'tixDirSelectBox', ['options'], cnf, kw) + self.subwidget_list['dirlist'] = _dummyDirList(self, 'dirlist') + self.subwidget_list['dircbx'] = _dummyFileComboBox(self, 'dircbx') + +class ExFileSelectBox(TixWidget): + """ExFileSelectBox - MS Windows style file select box. + It provides a convenient method for the user to select files. + + Subwidget Class + --------- ----- + cancel Button + ok Button + hidden Checkbutton + types ComboBox + dir ComboBox + file ComboBox + dirlist ScrolledListBox + filelist ScrolledListBox""" + + def __init__(self, master, cnf={}, **kw): + TixWidget.__init__(self, master, 'tixExFileSelectBox', ['options'], cnf, kw) + self.subwidget_list['cancel'] = _dummyButton(self, 'cancel') + self.subwidget_list['ok'] = _dummyButton(self, 'ok') + self.subwidget_list['hidden'] = _dummyCheckbutton(self, 'hidden') + self.subwidget_list['types'] = _dummyComboBox(self, 'types') + self.subwidget_list['dir'] = _dummyComboBox(self, 'dir') + self.subwidget_list['dirlist'] = _dummyDirList(self, 'dirlist') + self.subwidget_list['file'] = _dummyComboBox(self, 'file') + self.subwidget_list['filelist'] = _dummyScrolledListBox(self, 'filelist') + + def filter(self): + self.tk.call(self._w, 'filter') + + def invoke(self): + self.tk.call(self._w, 'invoke') + + +# Should inherit from a Dialog class +class DirSelectDialog(TixWidget): + """The DirSelectDialog widget presents the directories in the file + system in a dialog window. The user can use this dialog window to + navigate through the file system to select the desired directory. + + Subwidgets Class + ---------- ----- + dirbox DirSelectDialog""" + + # FIXME: It should inherit -superclass tixDialogShell + def __init__(self, master, cnf={}, **kw): + TixWidget.__init__(self, master, 'tixDirSelectDialog', + ['options'], cnf, kw) + self.subwidget_list['dirbox'] = _dummyDirSelectBox(self, 'dirbox') + # cancel and ok buttons are missing + + def popup(self): + self.tk.call(self._w, 'popup') + + def popdown(self): + self.tk.call(self._w, 'popdown') + + +# Should inherit from a Dialog class +class ExFileSelectDialog(TixWidget): + """ExFileSelectDialog - MS Windows style file select dialog. + It provides a convenient method for the user to select files. + + Subwidgets Class + ---------- ----- + fsbox ExFileSelectBox""" + + # FIXME: It should inherit -superclass tixDialogShell + def __init__(self, master, cnf={}, **kw): + TixWidget.__init__(self, master, 'tixExFileSelectDialog', + ['options'], cnf, kw) + self.subwidget_list['fsbox'] = _dummyExFileSelectBox(self, 'fsbox') + + def popup(self): + self.tk.call(self._w, 'popup') + + def popdown(self): + self.tk.call(self._w, 'popdown') + +class FileSelectBox(TixWidget): + """ExFileSelectBox - Motif style file select box. + It is generally used for + the user to choose a file. FileSelectBox stores the files mostly + recently selected into a ComboBox widget so that they can be quickly + selected again. + + Subwidget Class + --------- ----- + selection ComboBox + filter ComboBox + dirlist ScrolledListBox + filelist ScrolledListBox""" + + def __init__(self, master, cnf={}, **kw): + TixWidget.__init__(self, master, 'tixFileSelectBox', ['options'], cnf, kw) + self.subwidget_list['dirlist'] = _dummyScrolledListBox(self, 'dirlist') + self.subwidget_list['filelist'] = _dummyScrolledListBox(self, 'filelist') + self.subwidget_list['filter'] = _dummyComboBox(self, 'filter') + self.subwidget_list['selection'] = _dummyComboBox(self, 'selection') + + def apply_filter(self): # name of subwidget is same as command + self.tk.call(self._w, 'filter') + + def invoke(self): + self.tk.call(self._w, 'invoke') + +# Should inherit from a Dialog class +class FileSelectDialog(TixWidget): + """FileSelectDialog - Motif style file select dialog. + + Subwidgets Class + ---------- ----- + btns StdButtonBox + fsbox FileSelectBox""" + + # FIXME: It should inherit -superclass tixStdDialogShell + def __init__(self, master, cnf={}, **kw): + TixWidget.__init__(self, master, 'tixFileSelectDialog', + ['options'], cnf, kw) + self.subwidget_list['btns'] = _dummyStdButtonBox(self, 'btns') + self.subwidget_list['fsbox'] = _dummyFileSelectBox(self, 'fsbox') + + def popup(self): + self.tk.call(self._w, 'popup') + + def popdown(self): + self.tk.call(self._w, 'popdown') + +class FileEntry(TixWidget): + """FileEntry - Entry field with button that invokes a FileSelectDialog. + The user can type in the filename manually. Alternatively, the user can + press the button widget that sits next to the entry, which will bring + up a file selection dialog. + + Subwidgets Class + ---------- ----- + button Button + entry Entry""" + + # FIXME: It should inherit -superclass tixLabelWidget + def __init__(self, master, cnf={}, **kw): + TixWidget.__init__(self, master, 'tixFileEntry', + ['dialogtype', 'options'], cnf, kw) + self.subwidget_list['button'] = _dummyButton(self, 'button') + self.subwidget_list['entry'] = _dummyEntry(self, 'entry') + + def invoke(self): + self.tk.call(self._w, 'invoke') + + def file_dialog(self): + # FIXME: return python object + pass + +class HList(TixWidget, XView, YView): + """HList - Hierarchy display widget can be used to display any data + that have a hierarchical structure, for example, file system directory + trees. The list entries are indented and connected by branch lines + according to their places in the hierarchy. + + Subwidgets - None""" + + def __init__ (self,master=None,cnf={}, **kw): + TixWidget.__init__(self, master, 'tixHList', + ['columns', 'options'], cnf, kw) + + def add(self, entry, cnf={}, **kw): + return self.tk.call(self._w, 'add', entry, *self._options(cnf, kw)) + + def add_child(self, parent=None, cnf={}, **kw): + if parent is None: + parent = '' + return self.tk.call( + self._w, 'addchild', parent, *self._options(cnf, kw)) + + def anchor_set(self, entry): + self.tk.call(self._w, 'anchor', 'set', entry) + + def anchor_clear(self): + self.tk.call(self._w, 'anchor', 'clear') + + def column_width(self, col=0, width=None, chars=None): + if not chars: + return self.tk.call(self._w, 'column', 'width', col, width) + else: + return self.tk.call(self._w, 'column', 'width', col, + '-char', chars) + + def delete_all(self): + self.tk.call(self._w, 'delete', 'all') + + def delete_entry(self, entry): + self.tk.call(self._w, 'delete', 'entry', entry) + + def delete_offsprings(self, entry): + self.tk.call(self._w, 'delete', 'offsprings', entry) + + def delete_siblings(self, entry): + self.tk.call(self._w, 'delete', 'siblings', entry) + + def dragsite_set(self, index): + self.tk.call(self._w, 'dragsite', 'set', index) + + def dragsite_clear(self): + self.tk.call(self._w, 'dragsite', 'clear') + + def dropsite_set(self, index): + self.tk.call(self._w, 'dropsite', 'set', index) + + def dropsite_clear(self): + self.tk.call(self._w, 'dropsite', 'clear') + + def header_create(self, col, cnf={}, **kw): + self.tk.call(self._w, 'header', 'create', col, *self._options(cnf, kw)) + + def header_configure(self, col, cnf={}, **kw): + if cnf is None: + return self._getconfigure(self._w, 'header', 'configure', col) + self.tk.call(self._w, 'header', 'configure', col, + *self._options(cnf, kw)) + + def header_cget(self, col, opt): + return self.tk.call(self._w, 'header', 'cget', col, opt) + + def header_exists(self, col): + # A workaround to Tix library bug (issue #25464). + # The documented command is "exists", but only erroneous "exist" is + # accepted. + return self.tk.getboolean(self.tk.call(self._w, 'header', 'exist', col)) + header_exist = header_exists + + def header_delete(self, col): + self.tk.call(self._w, 'header', 'delete', col) + + def header_size(self, col): + return self.tk.call(self._w, 'header', 'size', col) + + def hide_entry(self, entry): + self.tk.call(self._w, 'hide', 'entry', entry) + + def indicator_create(self, entry, cnf={}, **kw): + self.tk.call( + self._w, 'indicator', 'create', entry, *self._options(cnf, kw)) + + def indicator_configure(self, entry, cnf={}, **kw): + if cnf is None: + return self._getconfigure( + self._w, 'indicator', 'configure', entry) + self.tk.call( + self._w, 'indicator', 'configure', entry, *self._options(cnf, kw)) + + def indicator_cget(self, entry, opt): + return self.tk.call(self._w, 'indicator', 'cget', entry, opt) + + def indicator_exists(self, entry): + return self.tk.call (self._w, 'indicator', 'exists', entry) + + def indicator_delete(self, entry): + self.tk.call(self._w, 'indicator', 'delete', entry) + + def indicator_size(self, entry): + return self.tk.call(self._w, 'indicator', 'size', entry) + + def info_anchor(self): + return self.tk.call(self._w, 'info', 'anchor') + + def info_bbox(self, entry): + return self._getints( + self.tk.call(self._w, 'info', 'bbox', entry)) or None + + def info_children(self, entry=None): + c = self.tk.call(self._w, 'info', 'children', entry) + return self.tk.splitlist(c) + + def info_data(self, entry): + return self.tk.call(self._w, 'info', 'data', entry) + + def info_dragsite(self): + return self.tk.call(self._w, 'info', 'dragsite') + + def info_dropsite(self): + return self.tk.call(self._w, 'info', 'dropsite') + + def info_exists(self, entry): + return self.tk.call(self._w, 'info', 'exists', entry) + + def info_hidden(self, entry): + return self.tk.call(self._w, 'info', 'hidden', entry) + + def info_next(self, entry): + return self.tk.call(self._w, 'info', 'next', entry) + + def info_parent(self, entry): + return self.tk.call(self._w, 'info', 'parent', entry) + + def info_prev(self, entry): + return self.tk.call(self._w, 'info', 'prev', entry) + + def info_selection(self): + c = self.tk.call(self._w, 'info', 'selection') + return self.tk.splitlist(c) + + def item_cget(self, entry, col, opt): + return self.tk.call(self._w, 'item', 'cget', entry, col, opt) + + def item_configure(self, entry, col, cnf={}, **kw): + if cnf is None: + return self._getconfigure(self._w, 'item', 'configure', entry, col) + self.tk.call(self._w, 'item', 'configure', entry, col, + *self._options(cnf, kw)) + + def item_create(self, entry, col, cnf={}, **kw): + self.tk.call( + self._w, 'item', 'create', entry, col, *self._options(cnf, kw)) + + def item_exists(self, entry, col): + return self.tk.call(self._w, 'item', 'exists', entry, col) + + def item_delete(self, entry, col): + self.tk.call(self._w, 'item', 'delete', entry, col) + + def entrycget(self, entry, opt): + return self.tk.call(self._w, 'entrycget', entry, opt) + + def entryconfigure(self, entry, cnf={}, **kw): + if cnf is None: + return self._getconfigure(self._w, 'entryconfigure', entry) + self.tk.call(self._w, 'entryconfigure', entry, + *self._options(cnf, kw)) + + def nearest(self, y): + return self.tk.call(self._w, 'nearest', y) + + def see(self, entry): + self.tk.call(self._w, 'see', entry) + + def selection_clear(self, cnf={}, **kw): + self.tk.call(self._w, 'selection', 'clear', *self._options(cnf, kw)) + + def selection_includes(self, entry): + return self.tk.call(self._w, 'selection', 'includes', entry) + + def selection_set(self, first, last=None): + self.tk.call(self._w, 'selection', 'set', first, last) + + def show_entry(self, entry): + return self.tk.call(self._w, 'show', 'entry', entry) + +class InputOnly(TixWidget): + """InputOnly - Invisible widget. Unix only. + + Subwidgets - None""" + + def __init__ (self,master=None,cnf={}, **kw): + TixWidget.__init__(self, master, 'tixInputOnly', None, cnf, kw) + +class LabelEntry(TixWidget): + """LabelEntry - Entry field with label. Packages an entry widget + and a label into one mega widget. It can be used to simplify the creation + of ``entry-form'' type of interface. + + Subwidgets Class + ---------- ----- + label Label + entry Entry""" + + def __init__ (self,master=None,cnf={}, **kw): + TixWidget.__init__(self, master, 'tixLabelEntry', + ['labelside','options'], cnf, kw) + self.subwidget_list['label'] = _dummyLabel(self, 'label') + self.subwidget_list['entry'] = _dummyEntry(self, 'entry') + +class LabelFrame(TixWidget): + """LabelFrame - Labelled Frame container. Packages a frame widget + and a label into one mega widget. To create widgets inside a + LabelFrame widget, one creates the new widgets relative to the + frame subwidget and manage them inside the frame subwidget. + + Subwidgets Class + ---------- ----- + label Label + frame Frame""" + + def __init__ (self,master=None,cnf={}, **kw): + TixWidget.__init__(self, master, 'tixLabelFrame', + ['labelside','options'], cnf, kw) + self.subwidget_list['label'] = _dummyLabel(self, 'label') + self.subwidget_list['frame'] = _dummyFrame(self, 'frame') + + +class ListNoteBook(TixWidget): + """A ListNoteBook widget is very similar to the TixNoteBook widget: + it can be used to display many windows in a limited space using a + notebook metaphor. The notebook is divided into a stack of pages + (windows). At one time only one of these pages can be shown. + The user can navigate through these pages by + choosing the name of the desired page in the hlist subwidget.""" + + def __init__(self, master, cnf={}, **kw): + TixWidget.__init__(self, master, 'tixListNoteBook', ['options'], cnf, kw) + # Is this necessary? It's not an exposed subwidget in Tix. + self.subwidget_list['pane'] = _dummyPanedWindow(self, 'pane', + destroy_physically=0) + self.subwidget_list['hlist'] = _dummyHList(self, 'hlist') + self.subwidget_list['shlist'] = _dummyScrolledHList(self, 'shlist') + + def add(self, name, cnf={}, **kw): + self.tk.call(self._w, 'add', name, *self._options(cnf, kw)) + self.subwidget_list[name] = TixSubWidget(self, name) + return self.subwidget_list[name] + + def page(self, name): + return self.subwidget(name) + + def pages(self): + # Can't call subwidgets_all directly because we don't want .nbframe + names = self.tk.splitlist(self.tk.call(self._w, 'pages')) + ret = [] + for x in names: + ret.append(self.subwidget(x)) + return ret + + def raise_page(self, name): # raise is a python keyword + self.tk.call(self._w, 'raise', name) + +class Meter(TixWidget): + """The Meter widget can be used to show the progress of a background + job which may take a long time to execute. + """ + + def __init__(self, master=None, cnf={}, **kw): + TixWidget.__init__(self, master, 'tixMeter', + ['options'], cnf, kw) + +class NoteBook(TixWidget): + """NoteBook - Multi-page container widget (tabbed notebook metaphor). + + Subwidgets Class + ---------- ----- + nbframe NoteBookFrame + page widgets added dynamically with the add method""" + + def __init__ (self,master=None,cnf={}, **kw): + TixWidget.__init__(self,master,'tixNoteBook', ['options'], cnf, kw) + self.subwidget_list['nbframe'] = TixSubWidget(self, 'nbframe', + destroy_physically=0) + + def add(self, name, cnf={}, **kw): + self.tk.call(self._w, 'add', name, *self._options(cnf, kw)) + self.subwidget_list[name] = TixSubWidget(self, name) + return self.subwidget_list[name] + + def delete(self, name): + self.tk.call(self._w, 'delete', name) + self.subwidget_list[name].destroy() + del self.subwidget_list[name] + + def page(self, name): + return self.subwidget(name) + + def pages(self): + # Can't call subwidgets_all directly because we don't want .nbframe + names = self.tk.splitlist(self.tk.call(self._w, 'pages')) + ret = [] + for x in names: + ret.append(self.subwidget(x)) + return ret + + def raise_page(self, name): # raise is a python keyword + self.tk.call(self._w, 'raise', name) + + def raised(self): + return self.tk.call(self._w, 'raised') + +class NoteBookFrame(TixWidget): + # FIXME: This is dangerous to expose to be called on its own. + pass + +class OptionMenu(TixWidget): + """OptionMenu - creates a menu button of options. + + Subwidget Class + --------- ----- + menubutton Menubutton + menu Menu""" + + def __init__(self, master, cnf={}, **kw): + TixWidget.__init__(self, master, 'tixOptionMenu', ['options'], cnf, kw) + self.subwidget_list['menubutton'] = _dummyMenubutton(self, 'menubutton') + self.subwidget_list['menu'] = _dummyMenu(self, 'menu') + + def add_command(self, name, cnf={}, **kw): + self.tk.call(self._w, 'add', 'command', name, *self._options(cnf, kw)) + + def add_separator(self, name, cnf={}, **kw): + self.tk.call(self._w, 'add', 'separator', name, *self._options(cnf, kw)) + + def delete(self, name): + self.tk.call(self._w, 'delete', name) + + def disable(self, name): + self.tk.call(self._w, 'disable', name) + + def enable(self, name): + self.tk.call(self._w, 'enable', name) + +class PanedWindow(TixWidget): + """PanedWindow - Multi-pane container widget + allows the user to interactively manipulate the sizes of several + panes. The panes can be arranged either vertically or horizontally.The + user changes the sizes of the panes by dragging the resize handle + between two panes. + + Subwidgets Class + ---------- ----- + g/p widgets added dynamically with the add method.""" + + def __init__(self, master, cnf={}, **kw): + TixWidget.__init__(self, master, 'tixPanedWindow', ['orientation', 'options'], cnf, kw) + + # add delete forget panecget paneconfigure panes setsize + def add(self, name, cnf={}, **kw): + self.tk.call(self._w, 'add', name, *self._options(cnf, kw)) + self.subwidget_list[name] = TixSubWidget(self, name, + check_intermediate=0) + return self.subwidget_list[name] + + def delete(self, name): + self.tk.call(self._w, 'delete', name) + self.subwidget_list[name].destroy() + del self.subwidget_list[name] + + def forget(self, name): + self.tk.call(self._w, 'forget', name) + + def panecget(self, entry, opt): + return self.tk.call(self._w, 'panecget', entry, opt) + + def paneconfigure(self, entry, cnf={}, **kw): + if cnf is None: + return self._getconfigure(self._w, 'paneconfigure', entry) + self.tk.call(self._w, 'paneconfigure', entry, *self._options(cnf, kw)) + + def panes(self): + names = self.tk.splitlist(self.tk.call(self._w, 'panes')) + return [self.subwidget(x) for x in names] + +class PopupMenu(TixWidget): + """PopupMenu widget can be used as a replacement of the tk_popup command. + The advantage of the Tix PopupMenu widget is it requires less application + code to manipulate. + + + Subwidgets Class + ---------- ----- + menubutton Menubutton + menu Menu""" + + # FIXME: It should inherit -superclass tixShell + def __init__(self, master, cnf={}, **kw): + TixWidget.__init__(self, master, 'tixPopupMenu', ['options'], cnf, kw) + self.subwidget_list['menubutton'] = _dummyMenubutton(self, 'menubutton') + self.subwidget_list['menu'] = _dummyMenu(self, 'menu') + + def bind_widget(self, widget): + self.tk.call(self._w, 'bind', widget._w) + + def unbind_widget(self, widget): + self.tk.call(self._w, 'unbind', widget._w) + + def post_widget(self, widget, x, y): + self.tk.call(self._w, 'post', widget._w, x, y) + +class ResizeHandle(TixWidget): + """Internal widget to draw resize handles on Scrolled widgets.""" + def __init__(self, master, cnf={}, **kw): + # There seems to be a Tix bug rejecting the configure method + # Let's try making the flags -static + flags = ['options', 'command', 'cursorfg', 'cursorbg', + 'handlesize', 'hintcolor', 'hintwidth', + 'x', 'y'] + # In fact, x y height width are configurable + TixWidget.__init__(self, master, 'tixResizeHandle', + flags, cnf, kw) + + def attach_widget(self, widget): + self.tk.call(self._w, 'attachwidget', widget._w) + + def detach_widget(self, widget): + self.tk.call(self._w, 'detachwidget', widget._w) + + def hide(self, widget): + self.tk.call(self._w, 'hide', widget._w) + + def show(self, widget): + self.tk.call(self._w, 'show', widget._w) + +class ScrolledHList(TixWidget): + """ScrolledHList - HList with automatic scrollbars.""" + + # FIXME: It should inherit -superclass tixScrolledWidget + def __init__(self, master, cnf={}, **kw): + TixWidget.__init__(self, master, 'tixScrolledHList', ['options'], + cnf, kw) + self.subwidget_list['hlist'] = _dummyHList(self, 'hlist') + self.subwidget_list['vsb'] = _dummyScrollbar(self, 'vsb') + self.subwidget_list['hsb'] = _dummyScrollbar(self, 'hsb') + +class ScrolledListBox(TixWidget): + """ScrolledListBox - Listbox with automatic scrollbars.""" + + # FIXME: It should inherit -superclass tixScrolledWidget + def __init__(self, master, cnf={}, **kw): + TixWidget.__init__(self, master, 'tixScrolledListBox', ['options'], cnf, kw) + self.subwidget_list['listbox'] = _dummyListbox(self, 'listbox') + self.subwidget_list['vsb'] = _dummyScrollbar(self, 'vsb') + self.subwidget_list['hsb'] = _dummyScrollbar(self, 'hsb') + +class ScrolledText(TixWidget): + """ScrolledText - Text with automatic scrollbars.""" + + # FIXME: It should inherit -superclass tixScrolledWidget + def __init__(self, master, cnf={}, **kw): + TixWidget.__init__(self, master, 'tixScrolledText', ['options'], cnf, kw) + self.subwidget_list['text'] = _dummyText(self, 'text') + self.subwidget_list['vsb'] = _dummyScrollbar(self, 'vsb') + self.subwidget_list['hsb'] = _dummyScrollbar(self, 'hsb') + +class ScrolledTList(TixWidget): + """ScrolledTList - TList with automatic scrollbars.""" + + # FIXME: It should inherit -superclass tixScrolledWidget + def __init__(self, master, cnf={}, **kw): + TixWidget.__init__(self, master, 'tixScrolledTList', ['options'], + cnf, kw) + self.subwidget_list['tlist'] = _dummyTList(self, 'tlist') + self.subwidget_list['vsb'] = _dummyScrollbar(self, 'vsb') + self.subwidget_list['hsb'] = _dummyScrollbar(self, 'hsb') + +class ScrolledWindow(TixWidget): + """ScrolledWindow - Window with automatic scrollbars.""" + + # FIXME: It should inherit -superclass tixScrolledWidget + def __init__(self, master, cnf={}, **kw): + TixWidget.__init__(self, master, 'tixScrolledWindow', ['options'], cnf, kw) + self.subwidget_list['window'] = _dummyFrame(self, 'window') + self.subwidget_list['vsb'] = _dummyScrollbar(self, 'vsb') + self.subwidget_list['hsb'] = _dummyScrollbar(self, 'hsb') + +class Select(TixWidget): + """Select - Container of button subwidgets. It can be used to provide + radio-box or check-box style of selection options for the user. + + Subwidgets are buttons added dynamically using the add method.""" + + # FIXME: It should inherit -superclass tixLabelWidget + def __init__(self, master, cnf={}, **kw): + TixWidget.__init__(self, master, 'tixSelect', + ['allowzero', 'radio', 'orientation', 'labelside', + 'options'], + cnf, kw) + self.subwidget_list['label'] = _dummyLabel(self, 'label') + + def add(self, name, cnf={}, **kw): + self.tk.call(self._w, 'add', name, *self._options(cnf, kw)) + self.subwidget_list[name] = _dummyButton(self, name) + return self.subwidget_list[name] + + def invoke(self, name): + self.tk.call(self._w, 'invoke', name) + +class Shell(TixWidget): + """Toplevel window. + + Subwidgets - None""" + + def __init__ (self,master=None,cnf={}, **kw): + TixWidget.__init__(self, master, 'tixShell', ['options', 'title'], cnf, kw) + +class DialogShell(TixWidget): + """Toplevel window, with popup popdown and center methods. + It tells the window manager that it is a dialog window and should be + treated specially. The exact treatment depends on the treatment of + the window manager. + + Subwidgets - None""" + + # FIXME: It should inherit from Shell + def __init__ (self,master=None,cnf={}, **kw): + TixWidget.__init__(self, master, + 'tixDialogShell', + ['options', 'title', 'mapped', + 'minheight', 'minwidth', + 'parent', 'transient'], cnf, kw) + + def popdown(self): + self.tk.call(self._w, 'popdown') + + def popup(self): + self.tk.call(self._w, 'popup') + + def center(self): + self.tk.call(self._w, 'center') + +class StdButtonBox(TixWidget): + """StdButtonBox - Standard Button Box (OK, Apply, Cancel and Help) """ + + def __init__(self, master=None, cnf={}, **kw): + TixWidget.__init__(self, master, 'tixStdButtonBox', + ['orientation', 'options'], cnf, kw) + self.subwidget_list['ok'] = _dummyButton(self, 'ok') + self.subwidget_list['apply'] = _dummyButton(self, 'apply') + self.subwidget_list['cancel'] = _dummyButton(self, 'cancel') + self.subwidget_list['help'] = _dummyButton(self, 'help') + + def invoke(self, name): + if name in self.subwidget_list: + self.tk.call(self._w, 'invoke', name) + +class TList(TixWidget, XView, YView): + """TList - Hierarchy display widget which can be + used to display data in a tabular format. The list entries of a TList + widget are similar to the entries in the Tk listbox widget. The main + differences are (1) the TList widget can display the list entries in a + two dimensional format and (2) you can use graphical images as well as + multiple colors and fonts for the list entries. + + Subwidgets - None""" + + def __init__ (self,master=None,cnf={}, **kw): + TixWidget.__init__(self, master, 'tixTList', ['options'], cnf, kw) + + def active_set(self, index): + self.tk.call(self._w, 'active', 'set', index) + + def active_clear(self): + self.tk.call(self._w, 'active', 'clear') + + def anchor_set(self, index): + self.tk.call(self._w, 'anchor', 'set', index) + + def anchor_clear(self): + self.tk.call(self._w, 'anchor', 'clear') + + def delete(self, from_, to=None): + self.tk.call(self._w, 'delete', from_, to) + + def dragsite_set(self, index): + self.tk.call(self._w, 'dragsite', 'set', index) + + def dragsite_clear(self): + self.tk.call(self._w, 'dragsite', 'clear') + + def dropsite_set(self, index): + self.tk.call(self._w, 'dropsite', 'set', index) + + def dropsite_clear(self): + self.tk.call(self._w, 'dropsite', 'clear') + + def insert(self, index, cnf={}, **kw): + self.tk.call(self._w, 'insert', index, *self._options(cnf, kw)) + + def info_active(self): + return self.tk.call(self._w, 'info', 'active') + + def info_anchor(self): + return self.tk.call(self._w, 'info', 'anchor') + + def info_down(self, index): + return self.tk.call(self._w, 'info', 'down', index) + + def info_left(self, index): + return self.tk.call(self._w, 'info', 'left', index) + + def info_right(self, index): + return self.tk.call(self._w, 'info', 'right', index) + + def info_selection(self): + c = self.tk.call(self._w, 'info', 'selection') + return self.tk.splitlist(c) + + def info_size(self): + return self.tk.call(self._w, 'info', 'size') + + def info_up(self, index): + return self.tk.call(self._w, 'info', 'up', index) + + def nearest(self, x, y): + return self.tk.call(self._w, 'nearest', x, y) + + def see(self, index): + self.tk.call(self._w, 'see', index) + + def selection_clear(self, cnf={}, **kw): + self.tk.call(self._w, 'selection', 'clear', *self._options(cnf, kw)) + + def selection_includes(self, index): + return self.tk.call(self._w, 'selection', 'includes', index) + + def selection_set(self, first, last=None): + self.tk.call(self._w, 'selection', 'set', first, last) + +class Tree(TixWidget): + """Tree - The tixTree widget can be used to display hierarchical + data in a tree form. The user can adjust + the view of the tree by opening or closing parts of the tree.""" + + # FIXME: It should inherit -superclass tixScrolledWidget + def __init__(self, master=None, cnf={}, **kw): + TixWidget.__init__(self, master, 'tixTree', + ['options'], cnf, kw) + self.subwidget_list['hlist'] = _dummyHList(self, 'hlist') + self.subwidget_list['vsb'] = _dummyScrollbar(self, 'vsb') + self.subwidget_list['hsb'] = _dummyScrollbar(self, 'hsb') + + def autosetmode(self): + '''This command calls the setmode method for all the entries in this + Tree widget: if an entry has no child entries, its mode is set to + none. Otherwise, if the entry has any hidden child entries, its mode is + set to open; otherwise its mode is set to close.''' + self.tk.call(self._w, 'autosetmode') + + def close(self, entrypath): + '''Close the entry given by entryPath if its mode is close.''' + self.tk.call(self._w, 'close', entrypath) + + def getmode(self, entrypath): + '''Returns the current mode of the entry given by entryPath.''' + return self.tk.call(self._w, 'getmode', entrypath) + + def open(self, entrypath): + '''Open the entry given by entryPath if its mode is open.''' + self.tk.call(self._w, 'open', entrypath) + + def setmode(self, entrypath, mode='none'): + '''This command is used to indicate whether the entry given by + entryPath has children entries and whether the children are visible. mode + must be one of open, close or none. If mode is set to open, a (+) + indicator is drawn next the entry. If mode is set to close, a (-) + indicator is drawn next the entry. If mode is set to none, no + indicators will be drawn for this entry. The default mode is none. The + open mode indicates the entry has hidden children and this entry can be + opened by the user. The close mode indicates that all the children of the + entry are now visible and the entry can be closed by the user.''' + self.tk.call(self._w, 'setmode', entrypath, mode) + + +# Could try subclassing Tree for CheckList - would need another arg to init +class CheckList(TixWidget): + """The CheckList widget + displays a list of items to be selected by the user. CheckList acts + similarly to the Tk checkbutton or radiobutton widgets, except it is + capable of handling many more items than checkbuttons or radiobuttons. + """ + # FIXME: It should inherit -superclass tixTree + def __init__(self, master=None, cnf={}, **kw): + TixWidget.__init__(self, master, 'tixCheckList', + ['options', 'radio'], cnf, kw) + self.subwidget_list['hlist'] = _dummyHList(self, 'hlist') + self.subwidget_list['vsb'] = _dummyScrollbar(self, 'vsb') + self.subwidget_list['hsb'] = _dummyScrollbar(self, 'hsb') + + def autosetmode(self): + '''This command calls the setmode method for all the entries in this + Tree widget: if an entry has no child entries, its mode is set to + none. Otherwise, if the entry has any hidden child entries, its mode is + set to open; otherwise its mode is set to close.''' + self.tk.call(self._w, 'autosetmode') + + def close(self, entrypath): + '''Close the entry given by entryPath if its mode is close.''' + self.tk.call(self._w, 'close', entrypath) + + def getmode(self, entrypath): + '''Returns the current mode of the entry given by entryPath.''' + return self.tk.call(self._w, 'getmode', entrypath) + + def open(self, entrypath): + '''Open the entry given by entryPath if its mode is open.''' + self.tk.call(self._w, 'open', entrypath) + + def getselection(self, mode='on'): + '''Returns a list of items whose status matches status. If status is + not specified, the list of items in the "on" status will be returned. + Mode can be on, off, default''' + return self.tk.splitlist(self.tk.call(self._w, 'getselection', mode)) + + def getstatus(self, entrypath): + '''Returns the current status of entryPath.''' + return self.tk.call(self._w, 'getstatus', entrypath) + + def setstatus(self, entrypath, mode='on'): + '''Sets the status of entryPath to be status. A bitmap will be + displayed next to the entry its status is on, off or default.''' + self.tk.call(self._w, 'setstatus', entrypath, mode) + + +########################################################################### +### The subclassing below is used to instantiate the subwidgets in each ### +### mega widget. This allows us to access their methods directly. ### +########################################################################### + +class _dummyButton(Button, TixSubWidget): + def __init__(self, master, name, destroy_physically=1): + TixSubWidget.__init__(self, master, name, destroy_physically) + +class _dummyCheckbutton(Checkbutton, TixSubWidget): + def __init__(self, master, name, destroy_physically=1): + TixSubWidget.__init__(self, master, name, destroy_physically) + +class _dummyEntry(Entry, TixSubWidget): + def __init__(self, master, name, destroy_physically=1): + TixSubWidget.__init__(self, master, name, destroy_physically) + +class _dummyFrame(Frame, TixSubWidget): + def __init__(self, master, name, destroy_physically=1): + TixSubWidget.__init__(self, master, name, destroy_physically) + +class _dummyLabel(Label, TixSubWidget): + def __init__(self, master, name, destroy_physically=1): + TixSubWidget.__init__(self, master, name, destroy_physically) + +class _dummyListbox(Listbox, TixSubWidget): + def __init__(self, master, name, destroy_physically=1): + TixSubWidget.__init__(self, master, name, destroy_physically) + +class _dummyMenu(Menu, TixSubWidget): + def __init__(self, master, name, destroy_physically=1): + TixSubWidget.__init__(self, master, name, destroy_physically) + +class _dummyMenubutton(Menubutton, TixSubWidget): + def __init__(self, master, name, destroy_physically=1): + TixSubWidget.__init__(self, master, name, destroy_physically) + +class _dummyScrollbar(Scrollbar, TixSubWidget): + def __init__(self, master, name, destroy_physically=1): + TixSubWidget.__init__(self, master, name, destroy_physically) + +class _dummyText(Text, TixSubWidget): + def __init__(self, master, name, destroy_physically=1): + TixSubWidget.__init__(self, master, name, destroy_physically) + +class _dummyScrolledListBox(ScrolledListBox, TixSubWidget): + def __init__(self, master, name, destroy_physically=1): + TixSubWidget.__init__(self, master, name, destroy_physically) + self.subwidget_list['listbox'] = _dummyListbox(self, 'listbox') + self.subwidget_list['vsb'] = _dummyScrollbar(self, 'vsb') + self.subwidget_list['hsb'] = _dummyScrollbar(self, 'hsb') + +class _dummyHList(HList, TixSubWidget): + def __init__(self, master, name, destroy_physically=1): + TixSubWidget.__init__(self, master, name, destroy_physically) + +class _dummyScrolledHList(ScrolledHList, TixSubWidget): + def __init__(self, master, name, destroy_physically=1): + TixSubWidget.__init__(self, master, name, destroy_physically) + self.subwidget_list['hlist'] = _dummyHList(self, 'hlist') + self.subwidget_list['vsb'] = _dummyScrollbar(self, 'vsb') + self.subwidget_list['hsb'] = _dummyScrollbar(self, 'hsb') + +class _dummyTList(TList, TixSubWidget): + def __init__(self, master, name, destroy_physically=1): + TixSubWidget.__init__(self, master, name, destroy_physically) + +class _dummyComboBox(ComboBox, TixSubWidget): + def __init__(self, master, name, destroy_physically=1): + TixSubWidget.__init__(self, master, name, ['fancy',destroy_physically]) + self.subwidget_list['label'] = _dummyLabel(self, 'label') + self.subwidget_list['entry'] = _dummyEntry(self, 'entry') + self.subwidget_list['arrow'] = _dummyButton(self, 'arrow') + + self.subwidget_list['slistbox'] = _dummyScrolledListBox(self, + 'slistbox') + try: + self.subwidget_list['tick'] = _dummyButton(self, 'tick') + #cross Button : present if created with the fancy option + self.subwidget_list['cross'] = _dummyButton(self, 'cross') + except TypeError: + # unavailable when -fancy not specified + pass + +class _dummyDirList(DirList, TixSubWidget): + def __init__(self, master, name, destroy_physically=1): + TixSubWidget.__init__(self, master, name, destroy_physically) + self.subwidget_list['hlist'] = _dummyHList(self, 'hlist') + self.subwidget_list['vsb'] = _dummyScrollbar(self, 'vsb') + self.subwidget_list['hsb'] = _dummyScrollbar(self, 'hsb') + +class _dummyDirSelectBox(DirSelectBox, TixSubWidget): + def __init__(self, master, name, destroy_physically=1): + TixSubWidget.__init__(self, master, name, destroy_physically) + self.subwidget_list['dirlist'] = _dummyDirList(self, 'dirlist') + self.subwidget_list['dircbx'] = _dummyFileComboBox(self, 'dircbx') + +class _dummyExFileSelectBox(ExFileSelectBox, TixSubWidget): + def __init__(self, master, name, destroy_physically=1): + TixSubWidget.__init__(self, master, name, destroy_physically) + self.subwidget_list['cancel'] = _dummyButton(self, 'cancel') + self.subwidget_list['ok'] = _dummyButton(self, 'ok') + self.subwidget_list['hidden'] = _dummyCheckbutton(self, 'hidden') + self.subwidget_list['types'] = _dummyComboBox(self, 'types') + self.subwidget_list['dir'] = _dummyComboBox(self, 'dir') + self.subwidget_list['dirlist'] = _dummyScrolledListBox(self, 'dirlist') + self.subwidget_list['file'] = _dummyComboBox(self, 'file') + self.subwidget_list['filelist'] = _dummyScrolledListBox(self, 'filelist') + +class _dummyFileSelectBox(FileSelectBox, TixSubWidget): + def __init__(self, master, name, destroy_physically=1): + TixSubWidget.__init__(self, master, name, destroy_physically) + self.subwidget_list['dirlist'] = _dummyScrolledListBox(self, 'dirlist') + self.subwidget_list['filelist'] = _dummyScrolledListBox(self, 'filelist') + self.subwidget_list['filter'] = _dummyComboBox(self, 'filter') + self.subwidget_list['selection'] = _dummyComboBox(self, 'selection') + +class _dummyFileComboBox(ComboBox, TixSubWidget): + def __init__(self, master, name, destroy_physically=1): + TixSubWidget.__init__(self, master, name, destroy_physically) + self.subwidget_list['dircbx'] = _dummyComboBox(self, 'dircbx') + +class _dummyStdButtonBox(StdButtonBox, TixSubWidget): + def __init__(self, master, name, destroy_physically=1): + TixSubWidget.__init__(self, master, name, destroy_physically) + self.subwidget_list['ok'] = _dummyButton(self, 'ok') + self.subwidget_list['apply'] = _dummyButton(self, 'apply') + self.subwidget_list['cancel'] = _dummyButton(self, 'cancel') + self.subwidget_list['help'] = _dummyButton(self, 'help') + +class _dummyNoteBookFrame(NoteBookFrame, TixSubWidget): + def __init__(self, master, name, destroy_physically=0): + TixSubWidget.__init__(self, master, name, destroy_physically) + +class _dummyPanedWindow(PanedWindow, TixSubWidget): + def __init__(self, master, name, destroy_physically=1): + TixSubWidget.__init__(self, master, name, destroy_physically) + +######################## +### Utility Routines ### +######################## + +#mike Should tixDestroy be exposed as a wrapper? - but not for widgets. + +def OptionName(widget): + '''Returns the qualified path name for the widget. Normally used to set + default options for subwidgets. See tixwidgets.py''' + return widget.tk.call('tixOptionName', widget._w) + +# Called with a dictionary argument of the form +# {'*.c':'C source files', '*.txt':'Text Files', '*':'All files'} +# returns a string which can be used to configure the fsbox file types +# in an ExFileSelectBox. i.e., +# '{{*} {* - All files}} {{*.c} {*.c - C source files}} {{*.txt} {*.txt - Text Files}}' +def FileTypeList(dict): + s = '' + for type in dict.keys(): + s = s + '{{' + type + '} {' + type + ' - ' + dict[type] + '}} ' + return s + +# Still to be done: +# tixIconView +class CObjView(TixWidget): + """This file implements the Canvas Object View widget. This is a base + class of IconView. It implements automatic placement/adjustment of the + scrollbars according to the canvas objects inside the canvas subwidget. + The scrollbars are adjusted so that the canvas is just large enough + to see all the objects. + """ + # FIXME: It should inherit -superclass tixScrolledWidget + pass + + +class Grid(TixWidget, XView, YView): + '''The Tix Grid command creates a new window and makes it into a + tixGrid widget. Additional options, may be specified on the command + line or in the option database to configure aspects such as its cursor + and relief. + + A Grid widget displays its contents in a two dimensional grid of cells. + Each cell may contain one Tix display item, which may be in text, + graphics or other formats. See the DisplayStyle class for more information + about Tix display items. Individual cells, or groups of cells, can be + formatted with a wide range of attributes, such as its color, relief and + border. + + Subwidgets - None''' + # valid specific resources as of Tk 8.4 + # editdonecmd, editnotifycmd, floatingcols, floatingrows, formatcmd, + # highlightbackground, highlightcolor, leftmargin, itemtype, selectmode, + # selectunit, topmargin, + def __init__(self, master=None, cnf={}, **kw): + static= [] + self.cnf= cnf + TixWidget.__init__(self, master, 'tixGrid', static, cnf, kw) + + # valid options as of Tk 8.4 + # anchor, bdtype, cget, configure, delete, dragsite, dropsite, entrycget, + # edit, entryconfigure, format, geometryinfo, info, index, move, nearest, + # selection, set, size, unset, xview, yview + def anchor_clear(self): + """Removes the selection anchor.""" + self.tk.call(self, 'anchor', 'clear') + + def anchor_get(self): + "Get the (x,y) coordinate of the current anchor cell" + return self._getints(self.tk.call(self, 'anchor', 'get')) + + def anchor_set(self, x, y): + """Set the selection anchor to the cell at (x, y).""" + self.tk.call(self, 'anchor', 'set', x, y) + + def delete_row(self, from_, to=None): + """Delete rows between from_ and to inclusive. + If to is not provided, delete only row at from_""" + if to is None: + self.tk.call(self, 'delete', 'row', from_) + else: + self.tk.call(self, 'delete', 'row', from_, to) + + def delete_column(self, from_, to=None): + """Delete columns between from_ and to inclusive. + If to is not provided, delete only column at from_""" + if to is None: + self.tk.call(self, 'delete', 'column', from_) + else: + self.tk.call(self, 'delete', 'column', from_, to) + + def edit_apply(self): + """If any cell is being edited, de-highlight the cell and applies + the changes.""" + self.tk.call(self, 'edit', 'apply') + + def edit_set(self, x, y): + """Highlights the cell at (x, y) for editing, if the -editnotify + command returns True for this cell.""" + self.tk.call(self, 'edit', 'set', x, y) + + def entrycget(self, x, y, option): + "Get the option value for cell at (x,y)" + if option and option[0] != '-': + option = '-' + option + return self.tk.call(self, 'entrycget', x, y, option) + + def entryconfigure(self, x, y, cnf=None, **kw): + return self._configure(('entryconfigure', x, y), cnf, kw) + + # def format + # def index + + def info_exists(self, x, y): + "Return True if display item exists at (x,y)" + return self._getboolean(self.tk.call(self, 'info', 'exists', x, y)) + + def info_bbox(self, x, y): + # This seems to always return '', at least for 'text' displayitems + return self.tk.call(self, 'info', 'bbox', x, y) + + def move_column(self, from_, to, offset): + """Moves the range of columns from position FROM through TO by + the distance indicated by OFFSET. For example, move_column(2, 4, 1) + moves the columns 2,3,4 to columns 3,4,5.""" + self.tk.call(self, 'move', 'column', from_, to, offset) + + def move_row(self, from_, to, offset): + """Moves the range of rows from position FROM through TO by + the distance indicated by OFFSET. + For example, move_row(2, 4, 1) moves the rows 2,3,4 to rows 3,4,5.""" + self.tk.call(self, 'move', 'row', from_, to, offset) + + def nearest(self, x, y): + "Return coordinate of cell nearest pixel coordinate (x,y)" + return self._getints(self.tk.call(self, 'nearest', x, y)) + + # def selection adjust + # def selection clear + # def selection includes + # def selection set + # def selection toggle + + def set(self, x, y, itemtype=None, **kw): + args= self._options(self.cnf, kw) + if itemtype is not None: + args= ('-itemtype', itemtype) + args + self.tk.call(self, 'set', x, y, *args) + + def size_column(self, index, **kw): + """Queries or sets the size of the column given by + INDEX. INDEX may be any non-negative + integer that gives the position of a given column. + INDEX can also be the string "default"; in this case, this command + queries or sets the default size of all columns. + When no option-value pair is given, this command returns a tuple + containing the current size setting of the given column. When + option-value pairs are given, the corresponding options of the + size setting of the given column are changed. Options may be one + of the following: + pad0 pixels + Specifies the paddings to the left of a column. + pad1 pixels + Specifies the paddings to the right of a column. + size val + Specifies the width of a column. Val may be: + "auto" -- the width of the column is set to the + width of the widest cell in the column; + a valid Tk screen distance unit; + or a real number following by the word chars + (e.g. 3.4chars) that sets the width of the column to the + given number of characters.""" + return self.tk.splitlist(self.tk.call(self._w, 'size', 'column', index, + *self._options({}, kw))) + + def size_row(self, index, **kw): + """Queries or sets the size of the row given by + INDEX. INDEX may be any non-negative + integer that gives the position of a given row . + INDEX can also be the string "default"; in this case, this command + queries or sets the default size of all rows. + When no option-value pair is given, this command returns a list con- + taining the current size setting of the given row . When option-value + pairs are given, the corresponding options of the size setting of the + given row are changed. Options may be one of the following: + pad0 pixels + Specifies the paddings to the top of a row. + pad1 pixels + Specifies the paddings to the bottom of a row. + size val + Specifies the height of a row. Val may be: + "auto" -- the height of the row is set to the + height of the highest cell in the row; + a valid Tk screen distance unit; + or a real number following by the word chars + (e.g. 3.4chars) that sets the height of the row to the + given number of characters.""" + return self.tk.splitlist(self.tk.call( + self, 'size', 'row', index, *self._options({}, kw))) + + def unset(self, x, y): + """Clears the cell at (x, y) by removing its display item.""" + self.tk.call(self._w, 'unset', x, y) + + +class ScrolledGrid(Grid): + '''Scrolled Grid widgets''' + + # FIXME: It should inherit -superclass tixScrolledWidget + def __init__(self, master=None, cnf={}, **kw): + static= [] + self.cnf= cnf + TixWidget.__init__(self, master, 'tixScrolledGrid', static, cnf, kw) diff --git a/miniconda3/envs/active_proaction/lib/python3.10/tkinter/ttk.py b/miniconda3/envs/active_proaction/lib/python3.10/tkinter/ttk.py new file mode 100644 index 0000000000000000000000000000000000000000..acdd565ec48a92cf2395ba759195f6caaf58f6b9 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/tkinter/ttk.py @@ -0,0 +1,1662 @@ +"""Ttk wrapper. + +This module provides classes to allow using Tk themed widget set. + +Ttk is based on a revised and enhanced version of +TIP #48 (http://tip.tcl.tk/48) specified style engine. + +Its basic idea is to separate, to the extent possible, the code +implementing a widget's behavior from the code implementing its +appearance. Widget class bindings are primarily responsible for +maintaining the widget state and invoking callbacks, all aspects +of the widgets appearance lies at Themes. +""" + +__version__ = "0.3.1" + +__author__ = "Guilherme Polo " + +__all__ = ["Button", "Checkbutton", "Combobox", "Entry", "Frame", "Label", + "Labelframe", "LabelFrame", "Menubutton", "Notebook", "Panedwindow", + "PanedWindow", "Progressbar", "Radiobutton", "Scale", "Scrollbar", + "Separator", "Sizegrip", "Spinbox", "Style", "Treeview", + # Extensions + "LabeledScale", "OptionMenu", + # functions + "tclobjs_to_py", "setup_master"] + +import tkinter +from tkinter import _flatten, _join, _stringify, _splitdict + +# Verify if Tk is new enough to not need the Tile package +_REQUIRE_TILE = True if tkinter.TkVersion < 8.5 else False + +def _load_tile(master): + if _REQUIRE_TILE: + import os + tilelib = os.environ.get('TILE_LIBRARY') + if tilelib: + # append custom tile path to the list of directories that + # Tcl uses when attempting to resolve packages with the package + # command + master.tk.eval( + 'global auto_path; ' + 'lappend auto_path {%s}' % tilelib) + + master.tk.eval('package require tile') # TclError may be raised here + master._tile_loaded = True + +def _format_optvalue(value, script=False): + """Internal function.""" + if script: + # if caller passes a Tcl script to tk.call, all the values need to + # be grouped into words (arguments to a command in Tcl dialect) + value = _stringify(value) + elif isinstance(value, (list, tuple)): + value = _join(value) + return value + +def _format_optdict(optdict, script=False, ignore=None): + """Formats optdict to a tuple to pass it to tk.call. + + E.g. (script=False): + {'foreground': 'blue', 'padding': [1, 2, 3, 4]} returns: + ('-foreground', 'blue', '-padding', '1 2 3 4')""" + + opts = [] + for opt, value in optdict.items(): + if not ignore or opt not in ignore: + opts.append("-%s" % opt) + if value is not None: + opts.append(_format_optvalue(value, script)) + + return _flatten(opts) + +def _mapdict_values(items): + # each value in mapdict is expected to be a sequence, where each item + # is another sequence containing a state (or several) and a value + # E.g. (script=False): + # [('active', 'selected', 'grey'), ('focus', [1, 2, 3, 4])] + # returns: + # ['active selected', 'grey', 'focus', [1, 2, 3, 4]] + opt_val = [] + for *state, val in items: + if len(state) == 1: + # if it is empty (something that evaluates to False), then + # format it to Tcl code to denote the "normal" state + state = state[0] or '' + else: + # group multiple states + state = ' '.join(state) # raise TypeError if not str + opt_val.append(state) + if val is not None: + opt_val.append(val) + return opt_val + +def _format_mapdict(mapdict, script=False): + """Formats mapdict to pass it to tk.call. + + E.g. (script=False): + {'expand': [('active', 'selected', 'grey'), ('focus', [1, 2, 3, 4])]} + + returns: + + ('-expand', '{active selected} grey focus {1, 2, 3, 4}')""" + + opts = [] + for opt, value in mapdict.items(): + opts.extend(("-%s" % opt, + _format_optvalue(_mapdict_values(value), script))) + + return _flatten(opts) + +def _format_elemcreate(etype, script=False, *args, **kw): + """Formats args and kw according to the given element factory etype.""" + spec = None + opts = () + if etype in ("image", "vsapi"): + if etype == "image": # define an element based on an image + # first arg should be the default image name + iname = args[0] + # next args, if any, are statespec/value pairs which is almost + # a mapdict, but we just need the value + imagespec = _join(_mapdict_values(args[1:])) + spec = "%s %s" % (iname, imagespec) + + else: + # define an element whose visual appearance is drawn using the + # Microsoft Visual Styles API which is responsible for the + # themed styles on Windows XP and Vista. + # Availability: Tk 8.6, Windows XP and Vista. + class_name, part_id = args[:2] + statemap = _join(_mapdict_values(args[2:])) + spec = "%s %s %s" % (class_name, part_id, statemap) + + opts = _format_optdict(kw, script) + + elif etype == "from": # clone an element + # it expects a themename and optionally an element to clone from, + # otherwise it will clone {} (empty element) + spec = args[0] # theme name + if len(args) > 1: # elementfrom specified + opts = (_format_optvalue(args[1], script),) + + if script: + spec = '{%s}' % spec + opts = ' '.join(opts) + + return spec, opts + +def _format_layoutlist(layout, indent=0, indent_size=2): + """Formats a layout list so we can pass the result to ttk::style + layout and ttk::style settings. Note that the layout doesn't have to + be a list necessarily. + + E.g.: + [("Menubutton.background", None), + ("Menubutton.button", {"children": + [("Menubutton.focus", {"children": + [("Menubutton.padding", {"children": + [("Menubutton.label", {"side": "left", "expand": 1})] + })] + })] + }), + ("Menubutton.indicator", {"side": "right"}) + ] + + returns: + + Menubutton.background + Menubutton.button -children { + Menubutton.focus -children { + Menubutton.padding -children { + Menubutton.label -side left -expand 1 + } + } + } + Menubutton.indicator -side right""" + script = [] + + for layout_elem in layout: + elem, opts = layout_elem + opts = opts or {} + fopts = ' '.join(_format_optdict(opts, True, ("children",))) + head = "%s%s%s" % (' ' * indent, elem, (" %s" % fopts) if fopts else '') + + if "children" in opts: + script.append(head + " -children {") + indent += indent_size + newscript, indent = _format_layoutlist(opts['children'], indent, + indent_size) + script.append(newscript) + indent -= indent_size + script.append('%s}' % (' ' * indent)) + else: + script.append(head) + + return '\n'.join(script), indent + +def _script_from_settings(settings): + """Returns an appropriate script, based on settings, according to + theme_settings definition to be used by theme_settings and + theme_create.""" + script = [] + # a script will be generated according to settings passed, which + # will then be evaluated by Tcl + for name, opts in settings.items(): + # will format specific keys according to Tcl code + if opts.get('configure'): # format 'configure' + s = ' '.join(_format_optdict(opts['configure'], True)) + script.append("ttk::style configure %s %s;" % (name, s)) + + if opts.get('map'): # format 'map' + s = ' '.join(_format_mapdict(opts['map'], True)) + script.append("ttk::style map %s %s;" % (name, s)) + + if 'layout' in opts: # format 'layout' which may be empty + if not opts['layout']: + s = 'null' # could be any other word, but this one makes sense + else: + s, _ = _format_layoutlist(opts['layout']) + script.append("ttk::style layout %s {\n%s\n}" % (name, s)) + + if opts.get('element create'): # format 'element create' + eopts = opts['element create'] + etype = eopts[0] + + # find where args end, and where kwargs start + argc = 1 # etype was the first one + while argc < len(eopts) and not hasattr(eopts[argc], 'items'): + argc += 1 + + elemargs = eopts[1:argc] + elemkw = eopts[argc] if argc < len(eopts) and eopts[argc] else {} + spec, opts = _format_elemcreate(etype, True, *elemargs, **elemkw) + + script.append("ttk::style element create %s %s %s %s" % ( + name, etype, spec, opts)) + + return '\n'.join(script) + +def _list_from_statespec(stuple): + """Construct a list from the given statespec tuple according to the + accepted statespec accepted by _format_mapdict.""" + if isinstance(stuple, str): + return stuple + result = [] + it = iter(stuple) + for state, val in zip(it, it): + if hasattr(state, 'typename'): # this is a Tcl object + state = str(state).split() + elif isinstance(state, str): + state = state.split() + elif not isinstance(state, (tuple, list)): + state = (state,) + if hasattr(val, 'typename'): + val = str(val) + result.append((*state, val)) + + return result + +def _list_from_layouttuple(tk, ltuple): + """Construct a list from the tuple returned by ttk::layout, this is + somewhat the reverse of _format_layoutlist.""" + ltuple = tk.splitlist(ltuple) + res = [] + + indx = 0 + while indx < len(ltuple): + name = ltuple[indx] + opts = {} + res.append((name, opts)) + indx += 1 + + while indx < len(ltuple): # grab name's options + opt, val = ltuple[indx:indx + 2] + if not opt.startswith('-'): # found next name + break + + opt = opt[1:] # remove the '-' from the option + indx += 2 + + if opt == 'children': + val = _list_from_layouttuple(tk, val) + + opts[opt] = val + + return res + +def _val_or_dict(tk, options, *args): + """Format options then call Tk command with args and options and return + the appropriate result. + + If no option is specified, a dict is returned. If an option is + specified with the None value, the value for that option is returned. + Otherwise, the function just sets the passed options and the caller + shouldn't be expecting a return value anyway.""" + options = _format_optdict(options) + res = tk.call(*(args + options)) + + if len(options) % 2: # option specified without a value, return its value + return res + + return _splitdict(tk, res, conv=_tclobj_to_py) + +def _convert_stringval(value): + """Converts a value to, hopefully, a more appropriate Python object.""" + value = str(value) + try: + value = int(value) + except (ValueError, TypeError): + pass + + return value + +def _to_number(x): + if isinstance(x, str): + if '.' in x: + x = float(x) + else: + x = int(x) + return x + +def _tclobj_to_py(val): + """Return value converted from Tcl object to Python object.""" + if val and hasattr(val, '__len__') and not isinstance(val, str): + if getattr(val[0], 'typename', None) == 'StateSpec': + val = _list_from_statespec(val) + else: + val = list(map(_convert_stringval, val)) + + elif hasattr(val, 'typename'): # some other (single) Tcl object + val = _convert_stringval(val) + + return val + +def tclobjs_to_py(adict): + """Returns adict with its values converted from Tcl objects to Python + objects.""" + for opt, val in adict.items(): + adict[opt] = _tclobj_to_py(val) + + return adict + +def setup_master(master=None): + """If master is not None, itself is returned. If master is None, + the default master is returned if there is one, otherwise a new + master is created and returned. + + If it is not allowed to use the default root and master is None, + RuntimeError is raised.""" + if master is None: + master = tkinter._get_default_root() + return master + + +class Style(object): + """Manipulate style database.""" + + _name = "ttk::style" + + def __init__(self, master=None): + master = setup_master(master) + + if not getattr(master, '_tile_loaded', False): + # Load tile now, if needed + _load_tile(master) + + self.master = master + self.tk = self.master.tk + + + def configure(self, style, query_opt=None, **kw): + """Query or sets the default value of the specified option(s) in + style. + + Each key in kw is an option and each value is either a string or + a sequence identifying the value for that option.""" + if query_opt is not None: + kw[query_opt] = None + result = _val_or_dict(self.tk, kw, self._name, "configure", style) + if result or query_opt: + return result + + + def map(self, style, query_opt=None, **kw): + """Query or sets dynamic values of the specified option(s) in + style. + + Each key in kw is an option and each value should be a list or a + tuple (usually) containing statespecs grouped in tuples, or list, + or something else of your preference. A statespec is compound of + one or more states and then a value.""" + if query_opt is not None: + result = self.tk.call(self._name, "map", style, '-%s' % query_opt) + return _list_from_statespec(self.tk.splitlist(result)) + + result = self.tk.call(self._name, "map", style, *_format_mapdict(kw)) + return {k: _list_from_statespec(self.tk.splitlist(v)) + for k, v in _splitdict(self.tk, result).items()} + + + def lookup(self, style, option, state=None, default=None): + """Returns the value specified for option in style. + + If state is specified it is expected to be a sequence of one + or more states. If the default argument is set, it is used as + a fallback value in case no specification for option is found.""" + state = ' '.join(state) if state else '' + + return self.tk.call(self._name, "lookup", style, '-%s' % option, + state, default) + + + def layout(self, style, layoutspec=None): + """Define the widget layout for given style. If layoutspec is + omitted, return the layout specification for given style. + + layoutspec is expected to be a list or an object different than + None that evaluates to False if you want to "turn off" that style. + If it is a list (or tuple, or something else), each item should be + a tuple where the first item is the layout name and the second item + should have the format described below: + + LAYOUTS + + A layout can contain the value None, if takes no options, or + a dict of options specifying how to arrange the element. + The layout mechanism uses a simplified version of the pack + geometry manager: given an initial cavity, each element is + allocated a parcel. Valid options/values are: + + side: whichside + Specifies which side of the cavity to place the + element; one of top, right, bottom or left. If + omitted, the element occupies the entire cavity. + + sticky: nswe + Specifies where the element is placed inside its + allocated parcel. + + children: [sublayout... ] + Specifies a list of elements to place inside the + element. Each element is a tuple (or other sequence) + where the first item is the layout name, and the other + is a LAYOUT.""" + lspec = None + if layoutspec: + lspec = _format_layoutlist(layoutspec)[0] + elif layoutspec is not None: # will disable the layout ({}, '', etc) + lspec = "null" # could be any other word, but this may make sense + # when calling layout(style) later + + return _list_from_layouttuple(self.tk, + self.tk.call(self._name, "layout", style, lspec)) + + + def element_create(self, elementname, etype, *args, **kw): + """Create a new element in the current theme of given etype.""" + spec, opts = _format_elemcreate(etype, False, *args, **kw) + self.tk.call(self._name, "element", "create", elementname, etype, + spec, *opts) + + + def element_names(self): + """Returns the list of elements defined in the current theme.""" + return tuple(n.lstrip('-') for n in self.tk.splitlist( + self.tk.call(self._name, "element", "names"))) + + + def element_options(self, elementname): + """Return the list of elementname's options.""" + return tuple(o.lstrip('-') for o in self.tk.splitlist( + self.tk.call(self._name, "element", "options", elementname))) + + + def theme_create(self, themename, parent=None, settings=None): + """Creates a new theme. + + It is an error if themename already exists. If parent is + specified, the new theme will inherit styles, elements and + layouts from the specified parent theme. If settings are present, + they are expected to have the same syntax used for theme_settings.""" + script = _script_from_settings(settings) if settings else '' + + if parent: + self.tk.call(self._name, "theme", "create", themename, + "-parent", parent, "-settings", script) + else: + self.tk.call(self._name, "theme", "create", themename, + "-settings", script) + + + def theme_settings(self, themename, settings): + """Temporarily sets the current theme to themename, apply specified + settings and then restore the previous theme. + + Each key in settings is a style and each value may contain the + keys 'configure', 'map', 'layout' and 'element create' and they + are expected to have the same format as specified by the methods + configure, map, layout and element_create respectively.""" + script = _script_from_settings(settings) + self.tk.call(self._name, "theme", "settings", themename, script) + + + def theme_names(self): + """Returns a list of all known themes.""" + return self.tk.splitlist(self.tk.call(self._name, "theme", "names")) + + + def theme_use(self, themename=None): + """If themename is None, returns the theme in use, otherwise, set + the current theme to themename, refreshes all widgets and emits + a <> event.""" + if themename is None: + # Starting on Tk 8.6, checking this global is no longer needed + # since it allows doing self.tk.call(self._name, "theme", "use") + return self.tk.eval("return $ttk::currentTheme") + + # using "ttk::setTheme" instead of "ttk::style theme use" causes + # the variable currentTheme to be updated, also, ttk::setTheme calls + # "ttk::style theme use" in order to change theme. + self.tk.call("ttk::setTheme", themename) + + +class Widget(tkinter.Widget): + """Base class for Tk themed widgets.""" + + def __init__(self, master, widgetname, kw=None): + """Constructs a Ttk Widget with the parent master. + + STANDARD OPTIONS + + class, cursor, takefocus, style + + SCROLLABLE WIDGET OPTIONS + + xscrollcommand, yscrollcommand + + LABEL WIDGET OPTIONS + + text, textvariable, underline, image, compound, width + + WIDGET STATES + + active, disabled, focus, pressed, selected, background, + readonly, alternate, invalid + """ + master = setup_master(master) + if not getattr(master, '_tile_loaded', False): + # Load tile now, if needed + _load_tile(master) + tkinter.Widget.__init__(self, master, widgetname, kw=kw) + + + def identify(self, x, y): + """Returns the name of the element at position x, y, or the empty + string if the point does not lie within any element. + + x and y are pixel coordinates relative to the widget.""" + return self.tk.call(self._w, "identify", x, y) + + + def instate(self, statespec, callback=None, *args, **kw): + """Test the widget's state. + + If callback is not specified, returns True if the widget state + matches statespec and False otherwise. If callback is specified, + then it will be invoked with *args, **kw if the widget state + matches statespec. statespec is expected to be a sequence.""" + ret = self.tk.getboolean( + self.tk.call(self._w, "instate", ' '.join(statespec))) + if ret and callback is not None: + return callback(*args, **kw) + + return ret + + + def state(self, statespec=None): + """Modify or inquire widget state. + + Widget state is returned if statespec is None, otherwise it is + set according to the statespec flags and then a new state spec + is returned indicating which flags were changed. statespec is + expected to be a sequence.""" + if statespec is not None: + statespec = ' '.join(statespec) + + return self.tk.splitlist(str(self.tk.call(self._w, "state", statespec))) + + +class Button(Widget): + """Ttk Button widget, displays a textual label and/or image, and + evaluates a command when pressed.""" + + def __init__(self, master=None, **kw): + """Construct a Ttk Button widget with the parent master. + + STANDARD OPTIONS + + class, compound, cursor, image, state, style, takefocus, + text, textvariable, underline, width + + WIDGET-SPECIFIC OPTIONS + + command, default, width + """ + Widget.__init__(self, master, "ttk::button", kw) + + + def invoke(self): + """Invokes the command associated with the button.""" + return self.tk.call(self._w, "invoke") + + +class Checkbutton(Widget): + """Ttk Checkbutton widget which is either in on- or off-state.""" + + def __init__(self, master=None, **kw): + """Construct a Ttk Checkbutton widget with the parent master. + + STANDARD OPTIONS + + class, compound, cursor, image, state, style, takefocus, + text, textvariable, underline, width + + WIDGET-SPECIFIC OPTIONS + + command, offvalue, onvalue, variable + """ + Widget.__init__(self, master, "ttk::checkbutton", kw) + + + def invoke(self): + """Toggles between the selected and deselected states and + invokes the associated command. If the widget is currently + selected, sets the option variable to the offvalue option + and deselects the widget; otherwise, sets the option variable + to the option onvalue. + + Returns the result of the associated command.""" + return self.tk.call(self._w, "invoke") + + +class Entry(Widget, tkinter.Entry): + """Ttk Entry widget displays a one-line text string and allows that + string to be edited by the user.""" + + def __init__(self, master=None, widget=None, **kw): + """Constructs a Ttk Entry widget with the parent master. + + STANDARD OPTIONS + + class, cursor, style, takefocus, xscrollcommand + + WIDGET-SPECIFIC OPTIONS + + exportselection, invalidcommand, justify, show, state, + textvariable, validate, validatecommand, width + + VALIDATION MODES + + none, key, focus, focusin, focusout, all + """ + Widget.__init__(self, master, widget or "ttk::entry", kw) + + + def bbox(self, index): + """Return a tuple of (x, y, width, height) which describes the + bounding box of the character given by index.""" + return self._getints(self.tk.call(self._w, "bbox", index)) + + + def identify(self, x, y): + """Returns the name of the element at position x, y, or the + empty string if the coordinates are outside the window.""" + return self.tk.call(self._w, "identify", x, y) + + + def validate(self): + """Force revalidation, independent of the conditions specified + by the validate option. Returns False if validation fails, True + if it succeeds. Sets or clears the invalid state accordingly.""" + return self.tk.getboolean(self.tk.call(self._w, "validate")) + + +class Combobox(Entry): + """Ttk Combobox widget combines a text field with a pop-down list of + values.""" + + def __init__(self, master=None, **kw): + """Construct a Ttk Combobox widget with the parent master. + + STANDARD OPTIONS + + class, cursor, style, takefocus + + WIDGET-SPECIFIC OPTIONS + + exportselection, justify, height, postcommand, state, + textvariable, values, width + """ + Entry.__init__(self, master, "ttk::combobox", **kw) + + + def current(self, newindex=None): + """If newindex is supplied, sets the combobox value to the + element at position newindex in the list of values. Otherwise, + returns the index of the current value in the list of values + or -1 if the current value does not appear in the list.""" + if newindex is None: + return self.tk.getint(self.tk.call(self._w, "current")) + return self.tk.call(self._w, "current", newindex) + + + def set(self, value): + """Sets the value of the combobox to value.""" + self.tk.call(self._w, "set", value) + + +class Frame(Widget): + """Ttk Frame widget is a container, used to group other widgets + together.""" + + def __init__(self, master=None, **kw): + """Construct a Ttk Frame with parent master. + + STANDARD OPTIONS + + class, cursor, style, takefocus + + WIDGET-SPECIFIC OPTIONS + + borderwidth, relief, padding, width, height + """ + Widget.__init__(self, master, "ttk::frame", kw) + + +class Label(Widget): + """Ttk Label widget displays a textual label and/or image.""" + + def __init__(self, master=None, **kw): + """Construct a Ttk Label with parent master. + + STANDARD OPTIONS + + class, compound, cursor, image, style, takefocus, text, + textvariable, underline, width + + WIDGET-SPECIFIC OPTIONS + + anchor, background, font, foreground, justify, padding, + relief, text, wraplength + """ + Widget.__init__(self, master, "ttk::label", kw) + + +class Labelframe(Widget): + """Ttk Labelframe widget is a container used to group other widgets + together. It has an optional label, which may be a plain text string + or another widget.""" + + def __init__(self, master=None, **kw): + """Construct a Ttk Labelframe with parent master. + + STANDARD OPTIONS + + class, cursor, style, takefocus + + WIDGET-SPECIFIC OPTIONS + labelanchor, text, underline, padding, labelwidget, width, + height + """ + Widget.__init__(self, master, "ttk::labelframe", kw) + +LabelFrame = Labelframe # tkinter name compatibility + + +class Menubutton(Widget): + """Ttk Menubutton widget displays a textual label and/or image, and + displays a menu when pressed.""" + + def __init__(self, master=None, **kw): + """Construct a Ttk Menubutton with parent master. + + STANDARD OPTIONS + + class, compound, cursor, image, state, style, takefocus, + text, textvariable, underline, width + + WIDGET-SPECIFIC OPTIONS + + direction, menu + """ + Widget.__init__(self, master, "ttk::menubutton", kw) + + +class Notebook(Widget): + """Ttk Notebook widget manages a collection of windows and displays + a single one at a time. Each child window is associated with a tab, + which the user may select to change the currently-displayed window.""" + + def __init__(self, master=None, **kw): + """Construct a Ttk Notebook with parent master. + + STANDARD OPTIONS + + class, cursor, style, takefocus + + WIDGET-SPECIFIC OPTIONS + + height, padding, width + + TAB OPTIONS + + state, sticky, padding, text, image, compound, underline + + TAB IDENTIFIERS (tab_id) + + The tab_id argument found in several methods may take any of + the following forms: + + * An integer between zero and the number of tabs + * The name of a child window + * A positional specification of the form "@x,y", which + defines the tab + * The string "current", which identifies the + currently-selected tab + * The string "end", which returns the number of tabs (only + valid for method index) + """ + Widget.__init__(self, master, "ttk::notebook", kw) + + + def add(self, child, **kw): + """Adds a new tab to the notebook. + + If window is currently managed by the notebook but hidden, it is + restored to its previous position.""" + self.tk.call(self._w, "add", child, *(_format_optdict(kw))) + + + def forget(self, tab_id): + """Removes the tab specified by tab_id, unmaps and unmanages the + associated window.""" + self.tk.call(self._w, "forget", tab_id) + + + def hide(self, tab_id): + """Hides the tab specified by tab_id. + + The tab will not be displayed, but the associated window remains + managed by the notebook and its configuration remembered. Hidden + tabs may be restored with the add command.""" + self.tk.call(self._w, "hide", tab_id) + + + def identify(self, x, y): + """Returns the name of the tab element at position x, y, or the + empty string if none.""" + return self.tk.call(self._w, "identify", x, y) + + + def index(self, tab_id): + """Returns the numeric index of the tab specified by tab_id, or + the total number of tabs if tab_id is the string "end".""" + return self.tk.getint(self.tk.call(self._w, "index", tab_id)) + + + def insert(self, pos, child, **kw): + """Inserts a pane at the specified position. + + pos is either the string end, an integer index, or the name of + a managed child. If child is already managed by the notebook, + moves it to the specified position.""" + self.tk.call(self._w, "insert", pos, child, *(_format_optdict(kw))) + + + def select(self, tab_id=None): + """Selects the specified tab. + + The associated child window will be displayed, and the + previously-selected window (if different) is unmapped. If tab_id + is omitted, returns the widget name of the currently selected + pane.""" + return self.tk.call(self._w, "select", tab_id) + + + def tab(self, tab_id, option=None, **kw): + """Query or modify the options of the specific tab_id. + + If kw is not given, returns a dict of the tab option values. If option + is specified, returns the value of that option. Otherwise, sets the + options to the corresponding values.""" + if option is not None: + kw[option] = None + return _val_or_dict(self.tk, kw, self._w, "tab", tab_id) + + + def tabs(self): + """Returns a list of windows managed by the notebook.""" + return self.tk.splitlist(self.tk.call(self._w, "tabs") or ()) + + + def enable_traversal(self): + """Enable keyboard traversal for a toplevel window containing + this notebook. + + This will extend the bindings for the toplevel window containing + this notebook as follows: + + Control-Tab: selects the tab following the currently selected + one + + Shift-Control-Tab: selects the tab preceding the currently + selected one + + Alt-K: where K is the mnemonic (underlined) character of any + tab, will select that tab. + + Multiple notebooks in a single toplevel may be enabled for + traversal, including nested notebooks. However, notebook traversal + only works properly if all panes are direct children of the + notebook.""" + # The only, and good, difference I see is about mnemonics, which works + # after calling this method. Control-Tab and Shift-Control-Tab always + # works (here at least). + self.tk.call("ttk::notebook::enableTraversal", self._w) + + +class Panedwindow(Widget, tkinter.PanedWindow): + """Ttk Panedwindow widget displays a number of subwindows, stacked + either vertically or horizontally.""" + + def __init__(self, master=None, **kw): + """Construct a Ttk Panedwindow with parent master. + + STANDARD OPTIONS + + class, cursor, style, takefocus + + WIDGET-SPECIFIC OPTIONS + + orient, width, height + + PANE OPTIONS + + weight + """ + Widget.__init__(self, master, "ttk::panedwindow", kw) + + + forget = tkinter.PanedWindow.forget # overrides Pack.forget + + + def insert(self, pos, child, **kw): + """Inserts a pane at the specified positions. + + pos is either the string end, and integer index, or the name + of a child. If child is already managed by the paned window, + moves it to the specified position.""" + self.tk.call(self._w, "insert", pos, child, *(_format_optdict(kw))) + + + def pane(self, pane, option=None, **kw): + """Query or modify the options of the specified pane. + + pane is either an integer index or the name of a managed subwindow. + If kw is not given, returns a dict of the pane option values. If + option is specified then the value for that option is returned. + Otherwise, sets the options to the corresponding values.""" + if option is not None: + kw[option] = None + return _val_or_dict(self.tk, kw, self._w, "pane", pane) + + + def sashpos(self, index, newpos=None): + """If newpos is specified, sets the position of sash number index. + + May adjust the positions of adjacent sashes to ensure that + positions are monotonically increasing. Sash positions are further + constrained to be between 0 and the total size of the widget. + + Returns the new position of sash number index.""" + return self.tk.getint(self.tk.call(self._w, "sashpos", index, newpos)) + +PanedWindow = Panedwindow # tkinter name compatibility + + +class Progressbar(Widget): + """Ttk Progressbar widget shows the status of a long-running + operation. They can operate in two modes: determinate mode shows the + amount completed relative to the total amount of work to be done, and + indeterminate mode provides an animated display to let the user know + that something is happening.""" + + def __init__(self, master=None, **kw): + """Construct a Ttk Progressbar with parent master. + + STANDARD OPTIONS + + class, cursor, style, takefocus + + WIDGET-SPECIFIC OPTIONS + + orient, length, mode, maximum, value, variable, phase + """ + Widget.__init__(self, master, "ttk::progressbar", kw) + + + def start(self, interval=None): + """Begin autoincrement mode: schedules a recurring timer event + that calls method step every interval milliseconds. + + interval defaults to 50 milliseconds (20 steps/second) if omitted.""" + self.tk.call(self._w, "start", interval) + + + def step(self, amount=None): + """Increments the value option by amount. + + amount defaults to 1.0 if omitted.""" + self.tk.call(self._w, "step", amount) + + + def stop(self): + """Stop autoincrement mode: cancels any recurring timer event + initiated by start.""" + self.tk.call(self._w, "stop") + + +class Radiobutton(Widget): + """Ttk Radiobutton widgets are used in groups to show or change a + set of mutually-exclusive options.""" + + def __init__(self, master=None, **kw): + """Construct a Ttk Radiobutton with parent master. + + STANDARD OPTIONS + + class, compound, cursor, image, state, style, takefocus, + text, textvariable, underline, width + + WIDGET-SPECIFIC OPTIONS + + command, value, variable + """ + Widget.__init__(self, master, "ttk::radiobutton", kw) + + + def invoke(self): + """Sets the option variable to the option value, selects the + widget, and invokes the associated command. + + Returns the result of the command, or an empty string if + no command is specified.""" + return self.tk.call(self._w, "invoke") + + +class Scale(Widget, tkinter.Scale): + """Ttk Scale widget is typically used to control the numeric value of + a linked variable that varies uniformly over some range.""" + + def __init__(self, master=None, **kw): + """Construct a Ttk Scale with parent master. + + STANDARD OPTIONS + + class, cursor, style, takefocus + + WIDGET-SPECIFIC OPTIONS + + command, from, length, orient, to, value, variable + """ + Widget.__init__(self, master, "ttk::scale", kw) + + + def configure(self, cnf=None, **kw): + """Modify or query scale options. + + Setting a value for any of the "from", "from_" or "to" options + generates a <> event.""" + retval = Widget.configure(self, cnf, **kw) + if not isinstance(cnf, (type(None), str)): + kw.update(cnf) + if any(['from' in kw, 'from_' in kw, 'to' in kw]): + self.event_generate('<>') + return retval + + + def get(self, x=None, y=None): + """Get the current value of the value option, or the value + corresponding to the coordinates x, y if they are specified. + + x and y are pixel coordinates relative to the scale widget + origin.""" + return self.tk.call(self._w, 'get', x, y) + + +class Scrollbar(Widget, tkinter.Scrollbar): + """Ttk Scrollbar controls the viewport of a scrollable widget.""" + + def __init__(self, master=None, **kw): + """Construct a Ttk Scrollbar with parent master. + + STANDARD OPTIONS + + class, cursor, style, takefocus + + WIDGET-SPECIFIC OPTIONS + + command, orient + """ + Widget.__init__(self, master, "ttk::scrollbar", kw) + + +class Separator(Widget): + """Ttk Separator widget displays a horizontal or vertical separator + bar.""" + + def __init__(self, master=None, **kw): + """Construct a Ttk Separator with parent master. + + STANDARD OPTIONS + + class, cursor, style, takefocus + + WIDGET-SPECIFIC OPTIONS + + orient + """ + Widget.__init__(self, master, "ttk::separator", kw) + + +class Sizegrip(Widget): + """Ttk Sizegrip allows the user to resize the containing toplevel + window by pressing and dragging the grip.""" + + def __init__(self, master=None, **kw): + """Construct a Ttk Sizegrip with parent master. + + STANDARD OPTIONS + + class, cursor, state, style, takefocus + """ + Widget.__init__(self, master, "ttk::sizegrip", kw) + + +class Spinbox(Entry): + """Ttk Spinbox is an Entry with increment and decrement arrows + + It is commonly used for number entry or to select from a list of + string values. + """ + + def __init__(self, master=None, **kw): + """Construct a Ttk Spinbox widget with the parent master. + + STANDARD OPTIONS + + class, cursor, style, takefocus, validate, + validatecommand, xscrollcommand, invalidcommand + + WIDGET-SPECIFIC OPTIONS + + to, from_, increment, values, wrap, format, command + """ + Entry.__init__(self, master, "ttk::spinbox", **kw) + + + def set(self, value): + """Sets the value of the Spinbox to value.""" + self.tk.call(self._w, "set", value) + + +class Treeview(Widget, tkinter.XView, tkinter.YView): + """Ttk Treeview widget displays a hierarchical collection of items. + + Each item has a textual label, an optional image, and an optional list + of data values. The data values are displayed in successive columns + after the tree label.""" + + def __init__(self, master=None, **kw): + """Construct a Ttk Treeview with parent master. + + STANDARD OPTIONS + + class, cursor, style, takefocus, xscrollcommand, + yscrollcommand + + WIDGET-SPECIFIC OPTIONS + + columns, displaycolumns, height, padding, selectmode, show + + ITEM OPTIONS + + text, image, values, open, tags + + TAG OPTIONS + + foreground, background, font, image + """ + Widget.__init__(self, master, "ttk::treeview", kw) + + + def bbox(self, item, column=None): + """Returns the bounding box (relative to the treeview widget's + window) of the specified item in the form x y width height. + + If column is specified, returns the bounding box of that cell. + If the item is not visible (i.e., if it is a descendant of a + closed item or is scrolled offscreen), returns an empty string.""" + return self._getints(self.tk.call(self._w, "bbox", item, column)) or '' + + + def get_children(self, item=None): + """Returns a tuple of children belonging to item. + + If item is not specified, returns root children.""" + return self.tk.splitlist( + self.tk.call(self._w, "children", item or '') or ()) + + + def set_children(self, item, *newchildren): + """Replaces item's child with newchildren. + + Children present in item that are not present in newchildren + are detached from tree. No items in newchildren may be an + ancestor of item.""" + self.tk.call(self._w, "children", item, newchildren) + + + def column(self, column, option=None, **kw): + """Query or modify the options for the specified column. + + If kw is not given, returns a dict of the column option values. If + option is specified then the value for that option is returned. + Otherwise, sets the options to the corresponding values.""" + if option is not None: + kw[option] = None + return _val_or_dict(self.tk, kw, self._w, "column", column) + + + def delete(self, *items): + """Delete all specified items and all their descendants. The root + item may not be deleted.""" + self.tk.call(self._w, "delete", items) + + + def detach(self, *items): + """Unlinks all of the specified items from the tree. + + The items and all of their descendants are still present, and may + be reinserted at another point in the tree, but will not be + displayed. The root item may not be detached.""" + self.tk.call(self._w, "detach", items) + + + def exists(self, item): + """Returns True if the specified item is present in the tree, + False otherwise.""" + return self.tk.getboolean(self.tk.call(self._w, "exists", item)) + + + def focus(self, item=None): + """If item is specified, sets the focus item to item. Otherwise, + returns the current focus item, or '' if there is none.""" + return self.tk.call(self._w, "focus", item) + + + def heading(self, column, option=None, **kw): + """Query or modify the heading options for the specified column. + + If kw is not given, returns a dict of the heading option values. If + option is specified then the value for that option is returned. + Otherwise, sets the options to the corresponding values. + + Valid options/values are: + text: text + The text to display in the column heading + image: image_name + Specifies an image to display to the right of the column + heading + anchor: anchor + Specifies how the heading text should be aligned. One of + the standard Tk anchor values + command: callback + A callback to be invoked when the heading label is + pressed. + + To configure the tree column heading, call this with column = "#0" """ + cmd = kw.get('command') + if cmd and not isinstance(cmd, str): + # callback not registered yet, do it now + kw['command'] = self.master.register(cmd, self._substitute) + + if option is not None: + kw[option] = None + + return _val_or_dict(self.tk, kw, self._w, 'heading', column) + + + def identify(self, component, x, y): + """Returns a description of the specified component under the + point given by x and y, or the empty string if no such component + is present at that position.""" + return self.tk.call(self._w, "identify", component, x, y) + + + def identify_row(self, y): + """Returns the item ID of the item at position y.""" + return self.identify("row", 0, y) + + + def identify_column(self, x): + """Returns the data column identifier of the cell at position x. + + The tree column has ID #0.""" + return self.identify("column", x, 0) + + + def identify_region(self, x, y): + """Returns one of: + + heading: Tree heading area. + separator: Space between two columns headings; + tree: The tree area. + cell: A data cell. + + * Availability: Tk 8.6""" + return self.identify("region", x, y) + + + def identify_element(self, x, y): + """Returns the element at position x, y. + + * Availability: Tk 8.6""" + return self.identify("element", x, y) + + + def index(self, item): + """Returns the integer index of item within its parent's list + of children.""" + return self.tk.getint(self.tk.call(self._w, "index", item)) + + + def insert(self, parent, index, iid=None, **kw): + """Creates a new item and return the item identifier of the newly + created item. + + parent is the item ID of the parent item, or the empty string + to create a new top-level item. index is an integer, or the value + end, specifying where in the list of parent's children to insert + the new item. If index is less than or equal to zero, the new node + is inserted at the beginning, if index is greater than or equal to + the current number of children, it is inserted at the end. If iid + is specified, it is used as the item identifier, iid must not + already exist in the tree. Otherwise, a new unique identifier + is generated.""" + opts = _format_optdict(kw) + if iid is not None: + res = self.tk.call(self._w, "insert", parent, index, + "-id", iid, *opts) + else: + res = self.tk.call(self._w, "insert", parent, index, *opts) + + return res + + + def item(self, item, option=None, **kw): + """Query or modify the options for the specified item. + + If no options are given, a dict with options/values for the item + is returned. If option is specified then the value for that option + is returned. Otherwise, sets the options to the corresponding + values as given by kw.""" + if option is not None: + kw[option] = None + return _val_or_dict(self.tk, kw, self._w, "item", item) + + + def move(self, item, parent, index): + """Moves item to position index in parent's list of children. + + It is illegal to move an item under one of its descendants. If + index is less than or equal to zero, item is moved to the + beginning, if greater than or equal to the number of children, + it is moved to the end. If item was detached it is reattached.""" + self.tk.call(self._w, "move", item, parent, index) + + reattach = move # A sensible method name for reattaching detached items + + + def next(self, item): + """Returns the identifier of item's next sibling, or '' if item + is the last child of its parent.""" + return self.tk.call(self._w, "next", item) + + + def parent(self, item): + """Returns the ID of the parent of item, or '' if item is at the + top level of the hierarchy.""" + return self.tk.call(self._w, "parent", item) + + + def prev(self, item): + """Returns the identifier of item's previous sibling, or '' if + item is the first child of its parent.""" + return self.tk.call(self._w, "prev", item) + + + def see(self, item): + """Ensure that item is visible. + + Sets all of item's ancestors open option to True, and scrolls + the widget if necessary so that item is within the visible + portion of the tree.""" + self.tk.call(self._w, "see", item) + + + def selection(self): + """Returns the tuple of selected items.""" + return self.tk.splitlist(self.tk.call(self._w, "selection")) + + + def _selection(self, selop, items): + if len(items) == 1 and isinstance(items[0], (tuple, list)): + items = items[0] + + self.tk.call(self._w, "selection", selop, items) + + + def selection_set(self, *items): + """The specified items becomes the new selection.""" + self._selection("set", items) + + + def selection_add(self, *items): + """Add all of the specified items to the selection.""" + self._selection("add", items) + + + def selection_remove(self, *items): + """Remove all of the specified items from the selection.""" + self._selection("remove", items) + + + def selection_toggle(self, *items): + """Toggle the selection state of each specified item.""" + self._selection("toggle", items) + + + def set(self, item, column=None, value=None): + """Query or set the value of given item. + + With one argument, return a dictionary of column/value pairs + for the specified item. With two arguments, return the current + value of the specified column. With three arguments, set the + value of given column in given item to the specified value.""" + res = self.tk.call(self._w, "set", item, column, value) + if column is None and value is None: + return _splitdict(self.tk, res, + cut_minus=False, conv=_tclobj_to_py) + else: + return res + + + def tag_bind(self, tagname, sequence=None, callback=None): + """Bind a callback for the given event sequence to the tag tagname. + When an event is delivered to an item, the callbacks for each + of the item's tags option are called.""" + self._bind((self._w, "tag", "bind", tagname), sequence, callback, add=0) + + + def tag_configure(self, tagname, option=None, **kw): + """Query or modify the options for the specified tagname. + + If kw is not given, returns a dict of the option settings for tagname. + If option is specified, returns the value for that option for the + specified tagname. Otherwise, sets the options to the corresponding + values for the given tagname.""" + if option is not None: + kw[option] = None + return _val_or_dict(self.tk, kw, self._w, "tag", "configure", + tagname) + + + def tag_has(self, tagname, item=None): + """If item is specified, returns 1 or 0 depending on whether the + specified item has the given tagname. Otherwise, returns a list of + all items which have the specified tag. + + * Availability: Tk 8.6""" + if item is None: + return self.tk.splitlist( + self.tk.call(self._w, "tag", "has", tagname)) + else: + return self.tk.getboolean( + self.tk.call(self._w, "tag", "has", tagname, item)) + + +# Extensions + +class LabeledScale(Frame): + """A Ttk Scale widget with a Ttk Label widget indicating its + current value. + + The Ttk Scale can be accessed through instance.scale, and Ttk Label + can be accessed through instance.label""" + + def __init__(self, master=None, variable=None, from_=0, to=10, **kw): + """Construct a horizontal LabeledScale with parent master, a + variable to be associated with the Ttk Scale widget and its range. + If variable is not specified, a tkinter.IntVar is created. + + WIDGET-SPECIFIC OPTIONS + + compound: 'top' or 'bottom' + Specifies how to display the label relative to the scale. + Defaults to 'top'. + """ + self._label_top = kw.pop('compound', 'top') == 'top' + + Frame.__init__(self, master, **kw) + self._variable = variable or tkinter.IntVar(master) + self._variable.set(from_) + self._last_valid = from_ + + self.label = Label(self) + self.scale = Scale(self, variable=self._variable, from_=from_, to=to) + self.scale.bind('<>', self._adjust) + + # position scale and label according to the compound option + scale_side = 'bottom' if self._label_top else 'top' + label_side = 'top' if scale_side == 'bottom' else 'bottom' + self.scale.pack(side=scale_side, fill='x') + # Dummy required to make frame correct height + dummy = Label(self) + dummy.pack(side=label_side) + dummy.lower() + self.label.place(anchor='n' if label_side == 'top' else 's') + + # update the label as scale or variable changes + self.__tracecb = self._variable.trace_variable('w', self._adjust) + self.bind('', self._adjust) + self.bind('', self._adjust) + + + def destroy(self): + """Destroy this widget and possibly its associated variable.""" + try: + self._variable.trace_vdelete('w', self.__tracecb) + except AttributeError: + pass + else: + del self._variable + super().destroy() + self.label = None + self.scale = None + + + def _adjust(self, *args): + """Adjust the label position according to the scale.""" + def adjust_label(): + self.update_idletasks() # "force" scale redraw + + x, y = self.scale.coords() + if self._label_top: + y = self.scale.winfo_y() - self.label.winfo_reqheight() + else: + y = self.scale.winfo_reqheight() + self.label.winfo_reqheight() + + self.label.place_configure(x=x, y=y) + + from_ = _to_number(self.scale['from']) + to = _to_number(self.scale['to']) + if to < from_: + from_, to = to, from_ + newval = self._variable.get() + if not from_ <= newval <= to: + # value outside range, set value back to the last valid one + self.value = self._last_valid + return + + self._last_valid = newval + self.label['text'] = newval + self.after_idle(adjust_label) + + @property + def value(self): + """Return current scale value.""" + return self._variable.get() + + @value.setter + def value(self, val): + """Set new scale value.""" + self._variable.set(val) + + +class OptionMenu(Menubutton): + """Themed OptionMenu, based after tkinter's OptionMenu, which allows + the user to select a value from a menu.""" + + def __init__(self, master, variable, default=None, *values, **kwargs): + """Construct a themed OptionMenu widget with master as the parent, + the resource textvariable set to variable, the initially selected + value specified by the default parameter, the menu values given by + *values and additional keywords. + + WIDGET-SPECIFIC OPTIONS + + style: stylename + Menubutton style. + direction: 'above', 'below', 'left', 'right', or 'flush' + Menubutton direction. + command: callback + A callback that will be invoked after selecting an item. + """ + kw = {'textvariable': variable, 'style': kwargs.pop('style', None), + 'direction': kwargs.pop('direction', None)} + Menubutton.__init__(self, master, **kw) + self['menu'] = tkinter.Menu(self, tearoff=False) + + self._variable = variable + self._callback = kwargs.pop('command', None) + if kwargs: + raise tkinter.TclError('unknown option -%s' % ( + next(iter(kwargs.keys())))) + + self.set_menu(default, *values) + + + def __getitem__(self, item): + if item == 'menu': + return self.nametowidget(Menubutton.__getitem__(self, item)) + + return Menubutton.__getitem__(self, item) + + + def set_menu(self, default=None, *values): + """Build a new menu of radiobuttons with *values and optionally + a default value.""" + menu = self['menu'] + menu.delete(0, 'end') + for val in values: + menu.add_radiobutton(label=val, + command=( + None if self._callback is None + else lambda val=val: self._callback(val) + ), + variable=self._variable) + + if default: + self._variable.set(default) + + + def destroy(self): + """Destroy this widget and its associated variable.""" + try: + del self._variable + except AttributeError: + pass + super().destroy() diff --git a/miniconda3/envs/active_proaction/lib/python3.10/turtledemo/__init__.py b/miniconda3/envs/active_proaction/lib/python3.10/turtledemo/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..77150e25331cc4b31d3fd64c9ed079dc880e8356 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/turtledemo/__init__.py @@ -0,0 +1,14 @@ +""" + -------------------------------------- + About this viewer + -------------------------------------- + + Tiny demo viewer to view turtle graphics example scripts. + + Quickly and dirtyly assembled by Gregor Lingl. + June, 2006 + + For more information see: turtledemo - Help + + Have fun! +""" diff --git a/miniconda3/envs/active_proaction/lib/python3.10/turtledemo/__main__.py b/miniconda3/envs/active_proaction/lib/python3.10/turtledemo/__main__.py new file mode 100644 index 0000000000000000000000000000000000000000..caea022da4a68807838e9ca171b58d57856a181a --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/turtledemo/__main__.py @@ -0,0 +1,398 @@ +#!/usr/bin/env python3 + +""" + ---------------------------------------------- + turtleDemo - Help + ---------------------------------------------- + + This document has two sections: + + (1) How to use the demo viewer + (2) How to add your own demos to the demo repository + + + (1) How to use the demo viewer. + + Select a demoscript from the example menu. + The (syntax colored) source code appears in the left + source code window. IT CANNOT BE EDITED, but ONLY VIEWED! + + The demo viewer windows can be resized. The divider between text + and canvas can be moved by grabbing it with the mouse. The text font + size can be changed from the menu and with Control/Command '-'/'+'. + It can also be changed on most systems with Control-mousewheel + when the mouse is over the text. + + Press START button to start the demo. + Stop execution by pressing the STOP button. + Clear screen by pressing the CLEAR button. + Restart by pressing the START button again. + + SPECIAL demos, such as clock.py are those which run EVENTDRIVEN. + + Press START button to start the demo. + + - Until the EVENTLOOP is entered everything works + as in an ordinary demo script. + + - When the EVENTLOOP is entered, you control the + application by using the mouse and/or keys (or it's + controlled by some timer events) + To stop it you can and must press the STOP button. + + While the EVENTLOOP is running, the examples menu is disabled. + + - Only after having pressed the STOP button, you may + restart it or choose another example script. + + * * * * * * * * + In some rare situations there may occur interferences/conflicts + between events concerning the demo script and those concerning the + demo-viewer. (They run in the same process.) Strange behaviour may be + the consequence and in the worst case you must close and restart the + viewer. + * * * * * * * * + + + (2) How to add your own demos to the demo repository + + - Place the file in the same directory as turtledemo/__main__.py + IMPORTANT! When imported, the demo should not modify the system + by calling functions in other modules, such as sys, tkinter, or + turtle. Global variables should be initialized in main(). + + - The code must contain a main() function which will + be executed by the viewer (see provided example scripts). + It may return a string which will be displayed in the Label below + the source code window (when execution has finished.) + + - In order to run mydemo.py by itself, such as during development, + add the following at the end of the file: + + if __name__ == '__main__': + main() + mainloop() # keep window open + + python -m turtledemo.mydemo # will then run it + + - If the demo is EVENT DRIVEN, main must return the string + "EVENTLOOP". This informs the demo viewer that the script is + still running and must be stopped by the user! + + If an "EVENTLOOP" demo runs by itself, as with clock, which uses + ontimer, or minimal_hanoi, which loops by recursion, then the + code should catch the turtle.Terminator exception that will be + raised when the user presses the STOP button. (Paint is not such + a demo; it only acts in response to mouse clicks and movements.) +""" +import sys +import os + +from tkinter import * +from idlelib.colorizer import ColorDelegator, color_config +from idlelib.percolator import Percolator +from idlelib.textview import view_text +from turtledemo import __doc__ as about_turtledemo + +import turtle + +demo_dir = os.path.dirname(os.path.abspath(__file__)) +darwin = sys.platform == 'darwin' + +STARTUP = 1 +READY = 2 +RUNNING = 3 +DONE = 4 +EVENTDRIVEN = 5 + +menufont = ("Arial", 12, NORMAL) +btnfont = ("Arial", 12, 'bold') +txtfont = ['Lucida Console', 10, 'normal'] + +MINIMUM_FONT_SIZE = 6 +MAXIMUM_FONT_SIZE = 100 +font_sizes = [8, 9, 10, 11, 12, 14, 18, 20, 22, 24, 30] + +def getExampleEntries(): + return [entry[:-3] for entry in os.listdir(demo_dir) if + entry.endswith(".py") and entry[0] != '_'] + +help_entries = ( # (help_label, help_doc) + ('Turtledemo help', __doc__), + ('About turtledemo', about_turtledemo), + ('About turtle module', turtle.__doc__), + ) + + +class DemoWindow(object): + + def __init__(self, filename=None): + self.root = root = turtle._root = Tk() + root.title('Python turtle-graphics examples') + root.wm_protocol("WM_DELETE_WINDOW", self._destroy) + + if darwin: + import subprocess + # Make sure we are the currently activated OS X application + # so that our menu bar appears. + subprocess.run( + [ + 'osascript', + '-e', 'tell application "System Events"', + '-e', 'set frontmost of the first process whose ' + 'unix id is {} to true'.format(os.getpid()), + '-e', 'end tell', + ], + stderr=subprocess.DEVNULL, + stdout=subprocess.DEVNULL,) + + root.grid_rowconfigure(0, weight=1) + root.grid_columnconfigure(0, weight=1) + root.grid_columnconfigure(1, minsize=90, weight=1) + root.grid_columnconfigure(2, minsize=90, weight=1) + root.grid_columnconfigure(3, minsize=90, weight=1) + + self.mBar = Menu(root, relief=RAISED, borderwidth=2) + self.mBar.add_cascade(menu=self.makeLoadDemoMenu(self.mBar), + label='Examples', underline=0) + self.mBar.add_cascade(menu=self.makeFontMenu(self.mBar), + label='Fontsize', underline=0) + self.mBar.add_cascade(menu=self.makeHelpMenu(self.mBar), + label='Help', underline=0) + root['menu'] = self.mBar + + pane = PanedWindow(orient=HORIZONTAL, sashwidth=5, + sashrelief=SOLID, bg='#ddd') + pane.add(self.makeTextFrame(pane)) + pane.add(self.makeGraphFrame(pane)) + pane.grid(row=0, columnspan=4, sticky='news') + + self.output_lbl = Label(root, height= 1, text=" --- ", bg="#ddf", + font=("Arial", 16, 'normal'), borderwidth=2, + relief=RIDGE) + if darwin: # Leave Mac button colors alone - #44254. + self.start_btn = Button(root, text=" START ", font=btnfont, + fg='#00cc22', command=self.startDemo) + self.stop_btn = Button(root, text=" STOP ", font=btnfont, + fg='#00cc22', command=self.stopIt) + self.clear_btn = Button(root, text=" CLEAR ", font=btnfont, + fg='#00cc22', command = self.clearCanvas) + else: + self.start_btn = Button(root, text=" START ", font=btnfont, + fg="white", disabledforeground = "#fed", + command=self.startDemo) + self.stop_btn = Button(root, text=" STOP ", font=btnfont, + fg="white", disabledforeground = "#fed", + command=self.stopIt) + self.clear_btn = Button(root, text=" CLEAR ", font=btnfont, + fg="white", disabledforeground="#fed", + command = self.clearCanvas) + self.output_lbl.grid(row=1, column=0, sticky='news', padx=(0,5)) + self.start_btn.grid(row=1, column=1, sticky='ew') + self.stop_btn.grid(row=1, column=2, sticky='ew') + self.clear_btn.grid(row=1, column=3, sticky='ew') + + Percolator(self.text).insertfilter(ColorDelegator()) + self.dirty = False + self.exitflag = False + if filename: + self.loadfile(filename) + self.configGUI(DISABLED, DISABLED, DISABLED, + "Choose example from menu", "black") + self.state = STARTUP + + + def onResize(self, event): + cwidth = self._canvas.winfo_width() + cheight = self._canvas.winfo_height() + self._canvas.xview_moveto(0.5*(self.canvwidth-cwidth)/self.canvwidth) + self._canvas.yview_moveto(0.5*(self.canvheight-cheight)/self.canvheight) + + def makeTextFrame(self, root): + self.text_frame = text_frame = Frame(root) + self.text = text = Text(text_frame, name='text', padx=5, + wrap='none', width=45) + color_config(text) + + self.vbar = vbar = Scrollbar(text_frame, name='vbar') + vbar['command'] = text.yview + vbar.pack(side=LEFT, fill=Y) + self.hbar = hbar = Scrollbar(text_frame, name='hbar', orient=HORIZONTAL) + hbar['command'] = text.xview + hbar.pack(side=BOTTOM, fill=X) + text['yscrollcommand'] = vbar.set + text['xscrollcommand'] = hbar.set + + text['font'] = tuple(txtfont) + shortcut = 'Command' if darwin else 'Control' + text.bind_all('<%s-minus>' % shortcut, self.decrease_size) + text.bind_all('<%s-underscore>' % shortcut, self.decrease_size) + text.bind_all('<%s-equal>' % shortcut, self.increase_size) + text.bind_all('<%s-plus>' % shortcut, self.increase_size) + text.bind('', self.update_mousewheel) + text.bind('', self.increase_size) + text.bind('', self.decrease_size) + + text.pack(side=LEFT, fill=BOTH, expand=1) + return text_frame + + def makeGraphFrame(self, root): + turtle._Screen._root = root + self.canvwidth = 1000 + self.canvheight = 800 + turtle._Screen._canvas = self._canvas = canvas = turtle.ScrolledCanvas( + root, 800, 600, self.canvwidth, self.canvheight) + canvas.adjustScrolls() + canvas._rootwindow.bind('', self.onResize) + canvas._canvas['borderwidth'] = 0 + + self.screen = _s_ = turtle.Screen() + turtle.TurtleScreen.__init__(_s_, _s_._canvas) + self.scanvas = _s_._canvas + turtle.RawTurtle.screens = [_s_] + return canvas + + def set_txtsize(self, size): + txtfont[1] = size + self.text['font'] = tuple(txtfont) + self.output_lbl['text'] = 'Font size %d' % size + + def decrease_size(self, dummy=None): + self.set_txtsize(max(txtfont[1] - 1, MINIMUM_FONT_SIZE)) + return 'break' + + def increase_size(self, dummy=None): + self.set_txtsize(min(txtfont[1] + 1, MAXIMUM_FONT_SIZE)) + return 'break' + + def update_mousewheel(self, event): + # For wheel up, event.delta = 120 on Windows, -1 on darwin. + # X-11 sends Control-Button-4 event instead. + if (event.delta < 0) == (not darwin): + return self.decrease_size() + else: + return self.increase_size() + + def configGUI(self, start, stop, clear, txt="", color="blue"): + if darwin: # Leave Mac button colors alone - #44254. + self.start_btn.config(state=start) + self.stop_btn.config(state=stop) + self.clear_btn.config(state=clear) + else: + self.start_btn.config(state=start, + bg="#d00" if start == NORMAL else "#fca") + self.stop_btn.config(state=stop, + bg="#d00" if stop == NORMAL else "#fca") + self.clear_btn.config(state=clear, + bg="#d00" if clear == NORMAL else "#fca") + self.output_lbl.config(text=txt, fg=color) + + def makeLoadDemoMenu(self, master): + menu = Menu(master) + + for entry in getExampleEntries(): + def load(entry=entry): + self.loadfile(entry) + menu.add_command(label=entry, underline=0, + font=menufont, command=load) + return menu + + def makeFontMenu(self, master): + menu = Menu(master) + menu.add_command(label="Decrease (C-'-')", command=self.decrease_size, + font=menufont) + menu.add_command(label="Increase (C-'+')", command=self.increase_size, + font=menufont) + menu.add_separator() + + for size in font_sizes: + def resize(size=size): + self.set_txtsize(size) + menu.add_command(label=str(size), underline=0, + font=menufont, command=resize) + return menu + + def makeHelpMenu(self, master): + menu = Menu(master) + + for help_label, help_file in help_entries: + def show(help_label=help_label, help_file=help_file): + view_text(self.root, help_label, help_file) + menu.add_command(label=help_label, font=menufont, command=show) + return menu + + def refreshCanvas(self): + if self.dirty: + self.screen.clear() + self.dirty=False + + def loadfile(self, filename): + self.clearCanvas() + turtle.TurtleScreen._RUNNING = False + modname = 'turtledemo.' + filename + __import__(modname) + self.module = sys.modules[modname] + with open(self.module.__file__, 'r') as f: + chars = f.read() + self.text.delete("1.0", "end") + self.text.insert("1.0", chars) + self.root.title(filename + " - a Python turtle graphics example") + self.configGUI(NORMAL, DISABLED, DISABLED, + "Press start button", "red") + self.state = READY + + def startDemo(self): + self.refreshCanvas() + self.dirty = True + turtle.TurtleScreen._RUNNING = True + self.configGUI(DISABLED, NORMAL, DISABLED, + "demo running...", "black") + self.screen.clear() + self.screen.mode("standard") + self.state = RUNNING + + try: + result = self.module.main() + if result == "EVENTLOOP": + self.state = EVENTDRIVEN + else: + self.state = DONE + except turtle.Terminator: + if self.root is None: + return + self.state = DONE + result = "stopped!" + if self.state == DONE: + self.configGUI(NORMAL, DISABLED, NORMAL, + result) + elif self.state == EVENTDRIVEN: + self.exitflag = True + self.configGUI(DISABLED, NORMAL, DISABLED, + "use mouse/keys or STOP", "red") + + def clearCanvas(self): + self.refreshCanvas() + self.screen._delete("all") + self.scanvas.config(cursor="") + self.configGUI(NORMAL, DISABLED, DISABLED) + + def stopIt(self): + if self.exitflag: + self.clearCanvas() + self.exitflag = False + self.configGUI(NORMAL, DISABLED, DISABLED, + "STOPPED!", "red") + turtle.TurtleScreen._RUNNING = False + + def _destroy(self): + turtle.TurtleScreen._RUNNING = False + self.root.destroy() + self.root = None + + +def main(): + demo = DemoWindow() + demo.root.mainloop() + +if __name__ == '__main__': + main() diff --git a/miniconda3/envs/active_proaction/lib/python3.10/turtledemo/bytedesign.py b/miniconda3/envs/active_proaction/lib/python3.10/turtledemo/bytedesign.py new file mode 100644 index 0000000000000000000000000000000000000000..1b7452b512c6eb9a1ff6e47c2da78a63f7946185 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/turtledemo/bytedesign.py @@ -0,0 +1,161 @@ +#!/usr/bin/env python3 +""" turtle-example-suite: + + tdemo_bytedesign.py + +An example adapted from the example-suite +of PythonCard's turtle graphics. + +It's based on an article in BYTE magazine +Problem Solving with Logo: Using Turtle +Graphics to Redraw a Design +November 1982, p. 118 - 134 + +------------------------------------------- + +Due to the statement + +t.delay(0) + +in line 152, which sets the animation delay +to 0, this animation runs in "line per line" +mode as fast as possible. +""" + +from turtle import Turtle, mainloop +from time import perf_counter as clock + +# wrapper for any additional drawing routines +# that need to know about each other +class Designer(Turtle): + + def design(self, homePos, scale): + self.up() + for i in range(5): + self.forward(64.65 * scale) + self.down() + self.wheel(self.position(), scale) + self.up() + self.backward(64.65 * scale) + self.right(72) + self.up() + self.goto(homePos) + self.right(36) + self.forward(24.5 * scale) + self.right(198) + self.down() + self.centerpiece(46 * scale, 143.4, scale) + self.getscreen().tracer(True) + + def wheel(self, initpos, scale): + self.right(54) + for i in range(4): + self.pentpiece(initpos, scale) + self.down() + self.left(36) + for i in range(5): + self.tripiece(initpos, scale) + self.left(36) + for i in range(5): + self.down() + self.right(72) + self.forward(28 * scale) + self.up() + self.backward(28 * scale) + self.left(54) + self.getscreen().update() + + def tripiece(self, initpos, scale): + oldh = self.heading() + self.down() + self.backward(2.5 * scale) + self.tripolyr(31.5 * scale, scale) + self.up() + self.goto(initpos) + self.setheading(oldh) + self.down() + self.backward(2.5 * scale) + self.tripolyl(31.5 * scale, scale) + self.up() + self.goto(initpos) + self.setheading(oldh) + self.left(72) + self.getscreen().update() + + def pentpiece(self, initpos, scale): + oldh = self.heading() + self.up() + self.forward(29 * scale) + self.down() + for i in range(5): + self.forward(18 * scale) + self.right(72) + self.pentr(18 * scale, 75, scale) + self.up() + self.goto(initpos) + self.setheading(oldh) + self.forward(29 * scale) + self.down() + for i in range(5): + self.forward(18 * scale) + self.right(72) + self.pentl(18 * scale, 75, scale) + self.up() + self.goto(initpos) + self.setheading(oldh) + self.left(72) + self.getscreen().update() + + def pentl(self, side, ang, scale): + if side < (2 * scale): return + self.forward(side) + self.left(ang) + self.pentl(side - (.38 * scale), ang, scale) + + def pentr(self, side, ang, scale): + if side < (2 * scale): return + self.forward(side) + self.right(ang) + self.pentr(side - (.38 * scale), ang, scale) + + def tripolyr(self, side, scale): + if side < (4 * scale): return + self.forward(side) + self.right(111) + self.forward(side / 1.78) + self.right(111) + self.forward(side / 1.3) + self.right(146) + self.tripolyr(side * .75, scale) + + def tripolyl(self, side, scale): + if side < (4 * scale): return + self.forward(side) + self.left(111) + self.forward(side / 1.78) + self.left(111) + self.forward(side / 1.3) + self.left(146) + self.tripolyl(side * .75, scale) + + def centerpiece(self, s, a, scale): + self.forward(s); self.left(a) + if s < (7.5 * scale): + return + self.centerpiece(s - (1.2 * scale), a, scale) + +def main(): + t = Designer() + t.speed(0) + t.hideturtle() + t.getscreen().delay(0) + t.getscreen().tracer(0) + at = clock() + t.design(t.position(), 2) + et = clock() + return "runtime: %.2f sec." % (et-at) + +if __name__ == '__main__': + msg = main() + print(msg) + mainloop() diff --git a/miniconda3/envs/active_proaction/lib/python3.10/turtledemo/chaos.py b/miniconda3/envs/active_proaction/lib/python3.10/turtledemo/chaos.py new file mode 100644 index 0000000000000000000000000000000000000000..6a45d0d807ef0b88bb2189a0bf82490ac3dd0df9 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/turtledemo/chaos.py @@ -0,0 +1,59 @@ +# File: tdemo_chaos.py +# Author: Gregor Lingl +# Date: 2009-06-24 + +# A demonstration of chaos + +from turtle import * + +N = 80 + +def f(x): + return 3.9*x*(1-x) + +def g(x): + return 3.9*(x-x**2) + +def h(x): + return 3.9*x-3.9*x*x + +def jumpto(x, y): + penup(); goto(x,y) + +def line(x1, y1, x2, y2): + jumpto(x1, y1) + pendown() + goto(x2, y2) + +def coosys(): + line(-1, 0, N+1, 0) + line(0, -0.1, 0, 1.1) + +def plot(fun, start, color): + pencolor(color) + x = start + jumpto(0, x) + pendown() + dot(5) + for i in range(N): + x=fun(x) + goto(i+1,x) + dot(5) + +def main(): + reset() + setworldcoordinates(-1.0,-0.1, N+1, 1.1) + speed(0) + hideturtle() + coosys() + plot(f, 0.35, "blue") + plot(g, 0.35, "green") + plot(h, 0.35, "red") + # Now zoom in: + for s in range(100): + setworldcoordinates(0.5*s,-0.1, N+1, 1.1) + return "Done!" + +if __name__ == "__main__": + main() + mainloop() diff --git a/miniconda3/envs/active_proaction/lib/python3.10/turtledemo/clock.py b/miniconda3/envs/active_proaction/lib/python3.10/turtledemo/clock.py new file mode 100644 index 0000000000000000000000000000000000000000..9f8585bd11e053e3ce668c0a9feccc5f7db438e9 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/turtledemo/clock.py @@ -0,0 +1,131 @@ +#!/usr/bin/env python3 +# -*- coding: cp1252 -*- +""" turtle-example-suite: + + tdemo_clock.py + +Enhanced clock-program, showing date +and time + ------------------------------------ + Press STOP to exit the program! + ------------------------------------ +""" +from turtle import * +from datetime import datetime + +def jump(distanz, winkel=0): + penup() + right(winkel) + forward(distanz) + left(winkel) + pendown() + +def hand(laenge, spitze): + fd(laenge*1.15) + rt(90) + fd(spitze/2.0) + lt(120) + fd(spitze) + lt(120) + fd(spitze) + lt(120) + fd(spitze/2.0) + +def make_hand_shape(name, laenge, spitze): + reset() + jump(-laenge*0.15) + begin_poly() + hand(laenge, spitze) + end_poly() + hand_form = get_poly() + register_shape(name, hand_form) + +def clockface(radius): + reset() + pensize(7) + for i in range(60): + jump(radius) + if i % 5 == 0: + fd(25) + jump(-radius-25) + else: + dot(3) + jump(-radius) + rt(6) + +def setup(): + global second_hand, minute_hand, hour_hand, writer + mode("logo") + make_hand_shape("second_hand", 125, 25) + make_hand_shape("minute_hand", 130, 25) + make_hand_shape("hour_hand", 90, 25) + clockface(160) + second_hand = Turtle() + second_hand.shape("second_hand") + second_hand.color("gray20", "gray80") + minute_hand = Turtle() + minute_hand.shape("minute_hand") + minute_hand.color("blue1", "red1") + hour_hand = Turtle() + hour_hand.shape("hour_hand") + hour_hand.color("blue3", "red3") + for hand in second_hand, minute_hand, hour_hand: + hand.resizemode("user") + hand.shapesize(1, 1, 3) + hand.speed(0) + ht() + writer = Turtle() + #writer.mode("logo") + writer.ht() + writer.pu() + writer.bk(85) + +def wochentag(t): + wochentag = ["Monday", "Tuesday", "Wednesday", + "Thursday", "Friday", "Saturday", "Sunday"] + return wochentag[t.weekday()] + +def datum(z): + monat = ["Jan.", "Feb.", "Mar.", "Apr.", "May", "June", + "July", "Aug.", "Sep.", "Oct.", "Nov.", "Dec."] + j = z.year + m = monat[z.month - 1] + t = z.day + return "%s %d %d" % (m, t, j) + +def tick(): + t = datetime.today() + sekunde = t.second + t.microsecond*0.000001 + minute = t.minute + sekunde/60.0 + stunde = t.hour + minute/60.0 + try: + tracer(False) # Terminator can occur here + writer.clear() + writer.home() + writer.forward(65) + writer.write(wochentag(t), + align="center", font=("Courier", 14, "bold")) + writer.back(150) + writer.write(datum(t), + align="center", font=("Courier", 14, "bold")) + writer.forward(85) + second_hand.setheading(6*sekunde) # or here + minute_hand.setheading(6*minute) + hour_hand.setheading(30*stunde) + tracer(True) + ontimer(tick, 100) + except Terminator: + pass # turtledemo user pressed STOP + +def main(): + tracer(False) + setup() + tracer(True) + tick() + return "EVENTLOOP" + +if __name__ == "__main__": + mode("logo") + msg = main() + print(msg) + mainloop() diff --git a/miniconda3/envs/active_proaction/lib/python3.10/turtledemo/colormixer.py b/miniconda3/envs/active_proaction/lib/python3.10/turtledemo/colormixer.py new file mode 100644 index 0000000000000000000000000000000000000000..448db83361a649eff317733a5b932a1989a8697f --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/turtledemo/colormixer.py @@ -0,0 +1,58 @@ +# colormixer + +from turtle import Screen, Turtle, mainloop + +class ColorTurtle(Turtle): + + def __init__(self, x, y): + Turtle.__init__(self) + self.shape("turtle") + self.resizemode("user") + self.shapesize(3,3,5) + self.pensize(10) + self._color = [0,0,0] + self.x = x + self._color[x] = y + self.color(self._color) + self.speed(0) + self.left(90) + self.pu() + self.goto(x,0) + self.pd() + self.sety(1) + self.pu() + self.sety(y) + self.pencolor("gray25") + self.ondrag(self.shift) + + def shift(self, x, y): + self.sety(max(0,min(y,1))) + self._color[self.x] = self.ycor() + self.fillcolor(self._color) + setbgcolor() + +def setbgcolor(): + screen.bgcolor(red.ycor(), green.ycor(), blue.ycor()) + +def main(): + global screen, red, green, blue + screen = Screen() + screen.delay(0) + screen.setworldcoordinates(-1, -0.3, 3, 1.3) + + red = ColorTurtle(0, .5) + green = ColorTurtle(1, .5) + blue = ColorTurtle(2, .5) + setbgcolor() + + writer = Turtle() + writer.ht() + writer.pu() + writer.goto(1,1.15) + writer.write("DRAG!",align="center",font=("Arial",30,("bold","italic"))) + return "EVENTLOOP" + +if __name__ == "__main__": + msg = main() + print(msg) + mainloop() diff --git a/miniconda3/envs/active_proaction/lib/python3.10/turtledemo/forest.py b/miniconda3/envs/active_proaction/lib/python3.10/turtledemo/forest.py new file mode 100644 index 0000000000000000000000000000000000000000..55b7da947d24760b204afc45bff9474b48f45848 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/turtledemo/forest.py @@ -0,0 +1,108 @@ +#!/usr/bin/env python3 +""" turtlegraphics-example-suite: + + tdemo_forest.py + +Displays a 'forest' of 3 breadth-first-trees +similar to the one in tree. +For further remarks see tree.py + +This example is a 'breadth-first'-rewrite of +a Logo program written by Erich Neuwirth. See +http://homepage.univie.ac.at/erich.neuwirth/ +""" +from turtle import Turtle, colormode, tracer, mainloop +from random import randrange +from time import perf_counter as clock + +def symRandom(n): + return randrange(-n,n+1) + +def randomize( branchlist, angledist, sizedist ): + return [ (angle+symRandom(angledist), + sizefactor*1.01**symRandom(sizedist)) + for angle, sizefactor in branchlist ] + +def randomfd( t, distance, parts, angledist ): + for i in range(parts): + t.left(symRandom(angledist)) + t.forward( (1.0 * distance)/parts ) + +def tree(tlist, size, level, widthfactor, branchlists, angledist=10, sizedist=5): + # benutzt Liste von turtles und Liste von Zweiglisten, + # fuer jede turtle eine! + if level > 0: + lst = [] + brs = [] + for t, branchlist in list(zip(tlist,branchlists)): + t.pensize( size * widthfactor ) + t.pencolor( 255 - (180 - 11 * level + symRandom(15)), + 180 - 11 * level + symRandom(15), + 0 ) + t.pendown() + randomfd(t, size, level, angledist ) + yield 1 + for angle, sizefactor in branchlist: + t.left(angle) + lst.append(t.clone()) + brs.append(randomize(branchlist, angledist, sizedist)) + t.right(angle) + for x in tree(lst, size*sizefactor, level-1, widthfactor, brs, + angledist, sizedist): + yield None + + +def start(t,x,y): + colormode(255) + t.reset() + t.speed(0) + t.hideturtle() + t.left(90) + t.penup() + t.setpos(x,y) + t.pendown() + +def doit1(level, pen): + pen.hideturtle() + start(pen, 20, -208) + t = tree( [pen], 80, level, 0.1, [[ (45,0.69), (0,0.65), (-45,0.71) ]] ) + return t + +def doit2(level, pen): + pen.hideturtle() + start(pen, -135, -130) + t = tree( [pen], 120, level, 0.1, [[ (45,0.69), (-45,0.71) ]] ) + return t + +def doit3(level, pen): + pen.hideturtle() + start(pen, 190, -90) + t = tree( [pen], 100, level, 0.1, [[ (45,0.7), (0,0.72), (-45,0.65) ]] ) + return t + +# Hier 3 Baumgeneratoren: +def main(): + p = Turtle() + p.ht() + tracer(75,0) + u = doit1(6, Turtle(undobuffersize=1)) + s = doit2(7, Turtle(undobuffersize=1)) + t = doit3(5, Turtle(undobuffersize=1)) + a = clock() + while True: + done = 0 + for b in u,s,t: + try: + b.__next__() + except: + done += 1 + if done == 3: + break + + tracer(1,10) + b = clock() + return "runtime: %.2f sec." % (b-a) + +if __name__ == '__main__': + main() + mainloop() diff --git a/miniconda3/envs/active_proaction/lib/python3.10/turtledemo/fractalcurves.py b/miniconda3/envs/active_proaction/lib/python3.10/turtledemo/fractalcurves.py new file mode 100644 index 0000000000000000000000000000000000000000..54ade96a0ad05eba6304b643c21906db609903c4 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/turtledemo/fractalcurves.py @@ -0,0 +1,138 @@ +#!/usr/bin/env python3 +""" turtle-example-suite: + + tdemo_fractalCurves.py + +This program draws two fractal-curve-designs: +(1) A hilbert curve (in a box) +(2) A combination of Koch-curves. + +The CurvesTurtle class and the fractal-curve- +methods are taken from the PythonCard example +scripts for turtle-graphics. +""" +from turtle import * +from time import sleep, perf_counter as clock + +class CurvesTurtle(Pen): + # example derived from + # Turtle Geometry: The Computer as a Medium for Exploring Mathematics + # by Harold Abelson and Andrea diSessa + # p. 96-98 + def hilbert(self, size, level, parity): + if level == 0: + return + # rotate and draw first subcurve with opposite parity to big curve + self.left(parity * 90) + self.hilbert(size, level - 1, -parity) + # interface to and draw second subcurve with same parity as big curve + self.forward(size) + self.right(parity * 90) + self.hilbert(size, level - 1, parity) + # third subcurve + self.forward(size) + self.hilbert(size, level - 1, parity) + # fourth subcurve + self.right(parity * 90) + self.forward(size) + self.hilbert(size, level - 1, -parity) + # a final turn is needed to make the turtle + # end up facing outward from the large square + self.left(parity * 90) + + # Visual Modeling with Logo: A Structural Approach to Seeing + # by James Clayson + # Koch curve, after Helge von Koch who introduced this geometric figure in 1904 + # p. 146 + def fractalgon(self, n, rad, lev, dir): + import math + + # if dir = 1 turn outward + # if dir = -1 turn inward + edge = 2 * rad * math.sin(math.pi / n) + self.pu() + self.fd(rad) + self.pd() + self.rt(180 - (90 * (n - 2) / n)) + for i in range(n): + self.fractal(edge, lev, dir) + self.rt(360 / n) + self.lt(180 - (90 * (n - 2) / n)) + self.pu() + self.bk(rad) + self.pd() + + # p. 146 + def fractal(self, dist, depth, dir): + if depth < 1: + self.fd(dist) + return + self.fractal(dist / 3, depth - 1, dir) + self.lt(60 * dir) + self.fractal(dist / 3, depth - 1, dir) + self.rt(120 * dir) + self.fractal(dist / 3, depth - 1, dir) + self.lt(60 * dir) + self.fractal(dist / 3, depth - 1, dir) + +def main(): + ft = CurvesTurtle() + + ft.reset() + ft.speed(0) + ft.ht() + ft.getscreen().tracer(1,0) + ft.pu() + + size = 6 + ft.setpos(-33*size, -32*size) + ft.pd() + + ta=clock() + ft.fillcolor("red") + ft.begin_fill() + ft.fd(size) + + ft.hilbert(size, 6, 1) + + # frame + ft.fd(size) + for i in range(3): + ft.lt(90) + ft.fd(size*(64+i%2)) + ft.pu() + for i in range(2): + ft.fd(size) + ft.rt(90) + ft.pd() + for i in range(4): + ft.fd(size*(66+i%2)) + ft.rt(90) + ft.end_fill() + tb=clock() + res = "Hilbert: %.2fsec. " % (tb-ta) + + sleep(3) + + ft.reset() + ft.speed(0) + ft.ht() + ft.getscreen().tracer(1,0) + + ta=clock() + ft.color("black", "blue") + ft.begin_fill() + ft.fractalgon(3, 250, 4, 1) + ft.end_fill() + ft.begin_fill() + ft.color("red") + ft.fractalgon(3, 200, 4, -1) + ft.end_fill() + tb=clock() + res += "Koch: %.2fsec." % (tb-ta) + return res + +if __name__ == '__main__': + msg = main() + print(msg) + mainloop() diff --git a/miniconda3/envs/active_proaction/lib/python3.10/turtledemo/lindenmayer.py b/miniconda3/envs/active_proaction/lib/python3.10/turtledemo/lindenmayer.py new file mode 100644 index 0000000000000000000000000000000000000000..3925f25da61870d0cf75ede6ddefbef2562afd03 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/turtledemo/lindenmayer.py @@ -0,0 +1,119 @@ +#!/usr/bin/env python3 +""" turtle-example-suite: + + xtx_lindenmayer_indian.py + +Each morning women in Tamil Nadu, in southern +India, place designs, created by using rice +flour and known as kolam on the thresholds of +their homes. + +These can be described by Lindenmayer systems, +which can easily be implemented with turtle +graphics and Python. + +Two examples are shown here: +(1) the snake kolam +(2) anklets of Krishna + +Taken from Marcia Ascher: Mathematics +Elsewhere, An Exploration of Ideas Across +Cultures + +""" +################################ +# Mini Lindenmayer tool +############################### + +from turtle import * + +def replace( seq, replacementRules, n ): + for i in range(n): + newseq = "" + for element in seq: + newseq = newseq + replacementRules.get(element,element) + seq = newseq + return seq + +def draw( commands, rules ): + for b in commands: + try: + rules[b]() + except TypeError: + try: + draw(rules[b], rules) + except: + pass + + +def main(): + ################################ + # Example 1: Snake kolam + ################################ + + + def r(): + right(45) + + def l(): + left(45) + + def f(): + forward(7.5) + + snake_rules = {"-":r, "+":l, "f":f, "b":"f+f+f--f--f+f+f"} + snake_replacementRules = {"b": "b+f+b--f--b+f+b"} + snake_start = "b--f--b--f" + + drawing = replace(snake_start, snake_replacementRules, 3) + + reset() + speed(3) + tracer(1,0) + ht() + up() + backward(195) + down() + draw(drawing, snake_rules) + + from time import sleep + sleep(3) + + ################################ + # Example 2: Anklets of Krishna + ################################ + + def A(): + color("red") + circle(10,90) + + def B(): + from math import sqrt + color("black") + l = 5/sqrt(2) + forward(l) + circle(l, 270) + forward(l) + + def F(): + color("green") + forward(10) + + krishna_rules = {"a":A, "b":B, "f":F} + krishna_replacementRules = {"a" : "afbfa", "b" : "afbfbfbfa" } + krishna_start = "fbfbfbfb" + + reset() + speed(0) + tracer(3,0) + ht() + left(45) + drawing = replace(krishna_start, krishna_replacementRules, 3) + draw(drawing, krishna_rules) + tracer(1) + return "Done!" + +if __name__=='__main__': + msg = main() + print(msg) + mainloop() diff --git a/miniconda3/envs/active_proaction/lib/python3.10/turtledemo/minimal_hanoi.py b/miniconda3/envs/active_proaction/lib/python3.10/turtledemo/minimal_hanoi.py new file mode 100644 index 0000000000000000000000000000000000000000..4a432f2b2908d5ec6c18640fe856044bddc8a7f6 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/turtledemo/minimal_hanoi.py @@ -0,0 +1,79 @@ +#!/usr/bin/env python3 +""" turtle-example-suite: + + tdemo_minimal_hanoi.py + +A minimal 'Towers of Hanoi' animation: +A tower of 6 discs is transferred from the +left to the right peg. + +An imho quite elegant and concise +implementation using a tower class, which +is derived from the built-in type list. + +Discs are turtles with shape "square", but +stretched to rectangles by shapesize() + --------------------------------------- + To exit press STOP button + --------------------------------------- +""" +from turtle import * + +class Disc(Turtle): + def __init__(self, n): + Turtle.__init__(self, shape="square", visible=False) + self.pu() + self.shapesize(1.5, n*1.5, 2) # square-->rectangle + self.fillcolor(n/6., 0, 1-n/6.) + self.st() + +class Tower(list): + "Hanoi tower, a subclass of built-in type list" + def __init__(self, x): + "create an empty tower. x is x-position of peg" + self.x = x + def push(self, d): + d.setx(self.x) + d.sety(-150+34*len(self)) + self.append(d) + def pop(self): + d = list.pop(self) + d.sety(150) + return d + +def hanoi(n, from_, with_, to_): + if n > 0: + hanoi(n-1, from_, to_, with_) + to_.push(from_.pop()) + hanoi(n-1, with_, from_, to_) + +def play(): + onkey(None,"space") + clear() + try: + hanoi(6, t1, t2, t3) + write("press STOP button to exit", + align="center", font=("Courier", 16, "bold")) + except Terminator: + pass # turtledemo user pressed STOP + +def main(): + global t1, t2, t3 + ht(); penup(); goto(0, -225) # writer turtle + t1 = Tower(-250) + t2 = Tower(0) + t3 = Tower(250) + # make tower of 6 discs + for i in range(6,0,-1): + t1.push(Disc(i)) + # prepare spartanic user interface ;-) + write("press spacebar to start game", + align="center", font=("Courier", 16, "bold")) + onkey(play, "space") + listen() + return "EVENTLOOP" + +if __name__=="__main__": + msg = main() + print(msg) + mainloop() diff --git a/miniconda3/envs/active_proaction/lib/python3.10/turtledemo/nim.py b/miniconda3/envs/active_proaction/lib/python3.10/turtledemo/nim.py new file mode 100644 index 0000000000000000000000000000000000000000..9ae6cc5c01b9039981f31f4c28a470ac249ee5dc --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/turtledemo/nim.py @@ -0,0 +1,226 @@ +""" turtle-example-suite: + + tdemo_nim.py + +Play nim against the computer. The player +who takes the last stick is the winner. + +Implements the model-view-controller +design pattern. +""" + + +import turtle +import random +import time + +SCREENWIDTH = 640 +SCREENHEIGHT = 480 + +MINSTICKS = 7 +MAXSTICKS = 31 + +HUNIT = SCREENHEIGHT // 12 +WUNIT = SCREENWIDTH // ((MAXSTICKS // 5) * 11 + (MAXSTICKS % 5) * 2) + +SCOLOR = (63, 63, 31) +HCOLOR = (255, 204, 204) +COLOR = (204, 204, 255) + +def randomrow(): + return random.randint(MINSTICKS, MAXSTICKS) + +def computerzug(state): + xored = state[0] ^ state[1] ^ state[2] + if xored == 0: + return randommove(state) + for z in range(3): + s = state[z] ^ xored + if s <= state[z]: + move = (z, s) + return move + +def randommove(state): + m = max(state) + while True: + z = random.randint(0,2) + if state[z] > (m > 1): + break + rand = random.randint(m > 1, state[z]-1) + return z, rand + + +class NimModel(object): + def __init__(self, game): + self.game = game + + def setup(self): + if self.game.state not in [Nim.CREATED, Nim.OVER]: + return + self.sticks = [randomrow(), randomrow(), randomrow()] + self.player = 0 + self.winner = None + self.game.view.setup() + self.game.state = Nim.RUNNING + + def move(self, row, col): + maxspalte = self.sticks[row] + self.sticks[row] = col + self.game.view.notify_move(row, col, maxspalte, self.player) + if self.game_over(): + self.game.state = Nim.OVER + self.winner = self.player + self.game.view.notify_over() + elif self.player == 0: + self.player = 1 + row, col = computerzug(self.sticks) + self.move(row, col) + self.player = 0 + + def game_over(self): + return self.sticks == [0, 0, 0] + + def notify_move(self, row, col): + if self.sticks[row] <= col: + return + self.move(row, col) + + +class Stick(turtle.Turtle): + def __init__(self, row, col, game): + turtle.Turtle.__init__(self, visible=False) + self.row = row + self.col = col + self.game = game + x, y = self.coords(row, col) + self.shape("square") + self.shapesize(HUNIT/10.0, WUNIT/20.0) + self.speed(0) + self.pu() + self.goto(x,y) + self.color("white") + self.showturtle() + + def coords(self, row, col): + packet, remainder = divmod(col, 5) + x = (3 + 11 * packet + 2 * remainder) * WUNIT + y = (2 + 3 * row) * HUNIT + return x - SCREENWIDTH // 2 + WUNIT // 2, SCREENHEIGHT // 2 - y - HUNIT // 2 + + def makemove(self, x, y): + if self.game.state != Nim.RUNNING: + return + self.game.controller.notify_move(self.row, self.col) + + +class NimView(object): + def __init__(self, game): + self.game = game + self.screen = game.screen + self.model = game.model + self.screen.colormode(255) + self.screen.tracer(False) + self.screen.bgcolor((240, 240, 255)) + self.writer = turtle.Turtle(visible=False) + self.writer.pu() + self.writer.speed(0) + self.sticks = {} + for row in range(3): + for col in range(MAXSTICKS): + self.sticks[(row, col)] = Stick(row, col, game) + self.display("... a moment please ...") + self.screen.tracer(True) + + def display(self, msg1, msg2=None): + self.screen.tracer(False) + self.writer.clear() + if msg2 is not None: + self.writer.goto(0, - SCREENHEIGHT // 2 + 48) + self.writer.pencolor("red") + self.writer.write(msg2, align="center", font=("Courier",18,"bold")) + self.writer.goto(0, - SCREENHEIGHT // 2 + 20) + self.writer.pencolor("black") + self.writer.write(msg1, align="center", font=("Courier",14,"bold")) + self.screen.tracer(True) + + def setup(self): + self.screen.tracer(False) + for row in range(3): + for col in range(self.model.sticks[row]): + self.sticks[(row, col)].color(SCOLOR) + for row in range(3): + for col in range(self.model.sticks[row], MAXSTICKS): + self.sticks[(row, col)].color("white") + self.display("Your turn! Click leftmost stick to remove.") + self.screen.tracer(True) + + def notify_move(self, row, col, maxspalte, player): + if player == 0: + farbe = HCOLOR + for s in range(col, maxspalte): + self.sticks[(row, s)].color(farbe) + else: + self.display(" ... thinking ... ") + time.sleep(0.5) + self.display(" ... thinking ... aaah ...") + farbe = COLOR + for s in range(maxspalte-1, col-1, -1): + time.sleep(0.2) + self.sticks[(row, s)].color(farbe) + self.display("Your turn! Click leftmost stick to remove.") + + def notify_over(self): + if self.game.model.winner == 0: + msg2 = "Congrats. You're the winner!!!" + else: + msg2 = "Sorry, the computer is the winner." + self.display("To play again press space bar. To leave press ESC.", msg2) + + def clear(self): + if self.game.state == Nim.OVER: + self.screen.clear() + + +class NimController(object): + + def __init__(self, game): + self.game = game + self.sticks = game.view.sticks + self.BUSY = False + for stick in self.sticks.values(): + stick.onclick(stick.makemove) + self.game.screen.onkey(self.game.model.setup, "space") + self.game.screen.onkey(self.game.view.clear, "Escape") + self.game.view.display("Press space bar to start game") + self.game.screen.listen() + + def notify_move(self, row, col): + if self.BUSY: + return + self.BUSY = True + self.game.model.notify_move(row, col) + self.BUSY = False + + +class Nim(object): + CREATED = 0 + RUNNING = 1 + OVER = 2 + def __init__(self, screen): + self.state = Nim.CREATED + self.screen = screen + self.model = NimModel(self) + self.view = NimView(self) + self.controller = NimController(self) + + +def main(): + mainscreen = turtle.Screen() + mainscreen.mode("standard") + mainscreen.setup(SCREENWIDTH, SCREENHEIGHT) + nim = Nim(mainscreen) + return "EVENTLOOP" + +if __name__ == "__main__": + main() + turtle.mainloop() diff --git a/miniconda3/envs/active_proaction/lib/python3.10/turtledemo/paint.py b/miniconda3/envs/active_proaction/lib/python3.10/turtledemo/paint.py new file mode 100644 index 0000000000000000000000000000000000000000..fc6852a20082f5fb085b35201c452d0ed96bafe0 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/turtledemo/paint.py @@ -0,0 +1,54 @@ +#!/usr/bin/env python3 +""" turtle-example-suite: + + tdemo_paint.py + +A simple event-driven paint program + +- left mouse button moves turtle +- middle mouse button changes color +- right mouse button toggles between pen up +(no line drawn when the turtle moves) and +pen down (line is drawn). If pen up follows +at least two pen-down moves, the polygon that +includes the starting point is filled. + ------------------------------------------- + Play around by clicking into the canvas + using all three mouse buttons. + ------------------------------------------- + To exit press STOP button + ------------------------------------------- +""" +from turtle import * + +def switchupdown(x=0, y=0): + if pen()["pendown"]: + end_fill() + up() + else: + down() + begin_fill() + +def changecolor(x=0, y=0): + global colors + colors = colors[1:]+colors[:1] + color(colors[0]) + +def main(): + global colors + shape("circle") + resizemode("user") + shapesize(.5) + width(3) + colors=["red", "green", "blue", "yellow"] + color(colors[0]) + switchupdown() + onscreenclick(goto,1) + onscreenclick(changecolor,2) + onscreenclick(switchupdown,3) + return "EVENTLOOP" + +if __name__ == "__main__": + msg = main() + print(msg) + mainloop() diff --git a/miniconda3/envs/active_proaction/lib/python3.10/turtledemo/peace.py b/miniconda3/envs/active_proaction/lib/python3.10/turtledemo/peace.py new file mode 100644 index 0000000000000000000000000000000000000000..e2ba9288d9e42e78bb0ad68f69ed4910aa65567d --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/turtledemo/peace.py @@ -0,0 +1,61 @@ +#!/usr/bin/env python3 +""" turtle-example-suite: + + tdemo_peace.py + +A simple drawing suitable as a beginner's +programming example. Aside from the +peacecolors assignment and the for loop, +it only uses turtle commands. +""" + +from turtle import * + +def main(): + peacecolors = ("red3", "orange", "yellow", + "seagreen4", "orchid4", + "royalblue1", "dodgerblue4") + + reset() + Screen() + up() + goto(-320,-195) + width(70) + + for pcolor in peacecolors: + color(pcolor) + down() + forward(640) + up() + backward(640) + left(90) + forward(66) + right(90) + + width(25) + color("white") + goto(0,-170) + down() + + circle(170) + left(90) + forward(340) + up() + left(180) + forward(170) + right(45) + down() + forward(170) + up() + backward(170) + left(90) + down() + forward(170) + up() + + goto(0,300) # vanish if hideturtle() is not available ;-) + return "Done!" + +if __name__ == "__main__": + main() + mainloop() diff --git a/miniconda3/envs/active_proaction/lib/python3.10/turtledemo/penrose.py b/miniconda3/envs/active_proaction/lib/python3.10/turtledemo/penrose.py new file mode 100644 index 0000000000000000000000000000000000000000..045722a2286061eb9cb22e1e245f0164fc665afc --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/turtledemo/penrose.py @@ -0,0 +1,175 @@ +#!/usr/bin/env python3 +""" xturtle-example-suite: + + xtx_kites_and_darts.py + +Constructs two aperiodic penrose-tilings, +consisting of kites and darts, by the method +of inflation in six steps. + +Starting points are the patterns "sun" +consisting of five kites and "star" +consisting of five darts. + +For more information see: + http://en.wikipedia.org/wiki/Penrose_tiling + ------------------------------------------- +""" +from turtle import * +from math import cos, pi +from time import perf_counter as clock, sleep + +f = (5**0.5-1)/2.0 # (sqrt(5)-1)/2 -- golden ratio +d = 2 * cos(3*pi/10) + +def kite(l): + fl = f * l + lt(36) + fd(l) + rt(108) + fd(fl) + rt(36) + fd(fl) + rt(108) + fd(l) + rt(144) + +def dart(l): + fl = f * l + lt(36) + fd(l) + rt(144) + fd(fl) + lt(36) + fd(fl) + rt(144) + fd(l) + rt(144) + +def inflatekite(l, n): + if n == 0: + px, py = pos() + h, x, y = int(heading()), round(px,3), round(py,3) + tiledict[(h,x,y)] = True + return + fl = f * l + lt(36) + inflatedart(fl, n-1) + fd(l) + rt(144) + inflatekite(fl, n-1) + lt(18) + fd(l*d) + rt(162) + inflatekite(fl, n-1) + lt(36) + fd(l) + rt(180) + inflatedart(fl, n-1) + lt(36) + +def inflatedart(l, n): + if n == 0: + px, py = pos() + h, x, y = int(heading()), round(px,3), round(py,3) + tiledict[(h,x,y)] = False + return + fl = f * l + inflatekite(fl, n-1) + lt(36) + fd(l) + rt(180) + inflatedart(fl, n-1) + lt(54) + fd(l*d) + rt(126) + inflatedart(fl, n-1) + fd(l) + rt(144) + +def draw(l, n, th=2): + clear() + l = l * f**n + shapesize(l/100.0, l/100.0, th) + for k in tiledict: + h, x, y = k + setpos(x, y) + setheading(h) + if tiledict[k]: + shape("kite") + color("black", (0, 0.75, 0)) + else: + shape("dart") + color("black", (0.75, 0, 0)) + stamp() + +def sun(l, n): + for i in range(5): + inflatekite(l, n) + lt(72) + +def star(l,n): + for i in range(5): + inflatedart(l, n) + lt(72) + +def makeshapes(): + tracer(0) + begin_poly() + kite(100) + end_poly() + register_shape("kite", get_poly()) + begin_poly() + dart(100) + end_poly() + register_shape("dart", get_poly()) + tracer(1) + +def start(): + reset() + ht() + pu() + makeshapes() + resizemode("user") + +def test(l=200, n=4, fun=sun, startpos=(0,0), th=2): + global tiledict + goto(startpos) + setheading(0) + tiledict = {} + tracer(0) + fun(l, n) + draw(l, n, th) + tracer(1) + nk = len([x for x in tiledict if tiledict[x]]) + nd = len([x for x in tiledict if not tiledict[x]]) + print("%d kites and %d darts = %d pieces." % (nk, nd, nk+nd)) + +def demo(fun=sun): + start() + for i in range(8): + a = clock() + test(300, i, fun) + b = clock() + t = b - a + if t < 2: + sleep(2 - t) + +def main(): + #title("Penrose-tiling with kites and darts.") + mode("logo") + bgcolor(0.3, 0.3, 0) + demo(sun) + sleep(2) + demo(star) + pencolor("black") + goto(0,-200) + pencolor(0.7,0.7,1) + write("Please wait...", + align="center", font=('Arial Black', 36, 'bold')) + test(600, 8, startpos=(70, 117)) + return "Done" + +if __name__ == "__main__": + msg = main() + mainloop() diff --git a/miniconda3/envs/active_proaction/lib/python3.10/turtledemo/planet_and_moon.py b/miniconda3/envs/active_proaction/lib/python3.10/turtledemo/planet_and_moon.py new file mode 100644 index 0000000000000000000000000000000000000000..021ff99383aa65122b663f394b9d55bf57a24e9d --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/turtledemo/planet_and_moon.py @@ -0,0 +1,111 @@ +#!/usr/bin/env python3 +""" turtle-example-suite: + + tdemo_planets_and_moon.py + +Gravitational system simulation using the +approximation method from Feynman-lectures, +p.9-8, using turtlegraphics. + +Example: heavy central body, light planet, +very light moon! +Planet has a circular orbit, moon a stable +orbit around the planet. + +You can hold the movement temporarily by +pressing the left mouse button with the +mouse over the scrollbar of the canvas. + +""" +from turtle import Shape, Turtle, mainloop, Vec2D as Vec + +G = 8 + +class GravSys(object): + def __init__(self): + self.planets = [] + self.t = 0 + self.dt = 0.01 + def init(self): + for p in self.planets: + p.init() + def start(self): + for i in range(10000): + self.t += self.dt + for p in self.planets: + p.step() + +class Star(Turtle): + def __init__(self, m, x, v, gravSys, shape): + Turtle.__init__(self, shape=shape) + self.penup() + self.m = m + self.setpos(x) + self.v = v + gravSys.planets.append(self) + self.gravSys = gravSys + self.resizemode("user") + self.pendown() + def init(self): + dt = self.gravSys.dt + self.a = self.acc() + self.v = self.v + 0.5*dt*self.a + def acc(self): + a = Vec(0,0) + for planet in self.gravSys.planets: + if planet != self: + v = planet.pos()-self.pos() + a += (G*planet.m/abs(v)**3)*v + return a + def step(self): + dt = self.gravSys.dt + self.setpos(self.pos() + dt*self.v) + if self.gravSys.planets.index(self) != 0: + self.setheading(self.towards(self.gravSys.planets[0])) + self.a = self.acc() + self.v = self.v + dt*self.a + +## create compound yellow/blue turtleshape for planets + +def main(): + s = Turtle() + s.reset() + s.getscreen().tracer(0,0) + s.ht() + s.pu() + s.fd(6) + s.lt(90) + s.begin_poly() + s.circle(6, 180) + s.end_poly() + m1 = s.get_poly() + s.begin_poly() + s.circle(6,180) + s.end_poly() + m2 = s.get_poly() + + planetshape = Shape("compound") + planetshape.addcomponent(m1,"orange") + planetshape.addcomponent(m2,"blue") + s.getscreen().register_shape("planet", planetshape) + s.getscreen().tracer(1,0) + + ## setup gravitational system + gs = GravSys() + sun = Star(1000000, Vec(0,0), Vec(0,-2.5), gs, "circle") + sun.color("yellow") + sun.shapesize(1.8) + sun.pu() + earth = Star(12500, Vec(210,0), Vec(0,195), gs, "planet") + earth.pencolor("green") + earth.shapesize(0.8) + moon = Star(1, Vec(220,0), Vec(0,295), gs, "planet") + moon.pencolor("blue") + moon.shapesize(0.5) + gs.init() + gs.start() + return "Done!" + +if __name__ == '__main__': + main() + mainloop() diff --git a/miniconda3/envs/active_proaction/lib/python3.10/turtledemo/rosette.py b/miniconda3/envs/active_proaction/lib/python3.10/turtledemo/rosette.py new file mode 100644 index 0000000000000000000000000000000000000000..47d0f00e9da9d15dc93b0814208949e86be618f5 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/turtledemo/rosette.py @@ -0,0 +1,65 @@ +""" turtle-example-suite: + + tdemo_wikipedia3.py + +This example is +inspired by the Wikipedia article on turtle +graphics. (See example wikipedia1 for URLs) + +First we create (ne-1) (i.e. 35 in this +example) copies of our first turtle p. +Then we let them perform their steps in +parallel. + +Followed by a complete undo(). +""" +from turtle import Screen, Turtle, mainloop +from time import perf_counter as clock, sleep + +def mn_eck(p, ne,sz): + turtlelist = [p] + #create ne-1 additional turtles + for i in range(1,ne): + q = p.clone() + q.rt(360.0/ne) + turtlelist.append(q) + p = q + for i in range(ne): + c = abs(ne/2.0-i)/(ne*.7) + # let those ne turtles make a step + # in parallel: + for t in turtlelist: + t.rt(360./ne) + t.pencolor(1-c,0,c) + t.fd(sz) + +def main(): + s = Screen() + s.bgcolor("black") + p=Turtle() + p.speed(0) + p.hideturtle() + p.pencolor("red") + p.pensize(3) + + s.tracer(36,0) + + at = clock() + mn_eck(p, 36, 19) + et = clock() + z1 = et-at + + sleep(1) + + at = clock() + while any(t.undobufferentries() for t in s.turtles()): + for t in s.turtles(): + t.undo() + et = clock() + return "runtime: %.3f sec" % (z1+et-at) + + +if __name__ == '__main__': + msg = main() + print(msg) + mainloop() diff --git a/miniconda3/envs/active_proaction/lib/python3.10/turtledemo/round_dance.py b/miniconda3/envs/active_proaction/lib/python3.10/turtledemo/round_dance.py new file mode 100644 index 0000000000000000000000000000000000000000..10383614c6e974c7b0cbd3e9ad99ba8ee5371922 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/turtledemo/round_dance.py @@ -0,0 +1,86 @@ +""" turtle-example-suite: + + tdemo_round_dance.py + +(Needs version 1.1 of the turtle module that +comes with Python 3.1) + +Dancing turtles have a compound shape +consisting of a series of triangles of +decreasing size. + +Turtles march along a circle while rotating +pairwise in opposite direction, with one +exception. Does that breaking of symmetry +enhance the attractiveness of the example? + +Press any key to stop the animation. + +Technically: demonstrates use of compound +shapes, transformation of shapes as well as +cloning turtles. The animation is +controlled through update(). +""" + +from turtle import * + +def stop(): + global running + running = False + +def main(): + global running + clearscreen() + bgcolor("gray10") + tracer(False) + shape("triangle") + f = 0.793402 + phi = 9.064678 + s = 5 + c = 1 + # create compound shape + sh = Shape("compound") + for i in range(10): + shapesize(s) + p =get_shapepoly() + s *= f + c *= f + tilt(-phi) + sh.addcomponent(p, (c, 0.25, 1-c), "black") + register_shape("multitri", sh) + # create dancers + shapesize(1) + shape("multitri") + pu() + setpos(0, -200) + dancers = [] + for i in range(180): + fd(7) + tilt(-4) + lt(2) + update() + if i % 12 == 0: + dancers.append(clone()) + home() + # dance + running = True + onkeypress(stop) + listen() + cs = 1 + while running: + ta = -4 + for dancer in dancers: + dancer.fd(7) + dancer.lt(2) + dancer.tilt(ta) + ta = -4 if ta > 0 else 2 + if cs < 180: + right(4) + shapesize(cs) + cs *= 1.005 + update() + return "DONE!" + +if __name__=='__main__': + print(main()) + mainloop() diff --git a/miniconda3/envs/active_proaction/lib/python3.10/turtledemo/sorting_animate.py b/miniconda3/envs/active_proaction/lib/python3.10/turtledemo/sorting_animate.py new file mode 100644 index 0000000000000000000000000000000000000000..d25a0ab6cebdc09e79a7a7974345852cd23a469c --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/turtledemo/sorting_animate.py @@ -0,0 +1,204 @@ +#!/usr/bin/env python3 +""" + + sorting_animation.py + +A minimal sorting algorithm animation: +Sorts a shelf of 10 blocks using insertion +sort, selection sort and quicksort. + +Shelfs are implemented using builtin lists. + +Blocks are turtles with shape "square", but +stretched to rectangles by shapesize() + --------------------------------------- + To exit press space button + --------------------------------------- +""" +from turtle import * +import random + + +class Block(Turtle): + + def __init__(self, size): + self.size = size + Turtle.__init__(self, shape="square", visible=False) + self.pu() + self.shapesize(size * 1.5, 1.5, 2) # square-->rectangle + self.fillcolor("black") + self.st() + + def glow(self): + self.fillcolor("red") + + def unglow(self): + self.fillcolor("black") + + def __repr__(self): + return "Block size: {0}".format(self.size) + + +class Shelf(list): + + def __init__(self, y): + "create a shelf. y is y-position of first block" + self.y = y + self.x = -150 + + def push(self, d): + width, _, _ = d.shapesize() + # align blocks by the bottom edge + y_offset = width / 2 * 20 + d.sety(self.y + y_offset) + d.setx(self.x + 34 * len(self)) + self.append(d) + + def _close_gap_from_i(self, i): + for b in self[i:]: + xpos, _ = b.pos() + b.setx(xpos - 34) + + def _open_gap_from_i(self, i): + for b in self[i:]: + xpos, _ = b.pos() + b.setx(xpos + 34) + + def pop(self, key): + b = list.pop(self, key) + b.glow() + b.sety(200) + self._close_gap_from_i(key) + return b + + def insert(self, key, b): + self._open_gap_from_i(key) + list.insert(self, key, b) + b.setx(self.x + 34 * key) + width, _, _ = b.shapesize() + # align blocks by the bottom edge + y_offset = width / 2 * 20 + b.sety(self.y + y_offset) + b.unglow() + +def isort(shelf): + length = len(shelf) + for i in range(1, length): + hole = i + while hole > 0 and shelf[i].size < shelf[hole - 1].size: + hole = hole - 1 + shelf.insert(hole, shelf.pop(i)) + return + +def ssort(shelf): + length = len(shelf) + for j in range(0, length - 1): + imin = j + for i in range(j + 1, length): + if shelf[i].size < shelf[imin].size: + imin = i + if imin != j: + shelf.insert(j, shelf.pop(imin)) + +def partition(shelf, left, right, pivot_index): + pivot = shelf[pivot_index] + shelf.insert(right, shelf.pop(pivot_index)) + store_index = left + for i in range(left, right): # range is non-inclusive of ending value + if shelf[i].size < pivot.size: + shelf.insert(store_index, shelf.pop(i)) + store_index = store_index + 1 + shelf.insert(store_index, shelf.pop(right)) # move pivot to correct position + return store_index + +def qsort(shelf, left, right): + if left < right: + pivot_index = left + pivot_new_index = partition(shelf, left, right, pivot_index) + qsort(shelf, left, pivot_new_index - 1) + qsort(shelf, pivot_new_index + 1, right) + +def randomize(): + disable_keys() + clear() + target = list(range(10)) + random.shuffle(target) + for i, t in enumerate(target): + for j in range(i, len(s)): + if s[j].size == t + 1: + s.insert(i, s.pop(j)) + show_text(instructions1) + show_text(instructions2, line=1) + enable_keys() + +def show_text(text, line=0): + line = 20 * line + goto(0,-250 - line) + write(text, align="center", font=("Courier", 16, "bold")) + +def start_ssort(): + disable_keys() + clear() + show_text("Selection Sort") + ssort(s) + clear() + show_text(instructions1) + show_text(instructions2, line=1) + enable_keys() + +def start_isort(): + disable_keys() + clear() + show_text("Insertion Sort") + isort(s) + clear() + show_text(instructions1) + show_text(instructions2, line=1) + enable_keys() + +def start_qsort(): + disable_keys() + clear() + show_text("Quicksort") + qsort(s, 0, len(s) - 1) + clear() + show_text(instructions1) + show_text(instructions2, line=1) + enable_keys() + +def init_shelf(): + global s + s = Shelf(-200) + vals = (4, 2, 8, 9, 1, 5, 10, 3, 7, 6) + for i in vals: + s.push(Block(i)) + +def disable_keys(): + onkey(None, "s") + onkey(None, "i") + onkey(None, "q") + onkey(None, "r") + +def enable_keys(): + onkey(start_isort, "i") + onkey(start_ssort, "s") + onkey(start_qsort, "q") + onkey(randomize, "r") + onkey(bye, "space") + +def main(): + getscreen().clearscreen() + ht(); penup() + init_shelf() + show_text(instructions1) + show_text(instructions2, line=1) + enable_keys() + listen() + return "EVENTLOOP" + +instructions1 = "press i for insertion sort, s for selection sort, q for quicksort" +instructions2 = "spacebar to quit, r to randomize" + +if __name__=="__main__": + msg = main() + mainloop() diff --git a/miniconda3/envs/active_proaction/lib/python3.10/turtledemo/tree.py b/miniconda3/envs/active_proaction/lib/python3.10/turtledemo/tree.py new file mode 100644 index 0000000000000000000000000000000000000000..98a20da7f15c11d90a4243b8319131ceed2e8f4c --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/turtledemo/tree.py @@ -0,0 +1,62 @@ +#!/usr/bin/env python3 +""" turtle-example-suite: + + tdemo_tree.py + +Displays a 'breadth-first-tree' - in contrast +to the classical Logo tree drawing programs, +which use a depth-first-algorithm. + +Uses: +(1) a tree-generator, where the drawing is +quasi the side-effect, whereas the generator +always yields None. +(2) Turtle-cloning: At each branching point +the current pen is cloned. So in the end +there are 1024 turtles. +""" +from turtle import Turtle, mainloop +from time import perf_counter as clock + +def tree(plist, l, a, f): + """ plist is list of pens + l is length of branch + a is half of the angle between 2 branches + f is factor by which branch is shortened + from level to level.""" + if l > 3: + lst = [] + for p in plist: + p.forward(l) + q = p.clone() + p.left(a) + q.right(a) + lst.append(p) + lst.append(q) + for x in tree(lst, l*f, a, f): + yield None + +def maketree(): + p = Turtle() + p.setundobuffer(None) + p.hideturtle() + p.speed(0) + p.getscreen().tracer(30,0) + p.left(90) + p.penup() + p.forward(-210) + p.pendown() + t = tree([p], 200, 65, 0.6375) + for x in t: + pass + +def main(): + a=clock() + maketree() + b=clock() + return "done: %.2f sec." % (b-a) + +if __name__ == "__main__": + msg = main() + print(msg) + mainloop() diff --git a/miniconda3/envs/active_proaction/lib/python3.10/turtledemo/turtle.cfg b/miniconda3/envs/active_proaction/lib/python3.10/turtledemo/turtle.cfg new file mode 100644 index 0000000000000000000000000000000000000000..bd89a741f926912a6a9288a688d1f31d133afac9 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/turtledemo/turtle.cfg @@ -0,0 +1,10 @@ +width = 800 +height = 600 +canvwidth = 1200 +canvheight = 900 +shape = arrow +mode = standard +resizemode = auto +fillcolor = "" +title = Python turtle graphics demo. + diff --git a/miniconda3/envs/active_proaction/lib/python3.10/turtledemo/two_canvases.py b/miniconda3/envs/active_proaction/lib/python3.10/turtledemo/two_canvases.py new file mode 100644 index 0000000000000000000000000000000000000000..f3602585ab0592c393fbe9526cb5aae4ae902f6c --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/turtledemo/two_canvases.py @@ -0,0 +1,54 @@ +"""turtledemo.two_canvases + +Use TurtleScreen and RawTurtle to draw on two +distinct canvases in a separate window. The +new window must be separately closed in +addition to pressing the STOP button. +""" + +from turtle import TurtleScreen, RawTurtle, TK + +def main(): + root = TK.Tk() + cv1 = TK.Canvas(root, width=300, height=200, bg="#ddffff") + cv2 = TK.Canvas(root, width=300, height=200, bg="#ffeeee") + cv1.pack() + cv2.pack() + + s1 = TurtleScreen(cv1) + s1.bgcolor(0.85, 0.85, 1) + s2 = TurtleScreen(cv2) + s2.bgcolor(1, 0.85, 0.85) + + p = RawTurtle(s1) + q = RawTurtle(s2) + + p.color("red", (1, 0.85, 0.85)) + p.width(3) + q.color("blue", (0.85, 0.85, 1)) + q.width(3) + + for t in p,q: + t.shape("turtle") + t.lt(36) + + q.lt(180) + + for t in p, q: + t.begin_fill() + for i in range(5): + for t in p, q: + t.fd(50) + t.lt(72) + for t in p,q: + t.end_fill() + t.lt(54) + t.pu() + t.bk(50) + + return "EVENTLOOP" + + +if __name__ == '__main__': + main() + TK.mainloop() # keep window open until user closes it diff --git a/miniconda3/envs/active_proaction/lib/python3.10/turtledemo/yinyang.py b/miniconda3/envs/active_proaction/lib/python3.10/turtledemo/yinyang.py new file mode 100644 index 0000000000000000000000000000000000000000..11d1f47cae25491b302f2a387a816c3558130444 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/turtledemo/yinyang.py @@ -0,0 +1,49 @@ +#!/usr/bin/env python3 +""" turtle-example-suite: + + tdemo_yinyang.py + +Another drawing suitable as a beginner's +programming example. + +The small circles are drawn by the circle +command. + +""" + +from turtle import * + +def yin(radius, color1, color2): + width(3) + color("black", color1) + begin_fill() + circle(radius/2., 180) + circle(radius, 180) + left(180) + circle(-radius/2., 180) + end_fill() + left(90) + up() + forward(radius*0.35) + right(90) + down() + color(color1, color2) + begin_fill() + circle(radius*0.15) + end_fill() + left(90) + up() + backward(radius*0.35) + down() + left(90) + +def main(): + reset() + yin(200, "black", "white") + yin(200, "white", "black") + ht() + return "Done!" + +if __name__ == '__main__': + main() + mainloop() diff --git a/miniconda3/envs/active_proaction/lib/python3.10/unittest/__init__.py b/miniconda3/envs/active_proaction/lib/python3.10/unittest/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..348dc471f4c3d44af8cd984fc5d08b1d2072f30b --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/unittest/__init__.py @@ -0,0 +1,95 @@ +""" +Python unit testing framework, based on Erich Gamma's JUnit and Kent Beck's +Smalltalk testing framework (used with permission). + +This module contains the core framework classes that form the basis of +specific test cases and suites (TestCase, TestSuite etc.), and also a +text-based utility class for running the tests and reporting the results + (TextTestRunner). + +Simple usage: + + import unittest + + class IntegerArithmeticTestCase(unittest.TestCase): + def testAdd(self): # test method names begin with 'test' + self.assertEqual((1 + 2), 3) + self.assertEqual(0 + 1, 1) + def testMultiply(self): + self.assertEqual((0 * 10), 0) + self.assertEqual((5 * 8), 40) + + if __name__ == '__main__': + unittest.main() + +Further information is available in the bundled documentation, and from + + http://docs.python.org/library/unittest.html + +Copyright (c) 1999-2003 Steve Purcell +Copyright (c) 2003-2010 Python Software Foundation +This module is free software, and you may redistribute it and/or modify +it under the same terms as Python itself, so long as this copyright message +and disclaimer are retained in their original form. + +IN NO EVENT SHALL THE AUTHOR BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, +SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OF +THIS CODE, EVEN IF THE AUTHOR HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGE. + +THE AUTHOR SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A +PARTICULAR PURPOSE. THE CODE PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, +AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, +SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +""" + +__all__ = ['TestResult', 'TestCase', 'IsolatedAsyncioTestCase', 'TestSuite', + 'TextTestRunner', 'TestLoader', 'FunctionTestCase', 'main', + 'defaultTestLoader', 'SkipTest', 'skip', 'skipIf', 'skipUnless', + 'expectedFailure', 'TextTestResult', 'installHandler', + 'registerResult', 'removeResult', 'removeHandler', + 'addModuleCleanup'] + +# Expose obsolete functions for backwards compatibility +__all__.extend(['getTestCaseNames', 'makeSuite', 'findTestCases']) + +__unittest = True + +from .result import TestResult +from .case import (addModuleCleanup, TestCase, FunctionTestCase, SkipTest, skip, + skipIf, skipUnless, expectedFailure) +from .suite import BaseTestSuite, TestSuite +from .loader import (TestLoader, defaultTestLoader, makeSuite, getTestCaseNames, + findTestCases) +from .main import TestProgram, main +from .runner import TextTestRunner, TextTestResult +from .signals import installHandler, registerResult, removeResult, removeHandler +# IsolatedAsyncioTestCase will be imported lazily. + +# deprecated +_TextTestResult = TextTestResult + +# There are no tests here, so don't try to run anything discovered from +# introspecting the symbols (e.g. FunctionTestCase). Instead, all our +# tests come from within unittest.test. +def load_tests(loader, tests, pattern): + import os.path + # top level directory cached on loader instance + this_dir = os.path.dirname(__file__) + return loader.discover(start_dir=this_dir, pattern=pattern) + + +# Lazy import of IsolatedAsyncioTestCase from .async_case +# It imports asyncio, which is relatively heavy, but most tests +# do not need it. + +def __dir__(): + return globals().keys() | {'IsolatedAsyncioTestCase'} + +def __getattr__(name): + if name == 'IsolatedAsyncioTestCase': + global IsolatedAsyncioTestCase + from .async_case import IsolatedAsyncioTestCase + return IsolatedAsyncioTestCase + raise AttributeError(f"module {__name__!r} has no attribute {name!r}") diff --git a/miniconda3/envs/active_proaction/lib/python3.10/unittest/__main__.py b/miniconda3/envs/active_proaction/lib/python3.10/unittest/__main__.py new file mode 100644 index 0000000000000000000000000000000000000000..e5876f569b5fa8a1bc1be582e8ba7e433f3efa1c --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/unittest/__main__.py @@ -0,0 +1,18 @@ +"""Main entry point""" + +import sys +if sys.argv[0].endswith("__main__.py"): + import os.path + # We change sys.argv[0] to make help message more useful + # use executable without path, unquoted + # (it's just a hint anyway) + # (if you have spaces in your executable you get what you deserve!) + executable = os.path.basename(sys.executable) + sys.argv[0] = executable + " -m unittest" + del os + +__unittest = True + +from .main import main + +main(module=None) diff --git a/miniconda3/envs/active_proaction/lib/python3.10/unittest/_log.py b/miniconda3/envs/active_proaction/lib/python3.10/unittest/_log.py new file mode 100644 index 0000000000000000000000000000000000000000..94868e5bb95eb35fb17c9bea103f04c7d0fd5433 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/unittest/_log.py @@ -0,0 +1,86 @@ +import logging +import collections + +from .case import _BaseTestCaseContext + + +_LoggingWatcher = collections.namedtuple("_LoggingWatcher", + ["records", "output"]) + +class _CapturingHandler(logging.Handler): + """ + A logging handler capturing all (raw and formatted) logging output. + """ + + def __init__(self): + logging.Handler.__init__(self) + self.watcher = _LoggingWatcher([], []) + + def flush(self): + pass + + def emit(self, record): + self.watcher.records.append(record) + msg = self.format(record) + self.watcher.output.append(msg) + + +class _AssertLogsContext(_BaseTestCaseContext): + """A context manager for assertLogs() and assertNoLogs() """ + + LOGGING_FORMAT = "%(levelname)s:%(name)s:%(message)s" + + def __init__(self, test_case, logger_name, level, no_logs): + _BaseTestCaseContext.__init__(self, test_case) + self.logger_name = logger_name + if level: + self.level = logging._nameToLevel.get(level, level) + else: + self.level = logging.INFO + self.msg = None + self.no_logs = no_logs + + def __enter__(self): + if isinstance(self.logger_name, logging.Logger): + logger = self.logger = self.logger_name + else: + logger = self.logger = logging.getLogger(self.logger_name) + formatter = logging.Formatter(self.LOGGING_FORMAT) + handler = _CapturingHandler() + handler.setLevel(self.level) + handler.setFormatter(formatter) + self.watcher = handler.watcher + self.old_handlers = logger.handlers[:] + self.old_level = logger.level + self.old_propagate = logger.propagate + logger.handlers = [handler] + logger.setLevel(self.level) + logger.propagate = False + if self.no_logs: + return + return handler.watcher + + def __exit__(self, exc_type, exc_value, tb): + self.logger.handlers = self.old_handlers + self.logger.propagate = self.old_propagate + self.logger.setLevel(self.old_level) + + if exc_type is not None: + # let unexpected exceptions pass through + return False + + if self.no_logs: + # assertNoLogs + if len(self.watcher.records) > 0: + self._raiseFailure( + "Unexpected logs found: {!r}".format( + self.watcher.output + ) + ) + + else: + # assertLogs + if len(self.watcher.records) == 0: + self._raiseFailure( + "no logs of level {} or higher triggered on {}" + .format(logging.getLevelName(self.level), self.logger.name)) diff --git a/miniconda3/envs/active_proaction/lib/python3.10/unittest/async_case.py b/miniconda3/envs/active_proaction/lib/python3.10/unittest/async_case.py new file mode 100644 index 0000000000000000000000000000000000000000..d9c694e368255dec153a01323eee13e2510deb1b --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/unittest/async_case.py @@ -0,0 +1,170 @@ +import asyncio +import inspect + +from .case import TestCase + + +class IsolatedAsyncioTestCase(TestCase): + # Names intentionally have a long prefix + # to reduce a chance of clashing with user-defined attributes + # from inherited test case + # + # The class doesn't call loop.run_until_complete(self.setUp()) and family + # but uses a different approach: + # 1. create a long-running task that reads self.setUp() + # awaitable from queue along with a future + # 2. await the awaitable object passing in and set the result + # into the future object + # 3. Outer code puts the awaitable and the future object into a queue + # with waiting for the future + # The trick is necessary because every run_until_complete() call + # creates a new task with embedded ContextVar context. + # To share contextvars between setUp(), test and tearDown() we need to execute + # them inside the same task. + + # Note: the test case modifies event loop policy if the policy was not instantiated + # yet. + # asyncio.get_event_loop_policy() creates a default policy on demand but never + # returns None + # I believe this is not an issue in user level tests but python itself for testing + # should reset a policy in every test module + # by calling asyncio.set_event_loop_policy(None) in tearDownModule() + + def __init__(self, methodName='runTest'): + super().__init__(methodName) + self._asyncioTestLoop = None + self._asyncioCallsQueue = None + + async def asyncSetUp(self): + pass + + async def asyncTearDown(self): + pass + + def addAsyncCleanup(self, func, /, *args, **kwargs): + # A trivial trampoline to addCleanup() + # the function exists because it has a different semantics + # and signature: + # addCleanup() accepts regular functions + # but addAsyncCleanup() accepts coroutines + # + # We intentionally don't add inspect.iscoroutinefunction() check + # for func argument because there is no way + # to check for async function reliably: + # 1. It can be "async def func()" itself + # 2. Class can implement "async def __call__()" method + # 3. Regular "def func()" that returns awaitable object + self.addCleanup(*(func, *args), **kwargs) + + def _callSetUp(self): + self.setUp() + self._callAsync(self.asyncSetUp) + + def _callTestMethod(self, method): + self._callMaybeAsync(method) + + def _callTearDown(self): + self._callAsync(self.asyncTearDown) + self.tearDown() + + def _callCleanup(self, function, *args, **kwargs): + self._callMaybeAsync(function, *args, **kwargs) + + def _callAsync(self, func, /, *args, **kwargs): + assert self._asyncioTestLoop is not None, 'asyncio test loop is not initialized' + ret = func(*args, **kwargs) + assert inspect.isawaitable(ret), f'{func!r} returned non-awaitable' + fut = self._asyncioTestLoop.create_future() + self._asyncioCallsQueue.put_nowait((fut, ret)) + return self._asyncioTestLoop.run_until_complete(fut) + + def _callMaybeAsync(self, func, /, *args, **kwargs): + assert self._asyncioTestLoop is not None, 'asyncio test loop is not initialized' + ret = func(*args, **kwargs) + if inspect.isawaitable(ret): + fut = self._asyncioTestLoop.create_future() + self._asyncioCallsQueue.put_nowait((fut, ret)) + return self._asyncioTestLoop.run_until_complete(fut) + else: + return ret + + async def _asyncioLoopRunner(self, fut): + self._asyncioCallsQueue = queue = asyncio.Queue() + fut.set_result(None) + while True: + query = await queue.get() + queue.task_done() + if query is None: + return + fut, awaitable = query + try: + ret = await awaitable + if not fut.cancelled(): + fut.set_result(ret) + except (SystemExit, KeyboardInterrupt): + raise + except (BaseException, asyncio.CancelledError) as ex: + if not fut.cancelled(): + fut.set_exception(ex) + + def _setupAsyncioLoop(self): + assert self._asyncioTestLoop is None, 'asyncio test loop already initialized' + loop = asyncio.new_event_loop() + asyncio.set_event_loop(loop) + loop.set_debug(True) + self._asyncioTestLoop = loop + fut = loop.create_future() + self._asyncioCallsTask = loop.create_task(self._asyncioLoopRunner(fut)) + loop.run_until_complete(fut) + + def _tearDownAsyncioLoop(self): + assert self._asyncioTestLoop is not None, 'asyncio test loop is not initialized' + loop = self._asyncioTestLoop + self._asyncioTestLoop = None + self._asyncioCallsQueue.put_nowait(None) + loop.run_until_complete(self._asyncioCallsQueue.join()) + + try: + # cancel all tasks + to_cancel = asyncio.all_tasks(loop) + if not to_cancel: + return + + for task in to_cancel: + task.cancel() + + loop.run_until_complete( + asyncio.gather(*to_cancel, return_exceptions=True)) + + for task in to_cancel: + if task.cancelled(): + continue + if task.exception() is not None: + loop.call_exception_handler({ + 'message': 'unhandled exception during test shutdown', + 'exception': task.exception(), + 'task': task, + }) + # shutdown asyncgens + loop.run_until_complete(loop.shutdown_asyncgens()) + finally: + # Prevent our executor environment from leaking to future tests. + loop.run_until_complete(loop.shutdown_default_executor()) + asyncio.set_event_loop(None) + loop.close() + + def run(self, result=None): + self._setupAsyncioLoop() + try: + return super().run(result) + finally: + self._tearDownAsyncioLoop() + + def debug(self): + self._setupAsyncioLoop() + super().debug() + self._tearDownAsyncioLoop() + + def __del__(self): + if self._asyncioTestLoop is not None: + self._tearDownAsyncioLoop() diff --git a/miniconda3/envs/active_proaction/lib/python3.10/unittest/case.py b/miniconda3/envs/active_proaction/lib/python3.10/unittest/case.py new file mode 100644 index 0000000000000000000000000000000000000000..50100e90e477c86c7e7bd3419486dc717987e3cc --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/unittest/case.py @@ -0,0 +1,1452 @@ +"""Test case implementation""" + +import sys +import functools +import difflib +import pprint +import re +import warnings +import collections +import contextlib +import traceback +import types + +from . import result +from .util import (strclass, safe_repr, _count_diff_all_purpose, + _count_diff_hashable, _common_shorten_repr) + +__unittest = True + +_subtest_msg_sentinel = object() + +DIFF_OMITTED = ('\nDiff is %s characters long. ' + 'Set self.maxDiff to None to see it.') + +class SkipTest(Exception): + """ + Raise this exception in a test to skip it. + + Usually you can use TestCase.skipTest() or one of the skipping decorators + instead of raising this directly. + """ + +class _ShouldStop(Exception): + """ + The test should stop. + """ + +class _UnexpectedSuccess(Exception): + """ + The test was supposed to fail, but it didn't! + """ + + +class _Outcome(object): + def __init__(self, result=None): + self.expecting_failure = False + self.result = result + self.result_supports_subtests = hasattr(result, "addSubTest") + self.success = True + self.skipped = [] + self.expectedFailure = None + self.errors = [] + + @contextlib.contextmanager + def testPartExecutor(self, test_case, isTest=False): + old_success = self.success + self.success = True + try: + yield + except KeyboardInterrupt: + raise + except SkipTest as e: + self.success = False + self.skipped.append((test_case, str(e))) + except _ShouldStop: + pass + except: + exc_info = sys.exc_info() + if self.expecting_failure: + self.expectedFailure = exc_info + else: + self.success = False + self.errors.append((test_case, exc_info)) + # explicitly break a reference cycle: + # exc_info -> frame -> exc_info + exc_info = None + else: + if self.result_supports_subtests and self.success: + self.errors.append((test_case, None)) + finally: + self.success = self.success and old_success + + +def _id(obj): + return obj + + +_module_cleanups = [] +def addModuleCleanup(function, /, *args, **kwargs): + """Same as addCleanup, except the cleanup items are called even if + setUpModule fails (unlike tearDownModule).""" + _module_cleanups.append((function, args, kwargs)) + + +def doModuleCleanups(): + """Execute all module cleanup functions. Normally called for you after + tearDownModule.""" + exceptions = [] + while _module_cleanups: + function, args, kwargs = _module_cleanups.pop() + try: + function(*args, **kwargs) + except Exception as exc: + exceptions.append(exc) + if exceptions: + # Swallows all but first exception. If a multi-exception handler + # gets written we should use that here instead. + raise exceptions[0] + + +def skip(reason): + """ + Unconditionally skip a test. + """ + def decorator(test_item): + if not isinstance(test_item, type): + @functools.wraps(test_item) + def skip_wrapper(*args, **kwargs): + raise SkipTest(reason) + test_item = skip_wrapper + + test_item.__unittest_skip__ = True + test_item.__unittest_skip_why__ = reason + return test_item + if isinstance(reason, types.FunctionType): + test_item = reason + reason = '' + return decorator(test_item) + return decorator + +def skipIf(condition, reason): + """ + Skip a test if the condition is true. + """ + if condition: + return skip(reason) + return _id + +def skipUnless(condition, reason): + """ + Skip a test unless the condition is true. + """ + if not condition: + return skip(reason) + return _id + +def expectedFailure(test_item): + test_item.__unittest_expecting_failure__ = True + return test_item + +def _is_subtype(expected, basetype): + if isinstance(expected, tuple): + return all(_is_subtype(e, basetype) for e in expected) + return isinstance(expected, type) and issubclass(expected, basetype) + +class _BaseTestCaseContext: + + def __init__(self, test_case): + self.test_case = test_case + + def _raiseFailure(self, standardMsg): + msg = self.test_case._formatMessage(self.msg, standardMsg) + raise self.test_case.failureException(msg) + +class _AssertRaisesBaseContext(_BaseTestCaseContext): + + def __init__(self, expected, test_case, expected_regex=None): + _BaseTestCaseContext.__init__(self, test_case) + self.expected = expected + self.test_case = test_case + if expected_regex is not None: + expected_regex = re.compile(expected_regex) + self.expected_regex = expected_regex + self.obj_name = None + self.msg = None + + def handle(self, name, args, kwargs): + """ + If args is empty, assertRaises/Warns is being used as a + context manager, so check for a 'msg' kwarg and return self. + If args is not empty, call a callable passing positional and keyword + arguments. + """ + try: + if not _is_subtype(self.expected, self._base_type): + raise TypeError('%s() arg 1 must be %s' % + (name, self._base_type_str)) + if not args: + self.msg = kwargs.pop('msg', None) + if kwargs: + raise TypeError('%r is an invalid keyword argument for ' + 'this function' % (next(iter(kwargs)),)) + return self + + callable_obj, *args = args + try: + self.obj_name = callable_obj.__name__ + except AttributeError: + self.obj_name = str(callable_obj) + with self: + callable_obj(*args, **kwargs) + finally: + # bpo-23890: manually break a reference cycle + self = None + + +class _AssertRaisesContext(_AssertRaisesBaseContext): + """A context manager used to implement TestCase.assertRaises* methods.""" + + _base_type = BaseException + _base_type_str = 'an exception type or tuple of exception types' + + def __enter__(self): + return self + + def __exit__(self, exc_type, exc_value, tb): + if exc_type is None: + try: + exc_name = self.expected.__name__ + except AttributeError: + exc_name = str(self.expected) + if self.obj_name: + self._raiseFailure("{} not raised by {}".format(exc_name, + self.obj_name)) + else: + self._raiseFailure("{} not raised".format(exc_name)) + else: + traceback.clear_frames(tb) + if not issubclass(exc_type, self.expected): + # let unexpected exceptions pass through + return False + # store exception, without traceback, for later retrieval + self.exception = exc_value.with_traceback(None) + if self.expected_regex is None: + return True + + expected_regex = self.expected_regex + if not expected_regex.search(str(exc_value)): + self._raiseFailure('"{}" does not match "{}"'.format( + expected_regex.pattern, str(exc_value))) + return True + + __class_getitem__ = classmethod(types.GenericAlias) + + +class _AssertWarnsContext(_AssertRaisesBaseContext): + """A context manager used to implement TestCase.assertWarns* methods.""" + + _base_type = Warning + _base_type_str = 'a warning type or tuple of warning types' + + def __enter__(self): + # The __warningregistry__'s need to be in a pristine state for tests + # to work properly. + for v in list(sys.modules.values()): + if getattr(v, '__warningregistry__', None): + v.__warningregistry__ = {} + self.warnings_manager = warnings.catch_warnings(record=True) + self.warnings = self.warnings_manager.__enter__() + warnings.simplefilter("always", self.expected) + return self + + def __exit__(self, exc_type, exc_value, tb): + self.warnings_manager.__exit__(exc_type, exc_value, tb) + if exc_type is not None: + # let unexpected exceptions pass through + return + try: + exc_name = self.expected.__name__ + except AttributeError: + exc_name = str(self.expected) + first_matching = None + for m in self.warnings: + w = m.message + if not isinstance(w, self.expected): + continue + if first_matching is None: + first_matching = w + if (self.expected_regex is not None and + not self.expected_regex.search(str(w))): + continue + # store warning for later retrieval + self.warning = w + self.filename = m.filename + self.lineno = m.lineno + return + # Now we simply try to choose a helpful failure message + if first_matching is not None: + self._raiseFailure('"{}" does not match "{}"'.format( + self.expected_regex.pattern, str(first_matching))) + if self.obj_name: + self._raiseFailure("{} not triggered by {}".format(exc_name, + self.obj_name)) + else: + self._raiseFailure("{} not triggered".format(exc_name)) + + +class _OrderedChainMap(collections.ChainMap): + def __iter__(self): + seen = set() + for mapping in self.maps: + for k in mapping: + if k not in seen: + seen.add(k) + yield k + + +class TestCase(object): + """A class whose instances are single test cases. + + By default, the test code itself should be placed in a method named + 'runTest'. + + If the fixture may be used for many test cases, create as + many test methods as are needed. When instantiating such a TestCase + subclass, specify in the constructor arguments the name of the test method + that the instance is to execute. + + Test authors should subclass TestCase for their own tests. Construction + and deconstruction of the test's environment ('fixture') can be + implemented by overriding the 'setUp' and 'tearDown' methods respectively. + + If it is necessary to override the __init__ method, the base class + __init__ method must always be called. It is important that subclasses + should not change the signature of their __init__ method, since instances + of the classes are instantiated automatically by parts of the framework + in order to be run. + + When subclassing TestCase, you can set these attributes: + * failureException: determines which exception will be raised when + the instance's assertion methods fail; test methods raising this + exception will be deemed to have 'failed' rather than 'errored'. + * longMessage: determines whether long messages (including repr of + objects used in assert methods) will be printed on failure in *addition* + to any explicit message passed. + * maxDiff: sets the maximum length of a diff in failure messages + by assert methods using difflib. It is looked up as an instance + attribute so can be configured by individual tests if required. + """ + + failureException = AssertionError + + longMessage = True + + maxDiff = 80*8 + + # If a string is longer than _diffThreshold, use normal comparison instead + # of difflib. See #11763. + _diffThreshold = 2**16 + + def __init_subclass__(cls, *args, **kwargs): + # Attribute used by TestSuite for classSetUp + cls._classSetupFailed = False + cls._class_cleanups = [] + super().__init_subclass__(*args, **kwargs) + + def __init__(self, methodName='runTest'): + """Create an instance of the class that will use the named test + method when executed. Raises a ValueError if the instance does + not have a method with the specified name. + """ + self._testMethodName = methodName + self._outcome = None + self._testMethodDoc = 'No test' + try: + testMethod = getattr(self, methodName) + except AttributeError: + if methodName != 'runTest': + # we allow instantiation with no explicit method name + # but not an *incorrect* or missing method name + raise ValueError("no such test method in %s: %s" % + (self.__class__, methodName)) + else: + self._testMethodDoc = testMethod.__doc__ + self._cleanups = [] + self._subtest = None + + # Map types to custom assertEqual functions that will compare + # instances of said type in more detail to generate a more useful + # error message. + self._type_equality_funcs = {} + self.addTypeEqualityFunc(dict, 'assertDictEqual') + self.addTypeEqualityFunc(list, 'assertListEqual') + self.addTypeEqualityFunc(tuple, 'assertTupleEqual') + self.addTypeEqualityFunc(set, 'assertSetEqual') + self.addTypeEqualityFunc(frozenset, 'assertSetEqual') + self.addTypeEqualityFunc(str, 'assertMultiLineEqual') + + def addTypeEqualityFunc(self, typeobj, function): + """Add a type specific assertEqual style function to compare a type. + + This method is for use by TestCase subclasses that need to register + their own type equality functions to provide nicer error messages. + + Args: + typeobj: The data type to call this function on when both values + are of the same type in assertEqual(). + function: The callable taking two arguments and an optional + msg= argument that raises self.failureException with a + useful error message when the two arguments are not equal. + """ + self._type_equality_funcs[typeobj] = function + + def addCleanup(self, function, /, *args, **kwargs): + """Add a function, with arguments, to be called when the test is + completed. Functions added are called on a LIFO basis and are + called after tearDown on test failure or success. + + Cleanup items are called even if setUp fails (unlike tearDown).""" + self._cleanups.append((function, args, kwargs)) + + @classmethod + def addClassCleanup(cls, function, /, *args, **kwargs): + """Same as addCleanup, except the cleanup items are called even if + setUpClass fails (unlike tearDownClass).""" + cls._class_cleanups.append((function, args, kwargs)) + + def setUp(self): + "Hook method for setting up the test fixture before exercising it." + pass + + def tearDown(self): + "Hook method for deconstructing the test fixture after testing it." + pass + + @classmethod + def setUpClass(cls): + "Hook method for setting up class fixture before running tests in the class." + + @classmethod + def tearDownClass(cls): + "Hook method for deconstructing the class fixture after running all tests in the class." + + def countTestCases(self): + return 1 + + def defaultTestResult(self): + return result.TestResult() + + def shortDescription(self): + """Returns a one-line description of the test, or None if no + description has been provided. + + The default implementation of this method returns the first line of + the specified test method's docstring. + """ + doc = self._testMethodDoc + return doc.strip().split("\n")[0].strip() if doc else None + + + def id(self): + return "%s.%s" % (strclass(self.__class__), self._testMethodName) + + def __eq__(self, other): + if type(self) is not type(other): + return NotImplemented + + return self._testMethodName == other._testMethodName + + def __hash__(self): + return hash((type(self), self._testMethodName)) + + def __str__(self): + return "%s (%s)" % (self._testMethodName, strclass(self.__class__)) + + def __repr__(self): + return "<%s testMethod=%s>" % \ + (strclass(self.__class__), self._testMethodName) + + def _addSkip(self, result, test_case, reason): + addSkip = getattr(result, 'addSkip', None) + if addSkip is not None: + addSkip(test_case, reason) + else: + warnings.warn("TestResult has no addSkip method, skips not reported", + RuntimeWarning, 2) + result.addSuccess(test_case) + + @contextlib.contextmanager + def subTest(self, msg=_subtest_msg_sentinel, **params): + """Return a context manager that will return the enclosed block + of code in a subtest identified by the optional message and + keyword parameters. A failure in the subtest marks the test + case as failed but resumes execution at the end of the enclosed + block, allowing further test code to be executed. + """ + if self._outcome is None or not self._outcome.result_supports_subtests: + yield + return + parent = self._subtest + if parent is None: + params_map = _OrderedChainMap(params) + else: + params_map = parent.params.new_child(params) + self._subtest = _SubTest(self, msg, params_map) + try: + with self._outcome.testPartExecutor(self._subtest, isTest=True): + yield + if not self._outcome.success: + result = self._outcome.result + if result is not None and result.failfast: + raise _ShouldStop + elif self._outcome.expectedFailure: + # If the test is expecting a failure, we really want to + # stop now and register the expected failure. + raise _ShouldStop + finally: + self._subtest = parent + + def _feedErrorsToResult(self, result, errors): + for test, exc_info in errors: + if isinstance(test, _SubTest): + result.addSubTest(test.test_case, test, exc_info) + elif exc_info is not None: + if issubclass(exc_info[0], self.failureException): + result.addFailure(test, exc_info) + else: + result.addError(test, exc_info) + + def _addExpectedFailure(self, result, exc_info): + try: + addExpectedFailure = result.addExpectedFailure + except AttributeError: + warnings.warn("TestResult has no addExpectedFailure method, reporting as passes", + RuntimeWarning) + result.addSuccess(self) + else: + addExpectedFailure(self, exc_info) + + def _addUnexpectedSuccess(self, result): + try: + addUnexpectedSuccess = result.addUnexpectedSuccess + except AttributeError: + warnings.warn("TestResult has no addUnexpectedSuccess method, reporting as failure", + RuntimeWarning) + # We need to pass an actual exception and traceback to addFailure, + # otherwise the legacy result can choke. + try: + raise _UnexpectedSuccess from None + except _UnexpectedSuccess: + result.addFailure(self, sys.exc_info()) + else: + addUnexpectedSuccess(self) + + def _callSetUp(self): + self.setUp() + + def _callTestMethod(self, method): + method() + + def _callTearDown(self): + self.tearDown() + + def _callCleanup(self, function, /, *args, **kwargs): + function(*args, **kwargs) + + def run(self, result=None): + if result is None: + result = self.defaultTestResult() + startTestRun = getattr(result, 'startTestRun', None) + stopTestRun = getattr(result, 'stopTestRun', None) + if startTestRun is not None: + startTestRun() + else: + stopTestRun = None + + result.startTest(self) + try: + testMethod = getattr(self, self._testMethodName) + if (getattr(self.__class__, "__unittest_skip__", False) or + getattr(testMethod, "__unittest_skip__", False)): + # If the class or method was skipped. + skip_why = (getattr(self.__class__, '__unittest_skip_why__', '') + or getattr(testMethod, '__unittest_skip_why__', '')) + self._addSkip(result, self, skip_why) + return result + + expecting_failure = ( + getattr(self, "__unittest_expecting_failure__", False) or + getattr(testMethod, "__unittest_expecting_failure__", False) + ) + outcome = _Outcome(result) + try: + self._outcome = outcome + + with outcome.testPartExecutor(self): + self._callSetUp() + if outcome.success: + outcome.expecting_failure = expecting_failure + with outcome.testPartExecutor(self, isTest=True): + self._callTestMethod(testMethod) + outcome.expecting_failure = False + with outcome.testPartExecutor(self): + self._callTearDown() + + self.doCleanups() + for test, reason in outcome.skipped: + self._addSkip(result, test, reason) + self._feedErrorsToResult(result, outcome.errors) + if outcome.success: + if expecting_failure: + if outcome.expectedFailure: + self._addExpectedFailure(result, outcome.expectedFailure) + else: + self._addUnexpectedSuccess(result) + else: + result.addSuccess(self) + return result + finally: + # explicitly break reference cycles: + # outcome.errors -> frame -> outcome -> outcome.errors + # outcome.expectedFailure -> frame -> outcome -> outcome.expectedFailure + outcome.errors.clear() + outcome.expectedFailure = None + + # clear the outcome, no more needed + self._outcome = None + + finally: + result.stopTest(self) + if stopTestRun is not None: + stopTestRun() + + def doCleanups(self): + """Execute all cleanup functions. Normally called for you after + tearDown.""" + outcome = self._outcome or _Outcome() + while self._cleanups: + function, args, kwargs = self._cleanups.pop() + with outcome.testPartExecutor(self): + self._callCleanup(function, *args, **kwargs) + + # return this for backwards compatibility + # even though we no longer use it internally + return outcome.success + + @classmethod + def doClassCleanups(cls): + """Execute all class cleanup functions. Normally called for you after + tearDownClass.""" + cls.tearDown_exceptions = [] + while cls._class_cleanups: + function, args, kwargs = cls._class_cleanups.pop() + try: + function(*args, **kwargs) + except Exception: + cls.tearDown_exceptions.append(sys.exc_info()) + + def __call__(self, *args, **kwds): + return self.run(*args, **kwds) + + def debug(self): + """Run the test without collecting errors in a TestResult""" + testMethod = getattr(self, self._testMethodName) + if (getattr(self.__class__, "__unittest_skip__", False) or + getattr(testMethod, "__unittest_skip__", False)): + # If the class or method was skipped. + skip_why = (getattr(self.__class__, '__unittest_skip_why__', '') + or getattr(testMethod, '__unittest_skip_why__', '')) + raise SkipTest(skip_why) + + self._callSetUp() + self._callTestMethod(testMethod) + self._callTearDown() + while self._cleanups: + function, args, kwargs = self._cleanups.pop() + self._callCleanup(function, *args, **kwargs) + + def skipTest(self, reason): + """Skip this test.""" + raise SkipTest(reason) + + def fail(self, msg=None): + """Fail immediately, with the given message.""" + raise self.failureException(msg) + + def assertFalse(self, expr, msg=None): + """Check that the expression is false.""" + if expr: + msg = self._formatMessage(msg, "%s is not false" % safe_repr(expr)) + raise self.failureException(msg) + + def assertTrue(self, expr, msg=None): + """Check that the expression is true.""" + if not expr: + msg = self._formatMessage(msg, "%s is not true" % safe_repr(expr)) + raise self.failureException(msg) + + def _formatMessage(self, msg, standardMsg): + """Honour the longMessage attribute when generating failure messages. + If longMessage is False this means: + * Use only an explicit message if it is provided + * Otherwise use the standard message for the assert + + If longMessage is True: + * Use the standard message + * If an explicit message is provided, plus ' : ' and the explicit message + """ + if not self.longMessage: + return msg or standardMsg + if msg is None: + return standardMsg + try: + # don't switch to '{}' formatting in Python 2.X + # it changes the way unicode input is handled + return '%s : %s' % (standardMsg, msg) + except UnicodeDecodeError: + return '%s : %s' % (safe_repr(standardMsg), safe_repr(msg)) + + def assertRaises(self, expected_exception, *args, **kwargs): + """Fail unless an exception of class expected_exception is raised + by the callable when invoked with specified positional and + keyword arguments. If a different type of exception is + raised, it will not be caught, and the test case will be + deemed to have suffered an error, exactly as for an + unexpected exception. + + If called with the callable and arguments omitted, will return a + context object used like this:: + + with self.assertRaises(SomeException): + do_something() + + An optional keyword argument 'msg' can be provided when assertRaises + is used as a context object. + + The context manager keeps a reference to the exception as + the 'exception' attribute. This allows you to inspect the + exception after the assertion:: + + with self.assertRaises(SomeException) as cm: + do_something() + the_exception = cm.exception + self.assertEqual(the_exception.error_code, 3) + """ + context = _AssertRaisesContext(expected_exception, self) + try: + return context.handle('assertRaises', args, kwargs) + finally: + # bpo-23890: manually break a reference cycle + context = None + + def assertWarns(self, expected_warning, *args, **kwargs): + """Fail unless a warning of class warnClass is triggered + by the callable when invoked with specified positional and + keyword arguments. If a different type of warning is + triggered, it will not be handled: depending on the other + warning filtering rules in effect, it might be silenced, printed + out, or raised as an exception. + + If called with the callable and arguments omitted, will return a + context object used like this:: + + with self.assertWarns(SomeWarning): + do_something() + + An optional keyword argument 'msg' can be provided when assertWarns + is used as a context object. + + The context manager keeps a reference to the first matching + warning as the 'warning' attribute; similarly, the 'filename' + and 'lineno' attributes give you information about the line + of Python code from which the warning was triggered. + This allows you to inspect the warning after the assertion:: + + with self.assertWarns(SomeWarning) as cm: + do_something() + the_warning = cm.warning + self.assertEqual(the_warning.some_attribute, 147) + """ + context = _AssertWarnsContext(expected_warning, self) + return context.handle('assertWarns', args, kwargs) + + def assertLogs(self, logger=None, level=None): + """Fail unless a log message of level *level* or higher is emitted + on *logger_name* or its children. If omitted, *level* defaults to + INFO and *logger* defaults to the root logger. + + This method must be used as a context manager, and will yield + a recording object with two attributes: `output` and `records`. + At the end of the context manager, the `output` attribute will + be a list of the matching formatted log messages and the + `records` attribute will be a list of the corresponding LogRecord + objects. + + Example:: + + with self.assertLogs('foo', level='INFO') as cm: + logging.getLogger('foo').info('first message') + logging.getLogger('foo.bar').error('second message') + self.assertEqual(cm.output, ['INFO:foo:first message', + 'ERROR:foo.bar:second message']) + """ + # Lazy import to avoid importing logging if it is not needed. + from ._log import _AssertLogsContext + return _AssertLogsContext(self, logger, level, no_logs=False) + + def assertNoLogs(self, logger=None, level=None): + """ Fail unless no log messages of level *level* or higher are emitted + on *logger_name* or its children. + + This method must be used as a context manager. + """ + from ._log import _AssertLogsContext + return _AssertLogsContext(self, logger, level, no_logs=True) + + def _getAssertEqualityFunc(self, first, second): + """Get a detailed comparison function for the types of the two args. + + Returns: A callable accepting (first, second, msg=None) that will + raise a failure exception if first != second with a useful human + readable error message for those types. + """ + # + # NOTE(gregory.p.smith): I considered isinstance(first, type(second)) + # and vice versa. I opted for the conservative approach in case + # subclasses are not intended to be compared in detail to their super + # class instances using a type equality func. This means testing + # subtypes won't automagically use the detailed comparison. Callers + # should use their type specific assertSpamEqual method to compare + # subclasses if the detailed comparison is desired and appropriate. + # See the discussion in http://bugs.python.org/issue2578. + # + if type(first) is type(second): + asserter = self._type_equality_funcs.get(type(first)) + if asserter is not None: + if isinstance(asserter, str): + asserter = getattr(self, asserter) + return asserter + + return self._baseAssertEqual + + def _baseAssertEqual(self, first, second, msg=None): + """The default assertEqual implementation, not type specific.""" + if not first == second: + standardMsg = '%s != %s' % _common_shorten_repr(first, second) + msg = self._formatMessage(msg, standardMsg) + raise self.failureException(msg) + + def assertEqual(self, first, second, msg=None): + """Fail if the two objects are unequal as determined by the '==' + operator. + """ + assertion_func = self._getAssertEqualityFunc(first, second) + assertion_func(first, second, msg=msg) + + def assertNotEqual(self, first, second, msg=None): + """Fail if the two objects are equal as determined by the '!=' + operator. + """ + if not first != second: + msg = self._formatMessage(msg, '%s == %s' % (safe_repr(first), + safe_repr(second))) + raise self.failureException(msg) + + def assertAlmostEqual(self, first, second, places=None, msg=None, + delta=None): + """Fail if the two objects are unequal as determined by their + difference rounded to the given number of decimal places + (default 7) and comparing to zero, or by comparing that the + difference between the two objects is more than the given + delta. + + Note that decimal places (from zero) are usually not the same + as significant digits (measured from the most significant digit). + + If the two objects compare equal then they will automatically + compare almost equal. + """ + if first == second: + # shortcut + return + if delta is not None and places is not None: + raise TypeError("specify delta or places not both") + + diff = abs(first - second) + if delta is not None: + if diff <= delta: + return + + standardMsg = '%s != %s within %s delta (%s difference)' % ( + safe_repr(first), + safe_repr(second), + safe_repr(delta), + safe_repr(diff)) + else: + if places is None: + places = 7 + + if round(diff, places) == 0: + return + + standardMsg = '%s != %s within %r places (%s difference)' % ( + safe_repr(first), + safe_repr(second), + places, + safe_repr(diff)) + msg = self._formatMessage(msg, standardMsg) + raise self.failureException(msg) + + def assertNotAlmostEqual(self, first, second, places=None, msg=None, + delta=None): + """Fail if the two objects are equal as determined by their + difference rounded to the given number of decimal places + (default 7) and comparing to zero, or by comparing that the + difference between the two objects is less than the given delta. + + Note that decimal places (from zero) are usually not the same + as significant digits (measured from the most significant digit). + + Objects that are equal automatically fail. + """ + if delta is not None and places is not None: + raise TypeError("specify delta or places not both") + diff = abs(first - second) + if delta is not None: + if not (first == second) and diff > delta: + return + standardMsg = '%s == %s within %s delta (%s difference)' % ( + safe_repr(first), + safe_repr(second), + safe_repr(delta), + safe_repr(diff)) + else: + if places is None: + places = 7 + if not (first == second) and round(diff, places) != 0: + return + standardMsg = '%s == %s within %r places' % (safe_repr(first), + safe_repr(second), + places) + + msg = self._formatMessage(msg, standardMsg) + raise self.failureException(msg) + + def assertSequenceEqual(self, seq1, seq2, msg=None, seq_type=None): + """An equality assertion for ordered sequences (like lists and tuples). + + For the purposes of this function, a valid ordered sequence type is one + which can be indexed, has a length, and has an equality operator. + + Args: + seq1: The first sequence to compare. + seq2: The second sequence to compare. + seq_type: The expected datatype of the sequences, or None if no + datatype should be enforced. + msg: Optional message to use on failure instead of a list of + differences. + """ + if seq_type is not None: + seq_type_name = seq_type.__name__ + if not isinstance(seq1, seq_type): + raise self.failureException('First sequence is not a %s: %s' + % (seq_type_name, safe_repr(seq1))) + if not isinstance(seq2, seq_type): + raise self.failureException('Second sequence is not a %s: %s' + % (seq_type_name, safe_repr(seq2))) + else: + seq_type_name = "sequence" + + differing = None + try: + len1 = len(seq1) + except (TypeError, NotImplementedError): + differing = 'First %s has no length. Non-sequence?' % ( + seq_type_name) + + if differing is None: + try: + len2 = len(seq2) + except (TypeError, NotImplementedError): + differing = 'Second %s has no length. Non-sequence?' % ( + seq_type_name) + + if differing is None: + if seq1 == seq2: + return + + differing = '%ss differ: %s != %s\n' % ( + (seq_type_name.capitalize(),) + + _common_shorten_repr(seq1, seq2)) + + for i in range(min(len1, len2)): + try: + item1 = seq1[i] + except (TypeError, IndexError, NotImplementedError): + differing += ('\nUnable to index element %d of first %s\n' % + (i, seq_type_name)) + break + + try: + item2 = seq2[i] + except (TypeError, IndexError, NotImplementedError): + differing += ('\nUnable to index element %d of second %s\n' % + (i, seq_type_name)) + break + + if item1 != item2: + differing += ('\nFirst differing element %d:\n%s\n%s\n' % + ((i,) + _common_shorten_repr(item1, item2))) + break + else: + if (len1 == len2 and seq_type is None and + type(seq1) != type(seq2)): + # The sequences are the same, but have differing types. + return + + if len1 > len2: + differing += ('\nFirst %s contains %d additional ' + 'elements.\n' % (seq_type_name, len1 - len2)) + try: + differing += ('First extra element %d:\n%s\n' % + (len2, safe_repr(seq1[len2]))) + except (TypeError, IndexError, NotImplementedError): + differing += ('Unable to index element %d ' + 'of first %s\n' % (len2, seq_type_name)) + elif len1 < len2: + differing += ('\nSecond %s contains %d additional ' + 'elements.\n' % (seq_type_name, len2 - len1)) + try: + differing += ('First extra element %d:\n%s\n' % + (len1, safe_repr(seq2[len1]))) + except (TypeError, IndexError, NotImplementedError): + differing += ('Unable to index element %d ' + 'of second %s\n' % (len1, seq_type_name)) + standardMsg = differing + diffMsg = '\n' + '\n'.join( + difflib.ndiff(pprint.pformat(seq1).splitlines(), + pprint.pformat(seq2).splitlines())) + + standardMsg = self._truncateMessage(standardMsg, diffMsg) + msg = self._formatMessage(msg, standardMsg) + self.fail(msg) + + def _truncateMessage(self, message, diff): + max_diff = self.maxDiff + if max_diff is None or len(diff) <= max_diff: + return message + diff + return message + (DIFF_OMITTED % len(diff)) + + def assertListEqual(self, list1, list2, msg=None): + """A list-specific equality assertion. + + Args: + list1: The first list to compare. + list2: The second list to compare. + msg: Optional message to use on failure instead of a list of + differences. + + """ + self.assertSequenceEqual(list1, list2, msg, seq_type=list) + + def assertTupleEqual(self, tuple1, tuple2, msg=None): + """A tuple-specific equality assertion. + + Args: + tuple1: The first tuple to compare. + tuple2: The second tuple to compare. + msg: Optional message to use on failure instead of a list of + differences. + """ + self.assertSequenceEqual(tuple1, tuple2, msg, seq_type=tuple) + + def assertSetEqual(self, set1, set2, msg=None): + """A set-specific equality assertion. + + Args: + set1: The first set to compare. + set2: The second set to compare. + msg: Optional message to use on failure instead of a list of + differences. + + assertSetEqual uses ducktyping to support different types of sets, and + is optimized for sets specifically (parameters must support a + difference method). + """ + try: + difference1 = set1.difference(set2) + except TypeError as e: + self.fail('invalid type when attempting set difference: %s' % e) + except AttributeError as e: + self.fail('first argument does not support set difference: %s' % e) + + try: + difference2 = set2.difference(set1) + except TypeError as e: + self.fail('invalid type when attempting set difference: %s' % e) + except AttributeError as e: + self.fail('second argument does not support set difference: %s' % e) + + if not (difference1 or difference2): + return + + lines = [] + if difference1: + lines.append('Items in the first set but not the second:') + for item in difference1: + lines.append(repr(item)) + if difference2: + lines.append('Items in the second set but not the first:') + for item in difference2: + lines.append(repr(item)) + + standardMsg = '\n'.join(lines) + self.fail(self._formatMessage(msg, standardMsg)) + + def assertIn(self, member, container, msg=None): + """Just like self.assertTrue(a in b), but with a nicer default message.""" + if member not in container: + standardMsg = '%s not found in %s' % (safe_repr(member), + safe_repr(container)) + self.fail(self._formatMessage(msg, standardMsg)) + + def assertNotIn(self, member, container, msg=None): + """Just like self.assertTrue(a not in b), but with a nicer default message.""" + if member in container: + standardMsg = '%s unexpectedly found in %s' % (safe_repr(member), + safe_repr(container)) + self.fail(self._formatMessage(msg, standardMsg)) + + def assertIs(self, expr1, expr2, msg=None): + """Just like self.assertTrue(a is b), but with a nicer default message.""" + if expr1 is not expr2: + standardMsg = '%s is not %s' % (safe_repr(expr1), + safe_repr(expr2)) + self.fail(self._formatMessage(msg, standardMsg)) + + def assertIsNot(self, expr1, expr2, msg=None): + """Just like self.assertTrue(a is not b), but with a nicer default message.""" + if expr1 is expr2: + standardMsg = 'unexpectedly identical: %s' % (safe_repr(expr1),) + self.fail(self._formatMessage(msg, standardMsg)) + + def assertDictEqual(self, d1, d2, msg=None): + self.assertIsInstance(d1, dict, 'First argument is not a dictionary') + self.assertIsInstance(d2, dict, 'Second argument is not a dictionary') + + if d1 != d2: + standardMsg = '%s != %s' % _common_shorten_repr(d1, d2) + diff = ('\n' + '\n'.join(difflib.ndiff( + pprint.pformat(d1).splitlines(), + pprint.pformat(d2).splitlines()))) + standardMsg = self._truncateMessage(standardMsg, diff) + self.fail(self._formatMessage(msg, standardMsg)) + + def assertDictContainsSubset(self, subset, dictionary, msg=None): + """Checks whether dictionary is a superset of subset.""" + warnings.warn('assertDictContainsSubset is deprecated', + DeprecationWarning, + stacklevel=2) + missing = [] + mismatched = [] + for key, value in subset.items(): + if key not in dictionary: + missing.append(key) + elif value != dictionary[key]: + mismatched.append('%s, expected: %s, actual: %s' % + (safe_repr(key), safe_repr(value), + safe_repr(dictionary[key]))) + + if not (missing or mismatched): + return + + standardMsg = '' + if missing: + standardMsg = 'Missing: %s' % ','.join(safe_repr(m) for m in + missing) + if mismatched: + if standardMsg: + standardMsg += '; ' + standardMsg += 'Mismatched values: %s' % ','.join(mismatched) + + self.fail(self._formatMessage(msg, standardMsg)) + + + def assertCountEqual(self, first, second, msg=None): + """Asserts that two iterables have the same elements, the same number of + times, without regard to order. + + self.assertEqual(Counter(list(first)), + Counter(list(second))) + + Example: + - [0, 1, 1] and [1, 0, 1] compare equal. + - [0, 0, 1] and [0, 1] compare unequal. + + """ + first_seq, second_seq = list(first), list(second) + try: + first = collections.Counter(first_seq) + second = collections.Counter(second_seq) + except TypeError: + # Handle case with unhashable elements + differences = _count_diff_all_purpose(first_seq, second_seq) + else: + if first == second: + return + differences = _count_diff_hashable(first_seq, second_seq) + + if differences: + standardMsg = 'Element counts were not equal:\n' + lines = ['First has %d, Second has %d: %r' % diff for diff in differences] + diffMsg = '\n'.join(lines) + standardMsg = self._truncateMessage(standardMsg, diffMsg) + msg = self._formatMessage(msg, standardMsg) + self.fail(msg) + + def assertMultiLineEqual(self, first, second, msg=None): + """Assert that two multi-line strings are equal.""" + self.assertIsInstance(first, str, 'First argument is not a string') + self.assertIsInstance(second, str, 'Second argument is not a string') + + if first != second: + # don't use difflib if the strings are too long + if (len(first) > self._diffThreshold or + len(second) > self._diffThreshold): + self._baseAssertEqual(first, second, msg) + firstlines = first.splitlines(keepends=True) + secondlines = second.splitlines(keepends=True) + if len(firstlines) == 1 and first.strip('\r\n') == first: + firstlines = [first + '\n'] + secondlines = [second + '\n'] + standardMsg = '%s != %s' % _common_shorten_repr(first, second) + diff = '\n' + ''.join(difflib.ndiff(firstlines, secondlines)) + standardMsg = self._truncateMessage(standardMsg, diff) + self.fail(self._formatMessage(msg, standardMsg)) + + def assertLess(self, a, b, msg=None): + """Just like self.assertTrue(a < b), but with a nicer default message.""" + if not a < b: + standardMsg = '%s not less than %s' % (safe_repr(a), safe_repr(b)) + self.fail(self._formatMessage(msg, standardMsg)) + + def assertLessEqual(self, a, b, msg=None): + """Just like self.assertTrue(a <= b), but with a nicer default message.""" + if not a <= b: + standardMsg = '%s not less than or equal to %s' % (safe_repr(a), safe_repr(b)) + self.fail(self._formatMessage(msg, standardMsg)) + + def assertGreater(self, a, b, msg=None): + """Just like self.assertTrue(a > b), but with a nicer default message.""" + if not a > b: + standardMsg = '%s not greater than %s' % (safe_repr(a), safe_repr(b)) + self.fail(self._formatMessage(msg, standardMsg)) + + def assertGreaterEqual(self, a, b, msg=None): + """Just like self.assertTrue(a >= b), but with a nicer default message.""" + if not a >= b: + standardMsg = '%s not greater than or equal to %s' % (safe_repr(a), safe_repr(b)) + self.fail(self._formatMessage(msg, standardMsg)) + + def assertIsNone(self, obj, msg=None): + """Same as self.assertTrue(obj is None), with a nicer default message.""" + if obj is not None: + standardMsg = '%s is not None' % (safe_repr(obj),) + self.fail(self._formatMessage(msg, standardMsg)) + + def assertIsNotNone(self, obj, msg=None): + """Included for symmetry with assertIsNone.""" + if obj is None: + standardMsg = 'unexpectedly None' + self.fail(self._formatMessage(msg, standardMsg)) + + def assertIsInstance(self, obj, cls, msg=None): + """Same as self.assertTrue(isinstance(obj, cls)), with a nicer + default message.""" + if not isinstance(obj, cls): + standardMsg = '%s is not an instance of %r' % (safe_repr(obj), cls) + self.fail(self._formatMessage(msg, standardMsg)) + + def assertNotIsInstance(self, obj, cls, msg=None): + """Included for symmetry with assertIsInstance.""" + if isinstance(obj, cls): + standardMsg = '%s is an instance of %r' % (safe_repr(obj), cls) + self.fail(self._formatMessage(msg, standardMsg)) + + def assertRaisesRegex(self, expected_exception, expected_regex, + *args, **kwargs): + """Asserts that the message in a raised exception matches a regex. + + Args: + expected_exception: Exception class expected to be raised. + expected_regex: Regex (re.Pattern object or string) expected + to be found in error message. + args: Function to be called and extra positional args. + kwargs: Extra kwargs. + msg: Optional message used in case of failure. Can only be used + when assertRaisesRegex is used as a context manager. + """ + context = _AssertRaisesContext(expected_exception, self, expected_regex) + return context.handle('assertRaisesRegex', args, kwargs) + + def assertWarnsRegex(self, expected_warning, expected_regex, + *args, **kwargs): + """Asserts that the message in a triggered warning matches a regexp. + Basic functioning is similar to assertWarns() with the addition + that only warnings whose messages also match the regular expression + are considered successful matches. + + Args: + expected_warning: Warning class expected to be triggered. + expected_regex: Regex (re.Pattern object or string) expected + to be found in error message. + args: Function to be called and extra positional args. + kwargs: Extra kwargs. + msg: Optional message used in case of failure. Can only be used + when assertWarnsRegex is used as a context manager. + """ + context = _AssertWarnsContext(expected_warning, self, expected_regex) + return context.handle('assertWarnsRegex', args, kwargs) + + def assertRegex(self, text, expected_regex, msg=None): + """Fail the test unless the text matches the regular expression.""" + if isinstance(expected_regex, (str, bytes)): + assert expected_regex, "expected_regex must not be empty." + expected_regex = re.compile(expected_regex) + if not expected_regex.search(text): + standardMsg = "Regex didn't match: %r not found in %r" % ( + expected_regex.pattern, text) + # _formatMessage ensures the longMessage option is respected + msg = self._formatMessage(msg, standardMsg) + raise self.failureException(msg) + + def assertNotRegex(self, text, unexpected_regex, msg=None): + """Fail the test if the text matches the regular expression.""" + if isinstance(unexpected_regex, (str, bytes)): + unexpected_regex = re.compile(unexpected_regex) + match = unexpected_regex.search(text) + if match: + standardMsg = 'Regex matched: %r matches %r in %r' % ( + text[match.start() : match.end()], + unexpected_regex.pattern, + text) + # _formatMessage ensures the longMessage option is respected + msg = self._formatMessage(msg, standardMsg) + raise self.failureException(msg) + + + def _deprecate(original_func): + def deprecated_func(*args, **kwargs): + warnings.warn( + 'Please use {0} instead.'.format(original_func.__name__), + DeprecationWarning, 2) + return original_func(*args, **kwargs) + return deprecated_func + + # see #9424 + failUnlessEqual = assertEquals = _deprecate(assertEqual) + failIfEqual = assertNotEquals = _deprecate(assertNotEqual) + failUnlessAlmostEqual = assertAlmostEquals = _deprecate(assertAlmostEqual) + failIfAlmostEqual = assertNotAlmostEquals = _deprecate(assertNotAlmostEqual) + failUnless = assert_ = _deprecate(assertTrue) + failUnlessRaises = _deprecate(assertRaises) + failIf = _deprecate(assertFalse) + assertRaisesRegexp = _deprecate(assertRaisesRegex) + assertRegexpMatches = _deprecate(assertRegex) + assertNotRegexpMatches = _deprecate(assertNotRegex) + + + +class FunctionTestCase(TestCase): + """A test case that wraps a test function. + + This is useful for slipping pre-existing test functions into the + unittest framework. Optionally, set-up and tidy-up functions can be + supplied. As with TestCase, the tidy-up ('tearDown') function will + always be called if the set-up ('setUp') function ran successfully. + """ + + def __init__(self, testFunc, setUp=None, tearDown=None, description=None): + super(FunctionTestCase, self).__init__() + self._setUpFunc = setUp + self._tearDownFunc = tearDown + self._testFunc = testFunc + self._description = description + + def setUp(self): + if self._setUpFunc is not None: + self._setUpFunc() + + def tearDown(self): + if self._tearDownFunc is not None: + self._tearDownFunc() + + def runTest(self): + self._testFunc() + + def id(self): + return self._testFunc.__name__ + + def __eq__(self, other): + if not isinstance(other, self.__class__): + return NotImplemented + + return self._setUpFunc == other._setUpFunc and \ + self._tearDownFunc == other._tearDownFunc and \ + self._testFunc == other._testFunc and \ + self._description == other._description + + def __hash__(self): + return hash((type(self), self._setUpFunc, self._tearDownFunc, + self._testFunc, self._description)) + + def __str__(self): + return "%s (%s)" % (strclass(self.__class__), + self._testFunc.__name__) + + def __repr__(self): + return "<%s tec=%s>" % (strclass(self.__class__), + self._testFunc) + + def shortDescription(self): + if self._description is not None: + return self._description + doc = self._testFunc.__doc__ + return doc and doc.split("\n")[0].strip() or None + + +class _SubTest(TestCase): + + def __init__(self, test_case, message, params): + super().__init__() + self._message = message + self.test_case = test_case + self.params = params + self.failureException = test_case.failureException + + def runTest(self): + raise NotImplementedError("subtests cannot be run directly") + + def _subDescription(self): + parts = [] + if self._message is not _subtest_msg_sentinel: + parts.append("[{}]".format(self._message)) + if self.params: + params_desc = ', '.join( + "{}={!r}".format(k, v) + for (k, v) in self.params.items()) + parts.append("({})".format(params_desc)) + return " ".join(parts) or '()' + + def id(self): + return "{} {}".format(self.test_case.id(), self._subDescription()) + + def shortDescription(self): + """Returns a one-line description of the subtest, or None if no + description has been provided. + """ + return self.test_case.shortDescription() + + def __str__(self): + return "{} {}".format(self.test_case, self._subDescription()) diff --git a/miniconda3/envs/active_proaction/lib/python3.10/unittest/loader.py b/miniconda3/envs/active_proaction/lib/python3.10/unittest/loader.py new file mode 100644 index 0000000000000000000000000000000000000000..ba7105e1ad6039ffbd3f9ea61566d1e6e204954d --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/unittest/loader.py @@ -0,0 +1,517 @@ +"""Loading unittests.""" + +import os +import re +import sys +import traceback +import types +import functools +import warnings + +from fnmatch import fnmatch, fnmatchcase + +from . import case, suite, util + +__unittest = True + +# what about .pyc (etc) +# we would need to avoid loading the same tests multiple times +# from '.py', *and* '.pyc' +VALID_MODULE_NAME = re.compile(r'[_a-z]\w*\.py$', re.IGNORECASE) + + +class _FailedTest(case.TestCase): + _testMethodName = None + + def __init__(self, method_name, exception): + self._exception = exception + super(_FailedTest, self).__init__(method_name) + + def __getattr__(self, name): + if name != self._testMethodName: + return super(_FailedTest, self).__getattr__(name) + def testFailure(): + raise self._exception + return testFailure + + +def _make_failed_import_test(name, suiteClass): + message = 'Failed to import test module: %s\n%s' % ( + name, traceback.format_exc()) + return _make_failed_test(name, ImportError(message), suiteClass, message) + +def _make_failed_load_tests(name, exception, suiteClass): + message = 'Failed to call load_tests:\n%s' % (traceback.format_exc(),) + return _make_failed_test( + name, exception, suiteClass, message) + +def _make_failed_test(methodname, exception, suiteClass, message): + test = _FailedTest(methodname, exception) + return suiteClass((test,)), message + +def _make_skipped_test(methodname, exception, suiteClass): + @case.skip(str(exception)) + def testSkipped(self): + pass + attrs = {methodname: testSkipped} + TestClass = type("ModuleSkipped", (case.TestCase,), attrs) + return suiteClass((TestClass(methodname),)) + +def _jython_aware_splitext(path): + if path.lower().endswith('$py.class'): + return path[:-9] + return os.path.splitext(path)[0] + + +class TestLoader(object): + """ + This class is responsible for loading tests according to various criteria + and returning them wrapped in a TestSuite + """ + testMethodPrefix = 'test' + sortTestMethodsUsing = staticmethod(util.three_way_cmp) + testNamePatterns = None + suiteClass = suite.TestSuite + _top_level_dir = None + + def __init__(self): + super(TestLoader, self).__init__() + self.errors = [] + # Tracks packages which we have called into via load_tests, to + # avoid infinite re-entrancy. + self._loading_packages = set() + + def loadTestsFromTestCase(self, testCaseClass): + """Return a suite of all test cases contained in testCaseClass""" + if issubclass(testCaseClass, suite.TestSuite): + raise TypeError("Test cases should not be derived from " + "TestSuite. Maybe you meant to derive from " + "TestCase?") + testCaseNames = self.getTestCaseNames(testCaseClass) + if not testCaseNames and hasattr(testCaseClass, 'runTest'): + testCaseNames = ['runTest'] + loaded_suite = self.suiteClass(map(testCaseClass, testCaseNames)) + return loaded_suite + + # XXX After Python 3.5, remove backward compatibility hacks for + # use_load_tests deprecation via *args and **kws. See issue 16662. + def loadTestsFromModule(self, module, *args, pattern=None, **kws): + """Return a suite of all test cases contained in the given module""" + # This method used to take an undocumented and unofficial + # use_load_tests argument. For backward compatibility, we still + # accept the argument (which can also be the first position) but we + # ignore it and issue a deprecation warning if it's present. + if len(args) > 0 or 'use_load_tests' in kws: + warnings.warn('use_load_tests is deprecated and ignored', + DeprecationWarning) + kws.pop('use_load_tests', None) + if len(args) > 1: + # Complain about the number of arguments, but don't forget the + # required `module` argument. + complaint = len(args) + 1 + raise TypeError('loadTestsFromModule() takes 1 positional argument but {} were given'.format(complaint)) + if len(kws) != 0: + # Since the keyword arguments are unsorted (see PEP 468), just + # pick the alphabetically sorted first argument to complain about, + # if multiple were given. At least the error message will be + # predictable. + complaint = sorted(kws)[0] + raise TypeError("loadTestsFromModule() got an unexpected keyword argument '{}'".format(complaint)) + tests = [] + for name in dir(module): + obj = getattr(module, name) + if isinstance(obj, type) and issubclass(obj, case.TestCase): + tests.append(self.loadTestsFromTestCase(obj)) + + load_tests = getattr(module, 'load_tests', None) + tests = self.suiteClass(tests) + if load_tests is not None: + try: + return load_tests(self, tests, pattern) + except Exception as e: + error_case, error_message = _make_failed_load_tests( + module.__name__, e, self.suiteClass) + self.errors.append(error_message) + return error_case + return tests + + def loadTestsFromName(self, name, module=None): + """Return a suite of all test cases given a string specifier. + + The name may resolve either to a module, a test case class, a + test method within a test case class, or a callable object which + returns a TestCase or TestSuite instance. + + The method optionally resolves the names relative to a given module. + """ + parts = name.split('.') + error_case, error_message = None, None + if module is None: + parts_copy = parts[:] + while parts_copy: + try: + module_name = '.'.join(parts_copy) + module = __import__(module_name) + break + except ImportError: + next_attribute = parts_copy.pop() + # Last error so we can give it to the user if needed. + error_case, error_message = _make_failed_import_test( + next_attribute, self.suiteClass) + if not parts_copy: + # Even the top level import failed: report that error. + self.errors.append(error_message) + return error_case + parts = parts[1:] + obj = module + for part in parts: + try: + parent, obj = obj, getattr(obj, part) + except AttributeError as e: + # We can't traverse some part of the name. + if (getattr(obj, '__path__', None) is not None + and error_case is not None): + # This is a package (no __path__ per importlib docs), and we + # encountered an error importing something. We cannot tell + # the difference between package.WrongNameTestClass and + # package.wrong_module_name so we just report the + # ImportError - it is more informative. + self.errors.append(error_message) + return error_case + else: + # Otherwise, we signal that an AttributeError has occurred. + error_case, error_message = _make_failed_test( + part, e, self.suiteClass, + 'Failed to access attribute:\n%s' % ( + traceback.format_exc(),)) + self.errors.append(error_message) + return error_case + + if isinstance(obj, types.ModuleType): + return self.loadTestsFromModule(obj) + elif isinstance(obj, type) and issubclass(obj, case.TestCase): + return self.loadTestsFromTestCase(obj) + elif (isinstance(obj, types.FunctionType) and + isinstance(parent, type) and + issubclass(parent, case.TestCase)): + name = parts[-1] + inst = parent(name) + # static methods follow a different path + if not isinstance(getattr(inst, name), types.FunctionType): + return self.suiteClass([inst]) + elif isinstance(obj, suite.TestSuite): + return obj + if callable(obj): + test = obj() + if isinstance(test, suite.TestSuite): + return test + elif isinstance(test, case.TestCase): + return self.suiteClass([test]) + else: + raise TypeError("calling %s returned %s, not a test" % + (obj, test)) + else: + raise TypeError("don't know how to make test from: %s" % obj) + + def loadTestsFromNames(self, names, module=None): + """Return a suite of all test cases found using the given sequence + of string specifiers. See 'loadTestsFromName()'. + """ + suites = [self.loadTestsFromName(name, module) for name in names] + return self.suiteClass(suites) + + def getTestCaseNames(self, testCaseClass): + """Return a sorted sequence of method names found within testCaseClass + """ + def shouldIncludeMethod(attrname): + if not attrname.startswith(self.testMethodPrefix): + return False + testFunc = getattr(testCaseClass, attrname) + if not callable(testFunc): + return False + fullName = f'%s.%s.%s' % ( + testCaseClass.__module__, testCaseClass.__qualname__, attrname + ) + return self.testNamePatterns is None or \ + any(fnmatchcase(fullName, pattern) for pattern in self.testNamePatterns) + testFnNames = list(filter(shouldIncludeMethod, dir(testCaseClass))) + if self.sortTestMethodsUsing: + testFnNames.sort(key=functools.cmp_to_key(self.sortTestMethodsUsing)) + return testFnNames + + def discover(self, start_dir, pattern='test*.py', top_level_dir=None): + """Find and return all test modules from the specified start + directory, recursing into subdirectories to find them and return all + tests found within them. Only test files that match the pattern will + be loaded. (Using shell style pattern matching.) + + All test modules must be importable from the top level of the project. + If the start directory is not the top level directory then the top + level directory must be specified separately. + + If a test package name (directory with '__init__.py') matches the + pattern then the package will be checked for a 'load_tests' function. If + this exists then it will be called with (loader, tests, pattern) unless + the package has already had load_tests called from the same discovery + invocation, in which case the package module object is not scanned for + tests - this ensures that when a package uses discover to further + discover child tests that infinite recursion does not happen. + + If load_tests exists then discovery does *not* recurse into the package, + load_tests is responsible for loading all tests in the package. + + The pattern is deliberately not stored as a loader attribute so that + packages can continue discovery themselves. top_level_dir is stored so + load_tests does not need to pass this argument in to loader.discover(). + + Paths are sorted before being imported to ensure reproducible execution + order even on filesystems with non-alphabetical ordering like ext3/4. + """ + set_implicit_top = False + if top_level_dir is None and self._top_level_dir is not None: + # make top_level_dir optional if called from load_tests in a package + top_level_dir = self._top_level_dir + elif top_level_dir is None: + set_implicit_top = True + top_level_dir = start_dir + + top_level_dir = os.path.abspath(top_level_dir) + + if not top_level_dir in sys.path: + # all test modules must be importable from the top level directory + # should we *unconditionally* put the start directory in first + # in sys.path to minimise likelihood of conflicts between installed + # modules and development versions? + sys.path.insert(0, top_level_dir) + self._top_level_dir = top_level_dir + + is_not_importable = False + is_namespace = False + tests = [] + if os.path.isdir(os.path.abspath(start_dir)): + start_dir = os.path.abspath(start_dir) + if start_dir != top_level_dir: + is_not_importable = not os.path.isfile(os.path.join(start_dir, '__init__.py')) + else: + # support for discovery from dotted module names + try: + __import__(start_dir) + except ImportError: + is_not_importable = True + else: + the_module = sys.modules[start_dir] + top_part = start_dir.split('.')[0] + try: + start_dir = os.path.abspath( + os.path.dirname((the_module.__file__))) + except AttributeError: + # look for namespace packages + try: + spec = the_module.__spec__ + except AttributeError: + spec = None + + if spec and spec.loader is None: + if spec.submodule_search_locations is not None: + is_namespace = True + + for path in the_module.__path__: + if (not set_implicit_top and + not path.startswith(top_level_dir)): + continue + self._top_level_dir = \ + (path.split(the_module.__name__ + .replace(".", os.path.sep))[0]) + tests.extend(self._find_tests(path, + pattern, + namespace=True)) + elif the_module.__name__ in sys.builtin_module_names: + # builtin module + raise TypeError('Can not use builtin modules ' + 'as dotted module names') from None + else: + raise TypeError( + 'don\'t know how to discover from {!r}' + .format(the_module)) from None + + if set_implicit_top: + if not is_namespace: + self._top_level_dir = \ + self._get_directory_containing_module(top_part) + sys.path.remove(top_level_dir) + else: + sys.path.remove(top_level_dir) + + if is_not_importable: + raise ImportError('Start directory is not importable: %r' % start_dir) + + if not is_namespace: + tests = list(self._find_tests(start_dir, pattern)) + return self.suiteClass(tests) + + def _get_directory_containing_module(self, module_name): + module = sys.modules[module_name] + full_path = os.path.abspath(module.__file__) + + if os.path.basename(full_path).lower().startswith('__init__.py'): + return os.path.dirname(os.path.dirname(full_path)) + else: + # here we have been given a module rather than a package - so + # all we can do is search the *same* directory the module is in + # should an exception be raised instead + return os.path.dirname(full_path) + + def _get_name_from_path(self, path): + if path == self._top_level_dir: + return '.' + path = _jython_aware_splitext(os.path.normpath(path)) + + _relpath = os.path.relpath(path, self._top_level_dir) + assert not os.path.isabs(_relpath), "Path must be within the project" + assert not _relpath.startswith('..'), "Path must be within the project" + + name = _relpath.replace(os.path.sep, '.') + return name + + def _get_module_from_name(self, name): + __import__(name) + return sys.modules[name] + + def _match_path(self, path, full_path, pattern): + # override this method to use alternative matching strategy + return fnmatch(path, pattern) + + def _find_tests(self, start_dir, pattern, namespace=False): + """Used by discovery. Yields test suites it loads.""" + # Handle the __init__ in this package + name = self._get_name_from_path(start_dir) + # name is '.' when start_dir == top_level_dir (and top_level_dir is by + # definition not a package). + if name != '.' and name not in self._loading_packages: + # name is in self._loading_packages while we have called into + # loadTestsFromModule with name. + tests, should_recurse = self._find_test_path( + start_dir, pattern, namespace) + if tests is not None: + yield tests + if not should_recurse: + # Either an error occurred, or load_tests was used by the + # package. + return + # Handle the contents. + paths = sorted(os.listdir(start_dir)) + for path in paths: + full_path = os.path.join(start_dir, path) + tests, should_recurse = self._find_test_path( + full_path, pattern, namespace) + if tests is not None: + yield tests + if should_recurse: + # we found a package that didn't use load_tests. + name = self._get_name_from_path(full_path) + self._loading_packages.add(name) + try: + yield from self._find_tests(full_path, pattern, namespace) + finally: + self._loading_packages.discard(name) + + def _find_test_path(self, full_path, pattern, namespace=False): + """Used by discovery. + + Loads tests from a single file, or a directories' __init__.py when + passed the directory. + + Returns a tuple (None_or_tests_from_file, should_recurse). + """ + basename = os.path.basename(full_path) + if os.path.isfile(full_path): + if not VALID_MODULE_NAME.match(basename): + # valid Python identifiers only + return None, False + if not self._match_path(basename, full_path, pattern): + return None, False + # if the test file matches, load it + name = self._get_name_from_path(full_path) + try: + module = self._get_module_from_name(name) + except case.SkipTest as e: + return _make_skipped_test(name, e, self.suiteClass), False + except: + error_case, error_message = \ + _make_failed_import_test(name, self.suiteClass) + self.errors.append(error_message) + return error_case, False + else: + mod_file = os.path.abspath( + getattr(module, '__file__', full_path)) + realpath = _jython_aware_splitext( + os.path.realpath(mod_file)) + fullpath_noext = _jython_aware_splitext( + os.path.realpath(full_path)) + if realpath.lower() != fullpath_noext.lower(): + module_dir = os.path.dirname(realpath) + mod_name = _jython_aware_splitext( + os.path.basename(full_path)) + expected_dir = os.path.dirname(full_path) + msg = ("%r module incorrectly imported from %r. Expected " + "%r. Is this module globally installed?") + raise ImportError( + msg % (mod_name, module_dir, expected_dir)) + return self.loadTestsFromModule(module, pattern=pattern), False + elif os.path.isdir(full_path): + if (not namespace and + not os.path.isfile(os.path.join(full_path, '__init__.py'))): + return None, False + + load_tests = None + tests = None + name = self._get_name_from_path(full_path) + try: + package = self._get_module_from_name(name) + except case.SkipTest as e: + return _make_skipped_test(name, e, self.suiteClass), False + except: + error_case, error_message = \ + _make_failed_import_test(name, self.suiteClass) + self.errors.append(error_message) + return error_case, False + else: + load_tests = getattr(package, 'load_tests', None) + # Mark this package as being in load_tests (possibly ;)) + self._loading_packages.add(name) + try: + tests = self.loadTestsFromModule(package, pattern=pattern) + if load_tests is not None: + # loadTestsFromModule(package) has loaded tests for us. + return tests, False + return tests, True + finally: + self._loading_packages.discard(name) + else: + return None, False + + +defaultTestLoader = TestLoader() + + +def _makeLoader(prefix, sortUsing, suiteClass=None, testNamePatterns=None): + loader = TestLoader() + loader.sortTestMethodsUsing = sortUsing + loader.testMethodPrefix = prefix + loader.testNamePatterns = testNamePatterns + if suiteClass: + loader.suiteClass = suiteClass + return loader + +def getTestCaseNames(testCaseClass, prefix, sortUsing=util.three_way_cmp, testNamePatterns=None): + return _makeLoader(prefix, sortUsing, testNamePatterns=testNamePatterns).getTestCaseNames(testCaseClass) + +def makeSuite(testCaseClass, prefix='test', sortUsing=util.three_way_cmp, + suiteClass=suite.TestSuite): + return _makeLoader(prefix, sortUsing, suiteClass).loadTestsFromTestCase( + testCaseClass) + +def findTestCases(module, prefix='test', sortUsing=util.three_way_cmp, + suiteClass=suite.TestSuite): + return _makeLoader(prefix, sortUsing, suiteClass).loadTestsFromModule(\ + module) diff --git a/miniconda3/envs/active_proaction/lib/python3.10/unittest/main.py b/miniconda3/envs/active_proaction/lib/python3.10/unittest/main.py new file mode 100644 index 0000000000000000000000000000000000000000..88a188c545cd073acef54789fe07ca9875c5cf27 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/unittest/main.py @@ -0,0 +1,275 @@ +"""Unittest main program""" + +import sys +import argparse +import os + +from . import loader, runner +from .signals import installHandler + +__unittest = True + +MAIN_EXAMPLES = """\ +Examples: + %(prog)s test_module - run tests from test_module + %(prog)s module.TestClass - run tests from module.TestClass + %(prog)s module.Class.test_method - run specified test method + %(prog)s path/to/test_file.py - run tests from test_file.py +""" + +MODULE_EXAMPLES = """\ +Examples: + %(prog)s - run default set of tests + %(prog)s MyTestSuite - run suite 'MyTestSuite' + %(prog)s MyTestCase.testSomething - run MyTestCase.testSomething + %(prog)s MyTestCase - run all 'test*' test methods + in MyTestCase +""" + +def _convert_name(name): + # on Linux / Mac OS X 'foo.PY' is not importable, but on + # Windows it is. Simpler to do a case insensitive match + # a better check would be to check that the name is a + # valid Python module name. + if os.path.isfile(name) and name.lower().endswith('.py'): + if os.path.isabs(name): + rel_path = os.path.relpath(name, os.getcwd()) + if os.path.isabs(rel_path) or rel_path.startswith(os.pardir): + return name + name = rel_path + # on Windows both '\' and '/' are used as path + # separators. Better to replace both than rely on os.path.sep + return os.path.normpath(name)[:-3].replace('\\', '.').replace('/', '.') + return name + +def _convert_names(names): + return [_convert_name(name) for name in names] + + +def _convert_select_pattern(pattern): + if not '*' in pattern: + pattern = '*%s*' % pattern + return pattern + + +class TestProgram(object): + """A command-line program that runs a set of tests; this is primarily + for making test modules conveniently executable. + """ + # defaults for testing + module=None + verbosity = 1 + failfast = catchbreak = buffer = progName = warnings = testNamePatterns = None + _discovery_parser = None + + def __init__(self, module='__main__', defaultTest=None, argv=None, + testRunner=None, testLoader=loader.defaultTestLoader, + exit=True, verbosity=1, failfast=None, catchbreak=None, + buffer=None, warnings=None, *, tb_locals=False): + if isinstance(module, str): + self.module = __import__(module) + for part in module.split('.')[1:]: + self.module = getattr(self.module, part) + else: + self.module = module + if argv is None: + argv = sys.argv + + self.exit = exit + self.failfast = failfast + self.catchbreak = catchbreak + self.verbosity = verbosity + self.buffer = buffer + self.tb_locals = tb_locals + if warnings is None and not sys.warnoptions: + # even if DeprecationWarnings are ignored by default + # print them anyway unless other warnings settings are + # specified by the warnings arg or the -W python flag + self.warnings = 'default' + else: + # here self.warnings is set either to the value passed + # to the warnings args or to None. + # If the user didn't pass a value self.warnings will + # be None. This means that the behavior is unchanged + # and depends on the values passed to -W. + self.warnings = warnings + self.defaultTest = defaultTest + self.testRunner = testRunner + self.testLoader = testLoader + self.progName = os.path.basename(argv[0]) + self.parseArgs(argv) + self.runTests() + + def usageExit(self, msg=None): + if msg: + print(msg) + if self._discovery_parser is None: + self._initArgParsers() + self._print_help() + sys.exit(2) + + def _print_help(self, *args, **kwargs): + if self.module is None: + print(self._main_parser.format_help()) + print(MAIN_EXAMPLES % {'prog': self.progName}) + self._discovery_parser.print_help() + else: + print(self._main_parser.format_help()) + print(MODULE_EXAMPLES % {'prog': self.progName}) + + def parseArgs(self, argv): + self._initArgParsers() + if self.module is None: + if len(argv) > 1 and argv[1].lower() == 'discover': + self._do_discovery(argv[2:]) + return + self._main_parser.parse_args(argv[1:], self) + if not self.tests: + # this allows "python -m unittest -v" to still work for + # test discovery. + self._do_discovery([]) + return + else: + self._main_parser.parse_args(argv[1:], self) + + if self.tests: + self.testNames = _convert_names(self.tests) + if __name__ == '__main__': + # to support python -m unittest ... + self.module = None + elif self.defaultTest is None: + # createTests will load tests from self.module + self.testNames = None + elif isinstance(self.defaultTest, str): + self.testNames = (self.defaultTest,) + else: + self.testNames = list(self.defaultTest) + self.createTests() + + def createTests(self, from_discovery=False, Loader=None): + if self.testNamePatterns: + self.testLoader.testNamePatterns = self.testNamePatterns + if from_discovery: + loader = self.testLoader if Loader is None else Loader() + self.test = loader.discover(self.start, self.pattern, self.top) + elif self.testNames is None: + self.test = self.testLoader.loadTestsFromModule(self.module) + else: + self.test = self.testLoader.loadTestsFromNames(self.testNames, + self.module) + + def _initArgParsers(self): + parent_parser = self._getParentArgParser() + self._main_parser = self._getMainArgParser(parent_parser) + self._discovery_parser = self._getDiscoveryArgParser(parent_parser) + + def _getParentArgParser(self): + parser = argparse.ArgumentParser(add_help=False) + + parser.add_argument('-v', '--verbose', dest='verbosity', + action='store_const', const=2, + help='Verbose output') + parser.add_argument('-q', '--quiet', dest='verbosity', + action='store_const', const=0, + help='Quiet output') + parser.add_argument('--locals', dest='tb_locals', + action='store_true', + help='Show local variables in tracebacks') + if self.failfast is None: + parser.add_argument('-f', '--failfast', dest='failfast', + action='store_true', + help='Stop on first fail or error') + self.failfast = False + if self.catchbreak is None: + parser.add_argument('-c', '--catch', dest='catchbreak', + action='store_true', + help='Catch Ctrl-C and display results so far') + self.catchbreak = False + if self.buffer is None: + parser.add_argument('-b', '--buffer', dest='buffer', + action='store_true', + help='Buffer stdout and stderr during tests') + self.buffer = False + if self.testNamePatterns is None: + parser.add_argument('-k', dest='testNamePatterns', + action='append', type=_convert_select_pattern, + help='Only run tests which match the given substring') + self.testNamePatterns = [] + + return parser + + def _getMainArgParser(self, parent): + parser = argparse.ArgumentParser(parents=[parent]) + parser.prog = self.progName + parser.print_help = self._print_help + + parser.add_argument('tests', nargs='*', + help='a list of any number of test modules, ' + 'classes and test methods.') + + return parser + + def _getDiscoveryArgParser(self, parent): + parser = argparse.ArgumentParser(parents=[parent]) + parser.prog = '%s discover' % self.progName + parser.epilog = ('For test discovery all test modules must be ' + 'importable from the top level directory of the ' + 'project.') + + parser.add_argument('-s', '--start-directory', dest='start', + help="Directory to start discovery ('.' default)") + parser.add_argument('-p', '--pattern', dest='pattern', + help="Pattern to match tests ('test*.py' default)") + parser.add_argument('-t', '--top-level-directory', dest='top', + help='Top level directory of project (defaults to ' + 'start directory)') + for arg in ('start', 'pattern', 'top'): + parser.add_argument(arg, nargs='?', + default=argparse.SUPPRESS, + help=argparse.SUPPRESS) + + return parser + + def _do_discovery(self, argv, Loader=None): + self.start = '.' + self.pattern = 'test*.py' + self.top = None + if argv is not None: + # handle command line args for test discovery + if self._discovery_parser is None: + # for testing + self._initArgParsers() + self._discovery_parser.parse_args(argv, self) + + self.createTests(from_discovery=True, Loader=Loader) + + def runTests(self): + if self.catchbreak: + installHandler() + if self.testRunner is None: + self.testRunner = runner.TextTestRunner + if isinstance(self.testRunner, type): + try: + try: + testRunner = self.testRunner(verbosity=self.verbosity, + failfast=self.failfast, + buffer=self.buffer, + warnings=self.warnings, + tb_locals=self.tb_locals) + except TypeError: + # didn't accept the tb_locals argument + testRunner = self.testRunner(verbosity=self.verbosity, + failfast=self.failfast, + buffer=self.buffer, + warnings=self.warnings) + except TypeError: + # didn't accept the verbosity, buffer or failfast arguments + testRunner = self.testRunner() + else: + # it is assumed to be a TestRunner instance + testRunner = self.testRunner + self.result = testRunner.run(self.test) + if self.exit: + sys.exit(not self.result.wasSuccessful()) + +main = TestProgram diff --git a/miniconda3/envs/active_proaction/lib/python3.10/unittest/mock.py b/miniconda3/envs/active_proaction/lib/python3.10/unittest/mock.py new file mode 100644 index 0000000000000000000000000000000000000000..7453dfa187e25a4cacf88b46c3a1fd672c60a71b --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/unittest/mock.py @@ -0,0 +1,2982 @@ +# mock.py +# Test tools for mocking and patching. +# Maintained by Michael Foord +# Backport for other versions of Python available from +# https://pypi.org/project/mock + +__all__ = ( + 'Mock', + 'MagicMock', + 'patch', + 'sentinel', + 'DEFAULT', + 'ANY', + 'call', + 'create_autospec', + 'AsyncMock', + 'FILTER_DIR', + 'NonCallableMock', + 'NonCallableMagicMock', + 'mock_open', + 'PropertyMock', + 'seal', +) + + +import asyncio +import contextlib +import io +import inspect +import pprint +import sys +import builtins +from asyncio import iscoroutinefunction +from types import CodeType, ModuleType, MethodType +from unittest.util import safe_repr +from functools import wraps, partial +from threading import RLock + + +class InvalidSpecError(Exception): + """Indicates that an invalid value was used as a mock spec.""" + + +_builtins = {name for name in dir(builtins) if not name.startswith('_')} + +FILTER_DIR = True + +# Workaround for issue #12370 +# Without this, the __class__ properties wouldn't be set correctly +_safe_super = super + +def _is_async_obj(obj): + if _is_instance_mock(obj) and not isinstance(obj, AsyncMock): + return False + if hasattr(obj, '__func__'): + obj = getattr(obj, '__func__') + return iscoroutinefunction(obj) or inspect.isawaitable(obj) + + +def _is_async_func(func): + if getattr(func, '__code__', None): + return iscoroutinefunction(func) + else: + return False + + +def _is_instance_mock(obj): + # can't use isinstance on Mock objects because they override __class__ + # The base class for all mocks is NonCallableMock + return issubclass(type(obj), NonCallableMock) + + +def _is_exception(obj): + return ( + isinstance(obj, BaseException) or + isinstance(obj, type) and issubclass(obj, BaseException) + ) + + +def _extract_mock(obj): + # Autospecced functions will return a FunctionType with "mock" attribute + # which is the actual mock object that needs to be used. + if isinstance(obj, FunctionTypes) and hasattr(obj, 'mock'): + return obj.mock + else: + return obj + + +def _get_signature_object(func, as_instance, eat_self): + """ + Given an arbitrary, possibly callable object, try to create a suitable + signature object. + Return a (reduced func, signature) tuple, or None. + """ + if isinstance(func, type) and not as_instance: + # If it's a type and should be modelled as a type, use __init__. + func = func.__init__ + # Skip the `self` argument in __init__ + eat_self = True + elif not isinstance(func, FunctionTypes): + # If we really want to model an instance of the passed type, + # __call__ should be looked up, not __init__. + try: + func = func.__call__ + except AttributeError: + return None + if eat_self: + sig_func = partial(func, None) + else: + sig_func = func + try: + return func, inspect.signature(sig_func) + except ValueError: + # Certain callable types are not supported by inspect.signature() + return None + + +def _check_signature(func, mock, skipfirst, instance=False): + sig = _get_signature_object(func, instance, skipfirst) + if sig is None: + return + func, sig = sig + def checksig(self, /, *args, **kwargs): + sig.bind(*args, **kwargs) + _copy_func_details(func, checksig) + type(mock)._mock_check_sig = checksig + type(mock).__signature__ = sig + + +def _copy_func_details(func, funcopy): + # we explicitly don't copy func.__dict__ into this copy as it would + # expose original attributes that should be mocked + for attribute in ( + '__name__', '__doc__', '__text_signature__', + '__module__', '__defaults__', '__kwdefaults__', + ): + try: + setattr(funcopy, attribute, getattr(func, attribute)) + except AttributeError: + pass + + +def _callable(obj): + if isinstance(obj, type): + return True + if isinstance(obj, (staticmethod, classmethod, MethodType)): + return _callable(obj.__func__) + if getattr(obj, '__call__', None) is not None: + return True + return False + + +def _is_list(obj): + # checks for list or tuples + # XXXX badly named! + return type(obj) in (list, tuple) + + +def _instance_callable(obj): + """Given an object, return True if the object is callable. + For classes, return True if instances would be callable.""" + if not isinstance(obj, type): + # already an instance + return getattr(obj, '__call__', None) is not None + + # *could* be broken by a class overriding __mro__ or __dict__ via + # a metaclass + for base in (obj,) + obj.__mro__: + if base.__dict__.get('__call__') is not None: + return True + return False + + +def _set_signature(mock, original, instance=False): + # creates a function with signature (*args, **kwargs) that delegates to a + # mock. It still does signature checking by calling a lambda with the same + # signature as the original. + + skipfirst = isinstance(original, type) + result = _get_signature_object(original, instance, skipfirst) + if result is None: + return mock + func, sig = result + def checksig(*args, **kwargs): + sig.bind(*args, **kwargs) + _copy_func_details(func, checksig) + + name = original.__name__ + if not name.isidentifier(): + name = 'funcopy' + context = {'_checksig_': checksig, 'mock': mock} + src = """def %s(*args, **kwargs): + _checksig_(*args, **kwargs) + return mock(*args, **kwargs)""" % name + exec (src, context) + funcopy = context[name] + _setup_func(funcopy, mock, sig) + return funcopy + + +def _setup_func(funcopy, mock, sig): + funcopy.mock = mock + + def assert_called_with(*args, **kwargs): + return mock.assert_called_with(*args, **kwargs) + def assert_called(*args, **kwargs): + return mock.assert_called(*args, **kwargs) + def assert_not_called(*args, **kwargs): + return mock.assert_not_called(*args, **kwargs) + def assert_called_once(*args, **kwargs): + return mock.assert_called_once(*args, **kwargs) + def assert_called_once_with(*args, **kwargs): + return mock.assert_called_once_with(*args, **kwargs) + def assert_has_calls(*args, **kwargs): + return mock.assert_has_calls(*args, **kwargs) + def assert_any_call(*args, **kwargs): + return mock.assert_any_call(*args, **kwargs) + def reset_mock(): + funcopy.method_calls = _CallList() + funcopy.mock_calls = _CallList() + mock.reset_mock() + ret = funcopy.return_value + if _is_instance_mock(ret) and not ret is mock: + ret.reset_mock() + + funcopy.called = False + funcopy.call_count = 0 + funcopy.call_args = None + funcopy.call_args_list = _CallList() + funcopy.method_calls = _CallList() + funcopy.mock_calls = _CallList() + + funcopy.return_value = mock.return_value + funcopy.side_effect = mock.side_effect + funcopy._mock_children = mock._mock_children + + funcopy.assert_called_with = assert_called_with + funcopy.assert_called_once_with = assert_called_once_with + funcopy.assert_has_calls = assert_has_calls + funcopy.assert_any_call = assert_any_call + funcopy.reset_mock = reset_mock + funcopy.assert_called = assert_called + funcopy.assert_not_called = assert_not_called + funcopy.assert_called_once = assert_called_once + funcopy.__signature__ = sig + + mock._mock_delegate = funcopy + + +def _setup_async_mock(mock): + mock._is_coroutine = asyncio.coroutines._is_coroutine + mock.await_count = 0 + mock.await_args = None + mock.await_args_list = _CallList() + + # Mock is not configured yet so the attributes are set + # to a function and then the corresponding mock helper function + # is called when the helper is accessed similar to _setup_func. + def wrapper(attr, /, *args, **kwargs): + return getattr(mock.mock, attr)(*args, **kwargs) + + for attribute in ('assert_awaited', + 'assert_awaited_once', + 'assert_awaited_with', + 'assert_awaited_once_with', + 'assert_any_await', + 'assert_has_awaits', + 'assert_not_awaited'): + + # setattr(mock, attribute, wrapper) causes late binding + # hence attribute will always be the last value in the loop + # Use partial(wrapper, attribute) to ensure the attribute is bound + # correctly. + setattr(mock, attribute, partial(wrapper, attribute)) + + +def _is_magic(name): + return '__%s__' % name[2:-2] == name + + +class _SentinelObject(object): + "A unique, named, sentinel object." + def __init__(self, name): + self.name = name + + def __repr__(self): + return 'sentinel.%s' % self.name + + def __reduce__(self): + return 'sentinel.%s' % self.name + + +class _Sentinel(object): + """Access attributes to return a named object, usable as a sentinel.""" + def __init__(self): + self._sentinels = {} + + def __getattr__(self, name): + if name == '__bases__': + # Without this help(unittest.mock) raises an exception + raise AttributeError + return self._sentinels.setdefault(name, _SentinelObject(name)) + + def __reduce__(self): + return 'sentinel' + + +sentinel = _Sentinel() + +DEFAULT = sentinel.DEFAULT +_missing = sentinel.MISSING +_deleted = sentinel.DELETED + + +_allowed_names = { + 'return_value', '_mock_return_value', 'side_effect', + '_mock_side_effect', '_mock_parent', '_mock_new_parent', + '_mock_name', '_mock_new_name' +} + + +def _delegating_property(name): + _allowed_names.add(name) + _the_name = '_mock_' + name + def _get(self, name=name, _the_name=_the_name): + sig = self._mock_delegate + if sig is None: + return getattr(self, _the_name) + return getattr(sig, name) + def _set(self, value, name=name, _the_name=_the_name): + sig = self._mock_delegate + if sig is None: + self.__dict__[_the_name] = value + else: + setattr(sig, name, value) + + return property(_get, _set) + + + +class _CallList(list): + + def __contains__(self, value): + if not isinstance(value, list): + return list.__contains__(self, value) + len_value = len(value) + len_self = len(self) + if len_value > len_self: + return False + + for i in range(0, len_self - len_value + 1): + sub_list = self[i:i+len_value] + if sub_list == value: + return True + return False + + def __repr__(self): + return pprint.pformat(list(self)) + + +def _check_and_set_parent(parent, value, name, new_name): + value = _extract_mock(value) + + if not _is_instance_mock(value): + return False + if ((value._mock_name or value._mock_new_name) or + (value._mock_parent is not None) or + (value._mock_new_parent is not None)): + return False + + _parent = parent + while _parent is not None: + # setting a mock (value) as a child or return value of itself + # should not modify the mock + if _parent is value: + return False + _parent = _parent._mock_new_parent + + if new_name: + value._mock_new_parent = parent + value._mock_new_name = new_name + if name: + value._mock_parent = parent + value._mock_name = name + return True + +# Internal class to identify if we wrapped an iterator object or not. +class _MockIter(object): + def __init__(self, obj): + self.obj = iter(obj) + def __next__(self): + return next(self.obj) + +class Base(object): + _mock_return_value = DEFAULT + _mock_side_effect = None + def __init__(self, /, *args, **kwargs): + pass + + + +class NonCallableMock(Base): + """A non-callable version of `Mock`""" + + # Store a mutex as a class attribute in order to protect concurrent access + # to mock attributes. Using a class attribute allows all NonCallableMock + # instances to share the mutex for simplicity. + # + # See https://github.com/python/cpython/issues/98624 for why this is + # necessary. + _lock = RLock() + + def __new__(cls, /, *args, **kw): + # every instance has its own class + # so we can create magic methods on the + # class without stomping on other mocks + bases = (cls,) + if not issubclass(cls, AsyncMockMixin): + # Check if spec is an async object or function + bound_args = _MOCK_SIG.bind_partial(cls, *args, **kw).arguments + spec_arg = bound_args.get('spec_set', bound_args.get('spec')) + if spec_arg is not None and _is_async_obj(spec_arg): + bases = (AsyncMockMixin, cls) + new = type(cls.__name__, bases, {'__doc__': cls.__doc__}) + instance = _safe_super(NonCallableMock, cls).__new__(new) + return instance + + + def __init__( + self, spec=None, wraps=None, name=None, spec_set=None, + parent=None, _spec_state=None, _new_name='', _new_parent=None, + _spec_as_instance=False, _eat_self=None, unsafe=False, **kwargs + ): + if _new_parent is None: + _new_parent = parent + + __dict__ = self.__dict__ + __dict__['_mock_parent'] = parent + __dict__['_mock_name'] = name + __dict__['_mock_new_name'] = _new_name + __dict__['_mock_new_parent'] = _new_parent + __dict__['_mock_sealed'] = False + + if spec_set is not None: + spec = spec_set + spec_set = True + if _eat_self is None: + _eat_self = parent is not None + + self._mock_add_spec(spec, spec_set, _spec_as_instance, _eat_self) + + __dict__['_mock_children'] = {} + __dict__['_mock_wraps'] = wraps + __dict__['_mock_delegate'] = None + + __dict__['_mock_called'] = False + __dict__['_mock_call_args'] = None + __dict__['_mock_call_count'] = 0 + __dict__['_mock_call_args_list'] = _CallList() + __dict__['_mock_mock_calls'] = _CallList() + + __dict__['method_calls'] = _CallList() + __dict__['_mock_unsafe'] = unsafe + + if kwargs: + self.configure_mock(**kwargs) + + _safe_super(NonCallableMock, self).__init__( + spec, wraps, name, spec_set, parent, + _spec_state + ) + + + def attach_mock(self, mock, attribute): + """ + Attach a mock as an attribute of this one, replacing its name and + parent. Calls to the attached mock will be recorded in the + `method_calls` and `mock_calls` attributes of this one.""" + inner_mock = _extract_mock(mock) + + inner_mock._mock_parent = None + inner_mock._mock_new_parent = None + inner_mock._mock_name = '' + inner_mock._mock_new_name = None + + setattr(self, attribute, mock) + + + def mock_add_spec(self, spec, spec_set=False): + """Add a spec to a mock. `spec` can either be an object or a + list of strings. Only attributes on the `spec` can be fetched as + attributes from the mock. + + If `spec_set` is True then only attributes on the spec can be set.""" + self._mock_add_spec(spec, spec_set) + + + def _mock_add_spec(self, spec, spec_set, _spec_as_instance=False, + _eat_self=False): + _spec_class = None + _spec_signature = None + _spec_asyncs = [] + + for attr in dir(spec): + if iscoroutinefunction(getattr(spec, attr, None)): + _spec_asyncs.append(attr) + + if spec is not None and not _is_list(spec): + if isinstance(spec, type): + _spec_class = spec + else: + _spec_class = type(spec) + res = _get_signature_object(spec, + _spec_as_instance, _eat_self) + _spec_signature = res and res[1] + + spec = dir(spec) + + __dict__ = self.__dict__ + __dict__['_spec_class'] = _spec_class + __dict__['_spec_set'] = spec_set + __dict__['_spec_signature'] = _spec_signature + __dict__['_mock_methods'] = spec + __dict__['_spec_asyncs'] = _spec_asyncs + + def __get_return_value(self): + ret = self._mock_return_value + if self._mock_delegate is not None: + ret = self._mock_delegate.return_value + + if ret is DEFAULT: + ret = self._get_child_mock( + _new_parent=self, _new_name='()' + ) + self.return_value = ret + return ret + + + def __set_return_value(self, value): + if self._mock_delegate is not None: + self._mock_delegate.return_value = value + else: + self._mock_return_value = value + _check_and_set_parent(self, value, None, '()') + + __return_value_doc = "The value to be returned when the mock is called." + return_value = property(__get_return_value, __set_return_value, + __return_value_doc) + + + @property + def __class__(self): + if self._spec_class is None: + return type(self) + return self._spec_class + + called = _delegating_property('called') + call_count = _delegating_property('call_count') + call_args = _delegating_property('call_args') + call_args_list = _delegating_property('call_args_list') + mock_calls = _delegating_property('mock_calls') + + + def __get_side_effect(self): + delegated = self._mock_delegate + if delegated is None: + return self._mock_side_effect + sf = delegated.side_effect + if (sf is not None and not callable(sf) + and not isinstance(sf, _MockIter) and not _is_exception(sf)): + sf = _MockIter(sf) + delegated.side_effect = sf + return sf + + def __set_side_effect(self, value): + value = _try_iter(value) + delegated = self._mock_delegate + if delegated is None: + self._mock_side_effect = value + else: + delegated.side_effect = value + + side_effect = property(__get_side_effect, __set_side_effect) + + + def reset_mock(self, visited=None,*, return_value=False, side_effect=False): + "Restore the mock object to its initial state." + if visited is None: + visited = [] + if id(self) in visited: + return + visited.append(id(self)) + + self.called = False + self.call_args = None + self.call_count = 0 + self.mock_calls = _CallList() + self.call_args_list = _CallList() + self.method_calls = _CallList() + + if return_value: + self._mock_return_value = DEFAULT + if side_effect: + self._mock_side_effect = None + + for child in self._mock_children.values(): + if isinstance(child, _SpecState) or child is _deleted: + continue + child.reset_mock(visited, return_value=return_value, side_effect=side_effect) + + ret = self._mock_return_value + if _is_instance_mock(ret) and ret is not self: + ret.reset_mock(visited) + + + def configure_mock(self, /, **kwargs): + """Set attributes on the mock through keyword arguments. + + Attributes plus return values and side effects can be set on child + mocks using standard dot notation and unpacking a dictionary in the + method call: + + >>> attrs = {'method.return_value': 3, 'other.side_effect': KeyError} + >>> mock.configure_mock(**attrs)""" + for arg, val in sorted(kwargs.items(), + # we sort on the number of dots so that + # attributes are set before we set attributes on + # attributes + key=lambda entry: entry[0].count('.')): + args = arg.split('.') + final = args.pop() + obj = self + for entry in args: + obj = getattr(obj, entry) + setattr(obj, final, val) + + + def __getattr__(self, name): + if name in {'_mock_methods', '_mock_unsafe'}: + raise AttributeError(name) + elif self._mock_methods is not None: + if name not in self._mock_methods or name in _all_magics: + raise AttributeError("Mock object has no attribute %r" % name) + elif _is_magic(name): + raise AttributeError(name) + if not self._mock_unsafe and (not self._mock_methods or name not in self._mock_methods): + if name.startswith(('assert', 'assret', 'asert', 'aseert', 'assrt')): + raise AttributeError( + f"{name!r} is not a valid assertion. Use a spec " + f"for the mock if {name!r} is meant to be an attribute.") + + with NonCallableMock._lock: + result = self._mock_children.get(name) + if result is _deleted: + raise AttributeError(name) + elif result is None: + wraps = None + if self._mock_wraps is not None: + # XXXX should we get the attribute without triggering code + # execution? + wraps = getattr(self._mock_wraps, name) + + result = self._get_child_mock( + parent=self, name=name, wraps=wraps, _new_name=name, + _new_parent=self + ) + self._mock_children[name] = result + + elif isinstance(result, _SpecState): + try: + result = create_autospec( + result.spec, result.spec_set, result.instance, + result.parent, result.name + ) + except InvalidSpecError: + target_name = self.__dict__['_mock_name'] or self + raise InvalidSpecError( + f'Cannot autospec attr {name!r} from target ' + f'{target_name!r} as it has already been mocked out. ' + f'[target={self!r}, attr={result.spec!r}]') + self._mock_children[name] = result + + return result + + + def _extract_mock_name(self): + _name_list = [self._mock_new_name] + _parent = self._mock_new_parent + last = self + + dot = '.' + if _name_list == ['()']: + dot = '' + + while _parent is not None: + last = _parent + + _name_list.append(_parent._mock_new_name + dot) + dot = '.' + if _parent._mock_new_name == '()': + dot = '' + + _parent = _parent._mock_new_parent + + _name_list = list(reversed(_name_list)) + _first = last._mock_name or 'mock' + if len(_name_list) > 1: + if _name_list[1] not in ('()', '().'): + _first += '.' + _name_list[0] = _first + return ''.join(_name_list) + + def __repr__(self): + name = self._extract_mock_name() + + name_string = '' + if name not in ('mock', 'mock.'): + name_string = ' name=%r' % name + + spec_string = '' + if self._spec_class is not None: + spec_string = ' spec=%r' + if self._spec_set: + spec_string = ' spec_set=%r' + spec_string = spec_string % self._spec_class.__name__ + return "<%s%s%s id='%s'>" % ( + type(self).__name__, + name_string, + spec_string, + id(self) + ) + + + def __dir__(self): + """Filter the output of `dir(mock)` to only useful members.""" + if not FILTER_DIR: + return object.__dir__(self) + + extras = self._mock_methods or [] + from_type = dir(type(self)) + from_dict = list(self.__dict__) + from_child_mocks = [ + m_name for m_name, m_value in self._mock_children.items() + if m_value is not _deleted] + + from_type = [e for e in from_type if not e.startswith('_')] + from_dict = [e for e in from_dict if not e.startswith('_') or + _is_magic(e)] + return sorted(set(extras + from_type + from_dict + from_child_mocks)) + + + def __setattr__(self, name, value): + if name in _allowed_names: + # property setters go through here + return object.__setattr__(self, name, value) + elif (self._spec_set and self._mock_methods is not None and + name not in self._mock_methods and + name not in self.__dict__): + raise AttributeError("Mock object has no attribute '%s'" % name) + elif name in _unsupported_magics: + msg = 'Attempting to set unsupported magic method %r.' % name + raise AttributeError(msg) + elif name in _all_magics: + if self._mock_methods is not None and name not in self._mock_methods: + raise AttributeError("Mock object has no attribute '%s'" % name) + + if not _is_instance_mock(value): + setattr(type(self), name, _get_method(name, value)) + original = value + value = lambda *args, **kw: original(self, *args, **kw) + else: + # only set _new_name and not name so that mock_calls is tracked + # but not method calls + _check_and_set_parent(self, value, None, name) + setattr(type(self), name, value) + self._mock_children[name] = value + elif name == '__class__': + self._spec_class = value + return + else: + if _check_and_set_parent(self, value, name, name): + self._mock_children[name] = value + + if self._mock_sealed and not hasattr(self, name): + mock_name = f'{self._extract_mock_name()}.{name}' + raise AttributeError(f'Cannot set {mock_name}') + + return object.__setattr__(self, name, value) + + + def __delattr__(self, name): + if name in _all_magics and name in type(self).__dict__: + delattr(type(self), name) + if name not in self.__dict__: + # for magic methods that are still MagicProxy objects and + # not set on the instance itself + return + + obj = self._mock_children.get(name, _missing) + if name in self.__dict__: + _safe_super(NonCallableMock, self).__delattr__(name) + elif obj is _deleted: + raise AttributeError(name) + if obj is not _missing: + del self._mock_children[name] + self._mock_children[name] = _deleted + + + def _format_mock_call_signature(self, args, kwargs): + name = self._mock_name or 'mock' + return _format_call_signature(name, args, kwargs) + + + def _format_mock_failure_message(self, args, kwargs, action='call'): + message = 'expected %s not found.\nExpected: %s\nActual: %s' + expected_string = self._format_mock_call_signature(args, kwargs) + call_args = self.call_args + actual_string = self._format_mock_call_signature(*call_args) + return message % (action, expected_string, actual_string) + + + def _get_call_signature_from_name(self, name): + """ + * If call objects are asserted against a method/function like obj.meth1 + then there could be no name for the call object to lookup. Hence just + return the spec_signature of the method/function being asserted against. + * If the name is not empty then remove () and split by '.' to get + list of names to iterate through the children until a potential + match is found. A child mock is created only during attribute access + so if we get a _SpecState then no attributes of the spec were accessed + and can be safely exited. + """ + if not name: + return self._spec_signature + + sig = None + names = name.replace('()', '').split('.') + children = self._mock_children + + for name in names: + child = children.get(name) + if child is None or isinstance(child, _SpecState): + break + else: + # If an autospecced object is attached using attach_mock the + # child would be a function with mock object as attribute from + # which signature has to be derived. + child = _extract_mock(child) + children = child._mock_children + sig = child._spec_signature + + return sig + + + def _call_matcher(self, _call): + """ + Given a call (or simply an (args, kwargs) tuple), return a + comparison key suitable for matching with other calls. + This is a best effort method which relies on the spec's signature, + if available, or falls back on the arguments themselves. + """ + + if isinstance(_call, tuple) and len(_call) > 2: + sig = self._get_call_signature_from_name(_call[0]) + else: + sig = self._spec_signature + + if sig is not None: + if len(_call) == 2: + name = '' + args, kwargs = _call + else: + name, args, kwargs = _call + try: + bound_call = sig.bind(*args, **kwargs) + return call(name, bound_call.args, bound_call.kwargs) + except TypeError as e: + return e.with_traceback(None) + else: + return _call + + def assert_not_called(self): + """assert that the mock was never called. + """ + if self.call_count != 0: + msg = ("Expected '%s' to not have been called. Called %s times.%s" + % (self._mock_name or 'mock', + self.call_count, + self._calls_repr())) + raise AssertionError(msg) + + def assert_called(self): + """assert that the mock was called at least once + """ + if self.call_count == 0: + msg = ("Expected '%s' to have been called." % + (self._mock_name or 'mock')) + raise AssertionError(msg) + + def assert_called_once(self): + """assert that the mock was called only once. + """ + if not self.call_count == 1: + msg = ("Expected '%s' to have been called once. Called %s times.%s" + % (self._mock_name or 'mock', + self.call_count, + self._calls_repr())) + raise AssertionError(msg) + + def assert_called_with(self, /, *args, **kwargs): + """assert that the last call was made with the specified arguments. + + Raises an AssertionError if the args and keyword args passed in are + different to the last call to the mock.""" + if self.call_args is None: + expected = self._format_mock_call_signature(args, kwargs) + actual = 'not called.' + error_message = ('expected call not found.\nExpected: %s\nActual: %s' + % (expected, actual)) + raise AssertionError(error_message) + + def _error_message(): + msg = self._format_mock_failure_message(args, kwargs) + return msg + expected = self._call_matcher(_Call((args, kwargs), two=True)) + actual = self._call_matcher(self.call_args) + if actual != expected: + cause = expected if isinstance(expected, Exception) else None + raise AssertionError(_error_message()) from cause + + + def assert_called_once_with(self, /, *args, **kwargs): + """assert that the mock was called exactly once and that that call was + with the specified arguments.""" + if not self.call_count == 1: + msg = ("Expected '%s' to be called once. Called %s times.%s" + % (self._mock_name or 'mock', + self.call_count, + self._calls_repr())) + raise AssertionError(msg) + return self.assert_called_with(*args, **kwargs) + + + def assert_has_calls(self, calls, any_order=False): + """assert the mock has been called with the specified calls. + The `mock_calls` list is checked for the calls. + + If `any_order` is False (the default) then the calls must be + sequential. There can be extra calls before or after the + specified calls. + + If `any_order` is True then the calls can be in any order, but + they must all appear in `mock_calls`.""" + expected = [self._call_matcher(c) for c in calls] + cause = next((e for e in expected if isinstance(e, Exception)), None) + all_calls = _CallList(self._call_matcher(c) for c in self.mock_calls) + if not any_order: + if expected not in all_calls: + if cause is None: + problem = 'Calls not found.' + else: + problem = ('Error processing expected calls.\n' + 'Errors: {}').format( + [e if isinstance(e, Exception) else None + for e in expected]) + raise AssertionError( + f'{problem}\n' + f'Expected: {_CallList(calls)}' + f'{self._calls_repr(prefix="Actual").rstrip(".")}' + ) from cause + return + + all_calls = list(all_calls) + + not_found = [] + for kall in expected: + try: + all_calls.remove(kall) + except ValueError: + not_found.append(kall) + if not_found: + raise AssertionError( + '%r does not contain all of %r in its call list, ' + 'found %r instead' % (self._mock_name or 'mock', + tuple(not_found), all_calls) + ) from cause + + + def assert_any_call(self, /, *args, **kwargs): + """assert the mock has been called with the specified arguments. + + The assert passes if the mock has *ever* been called, unlike + `assert_called_with` and `assert_called_once_with` that only pass if + the call is the most recent one.""" + expected = self._call_matcher(_Call((args, kwargs), two=True)) + cause = expected if isinstance(expected, Exception) else None + actual = [self._call_matcher(c) for c in self.call_args_list] + if cause or expected not in _AnyComparer(actual): + expected_string = self._format_mock_call_signature(args, kwargs) + raise AssertionError( + '%s call not found' % expected_string + ) from cause + + + def _get_child_mock(self, /, **kw): + """Create the child mocks for attributes and return value. + By default child mocks will be the same type as the parent. + Subclasses of Mock may want to override this to customize the way + child mocks are made. + + For non-callable mocks the callable variant will be used (rather than + any custom subclass).""" + if self._mock_sealed: + attribute = f".{kw['name']}" if "name" in kw else "()" + mock_name = self._extract_mock_name() + attribute + raise AttributeError(mock_name) + + _new_name = kw.get("_new_name") + if _new_name in self.__dict__['_spec_asyncs']: + return AsyncMock(**kw) + + _type = type(self) + if issubclass(_type, MagicMock) and _new_name in _async_method_magics: + # Any asynchronous magic becomes an AsyncMock + klass = AsyncMock + elif issubclass(_type, AsyncMockMixin): + if (_new_name in _all_sync_magics or + self._mock_methods and _new_name in self._mock_methods): + # Any synchronous method on AsyncMock becomes a MagicMock + klass = MagicMock + else: + klass = AsyncMock + elif not issubclass(_type, CallableMixin): + if issubclass(_type, NonCallableMagicMock): + klass = MagicMock + elif issubclass(_type, NonCallableMock): + klass = Mock + else: + klass = _type.__mro__[1] + return klass(**kw) + + + def _calls_repr(self, prefix="Calls"): + """Renders self.mock_calls as a string. + + Example: "\nCalls: [call(1), call(2)]." + + If self.mock_calls is empty, an empty string is returned. The + output will be truncated if very long. + """ + if not self.mock_calls: + return "" + return f"\n{prefix}: {safe_repr(self.mock_calls)}." + + +_MOCK_SIG = inspect.signature(NonCallableMock.__init__) + + +class _AnyComparer(list): + """A list which checks if it contains a call which may have an + argument of ANY, flipping the components of item and self from + their traditional locations so that ANY is guaranteed to be on + the left.""" + def __contains__(self, item): + for _call in self: + assert len(item) == len(_call) + if all([ + expected == actual + for expected, actual in zip(item, _call) + ]): + return True + return False + + +def _try_iter(obj): + if obj is None: + return obj + if _is_exception(obj): + return obj + if _callable(obj): + return obj + try: + return iter(obj) + except TypeError: + # XXXX backwards compatibility + # but this will blow up on first call - so maybe we should fail early? + return obj + + +class CallableMixin(Base): + + def __init__(self, spec=None, side_effect=None, return_value=DEFAULT, + wraps=None, name=None, spec_set=None, parent=None, + _spec_state=None, _new_name='', _new_parent=None, **kwargs): + self.__dict__['_mock_return_value'] = return_value + _safe_super(CallableMixin, self).__init__( + spec, wraps, name, spec_set, parent, + _spec_state, _new_name, _new_parent, **kwargs + ) + + self.side_effect = side_effect + + + def _mock_check_sig(self, /, *args, **kwargs): + # stub method that can be replaced with one with a specific signature + pass + + + def __call__(self, /, *args, **kwargs): + # can't use self in-case a function / method we are mocking uses self + # in the signature + self._mock_check_sig(*args, **kwargs) + self._increment_mock_call(*args, **kwargs) + return self._mock_call(*args, **kwargs) + + + def _mock_call(self, /, *args, **kwargs): + return self._execute_mock_call(*args, **kwargs) + + def _increment_mock_call(self, /, *args, **kwargs): + self.called = True + self.call_count += 1 + + # handle call_args + # needs to be set here so assertions on call arguments pass before + # execution in the case of awaited calls + _call = _Call((args, kwargs), two=True) + self.call_args = _call + self.call_args_list.append(_call) + + # initial stuff for method_calls: + do_method_calls = self._mock_parent is not None + method_call_name = self._mock_name + + # initial stuff for mock_calls: + mock_call_name = self._mock_new_name + is_a_call = mock_call_name == '()' + self.mock_calls.append(_Call(('', args, kwargs))) + + # follow up the chain of mocks: + _new_parent = self._mock_new_parent + while _new_parent is not None: + + # handle method_calls: + if do_method_calls: + _new_parent.method_calls.append(_Call((method_call_name, args, kwargs))) + do_method_calls = _new_parent._mock_parent is not None + if do_method_calls: + method_call_name = _new_parent._mock_name + '.' + method_call_name + + # handle mock_calls: + this_mock_call = _Call((mock_call_name, args, kwargs)) + _new_parent.mock_calls.append(this_mock_call) + + if _new_parent._mock_new_name: + if is_a_call: + dot = '' + else: + dot = '.' + is_a_call = _new_parent._mock_new_name == '()' + mock_call_name = _new_parent._mock_new_name + dot + mock_call_name + + # follow the parental chain: + _new_parent = _new_parent._mock_new_parent + + def _execute_mock_call(self, /, *args, **kwargs): + # separate from _increment_mock_call so that awaited functions are + # executed separately from their call, also AsyncMock overrides this method + + effect = self.side_effect + if effect is not None: + if _is_exception(effect): + raise effect + elif not _callable(effect): + result = next(effect) + if _is_exception(result): + raise result + else: + result = effect(*args, **kwargs) + + if result is not DEFAULT: + return result + + if self._mock_return_value is not DEFAULT: + return self.return_value + + if self._mock_wraps is not None: + return self._mock_wraps(*args, **kwargs) + + return self.return_value + + + +class Mock(CallableMixin, NonCallableMock): + """ + Create a new `Mock` object. `Mock` takes several optional arguments + that specify the behaviour of the Mock object: + + * `spec`: This can be either a list of strings or an existing object (a + class or instance) that acts as the specification for the mock object. If + you pass in an object then a list of strings is formed by calling dir on + the object (excluding unsupported magic attributes and methods). Accessing + any attribute not in this list will raise an `AttributeError`. + + If `spec` is an object (rather than a list of strings) then + `mock.__class__` returns the class of the spec object. This allows mocks + to pass `isinstance` tests. + + * `spec_set`: A stricter variant of `spec`. If used, attempting to *set* + or get an attribute on the mock that isn't on the object passed as + `spec_set` will raise an `AttributeError`. + + * `side_effect`: A function to be called whenever the Mock is called. See + the `side_effect` attribute. Useful for raising exceptions or + dynamically changing return values. The function is called with the same + arguments as the mock, and unless it returns `DEFAULT`, the return + value of this function is used as the return value. + + If `side_effect` is an iterable then each call to the mock will return + the next value from the iterable. If any of the members of the iterable + are exceptions they will be raised instead of returned. + + * `return_value`: The value returned when the mock is called. By default + this is a new Mock (created on first access). See the + `return_value` attribute. + + * `wraps`: Item for the mock object to wrap. If `wraps` is not None then + calling the Mock will pass the call through to the wrapped object + (returning the real result). Attribute access on the mock will return a + Mock object that wraps the corresponding attribute of the wrapped object + (so attempting to access an attribute that doesn't exist will raise an + `AttributeError`). + + If the mock has an explicit `return_value` set then calls are not passed + to the wrapped object and the `return_value` is returned instead. + + * `name`: If the mock has a name then it will be used in the repr of the + mock. This can be useful for debugging. The name is propagated to child + mocks. + + Mocks can also be called with arbitrary keyword arguments. These will be + used to set attributes on the mock after it is created. + """ + + +def _dot_lookup(thing, comp, import_path): + try: + return getattr(thing, comp) + except AttributeError: + __import__(import_path) + return getattr(thing, comp) + + +def _importer(target): + components = target.split('.') + import_path = components.pop(0) + thing = __import__(import_path) + + for comp in components: + import_path += ".%s" % comp + thing = _dot_lookup(thing, comp, import_path) + return thing + + +# _check_spec_arg_typos takes kwargs from commands like patch and checks that +# they don't contain common misspellings of arguments related to autospeccing. +def _check_spec_arg_typos(kwargs_to_check): + typos = ("autospect", "auto_spec", "set_spec") + for typo in typos: + if typo in kwargs_to_check: + raise RuntimeError( + f"{typo!r} might be a typo; use unsafe=True if this is intended" + ) + + +class _patch(object): + + attribute_name = None + _active_patches = [] + + def __init__( + self, getter, attribute, new, spec, create, + spec_set, autospec, new_callable, kwargs, *, unsafe=False + ): + if new_callable is not None: + if new is not DEFAULT: + raise ValueError( + "Cannot use 'new' and 'new_callable' together" + ) + if autospec is not None: + raise ValueError( + "Cannot use 'autospec' and 'new_callable' together" + ) + if not unsafe: + _check_spec_arg_typos(kwargs) + if _is_instance_mock(spec): + raise InvalidSpecError( + f'Cannot spec attr {attribute!r} as the spec ' + f'has already been mocked out. [spec={spec!r}]') + if _is_instance_mock(spec_set): + raise InvalidSpecError( + f'Cannot spec attr {attribute!r} as the spec_set ' + f'target has already been mocked out. [spec_set={spec_set!r}]') + + self.getter = getter + self.attribute = attribute + self.new = new + self.new_callable = new_callable + self.spec = spec + self.create = create + self.has_local = False + self.spec_set = spec_set + self.autospec = autospec + self.kwargs = kwargs + self.additional_patchers = [] + + + def copy(self): + patcher = _patch( + self.getter, self.attribute, self.new, self.spec, + self.create, self.spec_set, + self.autospec, self.new_callable, self.kwargs + ) + patcher.attribute_name = self.attribute_name + patcher.additional_patchers = [ + p.copy() for p in self.additional_patchers + ] + return patcher + + + def __call__(self, func): + if isinstance(func, type): + return self.decorate_class(func) + if inspect.iscoroutinefunction(func): + return self.decorate_async_callable(func) + return self.decorate_callable(func) + + + def decorate_class(self, klass): + for attr in dir(klass): + if not attr.startswith(patch.TEST_PREFIX): + continue + + attr_value = getattr(klass, attr) + if not hasattr(attr_value, "__call__"): + continue + + patcher = self.copy() + setattr(klass, attr, patcher(attr_value)) + return klass + + + @contextlib.contextmanager + def decoration_helper(self, patched, args, keywargs): + extra_args = [] + with contextlib.ExitStack() as exit_stack: + for patching in patched.patchings: + arg = exit_stack.enter_context(patching) + if patching.attribute_name is not None: + keywargs.update(arg) + elif patching.new is DEFAULT: + extra_args.append(arg) + + args += tuple(extra_args) + yield (args, keywargs) + + + def decorate_callable(self, func): + # NB. Keep the method in sync with decorate_async_callable() + if hasattr(func, 'patchings'): + func.patchings.append(self) + return func + + @wraps(func) + def patched(*args, **keywargs): + with self.decoration_helper(patched, + args, + keywargs) as (newargs, newkeywargs): + return func(*newargs, **newkeywargs) + + patched.patchings = [self] + return patched + + + def decorate_async_callable(self, func): + # NB. Keep the method in sync with decorate_callable() + if hasattr(func, 'patchings'): + func.patchings.append(self) + return func + + @wraps(func) + async def patched(*args, **keywargs): + with self.decoration_helper(patched, + args, + keywargs) as (newargs, newkeywargs): + return await func(*newargs, **newkeywargs) + + patched.patchings = [self] + return patched + + + def get_original(self): + target = self.getter() + name = self.attribute + + original = DEFAULT + local = False + + try: + original = target.__dict__[name] + except (AttributeError, KeyError): + original = getattr(target, name, DEFAULT) + else: + local = True + + if name in _builtins and isinstance(target, ModuleType): + self.create = True + + if not self.create and original is DEFAULT: + raise AttributeError( + "%s does not have the attribute %r" % (target, name) + ) + return original, local + + + def __enter__(self): + """Perform the patch.""" + new, spec, spec_set = self.new, self.spec, self.spec_set + autospec, kwargs = self.autospec, self.kwargs + new_callable = self.new_callable + self.target = self.getter() + + # normalise False to None + if spec is False: + spec = None + if spec_set is False: + spec_set = None + if autospec is False: + autospec = None + + if spec is not None and autospec is not None: + raise TypeError("Can't specify spec and autospec") + if ((spec is not None or autospec is not None) and + spec_set not in (True, None)): + raise TypeError("Can't provide explicit spec_set *and* spec or autospec") + + original, local = self.get_original() + + if new is DEFAULT and autospec is None: + inherit = False + if spec is True: + # set spec to the object we are replacing + spec = original + if spec_set is True: + spec_set = original + spec = None + elif spec is not None: + if spec_set is True: + spec_set = spec + spec = None + elif spec_set is True: + spec_set = original + + if spec is not None or spec_set is not None: + if original is DEFAULT: + raise TypeError("Can't use 'spec' with create=True") + if isinstance(original, type): + # If we're patching out a class and there is a spec + inherit = True + if spec is None and _is_async_obj(original): + Klass = AsyncMock + else: + Klass = MagicMock + _kwargs = {} + if new_callable is not None: + Klass = new_callable + elif spec is not None or spec_set is not None: + this_spec = spec + if spec_set is not None: + this_spec = spec_set + if _is_list(this_spec): + not_callable = '__call__' not in this_spec + else: + not_callable = not callable(this_spec) + if _is_async_obj(this_spec): + Klass = AsyncMock + elif not_callable: + Klass = NonCallableMagicMock + + if spec is not None: + _kwargs['spec'] = spec + if spec_set is not None: + _kwargs['spec_set'] = spec_set + + # add a name to mocks + if (isinstance(Klass, type) and + issubclass(Klass, NonCallableMock) and self.attribute): + _kwargs['name'] = self.attribute + + _kwargs.update(kwargs) + new = Klass(**_kwargs) + + if inherit and _is_instance_mock(new): + # we can only tell if the instance should be callable if the + # spec is not a list + this_spec = spec + if spec_set is not None: + this_spec = spec_set + if (not _is_list(this_spec) and not + _instance_callable(this_spec)): + Klass = NonCallableMagicMock + + _kwargs.pop('name') + new.return_value = Klass(_new_parent=new, _new_name='()', + **_kwargs) + elif autospec is not None: + # spec is ignored, new *must* be default, spec_set is treated + # as a boolean. Should we check spec is not None and that spec_set + # is a bool? + if new is not DEFAULT: + raise TypeError( + "autospec creates the mock for you. Can't specify " + "autospec and new." + ) + if original is DEFAULT: + raise TypeError("Can't use 'autospec' with create=True") + spec_set = bool(spec_set) + if autospec is True: + autospec = original + + if _is_instance_mock(self.target): + raise InvalidSpecError( + f'Cannot autospec attr {self.attribute!r} as the patch ' + f'target has already been mocked out. ' + f'[target={self.target!r}, attr={autospec!r}]') + if _is_instance_mock(autospec): + target_name = getattr(self.target, '__name__', self.target) + raise InvalidSpecError( + f'Cannot autospec attr {self.attribute!r} from target ' + f'{target_name!r} as it has already been mocked out. ' + f'[target={self.target!r}, attr={autospec!r}]') + + new = create_autospec(autospec, spec_set=spec_set, + _name=self.attribute, **kwargs) + elif kwargs: + # can't set keyword args when we aren't creating the mock + # XXXX If new is a Mock we could call new.configure_mock(**kwargs) + raise TypeError("Can't pass kwargs to a mock we aren't creating") + + new_attr = new + + self.temp_original = original + self.is_local = local + self._exit_stack = contextlib.ExitStack() + try: + setattr(self.target, self.attribute, new_attr) + if self.attribute_name is not None: + extra_args = {} + if self.new is DEFAULT: + extra_args[self.attribute_name] = new + for patching in self.additional_patchers: + arg = self._exit_stack.enter_context(patching) + if patching.new is DEFAULT: + extra_args.update(arg) + return extra_args + + return new + except: + if not self.__exit__(*sys.exc_info()): + raise + + def __exit__(self, *exc_info): + """Undo the patch.""" + if self.is_local and self.temp_original is not DEFAULT: + setattr(self.target, self.attribute, self.temp_original) + else: + delattr(self.target, self.attribute) + if not self.create and (not hasattr(self.target, self.attribute) or + self.attribute in ('__doc__', '__module__', + '__defaults__', '__annotations__', + '__kwdefaults__')): + # needed for proxy objects like django settings + setattr(self.target, self.attribute, self.temp_original) + + del self.temp_original + del self.is_local + del self.target + exit_stack = self._exit_stack + del self._exit_stack + return exit_stack.__exit__(*exc_info) + + + def start(self): + """Activate a patch, returning any created mock.""" + result = self.__enter__() + self._active_patches.append(self) + return result + + + def stop(self): + """Stop an active patch.""" + try: + self._active_patches.remove(self) + except ValueError: + # If the patch hasn't been started this will fail + return None + + return self.__exit__(None, None, None) + + + +def _get_target(target): + try: + target, attribute = target.rsplit('.', 1) + except (TypeError, ValueError, AttributeError): + raise TypeError( + f"Need a valid target to patch. You supplied: {target!r}") + getter = lambda: _importer(target) + return getter, attribute + + +def _patch_object( + target, attribute, new=DEFAULT, spec=None, + create=False, spec_set=None, autospec=None, + new_callable=None, *, unsafe=False, **kwargs + ): + """ + patch the named member (`attribute`) on an object (`target`) with a mock + object. + + `patch.object` can be used as a decorator, class decorator or a context + manager. Arguments `new`, `spec`, `create`, `spec_set`, + `autospec` and `new_callable` have the same meaning as for `patch`. Like + `patch`, `patch.object` takes arbitrary keyword arguments for configuring + the mock object it creates. + + When used as a class decorator `patch.object` honours `patch.TEST_PREFIX` + for choosing which methods to wrap. + """ + if type(target) is str: + raise TypeError( + f"{target!r} must be the actual object to be patched, not a str" + ) + getter = lambda: target + return _patch( + getter, attribute, new, spec, create, + spec_set, autospec, new_callable, kwargs, unsafe=unsafe + ) + + +def _patch_multiple(target, spec=None, create=False, spec_set=None, + autospec=None, new_callable=None, **kwargs): + """Perform multiple patches in a single call. It takes the object to be + patched (either as an object or a string to fetch the object by importing) + and keyword arguments for the patches:: + + with patch.multiple(settings, FIRST_PATCH='one', SECOND_PATCH='two'): + ... + + Use `DEFAULT` as the value if you want `patch.multiple` to create + mocks for you. In this case the created mocks are passed into a decorated + function by keyword, and a dictionary is returned when `patch.multiple` is + used as a context manager. + + `patch.multiple` can be used as a decorator, class decorator or a context + manager. The arguments `spec`, `spec_set`, `create`, + `autospec` and `new_callable` have the same meaning as for `patch`. These + arguments will be applied to *all* patches done by `patch.multiple`. + + When used as a class decorator `patch.multiple` honours `patch.TEST_PREFIX` + for choosing which methods to wrap. + """ + if type(target) is str: + getter = lambda: _importer(target) + else: + getter = lambda: target + + if not kwargs: + raise ValueError( + 'Must supply at least one keyword argument with patch.multiple' + ) + # need to wrap in a list for python 3, where items is a view + items = list(kwargs.items()) + attribute, new = items[0] + patcher = _patch( + getter, attribute, new, spec, create, spec_set, + autospec, new_callable, {} + ) + patcher.attribute_name = attribute + for attribute, new in items[1:]: + this_patcher = _patch( + getter, attribute, new, spec, create, spec_set, + autospec, new_callable, {} + ) + this_patcher.attribute_name = attribute + patcher.additional_patchers.append(this_patcher) + return patcher + + +def patch( + target, new=DEFAULT, spec=None, create=False, + spec_set=None, autospec=None, new_callable=None, *, unsafe=False, **kwargs + ): + """ + `patch` acts as a function decorator, class decorator or a context + manager. Inside the body of the function or with statement, the `target` + is patched with a `new` object. When the function/with statement exits + the patch is undone. + + If `new` is omitted, then the target is replaced with an + `AsyncMock if the patched object is an async function or a + `MagicMock` otherwise. If `patch` is used as a decorator and `new` is + omitted, the created mock is passed in as an extra argument to the + decorated function. If `patch` is used as a context manager the created + mock is returned by the context manager. + + `target` should be a string in the form `'package.module.ClassName'`. The + `target` is imported and the specified object replaced with the `new` + object, so the `target` must be importable from the environment you are + calling `patch` from. The target is imported when the decorated function + is executed, not at decoration time. + + The `spec` and `spec_set` keyword arguments are passed to the `MagicMock` + if patch is creating one for you. + + In addition you can pass `spec=True` or `spec_set=True`, which causes + patch to pass in the object being mocked as the spec/spec_set object. + + `new_callable` allows you to specify a different class, or callable object, + that will be called to create the `new` object. By default `AsyncMock` is + used for async functions and `MagicMock` for the rest. + + A more powerful form of `spec` is `autospec`. If you set `autospec=True` + then the mock will be created with a spec from the object being replaced. + All attributes of the mock will also have the spec of the corresponding + attribute of the object being replaced. Methods and functions being + mocked will have their arguments checked and will raise a `TypeError` if + they are called with the wrong signature. For mocks replacing a class, + their return value (the 'instance') will have the same spec as the class. + + Instead of `autospec=True` you can pass `autospec=some_object` to use an + arbitrary object as the spec instead of the one being replaced. + + By default `patch` will fail to replace attributes that don't exist. If + you pass in `create=True`, and the attribute doesn't exist, patch will + create the attribute for you when the patched function is called, and + delete it again afterwards. This is useful for writing tests against + attributes that your production code creates at runtime. It is off by + default because it can be dangerous. With it switched on you can write + passing tests against APIs that don't actually exist! + + Patch can be used as a `TestCase` class decorator. It works by + decorating each test method in the class. This reduces the boilerplate + code when your test methods share a common patchings set. `patch` finds + tests by looking for method names that start with `patch.TEST_PREFIX`. + By default this is `test`, which matches the way `unittest` finds tests. + You can specify an alternative prefix by setting `patch.TEST_PREFIX`. + + Patch can be used as a context manager, with the with statement. Here the + patching applies to the indented block after the with statement. If you + use "as" then the patched object will be bound to the name after the + "as"; very useful if `patch` is creating a mock object for you. + + Patch will raise a `RuntimeError` if passed some common misspellings of + the arguments autospec and spec_set. Pass the argument `unsafe` with the + value True to disable that check. + + `patch` takes arbitrary keyword arguments. These will be passed to + `AsyncMock` if the patched object is asynchronous, to `MagicMock` + otherwise or to `new_callable` if specified. + + `patch.dict(...)`, `patch.multiple(...)` and `patch.object(...)` are + available for alternate use-cases. + """ + getter, attribute = _get_target(target) + return _patch( + getter, attribute, new, spec, create, + spec_set, autospec, new_callable, kwargs, unsafe=unsafe + ) + + +class _patch_dict(object): + """ + Patch a dictionary, or dictionary like object, and restore the dictionary + to its original state after the test. + + `in_dict` can be a dictionary or a mapping like container. If it is a + mapping then it must at least support getting, setting and deleting items + plus iterating over keys. + + `in_dict` can also be a string specifying the name of the dictionary, which + will then be fetched by importing it. + + `values` can be a dictionary of values to set in the dictionary. `values` + can also be an iterable of `(key, value)` pairs. + + If `clear` is True then the dictionary will be cleared before the new + values are set. + + `patch.dict` can also be called with arbitrary keyword arguments to set + values in the dictionary:: + + with patch.dict('sys.modules', mymodule=Mock(), other_module=Mock()): + ... + + `patch.dict` can be used as a context manager, decorator or class + decorator. When used as a class decorator `patch.dict` honours + `patch.TEST_PREFIX` for choosing which methods to wrap. + """ + + def __init__(self, in_dict, values=(), clear=False, **kwargs): + self.in_dict = in_dict + # support any argument supported by dict(...) constructor + self.values = dict(values) + self.values.update(kwargs) + self.clear = clear + self._original = None + + + def __call__(self, f): + if isinstance(f, type): + return self.decorate_class(f) + if inspect.iscoroutinefunction(f): + return self.decorate_async_callable(f) + return self.decorate_callable(f) + + + def decorate_callable(self, f): + @wraps(f) + def _inner(*args, **kw): + self._patch_dict() + try: + return f(*args, **kw) + finally: + self._unpatch_dict() + + return _inner + + + def decorate_async_callable(self, f): + @wraps(f) + async def _inner(*args, **kw): + self._patch_dict() + try: + return await f(*args, **kw) + finally: + self._unpatch_dict() + + return _inner + + + def decorate_class(self, klass): + for attr in dir(klass): + attr_value = getattr(klass, attr) + if (attr.startswith(patch.TEST_PREFIX) and + hasattr(attr_value, "__call__")): + decorator = _patch_dict(self.in_dict, self.values, self.clear) + decorated = decorator(attr_value) + setattr(klass, attr, decorated) + return klass + + + def __enter__(self): + """Patch the dict.""" + self._patch_dict() + return self.in_dict + + + def _patch_dict(self): + values = self.values + if isinstance(self.in_dict, str): + self.in_dict = _importer(self.in_dict) + in_dict = self.in_dict + clear = self.clear + + try: + original = in_dict.copy() + except AttributeError: + # dict like object with no copy method + # must support iteration over keys + original = {} + for key in in_dict: + original[key] = in_dict[key] + self._original = original + + if clear: + _clear_dict(in_dict) + + try: + in_dict.update(values) + except AttributeError: + # dict like object with no update method + for key in values: + in_dict[key] = values[key] + + + def _unpatch_dict(self): + in_dict = self.in_dict + original = self._original + + _clear_dict(in_dict) + + try: + in_dict.update(original) + except AttributeError: + for key in original: + in_dict[key] = original[key] + + + def __exit__(self, *args): + """Unpatch the dict.""" + if self._original is not None: + self._unpatch_dict() + return False + + + def start(self): + """Activate a patch, returning any created mock.""" + result = self.__enter__() + _patch._active_patches.append(self) + return result + + + def stop(self): + """Stop an active patch.""" + try: + _patch._active_patches.remove(self) + except ValueError: + # If the patch hasn't been started this will fail + return None + + return self.__exit__(None, None, None) + + +def _clear_dict(in_dict): + try: + in_dict.clear() + except AttributeError: + keys = list(in_dict) + for key in keys: + del in_dict[key] + + +def _patch_stopall(): + """Stop all active patches. LIFO to unroll nested patches.""" + for patch in reversed(_patch._active_patches): + patch.stop() + + +patch.object = _patch_object +patch.dict = _patch_dict +patch.multiple = _patch_multiple +patch.stopall = _patch_stopall +patch.TEST_PREFIX = 'test' + +magic_methods = ( + "lt le gt ge eq ne " + "getitem setitem delitem " + "len contains iter " + "hash str sizeof " + "enter exit " + # we added divmod and rdivmod here instead of numerics + # because there is no idivmod + "divmod rdivmod neg pos abs invert " + "complex int float index " + "round trunc floor ceil " + "bool next " + "fspath " + "aiter " +) + +numerics = ( + "add sub mul matmul div floordiv mod lshift rshift and xor or pow truediv" +) +inplace = ' '.join('i%s' % n for n in numerics.split()) +right = ' '.join('r%s' % n for n in numerics.split()) + +# not including __prepare__, __instancecheck__, __subclasscheck__ +# (as they are metaclass methods) +# __del__ is not supported at all as it causes problems if it exists + +_non_defaults = { + '__get__', '__set__', '__delete__', '__reversed__', '__missing__', + '__reduce__', '__reduce_ex__', '__getinitargs__', '__getnewargs__', + '__getstate__', '__setstate__', '__getformat__', '__setformat__', + '__repr__', '__dir__', '__subclasses__', '__format__', + '__getnewargs_ex__', +} + + +def _get_method(name, func): + "Turns a callable object (like a mock) into a real function" + def method(self, /, *args, **kw): + return func(self, *args, **kw) + method.__name__ = name + return method + + +_magics = { + '__%s__' % method for method in + ' '.join([magic_methods, numerics, inplace, right]).split() +} + +# Magic methods used for async `with` statements +_async_method_magics = {"__aenter__", "__aexit__", "__anext__"} +# Magic methods that are only used with async calls but are synchronous functions themselves +_sync_async_magics = {"__aiter__"} +_async_magics = _async_method_magics | _sync_async_magics + +_all_sync_magics = _magics | _non_defaults +_all_magics = _all_sync_magics | _async_magics + +_unsupported_magics = { + '__getattr__', '__setattr__', + '__init__', '__new__', '__prepare__', + '__instancecheck__', '__subclasscheck__', + '__del__' +} + +_calculate_return_value = { + '__hash__': lambda self: object.__hash__(self), + '__str__': lambda self: object.__str__(self), + '__sizeof__': lambda self: object.__sizeof__(self), + '__fspath__': lambda self: f"{type(self).__name__}/{self._extract_mock_name()}/{id(self)}", +} + +_return_values = { + '__lt__': NotImplemented, + '__gt__': NotImplemented, + '__le__': NotImplemented, + '__ge__': NotImplemented, + '__int__': 1, + '__contains__': False, + '__len__': 0, + '__exit__': False, + '__complex__': 1j, + '__float__': 1.0, + '__bool__': True, + '__index__': 1, + '__aexit__': False, +} + + +def _get_eq(self): + def __eq__(other): + ret_val = self.__eq__._mock_return_value + if ret_val is not DEFAULT: + return ret_val + if self is other: + return True + return NotImplemented + return __eq__ + +def _get_ne(self): + def __ne__(other): + if self.__ne__._mock_return_value is not DEFAULT: + return DEFAULT + if self is other: + return False + return NotImplemented + return __ne__ + +def _get_iter(self): + def __iter__(): + ret_val = self.__iter__._mock_return_value + if ret_val is DEFAULT: + return iter([]) + # if ret_val was already an iterator, then calling iter on it should + # return the iterator unchanged + return iter(ret_val) + return __iter__ + +def _get_async_iter(self): + def __aiter__(): + ret_val = self.__aiter__._mock_return_value + if ret_val is DEFAULT: + return _AsyncIterator(iter([])) + return _AsyncIterator(iter(ret_val)) + return __aiter__ + +_side_effect_methods = { + '__eq__': _get_eq, + '__ne__': _get_ne, + '__iter__': _get_iter, + '__aiter__': _get_async_iter +} + + + +def _set_return_value(mock, method, name): + fixed = _return_values.get(name, DEFAULT) + if fixed is not DEFAULT: + method.return_value = fixed + return + + return_calculator = _calculate_return_value.get(name) + if return_calculator is not None: + return_value = return_calculator(mock) + method.return_value = return_value + return + + side_effector = _side_effect_methods.get(name) + if side_effector is not None: + method.side_effect = side_effector(mock) + + + +class MagicMixin(Base): + def __init__(self, /, *args, **kw): + self._mock_set_magics() # make magic work for kwargs in init + _safe_super(MagicMixin, self).__init__(*args, **kw) + self._mock_set_magics() # fix magic broken by upper level init + + + def _mock_set_magics(self): + orig_magics = _magics | _async_method_magics + these_magics = orig_magics + + if getattr(self, "_mock_methods", None) is not None: + these_magics = orig_magics.intersection(self._mock_methods) + + remove_magics = set() + remove_magics = orig_magics - these_magics + + for entry in remove_magics: + if entry in type(self).__dict__: + # remove unneeded magic methods + delattr(self, entry) + + # don't overwrite existing attributes if called a second time + these_magics = these_magics - set(type(self).__dict__) + + _type = type(self) + for entry in these_magics: + setattr(_type, entry, MagicProxy(entry, self)) + + + +class NonCallableMagicMock(MagicMixin, NonCallableMock): + """A version of `MagicMock` that isn't callable.""" + def mock_add_spec(self, spec, spec_set=False): + """Add a spec to a mock. `spec` can either be an object or a + list of strings. Only attributes on the `spec` can be fetched as + attributes from the mock. + + If `spec_set` is True then only attributes on the spec can be set.""" + self._mock_add_spec(spec, spec_set) + self._mock_set_magics() + + +class AsyncMagicMixin(MagicMixin): + def __init__(self, /, *args, **kw): + self._mock_set_magics() # make magic work for kwargs in init + _safe_super(AsyncMagicMixin, self).__init__(*args, **kw) + self._mock_set_magics() # fix magic broken by upper level init + +class MagicMock(MagicMixin, Mock): + """ + MagicMock is a subclass of Mock with default implementations + of most of the magic methods. You can use MagicMock without having to + configure the magic methods yourself. + + If you use the `spec` or `spec_set` arguments then *only* magic + methods that exist in the spec will be created. + + Attributes and the return value of a `MagicMock` will also be `MagicMocks`. + """ + def mock_add_spec(self, spec, spec_set=False): + """Add a spec to a mock. `spec` can either be an object or a + list of strings. Only attributes on the `spec` can be fetched as + attributes from the mock. + + If `spec_set` is True then only attributes on the spec can be set.""" + self._mock_add_spec(spec, spec_set) + self._mock_set_magics() + + + +class MagicProxy(Base): + def __init__(self, name, parent): + self.name = name + self.parent = parent + + def create_mock(self): + entry = self.name + parent = self.parent + m = parent._get_child_mock(name=entry, _new_name=entry, + _new_parent=parent) + setattr(parent, entry, m) + _set_return_value(parent, m, entry) + return m + + def __get__(self, obj, _type=None): + return self.create_mock() + + +class AsyncMockMixin(Base): + await_count = _delegating_property('await_count') + await_args = _delegating_property('await_args') + await_args_list = _delegating_property('await_args_list') + + def __init__(self, /, *args, **kwargs): + super().__init__(*args, **kwargs) + # iscoroutinefunction() checks _is_coroutine property to say if an + # object is a coroutine. Without this check it looks to see if it is a + # function/method, which in this case it is not (since it is an + # AsyncMock). + # It is set through __dict__ because when spec_set is True, this + # attribute is likely undefined. + self.__dict__['_is_coroutine'] = asyncio.coroutines._is_coroutine + self.__dict__['_mock_await_count'] = 0 + self.__dict__['_mock_await_args'] = None + self.__dict__['_mock_await_args_list'] = _CallList() + code_mock = NonCallableMock(spec_set=CodeType) + code_mock.co_flags = inspect.CO_COROUTINE + self.__dict__['__code__'] = code_mock + self.__dict__['__name__'] = 'AsyncMock' + self.__dict__['__defaults__'] = tuple() + self.__dict__['__kwdefaults__'] = {} + self.__dict__['__annotations__'] = None + + async def _execute_mock_call(self, /, *args, **kwargs): + # This is nearly just like super(), except for special handling + # of coroutines + + _call = _Call((args, kwargs), two=True) + self.await_count += 1 + self.await_args = _call + self.await_args_list.append(_call) + + effect = self.side_effect + if effect is not None: + if _is_exception(effect): + raise effect + elif not _callable(effect): + try: + result = next(effect) + except StopIteration: + # It is impossible to propogate a StopIteration + # through coroutines because of PEP 479 + raise StopAsyncIteration + if _is_exception(result): + raise result + elif iscoroutinefunction(effect): + result = await effect(*args, **kwargs) + else: + result = effect(*args, **kwargs) + + if result is not DEFAULT: + return result + + if self._mock_return_value is not DEFAULT: + return self.return_value + + if self._mock_wraps is not None: + if iscoroutinefunction(self._mock_wraps): + return await self._mock_wraps(*args, **kwargs) + return self._mock_wraps(*args, **kwargs) + + return self.return_value + + def assert_awaited(self): + """ + Assert that the mock was awaited at least once. + """ + if self.await_count == 0: + msg = f"Expected {self._mock_name or 'mock'} to have been awaited." + raise AssertionError(msg) + + def assert_awaited_once(self): + """ + Assert that the mock was awaited exactly once. + """ + if not self.await_count == 1: + msg = (f"Expected {self._mock_name or 'mock'} to have been awaited once." + f" Awaited {self.await_count} times.") + raise AssertionError(msg) + + def assert_awaited_with(self, /, *args, **kwargs): + """ + Assert that the last await was with the specified arguments. + """ + if self.await_args is None: + expected = self._format_mock_call_signature(args, kwargs) + raise AssertionError(f'Expected await: {expected}\nNot awaited') + + def _error_message(): + msg = self._format_mock_failure_message(args, kwargs, action='await') + return msg + + expected = self._call_matcher(_Call((args, kwargs), two=True)) + actual = self._call_matcher(self.await_args) + if actual != expected: + cause = expected if isinstance(expected, Exception) else None + raise AssertionError(_error_message()) from cause + + def assert_awaited_once_with(self, /, *args, **kwargs): + """ + Assert that the mock was awaited exactly once and with the specified + arguments. + """ + if not self.await_count == 1: + msg = (f"Expected {self._mock_name or 'mock'} to have been awaited once." + f" Awaited {self.await_count} times.") + raise AssertionError(msg) + return self.assert_awaited_with(*args, **kwargs) + + def assert_any_await(self, /, *args, **kwargs): + """ + Assert the mock has ever been awaited with the specified arguments. + """ + expected = self._call_matcher(_Call((args, kwargs), two=True)) + cause = expected if isinstance(expected, Exception) else None + actual = [self._call_matcher(c) for c in self.await_args_list] + if cause or expected not in _AnyComparer(actual): + expected_string = self._format_mock_call_signature(args, kwargs) + raise AssertionError( + '%s await not found' % expected_string + ) from cause + + def assert_has_awaits(self, calls, any_order=False): + """ + Assert the mock has been awaited with the specified calls. + The :attr:`await_args_list` list is checked for the awaits. + + If `any_order` is False (the default) then the awaits must be + sequential. There can be extra calls before or after the + specified awaits. + + If `any_order` is True then the awaits can be in any order, but + they must all appear in :attr:`await_args_list`. + """ + expected = [self._call_matcher(c) for c in calls] + cause = next((e for e in expected if isinstance(e, Exception)), None) + all_awaits = _CallList(self._call_matcher(c) for c in self.await_args_list) + if not any_order: + if expected not in all_awaits: + if cause is None: + problem = 'Awaits not found.' + else: + problem = ('Error processing expected awaits.\n' + 'Errors: {}').format( + [e if isinstance(e, Exception) else None + for e in expected]) + raise AssertionError( + f'{problem}\n' + f'Expected: {_CallList(calls)}\n' + f'Actual: {self.await_args_list}' + ) from cause + return + + all_awaits = list(all_awaits) + + not_found = [] + for kall in expected: + try: + all_awaits.remove(kall) + except ValueError: + not_found.append(kall) + if not_found: + raise AssertionError( + '%r not all found in await list' % (tuple(not_found),) + ) from cause + + def assert_not_awaited(self): + """ + Assert that the mock was never awaited. + """ + if self.await_count != 0: + msg = (f"Expected {self._mock_name or 'mock'} to not have been awaited." + f" Awaited {self.await_count} times.") + raise AssertionError(msg) + + def reset_mock(self, /, *args, **kwargs): + """ + See :func:`.Mock.reset_mock()` + """ + super().reset_mock(*args, **kwargs) + self.await_count = 0 + self.await_args = None + self.await_args_list = _CallList() + + +class AsyncMock(AsyncMockMixin, AsyncMagicMixin, Mock): + """ + Enhance :class:`Mock` with features allowing to mock + an async function. + + The :class:`AsyncMock` object will behave so the object is + recognized as an async function, and the result of a call is an awaitable: + + >>> mock = AsyncMock() + >>> iscoroutinefunction(mock) + True + >>> inspect.isawaitable(mock()) + True + + + The result of ``mock()`` is an async function which will have the outcome + of ``side_effect`` or ``return_value``: + + - if ``side_effect`` is a function, the async function will return the + result of that function, + - if ``side_effect`` is an exception, the async function will raise the + exception, + - if ``side_effect`` is an iterable, the async function will return the + next value of the iterable, however, if the sequence of result is + exhausted, ``StopIteration`` is raised immediately, + - if ``side_effect`` is not defined, the async function will return the + value defined by ``return_value``, hence, by default, the async function + returns a new :class:`AsyncMock` object. + + If the outcome of ``side_effect`` or ``return_value`` is an async function, + the mock async function obtained when the mock object is called will be this + async function itself (and not an async function returning an async + function). + + The test author can also specify a wrapped object with ``wraps``. In this + case, the :class:`Mock` object behavior is the same as with an + :class:`.Mock` object: the wrapped object may have methods + defined as async function functions. + + Based on Martin Richard's asynctest project. + """ + + +class _ANY(object): + "A helper object that compares equal to everything." + + def __eq__(self, other): + return True + + def __ne__(self, other): + return False + + def __repr__(self): + return '' + +ANY = _ANY() + + + +def _format_call_signature(name, args, kwargs): + message = '%s(%%s)' % name + formatted_args = '' + args_string = ', '.join([repr(arg) for arg in args]) + kwargs_string = ', '.join([ + '%s=%r' % (key, value) for key, value in kwargs.items() + ]) + if args_string: + formatted_args = args_string + if kwargs_string: + if formatted_args: + formatted_args += ', ' + formatted_args += kwargs_string + + return message % formatted_args + + + +class _Call(tuple): + """ + A tuple for holding the results of a call to a mock, either in the form + `(args, kwargs)` or `(name, args, kwargs)`. + + If args or kwargs are empty then a call tuple will compare equal to + a tuple without those values. This makes comparisons less verbose:: + + _Call(('name', (), {})) == ('name',) + _Call(('name', (1,), {})) == ('name', (1,)) + _Call(((), {'a': 'b'})) == ({'a': 'b'},) + + The `_Call` object provides a useful shortcut for comparing with call:: + + _Call(((1, 2), {'a': 3})) == call(1, 2, a=3) + _Call(('foo', (1, 2), {'a': 3})) == call.foo(1, 2, a=3) + + If the _Call has no name then it will match any name. + """ + def __new__(cls, value=(), name='', parent=None, two=False, + from_kall=True): + args = () + kwargs = {} + _len = len(value) + if _len == 3: + name, args, kwargs = value + elif _len == 2: + first, second = value + if isinstance(first, str): + name = first + if isinstance(second, tuple): + args = second + else: + kwargs = second + else: + args, kwargs = first, second + elif _len == 1: + value, = value + if isinstance(value, str): + name = value + elif isinstance(value, tuple): + args = value + else: + kwargs = value + + if two: + return tuple.__new__(cls, (args, kwargs)) + + return tuple.__new__(cls, (name, args, kwargs)) + + + def __init__(self, value=(), name=None, parent=None, two=False, + from_kall=True): + self._mock_name = name + self._mock_parent = parent + self._mock_from_kall = from_kall + + + def __eq__(self, other): + try: + len_other = len(other) + except TypeError: + return NotImplemented + + self_name = '' + if len(self) == 2: + self_args, self_kwargs = self + else: + self_name, self_args, self_kwargs = self + + if (getattr(self, '_mock_parent', None) and getattr(other, '_mock_parent', None) + and self._mock_parent != other._mock_parent): + return False + + other_name = '' + if len_other == 0: + other_args, other_kwargs = (), {} + elif len_other == 3: + other_name, other_args, other_kwargs = other + elif len_other == 1: + value, = other + if isinstance(value, tuple): + other_args = value + other_kwargs = {} + elif isinstance(value, str): + other_name = value + other_args, other_kwargs = (), {} + else: + other_args = () + other_kwargs = value + elif len_other == 2: + # could be (name, args) or (name, kwargs) or (args, kwargs) + first, second = other + if isinstance(first, str): + other_name = first + if isinstance(second, tuple): + other_args, other_kwargs = second, {} + else: + other_args, other_kwargs = (), second + else: + other_args, other_kwargs = first, second + else: + return False + + if self_name and other_name != self_name: + return False + + # this order is important for ANY to work! + return (other_args, other_kwargs) == (self_args, self_kwargs) + + + __ne__ = object.__ne__ + + + def __call__(self, /, *args, **kwargs): + if self._mock_name is None: + return _Call(('', args, kwargs), name='()') + + name = self._mock_name + '()' + return _Call((self._mock_name, args, kwargs), name=name, parent=self) + + + def __getattr__(self, attr): + if self._mock_name is None: + return _Call(name=attr, from_kall=False) + name = '%s.%s' % (self._mock_name, attr) + return _Call(name=name, parent=self, from_kall=False) + + + def __getattribute__(self, attr): + if attr in tuple.__dict__: + raise AttributeError + return tuple.__getattribute__(self, attr) + + + def _get_call_arguments(self): + if len(self) == 2: + args, kwargs = self + else: + name, args, kwargs = self + + return args, kwargs + + @property + def args(self): + return self._get_call_arguments()[0] + + @property + def kwargs(self): + return self._get_call_arguments()[1] + + def __repr__(self): + if not self._mock_from_kall: + name = self._mock_name or 'call' + if name.startswith('()'): + name = 'call%s' % name + return name + + if len(self) == 2: + name = 'call' + args, kwargs = self + else: + name, args, kwargs = self + if not name: + name = 'call' + elif not name.startswith('()'): + name = 'call.%s' % name + else: + name = 'call%s' % name + return _format_call_signature(name, args, kwargs) + + + def call_list(self): + """For a call object that represents multiple calls, `call_list` + returns a list of all the intermediate calls as well as the + final call.""" + vals = [] + thing = self + while thing is not None: + if thing._mock_from_kall: + vals.append(thing) + thing = thing._mock_parent + return _CallList(reversed(vals)) + + +call = _Call(from_kall=False) + + +def create_autospec(spec, spec_set=False, instance=False, _parent=None, + _name=None, *, unsafe=False, **kwargs): + """Create a mock object using another object as a spec. Attributes on the + mock will use the corresponding attribute on the `spec` object as their + spec. + + Functions or methods being mocked will have their arguments checked + to check that they are called with the correct signature. + + If `spec_set` is True then attempting to set attributes that don't exist + on the spec object will raise an `AttributeError`. + + If a class is used as a spec then the return value of the mock (the + instance of the class) will have the same spec. You can use a class as the + spec for an instance object by passing `instance=True`. The returned mock + will only be callable if instances of the mock are callable. + + `create_autospec` will raise a `RuntimeError` if passed some common + misspellings of the arguments autospec and spec_set. Pass the argument + `unsafe` with the value True to disable that check. + + `create_autospec` also takes arbitrary keyword arguments that are passed to + the constructor of the created mock.""" + if _is_list(spec): + # can't pass a list instance to the mock constructor as it will be + # interpreted as a list of strings + spec = type(spec) + + is_type = isinstance(spec, type) + if _is_instance_mock(spec): + raise InvalidSpecError(f'Cannot autospec a Mock object. ' + f'[object={spec!r}]') + is_async_func = _is_async_func(spec) + _kwargs = {'spec': spec} + if spec_set: + _kwargs = {'spec_set': spec} + elif spec is None: + # None we mock with a normal mock without a spec + _kwargs = {} + if _kwargs and instance: + _kwargs['_spec_as_instance'] = True + if not unsafe: + _check_spec_arg_typos(kwargs) + + _kwargs.update(kwargs) + + Klass = MagicMock + if inspect.isdatadescriptor(spec): + # descriptors don't have a spec + # because we don't know what type they return + _kwargs = {} + elif is_async_func: + if instance: + raise RuntimeError("Instance can not be True when create_autospec " + "is mocking an async function") + Klass = AsyncMock + elif not _callable(spec): + Klass = NonCallableMagicMock + elif is_type and instance and not _instance_callable(spec): + Klass = NonCallableMagicMock + + _name = _kwargs.pop('name', _name) + + _new_name = _name + if _parent is None: + # for a top level object no _new_name should be set + _new_name = '' + + mock = Klass(parent=_parent, _new_parent=_parent, _new_name=_new_name, + name=_name, **_kwargs) + + if isinstance(spec, FunctionTypes): + # should only happen at the top level because we don't + # recurse for functions + mock = _set_signature(mock, spec) + if is_async_func: + _setup_async_mock(mock) + else: + _check_signature(spec, mock, is_type, instance) + + if _parent is not None and not instance: + _parent._mock_children[_name] = mock + + if is_type and not instance and 'return_value' not in kwargs: + mock.return_value = create_autospec(spec, spec_set, instance=True, + _name='()', _parent=mock) + + for entry in dir(spec): + if _is_magic(entry): + # MagicMock already does the useful magic methods for us + continue + + # XXXX do we need a better way of getting attributes without + # triggering code execution (?) Probably not - we need the actual + # object to mock it so we would rather trigger a property than mock + # the property descriptor. Likewise we want to mock out dynamically + # provided attributes. + # XXXX what about attributes that raise exceptions other than + # AttributeError on being fetched? + # we could be resilient against it, or catch and propagate the + # exception when the attribute is fetched from the mock + try: + original = getattr(spec, entry) + except AttributeError: + continue + + kwargs = {'spec': original} + if spec_set: + kwargs = {'spec_set': original} + + if not isinstance(original, FunctionTypes): + new = _SpecState(original, spec_set, mock, entry, instance) + mock._mock_children[entry] = new + else: + parent = mock + if isinstance(spec, FunctionTypes): + parent = mock.mock + + skipfirst = _must_skip(spec, entry, is_type) + kwargs['_eat_self'] = skipfirst + if iscoroutinefunction(original): + child_klass = AsyncMock + else: + child_klass = MagicMock + new = child_klass(parent=parent, name=entry, _new_name=entry, + _new_parent=parent, + **kwargs) + mock._mock_children[entry] = new + _check_signature(original, new, skipfirst=skipfirst) + + # so functions created with _set_signature become instance attributes, + # *plus* their underlying mock exists in _mock_children of the parent + # mock. Adding to _mock_children may be unnecessary where we are also + # setting as an instance attribute? + if isinstance(new, FunctionTypes): + setattr(mock, entry, new) + + return mock + + +def _must_skip(spec, entry, is_type): + """ + Return whether we should skip the first argument on spec's `entry` + attribute. + """ + if not isinstance(spec, type): + if entry in getattr(spec, '__dict__', {}): + # instance attribute - shouldn't skip + return False + spec = spec.__class__ + + for klass in spec.__mro__: + result = klass.__dict__.get(entry, DEFAULT) + if result is DEFAULT: + continue + if isinstance(result, (staticmethod, classmethod)): + return False + elif isinstance(result, FunctionTypes): + # Normal method => skip if looked up on type + # (if looked up on instance, self is already skipped) + return is_type + else: + return False + + # function is a dynamically provided attribute + return is_type + + +class _SpecState(object): + + def __init__(self, spec, spec_set=False, parent=None, + name=None, ids=None, instance=False): + self.spec = spec + self.ids = ids + self.spec_set = spec_set + self.parent = parent + self.instance = instance + self.name = name + + +FunctionTypes = ( + # python function + type(create_autospec), + # instance method + type(ANY.__eq__), +) + + +file_spec = None + + +def _to_stream(read_data): + if isinstance(read_data, bytes): + return io.BytesIO(read_data) + else: + return io.StringIO(read_data) + + +def mock_open(mock=None, read_data=''): + """ + A helper function to create a mock to replace the use of `open`. It works + for `open` called directly or used as a context manager. + + The `mock` argument is the mock object to configure. If `None` (the + default) then a `MagicMock` will be created for you, with the API limited + to methods or attributes available on standard file handles. + + `read_data` is a string for the `read`, `readline` and `readlines` of the + file handle to return. This is an empty string by default. + """ + _read_data = _to_stream(read_data) + _state = [_read_data, None] + + def _readlines_side_effect(*args, **kwargs): + if handle.readlines.return_value is not None: + return handle.readlines.return_value + return _state[0].readlines(*args, **kwargs) + + def _read_side_effect(*args, **kwargs): + if handle.read.return_value is not None: + return handle.read.return_value + return _state[0].read(*args, **kwargs) + + def _readline_side_effect(*args, **kwargs): + yield from _iter_side_effect() + while True: + yield _state[0].readline(*args, **kwargs) + + def _iter_side_effect(): + if handle.readline.return_value is not None: + while True: + yield handle.readline.return_value + for line in _state[0]: + yield line + + def _next_side_effect(): + if handle.readline.return_value is not None: + return handle.readline.return_value + return next(_state[0]) + + global file_spec + if file_spec is None: + import _io + file_spec = list(set(dir(_io.TextIOWrapper)).union(set(dir(_io.BytesIO)))) + + if mock is None: + mock = MagicMock(name='open', spec=open) + + handle = MagicMock(spec=file_spec) + handle.__enter__.return_value = handle + + handle.write.return_value = None + handle.read.return_value = None + handle.readline.return_value = None + handle.readlines.return_value = None + + handle.read.side_effect = _read_side_effect + _state[1] = _readline_side_effect() + handle.readline.side_effect = _state[1] + handle.readlines.side_effect = _readlines_side_effect + handle.__iter__.side_effect = _iter_side_effect + handle.__next__.side_effect = _next_side_effect + + def reset_data(*args, **kwargs): + _state[0] = _to_stream(read_data) + if handle.readline.side_effect == _state[1]: + # Only reset the side effect if the user hasn't overridden it. + _state[1] = _readline_side_effect() + handle.readline.side_effect = _state[1] + return DEFAULT + + mock.side_effect = reset_data + mock.return_value = handle + return mock + + +class PropertyMock(Mock): + """ + A mock intended to be used as a property, or other descriptor, on a class. + `PropertyMock` provides `__get__` and `__set__` methods so you can specify + a return value when it is fetched. + + Fetching a `PropertyMock` instance from an object calls the mock, with + no args. Setting it calls the mock with the value being set. + """ + def _get_child_mock(self, /, **kwargs): + return MagicMock(**kwargs) + + def __get__(self, obj, obj_type=None): + return self() + def __set__(self, obj, val): + self(val) + + +def seal(mock): + """Disable the automatic generation of child mocks. + + Given an input Mock, seals it to ensure no further mocks will be generated + when accessing an attribute that was not already defined. + + The operation recursively seals the mock passed in, meaning that + the mock itself, any mocks generated by accessing one of its attributes, + and all assigned mocks without a name or spec will be sealed. + """ + mock._mock_sealed = True + for attr in dir(mock): + try: + m = getattr(mock, attr) + except AttributeError: + continue + if not isinstance(m, NonCallableMock): + continue + if isinstance(m._mock_children.get(attr), _SpecState): + continue + if m._mock_new_parent is mock: + seal(m) + + +class _AsyncIterator: + """ + Wraps an iterator in an asynchronous iterator. + """ + def __init__(self, iterator): + self.iterator = iterator + code_mock = NonCallableMock(spec_set=CodeType) + code_mock.co_flags = inspect.CO_ITERABLE_COROUTINE + self.__dict__['__code__'] = code_mock + + async def __anext__(self): + try: + return next(self.iterator) + except StopIteration: + pass + raise StopAsyncIteration diff --git a/miniconda3/envs/active_proaction/lib/python3.10/unittest/result.py b/miniconda3/envs/active_proaction/lib/python3.10/unittest/result.py new file mode 100644 index 0000000000000000000000000000000000000000..5ca4c23238b41985bffaa03a867e46480da86867 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/unittest/result.py @@ -0,0 +1,244 @@ +"""Test result object""" + +import io +import sys +import traceback + +from . import util +from functools import wraps + +__unittest = True + +def failfast(method): + @wraps(method) + def inner(self, *args, **kw): + if getattr(self, 'failfast', False): + self.stop() + return method(self, *args, **kw) + return inner + +STDOUT_LINE = '\nStdout:\n%s' +STDERR_LINE = '\nStderr:\n%s' + + +class TestResult(object): + """Holder for test result information. + + Test results are automatically managed by the TestCase and TestSuite + classes, and do not need to be explicitly manipulated by writers of tests. + + Each instance holds the total number of tests run, and collections of + failures and errors that occurred among those test runs. The collections + contain tuples of (testcase, exceptioninfo), where exceptioninfo is the + formatted traceback of the error that occurred. + """ + _previousTestClass = None + _testRunEntered = False + _moduleSetUpFailed = False + def __init__(self, stream=None, descriptions=None, verbosity=None): + self.failfast = False + self.failures = [] + self.errors = [] + self.testsRun = 0 + self.skipped = [] + self.expectedFailures = [] + self.unexpectedSuccesses = [] + self.shouldStop = False + self.buffer = False + self.tb_locals = False + self._stdout_buffer = None + self._stderr_buffer = None + self._original_stdout = sys.stdout + self._original_stderr = sys.stderr + self._mirrorOutput = False + + def printErrors(self): + "Called by TestRunner after test run" + + def startTest(self, test): + "Called when the given test is about to be run" + self.testsRun += 1 + self._mirrorOutput = False + self._setupStdout() + + def _setupStdout(self): + if self.buffer: + if self._stderr_buffer is None: + self._stderr_buffer = io.StringIO() + self._stdout_buffer = io.StringIO() + sys.stdout = self._stdout_buffer + sys.stderr = self._stderr_buffer + + def startTestRun(self): + """Called once before any tests are executed. + + See startTest for a method called before each test. + """ + + def stopTest(self, test): + """Called when the given test has been run""" + self._restoreStdout() + self._mirrorOutput = False + + def _restoreStdout(self): + if self.buffer: + if self._mirrorOutput: + output = sys.stdout.getvalue() + error = sys.stderr.getvalue() + if output: + if not output.endswith('\n'): + output += '\n' + self._original_stdout.write(STDOUT_LINE % output) + if error: + if not error.endswith('\n'): + error += '\n' + self._original_stderr.write(STDERR_LINE % error) + + sys.stdout = self._original_stdout + sys.stderr = self._original_stderr + self._stdout_buffer.seek(0) + self._stdout_buffer.truncate() + self._stderr_buffer.seek(0) + self._stderr_buffer.truncate() + + def stopTestRun(self): + """Called once after all tests are executed. + + See stopTest for a method called after each test. + """ + + @failfast + def addError(self, test, err): + """Called when an error has occurred. 'err' is a tuple of values as + returned by sys.exc_info(). + """ + self.errors.append((test, self._exc_info_to_string(err, test))) + self._mirrorOutput = True + + @failfast + def addFailure(self, test, err): + """Called when an error has occurred. 'err' is a tuple of values as + returned by sys.exc_info().""" + self.failures.append((test, self._exc_info_to_string(err, test))) + self._mirrorOutput = True + + def addSubTest(self, test, subtest, err): + """Called at the end of a subtest. + 'err' is None if the subtest ended successfully, otherwise it's a + tuple of values as returned by sys.exc_info(). + """ + # By default, we don't do anything with successful subtests, but + # more sophisticated test results might want to record them. + if err is not None: + if getattr(self, 'failfast', False): + self.stop() + if issubclass(err[0], test.failureException): + errors = self.failures + else: + errors = self.errors + errors.append((subtest, self._exc_info_to_string(err, test))) + self._mirrorOutput = True + + def addSuccess(self, test): + "Called when a test has completed successfully" + pass + + def addSkip(self, test, reason): + """Called when a test is skipped.""" + self.skipped.append((test, reason)) + + def addExpectedFailure(self, test, err): + """Called when an expected failure/error occurred.""" + self.expectedFailures.append( + (test, self._exc_info_to_string(err, test))) + + @failfast + def addUnexpectedSuccess(self, test): + """Called when a test was expected to fail, but succeed.""" + self.unexpectedSuccesses.append(test) + + def wasSuccessful(self): + """Tells whether or not this result was a success.""" + # The hasattr check is for test_result's OldResult test. That + # way this method works on objects that lack the attribute. + # (where would such result instances come from? old stored pickles?) + return ((len(self.failures) == len(self.errors) == 0) and + (not hasattr(self, 'unexpectedSuccesses') or + len(self.unexpectedSuccesses) == 0)) + + def stop(self): + """Indicates that the tests should be aborted.""" + self.shouldStop = True + + def _exc_info_to_string(self, err, test): + """Converts a sys.exc_info()-style tuple of values into a string.""" + exctype, value, tb = err + tb = self._clean_tracebacks(exctype, value, tb, test) + tb_e = traceback.TracebackException( + exctype, value, tb, + capture_locals=self.tb_locals, compact=True) + msgLines = list(tb_e.format()) + + if self.buffer: + output = sys.stdout.getvalue() + error = sys.stderr.getvalue() + if output: + if not output.endswith('\n'): + output += '\n' + msgLines.append(STDOUT_LINE % output) + if error: + if not error.endswith('\n'): + error += '\n' + msgLines.append(STDERR_LINE % error) + return ''.join(msgLines) + + def _clean_tracebacks(self, exctype, value, tb, test): + ret = None + first = True + excs = [(exctype, value, tb)] + seen = {id(value)} # Detect loops in chained exceptions. + while excs: + (exctype, value, tb) = excs.pop() + # Skip test runner traceback levels + while tb and self._is_relevant_tb_level(tb): + tb = tb.tb_next + + # Skip assert*() traceback levels + if exctype is test.failureException: + self._remove_unittest_tb_frames(tb) + + if first: + ret = tb + first = False + else: + value.__traceback__ = tb + + if value is not None: + for c in (value.__cause__, value.__context__): + if c is not None and id(c) not in seen: + excs.append((type(c), c, c.__traceback__)) + seen.add(id(c)) + return ret + + def _is_relevant_tb_level(self, tb): + return '__unittest' in tb.tb_frame.f_globals + + def _remove_unittest_tb_frames(self, tb): + '''Truncates usercode tb at the first unittest frame. + + If the first frame of the traceback is in user code, + the prefix up to the first unittest frame is returned. + If the first frame is already in the unittest module, + the traceback is not modified. + ''' + prev = None + while tb and not self._is_relevant_tb_level(tb): + prev = tb + tb = tb.tb_next + if prev is not None: + prev.tb_next = None + + def __repr__(self): + return ("<%s run=%i errors=%i failures=%i>" % + (util.strclass(self.__class__), self.testsRun, len(self.errors), + len(self.failures))) diff --git a/miniconda3/envs/active_proaction/lib/python3.10/unittest/runner.py b/miniconda3/envs/active_proaction/lib/python3.10/unittest/runner.py new file mode 100644 index 0000000000000000000000000000000000000000..caf159002d8bb6778b53315a96dabc2e177ac23c --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/unittest/runner.py @@ -0,0 +1,230 @@ +"""Running tests""" + +import sys +import time +import warnings + +from . import result +from .signals import registerResult + +__unittest = True + + +class _WritelnDecorator(object): + """Used to decorate file-like objects with a handy 'writeln' method""" + def __init__(self,stream): + self.stream = stream + + def __getattr__(self, attr): + if attr in ('stream', '__getstate__'): + raise AttributeError(attr) + return getattr(self.stream,attr) + + def writeln(self, arg=None): + if arg: + self.write(arg) + self.write('\n') # text-mode streams translate to \r\n if needed + + +class TextTestResult(result.TestResult): + """A test result class that can print formatted text results to a stream. + + Used by TextTestRunner. + """ + separator1 = '=' * 70 + separator2 = '-' * 70 + + def __init__(self, stream, descriptions, verbosity): + super(TextTestResult, self).__init__(stream, descriptions, verbosity) + self.stream = stream + self.showAll = verbosity > 1 + self.dots = verbosity == 1 + self.descriptions = descriptions + + def getDescription(self, test): + doc_first_line = test.shortDescription() + if self.descriptions and doc_first_line: + return '\n'.join((str(test), doc_first_line)) + else: + return str(test) + + def startTest(self, test): + super(TextTestResult, self).startTest(test) + if self.showAll: + self.stream.write(self.getDescription(test)) + self.stream.write(" ... ") + self.stream.flush() + + def addSuccess(self, test): + super(TextTestResult, self).addSuccess(test) + if self.showAll: + self.stream.writeln("ok") + self.stream.flush() + elif self.dots: + self.stream.write('.') + self.stream.flush() + + def addError(self, test, err): + super(TextTestResult, self).addError(test, err) + if self.showAll: + self.stream.writeln("ERROR") + self.stream.flush() + elif self.dots: + self.stream.write('E') + self.stream.flush() + + def addFailure(self, test, err): + super(TextTestResult, self).addFailure(test, err) + if self.showAll: + self.stream.writeln("FAIL") + self.stream.flush() + elif self.dots: + self.stream.write('F') + self.stream.flush() + + def addSkip(self, test, reason): + super(TextTestResult, self).addSkip(test, reason) + if self.showAll: + self.stream.writeln("skipped {0!r}".format(reason)) + self.stream.flush() + elif self.dots: + self.stream.write("s") + self.stream.flush() + + def addExpectedFailure(self, test, err): + super(TextTestResult, self).addExpectedFailure(test, err) + if self.showAll: + self.stream.writeln("expected failure") + self.stream.flush() + elif self.dots: + self.stream.write("x") + self.stream.flush() + + def addUnexpectedSuccess(self, test): + super(TextTestResult, self).addUnexpectedSuccess(test) + if self.showAll: + self.stream.writeln("unexpected success") + self.stream.flush() + elif self.dots: + self.stream.write("u") + self.stream.flush() + + def printErrors(self): + if self.dots or self.showAll: + self.stream.writeln() + self.stream.flush() + self.printErrorList('ERROR', self.errors) + self.printErrorList('FAIL', self.failures) + + def printErrorList(self, flavour, errors): + for test, err in errors: + self.stream.writeln(self.separator1) + self.stream.writeln("%s: %s" % (flavour,self.getDescription(test))) + self.stream.writeln(self.separator2) + self.stream.writeln("%s" % err) + self.stream.flush() + + +class TextTestRunner(object): + """A test runner class that displays results in textual form. + + It prints out the names of tests as they are run, errors as they + occur, and a summary of the results at the end of the test run. + """ + resultclass = TextTestResult + + def __init__(self, stream=None, descriptions=True, verbosity=1, + failfast=False, buffer=False, resultclass=None, warnings=None, + *, tb_locals=False): + """Construct a TextTestRunner. + + Subclasses should accept **kwargs to ensure compatibility as the + interface changes. + """ + if stream is None: + stream = sys.stderr + self.stream = _WritelnDecorator(stream) + self.descriptions = descriptions + self.verbosity = verbosity + self.failfast = failfast + self.buffer = buffer + self.tb_locals = tb_locals + self.warnings = warnings + if resultclass is not None: + self.resultclass = resultclass + + def _makeResult(self): + return self.resultclass(self.stream, self.descriptions, self.verbosity) + + def run(self, test): + "Run the given test case or test suite." + result = self._makeResult() + registerResult(result) + result.failfast = self.failfast + result.buffer = self.buffer + result.tb_locals = self.tb_locals + with warnings.catch_warnings(): + if self.warnings: + # if self.warnings is set, use it to filter all the warnings + warnings.simplefilter(self.warnings) + # if the filter is 'default' or 'always', special-case the + # warnings from the deprecated unittest methods to show them + # no more than once per module, because they can be fairly + # noisy. The -Wd and -Wa flags can be used to bypass this + # only when self.warnings is None. + if self.warnings in ['default', 'always']: + warnings.filterwarnings('module', + category=DeprecationWarning, + message=r'Please use assert\w+ instead.') + startTime = time.perf_counter() + startTestRun = getattr(result, 'startTestRun', None) + if startTestRun is not None: + startTestRun() + try: + test(result) + finally: + stopTestRun = getattr(result, 'stopTestRun', None) + if stopTestRun is not None: + stopTestRun() + stopTime = time.perf_counter() + timeTaken = stopTime - startTime + result.printErrors() + if hasattr(result, 'separator2'): + self.stream.writeln(result.separator2) + run = result.testsRun + self.stream.writeln("Ran %d test%s in %.3fs" % + (run, run != 1 and "s" or "", timeTaken)) + self.stream.writeln() + + expectedFails = unexpectedSuccesses = skipped = 0 + try: + results = map(len, (result.expectedFailures, + result.unexpectedSuccesses, + result.skipped)) + except AttributeError: + pass + else: + expectedFails, unexpectedSuccesses, skipped = results + + infos = [] + if not result.wasSuccessful(): + self.stream.write("FAILED") + failed, errored = len(result.failures), len(result.errors) + if failed: + infos.append("failures=%d" % failed) + if errored: + infos.append("errors=%d" % errored) + else: + self.stream.write("OK") + if skipped: + infos.append("skipped=%d" % skipped) + if expectedFails: + infos.append("expected failures=%d" % expectedFails) + if unexpectedSuccesses: + infos.append("unexpected successes=%d" % unexpectedSuccesses) + if infos: + self.stream.writeln(" (%s)" % (", ".join(infos),)) + else: + self.stream.write("\n") + self.stream.flush() + return result diff --git a/miniconda3/envs/active_proaction/lib/python3.10/unittest/signals.py b/miniconda3/envs/active_proaction/lib/python3.10/unittest/signals.py new file mode 100644 index 0000000000000000000000000000000000000000..e6a5fc524397121e170bd5a888957374b91ba946 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/unittest/signals.py @@ -0,0 +1,71 @@ +import signal +import weakref + +from functools import wraps + +__unittest = True + + +class _InterruptHandler(object): + def __init__(self, default_handler): + self.called = False + self.original_handler = default_handler + if isinstance(default_handler, int): + if default_handler == signal.SIG_DFL: + # Pretend it's signal.default_int_handler instead. + default_handler = signal.default_int_handler + elif default_handler == signal.SIG_IGN: + # Not quite the same thing as SIG_IGN, but the closest we + # can make it: do nothing. + def default_handler(unused_signum, unused_frame): + pass + else: + raise TypeError("expected SIGINT signal handler to be " + "signal.SIG_IGN, signal.SIG_DFL, or a " + "callable object") + self.default_handler = default_handler + + def __call__(self, signum, frame): + installed_handler = signal.getsignal(signal.SIGINT) + if installed_handler is not self: + # if we aren't the installed handler, then delegate immediately + # to the default handler + self.default_handler(signum, frame) + + if self.called: + self.default_handler(signum, frame) + self.called = True + for result in _results.keys(): + result.stop() + +_results = weakref.WeakKeyDictionary() +def registerResult(result): + _results[result] = 1 + +def removeResult(result): + return bool(_results.pop(result, None)) + +_interrupt_handler = None +def installHandler(): + global _interrupt_handler + if _interrupt_handler is None: + default_handler = signal.getsignal(signal.SIGINT) + _interrupt_handler = _InterruptHandler(default_handler) + signal.signal(signal.SIGINT, _interrupt_handler) + + +def removeHandler(method=None): + if method is not None: + @wraps(method) + def inner(*args, **kwargs): + initial = signal.getsignal(signal.SIGINT) + removeHandler() + try: + return method(*args, **kwargs) + finally: + signal.signal(signal.SIGINT, initial) + return inner + + global _interrupt_handler + if _interrupt_handler is not None: + signal.signal(signal.SIGINT, _interrupt_handler.original_handler) diff --git a/miniconda3/envs/active_proaction/lib/python3.10/unittest/suite.py b/miniconda3/envs/active_proaction/lib/python3.10/unittest/suite.py new file mode 100644 index 0000000000000000000000000000000000000000..6f45b6fe5f6039b94725b732e18eab5c01f4494b --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/unittest/suite.py @@ -0,0 +1,379 @@ +"""TestSuite""" + +import sys + +from . import case +from . import util + +__unittest = True + + +def _call_if_exists(parent, attr): + func = getattr(parent, attr, lambda: None) + func() + + +class BaseTestSuite(object): + """A simple test suite that doesn't provide class or module shared fixtures. + """ + _cleanup = True + + def __init__(self, tests=()): + self._tests = [] + self._removed_tests = 0 + self.addTests(tests) + + def __repr__(self): + return "<%s tests=%s>" % (util.strclass(self.__class__), list(self)) + + def __eq__(self, other): + if not isinstance(other, self.__class__): + return NotImplemented + return list(self) == list(other) + + def __iter__(self): + return iter(self._tests) + + def countTestCases(self): + cases = self._removed_tests + for test in self: + if test: + cases += test.countTestCases() + return cases + + def addTest(self, test): + # sanity checks + if not callable(test): + raise TypeError("{} is not callable".format(repr(test))) + if isinstance(test, type) and issubclass(test, + (case.TestCase, TestSuite)): + raise TypeError("TestCases and TestSuites must be instantiated " + "before passing them to addTest()") + self._tests.append(test) + + def addTests(self, tests): + if isinstance(tests, str): + raise TypeError("tests must be an iterable of tests, not a string") + for test in tests: + self.addTest(test) + + def run(self, result): + for index, test in enumerate(self): + if result.shouldStop: + break + test(result) + if self._cleanup: + self._removeTestAtIndex(index) + return result + + def _removeTestAtIndex(self, index): + """Stop holding a reference to the TestCase at index.""" + try: + test = self._tests[index] + except TypeError: + # support for suite implementations that have overridden self._tests + pass + else: + # Some unittest tests add non TestCase/TestSuite objects to + # the suite. + if hasattr(test, 'countTestCases'): + self._removed_tests += test.countTestCases() + self._tests[index] = None + + def __call__(self, *args, **kwds): + return self.run(*args, **kwds) + + def debug(self): + """Run the tests without collecting errors in a TestResult""" + for test in self: + test.debug() + + +class TestSuite(BaseTestSuite): + """A test suite is a composite test consisting of a number of TestCases. + + For use, create an instance of TestSuite, then add test case instances. + When all tests have been added, the suite can be passed to a test + runner, such as TextTestRunner. It will run the individual test cases + in the order in which they were added, aggregating the results. When + subclassing, do not forget to call the base class constructor. + """ + + def run(self, result, debug=False): + topLevel = False + if getattr(result, '_testRunEntered', False) is False: + result._testRunEntered = topLevel = True + + for index, test in enumerate(self): + if result.shouldStop: + break + + if _isnotsuite(test): + self._tearDownPreviousClass(test, result) + self._handleModuleFixture(test, result) + self._handleClassSetUp(test, result) + result._previousTestClass = test.__class__ + + if (getattr(test.__class__, '_classSetupFailed', False) or + getattr(result, '_moduleSetUpFailed', False)): + continue + + if not debug: + test(result) + else: + test.debug() + + if self._cleanup: + self._removeTestAtIndex(index) + + if topLevel: + self._tearDownPreviousClass(None, result) + self._handleModuleTearDown(result) + result._testRunEntered = False + return result + + def debug(self): + """Run the tests without collecting errors in a TestResult""" + debug = _DebugResult() + self.run(debug, True) + + ################################ + + def _handleClassSetUp(self, test, result): + previousClass = getattr(result, '_previousTestClass', None) + currentClass = test.__class__ + if currentClass == previousClass: + return + if result._moduleSetUpFailed: + return + if getattr(currentClass, "__unittest_skip__", False): + return + + failed = False + try: + currentClass._classSetupFailed = False + except TypeError: + # test may actually be a function + # so its class will be a builtin-type + pass + + setUpClass = getattr(currentClass, 'setUpClass', None) + doClassCleanups = getattr(currentClass, 'doClassCleanups', None) + if setUpClass is not None: + _call_if_exists(result, '_setupStdout') + try: + try: + setUpClass() + except Exception as e: + if isinstance(result, _DebugResult): + raise + failed = True + try: + currentClass._classSetupFailed = True + except TypeError: + pass + className = util.strclass(currentClass) + self._createClassOrModuleLevelException(result, e, + 'setUpClass', + className) + if failed and doClassCleanups is not None: + doClassCleanups() + for exc_info in currentClass.tearDown_exceptions: + self._createClassOrModuleLevelException( + result, exc_info[1], 'setUpClass', className, + info=exc_info) + finally: + _call_if_exists(result, '_restoreStdout') + + def _get_previous_module(self, result): + previousModule = None + previousClass = getattr(result, '_previousTestClass', None) + if previousClass is not None: + previousModule = previousClass.__module__ + return previousModule + + + def _handleModuleFixture(self, test, result): + previousModule = self._get_previous_module(result) + currentModule = test.__class__.__module__ + if currentModule == previousModule: + return + + self._handleModuleTearDown(result) + + + result._moduleSetUpFailed = False + try: + module = sys.modules[currentModule] + except KeyError: + return + setUpModule = getattr(module, 'setUpModule', None) + if setUpModule is not None: + _call_if_exists(result, '_setupStdout') + try: + try: + setUpModule() + except Exception as e: + if isinstance(result, _DebugResult): + raise + result._moduleSetUpFailed = True + self._createClassOrModuleLevelException(result, e, + 'setUpModule', + currentModule) + if result._moduleSetUpFailed: + try: + case.doModuleCleanups() + except Exception as e: + self._createClassOrModuleLevelException(result, e, + 'setUpModule', + currentModule) + finally: + _call_if_exists(result, '_restoreStdout') + + def _createClassOrModuleLevelException(self, result, exc, method_name, + parent, info=None): + errorName = f'{method_name} ({parent})' + self._addClassOrModuleLevelException(result, exc, errorName, info) + + def _addClassOrModuleLevelException(self, result, exception, errorName, + info=None): + error = _ErrorHolder(errorName) + addSkip = getattr(result, 'addSkip', None) + if addSkip is not None and isinstance(exception, case.SkipTest): + addSkip(error, str(exception)) + else: + if not info: + result.addError(error, sys.exc_info()) + else: + result.addError(error, info) + + def _handleModuleTearDown(self, result): + previousModule = self._get_previous_module(result) + if previousModule is None: + return + if result._moduleSetUpFailed: + return + + try: + module = sys.modules[previousModule] + except KeyError: + return + + _call_if_exists(result, '_setupStdout') + try: + tearDownModule = getattr(module, 'tearDownModule', None) + if tearDownModule is not None: + try: + tearDownModule() + except Exception as e: + if isinstance(result, _DebugResult): + raise + self._createClassOrModuleLevelException(result, e, + 'tearDownModule', + previousModule) + try: + case.doModuleCleanups() + except Exception as e: + if isinstance(result, _DebugResult): + raise + self._createClassOrModuleLevelException(result, e, + 'tearDownModule', + previousModule) + finally: + _call_if_exists(result, '_restoreStdout') + + def _tearDownPreviousClass(self, test, result): + previousClass = getattr(result, '_previousTestClass', None) + currentClass = test.__class__ + if currentClass == previousClass or previousClass is None: + return + if getattr(previousClass, '_classSetupFailed', False): + return + if getattr(result, '_moduleSetUpFailed', False): + return + if getattr(previousClass, "__unittest_skip__", False): + return + + tearDownClass = getattr(previousClass, 'tearDownClass', None) + doClassCleanups = getattr(previousClass, 'doClassCleanups', None) + if tearDownClass is None and doClassCleanups is None: + return + + _call_if_exists(result, '_setupStdout') + try: + if tearDownClass is not None: + try: + tearDownClass() + except Exception as e: + if isinstance(result, _DebugResult): + raise + className = util.strclass(previousClass) + self._createClassOrModuleLevelException(result, e, + 'tearDownClass', + className) + if doClassCleanups is not None: + doClassCleanups() + for exc_info in previousClass.tearDown_exceptions: + if isinstance(result, _DebugResult): + raise exc_info[1] + className = util.strclass(previousClass) + self._createClassOrModuleLevelException(result, exc_info[1], + 'tearDownClass', + className, + info=exc_info) + finally: + _call_if_exists(result, '_restoreStdout') + + +class _ErrorHolder(object): + """ + Placeholder for a TestCase inside a result. As far as a TestResult + is concerned, this looks exactly like a unit test. Used to insert + arbitrary errors into a test suite run. + """ + # Inspired by the ErrorHolder from Twisted: + # http://twistedmatrix.com/trac/browser/trunk/twisted/trial/runner.py + + # attribute used by TestResult._exc_info_to_string + failureException = None + + def __init__(self, description): + self.description = description + + def id(self): + return self.description + + def shortDescription(self): + return None + + def __repr__(self): + return "" % (self.description,) + + def __str__(self): + return self.id() + + def run(self, result): + # could call result.addError(...) - but this test-like object + # shouldn't be run anyway + pass + + def __call__(self, result): + return self.run(result) + + def countTestCases(self): + return 0 + +def _isnotsuite(test): + "A crude way to tell apart testcases and suites with duck-typing" + try: + iter(test) + except TypeError: + return True + return False + + +class _DebugResult(object): + "Used by the TestSuite to hold previous class when running in debug." + _previousTestClass = None + _moduleSetUpFailed = False + shouldStop = False diff --git a/miniconda3/envs/active_proaction/lib/python3.10/unittest/util.py b/miniconda3/envs/active_proaction/lib/python3.10/unittest/util.py new file mode 100644 index 0000000000000000000000000000000000000000..050eaed0b3f58fb09d1797f81c19de44110c511e --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/unittest/util.py @@ -0,0 +1,170 @@ +"""Various utility functions.""" + +from collections import namedtuple, Counter +from os.path import commonprefix + +__unittest = True + +_MAX_LENGTH = 80 +_PLACEHOLDER_LEN = 12 +_MIN_BEGIN_LEN = 5 +_MIN_END_LEN = 5 +_MIN_COMMON_LEN = 5 +_MIN_DIFF_LEN = _MAX_LENGTH - \ + (_MIN_BEGIN_LEN + _PLACEHOLDER_LEN + _MIN_COMMON_LEN + + _PLACEHOLDER_LEN + _MIN_END_LEN) +assert _MIN_DIFF_LEN >= 0 + +def _shorten(s, prefixlen, suffixlen): + skip = len(s) - prefixlen - suffixlen + if skip > _PLACEHOLDER_LEN: + s = '%s[%d chars]%s' % (s[:prefixlen], skip, s[len(s) - suffixlen:]) + return s + +def _common_shorten_repr(*args): + args = tuple(map(safe_repr, args)) + maxlen = max(map(len, args)) + if maxlen <= _MAX_LENGTH: + return args + + prefix = commonprefix(args) + prefixlen = len(prefix) + + common_len = _MAX_LENGTH - \ + (maxlen - prefixlen + _MIN_BEGIN_LEN + _PLACEHOLDER_LEN) + if common_len > _MIN_COMMON_LEN: + assert _MIN_BEGIN_LEN + _PLACEHOLDER_LEN + _MIN_COMMON_LEN + \ + (maxlen - prefixlen) < _MAX_LENGTH + prefix = _shorten(prefix, _MIN_BEGIN_LEN, common_len) + return tuple(prefix + s[prefixlen:] for s in args) + + prefix = _shorten(prefix, _MIN_BEGIN_LEN, _MIN_COMMON_LEN) + return tuple(prefix + _shorten(s[prefixlen:], _MIN_DIFF_LEN, _MIN_END_LEN) + for s in args) + +def safe_repr(obj, short=False): + try: + result = repr(obj) + except Exception: + result = object.__repr__(obj) + if not short or len(result) < _MAX_LENGTH: + return result + return result[:_MAX_LENGTH] + ' [truncated]...' + +def strclass(cls): + return "%s.%s" % (cls.__module__, cls.__qualname__) + +def sorted_list_difference(expected, actual): + """Finds elements in only one or the other of two, sorted input lists. + + Returns a two-element tuple of lists. The first list contains those + elements in the "expected" list but not in the "actual" list, and the + second contains those elements in the "actual" list but not in the + "expected" list. Duplicate elements in either input list are ignored. + """ + i = j = 0 + missing = [] + unexpected = [] + while True: + try: + e = expected[i] + a = actual[j] + if e < a: + missing.append(e) + i += 1 + while expected[i] == e: + i += 1 + elif e > a: + unexpected.append(a) + j += 1 + while actual[j] == a: + j += 1 + else: + i += 1 + try: + while expected[i] == e: + i += 1 + finally: + j += 1 + while actual[j] == a: + j += 1 + except IndexError: + missing.extend(expected[i:]) + unexpected.extend(actual[j:]) + break + return missing, unexpected + + +def unorderable_list_difference(expected, actual): + """Same behavior as sorted_list_difference but + for lists of unorderable items (like dicts). + + As it does a linear search per item (remove) it + has O(n*n) performance.""" + missing = [] + while expected: + item = expected.pop() + try: + actual.remove(item) + except ValueError: + missing.append(item) + + # anything left in actual is unexpected + return missing, actual + +def three_way_cmp(x, y): + """Return -1 if x < y, 0 if x == y and 1 if x > y""" + return (x > y) - (x < y) + +_Mismatch = namedtuple('Mismatch', 'actual expected value') + +def _count_diff_all_purpose(actual, expected): + 'Returns list of (cnt_act, cnt_exp, elem) triples where the counts differ' + # elements need not be hashable + s, t = list(actual), list(expected) + m, n = len(s), len(t) + NULL = object() + result = [] + for i, elem in enumerate(s): + if elem is NULL: + continue + cnt_s = cnt_t = 0 + for j in range(i, m): + if s[j] == elem: + cnt_s += 1 + s[j] = NULL + for j, other_elem in enumerate(t): + if other_elem == elem: + cnt_t += 1 + t[j] = NULL + if cnt_s != cnt_t: + diff = _Mismatch(cnt_s, cnt_t, elem) + result.append(diff) + + for i, elem in enumerate(t): + if elem is NULL: + continue + cnt_t = 0 + for j in range(i, n): + if t[j] == elem: + cnt_t += 1 + t[j] = NULL + diff = _Mismatch(0, cnt_t, elem) + result.append(diff) + return result + +def _count_diff_hashable(actual, expected): + 'Returns list of (cnt_act, cnt_exp, elem) triples where the counts differ' + # elements must be hashable + s, t = Counter(actual), Counter(expected) + result = [] + for elem, cnt_s in s.items(): + cnt_t = t.get(elem, 0) + if cnt_s != cnt_t: + diff = _Mismatch(cnt_s, cnt_t, elem) + result.append(diff) + for elem, cnt_t in t.items(): + if elem not in s: + diff = _Mismatch(0, cnt_t, elem) + result.append(diff) + return result diff --git a/miniconda3/envs/active_proaction/lib/python3.10/urllib/__init__.py b/miniconda3/envs/active_proaction/lib/python3.10/urllib/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/miniconda3/envs/active_proaction/lib/python3.10/urllib/error.py b/miniconda3/envs/active_proaction/lib/python3.10/urllib/error.py new file mode 100644 index 0000000000000000000000000000000000000000..a9cd1ecadd63f2b09ee4363fc283e8f1f5cbbb3b --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/urllib/error.py @@ -0,0 +1,74 @@ +"""Exception classes raised by urllib. + +The base exception class is URLError, which inherits from OSError. It +doesn't define any behavior of its own, but is the base class for all +exceptions defined in this package. + +HTTPError is an exception class that is also a valid HTTP response +instance. It behaves this way because HTTP protocol errors are valid +responses, with a status code, headers, and a body. In some contexts, +an application may want to handle an exception like a regular +response. +""" +import io +import urllib.response + +__all__ = ['URLError', 'HTTPError', 'ContentTooShortError'] + + +class URLError(OSError): + # URLError is a sub-type of OSError, but it doesn't share any of + # the implementation. need to override __init__ and __str__. + # It sets self.args for compatibility with other OSError + # subclasses, but args doesn't have the typical format with errno in + # slot 0 and strerror in slot 1. This may be better than nothing. + def __init__(self, reason, filename=None): + self.args = reason, + self.reason = reason + if filename is not None: + self.filename = filename + + def __str__(self): + return '' % self.reason + + +class HTTPError(URLError, urllib.response.addinfourl): + """Raised when HTTP error occurs, but also acts like non-error return""" + __super_init = urllib.response.addinfourl.__init__ + + def __init__(self, url, code, msg, hdrs, fp): + self.code = code + self.msg = msg + self.hdrs = hdrs + self.fp = fp + self.filename = url + if fp is None: + fp = io.BytesIO() + self.__super_init(fp, hdrs, url, code) + + def __str__(self): + return 'HTTP Error %s: %s' % (self.code, self.msg) + + def __repr__(self): + return '' % (self.code, self.msg) + + # since URLError specifies a .reason attribute, HTTPError should also + # provide this attribute. See issue13211 for discussion. + @property + def reason(self): + return self.msg + + @property + def headers(self): + return self.hdrs + + @headers.setter + def headers(self, headers): + self.hdrs = headers + + +class ContentTooShortError(URLError): + """Exception raised when downloaded size does not match content-length.""" + def __init__(self, message, content): + URLError.__init__(self, message) + self.content = content diff --git a/miniconda3/envs/active_proaction/lib/python3.10/urllib/parse.py b/miniconda3/envs/active_proaction/lib/python3.10/urllib/parse.py new file mode 100644 index 0000000000000000000000000000000000000000..e1ee36d98e71edbe394529aed9bb8e9f14dc2775 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/urllib/parse.py @@ -0,0 +1,1237 @@ +"""Parse (absolute and relative) URLs. + +urlparse module is based upon the following RFC specifications. + +RFC 3986 (STD66): "Uniform Resource Identifiers" by T. Berners-Lee, R. Fielding +and L. Masinter, January 2005. + +RFC 2732 : "Format for Literal IPv6 Addresses in URL's by R.Hinden, B.Carpenter +and L.Masinter, December 1999. + +RFC 2396: "Uniform Resource Identifiers (URI)": Generic Syntax by T. +Berners-Lee, R. Fielding, and L. Masinter, August 1998. + +RFC 2368: "The mailto URL scheme", by P.Hoffman , L Masinter, J. Zawinski, July 1998. + +RFC 1808: "Relative Uniform Resource Locators", by R. Fielding, UC Irvine, June +1995. + +RFC 1738: "Uniform Resource Locators (URL)" by T. Berners-Lee, L. Masinter, M. +McCahill, December 1994 + +RFC 3986 is considered the current standard and any future changes to +urlparse module should conform with it. The urlparse module is +currently not entirely compliant with this RFC due to defacto +scenarios for parsing, and for backward compatibility purposes, some +parsing quirks from older RFCs are retained. The testcases in +test_urlparse.py provides a good indicator of parsing behavior. + +The WHATWG URL Parser spec should also be considered. We are not compliant with +it either due to existing user code API behavior expectations (Hyrum's Law). +It serves as a useful guide when making changes. +""" + +import re +import sys +import types +import collections +import warnings +import ipaddress + +__all__ = ["urlparse", "urlunparse", "urljoin", "urldefrag", + "urlsplit", "urlunsplit", "urlencode", "parse_qs", + "parse_qsl", "quote", "quote_plus", "quote_from_bytes", + "unquote", "unquote_plus", "unquote_to_bytes", + "DefragResult", "ParseResult", "SplitResult", + "DefragResultBytes", "ParseResultBytes", "SplitResultBytes"] + +# A classification of schemes. +# The empty string classifies URLs with no scheme specified, +# being the default value returned by “urlsplit” and “urlparse”. + +uses_relative = ['', 'ftp', 'http', 'gopher', 'nntp', 'imap', + 'wais', 'file', 'https', 'shttp', 'mms', + 'prospero', 'rtsp', 'rtspu', 'sftp', + 'svn', 'svn+ssh', 'ws', 'wss'] + +uses_netloc = ['', 'ftp', 'http', 'gopher', 'nntp', 'telnet', + 'imap', 'wais', 'file', 'mms', 'https', 'shttp', + 'snews', 'prospero', 'rtsp', 'rtspu', 'rsync', + 'svn', 'svn+ssh', 'sftp', 'nfs', 'git', 'git+ssh', + 'ws', 'wss'] + +uses_params = ['', 'ftp', 'hdl', 'prospero', 'http', 'imap', + 'https', 'shttp', 'rtsp', 'rtspu', 'sip', 'sips', + 'mms', 'sftp', 'tel'] + +# These are not actually used anymore, but should stay for backwards +# compatibility. (They are undocumented, but have a public-looking name.) + +non_hierarchical = ['gopher', 'hdl', 'mailto', 'news', + 'telnet', 'wais', 'imap', 'snews', 'sip', 'sips'] + +uses_query = ['', 'http', 'wais', 'imap', 'https', 'shttp', 'mms', + 'gopher', 'rtsp', 'rtspu', 'sip', 'sips'] + +uses_fragment = ['', 'ftp', 'hdl', 'http', 'gopher', 'news', + 'nntp', 'wais', 'https', 'shttp', 'snews', + 'file', 'prospero'] + +# Characters valid in scheme names +scheme_chars = ('abcdefghijklmnopqrstuvwxyz' + 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' + '0123456789' + '+-.') + +# Leading and trailing C0 control and space to be stripped per WHATWG spec. +# == "".join([chr(i) for i in range(0, 0x20 + 1)]) +_WHATWG_C0_CONTROL_OR_SPACE = '\x00\x01\x02\x03\x04\x05\x06\x07\x08\t\n\x0b\x0c\r\x0e\x0f\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f ' + +# Unsafe bytes to be removed per WHATWG spec +_UNSAFE_URL_BYTES_TO_REMOVE = ['\t', '\r', '\n'] + +# XXX: Consider replacing with functools.lru_cache +MAX_CACHE_SIZE = 20 +_parse_cache = {} + +def clear_cache(): + """Clear the parse cache and the quoters cache.""" + _parse_cache.clear() + _safe_quoters.clear() + + +# Helpers for bytes handling +# For 3.2, we deliberately require applications that +# handle improperly quoted URLs to do their own +# decoding and encoding. If valid use cases are +# presented, we may relax this by using latin-1 +# decoding internally for 3.3 +_implicit_encoding = 'ascii' +_implicit_errors = 'strict' + +def _noop(obj): + return obj + +def _encode_result(obj, encoding=_implicit_encoding, + errors=_implicit_errors): + return obj.encode(encoding, errors) + +def _decode_args(args, encoding=_implicit_encoding, + errors=_implicit_errors): + return tuple(x.decode(encoding, errors) if x else '' for x in args) + +def _coerce_args(*args): + # Invokes decode if necessary to create str args + # and returns the coerced inputs along with + # an appropriate result coercion function + # - noop for str inputs + # - encoding function otherwise + str_input = isinstance(args[0], str) + for arg in args[1:]: + # We special-case the empty string to support the + # "scheme=''" default argument to some functions + if arg and isinstance(arg, str) != str_input: + raise TypeError("Cannot mix str and non-str arguments") + if str_input: + return args + (_noop,) + return _decode_args(args) + (_encode_result,) + +# Result objects are more helpful than simple tuples +class _ResultMixinStr(object): + """Standard approach to encoding parsed results from str to bytes""" + __slots__ = () + + def encode(self, encoding='ascii', errors='strict'): + return self._encoded_counterpart(*(x.encode(encoding, errors) for x in self)) + + +class _ResultMixinBytes(object): + """Standard approach to decoding parsed results from bytes to str""" + __slots__ = () + + def decode(self, encoding='ascii', errors='strict'): + return self._decoded_counterpart(*(x.decode(encoding, errors) for x in self)) + + +class _NetlocResultMixinBase(object): + """Shared methods for the parsed result objects containing a netloc element""" + __slots__ = () + + @property + def username(self): + return self._userinfo[0] + + @property + def password(self): + return self._userinfo[1] + + @property + def hostname(self): + hostname = self._hostinfo[0] + if not hostname: + return None + # Scoped IPv6 address may have zone info, which must not be lowercased + # like http://[fe80::822a:a8ff:fe49:470c%tESt]:1234/keys + separator = '%' if isinstance(hostname, str) else b'%' + hostname, percent, zone = hostname.partition(separator) + return hostname.lower() + percent + zone + + @property + def port(self): + port = self._hostinfo[1] + if port is not None: + if port.isdigit() and port.isascii(): + port = int(port) + else: + raise ValueError(f"Port could not be cast to integer value as {port!r}") + if not (0 <= port <= 65535): + raise ValueError("Port out of range 0-65535") + return port + + __class_getitem__ = classmethod(types.GenericAlias) + + +class _NetlocResultMixinStr(_NetlocResultMixinBase, _ResultMixinStr): + __slots__ = () + + @property + def _userinfo(self): + netloc = self.netloc + userinfo, have_info, hostinfo = netloc.rpartition('@') + if have_info: + username, have_password, password = userinfo.partition(':') + if not have_password: + password = None + else: + username = password = None + return username, password + + @property + def _hostinfo(self): + netloc = self.netloc + _, _, hostinfo = netloc.rpartition('@') + _, have_open_br, bracketed = hostinfo.partition('[') + if have_open_br: + hostname, _, port = bracketed.partition(']') + _, _, port = port.partition(':') + else: + hostname, _, port = hostinfo.partition(':') + if not port: + port = None + return hostname, port + + +class _NetlocResultMixinBytes(_NetlocResultMixinBase, _ResultMixinBytes): + __slots__ = () + + @property + def _userinfo(self): + netloc = self.netloc + userinfo, have_info, hostinfo = netloc.rpartition(b'@') + if have_info: + username, have_password, password = userinfo.partition(b':') + if not have_password: + password = None + else: + username = password = None + return username, password + + @property + def _hostinfo(self): + netloc = self.netloc + _, _, hostinfo = netloc.rpartition(b'@') + _, have_open_br, bracketed = hostinfo.partition(b'[') + if have_open_br: + hostname, _, port = bracketed.partition(b']') + _, _, port = port.partition(b':') + else: + hostname, _, port = hostinfo.partition(b':') + if not port: + port = None + return hostname, port + + +from collections import namedtuple + +_DefragResultBase = namedtuple('DefragResult', 'url fragment') +_SplitResultBase = namedtuple( + 'SplitResult', 'scheme netloc path query fragment') +_ParseResultBase = namedtuple( + 'ParseResult', 'scheme netloc path params query fragment') + +_DefragResultBase.__doc__ = """ +DefragResult(url, fragment) + +A 2-tuple that contains the url without fragment identifier and the fragment +identifier as a separate argument. +""" + +_DefragResultBase.url.__doc__ = """The URL with no fragment identifier.""" + +_DefragResultBase.fragment.__doc__ = """ +Fragment identifier separated from URL, that allows indirect identification of a +secondary resource by reference to a primary resource and additional identifying +information. +""" + +_SplitResultBase.__doc__ = """ +SplitResult(scheme, netloc, path, query, fragment) + +A 5-tuple that contains the different components of a URL. Similar to +ParseResult, but does not split params. +""" + +_SplitResultBase.scheme.__doc__ = """Specifies URL scheme for the request.""" + +_SplitResultBase.netloc.__doc__ = """ +Network location where the request is made to. +""" + +_SplitResultBase.path.__doc__ = """ +The hierarchical path, such as the path to a file to download. +""" + +_SplitResultBase.query.__doc__ = """ +The query component, that contains non-hierarchical data, that along with data +in path component, identifies a resource in the scope of URI's scheme and +network location. +""" + +_SplitResultBase.fragment.__doc__ = """ +Fragment identifier, that allows indirect identification of a secondary resource +by reference to a primary resource and additional identifying information. +""" + +_ParseResultBase.__doc__ = """ +ParseResult(scheme, netloc, path, params, query, fragment) + +A 6-tuple that contains components of a parsed URL. +""" + +_ParseResultBase.scheme.__doc__ = _SplitResultBase.scheme.__doc__ +_ParseResultBase.netloc.__doc__ = _SplitResultBase.netloc.__doc__ +_ParseResultBase.path.__doc__ = _SplitResultBase.path.__doc__ +_ParseResultBase.params.__doc__ = """ +Parameters for last path element used to dereference the URI in order to provide +access to perform some operation on the resource. +""" + +_ParseResultBase.query.__doc__ = _SplitResultBase.query.__doc__ +_ParseResultBase.fragment.__doc__ = _SplitResultBase.fragment.__doc__ + + +# For backwards compatibility, alias _NetlocResultMixinStr +# ResultBase is no longer part of the documented API, but it is +# retained since deprecating it isn't worth the hassle +ResultBase = _NetlocResultMixinStr + +# Structured result objects for string data +class DefragResult(_DefragResultBase, _ResultMixinStr): + __slots__ = () + def geturl(self): + if self.fragment: + return self.url + '#' + self.fragment + else: + return self.url + +class SplitResult(_SplitResultBase, _NetlocResultMixinStr): + __slots__ = () + def geturl(self): + return urlunsplit(self) + +class ParseResult(_ParseResultBase, _NetlocResultMixinStr): + __slots__ = () + def geturl(self): + return urlunparse(self) + +# Structured result objects for bytes data +class DefragResultBytes(_DefragResultBase, _ResultMixinBytes): + __slots__ = () + def geturl(self): + if self.fragment: + return self.url + b'#' + self.fragment + else: + return self.url + +class SplitResultBytes(_SplitResultBase, _NetlocResultMixinBytes): + __slots__ = () + def geturl(self): + return urlunsplit(self) + +class ParseResultBytes(_ParseResultBase, _NetlocResultMixinBytes): + __slots__ = () + def geturl(self): + return urlunparse(self) + +# Set up the encode/decode result pairs +def _fix_result_transcoding(): + _result_pairs = ( + (DefragResult, DefragResultBytes), + (SplitResult, SplitResultBytes), + (ParseResult, ParseResultBytes), + ) + for _decoded, _encoded in _result_pairs: + _decoded._encoded_counterpart = _encoded + _encoded._decoded_counterpart = _decoded + +_fix_result_transcoding() +del _fix_result_transcoding + +def urlparse(url, scheme='', allow_fragments=True): + """Parse a URL into 6 components: + :///;?# + + The result is a named 6-tuple with fields corresponding to the + above. It is either a ParseResult or ParseResultBytes object, + depending on the type of the url parameter. + + The username, password, hostname, and port sub-components of netloc + can also be accessed as attributes of the returned object. + + The scheme argument provides the default value of the scheme + component when no scheme is found in url. + + If allow_fragments is False, no attempt is made to separate the + fragment component from the previous component, which can be either + path or query. + + Note that % escapes are not expanded. + """ + url, scheme, _coerce_result = _coerce_args(url, scheme) + splitresult = urlsplit(url, scheme, allow_fragments) + scheme, netloc, url, query, fragment = splitresult + if scheme in uses_params and ';' in url: + url, params = _splitparams(url) + else: + params = '' + result = ParseResult(scheme, netloc, url, params, query, fragment) + return _coerce_result(result) + +def _splitparams(url): + if '/' in url: + i = url.find(';', url.rfind('/')) + if i < 0: + return url, '' + else: + i = url.find(';') + return url[:i], url[i+1:] + +def _splitnetloc(url, start=0): + delim = len(url) # position of end of domain part of url, default is end + for c in '/?#': # look for delimiters; the order is NOT important + wdelim = url.find(c, start) # find first of this delim + if wdelim >= 0: # if found + delim = min(delim, wdelim) # use earliest delim position + return url[start:delim], url[delim:] # return (domain, rest) + +def _checknetloc(netloc): + if not netloc or netloc.isascii(): + return + # looking for characters like \u2100 that expand to 'a/c' + # IDNA uses NFKC equivalence, so normalize for this check + import unicodedata + n = netloc.replace('@', '') # ignore characters already included + n = n.replace(':', '') # but not the surrounding text + n = n.replace('#', '') + n = n.replace('?', '') + netloc2 = unicodedata.normalize('NFKC', n) + if n == netloc2: + return + for c in '/?#@:': + if c in netloc2: + raise ValueError("netloc '" + netloc + "' contains invalid " + + "characters under NFKC normalization") + +def _check_bracketed_netloc(netloc): + # Note that this function must mirror the splitting + # done in NetlocResultMixins._hostinfo(). + hostname_and_port = netloc.rpartition('@')[2] + before_bracket, have_open_br, bracketed = hostname_and_port.partition('[') + if have_open_br: + # No data is allowed before a bracket. + if before_bracket: + raise ValueError("Invalid IPv6 URL") + hostname, _, port = bracketed.partition(']') + # No data is allowed after the bracket but before the port delimiter. + if port and not port.startswith(":"): + raise ValueError("Invalid IPv6 URL") + else: + hostname, _, port = hostname_and_port.partition(':') + _check_bracketed_host(hostname) + +# Valid bracketed hosts are defined in +# https://www.rfc-editor.org/rfc/rfc3986#page-49 and https://url.spec.whatwg.org/ +def _check_bracketed_host(hostname): + if hostname.startswith('v'): + if not re.match(r"\Av[a-fA-F0-9]+\..+\Z", hostname): + raise ValueError(f"IPvFuture address is invalid") + else: + ip = ipaddress.ip_address(hostname) # Throws Value Error if not IPv6 or IPv4 + if isinstance(ip, ipaddress.IPv4Address): + raise ValueError(f"An IPv4 address cannot be in brackets") + +def urlsplit(url, scheme='', allow_fragments=True): + """Parse a URL into 5 components: + :///?# + + The result is a named 5-tuple with fields corresponding to the + above. It is either a SplitResult or SplitResultBytes object, + depending on the type of the url parameter. + + The username, password, hostname, and port sub-components of netloc + can also be accessed as attributes of the returned object. + + The scheme argument provides the default value of the scheme + component when no scheme is found in url. + + If allow_fragments is False, no attempt is made to separate the + fragment component from the previous component, which can be either + path or query. + + Note that % escapes are not expanded. + """ + + url, scheme, _coerce_result = _coerce_args(url, scheme) + # Only lstrip url as some applications rely on preserving trailing space. + # (https://url.spec.whatwg.org/#concept-basic-url-parser would strip both) + url = url.lstrip(_WHATWG_C0_CONTROL_OR_SPACE) + scheme = scheme.strip(_WHATWG_C0_CONTROL_OR_SPACE) + + for b in _UNSAFE_URL_BYTES_TO_REMOVE: + url = url.replace(b, "") + scheme = scheme.replace(b, "") + + allow_fragments = bool(allow_fragments) + key = url, scheme, allow_fragments, type(url), type(scheme) + cached = _parse_cache.get(key, None) + if cached: + return _coerce_result(cached) + if len(_parse_cache) >= MAX_CACHE_SIZE: # avoid runaway growth + clear_cache() + netloc = query = fragment = '' + i = url.find(':') + if i > 0: + for c in url[:i]: + if c not in scheme_chars: + break + else: + scheme, url = url[:i].lower(), url[i+1:] + if url[:2] == '//': + netloc, url = _splitnetloc(url, 2) + if (('[' in netloc and ']' not in netloc) or + (']' in netloc and '[' not in netloc)): + raise ValueError("Invalid IPv6 URL") + if '[' in netloc and ']' in netloc: + _check_bracketed_netloc(netloc) + if allow_fragments and '#' in url: + url, fragment = url.split('#', 1) + if '?' in url: + url, query = url.split('?', 1) + _checknetloc(netloc) + v = SplitResult(scheme, netloc, url, query, fragment) + _parse_cache[key] = v + return _coerce_result(v) + +def urlunparse(components): + """Put a parsed URL back together again. This may result in a + slightly different, but equivalent URL, if the URL that was parsed + originally had redundant delimiters, e.g. a ? with an empty query + (the draft states that these are equivalent).""" + scheme, netloc, url, params, query, fragment, _coerce_result = ( + _coerce_args(*components)) + if params: + url = "%s;%s" % (url, params) + return _coerce_result(urlunsplit((scheme, netloc, url, query, fragment))) + +def urlunsplit(components): + """Combine the elements of a tuple as returned by urlsplit() into a + complete URL as a string. The data argument can be any five-item iterable. + This may result in a slightly different, but equivalent URL, if the URL that + was parsed originally had unnecessary delimiters (for example, a ? with an + empty query; the RFC states that these are equivalent).""" + scheme, netloc, url, query, fragment, _coerce_result = ( + _coerce_args(*components)) + if netloc or (scheme and scheme in uses_netloc) or url[:2] == '//': + if url and url[:1] != '/': url = '/' + url + url = '//' + (netloc or '') + url + if scheme: + url = scheme + ':' + url + if query: + url = url + '?' + query + if fragment: + url = url + '#' + fragment + return _coerce_result(url) + +def urljoin(base, url, allow_fragments=True): + """Join a base URL and a possibly relative URL to form an absolute + interpretation of the latter.""" + if not base: + return url + if not url: + return base + + base, url, _coerce_result = _coerce_args(base, url) + bscheme, bnetloc, bpath, bparams, bquery, bfragment = \ + urlparse(base, '', allow_fragments) + scheme, netloc, path, params, query, fragment = \ + urlparse(url, bscheme, allow_fragments) + + if scheme != bscheme or scheme not in uses_relative: + return _coerce_result(url) + if scheme in uses_netloc: + if netloc: + return _coerce_result(urlunparse((scheme, netloc, path, + params, query, fragment))) + netloc = bnetloc + + if not path and not params: + path = bpath + params = bparams + if not query: + query = bquery + return _coerce_result(urlunparse((scheme, netloc, path, + params, query, fragment))) + + base_parts = bpath.split('/') + if base_parts[-1] != '': + # the last item is not a directory, so will not be taken into account + # in resolving the relative path + del base_parts[-1] + + # for rfc3986, ignore all base path should the first character be root. + if path[:1] == '/': + segments = path.split('/') + else: + segments = base_parts + path.split('/') + # filter out elements that would cause redundant slashes on re-joining + # the resolved_path + segments[1:-1] = filter(None, segments[1:-1]) + + resolved_path = [] + + for seg in segments: + if seg == '..': + try: + resolved_path.pop() + except IndexError: + # ignore any .. segments that would otherwise cause an IndexError + # when popped from resolved_path if resolving for rfc3986 + pass + elif seg == '.': + continue + else: + resolved_path.append(seg) + + if segments[-1] in ('.', '..'): + # do some post-processing here. if the last segment was a relative dir, + # then we need to append the trailing '/' + resolved_path.append('') + + return _coerce_result(urlunparse((scheme, netloc, '/'.join( + resolved_path) or '/', params, query, fragment))) + + +def urldefrag(url): + """Removes any existing fragment from URL. + + Returns a tuple of the defragmented URL and the fragment. If + the URL contained no fragments, the second element is the + empty string. + """ + url, _coerce_result = _coerce_args(url) + if '#' in url: + s, n, p, a, q, frag = urlparse(url) + defrag = urlunparse((s, n, p, a, q, '')) + else: + frag = '' + defrag = url + return _coerce_result(DefragResult(defrag, frag)) + +_hexdig = '0123456789ABCDEFabcdef' +_hextobyte = None + +def unquote_to_bytes(string): + """unquote_to_bytes('abc%20def') -> b'abc def'.""" + # Note: strings are encoded as UTF-8. This is only an issue if it contains + # unescaped non-ASCII characters, which URIs should not. + if not string: + # Is it a string-like object? + string.split + return b'' + if isinstance(string, str): + string = string.encode('utf-8') + bits = string.split(b'%') + if len(bits) == 1: + return string + res = [bits[0]] + append = res.append + # Delay the initialization of the table to not waste memory + # if the function is never called + global _hextobyte + if _hextobyte is None: + _hextobyte = {(a + b).encode(): bytes.fromhex(a + b) + for a in _hexdig for b in _hexdig} + for item in bits[1:]: + try: + append(_hextobyte[item[:2]]) + append(item[2:]) + except KeyError: + append(b'%') + append(item) + return b''.join(res) + +_asciire = re.compile('([\x00-\x7f]+)') + +def unquote(string, encoding='utf-8', errors='replace'): + """Replace %xx escapes by their single-character equivalent. The optional + encoding and errors parameters specify how to decode percent-encoded + sequences into Unicode characters, as accepted by the bytes.decode() + method. + By default, percent-encoded sequences are decoded with UTF-8, and invalid + sequences are replaced by a placeholder character. + + unquote('abc%20def') -> 'abc def'. + """ + if isinstance(string, bytes): + return unquote_to_bytes(string).decode(encoding, errors) + if '%' not in string: + string.split + return string + if encoding is None: + encoding = 'utf-8' + if errors is None: + errors = 'replace' + bits = _asciire.split(string) + res = [bits[0]] + append = res.append + for i in range(1, len(bits), 2): + append(unquote_to_bytes(bits[i]).decode(encoding, errors)) + append(bits[i + 1]) + return ''.join(res) + + +def parse_qs(qs, keep_blank_values=False, strict_parsing=False, + encoding='utf-8', errors='replace', max_num_fields=None, separator='&'): + """Parse a query given as a string argument. + + Arguments: + + qs: percent-encoded query string to be parsed + + keep_blank_values: flag indicating whether blank values in + percent-encoded queries should be treated as blank strings. + A true value indicates that blanks should be retained as + blank strings. The default false value indicates that + blank values are to be ignored and treated as if they were + not included. + + strict_parsing: flag indicating what to do with parsing errors. + If false (the default), errors are silently ignored. + If true, errors raise a ValueError exception. + + encoding and errors: specify how to decode percent-encoded sequences + into Unicode characters, as accepted by the bytes.decode() method. + + max_num_fields: int. If set, then throws a ValueError if there + are more than n fields read by parse_qsl(). + + separator: str. The symbol to use for separating the query arguments. + Defaults to &. + + Returns a dictionary. + """ + parsed_result = {} + pairs = parse_qsl(qs, keep_blank_values, strict_parsing, + encoding=encoding, errors=errors, + max_num_fields=max_num_fields, separator=separator) + for name, value in pairs: + if name in parsed_result: + parsed_result[name].append(value) + else: + parsed_result[name] = [value] + return parsed_result + + +def parse_qsl(qs, keep_blank_values=False, strict_parsing=False, + encoding='utf-8', errors='replace', max_num_fields=None, separator='&'): + """Parse a query given as a string argument. + + Arguments: + + qs: percent-encoded query string to be parsed + + keep_blank_values: flag indicating whether blank values in + percent-encoded queries should be treated as blank strings. + A true value indicates that blanks should be retained as blank + strings. The default false value indicates that blank values + are to be ignored and treated as if they were not included. + + strict_parsing: flag indicating what to do with parsing errors. If + false (the default), errors are silently ignored. If true, + errors raise a ValueError exception. + + encoding and errors: specify how to decode percent-encoded sequences + into Unicode characters, as accepted by the bytes.decode() method. + + max_num_fields: int. If set, then throws a ValueError + if there are more than n fields read by parse_qsl(). + + separator: str. The symbol to use for separating the query arguments. + Defaults to &. + + Returns a list, as G-d intended. + """ + qs, _coerce_result = _coerce_args(qs) + separator, _ = _coerce_args(separator) + + if not separator or (not isinstance(separator, (str, bytes))): + raise ValueError("Separator must be of type string or bytes.") + + # If max_num_fields is defined then check that the number of fields + # is less than max_num_fields. This prevents a memory exhaustion DOS + # attack via post bodies with many fields. + if max_num_fields is not None: + num_fields = 1 + qs.count(separator) + if max_num_fields < num_fields: + raise ValueError('Max number of fields exceeded') + + r = [] + for name_value in qs.split(separator): + if not name_value and not strict_parsing: + continue + nv = name_value.split('=', 1) + if len(nv) != 2: + if strict_parsing: + raise ValueError("bad query field: %r" % (name_value,)) + # Handle case of a control-name with no equal sign + if keep_blank_values: + nv.append('') + else: + continue + if len(nv[1]) or keep_blank_values: + name = nv[0].replace('+', ' ') + name = unquote(name, encoding=encoding, errors=errors) + name = _coerce_result(name) + value = nv[1].replace('+', ' ') + value = unquote(value, encoding=encoding, errors=errors) + value = _coerce_result(value) + r.append((name, value)) + return r + +def unquote_plus(string, encoding='utf-8', errors='replace'): + """Like unquote(), but also replace plus signs by spaces, as required for + unquoting HTML form values. + + unquote_plus('%7e/abc+def') -> '~/abc def' + """ + string = string.replace('+', ' ') + return unquote(string, encoding, errors) + +_ALWAYS_SAFE = frozenset(b'ABCDEFGHIJKLMNOPQRSTUVWXYZ' + b'abcdefghijklmnopqrstuvwxyz' + b'0123456789' + b'_.-~') +_ALWAYS_SAFE_BYTES = bytes(_ALWAYS_SAFE) +_safe_quoters = {} + +class Quoter(collections.defaultdict): + """A mapping from bytes (in range(0,256)) to strings. + + String values are percent-encoded byte values, unless the key < 128, and + in the "safe" set (either the specified safe set, or default set). + """ + # Keeps a cache internally, using defaultdict, for efficiency (lookups + # of cached keys don't call Python code at all). + def __init__(self, safe): + """safe: bytes object.""" + self.safe = _ALWAYS_SAFE.union(safe) + + def __repr__(self): + # Without this, will just display as a defaultdict + return "<%s %r>" % (self.__class__.__name__, dict(self)) + + def __missing__(self, b): + # Handle a cache miss. Store quoted string in cache and return. + res = chr(b) if b in self.safe else '%{:02X}'.format(b) + self[b] = res + return res + +def quote(string, safe='/', encoding=None, errors=None): + """quote('abc def') -> 'abc%20def' + + Each part of a URL, e.g. the path info, the query, etc., has a + different set of reserved characters that must be quoted. The + quote function offers a cautious (not minimal) way to quote a + string for most of these parts. + + RFC 3986 Uniform Resource Identifier (URI): Generic Syntax lists + the following (un)reserved characters. + + unreserved = ALPHA / DIGIT / "-" / "." / "_" / "~" + reserved = gen-delims / sub-delims + gen-delims = ":" / "/" / "?" / "#" / "[" / "]" / "@" + sub-delims = "!" / "$" / "&" / "'" / "(" / ")" + / "*" / "+" / "," / ";" / "=" + + Each of the reserved characters is reserved in some component of a URL, + but not necessarily in all of them. + + The quote function %-escapes all characters that are neither in the + unreserved chars ("always safe") nor the additional chars set via the + safe arg. + + The default for the safe arg is '/'. The character is reserved, but in + typical usage the quote function is being called on a path where the + existing slash characters are to be preserved. + + Python 3.7 updates from using RFC 2396 to RFC 3986 to quote URL strings. + Now, "~" is included in the set of unreserved characters. + + string and safe may be either str or bytes objects. encoding and errors + must not be specified if string is a bytes object. + + The optional encoding and errors parameters specify how to deal with + non-ASCII characters, as accepted by the str.encode method. + By default, encoding='utf-8' (characters are encoded with UTF-8), and + errors='strict' (unsupported characters raise a UnicodeEncodeError). + """ + if isinstance(string, str): + if not string: + return string + if encoding is None: + encoding = 'utf-8' + if errors is None: + errors = 'strict' + string = string.encode(encoding, errors) + else: + if encoding is not None: + raise TypeError("quote() doesn't support 'encoding' for bytes") + if errors is not None: + raise TypeError("quote() doesn't support 'errors' for bytes") + return quote_from_bytes(string, safe) + +def quote_plus(string, safe='', encoding=None, errors=None): + """Like quote(), but also replace ' ' with '+', as required for quoting + HTML form values. Plus signs in the original string are escaped unless + they are included in safe. It also does not have safe default to '/'. + """ + # Check if ' ' in string, where string may either be a str or bytes. If + # there are no spaces, the regular quote will produce the right answer. + if ((isinstance(string, str) and ' ' not in string) or + (isinstance(string, bytes) and b' ' not in string)): + return quote(string, safe, encoding, errors) + if isinstance(safe, str): + space = ' ' + else: + space = b' ' + string = quote(string, safe + space, encoding, errors) + return string.replace(' ', '+') + +def quote_from_bytes(bs, safe='/'): + """Like quote(), but accepts a bytes object rather than a str, and does + not perform string-to-bytes encoding. It always returns an ASCII string. + quote_from_bytes(b'abc def\x3f') -> 'abc%20def%3f' + """ + if not isinstance(bs, (bytes, bytearray)): + raise TypeError("quote_from_bytes() expected bytes") + if not bs: + return '' + if isinstance(safe, str): + # Normalize 'safe' by converting to bytes and removing non-ASCII chars + safe = safe.encode('ascii', 'ignore') + else: + safe = bytes([c for c in safe if c < 128]) + if not bs.rstrip(_ALWAYS_SAFE_BYTES + safe): + return bs.decode() + try: + quoter = _safe_quoters[safe] + except KeyError: + _safe_quoters[safe] = quoter = Quoter(safe).__getitem__ + return ''.join([quoter(char) for char in bs]) + +def urlencode(query, doseq=False, safe='', encoding=None, errors=None, + quote_via=quote_plus): + """Encode a dict or sequence of two-element tuples into a URL query string. + + If any values in the query arg are sequences and doseq is true, each + sequence element is converted to a separate parameter. + + If the query arg is a sequence of two-element tuples, the order of the + parameters in the output will match the order of parameters in the + input. + + The components of a query arg may each be either a string or a bytes type. + + The safe, encoding, and errors parameters are passed down to the function + specified by quote_via (encoding and errors only if a component is a str). + """ + + if hasattr(query, "items"): + query = query.items() + else: + # It's a bother at times that strings and string-like objects are + # sequences. + try: + # non-sequence items should not work with len() + # non-empty strings will fail this + if len(query) and not isinstance(query[0], tuple): + raise TypeError + # Zero-length sequences of all types will get here and succeed, + # but that's a minor nit. Since the original implementation + # allowed empty dicts that type of behavior probably should be + # preserved for consistency + except TypeError: + ty, va, tb = sys.exc_info() + raise TypeError("not a valid non-string sequence " + "or mapping object").with_traceback(tb) + + l = [] + if not doseq: + for k, v in query: + if isinstance(k, bytes): + k = quote_via(k, safe) + else: + k = quote_via(str(k), safe, encoding, errors) + + if isinstance(v, bytes): + v = quote_via(v, safe) + else: + v = quote_via(str(v), safe, encoding, errors) + l.append(k + '=' + v) + else: + for k, v in query: + if isinstance(k, bytes): + k = quote_via(k, safe) + else: + k = quote_via(str(k), safe, encoding, errors) + + if isinstance(v, bytes): + v = quote_via(v, safe) + l.append(k + '=' + v) + elif isinstance(v, str): + v = quote_via(v, safe, encoding, errors) + l.append(k + '=' + v) + else: + try: + # Is this a sufficient test for sequence-ness? + x = len(v) + except TypeError: + # not a sequence + v = quote_via(str(v), safe, encoding, errors) + l.append(k + '=' + v) + else: + # loop over the sequence + for elt in v: + if isinstance(elt, bytes): + elt = quote_via(elt, safe) + else: + elt = quote_via(str(elt), safe, encoding, errors) + l.append(k + '=' + elt) + return '&'.join(l) + + +def to_bytes(url): + warnings.warn("urllib.parse.to_bytes() is deprecated as of 3.8", + DeprecationWarning, stacklevel=2) + return _to_bytes(url) + + +def _to_bytes(url): + """to_bytes(u"URL") --> 'URL'.""" + # Most URL schemes require ASCII. If that changes, the conversion + # can be relaxed. + # XXX get rid of to_bytes() + if isinstance(url, str): + try: + url = url.encode("ASCII").decode() + except UnicodeError: + raise UnicodeError("URL " + repr(url) + + " contains non-ASCII characters") + return url + + +def unwrap(url): + """Transform a string like '' into 'scheme://host/path'. + + The string is returned unchanged if it's not a wrapped URL. + """ + url = str(url).strip() + if url[:1] == '<' and url[-1:] == '>': + url = url[1:-1].strip() + if url[:4] == 'URL:': + url = url[4:].strip() + return url + + +def splittype(url): + warnings.warn("urllib.parse.splittype() is deprecated as of 3.8, " + "use urllib.parse.urlparse() instead", + DeprecationWarning, stacklevel=2) + return _splittype(url) + + +_typeprog = None +def _splittype(url): + """splittype('type:opaquestring') --> 'type', 'opaquestring'.""" + global _typeprog + if _typeprog is None: + _typeprog = re.compile('([^/:]+):(.*)', re.DOTALL) + + match = _typeprog.match(url) + if match: + scheme, data = match.groups() + return scheme.lower(), data + return None, url + + +def splithost(url): + warnings.warn("urllib.parse.splithost() is deprecated as of 3.8, " + "use urllib.parse.urlparse() instead", + DeprecationWarning, stacklevel=2) + return _splithost(url) + + +_hostprog = None +def _splithost(url): + """splithost('//host[:port]/path') --> 'host[:port]', '/path'.""" + global _hostprog + if _hostprog is None: + _hostprog = re.compile('//([^/#?]*)(.*)', re.DOTALL) + + match = _hostprog.match(url) + if match: + host_port, path = match.groups() + if path and path[0] != '/': + path = '/' + path + return host_port, path + return None, url + + +def splituser(host): + warnings.warn("urllib.parse.splituser() is deprecated as of 3.8, " + "use urllib.parse.urlparse() instead", + DeprecationWarning, stacklevel=2) + return _splituser(host) + + +def _splituser(host): + """splituser('user[:passwd]@host[:port]') --> 'user[:passwd]', 'host[:port]'.""" + user, delim, host = host.rpartition('@') + return (user if delim else None), host + + +def splitpasswd(user): + warnings.warn("urllib.parse.splitpasswd() is deprecated as of 3.8, " + "use urllib.parse.urlparse() instead", + DeprecationWarning, stacklevel=2) + return _splitpasswd(user) + + +def _splitpasswd(user): + """splitpasswd('user:passwd') -> 'user', 'passwd'.""" + user, delim, passwd = user.partition(':') + return user, (passwd if delim else None) + + +def splitport(host): + warnings.warn("urllib.parse.splitport() is deprecated as of 3.8, " + "use urllib.parse.urlparse() instead", + DeprecationWarning, stacklevel=2) + return _splitport(host) + + +# splittag('/path#tag') --> '/path', 'tag' +_portprog = None +def _splitport(host): + """splitport('host:port') --> 'host', 'port'.""" + global _portprog + if _portprog is None: + _portprog = re.compile('(.*):([0-9]*)', re.DOTALL) + + match = _portprog.fullmatch(host) + if match: + host, port = match.groups() + if port: + return host, port + return host, None + + +def splitnport(host, defport=-1): + warnings.warn("urllib.parse.splitnport() is deprecated as of 3.8, " + "use urllib.parse.urlparse() instead", + DeprecationWarning, stacklevel=2) + return _splitnport(host, defport) + + +def _splitnport(host, defport=-1): + """Split host and port, returning numeric port. + Return given default port if no ':' found; defaults to -1. + Return numerical port if a valid number is found after ':'. + Return None if ':' but not a valid number.""" + host, delim, port = host.rpartition(':') + if not delim: + host = port + elif port: + if port.isdigit() and port.isascii(): + nport = int(port) + else: + nport = None + return host, nport + return host, defport + + +def splitquery(url): + warnings.warn("urllib.parse.splitquery() is deprecated as of 3.8, " + "use urllib.parse.urlparse() instead", + DeprecationWarning, stacklevel=2) + return _splitquery(url) + + +def _splitquery(url): + """splitquery('/path?query') --> '/path', 'query'.""" + path, delim, query = url.rpartition('?') + if delim: + return path, query + return url, None + + +def splittag(url): + warnings.warn("urllib.parse.splittag() is deprecated as of 3.8, " + "use urllib.parse.urlparse() instead", + DeprecationWarning, stacklevel=2) + return _splittag(url) + + +def _splittag(url): + """splittag('/path#tag') --> '/path', 'tag'.""" + path, delim, tag = url.rpartition('#') + if delim: + return path, tag + return url, None + + +def splitattr(url): + warnings.warn("urllib.parse.splitattr() is deprecated as of 3.8, " + "use urllib.parse.urlparse() instead", + DeprecationWarning, stacklevel=2) + return _splitattr(url) + + +def _splitattr(url): + """splitattr('/path;attr1=value1;attr2=value2;...') -> + '/path', ['attr1=value1', 'attr2=value2', ...].""" + words = url.split(';') + return words[0], words[1:] + + +def splitvalue(attr): + warnings.warn("urllib.parse.splitvalue() is deprecated as of 3.8, " + "use urllib.parse.parse_qsl() instead", + DeprecationWarning, stacklevel=2) + return _splitvalue(attr) + + +def _splitvalue(attr): + """splitvalue('attr=value') --> 'attr', 'value'.""" + attr, delim, value = attr.partition('=') + return attr, (value if delim else None) diff --git a/miniconda3/envs/active_proaction/lib/python3.10/urllib/request.py b/miniconda3/envs/active_proaction/lib/python3.10/urllib/request.py new file mode 100644 index 0000000000000000000000000000000000000000..c378a86a70cbeba576146b0157aba6b7dd3bfc86 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/urllib/request.py @@ -0,0 +1,2783 @@ +"""An extensible library for opening URLs using a variety of protocols + +The simplest way to use this module is to call the urlopen function, +which accepts a string containing a URL or a Request object (described +below). It opens the URL and returns the results as file-like +object; the returned object has some extra methods described below. + +The OpenerDirector manages a collection of Handler objects that do +all the actual work. Each Handler implements a particular protocol or +option. The OpenerDirector is a composite object that invokes the +Handlers needed to open the requested URL. For example, the +HTTPHandler performs HTTP GET and POST requests and deals with +non-error returns. The HTTPRedirectHandler automatically deals with +HTTP 301, 302, 303 and 307 redirect errors, and the HTTPDigestAuthHandler +deals with digest authentication. + +urlopen(url, data=None) -- Basic usage is the same as original +urllib. pass the url and optionally data to post to an HTTP URL, and +get a file-like object back. One difference is that you can also pass +a Request instance instead of URL. Raises a URLError (subclass of +OSError); for HTTP errors, raises an HTTPError, which can also be +treated as a valid response. + +build_opener -- Function that creates a new OpenerDirector instance. +Will install the default handlers. Accepts one or more Handlers as +arguments, either instances or Handler classes that it will +instantiate. If one of the argument is a subclass of the default +handler, the argument will be installed instead of the default. + +install_opener -- Installs a new opener as the default opener. + +objects of interest: + +OpenerDirector -- Sets up the User Agent as the Python-urllib client and manages +the Handler classes, while dealing with requests and responses. + +Request -- An object that encapsulates the state of a request. The +state can be as simple as the URL. It can also include extra HTTP +headers, e.g. a User-Agent. + +BaseHandler -- + +internals: +BaseHandler and parent +_call_chain conventions + +Example usage: + +import urllib.request + +# set up authentication info +authinfo = urllib.request.HTTPBasicAuthHandler() +authinfo.add_password(realm='PDQ Application', + uri='https://mahler:8092/site-updates.py', + user='klem', + passwd='geheim$parole') + +proxy_support = urllib.request.ProxyHandler({"http" : "http://ahad-haam:3128"}) + +# build a new opener that adds authentication and caching FTP handlers +opener = urllib.request.build_opener(proxy_support, authinfo, + urllib.request.CacheFTPHandler) + +# install it +urllib.request.install_opener(opener) + +f = urllib.request.urlopen('https://www.python.org/') +""" + +# XXX issues: +# If an authentication error handler that tries to perform +# authentication for some reason but fails, how should the error be +# signalled? The client needs to know the HTTP error code. But if +# the handler knows that the problem was, e.g., that it didn't know +# that hash algo that requested in the challenge, it would be good to +# pass that information along to the client, too. +# ftp errors aren't handled cleanly +# check digest against correct (i.e. non-apache) implementation + +# Possible extensions: +# complex proxies XXX not sure what exactly was meant by this +# abstract factory for opener + +import base64 +import bisect +import email +import hashlib +import http.client +import io +import os +import posixpath +import re +import socket +import string +import sys +import time +import tempfile +import contextlib +import warnings + + +from urllib.error import URLError, HTTPError, ContentTooShortError +from urllib.parse import ( + urlparse, urlsplit, urljoin, unwrap, quote, unquote, + _splittype, _splithost, _splitport, _splituser, _splitpasswd, + _splitattr, _splitquery, _splitvalue, _splittag, _to_bytes, + unquote_to_bytes, urlunparse) +from urllib.response import addinfourl, addclosehook + +# check for SSL +try: + import ssl +except ImportError: + _have_ssl = False +else: + _have_ssl = True + +__all__ = [ + # Classes + 'Request', 'OpenerDirector', 'BaseHandler', 'HTTPDefaultErrorHandler', + 'HTTPRedirectHandler', 'HTTPCookieProcessor', 'ProxyHandler', + 'HTTPPasswordMgr', 'HTTPPasswordMgrWithDefaultRealm', + 'HTTPPasswordMgrWithPriorAuth', 'AbstractBasicAuthHandler', + 'HTTPBasicAuthHandler', 'ProxyBasicAuthHandler', 'AbstractDigestAuthHandler', + 'HTTPDigestAuthHandler', 'ProxyDigestAuthHandler', 'HTTPHandler', + 'FileHandler', 'FTPHandler', 'CacheFTPHandler', 'DataHandler', + 'UnknownHandler', 'HTTPErrorProcessor', + # Functions + 'urlopen', 'install_opener', 'build_opener', + 'pathname2url', 'url2pathname', 'getproxies', + # Legacy interface + 'urlretrieve', 'urlcleanup', 'URLopener', 'FancyURLopener', +] + +# used in User-Agent header sent +__version__ = '%d.%d' % sys.version_info[:2] + +_opener = None +def urlopen(url, data=None, timeout=socket._GLOBAL_DEFAULT_TIMEOUT, + *, cafile=None, capath=None, cadefault=False, context=None): + '''Open the URL url, which can be either a string or a Request object. + + *data* must be an object specifying additional data to be sent to + the server, or None if no such data is needed. See Request for + details. + + urllib.request module uses HTTP/1.1 and includes a "Connection:close" + header in its HTTP requests. + + The optional *timeout* parameter specifies a timeout in seconds for + blocking operations like the connection attempt (if not specified, the + global default timeout setting will be used). This only works for HTTP, + HTTPS and FTP connections. + + If *context* is specified, it must be a ssl.SSLContext instance describing + the various SSL options. See HTTPSConnection for more details. + + The optional *cafile* and *capath* parameters specify a set of trusted CA + certificates for HTTPS requests. cafile should point to a single file + containing a bundle of CA certificates, whereas capath should point to a + directory of hashed certificate files. More information can be found in + ssl.SSLContext.load_verify_locations(). + + The *cadefault* parameter is ignored. + + + This function always returns an object which can work as a + context manager and has the properties url, headers, and status. + See urllib.response.addinfourl for more detail on these properties. + + For HTTP and HTTPS URLs, this function returns a http.client.HTTPResponse + object slightly modified. In addition to the three new methods above, the + msg attribute contains the same information as the reason attribute --- + the reason phrase returned by the server --- instead of the response + headers as it is specified in the documentation for HTTPResponse. + + For FTP, file, and data URLs and requests explicitly handled by legacy + URLopener and FancyURLopener classes, this function returns a + urllib.response.addinfourl object. + + Note that None may be returned if no handler handles the request (though + the default installed global OpenerDirector uses UnknownHandler to ensure + this never happens). + + In addition, if proxy settings are detected (for example, when a *_proxy + environment variable like http_proxy is set), ProxyHandler is default + installed and makes sure the requests are handled through the proxy. + + ''' + global _opener + if cafile or capath or cadefault: + import warnings + warnings.warn("cafile, capath and cadefault are deprecated, use a " + "custom context instead.", DeprecationWarning, 2) + if context is not None: + raise ValueError( + "You can't pass both context and any of cafile, capath, and " + "cadefault" + ) + if not _have_ssl: + raise ValueError('SSL support not available') + context = ssl.create_default_context(ssl.Purpose.SERVER_AUTH, + cafile=cafile, + capath=capath) + # send ALPN extension to indicate HTTP/1.1 protocol + context.set_alpn_protocols(['http/1.1']) + https_handler = HTTPSHandler(context=context) + opener = build_opener(https_handler) + elif context: + https_handler = HTTPSHandler(context=context) + opener = build_opener(https_handler) + elif _opener is None: + _opener = opener = build_opener() + else: + opener = _opener + return opener.open(url, data, timeout) + +def install_opener(opener): + global _opener + _opener = opener + +_url_tempfiles = [] +def urlretrieve(url, filename=None, reporthook=None, data=None): + """ + Retrieve a URL into a temporary location on disk. + + Requires a URL argument. If a filename is passed, it is used as + the temporary file location. The reporthook argument should be + a callable that accepts a block number, a read size, and the + total file size of the URL target. The data argument should be + valid URL encoded data. + + If a filename is passed and the URL points to a local resource, + the result is a copy from local file to new file. + + Returns a tuple containing the path to the newly created + data file as well as the resulting HTTPMessage object. + """ + url_type, path = _splittype(url) + + with contextlib.closing(urlopen(url, data)) as fp: + headers = fp.info() + + # Just return the local path and the "headers" for file:// + # URLs. No sense in performing a copy unless requested. + if url_type == "file" and not filename: + return os.path.normpath(path), headers + + # Handle temporary file setup. + if filename: + tfp = open(filename, 'wb') + else: + tfp = tempfile.NamedTemporaryFile(delete=False) + filename = tfp.name + _url_tempfiles.append(filename) + + with tfp: + result = filename, headers + bs = 1024*8 + size = -1 + read = 0 + blocknum = 0 + if "content-length" in headers: + size = int(headers["Content-Length"]) + + if reporthook: + reporthook(blocknum, bs, size) + + while True: + block = fp.read(bs) + if not block: + break + read += len(block) + tfp.write(block) + blocknum += 1 + if reporthook: + reporthook(blocknum, bs, size) + + if size >= 0 and read < size: + raise ContentTooShortError( + "retrieval incomplete: got only %i out of %i bytes" + % (read, size), result) + + return result + +def urlcleanup(): + """Clean up temporary files from urlretrieve calls.""" + for temp_file in _url_tempfiles: + try: + os.unlink(temp_file) + except OSError: + pass + + del _url_tempfiles[:] + global _opener + if _opener: + _opener = None + +# copied from cookielib.py +_cut_port_re = re.compile(r":\d+$", re.ASCII) +def request_host(request): + """Return request-host, as defined by RFC 2965. + + Variation from RFC: returned value is lowercased, for convenient + comparison. + + """ + url = request.full_url + host = urlparse(url)[1] + if host == "": + host = request.get_header("Host", "") + + # remove port, if present + host = _cut_port_re.sub("", host, 1) + return host.lower() + +class Request: + + def __init__(self, url, data=None, headers={}, + origin_req_host=None, unverifiable=False, + method=None): + self.full_url = url + self.headers = {} + self.unredirected_hdrs = {} + self._data = None + self.data = data + self._tunnel_host = None + for key, value in headers.items(): + self.add_header(key, value) + if origin_req_host is None: + origin_req_host = request_host(self) + self.origin_req_host = origin_req_host + self.unverifiable = unverifiable + if method: + self.method = method + + @property + def full_url(self): + if self.fragment: + return '{}#{}'.format(self._full_url, self.fragment) + return self._full_url + + @full_url.setter + def full_url(self, url): + # unwrap('') --> 'type://host/path' + self._full_url = unwrap(url) + self._full_url, self.fragment = _splittag(self._full_url) + self._parse() + + @full_url.deleter + def full_url(self): + self._full_url = None + self.fragment = None + self.selector = '' + + @property + def data(self): + return self._data + + @data.setter + def data(self, data): + if data != self._data: + self._data = data + # issue 16464 + # if we change data we need to remove content-length header + # (cause it's most probably calculated for previous value) + if self.has_header("Content-length"): + self.remove_header("Content-length") + + @data.deleter + def data(self): + self.data = None + + def _parse(self): + self.type, rest = _splittype(self._full_url) + if self.type is None: + raise ValueError("unknown url type: %r" % self.full_url) + self.host, self.selector = _splithost(rest) + if self.host: + self.host = unquote(self.host) + + def get_method(self): + """Return a string indicating the HTTP request method.""" + default_method = "POST" if self.data is not None else "GET" + return getattr(self, 'method', default_method) + + def get_full_url(self): + return self.full_url + + def set_proxy(self, host, type): + if self.type == 'https' and not self._tunnel_host: + self._tunnel_host = self.host + else: + self.type= type + self.selector = self.full_url + self.host = host + + def has_proxy(self): + return self.selector == self.full_url + + def add_header(self, key, val): + # useful for something like authentication + self.headers[key.capitalize()] = val + + def add_unredirected_header(self, key, val): + # will not be added to a redirected request + self.unredirected_hdrs[key.capitalize()] = val + + def has_header(self, header_name): + return (header_name in self.headers or + header_name in self.unredirected_hdrs) + + def get_header(self, header_name, default=None): + return self.headers.get( + header_name, + self.unredirected_hdrs.get(header_name, default)) + + def remove_header(self, header_name): + self.headers.pop(header_name, None) + self.unredirected_hdrs.pop(header_name, None) + + def header_items(self): + hdrs = {**self.unredirected_hdrs, **self.headers} + return list(hdrs.items()) + +class OpenerDirector: + def __init__(self): + client_version = "Python-urllib/%s" % __version__ + self.addheaders = [('User-agent', client_version)] + # self.handlers is retained only for backward compatibility + self.handlers = [] + # manage the individual handlers + self.handle_open = {} + self.handle_error = {} + self.process_response = {} + self.process_request = {} + + def add_handler(self, handler): + if not hasattr(handler, "add_parent"): + raise TypeError("expected BaseHandler instance, got %r" % + type(handler)) + + added = False + for meth in dir(handler): + if meth in ["redirect_request", "do_open", "proxy_open"]: + # oops, coincidental match + continue + + i = meth.find("_") + protocol = meth[:i] + condition = meth[i+1:] + + if condition.startswith("error"): + j = condition.find("_") + i + 1 + kind = meth[j+1:] + try: + kind = int(kind) + except ValueError: + pass + lookup = self.handle_error.get(protocol, {}) + self.handle_error[protocol] = lookup + elif condition == "open": + kind = protocol + lookup = self.handle_open + elif condition == "response": + kind = protocol + lookup = self.process_response + elif condition == "request": + kind = protocol + lookup = self.process_request + else: + continue + + handlers = lookup.setdefault(kind, []) + if handlers: + bisect.insort(handlers, handler) + else: + handlers.append(handler) + added = True + + if added: + bisect.insort(self.handlers, handler) + handler.add_parent(self) + + def close(self): + # Only exists for backwards compatibility. + pass + + def _call_chain(self, chain, kind, meth_name, *args): + # Handlers raise an exception if no one else should try to handle + # the request, or return None if they can't but another handler + # could. Otherwise, they return the response. + handlers = chain.get(kind, ()) + for handler in handlers: + func = getattr(handler, meth_name) + result = func(*args) + if result is not None: + return result + + def open(self, fullurl, data=None, timeout=socket._GLOBAL_DEFAULT_TIMEOUT): + # accept a URL or a Request object + if isinstance(fullurl, str): + req = Request(fullurl, data) + else: + req = fullurl + if data is not None: + req.data = data + + req.timeout = timeout + protocol = req.type + + # pre-process request + meth_name = protocol+"_request" + for processor in self.process_request.get(protocol, []): + meth = getattr(processor, meth_name) + req = meth(req) + + sys.audit('urllib.Request', req.full_url, req.data, req.headers, req.get_method()) + response = self._open(req, data) + + # post-process response + meth_name = protocol+"_response" + for processor in self.process_response.get(protocol, []): + meth = getattr(processor, meth_name) + response = meth(req, response) + + return response + + def _open(self, req, data=None): + result = self._call_chain(self.handle_open, 'default', + 'default_open', req) + if result: + return result + + protocol = req.type + result = self._call_chain(self.handle_open, protocol, protocol + + '_open', req) + if result: + return result + + return self._call_chain(self.handle_open, 'unknown', + 'unknown_open', req) + + def error(self, proto, *args): + if proto in ('http', 'https'): + # XXX http[s] protocols are special-cased + dict = self.handle_error['http'] # https is not different than http + proto = args[2] # YUCK! + meth_name = 'http_error_%s' % proto + http_err = 1 + orig_args = args + else: + dict = self.handle_error + meth_name = proto + '_error' + http_err = 0 + args = (dict, proto, meth_name) + args + result = self._call_chain(*args) + if result: + return result + + if http_err: + args = (dict, 'default', 'http_error_default') + orig_args + return self._call_chain(*args) + +# XXX probably also want an abstract factory that knows when it makes +# sense to skip a superclass in favor of a subclass and when it might +# make sense to include both + +def build_opener(*handlers): + """Create an opener object from a list of handlers. + + The opener will use several default handlers, including support + for HTTP, FTP and when applicable HTTPS. + + If any of the handlers passed as arguments are subclasses of the + default handlers, the default handlers will not be used. + """ + opener = OpenerDirector() + default_classes = [ProxyHandler, UnknownHandler, HTTPHandler, + HTTPDefaultErrorHandler, HTTPRedirectHandler, + FTPHandler, FileHandler, HTTPErrorProcessor, + DataHandler] + if hasattr(http.client, "HTTPSConnection"): + default_classes.append(HTTPSHandler) + skip = set() + for klass in default_classes: + for check in handlers: + if isinstance(check, type): + if issubclass(check, klass): + skip.add(klass) + elif isinstance(check, klass): + skip.add(klass) + for klass in skip: + default_classes.remove(klass) + + for klass in default_classes: + opener.add_handler(klass()) + + for h in handlers: + if isinstance(h, type): + h = h() + opener.add_handler(h) + return opener + +class BaseHandler: + handler_order = 500 + + def add_parent(self, parent): + self.parent = parent + + def close(self): + # Only exists for backwards compatibility + pass + + def __lt__(self, other): + if not hasattr(other, "handler_order"): + # Try to preserve the old behavior of having custom classes + # inserted after default ones (works only for custom user + # classes which are not aware of handler_order). + return True + return self.handler_order < other.handler_order + + +class HTTPErrorProcessor(BaseHandler): + """Process HTTP error responses.""" + handler_order = 1000 # after all other processing + + def http_response(self, request, response): + code, msg, hdrs = response.code, response.msg, response.info() + + # According to RFC 2616, "2xx" code indicates that the client's + # request was successfully received, understood, and accepted. + if not (200 <= code < 300): + response = self.parent.error( + 'http', request, response, code, msg, hdrs) + + return response + + https_response = http_response + +class HTTPDefaultErrorHandler(BaseHandler): + def http_error_default(self, req, fp, code, msg, hdrs): + raise HTTPError(req.full_url, code, msg, hdrs, fp) + +class HTTPRedirectHandler(BaseHandler): + # maximum number of redirections to any single URL + # this is needed because of the state that cookies introduce + max_repeats = 4 + # maximum total number of redirections (regardless of URL) before + # assuming we're in a loop + max_redirections = 10 + + def redirect_request(self, req, fp, code, msg, headers, newurl): + """Return a Request or None in response to a redirect. + + This is called by the http_error_30x methods when a + redirection response is received. If a redirection should + take place, return a new Request to allow http_error_30x to + perform the redirect. Otherwise, raise HTTPError if no-one + else should try to handle this url. Return None if you can't + but another Handler might. + """ + m = req.get_method() + if (not (code in (301, 302, 303, 307) and m in ("GET", "HEAD") + or code in (301, 302, 303) and m == "POST")): + raise HTTPError(req.full_url, code, msg, headers, fp) + + # Strictly (according to RFC 2616), 301 or 302 in response to + # a POST MUST NOT cause a redirection without confirmation + # from the user (of urllib.request, in this case). In practice, + # essentially all clients do redirect in this case, so we do + # the same. + + # Be conciliant with URIs containing a space. This is mainly + # redundant with the more complete encoding done in http_error_302(), + # but it is kept for compatibility with other callers. + newurl = newurl.replace(' ', '%20') + + CONTENT_HEADERS = ("content-length", "content-type") + newheaders = {k: v for k, v in req.headers.items() + if k.lower() not in CONTENT_HEADERS} + return Request(newurl, + headers=newheaders, + origin_req_host=req.origin_req_host, + unverifiable=True) + + # Implementation note: To avoid the server sending us into an + # infinite loop, the request object needs to track what URLs we + # have already seen. Do this by adding a handler-specific + # attribute to the Request object. + def http_error_302(self, req, fp, code, msg, headers): + # Some servers (incorrectly) return multiple Location headers + # (so probably same goes for URI). Use first header. + if "location" in headers: + newurl = headers["location"] + elif "uri" in headers: + newurl = headers["uri"] + else: + return + + # fix a possible malformed URL + urlparts = urlparse(newurl) + + # For security reasons we don't allow redirection to anything other + # than http, https or ftp. + + if urlparts.scheme not in ('http', 'https', 'ftp', ''): + raise HTTPError( + newurl, code, + "%s - Redirection to url '%s' is not allowed" % (msg, newurl), + headers, fp) + + if not urlparts.path and urlparts.netloc: + urlparts = list(urlparts) + urlparts[2] = "/" + newurl = urlunparse(urlparts) + + # http.client.parse_headers() decodes as ISO-8859-1. Recover the + # original bytes and percent-encode non-ASCII bytes, and any special + # characters such as the space. + newurl = quote( + newurl, encoding="iso-8859-1", safe=string.punctuation) + newurl = urljoin(req.full_url, newurl) + + # XXX Probably want to forget about the state of the current + # request, although that might interact poorly with other + # handlers that also use handler-specific request attributes + new = self.redirect_request(req, fp, code, msg, headers, newurl) + if new is None: + return + + # loop detection + # .redirect_dict has a key url if url was previously visited. + if hasattr(req, 'redirect_dict'): + visited = new.redirect_dict = req.redirect_dict + if (visited.get(newurl, 0) >= self.max_repeats or + len(visited) >= self.max_redirections): + raise HTTPError(req.full_url, code, + self.inf_msg + msg, headers, fp) + else: + visited = new.redirect_dict = req.redirect_dict = {} + visited[newurl] = visited.get(newurl, 0) + 1 + + # Don't close the fp until we are sure that we won't use it + # with HTTPError. + fp.read() + fp.close() + + return self.parent.open(new, timeout=req.timeout) + + http_error_301 = http_error_303 = http_error_307 = http_error_302 + + inf_msg = "The HTTP server returned a redirect error that would " \ + "lead to an infinite loop.\n" \ + "The last 30x error message was:\n" + + +def _parse_proxy(proxy): + """Return (scheme, user, password, host/port) given a URL or an authority. + + If a URL is supplied, it must have an authority (host:port) component. + According to RFC 3986, having an authority component means the URL must + have two slashes after the scheme. + """ + scheme, r_scheme = _splittype(proxy) + if not r_scheme.startswith("/"): + # authority + scheme = None + authority = proxy + else: + # URL + if not r_scheme.startswith("//"): + raise ValueError("proxy URL with no authority: %r" % proxy) + # We have an authority, so for RFC 3986-compliant URLs (by ss 3. + # and 3.3.), path is empty or starts with '/' + if '@' in r_scheme: + host_separator = r_scheme.find('@') + end = r_scheme.find("/", host_separator) + else: + end = r_scheme.find("/", 2) + if end == -1: + end = None + authority = r_scheme[2:end] + userinfo, hostport = _splituser(authority) + if userinfo is not None: + user, password = _splitpasswd(userinfo) + else: + user = password = None + return scheme, user, password, hostport + +class ProxyHandler(BaseHandler): + # Proxies must be in front + handler_order = 100 + + def __init__(self, proxies=None): + if proxies is None: + proxies = getproxies() + assert hasattr(proxies, 'keys'), "proxies must be a mapping" + self.proxies = proxies + for type, url in proxies.items(): + type = type.lower() + setattr(self, '%s_open' % type, + lambda r, proxy=url, type=type, meth=self.proxy_open: + meth(r, proxy, type)) + + def proxy_open(self, req, proxy, type): + orig_type = req.type + proxy_type, user, password, hostport = _parse_proxy(proxy) + if proxy_type is None: + proxy_type = orig_type + + if req.host and proxy_bypass(req.host): + return None + + if user and password: + user_pass = '%s:%s' % (unquote(user), + unquote(password)) + creds = base64.b64encode(user_pass.encode()).decode("ascii") + req.add_header('Proxy-authorization', 'Basic ' + creds) + hostport = unquote(hostport) + req.set_proxy(hostport, proxy_type) + if orig_type == proxy_type or orig_type == 'https': + # let other handlers take care of it + return None + else: + # need to start over, because the other handlers don't + # grok the proxy's URL type + # e.g. if we have a constructor arg proxies like so: + # {'http': 'ftp://proxy.example.com'}, we may end up turning + # a request for http://acme.example.com/a into one for + # ftp://proxy.example.com/a + return self.parent.open(req, timeout=req.timeout) + +class HTTPPasswordMgr: + + def __init__(self): + self.passwd = {} + + def add_password(self, realm, uri, user, passwd): + # uri could be a single URI or a sequence + if isinstance(uri, str): + uri = [uri] + if realm not in self.passwd: + self.passwd[realm] = {} + for default_port in True, False: + reduced_uri = tuple( + self.reduce_uri(u, default_port) for u in uri) + self.passwd[realm][reduced_uri] = (user, passwd) + + def find_user_password(self, realm, authuri): + domains = self.passwd.get(realm, {}) + for default_port in True, False: + reduced_authuri = self.reduce_uri(authuri, default_port) + for uris, authinfo in domains.items(): + for uri in uris: + if self.is_suburi(uri, reduced_authuri): + return authinfo + return None, None + + def reduce_uri(self, uri, default_port=True): + """Accept authority or URI and extract only the authority and path.""" + # note HTTP URLs do not have a userinfo component + parts = urlsplit(uri) + if parts[1]: + # URI + scheme = parts[0] + authority = parts[1] + path = parts[2] or '/' + else: + # host or host:port + scheme = None + authority = uri + path = '/' + host, port = _splitport(authority) + if default_port and port is None and scheme is not None: + dport = {"http": 80, + "https": 443, + }.get(scheme) + if dport is not None: + authority = "%s:%d" % (host, dport) + return authority, path + + def is_suburi(self, base, test): + """Check if test is below base in a URI tree + + Both args must be URIs in reduced form. + """ + if base == test: + return True + if base[0] != test[0]: + return False + prefix = base[1] + if prefix[-1:] != '/': + prefix += '/' + return test[1].startswith(prefix) + + +class HTTPPasswordMgrWithDefaultRealm(HTTPPasswordMgr): + + def find_user_password(self, realm, authuri): + user, password = HTTPPasswordMgr.find_user_password(self, realm, + authuri) + if user is not None: + return user, password + return HTTPPasswordMgr.find_user_password(self, None, authuri) + + +class HTTPPasswordMgrWithPriorAuth(HTTPPasswordMgrWithDefaultRealm): + + def __init__(self, *args, **kwargs): + self.authenticated = {} + super().__init__(*args, **kwargs) + + def add_password(self, realm, uri, user, passwd, is_authenticated=False): + self.update_authenticated(uri, is_authenticated) + # Add a default for prior auth requests + if realm is not None: + super().add_password(None, uri, user, passwd) + super().add_password(realm, uri, user, passwd) + + def update_authenticated(self, uri, is_authenticated=False): + # uri could be a single URI or a sequence + if isinstance(uri, str): + uri = [uri] + + for default_port in True, False: + for u in uri: + reduced_uri = self.reduce_uri(u, default_port) + self.authenticated[reduced_uri] = is_authenticated + + def is_authenticated(self, authuri): + for default_port in True, False: + reduced_authuri = self.reduce_uri(authuri, default_port) + for uri in self.authenticated: + if self.is_suburi(uri, reduced_authuri): + return self.authenticated[uri] + + +class AbstractBasicAuthHandler: + + # XXX this allows for multiple auth-schemes, but will stupidly pick + # the last one with a realm specified. + + # allow for double- and single-quoted realm values + # (single quotes are a violation of the RFC, but appear in the wild) + rx = re.compile('(?:^|,)' # start of the string or ',' + '[ \t]*' # optional whitespaces + '([^ \t,]+)' # scheme like "Basic" + '[ \t]+' # mandatory whitespaces + # realm=xxx + # realm='xxx' + # realm="xxx" + 'realm=(["\']?)([^"\']*)\\2', + re.I) + + # XXX could pre-emptively send auth info already accepted (RFC 2617, + # end of section 2, and section 1.2 immediately after "credentials" + # production). + + def __init__(self, password_mgr=None): + if password_mgr is None: + password_mgr = HTTPPasswordMgr() + self.passwd = password_mgr + self.add_password = self.passwd.add_password + + def _parse_realm(self, header): + # parse WWW-Authenticate header: accept multiple challenges per header + found_challenge = False + for mo in AbstractBasicAuthHandler.rx.finditer(header): + scheme, quote, realm = mo.groups() + if quote not in ['"', "'"]: + warnings.warn("Basic Auth Realm was unquoted", + UserWarning, 3) + + yield (scheme, realm) + + found_challenge = True + + if not found_challenge: + if header: + scheme = header.split()[0] + else: + scheme = '' + yield (scheme, None) + + def http_error_auth_reqed(self, authreq, host, req, headers): + # host may be an authority (without userinfo) or a URL with an + # authority + headers = headers.get_all(authreq) + if not headers: + # no header found + return + + unsupported = None + for header in headers: + for scheme, realm in self._parse_realm(header): + if scheme.lower() != 'basic': + unsupported = scheme + continue + + if realm is not None: + # Use the first matching Basic challenge. + # Ignore following challenges even if they use the Basic + # scheme. + return self.retry_http_basic_auth(host, req, realm) + + if unsupported is not None: + raise ValueError("AbstractBasicAuthHandler does not " + "support the following scheme: %r" + % (scheme,)) + + def retry_http_basic_auth(self, host, req, realm): + user, pw = self.passwd.find_user_password(realm, host) + if pw is not None: + raw = "%s:%s" % (user, pw) + auth = "Basic " + base64.b64encode(raw.encode()).decode("ascii") + if req.get_header(self.auth_header, None) == auth: + return None + req.add_unredirected_header(self.auth_header, auth) + return self.parent.open(req, timeout=req.timeout) + else: + return None + + def http_request(self, req): + if (not hasattr(self.passwd, 'is_authenticated') or + not self.passwd.is_authenticated(req.full_url)): + return req + + if not req.has_header('Authorization'): + user, passwd = self.passwd.find_user_password(None, req.full_url) + credentials = '{0}:{1}'.format(user, passwd).encode() + auth_str = base64.standard_b64encode(credentials).decode() + req.add_unredirected_header('Authorization', + 'Basic {}'.format(auth_str.strip())) + return req + + def http_response(self, req, response): + if hasattr(self.passwd, 'is_authenticated'): + if 200 <= response.code < 300: + self.passwd.update_authenticated(req.full_url, True) + else: + self.passwd.update_authenticated(req.full_url, False) + return response + + https_request = http_request + https_response = http_response + + + +class HTTPBasicAuthHandler(AbstractBasicAuthHandler, BaseHandler): + + auth_header = 'Authorization' + + def http_error_401(self, req, fp, code, msg, headers): + url = req.full_url + response = self.http_error_auth_reqed('www-authenticate', + url, req, headers) + return response + + +class ProxyBasicAuthHandler(AbstractBasicAuthHandler, BaseHandler): + + auth_header = 'Proxy-authorization' + + def http_error_407(self, req, fp, code, msg, headers): + # http_error_auth_reqed requires that there is no userinfo component in + # authority. Assume there isn't one, since urllib.request does not (and + # should not, RFC 3986 s. 3.2.1) support requests for URLs containing + # userinfo. + authority = req.host + response = self.http_error_auth_reqed('proxy-authenticate', + authority, req, headers) + return response + + +# Return n random bytes. +_randombytes = os.urandom + + +class AbstractDigestAuthHandler: + # Digest authentication is specified in RFC 2617. + + # XXX The client does not inspect the Authentication-Info header + # in a successful response. + + # XXX It should be possible to test this implementation against + # a mock server that just generates a static set of challenges. + + # XXX qop="auth-int" supports is shaky + + def __init__(self, passwd=None): + if passwd is None: + passwd = HTTPPasswordMgr() + self.passwd = passwd + self.add_password = self.passwd.add_password + self.retried = 0 + self.nonce_count = 0 + self.last_nonce = None + + def reset_retry_count(self): + self.retried = 0 + + def http_error_auth_reqed(self, auth_header, host, req, headers): + authreq = headers.get(auth_header, None) + if self.retried > 5: + # Don't fail endlessly - if we failed once, we'll probably + # fail a second time. Hm. Unless the Password Manager is + # prompting for the information. Crap. This isn't great + # but it's better than the current 'repeat until recursion + # depth exceeded' approach + raise HTTPError(req.full_url, 401, "digest auth failed", + headers, None) + else: + self.retried += 1 + if authreq: + scheme = authreq.split()[0] + if scheme.lower() == 'digest': + return self.retry_http_digest_auth(req, authreq) + elif scheme.lower() != 'basic': + raise ValueError("AbstractDigestAuthHandler does not support" + " the following scheme: '%s'" % scheme) + + def retry_http_digest_auth(self, req, auth): + token, challenge = auth.split(' ', 1) + chal = parse_keqv_list(filter(None, parse_http_list(challenge))) + auth = self.get_authorization(req, chal) + if auth: + auth_val = 'Digest %s' % auth + if req.headers.get(self.auth_header, None) == auth_val: + return None + req.add_unredirected_header(self.auth_header, auth_val) + resp = self.parent.open(req, timeout=req.timeout) + return resp + + def get_cnonce(self, nonce): + # The cnonce-value is an opaque + # quoted string value provided by the client and used by both client + # and server to avoid chosen plaintext attacks, to provide mutual + # authentication, and to provide some message integrity protection. + # This isn't a fabulous effort, but it's probably Good Enough. + s = "%s:%s:%s:" % (self.nonce_count, nonce, time.ctime()) + b = s.encode("ascii") + _randombytes(8) + dig = hashlib.sha1(b).hexdigest() + return dig[:16] + + def get_authorization(self, req, chal): + try: + realm = chal['realm'] + nonce = chal['nonce'] + qop = chal.get('qop') + algorithm = chal.get('algorithm', 'MD5') + # mod_digest doesn't send an opaque, even though it isn't + # supposed to be optional + opaque = chal.get('opaque', None) + except KeyError: + return None + + H, KD = self.get_algorithm_impls(algorithm) + if H is None: + return None + + user, pw = self.passwd.find_user_password(realm, req.full_url) + if user is None: + return None + + # XXX not implemented yet + if req.data is not None: + entdig = self.get_entity_digest(req.data, chal) + else: + entdig = None + + A1 = "%s:%s:%s" % (user, realm, pw) + A2 = "%s:%s" % (req.get_method(), + # XXX selector: what about proxies and full urls + req.selector) + # NOTE: As per RFC 2617, when server sends "auth,auth-int", the client could use either `auth` + # or `auth-int` to the response back. we use `auth` to send the response back. + if qop is None: + respdig = KD(H(A1), "%s:%s" % (nonce, H(A2))) + elif 'auth' in qop.split(','): + if nonce == self.last_nonce: + self.nonce_count += 1 + else: + self.nonce_count = 1 + self.last_nonce = nonce + ncvalue = '%08x' % self.nonce_count + cnonce = self.get_cnonce(nonce) + noncebit = "%s:%s:%s:%s:%s" % (nonce, ncvalue, cnonce, 'auth', H(A2)) + respdig = KD(H(A1), noncebit) + else: + # XXX handle auth-int. + raise URLError("qop '%s' is not supported." % qop) + + # XXX should the partial digests be encoded too? + + base = 'username="%s", realm="%s", nonce="%s", uri="%s", ' \ + 'response="%s"' % (user, realm, nonce, req.selector, + respdig) + if opaque: + base += ', opaque="%s"' % opaque + if entdig: + base += ', digest="%s"' % entdig + base += ', algorithm="%s"' % algorithm + if qop: + base += ', qop=auth, nc=%s, cnonce="%s"' % (ncvalue, cnonce) + return base + + def get_algorithm_impls(self, algorithm): + # lambdas assume digest modules are imported at the top level + if algorithm == 'MD5': + H = lambda x: hashlib.md5(x.encode("ascii")).hexdigest() + elif algorithm == 'SHA': + H = lambda x: hashlib.sha1(x.encode("ascii")).hexdigest() + # XXX MD5-sess + else: + raise ValueError("Unsupported digest authentication " + "algorithm %r" % algorithm) + KD = lambda s, d: H("%s:%s" % (s, d)) + return H, KD + + def get_entity_digest(self, data, chal): + # XXX not implemented yet + return None + + +class HTTPDigestAuthHandler(BaseHandler, AbstractDigestAuthHandler): + """An authentication protocol defined by RFC 2069 + + Digest authentication improves on basic authentication because it + does not transmit passwords in the clear. + """ + + auth_header = 'Authorization' + handler_order = 490 # before Basic auth + + def http_error_401(self, req, fp, code, msg, headers): + host = urlparse(req.full_url)[1] + retry = self.http_error_auth_reqed('www-authenticate', + host, req, headers) + self.reset_retry_count() + return retry + + +class ProxyDigestAuthHandler(BaseHandler, AbstractDigestAuthHandler): + + auth_header = 'Proxy-Authorization' + handler_order = 490 # before Basic auth + + def http_error_407(self, req, fp, code, msg, headers): + host = req.host + retry = self.http_error_auth_reqed('proxy-authenticate', + host, req, headers) + self.reset_retry_count() + return retry + +class AbstractHTTPHandler(BaseHandler): + + def __init__(self, debuglevel=0): + self._debuglevel = debuglevel + + def set_http_debuglevel(self, level): + self._debuglevel = level + + def _get_content_length(self, request): + return http.client.HTTPConnection._get_content_length( + request.data, + request.get_method()) + + def do_request_(self, request): + host = request.host + if not host: + raise URLError('no host given') + + if request.data is not None: # POST + data = request.data + if isinstance(data, str): + msg = "POST data should be bytes, an iterable of bytes, " \ + "or a file object. It cannot be of type str." + raise TypeError(msg) + if not request.has_header('Content-type'): + request.add_unredirected_header( + 'Content-type', + 'application/x-www-form-urlencoded') + if (not request.has_header('Content-length') + and not request.has_header('Transfer-encoding')): + content_length = self._get_content_length(request) + if content_length is not None: + request.add_unredirected_header( + 'Content-length', str(content_length)) + else: + request.add_unredirected_header( + 'Transfer-encoding', 'chunked') + + sel_host = host + if request.has_proxy(): + scheme, sel = _splittype(request.selector) + sel_host, sel_path = _splithost(sel) + if not request.has_header('Host'): + request.add_unredirected_header('Host', sel_host) + for name, value in self.parent.addheaders: + name = name.capitalize() + if not request.has_header(name): + request.add_unredirected_header(name, value) + + return request + + def do_open(self, http_class, req, **http_conn_args): + """Return an HTTPResponse object for the request, using http_class. + + http_class must implement the HTTPConnection API from http.client. + """ + host = req.host + if not host: + raise URLError('no host given') + + # will parse host:port + h = http_class(host, timeout=req.timeout, **http_conn_args) + h.set_debuglevel(self._debuglevel) + + headers = dict(req.unredirected_hdrs) + headers.update({k: v for k, v in req.headers.items() + if k not in headers}) + + # TODO(jhylton): Should this be redesigned to handle + # persistent connections? + + # We want to make an HTTP/1.1 request, but the addinfourl + # class isn't prepared to deal with a persistent connection. + # It will try to read all remaining data from the socket, + # which will block while the server waits for the next request. + # So make sure the connection gets closed after the (only) + # request. + headers["Connection"] = "close" + headers = {name.title(): val for name, val in headers.items()} + + if req._tunnel_host: + tunnel_headers = {} + proxy_auth_hdr = "Proxy-Authorization" + if proxy_auth_hdr in headers: + tunnel_headers[proxy_auth_hdr] = headers[proxy_auth_hdr] + # Proxy-Authorization should not be sent to origin + # server. + del headers[proxy_auth_hdr] + h.set_tunnel(req._tunnel_host, headers=tunnel_headers) + + try: + try: + h.request(req.get_method(), req.selector, req.data, headers, + encode_chunked=req.has_header('Transfer-encoding')) + except OSError as err: # timeout error + raise URLError(err) + r = h.getresponse() + except: + h.close() + raise + + # If the server does not send us a 'Connection: close' header, + # HTTPConnection assumes the socket should be left open. Manually + # mark the socket to be closed when this response object goes away. + if h.sock: + h.sock.close() + h.sock = None + + r.url = req.get_full_url() + # This line replaces the .msg attribute of the HTTPResponse + # with .headers, because urllib clients expect the response to + # have the reason in .msg. It would be good to mark this + # attribute is deprecated and get then to use info() or + # .headers. + r.msg = r.reason + return r + + +class HTTPHandler(AbstractHTTPHandler): + + def http_open(self, req): + return self.do_open(http.client.HTTPConnection, req) + + http_request = AbstractHTTPHandler.do_request_ + +if hasattr(http.client, 'HTTPSConnection'): + + class HTTPSHandler(AbstractHTTPHandler): + + def __init__(self, debuglevel=0, context=None, check_hostname=None): + AbstractHTTPHandler.__init__(self, debuglevel) + self._context = context + self._check_hostname = check_hostname + + def https_open(self, req): + return self.do_open(http.client.HTTPSConnection, req, + context=self._context, check_hostname=self._check_hostname) + + https_request = AbstractHTTPHandler.do_request_ + + __all__.append('HTTPSHandler') + +class HTTPCookieProcessor(BaseHandler): + def __init__(self, cookiejar=None): + import http.cookiejar + if cookiejar is None: + cookiejar = http.cookiejar.CookieJar() + self.cookiejar = cookiejar + + def http_request(self, request): + self.cookiejar.add_cookie_header(request) + return request + + def http_response(self, request, response): + self.cookiejar.extract_cookies(response, request) + return response + + https_request = http_request + https_response = http_response + +class UnknownHandler(BaseHandler): + def unknown_open(self, req): + type = req.type + raise URLError('unknown url type: %s' % type) + +def parse_keqv_list(l): + """Parse list of key=value strings where keys are not duplicated.""" + parsed = {} + for elt in l: + k, v = elt.split('=', 1) + if v[0] == '"' and v[-1] == '"': + v = v[1:-1] + parsed[k] = v + return parsed + +def parse_http_list(s): + """Parse lists as described by RFC 2068 Section 2. + + In particular, parse comma-separated lists where the elements of + the list may include quoted-strings. A quoted-string could + contain a comma. A non-quoted string could have quotes in the + middle. Neither commas nor quotes count if they are escaped. + Only double-quotes count, not single-quotes. + """ + res = [] + part = '' + + escape = quote = False + for cur in s: + if escape: + part += cur + escape = False + continue + if quote: + if cur == '\\': + escape = True + continue + elif cur == '"': + quote = False + part += cur + continue + + if cur == ',': + res.append(part) + part = '' + continue + + if cur == '"': + quote = True + + part += cur + + # append last part + if part: + res.append(part) + + return [part.strip() for part in res] + +class FileHandler(BaseHandler): + # Use local file or FTP depending on form of URL + def file_open(self, req): + url = req.selector + if url[:2] == '//' and url[2:3] != '/' and (req.host and + req.host != 'localhost'): + if not req.host in self.get_names(): + raise URLError("file:// scheme is supported only on localhost") + else: + return self.open_local_file(req) + + # names for the localhost + names = None + def get_names(self): + if FileHandler.names is None: + try: + FileHandler.names = tuple( + socket.gethostbyname_ex('localhost')[2] + + socket.gethostbyname_ex(socket.gethostname())[2]) + except socket.gaierror: + FileHandler.names = (socket.gethostbyname('localhost'),) + return FileHandler.names + + # not entirely sure what the rules are here + def open_local_file(self, req): + import email.utils + import mimetypes + host = req.host + filename = req.selector + localfile = url2pathname(filename) + try: + stats = os.stat(localfile) + size = stats.st_size + modified = email.utils.formatdate(stats.st_mtime, usegmt=True) + mtype = mimetypes.guess_type(filename)[0] + headers = email.message_from_string( + 'Content-type: %s\nContent-length: %d\nLast-modified: %s\n' % + (mtype or 'text/plain', size, modified)) + if host: + host, port = _splitport(host) + if not host or \ + (not port and _safe_gethostbyname(host) in self.get_names()): + if host: + origurl = 'file://' + host + filename + else: + origurl = 'file://' + filename + return addinfourl(open(localfile, 'rb'), headers, origurl) + except OSError as exp: + raise URLError(exp) + raise URLError('file not on local host') + +def _safe_gethostbyname(host): + try: + return socket.gethostbyname(host) + except socket.gaierror: + return None + +class FTPHandler(BaseHandler): + def ftp_open(self, req): + import ftplib + import mimetypes + host = req.host + if not host: + raise URLError('ftp error: no host given') + host, port = _splitport(host) + if port is None: + port = ftplib.FTP_PORT + else: + port = int(port) + + # username/password handling + user, host = _splituser(host) + if user: + user, passwd = _splitpasswd(user) + else: + passwd = None + host = unquote(host) + user = user or '' + passwd = passwd or '' + + try: + host = socket.gethostbyname(host) + except OSError as msg: + raise URLError(msg) + path, attrs = _splitattr(req.selector) + dirs = path.split('/') + dirs = list(map(unquote, dirs)) + dirs, file = dirs[:-1], dirs[-1] + if dirs and not dirs[0]: + dirs = dirs[1:] + try: + fw = self.connect_ftp(user, passwd, host, port, dirs, req.timeout) + type = file and 'I' or 'D' + for attr in attrs: + attr, value = _splitvalue(attr) + if attr.lower() == 'type' and \ + value in ('a', 'A', 'i', 'I', 'd', 'D'): + type = value.upper() + fp, retrlen = fw.retrfile(file, type) + headers = "" + mtype = mimetypes.guess_type(req.full_url)[0] + if mtype: + headers += "Content-type: %s\n" % mtype + if retrlen is not None and retrlen >= 0: + headers += "Content-length: %d\n" % retrlen + headers = email.message_from_string(headers) + return addinfourl(fp, headers, req.full_url) + except ftplib.all_errors as exp: + raise URLError(exp) from exp + + def connect_ftp(self, user, passwd, host, port, dirs, timeout): + return ftpwrapper(user, passwd, host, port, dirs, timeout, + persistent=False) + +class CacheFTPHandler(FTPHandler): + # XXX would be nice to have pluggable cache strategies + # XXX this stuff is definitely not thread safe + def __init__(self): + self.cache = {} + self.timeout = {} + self.soonest = 0 + self.delay = 60 + self.max_conns = 16 + + def setTimeout(self, t): + self.delay = t + + def setMaxConns(self, m): + self.max_conns = m + + def connect_ftp(self, user, passwd, host, port, dirs, timeout): + key = user, host, port, '/'.join(dirs), timeout + if key in self.cache: + self.timeout[key] = time.time() + self.delay + else: + self.cache[key] = ftpwrapper(user, passwd, host, port, + dirs, timeout) + self.timeout[key] = time.time() + self.delay + self.check_cache() + return self.cache[key] + + def check_cache(self): + # first check for old ones + t = time.time() + if self.soonest <= t: + for k, v in list(self.timeout.items()): + if v < t: + self.cache[k].close() + del self.cache[k] + del self.timeout[k] + self.soonest = min(list(self.timeout.values())) + + # then check the size + if len(self.cache) == self.max_conns: + for k, v in list(self.timeout.items()): + if v == self.soonest: + del self.cache[k] + del self.timeout[k] + break + self.soonest = min(list(self.timeout.values())) + + def clear_cache(self): + for conn in self.cache.values(): + conn.close() + self.cache.clear() + self.timeout.clear() + +class DataHandler(BaseHandler): + def data_open(self, req): + # data URLs as specified in RFC 2397. + # + # ignores POSTed data + # + # syntax: + # dataurl := "data:" [ mediatype ] [ ";base64" ] "," data + # mediatype := [ type "/" subtype ] *( ";" parameter ) + # data := *urlchar + # parameter := attribute "=" value + url = req.full_url + + scheme, data = url.split(":",1) + mediatype, data = data.split(",",1) + + # Disallow control characters within mediatype. + if re.search(r"[\x00-\x1F\x7F]", mediatype): + raise ValueError( + "Control characters not allowed in data: mediatype") + + # even base64 encoded data URLs might be quoted so unquote in any case: + data = unquote_to_bytes(data) + if mediatype.endswith(";base64"): + data = base64.decodebytes(data) + mediatype = mediatype[:-7] + + if not mediatype: + mediatype = "text/plain;charset=US-ASCII" + + headers = email.message_from_string("Content-type: %s\nContent-length: %d\n" % + (mediatype, len(data))) + + return addinfourl(io.BytesIO(data), headers, url) + + +# Code move from the old urllib module + +MAXFTPCACHE = 10 # Trim the ftp cache beyond this size + +# Helper for non-unix systems +if os.name == 'nt': + from nturl2path import url2pathname, pathname2url +else: + def url2pathname(pathname): + """OS-specific conversion from a relative URL of the 'file' scheme + to a file system path; not recommended for general use.""" + return unquote(pathname) + + def pathname2url(pathname): + """OS-specific conversion from a file system path to a relative URL + of the 'file' scheme; not recommended for general use.""" + return quote(pathname) + + +ftpcache = {} + + +class URLopener: + """Class to open URLs. + This is a class rather than just a subroutine because we may need + more than one set of global protocol-specific options. + Note -- this is a base class for those who don't want the + automatic handling of errors type 302 (relocated) and 401 + (authorization needed).""" + + __tempfiles = None + + version = "Python-urllib/%s" % __version__ + + # Constructor + def __init__(self, proxies=None, **x509): + msg = "%(class)s style of invoking requests is deprecated. " \ + "Use newer urlopen functions/methods" % {'class': self.__class__.__name__} + warnings.warn(msg, DeprecationWarning, stacklevel=3) + if proxies is None: + proxies = getproxies() + assert hasattr(proxies, 'keys'), "proxies must be a mapping" + self.proxies = proxies + self.key_file = x509.get('key_file') + self.cert_file = x509.get('cert_file') + self.addheaders = [('User-Agent', self.version), ('Accept', '*/*')] + self.__tempfiles = [] + self.__unlink = os.unlink # See cleanup() + self.tempcache = None + # Undocumented feature: if you assign {} to tempcache, + # it is used to cache files retrieved with + # self.retrieve(). This is not enabled by default + # since it does not work for changing documents (and I + # haven't got the logic to check expiration headers + # yet). + self.ftpcache = ftpcache + # Undocumented feature: you can use a different + # ftp cache by assigning to the .ftpcache member; + # in case you want logically independent URL openers + # XXX This is not threadsafe. Bah. + + def __del__(self): + self.close() + + def close(self): + self.cleanup() + + def cleanup(self): + # This code sometimes runs when the rest of this module + # has already been deleted, so it can't use any globals + # or import anything. + if self.__tempfiles: + for file in self.__tempfiles: + try: + self.__unlink(file) + except OSError: + pass + del self.__tempfiles[:] + if self.tempcache: + self.tempcache.clear() + + def addheader(self, *args): + """Add a header to be used by the HTTP interface only + e.g. u.addheader('Accept', 'sound/basic')""" + self.addheaders.append(args) + + # External interface + def open(self, fullurl, data=None): + """Use URLopener().open(file) instead of open(file, 'r').""" + fullurl = unwrap(_to_bytes(fullurl)) + fullurl = quote(fullurl, safe="%/:=&?~#+!$,;'@()*[]|") + if self.tempcache and fullurl in self.tempcache: + filename, headers = self.tempcache[fullurl] + fp = open(filename, 'rb') + return addinfourl(fp, headers, fullurl) + urltype, url = _splittype(fullurl) + if not urltype: + urltype = 'file' + if urltype in self.proxies: + proxy = self.proxies[urltype] + urltype, proxyhost = _splittype(proxy) + host, selector = _splithost(proxyhost) + url = (host, fullurl) # Signal special case to open_*() + else: + proxy = None + name = 'open_' + urltype + self.type = urltype + name = name.replace('-', '_') + if not hasattr(self, name) or name == 'open_local_file': + if proxy: + return self.open_unknown_proxy(proxy, fullurl, data) + else: + return self.open_unknown(fullurl, data) + try: + if data is None: + return getattr(self, name)(url) + else: + return getattr(self, name)(url, data) + except (HTTPError, URLError): + raise + except OSError as msg: + raise OSError('socket error', msg).with_traceback(sys.exc_info()[2]) + + def open_unknown(self, fullurl, data=None): + """Overridable interface to open unknown URL type.""" + type, url = _splittype(fullurl) + raise OSError('url error', 'unknown url type', type) + + def open_unknown_proxy(self, proxy, fullurl, data=None): + """Overridable interface to open unknown URL type.""" + type, url = _splittype(fullurl) + raise OSError('url error', 'invalid proxy for %s' % type, proxy) + + # External interface + def retrieve(self, url, filename=None, reporthook=None, data=None): + """retrieve(url) returns (filename, headers) for a local object + or (tempfilename, headers) for a remote object.""" + url = unwrap(_to_bytes(url)) + if self.tempcache and url in self.tempcache: + return self.tempcache[url] + type, url1 = _splittype(url) + if filename is None and (not type or type == 'file'): + try: + fp = self.open_local_file(url1) + hdrs = fp.info() + fp.close() + return url2pathname(_splithost(url1)[1]), hdrs + except OSError: + pass + fp = self.open(url, data) + try: + headers = fp.info() + if filename: + tfp = open(filename, 'wb') + else: + garbage, path = _splittype(url) + garbage, path = _splithost(path or "") + path, garbage = _splitquery(path or "") + path, garbage = _splitattr(path or "") + suffix = os.path.splitext(path)[1] + (fd, filename) = tempfile.mkstemp(suffix) + self.__tempfiles.append(filename) + tfp = os.fdopen(fd, 'wb') + try: + result = filename, headers + if self.tempcache is not None: + self.tempcache[url] = result + bs = 1024*8 + size = -1 + read = 0 + blocknum = 0 + if "content-length" in headers: + size = int(headers["Content-Length"]) + if reporthook: + reporthook(blocknum, bs, size) + while 1: + block = fp.read(bs) + if not block: + break + read += len(block) + tfp.write(block) + blocknum += 1 + if reporthook: + reporthook(blocknum, bs, size) + finally: + tfp.close() + finally: + fp.close() + + # raise exception if actual size does not match content-length header + if size >= 0 and read < size: + raise ContentTooShortError( + "retrieval incomplete: got only %i out of %i bytes" + % (read, size), result) + + return result + + # Each method named open_ knows how to open that type of URL + + def _open_generic_http(self, connection_factory, url, data): + """Make an HTTP connection using connection_class. + + This is an internal method that should be called from + open_http() or open_https(). + + Arguments: + - connection_factory should take a host name and return an + HTTPConnection instance. + - url is the url to retrieval or a host, relative-path pair. + - data is payload for a POST request or None. + """ + + user_passwd = None + proxy_passwd= None + if isinstance(url, str): + host, selector = _splithost(url) + if host: + user_passwd, host = _splituser(host) + host = unquote(host) + realhost = host + else: + host, selector = url + # check whether the proxy contains authorization information + proxy_passwd, host = _splituser(host) + # now we proceed with the url we want to obtain + urltype, rest = _splittype(selector) + url = rest + user_passwd = None + if urltype.lower() != 'http': + realhost = None + else: + realhost, rest = _splithost(rest) + if realhost: + user_passwd, realhost = _splituser(realhost) + if user_passwd: + selector = "%s://%s%s" % (urltype, realhost, rest) + if proxy_bypass(realhost): + host = realhost + + if not host: raise OSError('http error', 'no host given') + + if proxy_passwd: + proxy_passwd = unquote(proxy_passwd) + proxy_auth = base64.b64encode(proxy_passwd.encode()).decode('ascii') + else: + proxy_auth = None + + if user_passwd: + user_passwd = unquote(user_passwd) + auth = base64.b64encode(user_passwd.encode()).decode('ascii') + else: + auth = None + http_conn = connection_factory(host) + headers = {} + if proxy_auth: + headers["Proxy-Authorization"] = "Basic %s" % proxy_auth + if auth: + headers["Authorization"] = "Basic %s" % auth + if realhost: + headers["Host"] = realhost + + # Add Connection:close as we don't support persistent connections yet. + # This helps in closing the socket and avoiding ResourceWarning + + headers["Connection"] = "close" + + for header, value in self.addheaders: + headers[header] = value + + if data is not None: + headers["Content-Type"] = "application/x-www-form-urlencoded" + http_conn.request("POST", selector, data, headers) + else: + http_conn.request("GET", selector, headers=headers) + + try: + response = http_conn.getresponse() + except http.client.BadStatusLine: + # something went wrong with the HTTP status line + raise URLError("http protocol error: bad status line") + + # According to RFC 2616, "2xx" code indicates that the client's + # request was successfully received, understood, and accepted. + if 200 <= response.status < 300: + return addinfourl(response, response.msg, "http:" + url, + response.status) + else: + return self.http_error( + url, response.fp, + response.status, response.reason, response.msg, data) + + def open_http(self, url, data=None): + """Use HTTP protocol.""" + return self._open_generic_http(http.client.HTTPConnection, url, data) + + def http_error(self, url, fp, errcode, errmsg, headers, data=None): + """Handle http errors. + + Derived class can override this, or provide specific handlers + named http_error_DDD where DDD is the 3-digit error code.""" + # First check if there's a specific handler for this error + name = 'http_error_%d' % errcode + if hasattr(self, name): + method = getattr(self, name) + if data is None: + result = method(url, fp, errcode, errmsg, headers) + else: + result = method(url, fp, errcode, errmsg, headers, data) + if result: return result + return self.http_error_default(url, fp, errcode, errmsg, headers) + + def http_error_default(self, url, fp, errcode, errmsg, headers): + """Default error handler: close the connection and raise OSError.""" + fp.close() + raise HTTPError(url, errcode, errmsg, headers, None) + + if _have_ssl: + def _https_connection(self, host): + return http.client.HTTPSConnection(host, + key_file=self.key_file, + cert_file=self.cert_file) + + def open_https(self, url, data=None): + """Use HTTPS protocol.""" + return self._open_generic_http(self._https_connection, url, data) + + def open_file(self, url): + """Use local file or FTP depending on form of URL.""" + if not isinstance(url, str): + raise URLError('file error: proxy support for file protocol currently not implemented') + if url[:2] == '//' and url[2:3] != '/' and url[2:12].lower() != 'localhost/': + raise ValueError("file:// scheme is supported only on localhost") + else: + return self.open_local_file(url) + + def open_local_file(self, url): + """Use local file.""" + import email.utils + import mimetypes + host, file = _splithost(url) + localname = url2pathname(file) + try: + stats = os.stat(localname) + except OSError as e: + raise URLError(e.strerror, e.filename) + size = stats.st_size + modified = email.utils.formatdate(stats.st_mtime, usegmt=True) + mtype = mimetypes.guess_type(url)[0] + headers = email.message_from_string( + 'Content-Type: %s\nContent-Length: %d\nLast-modified: %s\n' % + (mtype or 'text/plain', size, modified)) + if not host: + urlfile = file + if file[:1] == '/': + urlfile = 'file://' + file + return addinfourl(open(localname, 'rb'), headers, urlfile) + host, port = _splitport(host) + if (not port + and socket.gethostbyname(host) in ((localhost(),) + thishost())): + urlfile = file + if file[:1] == '/': + urlfile = 'file://' + file + elif file[:2] == './': + raise ValueError("local file url may start with / or file:. Unknown url of type: %s" % url) + return addinfourl(open(localname, 'rb'), headers, urlfile) + raise URLError('local file error: not on local host') + + def open_ftp(self, url): + """Use FTP protocol.""" + if not isinstance(url, str): + raise URLError('ftp error: proxy support for ftp protocol currently not implemented') + import mimetypes + host, path = _splithost(url) + if not host: raise URLError('ftp error: no host given') + host, port = _splitport(host) + user, host = _splituser(host) + if user: user, passwd = _splitpasswd(user) + else: passwd = None + host = unquote(host) + user = unquote(user or '') + passwd = unquote(passwd or '') + host = socket.gethostbyname(host) + if not port: + import ftplib + port = ftplib.FTP_PORT + else: + port = int(port) + path, attrs = _splitattr(path) + path = unquote(path) + dirs = path.split('/') + dirs, file = dirs[:-1], dirs[-1] + if dirs and not dirs[0]: dirs = dirs[1:] + if dirs and not dirs[0]: dirs[0] = '/' + key = user, host, port, '/'.join(dirs) + # XXX thread unsafe! + if len(self.ftpcache) > MAXFTPCACHE: + # Prune the cache, rather arbitrarily + for k in list(self.ftpcache): + if k != key: + v = self.ftpcache[k] + del self.ftpcache[k] + v.close() + try: + if key not in self.ftpcache: + self.ftpcache[key] = \ + ftpwrapper(user, passwd, host, port, dirs) + if not file: type = 'D' + else: type = 'I' + for attr in attrs: + attr, value = _splitvalue(attr) + if attr.lower() == 'type' and \ + value in ('a', 'A', 'i', 'I', 'd', 'D'): + type = value.upper() + (fp, retrlen) = self.ftpcache[key].retrfile(file, type) + mtype = mimetypes.guess_type("ftp:" + url)[0] + headers = "" + if mtype: + headers += "Content-Type: %s\n" % mtype + if retrlen is not None and retrlen >= 0: + headers += "Content-Length: %d\n" % retrlen + headers = email.message_from_string(headers) + return addinfourl(fp, headers, "ftp:" + url) + except ftperrors() as exp: + raise URLError('ftp error %r' % exp).with_traceback(sys.exc_info()[2]) + + def open_data(self, url, data=None): + """Use "data" URL.""" + if not isinstance(url, str): + raise URLError('data error: proxy support for data protocol currently not implemented') + # ignore POSTed data + # + # syntax of data URLs: + # dataurl := "data:" [ mediatype ] [ ";base64" ] "," data + # mediatype := [ type "/" subtype ] *( ";" parameter ) + # data := *urlchar + # parameter := attribute "=" value + try: + [type, data] = url.split(',', 1) + except ValueError: + raise OSError('data error', 'bad data URL') + if not type: + type = 'text/plain;charset=US-ASCII' + semi = type.rfind(';') + if semi >= 0 and '=' not in type[semi:]: + encoding = type[semi+1:] + type = type[:semi] + else: + encoding = '' + msg = [] + msg.append('Date: %s'%time.strftime('%a, %d %b %Y %H:%M:%S GMT', + time.gmtime(time.time()))) + msg.append('Content-type: %s' % type) + if encoding == 'base64': + # XXX is this encoding/decoding ok? + data = base64.decodebytes(data.encode('ascii')).decode('latin-1') + else: + data = unquote(data) + msg.append('Content-Length: %d' % len(data)) + msg.append('') + msg.append(data) + msg = '\n'.join(msg) + headers = email.message_from_string(msg) + f = io.StringIO(msg) + #f.fileno = None # needed for addinfourl + return addinfourl(f, headers, url) + + +class FancyURLopener(URLopener): + """Derived class with handlers for errors we can handle (perhaps).""" + + def __init__(self, *args, **kwargs): + URLopener.__init__(self, *args, **kwargs) + self.auth_cache = {} + self.tries = 0 + self.maxtries = 10 + + def http_error_default(self, url, fp, errcode, errmsg, headers): + """Default error handling -- don't raise an exception.""" + return addinfourl(fp, headers, "http:" + url, errcode) + + def http_error_302(self, url, fp, errcode, errmsg, headers, data=None): + """Error 302 -- relocated (temporarily).""" + self.tries += 1 + try: + if self.maxtries and self.tries >= self.maxtries: + if hasattr(self, "http_error_500"): + meth = self.http_error_500 + else: + meth = self.http_error_default + return meth(url, fp, 500, + "Internal Server Error: Redirect Recursion", + headers) + result = self.redirect_internal(url, fp, errcode, errmsg, + headers, data) + return result + finally: + self.tries = 0 + + def redirect_internal(self, url, fp, errcode, errmsg, headers, data): + if 'location' in headers: + newurl = headers['location'] + elif 'uri' in headers: + newurl = headers['uri'] + else: + return + fp.close() + + # In case the server sent a relative URL, join with original: + newurl = urljoin(self.type + ":" + url, newurl) + + urlparts = urlparse(newurl) + + # For security reasons, we don't allow redirection to anything other + # than http, https and ftp. + + # We are using newer HTTPError with older redirect_internal method + # This older method will get deprecated in 3.3 + + if urlparts.scheme not in ('http', 'https', 'ftp', ''): + raise HTTPError(newurl, errcode, + errmsg + + " Redirection to url '%s' is not allowed." % newurl, + headers, fp) + + return self.open(newurl) + + def http_error_301(self, url, fp, errcode, errmsg, headers, data=None): + """Error 301 -- also relocated (permanently).""" + return self.http_error_302(url, fp, errcode, errmsg, headers, data) + + def http_error_303(self, url, fp, errcode, errmsg, headers, data=None): + """Error 303 -- also relocated (essentially identical to 302).""" + return self.http_error_302(url, fp, errcode, errmsg, headers, data) + + def http_error_307(self, url, fp, errcode, errmsg, headers, data=None): + """Error 307 -- relocated, but turn POST into error.""" + if data is None: + return self.http_error_302(url, fp, errcode, errmsg, headers, data) + else: + return self.http_error_default(url, fp, errcode, errmsg, headers) + + def http_error_401(self, url, fp, errcode, errmsg, headers, data=None, + retry=False): + """Error 401 -- authentication required. + This function supports Basic authentication only.""" + if 'www-authenticate' not in headers: + URLopener.http_error_default(self, url, fp, + errcode, errmsg, headers) + stuff = headers['www-authenticate'] + match = re.match('[ \t]*([^ \t]+)[ \t]+realm="([^"]*)"', stuff) + if not match: + URLopener.http_error_default(self, url, fp, + errcode, errmsg, headers) + scheme, realm = match.groups() + if scheme.lower() != 'basic': + URLopener.http_error_default(self, url, fp, + errcode, errmsg, headers) + if not retry: + URLopener.http_error_default(self, url, fp, errcode, errmsg, + headers) + name = 'retry_' + self.type + '_basic_auth' + if data is None: + return getattr(self,name)(url, realm) + else: + return getattr(self,name)(url, realm, data) + + def http_error_407(self, url, fp, errcode, errmsg, headers, data=None, + retry=False): + """Error 407 -- proxy authentication required. + This function supports Basic authentication only.""" + if 'proxy-authenticate' not in headers: + URLopener.http_error_default(self, url, fp, + errcode, errmsg, headers) + stuff = headers['proxy-authenticate'] + match = re.match('[ \t]*([^ \t]+)[ \t]+realm="([^"]*)"', stuff) + if not match: + URLopener.http_error_default(self, url, fp, + errcode, errmsg, headers) + scheme, realm = match.groups() + if scheme.lower() != 'basic': + URLopener.http_error_default(self, url, fp, + errcode, errmsg, headers) + if not retry: + URLopener.http_error_default(self, url, fp, errcode, errmsg, + headers) + name = 'retry_proxy_' + self.type + '_basic_auth' + if data is None: + return getattr(self,name)(url, realm) + else: + return getattr(self,name)(url, realm, data) + + def retry_proxy_http_basic_auth(self, url, realm, data=None): + host, selector = _splithost(url) + newurl = 'http://' + host + selector + proxy = self.proxies['http'] + urltype, proxyhost = _splittype(proxy) + proxyhost, proxyselector = _splithost(proxyhost) + i = proxyhost.find('@') + 1 + proxyhost = proxyhost[i:] + user, passwd = self.get_user_passwd(proxyhost, realm, i) + if not (user or passwd): return None + proxyhost = "%s:%s@%s" % (quote(user, safe=''), + quote(passwd, safe=''), proxyhost) + self.proxies['http'] = 'http://' + proxyhost + proxyselector + if data is None: + return self.open(newurl) + else: + return self.open(newurl, data) + + def retry_proxy_https_basic_auth(self, url, realm, data=None): + host, selector = _splithost(url) + newurl = 'https://' + host + selector + proxy = self.proxies['https'] + urltype, proxyhost = _splittype(proxy) + proxyhost, proxyselector = _splithost(proxyhost) + i = proxyhost.find('@') + 1 + proxyhost = proxyhost[i:] + user, passwd = self.get_user_passwd(proxyhost, realm, i) + if not (user or passwd): return None + proxyhost = "%s:%s@%s" % (quote(user, safe=''), + quote(passwd, safe=''), proxyhost) + self.proxies['https'] = 'https://' + proxyhost + proxyselector + if data is None: + return self.open(newurl) + else: + return self.open(newurl, data) + + def retry_http_basic_auth(self, url, realm, data=None): + host, selector = _splithost(url) + i = host.find('@') + 1 + host = host[i:] + user, passwd = self.get_user_passwd(host, realm, i) + if not (user or passwd): return None + host = "%s:%s@%s" % (quote(user, safe=''), + quote(passwd, safe=''), host) + newurl = 'http://' + host + selector + if data is None: + return self.open(newurl) + else: + return self.open(newurl, data) + + def retry_https_basic_auth(self, url, realm, data=None): + host, selector = _splithost(url) + i = host.find('@') + 1 + host = host[i:] + user, passwd = self.get_user_passwd(host, realm, i) + if not (user or passwd): return None + host = "%s:%s@%s" % (quote(user, safe=''), + quote(passwd, safe=''), host) + newurl = 'https://' + host + selector + if data is None: + return self.open(newurl) + else: + return self.open(newurl, data) + + def get_user_passwd(self, host, realm, clear_cache=0): + key = realm + '@' + host.lower() + if key in self.auth_cache: + if clear_cache: + del self.auth_cache[key] + else: + return self.auth_cache[key] + user, passwd = self.prompt_user_passwd(host, realm) + if user or passwd: self.auth_cache[key] = (user, passwd) + return user, passwd + + def prompt_user_passwd(self, host, realm): + """Override this in a GUI environment!""" + import getpass + try: + user = input("Enter username for %s at %s: " % (realm, host)) + passwd = getpass.getpass("Enter password for %s in %s at %s: " % + (user, realm, host)) + return user, passwd + except KeyboardInterrupt: + print() + return None, None + + +# Utility functions + +_localhost = None +def localhost(): + """Return the IP address of the magic hostname 'localhost'.""" + global _localhost + if _localhost is None: + _localhost = socket.gethostbyname('localhost') + return _localhost + +_thishost = None +def thishost(): + """Return the IP addresses of the current host.""" + global _thishost + if _thishost is None: + try: + _thishost = tuple(socket.gethostbyname_ex(socket.gethostname())[2]) + except socket.gaierror: + _thishost = tuple(socket.gethostbyname_ex('localhost')[2]) + return _thishost + +_ftperrors = None +def ftperrors(): + """Return the set of errors raised by the FTP class.""" + global _ftperrors + if _ftperrors is None: + import ftplib + _ftperrors = ftplib.all_errors + return _ftperrors + +_noheaders = None +def noheaders(): + """Return an empty email Message object.""" + global _noheaders + if _noheaders is None: + _noheaders = email.message_from_string("") + return _noheaders + + +# Utility classes + +class ftpwrapper: + """Class used by open_ftp() for cache of open FTP connections.""" + + def __init__(self, user, passwd, host, port, dirs, timeout=None, + persistent=True): + self.user = user + self.passwd = passwd + self.host = host + self.port = port + self.dirs = dirs + self.timeout = timeout + self.refcount = 0 + self.keepalive = persistent + try: + self.init() + except: + self.close() + raise + + def init(self): + import ftplib + self.busy = 0 + self.ftp = ftplib.FTP() + self.ftp.connect(self.host, self.port, self.timeout) + self.ftp.login(self.user, self.passwd) + _target = '/'.join(self.dirs) + self.ftp.cwd(_target) + + def retrfile(self, file, type): + import ftplib + self.endtransfer() + if type in ('d', 'D'): cmd = 'TYPE A'; isdir = 1 + else: cmd = 'TYPE ' + type; isdir = 0 + try: + self.ftp.voidcmd(cmd) + except ftplib.all_errors: + self.init() + self.ftp.voidcmd(cmd) + conn = None + if file and not isdir: + # Try to retrieve as a file + try: + cmd = 'RETR ' + file + conn, retrlen = self.ftp.ntransfercmd(cmd) + except ftplib.error_perm as reason: + if str(reason)[:3] != '550': + raise URLError('ftp error: %r' % reason).with_traceback( + sys.exc_info()[2]) + if not conn: + # Set transfer mode to ASCII! + self.ftp.voidcmd('TYPE A') + # Try a directory listing. Verify that directory exists. + if file: + pwd = self.ftp.pwd() + try: + try: + self.ftp.cwd(file) + except ftplib.error_perm as reason: + raise URLError('ftp error: %r' % reason) from reason + finally: + self.ftp.cwd(pwd) + cmd = 'LIST ' + file + else: + cmd = 'LIST' + conn, retrlen = self.ftp.ntransfercmd(cmd) + self.busy = 1 + + ftpobj = addclosehook(conn.makefile('rb'), self.file_close) + self.refcount += 1 + conn.close() + # Pass back both a suitably decorated object and a retrieval length + return (ftpobj, retrlen) + + def endtransfer(self): + self.busy = 0 + + def close(self): + self.keepalive = False + if self.refcount <= 0: + self.real_close() + + def file_close(self): + self.endtransfer() + self.refcount -= 1 + if self.refcount <= 0 and not self.keepalive: + self.real_close() + + def real_close(self): + self.endtransfer() + try: + self.ftp.close() + except ftperrors(): + pass + +# Proxy handling +def getproxies_environment(): + """Return a dictionary of scheme -> proxy server URL mappings. + + Scan the environment for variables named _proxy; + this seems to be the standard convention. If you need a + different way, you can pass a proxies dictionary to the + [Fancy]URLopener constructor. + """ + # in order to prefer lowercase variables, process environment in + # two passes: first matches any, second pass matches lowercase only + + # select only environment variables which end in (after making lowercase) _proxy + proxies = {} + environment = [] + for name in os.environ.keys(): + # fast screen underscore position before more expensive case-folding + if len(name) > 5 and name[-6] == "_" and name[-5:].lower() == "proxy": + value = os.environ[name] + proxy_name = name[:-6].lower() + environment.append((name, value, proxy_name)) + if value: + proxies[proxy_name] = value + # CVE-2016-1000110 - If we are running as CGI script, forget HTTP_PROXY + # (non-all-lowercase) as it may be set from the web server by a "Proxy:" + # header from the client + # If "proxy" is lowercase, it will still be used thanks to the next block + if 'REQUEST_METHOD' in os.environ: + proxies.pop('http', None) + for name, value, proxy_name in environment: + # not case-folded, checking here for lower-case env vars only + if name[-6:] == '_proxy': + if value: + proxies[proxy_name] = value + else: + proxies.pop(proxy_name, None) + return proxies + +def proxy_bypass_environment(host, proxies=None): + """Test if proxies should not be used for a particular host. + + Checks the proxy dict for the value of no_proxy, which should + be a list of comma separated DNS suffixes, or '*' for all hosts. + + """ + if proxies is None: + proxies = getproxies_environment() + # don't bypass, if no_proxy isn't specified + try: + no_proxy = proxies['no'] + except KeyError: + return False + # '*' is special case for always bypass + if no_proxy == '*': + return True + host = host.lower() + # strip port off host + hostonly, port = _splitport(host) + # check if the host ends with any of the DNS suffixes + for name in no_proxy.split(','): + name = name.strip() + if name: + name = name.lstrip('.') # ignore leading dots + name = name.lower() + if hostonly == name or host == name: + return True + name = '.' + name + if hostonly.endswith(name) or host.endswith(name): + return True + # otherwise, don't bypass + return False + + +# This code tests an OSX specific data structure but is testable on all +# platforms +def _proxy_bypass_macosx_sysconf(host, proxy_settings): + """ + Return True iff this host shouldn't be accessed using a proxy + + This function uses the MacOSX framework SystemConfiguration + to fetch the proxy information. + + proxy_settings come from _scproxy._get_proxy_settings or get mocked ie: + { 'exclude_simple': bool, + 'exceptions': ['foo.bar', '*.bar.com', '127.0.0.1', '10.1', '10.0/16'] + } + """ + from fnmatch import fnmatch + from ipaddress import AddressValueError, IPv4Address + + hostonly, port = _splitport(host) + + def ip2num(ipAddr): + parts = ipAddr.split('.') + parts = list(map(int, parts)) + if len(parts) != 4: + parts = (parts + [0, 0, 0, 0])[:4] + return (parts[0] << 24) | (parts[1] << 16) | (parts[2] << 8) | parts[3] + + # Check for simple host names: + if '.' not in host: + if proxy_settings['exclude_simple']: + return True + + hostIP = None + try: + hostIP = int(IPv4Address(hostonly)) + except AddressValueError: + pass + + for value in proxy_settings.get('exceptions', ()): + # Items in the list are strings like these: *.local, 169.254/16 + if not value: continue + + m = re.match(r"(\d+(?:\.\d+)*)(/\d+)?", value) + if m is not None and hostIP is not None: + base = ip2num(m.group(1)) + mask = m.group(2) + if mask is None: + mask = 8 * (m.group(1).count('.') + 1) + else: + mask = int(mask[1:]) + + if mask < 0 or mask > 32: + # System libraries ignore invalid prefix lengths + continue + + mask = 32 - mask + + if (hostIP >> mask) == (base >> mask): + return True + + elif fnmatch(host, value): + return True + + return False + + +# Same as _proxy_bypass_macosx_sysconf, testable on all platforms +def _proxy_bypass_winreg_override(host, override): + """Return True if the host should bypass the proxy server. + + The proxy override list is obtained from the Windows + Internet settings proxy override registry value. + + An example of a proxy override value is: + "www.example.com;*.example.net; 192.168.0.1" + """ + from fnmatch import fnmatch + + host, _ = _splitport(host) + proxy_override = override.split(';') + for test in proxy_override: + test = test.strip() + # "" should bypass the proxy server for all intranet addresses + if test == '': + if '.' not in host: + return True + elif fnmatch(host, test): + return True + return False + + +if sys.platform == 'darwin': + from _scproxy import _get_proxy_settings, _get_proxies + + def proxy_bypass_macosx_sysconf(host): + proxy_settings = _get_proxy_settings() + return _proxy_bypass_macosx_sysconf(host, proxy_settings) + + def getproxies_macosx_sysconf(): + """Return a dictionary of scheme -> proxy server URL mappings. + + This function uses the MacOSX framework SystemConfiguration + to fetch the proxy information. + """ + return _get_proxies() + + + + def proxy_bypass(host): + """Return True, if host should be bypassed. + + Checks proxy settings gathered from the environment, if specified, + or from the MacOSX framework SystemConfiguration. + + """ + proxies = getproxies_environment() + if proxies: + return proxy_bypass_environment(host, proxies) + else: + return proxy_bypass_macosx_sysconf(host) + + def getproxies(): + return getproxies_environment() or getproxies_macosx_sysconf() + + +elif os.name == 'nt': + def getproxies_registry(): + """Return a dictionary of scheme -> proxy server URL mappings. + + Win32 uses the registry to store proxies. + + """ + proxies = {} + try: + import winreg + except ImportError: + # Std module, so should be around - but you never know! + return proxies + try: + internetSettings = winreg.OpenKey(winreg.HKEY_CURRENT_USER, + r'Software\Microsoft\Windows\CurrentVersion\Internet Settings') + proxyEnable = winreg.QueryValueEx(internetSettings, + 'ProxyEnable')[0] + if proxyEnable: + # Returned as Unicode but problems if not converted to ASCII + proxyServer = str(winreg.QueryValueEx(internetSettings, + 'ProxyServer')[0]) + if '=' not in proxyServer and ';' not in proxyServer: + # Use one setting for all protocols. + proxyServer = 'http={0};https={0};ftp={0}'.format(proxyServer) + for p in proxyServer.split(';'): + protocol, address = p.split('=', 1) + # See if address has a type:// prefix + if not re.match('(?:[^/:]+)://', address): + # Add type:// prefix to address without specifying type + if protocol in ('http', 'https', 'ftp'): + # The default proxy type of Windows is HTTP + address = 'http://' + address + elif protocol == 'socks': + address = 'socks://' + address + proxies[protocol] = address + # Use SOCKS proxy for HTTP(S) protocols + if proxies.get('socks'): + # The default SOCKS proxy type of Windows is SOCKS4 + address = re.sub(r'^socks://', 'socks4://', proxies['socks']) + proxies['http'] = proxies.get('http') or address + proxies['https'] = proxies.get('https') or address + internetSettings.Close() + except (OSError, ValueError, TypeError): + # Either registry key not found etc, or the value in an + # unexpected format. + # proxies already set up to be empty so nothing to do + pass + return proxies + + def getproxies(): + """Return a dictionary of scheme -> proxy server URL mappings. + + Returns settings gathered from the environment, if specified, + or the registry. + + """ + return getproxies_environment() or getproxies_registry() + + def proxy_bypass_registry(host): + try: + import winreg + except ImportError: + # Std modules, so should be around - but you never know! + return False + try: + internetSettings = winreg.OpenKey(winreg.HKEY_CURRENT_USER, + r'Software\Microsoft\Windows\CurrentVersion\Internet Settings') + proxyEnable = winreg.QueryValueEx(internetSettings, + 'ProxyEnable')[0] + proxyOverride = str(winreg.QueryValueEx(internetSettings, + 'ProxyOverride')[0]) + # ^^^^ Returned as Unicode but problems if not converted to ASCII + except OSError: + return False + if not proxyEnable or not proxyOverride: + return False + return _proxy_bypass_winreg_override(host, proxyOverride) + + def proxy_bypass(host): + """Return True, if host should be bypassed. + + Checks proxy settings gathered from the environment, if specified, + or the registry. + + """ + proxies = getproxies_environment() + if proxies: + return proxy_bypass_environment(host, proxies) + else: + return proxy_bypass_registry(host) + +else: + # By default use environment variables + getproxies = getproxies_environment + proxy_bypass = proxy_bypass_environment diff --git a/miniconda3/envs/active_proaction/lib/python3.10/urllib/response.py b/miniconda3/envs/active_proaction/lib/python3.10/urllib/response.py new file mode 100644 index 0000000000000000000000000000000000000000..5a2c3cc78c395d57de3fbadf7d75b96035b785b6 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/urllib/response.py @@ -0,0 +1,84 @@ +"""Response classes used by urllib. + +The base class, addbase, defines a minimal file-like interface, +including read() and readline(). The typical response object is an +addinfourl instance, which defines an info() method that returns +headers and a geturl() method that returns the url. +""" + +import tempfile + +__all__ = ['addbase', 'addclosehook', 'addinfo', 'addinfourl'] + + +class addbase(tempfile._TemporaryFileWrapper): + """Base class for addinfo and addclosehook. Is a good idea for garbage collection.""" + + # XXX Add a method to expose the timeout on the underlying socket? + + def __init__(self, fp): + super(addbase, self).__init__(fp, '', delete=False) + # Keep reference around as this was part of the original API. + self.fp = fp + + def __repr__(self): + return '<%s at %r whose fp = %r>' % (self.__class__.__name__, + id(self), self.file) + + def __enter__(self): + if self.fp.closed: + raise ValueError("I/O operation on closed file") + return self + + def __exit__(self, type, value, traceback): + self.close() + + +class addclosehook(addbase): + """Class to add a close hook to an open file.""" + + def __init__(self, fp, closehook, *hookargs): + super(addclosehook, self).__init__(fp) + self.closehook = closehook + self.hookargs = hookargs + + def close(self): + try: + closehook = self.closehook + hookargs = self.hookargs + if closehook: + self.closehook = None + self.hookargs = None + closehook(*hookargs) + finally: + super(addclosehook, self).close() + + +class addinfo(addbase): + """class to add an info() method to an open file.""" + + def __init__(self, fp, headers): + super(addinfo, self).__init__(fp) + self.headers = headers + + def info(self): + return self.headers + + +class addinfourl(addinfo): + """class to add info() and geturl() methods to an open file.""" + + def __init__(self, fp, headers, url, code=None): + super(addinfourl, self).__init__(fp, headers) + self.url = url + self.code = code + + @property + def status(self): + return self.code + + def getcode(self): + return self.code + + def geturl(self): + return self.url diff --git a/miniconda3/envs/active_proaction/lib/python3.10/urllib/robotparser.py b/miniconda3/envs/active_proaction/lib/python3.10/urllib/robotparser.py new file mode 100644 index 0000000000000000000000000000000000000000..c58565e39451461f03dc7d9fb652554c96615f00 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/urllib/robotparser.py @@ -0,0 +1,273 @@ +""" robotparser.py + + Copyright (C) 2000 Bastian Kleineidam + + You can choose between two licenses when using this package: + 1) GNU GPLv2 + 2) PSF license for Python 2.2 + + The robots.txt Exclusion Protocol is implemented as specified in + http://www.robotstxt.org/norobots-rfc.txt +""" + +import collections +import urllib.parse +import urllib.request + +__all__ = ["RobotFileParser"] + +RequestRate = collections.namedtuple("RequestRate", "requests seconds") + + +class RobotFileParser: + """ This class provides a set of methods to read, parse and answer + questions about a single robots.txt file. + + """ + + def __init__(self, url=''): + self.entries = [] + self.sitemaps = [] + self.default_entry = None + self.disallow_all = False + self.allow_all = False + self.set_url(url) + self.last_checked = 0 + + def mtime(self): + """Returns the time the robots.txt file was last fetched. + + This is useful for long-running web spiders that need to + check for new robots.txt files periodically. + + """ + return self.last_checked + + def modified(self): + """Sets the time the robots.txt file was last fetched to the + current time. + + """ + import time + self.last_checked = time.time() + + def set_url(self, url): + """Sets the URL referring to a robots.txt file.""" + self.url = url + self.host, self.path = urllib.parse.urlparse(url)[1:3] + + def read(self): + """Reads the robots.txt URL and feeds it to the parser.""" + try: + f = urllib.request.urlopen(self.url) + except urllib.error.HTTPError as err: + if err.code in (401, 403): + self.disallow_all = True + elif err.code >= 400 and err.code < 500: + self.allow_all = True + else: + raw = f.read() + self.parse(raw.decode("utf-8").splitlines()) + + def _add_entry(self, entry): + if "*" in entry.useragents: + # the default entry is considered last + if self.default_entry is None: + # the first default entry wins + self.default_entry = entry + else: + self.entries.append(entry) + + def parse(self, lines): + """Parse the input lines from a robots.txt file. + + We allow that a user-agent: line is not preceded by + one or more blank lines. + """ + # states: + # 0: start state + # 1: saw user-agent line + # 2: saw an allow or disallow line + state = 0 + entry = Entry() + + self.modified() + for line in lines: + if not line: + if state == 1: + entry = Entry() + state = 0 + elif state == 2: + self._add_entry(entry) + entry = Entry() + state = 0 + # remove optional comment and strip line + i = line.find('#') + if i >= 0: + line = line[:i] + line = line.strip() + if not line: + continue + line = line.split(':', 1) + if len(line) == 2: + line[0] = line[0].strip().lower() + line[1] = urllib.parse.unquote(line[1].strip()) + if line[0] == "user-agent": + if state == 2: + self._add_entry(entry) + entry = Entry() + entry.useragents.append(line[1]) + state = 1 + elif line[0] == "disallow": + if state != 0: + entry.rulelines.append(RuleLine(line[1], False)) + state = 2 + elif line[0] == "allow": + if state != 0: + entry.rulelines.append(RuleLine(line[1], True)) + state = 2 + elif line[0] == "crawl-delay": + if state != 0: + # before trying to convert to int we need to make + # sure that robots.txt has valid syntax otherwise + # it will crash + if line[1].strip().isdigit(): + entry.delay = int(line[1]) + state = 2 + elif line[0] == "request-rate": + if state != 0: + numbers = line[1].split('/') + # check if all values are sane + if (len(numbers) == 2 and numbers[0].strip().isdigit() + and numbers[1].strip().isdigit()): + entry.req_rate = RequestRate(int(numbers[0]), int(numbers[1])) + state = 2 + elif line[0] == "sitemap": + # According to http://www.sitemaps.org/protocol.html + # "This directive is independent of the user-agent line, + # so it doesn't matter where you place it in your file." + # Therefore we do not change the state of the parser. + self.sitemaps.append(line[1]) + if state == 2: + self._add_entry(entry) + + def can_fetch(self, useragent, url): + """using the parsed robots.txt decide if useragent can fetch url""" + if self.disallow_all: + return False + if self.allow_all: + return True + # Until the robots.txt file has been read or found not + # to exist, we must assume that no url is allowable. + # This prevents false positives when a user erroneously + # calls can_fetch() before calling read(). + if not self.last_checked: + return False + # search for given user agent matches + # the first match counts + parsed_url = urllib.parse.urlparse(urllib.parse.unquote(url)) + url = urllib.parse.urlunparse(('','',parsed_url.path, + parsed_url.params,parsed_url.query, parsed_url.fragment)) + url = urllib.parse.quote(url) + if not url: + url = "/" + for entry in self.entries: + if entry.applies_to(useragent): + return entry.allowance(url) + # try the default entry last + if self.default_entry: + return self.default_entry.allowance(url) + # agent not found ==> access granted + return True + + def crawl_delay(self, useragent): + if not self.mtime(): + return None + for entry in self.entries: + if entry.applies_to(useragent): + return entry.delay + if self.default_entry: + return self.default_entry.delay + return None + + def request_rate(self, useragent): + if not self.mtime(): + return None + for entry in self.entries: + if entry.applies_to(useragent): + return entry.req_rate + if self.default_entry: + return self.default_entry.req_rate + return None + + def site_maps(self): + if not self.sitemaps: + return None + return self.sitemaps + + def __str__(self): + entries = self.entries + if self.default_entry is not None: + entries = entries + [self.default_entry] + return '\n\n'.join(map(str, entries)) + + +class RuleLine: + """A rule line is a single "Allow:" (allowance==True) or "Disallow:" + (allowance==False) followed by a path.""" + def __init__(self, path, allowance): + if path == '' and not allowance: + # an empty value means allow all + allowance = True + path = urllib.parse.urlunparse(urllib.parse.urlparse(path)) + self.path = urllib.parse.quote(path) + self.allowance = allowance + + def applies_to(self, filename): + return self.path == "*" or filename.startswith(self.path) + + def __str__(self): + return ("Allow" if self.allowance else "Disallow") + ": " + self.path + + +class Entry: + """An entry has one or more user-agents and zero or more rulelines""" + def __init__(self): + self.useragents = [] + self.rulelines = [] + self.delay = None + self.req_rate = None + + def __str__(self): + ret = [] + for agent in self.useragents: + ret.append(f"User-agent: {agent}") + if self.delay is not None: + ret.append(f"Crawl-delay: {self.delay}") + if self.req_rate is not None: + rate = self.req_rate + ret.append(f"Request-rate: {rate.requests}/{rate.seconds}") + ret.extend(map(str, self.rulelines)) + return '\n'.join(ret) + + def applies_to(self, useragent): + """check if this entry applies to the specified agent""" + # split the name token and make it lower case + useragent = useragent.split("/")[0].lower() + for agent in self.useragents: + if agent == '*': + # we have the catch-all agent + return True + agent = agent.lower() + if agent in useragent: + return True + return False + + def allowance(self, filename): + """Preconditions: + - our agent applies to this entry + - filename is URL decoded""" + for line in self.rulelines: + if line.applies_to(filename): + return line.allowance + return True diff --git a/miniconda3/envs/active_proaction/lib/python3.10/venv/__init__.py b/miniconda3/envs/active_proaction/lib/python3.10/venv/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..fe468a9d8984ff23c0e3d3a6ba8adf364472aca9 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/venv/__init__.py @@ -0,0 +1,557 @@ +""" +Virtual environment (venv) package for Python. Based on PEP 405. + +Copyright (C) 2011-2014 Vinay Sajip. +Licensed to the PSF under a contributor agreement. +""" +import logging +import os +import shutil +import subprocess +import sys +import sysconfig +import types +import shlex + + +CORE_VENV_DEPS = ('pip', 'setuptools') +logger = logging.getLogger(__name__) + + +class EnvBuilder: + """ + This class exists to allow virtual environment creation to be + customized. The constructor parameters determine the builder's + behaviour when called upon to create a virtual environment. + + By default, the builder makes the system (global) site-packages dir + *un*available to the created environment. + + If invoked using the Python -m option, the default is to use copying + on Windows platforms but symlinks elsewhere. If instantiated some + other way, the default is to *not* use symlinks. + + :param system_site_packages: If True, the system (global) site-packages + dir is available to created environments. + :param clear: If True, delete the contents of the environment directory if + it already exists, before environment creation. + :param symlinks: If True, attempt to symlink rather than copy files into + virtual environment. + :param upgrade: If True, upgrade an existing virtual environment. + :param with_pip: If True, ensure pip is installed in the virtual + environment + :param prompt: Alternative terminal prefix for the environment. + :param upgrade_deps: Update the base venv modules to the latest on PyPI + """ + + def __init__(self, system_site_packages=False, clear=False, + symlinks=False, upgrade=False, with_pip=False, prompt=None, + upgrade_deps=False): + self.system_site_packages = system_site_packages + self.clear = clear + self.symlinks = symlinks + self.upgrade = upgrade + self.with_pip = with_pip + if prompt == '.': # see bpo-38901 + prompt = os.path.basename(os.getcwd()) + self.prompt = prompt + self.upgrade_deps = upgrade_deps + + def create(self, env_dir): + """ + Create a virtual environment in a directory. + + :param env_dir: The target directory to create an environment in. + + """ + env_dir = os.path.abspath(env_dir) + context = self.ensure_directories(env_dir) + # See issue 24875. We need system_site_packages to be False + # until after pip is installed. + true_system_site_packages = self.system_site_packages + self.system_site_packages = False + self.create_configuration(context) + self.setup_python(context) + if self.with_pip: + self._setup_pip(context) + if not self.upgrade: + self.setup_scripts(context) + self.post_setup(context) + if true_system_site_packages: + # We had set it to False before, now + # restore it and rewrite the configuration + self.system_site_packages = True + self.create_configuration(context) + if self.upgrade_deps: + self.upgrade_dependencies(context) + + def clear_directory(self, path): + for fn in os.listdir(path): + fn = os.path.join(path, fn) + if os.path.islink(fn) or os.path.isfile(fn): + os.remove(fn) + elif os.path.isdir(fn): + shutil.rmtree(fn) + + def ensure_directories(self, env_dir): + """ + Create the directories for the environment. + + Returns a context object which holds paths in the environment, + for use by subsequent logic. + """ + + def create_if_needed(d): + if not os.path.exists(d): + os.makedirs(d) + elif os.path.islink(d) or os.path.isfile(d): + raise ValueError('Unable to create directory %r' % d) + + if os.path.exists(env_dir) and self.clear: + self.clear_directory(env_dir) + context = types.SimpleNamespace() + context.env_dir = env_dir + context.env_name = os.path.split(env_dir)[1] + prompt = self.prompt if self.prompt is not None else context.env_name + context.prompt = '(%s) ' % prompt + create_if_needed(env_dir) + executable = sys._base_executable + if not executable: # see gh-96861 + raise ValueError('Unable to determine path to the running ' + 'Python interpreter. Provide an explicit path or ' + 'check that your PATH environment variable is ' + 'correctly set.') + dirname, exename = os.path.split(os.path.abspath(executable)) + context.executable = executable + context.python_dir = dirname + context.python_exe = exename + if sys.platform == 'win32': + binname = 'Scripts' + incpath = 'Include' + libpath = os.path.join(env_dir, 'Lib', 'site-packages') + else: + binname = 'bin' + incpath = 'include' + libpath = os.path.join(env_dir, 'lib', + 'python%d.%d' % sys.version_info[:2], + 'site-packages') + context.inc_path = path = os.path.join(env_dir, incpath) + create_if_needed(path) + create_if_needed(libpath) + # Issue 21197: create lib64 as a symlink to lib on 64-bit non-OS X POSIX + if ((sys.maxsize > 2**32) and (os.name == 'posix') and + (sys.platform != 'darwin')): + link_path = os.path.join(env_dir, 'lib64') + if not os.path.exists(link_path): # Issue #21643 + os.symlink('lib', link_path) + context.bin_path = binpath = os.path.join(env_dir, binname) + context.bin_name = binname + context.env_exe = os.path.join(binpath, exename) + create_if_needed(binpath) + # Assign and update the command to use when launching the newly created + # environment, in case it isn't simply the executable script (e.g. bpo-45337) + context.env_exec_cmd = context.env_exe + if sys.platform == 'win32': + # bpo-45337: Fix up env_exec_cmd to account for file system redirections. + # Some redirects only apply to CreateFile and not CreateProcess + real_env_exe = os.path.realpath(context.env_exe) + if os.path.normcase(real_env_exe) != os.path.normcase(context.env_exe): + logger.warning('Actual environment location may have moved due to ' + 'redirects, links or junctions.\n' + ' Requested location: "%s"\n' + ' Actual location: "%s"', + context.env_exe, real_env_exe) + context.env_exec_cmd = real_env_exe + return context + + def create_configuration(self, context): + """ + Create a configuration file indicating where the environment's Python + was copied from, and whether the system site-packages should be made + available in the environment. + + :param context: The information for the environment creation request + being processed. + """ + context.cfg_path = path = os.path.join(context.env_dir, 'pyvenv.cfg') + with open(path, 'w', encoding='utf-8') as f: + f.write('home = %s\n' % context.python_dir) + if self.system_site_packages: + incl = 'true' + else: + incl = 'false' + f.write('include-system-site-packages = %s\n' % incl) + f.write('version = %d.%d.%d\n' % sys.version_info[:3]) + if self.prompt is not None: + f.write(f'prompt = {self.prompt!r}\n') + + if os.name != 'nt': + def symlink_or_copy(self, src, dst, relative_symlinks_ok=False): + """ + Try symlinking a file, and if that fails, fall back to copying. + """ + force_copy = not self.symlinks + if not force_copy: + try: + if not os.path.islink(dst): # can't link to itself! + if relative_symlinks_ok: + assert os.path.dirname(src) == os.path.dirname(dst) + os.symlink(os.path.basename(src), dst) + else: + os.symlink(src, dst) + except Exception: # may need to use a more specific exception + logger.warning('Unable to symlink %r to %r', src, dst) + force_copy = True + if force_copy: + shutil.copyfile(src, dst) + else: + def symlink_or_copy(self, src, dst, relative_symlinks_ok=False): + """ + Try symlinking a file, and if that fails, fall back to copying. + """ + bad_src = os.path.lexists(src) and not os.path.exists(src) + if self.symlinks and not bad_src and not os.path.islink(dst): + try: + if relative_symlinks_ok: + assert os.path.dirname(src) == os.path.dirname(dst) + os.symlink(os.path.basename(src), dst) + else: + os.symlink(src, dst) + return + except Exception: # may need to use a more specific exception + logger.warning('Unable to symlink %r to %r', src, dst) + + # On Windows, we rewrite symlinks to our base python.exe into + # copies of venvlauncher.exe + basename, ext = os.path.splitext(os.path.basename(src)) + srcfn = os.path.join(os.path.dirname(__file__), + "scripts", + "nt", + basename + ext) + # Builds or venv's from builds need to remap source file + # locations, as we do not put them into Lib/venv/scripts + if sysconfig.is_python_build(True) or not os.path.isfile(srcfn): + if basename.endswith('_d'): + ext = '_d' + ext + basename = basename[:-2] + if basename == 'python': + basename = 'venvlauncher' + elif basename == 'pythonw': + basename = 'venvwlauncher' + src = os.path.join(os.path.dirname(src), basename + ext) + else: + src = srcfn + if not os.path.exists(src): + if not bad_src: + logger.warning('Unable to copy %r', src) + return + + shutil.copyfile(src, dst) + + def setup_python(self, context): + """ + Set up a Python executable in the environment. + + :param context: The information for the environment creation request + being processed. + """ + binpath = context.bin_path + path = context.env_exe + copier = self.symlink_or_copy + dirname = context.python_dir + if os.name != 'nt': + copier(context.executable, path) + if not os.path.islink(path): + os.chmod(path, 0o755) + for suffix in ('python', 'python3', f'python3.{sys.version_info[1]}'): + path = os.path.join(binpath, suffix) + if not os.path.exists(path): + # Issue 18807: make copies if + # symlinks are not wanted + copier(context.env_exe, path, relative_symlinks_ok=True) + if not os.path.islink(path): + os.chmod(path, 0o755) + else: + if self.symlinks: + # For symlinking, we need a complete copy of the root directory + # If symlinks fail, you'll get unnecessary copies of files, but + # we assume that if you've opted into symlinks on Windows then + # you know what you're doing. + suffixes = [ + f for f in os.listdir(dirname) if + os.path.normcase(os.path.splitext(f)[1]) in ('.exe', '.dll') + ] + if sysconfig.is_python_build(True): + suffixes = [ + f for f in suffixes if + os.path.normcase(f).startswith(('python', 'vcruntime')) + ] + else: + suffixes = {'python.exe', 'python_d.exe', 'pythonw.exe', 'pythonw_d.exe'} + base_exe = os.path.basename(context.env_exe) + suffixes.add(base_exe) + + for suffix in suffixes: + src = os.path.join(dirname, suffix) + if os.path.lexists(src): + copier(src, os.path.join(binpath, suffix)) + + if sysconfig.is_python_build(True): + # copy init.tcl + for root, dirs, files in os.walk(context.python_dir): + if 'init.tcl' in files: + tcldir = os.path.basename(root) + tcldir = os.path.join(context.env_dir, 'Lib', tcldir) + if not os.path.exists(tcldir): + os.makedirs(tcldir) + src = os.path.join(root, 'init.tcl') + dst = os.path.join(tcldir, 'init.tcl') + shutil.copyfile(src, dst) + break + + def _call_new_python(self, context, *py_args, **kwargs): + """Executes the newly created Python using safe-ish options""" + # gh-98251: We do not want to just use '-I' because that masks + # legitimate user preferences (such as not writing bytecode). All we + # really need is to ensure that the path variables do not overrule + # normal venv handling. + args = [context.env_exec_cmd, *py_args] + kwargs['env'] = env = os.environ.copy() + env['VIRTUAL_ENV'] = context.env_dir + env.pop('PYTHONHOME', None) + env.pop('PYTHONPATH', None) + kwargs['cwd'] = context.env_dir + kwargs['executable'] = context.env_exec_cmd + subprocess.check_output(args, **kwargs) + + def _setup_pip(self, context): + """Installs or upgrades pip in a virtual environment""" + self._call_new_python(context, '-m', 'ensurepip', '--upgrade', + '--default-pip', stderr=subprocess.STDOUT) + + def setup_scripts(self, context): + """ + Set up scripts into the created environment from a directory. + + This method installs the default scripts into the environment + being created. You can prevent the default installation by overriding + this method if you really need to, or if you need to specify + a different location for the scripts to install. By default, the + 'scripts' directory in the venv package is used as the source of + scripts to install. + """ + path = os.path.abspath(os.path.dirname(__file__)) + path = os.path.join(path, 'scripts') + self.install_scripts(context, path) + + def post_setup(self, context): + """ + Hook for post-setup modification of the venv. Subclasses may install + additional packages or scripts here, add activation shell scripts, etc. + + :param context: The information for the environment creation request + being processed. + """ + pass + + def replace_variables(self, text, context): + """ + Replace variable placeholders in script text with context-specific + variables. + + Return the text passed in , but with variables replaced. + + :param text: The text in which to replace placeholder variables. + :param context: The information for the environment creation request + being processed. + """ + replacements = { + '__VENV_DIR__': context.env_dir, + '__VENV_NAME__': context.env_name, + '__VENV_PROMPT__': context.prompt, + '__VENV_BIN_NAME__': context.bin_name, + '__VENV_PYTHON__': context.env_exe, + } + + def quote_ps1(s): + """ + This should satisfy PowerShell quoting rules [1], unless the quoted + string is passed directly to Windows native commands [2]. + [1]: https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_quoting_rules + [2]: https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_parsing#passing-arguments-that-contain-quote-characters + """ + s = s.replace("'", "''") + return f"'{s}'" + + def quote_bat(s): + return s + + # gh-124651: need to quote the template strings properly + quote = shlex.quote + script_path = context.script_path + if script_path.endswith('.ps1'): + quote = quote_ps1 + elif script_path.endswith('.bat'): + quote = quote_bat + else: + # fallbacks to POSIX shell compliant quote + quote = shlex.quote + + replacements = {key: quote(s) for key, s in replacements.items()} + for key, quoted in replacements.items(): + text = text.replace(key, quoted) + return text + + def install_scripts(self, context, path): + """ + Install scripts into the created environment from a directory. + + :param context: The information for the environment creation request + being processed. + :param path: Absolute pathname of a directory containing script. + Scripts in the 'common' subdirectory of this directory, + and those in the directory named for the platform + being run on, are installed in the created environment. + Placeholder variables are replaced with environment- + specific values. + """ + binpath = context.bin_path + plen = len(path) + for root, dirs, files in os.walk(path): + if root == path: # at top-level, remove irrelevant dirs + for d in dirs[:]: + if d not in ('common', os.name): + dirs.remove(d) + continue # ignore files in top level + for f in files: + if (os.name == 'nt' and f.startswith('python') + and f.endswith(('.exe', '.pdb'))): + continue + srcfile = os.path.join(root, f) + suffix = root[plen:].split(os.sep)[2:] + if not suffix: + dstdir = binpath + else: + dstdir = os.path.join(binpath, *suffix) + if not os.path.exists(dstdir): + os.makedirs(dstdir) + dstfile = os.path.join(dstdir, f) + with open(srcfile, 'rb') as f: + data = f.read() + if not srcfile.endswith(('.exe', '.pdb')): + context.script_path = srcfile + try: + data = data.decode('utf-8') + data = self.replace_variables(data, context) + data = data.encode('utf-8') + except UnicodeError as e: + data = None + logger.warning('unable to copy script %r, ' + 'may be binary: %s', srcfile, e) + if data is not None: + with open(dstfile, 'wb') as f: + f.write(data) + shutil.copymode(srcfile, dstfile) + + def upgrade_dependencies(self, context): + logger.debug( + f'Upgrading {CORE_VENV_DEPS} packages in {context.bin_path}' + ) + self._call_new_python(context, '-m', 'pip', 'install', '--upgrade', + *CORE_VENV_DEPS) + + +def create(env_dir, system_site_packages=False, clear=False, + symlinks=False, with_pip=False, prompt=None, upgrade_deps=False): + """Create a virtual environment in a directory.""" + builder = EnvBuilder(system_site_packages=system_site_packages, + clear=clear, symlinks=symlinks, with_pip=with_pip, + prompt=prompt, upgrade_deps=upgrade_deps) + builder.create(env_dir) + +def main(args=None): + compatible = True + if sys.version_info < (3, 3): + compatible = False + elif not hasattr(sys, 'base_prefix'): + compatible = False + if not compatible: + raise ValueError('This script is only for use with Python >= 3.3') + else: + import argparse + + parser = argparse.ArgumentParser(prog=__name__, + description='Creates virtual Python ' + 'environments in one or ' + 'more target ' + 'directories.', + epilog='Once an environment has been ' + 'created, you may wish to ' + 'activate it, e.g. by ' + 'sourcing an activate script ' + 'in its bin directory.') + parser.add_argument('dirs', metavar='ENV_DIR', nargs='+', + help='A directory to create the environment in.') + parser.add_argument('--system-site-packages', default=False, + action='store_true', dest='system_site', + help='Give the virtual environment access to the ' + 'system site-packages dir.') + if os.name == 'nt': + use_symlinks = False + else: + use_symlinks = True + group = parser.add_mutually_exclusive_group() + group.add_argument('--symlinks', default=use_symlinks, + action='store_true', dest='symlinks', + help='Try to use symlinks rather than copies, ' + 'when symlinks are not the default for ' + 'the platform.') + group.add_argument('--copies', default=not use_symlinks, + action='store_false', dest='symlinks', + help='Try to use copies rather than symlinks, ' + 'even when symlinks are the default for ' + 'the platform.') + parser.add_argument('--clear', default=False, action='store_true', + dest='clear', help='Delete the contents of the ' + 'environment directory if it ' + 'already exists, before ' + 'environment creation.') + parser.add_argument('--upgrade', default=False, action='store_true', + dest='upgrade', help='Upgrade the environment ' + 'directory to use this version ' + 'of Python, assuming Python ' + 'has been upgraded in-place.') + parser.add_argument('--without-pip', dest='with_pip', + default=True, action='store_false', + help='Skips installing or upgrading pip in the ' + 'virtual environment (pip is bootstrapped ' + 'by default)') + parser.add_argument('--prompt', + help='Provides an alternative prompt prefix for ' + 'this environment.') + parser.add_argument('--upgrade-deps', default=False, action='store_true', + dest='upgrade_deps', + help='Upgrade core dependencies: {} to the latest ' + 'version in PyPI'.format( + ' '.join(CORE_VENV_DEPS))) + options = parser.parse_args(args) + if options.upgrade and options.clear: + raise ValueError('you cannot supply --upgrade and --clear together.') + builder = EnvBuilder(system_site_packages=options.system_site, + clear=options.clear, + symlinks=options.symlinks, + upgrade=options.upgrade, + with_pip=options.with_pip, + prompt=options.prompt, + upgrade_deps=options.upgrade_deps) + for d in options.dirs: + builder.create(d) + +if __name__ == '__main__': + rc = 1 + try: + main() + rc = 0 + except Exception as e: + print('Error: %s' % e, file=sys.stderr) + sys.exit(rc) diff --git a/miniconda3/envs/active_proaction/lib/python3.10/venv/__main__.py b/miniconda3/envs/active_proaction/lib/python3.10/venv/__main__.py new file mode 100644 index 0000000000000000000000000000000000000000..912423e4a781988accc165be8f0f6bb2e289482d --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/venv/__main__.py @@ -0,0 +1,10 @@ +import sys +from . import main + +rc = 1 +try: + main() + rc = 0 +except Exception as e: + print('Error: %s' % e, file=sys.stderr) +sys.exit(rc) diff --git a/miniconda3/envs/active_proaction/lib/python3.10/venv/scripts/common/Activate.ps1 b/miniconda3/envs/active_proaction/lib/python3.10/venv/scripts/common/Activate.ps1 new file mode 100644 index 0000000000000000000000000000000000000000..b49d77ba44b24fe6d69f6bbe75139b3b5dc23075 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/venv/scripts/common/Activate.ps1 @@ -0,0 +1,247 @@ +<# +.Synopsis +Activate a Python virtual environment for the current PowerShell session. + +.Description +Pushes the python executable for a virtual environment to the front of the +$Env:PATH environment variable and sets the prompt to signify that you are +in a Python virtual environment. Makes use of the command line switches as +well as the `pyvenv.cfg` file values present in the virtual environment. + +.Parameter VenvDir +Path to the directory that contains the virtual environment to activate. The +default value for this is the parent of the directory that the Activate.ps1 +script is located within. + +.Parameter Prompt +The prompt prefix to display when this virtual environment is activated. By +default, this prompt is the name of the virtual environment folder (VenvDir) +surrounded by parentheses and followed by a single space (ie. '(.venv) '). + +.Example +Activate.ps1 +Activates the Python virtual environment that contains the Activate.ps1 script. + +.Example +Activate.ps1 -Verbose +Activates the Python virtual environment that contains the Activate.ps1 script, +and shows extra information about the activation as it executes. + +.Example +Activate.ps1 -VenvDir C:\Users\MyUser\Common\.venv +Activates the Python virtual environment located in the specified location. + +.Example +Activate.ps1 -Prompt "MyPython" +Activates the Python virtual environment that contains the Activate.ps1 script, +and prefixes the current prompt with the specified string (surrounded in +parentheses) while the virtual environment is active. + +.Notes +On Windows, it may be required to enable this Activate.ps1 script by setting the +execution policy for the user. You can do this by issuing the following PowerShell +command: + +PS C:\> Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser + +For more information on Execution Policies: +https://go.microsoft.com/fwlink/?LinkID=135170 + +#> +Param( + [Parameter(Mandatory = $false)] + [String] + $VenvDir, + [Parameter(Mandatory = $false)] + [String] + $Prompt +) + +<# Function declarations --------------------------------------------------- #> + +<# +.Synopsis +Remove all shell session elements added by the Activate script, including the +addition of the virtual environment's Python executable from the beginning of +the PATH variable. + +.Parameter NonDestructive +If present, do not remove this function from the global namespace for the +session. + +#> +function global:deactivate ([switch]$NonDestructive) { + # Revert to original values + + # The prior prompt: + if (Test-Path -Path Function:_OLD_VIRTUAL_PROMPT) { + Copy-Item -Path Function:_OLD_VIRTUAL_PROMPT -Destination Function:prompt + Remove-Item -Path Function:_OLD_VIRTUAL_PROMPT + } + + # The prior PYTHONHOME: + if (Test-Path -Path Env:_OLD_VIRTUAL_PYTHONHOME) { + Copy-Item -Path Env:_OLD_VIRTUAL_PYTHONHOME -Destination Env:PYTHONHOME + Remove-Item -Path Env:_OLD_VIRTUAL_PYTHONHOME + } + + # The prior PATH: + if (Test-Path -Path Env:_OLD_VIRTUAL_PATH) { + Copy-Item -Path Env:_OLD_VIRTUAL_PATH -Destination Env:PATH + Remove-Item -Path Env:_OLD_VIRTUAL_PATH + } + + # Just remove the VIRTUAL_ENV altogether: + if (Test-Path -Path Env:VIRTUAL_ENV) { + Remove-Item -Path env:VIRTUAL_ENV + } + + # Just remove VIRTUAL_ENV_PROMPT altogether. + if (Test-Path -Path Env:VIRTUAL_ENV_PROMPT) { + Remove-Item -Path env:VIRTUAL_ENV_PROMPT + } + + # Just remove the _PYTHON_VENV_PROMPT_PREFIX altogether: + if (Get-Variable -Name "_PYTHON_VENV_PROMPT_PREFIX" -ErrorAction SilentlyContinue) { + Remove-Variable -Name _PYTHON_VENV_PROMPT_PREFIX -Scope Global -Force + } + + # Leave deactivate function in the global namespace if requested: + if (-not $NonDestructive) { + Remove-Item -Path function:deactivate + } +} + +<# +.Description +Get-PyVenvConfig parses the values from the pyvenv.cfg file located in the +given folder, and returns them in a map. + +For each line in the pyvenv.cfg file, if that line can be parsed into exactly +two strings separated by `=` (with any amount of whitespace surrounding the =) +then it is considered a `key = value` line. The left hand string is the key, +the right hand is the value. + +If the value starts with a `'` or a `"` then the first and last character is +stripped from the value before being captured. + +.Parameter ConfigDir +Path to the directory that contains the `pyvenv.cfg` file. +#> +function Get-PyVenvConfig( + [String] + $ConfigDir +) { + Write-Verbose "Given ConfigDir=$ConfigDir, obtain values in pyvenv.cfg" + + # Ensure the file exists, and issue a warning if it doesn't (but still allow the function to continue). + $pyvenvConfigPath = Join-Path -Resolve -Path $ConfigDir -ChildPath 'pyvenv.cfg' -ErrorAction Continue + + # An empty map will be returned if no config file is found. + $pyvenvConfig = @{ } + + if ($pyvenvConfigPath) { + + Write-Verbose "File exists, parse `key = value` lines" + $pyvenvConfigContent = Get-Content -Path $pyvenvConfigPath + + $pyvenvConfigContent | ForEach-Object { + $keyval = $PSItem -split "\s*=\s*", 2 + if ($keyval[0] -and $keyval[1]) { + $val = $keyval[1] + + # Remove extraneous quotations around a string value. + if ("'""".Contains($val.Substring(0, 1))) { + $val = $val.Substring(1, $val.Length - 2) + } + + $pyvenvConfig[$keyval[0]] = $val + Write-Verbose "Adding Key: '$($keyval[0])'='$val'" + } + } + } + return $pyvenvConfig +} + + +<# Begin Activate script --------------------------------------------------- #> + +# Determine the containing directory of this script +$VenvExecPath = Split-Path -Parent $MyInvocation.MyCommand.Definition +$VenvExecDir = Get-Item -Path $VenvExecPath + +Write-Verbose "Activation script is located in path: '$VenvExecPath'" +Write-Verbose "VenvExecDir Fullname: '$($VenvExecDir.FullName)" +Write-Verbose "VenvExecDir Name: '$($VenvExecDir.Name)" + +# Set values required in priority: CmdLine, ConfigFile, Default +# First, get the location of the virtual environment, it might not be +# VenvExecDir if specified on the command line. +if ($VenvDir) { + Write-Verbose "VenvDir given as parameter, using '$VenvDir' to determine values" +} +else { + Write-Verbose "VenvDir not given as a parameter, using parent directory name as VenvDir." + $VenvDir = $VenvExecDir.Parent.FullName.TrimEnd("\\/") + Write-Verbose "VenvDir=$VenvDir" +} + +# Next, read the `pyvenv.cfg` file to determine any required value such +# as `prompt`. +$pyvenvCfg = Get-PyVenvConfig -ConfigDir $VenvDir + +# Next, set the prompt from the command line, or the config file, or +# just use the name of the virtual environment folder. +if ($Prompt) { + Write-Verbose "Prompt specified as argument, using '$Prompt'" +} +else { + Write-Verbose "Prompt not specified as argument to script, checking pyvenv.cfg value" + if ($pyvenvCfg -and $pyvenvCfg['prompt']) { + Write-Verbose " Setting based on value in pyvenv.cfg='$($pyvenvCfg['prompt'])'" + $Prompt = $pyvenvCfg['prompt']; + } + else { + Write-Verbose " Setting prompt based on parent's directory's name. (Is the directory name passed to venv module when creating the virtual environment)" + Write-Verbose " Got leaf-name of $VenvDir='$(Split-Path -Path $venvDir -Leaf)'" + $Prompt = Split-Path -Path $venvDir -Leaf + } +} + +Write-Verbose "Prompt = '$Prompt'" +Write-Verbose "VenvDir='$VenvDir'" + +# Deactivate any currently active virtual environment, but leave the +# deactivate function in place. +deactivate -nondestructive + +# Now set the environment variable VIRTUAL_ENV, used by many tools to determine +# that there is an activated venv. +$env:VIRTUAL_ENV = $VenvDir + +if (-not $Env:VIRTUAL_ENV_DISABLE_PROMPT) { + + Write-Verbose "Setting prompt to '$Prompt'" + + # Set the prompt to include the env name + # Make sure _OLD_VIRTUAL_PROMPT is global + function global:_OLD_VIRTUAL_PROMPT { "" } + Copy-Item -Path function:prompt -Destination function:_OLD_VIRTUAL_PROMPT + New-Variable -Name _PYTHON_VENV_PROMPT_PREFIX -Description "Python virtual environment prompt prefix" -Scope Global -Option ReadOnly -Visibility Public -Value $Prompt + + function global:prompt { + Write-Host -NoNewline -ForegroundColor Green "($_PYTHON_VENV_PROMPT_PREFIX) " + _OLD_VIRTUAL_PROMPT + } + $env:VIRTUAL_ENV_PROMPT = $Prompt +} + +# Clear PYTHONHOME +if (Test-Path -Path Env:PYTHONHOME) { + Copy-Item -Path Env:PYTHONHOME -Destination Env:_OLD_VIRTUAL_PYTHONHOME + Remove-Item -Path Env:PYTHONHOME +} + +# Add the venv to the PATH +Copy-Item -Path Env:PATH -Destination Env:_OLD_VIRTUAL_PATH +$Env:PATH = "$VenvExecDir$([System.IO.Path]::PathSeparator)$Env:PATH" diff --git a/miniconda3/envs/active_proaction/lib/python3.10/venv/scripts/common/activate b/miniconda3/envs/active_proaction/lib/python3.10/venv/scripts/common/activate new file mode 100644 index 0000000000000000000000000000000000000000..104399d55f8cc0e7ed2a18690098559e1e6888a8 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/venv/scripts/common/activate @@ -0,0 +1,69 @@ +# This file must be used with "source bin/activate" *from bash* +# you cannot run it directly + +deactivate () { + # reset old environment variables + if [ -n "${_OLD_VIRTUAL_PATH:-}" ] ; then + PATH="${_OLD_VIRTUAL_PATH:-}" + export PATH + unset _OLD_VIRTUAL_PATH + fi + if [ -n "${_OLD_VIRTUAL_PYTHONHOME:-}" ] ; then + PYTHONHOME="${_OLD_VIRTUAL_PYTHONHOME:-}" + export PYTHONHOME + unset _OLD_VIRTUAL_PYTHONHOME + fi + + # This should detect bash and zsh, which have a hash command that must + # be called to get it to forget past commands. Without forgetting + # past commands the $PATH changes we made may not be respected + if [ -n "${BASH:-}" -o -n "${ZSH_VERSION:-}" ] ; then + hash -r 2> /dev/null + fi + + if [ -n "${_OLD_VIRTUAL_PS1:-}" ] ; then + PS1="${_OLD_VIRTUAL_PS1:-}" + export PS1 + unset _OLD_VIRTUAL_PS1 + fi + + unset VIRTUAL_ENV + unset VIRTUAL_ENV_PROMPT + if [ ! "${1:-}" = "nondestructive" ] ; then + # Self destruct! + unset -f deactivate + fi +} + +# unset irrelevant variables +deactivate nondestructive + +VIRTUAL_ENV=__VENV_DIR__ +export VIRTUAL_ENV + +_OLD_VIRTUAL_PATH="$PATH" +PATH="$VIRTUAL_ENV/"__VENV_BIN_NAME__":$PATH" +export PATH + +# unset PYTHONHOME if set +# this will fail if PYTHONHOME is set to the empty string (which is bad anyway) +# could use `if (set -u; : $PYTHONHOME) ;` in bash +if [ -n "${PYTHONHOME:-}" ] ; then + _OLD_VIRTUAL_PYTHONHOME="${PYTHONHOME:-}" + unset PYTHONHOME +fi + +if [ -z "${VIRTUAL_ENV_DISABLE_PROMPT:-}" ] ; then + _OLD_VIRTUAL_PS1="${PS1:-}" + PS1=__VENV_PROMPT__"${PS1:-}" + export PS1 + VIRTUAL_ENV_PROMPT=__VENV_PROMPT__ + export VIRTUAL_ENV_PROMPT +fi + +# This should detect bash and zsh, which have a hash command that must +# be called to get it to forget past commands. Without forgetting +# past commands the $PATH changes we made may not be respected +if [ -n "${BASH:-}" -o -n "${ZSH_VERSION:-}" ] ; then + hash -r 2> /dev/null +fi diff --git a/miniconda3/envs/active_proaction/lib/python3.10/venv/scripts/posix/activate.csh b/miniconda3/envs/active_proaction/lib/python3.10/venv/scripts/posix/activate.csh new file mode 100644 index 0000000000000000000000000000000000000000..c47702127eff712cd64972d55be5a7dd66c06274 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/venv/scripts/posix/activate.csh @@ -0,0 +1,26 @@ +# This file must be used with "source bin/activate.csh" *from csh*. +# You cannot run it directly. +# Created by Davide Di Blasi . +# Ported to Python 3.3 venv by Andrew Svetlov + +alias deactivate 'test $?_OLD_VIRTUAL_PATH != 0 && setenv PATH "$_OLD_VIRTUAL_PATH" && unset _OLD_VIRTUAL_PATH; rehash; test $?_OLD_VIRTUAL_PROMPT != 0 && set prompt="$_OLD_VIRTUAL_PROMPT" && unset _OLD_VIRTUAL_PROMPT; unsetenv VIRTUAL_ENV; unsetenv VIRTUAL_ENV_PROMPT; test "\!:*" != "nondestructive" && unalias deactivate' + +# Unset irrelevant variables. +deactivate nondestructive + +setenv VIRTUAL_ENV __VENV_DIR__ + +set _OLD_VIRTUAL_PATH="$PATH" +setenv PATH "$VIRTUAL_ENV/"__VENV_BIN_NAME__":$PATH" + + +set _OLD_VIRTUAL_PROMPT="$prompt" + +if (! "$?VIRTUAL_ENV_DISABLE_PROMPT") then + set prompt = __VENV_PROMPT__"$prompt" + setenv VIRTUAL_ENV_PROMPT __VENV_PROMPT__ +endif + +alias pydoc python -m pydoc + +rehash diff --git a/miniconda3/envs/active_proaction/lib/python3.10/venv/scripts/posix/activate.fish b/miniconda3/envs/active_proaction/lib/python3.10/venv/scripts/posix/activate.fish new file mode 100644 index 0000000000000000000000000000000000000000..dc3a6c88270c182800d0594d062ba94b8d83205e --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/venv/scripts/posix/activate.fish @@ -0,0 +1,69 @@ +# This file must be used with "source /bin/activate.fish" *from fish* +# (https://fishshell.com/); you cannot run it directly. + +function deactivate -d "Exit virtual environment and return to normal shell environment" + # reset old environment variables + if test -n "$_OLD_VIRTUAL_PATH" + set -gx PATH $_OLD_VIRTUAL_PATH + set -e _OLD_VIRTUAL_PATH + end + if test -n "$_OLD_VIRTUAL_PYTHONHOME" + set -gx PYTHONHOME $_OLD_VIRTUAL_PYTHONHOME + set -e _OLD_VIRTUAL_PYTHONHOME + end + + if test -n "$_OLD_FISH_PROMPT_OVERRIDE" + set -e _OLD_FISH_PROMPT_OVERRIDE + # prevents error when using nested fish instances (Issue #93858) + if functions -q _old_fish_prompt + functions -e fish_prompt + functions -c _old_fish_prompt fish_prompt + functions -e _old_fish_prompt + end + end + + set -e VIRTUAL_ENV + set -e VIRTUAL_ENV_PROMPT + if test "$argv[1]" != "nondestructive" + # Self-destruct! + functions -e deactivate + end +end + +# Unset irrelevant variables. +deactivate nondestructive + +set -gx VIRTUAL_ENV __VENV_DIR__ + +set -gx _OLD_VIRTUAL_PATH $PATH +set -gx PATH "$VIRTUAL_ENV/"__VENV_BIN_NAME__ $PATH + +# Unset PYTHONHOME if set. +if set -q PYTHONHOME + set -gx _OLD_VIRTUAL_PYTHONHOME $PYTHONHOME + set -e PYTHONHOME +end + +if test -z "$VIRTUAL_ENV_DISABLE_PROMPT" + # fish uses a function instead of an env var to generate the prompt. + + # Save the current fish_prompt function as the function _old_fish_prompt. + functions -c fish_prompt _old_fish_prompt + + # With the original prompt function renamed, we can override with our own. + function fish_prompt + # Save the return status of the last command. + set -l old_status $status + + # Output the venv prompt; color taken from the blue of the Python logo. + printf "%s%s%s" (set_color 4B8BBE) __VENV_PROMPT__ (set_color normal) + + # Restore the return status of the previous command. + echo "exit $old_status" | . + # Output the original/"old" prompt. + _old_fish_prompt + end + + set -gx _OLD_FISH_PROMPT_OVERRIDE "$VIRTUAL_ENV" + set -gx VIRTUAL_ENV_PROMPT __VENV_PROMPT__ +end diff --git a/miniconda3/envs/active_proaction/lib/python3.10/wsgiref/__init__.py b/miniconda3/envs/active_proaction/lib/python3.10/wsgiref/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..1efbba01a306ea075777ae00c6403fdba96b44bd --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/wsgiref/__init__.py @@ -0,0 +1,23 @@ +"""wsgiref -- a WSGI (PEP 3333) Reference Library + +Current Contents: + +* util -- Miscellaneous useful functions and wrappers + +* headers -- Manage response headers + +* handlers -- base classes for server/gateway implementations + +* simple_server -- a simple BaseHTTPServer that supports WSGI + +* validate -- validation wrapper that sits between an app and a server + to detect errors in either + +To-Do: + +* cgi_gateway -- Run WSGI apps under CGI (pending a deployment standard) + +* cgi_wrapper -- Run CGI apps under WSGI + +* router -- a simple middleware component that handles URL traversal +""" diff --git a/miniconda3/envs/active_proaction/lib/python3.10/wsgiref/handlers.py b/miniconda3/envs/active_proaction/lib/python3.10/wsgiref/handlers.py new file mode 100644 index 0000000000000000000000000000000000000000..31360e58785ac6e824a339d2005ac1d0d5087df7 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/wsgiref/handlers.py @@ -0,0 +1,571 @@ +"""Base classes for server/gateway implementations""" + +from .util import FileWrapper, guess_scheme, is_hop_by_hop +from .headers import Headers + +import sys, os, time + +__all__ = [ + 'BaseHandler', 'SimpleHandler', 'BaseCGIHandler', 'CGIHandler', + 'IISCGIHandler', 'read_environ' +] + +# Weekday and month names for HTTP date/time formatting; always English! +_weekdayname = ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"] +_monthname = [None, # Dummy so we can use 1-based month numbers + "Jan", "Feb", "Mar", "Apr", "May", "Jun", + "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"] + +def format_date_time(timestamp): + year, month, day, hh, mm, ss, wd, y, z = time.gmtime(timestamp) + return "%s, %02d %3s %4d %02d:%02d:%02d GMT" % ( + _weekdayname[wd], day, _monthname[month], year, hh, mm, ss + ) + +_is_request = { + 'SCRIPT_NAME', 'PATH_INFO', 'QUERY_STRING', 'REQUEST_METHOD', 'AUTH_TYPE', + 'CONTENT_TYPE', 'CONTENT_LENGTH', 'HTTPS', 'REMOTE_USER', 'REMOTE_IDENT', +}.__contains__ + +def _needs_transcode(k): + return _is_request(k) or k.startswith('HTTP_') or k.startswith('SSL_') \ + or (k.startswith('REDIRECT_') and _needs_transcode(k[9:])) + +def read_environ(): + """Read environment, fixing HTTP variables""" + enc = sys.getfilesystemencoding() + esc = 'surrogateescape' + try: + ''.encode('utf-8', esc) + except LookupError: + esc = 'replace' + environ = {} + + # Take the basic environment from native-unicode os.environ. Attempt to + # fix up the variables that come from the HTTP request to compensate for + # the bytes->unicode decoding step that will already have taken place. + for k, v in os.environ.items(): + if _needs_transcode(k): + + # On win32, the os.environ is natively Unicode. Different servers + # decode the request bytes using different encodings. + if sys.platform == 'win32': + software = os.environ.get('SERVER_SOFTWARE', '').lower() + + # On IIS, the HTTP request will be decoded as UTF-8 as long + # as the input is a valid UTF-8 sequence. Otherwise it is + # decoded using the system code page (mbcs), with no way to + # detect this has happened. Because UTF-8 is the more likely + # encoding, and mbcs is inherently unreliable (an mbcs string + # that happens to be valid UTF-8 will not be decoded as mbcs) + # always recreate the original bytes as UTF-8. + if software.startswith('microsoft-iis/'): + v = v.encode('utf-8').decode('iso-8859-1') + + # Apache mod_cgi writes bytes-as-unicode (as if ISO-8859-1) direct + # to the Unicode environ. No modification needed. + elif software.startswith('apache/'): + pass + + # Python 3's http.server.CGIHTTPRequestHandler decodes + # using the urllib.unquote default of UTF-8, amongst other + # issues. + elif ( + software.startswith('simplehttp/') + and 'python/3' in software + ): + v = v.encode('utf-8').decode('iso-8859-1') + + # For other servers, guess that they have written bytes to + # the environ using stdio byte-oriented interfaces, ending up + # with the system code page. + else: + v = v.encode(enc, 'replace').decode('iso-8859-1') + + # Recover bytes from unicode environ, using surrogate escapes + # where available (Python 3.1+). + else: + v = v.encode(enc, esc).decode('iso-8859-1') + + environ[k] = v + return environ + + +class BaseHandler: + """Manage the invocation of a WSGI application""" + + # Configuration parameters; can override per-subclass or per-instance + wsgi_version = (1,0) + wsgi_multithread = True + wsgi_multiprocess = True + wsgi_run_once = False + + origin_server = True # We are transmitting direct to client + http_version = "1.0" # Version that should be used for response + server_software = None # String name of server software, if any + + # os_environ is used to supply configuration from the OS environment: + # by default it's a copy of 'os.environ' as of import time, but you can + # override this in e.g. your __init__ method. + os_environ= read_environ() + + # Collaborator classes + wsgi_file_wrapper = FileWrapper # set to None to disable + headers_class = Headers # must be a Headers-like class + + # Error handling (also per-subclass or per-instance) + traceback_limit = None # Print entire traceback to self.get_stderr() + error_status = "500 Internal Server Error" + error_headers = [('Content-Type','text/plain')] + error_body = b"A server error occurred. Please contact the administrator." + + # State variables (don't mess with these) + status = result = None + headers_sent = False + headers = None + bytes_sent = 0 + + def run(self, application): + """Invoke the application""" + # Note to self: don't move the close()! Asynchronous servers shouldn't + # call close() from finish_response(), so if you close() anywhere but + # the double-error branch here, you'll break asynchronous servers by + # prematurely closing. Async servers must return from 'run()' without + # closing if there might still be output to iterate over. + try: + self.setup_environ() + self.result = application(self.environ, self.start_response) + self.finish_response() + except (ConnectionAbortedError, BrokenPipeError, ConnectionResetError): + # We expect the client to close the connection abruptly from time + # to time. + return + except: + try: + self.handle_error() + except: + # If we get an error handling an error, just give up already! + self.close() + raise # ...and let the actual server figure it out. + + + def setup_environ(self): + """Set up the environment for one request""" + + env = self.environ = self.os_environ.copy() + self.add_cgi_vars() + + env['wsgi.input'] = self.get_stdin() + env['wsgi.errors'] = self.get_stderr() + env['wsgi.version'] = self.wsgi_version + env['wsgi.run_once'] = self.wsgi_run_once + env['wsgi.url_scheme'] = self.get_scheme() + env['wsgi.multithread'] = self.wsgi_multithread + env['wsgi.multiprocess'] = self.wsgi_multiprocess + + if self.wsgi_file_wrapper is not None: + env['wsgi.file_wrapper'] = self.wsgi_file_wrapper + + if self.origin_server and self.server_software: + env.setdefault('SERVER_SOFTWARE',self.server_software) + + + def finish_response(self): + """Send any iterable data, then close self and the iterable + + Subclasses intended for use in asynchronous servers will + want to redefine this method, such that it sets up callbacks + in the event loop to iterate over the data, and to call + 'self.close()' once the response is finished. + """ + try: + if not self.result_is_file() or not self.sendfile(): + for data in self.result: + self.write(data) + self.finish_content() + except: + # Call close() on the iterable returned by the WSGI application + # in case of an exception. + if hasattr(self.result, 'close'): + self.result.close() + raise + else: + # We only call close() when no exception is raised, because it + # will set status, result, headers, and environ fields to None. + # See bpo-29183 for more details. + self.close() + + + def get_scheme(self): + """Return the URL scheme being used""" + return guess_scheme(self.environ) + + + def set_content_length(self): + """Compute Content-Length or switch to chunked encoding if possible""" + try: + blocks = len(self.result) + except (TypeError,AttributeError,NotImplementedError): + pass + else: + if blocks==1: + self.headers['Content-Length'] = str(self.bytes_sent) + return + # XXX Try for chunked encoding if origin server and client is 1.1 + + + def cleanup_headers(self): + """Make any necessary header changes or defaults + + Subclasses can extend this to add other defaults. + """ + if 'Content-Length' not in self.headers: + self.set_content_length() + + def start_response(self, status, headers,exc_info=None): + """'start_response()' callable as specified by PEP 3333""" + + if exc_info: + try: + if self.headers_sent: + # Re-raise original exception if headers sent + raise exc_info[0](exc_info[1]).with_traceback(exc_info[2]) + finally: + exc_info = None # avoid dangling circular ref + elif self.headers is not None: + raise AssertionError("Headers already set!") + + self.status = status + self.headers = self.headers_class(headers) + status = self._convert_string_type(status, "Status") + assert len(status)>=4,"Status must be at least 4 characters" + assert status[:3].isdigit(), "Status message must begin w/3-digit code" + assert status[3]==" ", "Status message must have a space after code" + + if __debug__: + for name, val in headers: + name = self._convert_string_type(name, "Header name") + val = self._convert_string_type(val, "Header value") + assert not is_hop_by_hop(name),\ + f"Hop-by-hop header, '{name}: {val}', not allowed" + + return self.write + + def _convert_string_type(self, value, title): + """Convert/check value type.""" + if type(value) is str: + return value + raise AssertionError( + "{0} must be of type str (got {1})".format(title, repr(value)) + ) + + def send_preamble(self): + """Transmit version/status/date/server, via self._write()""" + if self.origin_server: + if self.client_is_modern(): + self._write(('HTTP/%s %s\r\n' % (self.http_version,self.status)).encode('iso-8859-1')) + if 'Date' not in self.headers: + self._write( + ('Date: %s\r\n' % format_date_time(time.time())).encode('iso-8859-1') + ) + if self.server_software and 'Server' not in self.headers: + self._write(('Server: %s\r\n' % self.server_software).encode('iso-8859-1')) + else: + self._write(('Status: %s\r\n' % self.status).encode('iso-8859-1')) + + def write(self, data): + """'write()' callable as specified by PEP 3333""" + + assert type(data) is bytes, \ + "write() argument must be a bytes instance" + + if not self.status: + raise AssertionError("write() before start_response()") + + elif not self.headers_sent: + # Before the first output, send the stored headers + self.bytes_sent = len(data) # make sure we know content-length + self.send_headers() + else: + self.bytes_sent += len(data) + + # XXX check Content-Length and truncate if too many bytes written? + self._write(data) + self._flush() + + + def sendfile(self): + """Platform-specific file transmission + + Override this method in subclasses to support platform-specific + file transmission. It is only called if the application's + return iterable ('self.result') is an instance of + 'self.wsgi_file_wrapper'. + + This method should return a true value if it was able to actually + transmit the wrapped file-like object using a platform-specific + approach. It should return a false value if normal iteration + should be used instead. An exception can be raised to indicate + that transmission was attempted, but failed. + + NOTE: this method should call 'self.send_headers()' if + 'self.headers_sent' is false and it is going to attempt direct + transmission of the file. + """ + return False # No platform-specific transmission by default + + + def finish_content(self): + """Ensure headers and content have both been sent""" + if not self.headers_sent: + # Only zero Content-Length if not set by the application (so + # that HEAD requests can be satisfied properly, see #3839) + self.headers.setdefault('Content-Length', "0") + self.send_headers() + else: + pass # XXX check if content-length was too short? + + def close(self): + """Close the iterable (if needed) and reset all instance vars + + Subclasses may want to also drop the client connection. + """ + try: + if hasattr(self.result,'close'): + self.result.close() + finally: + self.result = self.headers = self.status = self.environ = None + self.bytes_sent = 0; self.headers_sent = False + + + def send_headers(self): + """Transmit headers to the client, via self._write()""" + self.cleanup_headers() + self.headers_sent = True + if not self.origin_server or self.client_is_modern(): + self.send_preamble() + self._write(bytes(self.headers)) + + + def result_is_file(self): + """True if 'self.result' is an instance of 'self.wsgi_file_wrapper'""" + wrapper = self.wsgi_file_wrapper + return wrapper is not None and isinstance(self.result,wrapper) + + + def client_is_modern(self): + """True if client can accept status and headers""" + return self.environ['SERVER_PROTOCOL'].upper() != 'HTTP/0.9' + + + def log_exception(self,exc_info): + """Log the 'exc_info' tuple in the server log + + Subclasses may override to retarget the output or change its format. + """ + try: + from traceback import print_exception + stderr = self.get_stderr() + print_exception( + exc_info[0], exc_info[1], exc_info[2], + self.traceback_limit, stderr + ) + stderr.flush() + finally: + exc_info = None + + def handle_error(self): + """Log current error, and send error output to client if possible""" + self.log_exception(sys.exc_info()) + if not self.headers_sent: + self.result = self.error_output(self.environ, self.start_response) + self.finish_response() + # XXX else: attempt advanced recovery techniques for HTML or text? + + def error_output(self, environ, start_response): + """WSGI mini-app to create error output + + By default, this just uses the 'error_status', 'error_headers', + and 'error_body' attributes to generate an output page. It can + be overridden in a subclass to dynamically generate diagnostics, + choose an appropriate message for the user's preferred language, etc. + + Note, however, that it's not recommended from a security perspective to + spit out diagnostics to any old user; ideally, you should have to do + something special to enable diagnostic output, which is why we don't + include any here! + """ + start_response(self.error_status,self.error_headers[:],sys.exc_info()) + return [self.error_body] + + + # Pure abstract methods; *must* be overridden in subclasses + + def _write(self,data): + """Override in subclass to buffer data for send to client + + It's okay if this method actually transmits the data; BaseHandler + just separates write and flush operations for greater efficiency + when the underlying system actually has such a distinction. + """ + raise NotImplementedError + + def _flush(self): + """Override in subclass to force sending of recent '_write()' calls + + It's okay if this method is a no-op (i.e., if '_write()' actually + sends the data. + """ + raise NotImplementedError + + def get_stdin(self): + """Override in subclass to return suitable 'wsgi.input'""" + raise NotImplementedError + + def get_stderr(self): + """Override in subclass to return suitable 'wsgi.errors'""" + raise NotImplementedError + + def add_cgi_vars(self): + """Override in subclass to insert CGI variables in 'self.environ'""" + raise NotImplementedError + + +class SimpleHandler(BaseHandler): + """Handler that's just initialized with streams, environment, etc. + + This handler subclass is intended for synchronous HTTP/1.0 origin servers, + and handles sending the entire response output, given the correct inputs. + + Usage:: + + handler = SimpleHandler( + inp,out,err,env, multithread=False, multiprocess=True + ) + handler.run(app)""" + + def __init__(self,stdin,stdout,stderr,environ, + multithread=True, multiprocess=False + ): + self.stdin = stdin + self.stdout = stdout + self.stderr = stderr + self.base_env = environ + self.wsgi_multithread = multithread + self.wsgi_multiprocess = multiprocess + + def get_stdin(self): + return self.stdin + + def get_stderr(self): + return self.stderr + + def add_cgi_vars(self): + self.environ.update(self.base_env) + + def _write(self,data): + result = self.stdout.write(data) + if result is None or result == len(data): + return + from warnings import warn + warn("SimpleHandler.stdout.write() should not do partial writes", + DeprecationWarning) + while True: + data = data[result:] + if not data: + break + result = self.stdout.write(data) + + def _flush(self): + self.stdout.flush() + self._flush = self.stdout.flush + + +class BaseCGIHandler(SimpleHandler): + + """CGI-like systems using input/output/error streams and environ mapping + + Usage:: + + handler = BaseCGIHandler(inp,out,err,env) + handler.run(app) + + This handler class is useful for gateway protocols like ReadyExec and + FastCGI, that have usable input/output/error streams and an environment + mapping. It's also the base class for CGIHandler, which just uses + sys.stdin, os.environ, and so on. + + The constructor also takes keyword arguments 'multithread' and + 'multiprocess' (defaulting to 'True' and 'False' respectively) to control + the configuration sent to the application. It sets 'origin_server' to + False (to enable CGI-like output), and assumes that 'wsgi.run_once' is + False. + """ + + origin_server = False + + +class CGIHandler(BaseCGIHandler): + + """CGI-based invocation via sys.stdin/stdout/stderr and os.environ + + Usage:: + + CGIHandler().run(app) + + The difference between this class and BaseCGIHandler is that it always + uses 'wsgi.run_once' of 'True', 'wsgi.multithread' of 'False', and + 'wsgi.multiprocess' of 'True'. It does not take any initialization + parameters, but always uses 'sys.stdin', 'os.environ', and friends. + + If you need to override any of these parameters, use BaseCGIHandler + instead. + """ + + wsgi_run_once = True + # Do not allow os.environ to leak between requests in Google App Engine + # and other multi-run CGI use cases. This is not easily testable. + # See http://bugs.python.org/issue7250 + os_environ = {} + + def __init__(self): + BaseCGIHandler.__init__( + self, sys.stdin.buffer, sys.stdout.buffer, sys.stderr, + read_environ(), multithread=False, multiprocess=True + ) + + +class IISCGIHandler(BaseCGIHandler): + """CGI-based invocation with workaround for IIS path bug + + This handler should be used in preference to CGIHandler when deploying on + Microsoft IIS without having set the config allowPathInfo option (IIS>=7) + or metabase allowPathInfoForScriptMappings (IIS<7). + """ + wsgi_run_once = True + os_environ = {} + + # By default, IIS gives a PATH_INFO that duplicates the SCRIPT_NAME at + # the front, causing problems for WSGI applications that wish to implement + # routing. This handler strips any such duplicated path. + + # IIS can be configured to pass the correct PATH_INFO, but this causes + # another bug where PATH_TRANSLATED is wrong. Luckily this variable is + # rarely used and is not guaranteed by WSGI. On IIS<7, though, the + # setting can only be made on a vhost level, affecting all other script + # mappings, many of which break when exposed to the PATH_TRANSLATED bug. + # For this reason IIS<7 is almost never deployed with the fix. (Even IIS7 + # rarely uses it because there is still no UI for it.) + + # There is no way for CGI code to tell whether the option was set, so a + # separate handler class is provided. + def __init__(self): + environ= read_environ() + path = environ.get('PATH_INFO', '') + script = environ.get('SCRIPT_NAME', '') + if (path+'/').startswith(script+'/'): + environ['PATH_INFO'] = path[len(script):] + BaseCGIHandler.__init__( + self, sys.stdin.buffer, sys.stdout.buffer, sys.stderr, + environ, multithread=False, multiprocess=True + ) diff --git a/miniconda3/envs/active_proaction/lib/python3.10/wsgiref/headers.py b/miniconda3/envs/active_proaction/lib/python3.10/wsgiref/headers.py new file mode 100644 index 0000000000000000000000000000000000000000..17559b0a37bd201bb9c3872fc9cc4a6c4163f0d7 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/wsgiref/headers.py @@ -0,0 +1,192 @@ +"""Manage HTTP Response Headers + +Much of this module is red-handedly pilfered from email.message in the stdlib, +so portions are Copyright (C) 2001,2002 Python Software Foundation, and were +written by Barry Warsaw. +""" + +# Regular expression that matches `special' characters in parameters, the +# existence of which force quoting of the parameter value. +import re +tspecials = re.compile(r'[ \(\)<>@,;:\\"/\[\]\?=]') +# Disallowed characters for headers and values. +# HTAB (\x09) is allowed in header values, but +# not in header names. (RFC 9110 Section 5.5) +_name_disallowed_re = re.compile(r'[\x00-\x1F\x7F]') +_value_disallowed_re = re.compile(r'[\x00-\x08\x0A-\x1F\x7F]') + +def _formatparam(param, value=None, quote=1): + """Convenience function to format and return a key=value pair. + + This will quote the value if needed or if quote is true. + """ + if value is not None and len(value) > 0: + if quote or tspecials.search(value): + value = value.replace('\\', '\\\\').replace('"', r'\"') + return '%s="%s"' % (param, value) + else: + return '%s=%s' % (param, value) + else: + return param + + +class Headers: + """Manage a collection of HTTP response headers""" + + def __init__(self, headers=None): + headers = headers if headers is not None else [] + if type(headers) is not list: + raise TypeError("Headers must be a list of name/value tuples") + self._headers = headers + if __debug__: + for k, v in headers: + self._convert_string_type(k, name=True) + self._convert_string_type(v, name=False) + + def _convert_string_type(self, value, *, name): + """Convert/check value type.""" + if type(value) is str: + regex = (_name_disallowed_re if name else _value_disallowed_re) + if regex.search(value): + raise ValueError("Control characters not allowed in headers") + return value + raise AssertionError("Header names/values must be" + " of type str (got {0})".format(repr(value))) + + def __len__(self): + """Return the total number of headers, including duplicates.""" + return len(self._headers) + + def __setitem__(self, name, val): + """Set the value of a header.""" + del self[name] + self._headers.append( + (self._convert_string_type(name, name=True), self._convert_string_type(val, name=False))) + + def __delitem__(self,name): + """Delete all occurrences of a header, if present. + + Does *not* raise an exception if the header is missing. + """ + name = self._convert_string_type(name.lower(), name=True) + self._headers[:] = [kv for kv in self._headers if kv[0].lower() != name] + + def __getitem__(self,name): + """Get the first header value for 'name' + + Return None if the header is missing instead of raising an exception. + + Note that if the header appeared multiple times, the first exactly which + occurrence gets returned is undefined. Use getall() to get all + the values matching a header field name. + """ + return self.get(name) + + def __contains__(self, name): + """Return true if the message contains the header.""" + return self.get(name) is not None + + + def get_all(self, name): + """Return a list of all the values for the named field. + + These will be sorted in the order they appeared in the original header + list or were added to this instance, and may contain duplicates. Any + fields deleted and re-inserted are always appended to the header list. + If no fields exist with the given name, returns an empty list. + """ + name = self._convert_string_type(name.lower(), name=True) + return [kv[1] for kv in self._headers if kv[0].lower()==name] + + + def get(self,name,default=None): + """Get the first header value for 'name', or return 'default'""" + name = self._convert_string_type(name.lower(), name=True) + for k,v in self._headers: + if k.lower()==name: + return v + return default + + + def keys(self): + """Return a list of all the header field names. + + These will be sorted in the order they appeared in the original header + list, or were added to this instance, and may contain duplicates. + Any fields deleted and re-inserted are always appended to the header + list. + """ + return [k for k, v in self._headers] + + def values(self): + """Return a list of all header values. + + These will be sorted in the order they appeared in the original header + list, or were added to this instance, and may contain duplicates. + Any fields deleted and re-inserted are always appended to the header + list. + """ + return [v for k, v in self._headers] + + def items(self): + """Get all the header fields and values. + + These will be sorted in the order they were in the original header + list, or were added to this instance, and may contain duplicates. + Any fields deleted and re-inserted are always appended to the header + list. + """ + return self._headers[:] + + def __repr__(self): + return "%s(%r)" % (self.__class__.__name__, self._headers) + + def __str__(self): + """str() returns the formatted headers, complete with end line, + suitable for direct HTTP transmission.""" + return '\r\n'.join(["%s: %s" % kv for kv in self._headers]+['','']) + + def __bytes__(self): + return str(self).encode('iso-8859-1') + + def setdefault(self,name,value): + """Return first matching header value for 'name', or 'value' + + If there is no header named 'name', add a new header with name 'name' + and value 'value'.""" + result = self.get(name) + if result is None: + self._headers.append((self._convert_string_type(name, name=True), + self._convert_string_type(value, name=False))) + return value + else: + return result + + def add_header(self, _name, _value, **_params): + """Extended header setting. + + _name is the header field to add. keyword arguments can be used to set + additional parameters for the header field, with underscores converted + to dashes. Normally the parameter will be added as key="value" unless + value is None, in which case only the key will be added. + + Example: + + h.add_header('content-disposition', 'attachment', filename='bud.gif') + + Note that unlike the corresponding 'email.message' method, this does + *not* handle '(charset, language, value)' tuples: all values must be + strings or None. + """ + parts = [] + if _value is not None: + _value = self._convert_string_type(_value, name=False) + parts.append(_value) + for k, v in _params.items(): + k = self._convert_string_type(k, name=True) + if v is None: + parts.append(k.replace('_', '-')) + else: + v = self._convert_string_type(v, name=False) + parts.append(_formatparam(k.replace('_', '-'), v)) + self._headers.append((self._convert_string_type(_name, name=True), "; ".join(parts))) diff --git a/miniconda3/envs/active_proaction/lib/python3.10/wsgiref/simple_server.py b/miniconda3/envs/active_proaction/lib/python3.10/wsgiref/simple_server.py new file mode 100644 index 0000000000000000000000000000000000000000..93d01a863adf59e4dcf2e23d65e025526c273e6e --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/wsgiref/simple_server.py @@ -0,0 +1,165 @@ +"""BaseHTTPServer that implements the Python WSGI protocol (PEP 3333) + +This is both an example of how WSGI can be implemented, and a basis for running +simple web applications on a local machine, such as might be done when testing +or debugging an application. It has not been reviewed for security issues, +however, and we strongly recommend that you use a "real" web server for +production use. + +For example usage, see the 'if __name__=="__main__"' block at the end of the +module. See also the BaseHTTPServer module docs for other API information. +""" + +from http.server import BaseHTTPRequestHandler, HTTPServer +import sys +import urllib.parse +from wsgiref.handlers import SimpleHandler +from platform import python_implementation + +__version__ = "0.2" +__all__ = ['WSGIServer', 'WSGIRequestHandler', 'demo_app', 'make_server'] + + +server_version = "WSGIServer/" + __version__ +sys_version = python_implementation() + "/" + sys.version.split()[0] +software_version = server_version + ' ' + sys_version + + +class ServerHandler(SimpleHandler): + + server_software = software_version + + def close(self): + try: + self.request_handler.log_request( + self.status.split(' ',1)[0], self.bytes_sent + ) + finally: + SimpleHandler.close(self) + + + +class WSGIServer(HTTPServer): + + """BaseHTTPServer that implements the Python WSGI protocol""" + + application = None + + def server_bind(self): + """Override server_bind to store the server name.""" + HTTPServer.server_bind(self) + self.setup_environ() + + def setup_environ(self): + # Set up base environment + env = self.base_environ = {} + env['SERVER_NAME'] = self.server_name + env['GATEWAY_INTERFACE'] = 'CGI/1.1' + env['SERVER_PORT'] = str(self.server_port) + env['REMOTE_HOST']='' + env['CONTENT_LENGTH']='' + env['SCRIPT_NAME'] = '' + + def get_app(self): + return self.application + + def set_app(self,application): + self.application = application + + + +class WSGIRequestHandler(BaseHTTPRequestHandler): + + server_version = "WSGIServer/" + __version__ + + def get_environ(self): + env = self.server.base_environ.copy() + env['SERVER_PROTOCOL'] = self.request_version + env['SERVER_SOFTWARE'] = self.server_version + env['REQUEST_METHOD'] = self.command + if '?' in self.path: + path,query = self.path.split('?',1) + else: + path,query = self.path,'' + + env['PATH_INFO'] = urllib.parse.unquote(path, 'iso-8859-1') + env['QUERY_STRING'] = query + + host = self.address_string() + if host != self.client_address[0]: + env['REMOTE_HOST'] = host + env['REMOTE_ADDR'] = self.client_address[0] + + if self.headers.get('content-type') is None: + env['CONTENT_TYPE'] = self.headers.get_content_type() + else: + env['CONTENT_TYPE'] = self.headers['content-type'] + + length = self.headers.get('content-length') + if length: + env['CONTENT_LENGTH'] = length + + for k, v in self.headers.items(): + k=k.replace('-','_').upper(); v=v.strip() + if k in env: + continue # skip content length, type,etc. + if 'HTTP_'+k in env: + env['HTTP_'+k] += ','+v # comma-separate multiple headers + else: + env['HTTP_'+k] = v + return env + + def get_stderr(self): + return sys.stderr + + def handle(self): + """Handle a single HTTP request""" + + self.raw_requestline = self.rfile.readline(65537) + if len(self.raw_requestline) > 65536: + self.requestline = '' + self.request_version = '' + self.command = '' + self.send_error(414) + return + + if not self.parse_request(): # An error code has been sent, just exit + return + + handler = ServerHandler( + self.rfile, self.wfile, self.get_stderr(), self.get_environ(), + multithread=False, + ) + handler.request_handler = self # backpointer for logging + handler.run(self.server.get_app()) + + + +def demo_app(environ,start_response): + from io import StringIO + stdout = StringIO() + print("Hello world!", file=stdout) + print(file=stdout) + h = sorted(environ.items()) + for k,v in h: + print(k,'=',repr(v), file=stdout) + start_response("200 OK", [('Content-Type','text/plain; charset=utf-8')]) + return [stdout.getvalue().encode("utf-8")] + + +def make_server( + host, port, app, server_class=WSGIServer, handler_class=WSGIRequestHandler +): + """Create a new WSGI server listening on `host` and `port` for `app`""" + server = server_class((host, port), handler_class) + server.set_app(app) + return server + + +if __name__ == '__main__': + with make_server('', 8000, demo_app) as httpd: + sa = httpd.socket.getsockname() + print("Serving HTTP on", sa[0], "port", sa[1], "...") + import webbrowser + webbrowser.open('http://localhost:8000/xyz?abc') + httpd.handle_request() # serve one request, then exit diff --git a/miniconda3/envs/active_proaction/lib/python3.10/wsgiref/util.py b/miniconda3/envs/active_proaction/lib/python3.10/wsgiref/util.py new file mode 100644 index 0000000000000000000000000000000000000000..cac52eb5a555d18634d12fbf6e174b118c7d0a56 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/wsgiref/util.py @@ -0,0 +1,172 @@ +"""Miscellaneous WSGI-related Utilities""" + +import posixpath + +__all__ = [ + 'FileWrapper', 'guess_scheme', 'application_uri', 'request_uri', + 'shift_path_info', 'setup_testing_defaults', +] + + +class FileWrapper: + """Wrapper to convert file-like objects to iterables""" + + def __init__(self, filelike, blksize=8192): + self.filelike = filelike + self.blksize = blksize + if hasattr(filelike,'close'): + self.close = filelike.close + + def __getitem__(self,key): + import warnings + warnings.warn( + "FileWrapper's __getitem__ method ignores 'key' parameter. " + "Use iterator protocol instead.", + DeprecationWarning, + stacklevel=2 + ) + data = self.filelike.read(self.blksize) + if data: + return data + raise IndexError + + def __iter__(self): + return self + + def __next__(self): + data = self.filelike.read(self.blksize) + if data: + return data + raise StopIteration + +def guess_scheme(environ): + """Return a guess for whether 'wsgi.url_scheme' should be 'http' or 'https' + """ + if environ.get("HTTPS") in ('yes','on','1'): + return 'https' + else: + return 'http' + +def application_uri(environ): + """Return the application's base URI (no PATH_INFO or QUERY_STRING)""" + url = environ['wsgi.url_scheme']+'://' + from urllib.parse import quote + + if environ.get('HTTP_HOST'): + url += environ['HTTP_HOST'] + else: + url += environ['SERVER_NAME'] + + if environ['wsgi.url_scheme'] == 'https': + if environ['SERVER_PORT'] != '443': + url += ':' + environ['SERVER_PORT'] + else: + if environ['SERVER_PORT'] != '80': + url += ':' + environ['SERVER_PORT'] + + url += quote(environ.get('SCRIPT_NAME') or '/', encoding='latin1') + return url + +def request_uri(environ, include_query=True): + """Return the full request URI, optionally including the query string""" + url = application_uri(environ) + from urllib.parse import quote + path_info = quote(environ.get('PATH_INFO',''), safe='/;=,', encoding='latin1') + if not environ.get('SCRIPT_NAME'): + url += path_info[1:] + else: + url += path_info + if include_query and environ.get('QUERY_STRING'): + url += '?' + environ['QUERY_STRING'] + return url + +def shift_path_info(environ): + """Shift a name from PATH_INFO to SCRIPT_NAME, returning it + + If there are no remaining path segments in PATH_INFO, return None. + Note: 'environ' is modified in-place; use a copy if you need to keep + the original PATH_INFO or SCRIPT_NAME. + + Note: when PATH_INFO is just a '/', this returns '' and appends a trailing + '/' to SCRIPT_NAME, even though empty path segments are normally ignored, + and SCRIPT_NAME doesn't normally end in a '/'. This is intentional + behavior, to ensure that an application can tell the difference between + '/x' and '/x/' when traversing to objects. + """ + path_info = environ.get('PATH_INFO','') + if not path_info: + return None + + path_parts = path_info.split('/') + path_parts[1:-1] = [p for p in path_parts[1:-1] if p and p != '.'] + name = path_parts[1] + del path_parts[1] + + script_name = environ.get('SCRIPT_NAME','') + script_name = posixpath.normpath(script_name+'/'+name) + if script_name.endswith('/'): + script_name = script_name[:-1] + if not name and not script_name.endswith('/'): + script_name += '/' + + environ['SCRIPT_NAME'] = script_name + environ['PATH_INFO'] = '/'.join(path_parts) + + # Special case: '/.' on PATH_INFO doesn't get stripped, + # because we don't strip the last element of PATH_INFO + # if there's only one path part left. Instead of fixing this + # above, we fix it here so that PATH_INFO gets normalized to + # an empty string in the environ. + if name=='.': + name = None + return name + +def setup_testing_defaults(environ): + """Update 'environ' with trivial defaults for testing purposes + + This adds various parameters required for WSGI, including HTTP_HOST, + SERVER_NAME, SERVER_PORT, REQUEST_METHOD, SCRIPT_NAME, PATH_INFO, + and all of the wsgi.* variables. It only supplies default values, + and does not replace any existing settings for these variables. + + This routine is intended to make it easier for unit tests of WSGI + servers and applications to set up dummy environments. It should *not* + be used by actual WSGI servers or applications, since the data is fake! + """ + + environ.setdefault('SERVER_NAME','127.0.0.1') + environ.setdefault('SERVER_PROTOCOL','HTTP/1.0') + + environ.setdefault('HTTP_HOST',environ['SERVER_NAME']) + environ.setdefault('REQUEST_METHOD','GET') + + if 'SCRIPT_NAME' not in environ and 'PATH_INFO' not in environ: + environ.setdefault('SCRIPT_NAME','') + environ.setdefault('PATH_INFO','/') + + environ.setdefault('wsgi.version', (1,0)) + environ.setdefault('wsgi.run_once', 0) + environ.setdefault('wsgi.multithread', 0) + environ.setdefault('wsgi.multiprocess', 0) + + from io import StringIO, BytesIO + environ.setdefault('wsgi.input', BytesIO()) + environ.setdefault('wsgi.errors', StringIO()) + environ.setdefault('wsgi.url_scheme',guess_scheme(environ)) + + if environ['wsgi.url_scheme']=='http': + environ.setdefault('SERVER_PORT', '80') + elif environ['wsgi.url_scheme']=='https': + environ.setdefault('SERVER_PORT', '443') + + + +_hoppish = { + 'connection', 'keep-alive', 'proxy-authenticate', + 'proxy-authorization', 'te', 'trailers', 'transfer-encoding', + 'upgrade' +}.__contains__ + +def is_hop_by_hop(header_name): + """Return true if 'header_name' is an HTTP/1.1 "Hop-by-Hop" header""" + return _hoppish(header_name.lower()) diff --git a/miniconda3/envs/active_proaction/lib/python3.10/wsgiref/validate.py b/miniconda3/envs/active_proaction/lib/python3.10/wsgiref/validate.py new file mode 100644 index 0000000000000000000000000000000000000000..6044e320a474c644820a95a52d94de90fa10797a --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/wsgiref/validate.py @@ -0,0 +1,441 @@ +# (c) 2005 Ian Bicking and contributors; written for Paste (http://pythonpaste.org) +# Licensed under the MIT license: https://opensource.org/licenses/mit-license.php +# Also licenced under the Apache License, 2.0: https://opensource.org/licenses/apache2.0.php +# Licensed to PSF under a Contributor Agreement +""" +Middleware to check for obedience to the WSGI specification. + +Some of the things this checks: + +* Signature of the application and start_response (including that + keyword arguments are not used). + +* Environment checks: + + - Environment is a dictionary (and not a subclass). + + - That all the required keys are in the environment: REQUEST_METHOD, + SERVER_NAME, SERVER_PORT, wsgi.version, wsgi.input, wsgi.errors, + wsgi.multithread, wsgi.multiprocess, wsgi.run_once + + - That HTTP_CONTENT_TYPE and HTTP_CONTENT_LENGTH are not in the + environment (these headers should appear as CONTENT_LENGTH and + CONTENT_TYPE). + + - Warns if QUERY_STRING is missing, as the cgi module acts + unpredictably in that case. + + - That CGI-style variables (that don't contain a .) have + (non-unicode) string values + + - That wsgi.version is a tuple + + - That wsgi.url_scheme is 'http' or 'https' (@@: is this too + restrictive?) + + - Warns if the REQUEST_METHOD is not known (@@: probably too + restrictive). + + - That SCRIPT_NAME and PATH_INFO are empty or start with / + + - That at least one of SCRIPT_NAME or PATH_INFO are set. + + - That CONTENT_LENGTH is a positive integer. + + - That SCRIPT_NAME is not '/' (it should be '', and PATH_INFO should + be '/'). + + - That wsgi.input has the methods read, readline, readlines, and + __iter__ + + - That wsgi.errors has the methods flush, write, writelines + +* The status is a string, contains a space, starts with an integer, + and that integer is in range (> 100). + +* That the headers is a list (not a subclass, not another kind of + sequence). + +* That the items of the headers are tuples of strings. + +* That there is no 'status' header (that is used in CGI, but not in + WSGI). + +* That the headers don't contain newlines or colons, end in _ or -, or + contain characters codes below 037. + +* That Content-Type is given if there is content (CGI often has a + default content type, but WSGI does not). + +* That no Content-Type is given when there is no content (@@: is this + too restrictive?) + +* That the exc_info argument to start_response is a tuple or None. + +* That all calls to the writer are with strings, and no other methods + on the writer are accessed. + +* That wsgi.input is used properly: + + - .read() is called with exactly one argument + + - That it returns a string + + - That readline, readlines, and __iter__ return strings + + - That .close() is not called + + - No other methods are provided + +* That wsgi.errors is used properly: + + - .write() and .writelines() is called with a string + + - That .close() is not called, and no other methods are provided. + +* The response iterator: + + - That it is not a string (it should be a list of a single string; a + string will work, but perform horribly). + + - That .__next__() returns a string + + - That the iterator is not iterated over until start_response has + been called (that can signal either a server or application + error). + + - That .close() is called (doesn't raise exception, only prints to + sys.stderr, because we only know it isn't called when the object + is garbage collected). +""" +__all__ = ['validator'] + + +import re +import sys +import warnings + +header_re = re.compile(r'^[a-zA-Z][a-zA-Z0-9\-_]*$') +bad_header_value_re = re.compile(r'[\000-\037]') + +class WSGIWarning(Warning): + """ + Raised in response to WSGI-spec-related warnings + """ + +def assert_(cond, *args): + if not cond: + raise AssertionError(*args) + +def check_string_type(value, title): + if type (value) is str: + return value + raise AssertionError( + "{0} must be of type str (got {1})".format(title, repr(value))) + +def validator(application): + + """ + When applied between a WSGI server and a WSGI application, this + middleware will check for WSGI compliance on a number of levels. + This middleware does not modify the request or response in any + way, but will raise an AssertionError if anything seems off + (except for a failure to close the application iterator, which + will be printed to stderr -- there's no way to raise an exception + at that point). + """ + + def lint_app(*args, **kw): + assert_(len(args) == 2, "Two arguments required") + assert_(not kw, "No keyword arguments allowed") + environ, start_response = args + + check_environ(environ) + + # We use this to check if the application returns without + # calling start_response: + start_response_started = [] + + def start_response_wrapper(*args, **kw): + assert_(len(args) == 2 or len(args) == 3, ( + "Invalid number of arguments: %s" % (args,))) + assert_(not kw, "No keyword arguments allowed") + status = args[0] + headers = args[1] + if len(args) == 3: + exc_info = args[2] + else: + exc_info = None + + check_status(status) + check_headers(headers) + check_content_type(status, headers) + check_exc_info(exc_info) + + start_response_started.append(None) + return WriteWrapper(start_response(*args)) + + environ['wsgi.input'] = InputWrapper(environ['wsgi.input']) + environ['wsgi.errors'] = ErrorWrapper(environ['wsgi.errors']) + + iterator = application(environ, start_response_wrapper) + assert_(iterator is not None and iterator != False, + "The application must return an iterator, if only an empty list") + + check_iterator(iterator) + + return IteratorWrapper(iterator, start_response_started) + + return lint_app + +class InputWrapper: + + def __init__(self, wsgi_input): + self.input = wsgi_input + + def read(self, *args): + assert_(len(args) == 1) + v = self.input.read(*args) + assert_(type(v) is bytes) + return v + + def readline(self, *args): + assert_(len(args) <= 1) + v = self.input.readline(*args) + assert_(type(v) is bytes) + return v + + def readlines(self, *args): + assert_(len(args) <= 1) + lines = self.input.readlines(*args) + assert_(type(lines) is list) + for line in lines: + assert_(type(line) is bytes) + return lines + + def __iter__(self): + while 1: + line = self.readline() + if not line: + return + yield line + + def close(self): + assert_(0, "input.close() must not be called") + +class ErrorWrapper: + + def __init__(self, wsgi_errors): + self.errors = wsgi_errors + + def write(self, s): + assert_(type(s) is str) + self.errors.write(s) + + def flush(self): + self.errors.flush() + + def writelines(self, seq): + for line in seq: + self.write(line) + + def close(self): + assert_(0, "errors.close() must not be called") + +class WriteWrapper: + + def __init__(self, wsgi_writer): + self.writer = wsgi_writer + + def __call__(self, s): + assert_(type(s) is bytes) + self.writer(s) + +class PartialIteratorWrapper: + + def __init__(self, wsgi_iterator): + self.iterator = wsgi_iterator + + def __iter__(self): + # We want to make sure __iter__ is called + return IteratorWrapper(self.iterator, None) + +class IteratorWrapper: + + def __init__(self, wsgi_iterator, check_start_response): + self.original_iterator = wsgi_iterator + self.iterator = iter(wsgi_iterator) + self.closed = False + self.check_start_response = check_start_response + + def __iter__(self): + return self + + def __next__(self): + assert_(not self.closed, + "Iterator read after closed") + v = next(self.iterator) + if type(v) is not bytes: + assert_(False, "Iterator yielded non-bytestring (%r)" % (v,)) + if self.check_start_response is not None: + assert_(self.check_start_response, + "The application returns and we started iterating over its body, but start_response has not yet been called") + self.check_start_response = None + return v + + def close(self): + self.closed = True + if hasattr(self.original_iterator, 'close'): + self.original_iterator.close() + + def __del__(self): + if not self.closed: + sys.stderr.write( + "Iterator garbage collected without being closed") + assert_(self.closed, + "Iterator garbage collected without being closed") + +def check_environ(environ): + assert_(type(environ) is dict, + "Environment is not of the right type: %r (environment: %r)" + % (type(environ), environ)) + + for key in ['REQUEST_METHOD', 'SERVER_NAME', 'SERVER_PORT', + 'wsgi.version', 'wsgi.input', 'wsgi.errors', + 'wsgi.multithread', 'wsgi.multiprocess', + 'wsgi.run_once']: + assert_(key in environ, + "Environment missing required key: %r" % (key,)) + + for key in ['HTTP_CONTENT_TYPE', 'HTTP_CONTENT_LENGTH']: + assert_(key not in environ, + "Environment should not have the key: %s " + "(use %s instead)" % (key, key[5:])) + + if 'QUERY_STRING' not in environ: + warnings.warn( + 'QUERY_STRING is not in the WSGI environment; the cgi ' + 'module will use sys.argv when this variable is missing, ' + 'so application errors are more likely', + WSGIWarning) + + for key in environ.keys(): + if '.' in key: + # Extension, we don't care about its type + continue + assert_(type(environ[key]) is str, + "Environmental variable %s is not a string: %r (value: %r)" + % (key, type(environ[key]), environ[key])) + + assert_(type(environ['wsgi.version']) is tuple, + "wsgi.version should be a tuple (%r)" % (environ['wsgi.version'],)) + assert_(environ['wsgi.url_scheme'] in ('http', 'https'), + "wsgi.url_scheme unknown: %r" % environ['wsgi.url_scheme']) + + check_input(environ['wsgi.input']) + check_errors(environ['wsgi.errors']) + + # @@: these need filling out: + if environ['REQUEST_METHOD'] not in ( + 'GET', 'HEAD', 'POST', 'OPTIONS', 'PATCH', 'PUT', 'DELETE', 'TRACE'): + warnings.warn( + "Unknown REQUEST_METHOD: %r" % environ['REQUEST_METHOD'], + WSGIWarning) + + assert_(not environ.get('SCRIPT_NAME') + or environ['SCRIPT_NAME'].startswith('/'), + "SCRIPT_NAME doesn't start with /: %r" % environ['SCRIPT_NAME']) + assert_(not environ.get('PATH_INFO') + or environ['PATH_INFO'].startswith('/'), + "PATH_INFO doesn't start with /: %r" % environ['PATH_INFO']) + if environ.get('CONTENT_LENGTH'): + assert_(int(environ['CONTENT_LENGTH']) >= 0, + "Invalid CONTENT_LENGTH: %r" % environ['CONTENT_LENGTH']) + + if not environ.get('SCRIPT_NAME'): + assert_('PATH_INFO' in environ, + "One of SCRIPT_NAME or PATH_INFO are required (PATH_INFO " + "should at least be '/' if SCRIPT_NAME is empty)") + assert_(environ.get('SCRIPT_NAME') != '/', + "SCRIPT_NAME cannot be '/'; it should instead be '', and " + "PATH_INFO should be '/'") + +def check_input(wsgi_input): + for attr in ['read', 'readline', 'readlines', '__iter__']: + assert_(hasattr(wsgi_input, attr), + "wsgi.input (%r) doesn't have the attribute %s" + % (wsgi_input, attr)) + +def check_errors(wsgi_errors): + for attr in ['flush', 'write', 'writelines']: + assert_(hasattr(wsgi_errors, attr), + "wsgi.errors (%r) doesn't have the attribute %s" + % (wsgi_errors, attr)) + +def check_status(status): + status = check_string_type(status, "Status") + # Implicitly check that we can turn it into an integer: + status_code = status.split(None, 1)[0] + assert_(len(status_code) == 3, + "Status codes must be three characters: %r" % status_code) + status_int = int(status_code) + assert_(status_int >= 100, "Status code is invalid: %r" % status_int) + if len(status) < 4 or status[3] != ' ': + warnings.warn( + "The status string (%r) should be a three-digit integer " + "followed by a single space and a status explanation" + % status, WSGIWarning) + +def check_headers(headers): + assert_(type(headers) is list, + "Headers (%r) must be of type list: %r" + % (headers, type(headers))) + for item in headers: + assert_(type(item) is tuple, + "Individual headers (%r) must be of type tuple: %r" + % (item, type(item))) + assert_(len(item) == 2) + name, value = item + name = check_string_type(name, "Header name") + value = check_string_type(value, "Header value") + assert_(name.lower() != 'status', + "The Status header cannot be used; it conflicts with CGI " + "script, and HTTP status is not given through headers " + "(value: %r)." % value) + assert_('\n' not in name and ':' not in name, + "Header names may not contain ':' or '\\n': %r" % name) + assert_(header_re.search(name), "Bad header name: %r" % name) + assert_(not name.endswith('-') and not name.endswith('_'), + "Names may not end in '-' or '_': %r" % name) + if bad_header_value_re.search(value): + assert_(0, "Bad header value: %r (bad char: %r)" + % (value, bad_header_value_re.search(value).group(0))) + +def check_content_type(status, headers): + status = check_string_type(status, "Status") + code = int(status.split(None, 1)[0]) + # @@: need one more person to verify this interpretation of RFC 2616 + # http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html + NO_MESSAGE_BODY = (204, 304) + for name, value in headers: + name = check_string_type(name, "Header name") + if name.lower() == 'content-type': + if code not in NO_MESSAGE_BODY: + return + assert_(0, ("Content-Type header found in a %s response, " + "which must not return content.") % code) + if code not in NO_MESSAGE_BODY: + assert_(0, "No Content-Type header found in headers (%s)" % headers) + +def check_exc_info(exc_info): + assert_(exc_info is None or type(exc_info) is tuple, + "exc_info (%r) is not a tuple: %r" % (exc_info, type(exc_info))) + # More exc_info checks? + +def check_iterator(iterator): + # Technically a bytestring is legal, which is why it's a really bad + # idea, because it may cause the response to be returned + # character-by-character + assert_(not isinstance(iterator, (str, bytes)), + "You should not return a string as your application iterator, " + "instead return a single-item list containing a bytestring.") diff --git a/miniconda3/envs/active_proaction/lib/python3.10/xml/__init__.py b/miniconda3/envs/active_proaction/lib/python3.10/xml/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..bf6d8ddfd04c934003004472d7f03bfa3f06b5f5 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/xml/__init__.py @@ -0,0 +1,20 @@ +"""Core XML support for Python. + +This package contains four sub-packages: + +dom -- The W3C Document Object Model. This supports DOM Level 1 + + Namespaces. + +parsers -- Python wrappers for XML parsers (currently only supports Expat). + +sax -- The Simple API for XML, developed by XML-Dev, led by David + Megginson and ported to Python by Lars Marius Garshol. This + supports the SAX 2 API. + +etree -- The ElementTree XML library. This is a subset of the full + ElementTree XML release. + +""" + + +__all__ = ["dom", "parsers", "sax", "etree"] diff --git a/miniconda3/envs/active_proaction/lib/python3.10/xml/dom/NodeFilter.py b/miniconda3/envs/active_proaction/lib/python3.10/xml/dom/NodeFilter.py new file mode 100644 index 0000000000000000000000000000000000000000..640e0bfd246ca5f9b61fd7ca79ad7b3e560a2a2d --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/xml/dom/NodeFilter.py @@ -0,0 +1,27 @@ +# This is the Python mapping for interface NodeFilter from +# DOM2-Traversal-Range. It contains only constants. + +class NodeFilter: + """ + This is the DOM2 NodeFilter interface. It contains only constants. + """ + FILTER_ACCEPT = 1 + FILTER_REJECT = 2 + FILTER_SKIP = 3 + + SHOW_ALL = 0xFFFFFFFF + SHOW_ELEMENT = 0x00000001 + SHOW_ATTRIBUTE = 0x00000002 + SHOW_TEXT = 0x00000004 + SHOW_CDATA_SECTION = 0x00000008 + SHOW_ENTITY_REFERENCE = 0x00000010 + SHOW_ENTITY = 0x00000020 + SHOW_PROCESSING_INSTRUCTION = 0x00000040 + SHOW_COMMENT = 0x00000080 + SHOW_DOCUMENT = 0x00000100 + SHOW_DOCUMENT_TYPE = 0x00000200 + SHOW_DOCUMENT_FRAGMENT = 0x00000400 + SHOW_NOTATION = 0x00000800 + + def acceptNode(self, node): + raise NotImplementedError diff --git a/miniconda3/envs/active_proaction/lib/python3.10/xml/dom/__init__.py b/miniconda3/envs/active_proaction/lib/python3.10/xml/dom/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..97cf9a6429993d97e26e1867b038d433055cf419 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/xml/dom/__init__.py @@ -0,0 +1,140 @@ +"""W3C Document Object Model implementation for Python. + +The Python mapping of the Document Object Model is documented in the +Python Library Reference in the section on the xml.dom package. + +This package contains the following modules: + +minidom -- A simple implementation of the Level 1 DOM with namespace + support added (based on the Level 2 specification) and other + minor Level 2 functionality. + +pulldom -- DOM builder supporting on-demand tree-building for selected + subtrees of the document. + +""" + + +class Node: + """Class giving the NodeType constants.""" + __slots__ = () + + # DOM implementations may use this as a base class for their own + # Node implementations. If they don't, the constants defined here + # should still be used as the canonical definitions as they match + # the values given in the W3C recommendation. Client code can + # safely refer to these values in all tests of Node.nodeType + # values. + + ELEMENT_NODE = 1 + ATTRIBUTE_NODE = 2 + TEXT_NODE = 3 + CDATA_SECTION_NODE = 4 + ENTITY_REFERENCE_NODE = 5 + ENTITY_NODE = 6 + PROCESSING_INSTRUCTION_NODE = 7 + COMMENT_NODE = 8 + DOCUMENT_NODE = 9 + DOCUMENT_TYPE_NODE = 10 + DOCUMENT_FRAGMENT_NODE = 11 + NOTATION_NODE = 12 + + +#ExceptionCode +INDEX_SIZE_ERR = 1 +DOMSTRING_SIZE_ERR = 2 +HIERARCHY_REQUEST_ERR = 3 +WRONG_DOCUMENT_ERR = 4 +INVALID_CHARACTER_ERR = 5 +NO_DATA_ALLOWED_ERR = 6 +NO_MODIFICATION_ALLOWED_ERR = 7 +NOT_FOUND_ERR = 8 +NOT_SUPPORTED_ERR = 9 +INUSE_ATTRIBUTE_ERR = 10 +INVALID_STATE_ERR = 11 +SYNTAX_ERR = 12 +INVALID_MODIFICATION_ERR = 13 +NAMESPACE_ERR = 14 +INVALID_ACCESS_ERR = 15 +VALIDATION_ERR = 16 + + +class DOMException(Exception): + """Abstract base class for DOM exceptions. + Exceptions with specific codes are specializations of this class.""" + + def __init__(self, *args, **kw): + if self.__class__ is DOMException: + raise RuntimeError( + "DOMException should not be instantiated directly") + Exception.__init__(self, *args, **kw) + + def _get_code(self): + return self.code + + +class IndexSizeErr(DOMException): + code = INDEX_SIZE_ERR + +class DomstringSizeErr(DOMException): + code = DOMSTRING_SIZE_ERR + +class HierarchyRequestErr(DOMException): + code = HIERARCHY_REQUEST_ERR + +class WrongDocumentErr(DOMException): + code = WRONG_DOCUMENT_ERR + +class InvalidCharacterErr(DOMException): + code = INVALID_CHARACTER_ERR + +class NoDataAllowedErr(DOMException): + code = NO_DATA_ALLOWED_ERR + +class NoModificationAllowedErr(DOMException): + code = NO_MODIFICATION_ALLOWED_ERR + +class NotFoundErr(DOMException): + code = NOT_FOUND_ERR + +class NotSupportedErr(DOMException): + code = NOT_SUPPORTED_ERR + +class InuseAttributeErr(DOMException): + code = INUSE_ATTRIBUTE_ERR + +class InvalidStateErr(DOMException): + code = INVALID_STATE_ERR + +class SyntaxErr(DOMException): + code = SYNTAX_ERR + +class InvalidModificationErr(DOMException): + code = INVALID_MODIFICATION_ERR + +class NamespaceErr(DOMException): + code = NAMESPACE_ERR + +class InvalidAccessErr(DOMException): + code = INVALID_ACCESS_ERR + +class ValidationErr(DOMException): + code = VALIDATION_ERR + +class UserDataHandler: + """Class giving the operation constants for UserDataHandler.handle().""" + + # Based on DOM Level 3 (WD 9 April 2002) + + NODE_CLONED = 1 + NODE_IMPORTED = 2 + NODE_DELETED = 3 + NODE_RENAMED = 4 + +XML_NAMESPACE = "http://www.w3.org/XML/1998/namespace" +XMLNS_NAMESPACE = "http://www.w3.org/2000/xmlns/" +XHTML_NAMESPACE = "http://www.w3.org/1999/xhtml" +EMPTY_NAMESPACE = None +EMPTY_PREFIX = None + +from .domreg import getDOMImplementation, registerDOMImplementation diff --git a/miniconda3/envs/active_proaction/lib/python3.10/xml/dom/domreg.py b/miniconda3/envs/active_proaction/lib/python3.10/xml/dom/domreg.py new file mode 100644 index 0000000000000000000000000000000000000000..69c17eebb265daad3243e62018409d72942a93af --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/xml/dom/domreg.py @@ -0,0 +1,99 @@ +"""Registration facilities for DOM. This module should not be used +directly. Instead, the functions getDOMImplementation and +registerDOMImplementation should be imported from xml.dom.""" + +# This is a list of well-known implementations. Well-known names +# should be published by posting to xml-sig@python.org, and are +# subsequently recorded in this file. + +import sys + +well_known_implementations = { + 'minidom':'xml.dom.minidom', + '4DOM': 'xml.dom.DOMImplementation', + } + +# DOM implementations not officially registered should register +# themselves with their + +registered = {} + +def registerDOMImplementation(name, factory): + """registerDOMImplementation(name, factory) + + Register the factory function with the name. The factory function + should return an object which implements the DOMImplementation + interface. The factory function can either return the same object, + or a new one (e.g. if that implementation supports some + customization).""" + + registered[name] = factory + +def _good_enough(dom, features): + "_good_enough(dom, features) -> Return 1 if the dom offers the features" + for f,v in features: + if not dom.hasFeature(f,v): + return 0 + return 1 + +def getDOMImplementation(name=None, features=()): + """getDOMImplementation(name = None, features = ()) -> DOM implementation. + + Return a suitable DOM implementation. The name is either + well-known, the module name of a DOM implementation, or None. If + it is not None, imports the corresponding module and returns + DOMImplementation object if the import succeeds. + + If name is not given, consider the available implementations to + find one with the required feature set. If no implementation can + be found, raise an ImportError. The features list must be a sequence + of (feature, version) pairs which are passed to hasFeature.""" + + import os + creator = None + mod = well_known_implementations.get(name) + if mod: + mod = __import__(mod, {}, {}, ['getDOMImplementation']) + return mod.getDOMImplementation() + elif name: + return registered[name]() + elif not sys.flags.ignore_environment and "PYTHON_DOM" in os.environ: + return getDOMImplementation(name = os.environ["PYTHON_DOM"]) + + # User did not specify a name, try implementations in arbitrary + # order, returning the one that has the required features + if isinstance(features, str): + features = _parse_feature_string(features) + for creator in registered.values(): + dom = creator() + if _good_enough(dom, features): + return dom + + for creator in well_known_implementations.keys(): + try: + dom = getDOMImplementation(name = creator) + except Exception: # typically ImportError, or AttributeError + continue + if _good_enough(dom, features): + return dom + + raise ImportError("no suitable DOM implementation found") + +def _parse_feature_string(s): + features = [] + parts = s.split() + i = 0 + length = len(parts) + while i < length: + feature = parts[i] + if feature[0] in "0123456789": + raise ValueError("bad feature name: %r" % (feature,)) + i = i + 1 + version = None + if i < length: + v = parts[i] + if v[0] in "0123456789": + i = i + 1 + version = v + features.append((feature, version)) + return tuple(features) diff --git a/miniconda3/envs/active_proaction/lib/python3.10/xml/dom/expatbuilder.py b/miniconda3/envs/active_proaction/lib/python3.10/xml/dom/expatbuilder.py new file mode 100644 index 0000000000000000000000000000000000000000..199c22d0af347e15bf53005f74b5359ce0f0e904 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/xml/dom/expatbuilder.py @@ -0,0 +1,965 @@ +"""Facility to use the Expat parser to load a minidom instance +from a string or file. + +This avoids all the overhead of SAX and pulldom to gain performance. +""" + +# Warning! +# +# This module is tightly bound to the implementation details of the +# minidom DOM and can't be used with other DOM implementations. This +# is due, in part, to a lack of appropriate methods in the DOM (there is +# no way to create Entity and Notation nodes via the DOM Level 2 +# interface), and for performance. The latter is the cause of some fairly +# cryptic code. +# +# Performance hacks: +# +# - .character_data_handler() has an extra case in which continuing +# data is appended to an existing Text node; this can be a +# speedup since pyexpat can break up character data into multiple +# callbacks even though we set the buffer_text attribute on the +# parser. This also gives us the advantage that we don't need a +# separate normalization pass. +# +# - Determining that a node exists is done using an identity comparison +# with None rather than a truth test; this avoids searching for and +# calling any methods on the node object if it exists. (A rather +# nice speedup is achieved this way as well!) + +from xml.dom import xmlbuilder, minidom, Node +from xml.dom import EMPTY_NAMESPACE, EMPTY_PREFIX, XMLNS_NAMESPACE +from xml.parsers import expat +from xml.dom.minidom import _append_child, _set_attribute_node +from xml.dom.NodeFilter import NodeFilter + +TEXT_NODE = Node.TEXT_NODE +CDATA_SECTION_NODE = Node.CDATA_SECTION_NODE +DOCUMENT_NODE = Node.DOCUMENT_NODE + +FILTER_ACCEPT = xmlbuilder.DOMBuilderFilter.FILTER_ACCEPT +FILTER_REJECT = xmlbuilder.DOMBuilderFilter.FILTER_REJECT +FILTER_SKIP = xmlbuilder.DOMBuilderFilter.FILTER_SKIP +FILTER_INTERRUPT = xmlbuilder.DOMBuilderFilter.FILTER_INTERRUPT + +theDOMImplementation = minidom.getDOMImplementation() + +# Expat typename -> TypeInfo +_typeinfo_map = { + "CDATA": minidom.TypeInfo(None, "cdata"), + "ENUM": minidom.TypeInfo(None, "enumeration"), + "ENTITY": minidom.TypeInfo(None, "entity"), + "ENTITIES": minidom.TypeInfo(None, "entities"), + "ID": minidom.TypeInfo(None, "id"), + "IDREF": minidom.TypeInfo(None, "idref"), + "IDREFS": minidom.TypeInfo(None, "idrefs"), + "NMTOKEN": minidom.TypeInfo(None, "nmtoken"), + "NMTOKENS": minidom.TypeInfo(None, "nmtokens"), + } + +class ElementInfo(object): + __slots__ = '_attr_info', '_model', 'tagName' + + def __init__(self, tagName, model=None): + self.tagName = tagName + self._attr_info = [] + self._model = model + + def __getstate__(self): + return self._attr_info, self._model, self.tagName + + def __setstate__(self, state): + self._attr_info, self._model, self.tagName = state + + def getAttributeType(self, aname): + for info in self._attr_info: + if info[1] == aname: + t = info[-2] + if t[0] == "(": + return _typeinfo_map["ENUM"] + else: + return _typeinfo_map[info[-2]] + return minidom._no_type + + def getAttributeTypeNS(self, namespaceURI, localName): + return minidom._no_type + + def isElementContent(self): + if self._model: + type = self._model[0] + return type not in (expat.model.XML_CTYPE_ANY, + expat.model.XML_CTYPE_MIXED) + else: + return False + + def isEmpty(self): + if self._model: + return self._model[0] == expat.model.XML_CTYPE_EMPTY + else: + return False + + def isId(self, aname): + for info in self._attr_info: + if info[1] == aname: + return info[-2] == "ID" + return False + + def isIdNS(self, euri, ename, auri, aname): + # not sure this is meaningful + return self.isId((auri, aname)) + +def _intern(builder, s): + return builder._intern_setdefault(s, s) + +def _parse_ns_name(builder, name): + assert ' ' in name + parts = name.split(' ') + intern = builder._intern_setdefault + if len(parts) == 3: + uri, localname, prefix = parts + prefix = intern(prefix, prefix) + qname = "%s:%s" % (prefix, localname) + qname = intern(qname, qname) + localname = intern(localname, localname) + elif len(parts) == 2: + uri, localname = parts + prefix = EMPTY_PREFIX + qname = localname = intern(localname, localname) + else: + raise ValueError("Unsupported syntax: spaces in URIs not supported: %r" % name) + return intern(uri, uri), localname, prefix, qname + + +class ExpatBuilder: + """Document builder that uses Expat to build a ParsedXML.DOM document + instance.""" + + def __init__(self, options=None): + if options is None: + options = xmlbuilder.Options() + self._options = options + if self._options.filter is not None: + self._filter = FilterVisibilityController(self._options.filter) + else: + self._filter = None + # This *really* doesn't do anything in this case, so + # override it with something fast & minimal. + self._finish_start_element = id + self._parser = None + self.reset() + + def createParser(self): + """Create a new parser object.""" + return expat.ParserCreate() + + def getParser(self): + """Return the parser object, creating a new one if needed.""" + if not self._parser: + self._parser = self.createParser() + self._intern_setdefault = self._parser.intern.setdefault + self._parser.buffer_text = True + self._parser.ordered_attributes = True + self._parser.specified_attributes = True + self.install(self._parser) + return self._parser + + def reset(self): + """Free all data structures used during DOM construction.""" + self.document = theDOMImplementation.createDocument( + EMPTY_NAMESPACE, None, None) + self.curNode = self.document + self._elem_info = self.document._elem_info + self._cdata = False + + def install(self, parser): + """Install the callbacks needed to build the DOM into the parser.""" + # This creates circular references! + parser.StartDoctypeDeclHandler = self.start_doctype_decl_handler + parser.StartElementHandler = self.first_element_handler + parser.EndElementHandler = self.end_element_handler + parser.ProcessingInstructionHandler = self.pi_handler + if self._options.entities: + parser.EntityDeclHandler = self.entity_decl_handler + parser.NotationDeclHandler = self.notation_decl_handler + if self._options.comments: + parser.CommentHandler = self.comment_handler + if self._options.cdata_sections: + parser.StartCdataSectionHandler = self.start_cdata_section_handler + parser.EndCdataSectionHandler = self.end_cdata_section_handler + parser.CharacterDataHandler = self.character_data_handler_cdata + else: + parser.CharacterDataHandler = self.character_data_handler + parser.ExternalEntityRefHandler = self.external_entity_ref_handler + parser.XmlDeclHandler = self.xml_decl_handler + parser.ElementDeclHandler = self.element_decl_handler + parser.AttlistDeclHandler = self.attlist_decl_handler + + def parseFile(self, file): + """Parse a document from a file object, returning the document + node.""" + parser = self.getParser() + first_buffer = True + try: + while 1: + buffer = file.read(16*1024) + if not buffer: + break + parser.Parse(buffer, False) + if first_buffer and self.document.documentElement: + self._setup_subset(buffer) + first_buffer = False + parser.Parse(b"", True) + except ParseEscape: + pass + doc = self.document + self.reset() + self._parser = None + return doc + + def parseString(self, string): + """Parse a document from a string, returning the document node.""" + parser = self.getParser() + try: + parser.Parse(string, True) + self._setup_subset(string) + except ParseEscape: + pass + doc = self.document + self.reset() + self._parser = None + return doc + + def _setup_subset(self, buffer): + """Load the internal subset if there might be one.""" + if self.document.doctype: + extractor = InternalSubsetExtractor() + extractor.parseString(buffer) + subset = extractor.getSubset() + self.document.doctype.internalSubset = subset + + def start_doctype_decl_handler(self, doctypeName, systemId, publicId, + has_internal_subset): + doctype = self.document.implementation.createDocumentType( + doctypeName, publicId, systemId) + doctype.ownerDocument = self.document + _append_child(self.document, doctype) + self.document.doctype = doctype + if self._filter and self._filter.acceptNode(doctype) == FILTER_REJECT: + self.document.doctype = None + del self.document.childNodes[-1] + doctype = None + self._parser.EntityDeclHandler = None + self._parser.NotationDeclHandler = None + if has_internal_subset: + if doctype is not None: + doctype.entities._seq = [] + doctype.notations._seq = [] + self._parser.CommentHandler = None + self._parser.ProcessingInstructionHandler = None + self._parser.EndDoctypeDeclHandler = self.end_doctype_decl_handler + + def end_doctype_decl_handler(self): + if self._options.comments: + self._parser.CommentHandler = self.comment_handler + self._parser.ProcessingInstructionHandler = self.pi_handler + if not (self._elem_info or self._filter): + self._finish_end_element = id + + def pi_handler(self, target, data): + node = self.document.createProcessingInstruction(target, data) + _append_child(self.curNode, node) + if self._filter and self._filter.acceptNode(node) == FILTER_REJECT: + self.curNode.removeChild(node) + + def character_data_handler_cdata(self, data): + childNodes = self.curNode.childNodes + if self._cdata: + if ( self._cdata_continue + and childNodes[-1].nodeType == CDATA_SECTION_NODE): + childNodes[-1].appendData(data) + return + node = self.document.createCDATASection(data) + self._cdata_continue = True + elif childNodes and childNodes[-1].nodeType == TEXT_NODE: + node = childNodes[-1] + value = node.data + data + node.data = value + return + else: + node = minidom.Text() + node.data = data + node.ownerDocument = self.document + _append_child(self.curNode, node) + + def character_data_handler(self, data): + childNodes = self.curNode.childNodes + if childNodes and childNodes[-1].nodeType == TEXT_NODE: + node = childNodes[-1] + node.data = node.data + data + return + node = minidom.Text() + node.data = node.data + data + node.ownerDocument = self.document + _append_child(self.curNode, node) + + def entity_decl_handler(self, entityName, is_parameter_entity, value, + base, systemId, publicId, notationName): + if is_parameter_entity: + # we don't care about parameter entities for the DOM + return + if not self._options.entities: + return + node = self.document._create_entity(entityName, publicId, + systemId, notationName) + if value is not None: + # internal entity + # node *should* be readonly, but we'll cheat + child = self.document.createTextNode(value) + node.childNodes.append(child) + self.document.doctype.entities._seq.append(node) + if self._filter and self._filter.acceptNode(node) == FILTER_REJECT: + del self.document.doctype.entities._seq[-1] + + def notation_decl_handler(self, notationName, base, systemId, publicId): + node = self.document._create_notation(notationName, publicId, systemId) + self.document.doctype.notations._seq.append(node) + if self._filter and self._filter.acceptNode(node) == FILTER_ACCEPT: + del self.document.doctype.notations._seq[-1] + + def comment_handler(self, data): + node = self.document.createComment(data) + _append_child(self.curNode, node) + if self._filter and self._filter.acceptNode(node) == FILTER_REJECT: + self.curNode.removeChild(node) + + def start_cdata_section_handler(self): + self._cdata = True + self._cdata_continue = False + + def end_cdata_section_handler(self): + self._cdata = False + self._cdata_continue = False + + def external_entity_ref_handler(self, context, base, systemId, publicId): + return 1 + + def first_element_handler(self, name, attributes): + if self._filter is None and not self._elem_info: + self._finish_end_element = id + self.getParser().StartElementHandler = self.start_element_handler + self.start_element_handler(name, attributes) + + def start_element_handler(self, name, attributes): + node = self.document.createElement(name) + _append_child(self.curNode, node) + self.curNode = node + + if attributes: + for i in range(0, len(attributes), 2): + a = minidom.Attr(attributes[i], EMPTY_NAMESPACE, + None, EMPTY_PREFIX) + value = attributes[i+1] + a.value = value + a.ownerDocument = self.document + _set_attribute_node(node, a) + + if node is not self.document.documentElement: + self._finish_start_element(node) + + def _finish_start_element(self, node): + if self._filter: + # To be general, we'd have to call isSameNode(), but this + # is sufficient for minidom: + if node is self.document.documentElement: + return + filt = self._filter.startContainer(node) + if filt == FILTER_REJECT: + # ignore this node & all descendents + Rejecter(self) + elif filt == FILTER_SKIP: + # ignore this node, but make it's children become + # children of the parent node + Skipper(self) + else: + return + self.curNode = node.parentNode + node.parentNode.removeChild(node) + node.unlink() + + # If this ever changes, Namespaces.end_element_handler() needs to + # be changed to match. + # + def end_element_handler(self, name): + curNode = self.curNode + self.curNode = curNode.parentNode + self._finish_end_element(curNode) + + def _finish_end_element(self, curNode): + info = self._elem_info.get(curNode.tagName) + if info: + self._handle_white_text_nodes(curNode, info) + if self._filter: + if curNode is self.document.documentElement: + return + if self._filter.acceptNode(curNode) == FILTER_REJECT: + self.curNode.removeChild(curNode) + curNode.unlink() + + def _handle_white_text_nodes(self, node, info): + if (self._options.whitespace_in_element_content + or not info.isElementContent()): + return + + # We have element type information and should remove ignorable + # whitespace; identify for text nodes which contain only + # whitespace. + L = [] + for child in node.childNodes: + if child.nodeType == TEXT_NODE and not child.data.strip(): + L.append(child) + + # Remove ignorable whitespace from the tree. + for child in L: + node.removeChild(child) + + def element_decl_handler(self, name, model): + info = self._elem_info.get(name) + if info is None: + self._elem_info[name] = ElementInfo(name, model) + else: + assert info._model is None + info._model = model + + def attlist_decl_handler(self, elem, name, type, default, required): + info = self._elem_info.get(elem) + if info is None: + info = ElementInfo(elem) + self._elem_info[elem] = info + info._attr_info.append( + [None, name, None, None, default, 0, type, required]) + + def xml_decl_handler(self, version, encoding, standalone): + self.document.version = version + self.document.encoding = encoding + # This is still a little ugly, thanks to the pyexpat API. ;-( + if standalone >= 0: + if standalone: + self.document.standalone = True + else: + self.document.standalone = False + + +# Don't include FILTER_INTERRUPT, since that's checked separately +# where allowed. +_ALLOWED_FILTER_RETURNS = (FILTER_ACCEPT, FILTER_REJECT, FILTER_SKIP) + +class FilterVisibilityController(object): + """Wrapper around a DOMBuilderFilter which implements the checks + to make the whatToShow filter attribute work.""" + + __slots__ = 'filter', + + def __init__(self, filter): + self.filter = filter + + def startContainer(self, node): + mask = self._nodetype_mask[node.nodeType] + if self.filter.whatToShow & mask: + val = self.filter.startContainer(node) + if val == FILTER_INTERRUPT: + raise ParseEscape + if val not in _ALLOWED_FILTER_RETURNS: + raise ValueError( + "startContainer() returned illegal value: " + repr(val)) + return val + else: + return FILTER_ACCEPT + + def acceptNode(self, node): + mask = self._nodetype_mask[node.nodeType] + if self.filter.whatToShow & mask: + val = self.filter.acceptNode(node) + if val == FILTER_INTERRUPT: + raise ParseEscape + if val == FILTER_SKIP: + # move all child nodes to the parent, and remove this node + parent = node.parentNode + for child in node.childNodes[:]: + parent.appendChild(child) + # node is handled by the caller + return FILTER_REJECT + if val not in _ALLOWED_FILTER_RETURNS: + raise ValueError( + "acceptNode() returned illegal value: " + repr(val)) + return val + else: + return FILTER_ACCEPT + + _nodetype_mask = { + Node.ELEMENT_NODE: NodeFilter.SHOW_ELEMENT, + Node.ATTRIBUTE_NODE: NodeFilter.SHOW_ATTRIBUTE, + Node.TEXT_NODE: NodeFilter.SHOW_TEXT, + Node.CDATA_SECTION_NODE: NodeFilter.SHOW_CDATA_SECTION, + Node.ENTITY_REFERENCE_NODE: NodeFilter.SHOW_ENTITY_REFERENCE, + Node.ENTITY_NODE: NodeFilter.SHOW_ENTITY, + Node.PROCESSING_INSTRUCTION_NODE: NodeFilter.SHOW_PROCESSING_INSTRUCTION, + Node.COMMENT_NODE: NodeFilter.SHOW_COMMENT, + Node.DOCUMENT_NODE: NodeFilter.SHOW_DOCUMENT, + Node.DOCUMENT_TYPE_NODE: NodeFilter.SHOW_DOCUMENT_TYPE, + Node.DOCUMENT_FRAGMENT_NODE: NodeFilter.SHOW_DOCUMENT_FRAGMENT, + Node.NOTATION_NODE: NodeFilter.SHOW_NOTATION, + } + + +class FilterCrutch(object): + __slots__ = '_builder', '_level', '_old_start', '_old_end' + + def __init__(self, builder): + self._level = 0 + self._builder = builder + parser = builder._parser + self._old_start = parser.StartElementHandler + self._old_end = parser.EndElementHandler + parser.StartElementHandler = self.start_element_handler + parser.EndElementHandler = self.end_element_handler + +class Rejecter(FilterCrutch): + __slots__ = () + + def __init__(self, builder): + FilterCrutch.__init__(self, builder) + parser = builder._parser + for name in ("ProcessingInstructionHandler", + "CommentHandler", + "CharacterDataHandler", + "StartCdataSectionHandler", + "EndCdataSectionHandler", + "ExternalEntityRefHandler", + ): + setattr(parser, name, None) + + def start_element_handler(self, *args): + self._level = self._level + 1 + + def end_element_handler(self, *args): + if self._level == 0: + # restore the old handlers + parser = self._builder._parser + self._builder.install(parser) + parser.StartElementHandler = self._old_start + parser.EndElementHandler = self._old_end + else: + self._level = self._level - 1 + +class Skipper(FilterCrutch): + __slots__ = () + + def start_element_handler(self, *args): + node = self._builder.curNode + self._old_start(*args) + if self._builder.curNode is not node: + self._level = self._level + 1 + + def end_element_handler(self, *args): + if self._level == 0: + # We're popping back out of the node we're skipping, so we + # shouldn't need to do anything but reset the handlers. + self._builder._parser.StartElementHandler = self._old_start + self._builder._parser.EndElementHandler = self._old_end + self._builder = None + else: + self._level = self._level - 1 + self._old_end(*args) + + +# framework document used by the fragment builder. +# Takes a string for the doctype, subset string, and namespace attrs string. + +_FRAGMENT_BUILDER_INTERNAL_SYSTEM_ID = \ + "http://xml.python.org/entities/fragment-builder/internal" + +_FRAGMENT_BUILDER_TEMPLATE = ( + '''\ + +%%s +]> +&fragment-builder-internal;''' + % _FRAGMENT_BUILDER_INTERNAL_SYSTEM_ID) + + +class FragmentBuilder(ExpatBuilder): + """Builder which constructs document fragments given XML source + text and a context node. + + The context node is expected to provide information about the + namespace declarations which are in scope at the start of the + fragment. + """ + + def __init__(self, context, options=None): + if context.nodeType == DOCUMENT_NODE: + self.originalDocument = context + self.context = context + else: + self.originalDocument = context.ownerDocument + self.context = context + ExpatBuilder.__init__(self, options) + + def reset(self): + ExpatBuilder.reset(self) + self.fragment = None + + def parseFile(self, file): + """Parse a document fragment from a file object, returning the + fragment node.""" + return self.parseString(file.read()) + + def parseString(self, string): + """Parse a document fragment from a string, returning the + fragment node.""" + self._source = string + parser = self.getParser() + doctype = self.originalDocument.doctype + ident = "" + if doctype: + subset = doctype.internalSubset or self._getDeclarations() + if doctype.publicId: + ident = ('PUBLIC "%s" "%s"' + % (doctype.publicId, doctype.systemId)) + elif doctype.systemId: + ident = 'SYSTEM "%s"' % doctype.systemId + else: + subset = "" + nsattrs = self._getNSattrs() # get ns decls from node's ancestors + document = _FRAGMENT_BUILDER_TEMPLATE % (ident, subset, nsattrs) + try: + parser.Parse(document, True) + except: + self.reset() + raise + fragment = self.fragment + self.reset() +## self._parser = None + return fragment + + def _getDeclarations(self): + """Re-create the internal subset from the DocumentType node. + + This is only needed if we don't already have the + internalSubset as a string. + """ + doctype = self.context.ownerDocument.doctype + s = "" + if doctype: + for i in range(doctype.notations.length): + notation = doctype.notations.item(i) + if s: + s = s + "\n " + s = "%s' \ + % (s, notation.publicId, notation.systemId) + else: + s = '%s SYSTEM "%s">' % (s, notation.systemId) + for i in range(doctype.entities.length): + entity = doctype.entities.item(i) + if s: + s = s + "\n " + s = "%s" + return s + + def _getNSattrs(self): + return "" + + def external_entity_ref_handler(self, context, base, systemId, publicId): + if systemId == _FRAGMENT_BUILDER_INTERNAL_SYSTEM_ID: + # this entref is the one that we made to put the subtree + # in; all of our given input is parsed in here. + old_document = self.document + old_cur_node = self.curNode + parser = self._parser.ExternalEntityParserCreate(context) + # put the real document back, parse into the fragment to return + self.document = self.originalDocument + self.fragment = self.document.createDocumentFragment() + self.curNode = self.fragment + try: + parser.Parse(self._source, True) + finally: + self.curNode = old_cur_node + self.document = old_document + self._source = None + return -1 + else: + return ExpatBuilder.external_entity_ref_handler( + self, context, base, systemId, publicId) + + +class Namespaces: + """Mix-in class for builders; adds support for namespaces.""" + + def _initNamespaces(self): + # list of (prefix, uri) ns declarations. Namespace attrs are + # constructed from this and added to the element's attrs. + self._ns_ordered_prefixes = [] + + def createParser(self): + """Create a new namespace-handling parser.""" + parser = expat.ParserCreate(namespace_separator=" ") + parser.namespace_prefixes = True + return parser + + def install(self, parser): + """Insert the namespace-handlers onto the parser.""" + ExpatBuilder.install(self, parser) + if self._options.namespace_declarations: + parser.StartNamespaceDeclHandler = ( + self.start_namespace_decl_handler) + + def start_namespace_decl_handler(self, prefix, uri): + """Push this namespace declaration on our storage.""" + self._ns_ordered_prefixes.append((prefix, uri)) + + def start_element_handler(self, name, attributes): + if ' ' in name: + uri, localname, prefix, qname = _parse_ns_name(self, name) + else: + uri = EMPTY_NAMESPACE + qname = name + localname = None + prefix = EMPTY_PREFIX + node = minidom.Element(qname, uri, prefix, localname) + node.ownerDocument = self.document + _append_child(self.curNode, node) + self.curNode = node + + if self._ns_ordered_prefixes: + for prefix, uri in self._ns_ordered_prefixes: + if prefix: + a = minidom.Attr(_intern(self, 'xmlns:' + prefix), + XMLNS_NAMESPACE, prefix, "xmlns") + else: + a = minidom.Attr("xmlns", XMLNS_NAMESPACE, + "xmlns", EMPTY_PREFIX) + a.value = uri + a.ownerDocument = self.document + _set_attribute_node(node, a) + del self._ns_ordered_prefixes[:] + + if attributes: + node._ensure_attributes() + _attrs = node._attrs + _attrsNS = node._attrsNS + for i in range(0, len(attributes), 2): + aname = attributes[i] + value = attributes[i+1] + if ' ' in aname: + uri, localname, prefix, qname = _parse_ns_name(self, aname) + a = minidom.Attr(qname, uri, localname, prefix) + _attrs[qname] = a + _attrsNS[(uri, localname)] = a + else: + a = minidom.Attr(aname, EMPTY_NAMESPACE, + aname, EMPTY_PREFIX) + _attrs[aname] = a + _attrsNS[(EMPTY_NAMESPACE, aname)] = a + a.ownerDocument = self.document + a.value = value + a.ownerElement = node + + if __debug__: + # This only adds some asserts to the original + # end_element_handler(), so we only define this when -O is not + # used. If changing one, be sure to check the other to see if + # it needs to be changed as well. + # + def end_element_handler(self, name): + curNode = self.curNode + if ' ' in name: + uri, localname, prefix, qname = _parse_ns_name(self, name) + assert (curNode.namespaceURI == uri + and curNode.localName == localname + and curNode.prefix == prefix), \ + "element stack messed up! (namespace)" + else: + assert curNode.nodeName == name, \ + "element stack messed up - bad nodeName" + assert curNode.namespaceURI == EMPTY_NAMESPACE, \ + "element stack messed up - bad namespaceURI" + self.curNode = curNode.parentNode + self._finish_end_element(curNode) + + +class ExpatBuilderNS(Namespaces, ExpatBuilder): + """Document builder that supports namespaces.""" + + def reset(self): + ExpatBuilder.reset(self) + self._initNamespaces() + + +class FragmentBuilderNS(Namespaces, FragmentBuilder): + """Fragment builder that supports namespaces.""" + + def reset(self): + FragmentBuilder.reset(self) + self._initNamespaces() + + def _getNSattrs(self): + """Return string of namespace attributes from this element and + ancestors.""" + # XXX This needs to be re-written to walk the ancestors of the + # context to build up the namespace information from + # declarations, elements, and attributes found in context. + # Otherwise we have to store a bunch more data on the DOM + # (though that *might* be more reliable -- not clear). + attrs = "" + context = self.context + L = [] + while context: + if hasattr(context, '_ns_prefix_uri'): + for prefix, uri in context._ns_prefix_uri.items(): + # add every new NS decl from context to L and attrs string + if prefix in L: + continue + L.append(prefix) + if prefix: + declname = "xmlns:" + prefix + else: + declname = "xmlns" + if attrs: + attrs = "%s\n %s='%s'" % (attrs, declname, uri) + else: + attrs = " %s='%s'" % (declname, uri) + context = context.parentNode + return attrs + + +class ParseEscape(Exception): + """Exception raised to short-circuit parsing in InternalSubsetExtractor.""" + pass + +class InternalSubsetExtractor(ExpatBuilder): + """XML processor which can rip out the internal document type subset.""" + + subset = None + + def getSubset(self): + """Return the internal subset as a string.""" + return self.subset + + def parseFile(self, file): + try: + ExpatBuilder.parseFile(self, file) + except ParseEscape: + pass + + def parseString(self, string): + try: + ExpatBuilder.parseString(self, string) + except ParseEscape: + pass + + def install(self, parser): + parser.StartDoctypeDeclHandler = self.start_doctype_decl_handler + parser.StartElementHandler = self.start_element_handler + + def start_doctype_decl_handler(self, name, publicId, systemId, + has_internal_subset): + if has_internal_subset: + parser = self.getParser() + self.subset = [] + parser.DefaultHandler = self.subset.append + parser.EndDoctypeDeclHandler = self.end_doctype_decl_handler + else: + raise ParseEscape() + + def end_doctype_decl_handler(self): + s = ''.join(self.subset).replace('\r\n', '\n').replace('\r', '\n') + self.subset = s + raise ParseEscape() + + def start_element_handler(self, name, attrs): + raise ParseEscape() + + +def parse(file, namespaces=True): + """Parse a document, returning the resulting Document node. + + 'file' may be either a file name or an open file object. + """ + if namespaces: + builder = ExpatBuilderNS() + else: + builder = ExpatBuilder() + + if isinstance(file, str): + with open(file, 'rb') as fp: + result = builder.parseFile(fp) + else: + result = builder.parseFile(file) + return result + + +def parseString(string, namespaces=True): + """Parse a document from a string, returning the resulting + Document node. + """ + if namespaces: + builder = ExpatBuilderNS() + else: + builder = ExpatBuilder() + return builder.parseString(string) + + +def parseFragment(file, context, namespaces=True): + """Parse a fragment of a document, given the context from which it + was originally extracted. context should be the parent of the + node(s) which are in the fragment. + + 'file' may be either a file name or an open file object. + """ + if namespaces: + builder = FragmentBuilderNS(context) + else: + builder = FragmentBuilder(context) + + if isinstance(file, str): + with open(file, 'rb') as fp: + result = builder.parseFile(fp) + else: + result = builder.parseFile(file) + return result + + +def parseFragmentString(string, context, namespaces=True): + """Parse a fragment of a document from a string, given the context + from which it was originally extracted. context should be the + parent of the node(s) which are in the fragment. + """ + if namespaces: + builder = FragmentBuilderNS(context) + else: + builder = FragmentBuilder(context) + return builder.parseString(string) + + +def makeBuilder(options): + """Create a builder based on an Options object.""" + if options.namespaces: + return ExpatBuilderNS(options) + else: + return ExpatBuilder(options) diff --git a/miniconda3/envs/active_proaction/lib/python3.10/xml/dom/minicompat.py b/miniconda3/envs/active_proaction/lib/python3.10/xml/dom/minicompat.py new file mode 100644 index 0000000000000000000000000000000000000000..5d6fae9a2575bf502999b3c59aeecb7b93a37385 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/xml/dom/minicompat.py @@ -0,0 +1,109 @@ +"""Python version compatibility support for minidom. + +This module contains internal implementation details and +should not be imported; use xml.dom.minidom instead. +""" + +# This module should only be imported using "import *". +# +# The following names are defined: +# +# NodeList -- lightest possible NodeList implementation +# +# EmptyNodeList -- lightest possible NodeList that is guaranteed to +# remain empty (immutable) +# +# StringTypes -- tuple of defined string types +# +# defproperty -- function used in conjunction with GetattrMagic; +# using these together is needed to make them work +# as efficiently as possible in both Python 2.2+ +# and older versions. For example: +# +# class MyClass(GetattrMagic): +# def _get_myattr(self): +# return something +# +# defproperty(MyClass, "myattr", +# "return some value") +# +# For Python 2.2 and newer, this will construct a +# property object on the class, which avoids +# needing to override __getattr__(). It will only +# work for read-only attributes. +# +# For older versions of Python, inheriting from +# GetattrMagic will use the traditional +# __getattr__() hackery to achieve the same effect, +# but less efficiently. +# +# defproperty() should be used for each version of +# the relevant _get_() function. + +__all__ = ["NodeList", "EmptyNodeList", "StringTypes", "defproperty"] + +import xml.dom + +StringTypes = (str,) + + +class NodeList(list): + __slots__ = () + + def item(self, index): + if 0 <= index < len(self): + return self[index] + + def _get_length(self): + return len(self) + + def _set_length(self, value): + raise xml.dom.NoModificationAllowedErr( + "attempt to modify read-only attribute 'length'") + + length = property(_get_length, _set_length, + doc="The number of nodes in the NodeList.") + + # For backward compatibility + def __setstate__(self, state): + if state is None: + state = [] + self[:] = state + + +class EmptyNodeList(tuple): + __slots__ = () + + def __add__(self, other): + NL = NodeList() + NL.extend(other) + return NL + + def __radd__(self, other): + NL = NodeList() + NL.extend(other) + return NL + + def item(self, index): + return None + + def _get_length(self): + return 0 + + def _set_length(self, value): + raise xml.dom.NoModificationAllowedErr( + "attempt to modify read-only attribute 'length'") + + length = property(_get_length, _set_length, + doc="The number of nodes in the NodeList.") + + +def defproperty(klass, name, doc): + get = getattr(klass, ("_get_" + name)) + def set(self, value, name=name): + raise xml.dom.NoModificationAllowedErr( + "attempt to modify read-only attribute " + repr(name)) + assert not hasattr(klass, "_set_" + name), \ + "expected not to find _set_" + name + prop = property(get, set, doc=doc) + setattr(klass, name, prop) diff --git a/miniconda3/envs/active_proaction/lib/python3.10/xml/dom/minidom.py b/miniconda3/envs/active_proaction/lib/python3.10/xml/dom/minidom.py new file mode 100644 index 0000000000000000000000000000000000000000..cada981f39f3ee979840b94257ca27747f9776b7 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/xml/dom/minidom.py @@ -0,0 +1,2008 @@ +"""Simple implementation of the Level 1 DOM. + +Namespaces and other minor Level 2 features are also supported. + +parse("foo.xml") + +parseString("") + +Todo: +===== + * convenience methods for getting elements and text. + * more testing + * bring some of the writer and linearizer code into conformance with this + interface + * SAX 2 namespaces +""" + +import io +import xml.dom + +from xml.dom import EMPTY_NAMESPACE, EMPTY_PREFIX, XMLNS_NAMESPACE, domreg +from xml.dom.minicompat import * +from xml.dom.xmlbuilder import DOMImplementationLS, DocumentLS + +# This is used by the ID-cache invalidation checks; the list isn't +# actually complete, since the nodes being checked will never be the +# DOCUMENT_NODE or DOCUMENT_FRAGMENT_NODE. (The node being checked is +# the node being added or removed, not the node being modified.) +# +_nodeTypes_with_children = (xml.dom.Node.ELEMENT_NODE, + xml.dom.Node.ENTITY_REFERENCE_NODE) + + +class Node(xml.dom.Node): + namespaceURI = None # this is non-null only for elements and attributes + parentNode = None + ownerDocument = None + nextSibling = None + previousSibling = None + + prefix = EMPTY_PREFIX # non-null only for NS elements and attributes + + def __bool__(self): + return True + + def toxml(self, encoding=None, standalone=None): + return self.toprettyxml("", "", encoding, standalone) + + def toprettyxml(self, indent="\t", newl="\n", encoding=None, + standalone=None): + if encoding is None: + writer = io.StringIO() + else: + writer = io.TextIOWrapper(io.BytesIO(), + encoding=encoding, + errors="xmlcharrefreplace", + newline='\n') + if self.nodeType == Node.DOCUMENT_NODE: + # Can pass encoding only to document, to put it into XML header + self.writexml(writer, "", indent, newl, encoding, standalone) + else: + self.writexml(writer, "", indent, newl) + if encoding is None: + return writer.getvalue() + else: + return writer.detach().getvalue() + + def hasChildNodes(self): + return bool(self.childNodes) + + def _get_childNodes(self): + return self.childNodes + + def _get_firstChild(self): + if self.childNodes: + return self.childNodes[0] + + def _get_lastChild(self): + if self.childNodes: + return self.childNodes[-1] + + def insertBefore(self, newChild, refChild): + if newChild.nodeType == self.DOCUMENT_FRAGMENT_NODE: + for c in tuple(newChild.childNodes): + self.insertBefore(c, refChild) + ### The DOM does not clearly specify what to return in this case + return newChild + if newChild.nodeType not in self._child_node_types: + raise xml.dom.HierarchyRequestErr( + "%s cannot be child of %s" % (repr(newChild), repr(self))) + if newChild.parentNode is not None: + newChild.parentNode.removeChild(newChild) + if refChild is None: + self.appendChild(newChild) + else: + try: + index = self.childNodes.index(refChild) + except ValueError: + raise xml.dom.NotFoundErr() + if newChild.nodeType in _nodeTypes_with_children: + _clear_id_cache(self) + self.childNodes.insert(index, newChild) + newChild.nextSibling = refChild + refChild.previousSibling = newChild + if index: + node = self.childNodes[index-1] + node.nextSibling = newChild + newChild.previousSibling = node + else: + newChild.previousSibling = None + newChild.parentNode = self + return newChild + + def appendChild(self, node): + if node.nodeType == self.DOCUMENT_FRAGMENT_NODE: + for c in tuple(node.childNodes): + self.appendChild(c) + ### The DOM does not clearly specify what to return in this case + return node + if node.nodeType not in self._child_node_types: + raise xml.dom.HierarchyRequestErr( + "%s cannot be child of %s" % (repr(node), repr(self))) + elif node.nodeType in _nodeTypes_with_children: + _clear_id_cache(self) + if node.parentNode is not None: + node.parentNode.removeChild(node) + _append_child(self, node) + node.nextSibling = None + return node + + def replaceChild(self, newChild, oldChild): + if newChild.nodeType == self.DOCUMENT_FRAGMENT_NODE: + refChild = oldChild.nextSibling + self.removeChild(oldChild) + return self.insertBefore(newChild, refChild) + if newChild.nodeType not in self._child_node_types: + raise xml.dom.HierarchyRequestErr( + "%s cannot be child of %s" % (repr(newChild), repr(self))) + if newChild is oldChild: + return + if newChild.parentNode is not None: + newChild.parentNode.removeChild(newChild) + try: + index = self.childNodes.index(oldChild) + except ValueError: + raise xml.dom.NotFoundErr() + self.childNodes[index] = newChild + newChild.parentNode = self + oldChild.parentNode = None + if (newChild.nodeType in _nodeTypes_with_children + or oldChild.nodeType in _nodeTypes_with_children): + _clear_id_cache(self) + newChild.nextSibling = oldChild.nextSibling + newChild.previousSibling = oldChild.previousSibling + oldChild.nextSibling = None + oldChild.previousSibling = None + if newChild.previousSibling: + newChild.previousSibling.nextSibling = newChild + if newChild.nextSibling: + newChild.nextSibling.previousSibling = newChild + return oldChild + + def removeChild(self, oldChild): + try: + self.childNodes.remove(oldChild) + except ValueError: + raise xml.dom.NotFoundErr() + if oldChild.nextSibling is not None: + oldChild.nextSibling.previousSibling = oldChild.previousSibling + if oldChild.previousSibling is not None: + oldChild.previousSibling.nextSibling = oldChild.nextSibling + oldChild.nextSibling = oldChild.previousSibling = None + if oldChild.nodeType in _nodeTypes_with_children: + _clear_id_cache(self) + + oldChild.parentNode = None + return oldChild + + def normalize(self): + L = [] + for child in self.childNodes: + if child.nodeType == Node.TEXT_NODE: + if not child.data: + # empty text node; discard + if L: + L[-1].nextSibling = child.nextSibling + if child.nextSibling: + child.nextSibling.previousSibling = child.previousSibling + child.unlink() + elif L and L[-1].nodeType == child.nodeType: + # collapse text node + node = L[-1] + node.data = node.data + child.data + node.nextSibling = child.nextSibling + if child.nextSibling: + child.nextSibling.previousSibling = node + child.unlink() + else: + L.append(child) + else: + L.append(child) + if child.nodeType == Node.ELEMENT_NODE: + child.normalize() + self.childNodes[:] = L + + def cloneNode(self, deep): + return _clone_node(self, deep, self.ownerDocument or self) + + def isSupported(self, feature, version): + return self.ownerDocument.implementation.hasFeature(feature, version) + + def _get_localName(self): + # Overridden in Element and Attr where localName can be Non-Null + return None + + # Node interfaces from Level 3 (WD 9 April 2002) + + def isSameNode(self, other): + return self is other + + def getInterface(self, feature): + if self.isSupported(feature, None): + return self + else: + return None + + # The "user data" functions use a dictionary that is only present + # if some user data has been set, so be careful not to assume it + # exists. + + def getUserData(self, key): + try: + return self._user_data[key][0] + except (AttributeError, KeyError): + return None + + def setUserData(self, key, data, handler): + old = None + try: + d = self._user_data + except AttributeError: + d = {} + self._user_data = d + if key in d: + old = d[key][0] + if data is None: + # ignore handlers passed for None + handler = None + if old is not None: + del d[key] + else: + d[key] = (data, handler) + return old + + def _call_user_data_handler(self, operation, src, dst): + if hasattr(self, "_user_data"): + for key, (data, handler) in list(self._user_data.items()): + if handler is not None: + handler.handle(operation, key, data, src, dst) + + # minidom-specific API: + + def unlink(self): + self.parentNode = self.ownerDocument = None + if self.childNodes: + for child in self.childNodes: + child.unlink() + self.childNodes = NodeList() + self.previousSibling = None + self.nextSibling = None + + # A Node is its own context manager, to ensure that an unlink() call occurs. + # This is similar to how a file object works. + def __enter__(self): + return self + + def __exit__(self, et, ev, tb): + self.unlink() + +defproperty(Node, "firstChild", doc="First child node, or None.") +defproperty(Node, "lastChild", doc="Last child node, or None.") +defproperty(Node, "localName", doc="Namespace-local name of this node.") + + +def _append_child(self, node): + # fast path with less checks; usable by DOM builders if careful + childNodes = self.childNodes + if childNodes: + last = childNodes[-1] + node.previousSibling = last + last.nextSibling = node + childNodes.append(node) + node.parentNode = self + + +def _write_data(writer, data): + "Writes datachars to writer." + if data: + data = data.replace("&", "&").replace("<", "<"). \ + replace("\"", """).replace(">", ">") + writer.write(data) + +def _get_elements_by_tagName_helper(parent, name, rc): + for node in parent.childNodes: + if node.nodeType == Node.ELEMENT_NODE and \ + (name == "*" or node.tagName == name): + rc.append(node) + _get_elements_by_tagName_helper(node, name, rc) + return rc + +def _get_elements_by_tagName_ns_helper(parent, nsURI, localName, rc): + for node in parent.childNodes: + if node.nodeType == Node.ELEMENT_NODE: + if ((localName == "*" or node.localName == localName) and + (nsURI == "*" or node.namespaceURI == nsURI)): + rc.append(node) + _get_elements_by_tagName_ns_helper(node, nsURI, localName, rc) + return rc + +class DocumentFragment(Node): + nodeType = Node.DOCUMENT_FRAGMENT_NODE + nodeName = "#document-fragment" + nodeValue = None + attributes = None + parentNode = None + _child_node_types = (Node.ELEMENT_NODE, + Node.TEXT_NODE, + Node.CDATA_SECTION_NODE, + Node.ENTITY_REFERENCE_NODE, + Node.PROCESSING_INSTRUCTION_NODE, + Node.COMMENT_NODE, + Node.NOTATION_NODE) + + def __init__(self): + self.childNodes = NodeList() + + +class Attr(Node): + __slots__=('_name', '_value', 'namespaceURI', + '_prefix', 'childNodes', '_localName', 'ownerDocument', 'ownerElement') + nodeType = Node.ATTRIBUTE_NODE + attributes = None + specified = False + _is_id = False + + _child_node_types = (Node.TEXT_NODE, Node.ENTITY_REFERENCE_NODE) + + def __init__(self, qName, namespaceURI=EMPTY_NAMESPACE, localName=None, + prefix=None): + self.ownerElement = None + self.ownerDocument = None + self._name = qName + self.namespaceURI = namespaceURI + self._prefix = prefix + if localName is not None: + self._localName = localName + self.childNodes = NodeList() + + # Add the single child node that represents the value of the attr + self.childNodes.append(Text()) + + # nodeValue and value are set elsewhere + + def _get_localName(self): + try: + return self._localName + except AttributeError: + return self.nodeName.split(":", 1)[-1] + + def _get_specified(self): + return self.specified + + def _get_name(self): + return self._name + + def _set_name(self, value): + self._name = value + if self.ownerElement is not None: + _clear_id_cache(self.ownerElement) + + nodeName = name = property(_get_name, _set_name) + + def _get_value(self): + return self._value + + def _set_value(self, value): + self._value = value + self.childNodes[0].data = value + if self.ownerElement is not None: + _clear_id_cache(self.ownerElement) + self.childNodes[0].data = value + + nodeValue = value = property(_get_value, _set_value) + + def _get_prefix(self): + return self._prefix + + def _set_prefix(self, prefix): + nsuri = self.namespaceURI + if prefix == "xmlns": + if nsuri and nsuri != XMLNS_NAMESPACE: + raise xml.dom.NamespaceErr( + "illegal use of 'xmlns' prefix for the wrong namespace") + self._prefix = prefix + if prefix is None: + newName = self.localName + else: + newName = "%s:%s" % (prefix, self.localName) + if self.ownerElement: + _clear_id_cache(self.ownerElement) + self.name = newName + + prefix = property(_get_prefix, _set_prefix) + + def unlink(self): + # This implementation does not call the base implementation + # since most of that is not needed, and the expense of the + # method call is not warranted. We duplicate the removal of + # children, but that's all we needed from the base class. + elem = self.ownerElement + if elem is not None: + del elem._attrs[self.nodeName] + del elem._attrsNS[(self.namespaceURI, self.localName)] + if self._is_id: + self._is_id = False + elem._magic_id_nodes -= 1 + self.ownerDocument._magic_id_count -= 1 + for child in self.childNodes: + child.unlink() + del self.childNodes[:] + + def _get_isId(self): + if self._is_id: + return True + doc = self.ownerDocument + elem = self.ownerElement + if doc is None or elem is None: + return False + + info = doc._get_elem_info(elem) + if info is None: + return False + if self.namespaceURI: + return info.isIdNS(self.namespaceURI, self.localName) + else: + return info.isId(self.nodeName) + + def _get_schemaType(self): + doc = self.ownerDocument + elem = self.ownerElement + if doc is None or elem is None: + return _no_type + + info = doc._get_elem_info(elem) + if info is None: + return _no_type + if self.namespaceURI: + return info.getAttributeTypeNS(self.namespaceURI, self.localName) + else: + return info.getAttributeType(self.nodeName) + +defproperty(Attr, "isId", doc="True if this attribute is an ID.") +defproperty(Attr, "localName", doc="Namespace-local name of this attribute.") +defproperty(Attr, "schemaType", doc="Schema type for this attribute.") + + +class NamedNodeMap(object): + """The attribute list is a transient interface to the underlying + dictionaries. Mutations here will change the underlying element's + dictionary. + + Ordering is imposed artificially and does not reflect the order of + attributes as found in an input document. + """ + + __slots__ = ('_attrs', '_attrsNS', '_ownerElement') + + def __init__(self, attrs, attrsNS, ownerElement): + self._attrs = attrs + self._attrsNS = attrsNS + self._ownerElement = ownerElement + + def _get_length(self): + return len(self._attrs) + + def item(self, index): + try: + return self[list(self._attrs.keys())[index]] + except IndexError: + return None + + def items(self): + L = [] + for node in self._attrs.values(): + L.append((node.nodeName, node.value)) + return L + + def itemsNS(self): + L = [] + for node in self._attrs.values(): + L.append(((node.namespaceURI, node.localName), node.value)) + return L + + def __contains__(self, key): + if isinstance(key, str): + return key in self._attrs + else: + return key in self._attrsNS + + def keys(self): + return self._attrs.keys() + + def keysNS(self): + return self._attrsNS.keys() + + def values(self): + return self._attrs.values() + + def get(self, name, value=None): + return self._attrs.get(name, value) + + __len__ = _get_length + + def _cmp(self, other): + if self._attrs is getattr(other, "_attrs", None): + return 0 + else: + return (id(self) > id(other)) - (id(self) < id(other)) + + def __eq__(self, other): + return self._cmp(other) == 0 + + def __ge__(self, other): + return self._cmp(other) >= 0 + + def __gt__(self, other): + return self._cmp(other) > 0 + + def __le__(self, other): + return self._cmp(other) <= 0 + + def __lt__(self, other): + return self._cmp(other) < 0 + + def __getitem__(self, attname_or_tuple): + if isinstance(attname_or_tuple, tuple): + return self._attrsNS[attname_or_tuple] + else: + return self._attrs[attname_or_tuple] + + # same as set + def __setitem__(self, attname, value): + if isinstance(value, str): + try: + node = self._attrs[attname] + except KeyError: + node = Attr(attname) + node.ownerDocument = self._ownerElement.ownerDocument + self.setNamedItem(node) + node.value = value + else: + if not isinstance(value, Attr): + raise TypeError("value must be a string or Attr object") + node = value + self.setNamedItem(node) + + def getNamedItem(self, name): + try: + return self._attrs[name] + except KeyError: + return None + + def getNamedItemNS(self, namespaceURI, localName): + try: + return self._attrsNS[(namespaceURI, localName)] + except KeyError: + return None + + def removeNamedItem(self, name): + n = self.getNamedItem(name) + if n is not None: + _clear_id_cache(self._ownerElement) + del self._attrs[n.nodeName] + del self._attrsNS[(n.namespaceURI, n.localName)] + if hasattr(n, 'ownerElement'): + n.ownerElement = None + return n + else: + raise xml.dom.NotFoundErr() + + def removeNamedItemNS(self, namespaceURI, localName): + n = self.getNamedItemNS(namespaceURI, localName) + if n is not None: + _clear_id_cache(self._ownerElement) + del self._attrsNS[(n.namespaceURI, n.localName)] + del self._attrs[n.nodeName] + if hasattr(n, 'ownerElement'): + n.ownerElement = None + return n + else: + raise xml.dom.NotFoundErr() + + def setNamedItem(self, node): + if not isinstance(node, Attr): + raise xml.dom.HierarchyRequestErr( + "%s cannot be child of %s" % (repr(node), repr(self))) + old = self._attrs.get(node.name) + if old: + old.unlink() + self._attrs[node.name] = node + self._attrsNS[(node.namespaceURI, node.localName)] = node + node.ownerElement = self._ownerElement + _clear_id_cache(node.ownerElement) + return old + + def setNamedItemNS(self, node): + return self.setNamedItem(node) + + def __delitem__(self, attname_or_tuple): + node = self[attname_or_tuple] + _clear_id_cache(node.ownerElement) + node.unlink() + + def __getstate__(self): + return self._attrs, self._attrsNS, self._ownerElement + + def __setstate__(self, state): + self._attrs, self._attrsNS, self._ownerElement = state + +defproperty(NamedNodeMap, "length", + doc="Number of nodes in the NamedNodeMap.") + +AttributeList = NamedNodeMap + + +class TypeInfo(object): + __slots__ = 'namespace', 'name' + + def __init__(self, namespace, name): + self.namespace = namespace + self.name = name + + def __repr__(self): + if self.namespace: + return "<%s %r (from %r)>" % (self.__class__.__name__, self.name, + self.namespace) + else: + return "<%s %r>" % (self.__class__.__name__, self.name) + + def _get_name(self): + return self.name + + def _get_namespace(self): + return self.namespace + +_no_type = TypeInfo(None, None) + +class Element(Node): + __slots__=('ownerDocument', 'parentNode', 'tagName', 'nodeName', 'prefix', + 'namespaceURI', '_localName', 'childNodes', '_attrs', '_attrsNS', + 'nextSibling', 'previousSibling') + nodeType = Node.ELEMENT_NODE + nodeValue = None + schemaType = _no_type + + _magic_id_nodes = 0 + + _child_node_types = (Node.ELEMENT_NODE, + Node.PROCESSING_INSTRUCTION_NODE, + Node.COMMENT_NODE, + Node.TEXT_NODE, + Node.CDATA_SECTION_NODE, + Node.ENTITY_REFERENCE_NODE) + + def __init__(self, tagName, namespaceURI=EMPTY_NAMESPACE, prefix=None, + localName=None): + self.ownerDocument = None + self.parentNode = None + self.tagName = self.nodeName = tagName + self.prefix = prefix + self.namespaceURI = namespaceURI + self.childNodes = NodeList() + self.nextSibling = self.previousSibling = None + + # Attribute dictionaries are lazily created + # attributes are double-indexed: + # tagName -> Attribute + # URI,localName -> Attribute + # in the future: consider lazy generation + # of attribute objects this is too tricky + # for now because of headaches with + # namespaces. + self._attrs = None + self._attrsNS = None + + def _ensure_attributes(self): + if self._attrs is None: + self._attrs = {} + self._attrsNS = {} + + def _get_localName(self): + try: + return self._localName + except AttributeError: + return self.tagName.split(":", 1)[-1] + + def _get_tagName(self): + return self.tagName + + def unlink(self): + if self._attrs is not None: + for attr in list(self._attrs.values()): + attr.unlink() + self._attrs = None + self._attrsNS = None + Node.unlink(self) + + def getAttribute(self, attname): + """Returns the value of the specified attribute. + + Returns the value of the element's attribute named attname as + a string. An empty string is returned if the element does not + have such an attribute. Note that an empty string may also be + returned as an explicitly given attribute value, use the + hasAttribute method to distinguish these two cases. + """ + if self._attrs is None: + return "" + try: + return self._attrs[attname].value + except KeyError: + return "" + + def getAttributeNS(self, namespaceURI, localName): + if self._attrsNS is None: + return "" + try: + return self._attrsNS[(namespaceURI, localName)].value + except KeyError: + return "" + + def setAttribute(self, attname, value): + attr = self.getAttributeNode(attname) + if attr is None: + attr = Attr(attname) + attr.value = value # also sets nodeValue + attr.ownerDocument = self.ownerDocument + self.setAttributeNode(attr) + elif value != attr.value: + attr.value = value + if attr.isId: + _clear_id_cache(self) + + def setAttributeNS(self, namespaceURI, qualifiedName, value): + prefix, localname = _nssplit(qualifiedName) + attr = self.getAttributeNodeNS(namespaceURI, localname) + if attr is None: + attr = Attr(qualifiedName, namespaceURI, localname, prefix) + attr.value = value + attr.ownerDocument = self.ownerDocument + self.setAttributeNode(attr) + else: + if value != attr.value: + attr.value = value + if attr.isId: + _clear_id_cache(self) + if attr.prefix != prefix: + attr.prefix = prefix + attr.nodeName = qualifiedName + + def getAttributeNode(self, attrname): + if self._attrs is None: + return None + return self._attrs.get(attrname) + + def getAttributeNodeNS(self, namespaceURI, localName): + if self._attrsNS is None: + return None + return self._attrsNS.get((namespaceURI, localName)) + + def setAttributeNode(self, attr): + if attr.ownerElement not in (None, self): + raise xml.dom.InuseAttributeErr("attribute node already owned") + self._ensure_attributes() + old1 = self._attrs.get(attr.name, None) + if old1 is not None: + self.removeAttributeNode(old1) + old2 = self._attrsNS.get((attr.namespaceURI, attr.localName), None) + if old2 is not None and old2 is not old1: + self.removeAttributeNode(old2) + _set_attribute_node(self, attr) + + if old1 is not attr: + # It might have already been part of this node, in which case + # it doesn't represent a change, and should not be returned. + return old1 + if old2 is not attr: + return old2 + + setAttributeNodeNS = setAttributeNode + + def removeAttribute(self, name): + if self._attrsNS is None: + raise xml.dom.NotFoundErr() + try: + attr = self._attrs[name] + except KeyError: + raise xml.dom.NotFoundErr() + self.removeAttributeNode(attr) + + def removeAttributeNS(self, namespaceURI, localName): + if self._attrsNS is None: + raise xml.dom.NotFoundErr() + try: + attr = self._attrsNS[(namespaceURI, localName)] + except KeyError: + raise xml.dom.NotFoundErr() + self.removeAttributeNode(attr) + + def removeAttributeNode(self, node): + if node is None: + raise xml.dom.NotFoundErr() + try: + self._attrs[node.name] + except KeyError: + raise xml.dom.NotFoundErr() + _clear_id_cache(self) + node.unlink() + # Restore this since the node is still useful and otherwise + # unlinked + node.ownerDocument = self.ownerDocument + return node + + removeAttributeNodeNS = removeAttributeNode + + def hasAttribute(self, name): + """Checks whether the element has an attribute with the specified name. + + Returns True if the element has an attribute with the specified name. + Otherwise, returns False. + """ + if self._attrs is None: + return False + return name in self._attrs + + def hasAttributeNS(self, namespaceURI, localName): + if self._attrsNS is None: + return False + return (namespaceURI, localName) in self._attrsNS + + def getElementsByTagName(self, name): + """Returns all descendant elements with the given tag name. + + Returns the list of all descendant elements (not direct children + only) with the specified tag name. + """ + return _get_elements_by_tagName_helper(self, name, NodeList()) + + def getElementsByTagNameNS(self, namespaceURI, localName): + return _get_elements_by_tagName_ns_helper( + self, namespaceURI, localName, NodeList()) + + def __repr__(self): + return "" % (self.tagName, id(self)) + + def writexml(self, writer, indent="", addindent="", newl=""): + """Write an XML element to a file-like object + + Write the element to the writer object that must provide + a write method (e.g. a file or StringIO object). + """ + # indent = current indentation + # addindent = indentation to add to higher levels + # newl = newline string + writer.write(indent+"<" + self.tagName) + + attrs = self._get_attributes() + + for a_name in attrs.keys(): + writer.write(" %s=\"" % a_name) + _write_data(writer, attrs[a_name].value) + writer.write("\"") + if self.childNodes: + writer.write(">") + if (len(self.childNodes) == 1 and + self.childNodes[0].nodeType in ( + Node.TEXT_NODE, Node.CDATA_SECTION_NODE)): + self.childNodes[0].writexml(writer, '', '', '') + else: + writer.write(newl) + for node in self.childNodes: + node.writexml(writer, indent+addindent, addindent, newl) + writer.write(indent) + writer.write("%s" % (self.tagName, newl)) + else: + writer.write("/>%s"%(newl)) + + def _get_attributes(self): + self._ensure_attributes() + return NamedNodeMap(self._attrs, self._attrsNS, self) + + def hasAttributes(self): + if self._attrs: + return True + else: + return False + + # DOM Level 3 attributes, based on the 22 Oct 2002 draft + + def setIdAttribute(self, name): + idAttr = self.getAttributeNode(name) + self.setIdAttributeNode(idAttr) + + def setIdAttributeNS(self, namespaceURI, localName): + idAttr = self.getAttributeNodeNS(namespaceURI, localName) + self.setIdAttributeNode(idAttr) + + def setIdAttributeNode(self, idAttr): + if idAttr is None or not self.isSameNode(idAttr.ownerElement): + raise xml.dom.NotFoundErr() + if _get_containing_entref(self) is not None: + raise xml.dom.NoModificationAllowedErr() + if not idAttr._is_id: + idAttr._is_id = True + self._magic_id_nodes += 1 + self.ownerDocument._magic_id_count += 1 + _clear_id_cache(self) + +defproperty(Element, "attributes", + doc="NamedNodeMap of attributes on the element.") +defproperty(Element, "localName", + doc="Namespace-local name of this element.") + + +def _set_attribute_node(element, attr): + _clear_id_cache(element) + element._ensure_attributes() + element._attrs[attr.name] = attr + element._attrsNS[(attr.namespaceURI, attr.localName)] = attr + + # This creates a circular reference, but Element.unlink() + # breaks the cycle since the references to the attribute + # dictionaries are tossed. + attr.ownerElement = element + +class Childless: + """Mixin that makes childless-ness easy to implement and avoids + the complexity of the Node methods that deal with children. + """ + __slots__ = () + + attributes = None + childNodes = EmptyNodeList() + firstChild = None + lastChild = None + + def _get_firstChild(self): + return None + + def _get_lastChild(self): + return None + + def appendChild(self, node): + raise xml.dom.HierarchyRequestErr( + self.nodeName + " nodes cannot have children") + + def hasChildNodes(self): + return False + + def insertBefore(self, newChild, refChild): + raise xml.dom.HierarchyRequestErr( + self.nodeName + " nodes do not have children") + + def removeChild(self, oldChild): + raise xml.dom.NotFoundErr( + self.nodeName + " nodes do not have children") + + def normalize(self): + # For childless nodes, normalize() has nothing to do. + pass + + def replaceChild(self, newChild, oldChild): + raise xml.dom.HierarchyRequestErr( + self.nodeName + " nodes do not have children") + + +class ProcessingInstruction(Childless, Node): + nodeType = Node.PROCESSING_INSTRUCTION_NODE + __slots__ = ('target', 'data') + + def __init__(self, target, data): + self.target = target + self.data = data + + # nodeValue is an alias for data + def _get_nodeValue(self): + return self.data + def _set_nodeValue(self, value): + self.data = value + nodeValue = property(_get_nodeValue, _set_nodeValue) + + # nodeName is an alias for target + def _get_nodeName(self): + return self.target + def _set_nodeName(self, value): + self.target = value + nodeName = property(_get_nodeName, _set_nodeName) + + def writexml(self, writer, indent="", addindent="", newl=""): + writer.write("%s%s" % (indent,self.target, self.data, newl)) + + +class CharacterData(Childless, Node): + __slots__=('_data', 'ownerDocument','parentNode', 'previousSibling', 'nextSibling') + + def __init__(self): + self.ownerDocument = self.parentNode = None + self.previousSibling = self.nextSibling = None + self._data = '' + Node.__init__(self) + + def _get_length(self): + return len(self.data) + __len__ = _get_length + + def _get_data(self): + return self._data + def _set_data(self, data): + self._data = data + + data = nodeValue = property(_get_data, _set_data) + + def __repr__(self): + data = self.data + if len(data) > 10: + dotdotdot = "..." + else: + dotdotdot = "" + return '' % ( + self.__class__.__name__, data[0:10], dotdotdot) + + def substringData(self, offset, count): + if offset < 0: + raise xml.dom.IndexSizeErr("offset cannot be negative") + if offset >= len(self.data): + raise xml.dom.IndexSizeErr("offset cannot be beyond end of data") + if count < 0: + raise xml.dom.IndexSizeErr("count cannot be negative") + return self.data[offset:offset+count] + + def appendData(self, arg): + self.data = self.data + arg + + def insertData(self, offset, arg): + if offset < 0: + raise xml.dom.IndexSizeErr("offset cannot be negative") + if offset >= len(self.data): + raise xml.dom.IndexSizeErr("offset cannot be beyond end of data") + if arg: + self.data = "%s%s%s" % ( + self.data[:offset], arg, self.data[offset:]) + + def deleteData(self, offset, count): + if offset < 0: + raise xml.dom.IndexSizeErr("offset cannot be negative") + if offset >= len(self.data): + raise xml.dom.IndexSizeErr("offset cannot be beyond end of data") + if count < 0: + raise xml.dom.IndexSizeErr("count cannot be negative") + if count: + self.data = self.data[:offset] + self.data[offset+count:] + + def replaceData(self, offset, count, arg): + if offset < 0: + raise xml.dom.IndexSizeErr("offset cannot be negative") + if offset >= len(self.data): + raise xml.dom.IndexSizeErr("offset cannot be beyond end of data") + if count < 0: + raise xml.dom.IndexSizeErr("count cannot be negative") + if count: + self.data = "%s%s%s" % ( + self.data[:offset], arg, self.data[offset+count:]) + +defproperty(CharacterData, "length", doc="Length of the string data.") + + +class Text(CharacterData): + __slots__ = () + + nodeType = Node.TEXT_NODE + nodeName = "#text" + attributes = None + + def splitText(self, offset): + if offset < 0 or offset > len(self.data): + raise xml.dom.IndexSizeErr("illegal offset value") + newText = self.__class__() + newText.data = self.data[offset:] + newText.ownerDocument = self.ownerDocument + next = self.nextSibling + if self.parentNode and self in self.parentNode.childNodes: + if next is None: + self.parentNode.appendChild(newText) + else: + self.parentNode.insertBefore(newText, next) + self.data = self.data[:offset] + return newText + + def writexml(self, writer, indent="", addindent="", newl=""): + _write_data(writer, "%s%s%s" % (indent, self.data, newl)) + + # DOM Level 3 (WD 9 April 2002) + + def _get_wholeText(self): + L = [self.data] + n = self.previousSibling + while n is not None: + if n.nodeType in (Node.TEXT_NODE, Node.CDATA_SECTION_NODE): + L.insert(0, n.data) + n = n.previousSibling + else: + break + n = self.nextSibling + while n is not None: + if n.nodeType in (Node.TEXT_NODE, Node.CDATA_SECTION_NODE): + L.append(n.data) + n = n.nextSibling + else: + break + return ''.join(L) + + def replaceWholeText(self, content): + # XXX This needs to be seriously changed if minidom ever + # supports EntityReference nodes. + parent = self.parentNode + n = self.previousSibling + while n is not None: + if n.nodeType in (Node.TEXT_NODE, Node.CDATA_SECTION_NODE): + next = n.previousSibling + parent.removeChild(n) + n = next + else: + break + n = self.nextSibling + if not content: + parent.removeChild(self) + while n is not None: + if n.nodeType in (Node.TEXT_NODE, Node.CDATA_SECTION_NODE): + next = n.nextSibling + parent.removeChild(n) + n = next + else: + break + if content: + self.data = content + return self + else: + return None + + def _get_isWhitespaceInElementContent(self): + if self.data.strip(): + return False + elem = _get_containing_element(self) + if elem is None: + return False + info = self.ownerDocument._get_elem_info(elem) + if info is None: + return False + else: + return info.isElementContent() + +defproperty(Text, "isWhitespaceInElementContent", + doc="True iff this text node contains only whitespace" + " and is in element content.") +defproperty(Text, "wholeText", + doc="The text of all logically-adjacent text nodes.") + + +def _get_containing_element(node): + c = node.parentNode + while c is not None: + if c.nodeType == Node.ELEMENT_NODE: + return c + c = c.parentNode + return None + +def _get_containing_entref(node): + c = node.parentNode + while c is not None: + if c.nodeType == Node.ENTITY_REFERENCE_NODE: + return c + c = c.parentNode + return None + + +class Comment(CharacterData): + nodeType = Node.COMMENT_NODE + nodeName = "#comment" + + def __init__(self, data): + CharacterData.__init__(self) + self._data = data + + def writexml(self, writer, indent="", addindent="", newl=""): + if "--" in self.data: + raise ValueError("'--' is not allowed in a comment node") + writer.write("%s%s" % (indent, self.data, newl)) + + +class CDATASection(Text): + __slots__ = () + + nodeType = Node.CDATA_SECTION_NODE + nodeName = "#cdata-section" + + def writexml(self, writer, indent="", addindent="", newl=""): + if self.data.find("]]>") >= 0: + raise ValueError("']]>' not allowed in a CDATA section") + writer.write("" % self.data) + + +class ReadOnlySequentialNamedNodeMap(object): + __slots__ = '_seq', + + def __init__(self, seq=()): + # seq should be a list or tuple + self._seq = seq + + def __len__(self): + return len(self._seq) + + def _get_length(self): + return len(self._seq) + + def getNamedItem(self, name): + for n in self._seq: + if n.nodeName == name: + return n + + def getNamedItemNS(self, namespaceURI, localName): + for n in self._seq: + if n.namespaceURI == namespaceURI and n.localName == localName: + return n + + def __getitem__(self, name_or_tuple): + if isinstance(name_or_tuple, tuple): + node = self.getNamedItemNS(*name_or_tuple) + else: + node = self.getNamedItem(name_or_tuple) + if node is None: + raise KeyError(name_or_tuple) + return node + + def item(self, index): + if index < 0: + return None + try: + return self._seq[index] + except IndexError: + return None + + def removeNamedItem(self, name): + raise xml.dom.NoModificationAllowedErr( + "NamedNodeMap instance is read-only") + + def removeNamedItemNS(self, namespaceURI, localName): + raise xml.dom.NoModificationAllowedErr( + "NamedNodeMap instance is read-only") + + def setNamedItem(self, node): + raise xml.dom.NoModificationAllowedErr( + "NamedNodeMap instance is read-only") + + def setNamedItemNS(self, node): + raise xml.dom.NoModificationAllowedErr( + "NamedNodeMap instance is read-only") + + def __getstate__(self): + return [self._seq] + + def __setstate__(self, state): + self._seq = state[0] + +defproperty(ReadOnlySequentialNamedNodeMap, "length", + doc="Number of entries in the NamedNodeMap.") + + +class Identified: + """Mix-in class that supports the publicId and systemId attributes.""" + + __slots__ = 'publicId', 'systemId' + + def _identified_mixin_init(self, publicId, systemId): + self.publicId = publicId + self.systemId = systemId + + def _get_publicId(self): + return self.publicId + + def _get_systemId(self): + return self.systemId + +class DocumentType(Identified, Childless, Node): + nodeType = Node.DOCUMENT_TYPE_NODE + nodeValue = None + name = None + publicId = None + systemId = None + internalSubset = None + + def __init__(self, qualifiedName): + self.entities = ReadOnlySequentialNamedNodeMap() + self.notations = ReadOnlySequentialNamedNodeMap() + if qualifiedName: + prefix, localname = _nssplit(qualifiedName) + self.name = localname + self.nodeName = self.name + + def _get_internalSubset(self): + return self.internalSubset + + def cloneNode(self, deep): + if self.ownerDocument is None: + # it's ok + clone = DocumentType(None) + clone.name = self.name + clone.nodeName = self.name + operation = xml.dom.UserDataHandler.NODE_CLONED + if deep: + clone.entities._seq = [] + clone.notations._seq = [] + for n in self.notations._seq: + notation = Notation(n.nodeName, n.publicId, n.systemId) + clone.notations._seq.append(notation) + n._call_user_data_handler(operation, n, notation) + for e in self.entities._seq: + entity = Entity(e.nodeName, e.publicId, e.systemId, + e.notationName) + entity.actualEncoding = e.actualEncoding + entity.encoding = e.encoding + entity.version = e.version + clone.entities._seq.append(entity) + e._call_user_data_handler(operation, e, entity) + self._call_user_data_handler(operation, self, clone) + return clone + else: + return None + + def writexml(self, writer, indent="", addindent="", newl=""): + writer.write(""+newl) + +class Entity(Identified, Node): + attributes = None + nodeType = Node.ENTITY_NODE + nodeValue = None + + actualEncoding = None + encoding = None + version = None + + def __init__(self, name, publicId, systemId, notation): + self.nodeName = name + self.notationName = notation + self.childNodes = NodeList() + self._identified_mixin_init(publicId, systemId) + + def _get_actualEncoding(self): + return self.actualEncoding + + def _get_encoding(self): + return self.encoding + + def _get_version(self): + return self.version + + def appendChild(self, newChild): + raise xml.dom.HierarchyRequestErr( + "cannot append children to an entity node") + + def insertBefore(self, newChild, refChild): + raise xml.dom.HierarchyRequestErr( + "cannot insert children below an entity node") + + def removeChild(self, oldChild): + raise xml.dom.HierarchyRequestErr( + "cannot remove children from an entity node") + + def replaceChild(self, newChild, oldChild): + raise xml.dom.HierarchyRequestErr( + "cannot replace children of an entity node") + +class Notation(Identified, Childless, Node): + nodeType = Node.NOTATION_NODE + nodeValue = None + + def __init__(self, name, publicId, systemId): + self.nodeName = name + self._identified_mixin_init(publicId, systemId) + + +class DOMImplementation(DOMImplementationLS): + _features = [("core", "1.0"), + ("core", "2.0"), + ("core", None), + ("xml", "1.0"), + ("xml", "2.0"), + ("xml", None), + ("ls-load", "3.0"), + ("ls-load", None), + ] + + def hasFeature(self, feature, version): + if version == "": + version = None + return (feature.lower(), version) in self._features + + def createDocument(self, namespaceURI, qualifiedName, doctype): + if doctype and doctype.parentNode is not None: + raise xml.dom.WrongDocumentErr( + "doctype object owned by another DOM tree") + doc = self._create_document() + + add_root_element = not (namespaceURI is None + and qualifiedName is None + and doctype is None) + + if not qualifiedName and add_root_element: + # The spec is unclear what to raise here; SyntaxErr + # would be the other obvious candidate. Since Xerces raises + # InvalidCharacterErr, and since SyntaxErr is not listed + # for createDocument, that seems to be the better choice. + # XXX: need to check for illegal characters here and in + # createElement. + + # DOM Level III clears this up when talking about the return value + # of this function. If namespaceURI, qName and DocType are + # Null the document is returned without a document element + # Otherwise if doctype or namespaceURI are not None + # Then we go back to the above problem + raise xml.dom.InvalidCharacterErr("Element with no name") + + if add_root_element: + prefix, localname = _nssplit(qualifiedName) + if prefix == "xml" \ + and namespaceURI != "http://www.w3.org/XML/1998/namespace": + raise xml.dom.NamespaceErr("illegal use of 'xml' prefix") + if prefix and not namespaceURI: + raise xml.dom.NamespaceErr( + "illegal use of prefix without namespaces") + element = doc.createElementNS(namespaceURI, qualifiedName) + if doctype: + doc.appendChild(doctype) + doc.appendChild(element) + + if doctype: + doctype.parentNode = doctype.ownerDocument = doc + + doc.doctype = doctype + doc.implementation = self + return doc + + def createDocumentType(self, qualifiedName, publicId, systemId): + doctype = DocumentType(qualifiedName) + doctype.publicId = publicId + doctype.systemId = systemId + return doctype + + # DOM Level 3 (WD 9 April 2002) + + def getInterface(self, feature): + if self.hasFeature(feature, None): + return self + else: + return None + + # internal + def _create_document(self): + return Document() + +class ElementInfo(object): + """Object that represents content-model information for an element. + + This implementation is not expected to be used in practice; DOM + builders should provide implementations which do the right thing + using information available to it. + + """ + + __slots__ = 'tagName', + + def __init__(self, name): + self.tagName = name + + def getAttributeType(self, aname): + return _no_type + + def getAttributeTypeNS(self, namespaceURI, localName): + return _no_type + + def isElementContent(self): + return False + + def isEmpty(self): + """Returns true iff this element is declared to have an EMPTY + content model.""" + return False + + def isId(self, aname): + """Returns true iff the named attribute is a DTD-style ID.""" + return False + + def isIdNS(self, namespaceURI, localName): + """Returns true iff the identified attribute is a DTD-style ID.""" + return False + + def __getstate__(self): + return self.tagName + + def __setstate__(self, state): + self.tagName = state + +def _clear_id_cache(node): + if node.nodeType == Node.DOCUMENT_NODE: + node._id_cache.clear() + node._id_search_stack = None + elif node.ownerDocument: + node.ownerDocument._id_cache.clear() + node.ownerDocument._id_search_stack= None + +class Document(Node, DocumentLS): + __slots__ = ('_elem_info', 'doctype', + '_id_search_stack', 'childNodes', '_id_cache') + _child_node_types = (Node.ELEMENT_NODE, Node.PROCESSING_INSTRUCTION_NODE, + Node.COMMENT_NODE, Node.DOCUMENT_TYPE_NODE) + + implementation = DOMImplementation() + nodeType = Node.DOCUMENT_NODE + nodeName = "#document" + nodeValue = None + attributes = None + parentNode = None + previousSibling = nextSibling = None + + + # Document attributes from Level 3 (WD 9 April 2002) + + actualEncoding = None + encoding = None + standalone = None + version = None + strictErrorChecking = False + errorHandler = None + documentURI = None + + _magic_id_count = 0 + + def __init__(self): + self.doctype = None + self.childNodes = NodeList() + # mapping of (namespaceURI, localName) -> ElementInfo + # and tagName -> ElementInfo + self._elem_info = {} + self._id_cache = {} + self._id_search_stack = None + + def _get_elem_info(self, element): + if element.namespaceURI: + key = element.namespaceURI, element.localName + else: + key = element.tagName + return self._elem_info.get(key) + + def _get_actualEncoding(self): + return self.actualEncoding + + def _get_doctype(self): + return self.doctype + + def _get_documentURI(self): + return self.documentURI + + def _get_encoding(self): + return self.encoding + + def _get_errorHandler(self): + return self.errorHandler + + def _get_standalone(self): + return self.standalone + + def _get_strictErrorChecking(self): + return self.strictErrorChecking + + def _get_version(self): + return self.version + + def appendChild(self, node): + if node.nodeType not in self._child_node_types: + raise xml.dom.HierarchyRequestErr( + "%s cannot be child of %s" % (repr(node), repr(self))) + if node.parentNode is not None: + # This needs to be done before the next test since this + # may *be* the document element, in which case it should + # end up re-ordered to the end. + node.parentNode.removeChild(node) + + if node.nodeType == Node.ELEMENT_NODE \ + and self._get_documentElement(): + raise xml.dom.HierarchyRequestErr( + "two document elements disallowed") + return Node.appendChild(self, node) + + def removeChild(self, oldChild): + try: + self.childNodes.remove(oldChild) + except ValueError: + raise xml.dom.NotFoundErr() + oldChild.nextSibling = oldChild.previousSibling = None + oldChild.parentNode = None + if self.documentElement is oldChild: + self.documentElement = None + + return oldChild + + def _get_documentElement(self): + for node in self.childNodes: + if node.nodeType == Node.ELEMENT_NODE: + return node + + def unlink(self): + if self.doctype is not None: + self.doctype.unlink() + self.doctype = None + Node.unlink(self) + + def cloneNode(self, deep): + if not deep: + return None + clone = self.implementation.createDocument(None, None, None) + clone.encoding = self.encoding + clone.standalone = self.standalone + clone.version = self.version + for n in self.childNodes: + childclone = _clone_node(n, deep, clone) + assert childclone.ownerDocument.isSameNode(clone) + clone.childNodes.append(childclone) + if childclone.nodeType == Node.DOCUMENT_NODE: + assert clone.documentElement is None + elif childclone.nodeType == Node.DOCUMENT_TYPE_NODE: + assert clone.doctype is None + clone.doctype = childclone + childclone.parentNode = clone + self._call_user_data_handler(xml.dom.UserDataHandler.NODE_CLONED, + self, clone) + return clone + + def createDocumentFragment(self): + d = DocumentFragment() + d.ownerDocument = self + return d + + def createElement(self, tagName): + e = Element(tagName) + e.ownerDocument = self + return e + + def createTextNode(self, data): + if not isinstance(data, str): + raise TypeError("node contents must be a string") + t = Text() + t.data = data + t.ownerDocument = self + return t + + def createCDATASection(self, data): + if not isinstance(data, str): + raise TypeError("node contents must be a string") + c = CDATASection() + c.data = data + c.ownerDocument = self + return c + + def createComment(self, data): + c = Comment(data) + c.ownerDocument = self + return c + + def createProcessingInstruction(self, target, data): + p = ProcessingInstruction(target, data) + p.ownerDocument = self + return p + + def createAttribute(self, qName): + a = Attr(qName) + a.ownerDocument = self + a.value = "" + return a + + def createElementNS(self, namespaceURI, qualifiedName): + prefix, localName = _nssplit(qualifiedName) + e = Element(qualifiedName, namespaceURI, prefix) + e.ownerDocument = self + return e + + def createAttributeNS(self, namespaceURI, qualifiedName): + prefix, localName = _nssplit(qualifiedName) + a = Attr(qualifiedName, namespaceURI, localName, prefix) + a.ownerDocument = self + a.value = "" + return a + + # A couple of implementation-specific helpers to create node types + # not supported by the W3C DOM specs: + + def _create_entity(self, name, publicId, systemId, notationName): + e = Entity(name, publicId, systemId, notationName) + e.ownerDocument = self + return e + + def _create_notation(self, name, publicId, systemId): + n = Notation(name, publicId, systemId) + n.ownerDocument = self + return n + + def getElementById(self, id): + if id in self._id_cache: + return self._id_cache[id] + if not (self._elem_info or self._magic_id_count): + return None + + stack = self._id_search_stack + if stack is None: + # we never searched before, or the cache has been cleared + stack = [self.documentElement] + self._id_search_stack = stack + elif not stack: + # Previous search was completed and cache is still valid; + # no matching node. + return None + + result = None + while stack: + node = stack.pop() + # add child elements to stack for continued searching + stack.extend([child for child in node.childNodes + if child.nodeType in _nodeTypes_with_children]) + # check this node + info = self._get_elem_info(node) + if info: + # We have to process all ID attributes before + # returning in order to get all the attributes set to + # be IDs using Element.setIdAttribute*(). + for attr in node.attributes.values(): + if attr.namespaceURI: + if info.isIdNS(attr.namespaceURI, attr.localName): + self._id_cache[attr.value] = node + if attr.value == id: + result = node + elif not node._magic_id_nodes: + break + elif info.isId(attr.name): + self._id_cache[attr.value] = node + if attr.value == id: + result = node + elif not node._magic_id_nodes: + break + elif attr._is_id: + self._id_cache[attr.value] = node + if attr.value == id: + result = node + elif node._magic_id_nodes == 1: + break + elif node._magic_id_nodes: + for attr in node.attributes.values(): + if attr._is_id: + self._id_cache[attr.value] = node + if attr.value == id: + result = node + if result is not None: + break + return result + + def getElementsByTagName(self, name): + return _get_elements_by_tagName_helper(self, name, NodeList()) + + def getElementsByTagNameNS(self, namespaceURI, localName): + return _get_elements_by_tagName_ns_helper( + self, namespaceURI, localName, NodeList()) + + def isSupported(self, feature, version): + return self.implementation.hasFeature(feature, version) + + def importNode(self, node, deep): + if node.nodeType == Node.DOCUMENT_NODE: + raise xml.dom.NotSupportedErr("cannot import document nodes") + elif node.nodeType == Node.DOCUMENT_TYPE_NODE: + raise xml.dom.NotSupportedErr("cannot import document type nodes") + return _clone_node(node, deep, self) + + def writexml(self, writer, indent="", addindent="", newl="", encoding=None, + standalone=None): + declarations = [] + + if encoding: + declarations.append(f'encoding="{encoding}"') + if standalone is not None: + declarations.append(f'standalone="{"yes" if standalone else "no"}"') + + writer.write(f'{newl}') + + for node in self.childNodes: + node.writexml(writer, indent, addindent, newl) + + # DOM Level 3 (WD 9 April 2002) + + def renameNode(self, n, namespaceURI, name): + if n.ownerDocument is not self: + raise xml.dom.WrongDocumentErr( + "cannot rename nodes from other documents;\n" + "expected %s,\nfound %s" % (self, n.ownerDocument)) + if n.nodeType not in (Node.ELEMENT_NODE, Node.ATTRIBUTE_NODE): + raise xml.dom.NotSupportedErr( + "renameNode() only applies to element and attribute nodes") + if namespaceURI != EMPTY_NAMESPACE: + if ':' in name: + prefix, localName = name.split(':', 1) + if ( prefix == "xmlns" + and namespaceURI != xml.dom.XMLNS_NAMESPACE): + raise xml.dom.NamespaceErr( + "illegal use of 'xmlns' prefix") + else: + if ( name == "xmlns" + and namespaceURI != xml.dom.XMLNS_NAMESPACE + and n.nodeType == Node.ATTRIBUTE_NODE): + raise xml.dom.NamespaceErr( + "illegal use of the 'xmlns' attribute") + prefix = None + localName = name + else: + prefix = None + localName = None + if n.nodeType == Node.ATTRIBUTE_NODE: + element = n.ownerElement + if element is not None: + is_id = n._is_id + element.removeAttributeNode(n) + else: + element = None + n.prefix = prefix + n._localName = localName + n.namespaceURI = namespaceURI + n.nodeName = name + if n.nodeType == Node.ELEMENT_NODE: + n.tagName = name + else: + # attribute node + n.name = name + if element is not None: + element.setAttributeNode(n) + if is_id: + element.setIdAttributeNode(n) + # It's not clear from a semantic perspective whether we should + # call the user data handlers for the NODE_RENAMED event since + # we're re-using the existing node. The draft spec has been + # interpreted as meaning "no, don't call the handler unless a + # new node is created." + return n + +defproperty(Document, "documentElement", + doc="Top-level element of this document.") + + +def _clone_node(node, deep, newOwnerDocument): + """ + Clone a node and give it the new owner document. + Called by Node.cloneNode and Document.importNode + """ + if node.ownerDocument.isSameNode(newOwnerDocument): + operation = xml.dom.UserDataHandler.NODE_CLONED + else: + operation = xml.dom.UserDataHandler.NODE_IMPORTED + if node.nodeType == Node.ELEMENT_NODE: + clone = newOwnerDocument.createElementNS(node.namespaceURI, + node.nodeName) + for attr in node.attributes.values(): + clone.setAttributeNS(attr.namespaceURI, attr.nodeName, attr.value) + a = clone.getAttributeNodeNS(attr.namespaceURI, attr.localName) + a.specified = attr.specified + + if deep: + for child in node.childNodes: + c = _clone_node(child, deep, newOwnerDocument) + clone.appendChild(c) + + elif node.nodeType == Node.DOCUMENT_FRAGMENT_NODE: + clone = newOwnerDocument.createDocumentFragment() + if deep: + for child in node.childNodes: + c = _clone_node(child, deep, newOwnerDocument) + clone.appendChild(c) + + elif node.nodeType == Node.TEXT_NODE: + clone = newOwnerDocument.createTextNode(node.data) + elif node.nodeType == Node.CDATA_SECTION_NODE: + clone = newOwnerDocument.createCDATASection(node.data) + elif node.nodeType == Node.PROCESSING_INSTRUCTION_NODE: + clone = newOwnerDocument.createProcessingInstruction(node.target, + node.data) + elif node.nodeType == Node.COMMENT_NODE: + clone = newOwnerDocument.createComment(node.data) + elif node.nodeType == Node.ATTRIBUTE_NODE: + clone = newOwnerDocument.createAttributeNS(node.namespaceURI, + node.nodeName) + clone.specified = True + clone.value = node.value + elif node.nodeType == Node.DOCUMENT_TYPE_NODE: + assert node.ownerDocument is not newOwnerDocument + operation = xml.dom.UserDataHandler.NODE_IMPORTED + clone = newOwnerDocument.implementation.createDocumentType( + node.name, node.publicId, node.systemId) + clone.ownerDocument = newOwnerDocument + if deep: + clone.entities._seq = [] + clone.notations._seq = [] + for n in node.notations._seq: + notation = Notation(n.nodeName, n.publicId, n.systemId) + notation.ownerDocument = newOwnerDocument + clone.notations._seq.append(notation) + if hasattr(n, '_call_user_data_handler'): + n._call_user_data_handler(operation, n, notation) + for e in node.entities._seq: + entity = Entity(e.nodeName, e.publicId, e.systemId, + e.notationName) + entity.actualEncoding = e.actualEncoding + entity.encoding = e.encoding + entity.version = e.version + entity.ownerDocument = newOwnerDocument + clone.entities._seq.append(entity) + if hasattr(e, '_call_user_data_handler'): + e._call_user_data_handler(operation, e, entity) + else: + # Note the cloning of Document and DocumentType nodes is + # implementation specific. minidom handles those cases + # directly in the cloneNode() methods. + raise xml.dom.NotSupportedErr("Cannot clone node %s" % repr(node)) + + # Check for _call_user_data_handler() since this could conceivably + # used with other DOM implementations (one of the FourThought + # DOMs, perhaps?). + if hasattr(node, '_call_user_data_handler'): + node._call_user_data_handler(operation, node, clone) + return clone + + +def _nssplit(qualifiedName): + fields = qualifiedName.split(':', 1) + if len(fields) == 2: + return fields + else: + return (None, fields[0]) + + +def _do_pulldom_parse(func, args, kwargs): + events = func(*args, **kwargs) + toktype, rootNode = events.getEvent() + events.expandNode(rootNode) + events.clear() + return rootNode + +def parse(file, parser=None, bufsize=None): + """Parse a file into a DOM by filename or file object.""" + if parser is None and not bufsize: + from xml.dom import expatbuilder + return expatbuilder.parse(file) + else: + from xml.dom import pulldom + return _do_pulldom_parse(pulldom.parse, (file,), + {'parser': parser, 'bufsize': bufsize}) + +def parseString(string, parser=None): + """Parse a file into a DOM from a string.""" + if parser is None: + from xml.dom import expatbuilder + return expatbuilder.parseString(string) + else: + from xml.dom import pulldom + return _do_pulldom_parse(pulldom.parseString, (string,), + {'parser': parser}) + +def getDOMImplementation(features=None): + if features: + if isinstance(features, str): + features = domreg._parse_feature_string(features) + for f, v in features: + if not Document.implementation.hasFeature(f, v): + return None + return Document.implementation diff --git a/miniconda3/envs/active_proaction/lib/python3.10/xml/dom/pulldom.py b/miniconda3/envs/active_proaction/lib/python3.10/xml/dom/pulldom.py new file mode 100644 index 0000000000000000000000000000000000000000..96a8d59519ef45957b101b7295d044c316d4e84c --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/xml/dom/pulldom.py @@ -0,0 +1,349 @@ +import xml.sax +import xml.sax.handler + +START_ELEMENT = "START_ELEMENT" +END_ELEMENT = "END_ELEMENT" +COMMENT = "COMMENT" +START_DOCUMENT = "START_DOCUMENT" +END_DOCUMENT = "END_DOCUMENT" +PROCESSING_INSTRUCTION = "PROCESSING_INSTRUCTION" +IGNORABLE_WHITESPACE = "IGNORABLE_WHITESPACE" +CHARACTERS = "CHARACTERS" + +class PullDOM(xml.sax.ContentHandler): + _locator = None + document = None + + def __init__(self, documentFactory=None): + from xml.dom import XML_NAMESPACE + self.documentFactory = documentFactory + self.firstEvent = [None, None] + self.lastEvent = self.firstEvent + self.elementStack = [] + self.push = self.elementStack.append + try: + self.pop = self.elementStack.pop + except AttributeError: + # use class' pop instead + pass + self._ns_contexts = [{XML_NAMESPACE:'xml'}] # contains uri -> prefix dicts + self._current_context = self._ns_contexts[-1] + self.pending_events = [] + + def pop(self): + result = self.elementStack[-1] + del self.elementStack[-1] + return result + + def setDocumentLocator(self, locator): + self._locator = locator + + def startPrefixMapping(self, prefix, uri): + if not hasattr(self, '_xmlns_attrs'): + self._xmlns_attrs = [] + self._xmlns_attrs.append((prefix or 'xmlns', uri)) + self._ns_contexts.append(self._current_context.copy()) + self._current_context[uri] = prefix or None + + def endPrefixMapping(self, prefix): + self._current_context = self._ns_contexts.pop() + + def startElementNS(self, name, tagName , attrs): + # Retrieve xml namespace declaration attributes. + xmlns_uri = 'http://www.w3.org/2000/xmlns/' + xmlns_attrs = getattr(self, '_xmlns_attrs', None) + if xmlns_attrs is not None: + for aname, value in xmlns_attrs: + attrs._attrs[(xmlns_uri, aname)] = value + self._xmlns_attrs = [] + uri, localname = name + if uri: + # When using namespaces, the reader may or may not + # provide us with the original name. If not, create + # *a* valid tagName from the current context. + if tagName is None: + prefix = self._current_context[uri] + if prefix: + tagName = prefix + ":" + localname + else: + tagName = localname + if self.document: + node = self.document.createElementNS(uri, tagName) + else: + node = self.buildDocument(uri, tagName) + else: + # When the tagname is not prefixed, it just appears as + # localname + if self.document: + node = self.document.createElement(localname) + else: + node = self.buildDocument(None, localname) + + for aname,value in attrs.items(): + a_uri, a_localname = aname + if a_uri == xmlns_uri: + if a_localname == 'xmlns': + qname = a_localname + else: + qname = 'xmlns:' + a_localname + attr = self.document.createAttributeNS(a_uri, qname) + node.setAttributeNodeNS(attr) + elif a_uri: + prefix = self._current_context[a_uri] + if prefix: + qname = prefix + ":" + a_localname + else: + qname = a_localname + attr = self.document.createAttributeNS(a_uri, qname) + node.setAttributeNodeNS(attr) + else: + attr = self.document.createAttribute(a_localname) + node.setAttributeNode(attr) + attr.value = value + + self.lastEvent[1] = [(START_ELEMENT, node), None] + self.lastEvent = self.lastEvent[1] + self.push(node) + + def endElementNS(self, name, tagName): + self.lastEvent[1] = [(END_ELEMENT, self.pop()), None] + self.lastEvent = self.lastEvent[1] + + def startElement(self, name, attrs): + if self.document: + node = self.document.createElement(name) + else: + node = self.buildDocument(None, name) + + for aname,value in attrs.items(): + attr = self.document.createAttribute(aname) + attr.value = value + node.setAttributeNode(attr) + + self.lastEvent[1] = [(START_ELEMENT, node), None] + self.lastEvent = self.lastEvent[1] + self.push(node) + + def endElement(self, name): + self.lastEvent[1] = [(END_ELEMENT, self.pop()), None] + self.lastEvent = self.lastEvent[1] + + def comment(self, s): + if self.document: + node = self.document.createComment(s) + self.lastEvent[1] = [(COMMENT, node), None] + self.lastEvent = self.lastEvent[1] + else: + event = [(COMMENT, s), None] + self.pending_events.append(event) + + def processingInstruction(self, target, data): + if self.document: + node = self.document.createProcessingInstruction(target, data) + self.lastEvent[1] = [(PROCESSING_INSTRUCTION, node), None] + self.lastEvent = self.lastEvent[1] + else: + event = [(PROCESSING_INSTRUCTION, target, data), None] + self.pending_events.append(event) + + def ignorableWhitespace(self, chars): + node = self.document.createTextNode(chars) + self.lastEvent[1] = [(IGNORABLE_WHITESPACE, node), None] + self.lastEvent = self.lastEvent[1] + + def characters(self, chars): + node = self.document.createTextNode(chars) + self.lastEvent[1] = [(CHARACTERS, node), None] + self.lastEvent = self.lastEvent[1] + + def startDocument(self): + if self.documentFactory is None: + import xml.dom.minidom + self.documentFactory = xml.dom.minidom.Document.implementation + + def buildDocument(self, uri, tagname): + # Can't do that in startDocument, since we need the tagname + # XXX: obtain DocumentType + node = self.documentFactory.createDocument(uri, tagname, None) + self.document = node + self.lastEvent[1] = [(START_DOCUMENT, node), None] + self.lastEvent = self.lastEvent[1] + self.push(node) + # Put everything we have seen so far into the document + for e in self.pending_events: + if e[0][0] == PROCESSING_INSTRUCTION: + _,target,data = e[0] + n = self.document.createProcessingInstruction(target, data) + e[0] = (PROCESSING_INSTRUCTION, n) + elif e[0][0] == COMMENT: + n = self.document.createComment(e[0][1]) + e[0] = (COMMENT, n) + else: + raise AssertionError("Unknown pending event ",e[0][0]) + self.lastEvent[1] = e + self.lastEvent = e + self.pending_events = None + return node.firstChild + + def endDocument(self): + self.lastEvent[1] = [(END_DOCUMENT, self.document), None] + self.pop() + + def clear(self): + "clear(): Explicitly release parsing structures" + self.document = None + +class ErrorHandler: + def warning(self, exception): + print(exception) + def error(self, exception): + raise exception + def fatalError(self, exception): + raise exception + +class DOMEventStream: + def __init__(self, stream, parser, bufsize): + self.stream = stream + self.parser = parser + self.bufsize = bufsize + if not hasattr(self.parser, 'feed'): + self.getEvent = self._slurp + self.reset() + + def reset(self): + self.pulldom = PullDOM() + # This content handler relies on namespace support + self.parser.setFeature(xml.sax.handler.feature_namespaces, 1) + self.parser.setContentHandler(self.pulldom) + + def __getitem__(self, pos): + import warnings + warnings.warn( + "DOMEventStream's __getitem__ method ignores 'pos' parameter. " + "Use iterator protocol instead.", + DeprecationWarning, + stacklevel=2 + ) + rc = self.getEvent() + if rc: + return rc + raise IndexError + + def __next__(self): + rc = self.getEvent() + if rc: + return rc + raise StopIteration + + def __iter__(self): + return self + + def expandNode(self, node): + event = self.getEvent() + parents = [node] + while event: + token, cur_node = event + if cur_node is node: + return + if token != END_ELEMENT: + parents[-1].appendChild(cur_node) + if token == START_ELEMENT: + parents.append(cur_node) + elif token == END_ELEMENT: + del parents[-1] + event = self.getEvent() + + def getEvent(self): + # use IncrementalParser interface, so we get the desired + # pull effect + if not self.pulldom.firstEvent[1]: + self.pulldom.lastEvent = self.pulldom.firstEvent + while not self.pulldom.firstEvent[1]: + buf = self.stream.read(self.bufsize) + if not buf: + self.parser.close() + return None + self.parser.feed(buf) + rc = self.pulldom.firstEvent[1][0] + self.pulldom.firstEvent[1] = self.pulldom.firstEvent[1][1] + return rc + + def _slurp(self): + """ Fallback replacement for getEvent() using the + standard SAX2 interface, which means we slurp the + SAX events into memory (no performance gain, but + we are compatible to all SAX parsers). + """ + self.parser.parse(self.stream) + self.getEvent = self._emit + return self._emit() + + def _emit(self): + """ Fallback replacement for getEvent() that emits + the events that _slurp() read previously. + """ + rc = self.pulldom.firstEvent[1][0] + self.pulldom.firstEvent[1] = self.pulldom.firstEvent[1][1] + return rc + + def clear(self): + """clear(): Explicitly release parsing objects""" + self.pulldom.clear() + del self.pulldom + self.parser = None + self.stream = None + +class SAX2DOM(PullDOM): + + def startElementNS(self, name, tagName , attrs): + PullDOM.startElementNS(self, name, tagName, attrs) + curNode = self.elementStack[-1] + parentNode = self.elementStack[-2] + parentNode.appendChild(curNode) + + def startElement(self, name, attrs): + PullDOM.startElement(self, name, attrs) + curNode = self.elementStack[-1] + parentNode = self.elementStack[-2] + parentNode.appendChild(curNode) + + def processingInstruction(self, target, data): + PullDOM.processingInstruction(self, target, data) + node = self.lastEvent[0][1] + parentNode = self.elementStack[-1] + parentNode.appendChild(node) + + def ignorableWhitespace(self, chars): + PullDOM.ignorableWhitespace(self, chars) + node = self.lastEvent[0][1] + parentNode = self.elementStack[-1] + parentNode.appendChild(node) + + def characters(self, chars): + PullDOM.characters(self, chars) + node = self.lastEvent[0][1] + parentNode = self.elementStack[-1] + parentNode.appendChild(node) + + +default_bufsize = (2 ** 14) - 20 + +def parse(stream_or_string, parser=None, bufsize=None): + if bufsize is None: + bufsize = default_bufsize + if isinstance(stream_or_string, str): + stream = open(stream_or_string, 'rb') + else: + stream = stream_or_string + if not parser: + parser = xml.sax.make_parser() + return DOMEventStream(stream, parser, bufsize) + +def parseString(string, parser=None): + from io import StringIO + + bufsize = len(string) + buf = StringIO(string) + if not parser: + parser = xml.sax.make_parser() + return DOMEventStream(buf, parser, bufsize) diff --git a/miniconda3/envs/active_proaction/lib/python3.10/xml/dom/xmlbuilder.py b/miniconda3/envs/active_proaction/lib/python3.10/xml/dom/xmlbuilder.py new file mode 100644 index 0000000000000000000000000000000000000000..8a200263497b8927e7630ec5d8c14cfd8d8f5a19 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/xml/dom/xmlbuilder.py @@ -0,0 +1,387 @@ +"""Implementation of the DOM Level 3 'LS-Load' feature.""" + +import copy +import xml.dom + +from xml.dom.NodeFilter import NodeFilter + + +__all__ = ["DOMBuilder", "DOMEntityResolver", "DOMInputSource"] + + +class Options: + """Features object that has variables set for each DOMBuilder feature. + + The DOMBuilder class uses an instance of this class to pass settings to + the ExpatBuilder class. + """ + + # Note that the DOMBuilder class in LoadSave constrains which of these + # values can be set using the DOM Level 3 LoadSave feature. + + namespaces = 1 + namespace_declarations = True + validation = False + external_parameter_entities = True + external_general_entities = True + external_dtd_subset = True + validate_if_schema = False + validate = False + datatype_normalization = False + create_entity_ref_nodes = True + entities = True + whitespace_in_element_content = True + cdata_sections = True + comments = True + charset_overrides_xml_encoding = True + infoset = False + supported_mediatypes_only = False + + errorHandler = None + filter = None + + +class DOMBuilder: + entityResolver = None + errorHandler = None + filter = None + + ACTION_REPLACE = 1 + ACTION_APPEND_AS_CHILDREN = 2 + ACTION_INSERT_AFTER = 3 + ACTION_INSERT_BEFORE = 4 + + _legal_actions = (ACTION_REPLACE, ACTION_APPEND_AS_CHILDREN, + ACTION_INSERT_AFTER, ACTION_INSERT_BEFORE) + + def __init__(self): + self._options = Options() + + def _get_entityResolver(self): + return self.entityResolver + def _set_entityResolver(self, entityResolver): + self.entityResolver = entityResolver + + def _get_errorHandler(self): + return self.errorHandler + def _set_errorHandler(self, errorHandler): + self.errorHandler = errorHandler + + def _get_filter(self): + return self.filter + def _set_filter(self, filter): + self.filter = filter + + def setFeature(self, name, state): + if self.supportsFeature(name): + state = state and 1 or 0 + try: + settings = self._settings[(_name_xform(name), state)] + except KeyError: + raise xml.dom.NotSupportedErr( + "unsupported feature: %r" % (name,)) from None + else: + for name, value in settings: + setattr(self._options, name, value) + else: + raise xml.dom.NotFoundErr("unknown feature: " + repr(name)) + + def supportsFeature(self, name): + return hasattr(self._options, _name_xform(name)) + + def canSetFeature(self, name, state): + key = (_name_xform(name), state and 1 or 0) + return key in self._settings + + # This dictionary maps from (feature,value) to a list of + # (option,value) pairs that should be set on the Options object. + # If a (feature,value) setting is not in this dictionary, it is + # not supported by the DOMBuilder. + # + _settings = { + ("namespace_declarations", 0): [ + ("namespace_declarations", 0)], + ("namespace_declarations", 1): [ + ("namespace_declarations", 1)], + ("validation", 0): [ + ("validation", 0)], + ("external_general_entities", 0): [ + ("external_general_entities", 0)], + ("external_general_entities", 1): [ + ("external_general_entities", 1)], + ("external_parameter_entities", 0): [ + ("external_parameter_entities", 0)], + ("external_parameter_entities", 1): [ + ("external_parameter_entities", 1)], + ("validate_if_schema", 0): [ + ("validate_if_schema", 0)], + ("create_entity_ref_nodes", 0): [ + ("create_entity_ref_nodes", 0)], + ("create_entity_ref_nodes", 1): [ + ("create_entity_ref_nodes", 1)], + ("entities", 0): [ + ("create_entity_ref_nodes", 0), + ("entities", 0)], + ("entities", 1): [ + ("entities", 1)], + ("whitespace_in_element_content", 0): [ + ("whitespace_in_element_content", 0)], + ("whitespace_in_element_content", 1): [ + ("whitespace_in_element_content", 1)], + ("cdata_sections", 0): [ + ("cdata_sections", 0)], + ("cdata_sections", 1): [ + ("cdata_sections", 1)], + ("comments", 0): [ + ("comments", 0)], + ("comments", 1): [ + ("comments", 1)], + ("charset_overrides_xml_encoding", 0): [ + ("charset_overrides_xml_encoding", 0)], + ("charset_overrides_xml_encoding", 1): [ + ("charset_overrides_xml_encoding", 1)], + ("infoset", 0): [], + ("infoset", 1): [ + ("namespace_declarations", 0), + ("validate_if_schema", 0), + ("create_entity_ref_nodes", 0), + ("entities", 0), + ("cdata_sections", 0), + ("datatype_normalization", 1), + ("whitespace_in_element_content", 1), + ("comments", 1), + ("charset_overrides_xml_encoding", 1)], + ("supported_mediatypes_only", 0): [ + ("supported_mediatypes_only", 0)], + ("namespaces", 0): [ + ("namespaces", 0)], + ("namespaces", 1): [ + ("namespaces", 1)], + } + + def getFeature(self, name): + xname = _name_xform(name) + try: + return getattr(self._options, xname) + except AttributeError: + if name == "infoset": + options = self._options + return (options.datatype_normalization + and options.whitespace_in_element_content + and options.comments + and options.charset_overrides_xml_encoding + and not (options.namespace_declarations + or options.validate_if_schema + or options.create_entity_ref_nodes + or options.entities + or options.cdata_sections)) + raise xml.dom.NotFoundErr("feature %s not known" % repr(name)) + + def parseURI(self, uri): + if self.entityResolver: + input = self.entityResolver.resolveEntity(None, uri) + else: + input = DOMEntityResolver().resolveEntity(None, uri) + return self.parse(input) + + def parse(self, input): + options = copy.copy(self._options) + options.filter = self.filter + options.errorHandler = self.errorHandler + fp = input.byteStream + if fp is None and options.systemId: + import urllib.request + fp = urllib.request.urlopen(input.systemId) + return self._parse_bytestream(fp, options) + + def parseWithContext(self, input, cnode, action): + if action not in self._legal_actions: + raise ValueError("not a legal action") + raise NotImplementedError("Haven't written this yet...") + + def _parse_bytestream(self, stream, options): + import xml.dom.expatbuilder + builder = xml.dom.expatbuilder.makeBuilder(options) + return builder.parseFile(stream) + + +def _name_xform(name): + return name.lower().replace('-', '_') + + +class DOMEntityResolver(object): + __slots__ = '_opener', + + def resolveEntity(self, publicId, systemId): + assert systemId is not None + source = DOMInputSource() + source.publicId = publicId + source.systemId = systemId + source.byteStream = self._get_opener().open(systemId) + + # determine the encoding if the transport provided it + source.encoding = self._guess_media_encoding(source) + + # determine the base URI is we can + import posixpath, urllib.parse + parts = urllib.parse.urlparse(systemId) + scheme, netloc, path, params, query, fragment = parts + # XXX should we check the scheme here as well? + if path and not path.endswith("/"): + path = posixpath.dirname(path) + "/" + parts = scheme, netloc, path, params, query, fragment + source.baseURI = urllib.parse.urlunparse(parts) + + return source + + def _get_opener(self): + try: + return self._opener + except AttributeError: + self._opener = self._create_opener() + return self._opener + + def _create_opener(self): + import urllib.request + return urllib.request.build_opener() + + def _guess_media_encoding(self, source): + info = source.byteStream.info() + if "Content-Type" in info: + for param in info.getplist(): + if param.startswith("charset="): + return param.split("=", 1)[1].lower() + + +class DOMInputSource(object): + __slots__ = ('byteStream', 'characterStream', 'stringData', + 'encoding', 'publicId', 'systemId', 'baseURI') + + def __init__(self): + self.byteStream = None + self.characterStream = None + self.stringData = None + self.encoding = None + self.publicId = None + self.systemId = None + self.baseURI = None + + def _get_byteStream(self): + return self.byteStream + def _set_byteStream(self, byteStream): + self.byteStream = byteStream + + def _get_characterStream(self): + return self.characterStream + def _set_characterStream(self, characterStream): + self.characterStream = characterStream + + def _get_stringData(self): + return self.stringData + def _set_stringData(self, data): + self.stringData = data + + def _get_encoding(self): + return self.encoding + def _set_encoding(self, encoding): + self.encoding = encoding + + def _get_publicId(self): + return self.publicId + def _set_publicId(self, publicId): + self.publicId = publicId + + def _get_systemId(self): + return self.systemId + def _set_systemId(self, systemId): + self.systemId = systemId + + def _get_baseURI(self): + return self.baseURI + def _set_baseURI(self, uri): + self.baseURI = uri + + +class DOMBuilderFilter: + """Element filter which can be used to tailor construction of + a DOM instance. + """ + + # There's really no need for this class; concrete implementations + # should just implement the endElement() and startElement() + # methods as appropriate. Using this makes it easy to only + # implement one of them. + + FILTER_ACCEPT = 1 + FILTER_REJECT = 2 + FILTER_SKIP = 3 + FILTER_INTERRUPT = 4 + + whatToShow = NodeFilter.SHOW_ALL + + def _get_whatToShow(self): + return self.whatToShow + + def acceptNode(self, element): + return self.FILTER_ACCEPT + + def startContainer(self, element): + return self.FILTER_ACCEPT + +del NodeFilter + + +class DocumentLS: + """Mixin to create documents that conform to the load/save spec.""" + + async_ = False + + def _get_async(self): + return False + + def _set_async(self, flag): + if flag: + raise xml.dom.NotSupportedErr( + "asynchronous document loading is not supported") + + def abort(self): + # What does it mean to "clear" a document? Does the + # documentElement disappear? + raise NotImplementedError( + "haven't figured out what this means yet") + + def load(self, uri): + raise NotImplementedError("haven't written this yet") + + def loadXML(self, source): + raise NotImplementedError("haven't written this yet") + + def saveXML(self, snode): + if snode is None: + snode = self + elif snode.ownerDocument is not self: + raise xml.dom.WrongDocumentErr() + return snode.toxml() + + +class DOMImplementationLS: + MODE_SYNCHRONOUS = 1 + MODE_ASYNCHRONOUS = 2 + + def createDOMBuilder(self, mode, schemaType): + if schemaType is not None: + raise xml.dom.NotSupportedErr( + "schemaType not yet supported") + if mode == self.MODE_SYNCHRONOUS: + return DOMBuilder() + if mode == self.MODE_ASYNCHRONOUS: + raise xml.dom.NotSupportedErr( + "asynchronous builders are not supported") + raise ValueError("unknown value for mode") + + def createDOMWriter(self): + raise NotImplementedError( + "the writer interface hasn't been written yet!") + + def createDOMInputSource(self): + return DOMInputSource() diff --git a/miniconda3/envs/active_proaction/lib/python3.10/xml/etree/ElementInclude.py b/miniconda3/envs/active_proaction/lib/python3.10/xml/etree/ElementInclude.py new file mode 100644 index 0000000000000000000000000000000000000000..40a9b22292479fc43e8895a27e22b6846bc9abfe --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/xml/etree/ElementInclude.py @@ -0,0 +1,185 @@ +# +# ElementTree +# $Id: ElementInclude.py 3375 2008-02-13 08:05:08Z fredrik $ +# +# limited xinclude support for element trees +# +# history: +# 2003-08-15 fl created +# 2003-11-14 fl fixed default loader +# +# Copyright (c) 2003-2004 by Fredrik Lundh. All rights reserved. +# +# fredrik@pythonware.com +# http://www.pythonware.com +# +# -------------------------------------------------------------------- +# The ElementTree toolkit is +# +# Copyright (c) 1999-2008 by Fredrik Lundh +# +# By obtaining, using, and/or copying this software and/or its +# associated documentation, you agree that you have read, understood, +# and will comply with the following terms and conditions: +# +# Permission to use, copy, modify, and distribute this software and +# its associated documentation for any purpose and without fee is +# hereby granted, provided that the above copyright notice appears in +# all copies, and that both that copyright notice and this permission +# notice appear in supporting documentation, and that the name of +# Secret Labs AB or the author not be used in advertising or publicity +# pertaining to distribution of the software without specific, written +# prior permission. +# +# SECRET LABS AB AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD +# TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANT- +# ABILITY AND FITNESS. IN NO EVENT SHALL SECRET LABS AB OR THE AUTHOR +# 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. +# -------------------------------------------------------------------- + +# Licensed to PSF under a Contributor Agreement. +# See https://www.python.org/psf/license for licensing details. + +## +# Limited XInclude support for the ElementTree package. +## + +import copy +from . import ElementTree +from urllib.parse import urljoin + +XINCLUDE = "{http://www.w3.org/2001/XInclude}" + +XINCLUDE_INCLUDE = XINCLUDE + "include" +XINCLUDE_FALLBACK = XINCLUDE + "fallback" + +# For security reasons, the inclusion depth is limited to this read-only value by default. +DEFAULT_MAX_INCLUSION_DEPTH = 6 + + +## +# Fatal include error. + +class FatalIncludeError(SyntaxError): + pass + + +class LimitedRecursiveIncludeError(FatalIncludeError): + pass + + +## +# Default loader. This loader reads an included resource from disk. +# +# @param href Resource reference. +# @param parse Parse mode. Either "xml" or "text". +# @param encoding Optional text encoding (UTF-8 by default for "text"). +# @return The expanded resource. If the parse mode is "xml", this +# is an ElementTree instance. If the parse mode is "text", this +# is a Unicode string. If the loader fails, it can return None +# or raise an OSError exception. +# @throws OSError If the loader fails to load the resource. + +def default_loader(href, parse, encoding=None): + if parse == "xml": + with open(href, 'rb') as file: + data = ElementTree.parse(file).getroot() + else: + if not encoding: + encoding = 'UTF-8' + with open(href, 'r', encoding=encoding) as file: + data = file.read() + return data + +## +# Expand XInclude directives. +# +# @param elem Root element. +# @param loader Optional resource loader. If omitted, it defaults +# to {@link default_loader}. If given, it should be a callable +# that implements the same interface as default_loader. +# @param base_url The base URL of the original file, to resolve +# relative include file references. +# @param max_depth The maximum number of recursive inclusions. +# Limited to reduce the risk of malicious content explosion. +# Pass a negative value to disable the limitation. +# @throws LimitedRecursiveIncludeError If the {@link max_depth} was exceeded. +# @throws FatalIncludeError If the function fails to include a given +# resource, or if the tree contains malformed XInclude elements. +# @throws IOError If the function fails to load a given resource. +# @returns the node or its replacement if it was an XInclude node + +def include(elem, loader=None, base_url=None, + max_depth=DEFAULT_MAX_INCLUSION_DEPTH): + if max_depth is None: + max_depth = -1 + elif max_depth < 0: + raise ValueError("expected non-negative depth or None for 'max_depth', got %r" % max_depth) + + if hasattr(elem, 'getroot'): + elem = elem.getroot() + if loader is None: + loader = default_loader + + _include(elem, loader, base_url, max_depth, set()) + + +def _include(elem, loader, base_url, max_depth, _parent_hrefs): + # look for xinclude elements + i = 0 + while i < len(elem): + e = elem[i] + if e.tag == XINCLUDE_INCLUDE: + # process xinclude directive + href = e.get("href") + if base_url: + href = urljoin(base_url, href) + parse = e.get("parse", "xml") + if parse == "xml": + if href in _parent_hrefs: + raise FatalIncludeError("recursive include of %s" % href) + if max_depth == 0: + raise LimitedRecursiveIncludeError( + "maximum xinclude depth reached when including file %s" % href) + _parent_hrefs.add(href) + node = loader(href, parse) + if node is None: + raise FatalIncludeError( + "cannot load %r as %r" % (href, parse) + ) + node = copy.copy(node) # FIXME: this makes little sense with recursive includes + _include(node, loader, href, max_depth - 1, _parent_hrefs) + _parent_hrefs.remove(href) + if e.tail: + node.tail = (node.tail or "") + e.tail + elem[i] = node + elif parse == "text": + text = loader(href, parse, e.get("encoding")) + if text is None: + raise FatalIncludeError( + "cannot load %r as %r" % (href, parse) + ) + if e.tail: + text += e.tail + if i: + node = elem[i-1] + node.tail = (node.tail or "") + text + else: + elem.text = (elem.text or "") + text + del elem[i] + continue + else: + raise FatalIncludeError( + "unknown parse type in xi:include tag (%r)" % parse + ) + elif e.tag == XINCLUDE_FALLBACK: + raise FatalIncludeError( + "xi:fallback tag must be child of xi:include (%r)" % e.tag + ) + else: + _include(e, loader, base_url, max_depth, _parent_hrefs) + i += 1 diff --git a/miniconda3/envs/active_proaction/lib/python3.10/xml/etree/ElementPath.py b/miniconda3/envs/active_proaction/lib/python3.10/xml/etree/ElementPath.py new file mode 100644 index 0000000000000000000000000000000000000000..cd3c354d0813ee4b55000431306736c653331d51 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/xml/etree/ElementPath.py @@ -0,0 +1,421 @@ +# +# ElementTree +# $Id: ElementPath.py 3375 2008-02-13 08:05:08Z fredrik $ +# +# limited xpath support for element trees +# +# history: +# 2003-05-23 fl created +# 2003-05-28 fl added support for // etc +# 2003-08-27 fl fixed parsing of periods in element names +# 2007-09-10 fl new selection engine +# 2007-09-12 fl fixed parent selector +# 2007-09-13 fl added iterfind; changed findall to return a list +# 2007-11-30 fl added namespaces support +# 2009-10-30 fl added child element value filter +# +# Copyright (c) 2003-2009 by Fredrik Lundh. All rights reserved. +# +# fredrik@pythonware.com +# http://www.pythonware.com +# +# -------------------------------------------------------------------- +# The ElementTree toolkit is +# +# Copyright (c) 1999-2009 by Fredrik Lundh +# +# By obtaining, using, and/or copying this software and/or its +# associated documentation, you agree that you have read, understood, +# and will comply with the following terms and conditions: +# +# Permission to use, copy, modify, and distribute this software and +# its associated documentation for any purpose and without fee is +# hereby granted, provided that the above copyright notice appears in +# all copies, and that both that copyright notice and this permission +# notice appear in supporting documentation, and that the name of +# Secret Labs AB or the author not be used in advertising or publicity +# pertaining to distribution of the software without specific, written +# prior permission. +# +# SECRET LABS AB AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD +# TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANT- +# ABILITY AND FITNESS. IN NO EVENT SHALL SECRET LABS AB OR THE AUTHOR +# 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. +# -------------------------------------------------------------------- + +# Licensed to PSF under a Contributor Agreement. +# See https://www.python.org/psf/license for licensing details. + +## +# Implementation module for XPath support. There's usually no reason +# to import this module directly; the ElementTree does this for +# you, if needed. +## + +import re + +xpath_tokenizer_re = re.compile( + r"(" + r"'[^']*'|\"[^\"]*\"|" + r"::|" + r"//?|" + r"\.\.|" + r"\(\)|" + r"!=|" + r"[/.*:\[\]\(\)@=])|" + r"((?:\{[^}]+\})?[^/\[\]\(\)@!=\s]+)|" + r"\s+" + ) + +def xpath_tokenizer(pattern, namespaces=None): + default_namespace = namespaces.get('') if namespaces else None + parsing_attribute = False + for token in xpath_tokenizer_re.findall(pattern): + ttype, tag = token + if tag and tag[0] != "{": + if ":" in tag: + prefix, uri = tag.split(":", 1) + try: + if not namespaces: + raise KeyError + yield ttype, "{%s}%s" % (namespaces[prefix], uri) + except KeyError: + raise SyntaxError("prefix %r not found in prefix map" % prefix) from None + elif default_namespace and not parsing_attribute: + yield ttype, "{%s}%s" % (default_namespace, tag) + else: + yield token + parsing_attribute = False + else: + yield token + parsing_attribute = ttype == '@' + + +def get_parent_map(context): + parent_map = context.parent_map + if parent_map is None: + context.parent_map = parent_map = {} + for p in context.root.iter(): + for e in p: + parent_map[e] = p + return parent_map + + +def _is_wildcard_tag(tag): + return tag[:3] == '{*}' or tag[-2:] == '}*' + + +def _prepare_tag(tag): + _isinstance, _str = isinstance, str + if tag == '{*}*': + # Same as '*', but no comments or processing instructions. + # It can be a surprise that '*' includes those, but there is no + # justification for '{*}*' doing the same. + def select(context, result): + for elem in result: + if _isinstance(elem.tag, _str): + yield elem + elif tag == '{}*': + # Any tag that is not in a namespace. + def select(context, result): + for elem in result: + el_tag = elem.tag + if _isinstance(el_tag, _str) and el_tag[0] != '{': + yield elem + elif tag[:3] == '{*}': + # The tag in any (or no) namespace. + suffix = tag[2:] # '}name' + no_ns = slice(-len(suffix), None) + tag = tag[3:] + def select(context, result): + for elem in result: + el_tag = elem.tag + if el_tag == tag or _isinstance(el_tag, _str) and el_tag[no_ns] == suffix: + yield elem + elif tag[-2:] == '}*': + # Any tag in the given namespace. + ns = tag[:-1] + ns_only = slice(None, len(ns)) + def select(context, result): + for elem in result: + el_tag = elem.tag + if _isinstance(el_tag, _str) and el_tag[ns_only] == ns: + yield elem + else: + raise RuntimeError(f"internal parser error, got {tag}") + return select + + +def prepare_child(next, token): + tag = token[1] + if _is_wildcard_tag(tag): + select_tag = _prepare_tag(tag) + def select(context, result): + def select_child(result): + for elem in result: + yield from elem + return select_tag(context, select_child(result)) + else: + if tag[:2] == '{}': + tag = tag[2:] # '{}tag' == 'tag' + def select(context, result): + for elem in result: + for e in elem: + if e.tag == tag: + yield e + return select + +def prepare_star(next, token): + def select(context, result): + for elem in result: + yield from elem + return select + +def prepare_self(next, token): + def select(context, result): + yield from result + return select + +def prepare_descendant(next, token): + try: + token = next() + except StopIteration: + return + if token[0] == "*": + tag = "*" + elif not token[0]: + tag = token[1] + else: + raise SyntaxError("invalid descendant") + + if _is_wildcard_tag(tag): + select_tag = _prepare_tag(tag) + def select(context, result): + def select_child(result): + for elem in result: + for e in elem.iter(): + if e is not elem: + yield e + return select_tag(context, select_child(result)) + else: + if tag[:2] == '{}': + tag = tag[2:] # '{}tag' == 'tag' + def select(context, result): + for elem in result: + for e in elem.iter(tag): + if e is not elem: + yield e + return select + +def prepare_parent(next, token): + def select(context, result): + # FIXME: raise error if .. is applied at toplevel? + parent_map = get_parent_map(context) + result_map = {} + for elem in result: + if elem in parent_map: + parent = parent_map[elem] + if parent not in result_map: + result_map[parent] = None + yield parent + return select + +def prepare_predicate(next, token): + # FIXME: replace with real parser!!! refs: + # http://javascript.crockford.com/tdop/tdop.html + signature = [] + predicate = [] + while 1: + try: + token = next() + except StopIteration: + return + if token[0] == "]": + break + if token == ('', ''): + # ignore whitespace + continue + if token[0] and token[0][:1] in "'\"": + token = "'", token[0][1:-1] + signature.append(token[0] or "-") + predicate.append(token[1]) + signature = "".join(signature) + # use signature to determine predicate type + if signature == "@-": + # [@attribute] predicate + key = predicate[1] + def select(context, result): + for elem in result: + if elem.get(key) is not None: + yield elem + return select + if signature == "@-='" or signature == "@-!='": + # [@attribute='value'] or [@attribute!='value'] + key = predicate[1] + value = predicate[-1] + def select(context, result): + for elem in result: + if elem.get(key) == value: + yield elem + def select_negated(context, result): + for elem in result: + if (attr_value := elem.get(key)) is not None and attr_value != value: + yield elem + return select_negated if '!=' in signature else select + if signature == "-" and not re.match(r"\-?\d+$", predicate[0]): + # [tag] + tag = predicate[0] + def select(context, result): + for elem in result: + if elem.find(tag) is not None: + yield elem + return select + if signature == ".='" or signature == ".!='" or ( + (signature == "-='" or signature == "-!='") + and not re.match(r"\-?\d+$", predicate[0])): + # [.='value'] or [tag='value'] or [.!='value'] or [tag!='value'] + tag = predicate[0] + value = predicate[-1] + if tag: + def select(context, result): + for elem in result: + for e in elem.findall(tag): + if "".join(e.itertext()) == value: + yield elem + break + def select_negated(context, result): + for elem in result: + for e in elem.iterfind(tag): + if "".join(e.itertext()) != value: + yield elem + break + else: + def select(context, result): + for elem in result: + if "".join(elem.itertext()) == value: + yield elem + def select_negated(context, result): + for elem in result: + if "".join(elem.itertext()) != value: + yield elem + return select_negated if '!=' in signature else select + if signature == "-" or signature == "-()" or signature == "-()-": + # [index] or [last()] or [last()-index] + if signature == "-": + # [index] + index = int(predicate[0]) - 1 + if index < 0: + raise SyntaxError("XPath position >= 1 expected") + else: + if predicate[0] != "last": + raise SyntaxError("unsupported function") + if signature == "-()-": + try: + index = int(predicate[2]) - 1 + except ValueError: + raise SyntaxError("unsupported expression") + if index > -2: + raise SyntaxError("XPath offset from last() must be negative") + else: + index = -1 + def select(context, result): + parent_map = get_parent_map(context) + for elem in result: + try: + parent = parent_map[elem] + # FIXME: what if the selector is "*" ? + elems = list(parent.findall(elem.tag)) + if elems[index] is elem: + yield elem + except (IndexError, KeyError): + pass + return select + raise SyntaxError("invalid predicate") + +ops = { + "": prepare_child, + "*": prepare_star, + ".": prepare_self, + "..": prepare_parent, + "//": prepare_descendant, + "[": prepare_predicate, + } + +_cache = {} + +class _SelectorContext: + parent_map = None + def __init__(self, root): + self.root = root + +# -------------------------------------------------------------------- + +## +# Generate all matching objects. + +def iterfind(elem, path, namespaces=None): + # compile selector pattern + if path[-1:] == "/": + path = path + "*" # implicit all (FIXME: keep this?) + + cache_key = (path,) + if namespaces: + cache_key += tuple(sorted(namespaces.items())) + + try: + selector = _cache[cache_key] + except KeyError: + if len(_cache) > 100: + _cache.clear() + if path[:1] == "/": + raise SyntaxError("cannot use absolute path on element") + next = iter(xpath_tokenizer(path, namespaces)).__next__ + try: + token = next() + except StopIteration: + return + selector = [] + while 1: + try: + selector.append(ops[token[0]](next, token)) + except StopIteration: + raise SyntaxError("invalid path") from None + try: + token = next() + if token[0] == "/": + token = next() + except StopIteration: + break + _cache[cache_key] = selector + # execute selector pattern + result = [elem] + context = _SelectorContext(elem) + for select in selector: + result = select(context, result) + return result + +## +# Find first matching object. + +def find(elem, path, namespaces=None): + return next(iterfind(elem, path, namespaces), None) + +## +# Find all matching objects. + +def findall(elem, path, namespaces=None): + return list(iterfind(elem, path, namespaces)) + +## +# Find text for first matching object. + +def findtext(elem, path, default=None, namespaces=None): + try: + elem = next(iterfind(elem, path, namespaces)) + return elem.text or "" + except StopIteration: + return default diff --git a/miniconda3/envs/active_proaction/lib/python3.10/xml/etree/ElementTree.py b/miniconda3/envs/active_proaction/lib/python3.10/xml/etree/ElementTree.py new file mode 100644 index 0000000000000000000000000000000000000000..516656b69e3dfef076825ad47472d8265ca6312c --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/xml/etree/ElementTree.py @@ -0,0 +1,2097 @@ +"""Lightweight XML support for Python. + + XML is an inherently hierarchical data format, and the most natural way to + represent it is with a tree. This module has two classes for this purpose: + + 1. ElementTree represents the whole XML document as a tree and + + 2. Element represents a single node in this tree. + + Interactions with the whole document (reading and writing to/from files) are + usually done on the ElementTree level. Interactions with a single XML element + and its sub-elements are done on the Element level. + + Element is a flexible container object designed to store hierarchical data + structures in memory. It can be described as a cross between a list and a + dictionary. Each Element has a number of properties associated with it: + + 'tag' - a string containing the element's name. + + 'attributes' - a Python dictionary storing the element's attributes. + + 'text' - a string containing the element's text content. + + 'tail' - an optional string containing text after the element's end tag. + + And a number of child elements stored in a Python sequence. + + To create an element instance, use the Element constructor, + or the SubElement factory function. + + You can also use the ElementTree class to wrap an element structure + and convert it to and from XML. + +""" + +#--------------------------------------------------------------------- +# Licensed to PSF under a Contributor Agreement. +# See https://www.python.org/psf/license for licensing details. +# +# ElementTree +# Copyright (c) 1999-2008 by Fredrik Lundh. All rights reserved. +# +# fredrik@pythonware.com +# http://www.pythonware.com +# -------------------------------------------------------------------- +# The ElementTree toolkit is +# +# Copyright (c) 1999-2008 by Fredrik Lundh +# +# By obtaining, using, and/or copying this software and/or its +# associated documentation, you agree that you have read, understood, +# and will comply with the following terms and conditions: +# +# Permission to use, copy, modify, and distribute this software and +# its associated documentation for any purpose and without fee is +# hereby granted, provided that the above copyright notice appears in +# all copies, and that both that copyright notice and this permission +# notice appear in supporting documentation, and that the name of +# Secret Labs AB or the author not be used in advertising or publicity +# pertaining to distribution of the software without specific, written +# prior permission. +# +# SECRET LABS AB AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD +# TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANT- +# ABILITY AND FITNESS. IN NO EVENT SHALL SECRET LABS AB OR THE AUTHOR +# 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. +# -------------------------------------------------------------------- + +__all__ = [ + # public symbols + "Comment", + "dump", + "Element", "ElementTree", + "fromstring", "fromstringlist", + "indent", "iselement", "iterparse", + "parse", "ParseError", + "PI", "ProcessingInstruction", + "QName", + "SubElement", + "tostring", "tostringlist", + "TreeBuilder", + "VERSION", + "XML", "XMLID", + "XMLParser", "XMLPullParser", + "register_namespace", + "canonicalize", "C14NWriterTarget", + ] + +VERSION = "1.3.0" + +import sys +import re +import warnings +import io +import collections +import collections.abc +import contextlib + +from . import ElementPath + + +class ParseError(SyntaxError): + """An error when parsing an XML document. + + In addition to its exception value, a ParseError contains + two extra attributes: + 'code' - the specific exception code + 'position' - the line and column of the error + + """ + pass + +# -------------------------------------------------------------------- + + +def iselement(element): + """Return True if *element* appears to be an Element.""" + return hasattr(element, 'tag') + + +class Element: + """An XML element. + + This class is the reference implementation of the Element interface. + + An element's length is its number of subelements. That means if you + want to check if an element is truly empty, you should check BOTH + its length AND its text attribute. + + The element tag, attribute names, and attribute values can be either + bytes or strings. + + *tag* is the element name. *attrib* is an optional dictionary containing + element attributes. *extra* are additional element attributes given as + keyword arguments. + + Example form: + text...tail + + """ + + tag = None + """The element's name.""" + + attrib = None + """Dictionary of the element's attributes.""" + + text = None + """ + Text before first subelement. This is either a string or the value None. + Note that if there is no text, this attribute may be either + None or the empty string, depending on the parser. + + """ + + tail = None + """ + Text after this element's end tag, but before the next sibling element's + start tag. This is either a string or the value None. Note that if there + was no text, this attribute may be either None or an empty string, + depending on the parser. + + """ + + def __init__(self, tag, attrib={}, **extra): + if not isinstance(attrib, dict): + raise TypeError("attrib must be dict, not %s" % ( + attrib.__class__.__name__,)) + self.tag = tag + self.attrib = {**attrib, **extra} + self._children = [] + + def __repr__(self): + return "<%s %r at %#x>" % (self.__class__.__name__, self.tag, id(self)) + + def makeelement(self, tag, attrib): + """Create a new element with the same type. + + *tag* is a string containing the element name. + *attrib* is a dictionary containing the element attributes. + + Do not call this method, use the SubElement factory function instead. + + """ + return self.__class__(tag, attrib) + + def copy(self): + """Return copy of current element. + + This creates a shallow copy. Subelements will be shared with the + original tree. + + """ + warnings.warn( + "elem.copy() is deprecated. Use copy.copy(elem) instead.", + DeprecationWarning + ) + return self.__copy__() + + def __copy__(self): + elem = self.makeelement(self.tag, self.attrib) + elem.text = self.text + elem.tail = self.tail + elem[:] = self + return elem + + def __len__(self): + return len(self._children) + + def __bool__(self): + warnings.warn( + "The behavior of this method will change in future versions. " + "Use specific 'len(elem)' or 'elem is not None' test instead.", + FutureWarning, stacklevel=2 + ) + return len(self._children) != 0 # emulate old behaviour, for now + + def __getitem__(self, index): + return self._children[index] + + def __setitem__(self, index, element): + if isinstance(index, slice): + for elt in element: + self._assert_is_element(elt) + else: + self._assert_is_element(element) + self._children[index] = element + + def __delitem__(self, index): + del self._children[index] + + def append(self, subelement): + """Add *subelement* to the end of this element. + + The new element will appear in document order after the last existing + subelement (or directly after the text, if it's the first subelement), + but before the end tag for this element. + + """ + self._assert_is_element(subelement) + self._children.append(subelement) + + def extend(self, elements): + """Append subelements from a sequence. + + *elements* is a sequence with zero or more elements. + + """ + for element in elements: + self._assert_is_element(element) + self._children.append(element) + + def insert(self, index, subelement): + """Insert *subelement* at position *index*.""" + self._assert_is_element(subelement) + self._children.insert(index, subelement) + + def _assert_is_element(self, e): + # Need to refer to the actual Python implementation, not the + # shadowing C implementation. + if not isinstance(e, _Element_Py): + raise TypeError('expected an Element, not %s' % type(e).__name__) + + def remove(self, subelement): + """Remove matching subelement. + + Unlike the find methods, this method compares elements based on + identity, NOT ON tag value or contents. To remove subelements by + other means, the easiest way is to use a list comprehension to + select what elements to keep, and then use slice assignment to update + the parent element. + + ValueError is raised if a matching element could not be found. + + """ + # assert iselement(element) + self._children.remove(subelement) + + def find(self, path, namespaces=None): + """Find first matching element by tag name or path. + + *path* is a string having either an element tag or an XPath, + *namespaces* is an optional mapping from namespace prefix to full name. + + Return the first matching element, or None if no element was found. + + """ + return ElementPath.find(self, path, namespaces) + + def findtext(self, path, default=None, namespaces=None): + """Find text for first matching element by tag name or path. + + *path* is a string having either an element tag or an XPath, + *default* is the value to return if the element was not found, + *namespaces* is an optional mapping from namespace prefix to full name. + + Return text content of first matching element, or default value if + none was found. Note that if an element is found having no text + content, the empty string is returned. + + """ + return ElementPath.findtext(self, path, default, namespaces) + + def findall(self, path, namespaces=None): + """Find all matching subelements by tag name or path. + + *path* is a string having either an element tag or an XPath, + *namespaces* is an optional mapping from namespace prefix to full name. + + Returns list containing all matching elements in document order. + + """ + return ElementPath.findall(self, path, namespaces) + + def iterfind(self, path, namespaces=None): + """Find all matching subelements by tag name or path. + + *path* is a string having either an element tag or an XPath, + *namespaces* is an optional mapping from namespace prefix to full name. + + Return an iterable yielding all matching elements in document order. + + """ + return ElementPath.iterfind(self, path, namespaces) + + def clear(self): + """Reset element. + + This function removes all subelements, clears all attributes, and sets + the text and tail attributes to None. + + """ + self.attrib.clear() + self._children = [] + self.text = self.tail = None + + def get(self, key, default=None): + """Get element attribute. + + Equivalent to attrib.get, but some implementations may handle this a + bit more efficiently. *key* is what attribute to look for, and + *default* is what to return if the attribute was not found. + + Returns a string containing the attribute value, or the default if + attribute was not found. + + """ + return self.attrib.get(key, default) + + def set(self, key, value): + """Set element attribute. + + Equivalent to attrib[key] = value, but some implementations may handle + this a bit more efficiently. *key* is what attribute to set, and + *value* is the attribute value to set it to. + + """ + self.attrib[key] = value + + def keys(self): + """Get list of attribute names. + + Names are returned in an arbitrary order, just like an ordinary + Python dict. Equivalent to attrib.keys() + + """ + return self.attrib.keys() + + def items(self): + """Get element attributes as a sequence. + + The attributes are returned in arbitrary order. Equivalent to + attrib.items(). + + Return a list of (name, value) tuples. + + """ + return self.attrib.items() + + def iter(self, tag=None): + """Create tree iterator. + + The iterator loops over the element and all subelements in document + order, returning all elements with a matching tag. + + If the tree structure is modified during iteration, new or removed + elements may or may not be included. To get a stable set, use the + list() function on the iterator, and loop over the resulting list. + + *tag* is what tags to look for (default is to return all elements) + + Return an iterator containing all the matching elements. + + """ + if tag == "*": + tag = None + if tag is None or self.tag == tag: + yield self + for e in self._children: + yield from e.iter(tag) + + def itertext(self): + """Create text iterator. + + The iterator loops over the element and all subelements in document + order, returning all inner text. + + """ + tag = self.tag + if not isinstance(tag, str) and tag is not None: + return + t = self.text + if t: + yield t + for e in self: + yield from e.itertext() + t = e.tail + if t: + yield t + + +def SubElement(parent, tag, attrib={}, **extra): + """Subelement factory which creates an element instance, and appends it + to an existing parent. + + The element tag, attribute names, and attribute values can be either + bytes or Unicode strings. + + *parent* is the parent element, *tag* is the subelements name, *attrib* is + an optional directory containing element attributes, *extra* are + additional attributes given as keyword arguments. + + """ + attrib = {**attrib, **extra} + element = parent.makeelement(tag, attrib) + parent.append(element) + return element + + +def Comment(text=None): + """Comment element factory. + + This function creates a special element which the standard serializer + serializes as an XML comment. + + *text* is a string containing the comment string. + + """ + element = Element(Comment) + element.text = text + return element + + +def ProcessingInstruction(target, text=None): + """Processing Instruction element factory. + + This function creates a special element which the standard serializer + serializes as an XML comment. + + *target* is a string containing the processing instruction, *text* is a + string containing the processing instruction contents, if any. + + """ + element = Element(ProcessingInstruction) + element.text = target + if text: + element.text = element.text + " " + text + return element + +PI = ProcessingInstruction + + +class QName: + """Qualified name wrapper. + + This class can be used to wrap a QName attribute value in order to get + proper namespace handing on output. + + *text_or_uri* is a string containing the QName value either in the form + {uri}local, or if the tag argument is given, the URI part of a QName. + + *tag* is an optional argument which if given, will make the first + argument (text_or_uri) be interpreted as a URI, and this argument (tag) + be interpreted as a local name. + + """ + def __init__(self, text_or_uri, tag=None): + if tag: + text_or_uri = "{%s}%s" % (text_or_uri, tag) + self.text = text_or_uri + def __str__(self): + return self.text + def __repr__(self): + return '<%s %r>' % (self.__class__.__name__, self.text) + def __hash__(self): + return hash(self.text) + def __le__(self, other): + if isinstance(other, QName): + return self.text <= other.text + return self.text <= other + def __lt__(self, other): + if isinstance(other, QName): + return self.text < other.text + return self.text < other + def __ge__(self, other): + if isinstance(other, QName): + return self.text >= other.text + return self.text >= other + def __gt__(self, other): + if isinstance(other, QName): + return self.text > other.text + return self.text > other + def __eq__(self, other): + if isinstance(other, QName): + return self.text == other.text + return self.text == other + +# -------------------------------------------------------------------- + + +class ElementTree: + """An XML element hierarchy. + + This class also provides support for serialization to and from + standard XML. + + *element* is an optional root element node, + *file* is an optional file handle or file name of an XML file whose + contents will be used to initialize the tree with. + + """ + def __init__(self, element=None, file=None): + # assert element is None or iselement(element) + self._root = element # first node + if file: + self.parse(file) + + def getroot(self): + """Return root element of this tree.""" + return self._root + + def _setroot(self, element): + """Replace root element of this tree. + + This will discard the current contents of the tree and replace it + with the given element. Use with care! + + """ + # assert iselement(element) + self._root = element + + def parse(self, source, parser=None): + """Load external XML document into element tree. + + *source* is a file name or file object, *parser* is an optional parser + instance that defaults to XMLParser. + + ParseError is raised if the parser fails to parse the document. + + Returns the root element of the given source document. + + """ + close_source = False + if not hasattr(source, "read"): + source = open(source, "rb") + close_source = True + try: + if parser is None: + # If no parser was specified, create a default XMLParser + parser = XMLParser() + if hasattr(parser, '_parse_whole'): + # The default XMLParser, when it comes from an accelerator, + # can define an internal _parse_whole API for efficiency. + # It can be used to parse the whole source without feeding + # it with chunks. + self._root = parser._parse_whole(source) + return self._root + while True: + data = source.read(65536) + if not data: + break + parser.feed(data) + self._root = parser.close() + return self._root + finally: + if close_source: + source.close() + + def iter(self, tag=None): + """Create and return tree iterator for the root element. + + The iterator loops over all elements in this tree, in document order. + + *tag* is a string with the tag name to iterate over + (default is to return all elements). + + """ + # assert self._root is not None + return self._root.iter(tag) + + def find(self, path, namespaces=None): + """Find first matching element by tag name or path. + + Same as getroot().find(path), which is Element.find() + + *path* is a string having either an element tag or an XPath, + *namespaces* is an optional mapping from namespace prefix to full name. + + Return the first matching element, or None if no element was found. + + """ + # assert self._root is not None + if path[:1] == "/": + path = "." + path + warnings.warn( + "This search is broken in 1.3 and earlier, and will be " + "fixed in a future version. If you rely on the current " + "behaviour, change it to %r" % path, + FutureWarning, stacklevel=2 + ) + return self._root.find(path, namespaces) + + def findtext(self, path, default=None, namespaces=None): + """Find first matching element by tag name or path. + + Same as getroot().findtext(path), which is Element.findtext() + + *path* is a string having either an element tag or an XPath, + *namespaces* is an optional mapping from namespace prefix to full name. + + Return the first matching element, or None if no element was found. + + """ + # assert self._root is not None + if path[:1] == "/": + path = "." + path + warnings.warn( + "This search is broken in 1.3 and earlier, and will be " + "fixed in a future version. If you rely on the current " + "behaviour, change it to %r" % path, + FutureWarning, stacklevel=2 + ) + return self._root.findtext(path, default, namespaces) + + def findall(self, path, namespaces=None): + """Find all matching subelements by tag name or path. + + Same as getroot().findall(path), which is Element.findall(). + + *path* is a string having either an element tag or an XPath, + *namespaces* is an optional mapping from namespace prefix to full name. + + Return list containing all matching elements in document order. + + """ + # assert self._root is not None + if path[:1] == "/": + path = "." + path + warnings.warn( + "This search is broken in 1.3 and earlier, and will be " + "fixed in a future version. If you rely on the current " + "behaviour, change it to %r" % path, + FutureWarning, stacklevel=2 + ) + return self._root.findall(path, namespaces) + + def iterfind(self, path, namespaces=None): + """Find all matching subelements by tag name or path. + + Same as getroot().iterfind(path), which is element.iterfind() + + *path* is a string having either an element tag or an XPath, + *namespaces* is an optional mapping from namespace prefix to full name. + + Return an iterable yielding all matching elements in document order. + + """ + # assert self._root is not None + if path[:1] == "/": + path = "." + path + warnings.warn( + "This search is broken in 1.3 and earlier, and will be " + "fixed in a future version. If you rely on the current " + "behaviour, change it to %r" % path, + FutureWarning, stacklevel=2 + ) + return self._root.iterfind(path, namespaces) + + def write(self, file_or_filename, + encoding=None, + xml_declaration=None, + default_namespace=None, + method=None, *, + short_empty_elements=True): + """Write element tree to a file as XML. + + Arguments: + *file_or_filename* -- file name or a file object opened for writing + + *encoding* -- the output encoding (default: US-ASCII) + + *xml_declaration* -- bool indicating if an XML declaration should be + added to the output. If None, an XML declaration + is added if encoding IS NOT either of: + US-ASCII, UTF-8, or Unicode + + *default_namespace* -- sets the default XML namespace (for "xmlns") + + *method* -- either "xml" (default), "html, "text", or "c14n" + + *short_empty_elements* -- controls the formatting of elements + that contain no content. If True (default) + they are emitted as a single self-closed + tag, otherwise they are emitted as a pair + of start/end tags + + """ + if not method: + method = "xml" + elif method not in _serialize: + raise ValueError("unknown method %r" % method) + if not encoding: + if method == "c14n": + encoding = "utf-8" + else: + encoding = "us-ascii" + with _get_writer(file_or_filename, encoding) as (write, declared_encoding): + if method == "xml" and (xml_declaration or + (xml_declaration is None and + encoding.lower() != "unicode" and + declared_encoding.lower() not in ("utf-8", "us-ascii"))): + write("\n" % ( + declared_encoding,)) + if method == "text": + _serialize_text(write, self._root) + else: + qnames, namespaces = _namespaces(self._root, default_namespace) + serialize = _serialize[method] + serialize(write, self._root, qnames, namespaces, + short_empty_elements=short_empty_elements) + + def write_c14n(self, file): + # lxml.etree compatibility. use output method instead + return self.write(file, method="c14n") + +# -------------------------------------------------------------------- +# serialization support + +@contextlib.contextmanager +def _get_writer(file_or_filename, encoding): + # returns text write method and release all resources after using + try: + write = file_or_filename.write + except AttributeError: + # file_or_filename is a file name + if encoding.lower() == "unicode": + encoding="utf-8" + with open(file_or_filename, "w", encoding=encoding, + errors="xmlcharrefreplace") as file: + yield file.write, encoding + else: + # file_or_filename is a file-like object + # encoding determines if it is a text or binary writer + if encoding.lower() == "unicode": + # use a text writer as is + yield write, getattr(file_or_filename, "encoding", None) or "utf-8" + else: + # wrap a binary writer with TextIOWrapper + with contextlib.ExitStack() as stack: + if isinstance(file_or_filename, io.BufferedIOBase): + file = file_or_filename + elif isinstance(file_or_filename, io.RawIOBase): + file = io.BufferedWriter(file_or_filename) + # Keep the original file open when the BufferedWriter is + # destroyed + stack.callback(file.detach) + else: + # This is to handle passed objects that aren't in the + # IOBase hierarchy, but just have a write method + file = io.BufferedIOBase() + file.writable = lambda: True + file.write = write + try: + # TextIOWrapper uses this methods to determine + # if BOM (for UTF-16, etc) should be added + file.seekable = file_or_filename.seekable + file.tell = file_or_filename.tell + except AttributeError: + pass + file = io.TextIOWrapper(file, + encoding=encoding, + errors="xmlcharrefreplace", + newline="\n") + # Keep the original file open when the TextIOWrapper is + # destroyed + stack.callback(file.detach) + yield file.write, encoding + +def _namespaces(elem, default_namespace=None): + # identify namespaces used in this tree + + # maps qnames to *encoded* prefix:local names + qnames = {None: None} + + # maps uri:s to prefixes + namespaces = {} + if default_namespace: + namespaces[default_namespace] = "" + + def add_qname(qname): + # calculate serialized qname representation + try: + if qname[:1] == "{": + uri, tag = qname[1:].rsplit("}", 1) + prefix = namespaces.get(uri) + if prefix is None: + prefix = _namespace_map.get(uri) + if prefix is None: + prefix = "ns%d" % len(namespaces) + if prefix != "xml": + namespaces[uri] = prefix + if prefix: + qnames[qname] = "%s:%s" % (prefix, tag) + else: + qnames[qname] = tag # default element + else: + if default_namespace: + # FIXME: can this be handled in XML 1.0? + raise ValueError( + "cannot use non-qualified names with " + "default_namespace option" + ) + qnames[qname] = qname + except TypeError: + _raise_serialization_error(qname) + + # populate qname and namespaces table + for elem in elem.iter(): + tag = elem.tag + if isinstance(tag, QName): + if tag.text not in qnames: + add_qname(tag.text) + elif isinstance(tag, str): + if tag not in qnames: + add_qname(tag) + elif tag is not None and tag is not Comment and tag is not PI: + _raise_serialization_error(tag) + for key, value in elem.items(): + if isinstance(key, QName): + key = key.text + if key not in qnames: + add_qname(key) + if isinstance(value, QName) and value.text not in qnames: + add_qname(value.text) + text = elem.text + if isinstance(text, QName) and text.text not in qnames: + add_qname(text.text) + return qnames, namespaces + +def _serialize_xml(write, elem, qnames, namespaces, + short_empty_elements, **kwargs): + tag = elem.tag + text = elem.text + if tag is Comment: + write("" % text) + elif tag is ProcessingInstruction: + write("" % text) + else: + tag = qnames[tag] + if tag is None: + if text: + write(_escape_cdata(text)) + for e in elem: + _serialize_xml(write, e, qnames, None, + short_empty_elements=short_empty_elements) + else: + write("<" + tag) + items = list(elem.items()) + if items or namespaces: + if namespaces: + for v, k in sorted(namespaces.items(), + key=lambda x: x[1]): # sort on prefix + if k: + k = ":" + k + write(" xmlns%s=\"%s\"" % ( + k, + _escape_attrib(v) + )) + for k, v in items: + if isinstance(k, QName): + k = k.text + if isinstance(v, QName): + v = qnames[v.text] + else: + v = _escape_attrib(v) + write(" %s=\"%s\"" % (qnames[k], v)) + if text or len(elem) or not short_empty_elements: + write(">") + if text: + write(_escape_cdata(text)) + for e in elem: + _serialize_xml(write, e, qnames, None, + short_empty_elements=short_empty_elements) + write("") + else: + write(" />") + if elem.tail: + write(_escape_cdata(elem.tail)) + +HTML_EMPTY = ("area", "base", "basefont", "br", "col", "frame", "hr", + "img", "input", "isindex", "link", "meta", "param") + +try: + HTML_EMPTY = set(HTML_EMPTY) +except NameError: + pass + +def _serialize_html(write, elem, qnames, namespaces, **kwargs): + tag = elem.tag + text = elem.text + if tag is Comment: + write("" % _escape_cdata(text)) + elif tag is ProcessingInstruction: + write("" % _escape_cdata(text)) + else: + tag = qnames[tag] + if tag is None: + if text: + write(_escape_cdata(text)) + for e in elem: + _serialize_html(write, e, qnames, None) + else: + write("<" + tag) + items = list(elem.items()) + if items or namespaces: + if namespaces: + for v, k in sorted(namespaces.items(), + key=lambda x: x[1]): # sort on prefix + if k: + k = ":" + k + write(" xmlns%s=\"%s\"" % ( + k, + _escape_attrib(v) + )) + for k, v in items: + if isinstance(k, QName): + k = k.text + if isinstance(v, QName): + v = qnames[v.text] + else: + v = _escape_attrib_html(v) + # FIXME: handle boolean attributes + write(" %s=\"%s\"" % (qnames[k], v)) + write(">") + ltag = tag.lower() + if text: + if ltag == "script" or ltag == "style": + write(text) + else: + write(_escape_cdata(text)) + for e in elem: + _serialize_html(write, e, qnames, None) + if ltag not in HTML_EMPTY: + write("") + if elem.tail: + write(_escape_cdata(elem.tail)) + +def _serialize_text(write, elem): + for part in elem.itertext(): + write(part) + if elem.tail: + write(elem.tail) + +_serialize = { + "xml": _serialize_xml, + "html": _serialize_html, + "text": _serialize_text, +# this optional method is imported at the end of the module +# "c14n": _serialize_c14n, +} + + +def register_namespace(prefix, uri): + """Register a namespace prefix. + + The registry is global, and any existing mapping for either the + given prefix or the namespace URI will be removed. + + *prefix* is the namespace prefix, *uri* is a namespace uri. Tags and + attributes in this namespace will be serialized with prefix if possible. + + ValueError is raised if prefix is reserved or is invalid. + + """ + if re.match(r"ns\d+$", prefix): + raise ValueError("Prefix format reserved for internal use") + for k, v in list(_namespace_map.items()): + if k == uri or v == prefix: + del _namespace_map[k] + _namespace_map[uri] = prefix + +_namespace_map = { + # "well-known" namespace prefixes + "http://www.w3.org/XML/1998/namespace": "xml", + "http://www.w3.org/1999/xhtml": "html", + "http://www.w3.org/1999/02/22-rdf-syntax-ns#": "rdf", + "http://schemas.xmlsoap.org/wsdl/": "wsdl", + # xml schema + "http://www.w3.org/2001/XMLSchema": "xs", + "http://www.w3.org/2001/XMLSchema-instance": "xsi", + # dublin core + "http://purl.org/dc/elements/1.1/": "dc", +} +# For tests and troubleshooting +register_namespace._namespace_map = _namespace_map + +def _raise_serialization_error(text): + raise TypeError( + "cannot serialize %r (type %s)" % (text, type(text).__name__) + ) + +def _escape_cdata(text): + # escape character data + try: + # it's worth avoiding do-nothing calls for strings that are + # shorter than 500 characters, or so. assume that's, by far, + # the most common case in most applications. + if "&" in text: + text = text.replace("&", "&") + if "<" in text: + text = text.replace("<", "<") + if ">" in text: + text = text.replace(">", ">") + return text + except (TypeError, AttributeError): + _raise_serialization_error(text) + +def _escape_attrib(text): + # escape attribute value + try: + if "&" in text: + text = text.replace("&", "&") + if "<" in text: + text = text.replace("<", "<") + if ">" in text: + text = text.replace(">", ">") + if "\"" in text: + text = text.replace("\"", """) + # Although section 2.11 of the XML specification states that CR or + # CR LN should be replaced with just LN, it applies only to EOLNs + # which take part of organizing file into lines. Within attributes, + # we are replacing these with entity numbers, so they do not count. + # http://www.w3.org/TR/REC-xml/#sec-line-ends + # The current solution, contained in following six lines, was + # discussed in issue 17582 and 39011. + if "\r" in text: + text = text.replace("\r", " ") + if "\n" in text: + text = text.replace("\n", " ") + if "\t" in text: + text = text.replace("\t", " ") + return text + except (TypeError, AttributeError): + _raise_serialization_error(text) + +def _escape_attrib_html(text): + # escape attribute value + try: + if "&" in text: + text = text.replace("&", "&") + if ">" in text: + text = text.replace(">", ">") + if "\"" in text: + text = text.replace("\"", """) + return text + except (TypeError, AttributeError): + _raise_serialization_error(text) + +# -------------------------------------------------------------------- + +def tostring(element, encoding=None, method=None, *, + xml_declaration=None, default_namespace=None, + short_empty_elements=True): + """Generate string representation of XML element. + + All subelements are included. If encoding is "unicode", a string + is returned. Otherwise a bytestring is returned. + + *element* is an Element instance, *encoding* is an optional output + encoding defaulting to US-ASCII, *method* is an optional output which can + be one of "xml" (default), "html", "text" or "c14n", *default_namespace* + sets the default XML namespace (for "xmlns"). + + Returns an (optionally) encoded string containing the XML data. + + """ + stream = io.StringIO() if encoding == 'unicode' else io.BytesIO() + ElementTree(element).write(stream, encoding, + xml_declaration=xml_declaration, + default_namespace=default_namespace, + method=method, + short_empty_elements=short_empty_elements) + return stream.getvalue() + +class _ListDataStream(io.BufferedIOBase): + """An auxiliary stream accumulating into a list reference.""" + def __init__(self, lst): + self.lst = lst + + def writable(self): + return True + + def seekable(self): + return True + + def write(self, b): + self.lst.append(b) + + def tell(self): + return len(self.lst) + +def tostringlist(element, encoding=None, method=None, *, + xml_declaration=None, default_namespace=None, + short_empty_elements=True): + lst = [] + stream = _ListDataStream(lst) + ElementTree(element).write(stream, encoding, + xml_declaration=xml_declaration, + default_namespace=default_namespace, + method=method, + short_empty_elements=short_empty_elements) + return lst + + +def dump(elem): + """Write element tree or element structure to sys.stdout. + + This function should be used for debugging only. + + *elem* is either an ElementTree, or a single Element. The exact output + format is implementation dependent. In this version, it's written as an + ordinary XML file. + + """ + # debugging + if not isinstance(elem, ElementTree): + elem = ElementTree(elem) + elem.write(sys.stdout, encoding="unicode") + tail = elem.getroot().tail + if not tail or tail[-1] != "\n": + sys.stdout.write("\n") + + +def indent(tree, space=" ", level=0): + """Indent an XML document by inserting newlines and indentation space + after elements. + + *tree* is the ElementTree or Element to modify. The (root) element + itself will not be changed, but the tail text of all elements in its + subtree will be adapted. + + *space* is the whitespace to insert for each indentation level, two + space characters by default. + + *level* is the initial indentation level. Setting this to a higher + value than 0 can be used for indenting subtrees that are more deeply + nested inside of a document. + """ + if isinstance(tree, ElementTree): + tree = tree.getroot() + if level < 0: + raise ValueError(f"Initial indentation level must be >= 0, got {level}") + if not len(tree): + return + + # Reduce the memory consumption by reusing indentation strings. + indentations = ["\n" + level * space] + + def _indent_children(elem, level): + # Start a new indentation level for the first child. + child_level = level + 1 + try: + child_indentation = indentations[child_level] + except IndexError: + child_indentation = indentations[level] + space + indentations.append(child_indentation) + + if not elem.text or not elem.text.strip(): + elem.text = child_indentation + + for child in elem: + if len(child): + _indent_children(child, child_level) + if not child.tail or not child.tail.strip(): + child.tail = child_indentation + + # Dedent after the last child by overwriting the previous indentation. + if not child.tail.strip(): + child.tail = indentations[level] + + _indent_children(tree, 0) + + +# -------------------------------------------------------------------- +# parsing + + +def parse(source, parser=None): + """Parse XML document into element tree. + + *source* is a filename or file object containing XML data, + *parser* is an optional parser instance defaulting to XMLParser. + + Return an ElementTree instance. + + """ + tree = ElementTree() + tree.parse(source, parser) + return tree + + +def iterparse(source, events=None, parser=None): + """Incrementally parse XML document into ElementTree. + + This class also reports what's going on to the user based on the + *events* it is initialized with. The supported events are the strings + "start", "end", "start-ns" and "end-ns" (the "ns" events are used to get + detailed namespace information). If *events* is omitted, only + "end" events are reported. + + *source* is a filename or file object containing XML data, *events* is + a list of events to report back, *parser* is an optional parser instance. + + Returns an iterator providing (event, elem) pairs. + + """ + # Use the internal, undocumented _parser argument for now; When the + # parser argument of iterparse is removed, this can be killed. + pullparser = XMLPullParser(events=events, _parser=parser) + + def iterator(source): + close_source = False + try: + if not hasattr(source, "read"): + source = open(source, "rb") + close_source = True + yield None + while True: + yield from pullparser.read_events() + # load event buffer + data = source.read(16 * 1024) + if not data: + break + pullparser.feed(data) + root = pullparser._close_and_return_root() + yield from pullparser.read_events() + it.root = root + finally: + if close_source: + source.close() + + class IterParseIterator(collections.abc.Iterator): + __next__ = iterator(source).__next__ + it = IterParseIterator() + it.root = None + del iterator, IterParseIterator + + next(it) + return it + + +class XMLPullParser: + + def __init__(self, events=None, *, _parser=None): + # The _parser argument is for internal use only and must not be relied + # upon in user code. It will be removed in a future release. + # See https://bugs.python.org/issue17741 for more details. + + self._events_queue = collections.deque() + self._parser = _parser or XMLParser(target=TreeBuilder()) + # wire up the parser for event reporting + if events is None: + events = ("end",) + self._parser._setevents(self._events_queue, events) + + def feed(self, data): + """Feed encoded data to parser.""" + if self._parser is None: + raise ValueError("feed() called after end of stream") + if data: + try: + self._parser.feed(data) + except SyntaxError as exc: + self._events_queue.append(exc) + + def _close_and_return_root(self): + # iterparse needs this to set its root attribute properly :( + root = self._parser.close() + self._parser = None + return root + + def close(self): + """Finish feeding data to parser. + + Unlike XMLParser, does not return the root element. Use + read_events() to consume elements from XMLPullParser. + """ + self._close_and_return_root() + + def read_events(self): + """Return an iterator over currently available (event, elem) pairs. + + Events are consumed from the internal event queue as they are + retrieved from the iterator. + """ + events = self._events_queue + while events: + event = events.popleft() + if isinstance(event, Exception): + raise event + else: + yield event + + def flush(self): + if self._parser is None: + raise ValueError("flush() called after end of stream") + self._parser.flush() + + +def XML(text, parser=None): + """Parse XML document from string constant. + + This function can be used to embed "XML Literals" in Python code. + + *text* is a string containing XML data, *parser* is an + optional parser instance, defaulting to the standard XMLParser. + + Returns an Element instance. + + """ + if not parser: + parser = XMLParser(target=TreeBuilder()) + parser.feed(text) + return parser.close() + + +def XMLID(text, parser=None): + """Parse XML document from string constant for its IDs. + + *text* is a string containing XML data, *parser* is an + optional parser instance, defaulting to the standard XMLParser. + + Returns an (Element, dict) tuple, in which the + dict maps element id:s to elements. + + """ + if not parser: + parser = XMLParser(target=TreeBuilder()) + parser.feed(text) + tree = parser.close() + ids = {} + for elem in tree.iter(): + id = elem.get("id") + if id: + ids[id] = elem + return tree, ids + +# Parse XML document from string constant. Alias for XML(). +fromstring = XML + +def fromstringlist(sequence, parser=None): + """Parse XML document from sequence of string fragments. + + *sequence* is a list of other sequence, *parser* is an optional parser + instance, defaulting to the standard XMLParser. + + Returns an Element instance. + + """ + if not parser: + parser = XMLParser(target=TreeBuilder()) + for text in sequence: + parser.feed(text) + return parser.close() + +# -------------------------------------------------------------------- + + +class TreeBuilder: + """Generic element structure builder. + + This builder converts a sequence of start, data, and end method + calls to a well-formed element structure. + + You can use this class to build an element structure using a custom XML + parser, or a parser for some other XML-like format. + + *element_factory* is an optional element factory which is called + to create new Element instances, as necessary. + + *comment_factory* is a factory to create comments to be used instead of + the standard factory. If *insert_comments* is false (the default), + comments will not be inserted into the tree. + + *pi_factory* is a factory to create processing instructions to be used + instead of the standard factory. If *insert_pis* is false (the default), + processing instructions will not be inserted into the tree. + """ + def __init__(self, element_factory=None, *, + comment_factory=None, pi_factory=None, + insert_comments=False, insert_pis=False): + self._data = [] # data collector + self._elem = [] # element stack + self._last = None # last element + self._root = None # root element + self._tail = None # true if we're after an end tag + if comment_factory is None: + comment_factory = Comment + self._comment_factory = comment_factory + self.insert_comments = insert_comments + if pi_factory is None: + pi_factory = ProcessingInstruction + self._pi_factory = pi_factory + self.insert_pis = insert_pis + if element_factory is None: + element_factory = Element + self._factory = element_factory + + def close(self): + """Flush builder buffers and return toplevel document Element.""" + assert len(self._elem) == 0, "missing end tags" + assert self._root is not None, "missing toplevel element" + return self._root + + def _flush(self): + if self._data: + if self._last is not None: + text = "".join(self._data) + if self._tail: + assert self._last.tail is None, "internal error (tail)" + self._last.tail = text + else: + assert self._last.text is None, "internal error (text)" + self._last.text = text + self._data = [] + + def data(self, data): + """Add text to current element.""" + self._data.append(data) + + def start(self, tag, attrs): + """Open new element and return it. + + *tag* is the element name, *attrs* is a dict containing element + attributes. + + """ + self._flush() + self._last = elem = self._factory(tag, attrs) + if self._elem: + self._elem[-1].append(elem) + elif self._root is None: + self._root = elem + self._elem.append(elem) + self._tail = 0 + return elem + + def end(self, tag): + """Close and return current Element. + + *tag* is the element name. + + """ + self._flush() + self._last = self._elem.pop() + assert self._last.tag == tag,\ + "end tag mismatch (expected %s, got %s)" % ( + self._last.tag, tag) + self._tail = 1 + return self._last + + def comment(self, text): + """Create a comment using the comment_factory. + + *text* is the text of the comment. + """ + return self._handle_single( + self._comment_factory, self.insert_comments, text) + + def pi(self, target, text=None): + """Create a processing instruction using the pi_factory. + + *target* is the target name of the processing instruction. + *text* is the data of the processing instruction, or ''. + """ + return self._handle_single( + self._pi_factory, self.insert_pis, target, text) + + def _handle_single(self, factory, insert, *args): + elem = factory(*args) + if insert: + self._flush() + self._last = elem + if self._elem: + self._elem[-1].append(elem) + self._tail = 1 + return elem + + +# also see ElementTree and TreeBuilder +class XMLParser: + """Element structure builder for XML source data based on the expat parser. + + *target* is an optional target object which defaults to an instance of the + standard TreeBuilder class, *encoding* is an optional encoding string + which if given, overrides the encoding specified in the XML file: + http://www.iana.org/assignments/character-sets + + """ + + def __init__(self, *, target=None, encoding=None): + try: + from xml.parsers import expat + except ImportError: + try: + import pyexpat as expat + except ImportError: + raise ImportError( + "No module named expat; use SimpleXMLTreeBuilder instead" + ) + parser = expat.ParserCreate(encoding, "}") + if target is None: + target = TreeBuilder() + # underscored names are provided for compatibility only + self.parser = self._parser = parser + self.target = self._target = target + self._error = expat.error + self._names = {} # name memo cache + # main callbacks + parser.DefaultHandlerExpand = self._default + if hasattr(target, 'start'): + parser.StartElementHandler = self._start + if hasattr(target, 'end'): + parser.EndElementHandler = self._end + if hasattr(target, 'start_ns'): + parser.StartNamespaceDeclHandler = self._start_ns + if hasattr(target, 'end_ns'): + parser.EndNamespaceDeclHandler = self._end_ns + if hasattr(target, 'data'): + parser.CharacterDataHandler = target.data + # miscellaneous callbacks + if hasattr(target, 'comment'): + parser.CommentHandler = target.comment + if hasattr(target, 'pi'): + parser.ProcessingInstructionHandler = target.pi + # Configure pyexpat: buffering, new-style attribute handling. + parser.buffer_text = 1 + parser.ordered_attributes = 1 + self._doctype = None + self.entity = {} + try: + self.version = "Expat %d.%d.%d" % expat.version_info + except AttributeError: + pass # unknown + + def _setevents(self, events_queue, events_to_report): + # Internal API for XMLPullParser + # events_to_report: a list of events to report during parsing (same as + # the *events* of XMLPullParser's constructor. + # events_queue: a list of actual parsing events that will be populated + # by the underlying parser. + # + parser = self._parser + append = events_queue.append + for event_name in events_to_report: + if event_name == "start": + parser.ordered_attributes = 1 + def handler(tag, attrib_in, event=event_name, append=append, + start=self._start): + append((event, start(tag, attrib_in))) + parser.StartElementHandler = handler + elif event_name == "end": + def handler(tag, event=event_name, append=append, + end=self._end): + append((event, end(tag))) + parser.EndElementHandler = handler + elif event_name == "start-ns": + # TreeBuilder does not implement .start_ns() + if hasattr(self.target, "start_ns"): + def handler(prefix, uri, event=event_name, append=append, + start_ns=self._start_ns): + append((event, start_ns(prefix, uri))) + else: + def handler(prefix, uri, event=event_name, append=append): + append((event, (prefix or '', uri or ''))) + parser.StartNamespaceDeclHandler = handler + elif event_name == "end-ns": + # TreeBuilder does not implement .end_ns() + if hasattr(self.target, "end_ns"): + def handler(prefix, event=event_name, append=append, + end_ns=self._end_ns): + append((event, end_ns(prefix))) + else: + def handler(prefix, event=event_name, append=append): + append((event, None)) + parser.EndNamespaceDeclHandler = handler + elif event_name == 'comment': + def handler(text, event=event_name, append=append, self=self): + append((event, self.target.comment(text))) + parser.CommentHandler = handler + elif event_name == 'pi': + def handler(pi_target, data, event=event_name, append=append, + self=self): + append((event, self.target.pi(pi_target, data))) + parser.ProcessingInstructionHandler = handler + else: + raise ValueError("unknown event %r" % event_name) + + def _raiseerror(self, value): + err = ParseError(value) + err.code = value.code + err.position = value.lineno, value.offset + raise err + + def _fixname(self, key): + # expand qname, and convert name string to ascii, if possible + try: + name = self._names[key] + except KeyError: + name = key + if "}" in name: + name = "{" + name + self._names[key] = name + return name + + def _start_ns(self, prefix, uri): + return self.target.start_ns(prefix or '', uri or '') + + def _end_ns(self, prefix): + return self.target.end_ns(prefix or '') + + def _start(self, tag, attr_list): + # Handler for expat's StartElementHandler. Since ordered_attributes + # is set, the attributes are reported as a list of alternating + # attribute name,value. + fixname = self._fixname + tag = fixname(tag) + attrib = {} + if attr_list: + for i in range(0, len(attr_list), 2): + attrib[fixname(attr_list[i])] = attr_list[i+1] + return self.target.start(tag, attrib) + + def _end(self, tag): + return self.target.end(self._fixname(tag)) + + def _default(self, text): + prefix = text[:1] + if prefix == "&": + # deal with undefined entities + try: + data_handler = self.target.data + except AttributeError: + return + try: + data_handler(self.entity[text[1:-1]]) + except KeyError: + from xml.parsers import expat + err = expat.error( + "undefined entity %s: line %d, column %d" % + (text, self.parser.ErrorLineNumber, + self.parser.ErrorColumnNumber) + ) + err.code = 11 # XML_ERROR_UNDEFINED_ENTITY + err.lineno = self.parser.ErrorLineNumber + err.offset = self.parser.ErrorColumnNumber + raise err + elif prefix == "<" and text[:9] == "": + self._doctype = None + return + text = text.strip() + if not text: + return + self._doctype.append(text) + n = len(self._doctype) + if n > 2: + type = self._doctype[1] + if type == "PUBLIC" and n == 4: + name, type, pubid, system = self._doctype + if pubid: + pubid = pubid[1:-1] + elif type == "SYSTEM" and n == 3: + name, type, system = self._doctype + pubid = None + else: + return + if hasattr(self.target, "doctype"): + self.target.doctype(name, pubid, system[1:-1]) + elif hasattr(self, "doctype"): + warnings.warn( + "The doctype() method of XMLParser is ignored. " + "Define doctype() method on the TreeBuilder target.", + RuntimeWarning) + + self._doctype = None + + def feed(self, data): + """Feed encoded data to parser.""" + try: + self.parser.Parse(data, False) + except self._error as v: + self._raiseerror(v) + + def close(self): + """Finish feeding data to parser and return element structure.""" + try: + self.parser.Parse(b"", True) # end of data + except self._error as v: + self._raiseerror(v) + try: + close_handler = self.target.close + except AttributeError: + pass + else: + return close_handler() + finally: + # get rid of circular references + del self.parser, self._parser + del self.target, self._target + + def flush(self): + was_enabled = self.parser.GetReparseDeferralEnabled() + try: + self.parser.SetReparseDeferralEnabled(False) + self.parser.Parse(b"", False) + except self._error as v: + self._raiseerror(v) + finally: + self.parser.SetReparseDeferralEnabled(was_enabled) + +# -------------------------------------------------------------------- +# C14N 2.0 + +def canonicalize(xml_data=None, *, out=None, from_file=None, **options): + """Convert XML to its C14N 2.0 serialised form. + + If *out* is provided, it must be a file or file-like object that receives + the serialised canonical XML output (text, not bytes) through its ``.write()`` + method. To write to a file, open it in text mode with encoding "utf-8". + If *out* is not provided, this function returns the output as text string. + + Either *xml_data* (an XML string) or *from_file* (a file path or + file-like object) must be provided as input. + + The configuration options are the same as for the ``C14NWriterTarget``. + """ + if xml_data is None and from_file is None: + raise ValueError("Either 'xml_data' or 'from_file' must be provided as input") + sio = None + if out is None: + sio = out = io.StringIO() + + parser = XMLParser(target=C14NWriterTarget(out.write, **options)) + + if xml_data is not None: + parser.feed(xml_data) + parser.close() + elif from_file is not None: + parse(from_file, parser=parser) + + return sio.getvalue() if sio is not None else None + + +_looks_like_prefix_name = re.compile(r'^\w+:\w+$', re.UNICODE).match + + +class C14NWriterTarget: + """ + Canonicalization writer target for the XMLParser. + + Serialises parse events to XML C14N 2.0. + + The *write* function is used for writing out the resulting data stream + as text (not bytes). To write to a file, open it in text mode with encoding + "utf-8" and pass its ``.write`` method. + + Configuration options: + + - *with_comments*: set to true to include comments + - *strip_text*: set to true to strip whitespace before and after text content + - *rewrite_prefixes*: set to true to replace namespace prefixes by "n{number}" + - *qname_aware_tags*: a set of qname aware tag names in which prefixes + should be replaced in text content + - *qname_aware_attrs*: a set of qname aware attribute names in which prefixes + should be replaced in text content + - *exclude_attrs*: a set of attribute names that should not be serialised + - *exclude_tags*: a set of tag names that should not be serialised + """ + def __init__(self, write, *, + with_comments=False, strip_text=False, rewrite_prefixes=False, + qname_aware_tags=None, qname_aware_attrs=None, + exclude_attrs=None, exclude_tags=None): + self._write = write + self._data = [] + self._with_comments = with_comments + self._strip_text = strip_text + self._exclude_attrs = set(exclude_attrs) if exclude_attrs else None + self._exclude_tags = set(exclude_tags) if exclude_tags else None + + self._rewrite_prefixes = rewrite_prefixes + if qname_aware_tags: + self._qname_aware_tags = set(qname_aware_tags) + else: + self._qname_aware_tags = None + if qname_aware_attrs: + self._find_qname_aware_attrs = set(qname_aware_attrs).intersection + else: + self._find_qname_aware_attrs = None + + # Stack with globally and newly declared namespaces as (uri, prefix) pairs. + self._declared_ns_stack = [[ + ("http://www.w3.org/XML/1998/namespace", "xml"), + ]] + # Stack with user declared namespace prefixes as (uri, prefix) pairs. + self._ns_stack = [] + if not rewrite_prefixes: + self._ns_stack.append(list(_namespace_map.items())) + self._ns_stack.append([]) + self._prefix_map = {} + self._preserve_space = [False] + self._pending_start = None + self._root_seen = False + self._root_done = False + self._ignored_depth = 0 + + def _iter_namespaces(self, ns_stack, _reversed=reversed): + for namespaces in _reversed(ns_stack): + if namespaces: # almost no element declares new namespaces + yield from namespaces + + def _resolve_prefix_name(self, prefixed_name): + prefix, name = prefixed_name.split(':', 1) + for uri, p in self._iter_namespaces(self._ns_stack): + if p == prefix: + return f'{{{uri}}}{name}' + raise ValueError(f'Prefix {prefix} of QName "{prefixed_name}" is not declared in scope') + + def _qname(self, qname, uri=None): + if uri is None: + uri, tag = qname[1:].rsplit('}', 1) if qname[:1] == '{' else ('', qname) + else: + tag = qname + + prefixes_seen = set() + for u, prefix in self._iter_namespaces(self._declared_ns_stack): + if u == uri and prefix not in prefixes_seen: + return f'{prefix}:{tag}' if prefix else tag, tag, uri + prefixes_seen.add(prefix) + + # Not declared yet => add new declaration. + if self._rewrite_prefixes: + if uri in self._prefix_map: + prefix = self._prefix_map[uri] + else: + prefix = self._prefix_map[uri] = f'n{len(self._prefix_map)}' + self._declared_ns_stack[-1].append((uri, prefix)) + return f'{prefix}:{tag}', tag, uri + + if not uri and '' not in prefixes_seen: + # No default namespace declared => no prefix needed. + return tag, tag, uri + + for u, prefix in self._iter_namespaces(self._ns_stack): + if u == uri: + self._declared_ns_stack[-1].append((uri, prefix)) + return f'{prefix}:{tag}' if prefix else tag, tag, uri + + if not uri: + # As soon as a default namespace is defined, + # anything that has no namespace (and thus, no prefix) goes there. + return tag, tag, uri + + raise ValueError(f'Namespace "{uri}" is not declared in scope') + + def data(self, data): + if not self._ignored_depth: + self._data.append(data) + + def _flush(self, _join_text=''.join): + data = _join_text(self._data) + del self._data[:] + if self._strip_text and not self._preserve_space[-1]: + data = data.strip() + if self._pending_start is not None: + args, self._pending_start = self._pending_start, None + qname_text = data if data and _looks_like_prefix_name(data) else None + self._start(*args, qname_text) + if qname_text is not None: + return + if data and self._root_seen: + self._write(_escape_cdata_c14n(data)) + + def start_ns(self, prefix, uri): + if self._ignored_depth: + return + # we may have to resolve qnames in text content + if self._data: + self._flush() + self._ns_stack[-1].append((uri, prefix)) + + def start(self, tag, attrs): + if self._exclude_tags is not None and ( + self._ignored_depth or tag in self._exclude_tags): + self._ignored_depth += 1 + return + if self._data: + self._flush() + + new_namespaces = [] + self._declared_ns_stack.append(new_namespaces) + + if self._qname_aware_tags is not None and tag in self._qname_aware_tags: + # Need to parse text first to see if it requires a prefix declaration. + self._pending_start = (tag, attrs, new_namespaces) + return + self._start(tag, attrs, new_namespaces) + + def _start(self, tag, attrs, new_namespaces, qname_text=None): + if self._exclude_attrs is not None and attrs: + attrs = {k: v for k, v in attrs.items() if k not in self._exclude_attrs} + + qnames = {tag, *attrs} + resolved_names = {} + + # Resolve prefixes in attribute and tag text. + if qname_text is not None: + qname = resolved_names[qname_text] = self._resolve_prefix_name(qname_text) + qnames.add(qname) + if self._find_qname_aware_attrs is not None and attrs: + qattrs = self._find_qname_aware_attrs(attrs) + if qattrs: + for attr_name in qattrs: + value = attrs[attr_name] + if _looks_like_prefix_name(value): + qname = resolved_names[value] = self._resolve_prefix_name(value) + qnames.add(qname) + else: + qattrs = None + else: + qattrs = None + + # Assign prefixes in lexicographical order of used URIs. + parse_qname = self._qname + parsed_qnames = {n: parse_qname(n) for n in sorted( + qnames, key=lambda n: n.split('}', 1))} + + # Write namespace declarations in prefix order ... + if new_namespaces: + attr_list = [ + ('xmlns:' + prefix if prefix else 'xmlns', uri) + for uri, prefix in new_namespaces + ] + attr_list.sort() + else: + # almost always empty + attr_list = [] + + # ... followed by attributes in URI+name order + if attrs: + for k, v in sorted(attrs.items()): + if qattrs is not None and k in qattrs and v in resolved_names: + v = parsed_qnames[resolved_names[v]][0] + attr_qname, attr_name, uri = parsed_qnames[k] + # No prefix for attributes in default ('') namespace. + attr_list.append((attr_qname if uri else attr_name, v)) + + # Honour xml:space attributes. + space_behaviour = attrs.get('{http://www.w3.org/XML/1998/namespace}space') + self._preserve_space.append( + space_behaviour == 'preserve' if space_behaviour + else self._preserve_space[-1]) + + # Write the tag. + write = self._write + write('<' + parsed_qnames[tag][0]) + if attr_list: + write(''.join([f' {k}="{_escape_attrib_c14n(v)}"' for k, v in attr_list])) + write('>') + + # Write the resolved qname text content. + if qname_text is not None: + write(_escape_cdata_c14n(parsed_qnames[resolved_names[qname_text]][0])) + + self._root_seen = True + self._ns_stack.append([]) + + def end(self, tag): + if self._ignored_depth: + self._ignored_depth -= 1 + return + if self._data: + self._flush() + self._write(f'') + self._preserve_space.pop() + self._root_done = len(self._preserve_space) == 1 + self._declared_ns_stack.pop() + self._ns_stack.pop() + + def comment(self, text): + if not self._with_comments: + return + if self._ignored_depth: + return + if self._root_done: + self._write('\n') + elif self._root_seen and self._data: + self._flush() + self._write(f'') + if not self._root_seen: + self._write('\n') + + def pi(self, target, data): + if self._ignored_depth: + return + if self._root_done: + self._write('\n') + elif self._root_seen and self._data: + self._flush() + self._write( + f'' if data else f'') + if not self._root_seen: + self._write('\n') + + +def _escape_cdata_c14n(text): + # escape character data + try: + # it's worth avoiding do-nothing calls for strings that are + # shorter than 500 character, or so. assume that's, by far, + # the most common case in most applications. + if '&' in text: + text = text.replace('&', '&') + if '<' in text: + text = text.replace('<', '<') + if '>' in text: + text = text.replace('>', '>') + if '\r' in text: + text = text.replace('\r', ' ') + return text + except (TypeError, AttributeError): + _raise_serialization_error(text) + + +def _escape_attrib_c14n(text): + # escape attribute value + try: + if '&' in text: + text = text.replace('&', '&') + if '<' in text: + text = text.replace('<', '<') + if '"' in text: + text = text.replace('"', '"') + if '\t' in text: + text = text.replace('\t', ' ') + if '\n' in text: + text = text.replace('\n', ' ') + if '\r' in text: + text = text.replace('\r', ' ') + return text + except (TypeError, AttributeError): + _raise_serialization_error(text) + + +# -------------------------------------------------------------------- + +# Import the C accelerators +try: + # Element is going to be shadowed by the C implementation. We need to keep + # the Python version of it accessible for some "creative" by external code + # (see tests) + _Element_Py = Element + + # Element, SubElement, ParseError, TreeBuilder, XMLParser, _set_factories + from _elementtree import * + from _elementtree import _set_factories +except ImportError: + pass +else: + _set_factories(Comment, ProcessingInstruction) diff --git a/miniconda3/envs/active_proaction/lib/python3.10/xml/etree/__init__.py b/miniconda3/envs/active_proaction/lib/python3.10/xml/etree/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e2ec53421d3f70267ddc34436eec6a30ee9f1855 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/xml/etree/__init__.py @@ -0,0 +1,33 @@ +# $Id: __init__.py 3375 2008-02-13 08:05:08Z fredrik $ +# elementtree package + +# -------------------------------------------------------------------- +# The ElementTree toolkit is +# +# Copyright (c) 1999-2008 by Fredrik Lundh +# +# By obtaining, using, and/or copying this software and/or its +# associated documentation, you agree that you have read, understood, +# and will comply with the following terms and conditions: +# +# Permission to use, copy, modify, and distribute this software and +# its associated documentation for any purpose and without fee is +# hereby granted, provided that the above copyright notice appears in +# all copies, and that both that copyright notice and this permission +# notice appear in supporting documentation, and that the name of +# Secret Labs AB or the author not be used in advertising or publicity +# pertaining to distribution of the software without specific, written +# prior permission. +# +# SECRET LABS AB AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD +# TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANT- +# ABILITY AND FITNESS. IN NO EVENT SHALL SECRET LABS AB OR THE AUTHOR +# 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. +# -------------------------------------------------------------------- + +# Licensed to PSF under a Contributor Agreement. +# See https://www.python.org/psf/license for licensing details. diff --git a/miniconda3/envs/active_proaction/lib/python3.10/xml/etree/cElementTree.py b/miniconda3/envs/active_proaction/lib/python3.10/xml/etree/cElementTree.py new file mode 100644 index 0000000000000000000000000000000000000000..368e679189582990ab92cd73b8b820e74df253a7 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/xml/etree/cElementTree.py @@ -0,0 +1,3 @@ +# Deprecated alias for xml.etree.ElementTree + +from xml.etree.ElementTree import * diff --git a/miniconda3/envs/active_proaction/lib/python3.10/xml/parsers/__init__.py b/miniconda3/envs/active_proaction/lib/python3.10/xml/parsers/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..eb314a3b40573763835ad959acff985fad014537 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/xml/parsers/__init__.py @@ -0,0 +1,8 @@ +"""Python interfaces to XML parsers. + +This package contains one module: + +expat -- Python wrapper for James Clark's Expat parser, with namespace + support. + +""" diff --git a/miniconda3/envs/active_proaction/lib/python3.10/xml/parsers/expat.py b/miniconda3/envs/active_proaction/lib/python3.10/xml/parsers/expat.py new file mode 100644 index 0000000000000000000000000000000000000000..bcbe9fb1f8f00e568f76fce02fdbe7528012b622 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/xml/parsers/expat.py @@ -0,0 +1,8 @@ +"""Interface to the Expat non-validating XML parser.""" +import sys + +from pyexpat import * + +# provide pyexpat submodules as xml.parsers.expat submodules +sys.modules['xml.parsers.expat.model'] = model +sys.modules['xml.parsers.expat.errors'] = errors diff --git a/miniconda3/envs/active_proaction/lib/python3.10/xml/sax/__init__.py b/miniconda3/envs/active_proaction/lib/python3.10/xml/sax/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..17b75879ebaafad86c812bee53b4b24e01c18802 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/xml/sax/__init__.py @@ -0,0 +1,107 @@ +"""Simple API for XML (SAX) implementation for Python. + +This module provides an implementation of the SAX 2 interface; +information about the Java version of the interface can be found at +http://www.megginson.com/SAX/. The Python version of the interface is +documented at <...>. + +This package contains the following modules: + +handler -- Base classes and constants which define the SAX 2 API for + the 'client-side' of SAX for Python. + +saxutils -- Implementation of the convenience classes commonly used to + work with SAX. + +xmlreader -- Base classes and constants which define the SAX 2 API for + the parsers used with SAX for Python. + +expatreader -- Driver that allows use of the Expat parser with SAX. +""" + +from .xmlreader import InputSource +from .handler import ContentHandler, ErrorHandler +from ._exceptions import SAXException, SAXNotRecognizedException, \ + SAXParseException, SAXNotSupportedException, \ + SAXReaderNotAvailable + + +def parse(source, handler, errorHandler=ErrorHandler()): + parser = make_parser() + parser.setContentHandler(handler) + parser.setErrorHandler(errorHandler) + parser.parse(source) + +def parseString(string, handler, errorHandler=ErrorHandler()): + import io + if errorHandler is None: + errorHandler = ErrorHandler() + parser = make_parser() + parser.setContentHandler(handler) + parser.setErrorHandler(errorHandler) + + inpsrc = InputSource() + if isinstance(string, str): + inpsrc.setCharacterStream(io.StringIO(string)) + else: + inpsrc.setByteStream(io.BytesIO(string)) + parser.parse(inpsrc) + +# this is the parser list used by the make_parser function if no +# alternatives are given as parameters to the function + +default_parser_list = ["xml.sax.expatreader"] + +# tell modulefinder that importing sax potentially imports expatreader +_false = 0 +if _false: + import xml.sax.expatreader + +import os, sys +if not sys.flags.ignore_environment and "PY_SAX_PARSER" in os.environ: + default_parser_list = os.environ["PY_SAX_PARSER"].split(",") +del os + +_key = "python.xml.sax.parser" +if sys.platform[:4] == "java" and sys.registry.containsKey(_key): + default_parser_list = sys.registry.getProperty(_key).split(",") + + +def make_parser(parser_list=()): + """Creates and returns a SAX parser. + + Creates the first parser it is able to instantiate of the ones + given in the iterable created by chaining parser_list and + default_parser_list. The iterables must contain the names of Python + modules containing both a SAX parser and a create_parser function.""" + + for parser_name in list(parser_list) + default_parser_list: + try: + return _create_parser(parser_name) + except ImportError: + import sys + if parser_name in sys.modules: + # The parser module was found, but importing it + # failed unexpectedly, pass this exception through + raise + except SAXReaderNotAvailable: + # The parser module detected that it won't work properly, + # so try the next one + pass + + raise SAXReaderNotAvailable("No parsers found", None) + +# --- Internal utility methods used by make_parser + +if sys.platform[ : 4] == "java": + def _create_parser(parser_name): + from org.python.core import imp + drv_module = imp.importName(parser_name, 0, globals()) + return drv_module.create_parser() + +else: + def _create_parser(parser_name): + drv_module = __import__(parser_name,{},{},['create_parser']) + return drv_module.create_parser() + +del sys diff --git a/miniconda3/envs/active_proaction/lib/python3.10/xml/sax/_exceptions.py b/miniconda3/envs/active_proaction/lib/python3.10/xml/sax/_exceptions.py new file mode 100644 index 0000000000000000000000000000000000000000..a9b2ba35c6a22b2e393b6a898780f025a9e15e0f --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/xml/sax/_exceptions.py @@ -0,0 +1,131 @@ +"""Different kinds of SAX Exceptions""" +import sys +if sys.platform[:4] == "java": + from java.lang import Exception +del sys + +# ===== SAXEXCEPTION ===== + +class SAXException(Exception): + """Encapsulate an XML error or warning. This class can contain + basic error or warning information from either the XML parser or + the application: you can subclass it to provide additional + functionality, or to add localization. Note that although you will + receive a SAXException as the argument to the handlers in the + ErrorHandler interface, you are not actually required to raise + the exception; instead, you can simply read the information in + it.""" + + def __init__(self, msg, exception=None): + """Creates an exception. The message is required, but the exception + is optional.""" + self._msg = msg + self._exception = exception + Exception.__init__(self, msg) + + def getMessage(self): + "Return a message for this exception." + return self._msg + + def getException(self): + "Return the embedded exception, or None if there was none." + return self._exception + + def __str__(self): + "Create a string representation of the exception." + return self._msg + + def __getitem__(self, ix): + """Avoids weird error messages if someone does exception[ix] by + mistake, since Exception has __getitem__ defined.""" + raise AttributeError("__getitem__") + + +# ===== SAXPARSEEXCEPTION ===== + +class SAXParseException(SAXException): + """Encapsulate an XML parse error or warning. + + This exception will include information for locating the error in + the original XML document. Note that although the application will + receive a SAXParseException as the argument to the handlers in the + ErrorHandler interface, the application is not actually required + to raise the exception; instead, it can simply read the + information in it and take a different action. + + Since this exception is a subclass of SAXException, it inherits + the ability to wrap another exception.""" + + def __init__(self, msg, exception, locator): + "Creates the exception. The exception parameter is allowed to be None." + SAXException.__init__(self, msg, exception) + self._locator = locator + + # We need to cache this stuff at construction time. + # If this exception is raised, the objects through which we must + # traverse to get this information may be deleted by the time + # it gets caught. + self._systemId = self._locator.getSystemId() + self._colnum = self._locator.getColumnNumber() + self._linenum = self._locator.getLineNumber() + + def getColumnNumber(self): + """The column number of the end of the text where the exception + occurred.""" + return self._colnum + + def getLineNumber(self): + "The line number of the end of the text where the exception occurred." + return self._linenum + + def getPublicId(self): + "Get the public identifier of the entity where the exception occurred." + return self._locator.getPublicId() + + def getSystemId(self): + "Get the system identifier of the entity where the exception occurred." + return self._systemId + + def __str__(self): + "Create a string representation of the exception." + sysid = self.getSystemId() + if sysid is None: + sysid = "" + linenum = self.getLineNumber() + if linenum is None: + linenum = "?" + colnum = self.getColumnNumber() + if colnum is None: + colnum = "?" + return "%s:%s:%s: %s" % (sysid, linenum, colnum, self._msg) + + +# ===== SAXNOTRECOGNIZEDEXCEPTION ===== + +class SAXNotRecognizedException(SAXException): + """Exception class for an unrecognized identifier. + + An XMLReader will raise this exception when it is confronted with an + unrecognized feature or property. SAX applications and extensions may + use this class for similar purposes.""" + + +# ===== SAXNOTSUPPORTEDEXCEPTION ===== + +class SAXNotSupportedException(SAXException): + """Exception class for an unsupported operation. + + An XMLReader will raise this exception when a service it cannot + perform is requested (specifically setting a state or value). SAX + applications and extensions may use this class for similar + purposes.""" + +# ===== SAXNOTSUPPORTEDEXCEPTION ===== + +class SAXReaderNotAvailable(SAXNotSupportedException): + """Exception class for a missing driver. + + An XMLReader module (driver) should raise this exception when it + is first imported, e.g. when a support module cannot be imported. + It also may be raised during parsing, e.g. if executing an external + program is not permitted.""" diff --git a/miniconda3/envs/active_proaction/lib/python3.10/xml/sax/expatreader.py b/miniconda3/envs/active_proaction/lib/python3.10/xml/sax/expatreader.py new file mode 100644 index 0000000000000000000000000000000000000000..2f7c87b126c9933a4071dc19ec797e2472f28e42 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/xml/sax/expatreader.py @@ -0,0 +1,460 @@ +""" +SAX driver for the pyexpat C module. This driver works with +pyexpat.__version__ == '2.22'. +""" + +version = "0.20" + +from xml.sax._exceptions import * +from xml.sax.handler import feature_validation, feature_namespaces +from xml.sax.handler import feature_namespace_prefixes +from xml.sax.handler import feature_external_ges, feature_external_pes +from xml.sax.handler import feature_string_interning +from xml.sax.handler import property_xml_string, property_interning_dict + +# xml.parsers.expat does not raise ImportError in Jython +import sys +if sys.platform[:4] == "java": + raise SAXReaderNotAvailable("expat not available in Java", None) +del sys + +try: + from xml.parsers import expat +except ImportError: + raise SAXReaderNotAvailable("expat not supported", None) +else: + if not hasattr(expat, "ParserCreate"): + raise SAXReaderNotAvailable("expat not supported", None) +from xml.sax import xmlreader, saxutils, handler + +AttributesImpl = xmlreader.AttributesImpl +AttributesNSImpl = xmlreader.AttributesNSImpl + +# If we're using a sufficiently recent version of Python, we can use +# weak references to avoid cycles between the parser and content +# handler, otherwise we'll just have to pretend. +try: + import _weakref +except ImportError: + def _mkproxy(o): + return o +else: + import weakref + _mkproxy = weakref.proxy + del weakref, _weakref + +class _ClosedParser: + pass + +# --- ExpatLocator + +class ExpatLocator(xmlreader.Locator): + """Locator for use with the ExpatParser class. + + This uses a weak reference to the parser object to avoid creating + a circular reference between the parser and the content handler. + """ + def __init__(self, parser): + self._ref = _mkproxy(parser) + + def getColumnNumber(self): + parser = self._ref + if parser._parser is None: + return None + return parser._parser.ErrorColumnNumber + + def getLineNumber(self): + parser = self._ref + if parser._parser is None: + return 1 + return parser._parser.ErrorLineNumber + + def getPublicId(self): + parser = self._ref + if parser is None: + return None + return parser._source.getPublicId() + + def getSystemId(self): + parser = self._ref + if parser is None: + return None + return parser._source.getSystemId() + + +# --- ExpatParser + +class ExpatParser(xmlreader.IncrementalParser, xmlreader.Locator): + """SAX driver for the pyexpat C module.""" + + def __init__(self, namespaceHandling=0, bufsize=2**16-20): + xmlreader.IncrementalParser.__init__(self, bufsize) + self._source = xmlreader.InputSource() + self._parser = None + self._namespaces = namespaceHandling + self._lex_handler_prop = None + self._parsing = False + self._entity_stack = [] + self._external_ges = 0 + self._interning = None + + # XMLReader methods + + def parse(self, source): + "Parse an XML document from a URL or an InputSource." + source = saxutils.prepare_input_source(source) + + self._source = source + try: + self.reset() + self._cont_handler.setDocumentLocator(ExpatLocator(self)) + xmlreader.IncrementalParser.parse(self, source) + except: + # bpo-30264: Close the source on error to not leak resources: + # xml.sax.parse() doesn't give access to the underlying parser + # to the caller + self._close_source() + raise + + def prepareParser(self, source): + if source.getSystemId() is not None: + self._parser.SetBase(source.getSystemId()) + + # Redefined setContentHandler to allow changing handlers during parsing + + def setContentHandler(self, handler): + xmlreader.IncrementalParser.setContentHandler(self, handler) + if self._parsing: + self._reset_cont_handler() + + def getFeature(self, name): + if name == feature_namespaces: + return self._namespaces + elif name == feature_string_interning: + return self._interning is not None + elif name in (feature_validation, feature_external_pes, + feature_namespace_prefixes): + return 0 + elif name == feature_external_ges: + return self._external_ges + raise SAXNotRecognizedException("Feature '%s' not recognized" % name) + + def setFeature(self, name, state): + if self._parsing: + raise SAXNotSupportedException("Cannot set features while parsing") + + if name == feature_namespaces: + self._namespaces = state + elif name == feature_external_ges: + self._external_ges = state + elif name == feature_string_interning: + if state: + if self._interning is None: + self._interning = {} + else: + self._interning = None + elif name == feature_validation: + if state: + raise SAXNotSupportedException( + "expat does not support validation") + elif name == feature_external_pes: + if state: + raise SAXNotSupportedException( + "expat does not read external parameter entities") + elif name == feature_namespace_prefixes: + if state: + raise SAXNotSupportedException( + "expat does not report namespace prefixes") + else: + raise SAXNotRecognizedException( + "Feature '%s' not recognized" % name) + + def getProperty(self, name): + if name == handler.property_lexical_handler: + return self._lex_handler_prop + elif name == property_interning_dict: + return self._interning + elif name == property_xml_string: + if self._parser: + if hasattr(self._parser, "GetInputContext"): + return self._parser.GetInputContext() + else: + raise SAXNotRecognizedException( + "This version of expat does not support getting" + " the XML string") + else: + raise SAXNotSupportedException( + "XML string cannot be returned when not parsing") + raise SAXNotRecognizedException("Property '%s' not recognized" % name) + + def setProperty(self, name, value): + if name == handler.property_lexical_handler: + self._lex_handler_prop = value + if self._parsing: + self._reset_lex_handler_prop() + elif name == property_interning_dict: + self._interning = value + elif name == property_xml_string: + raise SAXNotSupportedException("Property '%s' cannot be set" % + name) + else: + raise SAXNotRecognizedException("Property '%s' not recognized" % + name) + + # IncrementalParser methods + + def feed(self, data, isFinal=False): + if not self._parsing: + self.reset() + self._parsing = True + self._cont_handler.startDocument() + + try: + # The isFinal parameter is internal to the expat reader. + # If it is set to true, expat will check validity of the entire + # document. When feeding chunks, they are not normally final - + # except when invoked from close. + self._parser.Parse(data, isFinal) + except expat.error as e: + exc = SAXParseException(expat.ErrorString(e.code), e, self) + # FIXME: when to invoke error()? + self._err_handler.fatalError(exc) + + def flush(self): + if self._parser is None: + return + + was_enabled = self._parser.GetReparseDeferralEnabled() + try: + self._parser.SetReparseDeferralEnabled(False) + self._parser.Parse(b"", False) + except expat.error as e: + exc = SAXParseException(expat.ErrorString(e.code), e, self) + self._err_handler.fatalError(exc) + finally: + self._parser.SetReparseDeferralEnabled(was_enabled) + + def _close_source(self): + source = self._source + try: + file = source.getCharacterStream() + if file is not None: + file.close() + finally: + file = source.getByteStream() + if file is not None: + file.close() + + def close(self): + if (self._entity_stack or self._parser is None or + isinstance(self._parser, _ClosedParser)): + # If we are completing an external entity, do nothing here + return + try: + self.feed(b"", isFinal=True) + self._cont_handler.endDocument() + self._parsing = False + # break cycle created by expat handlers pointing to our methods + self._parser = None + finally: + self._parsing = False + if self._parser is not None: + # Keep ErrorColumnNumber and ErrorLineNumber after closing. + parser = _ClosedParser() + parser.ErrorColumnNumber = self._parser.ErrorColumnNumber + parser.ErrorLineNumber = self._parser.ErrorLineNumber + self._parser = parser + self._close_source() + + def _reset_cont_handler(self): + self._parser.ProcessingInstructionHandler = \ + self._cont_handler.processingInstruction + self._parser.CharacterDataHandler = self._cont_handler.characters + + def _reset_lex_handler_prop(self): + lex = self._lex_handler_prop + parser = self._parser + if lex is None: + parser.CommentHandler = None + parser.StartCdataSectionHandler = None + parser.EndCdataSectionHandler = None + parser.StartDoctypeDeclHandler = None + parser.EndDoctypeDeclHandler = None + else: + parser.CommentHandler = lex.comment + parser.StartCdataSectionHandler = lex.startCDATA + parser.EndCdataSectionHandler = lex.endCDATA + parser.StartDoctypeDeclHandler = self.start_doctype_decl + parser.EndDoctypeDeclHandler = lex.endDTD + + def reset(self): + if self._namespaces: + self._parser = expat.ParserCreate(self._source.getEncoding(), " ", + intern=self._interning) + self._parser.namespace_prefixes = 1 + self._parser.StartElementHandler = self.start_element_ns + self._parser.EndElementHandler = self.end_element_ns + else: + self._parser = expat.ParserCreate(self._source.getEncoding(), + intern = self._interning) + self._parser.StartElementHandler = self.start_element + self._parser.EndElementHandler = self.end_element + + self._reset_cont_handler() + self._parser.UnparsedEntityDeclHandler = self.unparsed_entity_decl + self._parser.NotationDeclHandler = self.notation_decl + self._parser.StartNamespaceDeclHandler = self.start_namespace_decl + self._parser.EndNamespaceDeclHandler = self.end_namespace_decl + + self._decl_handler_prop = None + if self._lex_handler_prop: + self._reset_lex_handler_prop() +# self._parser.DefaultHandler = +# self._parser.DefaultHandlerExpand = +# self._parser.NotStandaloneHandler = + self._parser.ExternalEntityRefHandler = self.external_entity_ref + try: + self._parser.SkippedEntityHandler = self.skipped_entity_handler + except AttributeError: + # This pyexpat does not support SkippedEntity + pass + self._parser.SetParamEntityParsing( + expat.XML_PARAM_ENTITY_PARSING_UNLESS_STANDALONE) + + self._parsing = False + self._entity_stack = [] + + # Locator methods + + def getColumnNumber(self): + if self._parser is None: + return None + return self._parser.ErrorColumnNumber + + def getLineNumber(self): + if self._parser is None: + return 1 + return self._parser.ErrorLineNumber + + def getPublicId(self): + return self._source.getPublicId() + + def getSystemId(self): + return self._source.getSystemId() + + # event handlers + def start_element(self, name, attrs): + self._cont_handler.startElement(name, AttributesImpl(attrs)) + + def end_element(self, name): + self._cont_handler.endElement(name) + + def start_element_ns(self, name, attrs): + pair = name.split() + if len(pair) == 1: + # no namespace + pair = (None, name) + elif len(pair) == 3: + pair = pair[0], pair[1] + else: + # default namespace + pair = tuple(pair) + + newattrs = {} + qnames = {} + for (aname, value) in attrs.items(): + parts = aname.split() + length = len(parts) + if length == 1: + # no namespace + qname = aname + apair = (None, aname) + elif length == 3: + qname = "%s:%s" % (parts[2], parts[1]) + apair = parts[0], parts[1] + else: + # default namespace + qname = parts[1] + apair = tuple(parts) + + newattrs[apair] = value + qnames[apair] = qname + + self._cont_handler.startElementNS(pair, None, + AttributesNSImpl(newattrs, qnames)) + + def end_element_ns(self, name): + pair = name.split() + if len(pair) == 1: + pair = (None, name) + elif len(pair) == 3: + pair = pair[0], pair[1] + else: + pair = tuple(pair) + + self._cont_handler.endElementNS(pair, None) + + # this is not used (call directly to ContentHandler) + def processing_instruction(self, target, data): + self._cont_handler.processingInstruction(target, data) + + # this is not used (call directly to ContentHandler) + def character_data(self, data): + self._cont_handler.characters(data) + + def start_namespace_decl(self, prefix, uri): + self._cont_handler.startPrefixMapping(prefix, uri) + + def end_namespace_decl(self, prefix): + self._cont_handler.endPrefixMapping(prefix) + + def start_doctype_decl(self, name, sysid, pubid, has_internal_subset): + self._lex_handler_prop.startDTD(name, pubid, sysid) + + def unparsed_entity_decl(self, name, base, sysid, pubid, notation_name): + self._dtd_handler.unparsedEntityDecl(name, pubid, sysid, notation_name) + + def notation_decl(self, name, base, sysid, pubid): + self._dtd_handler.notationDecl(name, pubid, sysid) + + def external_entity_ref(self, context, base, sysid, pubid): + if not self._external_ges: + return 1 + + source = self._ent_handler.resolveEntity(pubid, sysid) + source = saxutils.prepare_input_source(source, + self._source.getSystemId() or + "") + + self._entity_stack.append((self._parser, self._source)) + self._parser = self._parser.ExternalEntityParserCreate(context) + self._source = source + + try: + xmlreader.IncrementalParser.parse(self, source) + except: + return 0 # FIXME: save error info here? + + (self._parser, self._source) = self._entity_stack[-1] + del self._entity_stack[-1] + return 1 + + def skipped_entity_handler(self, name, is_pe): + if is_pe: + # The SAX spec requires to report skipped PEs with a '%' + name = '%'+name + self._cont_handler.skippedEntity(name) + +# --- + +def create_parser(*args, **kwargs): + return ExpatParser(*args, **kwargs) + +# --- + +if __name__ == "__main__": + import xml.sax.saxutils + p = create_parser() + p.setContentHandler(xml.sax.saxutils.XMLGenerator()) + p.setErrorHandler(xml.sax.ErrorHandler()) + p.parse("http://www.ibiblio.org/xml/examples/shakespeare/hamlet.xml") diff --git a/miniconda3/envs/active_proaction/lib/python3.10/xml/sax/handler.py b/miniconda3/envs/active_proaction/lib/python3.10/xml/sax/handler.py new file mode 100644 index 0000000000000000000000000000000000000000..e8d417e51942329cbe111e458de3fa0788601ccc --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/xml/sax/handler.py @@ -0,0 +1,387 @@ +""" +This module contains the core classes of version 2.0 of SAX for Python. +This file provides only default classes with absolutely minimum +functionality, from which drivers and applications can be subclassed. + +Many of these classes are empty and are included only as documentation +of the interfaces. + +$Id$ +""" + +version = '2.0beta' + +#============================================================================ +# +# HANDLER INTERFACES +# +#============================================================================ + +# ===== ERRORHANDLER ===== + +class ErrorHandler: + """Basic interface for SAX error handlers. + + If you create an object that implements this interface, then + register the object with your XMLReader, the parser will call the + methods in your object to report all warnings and errors. There + are three levels of errors available: warnings, (possibly) + recoverable errors, and unrecoverable errors. All methods take a + SAXParseException as the only parameter.""" + + def error(self, exception): + "Handle a recoverable error." + raise exception + + def fatalError(self, exception): + "Handle a non-recoverable error." + raise exception + + def warning(self, exception): + "Handle a warning." + print(exception) + + +# ===== CONTENTHANDLER ===== + +class ContentHandler: + """Interface for receiving logical document content events. + + This is the main callback interface in SAX, and the one most + important to applications. The order of events in this interface + mirrors the order of the information in the document.""" + + def __init__(self): + self._locator = None + + def setDocumentLocator(self, locator): + """Called by the parser to give the application a locator for + locating the origin of document events. + + SAX parsers are strongly encouraged (though not absolutely + required) to supply a locator: if it does so, it must supply + the locator to the application by invoking this method before + invoking any of the other methods in the DocumentHandler + interface. + + The locator allows the application to determine the end + position of any document-related event, even if the parser is + not reporting an error. Typically, the application will use + this information for reporting its own errors (such as + character content that does not match an application's + business rules). The information returned by the locator is + probably not sufficient for use with a search engine. + + Note that the locator will return correct information only + during the invocation of the events in this interface. The + application should not attempt to use it at any other time.""" + self._locator = locator + + def startDocument(self): + """Receive notification of the beginning of a document. + + The SAX parser will invoke this method only once, before any + other methods in this interface or in DTDHandler (except for + setDocumentLocator).""" + + def endDocument(self): + """Receive notification of the end of a document. + + The SAX parser will invoke this method only once, and it will + be the last method invoked during the parse. The parser shall + not invoke this method until it has either abandoned parsing + (because of an unrecoverable error) or reached the end of + input.""" + + def startPrefixMapping(self, prefix, uri): + """Begin the scope of a prefix-URI Namespace mapping. + + The information from this event is not necessary for normal + Namespace processing: the SAX XML reader will automatically + replace prefixes for element and attribute names when the + http://xml.org/sax/features/namespaces feature is true (the + default). + + There are cases, however, when applications need to use + prefixes in character data or in attribute values, where they + cannot safely be expanded automatically; the + start/endPrefixMapping event supplies the information to the + application to expand prefixes in those contexts itself, if + necessary. + + Note that start/endPrefixMapping events are not guaranteed to + be properly nested relative to each-other: all + startPrefixMapping events will occur before the corresponding + startElement event, and all endPrefixMapping events will occur + after the corresponding endElement event, but their order is + not guaranteed.""" + + def endPrefixMapping(self, prefix): + """End the scope of a prefix-URI mapping. + + See startPrefixMapping for details. This event will always + occur after the corresponding endElement event, but the order + of endPrefixMapping events is not otherwise guaranteed.""" + + def startElement(self, name, attrs): + """Signals the start of an element in non-namespace mode. + + The name parameter contains the raw XML 1.0 name of the + element type as a string and the attrs parameter holds an + instance of the Attributes class containing the attributes of + the element.""" + + def endElement(self, name): + """Signals the end of an element in non-namespace mode. + + The name parameter contains the name of the element type, just + as with the startElement event.""" + + def startElementNS(self, name, qname, attrs): + """Signals the start of an element in namespace mode. + + The name parameter contains the name of the element type as a + (uri, localname) tuple, the qname parameter the raw XML 1.0 + name used in the source document, and the attrs parameter + holds an instance of the Attributes class containing the + attributes of the element. + + The uri part of the name tuple is None for elements which have + no namespace.""" + + def endElementNS(self, name, qname): + """Signals the end of an element in namespace mode. + + The name parameter contains the name of the element type, just + as with the startElementNS event.""" + + def characters(self, content): + """Receive notification of character data. + + The Parser will call this method to report each chunk of + character data. SAX parsers may return all contiguous + character data in a single chunk, or they may split it into + several chunks; however, all of the characters in any single + event must come from the same external entity so that the + Locator provides useful information.""" + + def ignorableWhitespace(self, whitespace): + """Receive notification of ignorable whitespace in element content. + + Validating Parsers must use this method to report each chunk + of ignorable whitespace (see the W3C XML 1.0 recommendation, + section 2.10): non-validating parsers may also use this method + if they are capable of parsing and using content models. + + SAX parsers may return all contiguous whitespace in a single + chunk, or they may split it into several chunks; however, all + of the characters in any single event must come from the same + external entity, so that the Locator provides useful + information.""" + + def processingInstruction(self, target, data): + """Receive notification of a processing instruction. + + The Parser will invoke this method once for each processing + instruction found: note that processing instructions may occur + before or after the main document element. + + A SAX parser should never report an XML declaration (XML 1.0, + section 2.8) or a text declaration (XML 1.0, section 4.3.1) + using this method.""" + + def skippedEntity(self, name): + """Receive notification of a skipped entity. + + The Parser will invoke this method once for each entity + skipped. Non-validating processors may skip entities if they + have not seen the declarations (because, for example, the + entity was declared in an external DTD subset). All processors + may skip external entities, depending on the values of the + http://xml.org/sax/features/external-general-entities and the + http://xml.org/sax/features/external-parameter-entities + properties.""" + + +# ===== DTDHandler ===== + +class DTDHandler: + """Handle DTD events. + + This interface specifies only those DTD events required for basic + parsing (unparsed entities and attributes).""" + + def notationDecl(self, name, publicId, systemId): + "Handle a notation declaration event." + + def unparsedEntityDecl(self, name, publicId, systemId, ndata): + "Handle an unparsed entity declaration event." + + +# ===== ENTITYRESOLVER ===== + +class EntityResolver: + """Basic interface for resolving entities. If you create an object + implementing this interface, then register the object with your + Parser, the parser will call the method in your object to + resolve all external entities. Note that DefaultHandler implements + this interface with the default behaviour.""" + + def resolveEntity(self, publicId, systemId): + """Resolve the system identifier of an entity and return either + the system identifier to read from as a string, or an InputSource + to read from.""" + return systemId + + +#============================================================================ +# +# CORE FEATURES +# +#============================================================================ + +feature_namespaces = "http://xml.org/sax/features/namespaces" +# true: Perform Namespace processing (default). +# false: Optionally do not perform Namespace processing +# (implies namespace-prefixes). +# access: (parsing) read-only; (not parsing) read/write + +feature_namespace_prefixes = "http://xml.org/sax/features/namespace-prefixes" +# true: Report the original prefixed names and attributes used for Namespace +# declarations. +# false: Do not report attributes used for Namespace declarations, and +# optionally do not report original prefixed names (default). +# access: (parsing) read-only; (not parsing) read/write + +feature_string_interning = "http://xml.org/sax/features/string-interning" +# true: All element names, prefixes, attribute names, Namespace URIs, and +# local names are interned using the built-in intern function. +# false: Names are not necessarily interned, although they may be (default). +# access: (parsing) read-only; (not parsing) read/write + +feature_validation = "http://xml.org/sax/features/validation" +# true: Report all validation errors (implies external-general-entities and +# external-parameter-entities). +# false: Do not report validation errors. +# access: (parsing) read-only; (not parsing) read/write + +feature_external_ges = "http://xml.org/sax/features/external-general-entities" +# true: Include all external general (text) entities. +# false: Do not include external general entities. +# access: (parsing) read-only; (not parsing) read/write + +feature_external_pes = "http://xml.org/sax/features/external-parameter-entities" +# true: Include all external parameter entities, including the external +# DTD subset. +# false: Do not include any external parameter entities, even the external +# DTD subset. +# access: (parsing) read-only; (not parsing) read/write + +all_features = [feature_namespaces, + feature_namespace_prefixes, + feature_string_interning, + feature_validation, + feature_external_ges, + feature_external_pes] + + +#============================================================================ +# +# CORE PROPERTIES +# +#============================================================================ + +property_lexical_handler = "http://xml.org/sax/properties/lexical-handler" +# data type: xml.sax.sax2lib.LexicalHandler +# description: An optional extension handler for lexical events like comments. +# access: read/write + +property_declaration_handler = "http://xml.org/sax/properties/declaration-handler" +# data type: xml.sax.sax2lib.DeclHandler +# description: An optional extension handler for DTD-related events other +# than notations and unparsed entities. +# access: read/write + +property_dom_node = "http://xml.org/sax/properties/dom-node" +# data type: org.w3c.dom.Node +# description: When parsing, the current DOM node being visited if this is +# a DOM iterator; when not parsing, the root DOM node for +# iteration. +# access: (parsing) read-only; (not parsing) read/write + +property_xml_string = "http://xml.org/sax/properties/xml-string" +# data type: String +# description: The literal string of characters that was the source for +# the current event. +# access: read-only + +property_encoding = "http://www.python.org/sax/properties/encoding" +# data type: String +# description: The name of the encoding to assume for input data. +# access: write: set the encoding, e.g. established by a higher-level +# protocol. May change during parsing (e.g. after +# processing a META tag) +# read: return the current encoding (possibly established through +# auto-detection. +# initial value: UTF-8 +# + +property_interning_dict = "http://www.python.org/sax/properties/interning-dict" +# data type: Dictionary +# description: The dictionary used to intern common strings in the document +# access: write: Request that the parser uses a specific dictionary, to +# allow interning across different documents +# read: return the current interning dictionary, or None +# + +all_properties = [property_lexical_handler, + property_dom_node, + property_declaration_handler, + property_xml_string, + property_encoding, + property_interning_dict] + + +class LexicalHandler: + """Optional SAX2 handler for lexical events. + + This handler is used to obtain lexical information about an XML + document, that is, information about how the document was encoded + (as opposed to what it contains, which is reported to the + ContentHandler), such as comments and CDATA marked section + boundaries. + + To set the LexicalHandler of an XMLReader, use the setProperty + method with the property identifier + 'http://xml.org/sax/properties/lexical-handler'.""" + + def comment(self, content): + """Reports a comment anywhere in the document (including the + DTD and outside the document element). + + content is a string that holds the contents of the comment.""" + + def startDTD(self, name, public_id, system_id): + """Report the start of the DTD declarations, if the document + has an associated DTD. + + A startEntity event will be reported before declaration events + from the external DTD subset are reported, and this can be + used to infer from which subset DTD declarations derive. + + name is the name of the document element type, public_id the + public identifier of the DTD (or None if none were supplied) + and system_id the system identfier of the external subset (or + None if none were supplied).""" + + def endDTD(self): + """Signals the end of DTD declarations.""" + + def startCDATA(self): + """Reports the beginning of a CDATA marked section. + + The contents of the CDATA marked section will be reported + through the characters event.""" + + def endCDATA(self): + """Reports the end of a CDATA marked section.""" diff --git a/miniconda3/envs/active_proaction/lib/python3.10/xml/sax/saxutils.py b/miniconda3/envs/active_proaction/lib/python3.10/xml/sax/saxutils.py new file mode 100644 index 0000000000000000000000000000000000000000..c1612ea1cebc5d064280e7d2d617d0fc2cf1f0f0 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/xml/sax/saxutils.py @@ -0,0 +1,369 @@ +"""\ +A library of useful helper classes to the SAX classes, for the +convenience of application and driver writers. +""" + +import os, urllib.parse, urllib.request +import io +import codecs +from . import handler +from . import xmlreader + +def __dict_replace(s, d): + """Replace substrings of a string using a dictionary.""" + for key, value in d.items(): + s = s.replace(key, value) + return s + +def escape(data, entities={}): + """Escape &, <, and > in a string of data. + + You can escape other strings of data by passing a dictionary as + the optional entities parameter. The keys and values must all be + strings; each key will be replaced with its corresponding value. + """ + + # must do ampersand first + data = data.replace("&", "&") + data = data.replace(">", ">") + data = data.replace("<", "<") + if entities: + data = __dict_replace(data, entities) + return data + +def unescape(data, entities={}): + """Unescape &, <, and > in a string of data. + + You can unescape other strings of data by passing a dictionary as + the optional entities parameter. The keys and values must all be + strings; each key will be replaced with its corresponding value. + """ + data = data.replace("<", "<") + data = data.replace(">", ">") + if entities: + data = __dict_replace(data, entities) + # must do ampersand last + return data.replace("&", "&") + +def quoteattr(data, entities={}): + """Escape and quote an attribute value. + + Escape &, <, and > in a string of data, then quote it for use as + an attribute value. The \" character will be escaped as well, if + necessary. + + You can escape other strings of data by passing a dictionary as + the optional entities parameter. The keys and values must all be + strings; each key will be replaced with its corresponding value. + """ + entities = {**entities, '\n': ' ', '\r': ' ', '\t':' '} + data = escape(data, entities) + if '"' in data: + if "'" in data: + data = '"%s"' % data.replace('"', """) + else: + data = "'%s'" % data + else: + data = '"%s"' % data + return data + + +def _gettextwriter(out, encoding): + if out is None: + import sys + return sys.stdout + + if isinstance(out, io.TextIOBase): + # use a text writer as is + return out + + if isinstance(out, (codecs.StreamWriter, codecs.StreamReaderWriter)): + # use a codecs stream writer as is + return out + + # wrap a binary writer with TextIOWrapper + if isinstance(out, io.RawIOBase): + # Keep the original file open when the TextIOWrapper is + # destroyed + class _wrapper: + __class__ = out.__class__ + def __getattr__(self, name): + return getattr(out, name) + buffer = _wrapper() + buffer.close = lambda: None + else: + # This is to handle passed objects that aren't in the + # IOBase hierarchy, but just have a write method + buffer = io.BufferedIOBase() + buffer.writable = lambda: True + buffer.write = out.write + try: + # TextIOWrapper uses this methods to determine + # if BOM (for UTF-16, etc) should be added + buffer.seekable = out.seekable + buffer.tell = out.tell + except AttributeError: + pass + return io.TextIOWrapper(buffer, encoding=encoding, + errors='xmlcharrefreplace', + newline='\n', + write_through=True) + +class XMLGenerator(handler.ContentHandler): + + def __init__(self, out=None, encoding="iso-8859-1", short_empty_elements=False): + handler.ContentHandler.__init__(self) + out = _gettextwriter(out, encoding) + self._write = out.write + self._flush = out.flush + self._ns_contexts = [{}] # contains uri -> prefix dicts + self._current_context = self._ns_contexts[-1] + self._undeclared_ns_maps = [] + self._encoding = encoding + self._short_empty_elements = short_empty_elements + self._pending_start_element = False + + def _qname(self, name): + """Builds a qualified name from a (ns_url, localname) pair""" + if name[0]: + # Per http://www.w3.org/XML/1998/namespace, The 'xml' prefix is + # bound by definition to http://www.w3.org/XML/1998/namespace. It + # does not need to be declared and will not usually be found in + # self._current_context. + if 'http://www.w3.org/XML/1998/namespace' == name[0]: + return 'xml:' + name[1] + # The name is in a non-empty namespace + prefix = self._current_context[name[0]] + if prefix: + # If it is not the default namespace, prepend the prefix + return prefix + ":" + name[1] + # Return the unqualified name + return name[1] + + def _finish_pending_start_element(self,endElement=False): + if self._pending_start_element: + self._write('>') + self._pending_start_element = False + + # ContentHandler methods + + def startDocument(self): + self._write('\n' % + self._encoding) + + def endDocument(self): + self._flush() + + def startPrefixMapping(self, prefix, uri): + self._ns_contexts.append(self._current_context.copy()) + self._current_context[uri] = prefix + self._undeclared_ns_maps.append((prefix, uri)) + + def endPrefixMapping(self, prefix): + self._current_context = self._ns_contexts[-1] + del self._ns_contexts[-1] + + def startElement(self, name, attrs): + self._finish_pending_start_element() + self._write('<' + name) + for (name, value) in attrs.items(): + self._write(' %s=%s' % (name, quoteattr(value))) + if self._short_empty_elements: + self._pending_start_element = True + else: + self._write(">") + + def endElement(self, name): + if self._pending_start_element: + self._write('/>') + self._pending_start_element = False + else: + self._write('' % name) + + def startElementNS(self, name, qname, attrs): + self._finish_pending_start_element() + self._write('<' + self._qname(name)) + + for prefix, uri in self._undeclared_ns_maps: + if prefix: + self._write(' xmlns:%s="%s"' % (prefix, uri)) + else: + self._write(' xmlns="%s"' % uri) + self._undeclared_ns_maps = [] + + for (name, value) in attrs.items(): + self._write(' %s=%s' % (self._qname(name), quoteattr(value))) + if self._short_empty_elements: + self._pending_start_element = True + else: + self._write(">") + + def endElementNS(self, name, qname): + if self._pending_start_element: + self._write('/>') + self._pending_start_element = False + else: + self._write('' % self._qname(name)) + + def characters(self, content): + if content: + self._finish_pending_start_element() + if not isinstance(content, str): + content = str(content, self._encoding) + self._write(escape(content)) + + def ignorableWhitespace(self, content): + if content: + self._finish_pending_start_element() + if not isinstance(content, str): + content = str(content, self._encoding) + self._write(content) + + def processingInstruction(self, target, data): + self._finish_pending_start_element() + self._write('' % (target, data)) + + +class XMLFilterBase(xmlreader.XMLReader): + """This class is designed to sit between an XMLReader and the + client application's event handlers. By default, it does nothing + but pass requests up to the reader and events on to the handlers + unmodified, but subclasses can override specific methods to modify + the event stream or the configuration requests as they pass + through.""" + + def __init__(self, parent = None): + xmlreader.XMLReader.__init__(self) + self._parent = parent + + # ErrorHandler methods + + def error(self, exception): + self._err_handler.error(exception) + + def fatalError(self, exception): + self._err_handler.fatalError(exception) + + def warning(self, exception): + self._err_handler.warning(exception) + + # ContentHandler methods + + def setDocumentLocator(self, locator): + self._cont_handler.setDocumentLocator(locator) + + def startDocument(self): + self._cont_handler.startDocument() + + def endDocument(self): + self._cont_handler.endDocument() + + def startPrefixMapping(self, prefix, uri): + self._cont_handler.startPrefixMapping(prefix, uri) + + def endPrefixMapping(self, prefix): + self._cont_handler.endPrefixMapping(prefix) + + def startElement(self, name, attrs): + self._cont_handler.startElement(name, attrs) + + def endElement(self, name): + self._cont_handler.endElement(name) + + def startElementNS(self, name, qname, attrs): + self._cont_handler.startElementNS(name, qname, attrs) + + def endElementNS(self, name, qname): + self._cont_handler.endElementNS(name, qname) + + def characters(self, content): + self._cont_handler.characters(content) + + def ignorableWhitespace(self, chars): + self._cont_handler.ignorableWhitespace(chars) + + def processingInstruction(self, target, data): + self._cont_handler.processingInstruction(target, data) + + def skippedEntity(self, name): + self._cont_handler.skippedEntity(name) + + # DTDHandler methods + + def notationDecl(self, name, publicId, systemId): + self._dtd_handler.notationDecl(name, publicId, systemId) + + def unparsedEntityDecl(self, name, publicId, systemId, ndata): + self._dtd_handler.unparsedEntityDecl(name, publicId, systemId, ndata) + + # EntityResolver methods + + def resolveEntity(self, publicId, systemId): + return self._ent_handler.resolveEntity(publicId, systemId) + + # XMLReader methods + + def parse(self, source): + self._parent.setContentHandler(self) + self._parent.setErrorHandler(self) + self._parent.setEntityResolver(self) + self._parent.setDTDHandler(self) + self._parent.parse(source) + + def setLocale(self, locale): + self._parent.setLocale(locale) + + def getFeature(self, name): + return self._parent.getFeature(name) + + def setFeature(self, name, state): + self._parent.setFeature(name, state) + + def getProperty(self, name): + return self._parent.getProperty(name) + + def setProperty(self, name, value): + self._parent.setProperty(name, value) + + # XMLFilter methods + + def getParent(self): + return self._parent + + def setParent(self, parent): + self._parent = parent + +# --- Utility functions + +def prepare_input_source(source, base=""): + """This function takes an InputSource and an optional base URL and + returns a fully resolved InputSource object ready for reading.""" + + if isinstance(source, os.PathLike): + source = os.fspath(source) + if isinstance(source, str): + source = xmlreader.InputSource(source) + elif hasattr(source, "read"): + f = source + source = xmlreader.InputSource() + if isinstance(f.read(0), str): + source.setCharacterStream(f) + else: + source.setByteStream(f) + if hasattr(f, "name") and isinstance(f.name, str): + source.setSystemId(f.name) + + if source.getCharacterStream() is None and source.getByteStream() is None: + sysid = source.getSystemId() + basehead = os.path.dirname(os.path.normpath(base)) + sysidfilename = os.path.join(basehead, sysid) + if os.path.isfile(sysidfilename): + source.setSystemId(sysidfilename) + f = open(sysidfilename, "rb") + else: + source.setSystemId(urllib.parse.urljoin(base, sysid)) + f = urllib.request.urlopen(source.getSystemId()) + + source.setByteStream(f) + + return source diff --git a/miniconda3/envs/active_proaction/lib/python3.10/xml/sax/xmlreader.py b/miniconda3/envs/active_proaction/lib/python3.10/xml/sax/xmlreader.py new file mode 100644 index 0000000000000000000000000000000000000000..716f22840414e604ab38661f91eb07f094309833 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/xml/sax/xmlreader.py @@ -0,0 +1,380 @@ +"""An XML Reader is the SAX 2 name for an XML parser. XML Parsers +should be based on this code. """ + +from . import handler + +from ._exceptions import SAXNotSupportedException, SAXNotRecognizedException + + +# ===== XMLREADER ===== + +class XMLReader: + """Interface for reading an XML document using callbacks. + + XMLReader is the interface that an XML parser's SAX2 driver must + implement. This interface allows an application to set and query + features and properties in the parser, to register event handlers + for document processing, and to initiate a document parse. + + All SAX interfaces are assumed to be synchronous: the parse + methods must not return until parsing is complete, and readers + must wait for an event-handler callback to return before reporting + the next event.""" + + def __init__(self): + self._cont_handler = handler.ContentHandler() + self._dtd_handler = handler.DTDHandler() + self._ent_handler = handler.EntityResolver() + self._err_handler = handler.ErrorHandler() + + def parse(self, source): + "Parse an XML document from a system identifier or an InputSource." + raise NotImplementedError("This method must be implemented!") + + def getContentHandler(self): + "Returns the current ContentHandler." + return self._cont_handler + + def setContentHandler(self, handler): + "Registers a new object to receive document content events." + self._cont_handler = handler + + def getDTDHandler(self): + "Returns the current DTD handler." + return self._dtd_handler + + def setDTDHandler(self, handler): + "Register an object to receive basic DTD-related events." + self._dtd_handler = handler + + def getEntityResolver(self): + "Returns the current EntityResolver." + return self._ent_handler + + def setEntityResolver(self, resolver): + "Register an object to resolve external entities." + self._ent_handler = resolver + + def getErrorHandler(self): + "Returns the current ErrorHandler." + return self._err_handler + + def setErrorHandler(self, handler): + "Register an object to receive error-message events." + self._err_handler = handler + + def setLocale(self, locale): + """Allow an application to set the locale for errors and warnings. + + SAX parsers are not required to provide localization for errors + and warnings; if they cannot support the requested locale, + however, they must raise a SAX exception. Applications may + request a locale change in the middle of a parse.""" + raise SAXNotSupportedException("Locale support not implemented") + + def getFeature(self, name): + "Looks up and returns the state of a SAX2 feature." + raise SAXNotRecognizedException("Feature '%s' not recognized" % name) + + def setFeature(self, name, state): + "Sets the state of a SAX2 feature." + raise SAXNotRecognizedException("Feature '%s' not recognized" % name) + + def getProperty(self, name): + "Looks up and returns the value of a SAX2 property." + raise SAXNotRecognizedException("Property '%s' not recognized" % name) + + def setProperty(self, name, value): + "Sets the value of a SAX2 property." + raise SAXNotRecognizedException("Property '%s' not recognized" % name) + +class IncrementalParser(XMLReader): + """This interface adds three extra methods to the XMLReader + interface that allow XML parsers to support incremental + parsing. Support for this interface is optional, since not all + underlying XML parsers support this functionality. + + When the parser is instantiated it is ready to begin accepting + data from the feed method immediately. After parsing has been + finished with a call to close the reset method must be called to + make the parser ready to accept new data, either from feed or + using the parse method. + + Note that these methods must _not_ be called during parsing, that + is, after parse has been called and before it returns. + + By default, the class also implements the parse method of the XMLReader + interface using the feed, close and reset methods of the + IncrementalParser interface as a convenience to SAX 2.0 driver + writers.""" + + def __init__(self, bufsize=2**16): + self._bufsize = bufsize + XMLReader.__init__(self) + + def parse(self, source): + from . import saxutils + source = saxutils.prepare_input_source(source) + + self.prepareParser(source) + file = source.getCharacterStream() + if file is None: + file = source.getByteStream() + buffer = file.read(self._bufsize) + while buffer: + self.feed(buffer) + buffer = file.read(self._bufsize) + self.close() + + def feed(self, data): + """This method gives the raw XML data in the data parameter to + the parser and makes it parse the data, emitting the + corresponding events. It is allowed for XML constructs to be + split across several calls to feed. + + feed may raise SAXException.""" + raise NotImplementedError("This method must be implemented!") + + def prepareParser(self, source): + """This method is called by the parse implementation to allow + the SAX 2.0 driver to prepare itself for parsing.""" + raise NotImplementedError("prepareParser must be overridden!") + + def close(self): + """This method is called when the entire XML document has been + passed to the parser through the feed method, to notify the + parser that there are no more data. This allows the parser to + do the final checks on the document and empty the internal + data buffer. + + The parser will not be ready to parse another document until + the reset method has been called. + + close may raise SAXException.""" + raise NotImplementedError("This method must be implemented!") + + def reset(self): + """This method is called after close has been called to reset + the parser so that it is ready to parse new documents. The + results of calling parse or feed after close without calling + reset are undefined.""" + raise NotImplementedError("This method must be implemented!") + +# ===== LOCATOR ===== + +class Locator: + """Interface for associating a SAX event with a document + location. A locator object will return valid results only during + calls to DocumentHandler methods; at any other time, the + results are unpredictable.""" + + def getColumnNumber(self): + "Return the column number where the current event ends." + return -1 + + def getLineNumber(self): + "Return the line number where the current event ends." + return -1 + + def getPublicId(self): + "Return the public identifier for the current event." + return None + + def getSystemId(self): + "Return the system identifier for the current event." + return None + +# ===== INPUTSOURCE ===== + +class InputSource: + """Encapsulation of the information needed by the XMLReader to + read entities. + + This class may include information about the public identifier, + system identifier, byte stream (possibly with character encoding + information) and/or the character stream of an entity. + + Applications will create objects of this class for use in the + XMLReader.parse method and for returning from + EntityResolver.resolveEntity. + + An InputSource belongs to the application, the XMLReader is not + allowed to modify InputSource objects passed to it from the + application, although it may make copies and modify those.""" + + def __init__(self, system_id = None): + self.__system_id = system_id + self.__public_id = None + self.__encoding = None + self.__bytefile = None + self.__charfile = None + + def setPublicId(self, public_id): + "Sets the public identifier of this InputSource." + self.__public_id = public_id + + def getPublicId(self): + "Returns the public identifier of this InputSource." + return self.__public_id + + def setSystemId(self, system_id): + "Sets the system identifier of this InputSource." + self.__system_id = system_id + + def getSystemId(self): + "Returns the system identifier of this InputSource." + return self.__system_id + + def setEncoding(self, encoding): + """Sets the character encoding of this InputSource. + + The encoding must be a string acceptable for an XML encoding + declaration (see section 4.3.3 of the XML recommendation). + + The encoding attribute of the InputSource is ignored if the + InputSource also contains a character stream.""" + self.__encoding = encoding + + def getEncoding(self): + "Get the character encoding of this InputSource." + return self.__encoding + + def setByteStream(self, bytefile): + """Set the byte stream (a Python file-like object which does + not perform byte-to-character conversion) for this input + source. + + The SAX parser will ignore this if there is also a character + stream specified, but it will use a byte stream in preference + to opening a URI connection itself. + + If the application knows the character encoding of the byte + stream, it should set it with the setEncoding method.""" + self.__bytefile = bytefile + + def getByteStream(self): + """Get the byte stream for this input source. + + The getEncoding method will return the character encoding for + this byte stream, or None if unknown.""" + return self.__bytefile + + def setCharacterStream(self, charfile): + """Set the character stream for this input source. (The stream + must be a Python 2.0 Unicode-wrapped file-like that performs + conversion to Unicode strings.) + + If there is a character stream specified, the SAX parser will + ignore any byte stream and will not attempt to open a URI + connection to the system identifier.""" + self.__charfile = charfile + + def getCharacterStream(self): + "Get the character stream for this input source." + return self.__charfile + +# ===== ATTRIBUTESIMPL ===== + +class AttributesImpl: + + def __init__(self, attrs): + """Non-NS-aware implementation. + + attrs should be of the form {name : value}.""" + self._attrs = attrs + + def getLength(self): + return len(self._attrs) + + def getType(self, name): + return "CDATA" + + def getValue(self, name): + return self._attrs[name] + + def getValueByQName(self, name): + return self._attrs[name] + + def getNameByQName(self, name): + if name not in self._attrs: + raise KeyError(name) + return name + + def getQNameByName(self, name): + if name not in self._attrs: + raise KeyError(name) + return name + + def getNames(self): + return list(self._attrs.keys()) + + def getQNames(self): + return list(self._attrs.keys()) + + def __len__(self): + return len(self._attrs) + + def __getitem__(self, name): + return self._attrs[name] + + def keys(self): + return list(self._attrs.keys()) + + def __contains__(self, name): + return name in self._attrs + + def get(self, name, alternative=None): + return self._attrs.get(name, alternative) + + def copy(self): + return self.__class__(self._attrs) + + def items(self): + return list(self._attrs.items()) + + def values(self): + return list(self._attrs.values()) + +# ===== ATTRIBUTESNSIMPL ===== + +class AttributesNSImpl(AttributesImpl): + + def __init__(self, attrs, qnames): + """NS-aware implementation. + + attrs should be of the form {(ns_uri, lname): value, ...}. + qnames of the form {(ns_uri, lname): qname, ...}.""" + self._attrs = attrs + self._qnames = qnames + + def getValueByQName(self, name): + for (nsname, qname) in self._qnames.items(): + if qname == name: + return self._attrs[nsname] + + raise KeyError(name) + + def getNameByQName(self, name): + for (nsname, qname) in self._qnames.items(): + if qname == name: + return nsname + + raise KeyError(name) + + def getQNameByName(self, name): + return self._qnames[name] + + def getQNames(self): + return list(self._qnames.values()) + + def copy(self): + return self.__class__(self._attrs, self._qnames) + + +def _test(): + XMLReader() + IncrementalParser() + Locator() + +if __name__ == "__main__": + _test() diff --git a/miniconda3/envs/active_proaction/lib/python3.10/xmlrpc/__init__.py b/miniconda3/envs/active_proaction/lib/python3.10/xmlrpc/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..196d3788575993eb403588b01ac6b0a3fbba13da --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/xmlrpc/__init__.py @@ -0,0 +1 @@ +# This directory is a Python package. diff --git a/miniconda3/envs/active_proaction/lib/python3.10/xmlrpc/client.py b/miniconda3/envs/active_proaction/lib/python3.10/xmlrpc/client.py new file mode 100644 index 0000000000000000000000000000000000000000..a614cef6ab2f1a52b3ece45f9a3c2e6920802e15 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/xmlrpc/client.py @@ -0,0 +1,1532 @@ +# +# XML-RPC CLIENT LIBRARY +# $Id$ +# +# an XML-RPC client interface for Python. +# +# the marshalling and response parser code can also be used to +# implement XML-RPC servers. +# +# Notes: +# this version is designed to work with Python 2.1 or newer. +# +# History: +# 1999-01-14 fl Created +# 1999-01-15 fl Changed dateTime to use localtime +# 1999-01-16 fl Added Binary/base64 element, default to RPC2 service +# 1999-01-19 fl Fixed array data element (from Skip Montanaro) +# 1999-01-21 fl Fixed dateTime constructor, etc. +# 1999-02-02 fl Added fault handling, handle empty sequences, etc. +# 1999-02-10 fl Fixed problem with empty responses (from Skip Montanaro) +# 1999-06-20 fl Speed improvements, pluggable parsers/transports (0.9.8) +# 2000-11-28 fl Changed boolean to check the truth value of its argument +# 2001-02-24 fl Added encoding/Unicode/SafeTransport patches +# 2001-02-26 fl Added compare support to wrappers (0.9.9/1.0b1) +# 2001-03-28 fl Make sure response tuple is a singleton +# 2001-03-29 fl Don't require empty params element (from Nicholas Riley) +# 2001-06-10 fl Folded in _xmlrpclib accelerator support (1.0b2) +# 2001-08-20 fl Base xmlrpclib.Error on built-in Exception (from Paul Prescod) +# 2001-09-03 fl Allow Transport subclass to override getparser +# 2001-09-10 fl Lazy import of urllib, cgi, xmllib (20x import speedup) +# 2001-10-01 fl Remove containers from memo cache when done with them +# 2001-10-01 fl Use faster escape method (80% dumps speedup) +# 2001-10-02 fl More dumps microtuning +# 2001-10-04 fl Make sure import expat gets a parser (from Guido van Rossum) +# 2001-10-10 sm Allow long ints to be passed as ints if they don't overflow +# 2001-10-17 sm Test for int and long overflow (allows use on 64-bit systems) +# 2001-11-12 fl Use repr() to marshal doubles (from Paul Felix) +# 2002-03-17 fl Avoid buffered read when possible (from James Rucker) +# 2002-04-07 fl Added pythondoc comments +# 2002-04-16 fl Added __str__ methods to datetime/binary wrappers +# 2002-05-15 fl Added error constants (from Andrew Kuchling) +# 2002-06-27 fl Merged with Python CVS version +# 2002-10-22 fl Added basic authentication (based on code from Phillip Eby) +# 2003-01-22 sm Add support for the bool type +# 2003-02-27 gvr Remove apply calls +# 2003-04-24 sm Use cStringIO if available +# 2003-04-25 ak Add support for nil +# 2003-06-15 gn Add support for time.struct_time +# 2003-07-12 gp Correct marshalling of Faults +# 2003-10-31 mvl Add multicall support +# 2004-08-20 mvl Bump minimum supported Python version to 2.1 +# 2014-12-02 ch/doko Add workaround for gzip bomb vulnerability +# +# Copyright (c) 1999-2002 by Secret Labs AB. +# Copyright (c) 1999-2002 by Fredrik Lundh. +# +# info@pythonware.com +# http://www.pythonware.com +# +# -------------------------------------------------------------------- +# The XML-RPC client interface is +# +# Copyright (c) 1999-2002 by Secret Labs AB +# Copyright (c) 1999-2002 by Fredrik Lundh +# +# By obtaining, using, and/or copying this software and/or its +# associated documentation, you agree that you have read, understood, +# and will comply with the following terms and conditions: +# +# Permission to use, copy, modify, and distribute this software and +# its associated documentation for any purpose and without fee is +# hereby granted, provided that the above copyright notice appears in +# all copies, and that both that copyright notice and this permission +# notice appear in supporting documentation, and that the name of +# Secret Labs AB or the author not be used in advertising or publicity +# pertaining to distribution of the software without specific, written +# prior permission. +# +# SECRET LABS AB AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD +# TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANT- +# ABILITY AND FITNESS. IN NO EVENT SHALL SECRET LABS AB OR THE AUTHOR +# 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. +# -------------------------------------------------------------------- + +""" +An XML-RPC client interface for Python. + +The marshalling and response parser code can also be used to +implement XML-RPC servers. + +Exported exceptions: + + Error Base class for client errors + ProtocolError Indicates an HTTP protocol error + ResponseError Indicates a broken response package + Fault Indicates an XML-RPC fault package + +Exported classes: + + ServerProxy Represents a logical connection to an XML-RPC server + + MultiCall Executor of boxcared xmlrpc requests + DateTime dateTime wrapper for an ISO 8601 string or time tuple or + localtime integer value to generate a "dateTime.iso8601" + XML-RPC value + Binary binary data wrapper + + Marshaller Generate an XML-RPC params chunk from a Python data structure + Unmarshaller Unmarshal an XML-RPC response from incoming XML event message + Transport Handles an HTTP transaction to an XML-RPC server + SafeTransport Handles an HTTPS transaction to an XML-RPC server + +Exported constants: + + (none) + +Exported functions: + + getparser Create instance of the fastest available parser & attach + to an unmarshalling object + dumps Convert an argument tuple or a Fault instance to an XML-RPC + request (or response, if the methodresponse option is used). + loads Convert an XML-RPC packet to unmarshalled data plus a method + name (None if not present). +""" + +import base64 +import sys +import time +from datetime import datetime +from decimal import Decimal +import http.client +import urllib.parse +from xml.parsers import expat +import errno +from io import BytesIO +try: + import gzip +except ImportError: + gzip = None #python can be built without zlib/gzip support + +# -------------------------------------------------------------------- +# Internal stuff + +def escape(s): + s = s.replace("&", "&") + s = s.replace("<", "<") + return s.replace(">", ">",) + +# used in User-Agent header sent +__version__ = '%d.%d' % sys.version_info[:2] + +# xmlrpc integer limits +MAXINT = 2**31-1 +MININT = -2**31 + +# -------------------------------------------------------------------- +# Error constants (from Dan Libby's specification at +# http://xmlrpc-epi.sourceforge.net/specs/rfc.fault_codes.php) + +# Ranges of errors +PARSE_ERROR = -32700 +SERVER_ERROR = -32600 +APPLICATION_ERROR = -32500 +SYSTEM_ERROR = -32400 +TRANSPORT_ERROR = -32300 + +# Specific errors +NOT_WELLFORMED_ERROR = -32700 +UNSUPPORTED_ENCODING = -32701 +INVALID_ENCODING_CHAR = -32702 +INVALID_XMLRPC = -32600 +METHOD_NOT_FOUND = -32601 +INVALID_METHOD_PARAMS = -32602 +INTERNAL_ERROR = -32603 + +# -------------------------------------------------------------------- +# Exceptions + +## +# Base class for all kinds of client-side errors. + +class Error(Exception): + """Base class for client errors.""" + __str__ = object.__str__ + +## +# Indicates an HTTP-level protocol error. This is raised by the HTTP +# transport layer, if the server returns an error code other than 200 +# (OK). +# +# @param url The target URL. +# @param errcode The HTTP error code. +# @param errmsg The HTTP error message. +# @param headers The HTTP header dictionary. + +class ProtocolError(Error): + """Indicates an HTTP protocol error.""" + def __init__(self, url, errcode, errmsg, headers): + Error.__init__(self) + self.url = url + self.errcode = errcode + self.errmsg = errmsg + self.headers = headers + def __repr__(self): + return ( + "<%s for %s: %s %s>" % + (self.__class__.__name__, self.url, self.errcode, self.errmsg) + ) + +## +# Indicates a broken XML-RPC response package. This exception is +# raised by the unmarshalling layer, if the XML-RPC response is +# malformed. + +class ResponseError(Error): + """Indicates a broken response package.""" + pass + +## +# Indicates an XML-RPC fault response package. This exception is +# raised by the unmarshalling layer, if the XML-RPC response contains +# a fault string. This exception can also be used as a class, to +# generate a fault XML-RPC message. +# +# @param faultCode The XML-RPC fault code. +# @param faultString The XML-RPC fault string. + +class Fault(Error): + """Indicates an XML-RPC fault package.""" + def __init__(self, faultCode, faultString, **extra): + Error.__init__(self) + self.faultCode = faultCode + self.faultString = faultString + def __repr__(self): + return "<%s %s: %r>" % (self.__class__.__name__, + self.faultCode, self.faultString) + +# -------------------------------------------------------------------- +# Special values + +## +# Backwards compatibility + +boolean = Boolean = bool + +## +# Wrapper for XML-RPC DateTime values. This converts a time value to +# the format used by XML-RPC. +#

    +# The value can be given as a datetime object, as a string in the +# format "yyyymmddThh:mm:ss", as a 9-item time tuple (as returned by +# time.localtime()), or an integer value (as returned by time.time()). +# The wrapper uses time.localtime() to convert an integer to a time +# tuple. +# +# @param value The time, given as a datetime object, an ISO 8601 string, +# a time tuple, or an integer time value. + + +# Issue #13305: different format codes across platforms +_day0 = datetime(1, 1, 1) +def _try(fmt): + try: + return _day0.strftime(fmt) == '0001' + except ValueError: + return False +if _try('%Y'): # Mac OS X + def _iso8601_format(value): + return value.strftime("%Y%m%dT%H:%M:%S") +elif _try('%4Y'): # Linux + def _iso8601_format(value): + return value.strftime("%4Y%m%dT%H:%M:%S") +else: + def _iso8601_format(value): + return value.strftime("%Y%m%dT%H:%M:%S").zfill(17) +del _day0 +del _try + + +def _strftime(value): + if isinstance(value, datetime): + return _iso8601_format(value) + + if not isinstance(value, (tuple, time.struct_time)): + if value == 0: + value = time.time() + value = time.localtime(value) + + return "%04d%02d%02dT%02d:%02d:%02d" % value[:6] + +class DateTime: + """DateTime wrapper for an ISO 8601 string or time tuple or + localtime integer value to generate 'dateTime.iso8601' XML-RPC + value. + """ + + def __init__(self, value=0): + if isinstance(value, str): + self.value = value + else: + self.value = _strftime(value) + + def make_comparable(self, other): + if isinstance(other, DateTime): + s = self.value + o = other.value + elif isinstance(other, datetime): + s = self.value + o = _iso8601_format(other) + elif isinstance(other, str): + s = self.value + o = other + elif hasattr(other, "timetuple"): + s = self.timetuple() + o = other.timetuple() + else: + s = self + o = NotImplemented + return s, o + + def __lt__(self, other): + s, o = self.make_comparable(other) + if o is NotImplemented: + return NotImplemented + return s < o + + def __le__(self, other): + s, o = self.make_comparable(other) + if o is NotImplemented: + return NotImplemented + return s <= o + + def __gt__(self, other): + s, o = self.make_comparable(other) + if o is NotImplemented: + return NotImplemented + return s > o + + def __ge__(self, other): + s, o = self.make_comparable(other) + if o is NotImplemented: + return NotImplemented + return s >= o + + def __eq__(self, other): + s, o = self.make_comparable(other) + if o is NotImplemented: + return NotImplemented + return s == o + + def timetuple(self): + return time.strptime(self.value, "%Y%m%dT%H:%M:%S") + + ## + # Get date/time value. + # + # @return Date/time value, as an ISO 8601 string. + + def __str__(self): + return self.value + + def __repr__(self): + return "<%s %r at %#x>" % (self.__class__.__name__, self.value, id(self)) + + def decode(self, data): + self.value = str(data).strip() + + def encode(self, out): + out.write("") + out.write(self.value) + out.write("\n") + +def _datetime(data): + # decode xml element contents into a DateTime structure. + value = DateTime() + value.decode(data) + return value + +def _datetime_type(data): + return datetime.strptime(data, "%Y%m%dT%H:%M:%S") + +## +# Wrapper for binary data. This can be used to transport any kind +# of binary data over XML-RPC, using BASE64 encoding. +# +# @param data An 8-bit string containing arbitrary data. + +class Binary: + """Wrapper for binary data.""" + + def __init__(self, data=None): + if data is None: + data = b"" + else: + if not isinstance(data, (bytes, bytearray)): + raise TypeError("expected bytes or bytearray, not %s" % + data.__class__.__name__) + data = bytes(data) # Make a copy of the bytes! + self.data = data + + ## + # Get buffer contents. + # + # @return Buffer contents, as an 8-bit string. + + def __str__(self): + return str(self.data, "latin-1") # XXX encoding?! + + def __eq__(self, other): + if isinstance(other, Binary): + other = other.data + return self.data == other + + def decode(self, data): + self.data = base64.decodebytes(data) + + def encode(self, out): + out.write("\n") + encoded = base64.encodebytes(self.data) + out.write(encoded.decode('ascii')) + out.write("\n") + +def _binary(data): + # decode xml element contents into a Binary structure + value = Binary() + value.decode(data) + return value + +WRAPPERS = (DateTime, Binary) + +# -------------------------------------------------------------------- +# XML parsers + +class ExpatParser: + # fast expat parser for Python 2.0 and later. + def __init__(self, target): + self._parser = parser = expat.ParserCreate(None, None) + self._target = target + parser.StartElementHandler = target.start + parser.EndElementHandler = target.end + parser.CharacterDataHandler = target.data + encoding = None + target.xml(encoding, None) + + def feed(self, data): + self._parser.Parse(data, False) + + def close(self): + try: + parser = self._parser + except AttributeError: + pass + else: + del self._target, self._parser # get rid of circular references + parser.Parse(b"", True) # end of data + +# -------------------------------------------------------------------- +# XML-RPC marshalling and unmarshalling code + +## +# XML-RPC marshaller. +# +# @param encoding Default encoding for 8-bit strings. The default +# value is None (interpreted as UTF-8). +# @see dumps + +class Marshaller: + """Generate an XML-RPC params chunk from a Python data structure. + + Create a Marshaller instance for each set of parameters, and use + the "dumps" method to convert your data (represented as a tuple) + to an XML-RPC params chunk. To write a fault response, pass a + Fault instance instead. You may prefer to use the "dumps" module + function for this purpose. + """ + + # by the way, if you don't understand what's going on in here, + # that's perfectly ok. + + def __init__(self, encoding=None, allow_none=False): + self.memo = {} + self.data = None + self.encoding = encoding + self.allow_none = allow_none + + dispatch = {} + + def dumps(self, values): + out = [] + write = out.append + dump = self.__dump + if isinstance(values, Fault): + # fault instance + write("\n") + dump({'faultCode': values.faultCode, + 'faultString': values.faultString}, + write) + write("\n") + else: + # parameter block + # FIXME: the xml-rpc specification allows us to leave out + # the entire block if there are no parameters. + # however, changing this may break older code (including + # old versions of xmlrpclib.py), so this is better left as + # is for now. See @XMLRPC3 for more information. /F + write("\n") + for v in values: + write("\n") + dump(v, write) + write("\n") + write("\n") + result = "".join(out) + return result + + def __dump(self, value, write): + try: + f = self.dispatch[type(value)] + except KeyError: + # check if this object can be marshalled as a structure + if not hasattr(value, '__dict__'): + raise TypeError("cannot marshal %s objects" % type(value)) + # check if this class is a sub-class of a basic type, + # because we don't know how to marshal these types + # (e.g. a string sub-class) + for type_ in type(value).__mro__: + if type_ in self.dispatch.keys(): + raise TypeError("cannot marshal %s objects" % type(value)) + # XXX(twouters): using "_arbitrary_instance" as key as a quick-fix + # for the p3yk merge, this should probably be fixed more neatly. + f = self.dispatch["_arbitrary_instance"] + f(self, value, write) + + def dump_nil (self, value, write): + if not self.allow_none: + raise TypeError("cannot marshal None unless allow_none is enabled") + write("") + dispatch[type(None)] = dump_nil + + def dump_bool(self, value, write): + write("") + write(value and "1" or "0") + write("\n") + dispatch[bool] = dump_bool + + def dump_long(self, value, write): + if value > MAXINT or value < MININT: + raise OverflowError("int exceeds XML-RPC limits") + write("") + write(str(int(value))) + write("\n") + dispatch[int] = dump_long + + # backward compatible + dump_int = dump_long + + def dump_double(self, value, write): + write("") + write(repr(value)) + write("\n") + dispatch[float] = dump_double + + def dump_unicode(self, value, write, escape=escape): + write("") + write(escape(value)) + write("\n") + dispatch[str] = dump_unicode + + def dump_bytes(self, value, write): + write("\n") + encoded = base64.encodebytes(value) + write(encoded.decode('ascii')) + write("\n") + dispatch[bytes] = dump_bytes + dispatch[bytearray] = dump_bytes + + def dump_array(self, value, write): + i = id(value) + if i in self.memo: + raise TypeError("cannot marshal recursive sequences") + self.memo[i] = None + dump = self.__dump + write("\n") + for v in value: + dump(v, write) + write("\n") + del self.memo[i] + dispatch[tuple] = dump_array + dispatch[list] = dump_array + + def dump_struct(self, value, write, escape=escape): + i = id(value) + if i in self.memo: + raise TypeError("cannot marshal recursive dictionaries") + self.memo[i] = None + dump = self.__dump + write("\n") + for k, v in value.items(): + write("\n") + if not isinstance(k, str): + raise TypeError("dictionary key must be string") + write("%s\n" % escape(k)) + dump(v, write) + write("\n") + write("\n") + del self.memo[i] + dispatch[dict] = dump_struct + + def dump_datetime(self, value, write): + write("") + write(_strftime(value)) + write("\n") + dispatch[datetime] = dump_datetime + + def dump_instance(self, value, write): + # check for special wrappers + if value.__class__ in WRAPPERS: + self.write = write + value.encode(self) + del self.write + else: + # store instance attributes as a struct (really?) + self.dump_struct(value.__dict__, write) + dispatch[DateTime] = dump_instance + dispatch[Binary] = dump_instance + # XXX(twouters): using "_arbitrary_instance" as key as a quick-fix + # for the p3yk merge, this should probably be fixed more neatly. + dispatch["_arbitrary_instance"] = dump_instance + +## +# XML-RPC unmarshaller. +# +# @see loads + +class Unmarshaller: + """Unmarshal an XML-RPC response, based on incoming XML event + messages (start, data, end). Call close() to get the resulting + data structure. + + Note that this reader is fairly tolerant, and gladly accepts bogus + XML-RPC data without complaining (but not bogus XML). + """ + + # and again, if you don't understand what's going on in here, + # that's perfectly ok. + + def __init__(self, use_datetime=False, use_builtin_types=False): + self._type = None + self._stack = [] + self._marks = [] + self._data = [] + self._value = False + self._methodname = None + self._encoding = "utf-8" + self.append = self._stack.append + self._use_datetime = use_builtin_types or use_datetime + self._use_bytes = use_builtin_types + + def close(self): + # return response tuple and target method + if self._type is None or self._marks: + raise ResponseError() + if self._type == "fault": + raise Fault(**self._stack[0]) + return tuple(self._stack) + + def getmethodname(self): + return self._methodname + + # + # event handlers + + def xml(self, encoding, standalone): + self._encoding = encoding + # FIXME: assert standalone == 1 ??? + + def start(self, tag, attrs): + # prepare to handle this element + if ':' in tag: + tag = tag.split(':')[-1] + if tag == "array" or tag == "struct": + self._marks.append(len(self._stack)) + self._data = [] + if self._value and tag not in self.dispatch: + raise ResponseError("unknown tag %r" % tag) + self._value = (tag == "value") + + def data(self, text): + self._data.append(text) + + def end(self, tag): + # call the appropriate end tag handler + try: + f = self.dispatch[tag] + except KeyError: + if ':' not in tag: + return # unknown tag ? + try: + f = self.dispatch[tag.split(':')[-1]] + except KeyError: + return # unknown tag ? + return f(self, "".join(self._data)) + + # + # accelerator support + + def end_dispatch(self, tag, data): + # dispatch data + try: + f = self.dispatch[tag] + except KeyError: + if ':' not in tag: + return # unknown tag ? + try: + f = self.dispatch[tag.split(':')[-1]] + except KeyError: + return # unknown tag ? + return f(self, data) + + # + # element decoders + + dispatch = {} + + def end_nil (self, data): + self.append(None) + self._value = 0 + dispatch["nil"] = end_nil + + def end_boolean(self, data): + if data == "0": + self.append(False) + elif data == "1": + self.append(True) + else: + raise TypeError("bad boolean value") + self._value = 0 + dispatch["boolean"] = end_boolean + + def end_int(self, data): + self.append(int(data)) + self._value = 0 + dispatch["i1"] = end_int + dispatch["i2"] = end_int + dispatch["i4"] = end_int + dispatch["i8"] = end_int + dispatch["int"] = end_int + dispatch["biginteger"] = end_int + + def end_double(self, data): + self.append(float(data)) + self._value = 0 + dispatch["double"] = end_double + dispatch["float"] = end_double + + def end_bigdecimal(self, data): + self.append(Decimal(data)) + self._value = 0 + dispatch["bigdecimal"] = end_bigdecimal + + def end_string(self, data): + if self._encoding: + data = data.decode(self._encoding) + self.append(data) + self._value = 0 + dispatch["string"] = end_string + dispatch["name"] = end_string # struct keys are always strings + + def end_array(self, data): + mark = self._marks.pop() + # map arrays to Python lists + self._stack[mark:] = [self._stack[mark:]] + self._value = 0 + dispatch["array"] = end_array + + def end_struct(self, data): + mark = self._marks.pop() + # map structs to Python dictionaries + dict = {} + items = self._stack[mark:] + for i in range(0, len(items), 2): + dict[items[i]] = items[i+1] + self._stack[mark:] = [dict] + self._value = 0 + dispatch["struct"] = end_struct + + def end_base64(self, data): + value = Binary() + value.decode(data.encode("ascii")) + if self._use_bytes: + value = value.data + self.append(value) + self._value = 0 + dispatch["base64"] = end_base64 + + def end_dateTime(self, data): + value = DateTime() + value.decode(data) + if self._use_datetime: + value = _datetime_type(data) + self.append(value) + dispatch["dateTime.iso8601"] = end_dateTime + + def end_value(self, data): + # if we stumble upon a value element with no internal + # elements, treat it as a string element + if self._value: + self.end_string(data) + dispatch["value"] = end_value + + def end_params(self, data): + self._type = "params" + dispatch["params"] = end_params + + def end_fault(self, data): + self._type = "fault" + dispatch["fault"] = end_fault + + def end_methodName(self, data): + if self._encoding: + data = data.decode(self._encoding) + self._methodname = data + self._type = "methodName" # no params + dispatch["methodName"] = end_methodName + +## Multicall support +# + +class _MultiCallMethod: + # some lesser magic to store calls made to a MultiCall object + # for batch execution + def __init__(self, call_list, name): + self.__call_list = call_list + self.__name = name + def __getattr__(self, name): + return _MultiCallMethod(self.__call_list, "%s.%s" % (self.__name, name)) + def __call__(self, *args): + self.__call_list.append((self.__name, args)) + +class MultiCallIterator: + """Iterates over the results of a multicall. Exceptions are + raised in response to xmlrpc faults.""" + + def __init__(self, results): + self.results = results + + def __getitem__(self, i): + item = self.results[i] + if type(item) == type({}): + raise Fault(item['faultCode'], item['faultString']) + elif type(item) == type([]): + return item[0] + else: + raise ValueError("unexpected type in multicall result") + +class MultiCall: + """server -> an object used to boxcar method calls + + server should be a ServerProxy object. + + Methods can be added to the MultiCall using normal + method call syntax e.g.: + + multicall = MultiCall(server_proxy) + multicall.add(2,3) + multicall.get_address("Guido") + + To execute the multicall, call the MultiCall object e.g.: + + add_result, address = multicall() + """ + + def __init__(self, server): + self.__server = server + self.__call_list = [] + + def __repr__(self): + return "<%s at %#x>" % (self.__class__.__name__, id(self)) + + def __getattr__(self, name): + return _MultiCallMethod(self.__call_list, name) + + def __call__(self): + marshalled_list = [] + for name, args in self.__call_list: + marshalled_list.append({'methodName' : name, 'params' : args}) + + return MultiCallIterator(self.__server.system.multicall(marshalled_list)) + +# -------------------------------------------------------------------- +# convenience functions + +FastMarshaller = FastParser = FastUnmarshaller = None + +## +# Create a parser object, and connect it to an unmarshalling instance. +# This function picks the fastest available XML parser. +# +# return A (parser, unmarshaller) tuple. + +def getparser(use_datetime=False, use_builtin_types=False): + """getparser() -> parser, unmarshaller + + Create an instance of the fastest available parser, and attach it + to an unmarshalling object. Return both objects. + """ + if FastParser and FastUnmarshaller: + if use_builtin_types: + mkdatetime = _datetime_type + mkbytes = base64.decodebytes + elif use_datetime: + mkdatetime = _datetime_type + mkbytes = _binary + else: + mkdatetime = _datetime + mkbytes = _binary + target = FastUnmarshaller(True, False, mkbytes, mkdatetime, Fault) + parser = FastParser(target) + else: + target = Unmarshaller(use_datetime=use_datetime, use_builtin_types=use_builtin_types) + if FastParser: + parser = FastParser(target) + else: + parser = ExpatParser(target) + return parser, target + +## +# Convert a Python tuple or a Fault instance to an XML-RPC packet. +# +# @def dumps(params, **options) +# @param params A tuple or Fault instance. +# @keyparam methodname If given, create a methodCall request for +# this method name. +# @keyparam methodresponse If given, create a methodResponse packet. +# If used with a tuple, the tuple must be a singleton (that is, +# it must contain exactly one element). +# @keyparam encoding The packet encoding. +# @return A string containing marshalled data. + +def dumps(params, methodname=None, methodresponse=None, encoding=None, + allow_none=False): + """data [,options] -> marshalled data + + Convert an argument tuple or a Fault instance to an XML-RPC + request (or response, if the methodresponse option is used). + + In addition to the data object, the following options can be given + as keyword arguments: + + methodname: the method name for a methodCall packet + + methodresponse: true to create a methodResponse packet. + If this option is used with a tuple, the tuple must be + a singleton (i.e. it can contain only one element). + + encoding: the packet encoding (default is UTF-8) + + All byte strings in the data structure are assumed to use the + packet encoding. Unicode strings are automatically converted, + where necessary. + """ + + assert isinstance(params, (tuple, Fault)), "argument must be tuple or Fault instance" + if isinstance(params, Fault): + methodresponse = 1 + elif methodresponse and isinstance(params, tuple): + assert len(params) == 1, "response tuple must be a singleton" + + if not encoding: + encoding = "utf-8" + + if FastMarshaller: + m = FastMarshaller(encoding) + else: + m = Marshaller(encoding, allow_none) + + data = m.dumps(params) + + if encoding != "utf-8": + xmlheader = "\n" % str(encoding) + else: + xmlheader = "\n" # utf-8 is default + + # standard XML-RPC wrappings + if methodname: + # a method call + data = ( + xmlheader, + "\n" + "", methodname, "\n", + data, + "\n" + ) + elif methodresponse: + # a method response, or a fault structure + data = ( + xmlheader, + "\n", + data, + "\n" + ) + else: + return data # return as is + return "".join(data) + +## +# Convert an XML-RPC packet to a Python object. If the XML-RPC packet +# represents a fault condition, this function raises a Fault exception. +# +# @param data An XML-RPC packet, given as an 8-bit string. +# @return A tuple containing the unpacked data, and the method name +# (None if not present). +# @see Fault + +def loads(data, use_datetime=False, use_builtin_types=False): + """data -> unmarshalled data, method name + + Convert an XML-RPC packet to unmarshalled data plus a method + name (None if not present). + + If the XML-RPC packet represents a fault condition, this function + raises a Fault exception. + """ + p, u = getparser(use_datetime=use_datetime, use_builtin_types=use_builtin_types) + p.feed(data) + p.close() + return u.close(), u.getmethodname() + +## +# Encode a string using the gzip content encoding such as specified by the +# Content-Encoding: gzip +# in the HTTP header, as described in RFC 1952 +# +# @param data the unencoded data +# @return the encoded data + +def gzip_encode(data): + """data -> gzip encoded data + + Encode data using the gzip content encoding as described in RFC 1952 + """ + if not gzip: + raise NotImplementedError + f = BytesIO() + with gzip.GzipFile(mode="wb", fileobj=f, compresslevel=1) as gzf: + gzf.write(data) + return f.getvalue() + +## +# Decode a string using the gzip content encoding such as specified by the +# Content-Encoding: gzip +# in the HTTP header, as described in RFC 1952 +# +# @param data The encoded data +# @keyparam max_decode Maximum bytes to decode (20 MiB default), use negative +# values for unlimited decoding +# @return the unencoded data +# @raises ValueError if data is not correctly coded. +# @raises ValueError if max gzipped payload length exceeded + +def gzip_decode(data, max_decode=20971520): + """gzip encoded data -> unencoded data + + Decode data using the gzip content encoding as described in RFC 1952 + """ + if not gzip: + raise NotImplementedError + with gzip.GzipFile(mode="rb", fileobj=BytesIO(data)) as gzf: + try: + if max_decode < 0: # no limit + decoded = gzf.read() + else: + decoded = gzf.read(max_decode + 1) + except OSError: + raise ValueError("invalid data") + if max_decode >= 0 and len(decoded) > max_decode: + raise ValueError("max gzipped payload length exceeded") + return decoded + +## +# Return a decoded file-like object for the gzip encoding +# as described in RFC 1952. +# +# @param response A stream supporting a read() method +# @return a file-like object that the decoded data can be read() from + +class GzipDecodedResponse(gzip.GzipFile if gzip else object): + """a file-like object to decode a response encoded with the gzip + method, as described in RFC 1952. + """ + def __init__(self, response): + #response doesn't support tell() and read(), required by + #GzipFile + if not gzip: + raise NotImplementedError + self.io = BytesIO(response.read()) + gzip.GzipFile.__init__(self, mode="rb", fileobj=self.io) + + def close(self): + try: + gzip.GzipFile.close(self) + finally: + self.io.close() + + +# -------------------------------------------------------------------- +# request dispatcher + +class _Method: + # some magic to bind an XML-RPC method to an RPC server. + # supports "nested" methods (e.g. examples.getStateName) + def __init__(self, send, name): + self.__send = send + self.__name = name + def __getattr__(self, name): + return _Method(self.__send, "%s.%s" % (self.__name, name)) + def __call__(self, *args): + return self.__send(self.__name, args) + +## +# Standard transport class for XML-RPC over HTTP. +#

    +# You can create custom transports by subclassing this method, and +# overriding selected methods. + +class Transport: + """Handles an HTTP transaction to an XML-RPC server.""" + + # client identifier (may be overridden) + user_agent = "Python-xmlrpc/%s" % __version__ + + #if true, we'll request gzip encoding + accept_gzip_encoding = True + + # if positive, encode request using gzip if it exceeds this threshold + # note that many servers will get confused, so only use it if you know + # that they can decode such a request + encode_threshold = None #None = don't encode + + def __init__(self, use_datetime=False, use_builtin_types=False, + *, headers=()): + self._use_datetime = use_datetime + self._use_builtin_types = use_builtin_types + self._connection = (None, None) + self._headers = list(headers) + self._extra_headers = [] + + ## + # Send a complete request, and parse the response. + # Retry request if a cached connection has disconnected. + # + # @param host Target host. + # @param handler Target PRC handler. + # @param request_body XML-RPC request body. + # @param verbose Debugging flag. + # @return Parsed response. + + def request(self, host, handler, request_body, verbose=False): + #retry request once if cached connection has gone cold + for i in (0, 1): + try: + return self.single_request(host, handler, request_body, verbose) + except http.client.RemoteDisconnected: + if i: + raise + except OSError as e: + if i or e.errno not in (errno.ECONNRESET, errno.ECONNABORTED, + errno.EPIPE): + raise + + def single_request(self, host, handler, request_body, verbose=False): + # issue XML-RPC request + try: + http_conn = self.send_request(host, handler, request_body, verbose) + resp = http_conn.getresponse() + if resp.status == 200: + self.verbose = verbose + return self.parse_response(resp) + + except Fault: + raise + except Exception: + #All unexpected errors leave connection in + # a strange state, so we clear it. + self.close() + raise + + #We got an error response. + #Discard any response data and raise exception + if resp.getheader("content-length", ""): + resp.read() + raise ProtocolError( + host + handler, + resp.status, resp.reason, + dict(resp.getheaders()) + ) + + + ## + # Create parser. + # + # @return A 2-tuple containing a parser and an unmarshaller. + + def getparser(self): + # get parser and unmarshaller + return getparser(use_datetime=self._use_datetime, + use_builtin_types=self._use_builtin_types) + + ## + # Get authorization info from host parameter + # Host may be a string, or a (host, x509-dict) tuple; if a string, + # it is checked for a "user:pw@host" format, and a "Basic + # Authentication" header is added if appropriate. + # + # @param host Host descriptor (URL or (URL, x509 info) tuple). + # @return A 3-tuple containing (actual host, extra headers, + # x509 info). The header and x509 fields may be None. + + def get_host_info(self, host): + + x509 = {} + if isinstance(host, tuple): + host, x509 = host + + auth, host = urllib.parse._splituser(host) + + if auth: + auth = urllib.parse.unquote_to_bytes(auth) + auth = base64.encodebytes(auth).decode("utf-8") + auth = "".join(auth.split()) # get rid of whitespace + extra_headers = [ + ("Authorization", "Basic " + auth) + ] + else: + extra_headers = [] + + return host, extra_headers, x509 + + ## + # Connect to server. + # + # @param host Target host. + # @return An HTTPConnection object + + def make_connection(self, host): + #return an existing connection if possible. This allows + #HTTP/1.1 keep-alive. + if self._connection and host == self._connection[0]: + return self._connection[1] + # create a HTTP connection object from a host descriptor + chost, self._extra_headers, x509 = self.get_host_info(host) + self._connection = host, http.client.HTTPConnection(chost) + return self._connection[1] + + ## + # Clear any cached connection object. + # Used in the event of socket errors. + # + def close(self): + host, connection = self._connection + if connection: + self._connection = (None, None) + connection.close() + + ## + # Send HTTP request. + # + # @param host Host descriptor (URL or (URL, x509 info) tuple). + # @param handler Target RPC handler (a path relative to host) + # @param request_body The XML-RPC request body + # @param debug Enable debugging if debug is true. + # @return An HTTPConnection. + + def send_request(self, host, handler, request_body, debug): + connection = self.make_connection(host) + headers = self._headers + self._extra_headers + if debug: + connection.set_debuglevel(1) + if self.accept_gzip_encoding and gzip: + connection.putrequest("POST", handler, skip_accept_encoding=True) + headers.append(("Accept-Encoding", "gzip")) + else: + connection.putrequest("POST", handler) + headers.append(("Content-Type", "text/xml")) + headers.append(("User-Agent", self.user_agent)) + self.send_headers(connection, headers) + self.send_content(connection, request_body) + return connection + + ## + # Send request headers. + # This function provides a useful hook for subclassing + # + # @param connection httpConnection. + # @param headers list of key,value pairs for HTTP headers + + def send_headers(self, connection, headers): + for key, val in headers: + connection.putheader(key, val) + + ## + # Send request body. + # This function provides a useful hook for subclassing + # + # @param connection httpConnection. + # @param request_body XML-RPC request body. + + def send_content(self, connection, request_body): + #optionally encode the request + if (self.encode_threshold is not None and + self.encode_threshold < len(request_body) and + gzip): + connection.putheader("Content-Encoding", "gzip") + request_body = gzip_encode(request_body) + + connection.putheader("Content-Length", str(len(request_body))) + connection.endheaders(request_body) + + ## + # Parse response. + # + # @param file Stream. + # @return Response tuple and target method. + + def parse_response(self, response): + # read response data from httpresponse, and parse it + # Check for new http response object, otherwise it is a file object. + if hasattr(response, 'getheader'): + if response.getheader("Content-Encoding", "") == "gzip": + stream = GzipDecodedResponse(response) + else: + stream = response + else: + stream = response + + p, u = self.getparser() + + while 1: + data = stream.read(1024) + if not data: + break + if self.verbose: + print("body:", repr(data)) + p.feed(data) + + if stream is not response: + stream.close() + p.close() + + return u.close() + +## +# Standard transport class for XML-RPC over HTTPS. + +class SafeTransport(Transport): + """Handles an HTTPS transaction to an XML-RPC server.""" + + def __init__(self, use_datetime=False, use_builtin_types=False, + *, headers=(), context=None): + super().__init__(use_datetime=use_datetime, + use_builtin_types=use_builtin_types, + headers=headers) + self.context = context + + # FIXME: mostly untested + + def make_connection(self, host): + if self._connection and host == self._connection[0]: + return self._connection[1] + + if not hasattr(http.client, "HTTPSConnection"): + raise NotImplementedError( + "your version of http.client doesn't support HTTPS") + # create a HTTPS connection object from a host descriptor + # host may be a string, or a (host, x509-dict) tuple + chost, self._extra_headers, x509 = self.get_host_info(host) + self._connection = host, http.client.HTTPSConnection(chost, + None, context=self.context, **(x509 or {})) + return self._connection[1] + +## +# Standard server proxy. This class establishes a virtual connection +# to an XML-RPC server. +#

    +# This class is available as ServerProxy and Server. New code should +# use ServerProxy, to avoid confusion. +# +# @def ServerProxy(uri, **options) +# @param uri The connection point on the server. +# @keyparam transport A transport factory, compatible with the +# standard transport class. +# @keyparam encoding The default encoding used for 8-bit strings +# (default is UTF-8). +# @keyparam verbose Use a true value to enable debugging output. +# (printed to standard output). +# @see Transport + +class ServerProxy: + """uri [,options] -> a logical connection to an XML-RPC server + + uri is the connection point on the server, given as + scheme://host/target. + + The standard implementation always supports the "http" scheme. If + SSL socket support is available (Python 2.0), it also supports + "https". + + If the target part and the slash preceding it are both omitted, + "/RPC2" is assumed. + + The following options can be given as keyword arguments: + + transport: a transport factory + encoding: the request encoding (default is UTF-8) + + All 8-bit strings passed to the server proxy are assumed to use + the given encoding. + """ + + def __init__(self, uri, transport=None, encoding=None, verbose=False, + allow_none=False, use_datetime=False, use_builtin_types=False, + *, headers=(), context=None): + # establish a "logical" server connection + + # get the url + p = urllib.parse.urlsplit(uri) + if p.scheme not in ("http", "https"): + raise OSError("unsupported XML-RPC protocol") + self.__host = p.netloc + self.__handler = urllib.parse.urlunsplit(["", "", *p[2:]]) + if not self.__handler: + self.__handler = "/RPC2" + + if transport is None: + if p.scheme == "https": + handler = SafeTransport + extra_kwargs = {"context": context} + else: + handler = Transport + extra_kwargs = {} + transport = handler(use_datetime=use_datetime, + use_builtin_types=use_builtin_types, + headers=headers, + **extra_kwargs) + self.__transport = transport + + self.__encoding = encoding or 'utf-8' + self.__verbose = verbose + self.__allow_none = allow_none + + def __close(self): + self.__transport.close() + + def __request(self, methodname, params): + # call a method on the remote server + + request = dumps(params, methodname, encoding=self.__encoding, + allow_none=self.__allow_none).encode(self.__encoding, 'xmlcharrefreplace') + + response = self.__transport.request( + self.__host, + self.__handler, + request, + verbose=self.__verbose + ) + + if len(response) == 1: + response = response[0] + + return response + + def __repr__(self): + return ( + "<%s for %s%s>" % + (self.__class__.__name__, self.__host, self.__handler) + ) + + def __getattr__(self, name): + # magic method dispatcher + return _Method(self.__request, name) + + # note: to call a remote object with a non-standard name, use + # result getattr(server, "strange-python-name")(args) + + def __call__(self, attr): + """A workaround to get special attributes on the ServerProxy + without interfering with the magic __getattr__ + """ + if attr == "close": + return self.__close + elif attr == "transport": + return self.__transport + raise AttributeError("Attribute %r not found" % (attr,)) + + def __enter__(self): + return self + + def __exit__(self, *args): + self.__close() + +# compatibility + +Server = ServerProxy + +# -------------------------------------------------------------------- +# test code + +if __name__ == "__main__": + + # simple test program (from the XML-RPC specification) + + # local server, available from Lib/xmlrpc/server.py + server = ServerProxy("http://localhost:8000") + + try: + print(server.currentTime.getCurrentTime()) + except Error as v: + print("ERROR", v) + + multi = MultiCall(server) + multi.getData() + multi.pow(2,9) + multi.add(1,2) + try: + for response in multi(): + print(response) + except Error as v: + print("ERROR", v) diff --git a/miniconda3/envs/active_proaction/lib/python3.10/xmlrpc/server.py b/miniconda3/envs/active_proaction/lib/python3.10/xmlrpc/server.py new file mode 100644 index 0000000000000000000000000000000000000000..69a260f5b12c079813d9760d45e1dff689527861 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/xmlrpc/server.py @@ -0,0 +1,993 @@ +r"""XML-RPC Servers. + +This module can be used to create simple XML-RPC servers +by creating a server and either installing functions, a +class instance, or by extending the SimpleXMLRPCServer +class. + +It can also be used to handle XML-RPC requests in a CGI +environment using CGIXMLRPCRequestHandler. + +The Doc* classes can be used to create XML-RPC servers that +serve pydoc-style documentation in response to HTTP +GET requests. This documentation is dynamically generated +based on the functions and methods registered with the +server. + +A list of possible usage patterns follows: + +1. Install functions: + +server = SimpleXMLRPCServer(("localhost", 8000)) +server.register_function(pow) +server.register_function(lambda x,y: x+y, 'add') +server.serve_forever() + +2. Install an instance: + +class MyFuncs: + def __init__(self): + # make all of the sys functions available through sys.func_name + import sys + self.sys = sys + def _listMethods(self): + # implement this method so that system.listMethods + # knows to advertise the sys methods + return list_public_methods(self) + \ + ['sys.' + method for method in list_public_methods(self.sys)] + def pow(self, x, y): return pow(x, y) + def add(self, x, y) : return x + y + +server = SimpleXMLRPCServer(("localhost", 8000)) +server.register_introspection_functions() +server.register_instance(MyFuncs()) +server.serve_forever() + +3. Install an instance with custom dispatch method: + +class Math: + def _listMethods(self): + # this method must be present for system.listMethods + # to work + return ['add', 'pow'] + def _methodHelp(self, method): + # this method must be present for system.methodHelp + # to work + if method == 'add': + return "add(2,3) => 5" + elif method == 'pow': + return "pow(x, y[, z]) => number" + else: + # By convention, return empty + # string if no help is available + return "" + def _dispatch(self, method, params): + if method == 'pow': + return pow(*params) + elif method == 'add': + return params[0] + params[1] + else: + raise ValueError('bad method') + +server = SimpleXMLRPCServer(("localhost", 8000)) +server.register_introspection_functions() +server.register_instance(Math()) +server.serve_forever() + +4. Subclass SimpleXMLRPCServer: + +class MathServer(SimpleXMLRPCServer): + def _dispatch(self, method, params): + try: + # We are forcing the 'export_' prefix on methods that are + # callable through XML-RPC to prevent potential security + # problems + func = getattr(self, 'export_' + method) + except AttributeError: + raise Exception('method "%s" is not supported' % method) + else: + return func(*params) + + def export_add(self, x, y): + return x + y + +server = MathServer(("localhost", 8000)) +server.serve_forever() + +5. CGI script: + +server = CGIXMLRPCRequestHandler() +server.register_function(pow) +server.handle_request() +""" + +# Written by Brian Quinlan (brian@sweetapp.com). +# Based on code written by Fredrik Lundh. + +from xmlrpc.client import Fault, dumps, loads, gzip_encode, gzip_decode +from http.server import BaseHTTPRequestHandler +from functools import partial +from inspect import signature +import html +import http.server +import socketserver +import sys +import os +import re +import pydoc +import traceback +try: + import fcntl +except ImportError: + fcntl = None + +def resolve_dotted_attribute(obj, attr, allow_dotted_names=True): + """resolve_dotted_attribute(a, 'b.c.d') => a.b.c.d + + Resolves a dotted attribute name to an object. Raises + an AttributeError if any attribute in the chain starts with a '_'. + + If the optional allow_dotted_names argument is false, dots are not + supported and this function operates similar to getattr(obj, attr). + """ + + if allow_dotted_names: + attrs = attr.split('.') + else: + attrs = [attr] + + for i in attrs: + if i.startswith('_'): + raise AttributeError( + 'attempt to access private attribute "%s"' % i + ) + else: + obj = getattr(obj,i) + return obj + +def list_public_methods(obj): + """Returns a list of attribute strings, found in the specified + object, which represent callable attributes""" + + return [member for member in dir(obj) + if not member.startswith('_') and + callable(getattr(obj, member))] + +class SimpleXMLRPCDispatcher: + """Mix-in class that dispatches XML-RPC requests. + + This class is used to register XML-RPC method handlers + and then to dispatch them. This class doesn't need to be + instanced directly when used by SimpleXMLRPCServer but it + can be instanced when used by the MultiPathXMLRPCServer + """ + + def __init__(self, allow_none=False, encoding=None, + use_builtin_types=False): + self.funcs = {} + self.instance = None + self.allow_none = allow_none + self.encoding = encoding or 'utf-8' + self.use_builtin_types = use_builtin_types + + def register_instance(self, instance, allow_dotted_names=False): + """Registers an instance to respond to XML-RPC requests. + + Only one instance can be installed at a time. + + If the registered instance has a _dispatch method then that + method will be called with the name of the XML-RPC method and + its parameters as a tuple + e.g. instance._dispatch('add',(2,3)) + + If the registered instance does not have a _dispatch method + then the instance will be searched to find a matching method + and, if found, will be called. Methods beginning with an '_' + are considered private and will not be called by + SimpleXMLRPCServer. + + If a registered function matches an XML-RPC request, then it + will be called instead of the registered instance. + + If the optional allow_dotted_names argument is true and the + instance does not have a _dispatch method, method names + containing dots are supported and resolved, as long as none of + the name segments start with an '_'. + + *** SECURITY WARNING: *** + + Enabling the allow_dotted_names options allows intruders + to access your module's global variables and may allow + intruders to execute arbitrary code on your machine. Only + use this option on a secure, closed network. + + """ + + self.instance = instance + self.allow_dotted_names = allow_dotted_names + + def register_function(self, function=None, name=None): + """Registers a function to respond to XML-RPC requests. + + The optional name argument can be used to set a Unicode name + for the function. + """ + # decorator factory + if function is None: + return partial(self.register_function, name=name) + + if name is None: + name = function.__name__ + self.funcs[name] = function + + return function + + def register_introspection_functions(self): + """Registers the XML-RPC introspection methods in the system + namespace. + + see http://xmlrpc.usefulinc.com/doc/reserved.html + """ + + self.funcs.update({'system.listMethods' : self.system_listMethods, + 'system.methodSignature' : self.system_methodSignature, + 'system.methodHelp' : self.system_methodHelp}) + + def register_multicall_functions(self): + """Registers the XML-RPC multicall method in the system + namespace. + + see http://www.xmlrpc.com/discuss/msgReader$1208""" + + self.funcs.update({'system.multicall' : self.system_multicall}) + + def _marshaled_dispatch(self, data, dispatch_method = None, path = None): + """Dispatches an XML-RPC method from marshalled (XML) data. + + XML-RPC methods are dispatched from the marshalled (XML) data + using the _dispatch method and the result is returned as + marshalled data. For backwards compatibility, a dispatch + function can be provided as an argument (see comment in + SimpleXMLRPCRequestHandler.do_POST) but overriding the + existing method through subclassing is the preferred means + of changing method dispatch behavior. + """ + + try: + params, method = loads(data, use_builtin_types=self.use_builtin_types) + + # generate response + if dispatch_method is not None: + response = dispatch_method(method, params) + else: + response = self._dispatch(method, params) + # wrap response in a singleton tuple + response = (response,) + response = dumps(response, methodresponse=1, + allow_none=self.allow_none, encoding=self.encoding) + except Fault as fault: + response = dumps(fault, allow_none=self.allow_none, + encoding=self.encoding) + except: + # report exception back to server + exc_type, exc_value, exc_tb = sys.exc_info() + try: + response = dumps( + Fault(1, "%s:%s" % (exc_type, exc_value)), + encoding=self.encoding, allow_none=self.allow_none, + ) + finally: + # Break reference cycle + exc_type = exc_value = exc_tb = None + + return response.encode(self.encoding, 'xmlcharrefreplace') + + def system_listMethods(self): + """system.listMethods() => ['add', 'subtract', 'multiple'] + + Returns a list of the methods supported by the server.""" + + methods = set(self.funcs.keys()) + if self.instance is not None: + # Instance can implement _listMethod to return a list of + # methods + if hasattr(self.instance, '_listMethods'): + methods |= set(self.instance._listMethods()) + # if the instance has a _dispatch method then we + # don't have enough information to provide a list + # of methods + elif not hasattr(self.instance, '_dispatch'): + methods |= set(list_public_methods(self.instance)) + return sorted(methods) + + def system_methodSignature(self, method_name): + """system.methodSignature('add') => [double, int, int] + + Returns a list describing the signature of the method. In the + above example, the add method takes two integers as arguments + and returns a double result. + + This server does NOT support system.methodSignature.""" + + # See http://xmlrpc.usefulinc.com/doc/sysmethodsig.html + + return 'signatures not supported' + + def system_methodHelp(self, method_name): + """system.methodHelp('add') => "Adds two integers together" + + Returns a string containing documentation for the specified method.""" + + method = None + if method_name in self.funcs: + method = self.funcs[method_name] + elif self.instance is not None: + # Instance can implement _methodHelp to return help for a method + if hasattr(self.instance, '_methodHelp'): + return self.instance._methodHelp(method_name) + # if the instance has a _dispatch method then we + # don't have enough information to provide help + elif not hasattr(self.instance, '_dispatch'): + try: + method = resolve_dotted_attribute( + self.instance, + method_name, + self.allow_dotted_names + ) + except AttributeError: + pass + + # Note that we aren't checking that the method actually + # be a callable object of some kind + if method is None: + return "" + else: + return pydoc.getdoc(method) + + def system_multicall(self, call_list): + """system.multicall([{'methodName': 'add', 'params': [2, 2]}, ...]) => \ +[[4], ...] + + Allows the caller to package multiple XML-RPC calls into a single + request. + + See http://www.xmlrpc.com/discuss/msgReader$1208 + """ + + results = [] + for call in call_list: + method_name = call['methodName'] + params = call['params'] + + try: + # XXX A marshalling error in any response will fail the entire + # multicall. If someone cares they should fix this. + results.append([self._dispatch(method_name, params)]) + except Fault as fault: + results.append( + {'faultCode' : fault.faultCode, + 'faultString' : fault.faultString} + ) + except: + exc_type, exc_value, exc_tb = sys.exc_info() + try: + results.append( + {'faultCode' : 1, + 'faultString' : "%s:%s" % (exc_type, exc_value)} + ) + finally: + # Break reference cycle + exc_type = exc_value = exc_tb = None + return results + + def _dispatch(self, method, params): + """Dispatches the XML-RPC method. + + XML-RPC calls are forwarded to a registered function that + matches the called XML-RPC method name. If no such function + exists then the call is forwarded to the registered instance, + if available. + + If the registered instance has a _dispatch method then that + method will be called with the name of the XML-RPC method and + its parameters as a tuple + e.g. instance._dispatch('add',(2,3)) + + If the registered instance does not have a _dispatch method + then the instance will be searched to find a matching method + and, if found, will be called. + + Methods beginning with an '_' are considered private and will + not be called. + """ + + try: + # call the matching registered function + func = self.funcs[method] + except KeyError: + pass + else: + if func is not None: + return func(*params) + raise Exception('method "%s" is not supported' % method) + + if self.instance is not None: + if hasattr(self.instance, '_dispatch'): + # call the `_dispatch` method on the instance + return self.instance._dispatch(method, params) + + # call the instance's method directly + try: + func = resolve_dotted_attribute( + self.instance, + method, + self.allow_dotted_names + ) + except AttributeError: + pass + else: + if func is not None: + return func(*params) + + raise Exception('method "%s" is not supported' % method) + +class SimpleXMLRPCRequestHandler(BaseHTTPRequestHandler): + """Simple XML-RPC request handler class. + + Handles all HTTP POST requests and attempts to decode them as + XML-RPC requests. + """ + + # Class attribute listing the accessible path components; + # paths not on this list will result in a 404 error. + rpc_paths = ('/', '/RPC2') + + #if not None, encode responses larger than this, if possible + encode_threshold = 1400 #a common MTU + + #Override form StreamRequestHandler: full buffering of output + #and no Nagle. + wbufsize = -1 + disable_nagle_algorithm = True + + # a re to match a gzip Accept-Encoding + aepattern = re.compile(r""" + \s* ([^\s;]+) \s* #content-coding + (;\s* q \s*=\s* ([0-9\.]+))? #q + """, re.VERBOSE | re.IGNORECASE) + + def accept_encodings(self): + r = {} + ae = self.headers.get("Accept-Encoding", "") + for e in ae.split(","): + match = self.aepattern.match(e) + if match: + v = match.group(3) + v = float(v) if v else 1.0 + r[match.group(1)] = v + return r + + def is_rpc_path_valid(self): + if self.rpc_paths: + return self.path in self.rpc_paths + else: + # If .rpc_paths is empty, just assume all paths are legal + return True + + def do_POST(self): + """Handles the HTTP POST request. + + Attempts to interpret all HTTP POST requests as XML-RPC calls, + which are forwarded to the server's _dispatch method for handling. + """ + + # Check that the path is legal + if not self.is_rpc_path_valid(): + self.report_404() + return + + try: + # Get arguments by reading body of request. + # We read this in chunks to avoid straining + # socket.read(); around the 10 or 15Mb mark, some platforms + # begin to have problems (bug #792570). + max_chunk_size = 10*1024*1024 + size_remaining = int(self.headers["content-length"]) + L = [] + while size_remaining: + chunk_size = min(size_remaining, max_chunk_size) + chunk = self.rfile.read(chunk_size) + if not chunk: + break + L.append(chunk) + size_remaining -= len(L[-1]) + data = b''.join(L) + + data = self.decode_request_content(data) + if data is None: + return #response has been sent + + # In previous versions of SimpleXMLRPCServer, _dispatch + # could be overridden in this class, instead of in + # SimpleXMLRPCDispatcher. To maintain backwards compatibility, + # check to see if a subclass implements _dispatch and dispatch + # using that method if present. + response = self.server._marshaled_dispatch( + data, getattr(self, '_dispatch', None), self.path + ) + except Exception as e: # This should only happen if the module is buggy + # internal error, report as HTTP server error + self.send_response(500) + + # Send information about the exception if requested + if hasattr(self.server, '_send_traceback_header') and \ + self.server._send_traceback_header: + self.send_header("X-exception", str(e)) + trace = traceback.format_exc() + trace = str(trace.encode('ASCII', 'backslashreplace'), 'ASCII') + self.send_header("X-traceback", trace) + + self.send_header("Content-length", "0") + self.end_headers() + else: + self.send_response(200) + self.send_header("Content-type", "text/xml") + if self.encode_threshold is not None: + if len(response) > self.encode_threshold: + q = self.accept_encodings().get("gzip", 0) + if q: + try: + response = gzip_encode(response) + self.send_header("Content-Encoding", "gzip") + except NotImplementedError: + pass + self.send_header("Content-length", str(len(response))) + self.end_headers() + self.wfile.write(response) + + def decode_request_content(self, data): + #support gzip encoding of request + encoding = self.headers.get("content-encoding", "identity").lower() + if encoding == "identity": + return data + if encoding == "gzip": + try: + return gzip_decode(data) + except NotImplementedError: + self.send_response(501, "encoding %r not supported" % encoding) + except ValueError: + self.send_response(400, "error decoding gzip content") + else: + self.send_response(501, "encoding %r not supported" % encoding) + self.send_header("Content-length", "0") + self.end_headers() + + def report_404 (self): + # Report a 404 error + self.send_response(404) + response = b'No such page' + self.send_header("Content-type", "text/plain") + self.send_header("Content-length", str(len(response))) + self.end_headers() + self.wfile.write(response) + + def log_request(self, code='-', size='-'): + """Selectively log an accepted request.""" + + if self.server.logRequests: + BaseHTTPRequestHandler.log_request(self, code, size) + +class SimpleXMLRPCServer(socketserver.TCPServer, + SimpleXMLRPCDispatcher): + """Simple XML-RPC server. + + Simple XML-RPC server that allows functions and a single instance + to be installed to handle requests. The default implementation + attempts to dispatch XML-RPC calls to the functions or instance + installed in the server. Override the _dispatch method inherited + from SimpleXMLRPCDispatcher to change this behavior. + """ + + allow_reuse_address = True + + # Warning: this is for debugging purposes only! Never set this to True in + # production code, as will be sending out sensitive information (exception + # and stack trace details) when exceptions are raised inside + # SimpleXMLRPCRequestHandler.do_POST + _send_traceback_header = False + + def __init__(self, addr, requestHandler=SimpleXMLRPCRequestHandler, + logRequests=True, allow_none=False, encoding=None, + bind_and_activate=True, use_builtin_types=False): + self.logRequests = logRequests + + SimpleXMLRPCDispatcher.__init__(self, allow_none, encoding, use_builtin_types) + socketserver.TCPServer.__init__(self, addr, requestHandler, bind_and_activate) + + +class MultiPathXMLRPCServer(SimpleXMLRPCServer): + """Multipath XML-RPC Server + This specialization of SimpleXMLRPCServer allows the user to create + multiple Dispatcher instances and assign them to different + HTTP request paths. This makes it possible to run two or more + 'virtual XML-RPC servers' at the same port. + Make sure that the requestHandler accepts the paths in question. + """ + def __init__(self, addr, requestHandler=SimpleXMLRPCRequestHandler, + logRequests=True, allow_none=False, encoding=None, + bind_and_activate=True, use_builtin_types=False): + + SimpleXMLRPCServer.__init__(self, addr, requestHandler, logRequests, allow_none, + encoding, bind_and_activate, use_builtin_types) + self.dispatchers = {} + self.allow_none = allow_none + self.encoding = encoding or 'utf-8' + + def add_dispatcher(self, path, dispatcher): + self.dispatchers[path] = dispatcher + return dispatcher + + def get_dispatcher(self, path): + return self.dispatchers[path] + + def _marshaled_dispatch(self, data, dispatch_method = None, path = None): + try: + response = self.dispatchers[path]._marshaled_dispatch( + data, dispatch_method, path) + except: + # report low level exception back to server + # (each dispatcher should have handled their own + # exceptions) + exc_type, exc_value = sys.exc_info()[:2] + try: + response = dumps( + Fault(1, "%s:%s" % (exc_type, exc_value)), + encoding=self.encoding, allow_none=self.allow_none) + response = response.encode(self.encoding, 'xmlcharrefreplace') + finally: + # Break reference cycle + exc_type = exc_value = None + return response + +class CGIXMLRPCRequestHandler(SimpleXMLRPCDispatcher): + """Simple handler for XML-RPC data passed through CGI.""" + + def __init__(self, allow_none=False, encoding=None, use_builtin_types=False): + SimpleXMLRPCDispatcher.__init__(self, allow_none, encoding, use_builtin_types) + + def handle_xmlrpc(self, request_text): + """Handle a single XML-RPC request""" + + response = self._marshaled_dispatch(request_text) + + print('Content-Type: text/xml') + print('Content-Length: %d' % len(response)) + print() + sys.stdout.flush() + sys.stdout.buffer.write(response) + sys.stdout.buffer.flush() + + def handle_get(self): + """Handle a single HTTP GET request. + + Default implementation indicates an error because + XML-RPC uses the POST method. + """ + + code = 400 + message, explain = BaseHTTPRequestHandler.responses[code] + + response = http.server.DEFAULT_ERROR_MESSAGE % \ + { + 'code' : code, + 'message' : message, + 'explain' : explain + } + response = response.encode('utf-8') + print('Status: %d %s' % (code, message)) + print('Content-Type: %s' % http.server.DEFAULT_ERROR_CONTENT_TYPE) + print('Content-Length: %d' % len(response)) + print() + sys.stdout.flush() + sys.stdout.buffer.write(response) + sys.stdout.buffer.flush() + + def handle_request(self, request_text=None): + """Handle a single XML-RPC request passed through a CGI post method. + + If no XML data is given then it is read from stdin. The resulting + XML-RPC response is printed to stdout along with the correct HTTP + headers. + """ + + if request_text is None and \ + os.environ.get('REQUEST_METHOD', None) == 'GET': + self.handle_get() + else: + # POST data is normally available through stdin + try: + length = int(os.environ.get('CONTENT_LENGTH', None)) + except (ValueError, TypeError): + length = -1 + if request_text is None: + request_text = sys.stdin.read(length) + + self.handle_xmlrpc(request_text) + + +# ----------------------------------------------------------------------------- +# Self documenting XML-RPC Server. + +class ServerHTMLDoc(pydoc.HTMLDoc): + """Class used to generate pydoc HTML document for a server""" + + def markup(self, text, escape=None, funcs={}, classes={}, methods={}): + """Mark up some plain text, given a context of symbols to look for. + Each context dictionary maps object names to anchor names.""" + escape = escape or self.escape + results = [] + here = 0 + + # XXX Note that this regular expression does not allow for the + # hyperlinking of arbitrary strings being used as method + # names. Only methods with names consisting of word characters + # and '.'s are hyperlinked. + pattern = re.compile(r'\b((http|https|ftp)://\S+[\w/]|' + r'RFC[- ]?(\d+)|' + r'PEP[- ]?(\d+)|' + r'(self\.)?((?:\w|\.)+))\b') + while 1: + match = pattern.search(text, here) + if not match: break + start, end = match.span() + results.append(escape(text[here:start])) + + all, scheme, rfc, pep, selfdot, name = match.groups() + if scheme: + url = escape(all).replace('"', '"') + results.append('%s' % (url, url)) + elif rfc: + url = 'http://www.rfc-editor.org/rfc/rfc%d.txt' % int(rfc) + results.append('%s' % (url, escape(all))) + elif pep: + url = 'https://www.python.org/dev/peps/pep-%04d/' % int(pep) + results.append('%s' % (url, escape(all))) + elif text[end:end+1] == '(': + results.append(self.namelink(name, methods, funcs, classes)) + elif selfdot: + results.append('self.%s' % name) + else: + results.append(self.namelink(name, classes)) + here = end + results.append(escape(text[here:])) + return ''.join(results) + + def docroutine(self, object, name, mod=None, + funcs={}, classes={}, methods={}, cl=None): + """Produce HTML documentation for a function or method object.""" + + anchor = (cl and cl.__name__ or '') + '-' + name + note = '' + + title = '%s' % ( + self.escape(anchor), self.escape(name)) + + if callable(object): + argspec = str(signature(object)) + else: + argspec = '(...)' + + if isinstance(object, tuple): + argspec = object[0] or argspec + docstring = object[1] or "" + else: + docstring = pydoc.getdoc(object) + + decl = title + argspec + (note and self.grey( + '%s' % note)) + + doc = self.markup( + docstring, self.preformat, funcs, classes, methods) + doc = doc and '

    %s
    ' % doc + return '
    %s
    %s
    \n' % (decl, doc) + + def docserver(self, server_name, package_documentation, methods): + """Produce HTML documentation for an XML-RPC server.""" + + fdict = {} + for key, value in methods.items(): + fdict[key] = '#-' + key + fdict[value] = fdict[key] + + server_name = self.escape(server_name) + head = '%s' % server_name + result = self.heading(head, '#ffffff', '#7799ee') + + doc = self.markup(package_documentation, self.preformat, fdict) + doc = doc and '%s' % doc + result = result + '

    %s

    \n' % doc + + contents = [] + method_items = sorted(methods.items()) + for key, value in method_items: + contents.append(self.docroutine(value, key, funcs=fdict)) + result = result + self.bigsection( + 'Methods', '#ffffff', '#eeaa77', ''.join(contents)) + + return result + +class XMLRPCDocGenerator: + """Generates documentation for an XML-RPC server. + + This class is designed as mix-in and should not + be constructed directly. + """ + + def __init__(self): + # setup variables used for HTML documentation + self.server_name = 'XML-RPC Server Documentation' + self.server_documentation = \ + "This server exports the following methods through the XML-RPC "\ + "protocol." + self.server_title = 'XML-RPC Server Documentation' + + def set_server_title(self, server_title): + """Set the HTML title of the generated server documentation""" + + self.server_title = server_title + + def set_server_name(self, server_name): + """Set the name of the generated HTML server documentation""" + + self.server_name = server_name + + def set_server_documentation(self, server_documentation): + """Set the documentation string for the entire server.""" + + self.server_documentation = server_documentation + + def generate_html_documentation(self): + """generate_html_documentation() => html documentation for the server + + Generates HTML documentation for the server using introspection for + installed functions and instances that do not implement the + _dispatch method. Alternatively, instances can choose to implement + the _get_method_argstring(method_name) method to provide the + argument string used in the documentation and the + _methodHelp(method_name) method to provide the help text used + in the documentation.""" + + methods = {} + + for method_name in self.system_listMethods(): + if method_name in self.funcs: + method = self.funcs[method_name] + elif self.instance is not None: + method_info = [None, None] # argspec, documentation + if hasattr(self.instance, '_get_method_argstring'): + method_info[0] = self.instance._get_method_argstring(method_name) + if hasattr(self.instance, '_methodHelp'): + method_info[1] = self.instance._methodHelp(method_name) + + method_info = tuple(method_info) + if method_info != (None, None): + method = method_info + elif not hasattr(self.instance, '_dispatch'): + try: + method = resolve_dotted_attribute( + self.instance, + method_name + ) + except AttributeError: + method = method_info + else: + method = method_info + else: + assert 0, "Could not find method in self.functions and no "\ + "instance installed" + + methods[method_name] = method + + documenter = ServerHTMLDoc() + documentation = documenter.docserver( + self.server_name, + self.server_documentation, + methods + ) + + return documenter.page(html.escape(self.server_title), documentation) + +class DocXMLRPCRequestHandler(SimpleXMLRPCRequestHandler): + """XML-RPC and documentation request handler class. + + Handles all HTTP POST requests and attempts to decode them as + XML-RPC requests. + + Handles all HTTP GET requests and interprets them as requests + for documentation. + """ + + def do_GET(self): + """Handles the HTTP GET request. + + Interpret all HTTP GET requests as requests for server + documentation. + """ + # Check that the path is legal + if not self.is_rpc_path_valid(): + self.report_404() + return + + response = self.server.generate_html_documentation().encode('utf-8') + self.send_response(200) + self.send_header("Content-type", "text/html") + self.send_header("Content-length", str(len(response))) + self.end_headers() + self.wfile.write(response) + +class DocXMLRPCServer( SimpleXMLRPCServer, + XMLRPCDocGenerator): + """XML-RPC and HTML documentation server. + + Adds the ability to serve server documentation to the capabilities + of SimpleXMLRPCServer. + """ + + def __init__(self, addr, requestHandler=DocXMLRPCRequestHandler, + logRequests=True, allow_none=False, encoding=None, + bind_and_activate=True, use_builtin_types=False): + SimpleXMLRPCServer.__init__(self, addr, requestHandler, logRequests, + allow_none, encoding, bind_and_activate, + use_builtin_types) + XMLRPCDocGenerator.__init__(self) + +class DocCGIXMLRPCRequestHandler( CGIXMLRPCRequestHandler, + XMLRPCDocGenerator): + """Handler for XML-RPC data and documentation requests passed through + CGI""" + + def handle_get(self): + """Handles the HTTP GET request. + + Interpret all HTTP GET requests as requests for server + documentation. + """ + + response = self.generate_html_documentation().encode('utf-8') + + print('Content-Type: text/html') + print('Content-Length: %d' % len(response)) + print() + sys.stdout.flush() + sys.stdout.buffer.write(response) + sys.stdout.buffer.flush() + + def __init__(self): + CGIXMLRPCRequestHandler.__init__(self) + XMLRPCDocGenerator.__init__(self) + + +if __name__ == '__main__': + import datetime + + class ExampleService: + def getData(self): + return '42' + + class currentTime: + @staticmethod + def getCurrentTime(): + return datetime.datetime.now() + + with SimpleXMLRPCServer(("localhost", 8000)) as server: + server.register_function(pow) + server.register_function(lambda x,y: x+y, 'add') + server.register_instance(ExampleService(), allow_dotted_names=True) + server.register_multicall_functions() + print('Serving XML-RPC on localhost port 8000') + print('It is advisable to run this example server within a secure, closed network.') + try: + server.serve_forever() + except KeyboardInterrupt: + print("\nKeyboard interrupt received, exiting.") + sys.exit(0) diff --git a/miniconda3/envs/active_proaction/lib/python3.10/zoneinfo/__init__.py b/miniconda3/envs/active_proaction/lib/python3.10/zoneinfo/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..f5510ee049751345ef4788401ca427549be3aab5 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/zoneinfo/__init__.py @@ -0,0 +1,31 @@ +__all__ = [ + "ZoneInfo", + "reset_tzpath", + "available_timezones", + "TZPATH", + "ZoneInfoNotFoundError", + "InvalidTZPathWarning", +] + +from . import _tzpath +from ._common import ZoneInfoNotFoundError + +try: + from _zoneinfo import ZoneInfo +except ImportError: # pragma: nocover + from ._zoneinfo import ZoneInfo + +reset_tzpath = _tzpath.reset_tzpath +available_timezones = _tzpath.available_timezones +InvalidTZPathWarning = _tzpath.InvalidTZPathWarning + + +def __getattr__(name): + if name == "TZPATH": + return _tzpath.TZPATH + else: + raise AttributeError(f"module {__name__!r} has no attribute {name!r}") + + +def __dir__(): + return sorted(list(globals()) + ["TZPATH"]) diff --git a/miniconda3/envs/active_proaction/lib/python3.10/zoneinfo/_common.py b/miniconda3/envs/active_proaction/lib/python3.10/zoneinfo/_common.py new file mode 100644 index 0000000000000000000000000000000000000000..4c24f01bd7b270eac5579680bee572c7b7ef0e88 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/zoneinfo/_common.py @@ -0,0 +1,164 @@ +import struct + + +def load_tzdata(key): + import importlib.resources + + components = key.split("/") + package_name = ".".join(["tzdata.zoneinfo"] + components[:-1]) + resource_name = components[-1] + + try: + return importlib.resources.open_binary(package_name, resource_name) + except (ImportError, FileNotFoundError, UnicodeEncodeError): + # There are three types of exception that can be raised that all amount + # to "we cannot find this key": + # + # ImportError: If package_name doesn't exist (e.g. if tzdata is not + # installed, or if there's an error in the folder name like + # Amrica/New_York) + # FileNotFoundError: If resource_name doesn't exist in the package + # (e.g. Europe/Krasnoy) + # UnicodeEncodeError: If package_name or resource_name are not UTF-8, + # such as keys containing a surrogate character. + raise ZoneInfoNotFoundError(f"No time zone found with key {key}") + + +def load_data(fobj): + header = _TZifHeader.from_file(fobj) + + if header.version == 1: + time_size = 4 + time_type = "l" + else: + # Version 2+ has 64-bit integer transition times + time_size = 8 + time_type = "q" + + # Version 2+ also starts with a Version 1 header and data, which + # we need to skip now + skip_bytes = ( + header.timecnt * 5 # Transition times and types + + header.typecnt * 6 # Local time type records + + header.charcnt # Time zone designations + + header.leapcnt * 8 # Leap second records + + header.isstdcnt # Standard/wall indicators + + header.isutcnt # UT/local indicators + ) + + fobj.seek(skip_bytes, 1) + + # Now we need to read the second header, which is not the same + # as the first + header = _TZifHeader.from_file(fobj) + + typecnt = header.typecnt + timecnt = header.timecnt + charcnt = header.charcnt + + # The data portion starts with timecnt transitions and indices + if timecnt: + trans_list_utc = struct.unpack( + f">{timecnt}{time_type}", fobj.read(timecnt * time_size) + ) + trans_idx = struct.unpack(f">{timecnt}B", fobj.read(timecnt)) + else: + trans_list_utc = () + trans_idx = () + + # Read the ttinfo struct, (utoff, isdst, abbrind) + if typecnt: + utcoff, isdst, abbrind = zip( + *(struct.unpack(">lbb", fobj.read(6)) for i in range(typecnt)) + ) + else: + utcoff = () + isdst = () + abbrind = () + + # Now read the abbreviations. They are null-terminated strings, indexed + # not by position in the array but by position in the unsplit + # abbreviation string. I suppose this makes more sense in C, which uses + # null to terminate the strings, but it's inconvenient here... + abbr_vals = {} + abbr_chars = fobj.read(charcnt) + + def get_abbr(idx): + # Gets a string starting at idx and running until the next \x00 + # + # We cannot pre-populate abbr_vals by splitting on \x00 because there + # are some zones that use subsets of longer abbreviations, like so: + # + # LMT\x00AHST\x00HDT\x00 + # + # Where the idx to abbr mapping should be: + # + # {0: "LMT", 4: "AHST", 5: "HST", 9: "HDT"} + if idx not in abbr_vals: + span_end = abbr_chars.find(b"\x00", idx) + abbr_vals[idx] = abbr_chars[idx:span_end].decode() + + return abbr_vals[idx] + + abbr = tuple(get_abbr(idx) for idx in abbrind) + + # The remainder of the file consists of leap seconds (currently unused) and + # the standard/wall and ut/local indicators, which are metadata we don't need. + # In version 2 files, we need to skip the unnecessary data to get at the TZ string: + if header.version >= 2: + # Each leap second record has size (time_size + 4) + skip_bytes = header.isutcnt + header.isstdcnt + header.leapcnt * 12 + fobj.seek(skip_bytes, 1) + + c = fobj.read(1) # Should be \n + assert c == b"\n", c + + tz_bytes = b"" + while (c := fobj.read(1)) != b"\n": + tz_bytes += c + + tz_str = tz_bytes + else: + tz_str = None + + return trans_idx, trans_list_utc, utcoff, isdst, abbr, tz_str + + +class _TZifHeader: + __slots__ = [ + "version", + "isutcnt", + "isstdcnt", + "leapcnt", + "timecnt", + "typecnt", + "charcnt", + ] + + def __init__(self, *args): + for attr, val in zip(self.__slots__, args, strict=True): + setattr(self, attr, val) + + @classmethod + def from_file(cls, stream): + # The header starts with a 4-byte "magic" value + if stream.read(4) != b"TZif": + raise ValueError("Invalid TZif file: magic not found") + + _version = stream.read(1) + if _version == b"\x00": + version = 1 + else: + version = int(_version) + stream.read(15) + + args = (version,) + + # Slots are defined in the order that the bytes are arranged + args = args + struct.unpack(">6l", stream.read(24)) + + return cls(*args) + + +class ZoneInfoNotFoundError(KeyError): + """Exception raised when a ZoneInfo key is not found.""" diff --git a/miniconda3/envs/active_proaction/lib/python3.10/zoneinfo/_tzpath.py b/miniconda3/envs/active_proaction/lib/python3.10/zoneinfo/_tzpath.py new file mode 100644 index 0000000000000000000000000000000000000000..672560b9514429e18598cdada8e1a086c6b29cef --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/zoneinfo/_tzpath.py @@ -0,0 +1,175 @@ +import os +import sysconfig + + +def reset_tzpath(to=None): + global TZPATH + + tzpaths = to + if tzpaths is not None: + if isinstance(tzpaths, (str, bytes)): + raise TypeError( + f"tzpaths must be a list or tuple, " + + f"not {type(tzpaths)}: {tzpaths!r}" + ) + + if not all(map(os.path.isabs, tzpaths)): + raise ValueError(_get_invalid_paths_message(tzpaths)) + base_tzpath = tzpaths + else: + env_var = os.environ.get("PYTHONTZPATH", None) + if env_var is not None: + base_tzpath = _parse_python_tzpath(env_var) + else: + base_tzpath = _parse_python_tzpath( + sysconfig.get_config_var("TZPATH") + ) + + TZPATH = tuple(base_tzpath) + + +def _parse_python_tzpath(env_var): + if not env_var: + return () + + raw_tzpath = env_var.split(os.pathsep) + new_tzpath = tuple(filter(os.path.isabs, raw_tzpath)) + + # If anything has been filtered out, we will warn about it + if len(new_tzpath) != len(raw_tzpath): + import warnings + + msg = _get_invalid_paths_message(raw_tzpath) + + warnings.warn( + "Invalid paths specified in PYTHONTZPATH environment variable. " + + msg, + InvalidTZPathWarning, + ) + + return new_tzpath + + +def _get_invalid_paths_message(tzpaths): + invalid_paths = (path for path in tzpaths if not os.path.isabs(path)) + + prefix = "\n " + indented_str = prefix + prefix.join(invalid_paths) + + return ( + "Paths should be absolute but found the following relative paths:" + + indented_str + ) + + +def find_tzfile(key): + """Retrieve the path to a TZif file from a key.""" + _validate_tzfile_path(key) + for search_path in TZPATH: + filepath = os.path.join(search_path, key) + if os.path.isfile(filepath): + return filepath + + return None + + +_TEST_PATH = os.path.normpath(os.path.join("_", "_"))[:-1] + + +def _validate_tzfile_path(path, _base=_TEST_PATH): + if os.path.isabs(path): + raise ValueError( + f"ZoneInfo keys may not be absolute paths, got: {path}" + ) + + # We only care about the kinds of path normalizations that would change the + # length of the key - e.g. a/../b -> a/b, or a/b/ -> a/b. On Windows, + # normpath will also change from a/b to a\b, but that would still preserve + # the length. + new_path = os.path.normpath(path) + if len(new_path) != len(path): + raise ValueError( + f"ZoneInfo keys must be normalized relative paths, got: {path}" + ) + + resolved = os.path.normpath(os.path.join(_base, new_path)) + if not resolved.startswith(_base): + raise ValueError( + f"ZoneInfo keys must refer to subdirectories of TZPATH, got: {path}" + ) + + +del _TEST_PATH + + +def available_timezones(): + """Returns a set containing all available time zones. + + .. caution:: + + This may attempt to open a large number of files, since the best way to + determine if a given file on the time zone search path is to open it + and check for the "magic string" at the beginning. + """ + from importlib import resources + + valid_zones = set() + + # Start with loading from the tzdata package if it exists: this has a + # pre-assembled list of zones that only requires opening one file. + try: + with resources.open_text("tzdata", "zones") as f: + for zone in f: + zone = zone.strip() + if zone: + valid_zones.add(zone) + except (ImportError, FileNotFoundError): + pass + + def valid_key(fpath): + try: + with open(fpath, "rb") as f: + return f.read(4) == b"TZif" + except Exception: # pragma: nocover + return False + + for tz_root in TZPATH: + if not os.path.exists(tz_root): + continue + + for root, dirnames, files in os.walk(tz_root): + if root == tz_root: + # right/ and posix/ are special directories and shouldn't be + # included in the output of available zones + if "right" in dirnames: + dirnames.remove("right") + if "posix" in dirnames: + dirnames.remove("posix") + + for file in files: + fpath = os.path.join(root, file) + + key = os.path.relpath(fpath, start=tz_root) + if os.sep != "/": # pragma: nocover + key = key.replace(os.sep, "/") + + if not key or key in valid_zones: + continue + + if valid_key(fpath): + valid_zones.add(key) + + if "posixrules" in valid_zones: + # posixrules is a special symlink-only time zone where it exists, it + # should not be included in the output + valid_zones.remove("posixrules") + + return valid_zones + + +class InvalidTZPathWarning(RuntimeWarning): + """Warning raised if an invalid path is specified in PYTHONTZPATH.""" + + +TZPATH = () +reset_tzpath() diff --git a/miniconda3/envs/active_proaction/lib/python3.10/zoneinfo/_zoneinfo.py b/miniconda3/envs/active_proaction/lib/python3.10/zoneinfo/_zoneinfo.py new file mode 100644 index 0000000000000000000000000000000000000000..eede15b8271058a25500dcf6df26486caa554e44 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/python3.10/zoneinfo/_zoneinfo.py @@ -0,0 +1,752 @@ +import bisect +import calendar +import collections +import functools +import re +import weakref +from datetime import datetime, timedelta, tzinfo + +from . import _common, _tzpath + +EPOCH = datetime(1970, 1, 1) +EPOCHORDINAL = datetime(1970, 1, 1).toordinal() + +# It is relatively expensive to construct new timedelta objects, and in most +# cases we're looking at the same deltas, like integer numbers of hours, etc. +# To improve speed and memory use, we'll keep a dictionary with references +# to the ones we've already used so far. +# +# Loading every time zone in the 2020a version of the time zone database +# requires 447 timedeltas, which requires approximately the amount of space +# that ZoneInfo("America/New_York") with 236 transitions takes up, so we will +# set the cache size to 512 so that in the common case we always get cache +# hits, but specifically crafted ZoneInfo objects don't leak arbitrary amounts +# of memory. +@functools.lru_cache(maxsize=512) +def _load_timedelta(seconds): + return timedelta(seconds=seconds) + + +class ZoneInfo(tzinfo): + _strong_cache_size = 8 + _strong_cache = collections.OrderedDict() + _weak_cache = weakref.WeakValueDictionary() + __module__ = "zoneinfo" + + def __init_subclass__(cls): + cls._strong_cache = collections.OrderedDict() + cls._weak_cache = weakref.WeakValueDictionary() + + def __new__(cls, key): + instance = cls._weak_cache.get(key, None) + if instance is None: + instance = cls._weak_cache.setdefault(key, cls._new_instance(key)) + instance._from_cache = True + + # Update the "strong" cache + cls._strong_cache[key] = cls._strong_cache.pop(key, instance) + + if len(cls._strong_cache) > cls._strong_cache_size: + cls._strong_cache.popitem(last=False) + + return instance + + @classmethod + def no_cache(cls, key): + obj = cls._new_instance(key) + obj._from_cache = False + + return obj + + @classmethod + def _new_instance(cls, key): + obj = super().__new__(cls) + obj._key = key + obj._file_path = obj._find_tzfile(key) + + if obj._file_path is not None: + file_obj = open(obj._file_path, "rb") + else: + file_obj = _common.load_tzdata(key) + + with file_obj as f: + obj._load_file(f) + + return obj + + @classmethod + def from_file(cls, fobj, /, key=None): + obj = super().__new__(cls) + obj._key = key + obj._file_path = None + obj._load_file(fobj) + obj._file_repr = repr(fobj) + + # Disable pickling for objects created from files + obj.__reduce__ = obj._file_reduce + + return obj + + @classmethod + def clear_cache(cls, *, only_keys=None): + if only_keys is not None: + for key in only_keys: + cls._weak_cache.pop(key, None) + cls._strong_cache.pop(key, None) + + else: + cls._weak_cache.clear() + cls._strong_cache.clear() + + @property + def key(self): + return self._key + + def utcoffset(self, dt): + return self._find_trans(dt).utcoff + + def dst(self, dt): + return self._find_trans(dt).dstoff + + def tzname(self, dt): + return self._find_trans(dt).tzname + + def fromutc(self, dt): + """Convert from datetime in UTC to datetime in local time""" + + if not isinstance(dt, datetime): + raise TypeError("fromutc() requires a datetime argument") + if dt.tzinfo is not self: + raise ValueError("dt.tzinfo is not self") + + timestamp = self._get_local_timestamp(dt) + num_trans = len(self._trans_utc) + + if num_trans >= 1 and timestamp < self._trans_utc[0]: + tti = self._tti_before + fold = 0 + elif ( + num_trans == 0 or timestamp > self._trans_utc[-1] + ) and not isinstance(self._tz_after, _ttinfo): + tti, fold = self._tz_after.get_trans_info_fromutc( + timestamp, dt.year + ) + elif num_trans == 0: + tti = self._tz_after + fold = 0 + else: + idx = bisect.bisect_right(self._trans_utc, timestamp) + + if num_trans > 1 and timestamp >= self._trans_utc[1]: + tti_prev, tti = self._ttinfos[idx - 2 : idx] + elif timestamp > self._trans_utc[-1]: + tti_prev = self._ttinfos[-1] + tti = self._tz_after + else: + tti_prev = self._tti_before + tti = self._ttinfos[0] + + # Detect fold + shift = tti_prev.utcoff - tti.utcoff + fold = shift.total_seconds() > timestamp - self._trans_utc[idx - 1] + dt += tti.utcoff + if fold: + return dt.replace(fold=1) + else: + return dt + + def _find_trans(self, dt): + if dt is None: + if self._fixed_offset: + return self._tz_after + else: + return _NO_TTINFO + + ts = self._get_local_timestamp(dt) + + lt = self._trans_local[dt.fold] + + num_trans = len(lt) + + if num_trans and ts < lt[0]: + return self._tti_before + elif not num_trans or ts > lt[-1]: + if isinstance(self._tz_after, _TZStr): + return self._tz_after.get_trans_info(ts, dt.year, dt.fold) + else: + return self._tz_after + else: + # idx is the transition that occurs after this timestamp, so we + # subtract off 1 to get the current ttinfo + idx = bisect.bisect_right(lt, ts) - 1 + assert idx >= 0 + return self._ttinfos[idx] + + def _get_local_timestamp(self, dt): + return ( + (dt.toordinal() - EPOCHORDINAL) * 86400 + + dt.hour * 3600 + + dt.minute * 60 + + dt.second + ) + + def __str__(self): + if self._key is not None: + return f"{self._key}" + else: + return repr(self) + + def __repr__(self): + if self._key is not None: + return f"{self.__class__.__name__}(key={self._key!r})" + else: + return f"{self.__class__.__name__}.from_file({self._file_repr})" + + def __reduce__(self): + return (self.__class__._unpickle, (self._key, self._from_cache)) + + def _file_reduce(self): + import pickle + + raise pickle.PicklingError( + "Cannot pickle a ZoneInfo file created from a file stream." + ) + + @classmethod + def _unpickle(cls, key, from_cache, /): + if from_cache: + return cls(key) + else: + return cls.no_cache(key) + + def _find_tzfile(self, key): + return _tzpath.find_tzfile(key) + + def _load_file(self, fobj): + # Retrieve all the data as it exists in the zoneinfo file + trans_idx, trans_utc, utcoff, isdst, abbr, tz_str = _common.load_data( + fobj + ) + + # Infer the DST offsets (needed for .dst()) from the data + dstoff = self._utcoff_to_dstoff(trans_idx, utcoff, isdst) + + # Convert all the transition times (UTC) into "seconds since 1970-01-01 local time" + trans_local = self._ts_to_local(trans_idx, trans_utc, utcoff) + + # Construct `_ttinfo` objects for each transition in the file + _ttinfo_list = [ + _ttinfo( + _load_timedelta(utcoffset), _load_timedelta(dstoffset), tzname + ) + for utcoffset, dstoffset, tzname in zip(utcoff, dstoff, abbr) + ] + + self._trans_utc = trans_utc + self._trans_local = trans_local + self._ttinfos = [_ttinfo_list[idx] for idx in trans_idx] + + # Find the first non-DST transition + for i in range(len(isdst)): + if not isdst[i]: + self._tti_before = _ttinfo_list[i] + break + else: + if self._ttinfos: + self._tti_before = self._ttinfos[0] + else: + self._tti_before = None + + # Set the "fallback" time zone + if tz_str is not None and tz_str != b"": + self._tz_after = _parse_tz_str(tz_str.decode()) + else: + if not self._ttinfos and not _ttinfo_list: + raise ValueError("No time zone information found.") + + if self._ttinfos: + self._tz_after = self._ttinfos[-1] + else: + self._tz_after = _ttinfo_list[-1] + + # Determine if this is a "fixed offset" zone, meaning that the output + # of the utcoffset, dst and tzname functions does not depend on the + # specific datetime passed. + # + # We make three simplifying assumptions here: + # + # 1. If _tz_after is not a _ttinfo, it has transitions that might + # actually occur (it is possible to construct TZ strings that + # specify STD and DST but no transitions ever occur, such as + # AAA0BBB,0/0,J365/25). + # 2. If _ttinfo_list contains more than one _ttinfo object, the objects + # represent different offsets. + # 3. _ttinfo_list contains no unused _ttinfos (in which case an + # otherwise fixed-offset zone with extra _ttinfos defined may + # appear to *not* be a fixed offset zone). + # + # Violations to these assumptions would be fairly exotic, and exotic + # zones should almost certainly not be used with datetime.time (the + # only thing that would be affected by this). + if len(_ttinfo_list) > 1 or not isinstance(self._tz_after, _ttinfo): + self._fixed_offset = False + elif not _ttinfo_list: + self._fixed_offset = True + else: + self._fixed_offset = _ttinfo_list[0] == self._tz_after + + @staticmethod + def _utcoff_to_dstoff(trans_idx, utcoffsets, isdsts): + # Now we must transform our ttis and abbrs into `_ttinfo` objects, + # but there is an issue: .dst() must return a timedelta with the + # difference between utcoffset() and the "standard" offset, but + # the "base offset" and "DST offset" are not encoded in the file; + # we can infer what they are from the isdst flag, but it is not + # sufficient to just look at the last standard offset, because + # occasionally countries will shift both DST offset and base offset. + + typecnt = len(isdsts) + dstoffs = [0] * typecnt # Provisionally assign all to 0. + dst_cnt = sum(isdsts) + dst_found = 0 + + for i in range(1, len(trans_idx)): + if dst_cnt == dst_found: + break + + idx = trans_idx[i] + + dst = isdsts[idx] + + # We're only going to look at daylight saving time + if not dst: + continue + + # Skip any offsets that have already been assigned + if dstoffs[idx] != 0: + continue + + dstoff = 0 + utcoff = utcoffsets[idx] + + comp_idx = trans_idx[i - 1] + + if not isdsts[comp_idx]: + dstoff = utcoff - utcoffsets[comp_idx] + + if not dstoff and idx < (typecnt - 1): + comp_idx = trans_idx[i + 1] + + # If the following transition is also DST and we couldn't + # find the DST offset by this point, we're going to have to + # skip it and hope this transition gets assigned later + if isdsts[comp_idx]: + continue + + dstoff = utcoff - utcoffsets[comp_idx] + + if dstoff: + dst_found += 1 + dstoffs[idx] = dstoff + else: + # If we didn't find a valid value for a given index, we'll end up + # with dstoff = 0 for something where `isdst=1`. This is obviously + # wrong - one hour will be a much better guess than 0 + for idx in range(typecnt): + if not dstoffs[idx] and isdsts[idx]: + dstoffs[idx] = 3600 + + return dstoffs + + @staticmethod + def _ts_to_local(trans_idx, trans_list_utc, utcoffsets): + """Generate number of seconds since 1970 *in the local time*. + + This is necessary to easily find the transition times in local time""" + if not trans_list_utc: + return [[], []] + + # Start with the timestamps and modify in-place + trans_list_wall = [list(trans_list_utc), list(trans_list_utc)] + + if len(utcoffsets) > 1: + offset_0 = utcoffsets[0] + offset_1 = utcoffsets[trans_idx[0]] + if offset_1 > offset_0: + offset_1, offset_0 = offset_0, offset_1 + else: + offset_0 = offset_1 = utcoffsets[0] + + trans_list_wall[0][0] += offset_0 + trans_list_wall[1][0] += offset_1 + + for i in range(1, len(trans_idx)): + offset_0 = utcoffsets[trans_idx[i - 1]] + offset_1 = utcoffsets[trans_idx[i]] + + if offset_1 > offset_0: + offset_1, offset_0 = offset_0, offset_1 + + trans_list_wall[0][i] += offset_0 + trans_list_wall[1][i] += offset_1 + + return trans_list_wall + + +class _ttinfo: + __slots__ = ["utcoff", "dstoff", "tzname"] + + def __init__(self, utcoff, dstoff, tzname): + self.utcoff = utcoff + self.dstoff = dstoff + self.tzname = tzname + + def __eq__(self, other): + return ( + self.utcoff == other.utcoff + and self.dstoff == other.dstoff + and self.tzname == other.tzname + ) + + def __repr__(self): # pragma: nocover + return ( + f"{self.__class__.__name__}" + + f"({self.utcoff}, {self.dstoff}, {self.tzname})" + ) + + +_NO_TTINFO = _ttinfo(None, None, None) + + +class _TZStr: + __slots__ = ( + "std", + "dst", + "start", + "end", + "get_trans_info", + "get_trans_info_fromutc", + "dst_diff", + ) + + def __init__( + self, std_abbr, std_offset, dst_abbr, dst_offset, start=None, end=None + ): + self.dst_diff = dst_offset - std_offset + std_offset = _load_timedelta(std_offset) + self.std = _ttinfo( + utcoff=std_offset, dstoff=_load_timedelta(0), tzname=std_abbr + ) + + self.start = start + self.end = end + + dst_offset = _load_timedelta(dst_offset) + delta = _load_timedelta(self.dst_diff) + self.dst = _ttinfo(utcoff=dst_offset, dstoff=delta, tzname=dst_abbr) + + # These are assertions because the constructor should only be called + # by functions that would fail before passing start or end + assert start is not None, "No transition start specified" + assert end is not None, "No transition end specified" + + self.get_trans_info = self._get_trans_info + self.get_trans_info_fromutc = self._get_trans_info_fromutc + + def transitions(self, year): + start = self.start.year_to_epoch(year) + end = self.end.year_to_epoch(year) + return start, end + + def _get_trans_info(self, ts, year, fold): + """Get the information about the current transition - tti""" + start, end = self.transitions(year) + + # With fold = 0, the period (denominated in local time) with the + # smaller offset starts at the end of the gap and ends at the end of + # the fold; with fold = 1, it runs from the start of the gap to the + # beginning of the fold. + # + # So in order to determine the DST boundaries we need to know both + # the fold and whether DST is positive or negative (rare), and it + # turns out that this boils down to fold XOR is_positive. + if fold == (self.dst_diff >= 0): + end -= self.dst_diff + else: + start += self.dst_diff + + if start < end: + isdst = start <= ts < end + else: + isdst = not (end <= ts < start) + + return self.dst if isdst else self.std + + def _get_trans_info_fromutc(self, ts, year): + start, end = self.transitions(year) + start -= self.std.utcoff.total_seconds() + end -= self.dst.utcoff.total_seconds() + + if start < end: + isdst = start <= ts < end + else: + isdst = not (end <= ts < start) + + # For positive DST, the ambiguous period is one dst_diff after the end + # of DST; for negative DST, the ambiguous period is one dst_diff before + # the start of DST. + if self.dst_diff > 0: + ambig_start = end + ambig_end = end + self.dst_diff + else: + ambig_start = start + ambig_end = start - self.dst_diff + + fold = ambig_start <= ts < ambig_end + + return (self.dst if isdst else self.std, fold) + + +def _post_epoch_days_before_year(year): + """Get the number of days between 1970-01-01 and YEAR-01-01""" + y = year - 1 + return y * 365 + y // 4 - y // 100 + y // 400 - EPOCHORDINAL + + +class _DayOffset: + __slots__ = ["d", "julian", "hour", "minute", "second"] + + def __init__(self, d, julian, hour=2, minute=0, second=0): + if not (0 + julian) <= d <= 365: + min_day = 0 + julian + raise ValueError(f"d must be in [{min_day}, 365], not: {d}") + + self.d = d + self.julian = julian + self.hour = hour + self.minute = minute + self.second = second + + def year_to_epoch(self, year): + days_before_year = _post_epoch_days_before_year(year) + + d = self.d + if self.julian and d >= 59 and calendar.isleap(year): + d += 1 + + epoch = (days_before_year + d) * 86400 + epoch += self.hour * 3600 + self.minute * 60 + self.second + + return epoch + + +class _CalendarOffset: + __slots__ = ["m", "w", "d", "hour", "minute", "second"] + + _DAYS_BEFORE_MONTH = ( + -1, + 0, + 31, + 59, + 90, + 120, + 151, + 181, + 212, + 243, + 273, + 304, + 334, + ) + + def __init__(self, m, w, d, hour=2, minute=0, second=0): + if not 0 < m <= 12: + raise ValueError("m must be in (0, 12]") + + if not 0 < w <= 5: + raise ValueError("w must be in (0, 5]") + + if not 0 <= d <= 6: + raise ValueError("d must be in [0, 6]") + + self.m = m + self.w = w + self.d = d + self.hour = hour + self.minute = minute + self.second = second + + @classmethod + def _ymd2ord(cls, year, month, day): + return ( + _post_epoch_days_before_year(year) + + cls._DAYS_BEFORE_MONTH[month] + + (month > 2 and calendar.isleap(year)) + + day + ) + + # TODO: These are not actually epoch dates as they are expressed in local time + def year_to_epoch(self, year): + """Calculates the datetime of the occurrence from the year""" + # We know year and month, we need to convert w, d into day of month + # + # Week 1 is the first week in which day `d` (where 0 = Sunday) appears. + # Week 5 represents the last occurrence of day `d`, so we need to know + # the range of the month. + first_day, days_in_month = calendar.monthrange(year, self.m) + + # This equation seems magical, so I'll break it down: + # 1. calendar says 0 = Monday, POSIX says 0 = Sunday + # so we need first_day + 1 to get 1 = Monday -> 7 = Sunday, + # which is still equivalent because this math is mod 7 + # 2. Get first day - desired day mod 7: -1 % 7 = 6, so we don't need + # to do anything to adjust negative numbers. + # 3. Add 1 because month days are a 1-based index. + month_day = (self.d - (first_day + 1)) % 7 + 1 + + # Now use a 0-based index version of `w` to calculate the w-th + # occurrence of `d` + month_day += (self.w - 1) * 7 + + # month_day will only be > days_in_month if w was 5, and `w` means + # "last occurrence of `d`", so now we just check if we over-shot the + # end of the month and if so knock off 1 week. + if month_day > days_in_month: + month_day -= 7 + + ordinal = self._ymd2ord(year, self.m, month_day) + epoch = ordinal * 86400 + epoch += self.hour * 3600 + self.minute * 60 + self.second + return epoch + + +def _parse_tz_str(tz_str): + # The tz string has the format: + # + # std[offset[dst[offset],start[/time],end[/time]]] + # + # std and dst must be 3 or more characters long and must not contain + # a leading colon, embedded digits, commas, nor a plus or minus signs; + # The spaces between "std" and "offset" are only for display and are + # not actually present in the string. + # + # The format of the offset is ``[+|-]hh[:mm[:ss]]`` + + offset_str, *start_end_str = tz_str.split(",", 1) + + # fmt: off + parser_re = re.compile( + r"(?P[^<0-9:.+-]+|<[a-zA-Z0-9+\-]+>)" + + r"((?P[+-]?\d{1,2}(:\d{2}(:\d{2})?)?)" + + r"((?P[^0-9:.+-]+|<[a-zA-Z0-9+\-]+>)" + + r"((?P[+-]?\d{1,2}(:\d{2}(:\d{2})?)?))?" + + r")?" + # dst + r")?$" # stdoff + ) + # fmt: on + + m = parser_re.match(offset_str) + + if m is None: + raise ValueError(f"{tz_str} is not a valid TZ string") + + std_abbr = m.group("std") + dst_abbr = m.group("dst") + dst_offset = None + + std_abbr = std_abbr.strip("<>") + + if dst_abbr: + dst_abbr = dst_abbr.strip("<>") + + if std_offset := m.group("stdoff"): + try: + std_offset = _parse_tz_delta(std_offset) + except ValueError as e: + raise ValueError(f"Invalid STD offset in {tz_str}") from e + else: + std_offset = 0 + + if dst_abbr is not None: + if dst_offset := m.group("dstoff"): + try: + dst_offset = _parse_tz_delta(dst_offset) + except ValueError as e: + raise ValueError(f"Invalid DST offset in {tz_str}") from e + else: + dst_offset = std_offset + 3600 + + if not start_end_str: + raise ValueError(f"Missing transition rules: {tz_str}") + + start_end_strs = start_end_str[0].split(",", 1) + try: + start, end = (_parse_dst_start_end(x) for x in start_end_strs) + except ValueError as e: + raise ValueError(f"Invalid TZ string: {tz_str}") from e + + return _TZStr(std_abbr, std_offset, dst_abbr, dst_offset, start, end) + elif start_end_str: + raise ValueError(f"Transition rule present without DST: {tz_str}") + else: + # This is a static ttinfo, don't return _TZStr + return _ttinfo( + _load_timedelta(std_offset), _load_timedelta(0), std_abbr + ) + + +def _parse_dst_start_end(dststr): + date, *time = dststr.split("/") + if date[0] == "M": + n_is_julian = False + m = re.match(r"M(\d{1,2})\.(\d).(\d)$", date) + if m is None: + raise ValueError(f"Invalid dst start/end date: {dststr}") + date_offset = tuple(map(int, m.groups())) + offset = _CalendarOffset(*date_offset) + else: + if date[0] == "J": + n_is_julian = True + date = date[1:] + else: + n_is_julian = False + + doy = int(date) + offset = _DayOffset(doy, n_is_julian) + + if time: + time_components = list(map(int, time[0].split(":"))) + n_components = len(time_components) + if n_components < 3: + time_components.extend([0] * (3 - n_components)) + offset.hour, offset.minute, offset.second = time_components + + return offset + + +def _parse_tz_delta(tz_delta): + match = re.match( + r"(?P[+-])?(?P\d{1,2})(:(?P\d{2})(:(?P\d{2}))?)?", + tz_delta, + ) + # Anything passed to this function should already have hit an equivalent + # regular expression to find the section to parse. + assert match is not None, tz_delta + + h, m, s = ( + int(v) if v is not None else 0 + for v in map(match.group, ("h", "m", "s")) + ) + + total = h * 3600 + m * 60 + s + + if not -86400 < total < 86400: + raise ValueError( + f"Offset must be strictly between -24h and +24h: {tz_delta}" + ) + + # Yes, +5 maps to an offset of -5h + if match.group("sign") != "-": + total *= -1 + + return total diff --git a/miniconda3/envs/active_proaction/lib/sqlite3.45.3/pkgIndex.tcl b/miniconda3/envs/active_proaction/lib/sqlite3.45.3/pkgIndex.tcl new file mode 100644 index 0000000000000000000000000000000000000000..b82b6f508ae8352947f64296111b04cc45f2f1eb --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/sqlite3.45.3/pkgIndex.tcl @@ -0,0 +1,12 @@ +# -*- tcl -*- +# Tcl package index file, version 1.1 +# +# Note sqlite*3* init specifically +# +if {[package vsatisfies [package provide Tcl] 9.0-]} { + package ifneeded sqlite3 3.45.3 \ + [list load [file join $dir libtcl9sqlite3.45.3.so] Sqlite3] +} else { + package ifneeded sqlite3 3.45.3 \ + [list load [file join $dir libsqlite3.45.3.so] Sqlite3] +} diff --git a/miniconda3/envs/active_proaction/lib/tcl8.6/auto.tcl b/miniconda3/envs/active_proaction/lib/tcl8.6/auto.tcl new file mode 100644 index 0000000000000000000000000000000000000000..bae44c392b2d7ad96878881328bfd58f7e0fc759 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/tcl8.6/auto.tcl @@ -0,0 +1,649 @@ +# auto.tcl -- +# +# utility procs formerly in init.tcl dealing with auto execution of commands +# and can be auto loaded themselves. +# +# Copyright (c) 1991-1993 The Regents of the University of California. +# Copyright (c) 1994-1998 Sun Microsystems, Inc. +# +# See the file "license.terms" for information on usage and redistribution of +# this file, and for a DISCLAIMER OF ALL WARRANTIES. +# + +# auto_reset -- +# +# Destroy all cached information for auto-loading and auto-execution, so that +# the information gets recomputed the next time it's needed. Also delete any +# commands that are listed in the auto-load index. +# +# Arguments: +# None. + +proc auto_reset {} { + global auto_execs auto_index auto_path + if {[array exists auto_index]} { + foreach cmdName [array names auto_index] { + set fqcn [namespace which $cmdName] + if {$fqcn eq ""} { + continue + } + rename $fqcn {} + } + } + unset -nocomplain auto_execs auto_index ::tcl::auto_oldpath + if {[catch {llength $auto_path}]} { + set auto_path [list [info library]] + } elseif {[info library] ni $auto_path} { + lappend auto_path [info library] + } +} + +# tcl_findLibrary -- +# +# This is a utility for extensions that searches for a library directory +# using a canonical searching algorithm. A side effect is to source the +# initialization script and set a global library variable. +# +# Arguments: +# basename Prefix of the directory name, (e.g., "tk") +# version Version number of the package, (e.g., "8.0") +# patch Patchlevel of the package, (e.g., "8.0.3") +# initScript Initialization script to source (e.g., tk.tcl) +# enVarName environment variable to honor (e.g., TK_LIBRARY) +# varName Global variable to set when done (e.g., tk_library) + +proc tcl_findLibrary {basename version patch initScript enVarName varName} { + upvar #0 $varName the_library + global auto_path env tcl_platform + + set dirs {} + set errors {} + + # The C application may have hardwired a path, which we honor + + if {[info exists the_library] && $the_library ne ""} { + lappend dirs $the_library + } else { + # Do the canonical search + + # 1. From an environment variable, if it exists. Placing this first + # gives the end-user ultimate control to work-around any bugs, or + # to customize. + + if {[info exists env($enVarName)]} { + lappend dirs $env($enVarName) + } + + # 2. In the package script directory registered within the + # configuration of the package itself. + + catch { + lappend dirs [::${basename}::pkgconfig get scriptdir,runtime] + } + + # 3. Relative to auto_path directories. This checks relative to the + # Tcl library as well as allowing loading of libraries added to the + # auto_path that is not relative to the core library or binary paths. + foreach d $auto_path { + lappend dirs [file join $d $basename$version] + if {$tcl_platform(platform) eq "unix" + && $tcl_platform(os) eq "Darwin"} { + # 4. On MacOSX, check the Resources/Scripts subdir too + lappend dirs [file join $d $basename$version Resources Scripts] + } + } + + # 3. Various locations relative to the executable + # ../lib/foo1.0 (From bin directory in install hierarchy) + # ../../lib/foo1.0 (From bin/arch directory in install hierarchy) + # ../library (From unix directory in build hierarchy) + # + # Remaining locations are out of date (when relevant, they ought to be + # covered by the $::auto_path seach above) and disabled. + # + # ../../library (From unix/arch directory in build hierarchy) + # ../../foo1.0.1/library + # (From unix directory in parallel build hierarchy) + # ../../../foo1.0.1/library + # (From unix/arch directory in parallel build hierarchy) + + set parentDir [file dirname [file dirname [info nameofexecutable]]] + set grandParentDir [file dirname $parentDir] + lappend dirs [file join $parentDir lib $basename$version] + lappend dirs [file join $grandParentDir lib $basename$version] + lappend dirs [file join $parentDir library] + if {0} { + lappend dirs [file join $grandParentDir library] + lappend dirs [file join $grandParentDir $basename$patch library] + lappend dirs [file join [file dirname $grandParentDir] \ + $basename$patch library] + } + } + # make $dirs unique, preserving order + array set seen {} + foreach i $dirs { + # Make sure $i is unique under normalization. Avoid repeated [source]. + if {[interp issafe]} { + # Safe interps have no [file normalize]. + set norm $i + } else { + set norm [file normalize $i] + } + if {[info exists seen($norm)]} { + continue + } + set seen($norm) {} + + set the_library $i + set file [file join $i $initScript] + + # source everything when in a safe interpreter because we have a + # source command, but no file exists command + + if {[interp issafe] || [file exists $file]} { + if {![catch {uplevel #0 [list source -encoding utf-8 $file]} msg opts]} { + return + } + append errors "$file: $msg\n" + append errors [dict get $opts -errorinfo]\n + } + } + unset -nocomplain the_library + set msg "Can't find a usable $initScript in the following directories: \n" + append msg " $dirs\n\n" + append msg "$errors\n\n" + append msg "This probably means that $basename wasn't installed properly.\n" + error $msg +} + + +# ---------------------------------------------------------------------- +# auto_mkindex +# ---------------------------------------------------------------------- +# The following procedures are used to generate the tclIndex file from Tcl +# source files. They use a special safe interpreter to parse Tcl source +# files, writing out index entries as "proc" commands are encountered. This +# implementation won't work in a safe interpreter, since a safe interpreter +# can't create the special parser and mess with its commands. + +if {[interp issafe]} { + return ;# Stop sourcing the file here +} + +# auto_mkindex -- +# Regenerate a tclIndex file from Tcl source files. Takes as argument the +# name of the directory in which the tclIndex file is to be placed, followed +# by any number of glob patterns to use in that directory to locate all of the +# relevant files. +# +# Arguments: +# dir - Name of the directory in which to create an index. + +# args - Any number of additional arguments giving the names of files +# within dir. If no additional are given auto_mkindex will look +# for *.tcl. + +proc auto_mkindex {dir args} { + if {[interp issafe]} { + error "can't generate index within safe interpreter" + } + + set oldDir [pwd] + cd $dir + + append index "# Tcl autoload index file, version 2.0\n" + append index "# This file is generated by the \"auto_mkindex\" command\n" + append index "# and sourced to set up indexing information for one or\n" + append index "# more commands. Typically each line is a command that\n" + append index "# sets an element in the auto_index array, where the\n" + append index "# element name is the name of a command and the value is\n" + append index "# a script that loads the command.\n\n" + if {![llength $args]} { + set args *.tcl + } + + auto_mkindex_parser::init + foreach file [lsort [glob -- {*}$args]] { + try { + append index [auto_mkindex_parser::mkindex $file] + } on error {msg opts} { + cd $oldDir + return -options $opts $msg + } + } + auto_mkindex_parser::cleanup + + set fid [open "tclIndex" w] + fconfigure $fid -encoding utf-8 + puts -nonewline $fid $index + close $fid + cd $oldDir +} + +# Original version of auto_mkindex that just searches the source code for +# "proc" at the beginning of the line. + +proc auto_mkindex_old {dir args} { + set oldDir [pwd] + cd $dir + set dir [pwd] + append index "# Tcl autoload index file, version 2.0\n" + append index "# This file is generated by the \"auto_mkindex\" command\n" + append index "# and sourced to set up indexing information for one or\n" + append index "# more commands. Typically each line is a command that\n" + append index "# sets an element in the auto_index array, where the\n" + append index "# element name is the name of a command and the value is\n" + append index "# a script that loads the command.\n\n" + if {![llength $args]} { + set args *.tcl + } + foreach file [lsort [glob -- {*}$args]] { + set f "" + set error [catch { + set f [open $file] + fconfigure $f -eofchar "\x1A {}" + while {[gets $f line] >= 0} { + if {[regexp {^proc[ ]+([^ ]*)} $line match procName]} { + set procName [lindex [auto_qualify $procName "::"] 0] + append index "set [list auto_index($procName)]" + append index " \[list source -encoding utf-8 \[file join \$dir [list $file]\]\]\n" + } + } + close $f + } msg opts] + if {$error} { + catch {close $f} + cd $oldDir + return -options $opts $msg + } + } + set f "" + set error [catch { + set f [open tclIndex w] + puts -nonewline $f $index + close $f + cd $oldDir + } msg opts] + if {$error} { + catch {close $f} + cd $oldDir + error $msg $info $code + return -options $opts $msg + } +} + +# Create a safe interpreter that can be used to parse Tcl source files +# generate a tclIndex file for autoloading. This interp contains commands for +# things that need index entries. Each time a command is executed, it writes +# an entry out to the index file. + +namespace eval auto_mkindex_parser { + variable parser "" ;# parser used to build index + variable index "" ;# maintains index as it is built + variable scriptFile "" ;# name of file being processed + variable contextStack "" ;# stack of namespace scopes + variable imports "" ;# keeps track of all imported cmds + variable initCommands ;# list of commands that create aliases + if {![info exists initCommands]} { + set initCommands [list] + } + + proc init {} { + variable parser + variable initCommands + + if {![interp issafe]} { + set parser [interp create -safe] + $parser hide info + $parser hide rename + $parser hide proc + $parser hide namespace + $parser hide eval + $parser hide puts + foreach ns [$parser invokehidden namespace children ::] { + # MUST NOT DELETE "::tcl" OR BAD THINGS HAPPEN! + if {$ns eq "::tcl"} continue + $parser invokehidden namespace delete $ns + } + foreach cmd [$parser invokehidden info commands ::*] { + $parser invokehidden rename $cmd {} + } + $parser invokehidden proc unknown {args} {} + + # We'll need access to the "namespace" command within the + # interp. Put it back, but move it out of the way. + + $parser expose namespace + $parser invokehidden rename namespace _%@namespace + $parser expose eval + $parser invokehidden rename eval _%@eval + + # Install all the registered pseudo-command implementations + + foreach cmd $initCommands { + eval $cmd + } + } + } + proc cleanup {} { + variable parser + interp delete $parser + unset parser + } +} + +# auto_mkindex_parser::mkindex -- +# +# Used by the "auto_mkindex" command to create a "tclIndex" file for the given +# Tcl source file. Executes the commands in the file, and handles things like +# the "proc" command by adding an entry for the index file. Returns a string +# that represents the index file. +# +# Arguments: +# file Name of Tcl source file to be indexed. + +proc auto_mkindex_parser::mkindex {file} { + variable parser + variable index + variable scriptFile + variable contextStack + variable imports + + set scriptFile $file + + set fid [open $file] + fconfigure $fid -eofchar "\x1A {}" + set contents [read $fid] + close $fid + + # There is one problem with sourcing files into the safe interpreter: + # references like "$x" will fail since code is not really being executed + # and variables do not really exist. To avoid this, we replace all $ with + # \0 (literally, the null char) later, when getting proc names we will + # have to reverse this replacement, in case there were any $ in the proc + # name. This will cause a problem if somebody actually tries to have a \0 + # in their proc name. Too bad for them. + set contents [string map [list \$ \0] $contents] + + set index "" + set contextStack "" + set imports "" + + $parser eval $contents + + foreach name $imports { + catch {$parser eval [list _%@namespace forget $name]} + } + return $index +} + +# auto_mkindex_parser::hook command +# +# Registers a Tcl command to evaluate when initializing the child interpreter +# used by the mkindex parser. The command is evaluated in the parent +# interpreter, and can use the variable auto_mkindex_parser::parser to get to +# the child + +proc auto_mkindex_parser::hook {cmd} { + variable initCommands + + lappend initCommands $cmd +} + +# auto_mkindex_parser::slavehook command +# +# Registers a Tcl command to evaluate when initializing the child interpreter +# used by the mkindex parser. The command is evaluated in the child +# interpreter. + +proc auto_mkindex_parser::slavehook {cmd} { + variable initCommands + + # The $parser variable is defined to be the name of the child interpreter + # when this command is used later. + + lappend initCommands "\$parser eval [list $cmd]" +} + +# auto_mkindex_parser::command -- +# +# Registers a new command with the "auto_mkindex_parser" interpreter that +# parses Tcl files. These commands are fake versions of things like the +# "proc" command. When you execute them, they simply write out an entry to a +# "tclIndex" file for auto-loading. +# +# This procedure allows extensions to register their own commands with the +# auto_mkindex facility. For example, a package like [incr Tcl] might +# register a "class" command so that class definitions could be added to a +# "tclIndex" file for auto-loading. +# +# Arguments: +# name Name of command recognized in Tcl files. +# arglist Argument list for command. +# body Implementation of command to handle indexing. + +proc auto_mkindex_parser::command {name arglist body} { + hook [list auto_mkindex_parser::commandInit $name $arglist $body] +} + +# auto_mkindex_parser::commandInit -- +# +# This does the actual work set up by auto_mkindex_parser::command. This is +# called when the interpreter used by the parser is created. +# +# Arguments: +# name Name of command recognized in Tcl files. +# arglist Argument list for command. +# body Implementation of command to handle indexing. + +proc auto_mkindex_parser::commandInit {name arglist body} { + variable parser + + set ns [namespace qualifiers $name] + set tail [namespace tail $name] + if {$ns eq ""} { + set fakeName [namespace current]::_%@fake_$tail + } else { + set fakeName [namespace current]::[string map {:: _} _%@fake_$name] + } + proc $fakeName $arglist $body + + # YUK! Tcl won't let us alias fully qualified command names, so we can't + # handle names like "::itcl::class". Instead, we have to build procs with + # the fully qualified names, and have the procs point to the aliases. + + if {[string match *::* $name]} { + set exportCmd [list _%@namespace export [namespace tail $name]] + $parser eval [list _%@namespace eval $ns $exportCmd] + + # The following proc definition does not work if you want to tolerate + # space or something else diabolical in the procedure name, (i.e., + # space in $alias). The following does not work: + # "_%@eval {$alias} \$args" + # because $alias gets concat'ed to $args. The following does not work + # because $cmd is somehow undefined + # "set cmd {$alias} \; _%@eval {\$cmd} \$args" + # A gold star to someone that can make test autoMkindex-3.3 work + # properly + + set alias [namespace tail $fakeName] + $parser invokehidden proc $name {args} "_%@eval {$alias} \$args" + $parser alias $alias $fakeName + } else { + $parser alias $name $fakeName + } + return +} + +# auto_mkindex_parser::fullname -- +# +# Used by commands like "proc" within the auto_mkindex parser. Returns the +# qualified namespace name for the "name" argument. If the "name" does not +# start with "::", elements are added from the current namespace stack to +# produce a qualified name. Then, the name is examined to see whether or not +# it should really be qualified. If the name has more than the leading "::", +# it is returned as a fully qualified name. Otherwise, it is returned as a +# simple name. That way, the Tcl autoloader will recognize it properly. +# +# Arguments: +# name - Name that is being added to index. + +proc auto_mkindex_parser::fullname {name} { + variable contextStack + + if {![string match ::* $name]} { + foreach ns $contextStack { + set name "${ns}::$name" + if {[string match ::* $name]} { + break + } + } + } + + if {[namespace qualifiers $name] eq ""} { + set name [namespace tail $name] + } elseif {![string match ::* $name]} { + set name "::$name" + } + + # Earlier, mkindex replaced all $'s with \0. Now, we have to reverse that + # replacement. + return [string map [list \0 \$] $name] +} + +# auto_mkindex_parser::indexEntry -- +# +# Used by commands like "proc" within the auto_mkindex parser to add a +# correctly-quoted entry to the index. This is shared code so it is done +# *right*, in one place. +# +# Arguments: +# name - Name that is being added to index. + +proc auto_mkindex_parser::indexEntry {name} { + variable index + variable scriptFile + + # We convert all metacharacters to their backslashed form, and pre-split + # the file name that we know about (which will be a proper list, and so + # correctly quoted). + + set name [string range [list \}[fullname $name]] 2 end] + set filenameParts [file split $scriptFile] + + append index [format \ + {set auto_index(%s) [list source -encoding utf-8 [file join $dir %s]]%s} \ + $name $filenameParts \n] + return +} + +if {[llength $::auto_mkindex_parser::initCommands]} { + return +} + +# Register all of the procedures for the auto_mkindex parser that will build +# the "tclIndex" file. + +# AUTO MKINDEX: proc name arglist body +# Adds an entry to the auto index list for the given procedure name. + +auto_mkindex_parser::command proc {name args} { + indexEntry $name +} + +# Conditionally add support for Tcl byte code files. There are some tricky +# details here. First, we need to get the tbcload library initialized in the +# current interpreter. We cannot load tbcload into the child until we have +# done so because it needs access to the tcl_patchLevel variable. Second, +# because the package index file may defer loading the library until we invoke +# a command, we need to explicitly invoke auto_load to force it to be loaded. +# This should be a noop if the package has already been loaded + +auto_mkindex_parser::hook { + try { + package require tbcload + } on error {} { + # OK, don't have it so do nothing + } on ok {} { + if {[namespace which -command tbcload::bcproc] eq ""} { + auto_load tbcload::bcproc + } + load {} tbcload $auto_mkindex_parser::parser + + # AUTO MKINDEX: tbcload::bcproc name arglist body + # Adds an entry to the auto index list for the given precompiled + # procedure name. + + auto_mkindex_parser::commandInit tbcload::bcproc {name args} { + indexEntry $name + } + } +} + +# AUTO MKINDEX: namespace eval name command ?arg arg...? +# Adds the namespace name onto the context stack and evaluates the associated +# body of commands. +# +# AUTO MKINDEX: namespace import ?-force? pattern ?pattern...? +# Performs the "import" action in the parser interpreter. This is important +# for any commands contained in a namespace that affect the index. For +# example, a script may say "itcl::class ...", or it may import "itcl::*" and +# then say "class ...". This procedure does the import operation, but keeps +# track of imported patterns so we can remove the imports later. + +auto_mkindex_parser::command namespace {op args} { + switch -- $op { + eval { + variable parser + variable contextStack + + set name [lindex $args 0] + set args [lrange $args 1 end] + + set contextStack [linsert $contextStack 0 $name] + $parser eval [list _%@namespace eval $name] $args + set contextStack [lrange $contextStack 1 end] + } + import { + variable parser + variable imports + foreach pattern $args { + if {$pattern ne "-force"} { + lappend imports $pattern + } + } + catch {$parser eval "_%@namespace import $args"} + } + ensemble { + variable parser + variable contextStack + if {[lindex $args 0] eq "create"} { + set name ::[join [lreverse $contextStack] ::] + catch { + set name [dict get [lrange $args 1 end] -command] + if {![string match ::* $name]} { + set name ::[join [lreverse $contextStack] ::]$name + } + regsub -all ::+ $name :: name + } + # create artificial proc to force an entry in the tclIndex + $parser eval [list ::proc $name {} {}] + } + } + } +} + +# AUTO MKINDEX: oo::class create name ?definition? +# Adds an entry to the auto index list for the given class name. +auto_mkindex_parser::command oo::class {op name {body ""}} { + if {$op eq "create"} { + indexEntry $name + } +} +auto_mkindex_parser::command class {op name {body ""}} { + if {$op eq "create"} { + indexEntry $name + } +} + +return diff --git a/miniconda3/envs/active_proaction/lib/tcl8.6/clock.tcl b/miniconda3/envs/active_proaction/lib/tcl8.6/clock.tcl new file mode 100644 index 0000000000000000000000000000000000000000..e578f4dd7e4828e58fe52faeab35090a3e9446ee --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/tcl8.6/clock.tcl @@ -0,0 +1,4553 @@ +#---------------------------------------------------------------------- +# +# clock.tcl -- +# +# This file implements the portions of the [clock] ensemble that are +# coded in Tcl. Refer to the users' manual to see the description of +# the [clock] command and its subcommands. +# +# +#---------------------------------------------------------------------- +# +# Copyright (c) 2004-2007 Kevin B. Kenny +# See the file "license.terms" for information on usage and redistribution +# of this file, and for a DISCLAIMER OF ALL WARRANTIES. +# +#---------------------------------------------------------------------- + +# We must have message catalogs that support the root locale, and we need +# access to the Registry on Windows systems. + +uplevel \#0 { + package require msgcat 1.6 + if { $::tcl_platform(platform) eq {windows} } { + if { [catch { package require registry 1.1 }] } { + namespace eval ::tcl::clock [list variable NoRegistry {}] + } + } +} + +# Put the library directory into the namespace for the ensemble so that the +# library code can find message catalogs and time zone definition files. + +namespace eval ::tcl::clock \ + [list variable LibDir [info library]] + +#---------------------------------------------------------------------- +# +# clock -- +# +# Manipulate times. +# +# The 'clock' command manipulates time. Refer to the user documentation for +# the available subcommands and what they do. +# +#---------------------------------------------------------------------- + +namespace eval ::tcl::clock { + + # Export the subcommands + + namespace export format + namespace export clicks + namespace export microseconds + namespace export milliseconds + namespace export scan + namespace export seconds + namespace export add + + # Import the message catalog commands that we use. + + namespace import ::msgcat::mcload + namespace import ::msgcat::mclocale + namespace import ::msgcat::mc + namespace import ::msgcat::mcpackagelocale + +} + +#---------------------------------------------------------------------- +# +# ::tcl::clock::Initialize -- +# +# Finish initializing the 'clock' subsystem +# +# Results: +# None. +# +# Side effects: +# Namespace variable in the 'clock' subsystem are initialized. +# +# The '::tcl::clock::Initialize' procedure initializes the namespace variables +# and root locale message catalog for the 'clock' subsystem. It is broken +# into a procedure rather than simply evaluated as a script so that it will be +# able to use local variables, avoiding the dangers of 'creative writing' as +# in Bug 1185933. +# +#---------------------------------------------------------------------- + +proc ::tcl::clock::Initialize {} { + + rename ::tcl::clock::Initialize {} + + variable LibDir + + # Define the Greenwich time zone + + proc InitTZData {} { + variable TZData + array unset TZData + set TZData(:Etc/GMT) { + {-9223372036854775808 0 0 GMT} + } + set TZData(:GMT) $TZData(:Etc/GMT) + set TZData(:Etc/UTC) { + {-9223372036854775808 0 0 UTC} + } + set TZData(:UTC) $TZData(:Etc/UTC) + set TZData(:localtime) {} + } + InitTZData + + mcpackagelocale set {} + ::msgcat::mcpackageconfig set mcfolder [file join $LibDir msgs] + ::msgcat::mcpackageconfig set unknowncmd "" + ::msgcat::mcpackageconfig set changecmd ChangeCurrentLocale + + # Define the message catalog for the root locale. + + ::msgcat::mcmset {} { + AM {am} + BCE {B.C.E.} + CE {C.E.} + DATE_FORMAT {%m/%d/%Y} + DATE_TIME_FORMAT {%a %b %e %H:%M:%S %Y} + DAYS_OF_WEEK_ABBREV { + Sun Mon Tue Wed Thu Fri Sat + } + DAYS_OF_WEEK_FULL { + Sunday Monday Tuesday Wednesday Thursday Friday Saturday + } + GREGORIAN_CHANGE_DATE 2299161 + LOCALE_DATE_FORMAT {%m/%d/%Y} + LOCALE_DATE_TIME_FORMAT {%a %b %e %H:%M:%S %Y} + LOCALE_ERAS {} + LOCALE_NUMERALS { + 00 01 02 03 04 05 06 07 08 09 + 10 11 12 13 14 15 16 17 18 19 + 20 21 22 23 24 25 26 27 28 29 + 30 31 32 33 34 35 36 37 38 39 + 40 41 42 43 44 45 46 47 48 49 + 50 51 52 53 54 55 56 57 58 59 + 60 61 62 63 64 65 66 67 68 69 + 70 71 72 73 74 75 76 77 78 79 + 80 81 82 83 84 85 86 87 88 89 + 90 91 92 93 94 95 96 97 98 99 + } + LOCALE_TIME_FORMAT {%H:%M:%S} + LOCALE_YEAR_FORMAT {%EC%Ey} + MONTHS_ABBREV { + Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec + } + MONTHS_FULL { + January February March + April May June + July August September + October November December + } + PM {pm} + TIME_FORMAT {%H:%M:%S} + TIME_FORMAT_12 {%I:%M:%S %P} + TIME_FORMAT_24 {%H:%M} + TIME_FORMAT_24_SECS {%H:%M:%S} + } + + # Define a few Gregorian change dates for other locales. In most cases + # the change date follows a language, because a nation's colonies changed + # at the same time as the nation itself. In many cases, different + # national boundaries existed; the dominating rule is to follow the + # nation's capital. + + # Italy, Spain, Portugal, Poland + + ::msgcat::mcset it GREGORIAN_CHANGE_DATE 2299161 + ::msgcat::mcset es GREGORIAN_CHANGE_DATE 2299161 + ::msgcat::mcset pt GREGORIAN_CHANGE_DATE 2299161 + ::msgcat::mcset pl GREGORIAN_CHANGE_DATE 2299161 + + # France, Austria + + ::msgcat::mcset fr GREGORIAN_CHANGE_DATE 2299227 + + # For Belgium, we follow Southern Netherlands; Liege Diocese changed + # several weeks later. + + ::msgcat::mcset fr_BE GREGORIAN_CHANGE_DATE 2299238 + ::msgcat::mcset nl_BE GREGORIAN_CHANGE_DATE 2299238 + + # Austria + + ::msgcat::mcset de_AT GREGORIAN_CHANGE_DATE 2299527 + + # Hungary + + ::msgcat::mcset hu GREGORIAN_CHANGE_DATE 2301004 + + # Germany, Norway, Denmark (Catholic Germany changed earlier) + + ::msgcat::mcset de_DE GREGORIAN_CHANGE_DATE 2342032 + ::msgcat::mcset nb GREGORIAN_CHANGE_DATE 2342032 + ::msgcat::mcset nn GREGORIAN_CHANGE_DATE 2342032 + ::msgcat::mcset no GREGORIAN_CHANGE_DATE 2342032 + ::msgcat::mcset da GREGORIAN_CHANGE_DATE 2342032 + + # Holland (Brabant, Gelderland, Flanders, Friesland, etc. changed at + # various times) + + ::msgcat::mcset nl GREGORIAN_CHANGE_DATE 2342165 + + # Protestant Switzerland (Catholic cantons changed earlier) + + ::msgcat::mcset fr_CH GREGORIAN_CHANGE_DATE 2361342 + ::msgcat::mcset it_CH GREGORIAN_CHANGE_DATE 2361342 + ::msgcat::mcset de_CH GREGORIAN_CHANGE_DATE 2361342 + + # English speaking countries + + ::msgcat::mcset en GREGORIAN_CHANGE_DATE 2361222 + + # Sweden (had several changes onto and off of the Gregorian calendar) + + ::msgcat::mcset sv GREGORIAN_CHANGE_DATE 2361390 + + # Russia + + ::msgcat::mcset ru GREGORIAN_CHANGE_DATE 2421639 + + # Romania (Transylvania changed earlier - perhaps de_RO should show the + # earlier date?) + + ::msgcat::mcset ro GREGORIAN_CHANGE_DATE 2422063 + + # Greece + + ::msgcat::mcset el GREGORIAN_CHANGE_DATE 2423480 + + #------------------------------------------------------------------ + # + # CONSTANTS + # + #------------------------------------------------------------------ + + # Paths at which binary time zone data for the Olson libraries are known + # to reside on various operating systems + + variable ZoneinfoPaths {} + foreach path { + /usr/share/zoneinfo + /usr/share/lib/zoneinfo + /usr/lib/zoneinfo + /usr/local/etc/zoneinfo + } { + if { [file isdirectory $path] } { + lappend ZoneinfoPaths $path + } + } + + # Define the directories for time zone data and message catalogs. + + variable DataDir [file join $LibDir tzdata] + + # Number of days in the months, in common years and leap years. + + variable DaysInRomanMonthInCommonYear \ + { 31 28 31 30 31 30 31 31 30 31 30 31 } + variable DaysInRomanMonthInLeapYear \ + { 31 29 31 30 31 30 31 31 30 31 30 31 } + variable DaysInPriorMonthsInCommonYear [list 0] + variable DaysInPriorMonthsInLeapYear [list 0] + set i 0 + foreach j $DaysInRomanMonthInCommonYear { + lappend DaysInPriorMonthsInCommonYear [incr i $j] + } + set i 0 + foreach j $DaysInRomanMonthInLeapYear { + lappend DaysInPriorMonthsInLeapYear [incr i $j] + } + + # Another epoch (Hi, Jeff!) + + variable Roddenberry 1946 + + # Integer ranges + + variable MINWIDE -9223372036854775808 + variable MAXWIDE 9223372036854775807 + + # Day before Leap Day + + variable FEB_28 58 + + # Translation table to map Windows TZI onto cities, so that the Olson + # rules can apply. In some cases the mapping is ambiguous, so it's wise + # to specify $::env(TCL_TZ) rather than simply depending on the system + # time zone. + + # The keys are long lists of values obtained from the time zone + # information in the Registry. In order, the list elements are: + # Bias StandardBias DaylightBias + # StandardDate.wYear StandardDate.wMonth StandardDate.wDayOfWeek + # StandardDate.wDay StandardDate.wHour StandardDate.wMinute + # StandardDate.wSecond StandardDate.wMilliseconds + # DaylightDate.wYear DaylightDate.wMonth DaylightDate.wDayOfWeek + # DaylightDate.wDay DaylightDate.wHour DaylightDate.wMinute + # DaylightDate.wSecond DaylightDate.wMilliseconds + # The values are the names of time zones where those rules apply. There + # is considerable ambiguity in certain zones; an attempt has been made to + # make a reasonable guess, but this table needs to be taken with a grain + # of salt. + + variable WinZoneInfo [dict create {*}{ + {-43200 0 3600 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0} :Pacific/Kwajalein + {-39600 0 3600 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0} :Pacific/Midway + {-36000 0 3600 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0} :Pacific/Honolulu + {-32400 0 3600 0 11 0 1 2 0 0 0 0 3 0 2 2 0 0 0} :America/Anchorage + {-28800 0 3600 0 11 0 1 2 0 0 0 0 3 0 2 2 0 0 0} :America/Los_Angeles + {-28800 0 3600 0 10 0 5 2 0 0 0 0 4 0 1 2 0 0 0} :America/Tijuana + {-25200 0 3600 0 11 0 1 2 0 0 0 0 3 0 2 2 0 0 0} :America/Denver + {-25200 0 3600 0 10 0 5 2 0 0 0 0 4 0 1 2 0 0 0} :America/Chihuahua + {-25200 0 3600 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0} :America/Phoenix + {-21600 0 3600 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0} :America/Regina + {-21600 0 3600 0 11 0 1 2 0 0 0 0 3 0 2 2 0 0 0} :America/Chicago + {-21600 0 3600 0 10 0 5 2 0 0 0 0 4 0 1 2 0 0 0} :America/Mexico_City + {-18000 0 3600 0 11 0 1 2 0 0 0 0 3 0 2 2 0 0 0} :America/New_York + {-18000 0 3600 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0} :America/Indianapolis + {-14400 0 3600 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0} :America/Caracas + {-14400 0 3600 0 3 6 2 23 59 59 999 0 10 6 2 23 59 59 999} + :America/Santiago + {-14400 0 3600 0 2 0 5 2 0 0 0 0 11 0 1 2 0 0 0} :America/Manaus + {-14400 0 3600 0 11 0 1 2 0 0 0 0 3 0 2 2 0 0 0} :America/Halifax + {-12600 0 3600 0 10 0 5 2 0 0 0 0 4 0 1 2 0 0 0} :America/St_Johns + {-10800 0 3600 0 2 0 2 2 0 0 0 0 10 0 3 2 0 0 0} :America/Sao_Paulo + {-10800 0 3600 0 10 0 5 2 0 0 0 0 4 0 1 2 0 0 0} :America/Godthab + {-10800 0 3600 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0} :America/Buenos_Aires + {-10800 0 3600 0 2 0 5 2 0 0 0 0 11 0 1 2 0 0 0} :America/Bahia + {-10800 0 3600 0 3 0 2 2 0 0 0 0 10 0 1 2 0 0 0} :America/Montevideo + {-7200 0 3600 0 9 0 5 2 0 0 0 0 3 0 5 2 0 0 0} :America/Noronha + {-3600 0 3600 0 10 0 5 3 0 0 0 0 3 0 5 2 0 0 0} :Atlantic/Azores + {-3600 0 3600 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0} :Atlantic/Cape_Verde + {0 0 3600 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0} :UTC + {0 0 3600 0 10 0 5 2 0 0 0 0 3 0 5 1 0 0 0} :Europe/London + {3600 0 3600 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0} :Africa/Kinshasa + {3600 0 3600 0 10 0 5 3 0 0 0 0 3 0 5 2 0 0 0} :CET + {7200 0 3600 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0} :Africa/Harare + {7200 0 3600 0 9 4 5 23 59 59 0 0 4 4 5 23 59 59 0} + :Africa/Cairo + {7200 0 3600 0 10 0 5 4 0 0 0 0 3 0 5 3 0 0 0} :Europe/Helsinki + {7200 0 3600 0 9 0 3 2 0 0 0 0 3 5 5 2 0 0 0} :Asia/Jerusalem + {7200 0 3600 0 9 0 5 1 0 0 0 0 3 0 5 0 0 0 0} :Europe/Bucharest + {7200 0 3600 0 10 0 5 3 0 0 0 0 3 0 5 2 0 0 0} :Europe/Athens + {7200 0 3600 0 9 5 5 1 0 0 0 0 3 4 5 0 0 0 0} :Asia/Amman + {7200 0 3600 0 10 6 5 23 59 59 999 0 3 0 5 0 0 0 0} + :Asia/Beirut + {7200 0 -3600 0 4 0 1 2 0 0 0 0 9 0 1 2 0 0 0} :Africa/Windhoek + {10800 0 3600 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0} :Asia/Riyadh + {10800 0 3600 0 10 0 1 4 0 0 0 0 4 0 1 3 0 0 0} :Asia/Baghdad + {10800 0 3600 0 10 0 5 3 0 0 0 0 3 0 5 2 0 0 0} :Europe/Moscow + {12600 0 3600 0 9 2 4 2 0 0 0 0 3 0 1 2 0 0 0} :Asia/Tehran + {14400 0 3600 0 10 0 5 5 0 0 0 0 3 0 5 4 0 0 0} :Asia/Baku + {14400 0 3600 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0} :Asia/Muscat + {14400 0 3600 0 10 0 5 3 0 0 0 0 3 0 5 2 0 0 0} :Asia/Tbilisi + {16200 0 3600 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0} :Asia/Kabul + {18000 0 3600 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0} :Asia/Karachi + {18000 0 3600 0 10 0 5 3 0 0 0 0 3 0 5 2 0 0 0} :Asia/Yekaterinburg + {19800 0 3600 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0} :Asia/Calcutta + {20700 0 3600 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0} :Asia/Katmandu + {21600 0 3600 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0} :Asia/Dhaka + {21600 0 3600 0 10 0 5 3 0 0 0 0 3 0 5 2 0 0 0} :Asia/Novosibirsk + {23400 0 3600 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0} :Asia/Rangoon + {25200 0 3600 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0} :Asia/Bangkok + {25200 0 3600 0 10 0 5 3 0 0 0 0 3 0 5 2 0 0 0} :Asia/Krasnoyarsk + {28800 0 3600 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0} :Asia/Chongqing + {28800 0 3600 0 10 0 5 3 0 0 0 0 3 0 5 2 0 0 0} :Asia/Irkutsk + {32400 0 3600 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0} :Asia/Tokyo + {32400 0 3600 0 10 0 5 3 0 0 0 0 3 0 5 2 0 0 0} :Asia/Yakutsk + {34200 0 3600 0 3 0 5 3 0 0 0 0 10 0 5 2 0 0 0} :Australia/Adelaide + {34200 0 3600 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0} :Australia/Darwin + {36000 0 3600 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0} :Australia/Brisbane + {36000 0 3600 0 10 0 5 3 0 0 0 0 3 0 5 2 0 0 0} :Asia/Vladivostok + {36000 0 3600 0 3 0 5 3 0 0 0 0 10 0 1 2 0 0 0} :Australia/Hobart + {36000 0 3600 0 3 0 5 3 0 0 0 0 10 0 5 2 0 0 0} :Australia/Sydney + {39600 0 3600 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0} :Pacific/Noumea + {43200 0 3600 0 3 0 3 3 0 0 0 0 10 0 1 2 0 0 0} :Pacific/Auckland + {43200 0 3600 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0} :Pacific/Fiji + {46800 0 3600 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0} :Pacific/Tongatapu + }] + + # Groups of fields that specify the date, priorities, and code bursts that + # determine Julian Day Number given those groups. The code in [clock + # scan] will choose the highest priority (lowest numbered) set of fields + # that determines the date. + + variable DateParseActions { + + { seconds } 0 {} + + { julianDay } 1 {} + + { era century yearOfCentury month dayOfMonth } 2 { + dict set date year [expr { 100 * [dict get $date century] + + [dict get $date yearOfCentury] }] + set date [GetJulianDayFromEraYearMonthDay $date[set date {}] \ + $changeover] + } + { era century yearOfCentury dayOfYear } 2 { + dict set date year [expr { 100 * [dict get $date century] + + [dict get $date yearOfCentury] }] + set date [GetJulianDayFromEraYearDay $date[set date {}] \ + $changeover] + } + + { century yearOfCentury month dayOfMonth } 3 { + dict set date era CE + dict set date year [expr { 100 * [dict get $date century] + + [dict get $date yearOfCentury] }] + set date [GetJulianDayFromEraYearMonthDay $date[set date {}] \ + $changeover] + } + { century yearOfCentury dayOfYear } 3 { + dict set date era CE + dict set date year [expr { 100 * [dict get $date century] + + [dict get $date yearOfCentury] }] + set date [GetJulianDayFromEraYearDay $date[set date {}] \ + $changeover] + } + { iso8601Century iso8601YearOfCentury iso8601Week dayOfWeek } 3 { + dict set date era CE + dict set date iso8601Year \ + [expr { 100 * [dict get $date iso8601Century] + + [dict get $date iso8601YearOfCentury] }] + set date [GetJulianDayFromEraYearWeekDay $date[set date {}] \ + $changeover] + } + + { yearOfCentury month dayOfMonth } 4 { + set date [InterpretTwoDigitYear $date[set date {}] $baseTime] + dict set date era CE + set date [GetJulianDayFromEraYearMonthDay $date[set date {}] \ + $changeover] + } + { yearOfCentury dayOfYear } 4 { + set date [InterpretTwoDigitYear $date[set date {}] $baseTime] + dict set date era CE + set date [GetJulianDayFromEraYearDay $date[set date {}] \ + $changeover] + } + { iso8601YearOfCentury iso8601Week dayOfWeek } 4 { + set date [InterpretTwoDigitYear \ + $date[set date {}] $baseTime \ + iso8601YearOfCentury iso8601Year] + dict set date era CE + set date [GetJulianDayFromEraYearWeekDay $date[set date {}] \ + $changeover] + } + + { month dayOfMonth } 5 { + set date [AssignBaseYear $date[set date {}] \ + $baseTime $timeZone $changeover] + set date [GetJulianDayFromEraYearMonthDay $date[set date {}] \ + $changeover] + } + { dayOfYear } 5 { + set date [AssignBaseYear $date[set date {}] \ + $baseTime $timeZone $changeover] + set date [GetJulianDayFromEraYearDay $date[set date {}] \ + $changeover] + } + { iso8601Week dayOfWeek } 5 { + set date [AssignBaseIso8601Year $date[set date {}] \ + $baseTime $timeZone $changeover] + set date [GetJulianDayFromEraYearWeekDay $date[set date {}] \ + $changeover] + } + + { dayOfMonth } 6 { + set date [AssignBaseMonth $date[set date {}] \ + $baseTime $timeZone $changeover] + set date [GetJulianDayFromEraYearMonthDay $date[set date {}] \ + $changeover] + } + + { dayOfWeek } 7 { + set date [AssignBaseWeek $date[set date {}] \ + $baseTime $timeZone $changeover] + set date [GetJulianDayFromEraYearWeekDay $date[set date {}] \ + $changeover] + } + + {} 8 { + set date [AssignBaseJulianDay $date[set date {}] \ + $baseTime $timeZone $changeover] + } + } + + # Groups of fields that specify time of day, priorities, and code that + # processes them + + variable TimeParseActions { + + seconds 1 {} + + { hourAMPM minute second amPmIndicator } 2 { + dict set date secondOfDay [InterpretHMSP $date] + } + { hour minute second } 2 { + dict set date secondOfDay [InterpretHMS $date] + } + + { hourAMPM minute amPmIndicator } 3 { + dict set date second 0 + dict set date secondOfDay [InterpretHMSP $date] + } + { hour minute } 3 { + dict set date second 0 + dict set date secondOfDay [InterpretHMS $date] + } + + { hourAMPM amPmIndicator } 4 { + dict set date minute 0 + dict set date second 0 + dict set date secondOfDay [InterpretHMSP $date] + } + { hour } 4 { + dict set date minute 0 + dict set date second 0 + dict set date secondOfDay [InterpretHMS $date] + } + + { } 5 { + dict set date secondOfDay 0 + } + } + + # Legacy time zones, used primarily for parsing RFC822 dates. + + variable LegacyTimeZone [dict create \ + gmt +0000 \ + ut +0000 \ + utc +0000 \ + bst +0100 \ + wet +0000 \ + wat -0100 \ + at -0200 \ + nft -0330 \ + nst -0330 \ + ndt -0230 \ + ast -0400 \ + adt -0300 \ + est -0500 \ + edt -0400 \ + cst -0600 \ + cdt -0500 \ + mst -0700 \ + mdt -0600 \ + pst -0800 \ + pdt -0700 \ + yst -0900 \ + ydt -0800 \ + akst -0900 \ + akdt -0800 \ + hst -1000 \ + hdt -0900 \ + cat -1000 \ + ahst -1000 \ + nt -1100 \ + idlw -1200 \ + cet +0100 \ + cest +0200 \ + met +0100 \ + mewt +0100 \ + mest +0200 \ + swt +0100 \ + sst +0200 \ + fwt +0100 \ + fst +0200 \ + eet +0200 \ + eest +0300 \ + bt +0300 \ + it +0330 \ + zp4 +0400 \ + zp5 +0500 \ + ist +0530 \ + zp6 +0600 \ + wast +0700 \ + wadt +0800 \ + jt +0730 \ + cct +0800 \ + jst +0900 \ + kst +0900 \ + cast +0930 \ + jdt +1000 \ + kdt +1000 \ + cadt +1030 \ + east +1000 \ + eadt +1030 \ + gst +1000 \ + nzt +1200 \ + nzst +1200 \ + nzdt +1300 \ + idle +1200 \ + a +0100 \ + b +0200 \ + c +0300 \ + d +0400 \ + e +0500 \ + f +0600 \ + g +0700 \ + h +0800 \ + i +0900 \ + k +1000 \ + l +1100 \ + m +1200 \ + n -0100 \ + o -0200 \ + p -0300 \ + q -0400 \ + r -0500 \ + s -0600 \ + t -0700 \ + u -0800 \ + v -0900 \ + w -1000 \ + x -1100 \ + y -1200 \ + z +0000 \ + ] + + # Caches + + variable LocaleNumeralCache {}; # Dictionary whose keys are locale + # names and whose values are pairs + # comprising regexes matching numerals + # in the given locales and dictionaries + # mapping the numerals to their numeric + # values. + # variable CachedSystemTimeZone; # If 'CachedSystemTimeZone' exists, + # it contains the value of the + # system time zone, as determined from + # the environment. + variable TimeZoneBad {}; # Dictionary whose keys are time zone + # names and whose values are 1 if + # the time zone is unknown and 0 + # if it is known. + variable TZData; # Array whose keys are time zone names + # and whose values are lists of quads + # comprising start time, UTC offset, + # Daylight Saving Time indicator, and + # time zone abbreviation. + variable FormatProc; # Array mapping format group + # and locale to the name of a procedure + # that renders the given format +} +::tcl::clock::Initialize + +#---------------------------------------------------------------------- +# +# clock format -- +# +# Formats a count of seconds since the Posix Epoch as a time of day. +# +# The 'clock format' command formats times of day for output. Refer to the +# user documentation to see what it does. +# +#---------------------------------------------------------------------- + +proc ::tcl::clock::format { args } { + + variable FormatProc + variable TZData + + lassign [ParseFormatArgs {*}$args] format locale timezone + set locale [string tolower $locale] + set clockval [lindex $args 0] + + # Get the data for time changes in the given zone + + if {$timezone eq ""} { + set timezone [GetSystemTimeZone] + } + if {![info exists TZData($timezone)]} { + if {[catch {SetupTimeZone $timezone} retval opts]} { + dict unset opts -errorinfo + return -options $opts $retval + } + } + + # Build a procedure to format the result. Cache the built procedure's name + # in the 'FormatProc' array to avoid losing its internal representation, + # which contains the name resolution. + + set procName formatproc'$format'$locale + set procName [namespace current]::[string map {: {\:} \\ {\\}} $procName] + if {[info exists FormatProc($procName)]} { + set procName $FormatProc($procName) + } else { + set FormatProc($procName) \ + [ParseClockFormatFormat $procName $format $locale] + } + + return [$procName $clockval $timezone] + +} + +#---------------------------------------------------------------------- +# +# ParseClockFormatFormat -- +# +# Builds and caches a procedure that formats a time value. +# +# Parameters: +# format -- Format string to use +# locale -- Locale in which the format string is to be interpreted +# +# Results: +# Returns the name of the newly-built procedure. +# +#---------------------------------------------------------------------- + +proc ::tcl::clock::ParseClockFormatFormat {procName format locale} { + + if {[namespace which $procName] ne {}} { + return $procName + } + + # Map away the locale-dependent composite format groups + + EnterLocale $locale + + # Change locale if a fresh locale has been given on the command line. + + try { + return [ParseClockFormatFormat2 $format $locale $procName] + } trap CLOCK {result opts} { + dict unset opts -errorinfo + return -options $opts $result + } +} + +proc ::tcl::clock::ParseClockFormatFormat2 {format locale procName} { + set didLocaleEra 0 + set didLocaleNumerals 0 + set preFormatCode \ + [string map [list @GREGORIAN_CHANGE_DATE@ \ + [mc GREGORIAN_CHANGE_DATE]] \ + { + variable TZData + set date [GetDateFields $clockval \ + $TZData($timezone) \ + @GREGORIAN_CHANGE_DATE@] + }] + set formatString {} + set substituents {} + set state {} + + set format [LocalizeFormat $locale $format] + + foreach char [split $format {}] { + switch -exact -- $state { + {} { + if { [string equal % $char] } { + set state percent + } else { + append formatString $char + } + } + percent { # Character following a '%' character + set state {} + switch -exact -- $char { + % { # A literal character, '%' + append formatString %% + } + a { # Day of week, abbreviated + append formatString %s + append substituents \ + [string map \ + [list @DAYS_OF_WEEK_ABBREV@ \ + [list [mc DAYS_OF_WEEK_ABBREV]]] \ + { [lindex @DAYS_OF_WEEK_ABBREV@ \ + [expr {[dict get $date dayOfWeek] \ + % 7}]]}] + } + A { # Day of week, spelt out. + append formatString %s + append substituents \ + [string map \ + [list @DAYS_OF_WEEK_FULL@ \ + [list [mc DAYS_OF_WEEK_FULL]]] \ + { [lindex @DAYS_OF_WEEK_FULL@ \ + [expr {[dict get $date dayOfWeek] \ + % 7}]]}] + } + b - h { # Name of month, abbreviated. + append formatString %s + append substituents \ + [string map \ + [list @MONTHS_ABBREV@ \ + [list [mc MONTHS_ABBREV]]] \ + { [lindex @MONTHS_ABBREV@ \ + [expr {[dict get $date month]-1}]]}] + } + B { # Name of month, spelt out + append formatString %s + append substituents \ + [string map \ + [list @MONTHS_FULL@ \ + [list [mc MONTHS_FULL]]] \ + { [lindex @MONTHS_FULL@ \ + [expr {[dict get $date month]-1}]]}] + } + C { # Century number + append formatString %02d + append substituents \ + { [expr {[dict get $date year] / 100}]} + } + d { # Day of month, with leading zero + append formatString %02d + append substituents { [dict get $date dayOfMonth]} + } + e { # Day of month, without leading zero + append formatString %2d + append substituents { [dict get $date dayOfMonth]} + } + E { # Format group in a locale-dependent + # alternative era + set state percentE + if {!$didLocaleEra} { + append preFormatCode \ + [string map \ + [list @LOCALE_ERAS@ \ + [list [mc LOCALE_ERAS]]] \ + { + set date [GetLocaleEra \ + $date[set date {}] \ + @LOCALE_ERAS@]}] \n + set didLocaleEra 1 + } + if {!$didLocaleNumerals} { + append preFormatCode \ + [list set localeNumerals \ + [mc LOCALE_NUMERALS]] \n + set didLocaleNumerals 1 + } + } + g { # Two-digit year relative to ISO8601 + # week number + append formatString %02d + append substituents \ + { [expr { [dict get $date iso8601Year] % 100 }]} + } + G { # Four-digit year relative to ISO8601 + # week number + append formatString %02d + append substituents { [dict get $date iso8601Year]} + } + H { # Hour in the 24-hour day, leading zero + append formatString %02d + append substituents \ + { [expr { [dict get $date localSeconds] \ + / 3600 % 24}]} + } + I { # Hour AM/PM, with leading zero + append formatString %02d + append substituents \ + { [expr { ( ( ( [dict get $date localSeconds] \ + % 86400 ) \ + + 86400 \ + - 3600 ) \ + / 3600 ) \ + % 12 + 1 }] } + } + j { # Day of year (001-366) + append formatString %03d + append substituents { [dict get $date dayOfYear]} + } + J { # Julian Day Number + append formatString %07ld + append substituents { [dict get $date julianDay]} + } + k { # Hour (0-23), no leading zero + append formatString %2d + append substituents \ + { [expr { [dict get $date localSeconds] + / 3600 + % 24 }]} + } + l { # Hour (12-11), no leading zero + append formatString %2d + append substituents \ + { [expr { ( ( ( [dict get $date localSeconds] + % 86400 ) + + 86400 + - 3600 ) + / 3600 ) + % 12 + 1 }]} + } + m { # Month number, leading zero + append formatString %02d + append substituents { [dict get $date month]} + } + M { # Minute of the hour, leading zero + append formatString %02d + append substituents \ + { [expr { [dict get $date localSeconds] + / 60 + % 60 }]} + } + n { # A literal newline + append formatString \n + } + N { # Month number, no leading zero + append formatString %2d + append substituents { [dict get $date month]} + } + O { # A format group in the locale's + # alternative numerals + set state percentO + if {!$didLocaleNumerals} { + append preFormatCode \ + [list set localeNumerals \ + [mc LOCALE_NUMERALS]] \n + set didLocaleNumerals 1 + } + } + p { # Localized 'AM' or 'PM' indicator + # converted to uppercase + append formatString %s + append preFormatCode \ + [list set AM [string toupper [mc AM]]] \n \ + [list set PM [string toupper [mc PM]]] \n + append substituents \ + { [expr {(([dict get $date localSeconds] + % 86400) < 43200) ? + $AM : $PM}]} + } + P { # Localized 'AM' or 'PM' indicator + append formatString %s + append preFormatCode \ + [list set am [mc AM]] \n \ + [list set pm [mc PM]] \n + append substituents \ + { [expr {(([dict get $date localSeconds] + % 86400) < 43200) ? + $am : $pm}]} + + } + Q { # Hi, Jeff! + append formatString %s + append substituents { [FormatStarDate $date]} + } + s { # Seconds from the Posix Epoch + append formatString %s + append substituents { [dict get $date seconds]} + } + S { # Second of the minute, with + # leading zero + append formatString %02d + append substituents \ + { [expr { [dict get $date localSeconds] + % 60 }]} + } + t { # A literal tab character + append formatString \t + } + u { # Day of the week (1-Monday, 7-Sunday) + append formatString %1d + append substituents { [dict get $date dayOfWeek]} + } + U { # Week of the year (00-53). The + # first Sunday of the year is the + # first day of week 01 + append formatString %02d + append preFormatCode { + set dow [dict get $date dayOfWeek] + if { $dow == 7 } { + set dow 0 + } + incr dow + set UweekNumber \ + [expr { ( [dict get $date dayOfYear] + - $dow + 7 ) + / 7 }] + } + append substituents { $UweekNumber} + } + V { # The ISO8601 week number + append formatString %02d + append substituents { [dict get $date iso8601Week]} + } + w { # Day of the week (0-Sunday, + # 6-Saturday) + append formatString %1d + append substituents \ + { [expr { [dict get $date dayOfWeek] % 7 }]} + } + W { # Week of the year (00-53). The first + # Monday of the year is the first day + # of week 01. + append preFormatCode { + set WweekNumber \ + [expr { ( [dict get $date dayOfYear] + - [dict get $date dayOfWeek] + + 7 ) + / 7 }] + } + append formatString %02d + append substituents { $WweekNumber} + } + y { # The two-digit year of the century + append formatString %02d + append substituents \ + { [expr { [dict get $date year] % 100 }]} + } + Y { # The four-digit year + append formatString %04d + append substituents { [dict get $date year]} + } + z { # The time zone as hours and minutes + # east (+) or west (-) of Greenwich + append formatString %s + append substituents { [FormatNumericTimeZone \ + [dict get $date tzOffset]]} + } + Z { # The name of the time zone + append formatString %s + append substituents { [dict get $date tzName]} + } + % { # A literal percent character + append formatString %% + } + default { # An unknown escape sequence + append formatString %% $char + } + } + } + percentE { # Character following %E + set state {} + switch -exact -- $char { + E { + append formatString %s + append substituents { } \ + [string map \ + [list @BCE@ [list [mc BCE]] \ + @CE@ [list [mc CE]]] \ + {[dict get {BCE @BCE@ CE @CE@} \ + [dict get $date era]]}] + } + C { # Locale-dependent era + append formatString %s + append substituents { [dict get $date localeEra]} + } + y { # Locale-dependent year of the era + append preFormatCode { + set y [dict get $date localeYear] + if { $y >= 0 && $y < 100 } { + set Eyear [lindex $localeNumerals $y] + } else { + set Eyear $y + } + } + append formatString %s + append substituents { $Eyear} + } + default { # Unknown %E format group + append formatString %%E $char + } + } + } + percentO { # Character following %O + set state {} + switch -exact -- $char { + d - e { # Day of the month in alternative + # numerals + append formatString %s + append substituents \ + { [lindex $localeNumerals \ + [dict get $date dayOfMonth]]} + } + H - k { # Hour of the day in alternative + # numerals + append formatString %s + append substituents \ + { [lindex $localeNumerals \ + [expr { [dict get $date localSeconds] + / 3600 + % 24 }]]} + } + I - l { # Hour (12-11) AM/PM in alternative + # numerals + append formatString %s + append substituents \ + { [lindex $localeNumerals \ + [expr { ( ( ( [dict get $date localSeconds] + % 86400 ) + + 86400 + - 3600 ) + / 3600 ) + % 12 + 1 }]]} + } + m { # Month number in alternative numerals + append formatString %s + append substituents \ + { [lindex $localeNumerals [dict get $date month]]} + } + M { # Minute of the hour in alternative + # numerals + append formatString %s + append substituents \ + { [lindex $localeNumerals \ + [expr { [dict get $date localSeconds] + / 60 + % 60 }]]} + } + S { # Second of the minute in alternative + # numerals + append formatString %s + append substituents \ + { [lindex $localeNumerals \ + [expr { [dict get $date localSeconds] + % 60 }]]} + } + u { # Day of the week (Monday=1,Sunday=7) + # in alternative numerals + append formatString %s + append substituents \ + { [lindex $localeNumerals \ + [dict get $date dayOfWeek]]} + } + w { # Day of the week (Sunday=0,Saturday=6) + # in alternative numerals + append formatString %s + append substituents \ + { [lindex $localeNumerals \ + [expr { [dict get $date dayOfWeek] % 7 }]]} + } + y { # Year of the century in alternative + # numerals + append formatString %s + append substituents \ + { [lindex $localeNumerals \ + [expr { [dict get $date year] % 100 }]]} + } + default { # Unknown format group + append formatString %%O $char + } + } + } + } + } + + # Clean up any improperly terminated groups + + switch -exact -- $state { + percent { + append formatString %% + } + percentE { + append retval %%E + } + percentO { + append retval %%O + } + } + + proc $procName {clockval timezone} " + $preFormatCode + return \[::format [list $formatString] $substituents\] + " + + # puts [list $procName [info args $procName] [info body $procName]] + + return $procName +} + +#---------------------------------------------------------------------- +# +# clock scan -- +# +# Inputs a count of seconds since the Posix Epoch as a time of day. +# +# The 'clock scan' command scans times of day on input. Refer to the user +# documentation to see what it does. +# +#---------------------------------------------------------------------- + +proc ::tcl::clock::scan { args } { + + set format {} + + # Check the count of args + + if { [llength $args] < 1 || [llength $args] % 2 != 1 } { + set cmdName "clock scan" + return -code error \ + -errorcode [list CLOCK wrongNumArgs] \ + "wrong \# args: should be\ + \"$cmdName string\ + ?-base seconds?\ + ?-format string? ?-gmt boolean?\ + ?-locale LOCALE? ?-timezone ZONE?\"" + } + + # Set defaults + + set base [clock seconds] + set string [lindex $args 0] + set format {} + set gmt 0 + set locale c + set timezone [GetSystemTimeZone] + + # Pick up command line options. + + foreach { flag value } [lreplace $args 0 0] { + switch -exact -- $flag { + -b - -ba - -bas - -base { + set base $value + } + -f - -fo - -for - -form - -forma - -format { + set saw(-format) {} + set format $value + } + -g - -gm - -gmt { + set saw(-gmt) {} + set gmt $value + } + -l - -lo - -loc - -loca - -local - -locale { + set saw(-locale) {} + set locale [string tolower $value] + } + -t - -ti - -tim - -time - -timez - -timezo - -timezon - -timezone { + set saw(-timezone) {} + set timezone $value + } + default { + return -code error \ + -errorcode [list CLOCK badOption $flag] \ + "bad option \"$flag\",\ + must be -base, -format, -gmt, -locale or -timezone" + } + } + } + + # Check options for validity + + if { [info exists saw(-gmt)] && [info exists saw(-timezone)] } { + return -code error \ + -errorcode [list CLOCK gmtWithTimezone] \ + "cannot use -gmt and -timezone in same call" + } + if { [catch { expr { wide($base) } } result] } { + return -code error "expected integer but got \"$base\"" + } + if { ![string is boolean -strict $gmt] } { + return -code error "expected boolean value but got \"$gmt\"" + } elseif { $gmt } { + set timezone :GMT + } + + if { ![info exists saw(-format)] } { + # Perhaps someday we'll localize the legacy code. Right now, it's not + # localized. + if { [info exists saw(-locale)] } { + return -code error \ + -errorcode [list CLOCK flagWithLegacyFormat] \ + "legacy \[clock scan\] does not support -locale" + + } + return [FreeScan $string $base $timezone $locale] + } + + # Change locale if a fresh locale has been given on the command line. + + EnterLocale $locale + + try { + # Map away the locale-dependent composite format groups + + set scanner [ParseClockScanFormat $format $locale] + return [$scanner $string $base $timezone] + } trap CLOCK {result opts} { + # Conceal location of generation of expected errors + dict unset opts -errorinfo + return -options $opts $result + } +} + +#---------------------------------------------------------------------- +# +# FreeScan -- +# +# Scans a time in free format +# +# Parameters: +# string - String containing the time to scan +# base - Base time, expressed in seconds from the Epoch +# timezone - Default time zone in which the time will be expressed +# locale - (Unused) Name of the locale where the time will be scanned. +# +# Results: +# Returns the date and time extracted from the string in seconds from +# the epoch +# +#---------------------------------------------------------------------- + +proc ::tcl::clock::FreeScan { string base timezone locale } { + + variable TZData + + # Get the data for time changes in the given zone + + try { + SetupTimeZone $timezone + } on error {retval opts} { + dict unset opts -errorinfo + return -options $opts $retval + } + + # Extract year, month and day from the base time for the parser to use as + # defaults + + set date [GetDateFields $base $TZData($timezone) 2361222] + dict set date secondOfDay [expr { + [dict get $date localSeconds] % 86400 + }] + + # Parse the date. The parser will return a list comprising date, time, + # time zone, relative month/day/seconds, relative weekday, ordinal month. + + try { + set scanned [Oldscan $string \ + [dict get $date year] \ + [dict get $date month] \ + [dict get $date dayOfMonth]] + lassign $scanned \ + parseDate parseTime parseZone parseRel \ + parseWeekday parseOrdinalMonth + } on error message { + return -code error \ + "unable to convert date-time string \"$string\": $message" + } + + # If the caller supplied a date in the string, update the 'date' dict with + # the value. If the caller didn't specify a time with the date, default to + # midnight. + + if { [llength $parseDate] > 0 } { + lassign $parseDate y m d + if { $y < 100 } { + if { $y >= 39 } { + incr y 1900 + } else { + incr y 2000 + } + } + dict set date era CE + dict set date year $y + dict set date month $m + dict set date dayOfMonth $d + if { $parseTime eq {} } { + set parseTime 0 + } + } + + # If the caller supplied a time zone in the string, it comes back as a + # two-element list; the first element is the number of minutes east of + # Greenwich, and the second is a Daylight Saving Time indicator (1 == yes, + # 0 == no, -1 == unknown). We make it into a time zone indicator of + # +-hhmm. + + if { [llength $parseZone] > 0 } { + lassign $parseZone minEast dstFlag + set timezone [FormatNumericTimeZone \ + [expr { 60 * $minEast + 3600 * $dstFlag }]] + SetupTimeZone $timezone + } + dict set date tzName $timezone + + # Assemble date, time, zone into seconds-from-epoch + + set date [GetJulianDayFromEraYearMonthDay $date[set date {}] 2361222] + if { $parseTime ne {} } { + dict set date secondOfDay $parseTime + } elseif { [llength $parseWeekday] != 0 + || [llength $parseOrdinalMonth] != 0 + || ( [llength $parseRel] != 0 + && ( [lindex $parseRel 0] != 0 + || [lindex $parseRel 1] != 0 ) ) } { + dict set date secondOfDay 0 + } + + dict set date localSeconds [expr { + -210866803200 + + ( 86400 * wide([dict get $date julianDay]) ) + + [dict get $date secondOfDay] + }] + dict set date tzName $timezone + set date [ConvertLocalToUTC $date[set date {}] $TZData($timezone) 2361222] + set seconds [dict get $date seconds] + + # Do relative times + + if { [llength $parseRel] > 0 } { + lassign $parseRel relMonth relDay relSecond + set seconds [add $seconds \ + $relMonth months $relDay days $relSecond seconds \ + -timezone $timezone -locale $locale] + } + + # Do relative weekday + + if { [llength $parseWeekday] > 0 } { + lassign $parseWeekday dayOrdinal dayOfWeek + set date2 [GetDateFields $seconds $TZData($timezone) 2361222] + dict set date2 era CE + set jdwkday [WeekdayOnOrBefore $dayOfWeek [expr { + [dict get $date2 julianDay] + 6 + }]] + incr jdwkday [expr { 7 * $dayOrdinal }] + if { $dayOrdinal > 0 } { + incr jdwkday -7 + } + dict set date2 secondOfDay \ + [expr { [dict get $date2 localSeconds] % 86400 }] + dict set date2 julianDay $jdwkday + dict set date2 localSeconds [expr { + -210866803200 + + ( 86400 * wide([dict get $date2 julianDay]) ) + + [dict get $date secondOfDay] + }] + dict set date2 tzName $timezone + set date2 [ConvertLocalToUTC $date2[set date2 {}] $TZData($timezone) \ + 2361222] + set seconds [dict get $date2 seconds] + + } + + # Do relative month + + if { [llength $parseOrdinalMonth] > 0 } { + lassign $parseOrdinalMonth monthOrdinal monthNumber + if { $monthOrdinal > 0 } { + set monthDiff [expr { $monthNumber - [dict get $date month] }] + if { $monthDiff <= 0 } { + incr monthDiff 12 + } + incr monthOrdinal -1 + } else { + set monthDiff [expr { [dict get $date month] - $monthNumber }] + if { $monthDiff >= 0 } { + incr monthDiff -12 + } + incr monthOrdinal + } + set seconds [add $seconds $monthOrdinal years $monthDiff months \ + -timezone $timezone -locale $locale] + } + + return $seconds +} + + +#---------------------------------------------------------------------- +# +# ParseClockScanFormat -- +# +# Parses a format string given to [clock scan -format] +# +# Parameters: +# formatString - The format being parsed +# locale - The current locale +# +# Results: +# Constructs and returns a procedure that accepts the string being +# scanned, the base time, and the time zone. The procedure will either +# return the scanned time or else throw an error that should be rethrown +# to the caller of [clock scan] +# +# Side effects: +# The given procedure is defined in the ::tcl::clock namespace. Scan +# procedures are not deleted once installed. +# +# Why do we parse dates by defining a procedure to parse them? The reason is +# that by doing so, we have one convenient place to cache all the information: +# the regular expressions that match the patterns (which will be compiled), +# the code that assembles the date information, everything lands in one place. +# In this way, when a given format is reused at run time, all the information +# of how to apply it is available in a single place. +# +#---------------------------------------------------------------------- + +proc ::tcl::clock::ParseClockScanFormat {formatString locale} { + # Check whether the format has been parsed previously, and return the + # existing recognizer if it has. + + set procName scanproc'$formatString'$locale + set procName [namespace current]::[string map {: {\:} \\ {\\}} $procName] + if { [namespace which $procName] != {} } { + return $procName + } + + variable DateParseActions + variable TimeParseActions + + # Localize the %x, %X, etc. groups + + set formatString [LocalizeFormat $locale $formatString] + + # Condense whitespace + + regsub -all {[[:space:]]+} $formatString { } formatString + + # Walk through the groups of the format string. In this loop, we + # accumulate: + # - a regular expression that matches the string, + # - the count of capturing brackets in the regexp + # - a set of code that post-processes the fields captured by the regexp, + # - a dictionary whose keys are the names of fields that are present + # in the format string. + + set re {^[[:space:]]*} + set captureCount 0 + set postcode {} + set fieldSet [dict create] + set fieldCount 0 + set postSep {} + set state {} + + foreach c [split $formatString {}] { + switch -exact -- $state { + {} { + if { $c eq "%" } { + set state % + } elseif { $c eq " " } { + append re {[[:space:]]+} + } else { + if { ! [string is alnum $c] } { + append re "\\" + } + append re $c + } + } + % { + set state {} + switch -exact -- $c { + % { + append re % + } + { } { + append re "\[\[:space:\]\]*" + } + a - A { # Day of week, in words + set l {} + foreach \ + i {7 1 2 3 4 5 6} \ + abr [mc DAYS_OF_WEEK_ABBREV] \ + full [mc DAYS_OF_WEEK_FULL] { + dict set l [string tolower $abr] $i + dict set l [string tolower $full] $i + incr i + } + lassign [UniquePrefixRegexp $l] regex lookup + append re ( $regex ) + dict set fieldSet dayOfWeek [incr fieldCount] + append postcode "dict set date dayOfWeek \[" \ + "dict get " [list $lookup] " " \ + \[ {string tolower $field} [incr captureCount] \] \ + "\]\n" + } + b - B - h { # Name of month + set i 0 + set l {} + foreach \ + abr [mc MONTHS_ABBREV] \ + full [mc MONTHS_FULL] { + incr i + dict set l [string tolower $abr] $i + dict set l [string tolower $full] $i + } + lassign [UniquePrefixRegexp $l] regex lookup + append re ( $regex ) + dict set fieldSet month [incr fieldCount] + append postcode "dict set date month \[" \ + "dict get " [list $lookup] \ + " " \[ {string tolower $field} \ + [incr captureCount] \] \ + "\]\n" + } + C { # Gregorian century + append re \\s*(\\d\\d?) + dict set fieldSet century [incr fieldCount] + append postcode "dict set date century \[" \ + "::scan \$field" [incr captureCount] " %d" \ + "\]\n" + } + d - e { # Day of month + append re \\s*(\\d\\d?) + dict set fieldSet dayOfMonth [incr fieldCount] + append postcode "dict set date dayOfMonth \[" \ + "::scan \$field" [incr captureCount] " %d" \ + "\]\n" + } + E { # Prefix for locale-specific codes + set state %E + } + g { # ISO8601 2-digit year + append re \\s*(\\d\\d) + dict set fieldSet iso8601YearOfCentury \ + [incr fieldCount] + append postcode \ + "dict set date iso8601YearOfCentury \[" \ + "::scan \$field" [incr captureCount] " %d" \ + "\]\n" + } + G { # ISO8601 4-digit year + append re \\s*(\\d\\d)(\\d\\d) + dict set fieldSet iso8601Century [incr fieldCount] + dict set fieldSet iso8601YearOfCentury \ + [incr fieldCount] + append postcode \ + "dict set date iso8601Century \[" \ + "::scan \$field" [incr captureCount] " %d" \ + "\]\n" \ + "dict set date iso8601YearOfCentury \[" \ + "::scan \$field" [incr captureCount] " %d" \ + "\]\n" + } + H - k { # Hour of day + append re \\s*(\\d\\d?) + dict set fieldSet hour [incr fieldCount] + append postcode "dict set date hour \[" \ + "::scan \$field" [incr captureCount] " %d" \ + "\]\n" + } + I - l { # Hour, AM/PM + append re \\s*(\\d\\d?) + dict set fieldSet hourAMPM [incr fieldCount] + append postcode "dict set date hourAMPM \[" \ + "::scan \$field" [incr captureCount] " %d" \ + "\]\n" + } + j { # Day of year + append re \\s*(\\d\\d?\\d?) + dict set fieldSet dayOfYear [incr fieldCount] + append postcode "dict set date dayOfYear \[" \ + "::scan \$field" [incr captureCount] " %d" \ + "\]\n" + } + J { # Julian Day Number + append re \\s*(\\d+) + dict set fieldSet julianDay [incr fieldCount] + append postcode "dict set date julianDay \[" \ + "::scan \$field" [incr captureCount] " %ld" \ + "\]\n" + } + m - N { # Month number + append re \\s*(\\d\\d?) + dict set fieldSet month [incr fieldCount] + append postcode "dict set date month \[" \ + "::scan \$field" [incr captureCount] " %d" \ + "\]\n" + } + M { # Minute + append re \\s*(\\d\\d?) + dict set fieldSet minute [incr fieldCount] + append postcode "dict set date minute \[" \ + "::scan \$field" [incr captureCount] " %d" \ + "\]\n" + } + n { # Literal newline + append re \\n + } + O { # Prefix for locale numerics + set state %O + } + p - P { # AM/PM indicator + set l [list [string tolower [mc AM]] 0 \ + [string tolower [mc PM]] 1] + lassign [UniquePrefixRegexp $l] regex lookup + append re ( $regex ) + dict set fieldSet amPmIndicator [incr fieldCount] + append postcode "dict set date amPmIndicator \[" \ + "dict get " [list $lookup] " \[string tolower " \ + "\$field" \ + [incr captureCount] \ + "\]\]\n" + } + Q { # Hi, Jeff! + append re {Stardate\s+([-+]?\d+)(\d\d\d)[.](\d)} + incr captureCount + dict set fieldSet seconds [incr fieldCount] + append postcode {dict set date seconds } \[ \ + {ParseStarDate $field} [incr captureCount] \ + { $field} [incr captureCount] \ + { $field} [incr captureCount] \ + \] \n + } + s { # Seconds from Posix Epoch + # This next case is insanely difficult, because it's + # problematic to determine whether the field is + # actually within the range of a wide integer. + append re {\s*([-+]?\d+)} + dict set fieldSet seconds [incr fieldCount] + append postcode {dict set date seconds } \[ \ + {ScanWide $field} [incr captureCount] \] \n + } + S { # Second + append re \\s*(\\d\\d?) + dict set fieldSet second [incr fieldCount] + append postcode "dict set date second \[" \ + "::scan \$field" [incr captureCount] " %d" \ + "\]\n" + } + t { # Literal tab character + append re \\t + } + u - w { # Day number within week, 0 or 7 == Sun + # 1=Mon, 6=Sat + append re \\s*(\\d) + dict set fieldSet dayOfWeek [incr fieldCount] + append postcode {::scan $field} [incr captureCount] \ + { %d dow} \n \ + { + if { $dow == 0 } { + set dow 7 + } elseif { $dow > 7 } { + return -code error \ + -errorcode [list CLOCK badDayOfWeek] \ + "day of week is greater than 7" + } + dict set date dayOfWeek $dow + } + } + U { # Week of year. The first Sunday of + # the year is the first day of week + # 01. No scan rule uses this group. + append re \\s*\\d\\d? + } + V { # Week of ISO8601 year + + append re \\s*(\\d\\d?) + dict set fieldSet iso8601Week [incr fieldCount] + append postcode "dict set date iso8601Week \[" \ + "::scan \$field" [incr captureCount] " %d" \ + "\]\n" + } + W { # Week of the year (00-53). The first + # Monday of the year is the first day + # of week 01. No scan rule uses this + # group. + append re \\s*\\d\\d? + } + y { # Two-digit Gregorian year + append re \\s*(\\d\\d?) + dict set fieldSet yearOfCentury [incr fieldCount] + append postcode "dict set date yearOfCentury \[" \ + "::scan \$field" [incr captureCount] " %d" \ + "\]\n" + } + Y { # 4-digit Gregorian year + append re \\s*(\\d\\d)(\\d\\d) + dict set fieldSet century [incr fieldCount] + dict set fieldSet yearOfCentury [incr fieldCount] + append postcode \ + "dict set date century \[" \ + "::scan \$field" [incr captureCount] " %d" \ + "\]\n" \ + "dict set date yearOfCentury \[" \ + "::scan \$field" [incr captureCount] " %d" \ + "\]\n" + } + z - Z { # Time zone name + append re {(?:([-+]\d\d(?::?\d\d(?::?\d\d)?)?)|([[:alnum:]]{1,4}))} + dict set fieldSet tzName [incr fieldCount] + append postcode \ + {if } \{ { $field} [incr captureCount] \ + { ne "" } \} { } \{ \n \ + {dict set date tzName $field} \ + $captureCount \n \ + \} { else } \{ \n \ + {dict set date tzName } \[ \ + {ConvertLegacyTimeZone $field} \ + [incr captureCount] \] \n \ + \} \n \ + } + % { # Literal percent character + append re % + } + default { + append re % + if { ! [string is alnum $c] } { + append re \\ + } + append re $c + } + } + } + %E { + switch -exact -- $c { + C { # Locale-dependent era + set d {} + foreach triple [mc LOCALE_ERAS] { + lassign $triple t symbol year + dict set d [string tolower $symbol] $year + } + lassign [UniquePrefixRegexp $d] regex lookup + append re (?: $regex ) + } + E { + set l {} + dict set l [string tolower [mc BCE]] BCE + dict set l [string tolower [mc CE]] CE + dict set l b.c.e. BCE + dict set l c.e. CE + dict set l b.c. BCE + dict set l a.d. CE + lassign [UniquePrefixRegexp $l] regex lookup + append re ( $regex ) + dict set fieldSet era [incr fieldCount] + append postcode "dict set date era \["\ + "dict get " [list $lookup] \ + { } \[ {string tolower $field} \ + [incr captureCount] \] \ + "\]\n" + } + y { # Locale-dependent year of the era + lassign [LocaleNumeralMatcher $locale] regex lookup + append re $regex + incr captureCount + } + default { + append re %E + if { ! [string is alnum $c] } { + append re \\ + } + append re $c + } + } + set state {} + } + %O { + switch -exact -- $c { + d - e { + lassign [LocaleNumeralMatcher $locale] regex lookup + append re $regex + dict set fieldSet dayOfMonth [incr fieldCount] + append postcode "dict set date dayOfMonth \[" \ + "dict get " [list $lookup] " \$field" \ + [incr captureCount] \ + "\]\n" + } + H - k { + lassign [LocaleNumeralMatcher $locale] regex lookup + append re $regex + dict set fieldSet hour [incr fieldCount] + append postcode "dict set date hour \[" \ + "dict get " [list $lookup] " \$field" \ + [incr captureCount] \ + "\]\n" + } + I - l { + lassign [LocaleNumeralMatcher $locale] regex lookup + append re $regex + dict set fieldSet hourAMPM [incr fieldCount] + append postcode "dict set date hourAMPM \[" \ + "dict get " [list $lookup] " \$field" \ + [incr captureCount] \ + "\]\n" + } + m { + lassign [LocaleNumeralMatcher $locale] regex lookup + append re $regex + dict set fieldSet month [incr fieldCount] + append postcode "dict set date month \[" \ + "dict get " [list $lookup] " \$field" \ + [incr captureCount] \ + "\]\n" + } + M { + lassign [LocaleNumeralMatcher $locale] regex lookup + append re $regex + dict set fieldSet minute [incr fieldCount] + append postcode "dict set date minute \[" \ + "dict get " [list $lookup] " \$field" \ + [incr captureCount] \ + "\]\n" + } + S { + lassign [LocaleNumeralMatcher $locale] regex lookup + append re $regex + dict set fieldSet second [incr fieldCount] + append postcode "dict set date second \[" \ + "dict get " [list $lookup] " \$field" \ + [incr captureCount] \ + "\]\n" + } + u - w { + lassign [LocaleNumeralMatcher $locale] regex lookup + append re $regex + dict set fieldSet dayOfWeek [incr fieldCount] + append postcode "set dow \[dict get " [list $lookup] \ + { $field} [incr captureCount] \] \n \ + { + if { $dow == 0 } { + set dow 7 + } elseif { $dow > 7 } { + return -code error \ + -errorcode [list CLOCK badDayOfWeek] \ + "day of week is greater than 7" + } + dict set date dayOfWeek $dow + } + } + y { + lassign [LocaleNumeralMatcher $locale] regex lookup + append re $regex + dict set fieldSet yearOfCentury [incr fieldCount] + append postcode {dict set date yearOfCentury } \[ \ + {dict get } [list $lookup] { $field} \ + [incr captureCount] \] \n + } + default { + append re %O + if { ! [string is alnum $c] } { + append re \\ + } + append re $c + } + } + set state {} + } + } + } + + # Clean up any unfinished format groups + + append re $state \\s*\$ + + # Build the procedure + + set procBody {} + append procBody "variable ::tcl::clock::TZData" \n + append procBody "if \{ !\[ regexp -nocase [list $re] \$string ->" + for { set i 1 } { $i <= $captureCount } { incr i } { + append procBody " " field $i + } + append procBody "\] \} \{" \n + append procBody { + return -code error -errorcode [list CLOCK badInputString] \ + {input string does not match supplied format} + } + append procBody \}\n + append procBody "set date \[dict create\]" \n + append procBody {dict set date tzName $timeZone} \n + append procBody $postcode + append procBody [list set changeover [mc GREGORIAN_CHANGE_DATE]] \n + + # Set up the time zone before doing anything with a default base date + # that might need a timezone to interpret it. + + if { ![dict exists $fieldSet seconds] + && ![dict exists $fieldSet starDate] } { + if { [dict exists $fieldSet tzName] } { + append procBody { + set timeZone [dict get $date tzName] + } + } + append procBody { + ::tcl::clock::SetupTimeZone $timeZone + } + } + + # Add code that gets Julian Day Number from the fields. + + append procBody [MakeParseCodeFromFields $fieldSet $DateParseActions] + + # Get time of day + + append procBody [MakeParseCodeFromFields $fieldSet $TimeParseActions] + + # Assemble seconds from the Julian day and second of the day. + # Convert to local time unless epoch seconds or stardate are + # being processed - they're always absolute + + if { ![dict exists $fieldSet seconds] + && ![dict exists $fieldSet starDate] } { + append procBody { + if { [dict get $date julianDay] > 5373484 } { + return -code error -errorcode [list CLOCK dateTooLarge] \ + "requested date too large to represent" + } + dict set date localSeconds [expr { + -210866803200 + + ( 86400 * wide([dict get $date julianDay]) ) + + [dict get $date secondOfDay] + }] + } + + # Finally, convert the date to local time + + append procBody { + set date [::tcl::clock::ConvertLocalToUTC $date[set date {}] \ + $TZData($timeZone) $changeover] + } + } + + # Return result + + append procBody {return [dict get $date seconds]} \n + + proc $procName { string baseTime timeZone } $procBody + + # puts [list proc $procName [list string baseTime timeZone] $procBody] + + return $procName +} + +#---------------------------------------------------------------------- +# +# LocaleNumeralMatcher -- +# +# Composes a regexp that captures the numerals in the given locale, and +# a dictionary to map them to conventional numerals. +# +# Parameters: +# locale - Name of the current locale +# +# Results: +# Returns a two-element list comprising the regexp and the dictionary. +# +# Side effects: +# Caches the result. +# +#---------------------------------------------------------------------- + +proc ::tcl::clock::LocaleNumeralMatcher {l} { + variable LocaleNumeralCache + + if { ![dict exists $LocaleNumeralCache $l] } { + set d {} + set i 0 + set sep \( + foreach n [mc LOCALE_NUMERALS] { + dict set d $n $i + regsub -all {[^[:alnum:]]} $n \\\\& subex + append re $sep $subex + set sep | + incr i + } + append re \) + dict set LocaleNumeralCache $l [list $re $d] + } + return [dict get $LocaleNumeralCache $l] +} + + + +#---------------------------------------------------------------------- +# +# UniquePrefixRegexp -- +# +# Composes a regexp that performs unique-prefix matching. The RE +# matches one of a supplied set of strings, or any unique prefix +# thereof. +# +# Parameters: +# data - List of alternating match-strings and values. +# Match-strings with distinct values are considered +# distinct. +# +# Results: +# Returns a two-element list. The first is a regexp that matches any +# unique prefix of any of the strings. The second is a dictionary whose +# keys are match values from the regexp and whose values are the +# corresponding values from 'data'. +# +# Side effects: +# None. +# +#---------------------------------------------------------------------- + +proc ::tcl::clock::UniquePrefixRegexp { data } { + # The 'successors' dictionary will contain, for each string that is a + # prefix of any key, all characters that may follow that prefix. The + # 'prefixMapping' dictionary will have keys that are prefixes of keys and + # values that correspond to the keys. + + set prefixMapping [dict create] + set successors [dict create {} {}] + + # Walk the key-value pairs + + foreach { key value } $data { + # Construct all prefixes of the key; + + set prefix {} + foreach char [split $key {}] { + set oldPrefix $prefix + dict set successors $oldPrefix $char {} + append prefix $char + + # Put the prefixes in the 'prefixMapping' and 'successors' + # dictionaries + + dict lappend prefixMapping $prefix $value + if { ![dict exists $successors $prefix] } { + dict set successors $prefix {} + } + } + } + + # Identify those prefixes that designate unique values, and those that are + # the full keys + + set uniquePrefixMapping {} + dict for { key valueList } $prefixMapping { + if { [llength $valueList] == 1 } { + dict set uniquePrefixMapping $key [lindex $valueList 0] + } + } + foreach { key value } $data { + dict set uniquePrefixMapping $key $value + } + + # Construct the re. + + return [list \ + [MakeUniquePrefixRegexp $successors $uniquePrefixMapping {}] \ + $uniquePrefixMapping] +} + +#---------------------------------------------------------------------- +# +# MakeUniquePrefixRegexp -- +# +# Service procedure for 'UniquePrefixRegexp' that constructs a regular +# expresison that matches the unique prefixes. +# +# Parameters: +# successors - Dictionary whose keys are all prefixes +# of keys passed to 'UniquePrefixRegexp' and whose +# values are dictionaries whose keys are the characters +# that may follow those prefixes. +# uniquePrefixMapping - Dictionary whose keys are the unique +# prefixes and whose values are not examined. +# prefixString - Current prefix being processed. +# +# Results: +# Returns a constructed regular expression that matches the set of +# unique prefixes beginning with the 'prefixString'. +# +# Side effects: +# None. +# +#---------------------------------------------------------------------- + +proc ::tcl::clock::MakeUniquePrefixRegexp { successors + uniquePrefixMapping + prefixString } { + + # Get the characters that may follow the current prefix string + + set schars [lsort -ascii [dict keys [dict get $successors $prefixString]]] + if { [llength $schars] == 0 } { + return {} + } + + # If there is more than one successor character, or if the current prefix + # is a unique prefix, surround the generated re with non-capturing + # parentheses. + + set re {} + if { + [dict exists $uniquePrefixMapping $prefixString] + || [llength $schars] > 1 + } then { + append re "(?:" + } + + # Generate a regexp that matches the successors. + + set sep "" + foreach { c } $schars { + set nextPrefix $prefixString$c + regsub -all {[^[:alnum:]]} $c \\\\& rechar + append re $sep $rechar \ + [MakeUniquePrefixRegexp \ + $successors $uniquePrefixMapping $nextPrefix] + set sep | + } + + # If the current prefix is a unique prefix, make all following text + # optional. Otherwise, if there is more than one successor character, + # close the non-capturing parentheses. + + if { [dict exists $uniquePrefixMapping $prefixString] } { + append re ")?" + } elseif { [llength $schars] > 1 } { + append re ")" + } + + return $re +} + +#---------------------------------------------------------------------- +# +# MakeParseCodeFromFields -- +# +# Composes Tcl code to extract the Julian Day Number from a dictionary +# containing date fields. +# +# Parameters: +# dateFields -- Dictionary whose keys are fields of the date, +# and whose values are the rightmost positions +# at which those fields appear. +# parseActions -- List of triples: field set, priority, and +# code to emit. Smaller priorities are better, and +# the list must be in ascending order by priority +# +# Results: +# Returns a burst of code that extracts the day number from the given +# date. +# +# Side effects: +# None. +# +#---------------------------------------------------------------------- + +proc ::tcl::clock::MakeParseCodeFromFields { dateFields parseActions } { + + set currPrio 999 + set currFieldPos [list] + set currCodeBurst { + error "in ::tcl::clock::MakeParseCodeFromFields: can't happen" + } + + foreach { fieldSet prio parseAction } $parseActions { + # If we've found an answer that's better than any that follow, quit + # now. + + if { $prio > $currPrio } { + break + } + + # Accumulate the field positions that are used in the current field + # grouping. + + set fieldPos [list] + set ok true + foreach field $fieldSet { + if { ! [dict exists $dateFields $field] } { + set ok 0 + break + } + lappend fieldPos [dict get $dateFields $field] + } + + # Quit if we don't have a complete set of fields + if { !$ok } { + continue + } + + # Determine whether the current answer is better than the last. + + set fPos [lsort -integer -decreasing $fieldPos] + + if { $prio == $currPrio } { + foreach currPos $currFieldPos newPos $fPos { + if { + ![string is integer $newPos] + || ![string is integer $currPos] + || $newPos > $currPos + } then { + break + } + if { $newPos < $currPos } { + set ok 0 + break + } + } + } + if { !$ok } { + continue + } + + # Remember the best possibility for extracting date information + + set currPrio $prio + set currFieldPos $fPos + set currCodeBurst $parseAction + } + + return $currCodeBurst +} + +#---------------------------------------------------------------------- +# +# EnterLocale -- +# +# Switch [mclocale] to a given locale if necessary +# +# Parameters: +# locale -- Desired locale +# +# Results: +# Returns the locale that was previously current. +# +# Side effects: +# Does [mclocale]. If necessary, loads the designated locale's files. +# +#---------------------------------------------------------------------- + +proc ::tcl::clock::EnterLocale { locale } { + if { $locale eq {system} } { + if { $::tcl_platform(platform) ne {windows} } { + # On a non-windows platform, the 'system' locale is the same as + # the 'current' locale + + set locale current + } else { + # On a windows platform, the 'system' locale is adapted from the + # 'current' locale by applying the date and time formats from the + # Control Panel. First, load the 'current' locale if it's not yet + # loaded + + mcpackagelocale set [mclocale] + + # Make a new locale string for the system locale, and get the + # Control Panel information + + set locale [mclocale]_windows + if { ! [mcpackagelocale present $locale] } { + LoadWindowsDateTimeFormats $locale + } + } + } + if { $locale eq {current}} { + set locale [mclocale] + } + # Eventually load the locale + mcpackagelocale set $locale +} + +#---------------------------------------------------------------------- +# +# LoadWindowsDateTimeFormats -- +# +# Load the date/time formats from the Control Panel in Windows and +# convert them so that they're usable by Tcl. +# +# Parameters: +# locale - Name of the locale in whose message catalog +# the converted formats are to be stored. +# +# Results: +# None. +# +# Side effects: +# Updates the given message catalog with the locale strings. +# +# Presumes that on entry, [mclocale] is set to the current locale, so that +# default strings can be obtained if the Registry query fails. +# +#---------------------------------------------------------------------- + +proc ::tcl::clock::LoadWindowsDateTimeFormats { locale } { + # Bail out if we can't find the Registry + + variable NoRegistry + if { [info exists NoRegistry] } return + + if { ![catch { + registry get "HKEY_CURRENT_USER\\Control Panel\\International" \ + sShortDate + } string] } { + set quote {} + set datefmt {} + foreach { unquoted quoted } [split $string '] { + append datefmt $quote [string map { + dddd %A + ddd %a + dd %d + d %e + MMMM %B + MMM %b + MM %m + M %N + yyyy %Y + yy %y + y %y + gg {} + } $unquoted] + if { $quoted eq {} } { + set quote ' + } else { + set quote $quoted + } + } + ::msgcat::mcset $locale DATE_FORMAT $datefmt + } + + if { ![catch { + registry get "HKEY_CURRENT_USER\\Control Panel\\International" \ + sLongDate + } string] } { + set quote {} + set ldatefmt {} + foreach { unquoted quoted } [split $string '] { + append ldatefmt $quote [string map { + dddd %A + ddd %a + dd %d + d %e + MMMM %B + MMM %b + MM %m + M %N + yyyy %Y + yy %y + y %y + gg {} + } $unquoted] + if { $quoted eq {} } { + set quote ' + } else { + set quote $quoted + } + } + ::msgcat::mcset $locale LOCALE_DATE_FORMAT $ldatefmt + } + + if { ![catch { + registry get "HKEY_CURRENT_USER\\Control Panel\\International" \ + sTimeFormat + } string] } { + set quote {} + set timefmt {} + foreach { unquoted quoted } [split $string '] { + append timefmt $quote [string map { + HH %H + H %k + hh %I + h %l + mm %M + m %M + ss %S + s %S + tt %p + t %p + } $unquoted] + if { $quoted eq {} } { + set quote ' + } else { + set quote $quoted + } + } + ::msgcat::mcset $locale TIME_FORMAT $timefmt + } + + catch { + ::msgcat::mcset $locale DATE_TIME_FORMAT "$datefmt $timefmt" + } + catch { + ::msgcat::mcset $locale LOCALE_DATE_TIME_FORMAT "$ldatefmt $timefmt" + } + + return + +} + +#---------------------------------------------------------------------- +# +# LocalizeFormat -- +# +# Map away locale-dependent format groups in a clock format. +# +# Parameters: +# locale -- Current [mclocale] locale, supplied to avoid +# an extra call +# format -- Format supplied to [clock scan] or [clock format] +# +# Results: +# Returns the string with locale-dependent composite format groups +# substituted out. +# +# Side effects: +# None. +# +#---------------------------------------------------------------------- + +proc ::tcl::clock::LocalizeFormat { locale format } { + + # message catalog key to cache this format + set key FORMAT_$format + + if { [::msgcat::mcexists -exactlocale -exactnamespace $key] } { + return [mc $key] + } + # Handle locale-dependent format groups by mapping them out of the format + # string. Note that the order of the [string map] operations is + # significant because later formats can refer to later ones; for example + # %c can refer to %X, which in turn can refer to %T. + + set list { + %% %% + %D %m/%d/%Y + %+ {%a %b %e %H:%M:%S %Z %Y} + } + lappend list %EY [string map $list [mc LOCALE_YEAR_FORMAT]] + lappend list %T [string map $list [mc TIME_FORMAT_24_SECS]] + lappend list %R [string map $list [mc TIME_FORMAT_24]] + lappend list %r [string map $list [mc TIME_FORMAT_12]] + lappend list %X [string map $list [mc TIME_FORMAT]] + lappend list %EX [string map $list [mc LOCALE_TIME_FORMAT]] + lappend list %x [string map $list [mc DATE_FORMAT]] + lappend list %Ex [string map $list [mc LOCALE_DATE_FORMAT]] + lappend list %c [string map $list [mc DATE_TIME_FORMAT]] + lappend list %Ec [string map $list [mc LOCALE_DATE_TIME_FORMAT]] + set format [string map $list $format] + + ::msgcat::mcset $locale $key $format + return $format +} + +#---------------------------------------------------------------------- +# +# FormatNumericTimeZone -- +# +# Formats a time zone as +hhmmss +# +# Parameters: +# z - Time zone in seconds east of Greenwich +# +# Results: +# Returns the time zone formatted in a numeric form +# +# Side effects: +# None. +# +#---------------------------------------------------------------------- + +proc ::tcl::clock::FormatNumericTimeZone { z } { + if { $z < 0 } { + set z [expr { - $z }] + set retval - + } else { + set retval + + } + append retval [::format %02d [expr { $z / 3600 }]] + set z [expr { $z % 3600 }] + append retval [::format %02d [expr { $z / 60 }]] + set z [expr { $z % 60 }] + if { $z != 0 } { + append retval [::format %02d $z] + } + return $retval +} + +#---------------------------------------------------------------------- +# +# FormatStarDate -- +# +# Formats a date as a StarDate. +# +# Parameters: +# date - Dictionary containing 'year', 'dayOfYear', and +# 'localSeconds' fields. +# +# Results: +# Returns the given date formatted as a StarDate. +# +# Side effects: +# None. +# +# Jeff Hobbs put this in to support an atrocious pun about Tcl being +# "Enterprise ready." Now we're stuck with it. +# +#---------------------------------------------------------------------- + +proc ::tcl::clock::FormatStarDate { date } { + variable Roddenberry + + # Get day of year, zero based + + set doy [expr { [dict get $date dayOfYear] - 1 }] + + # Determine whether the year is a leap year + + set lp [IsGregorianLeapYear $date] + + # Convert day of year to a fractional year + + if { $lp } { + set fractYear [expr { 1000 * $doy / 366 }] + } else { + set fractYear [expr { 1000 * $doy / 365 }] + } + + # Put together the StarDate + + return [::format "Stardate %02d%03d.%1d" \ + [expr { [dict get $date year] - $Roddenberry }] \ + $fractYear \ + [expr { [dict get $date localSeconds] % 86400 + / ( 86400 / 10 ) }]] +} + +#---------------------------------------------------------------------- +# +# ParseStarDate -- +# +# Parses a StarDate +# +# Parameters: +# year - Year from the Roddenberry epoch +# fractYear - Fraction of a year specifying the day of year. +# fractDay - Fraction of a day +# +# Results: +# Returns a count of seconds from the Posix epoch. +# +# Side effects: +# None. +# +# Jeff Hobbs put this in to support an atrocious pun about Tcl being +# "Enterprise ready." Now we're stuck with it. +# +#---------------------------------------------------------------------- + +proc ::tcl::clock::ParseStarDate { year fractYear fractDay } { + variable Roddenberry + + # Build a tentative date from year and fraction. + + set date [dict create \ + gregorian 1 \ + era CE \ + year [expr { $year + $Roddenberry }] \ + dayOfYear [expr { $fractYear * 365 / 1000 + 1 }]] + set date [GetJulianDayFromGregorianEraYearDay $date[set date {}]] + + # Determine whether the given year is a leap year + + set lp [IsGregorianLeapYear $date] + + # Reconvert the fractional year according to whether the given year is a + # leap year + + if { $lp } { + dict set date dayOfYear \ + [expr { $fractYear * 366 / 1000 + 1 }] + } else { + dict set date dayOfYear \ + [expr { $fractYear * 365 / 1000 + 1 }] + } + dict unset date julianDay + dict unset date gregorian + set date [GetJulianDayFromGregorianEraYearDay $date[set date {}]] + + return [expr { + 86400 * [dict get $date julianDay] + - 210866803200 + + ( 86400 / 10 ) * $fractDay + }] +} + +#---------------------------------------------------------------------- +# +# ScanWide -- +# +# Scans a wide integer from an input +# +# Parameters: +# str - String containing a decimal wide integer +# +# Results: +# Returns the string as a pure wide integer. Throws an error if the +# string is misformatted or out of range. +# +#---------------------------------------------------------------------- + +proc ::tcl::clock::ScanWide { str } { + set count [::scan $str {%ld %c} result junk] + if { $count != 1 } { + return -code error -errorcode [list CLOCK notAnInteger $str] \ + "\"$str\" is not an integer" + } + if { [incr result 0] != $str } { + return -code error -errorcode [list CLOCK integervalueTooLarge] \ + "integer value too large to represent" + } + return $result +} + +#---------------------------------------------------------------------- +# +# InterpretTwoDigitYear -- +# +# Given a date that contains only the year of the century, determines +# the target value of a two-digit year. +# +# Parameters: +# date - Dictionary containing fields of the date. +# baseTime - Base time relative to which the date is expressed. +# twoDigitField - Name of the field that stores the two-digit year. +# Default is 'yearOfCentury' +# fourDigitField - Name of the field that will receive the four-digit +# year. Default is 'year' +# +# Results: +# Returns the dictionary augmented with the four-digit year, stored in +# the given key. +# +# Side effects: +# None. +# +# The current rule for interpreting a two-digit year is that the year shall be +# between 1937 and 2037, thus staying within the range of a 32-bit signed +# value for time. This rule may change to a sliding window in future +# versions, so the 'baseTime' parameter (which is currently ignored) is +# provided in the procedure signature. +# +#---------------------------------------------------------------------- + +proc ::tcl::clock::InterpretTwoDigitYear { date baseTime + { twoDigitField yearOfCentury } + { fourDigitField year } } { + set yr [dict get $date $twoDigitField] + if { $yr <= 37 } { + dict set date $fourDigitField [expr { $yr + 2000 }] + } else { + dict set date $fourDigitField [expr { $yr + 1900 }] + } + return $date +} + +#---------------------------------------------------------------------- +# +# AssignBaseYear -- +# +# Places the number of the current year into a dictionary. +# +# Parameters: +# date - Dictionary value to update +# baseTime - Base time from which to extract the year, expressed +# in seconds from the Posix epoch +# timezone - the time zone in which the date is being scanned +# changeover - the Julian Day on which the Gregorian calendar +# was adopted in the target locale. +# +# Results: +# Returns the dictionary with the current year assigned. +# +# Side effects: +# None. +# +#---------------------------------------------------------------------- + +proc ::tcl::clock::AssignBaseYear { date baseTime timezone changeover } { + variable TZData + + # Find the Julian Day Number corresponding to the base time, and + # find the Gregorian year corresponding to that Julian Day. + + set date2 [GetDateFields $baseTime $TZData($timezone) $changeover] + + # Store the converted year + + dict set date era [dict get $date2 era] + dict set date year [dict get $date2 year] + + return $date +} + +#---------------------------------------------------------------------- +# +# AssignBaseIso8601Year -- +# +# Determines the base year in the ISO8601 fiscal calendar. +# +# Parameters: +# date - Dictionary containing the fields of the date that +# is to be augmented with the base year. +# baseTime - Base time expressed in seconds from the Posix epoch. +# timeZone - Target time zone +# changeover - Julian Day of adoption of the Gregorian calendar in +# the target locale. +# +# Results: +# Returns the given date with "iso8601Year" set to the +# base year. +# +# Side effects: +# None. +# +#---------------------------------------------------------------------- + +proc ::tcl::clock::AssignBaseIso8601Year {date baseTime timeZone changeover} { + variable TZData + + # Find the Julian Day Number corresponding to the base time + + set date2 [GetDateFields $baseTime $TZData($timeZone) $changeover] + + # Calculate the ISO8601 date and transfer the year + + dict set date era CE + dict set date iso8601Year [dict get $date2 iso8601Year] + return $date +} + +#---------------------------------------------------------------------- +# +# AssignBaseMonth -- +# +# Places the number of the current year and month into a +# dictionary. +# +# Parameters: +# date - Dictionary value to update +# baseTime - Time from which the year and month are to be +# obtained, expressed in seconds from the Posix epoch. +# timezone - Name of the desired time zone +# changeover - Julian Day on which the Gregorian calendar was adopted. +# +# Results: +# Returns the dictionary with the base year and month assigned. +# +# Side effects: +# None. +# +#---------------------------------------------------------------------- + +proc ::tcl::clock::AssignBaseMonth {date baseTime timezone changeover} { + variable TZData + + # Find the year and month corresponding to the base time + + set date2 [GetDateFields $baseTime $TZData($timezone) $changeover] + dict set date era [dict get $date2 era] + dict set date year [dict get $date2 year] + dict set date month [dict get $date2 month] + return $date +} + +#---------------------------------------------------------------------- +# +# AssignBaseWeek -- +# +# Determines the base year and week in the ISO8601 fiscal calendar. +# +# Parameters: +# date - Dictionary containing the fields of the date that +# is to be augmented with the base year and week. +# baseTime - Base time expressed in seconds from the Posix epoch. +# changeover - Julian Day on which the Gregorian calendar was adopted +# in the target locale. +# +# Results: +# Returns the given date with "iso8601Year" set to the +# base year and "iso8601Week" to the week number. +# +# Side effects: +# None. +# +#---------------------------------------------------------------------- + +proc ::tcl::clock::AssignBaseWeek {date baseTime timeZone changeover} { + variable TZData + + # Find the Julian Day Number corresponding to the base time + + set date2 [GetDateFields $baseTime $TZData($timeZone) $changeover] + + # Calculate the ISO8601 date and transfer the year + + dict set date era CE + dict set date iso8601Year [dict get $date2 iso8601Year] + dict set date iso8601Week [dict get $date2 iso8601Week] + return $date +} + +#---------------------------------------------------------------------- +# +# AssignBaseJulianDay -- +# +# Determines the base day for a time-of-day conversion. +# +# Parameters: +# date - Dictionary that is to get the base day +# baseTime - Base time expressed in seconds from the Posix epoch +# changeover - Julian day on which the Gregorian calendar was +# adpoted in the target locale. +# +# Results: +# Returns the given dictionary augmented with a 'julianDay' field +# that contains the base day. +# +# Side effects: +# None. +# +#---------------------------------------------------------------------- + +proc ::tcl::clock::AssignBaseJulianDay { date baseTime timeZone changeover } { + variable TZData + + # Find the Julian Day Number corresponding to the base time + + set date2 [GetDateFields $baseTime $TZData($timeZone) $changeover] + dict set date julianDay [dict get $date2 julianDay] + + return $date +} + +#---------------------------------------------------------------------- +# +# InterpretHMSP -- +# +# Interprets a time in the form "hh:mm:ss am". +# +# Parameters: +# date -- Dictionary containing "hourAMPM", "minute", "second" +# and "amPmIndicator" fields. +# +# Results: +# Returns the number of seconds from local midnight. +# +# Side effects: +# None. +# +#---------------------------------------------------------------------- + +proc ::tcl::clock::InterpretHMSP { date } { + set hr [dict get $date hourAMPM] + if { $hr == 12 } { + set hr 0 + } + if { [dict get $date amPmIndicator] } { + incr hr 12 + } + dict set date hour $hr + return [InterpretHMS $date[set date {}]] +} + +#---------------------------------------------------------------------- +# +# InterpretHMS -- +# +# Interprets a 24-hour time "hh:mm:ss" +# +# Parameters: +# date -- Dictionary containing the "hour", "minute" and "second" +# fields. +# +# Results: +# Returns the given dictionary augmented with a "secondOfDay" +# field containing the number of seconds from local midnight. +# +# Side effects: +# None. +# +#---------------------------------------------------------------------- + +proc ::tcl::clock::InterpretHMS { date } { + return [expr { + ( [dict get $date hour] * 60 + + [dict get $date minute] ) * 60 + + [dict get $date second] + }] +} + +#---------------------------------------------------------------------- +# +# GetSystemTimeZone -- +# +# Determines the system time zone, which is the default for the +# 'clock' command if no other zone is supplied. +# +# Parameters: +# None. +# +# Results: +# Returns the system time zone. +# +# Side effects: +# Stores the system time zone in the 'CachedSystemTimeZone' +# variable, since determining it may be an expensive process. +# +#---------------------------------------------------------------------- + +proc ::tcl::clock::GetSystemTimeZone {} { + variable CachedSystemTimeZone + variable TimeZoneBad + + if {[set result [getenv TCL_TZ]] ne {}} { + set timezone $result + } elseif {[set result [getenv TZ]] ne {}} { + set timezone $result + } else { + # Cache the time zone only if it was detected by one of the + # expensive methods. + if { [info exists CachedSystemTimeZone] } { + set timezone $CachedSystemTimeZone + } elseif { $::tcl_platform(platform) eq {windows} } { + set timezone [GuessWindowsTimeZone] + } elseif { [file exists /etc/localtime] + && ![catch {ReadZoneinfoFile \ + Tcl/Localtime /etc/localtime}] } { + set timezone :Tcl/Localtime + } else { + set timezone :localtime + } + set CachedSystemTimeZone $timezone + } + if { ![dict exists $TimeZoneBad $timezone] } { + dict set TimeZoneBad $timezone [catch {SetupTimeZone $timezone}] + } + if { [dict get $TimeZoneBad $timezone] } { + return :localtime + } else { + return $timezone + } +} + +#---------------------------------------------------------------------- +# +# ConvertLegacyTimeZone -- +# +# Given an alphanumeric time zone identifier and the system time zone, +# convert the alphanumeric identifier to an unambiguous time zone. +# +# Parameters: +# tzname - Name of the time zone to convert +# +# Results: +# Returns a time zone name corresponding to tzname, but in an +# unambiguous form, generally +hhmm. +# +# This procedure is implemented primarily to allow the parsing of RFC822 +# date/time strings. Processing a time zone name on input is not recommended +# practice, because there is considerable room for ambiguity; for instance, is +# BST Brazilian Standard Time, or British Summer Time? +# +#---------------------------------------------------------------------- + +proc ::tcl::clock::ConvertLegacyTimeZone { tzname } { + variable LegacyTimeZone + + set tzname [string tolower $tzname] + if { ![dict exists $LegacyTimeZone $tzname] } { + return -code error -errorcode [list CLOCK badTZName $tzname] \ + "time zone \"$tzname\" not found" + } + return [dict get $LegacyTimeZone $tzname] +} + +#---------------------------------------------------------------------- +# +# SetupTimeZone -- +# +# Given the name or specification of a time zone, sets up its in-memory +# data. +# +# Parameters: +# tzname - Name of a time zone +# +# Results: +# Unless the time zone is ':localtime', sets the TZData array to contain +# the lookup table for local<->UTC conversion. Returns an error if the +# time zone cannot be parsed. +# +#---------------------------------------------------------------------- + +proc ::tcl::clock::SetupTimeZone { timezone } { + variable TZData + + if {! [info exists TZData($timezone)] } { + variable MINWIDE + if { $timezone eq {:localtime} } { + # Nothing to do, we'll convert using the localtime function + + } elseif { + [regexp {^([-+])(\d\d)(?::?(\d\d)(?::?(\d\d))?)?} $timezone \ + -> s hh mm ss] + } then { + # Make a fixed offset + + ::scan $hh %d hh + if { $mm eq {} } { + set mm 0 + } else { + ::scan $mm %d mm + } + if { $ss eq {} } { + set ss 0 + } else { + ::scan $ss %d ss + } + set offset [expr { ( $hh * 60 + $mm ) * 60 + $ss }] + if { $s eq {-} } { + set offset [expr { - $offset }] + } + set TZData($timezone) [list [list $MINWIDE $offset -1 $timezone]] + + } elseif { [string index $timezone 0] eq {:} } { + # Convert using a time zone file + + if { + [catch { + LoadTimeZoneFile [string range $timezone 1 end] + }] && [catch { + LoadZoneinfoFile [string range $timezone 1 end] + }] + } then { + return -code error \ + -errorcode [list CLOCK badTimeZone $timezone] \ + "time zone \"$timezone\" not found" + } + } elseif { ![catch {ParsePosixTimeZone $timezone} tzfields] } { + # This looks like a POSIX time zone - try to process it + + if { [catch {ProcessPosixTimeZone $tzfields} data opts] } { + if { [lindex [dict get $opts -errorcode] 0] eq {CLOCK} } { + dict unset opts -errorinfo + } + return -options $opts $data + } else { + set TZData($timezone) $data + } + + } else { + # We couldn't parse this as a POSIX time zone. Try again with a + # time zone file - this time without a colon + + if { [catch { LoadTimeZoneFile $timezone }] + && [catch { LoadZoneinfoFile $timezone } - opts] } { + dict unset opts -errorinfo + return -options $opts "time zone $timezone not found" + } + set TZData($timezone) $TZData(:$timezone) + } + } + + return +} + +#---------------------------------------------------------------------- +# +# GuessWindowsTimeZone -- +# +# Determines the system time zone on windows. +# +# Parameters: +# None. +# +# Results: +# Returns a time zone specifier that corresponds to the system time zone +# information found in the Registry. +# +# Bugs: +# Fixed dates for DST change are unimplemented at present, because no +# time zone information supplied with Windows actually uses them! +# +# On a Windows system where neither $env(TCL_TZ) nor $env(TZ) is specified, +# GuessWindowsTimeZone looks in the Registry for the system time zone +# information. It then attempts to find an entry in WinZoneInfo for a time +# zone that uses the same rules. If it finds one, it returns it; otherwise, +# it constructs a Posix-style time zone string and returns that. +# +#---------------------------------------------------------------------- + +proc ::tcl::clock::GuessWindowsTimeZone {} { + variable WinZoneInfo + variable NoRegistry + variable TimeZoneBad + + if { [info exists NoRegistry] } { + return :localtime + } + + # Dredge time zone information out of the registry + + if { [catch { + set rpath HKEY_LOCAL_MACHINE\\System\\CurrentControlSet\\Control\\TimeZoneInformation + set data [list \ + [expr { -60 + * [registry get $rpath Bias] }] \ + [expr { -60 + * [registry get $rpath StandardBias] }] \ + [expr { -60 \ + * [registry get $rpath DaylightBias] }]] + set stdtzi [registry get $rpath StandardStart] + foreach ind {0 2 14 4 6 8 10 12} { + binary scan $stdtzi @${ind}s val + lappend data $val + } + set daytzi [registry get $rpath DaylightStart] + foreach ind {0 2 14 4 6 8 10 12} { + binary scan $daytzi @${ind}s val + lappend data $val + } + }] } { + # Missing values in the Registry - bail out + + return :localtime + } + + # Make up a Posix time zone specifier if we can't find one. Check here + # that the tzdata file exists, in case we're running in an environment + # (e.g. starpack) where tzdata is incomplete. (Bug 1237907) + + if { [dict exists $WinZoneInfo $data] } { + set tzname [dict get $WinZoneInfo $data] + if { ! [dict exists $TimeZoneBad $tzname] } { + dict set TimeZoneBad $tzname [catch {SetupTimeZone $tzname}] + } + } else { + set tzname {} + } + if { $tzname eq {} || [dict get $TimeZoneBad $tzname] } { + lassign $data \ + bias stdBias dstBias \ + stdYear stdMonth stdDayOfWeek stdDayOfMonth \ + stdHour stdMinute stdSecond stdMillisec \ + dstYear dstMonth dstDayOfWeek dstDayOfMonth \ + dstHour dstMinute dstSecond dstMillisec + set stdDelta [expr { $bias + $stdBias }] + set dstDelta [expr { $bias + $dstBias }] + if { $stdDelta <= 0 } { + set stdSignum + + set stdDelta [expr { - $stdDelta }] + set dispStdSignum - + } else { + set stdSignum - + set dispStdSignum + + } + set hh [::format %02d [expr { $stdDelta / 3600 }]] + set mm [::format %02d [expr { ($stdDelta / 60 ) % 60 }]] + set ss [::format %02d [expr { $stdDelta % 60 }]] + set tzname {} + append tzname < $dispStdSignum $hh $mm > $stdSignum $hh : $mm : $ss + if { $stdMonth >= 0 } { + if { $dstDelta <= 0 } { + set dstSignum + + set dstDelta [expr { - $dstDelta }] + set dispDstSignum - + } else { + set dstSignum - + set dispDstSignum + + } + set hh [::format %02d [expr { $dstDelta / 3600 }]] + set mm [::format %02d [expr { ($dstDelta / 60 ) % 60 }]] + set ss [::format %02d [expr { $dstDelta % 60 }]] + append tzname < $dispDstSignum $hh $mm > $dstSignum $hh : $mm : $ss + if { $dstYear == 0 } { + append tzname ,M $dstMonth . $dstDayOfMonth . $dstDayOfWeek + } else { + # I have not been able to find any locale on which Windows + # converts time zone on a fixed day of the year, hence don't + # know how to interpret the fields. If someone can inform me, + # I'd be glad to code it up. For right now, we bail out in + # such a case. + return :localtime + } + append tzname / [::format %02d $dstHour] \ + : [::format %02d $dstMinute] \ + : [::format %02d $dstSecond] + if { $stdYear == 0 } { + append tzname ,M $stdMonth . $stdDayOfMonth . $stdDayOfWeek + } else { + # I have not been able to find any locale on which Windows + # converts time zone on a fixed day of the year, hence don't + # know how to interpret the fields. If someone can inform me, + # I'd be glad to code it up. For right now, we bail out in + # such a case. + return :localtime + } + append tzname / [::format %02d $stdHour] \ + : [::format %02d $stdMinute] \ + : [::format %02d $stdSecond] + } + dict set WinZoneInfo $data $tzname + } + + return [dict get $WinZoneInfo $data] +} + +#---------------------------------------------------------------------- +# +# LoadTimeZoneFile -- +# +# Load the data file that specifies the conversion between a +# given time zone and Greenwich. +# +# Parameters: +# fileName -- Name of the file to load +# +# Results: +# None. +# +# Side effects: +# TZData(:fileName) contains the time zone data +# +#---------------------------------------------------------------------- + +proc ::tcl::clock::LoadTimeZoneFile { fileName } { + variable DataDir + variable TZData + + if { [info exists TZData($fileName)] } { + return + } + + # Since an unsafe interp uses the [clock] command in the parent, this code + # is security sensitive. Make sure that the path name cannot escape the + # given directory. + + if { ![regexp {^[[.-.][:alpha:]_]+(?:/[[.-.][:alpha:]_]+)*$} $fileName] } { + return -code error \ + -errorcode [list CLOCK badTimeZone $:fileName] \ + "time zone \":$fileName\" not valid" + } + try { + source -encoding utf-8 [file join $DataDir $fileName] + } on error {} { + return -code error \ + -errorcode [list CLOCK badTimeZone :$fileName] \ + "time zone \":$fileName\" not found" + } + return +} + +#---------------------------------------------------------------------- +# +# LoadZoneinfoFile -- +# +# Loads a binary time zone information file in Olson format. +# +# Parameters: +# fileName - Relative path name of the file to load. +# +# Results: +# Returns an empty result normally; returns an error if no Olson file +# was found or the file was malformed in some way. +# +# Side effects: +# TZData(:fileName) contains the time zone data +# +#---------------------------------------------------------------------- + +proc ::tcl::clock::LoadZoneinfoFile { fileName } { + variable ZoneinfoPaths + + # Since an unsafe interp uses the [clock] command in the parent, this code + # is security sensitive. Make sure that the path name cannot escape the + # given directory. + + if { ![regexp {^[[.-.][:alpha:]_]+(?:/[[.-.][:alpha:]_]+)*$} $fileName] } { + return -code error \ + -errorcode [list CLOCK badTimeZone $:fileName] \ + "time zone \":$fileName\" not valid" + } + foreach d $ZoneinfoPaths { + set fname [file join $d $fileName] + if { [file readable $fname] && [file isfile $fname] } { + break + } + unset fname + } + ReadZoneinfoFile $fileName $fname +} + +#---------------------------------------------------------------------- +# +# ReadZoneinfoFile -- +# +# Loads a binary time zone information file in Olson format. +# +# Parameters: +# fileName - Name of the time zone (relative path name of the +# file). +# fname - Absolute path name of the file. +# +# Results: +# Returns an empty result normally; returns an error if no Olson file +# was found or the file was malformed in some way. +# +# Side effects: +# TZData(:fileName) contains the time zone data +# +#---------------------------------------------------------------------- + +proc ::tcl::clock::ReadZoneinfoFile {fileName fname} { + variable MINWIDE + variable TZData + if { ![file exists $fname] } { + return -code error "$fileName not found" + } + + if { [file size $fname] > 262144 } { + return -code error "$fileName too big" + } + + # Suck in all the data from the file + + set f [open $fname r] + fconfigure $f -translation binary + set d [read $f] + close $f + + # The file begins with a magic number, sixteen reserved bytes, and then + # six 4-byte integers giving counts of fields in the file. + + binary scan $d a4a1x15IIIIII \ + magic version nIsGMT nIsStd nLeap nTime nType nChar + set seek 44 + set ilen 4 + set iformat I + if { $magic != {TZif} } { + return -code error "$fileName not a time zone information file" + } + if { $nType > 255 } { + return -code error "$fileName contains too many time types" + } + # Accept only Posix-style zoneinfo. Sorry, 'leaps' bigots. + if { $nLeap != 0 } { + return -code error "$fileName contains leap seconds" + } + + # In a version 2 file, we use the second part of the file, which contains + # 64-bit transition times. + + if {$version eq "2"} { + set seek [expr { + 44 + + 5 * $nTime + + 6 * $nType + + 4 * $nLeap + + $nIsStd + + $nIsGMT + + $nChar + }] + binary scan $d @${seek}a4a1x15IIIIII \ + magic version nIsGMT nIsStd nLeap nTime nType nChar + if {$magic ne {TZif}} { + return -code error "seek address $seek miscomputed, magic = $magic" + } + set iformat W + set ilen 8 + incr seek 44 + } + + # Next come ${nTime} transition times, followed by ${nTime} time type + # codes. The type codes are unsigned 1-byte quantities. We insert an + # arbitrary start time in front of the transitions. + + binary scan $d @${seek}${iformat}${nTime}c${nTime} times tempCodes + incr seek [expr { ($ilen + 1) * $nTime }] + set times [linsert $times 0 $MINWIDE] + set codes {} + foreach c $tempCodes { + lappend codes [expr { $c & 0xFF }] + } + set codes [linsert $codes 0 0] + + # Next come ${nType} time type descriptions, each of which has an offset + # (seconds east of GMT), a DST indicator, and an index into the + # abbreviation text. + + for { set i 0 } { $i < $nType } { incr i } { + binary scan $d @${seek}Icc gmtOff isDst abbrInd + lappend types [list $gmtOff $isDst $abbrInd] + incr seek 6 + } + + # Next come $nChar characters of time zone name abbreviations, which are + # null-terminated. + # We build them up into a dictionary indexed by character index, because + # that's what's in the indices above. + + binary scan $d @${seek}a${nChar} abbrs + incr seek ${nChar} + set abbrList [split $abbrs \0] + set i 0 + set abbrevs {} + foreach a $abbrList { + for {set j 0} {$j <= [string length $a]} {incr j} { + dict set abbrevs $i [string range $a $j end] + incr i + } + } + + # Package up a list of tuples, each of which contains transition time, + # seconds east of Greenwich, DST flag and time zone abbreviation. + + set r {} + set lastTime $MINWIDE + foreach t $times c $codes { + if { $t < $lastTime } { + return -code error "$fileName has times out of order" + } + set lastTime $t + lassign [lindex $types $c] gmtoff isDst abbrInd + set abbrev [dict get $abbrevs $abbrInd] + lappend r [list $t $gmtoff $isDst $abbrev] + } + + # In a version 2 file, there is also a POSIX-style time zone description + # at the very end of the file. To get to it, skip over nLeap leap second + # values (8 bytes each), + # nIsStd standard/DST indicators and nIsGMT UTC/local indicators. + + if {$version eq {2}} { + set seek [expr {$seek + 8 * $nLeap + $nIsStd + $nIsGMT + 1}] + set last [string first \n $d $seek] + set posix [string range $d $seek [expr {$last-1}]] + if {[llength $posix] > 0} { + set posixFields [ParsePosixTimeZone $posix] + foreach tuple [ProcessPosixTimeZone $posixFields] { + lassign $tuple t gmtoff isDst abbrev + if {$t > $lastTime} { + lappend r $tuple + } + } + } + } + + set TZData(:$fileName) $r + + return +} + +#---------------------------------------------------------------------- +# +# ParsePosixTimeZone -- +# +# Parses the TZ environment variable in Posix form +# +# Parameters: +# tz Time zone specifier to be interpreted +# +# Results: +# Returns a dictionary whose values contain the various pieces of the +# time zone specification. +# +# Side effects: +# None. +# +# Errors: +# Throws an error if the syntax of the time zone is incorrect. +# +# The following keys are present in the dictionary: +# stdName - Name of the time zone when Daylight Saving Time +# is not in effect. +# stdSignum - Sign (+, -, or empty) of the offset from Greenwich +# to the given (non-DST) time zone. + and the empty +# string denote zones west of Greenwich, - denotes east +# of Greenwich; this is contrary to the ISO convention +# but follows Posix. +# stdHours - Hours part of the offset from Greenwich to the given +# (non-DST) time zone. +# stdMinutes - Minutes part of the offset from Greenwich to the +# given (non-DST) time zone. Empty denotes zero. +# stdSeconds - Seconds part of the offset from Greenwich to the +# given (non-DST) time zone. Empty denotes zero. +# dstName - Name of the time zone when DST is in effect, or the +# empty string if the time zone does not observe Daylight +# Saving Time. +# dstSignum, dstHours, dstMinutes, dstSeconds - +# Fields corresponding to stdSignum, stdHours, stdMinutes, +# stdSeconds for the Daylight Saving Time version of the +# time zone. If dstHours is empty, it is presumed to be 1. +# startDayOfYear - The ordinal number of the day of the year on which +# Daylight Saving Time begins. If this field is +# empty, then DST begins on a given month-week-day, +# as below. +# startJ - The letter J, or an empty string. If a J is present in +# this field, then startDayOfYear does not count February 29 +# even in leap years. +# startMonth - The number of the month in which Daylight Saving Time +# begins, supplied if startDayOfYear is empty. If both +# startDayOfYear and startMonth are empty, then US rules +# are presumed. +# startWeekOfMonth - The number of the week in the month in which +# Daylight Saving Time begins, in the range 1-5. +# 5 denotes the last week of the month even in a +# 4-week month. +# startDayOfWeek - The number of the day of the week (Sunday=0, +# Saturday=6) on which Daylight Saving Time begins. +# startHours - The hours part of the time of day at which Daylight +# Saving Time begins. An empty string is presumed to be 2. +# startMinutes - The minutes part of the time of day at which DST begins. +# An empty string is presumed zero. +# startSeconds - The seconds part of the time of day at which DST begins. +# An empty string is presumed zero. +# endDayOfYear, endJ, endMonth, endWeekOfMonth, endDayOfWeek, +# endHours, endMinutes, endSeconds - +# Specify the end of DST in the same way that the start* fields +# specify the beginning of DST. +# +# This procedure serves only to break the time specifier into fields. No +# attempt is made to canonicalize the fields or supply default values. +# +#---------------------------------------------------------------------- + +proc ::tcl::clock::ParsePosixTimeZone { tz } { + if {[regexp -expanded -nocase -- { + ^ + # 1 - Standard time zone name + ([[:alpha:]]+ | <[-+[:alnum:]]+>) + # 2 - Standard time zone offset, signum + ([-+]?) + # 3 - Standard time zone offset, hours + ([[:digit:]]{1,2}) + (?: + # 4 - Standard time zone offset, minutes + : ([[:digit:]]{1,2}) + (?: + # 5 - Standard time zone offset, seconds + : ([[:digit:]]{1,2} ) + )? + )? + (?: + # 6 - DST time zone name + ([[:alpha:]]+ | <[-+[:alnum:]]+>) + (?: + (?: + # 7 - DST time zone offset, signum + ([-+]?) + # 8 - DST time zone offset, hours + ([[:digit:]]{1,2}) + (?: + # 9 - DST time zone offset, minutes + : ([[:digit:]]{1,2}) + (?: + # 10 - DST time zone offset, seconds + : ([[:digit:]]{1,2}) + )? + )? + )? + (?: + , + (?: + # 11 - Optional J in n and Jn form 12 - Day of year + ( J ? ) ( [[:digit:]]+ ) + | M + # 13 - Month number 14 - Week of month 15 - Day of week + ( [[:digit:]] + ) + [.] ( [[:digit:]] + ) + [.] ( [[:digit:]] + ) + ) + (?: + # 16 - Start time of DST - hours + / ( [[:digit:]]{1,2} ) + (?: + # 17 - Start time of DST - minutes + : ( [[:digit:]]{1,2} ) + (?: + # 18 - Start time of DST - seconds + : ( [[:digit:]]{1,2} ) + )? + )? + )? + , + (?: + # 19 - Optional J in n and Jn form 20 - Day of year + ( J ? ) ( [[:digit:]]+ ) + | M + # 21 - Month number 22 - Week of month 23 - Day of week + ( [[:digit:]] + ) + [.] ( [[:digit:]] + ) + [.] ( [[:digit:]] + ) + ) + (?: + # 24 - End time of DST - hours + / ( [[:digit:]]{1,2} ) + (?: + # 25 - End time of DST - minutes + : ( [[:digit:]]{1,2} ) + (?: + # 26 - End time of DST - seconds + : ( [[:digit:]]{1,2} ) + )? + )? + )? + )? + )? + )? + $ + } $tz -> x(stdName) x(stdSignum) x(stdHours) x(stdMinutes) x(stdSeconds) \ + x(dstName) x(dstSignum) x(dstHours) x(dstMinutes) x(dstSeconds) \ + x(startJ) x(startDayOfYear) \ + x(startMonth) x(startWeekOfMonth) x(startDayOfWeek) \ + x(startHours) x(startMinutes) x(startSeconds) \ + x(endJ) x(endDayOfYear) \ + x(endMonth) x(endWeekOfMonth) x(endDayOfWeek) \ + x(endHours) x(endMinutes) x(endSeconds)] } { + # it's a good timezone + + return [array get x] + } + + return -code error\ + -errorcode [list CLOCK badTimeZone $tz] \ + "unable to parse time zone specification \"$tz\"" +} + +#---------------------------------------------------------------------- +# +# ProcessPosixTimeZone -- +# +# Handle a Posix time zone after it's been broken out into fields. +# +# Parameters: +# z - Dictionary returned from 'ParsePosixTimeZone' +# +# Results: +# Returns time zone information for the 'TZData' array. +# +# Side effects: +# None. +# +#---------------------------------------------------------------------- + +proc ::tcl::clock::ProcessPosixTimeZone { z } { + variable MINWIDE + variable TZData + + # Determine the standard time zone name and seconds east of Greenwich + + set stdName [dict get $z stdName] + if { [string index $stdName 0] eq {<} } { + set stdName [string range $stdName 1 end-1] + } + if { [dict get $z stdSignum] eq {-} } { + set stdSignum +1 + } else { + set stdSignum -1 + } + set stdHours [lindex [::scan [dict get $z stdHours] %d] 0] + if { [dict get $z stdMinutes] ne {} } { + set stdMinutes [lindex [::scan [dict get $z stdMinutes] %d] 0] + } else { + set stdMinutes 0 + } + if { [dict get $z stdSeconds] ne {} } { + set stdSeconds [lindex [::scan [dict get $z stdSeconds] %d] 0] + } else { + set stdSeconds 0 + } + set stdOffset [expr { + (($stdHours * 60 + $stdMinutes) * 60 + $stdSeconds) * $stdSignum + }] + set data [list [list $MINWIDE $stdOffset 0 $stdName]] + + # If there's no daylight zone, we're done + + set dstName [dict get $z dstName] + if { $dstName eq {} } { + return $data + } + if { [string index $dstName 0] eq {<} } { + set dstName [string range $dstName 1 end-1] + } + + # Determine the daylight name + + if { [dict get $z dstSignum] eq {-} } { + set dstSignum +1 + } else { + set dstSignum -1 + } + if { [dict get $z dstHours] eq {} } { + set dstOffset [expr { 3600 + $stdOffset }] + } else { + set dstHours [lindex [::scan [dict get $z dstHours] %d] 0] + if { [dict get $z dstMinutes] ne {} } { + set dstMinutes [lindex [::scan [dict get $z dstMinutes] %d] 0] + } else { + set dstMinutes 0 + } + if { [dict get $z dstSeconds] ne {} } { + set dstSeconds [lindex [::scan [dict get $z dstSeconds] %d] 0] + } else { + set dstSeconds 0 + } + set dstOffset [expr { + (($dstHours*60 + $dstMinutes) * 60 + $dstSeconds) * $dstSignum + }] + } + + # Fill in defaults for European or US DST rules + # US start time is the second Sunday in March + # EU start time is the last Sunday in March + # US end time is the first Sunday in November. + # EU end time is the last Sunday in October + + if { + [dict get $z startDayOfYear] eq {} + && [dict get $z startMonth] eq {} + } then { + if {($stdSignum * $stdHours>=0) && ($stdSignum * $stdHours<=12)} { + # EU + dict set z startWeekOfMonth 5 + if {$stdHours>2} { + dict set z startHours 2 + } else { + dict set z startHours [expr {$stdHours+1}] + } + } else { + # US + dict set z startWeekOfMonth 2 + dict set z startHours 2 + } + dict set z startMonth 3 + dict set z startDayOfWeek 0 + dict set z startMinutes 0 + dict set z startSeconds 0 + } + if { + [dict get $z endDayOfYear] eq {} + && [dict get $z endMonth] eq {} + } then { + if {($stdSignum * $stdHours>=0) && ($stdSignum * $stdHours<=12)} { + # EU + dict set z endMonth 10 + dict set z endWeekOfMonth 5 + if {$stdHours>2} { + dict set z endHours 3 + } else { + dict set z endHours [expr {$stdHours+2}] + } + } else { + # US + dict set z endMonth 11 + dict set z endWeekOfMonth 1 + dict set z endHours 2 + } + dict set z endDayOfWeek 0 + dict set z endMinutes 0 + dict set z endSeconds 0 + } + + # Put DST in effect in all years from 1916 to 2099. + + for { set y 1916 } { $y < 2100 } { incr y } { + set startTime [DeterminePosixDSTTime $z start $y] + incr startTime [expr { - wide($stdOffset) }] + set endTime [DeterminePosixDSTTime $z end $y] + incr endTime [expr { - wide($dstOffset) }] + if { $startTime < $endTime } { + lappend data \ + [list $startTime $dstOffset 1 $dstName] \ + [list $endTime $stdOffset 0 $stdName] + } else { + lappend data \ + [list $endTime $stdOffset 0 $stdName] \ + [list $startTime $dstOffset 1 $dstName] + } + } + + return $data +} + +#---------------------------------------------------------------------- +# +# DeterminePosixDSTTime -- +# +# Determines the time that Daylight Saving Time starts or ends from a +# Posix time zone specification. +# +# Parameters: +# z - Time zone data returned from ParsePosixTimeZone. +# Missing fields are expected to be filled in with +# default values. +# bound - The word 'start' or 'end' +# y - The year for which the transition time is to be determined. +# +# Results: +# Returns the transition time as a count of seconds from the epoch. The +# time is relative to the wall clock, not UTC. +# +#---------------------------------------------------------------------- + +proc ::tcl::clock::DeterminePosixDSTTime { z bound y } { + + variable FEB_28 + + # Determine the start or end day of DST + + set date [dict create era CE year $y] + set doy [dict get $z ${bound}DayOfYear] + if { $doy ne {} } { + + # Time was specified as a day of the year + + if { [dict get $z ${bound}J] ne {} + && [IsGregorianLeapYear $y] + && ( $doy > $FEB_28 ) } { + incr doy + } + dict set date dayOfYear $doy + set date [GetJulianDayFromEraYearDay $date[set date {}] 2361222] + } else { + # Time was specified as a day of the week within a month + + dict set date month [dict get $z ${bound}Month] + dict set date dayOfWeek [dict get $z ${bound}DayOfWeek] + set dowim [dict get $z ${bound}WeekOfMonth] + if { $dowim >= 5 } { + set dowim -1 + } + dict set date dayOfWeekInMonth $dowim + set date [GetJulianDayFromEraYearMonthWeekDay $date[set date {}] 2361222] + + } + + set jd [dict get $date julianDay] + set seconds [expr { + wide($jd) * wide(86400) - wide(210866803200) + }] + + set h [dict get $z ${bound}Hours] + if { $h eq {} } { + set h 2 + } else { + set h [lindex [::scan $h %d] 0] + } + set m [dict get $z ${bound}Minutes] + if { $m eq {} } { + set m 0 + } else { + set m [lindex [::scan $m %d] 0] + } + set s [dict get $z ${bound}Seconds] + if { $s eq {} } { + set s 0 + } else { + set s [lindex [::scan $s %d] 0] + } + set tod [expr { ( $h * 60 + $m ) * 60 + $s }] + return [expr { $seconds + $tod }] +} + +#---------------------------------------------------------------------- +# +# GetLocaleEra -- +# +# Given local time expressed in seconds from the Posix epoch, +# determine localized era and year within the era. +# +# Parameters: +# date - Dictionary that must contain the keys, 'localSeconds', +# whose value is expressed as the appropriate local time; +# and 'year', whose value is the Gregorian year. +# etable - Value of the LOCALE_ERAS key in the message catalogue +# for the target locale. +# +# Results: +# Returns the dictionary, augmented with the keys, 'localeEra' and +# 'localeYear'. +# +#---------------------------------------------------------------------- + +proc ::tcl::clock::GetLocaleEra { date etable } { + set index [BSearch $etable [dict get $date localSeconds]] + if { $index < 0} { + dict set date localeEra \ + [::format %02d [expr { [dict get $date year] / 100 }]] + dict set date localeYear [expr { + [dict get $date year] % 100 + }] + } else { + dict set date localeEra [lindex $etable $index 1] + dict set date localeYear [expr { + [dict get $date year] - [lindex $etable $index 2] + }] + } + return $date +} + +#---------------------------------------------------------------------- +# +# GetJulianDayFromEraYearDay -- +# +# Given a year, month and day on the Gregorian calendar, determines +# the Julian Day Number beginning at noon on that date. +# +# Parameters: +# date -- A dictionary in which the 'era', 'year', and +# 'dayOfYear' slots are populated. The calendar in use +# is determined by the date itself relative to: +# changeover -- Julian day on which the Gregorian calendar was +# adopted in the current locale. +# +# Results: +# Returns the given dictionary augmented with a 'julianDay' key whose +# value is the desired Julian Day Number, and a 'gregorian' key that +# specifies whether the calendar is Gregorian (1) or Julian (0). +# +# Side effects: +# None. +# +# Bugs: +# This code needs to be moved to the C layer. +# +#---------------------------------------------------------------------- + +proc ::tcl::clock::GetJulianDayFromEraYearDay {date changeover} { + # Get absolute year number from the civil year + + switch -exact -- [dict get $date era] { + BCE { + set year [expr { 1 - [dict get $date year] }] + } + CE { + set year [dict get $date year] + } + } + set ym1 [expr { $year - 1 }] + + # Try the Gregorian calendar first. + + dict set date gregorian 1 + set jd [expr { + 1721425 + + [dict get $date dayOfYear] + + ( 365 * $ym1 ) + + ( $ym1 / 4 ) + - ( $ym1 / 100 ) + + ( $ym1 / 400 ) + }] + + # If the date is before the Gregorian change, use the Julian calendar. + + if { $jd < $changeover } { + dict set date gregorian 0 + set jd [expr { + 1721423 + + [dict get $date dayOfYear] + + ( 365 * $ym1 ) + + ( $ym1 / 4 ) + }] + } + + dict set date julianDay $jd + return $date +} + +#---------------------------------------------------------------------- +# +# GetJulianDayFromEraYearMonthWeekDay -- +# +# Determines the Julian Day number corresponding to the nth given +# day-of-the-week in a given month. +# +# Parameters: +# date - Dictionary containing the keys, 'era', 'year', 'month' +# 'weekOfMonth', 'dayOfWeek', and 'dayOfWeekInMonth'. +# changeover - Julian Day of adoption of the Gregorian calendar +# +# Results: +# Returns the given dictionary, augmented with a 'julianDay' key. +# +# Side effects: +# None. +# +# Bugs: +# This code needs to be moved to the C layer. +# +#---------------------------------------------------------------------- + +proc ::tcl::clock::GetJulianDayFromEraYearMonthWeekDay {date changeover} { + # Come up with a reference day; either the zeroeth day of the given month + # (dayOfWeekInMonth >= 0) or the seventh day of the following month + # (dayOfWeekInMonth < 0) + + set date2 $date + set week [dict get $date dayOfWeekInMonth] + if { $week >= 0 } { + dict set date2 dayOfMonth 0 + } else { + dict incr date2 month + dict set date2 dayOfMonth 7 + } + set date2 [GetJulianDayFromEraYearMonthDay $date2[set date2 {}] \ + $changeover] + set wd0 [WeekdayOnOrBefore [dict get $date dayOfWeek] \ + [dict get $date2 julianDay]] + dict set date julianDay [expr { $wd0 + 7 * $week }] + return $date +} + +#---------------------------------------------------------------------- +# +# IsGregorianLeapYear -- +# +# Determines whether a given date represents a leap year in the +# Gregorian calendar. +# +# Parameters: +# date -- The date to test. The fields, 'era', 'year' and 'gregorian' +# must be set. +# +# Results: +# Returns 1 if the year is a leap year, 0 otherwise. +# +# Side effects: +# None. +# +#---------------------------------------------------------------------- + +proc ::tcl::clock::IsGregorianLeapYear { date } { + switch -exact -- [dict get $date era] { + BCE { + set year [expr { 1 - [dict get $date year]}] + } + CE { + set year [dict get $date year] + } + } + if { $year % 4 != 0 } { + return 0 + } elseif { ![dict get $date gregorian] } { + return 1 + } elseif { $year % 400 == 0 } { + return 1 + } elseif { $year % 100 == 0 } { + return 0 + } else { + return 1 + } +} + +#---------------------------------------------------------------------- +# +# WeekdayOnOrBefore -- +# +# Determine the nearest day of week (given by the 'weekday' parameter, +# Sunday==0) on or before a given Julian Day. +# +# Parameters: +# weekday -- Day of the week +# j -- Julian Day number +# +# Results: +# Returns the Julian Day Number of the desired date. +# +# Side effects: +# None. +# +#---------------------------------------------------------------------- + +proc ::tcl::clock::WeekdayOnOrBefore { weekday j } { + set k [expr { ( $weekday + 6 ) % 7 }] + return [expr { $j - ( $j - $k ) % 7 }] +} + +#---------------------------------------------------------------------- +# +# BSearch -- +# +# Service procedure that does binary search in several places inside the +# 'clock' command. +# +# Parameters: +# list - List of lists, sorted in ascending order by the +# first elements +# key - Value to search for +# +# Results: +# Returns the index of the greatest element in $list that is less than +# or equal to $key. +# +# Side effects: +# None. +# +#---------------------------------------------------------------------- + +proc ::tcl::clock::BSearch { list key } { + if {[llength $list] == 0} { + return -1 + } + if { $key < [lindex $list 0 0] } { + return -1 + } + + set l 0 + set u [expr { [llength $list] - 1 }] + + while { $l < $u } { + # At this point, we know that + # $k >= [lindex $list $l 0] + # Either $u == [llength $list] or else $k < [lindex $list $u+1 0] + # We find the midpoint of the interval {l,u} rounded UP, compare + # against it, and set l or u to maintain the invariant. Note that the + # interval shrinks at each step, guaranteeing convergence. + + set m [expr { ( $l + $u + 1 ) / 2 }] + if { $key >= [lindex $list $m 0] } { + set l $m + } else { + set u [expr { $m - 1 }] + } + } + + return $l +} + +#---------------------------------------------------------------------- +# +# clock add -- +# +# Adds an offset to a given time. +# +# Syntax: +# clock add clockval ?count unit?... ?-option value? +# +# Parameters: +# clockval -- Starting time value +# count -- Amount of a unit of time to add +# unit -- Unit of time to add, must be one of: +# years year months month weeks week +# days day hours hour minutes minute +# seconds second +# +# Options: +# -gmt BOOLEAN +# (Deprecated) Flag synonymous with '-timezone :GMT' +# -timezone ZONE +# Name of the time zone in which calculations are to be done. +# -locale NAME +# Name of the locale in which calculations are to be done. +# Used to determine the Gregorian change date. +# +# Results: +# Returns the given time adjusted by the given offset(s) in +# order. +# +# Notes: +# It is possible that adding a number of months or years will adjust the +# day of the month as well. For instance, the time at one month after +# 31 January is either 28 or 29 February, because February has fewer +# than 31 days. +# +#---------------------------------------------------------------------- + +proc ::tcl::clock::add { clockval args } { + if { [llength $args] % 2 != 0 } { + set cmdName "clock add" + return -code error \ + -errorcode [list CLOCK wrongNumArgs] \ + "wrong \# args: should be\ + \"$cmdName clockval ?number units?...\ + ?-gmt boolean? ?-locale LOCALE? ?-timezone ZONE?\"" + } + if { [catch { expr {wide($clockval)} } result] } { + return -code error $result + } + + set offsets {} + set gmt 0 + set locale c + set timezone [GetSystemTimeZone] + + foreach { a b } $args { + if { [string is integer -strict $a] } { + lappend offsets $a $b + } else { + switch -exact -- $a { + -g - -gm - -gmt { + set saw(-gmt) {} + set gmt $b + } + -l - -lo - -loc - -loca - -local - -locale { + set locale [string tolower $b] + } + -t - -ti - -tim - -time - -timez - -timezo - -timezon - + -timezone { + set saw(-timezone) {} + set timezone $b + } + default { + throw [list CLOCK badOption $a] \ + "bad option \"$a\",\ + must be -gmt, -locale or -timezone" + } + } + } + } + + # Check options for validity + + if { [info exists saw(-gmt)] && [info exists saw(-timezone)] } { + return -code error \ + -errorcode [list CLOCK gmtWithTimezone] \ + "cannot use -gmt and -timezone in same call" + } + if { [catch { expr { wide($clockval) } } result] } { + return -code error "expected integer but got \"$clockval\"" + } + if { ![string is boolean -strict $gmt] } { + return -code error "expected boolean value but got \"$gmt\"" + } elseif { $gmt } { + set timezone :GMT + } + + EnterLocale $locale + + set changeover [mc GREGORIAN_CHANGE_DATE] + + if {[catch {SetupTimeZone $timezone} retval opts]} { + dict unset opts -errorinfo + return -options $opts $retval + } + + try { + foreach { quantity unit } $offsets { + switch -exact -- $unit { + years - year { + set clockval [AddMonths [expr { 12 * $quantity }] \ + $clockval $timezone $changeover] + } + months - month { + set clockval [AddMonths $quantity $clockval $timezone \ + $changeover] + } + + weeks - week { + set clockval [AddDays [expr { 7 * $quantity }] \ + $clockval $timezone $changeover] + } + days - day { + set clockval [AddDays $quantity $clockval $timezone \ + $changeover] + } + + hours - hour { + set clockval [expr { 3600 * $quantity + $clockval }] + } + minutes - minute { + set clockval [expr { 60 * $quantity + $clockval }] + } + seconds - second { + set clockval [expr { $quantity + $clockval }] + } + + default { + throw [list CLOCK badUnit $unit] \ + "unknown unit \"$unit\", must be \ + years, months, weeks, days, hours, minutes or seconds" + } + } + } + return $clockval + } trap CLOCK {result opts} { + # Conceal the innards of [clock] when it's an expected error + dict unset opts -errorinfo + return -options $opts $result + } +} + +#---------------------------------------------------------------------- +# +# AddMonths -- +# +# Add a given number of months to a given clock value in a given +# time zone. +# +# Parameters: +# months - Number of months to add (may be negative) +# clockval - Seconds since the epoch before the operation +# timezone - Time zone in which the operation is to be performed +# +# Results: +# Returns the new clock value as a number of seconds since +# the epoch. +# +# Side effects: +# None. +# +#---------------------------------------------------------------------- + +proc ::tcl::clock::AddMonths { months clockval timezone changeover } { + variable DaysInRomanMonthInCommonYear + variable DaysInRomanMonthInLeapYear + variable TZData + + # Convert the time to year, month, day, and fraction of day. + + set date [GetDateFields $clockval $TZData($timezone) $changeover] + dict set date secondOfDay [expr { + [dict get $date localSeconds] % 86400 + }] + dict set date tzName $timezone + + # Add the requisite number of months + + set m [dict get $date month] + incr m $months + incr m -1 + set delta [expr { $m / 12 }] + set mm [expr { $m % 12 }] + dict set date month [expr { $mm + 1 }] + dict incr date year $delta + + # If the date doesn't exist in the current month, repair it + + if { [IsGregorianLeapYear $date] } { + set hath [lindex $DaysInRomanMonthInLeapYear $mm] + } else { + set hath [lindex $DaysInRomanMonthInCommonYear $mm] + } + if { [dict get $date dayOfMonth] > $hath } { + dict set date dayOfMonth $hath + } + + # Reconvert to a number of seconds + + set date [GetJulianDayFromEraYearMonthDay \ + $date[set date {}]\ + $changeover] + dict set date localSeconds [expr { + -210866803200 + + ( 86400 * wide([dict get $date julianDay]) ) + + [dict get $date secondOfDay] + }] + set date [ConvertLocalToUTC $date[set date {}] $TZData($timezone) \ + $changeover] + + return [dict get $date seconds] + +} + +#---------------------------------------------------------------------- +# +# AddDays -- +# +# Add a given number of days to a given clock value in a given time +# zone. +# +# Parameters: +# days - Number of days to add (may be negative) +# clockval - Seconds since the epoch before the operation +# timezone - Time zone in which the operation is to be performed +# changeover - Julian Day on which the Gregorian calendar was adopted +# in the target locale. +# +# Results: +# Returns the new clock value as a number of seconds since the epoch. +# +# Side effects: +# None. +# +#---------------------------------------------------------------------- + +proc ::tcl::clock::AddDays { days clockval timezone changeover } { + variable TZData + + # Convert the time to Julian Day + + set date [GetDateFields $clockval $TZData($timezone) $changeover] + dict set date secondOfDay [expr { + [dict get $date localSeconds] % 86400 + }] + dict set date tzName $timezone + + # Add the requisite number of days + + dict incr date julianDay $days + + # Reconvert to a number of seconds + + dict set date localSeconds [expr { + -210866803200 + + ( 86400 * wide([dict get $date julianDay]) ) + + [dict get $date secondOfDay] + }] + set date [ConvertLocalToUTC $date[set date {}] $TZData($timezone) \ + $changeover] + + return [dict get $date seconds] + +} + +#---------------------------------------------------------------------- +# +# ChangeCurrentLocale -- +# +# The global locale was changed within msgcat. +# Clears the buffered parse functions of the current locale. +# +# Parameters: +# loclist (ignored) +# +# Results: +# None. +# +# Side effects: +# Buffered parse functions are cleared. +# +#---------------------------------------------------------------------- + +proc ::tcl::clock::ChangeCurrentLocale {args} { + variable FormatProc + variable LocaleNumeralCache + variable CachedSystemTimeZone + variable TimeZoneBad + + foreach p [info procs [namespace current]::scanproc'*'current] { + rename $p {} + } + foreach p [info procs [namespace current]::formatproc'*'current] { + rename $p {} + } + + catch {array unset FormatProc *'current} + set LocaleNumeralCache {} +} + +#---------------------------------------------------------------------- +# +# ClearCaches -- +# +# Clears all caches to reclaim the memory used in [clock] +# +# Parameters: +# None. +# +# Results: +# None. +# +# Side effects: +# Caches are cleared. +# +#---------------------------------------------------------------------- + +proc ::tcl::clock::ClearCaches {} { + variable FormatProc + variable LocaleNumeralCache + variable CachedSystemTimeZone + variable TimeZoneBad + + foreach p [info procs [namespace current]::scanproc'*] { + rename $p {} + } + foreach p [info procs [namespace current]::formatproc'*] { + rename $p {} + } + + catch {unset FormatProc} + set LocaleNumeralCache {} + catch {unset CachedSystemTimeZone} + set TimeZoneBad {} + InitTZData +} diff --git a/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/ascii.enc b/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/ascii.enc new file mode 100644 index 0000000000000000000000000000000000000000..e0320b8c58918fe264791ca900108fde55bf5b17 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/ascii.enc @@ -0,0 +1,20 @@ +# Encoding file: ascii, single-byte +S +003F 0 1 +00 +0000000100020003000400050006000700080009000A000B000C000D000E000F +0010001100120013001400150016001700180019001A001B001C001D001E001F +0020002100220023002400250026002700280029002A002B002C002D002E002F +0030003100320033003400350036003700380039003A003B003C003D003E003F +0040004100420043004400450046004700480049004A004B004C004D004E004F +0050005100520053005400550056005700580059005A005B005C005D005E005F +0060006100620063006400650066006700680069006A006B006C006D006E006F +0070007100720073007400750076007700780079007A007B007C007D007E0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 diff --git a/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/big5.enc b/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/big5.enc new file mode 100644 index 0000000000000000000000000000000000000000..26179f43d3404fda0817a481358883c5b4c6aa03 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/big5.enc @@ -0,0 +1,1516 @@ +# Encoding file: big5, multi-byte +M +003F 0 89 +00 +0000000100020003000400050006000700080009000A000B000C000D000E000F +0010001100120013001400150016001700180019001A001B001C001D001E001F +0020002100220023002400250026002700280029002A002B002C002D002E002F +0030003100320033003400350036003700380039003A003B003C003D003E003F +0040004100420043004400450046004700480049004A004B004C004D004E004F +0050005100520053005400550056005700580059005A005B005C005D005E005F +0060006100620063006400650066006700680069006A006B006C006D006E006F +0070007100720073007400750076007700780079007A007B007C007D007E007F +0080008100820083008400850086008700880089008A008B008C008D008E008F +0090009100920093009400950096009700980099009A009B009C009D009E009F +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +A1 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +3000FF0C30013002FF0E2022FF1BFF1AFF1FFF01FE3020262025FE50FF64FE52 +00B7FE54FE55FE56FE57FF5C2013FE312014FE33FFFDFE34FE4FFF08FF09FE35 +FE36FF5BFF5DFE37FE3830143015FE39FE3A30103011FE3BFE3C300A300BFE3D +FE3E30083009FE3FFE40300C300DFE41FE42300E300FFE43FE44FE59FE5A0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000FE5BFE5CFE5DFE5E20182019201C201D301D301E20352032FF03FF06FF0A +203B00A7300325CB25CF25B325B225CE2606260525C725C625A125A025BD25BC +32A32105203EFFFDFF3FFFFDFE49FE4AFE4DFE4EFE4BFE4CFE5FFE60FE61FF0B +FF0D00D700F700B1221AFF1CFF1EFF1D226622672260221E22522261FE62FE63 +FE64FE65FE66223C2229222A22A52220221F22BF33D233D1222B222E22352234 +26402642264126092191219321902192219621972199219822252223FFFD0000 +A2 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +FFFDFF0FFF3CFF0400A5301200A200A3FF05FF2021032109FE69FE6AFE6B33D5 +339C339D339E33CE33A1338E338F33C400B05159515B515E515D5161516355E7 +74E97CCE25812582258325842585258625872588258F258E258D258C258B258A +2589253C2534252C2524251C2594250025022595250C251025142518256D0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000256E2570256F2550255E256A256125E225E325E525E4257125722573FF10 +FF11FF12FF13FF14FF15FF16FF17FF18FF192160216121622163216421652166 +216721682169302130223023302430253026302730283029FFFD5344FFFDFF21 +FF22FF23FF24FF25FF26FF27FF28FF29FF2AFF2BFF2CFF2DFF2EFF2FFF30FF31 +FF32FF33FF34FF35FF36FF37FF38FF39FF3AFF41FF42FF43FF44FF45FF46FF47 +FF48FF49FF4AFF4BFF4CFF4DFF4EFF4FFF50FF51FF52FF53FF54FF55FF560000 +A3 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +FF57FF58FF59FF5A039103920393039403950396039703980399039A039B039C +039D039E039F03A003A103A303A403A503A603A703A803A903B103B203B303B4 +03B503B603B703B803B903BA03BB03BC03BD03BE03BF03C003C103C303C403C5 +03C603C703C803C931053106310731083109310A310B310C310D310E310F0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00003110311131123113311431153116311731183119311A311B311C311D311E +311F312031213122312331243125312631273128312902D902C902CA02C702CB +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +A4 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +4E004E594E014E034E434E5D4E864E8C4EBA513F5165516B51E052005201529B +53155341535C53C84E094E0B4E084E0A4E2B4E3851E14E454E484E5F4E5E4E8E +4EA15140520352FA534353C953E3571F58EB5915592759735B505B515B535BF8 +5C0F5C225C385C715DDD5DE55DF15DF25DF35DFE5E725EFE5F0B5F13624D0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00004E114E104E0D4E2D4E304E394E4B5C394E884E914E954E924E944EA24EC1 +4EC04EC34EC64EC74ECD4ECA4ECB4EC4514351415167516D516E516C519751F6 +52065207520852FB52FE52FF53165339534853475345535E538453CB53CA53CD +58EC5929592B592A592D5B545C115C245C3A5C6F5DF45E7B5EFF5F145F155FC3 +62086236624B624E652F6587659765A465B965E566F0670867286B206B626B79 +6BCB6BD46BDB6C0F6C34706B722A7236723B72477259725B72AC738B4E190000 +A5 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +4E164E154E144E184E3B4E4D4E4F4E4E4EE54ED84ED44ED54ED64ED74EE34EE4 +4ED94EDE514551445189518A51AC51F951FA51F8520A52A0529F530553065317 +531D4EDF534A534953615360536F536E53BB53EF53E453F353EC53EE53E953E8 +53FC53F853F553EB53E653EA53F253F153F053E553ED53FB56DB56DA59160000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000592E5931597459765B555B835C3C5DE85DE75DE65E025E035E735E7C5F01 +5F185F175FC5620A625362546252625165A565E6672E672C672A672B672D6B63 +6BCD6C116C106C386C416C406C3E72AF7384738974DC74E67518751F75287529 +7530753175327533758B767D76AE76BF76EE77DB77E277F3793A79BE7A747ACB +4E1E4E1F4E524E534E694E994EA44EA64EA54EFF4F094F194F0A4F154F0D4F10 +4F114F0F4EF24EF64EFB4EF04EF34EFD4F014F0B514951475146514851680000 +A6 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +5171518D51B0521752115212520E521652A3530853215320537053715409540F +540C540A54105401540B54045411540D54085403540E5406541256E056DE56DD +573357305728572D572C572F57295919591A59375938598459785983597D5979 +598259815B575B585B875B885B855B895BFA5C165C795DDE5E065E765E740000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00005F0F5F1B5FD95FD6620E620C620D62106263625B6258653665E965E865EC +65ED66F266F36709673D6734673167356B216B646B7B6C166C5D6C576C596C5F +6C606C506C556C616C5B6C4D6C4E7070725F725D767E7AF97C737CF87F367F8A +7FBD80018003800C80128033807F8089808B808C81E381EA81F381FC820C821B +821F826E8272827E866B8840884C8863897F96214E324EA84F4D4F4F4F474F57 +4F5E4F344F5B4F554F304F504F514F3D4F3A4F384F434F544F3C4F464F630000 +A7 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +4F5C4F604F2F4F4E4F364F594F5D4F484F5A514C514B514D517551B651B75225 +52245229522A522852AB52A952AA52AC532353735375541D542D541E543E5426 +544E542754465443543354485442541B5429544A5439543B5438542E54355436 +5420543C54405431542B541F542C56EA56F056E456EB574A57515740574D0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00005747574E573E5750574F573B58EF593E599D599259A8599E59A359995996 +598D59A45993598A59A55B5D5B5C5B5A5B5B5B8C5B8B5B8F5C2C5C405C415C3F +5C3E5C905C915C945C8C5DEB5E0C5E8F5E875E8A5EF75F045F1F5F645F625F77 +5F795FD85FCC5FD75FCD5FF15FEB5FF85FEA6212621162846297629662806276 +6289626D628A627C627E627962736292626F6298626E62956293629162866539 +653B653865F166F4675F674E674F67506751675C6756675E6749674667600000 +A8 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +675367576B656BCF6C426C5E6C996C816C886C896C856C9B6C6A6C7A6C906C70 +6C8C6C686C966C926C7D6C836C726C7E6C746C866C766C8D6C946C986C827076 +707C707D707872627261726072C472C27396752C752B75377538768276EF77E3 +79C179C079BF7A767CFB7F5580968093809D8098809B809A80B2826F82920000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000828B828D898B89D28A008C378C468C558C9D8D648D708DB38EAB8ECA8F9B +8FB08FC28FC68FC58FC45DE1909190A290AA90A690A3914991C691CC9632962E +9631962A962C4E264E564E734E8B4E9B4E9E4EAB4EAC4F6F4F9D4F8D4F734F7F +4F6C4F9B4F8B4F864F834F704F754F884F694F7B4F964F7E4F8F4F914F7A5154 +51525155516951775176517851BD51FD523B52385237523A5230522E52365241 +52BE52BB5352535453535351536653775378537953D653D453D7547354750000 +A9 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +5496547854955480547B5477548454925486547C549054715476548C549A5462 +5468548B547D548E56FA57835777576A5769576157665764577C591C59495947 +59485944595459BE59BB59D459B959AE59D159C659D059CD59CB59D359CA59AF +59B359D259C55B5F5B645B635B975B9A5B985B9C5B995B9B5C1A5C485C450000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00005C465CB75CA15CB85CA95CAB5CB15CB35E185E1A5E165E155E1B5E115E78 +5E9A5E975E9C5E955E965EF65F265F275F295F805F815F7F5F7C5FDD5FE05FFD +5FF55FFF600F6014602F60356016602A6015602160276029602B601B62166215 +623F623E6240627F62C962CC62C462BF62C262B962D262DB62AB62D362D462CB +62C862A862BD62BC62D062D962C762CD62B562DA62B162D862D662D762C662AC +62CE653E65A765BC65FA66146613660C66066602660E6600660F6615660A0000 +AA +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +6607670D670B676D678B67956771679C677367776787679D6797676F6770677F +6789677E67906775679A6793677C676A67726B236B666B676B7F6C136C1B6CE3 +6CE86CF36CB16CCC6CE56CB36CBD6CBE6CBC6CE26CAB6CD56CD36CB86CC46CB9 +6CC16CAE6CD76CC56CF16CBF6CBB6CE16CDB6CCA6CAC6CEF6CDC6CD66CE00000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00007095708E7092708A7099722C722D723872487267726972C072CE72D972D7 +72D073A973A8739F73AB73A5753D759D7599759A768476C276F276F477E577FD +793E7940794179C979C87A7A7A797AFA7CFE7F547F8C7F8B800580BA80A580A2 +80B180A180AB80A980B480AA80AF81E581FE820D82B3829D829982AD82BD829F +82B982B182AC82A582AF82B882A382B082BE82B7864E8671521D88688ECB8FCE +8FD48FD190B590B890B190B691C791D195779580961C9640963F963B96440000 +AB +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +964296B996E89752975E4E9F4EAD4EAE4FE14FB54FAF4FBF4FE04FD14FCF4FDD +4FC34FB64FD84FDF4FCA4FD74FAE4FD04FC44FC24FDA4FCE4FDE4FB751575192 +519151A0524E5243524A524D524C524B524752C752C952C352C1530D5357537B +539A53DB54AC54C054A854CE54C954B854A654B354C754C254BD54AA54C10000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000054C454C854AF54AB54B154BB54A954A754BF56FF5782578B57A057A357A2 +57CE57AE579359555951594F594E595059DC59D859FF59E359E85A0359E559EA +59DA59E65A0159FB5B695BA35BA65BA45BA25BA55C015C4E5C4F5C4D5C4B5CD9 +5CD25DF75E1D5E255E1F5E7D5EA05EA65EFA5F085F2D5F655F885F855F8A5F8B +5F875F8C5F896012601D60206025600E6028604D60706068606260466043606C +606B606A6064624162DC6316630962FC62ED630162EE62FD630762F162F70000 +AC +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +62EF62EC62FE62F463116302653F654565AB65BD65E26625662D66206627662F +661F66286631662466F767FF67D367F167D467D067EC67B667AF67F567E967EF +67C467D167B467DA67E567B867CF67DE67F367B067D967E267DD67D26B6A6B83 +6B866BB56BD26BD76C1F6CC96D0B6D326D2A6D416D256D0C6D316D1E6D170000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00006D3B6D3D6D3E6D366D1B6CF56D396D276D386D296D2E6D356D0E6D2B70AB +70BA70B370AC70AF70AD70B870AE70A472307272726F727472E972E072E173B7 +73CA73BB73B273CD73C073B3751A752D754F754C754E754B75AB75A475A575A2 +75A3767876867687768876C876C676C376C5770176F976F87709770B76FE76FC +770777DC78027814780C780D794679497948794779B979BA79D179D279CB7A7F +7A817AFF7AFD7C7D7D027D057D007D097D077D047D067F387F8E7FBF80040000 +AD +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +8010800D8011803680D680E580DA80C380C480CC80E180DB80CE80DE80E480DD +81F4822282E78303830582E382DB82E6830482E58302830982D282D782F18301 +82DC82D482D182DE82D382DF82EF830686508679867B867A884D886B898189D4 +8A088A028A038C9E8CA08D748D738DB48ECD8ECC8FF08FE68FE28FEA8FE50000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00008FED8FEB8FE48FE890CA90CE90C190C3914B914A91CD95829650964B964C +964D9762976997CB97ED97F3980198A898DB98DF999699994E584EB3500C500D +50234FEF502650254FF8502950165006503C501F501A501250114FFA50005014 +50284FF15021500B501950184FF34FEE502D502A4FFE502B5009517C51A451A5 +51A251CD51CC51C651CB5256525C5254525B525D532A537F539F539D53DF54E8 +55105501553754FC54E554F2550654FA551454E954ED54E1550954EE54EA0000 +AE +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +54E65527550754FD550F5703570457C257D457CB57C35809590F59575958595A +5A115A185A1C5A1F5A1B5A1359EC5A205A235A295A255A0C5A095B6B5C585BB0 +5BB35BB65BB45BAE5BB55BB95BB85C045C515C555C505CED5CFD5CFB5CEA5CE8 +5CF05CF65D015CF45DEE5E2D5E2B5EAB5EAD5EA75F315F925F915F9060590000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00006063606560506055606D6069606F6084609F609A608D6094608C60856096 +624762F3630862FF634E633E632F635563426346634F6349633A6350633D632A +632B6328634D634C65486549659965C165C566426649664F66436652664C6645 +664166F867146715671768216838684868466853683968426854682968B36817 +684C6851683D67F468506840683C6843682A68456813681868416B8A6B896BB7 +6C236C276C286C266C246CF06D6A6D956D886D876D666D786D776D596D930000 +AF +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +6D6C6D896D6E6D5A6D746D696D8C6D8A6D796D856D656D9470CA70D870E470D9 +70C870CF7239727972FC72F972FD72F872F7738673ED740973EE73E073EA73DE +7554755D755C755A755975BE75C575C775B275B375BD75BC75B975C275B8768B +76B076CA76CD76CE7729771F7720772877E9783078277838781D783478370000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00007825782D7820781F7832795579507960795F7956795E795D7957795A79E4 +79E379E779DF79E679E979D87A847A887AD97B067B117C897D217D177D0B7D0A +7D207D227D147D107D157D1A7D1C7D0D7D197D1B7F3A7F5F7F947FC57FC18006 +8018801580198017803D803F80F1810280F0810580ED80F4810680F880F38108 +80FD810A80FC80EF81ED81EC82008210822A822B8228822C82BB832B83528354 +834A83388350834983358334834F833283398336831783408331832883430000 +B0 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +8654868A86AA869386A486A9868C86A3869C8870887788818882887D88798A18 +8A108A0E8A0C8A158A0A8A178A138A168A0F8A118C488C7A8C798CA18CA28D77 +8EAC8ED28ED48ECF8FB1900190068FF790008FFA8FF490038FFD90058FF89095 +90E190DD90E29152914D914C91D891DD91D791DC91D995839662966396610000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000965B965D96649658965E96BB98E299AC9AA89AD89B259B329B3C4E7E507A +507D505C50475043504C505A504950655076504E5055507550745077504F500F +506F506D515C519551F0526A526F52D252D952D852D55310530F5319533F5340 +533E53C366FC5546556A55665544555E55615543554A55315556554F5555552F +55645538552E555C552C55635533554155575708570B570957DF5805580A5806 +57E057E457FA5802583557F757F9592059625A365A415A495A665A6A5A400000 +B1 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +5A3C5A625A5A5A465A4A5B705BC75BC55BC45BC25BBF5BC65C095C085C075C60 +5C5C5C5D5D075D065D0E5D1B5D165D225D115D295D145D195D245D275D175DE2 +5E385E365E335E375EB75EB85EB65EB55EBE5F355F375F575F6C5F695F6B5F97 +5F995F9E5F985FA15FA05F9C607F60A3608960A060A860CB60B460E660BD0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000060C560BB60B560DC60BC60D860D560C660DF60B860DA60C7621A621B6248 +63A063A76372639663A263A563776367639863AA637163A963896383639B636B +63A863846388639963A163AC6392638F6380637B63696368637A655D65566551 +65596557555F654F655865556554659C659B65AC65CF65CB65CC65CE665D665A +666466686666665E66F952D7671B688168AF68A2689368B5687F687668B168A7 +689768B0688368C468AD688668856894689D68A8689F68A168826B326BBA0000 +B2 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +6BEB6BEC6C2B6D8E6DBC6DF36DD96DB26DE16DCC6DE46DFB6DFA6E056DC76DCB +6DAF6DD16DAE6DDE6DF96DB86DF76DF56DC56DD26E1A6DB56DDA6DEB6DD86DEA +6DF16DEE6DE86DC66DC46DAA6DEC6DBF6DE670F97109710A70FD70EF723D727D +7281731C731B73167313731973877405740A7403740673FE740D74E074F60000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000074F7751C75227565756675627570758F75D475D575B575CA75CD768E76D4 +76D276DB7737773E773C77367738773A786B7843784E79657968796D79FB7A92 +7A957B207B287B1B7B2C7B267B197B1E7B2E7C927C977C957D467D437D717D2E +7D397D3C7D407D307D337D447D2F7D427D327D317F3D7F9E7F9A7FCC7FCE7FD2 +801C804A8046812F81168123812B81298130812482028235823782368239838E +839E8398837883A2839683BD83AB8392838A8393838983A08377837B837C0000 +B3 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +838683A786555F6A86C786C086B686C486B586C686CB86B186AF86C98853889E +888888AB88928896888D888B8993898F8A2A8A1D8A238A258A318A2D8A1F8A1B +8A228C498C5A8CA98CAC8CAB8CA88CAA8CA78D678D668DBE8DBA8EDB8EDF9019 +900D901A90179023901F901D90109015901E9020900F90229016901B90140000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000090E890ED90FD915791CE91F591E691E391E791ED91E99589966A96759673 +96789670967496769677966C96C096EA96E97AE07ADF980298039B5A9CE59E75 +9E7F9EA59EBB50A2508D508550995091508050965098509A670051F152725274 +5275526952DE52DD52DB535A53A5557B558055A7557C558A559D55985582559C +55AA55945587558B558355B355AE559F553E55B2559A55BB55AC55B1557E5589 +55AB5599570D582F582A58345824583058315821581D582058F958FA59600000 +B4 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +5A775A9A5A7F5A925A9B5AA75B735B715BD25BCC5BD35BD05C0A5C0B5C315D4C +5D505D345D475DFD5E455E3D5E405E435E7E5ECA5EC15EC25EC45F3C5F6D5FA9 +5FAA5FA860D160E160B260B660E0611C612360FA611560F060FB60F4616860F1 +610E60F6610961006112621F624963A3638C63CF63C063E963C963C663CD0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000063D263E363D063E163D663ED63EE637663F463EA63DB645263DA63F9655E +6566656265636591659065AF666E667066746676666F6691667A667E667766FE +66FF671F671D68FA68D568E068D868D7690568DF68F568EE68E768F968D268F2 +68E368CB68CD690D6912690E68C968DA696E68FB6B3E6B3A6B3D6B986B966BBC +6BEF6C2E6C2F6C2C6E2F6E386E546E216E326E676E4A6E206E256E236E1B6E5B +6E586E246E566E6E6E2D6E266E6F6E346E4D6E3A6E2C6E436E1D6E3E6ECB0000 +B5 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +6E896E196E4E6E636E446E726E696E5F7119711A7126713071217136716E711C +724C728472807336732573347329743A742A743374227425743574367434742F +741B7426742875257526756B756A75E275DB75E375D975D875DE75E0767B767C +7696769376B476DC774F77ED785D786C786F7A0D7A087A0B7A057A007A980000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00007A977A967AE57AE37B497B567B467B507B527B547B4D7B4B7B4F7B517C9F +7CA57D5E7D507D687D557D2B7D6E7D727D617D667D627D707D7355847FD47FD5 +800B8052808581558154814B8151814E81398146813E814C815381748212821C +83E9840383F8840D83E083C5840B83C183EF83F183F48457840A83F0840C83CC +83FD83F283CA8438840E840483DC840783D483DF865B86DF86D986ED86D486DB +86E486D086DE885788C188C288B1898389968A3B8A608A558A5E8A3C8A410000 +B6 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +8A548A5B8A508A468A348A3A8A368A568C618C828CAF8CBC8CB38CBD8CC18CBB +8CC08CB48CB78CB68CBF8CB88D8A8D858D818DCE8DDD8DCB8DDA8DD18DCC8DDB +8DC68EFB8EF88EFC8F9C902E90359031903890329036910290F5910990FE9163 +916591CF9214921592239209921E920D9210920792119594958F958B95910000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000095939592958E968A968E968B967D96859686968D9672968496C196C596C4 +96C696C796EF96F297CC98059806980898E798EA98EF98E998F298ED99AE99AD +9EC39ECD9ED14E8250AD50B550B250B350C550BE50AC50B750BB50AF50C7527F +5277527D52DF52E652E452E252E3532F55DF55E855D355E655CE55DC55C755D1 +55E355E455EF55DA55E155C555C655E555C957125713585E585158585857585A +5854586B584C586D584A58625852584B59675AC15AC95ACC5ABE5ABD5ABC0000 +B7 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +5AB35AC25AB25D695D6F5E4C5E795EC95EC85F125F595FAC5FAE611A610F6148 +611F60F3611B60F961016108614E614C6144614D613E61346127610D61066137 +622162226413643E641E642A642D643D642C640F641C6414640D643664166417 +6406656C659F65B06697668966876688669666846698668D67036994696D0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000695A697769606954697569306982694A6968696B695E695369796986695D +6963695B6B476B726BC06BBF6BD36BFD6EA26EAF6ED36EB66EC26E906E9D6EC7 +6EC56EA56E986EBC6EBA6EAB6ED16E966E9C6EC46ED46EAA6EA76EB4714E7159 +7169716471497167715C716C7166714C7165715E714671687156723A72527337 +7345733F733E746F745A7455745F745E7441743F7459745B745C757675787600 +75F0760175F275F175FA75FF75F475F376DE76DF775B776B7766775E77630000 +B8 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +7779776A776C775C77657768776277EE788E78B078977898788C7889787C7891 +7893787F797A797F7981842C79BD7A1C7A1A7A207A147A1F7A1E7A9F7AA07B77 +7BC07B607B6E7B677CB17CB37CB57D937D797D917D817D8F7D5B7F6E7F697F6A +7F727FA97FA87FA480568058808680848171817081788165816E8173816B0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00008179817A81668205824784828477843D843184758466846B8449846C845B +843C8435846184638469846D8446865E865C865F86F9871387088707870086FE +86FB870287038706870A885988DF88D488D988DC88D888DD88E188CA88D588D2 +899C89E38A6B8A728A738A668A698A708A878A7C8A638AA08A718A858A6D8A62 +8A6E8A6C8A798A7B8A3E8A688C628C8A8C898CCA8CC78CC88CC48CB28CC38CC2 +8CC58DE18DDF8DE88DEF8DF38DFA8DEA8DE48DE68EB28F038F098EFE8F0A0000 +B9 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +8F9F8FB2904B904A905390429054903C905590509047904F904E904D9051903E +904191129117916C916A916991C9923792579238923D9240923E925B924B9264 +925192349249924D92459239923F925A959896989694969596CD96CB96C996CA +96F796FB96F996F6975697749776981098119813980A9812980C98FC98F40000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000098FD98FE99B399B199B49AE19CE99E829F0E9F139F2050E750EE50E550D6 +50ED50DA50D550CF50D150F150CE50E9516251F352835282533153AD55FE5600 +561B561755FD561456065609560D560E55F75616561F5608561055F657185716 +5875587E58835893588A58795885587D58FD592559225924596A59695AE15AE6 +5AE95AD75AD65AD85AE35B755BDE5BE75BE15BE55BE65BE85BE25BE45BDF5C0D +5C625D845D875E5B5E635E555E575E545ED35ED65F0A5F465F705FB961470000 +BA +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +613F614B617761626163615F615A61586175622A64876458645464A46478645F +647A645164676434646D647B657265A165D765D666A266A8669D699C69A86995 +69C169AE69D369CB699B69B769BB69AB69B469D069CD69AD69CC69A669C369A3 +6B496B4C6C336F336F146EFE6F136EF46F296F3E6F206F2C6F0F6F026F220000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00006EFF6EEF6F066F316F386F326F236F156F2B6F2F6F886F2A6EEC6F016EF2 +6ECC6EF771947199717D718A71847192723E729272967344735074647463746A +7470746D750475917627760D760B7609761376E176E37784777D777F776178C1 +789F78A778B378A978A3798E798F798D7A2E7A317AAA7AA97AED7AEF7BA17B95 +7B8B7B757B977B9D7B947B8F7BB87B877B847CB97CBD7CBE7DBB7DB07D9C7DBD +7DBE7DA07DCA7DB47DB27DB17DBA7DA27DBF7DB57DB87DAD7DD27DC77DAC0000 +BB +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +7F707FE07FE17FDF805E805A808781508180818F8188818A817F818281E781FA +82078214821E824B84C984BF84C684C48499849E84B2849C84CB84B884C084D3 +849084BC84D184CA873F871C873B872287258734871887558737872988F38902 +88F488F988F888FD88E8891A88EF8AA68A8C8A9E8AA38A8D8AA18A938AA40000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00008AAA8AA58AA88A988A918A9A8AA78C6A8C8D8C8C8CD38CD18CD28D6B8D99 +8D958DFC8F148F128F158F138FA390609058905C90639059905E9062905D905B +91199118911E917591789177917492789280928592989296927B9293929C92A8 +927C929195A195A895A995A395A595A49699969C969B96CC96D29700977C9785 +97F69817981898AF98B199039905990C990999C19AAF9AB09AE69B419B429CF4 +9CF69CF39EBC9F3B9F4A5104510050FB50F550F9510251085109510551DC0000 +BC +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +528752885289528D528A52F053B2562E563B56395632563F563456295653564E +565756745636562F56305880589F589E58B3589C58AE58A958A6596D5B095AFB +5B0B5AF55B0C5B085BEE5BEC5BE95BEB5C645C655D9D5D945E625E5F5E615EE2 +5EDA5EDF5EDD5EE35EE05F485F715FB75FB561766167616E615D615561820000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000617C6170616B617E61A7619061AB618E61AC619A61A4619461AE622E6469 +646F6479649E64B26488649064B064A56493649564A9649264AE64AD64AB649A +64AC649964A264B365756577657866AE66AB66B466B16A236A1F69E86A016A1E +6A1969FD6A216A136A0A69F36A026A0569ED6A116B506B4E6BA46BC56BC66F3F +6F7C6F846F516F666F546F866F6D6F5B6F786F6E6F8E6F7A6F706F646F976F58 +6ED56F6F6F606F5F719F71AC71B171A87256729B734E73577469748B74830000 +BD +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +747E7480757F76207629761F7624762676217622769A76BA76E4778E7787778C +7791778B78CB78C578BA78CA78BE78D578BC78D07A3F7A3C7A407A3D7A377A3B +7AAF7AAE7BAD7BB17BC47BB47BC67BC77BC17BA07BCC7CCA7DE07DF47DEF7DFB +7DD87DEC7DDD7DE87DE37DDA7DDE7DE97D9E7DD97DF27DF97F757F777FAF0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00007FE98026819B819C819D81A0819A81988517853D851A84EE852C852D8513 +851185238521851484EC852584FF850687828774877687608766877887688759 +8757874C8753885B885D89108907891289138915890A8ABC8AD28AC78AC48A95 +8ACB8AF88AB28AC98AC28ABF8AB08AD68ACD8AB68AB98ADB8C4C8C4E8C6C8CE0 +8CDE8CE68CE48CEC8CED8CE28CE38CDC8CEA8CE18D6D8D9F8DA38E2B8E108E1D +8E228E0F8E298E1F8E218E1E8EBA8F1D8F1B8F1F8F298F268F2A8F1C8F1E0000 +BE +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +8F259069906E9068906D90779130912D9127913191879189918B918392C592BB +92B792EA92AC92E492C192B392BC92D292C792F092B295AD95B1970497069707 +97099760978D978B978F9821982B981C98B3990A99139912991899DD99D099DF +99DB99D199D599D299D99AB79AEE9AEF9B279B459B449B779B6F9D069D090000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00009D039EA99EBE9ECE58A89F5251125118511451105115518051AA51DD5291 +529352F35659566B5679566956645678566A566856655671566F566C56625676 +58C158BE58C758C5596E5B1D5B345B785BF05C0E5F4A61B2619161A9618A61CD +61B661BE61CA61C8623064C564C164CB64BB64BC64DA64C464C764C264CD64BF +64D264D464BE657466C666C966B966C466C766B86A3D6A386A3A6A596A6B6A58 +6A396A446A626A616A4B6A476A356A5F6A486B596B776C056FC26FB16FA10000 +BF +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +6FC36FA46FC16FA76FB36FC06FB96FB66FA66FA06FB471BE71C971D071D271C8 +71D571B971CE71D971DC71C371C47368749C74A37498749F749E74E2750C750D +76347638763A76E776E577A0779E779F77A578E878DA78EC78E779A67A4D7A4E +7A467A4C7A4B7ABA7BD97C117BC97BE47BDB7BE17BE97BE67CD57CD67E0A0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00007E117E087E1B7E237E1E7E1D7E097E107F797FB27FF07FF17FEE802881B3 +81A981A881FB820882588259854A855985488568856985438549856D856A855E +8783879F879E87A2878D8861892A89328925892B892189AA89A68AE68AFA8AEB +8AF18B008ADC8AE78AEE8AFE8B018B028AF78AED8AF38AF68AFC8C6B8C6D8C93 +8CF48E448E318E348E428E398E358F3B8F2F8F388F338FA88FA6907590749078 +9072907C907A913491929320933692F89333932F932292FC932B9304931A0000 +C0 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +9310932693219315932E931995BB96A796A896AA96D5970E97119716970D9713 +970F975B975C9766979898309838983B9837982D9839982499109928991E991B +9921991A99ED99E299F19AB89ABC9AFB9AED9B289B919D159D239D269D289D12 +9D1B9ED89ED49F8D9F9C512A511F5121513252F5568E56805690568556870000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000568F58D558D358D158CE5B305B2A5B245B7A5C375C685DBC5DBA5DBD5DB8 +5E6B5F4C5FBD61C961C261C761E661CB6232623464CE64CA64D864E064F064E6 +64EC64F164E264ED6582658366D966D66A806A946A846AA26A9C6ADB6AA36A7E +6A976A906AA06B5C6BAE6BDA6C086FD86FF16FDF6FE06FDB6FE46FEB6FEF6F80 +6FEC6FE16FE96FD56FEE6FF071E771DF71EE71E671E571ED71EC71F471E07235 +72467370737274A974B074A674A876467642764C76EA77B377AA77B077AC0000 +C1 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +77A777AD77EF78F778FA78F478EF790179A779AA7A577ABF7C077C0D7BFE7BF7 +7C0C7BE07CE07CDC7CDE7CE27CDF7CD97CDD7E2E7E3E7E467E377E327E437E2B +7E3D7E317E457E417E347E397E487E357E3F7E2F7F447FF37FFC807180728070 +806F807381C681C381BA81C281C081BF81BD81C981BE81E88209827185AA0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00008584857E859C8591859485AF859B858785A8858A866787C087D187B387D2 +87C687AB87BB87BA87C887CB893B893689448938893D89AC8B0E8B178B198B1B +8B0A8B208B1D8B048B108C418C3F8C738CFA8CFD8CFC8CF88CFB8DA88E498E4B +8E488E4A8F448F3E8F428F458F3F907F907D9084908190829080913991A3919E +919C934D938293289375934A9365934B9318937E936C935B9370935A935495CA +95CB95CC95C895C696B196B896D6971C971E97A097D3984698B699359A010000 +C2 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +99FF9BAE9BAB9BAA9BAD9D3B9D3F9E8B9ECF9EDE9EDC9EDD9EDB9F3E9F4B53E2 +569556AE58D958D85B385F5D61E3623364F464F264FE650664FA64FB64F765B7 +66DC67266AB36AAC6AC36ABB6AB86AC26AAE6AAF6B5F6B786BAF7009700B6FFE +70066FFA7011700F71FB71FC71FE71F87377737574A774BF7515765676580000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000765277BD77BF77BB77BC790E79AE7A617A627A607AC47AC57C2B7C277C2A +7C1E7C237C217CE77E547E557E5E7E5A7E617E527E597F487FF97FFB80778076 +81CD81CF820A85CF85A985CD85D085C985B085BA85B985A687EF87EC87F287E0 +898689B289F48B288B398B2C8B2B8C508D058E598E638E668E648E5F8E558EC0 +8F498F4D90879083908891AB91AC91D09394938A939693A293B393AE93AC93B0 +9398939A939795D495D695D095D596E296DC96D996DB96DE972497A397A60000 +C3 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +97AD97F9984D984F984C984E985398BA993E993F993D992E99A59A0E9AC19B03 +9B069B4F9B4E9B4D9BCA9BC99BFD9BC89BC09D519D5D9D609EE09F159F2C5133 +56A558DE58DF58E25BF59F905EEC61F261F761F661F56500650F66E066DD6AE5 +6ADD6ADA6AD3701B701F7028701A701D701570187206720D725872A273780000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000737A74BD74CA74E375877586765F766177C7791979B17A6B7A697C3E7C3F +7C387C3D7C377C407E6B7E6D7E797E697E6A7F857E737FB67FB97FB881D885E9 +85DD85EA85D585E485E585F787FB8805880D87F987FE8960895F8956895E8B41 +8B5C8B588B498B5A8B4E8B4F8B468B598D088D0A8E7C8E728E878E768E6C8E7A +8E748F548F4E8FAD908A908B91B191AE93E193D193DF93C393C893DC93DD93D6 +93E293CD93D893E493D793E895DC96B496E3972A9727976197DC97FB985E0000 +C4 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +9858985B98BC994599499A169A199B0D9BE89BE79BD69BDB9D899D619D729D6A +9D6C9E929E979E939EB452F856A856B756B656B456BC58E45B405B435B7D5BF6 +5DC961F861FA65186514651966E667276AEC703E703070327210737B74CF7662 +76657926792A792C792B7AC77AF67C4C7C437C4D7CEF7CF08FAE7E7D7E7C0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00007E827F4C800081DA826685FB85F9861185FA8606860B8607860A88148815 +896489BA89F88B708B6C8B668B6F8B5F8B6B8D0F8D0D8E898E818E858E8291B4 +91CB9418940393FD95E1973098C49952995199A89A2B9A309A379A359C139C0D +9E799EB59EE89F2F9F5F9F639F615137513856C156C056C259145C6C5DCD61FC +61FE651D651C659566E96AFB6B046AFA6BB2704C721B72A774D674D4766977D3 +7C507E8F7E8C7FBC8617862D861A882388228821881F896A896C89BD8B740000 +C5 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +8B778B7D8D138E8A8E8D8E8B8F5F8FAF91BA942E94339435943A94389432942B +95E297389739973297FF9867986599579A459A439A409A3E9ACF9B549B519C2D +9C259DAF9DB49DC29DB89E9D9EEF9F199F5C9F669F67513C513B56C856CA56C9 +5B7F5DD45DD25F4E61FF65246B0A6B6170517058738074E4758A766E766C0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000079B37C607C5F807E807D81DF8972896F89FC8B808D168D178E918E938F61 +9148944494519452973D973E97C397C1986B99559A559A4D9AD29B1A9C499C31 +9C3E9C3B9DD39DD79F349F6C9F6A9F9456CC5DD662006523652B652A66EC6B10 +74DA7ACA7C647C637C657E937E967E9481E28638863F88318B8A9090908F9463 +946094649768986F995C9A5A9A5B9A579AD39AD49AD19C549C579C569DE59E9F +9EF456D158E9652C705E7671767277D77F507F888836883988628B938B920000 +C6 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +8B9682778D1B91C0946A97429748974497C698709A5F9B229B589C5F9DF99DFA +9E7C9E7D9F079F779F725EF36B1670637C6C7C6E883B89C08EA191C194729470 +9871995E9AD69B239ECC706477DA8B9A947797C99A629A657E9C8B9C8EAA91C5 +947D947E947C9C779C789EF78C54947F9E1A72289A6A9B319E1B9E1E7C720000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000030FE309D309E3005304130423043304430453046304730483049304A304B +304C304D304E304F3050305130523053305430553056305730583059305A305B +305C305D305E305F3060306130623063306430653066306730683069306A306B +306C306D306E306F3070307130723073307430753076307730783079307A307B +307C307D307E307F3080308130823083308430853086308730883089308A308B +308C308D308E308F309030913092309330A130A230A330A430A530A630A70000 +C7 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +30A830A930AA30AB30AC30AD30AE30AF30B030B130B230B330B430B530B630B7 +30B830B930BA30BB30BC30BD30BE30BF30C030C130C230C330C430C530C630C7 +30C830C930CA30CB30CC30CD30CE30CF30D030D130D230D330D430D530D630D7 +30D830D930DA30DB30DC30DD30DE30DF30E030E130E230E330E430E530E60000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000030E730E830E930EA30EB30EC30ED30EE30EF30F030F130F230F330F430F5 +30F60414041504010416041704180419041A041B041C04230424042504260427 +04280429042A042B042C042D042E042F04300431043204330434043504510436 +043704380439043A043B043C043D043E043F0440044104420443044404450446 +044704480449044A044B044C044D044E044F2460246124622463246424652466 +246724682469247424752476247724782479247A247B247C247D000000000000 +C9 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +4E424E5C51F5531A53824E074E0C4E474E8D56D7FA0C5C6E5F734E0F51874E0E +4E2E4E934EC24EC94EC8519852FC536C53B957205903592C5C105DFF65E16BB3 +6BCC6C14723F4E314E3C4EE84EDC4EE94EE14EDD4EDA520C531C534C57225723 +5917592F5B815B845C125C3B5C745C735E045E805E825FC9620962506C150000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00006C366C436C3F6C3B72AE72B0738A79B8808A961E4F0E4F184F2C4EF54F14 +4EF14F004EF74F084F1D4F024F054F224F134F044EF44F1251B1521352095210 +52A65322531F534D538A540756E156DF572E572A5734593C5980597C5985597B +597E5977597F5B565C155C255C7C5C7A5C7B5C7E5DDF5E755E845F025F1A5F74 +5FD55FD45FCF625C625E626462616266626262596260625A626565EF65EE673E +67396738673B673A673F673C67336C186C466C526C5C6C4F6C4A6C546C4B0000 +CA +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +6C4C7071725E72B472B5738E752A767F7A757F518278827C8280827D827F864D +897E909990979098909B909496229624962096234F564F3B4F624F494F534F64 +4F3E4F674F524F5F4F414F584F2D4F334F3F4F61518F51B9521C521E522152AD +52AE530953635372538E538F54305437542A545454455419541C542554180000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000543D544F544154285424544756EE56E756E557415745574C5749574B5752 +5906594059A6599859A05997598E59A25990598F59A759A15B8E5B925C285C2A +5C8D5C8F5C885C8B5C895C925C8A5C865C935C955DE05E0A5E0E5E8B5E895E8C +5E885E8D5F055F1D5F785F765FD25FD15FD05FED5FE85FEE5FF35FE15FE45FE3 +5FFA5FEF5FF75FFB60005FF4623A6283628C628E628F629462876271627B627A +6270628162886277627D62726274653765F065F465F365F265F5674567470000 +CB +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +67596755674C6748675D674D675A674B6BD06C196C1A6C786C676C6B6C846C8B +6C8F6C716C6F6C696C9A6C6D6C876C956C9C6C666C736C656C7B6C8E7074707A +726372BF72BD72C372C672C172BA72C573957397739373947392753A75397594 +75957681793D80348095809980908092809C8290828F8285828E829182930000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000828A828382848C788FC98FBF909F90A190A5909E90A790A096309628962F +962D4E334F984F7C4F854F7D4F804F874F764F744F894F844F774F4C4F974F6A +4F9A4F794F814F784F904F9C4F944F9E4F924F824F954F6B4F6E519E51BC51BE +5235523252335246523152BC530A530B533C539253945487547F548154915482 +5488546B547A547E5465546C54745466548D546F546154605498546354675464 +56F756F9576F5772576D576B57715770577657805775577B5773577457620000 +CC +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +5768577D590C594559B559BA59CF59CE59B259CC59C159B659BC59C359D659B1 +59BD59C059C859B459C75B625B655B935B955C445C475CAE5CA45CA05CB55CAF +5CA85CAC5C9F5CA35CAD5CA25CAA5CA75C9D5CA55CB65CB05CA65E175E145E19 +5F285F225F235F245F545F825F7E5F7D5FDE5FE5602D602660196032600B0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00006034600A60176033601A601E602C6022600D6010602E60136011600C6009 +601C6214623D62AD62B462D162BE62AA62B662CA62AE62B362AF62BB62A962B0 +62B8653D65A865BB660965FC66046612660865FB6603660B660D660565FD6611 +661066F6670A6785676C678E67926776677B6798678667846774678D678C677A +679F679167996783677D67816778677967946B256B806B7E6BDE6C1D6C936CEC +6CEB6CEE6CD96CB66CD46CAD6CE76CB76CD06CC26CBA6CC36CC66CED6CF20000 +CD +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +6CD26CDD6CB46C8A6C9D6C806CDE6CC06D306CCD6CC76CB06CF96CCF6CE96CD1 +709470987085709370867084709170967082709A7083726A72D672CB72D872C9 +72DC72D272D472DA72CC72D173A473A173AD73A673A273A073AC739D74DD74E8 +753F7540753E758C759876AF76F376F176F076F577F877FC77F977FB77FA0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000077F77942793F79C57A787A7B7AFB7C757CFD8035808F80AE80A380B880B5 +80AD822082A082C082AB829A8298829B82B582A782AE82BC829E82BA82B482A8 +82A182A982C282A482C382B682A28670866F866D866E8C568FD28FCB8FD38FCD +8FD68FD58FD790B290B490AF90B390B09639963D963C963A96434FCD4FC54FD3 +4FB24FC94FCB4FC14FD44FDC4FD94FBB4FB34FDB4FC74FD64FBA4FC04FB94FEC +5244524952C052C2533D537C539753965399539854BA54A154AD54A554CF0000 +CE +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +54C3830D54B754AE54D654B654C554C654A0547054BC54A254BE547254DE54B0 +57B5579E579F57A4578C5797579D579B57945798578F579957A5579A579558F4 +590D595359E159DE59EE5A0059F159DD59FA59FD59FC59F659E459F259F759DB +59E959F359F559E059FE59F459ED5BA85C4C5CD05CD85CCC5CD75CCB5CDB0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00005CDE5CDA5CC95CC75CCA5CD65CD35CD45CCF5CC85CC65CCE5CDF5CF85DF9 +5E215E225E235E205E245EB05EA45EA25E9B5EA35EA55F075F2E5F565F866037 +603960546072605E6045605360476049605B604C60406042605F602460446058 +6066606E6242624362CF630D630B62F5630E630362EB62F9630F630C62F862F6 +63006313631462FA631562FB62F06541654365AA65BF6636662166326635661C +662666226633662B663A661D66346639662E670F671067C167F267C867BA0000 +CF +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +67DC67BB67F867D867C067B767C567EB67E467DF67B567CD67B367F767F667EE +67E367C267B967CE67E767F067B267FC67C667ED67CC67AE67E667DB67FA67C9 +67CA67C367EA67CB6B286B826B846BB66BD66BD86BE06C206C216D286D346D2D +6D1F6D3C6D3F6D126D0A6CDA6D336D046D196D3A6D1A6D116D006D1D6D420000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00006D016D186D376D036D0F6D406D076D206D2C6D086D226D096D1070B7709F +70BE70B170B070A170B470B570A972417249724A726C72707273726E72CA72E4 +72E872EB72DF72EA72E672E3738573CC73C273C873C573B973B673B573B473EB +73BF73C773BE73C373C673B873CB74EC74EE752E7547754875A775AA767976C4 +7708770377047705770A76F776FB76FA77E777E878067811781278057810780F +780E780978037813794A794C794B7945794479D579CD79CF79D679CE7A800000 +D0 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +7A7E7AD17B007B017C7A7C787C797C7F7C807C817D037D087D017F587F917F8D +7FBE8007800E800F8014803780D880C780E080D180C880C280D080C580E380D9 +80DC80CA80D580C980CF80D780E680CD81FF8221829482D982FE82F9830782E8 +830082D5833A82EB82D682F482EC82E182F282F5830C82FB82F682F082EA0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000082E482E082FA82F382ED86778674867C86738841884E8867886A886989D3 +8A048A078D728FE38FE18FEE8FE090F190BD90BF90D590C590BE90C790CB90C8 +91D491D39654964F96519653964A964E501E50055007501350225030501B4FF5 +4FF450335037502C4FF64FF75017501C502050275035502F5031500E515A5194 +519351CA51C451C551C851CE5261525A5252525E525F5255526252CD530E539E +552654E25517551254E754F354E4551A54FF5504550854EB5511550554F10000 +D1 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +550A54FB54F754F854E0550E5503550B5701570257CC583257D557D257BA57C6 +57BD57BC57B857B657BF57C757D057B957C1590E594A5A195A165A2D5A2E5A15 +5A0F5A175A0A5A1E5A335B6C5BA75BAD5BAC5C035C565C545CEC5CFF5CEE5CF1 +5CF75D005CF95E295E285EA85EAE5EAA5EAC5F335F305F67605D605A60670000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000604160A26088608060926081609D60836095609B60976087609C608E6219 +624662F263106356632C634463456336634363E46339634B634A633C63296341 +6334635863546359632D63476333635A63516338635763406348654A654665C6 +65C365C465C2664A665F6647665167126713681F681A684968326833683B684B +684F68166831681C6835682B682D682F684E68446834681D6812681468266828 +682E684D683A682568206B2C6B2F6B2D6B316B346B6D80826B886BE66BE40000 +D2 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +6BE86BE36BE26BE76C256D7A6D636D646D766D0D6D616D926D586D626D6D6D6F +6D916D8D6DEF6D7F6D866D5E6D676D606D976D706D7C6D5F6D826D986D2F6D68 +6D8B6D7E6D806D846D166D836D7B6D7D6D756D9070DC70D370D170DD70CB7F39 +70E270D770D270DE70E070D470CD70C570C670C770DA70CE70E1724272780000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000072777276730072FA72F472FE72F672F372FB730173D373D973E573D673BC +73E773E373E973DC73D273DB73D473DD73DA73D773D873E874DE74DF74F474F5 +7521755B755F75B075C175BB75C475C075BF75B675BA768A76C9771D771B7710 +771377127723771177157719771A772277277823782C78227835782F7828782E +782B782178297833782A78317954795B794F795C79537952795179EB79EC79E0 +79EE79ED79EA79DC79DE79DD7A867A897A857A8B7A8C7A8A7A877AD87B100000 +D3 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +7B047B137B057B0F7B087B0A7B0E7B097B127C847C917C8A7C8C7C887C8D7C85 +7D1E7D1D7D117D0E7D187D167D137D1F7D127D0F7D0C7F5C7F617F5E7F607F5D +7F5B7F967F927FC37FC27FC08016803E803980FA80F280F980F5810180FB8100 +8201822F82258333832D83448319835183258356833F83418326831C83220000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00008342834E831B832A8308833C834D8316832483208337832F832983478345 +834C8353831E832C834B832783488653865286A286A88696868D8691869E8687 +86978686868B869A868586A5869986A186A786958698868E869D869086948843 +8844886D88758876887288808871887F886F8883887E8874887C8A128C478C57 +8C7B8CA48CA38D768D788DB58DB78DB68ED18ED38FFE8FF590028FFF8FFB9004 +8FFC8FF690D690E090D990DA90E390DF90E590D890DB90D790DC90E491500000 +D4 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +914E914F91D591E291DA965C965F96BC98E39ADF9B2F4E7F5070506A5061505E +50605053504B505D50725048504D5041505B504A506250155045505F5069506B +5063506450465040506E50735057505151D0526B526D526C526E52D652D3532D +539C55755576553C554D55505534552A55515562553655355530555255450000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000550C55325565554E55395548552D553B5540554B570A570757FB581457E2 +57F657DC57F4580057ED57FD580857F8580B57F357CF580757EE57E357F257E5 +57EC57E1580E57FC581057E75801580C57F157E957F0580D5804595C5A605A58 +5A555A675A5E5A385A355A6D5A505A5F5A655A6C5A535A645A575A435A5D5A52 +5A445A5B5A485A8E5A3E5A4D5A395A4C5A705A695A475A515A565A425A5C5B72 +5B6E5BC15BC05C595D1E5D0B5D1D5D1A5D205D0C5D285D0D5D265D255D0F0000 +D5 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +5D305D125D235D1F5D2E5E3E5E345EB15EB45EB95EB25EB35F365F385F9B5F96 +5F9F608A6090608660BE60B060BA60D360D460CF60E460D960DD60C860B160DB +60B760CA60BF60C360CD60C063326365638A6382637D63BD639E63AD639D6397 +63AB638E636F63876390636E63AF6375639C636D63AE637C63A4633B639F0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00006378638563816391638D6370655365CD66656661665B6659665C66626718 +687968876890689C686D686E68AE68AB6956686F68A368AC68A96875687468B2 +688F68776892687C686B687268AA68806871687E689B6896688B68A0688968A4 +6878687B6891688C688A687D6B366B336B376B386B916B8F6B8D6B8E6B8C6C2A +6DC06DAB6DB46DB36E746DAC6DE96DE26DB76DF66DD46E006DC86DE06DDF6DD6 +6DBE6DE56DDC6DDD6DDB6DF46DCA6DBD6DED6DF06DBA6DD56DC26DCF6DC90000 +D6 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +6DD06DF26DD36DFD6DD76DCD6DE36DBB70FA710D70F7711770F4710C70F07104 +70F3711070FC70FF71067113710070F870F6710B7102710E727E727B727C727F +731D7317730773117318730A730872FF730F731E738873F673F873F574047401 +73FD7407740073FA73FC73FF740C740B73F474087564756375CE75D275CF0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000075CB75CC75D175D0768F768976D37739772F772D7731773277347733773D +7725773B7735784878527849784D784A784C782678457850796479677969796A +7963796B796179BB79FA79F879F679F77A8F7A947A907B357B477B347B257B30 +7B227B247B337B187B2A7B1D7B317B2B7B2D7B2F7B327B387B1A7B237C947C98 +7C967CA37D357D3D7D387D367D3A7D457D2C7D297D417D477D3E7D3F7D4A7D3B +7D287F637F957F9C7F9D7F9B7FCA7FCB7FCD7FD07FD17FC77FCF7FC9801F0000 +D7 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +801E801B804780438048811881258119811B812D811F812C811E812181158127 +811D8122821182388233823A823482328274839083A383A8838D837A837383A4 +8374838F8381839583998375839483A9837D8383838C839D839B83AA838B837E +83A583AF8388839783B0837F83A6838783AE8376839A8659865686BF86B70000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000086C286C186C586BA86B086C886B986B386B886CC86B486BB86BC86C386BD +86BE88528889889588A888A288AA889A889188A1889F889888A78899889B8897 +88A488AC888C8893888E898289D689D989D58A308A278A2C8A1E8C398C3B8C5C +8C5D8C7D8CA58D7D8D7B8D798DBC8DC28DB98DBF8DC18ED88EDE8EDD8EDC8ED7 +8EE08EE19024900B9011901C900C902190EF90EA90F090F490F290F390D490EB +90EC90E991569158915A9153915591EC91F491F191F391F891E491F991EA0000 +D8 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +91EB91F791E891EE957A95869588967C966D966B9671966F96BF976A980498E5 +9997509B50955094509E508B50A35083508C508E509D5068509C509250825087 +515F51D45312531153A453A7559155A855A555AD5577564555A255935588558F +55B5558155A3559255A4557D558C55A6557F559555A1558E570C582958370000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00005819581E58275823582857F558485825581C581B5833583F5836582E5839 +5838582D582C583B59615AAF5A945A9F5A7A5AA25A9E5A785AA65A7C5AA55AAC +5A955AAE5A375A845A8A5A975A835A8B5AA95A7B5A7D5A8C5A9C5A8F5A935A9D +5BEA5BCD5BCB5BD45BD15BCA5BCE5C0C5C305D375D435D6B5D415D4B5D3F5D35 +5D515D4E5D555D335D3A5D525D3D5D315D595D425D395D495D385D3C5D325D36 +5D405D455E445E415F585FA65FA55FAB60C960B960CC60E260CE60C461140000 +D9 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +60F2610A6116610560F5611360F860FC60FE60C161036118611D611060FF6104 +610B624A639463B163B063CE63E563E863EF63C3649D63F363CA63E063F663D5 +63F263F5646163DF63BE63DD63DC63C463D863D363C263C763CC63CB63C863F0 +63D763D965326567656A6564655C65686565658C659D659E65AE65D065D20000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000667C666C667B668066716679666A66726701690C68D3690468DC692A68EC +68EA68F1690F68D668F768EB68E468F66913691068F368E1690768CC69086970 +68B4691168EF68C6691468F868D068FD68FC68E8690B690A691768CE68C868DD +68DE68E668F468D1690668D468E96915692568C76B396B3B6B3F6B3C6B946B97 +6B996B956BBD6BF06BF26BF36C306DFC6E466E476E1F6E496E886E3C6E3D6E45 +6E626E2B6E3F6E416E5D6E736E1C6E336E4B6E406E516E3B6E036E2E6E5E0000 +DA +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +6E686E5C6E616E316E286E606E716E6B6E396E226E306E536E656E276E786E64 +6E776E556E796E526E666E356E366E5A7120711E712F70FB712E713171237125 +71227132711F7128713A711B724B725A7288728972867285728B7312730B7330 +73227331733373277332732D732673237335730C742E742C7430742B74160000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000741A7421742D743174247423741D74297420743274FB752F756F756C75E7 +75DA75E175E675DD75DF75E475D77695769276DA774677477744774D7745774A +774E774B774C77DE77EC786078647865785C786D7871786A786E787078697868 +785E786279747973797279707A027A0A7A037A0C7A047A997AE67AE47B4A7B3B +7B447B487B4C7B4E7B407B587B457CA27C9E7CA87CA17D587D6F7D637D537D56 +7D677D6A7D4F7D6D7D5C7D6B7D527D547D697D517D5F7D4E7F3E7F3F7F650000 +DB +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +7F667FA27FA07FA17FD78051804F805080FE80D48143814A8152814F8147813D +814D813A81E681EE81F781F881F98204823C823D823F8275833B83CF83F98423 +83C083E8841283E783E483FC83F6841083C683C883EB83E383BF840183DD83E5 +83D883FF83E183CB83CE83D683F583C98409840F83DE8411840683C283F30000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000083D583FA83C783D183EA841383C383EC83EE83C483FB83D783E2841B83DB +83FE86D886E286E686D386E386DA86EA86DD86EB86DC86EC86E986D786E886D1 +88488856885588BA88D788B988B888C088BE88B688BC88B788BD88B2890188C9 +89958998899789DD89DA89DB8A4E8A4D8A398A598A408A578A588A448A458A52 +8A488A518A4A8A4C8A4F8C5F8C818C808CBA8CBE8CB08CB98CB58D848D808D89 +8DD88DD38DCD8DC78DD68DDC8DCF8DD58DD98DC88DD78DC58EEF8EF78EFA0000 +DC +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +8EF98EE68EEE8EE58EF58EE78EE88EF68EEB8EF18EEC8EF48EE9902D9034902F +9106912C910490FF90FC910890F990FB9101910091079105910391619164915F +916291609201920A92259203921A9226920F920C9200921291FF91FD92069204 +92279202921C92249219921792059216957B958D958C95909687967E96880000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000096899683968096C296C896C396F196F0976C9770976E980798A998EB9CE6 +9EF94E834E844EB650BD50BF50C650AE50C450CA50B450C850C250B050C150BA +50B150CB50C950B650B851D7527A5278527B527C55C355DB55CC55D055CB55CA +55DD55C055D455C455E955BF55D2558D55CF55D555E255D655C855F255CD55D9 +55C25714585358685864584F584D5849586F5855584E585D58595865585B583D +5863587158FC5AC75AC45ACB5ABA5AB85AB15AB55AB05ABF5AC85ABB5AC60000 +DD +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +5AB75AC05ACA5AB45AB65ACD5AB95A905BD65BD85BD95C1F5C335D715D635D4A +5D655D725D6C5D5E5D685D675D625DF05E4F5E4E5E4A5E4D5E4B5EC55ECC5EC6 +5ECB5EC75F405FAF5FAD60F76149614A612B614561366132612E6146612F614F +612961406220916862236225622463C563F163EB641064126409642064240000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000064336443641F641564186439643764226423640C64266430642864416435 +642F640A641A644064256427640B63E7641B642E6421640E656F659265D36686 +668C66956690668B668A66996694667867206966695F6938694E69626971693F +6945696A6939694269576959697A694869496935696C6933693D696568F06978 +693469696940696F69446976695869416974694C693B694B6937695C694F6951 +69326952692F697B693C6B466B456B436B426B486B416B9BFA0D6BFB6BFC0000 +DE +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +6BF96BF76BF86E9B6ED66EC86E8F6EC06E9F6E936E946EA06EB16EB96EC66ED2 +6EBD6EC16E9E6EC96EB76EB06ECD6EA66ECF6EB26EBE6EC36EDC6ED86E996E92 +6E8E6E8D6EA46EA16EBF6EB36ED06ECA6E976EAE6EA371477154715271637160 +7141715D716271727178716A7161714271587143714B7170715F715071530000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00007144714D715A724F728D728C72917290728E733C7342733B733A7340734A +73497444744A744B7452745174577440744F7450744E74427446744D745474E1 +74FF74FE74FD751D75797577698375EF760F760375F775FE75FC75F975F87610 +75FB75F675ED75F575FD769976B576DD7755775F776077527756775A77697767 +77547759776D77E07887789A7894788F788478957885788678A1788378797899 +78807896787B797C7982797D79797A117A187A197A127A177A157A227A130000 +DF +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +7A1B7A107AA37AA27A9E7AEB7B667B647B6D7B747B697B727B657B737B717B70 +7B617B787B767B637CB27CB47CAF7D887D867D807D8D7D7F7D857D7A7D8E7D7B +7D837D7C7D8C7D947D847D7D7D927F6D7F6B7F677F687F6C7FA67FA57FA77FDB +7FDC8021816481608177815C8169815B816281726721815E81768167816F0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000081448161821D8249824482408242824584F1843F845684768479848F848D +846584518440848684678430844D847D845A845984748473845D8507845E8437 +843A8434847A8443847884328445842983D9844B842F8442842D845F84708439 +844E844C8452846F84C5848E843B8447843684338468847E8444842B84608454 +846E8450870B870486F7870C86FA86D686F5874D86F8870E8709870186F6870D +870588D688CB88CD88CE88DE88DB88DA88CC88D08985899B89DF89E589E40000 +E0 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +89E189E089E289DC89E68A768A868A7F8A618A3F8A778A828A848A758A838A81 +8A748A7A8C3C8C4B8C4A8C658C648C668C868C848C858CCC8D688D698D918D8C +8D8E8D8F8D8D8D938D948D908D928DF08DE08DEC8DF18DEE8DD08DE98DE38DE2 +8DE78DF28DEB8DF48F068EFF8F018F008F058F078F088F028F0B9052903F0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000090449049903D9110910D910F911191169114910B910E916E916F92489252 +9230923A926692339265925E9283922E924A9246926D926C924F92609267926F +92369261927092319254926392509272924E9253924C92569232959F959C959E +959B969296939691969796CE96FA96FD96F896F59773977797789772980F980D +980E98AC98F698F999AF99B299B099B59AAD9AAB9B5B9CEA9CED9CE79E809EFD +50E650D450D750E850F350DB50EA50DD50E450D350EC50F050EF50E350E00000 +E1 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +51D85280528152E952EB533053AC56275615560C561255FC560F561C56015613 +560255FA561D560455FF55F95889587C5890589858865881587F5874588B587A +58875891588E587658825888587B5894588F58FE596B5ADC5AEE5AE55AD55AEA +5ADA5AED5AEB5AF35AE25AE05ADB5AEC5ADE5ADD5AD95AE85ADF5B775BE00000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00005BE35C635D825D805D7D5D865D7A5D815D775D8A5D895D885D7E5D7C5D8D +5D795D7F5E585E595E535ED85ED15ED75ECE5EDC5ED55ED95ED25ED45F445F43 +5F6F5FB6612C61286141615E61716173615261536172616C618061746154617A +615B6165613B616A6161615662296227622B642B644D645B645D647464766472 +6473647D6475646664A6644E6482645E645C644B645364606450647F643F646C +646B645964656477657365A066A166A0669F67056704672269B169B669C90000 +E2 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +69A069CE699669B069AC69BC69916999698E69A7698D69A969BE69AF69BF69C4 +69BD69A469D469B969CA699A69CF69B3699369AA69A1699E69D96997699069C2 +69B569A569C66B4A6B4D6B4B6B9E6B9F6BA06BC36BC46BFE6ECE6EF56EF16F03 +6F256EF86F376EFB6F2E6F096F4E6F196F1A6F276F186F3B6F126EED6F0A0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00006F366F736EF96EEE6F2D6F406F306F3C6F356EEB6F076F0E6F436F056EFD +6EF66F396F1C6EFC6F3A6F1F6F0D6F1E6F086F21718771907189718071857182 +718F717B718671817197724472537297729572937343734D7351734C74627473 +7471747574727467746E750075027503757D759076167608760C76157611760A +761476B87781777C77857782776E7780776F777E778378B278AA78B478AD78A8 +787E78AB789E78A578A078AC78A278A47998798A798B79967995799479930000 +E3 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +79977988799279907A2B7A4A7A307A2F7A287A267AA87AAB7AAC7AEE7B887B9C +7B8A7B917B907B967B8D7B8C7B9B7B8E7B857B9852847B997BA47B827CBB7CBF +7CBC7CBA7DA77DB77DC27DA37DAA7DC17DC07DC57D9D7DCE7DC47DC67DCB7DCC +7DAF7DB97D967DBC7D9F7DA67DAE7DA97DA17DC97F737FE27FE37FE57FDE0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00008024805D805C8189818681838187818D818C818B8215849784A484A1849F +84BA84CE84C284AC84AE84AB84B984B484C184CD84AA849A84B184D0849D84A7 +84BB84A2849484C784CC849B84A984AF84A884D6849884B684CF84A084D784D4 +84D284DB84B084918661873387238728876B8740872E871E87218719871B8743 +872C8741873E874687208732872A872D873C8712873A87318735874287268727 +87388724871A8730871188F788E788F188F288FA88FE88EE88FC88F688FB0000 +E4 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +88F088EC88EB899D89A1899F899E89E989EB89E88AAB8A998A8B8A928A8F8A96 +8C3D8C688C698CD58CCF8CD78D968E098E028DFF8E0D8DFD8E0A8E038E078E06 +8E058DFE8E008E048F108F118F0E8F0D9123911C91209122911F911D911A9124 +9121911B917A91729179917392A592A49276929B927A92A0929492AA928D0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000092A6929A92AB92799297927F92A392EE928E9282929592A2927D928892A1 +928A9286928C929992A7927E928792A9929D928B922D969E96A196FF9758977D +977A977E978397809782977B97849781977F97CE97CD981698AD98AE99029900 +9907999D999C99C399B999BB99BA99C299BD99C79AB19AE39AE79B3E9B3F9B60 +9B619B5F9CF19CF29CF59EA750FF5103513050F85106510750F650FE510B510C +50FD510A528B528C52F152EF56485642564C56355641564A5649564656580000 +E5 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +565A56405633563D562C563E5638562A563A571A58AB589D58B158A058A358AF +58AC58A558A158FF5AFF5AF45AFD5AF75AF65B035AF85B025AF95B015B075B05 +5B0F5C675D995D975D9F5D925DA25D935D955DA05D9C5DA15D9A5D9E5E695E5D +5E605E5C7DF35EDB5EDE5EE15F495FB2618B6183617961B161B061A261890000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000619B619361AF61AD619F619261AA61A1618D616661B3622D646E64706496 +64A064856497649C648F648B648A648C64A3649F646864B164986576657A6579 +657B65B265B366B566B066A966B266B766AA66AF6A006A066A1769E569F86A15 +69F169E46A2069FF69EC69E26A1B6A1D69FE6A2769F269EE6A1469F769E76A40 +6A0869E669FB6A0D69FC69EB6A096A046A186A256A0F69F66A266A0769F46A16 +6B516BA56BA36BA26BA66C016C006BFF6C026F416F266F7E6F876FC66F920000 +E6 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +6F8D6F896F8C6F626F4F6F856F5A6F966F766F6C6F826F556F726F526F506F57 +6F946F936F5D6F006F616F6B6F7D6F676F906F536F8B6F696F7F6F956F636F77 +6F6A6F7B71B271AF719B71B071A0719A71A971B5719D71A5719E71A471A171AA +719C71A771B37298729A73587352735E735F7360735D735B7361735A73590000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000736274877489748A74867481747D74857488747C747975087507757E7625 +761E7619761D761C7623761A7628761B769C769D769E769B778D778F77897788 +78CD78BB78CF78CC78D178CE78D478C878C378C478C9799A79A179A0799C79A2 +799B6B767A397AB27AB47AB37BB77BCB7BBE7BAC7BCE7BAF7BB97BCA7BB57CC5 +7CC87CCC7CCB7DF77DDB7DEA7DE77DD77DE17E037DFA7DE67DF67DF17DF07DEE +7DDF7F767FAC7FB07FAD7FED7FEB7FEA7FEC7FE67FE88064806781A3819F0000 +E7 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +819E819581A2819981978216824F825382528250824E82518524853B850F8500 +8529850E8509850D851F850A8527851C84FB852B84FA8508850C84F4852A84F2 +851584F784EB84F384FC851284EA84E9851684FE8528851D852E850284FD851E +84F68531852684E784E884F084EF84F9851885208530850B8519852F86620000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000875687638764877787E1877387588754875B87528761875A8751875E876D +876A8750874E875F875D876F876C877A876E875C8765874F877B877587628767 +8769885A8905890C8914890B891789188919890689168911890E890989A289A4 +89A389ED89F089EC8ACF8AC68AB88AD38AD18AD48AD58ABB8AD78ABE8AC08AC5 +8AD88AC38ABA8ABD8AD98C3E8C4D8C8F8CE58CDF8CD98CE88CDA8CDD8CE78DA0 +8D9C8DA18D9B8E208E238E258E248E2E8E158E1B8E168E118E198E268E270000 +E8 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +8E148E128E188E138E1C8E178E1A8F2C8F248F188F1A8F208F238F168F179073 +9070906F9067906B912F912B9129912A91329126912E91859186918A91819182 +9184918092D092C392C492C092D992B692CF92F192DF92D892E992D792DD92CC +92EF92C292E892CA92C892CE92E692CD92D592C992E092DE92E792D192D30000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000092B592E192C692B4957C95AC95AB95AE95B096A496A296D3970597089702 +975A978A978E978897D097CF981E981D9826982998289820981B982798B29908 +98FA9911991499169917991599DC99CD99CF99D399D499CE99C999D699D899CB +99D799CC9AB39AEC9AEB9AF39AF29AF19B469B439B679B749B719B669B769B75 +9B709B689B649B6C9CFC9CFA9CFD9CFF9CF79D079D009CF99CFB9D089D059D04 +9E839ED39F0F9F10511C51135117511A511151DE533453E156705660566E0000 +E9 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +567356665663566D5672565E5677571C571B58C858BD58C958BF58BA58C258BC +58C65B175B195B1B5B215B145B135B105B165B285B1A5B205B1E5BEF5DAC5DB1 +5DA95DA75DB55DB05DAE5DAA5DA85DB25DAD5DAF5DB45E675E685E665E6F5EE9 +5EE75EE65EE85EE55F4B5FBC619D61A8619661C561B461C661C161CC61BA0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000061BF61B8618C64D764D664D064CF64C964BD648964C364DB64F364D96533 +657F657C65A266C866BE66C066CA66CB66CF66BD66BB66BA66CC67236A346A66 +6A496A676A326A686A3E6A5D6A6D6A766A5B6A516A286A5A6A3B6A3F6A416A6A +6A646A506A4F6A546A6F6A696A606A3C6A5E6A566A556A4D6A4E6A466B556B54 +6B566BA76BAA6BAB6BC86BC76C046C036C066FAD6FCB6FA36FC76FBC6FCE6FC8 +6F5E6FC46FBD6F9E6FCA6FA870046FA56FAE6FBA6FAC6FAA6FCF6FBF6FB80000 +EA +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +6FA26FC96FAB6FCD6FAF6FB26FB071C571C271BF71B871D671C071C171CB71D4 +71CA71C771CF71BD71D871BC71C671DA71DB729D729E736973667367736C7365 +736B736A747F749A74A074947492749574A1750B7580762F762D7631763D7633 +763C76357632763076BB76E6779A779D77A1779C779B77A277A3779577990000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000779778DD78E978E578EA78DE78E378DB78E178E278ED78DF78E079A47A44 +7A487A477AB67AB87AB57AB17AB77BDE7BE37BE77BDD7BD57BE57BDA7BE87BF9 +7BD47BEA7BE27BDC7BEB7BD87BDF7CD27CD47CD77CD07CD17E127E217E177E0C +7E1F7E207E137E0E7E1C7E157E1A7E227E0B7E0F7E167E0D7E147E257E247F43 +7F7B7F7C7F7A7FB17FEF802A8029806C81B181A681AE81B981B581AB81B081AC +81B481B281B781A781F282558256825785568545856B854D8553856185580000 +EB +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +854085468564854185628544855185478563853E855B8571854E856E85758555 +85678560858C8566855D85548565856C866386658664879B878F879787938792 +87888781879687988779878787A3878587908791879D87848794879C879A8789 +891E89268930892D892E89278931892289298923892F892C891F89F18AE00000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00008AE28AF28AF48AF58ADD8B148AE48ADF8AF08AC88ADE8AE18AE88AFF8AEF +8AFB8C918C928C908CF58CEE8CF18CF08CF38D6C8D6E8DA58DA78E338E3E8E38 +8E408E458E368E3C8E3D8E418E308E3F8EBD8F368F2E8F358F328F398F378F34 +90769079907B908690FA913391359136919391909191918D918F9327931E9308 +931F9306930F937A9338933C931B9323931293019346932D930E930D92CB931D +92FA9325931392F992F793349302932492FF932993399335932A9314930C0000 +EC +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +930B92FE9309930092FB931695BC95CD95BE95B995BA95B695BF95B595BD96A9 +96D4970B9712971097999797979497F097F89835982F98329924991F99279929 +999E99EE99EC99E599E499F099E399EA99E999E79AB99ABF9AB49ABB9AF69AFA +9AF99AF79B339B809B859B879B7C9B7E9B7B9B829B939B929B909B7A9B950000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00009B7D9B889D259D179D209D1E9D149D299D1D9D189D229D109D199D1F9E88 +9E869E879EAE9EAD9ED59ED69EFA9F129F3D51265125512251245120512952F4 +5693568C568D568656845683567E5682567F568158D658D458CF58D25B2D5B25 +5B325B235B2C5B275B265B2F5B2E5B7B5BF15BF25DB75E6C5E6A5FBE5FBB61C3 +61B561BC61E761E061E561E461E861DE64EF64E964E364EB64E464E865816580 +65B665DA66D26A8D6A966A816AA56A896A9F6A9B6AA16A9E6A876A936A8E0000 +ED +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +6A956A836AA86AA46A916A7F6AA66A9A6A856A8C6A926B5B6BAD6C096FCC6FA9 +6FF46FD46FE36FDC6FED6FE76FE66FDE6FF26FDD6FE26FE871E171F171E871F2 +71E471F071E27373736E736F749774B274AB749074AA74AD74B174A574AF7510 +75117512750F7584764376487649764776A476E977B577AB77B277B777B60000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000077B477B177A877F078F378FD790278FB78FC78F2790578F978FE790479AB +79A87A5C7A5B7A567A587A547A5A7ABE7AC07AC17C057C0F7BF27C007BFF7BFB +7C0E7BF47C0B7BF37C027C097C037C017BF87BFD7C067BF07BF17C107C0A7CE8 +7E2D7E3C7E427E3398487E387E2A7E497E407E477E297E4C7E307E3B7E367E44 +7E3A7F457F7F7F7E7F7D7FF47FF2802C81BB81C481CC81CA81C581C781BC81E9 +825B825A825C85838580858F85A7859585A0858B85A3857B85A4859A859E0000 +EE +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +8577857C858985A1857A85788557858E85968586858D8599859D858185A28582 +858885858579857685988590859F866887BE87AA87AD87C587B087AC87B987B5 +87BC87AE87C987C387C287CC87B787AF87C487CA87B487B687BF87B887BD87DE +87B289358933893C893E894189528937894289AD89AF89AE89F289F38B1E0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00008B188B168B118B058B0B8B228B0F8B128B158B078B0D8B088B068B1C8B13 +8B1A8C4F8C708C728C718C6F8C958C948CF98D6F8E4E8E4D8E538E508E4C8E47 +8F438F409085907E9138919A91A2919B9199919F91A1919D91A093A1938393AF +936493569347937C9358935C93769349935093519360936D938F934C936A9379 +935793559352934F93719377937B9361935E936393679380934E935995C795C0 +95C995C395C595B796AE96B096AC9720971F9718971D9719979A97A1979C0000 +EF +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +979E979D97D597D497F198419844984A9849984598439925992B992C992A9933 +9932992F992D99319930999899A399A19A0299FA99F499F799F999F899F699FB +99FD99FE99FC9A039ABE9AFE9AFD9B019AFC9B489B9A9BA89B9E9B9B9BA69BA1 +9BA59BA49B869BA29BA09BAF9D339D419D679D369D2E9D2F9D319D389D300000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00009D459D429D439D3E9D379D409D3D7FF59D2D9E8A9E899E8D9EB09EC89EDA +9EFB9EFF9F249F239F229F549FA05131512D512E5698569C5697569A569D5699 +59705B3C5C695C6A5DC05E6D5E6E61D861DF61ED61EE61F161EA61F061EB61D6 +61E964FF650464FD64F86501650364FC659465DB66DA66DB66D86AC56AB96ABD +6AE16AC66ABA6AB66AB76AC76AB46AAD6B5E6BC96C0B7007700C700D70017005 +7014700E6FFF70006FFB70266FFC6FF7700A720171FF71F9720371FD73760000 +F0 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +74B874C074B574C174BE74B674BB74C275147513765C76647659765076537657 +765A76A676BD76EC77C277BA78FF790C79137914790979107912791179AD79AC +7A5F7C1C7C297C197C207C1F7C2D7C1D7C267C287C227C257C307E5C7E507E56 +7E637E587E627E5F7E517E607E577E537FB57FB37FF77FF8807581D181D20000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000081D0825F825E85B485C685C085C385C285B385B585BD85C785C485BF85CB +85CE85C885C585B185B685D2862485B885B785BE866987E787E687E287DB87EB +87EA87E587DF87F387E487D487DC87D387ED87D887E387A487D787D9880187F4 +87E887DD8953894B894F894C89468950895189498B2A8B278B238B338B308B35 +8B478B2F8B3C8B3E8B318B258B378B268B368B2E8B248B3B8B3D8B3A8C428C75 +8C998C988C978CFE8D048D028D008E5C8E628E608E578E568E5E8E658E670000 +F1 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +8E5B8E5A8E618E5D8E698E548F468F478F488F4B9128913A913B913E91A891A5 +91A791AF91AA93B5938C939293B7939B939D938993A7938E93AA939E93A69395 +93889399939F938D93B1939193B293A493A893B493A393A595D295D395D196B3 +96D796DA5DC296DF96D896DD97239722972597AC97AE97A897AB97A497AA0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000097A297A597D797D997D697D897FA98509851985298B89941993C993A9A0F +9A0B9A099A0D9A049A119A0A9A059A079A069AC09ADC9B089B049B059B299B35 +9B4A9B4C9B4B9BC79BC69BC39BBF9BC19BB59BB89BD39BB69BC49BB99BBD9D5C +9D539D4F9D4A9D5B9D4B9D599D569D4C9D579D529D549D5F9D589D5A9E8E9E8C +9EDF9F019F009F169F259F2B9F2A9F299F289F4C9F5551345135529652F753B4 +56AB56AD56A656A756AA56AC58DA58DD58DB59125B3D5B3E5B3F5DC35E700000 +F2 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +5FBF61FB65076510650D6509650C650E658465DE65DD66DE6AE76AE06ACC6AD1 +6AD96ACB6ADF6ADC6AD06AEB6ACF6ACD6ADE6B606BB06C0C7019702770207016 +702B702170227023702970177024701C702A720C720A72077202720572A572A6 +72A472A372A174CB74C574B774C37516766077C977CA77C477F1791D791B0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00007921791C7917791E79B07A677A687C337C3C7C397C2C7C3B7CEC7CEA7E76 +7E757E787E707E777E6F7E7A7E727E747E687F4B7F4A7F837F867FB77FFD7FFE +807881D781D582648261826385EB85F185ED85D985E185E885DA85D785EC85F2 +85F885D885DF85E385DC85D185F085E685EF85DE85E2880087FA880387F687F7 +8809880C880B880687FC880887FF880A88028962895A895B89578961895C8958 +895D8959898889B789B689F68B508B488B4A8B408B538B568B548B4B8B550000 +F3 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +8B518B428B528B578C438C778C768C9A8D068D078D098DAC8DAA8DAD8DAB8E6D +8E788E738E6A8E6F8E7B8EC28F528F518F4F8F508F538FB49140913F91B091AD +93DE93C793CF93C293DA93D093F993EC93CC93D993A993E693CA93D493EE93E3 +93D593C493CE93C093D293E7957D95DA95DB96E19729972B972C972897260000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000097B397B797B697DD97DE97DF985C9859985D985798BF98BD98BB98BE9948 +9947994399A699A79A1A9A159A259A1D9A249A1B9A229A209A279A239A1E9A1C +9A149AC29B0B9B0A9B0E9B0C9B379BEA9BEB9BE09BDE9BE49BE69BE29BF09BD4 +9BD79BEC9BDC9BD99BE59BD59BE19BDA9D779D819D8A9D849D889D719D809D78 +9D869D8B9D8C9D7D9D6B9D749D759D709D699D859D739D7B9D829D6F9D799D7F +9D879D689E949E919EC09EFC9F2D9F409F419F4D9F569F579F58533756B20000 +F4 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +56B556B358E35B455DC65DC75EEE5EEF5FC05FC161F9651765166515651365DF +66E866E366E46AF36AF06AEA6AE86AF96AF16AEE6AEF703C7035702F70377034 +703170427038703F703A70397040703B703370417213721472A8737D737C74BA +76AB76AA76BE76ED77CC77CE77CF77CD77F27925792379277928792479290000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000079B27A6E7A6C7A6D7AF77C497C487C4A7C477C457CEE7E7B7E7E7E817E80 +7FBA7FFF807981DB81D9820B82688269862285FF860185FE861B860085F68604 +86098605860C85FD8819881088118817881388168963896689B989F78B608B6A +8B5D8B688B638B658B678B6D8DAE8E868E888E848F598F568F578F558F588F5A +908D9143914191B791B591B291B3940B941393FB9420940F941493FE94159410 +94289419940D93F5940093F79407940E9416941293FA940993F8940A93FF0000 +F5 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +93FC940C93F69411940695DE95E095DF972E972F97B997BB97FD97FE98609862 +9863985F98C198C29950994E9959994C994B99539A329A349A319A2C9A2A9A36 +9A299A2E9A389A2D9AC79ACA9AC69B109B129B119C0B9C089BF79C059C129BF8 +9C409C079C0E9C069C179C149C099D9F9D999DA49D9D9D929D989D909D9B0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00009DA09D949D9C9DAA9D979DA19D9A9DA29DA89D9E9DA39DBF9DA99D969DA6 +9DA79E999E9B9E9A9EE59EE49EE79EE69F309F2E9F5B9F609F5E9F5D9F599F91 +513A51395298529756C356BD56BE5B485B475DCB5DCF5EF161FD651B6B026AFC +6B036AF86B0070437044704A7048704970457046721D721A7219737E7517766A +77D0792D7931792F7C547C537CF27E8A7E877E887E8B7E867E8D7F4D7FBB8030 +81DD8618862A8626861F8623861C86198627862E862186208629861E86250000 +F6 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +8829881D881B88208824881C882B884A896D8969896E896B89FA8B798B788B45 +8B7A8B7B8D108D148DAF8E8E8E8C8F5E8F5B8F5D91469144914591B9943F943B +94369429943D943C94309439942A9437942C9440943195E595E495E39735973A +97BF97E1986498C998C698C0995899569A399A3D9A469A449A429A419A3A0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00009A3F9ACD9B159B179B189B169B3A9B529C2B9C1D9C1C9C2C9C239C289C29 +9C249C219DB79DB69DBC9DC19DC79DCA9DCF9DBE9DC59DC39DBB9DB59DCE9DB9 +9DBA9DAC9DC89DB19DAD9DCC9DB39DCD9DB29E7A9E9C9EEB9EEE9EED9F1B9F18 +9F1A9F319F4E9F659F649F924EB956C656C556CB59715B4B5B4C5DD55DD15EF2 +65216520652665226B0B6B086B096C0D7055705670577052721E721F72A9737F +74D874D574D974D7766D76AD793579B47A707A717C577C5C7C597C5B7C5A0000 +F7 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +7CF47CF17E917F4F7F8781DE826B863486358633862C86328636882C88288826 +882A8825897189BF89BE89FB8B7E8B848B828B868B858B7F8D158E958E948E9A +8E928E908E968E978F608F629147944C9450944A944B944F9447944594489449 +9446973F97E3986A986998CB9954995B9A4E9A539A549A4C9A4F9A489A4A0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00009A499A529A509AD09B199B2B9B3B9B569B559C469C489C3F9C449C399C33 +9C419C3C9C379C349C329C3D9C369DDB9DD29DDE9DDA9DCB9DD09DDC9DD19DDF +9DE99DD99DD89DD69DF59DD59DDD9EB69EF09F359F339F329F429F6B9F959FA2 +513D529958E858E759725B4D5DD8882F5F4F62016203620465296525659666EB +6B116B126B0F6BCA705B705A7222738273817383767077D47C677C667E95826C +863A86408639863C8631863B863E88308832882E883389768974897389FE0000 +F8 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +8B8C8B8E8B8B8B888C458D198E988F648F6391BC94629455945D9457945E97C4 +97C598009A569A599B1E9B1F9B209C529C589C509C4A9C4D9C4B9C559C599C4C +9C4E9DFB9DF79DEF9DE39DEB9DF89DE49DF69DE19DEE9DE69DF29DF09DE29DEC +9DF49DF39DE89DED9EC29ED09EF29EF39F069F1C9F389F379F369F439F4F0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00009F719F709F6E9F6F56D356CD5B4E5C6D652D66ED66EE6B13705F7061705D +7060722374DB74E577D5793879B779B67C6A7E977F89826D8643883888378835 +884B8B948B958E9E8E9F8EA08E9D91BE91BD91C2946B9468946996E597469743 +974797C797E59A5E9AD59B599C639C679C669C629C5E9C609E029DFE9E079E03 +9E069E059E009E019E099DFF9DFD9E049EA09F1E9F469F749F759F7656D4652E +65B86B186B196B176B1A7062722672AA77D877D979397C697C6B7CF67E9A0000 +F9 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +7E987E9B7E9981E081E18646864786488979897A897C897B89FF8B988B998EA5 +8EA48EA3946E946D946F9471947397499872995F9C689C6E9C6D9E0B9E0D9E10 +9E0F9E129E119EA19EF59F099F479F789F7B9F7A9F79571E70667C6F883C8DB2 +8EA691C394749478947694759A609C749C739C719C759E149E139EF69F0A0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00009FA4706870657CF7866A883E883D883F8B9E8C9C8EA98EC9974B98739874 +98CC996199AB9A649A669A679B249E159E179F4862076B1E7227864C8EA89482 +948094819A699A689B2E9E197229864B8B9F94839C799EB776759A6B9C7A9E1D +7069706A9EA49F7E9F499F980000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 diff --git a/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/cns11643.enc b/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/cns11643.enc new file mode 100644 index 0000000000000000000000000000000000000000..44dd9b7a09f5f421a387247770250de20791b922 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/cns11643.enc @@ -0,0 +1,1584 @@ +# Encoding file: cns11643, double-byte +D +2134 0 93 +21 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00004E284E364E3F4E854E054E04518251965338536953B64E2A4E874E4951E2 +4E464E8F4EBC4EBE516651E35204529C53B95902590A5B805DDB5E7A5E7F5EF4 +5F505F515F61961D4E3C4E634E624EA351854EC54ECF4ECE4ECC518451865722 +572351E45205529E529D52FD5300533A5C735346535D538653B7620953CC6C15 +53CE57216C3F5E005F0C623762386534653565E04F0E738D4E974EE04F144EF1 +4EE74EF74EE64F1D4F024F054F2256D8518B518C519951E55213520B52A60000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +22 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000053225304530353075407531E535F536D538953BA53D0598053F653F753F9 +597E53F4597F5B565724590459185932593059345DDF59755E845B825BF95C14 +5FD55FD45FCF625C625E626462615E815E835F0D5F52625A5FCA5FC7623965EE +624F65E7672F6B7A6C39673F673C6C376C446C45738C75927676909390926C4B +6C4C4E214E204E224E684E894E984EF94EEF7F5182784EF84F064F034EFC4EEE +4F1690994F284F1C4F074F1A4EFA4F17514A962351724F3B51B451B351B20000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +23 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00004F6451E84F675214520F5215521852A84F33534B534F518F5350521C538B +522153BE52AE53D2541653FF538E540054305405541354155445541956E35735 +57365731573258EE59054E545447593656E756E55741597A574C5986574B5752 +5B865F535C1859985C3D5C78598E59A25990598F5C8059A15E085B925C285C2A +5C8D5EF55F0E5C8B5C895C925FD35FDA5C935FDB5DE0620F625D625F62676257 +9F505E8D65EB65EA5F7867375FD2673267366B226BCE5FEE6C586C516C770000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +24 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00006C3C5FFA6C5A5FF76C53706F7072706E6283628C707372B172B26287738F +627B627A6270793C6288808D808E6272827B65F08D718FB99096909A67454E24 +4E7167554E9C4F454F4A4F394F37674B4F324F426C1A4F444F4B6C6B4F404F35 +4F3151516C6F5150514E6C6D6C87519D6C9C51B551B851EC522352275226521F +522B522052B452B372C65325533B537473957397739373947392544D75397594 +543A7681793D5444544C5423541A5432544B5421828F54345449545054220000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +25 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000543F5451545A542F8FC956E956F256F356EF56ED56EC56E6574896285744 +573F573C575357564F85575F5743575857574F744F894F8457464F4C573D4F6A +57425754575558F158F258F0590B9EA656F1593D4F955994598C519E599C51BE +5235599F5233599B52315989599A530B658853925B8D54875BFE5BFF5BFD5C2B +54885C845C8E5C9C5465546C5C855DF55E09546F54615E0B54985E925E905F03 +56F75F1E5F6357725FE75FFE5FE65FDC5FCE57805FFC5FDF5FEC5FF657620000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +26 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00005FF25FF05FF95945621359BA59CF623B623C628259C159B659BC6278628B +59B1629E62A5629B629C6299628D6285629D62755C445C475CAE65F65CA05CB5 +5CAF66F5675B5C9F675467525CA267586744674A67615CB66C7F6C916C9E5E14 +6C6E6C7C6C9F6C755F246C566CA26C795F7D6CA15FE56CAA6CA0601970797077 +707E600A7075707B7264601E72BB72BC72C772B972BE72B66011600C7398601C +6214623D62AD7593768062BE768376C076C162AE62B377F477F562A97ACC0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +27 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00007ACD7CFA809F80918097809466048286828C65FB8295660B866C66058FB5 +8FBE8FC766F68FC190A990A4678E6792677690A896279626962B963396349629 +4E3D679F4E9D4F934F8A677D67814F6D4F8E4FA04FA24FA14F9F4FA36C1D4F72 +6CEC4F8C51566CD96CB651906CAD6CE76CB751ED51FE522F6CC3523C52345239 +52B952B552BF53556C9D5376537A53936D3053C153C253D554856CCF545F5493 +548954799EFE548F5469546D70915494546A548A708356FD56FB56F872D80000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +28 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000056FC56F6576557815763576772D1576E5778577F73A673A258F3594B594C +74DD74E8753F59AD753E59C4759859C259B076F176F076F577F859BF77F959C9 +59B859AC7942793F79C559B759D77AFB5B607CFD5B965B9E5B945B9F5B9D80B5 +5C005C1982A082C05C495C4A82985CBB5CC182A782AE82BC5CB95C9E5CB45CBA +5DF65E135E125E7782C35E9882A25E995E9D5EF8866E5EF98FD25F065F218FCD +5F255F558FD790B290B45F845F8360306007963D6036963A96434FCD5FE90000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +29 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000603D60084FC94FCB62BA62B24FDC62B762E462A74FDB4FC74FD662D562E1 +62DD62A662C162C562C062DF62E062DE53976589539965A665BA54A165FF54A5 +66176618660165FE54AE670C54B6676B67966782678A54BC67A354BE67A2678F +54B067F967806B266B276B686B69579D6B816BB46BD1578F57996C1C579A5795 +58F4590D59536C976C6C6CDF5A006CEA59DD6CE46CD86CB26CCE6CC859F2708B +70887090708F59F570877089708D70815BA8708C5CD05CD872405CD75CCB0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +2A +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00007265726672685CC95CC772CD72D372DB5CD472CF73A773A3739E5CDF73AF +5DF95E2173AA739C5E2075427544753B75415E9B759B759E5F0779C479C379C6 +6037603979C7607279CA604560537ACF7C767C747CFF7CFC6042605F7F5980A8 +6058606680B0624280B362CF80A480B680A780AC630380A65367820E82C4833E +829C63006313631462FA631582AA62F082C9654365AA82A682B2662166326635 +8FCC8FD98FCA8FD88FCF90B7661D90AD90B99637670F9641963E96B697510000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +2B +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000097634E574E794EB24EB04EAF4EB14FD24FD567E44FBE4FB84FB04FB14FC8 +67F667EE4FC64FCC4FE54FE34FB4516A67B2519F67C651C167CC51C251C35245 +524867C967CA524F67EA67CB52C552CA52C453275358537D6BE053DD53DC53DA +53D954B96D1F54D054B454CA6D0A54A354DA54A46D1954B2549E549F54B56D1D +6D4254CD6D1854CC6D03570057AC5791578E578D579257A1579057A657A8709F +579C579657A770A170B470B570A958F572495909590872705952726E72CA0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +2C +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000059DF72E859EB59EF59F059D55A0D5A0459F95A0259F859E259D959E75B6A +73B473EB5BAB73C75C1B5C2F73C6663C73CB74EC74EE5CD15CDC5CE65CE15CCD +76795CE25CDD5CE55DFB5DFA5E1E76F75EA176FA77E75EFC5EFB5F2F78127805 +5F66780F780E7809605C7813604E6051794B794560236031607C605279D66060 +604A60617AD162187B017C7A7C787C797C7F7C807C81631F631762EA63216304 +63057FBE6531654465408014654265BE80C76629661B80C86623662C661A0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +2D +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00006630663B661E6637663880C9670E80D780E667E867D6822167C767BC6852 +67BF67D567FE836367FB833A67B168016805680067D782F26B2A6B6B82FB82F6 +82F082EA6BE182E082FA6D236CFF6D146D056D136D066D21884E6D156CAF6CF4 +6D026D458A076D268FE36D448FEE6D2470A590BD70A390D570A270BB70A070AA +90C891D470A870B670B270A79653964A70B9722E5005723C5013726D5030501B +72E772ED503372EC72E572E24FF773C473BD73CF73C973C173D0503173CE0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +2E +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000074ED74EB519374EF754975507546754A5261754D75A6525E525F525575A8 +52CD530E76C776FF54E276FD77E6780A54F37804780B78075504781578085511 +79D379D479D079D77A7C54F854E07A7D7A837A8257017AD47AD57AD37AD07AD2 +7AFE7AFC7C777C7C7C7B57B657BF57C757D057B957C1590E594A7F8F80D35A2D +80CB80D25A0F810980E280DF80C65B6C822482F782D882DD5C565C5482F882FC +5CEE5CF182E95D0082EE5E2982D0830E82E2830B82FD517986765F6786780000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +2F +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000605A60678675867D6088884288666081898C8A0560958A0660978C9F609C +8FF18FE78FE98FEF90C290BC632C90C690C06336634390CD90C9634B90C4633C +958163419CEC50324FF9501D4FFF50044FF05003635150024FFC4FF250245008 +5036502E65C35010503850394FFD50564FFB51A351A651A1681A684951C751C9 +5260526452595265526752575263682B5253682F52CF684452CE52D052D152CC +68266828682E550D54F46825551354EF54F554F9550255006B6D808255180000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +30 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000054F054F66BE86BE355196BE7570557C96D6357B757CD6D0D6D616D9257BE +57BB6D6D57DB57C857C457C557D157CA57C06D676D605A215A2A6D7C5A1D6D82 +5A0B6D2F6D686D8B6D7E5A226D846D165A246D7B5A145A316D905A2F5A1A5A12 +70DD70CB5A2670E270D75BBC5BBB5BB75C055C065C525C5370C770DA5CFA5CEB +72425CF35CF55CE95CEF72FA5E2A5E305E2E5E2C5E2F5EAF5EA973D95EFD5F32 +5F8E5F935F8F604F609973D2607E73D46074604B6073607573E874DE60560000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +31 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000060A9608B60A6755B609360AE609E60A7624575C075BF632E75BA63526330 +635B771B6319631B77126331635D6337633563537722635C633F654B78227835 +658B7828659A66506646664E6640782A664B6648795B66606644664D79526837 +682479EC79E0681B683679EA682C681968566847683E681E7A8B681568226827 +685968586855683068236B2E6B2B6B306B6C7B096B8B7C846BE96BEA6BE56D6B +7C8D7C856D736D577D117D0E6D5D6D566D8F6D5B6D1C6D9A6D9B6D997F610000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +32 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00006D816D717F5D7F5B6D726D5C6D9670C470DB70CC70D070E370DF80F270D6 +70EE70D580FB81008201822F727A833372F573028319835173E273EC73D573F9 +73DF73E683228342834E831B73E473E174F3834D831683248320755675557558 +7557755E75C38353831E75B4834B75B18348865376CB76CC772A86967716770F +869E8687773F772B770E772486857721771877DD86A7869578247836869D7958 +79598843796279DA79D9887679E179E579E879DB886F79E279F08874887C0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +33 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00008A128C477ADA7ADD8CA47ADB7ADC8D788DB57B0D7B0B7B147C8E7C868FF5 +7C877C837C8B90048FFC8FF690D67D2490D990DA90E37D257F627F937F997F97 +90DC90E47FC47FC6800A91D591E28040803C803B80F680FF80EE810481038107 +506A506180F750605053822D505D82278229831F8357505B504A506250158321 +505F506983188358506450465040506E50738684869F869B868986A68692868F +86A0884F8878887A886E887B88848873555055348A0D8A0B8A19553655350000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +34 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000553055525545550C8FF990099008553990DE9151553B554091DB91DF91DE +91D691E095859660965957F4965657ED57FD96BD57F8580B5042505958075044 +50665052505450715050507B507C505857E758015079506C507851A851D151CF +5268527652D45A5553A053C45A385558554C55685A5F55495A6C5A53555D5529 +5A43555455535A44555A5A48553A553F552B57EA5A4C57EF5A695A4757DD57FE +5A4257DE57E65B6E57E857FF580358F768A6591F5D1A595B595D595E5D0D0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +35 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00005D265A2B5D0F5A3B5D125D235A615A3A5A6E5A4B5A6B5EB45EB95A455A4E +5A685A3D5A715A3F5A6F5A7560905A735A2C5A595A545A4F5A6360CF60E45BC8 +60DD5BC360B15C5B5C6160CA5D215D0A5D0960C05D2C5D08638A63825D2A5D15 +639E5D105D1363975D2F5D18636F5DE35E395E355E3A5E32639C636D63AE637C +5EBB5EBA5F345F39638563816391638D6098655360D066656661665B60D760AA +666260A160A4688760EE689C60E7686E68AE60DE6956686F637E638B68A90000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +36 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000687563796386639368776373636A686B636C68AA637F687163B263BA6896 +688B6366637468A4655A687B654E654D658D658E65AD6B3365C765CA6B9165C9 +6B8D65E366576C2A66636667671A671967166DAC6DE9689E68B6689868736E00 +689A688E68B768DB68A5686C68C168846DDB6DF46895687A68996DF068B868B9 +68706DCF6B356DD06B906BBB6BED6DD76DCD6DE36DC16DC36DCE70F771176DAD +6E0470F06DB970F36DE770FC6E086E0671136E0A6DB070F66DF86E0C710E0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +37 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00006DB1727B6E026E076E096E016E176DFF6E12730A730871037107710170F5 +70F1710870F2710F740170FE7407740073FA731A7310730E740273F374087564 +73FB75CE75D275CF751B752375617568768F756775D37739772F769077317732 +76D576D776D67730773B7726784877407849771E784A784C782678477850784B +7851784F78427846796B796E796C79F279F879F179F579F379F97A907B357B3B +7A9A7A937A917AE17B247B337B217B1C7B167B177B367B1F7B2F7C937C990000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +38 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00007C9A7C9C7C947D497C967D347D377D3D7D2D7D367D4C7D457D2C7D487D41 +7D477F3B7D3F7D4A7D3B7D288008801A7F9C801D7F9B8049804580447C9B7FD1 +7FC7812A812E801F801E81318047811A8134811781258119811B831D83718384 +8380837283A18127837983918211839F83AD823A8234832382748385839C83B7 +8658865A8373865786B2838F86AE8395839983758845889C889488A3888F88A5 +88A988A6888A88A0889089928991899483B08A268A328A2883AE83768A1C0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +39 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000086568A2B8A2086C28A2986C586BA86B08A218C3A86B38C5B8C588C7C86BB +8CA68CAE8CAD8D6588528D7E88958D7C8D7F8D7A8DBD889188A18DC08DBB8EAD +8EAF8ED6889788A488AC888C88938ED9898289D69012900E90258A27901390EE +8C3990AB90F78C5D9159915491F291F091E591F68DC28DB995878DC1965A8EDE +8EDD966E8ED78EE08EE19679900B98E198E6900C9EC49ED24E8090F04E81508F +50975088508990EC90E950815160915A91535E4251D391F491F151D251D60000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +3A +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000527391F9527091EB91F791E853A853A653C5559755DE966D966B559655B4 +96BF55859804559B55A0509B555950945586508B50A355AF557A508E509D5068 +559E509255A9570F570E581A5312581F53A4583C5818583E582655AD583A5645 +5822559358FB5963596455815AA85AA35A825A885AA15A855A9855955A99558E +5A895A815A965A80581E58275A91582857F5584858255ACF581B5833583F5836 +582E58395A875AA0582C5A7959615A865AAB5AAA5AA45A8D5A7E5A785BD50000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +3B +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00005A7C5AA55AAC5C1E5C5F5C5E5D445D3E5A975D485D1C5AA95D5B5D4D5A8C +5A9C5D575A935D535D4F5BCD5D3B5D465BD15BCA5E465E475C305E485EC05EBD +5EBF5D4B5F115D355F3E5F3B5D555F3A5D3A5D525D3D5FA75D5960EA5D396107 +6122610C5D325D3660B360D660D25E4160E360E560E95FAB60C9611160FD60E2 +60CE611E61206121621E611663E263DE63E660F860FC60FE60C163F8611863FE +63C163BF63F763D1655F6560656163B063CE65D163E863EF667D666B667F0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +3C +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000063CA63E066736681666D6669646163DF671E68ED63DC63C463D863D36903 +63C768FE68E5691E690263D763D9690968CA690065646901691868E268CF659D +692E68C568FF65D2691C68C3667B6B6F66716B6E666A6BBE67016BF46C2D6904 +6DB66E756E1E68EA6E18690F6E4868F76E4F68E46E426E6A6E706DFE68E16907 +6E6D69086E7B6E7E6E5968EF6E5769146E806E5068FD6E296E766E2A6E4C712A +68CE7135712C7137711D68F468D1713868D47134712B7133712771246B3B0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +3D +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000712D7232728372827287730673247338732A732C732B6DFC732F73287417 +6E496E88741974386E45741F7414743C73F7741C74157418743974F975246E51 +6E3B6E03756E756D7571758E6E6175E56E286E606E716E6B769476B36E3076D9 +6E657748774977436E776E55774277DF6E66786378766E5A785F786679667971 +712E713179767984797579FF7A0771287A0E7A09724B725A7288728972867285 +7AE77AE27B55733073227B437B577B6C7B427B5373267B417335730C7CA70000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +3E +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00007CA07CA67CA47D74741A7D59742D7D607D577D6C7D7E7D6474207D5A7D5D +752F756F756C7D767D4D7D7575E67FD37FD675E475D78060804E8145813B7747 +814881428149814081148141774C81EF81F68203786483ED785C83DA841883D2 +8408787084007868785E786284178346841483D38405841F8402841683CD83E6 +7AE6865D86D586E17B447B487B4C7B4E86EE884788467CA27C9E88BB7CA188BF +88B47D6388B57D56899A8A437D4F7D6D8A5A7D6B7D527D548A358A388A420000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +3F +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00008A498A5D8A4B8A3D7F667FA27FA07FA18C608C5E8C7F8C7E8C8380D48CB1 +8D878152814F8D888D83814D813A8D868D8B8D828DCA8DD28204823C8DD48DC9 +8EB0833B83CF83F98EF28EE48EF38EEA83E78EFD83FC8F9D902B902A83C89028 +9029902C840183DD903A90309037903B83CB910A83D683F583C991FE922083DE +920B84069218922283D5921B920883D1920E9213839A83C3959583EE83C483FB +968C967B967F968183FE968286E286E686D386E386DA96EE96ED86EB96EC0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +40 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000975F976F86D7976D86D188488856885588BA88D798F088B888C088BE9AA9 +88BC88B79AE04EB7890188C950CC50BC899750AA50B989DB50AB50C350CD517E +527E52798A588A4452E152E052E7538053AB53AA53A953E055EA8C8055D78CBE +8CB055C157158D84586C8D89585C58505861586A5869585658605866585F5923 +596659688EEF8EF75ACE8EF95AC55AC38EE58EF55AD08EE88EF68EEB8EF18EEC +8EF45B745B765BDC5BD75BDA5BDB91045C205D6D5D6690F95D645D6E91000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +41 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00005D605F425F5A5F6E9164915F6130613A612A614361196131921A613D920F +920C92006408643264389206643192276419921C6411921992176429641D957B +958D958C643C96876446644796899683643A640796C8656B96F16570656D9770 +65E4669398A998EB9CE69EF9668F4E844EB6669250BF668E50AE694650CA50B4 +50C850C250B050C150BA693150CB50C9693E50B8697C694352786973527C6955 +55DB55CC6985694D69506947696769366964696155BF697D6B446B406B710000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +42 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00006B736B9C55C855F255CD6BC155C26BFA6C316C325864584F6EB86EA8586F +6E916EBB585D6E9A5865585B6EA9586358716EB56E6C6EE85ACB6EDD6EDA6EE6 +6EAC5AB05ABF5AC86ED96EE36EE96EDB5ACA716F5AB65ACD71485A90714A716B +5BD9714F715771745D635D4A5D6571457151716D5D6872517250724E5E4F7341 +5E4A732E73465EC574275EC674487453743D5FAF745D74566149741E74477443 +74587449612E744C7445743E61297501751E91686223757A75EE760276970000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +43 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00007698641064126409775D77647753775878827890788A6439787A787D6423 +788B787864306428788D788878927881797E798364256427640B7980641B642E +64217A0F656F65927A1D66867AA17AA466907AE97AEA66997B627B6B67207B5E +695F7B79694E69627B6F7B686945696A7CAE6942695769597CB069487D906935 +7D8A69337D8B7D997D9569787D877D787D977D897D986976695869417FA3694C +693B694B7FDD8057694F8163816A816C692F697B693C815D81756B43815F0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +44 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00006B48817D816D6BFB6BFC8241844F84846E9B847F6EC88448842A847B8472 +8464842E845C84536EC6844184C86EC184628480843E848384716EA6844A8455 +84586EC36EDC6ED886FC86FD87156E8D871686FF6EBF6EB36ED0885888CF88E0 +6EA371477154715289E78A6A8A80715D8A6F8A6571788A788A7D8A8871587143 +8A648A7E715F8A678C638C88714D8CCD724F8CC9728C8DED7290728E733C7342 +733B733A73408EB1734974448F048F9E8FA090439046904890459040904C0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +45 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000074427446910C9113911574FF916B9167925D9255923569839259922F923C +928F925C926A9262925F926B926E923B92449241959A7699959976DD7755775F +968F77529696775A7769776796F496FC776D9755788797797894788F788497EE +97F57886980B788398F37899788098F798FF98F5798298EC98F17A117A18999A +7A129AE29B3D9B5D9CE87A1B9CEB9CEF9CEE9E819F1450D050D950DC50D87B69 +50E150EB7B737B7150F450E250DE7B767B637CB251F47CAF7D887D8652ED0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +46 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000052EA7D7F53327D7A53AE53B07D8355FB5603560B7D8456077D9255F87F6B +5628561E7F6C5618561156515605571758928164588C817758785884587358AD +58975895587758725896588D59108161596C82495AE782405AE4824584F15AEF +5626847684795AF05D7B84655D83844084865D8B5D8C844D5D785E5284598474 +5ED05ECF85075FB35FB4843A8434847A617B8478616F6181613C614261386133 +844261606169617D6186622C62288452644C84C56457647C8447843664550000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +47 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000064626471646A6456643B6481846E644F647E646486F7870C86FA86D686F5 +657186F8870E66A5669A669C870D66A688D666A4698F69C569C8699269B288CC +88D0898569E369C069D669D1699F69A269D289DC89E68A7669E169D5699D8A3F +8A7769988A846B746BA18A816EF06EF38C3C8C4B6F1B6F0C6F1D6F346F286F17 +8C856F446F426F046F116EFA6F4A7191718E8D93718B718D717F718C717E717C +71838DEE71888DE98DE372948DE773557353734F7354746C7465746674610000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +48 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000746B746874768F0B7460903F74747506760E91107607910F911176B99114 +76B776E2916E7774777777767775923A777877719265777A715B777B78A678AE +78B8926C924F926078B178AF923679897987923192547A2992507A2A924E7A2D +7A2C92567A32959F7AEC7AF07B817B9E7B8396917B9296CE7BA37B9F7B9396F5 +7B867CB87CB79772980F980D980E98AC7DC87DB699AF7DD199B07DA87DAB9AAB +7DB37DCD9CED7DCF7DA49EFD50E67F417F6F7F7150F350DB50EA50DD50E40000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +49 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000050D38023805B50EF8061805F818152805281818482135330824A824C5615 +560C561284BD8495561C849284C35602849684A584B584B384A384E484D884D5 +589884B784AD84DA84938736587A58875891873D872B87478739587B8745871D +58FE88FF88EA5AEE88F55AD5890088ED890388E95AF35AE289EA5ADB8A9B8A8E +8AA25AD98A9C8A948A908AA98AAC5C638A9F5D805D7D8A9D5D7A8C675D775D8A +8CD08CD68CD48D988D9A8D975D7F5E585E598E0B8E088E018EB48EB35EDC0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +4A +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00008FA18FA25ED2905A5F449061905F5FB6612C9125917B9176917C61739289 +92F692B192AD929292819284617A92AE9290929E616A6161615695A295A7622B +642B644D645B645D96A0969D969F96D0647D96D1646664A6975964829764645C +644B64539819645098149815981A646B645964656477990665A098F89901669F +99BE99BC99B799B699C069C999B869CE699669B099C469BC99BF69999ADA9AE4 +9AE99AE89AEA9AE569BF9B2669BD69A49B4069B969CA699A69CF69B369930000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +4B +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000069AA9EBD699E69D969976990510E69B550F769C650FC510D510151DA51D9 +51DB5286528E52EE533353B16EF15647562D56546F37564B5652563156445656 +5650562B6F18564D5637564F58A258B76F7358B26EEE58AA58B558B06F3C58B4 +58A458A76F0E59265AFE6EFD5B046F395AFC6EFC5B065B0A5AFA5B0D5B005B0E +7187719071895D9171855D8F5D905D985DA45D9B5DA35D965DE45E5A72957293 +5E5E734D5FB86157615C61A661956188747261A3618F75006164750361590000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +4C +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00006178761661856187619E7611760A6198619C7781777C622F6480649B648E +648D649464C678B264A8648378AD64B9648664B464AF649178A064AA64A164A7 +66B666B3798B66BC66AC799466AD6A0E79886A1C6A1A7A2B7A4A6A0B7A2F69EF +6A0C69F06A227AAC69D87B886A1269FA7B916A2A7B966A107B8C7B9B6A2969F9 +69EA6A2C6A247BA469E96B526B4F6B537CBA7DA76F106F656F757DAA7DC17DC0 +7DC56FD07DCE6F5C6F3D6F717DCC6F916F0B6F796F816F8F7DA66F596F740000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +4D +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00007DA171AE7F7371A371AD7FE57FDE71AB71A671A2818952F2725772557299 +734B747A8215849784A4748C748484BA84CE74827493747B84AB750984B484C1 +84CD84AA849A84B1778A849D779084BB78C678D378C078D278C778C284AF799F +799D799E84B67A4184A07A387A3A7A4284DB84B07A3E7AB07BAE7BB38728876B +7BBF872E871E7BCD87197BB28743872C8741873E8746872087327CC47CCD7CC2 +7CC67CC37CC97CC787427DF887277DED7DE2871A873087117DDC7E027E010000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +4E +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000088F27DD688FE7DE47DFE88F67E007DFC7DFD88EB7DF57DFF899F7DEB7DE5 +7F787FAE7FE78A998065806A80668068806B819481A18192819681938D968E09 +85018DFF84F88DFD84F58E0385048E068E058DFE8E00851B85038533853484ED +9123911C853591228505911D911A91249121877D917A91729179877192A5885C +88E6890F891B92A089A989A589EE8AB1929A8ACC8ACE92978AB792A38AB58AE9 +8AB492958AB38AC18AAF8ACA8AD09286928C92998C8E927E92878CE98CDB0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +4F +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000928B8CEB8DA496A18DA28D9D977D977A977E97838E2A8E28977B97848EB8 +8EB68EB98EB78F228F2B8F278F198FA499078FB3999C9071906A99BB99BA9188 +918C92BF92B892BE92DC92E59B3F9B6092D492D69CF192DA92ED92F392DB5103 +92B992E292EB95AF50F695B295B3510C50FD510A96A396A552F152EF56485642 +970A563597879789978C97EF982A98225640981F563D9919563E99CA99DA563A +571A58AB99DE99C899E058A39AB69AB558A59AF458FF9B6B9B699B729B630000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +50 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00005AF69D0D5AF89D019D0C5B019CF85B055B0F9CFE9D029E845D9F9EAB9EAA +511D51165DA0512B511E511B5290529453145E605E5C56675EDB567B5EE1565F +5661618B6183617961B161B061A2618958C358CA58BB58C058C459015B1F5B18 +5B115B1561B35B125B1C64705B225B795DA664975DB35DAB5EEA648A5F5B64A3 +649F61B761CE61B961BD61CF61C06199619765B361BB61D061C4623166B764D3 +64C06A006A066A1769E564DC64D164C869E464D566C369EC69E266BF66C50000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +51 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000069FE66CD66C167066A1467246A636A426A5269E66A436A3369FC6A6C6A57 +6A046A4C6A6E6A0F69F66A266A0769F46A376B516A716A4A6A366BA66A536C00 +6A456A706F416F266A5C6B586B576F926F8D6F896F8C6F626F4F6FBB6F5A6F96 +6FBE6F6C6F826F556FB56FD36F9F6F576FB76FF571B76F0071BB6F6B71D16F67 +71BA6F5371B671CC6F7F6F9571D3749B6F6A6F7B749674A2749D750A750E719A +7581762C76377636763B71A476A171AA719C779871B37796729A735873520000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +52 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000078D678EB736078DC735B79A579A998347A537A4574897A4F74867ABD7ABB +7AF17488747C7BEC7BED7507757E7CD3761E7CE1761D7E197623761A76287E27 +7E26769D769E806E81AF778F778981AD78CD81AA821878CC78D178CE78D4856F +854C78C48542799A855C8570855F79A2855A854B853F878A7AB4878B87A1878E +7BBE7BAC8799885E885F892489A78AEA8AFD8AF98AE38AE57DDB7DEA8AEC7DD7 +7DE17E037DFA8CF27DF68CEF7DF08DA67DDF7F767FAC8E3B8E437FED8E320000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +53 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00008F318F307FE68F2D8F3C8FA78FA5819F819E819591379195918E82169196 +82539345930A824E825192FD9317931C930793319332932C9330930393058527 +95C284FB95B884FA95C1850C84F4852A96AB96B784F784EB97159714851284EA +970C971784FE9793851D97D2850284FD983698319833983C982E983A84F0983D +84F998B5992299239920991C991D866299A0876399EF99E899EB877387588754 +99E199E68761875A9AF89AF5876D876A9B839B949B84875D9B8B9B8F877A0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +54 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00009B8C875C9B89874F9B8E8775876287679D249D0F89059D139D0A890B8917 +891889199D2A9D1A89119D279D169D2189A49E859EAC9EC69EC59ED79F538AB8 +5128512751DF8AD5533553B38ABE568A567D56898AC358CD58D08AD95B2B5B33 +5B295B355B315B375C365DBE8CDD5DB98DA05DBB8DA161E261DB61DD61DC61DA +8E2E61D98E1B8E1664DF8E198E2664E18E1464EE8E1865B566D466D58E1A66D0 +66D166CE66D78F208F236A7D6A8A90736AA7906F6A996A826A88912B91290000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +55 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00006A8691326A986A9D918591866A8F91816AAA91846B5D92D06C0A92C46FD7 +6FD66FE592CF92F192DF6FD96FDA6FEA92DD6FF692EF92C271E392CA71E992CE +71EB71EF71F371EA92E092DE92E792D192D3737192E174AE92C674B3957C74AC +95AB95AE75837645764E764476A376A577A677A4978A77A977AF97D097CF981E +78F078F878F198287A49981B982798B27AC27AF27AF37BFA99167BF67BFC7C18 +7C087C1299D399D47CDB7CDA99D699D899CB7E2C7E4D9AB39AEC7F467FF60000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +56 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000802B807481B881C89B679B749B71859285939B75857F85AB85979B6C9CFC +85AC9CFD9CFF9CF787CE9D0087CD9CFB9D0887C187B187C79ED389409F10893F +893951178943511151DE533489AB56708B1F8B098B0C566656638C4056728C96 +56778CF68CF758C88E468E4F58BF58BA58C28F3D8F4193669378935D93699374 +937D936E93729373936293489353935F93685DB1937F936B5DB595C45DAE96AF +96AD96B25DAD5DAF971A971B5E685E665E6F5EE9979B979F5EE85EE55F4B0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +57 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00005FBC5FBB619D61A86196984061B4984761C198B761BA61BF61B8618C64D7 +99A264D064CF9A0099F3648964C399F564F364D99ABD9B009B0265A29B349B49 +9B9F66CA9BA39BCD9B999B9D66BA66CC9D396A349D446A496A679D356A686A3E +9EAF6A6D512F6A5B6A519F8E6A5A569F569B569E5696569456A06A4F5B3B6A6F +6A695B3A5DC15F4D5F5D61F36A4D6A4E6A466B5564F664E564EA64E765056BC8 +64F96C046C036C066AAB6AED6AB26AB06AB56ABE6AC16AC86FC46AC06ABC0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +58 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00006AB16AC46ABF6FA56FAE700870036FFD7010700270136FA271FA720074B9 +74BC6FB2765B7651764F76EB77B871D677B977C177C077BE790B71C77907790A +790871BC790D7906791579AF729E736973667AF5736C73657C2E736A7C1B749A +7C1A7C24749274957CE67CE37580762F7E5D7E4F7E667E5B7F477FB476327630 +76BB7FFA802E779D77A181CE779B77A282197795779985CC85B278E985BB85C1 +78DE78E378DB87E987EE87F087D6880E87DA8948894A894E894D89B189B00000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +59 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000089B37AB78B388B327BE78B2D7BD58B347BDA8B298C747BD47BEA8D037BDC +7BEB8DA98E587CD27CD48EBF8EC18F4A8FAC7E219089913D913C91A993A07E0E +93907E159393938B93AD93BB93B87E0D7E14939C95D895D77F7B7F7C7F7A975D +97A997DA8029806C81B181A6985481B99855984B81B0983F98B981B281B781A7 +81F29938993699408556993B993999A4855385619A089A0C85469A1085419B07 +85449BD285479BC29BBB9BCC9BCB854E856E9D4D9D639D4E85609D509D550000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +5A +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000855D9D5E85659E909EB29EB186649ECA9F029F279F26879356AF58E058DC +87965B39877987875B7C5BF3879087915C6B5DC4650B6508650A8789891E65DC +8930892D66E166DF6ACE6AD46AE36AD76AE2892C891F89F18AE06AD86AD56AD2 +8AF58ADD701E702C70256FF37204720872158AE874C474C974C774C876A977C6 +77C57918791A79208CF37A667A647A6A8DA78E338E3E8E388E408E457C357C34 +8E3D8E417E6C8E3F7E6E7E718F2E81D481D6821A82628265827685DB85D60000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +5B +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000908685E79133913585F4919387FD87D58807918F880F87F89308931F8987 +930F89B589F5933C8B3F8B438B4C93018D0B8E6B8E688E708E758E7792FA8EC3 +92F993E993EA93CB93C593C6932993ED93D3932A93E5930C930B93DB93EB93E0 +93C1931695BC95DD95BE95B995BA95B695BF95B595BD96A996D497B297B497B1 +97B597F2979497F097F89856982F98329924994499279A269A1F9A189A219A17 +99E49B0999E399EA9BC59BDF9AB99BE39AB49BE99BEE9AFA9AF99D669D7A0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +5C +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00009B809D6E9D919D839D769D7E9D6D9B939E959EE39B7A9B959F039F049D25 +9F179D2051369D1453369D1D5B429D229D105B445B465B7E5DCA5DC85DCC5EF0 +9ED5658566E566E79F3D512651256AF451246AE9512952F45693568C568D703D +56847036567E7216567F7212720F72177211720B5B2D5B2574CD74D074CC74CE +74D15B2F75895B7B7A6F7C4B7C445E6C5E6A5FBE61C361B57E7F8B7161E0802F +807A807B807C64EF64E964E385FC861086026581658085EE860366D2860D0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +5D +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000086138608860F881888126A9B6AA18967896589BB8B698B626A838B6E6AA4 +8B616A7F8B648B4D8C516A8C6A928E838EC66C09941F6FA99404941794089405 +6FED93F3941E9402941A941B9427941C71E196B571E871F2973371F097349731 +97B897BA749797FC74AB749098C374AD994D74A59A2F7510751175129AC97584 +9AC89AC49B2A9B389B5076E99C0A9BFB9C049BFC9BFE77B477B177A89C029BF6 +9C1B9BF99C159C109BFF9C009C0C78F978FE9D959DA579A87A5C7A5B7A560000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +5E +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00009E989EC17A5A9F5A516456BB7C0558E65B495BF77BFF7BFB5DD07BF45FC2 +7BF365117C096AFF6AFE6AFD7BFD6B017BF07BF1704B704D704774D376687667 +7E33984877D179307932792E7E479F9D7AC97AC87E3B7C567C517E3A7F457F7F +7E857E897E8E7E84802C826A862B862F862881C586168615861D881A825A825C +858389BC8B758B7C85958D118D128F5C91BB85A493F4859E8577942D858985A1 +96E497379736976797BE97BD97E29868986698C898CA98C798DC8585994F0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +5F +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000099A99A3C85909A3B9ACE87BE9B149B5387C59C2E87AC9C1F87B587BC87AE +87C99DB09DBD87CC87B79DAE9DC49E7B87B487B69E9E87B89F0587DE9F699FA1 +56C7571D5B4A5DD389525F72620289AD62356527651E651F8B1E8B186B076B06 +8B058B0B7054721C72207AF88B077C5D7C588B067E927F4E8B1A8C4F8C708827 +8C718B818B838C948C448D6F8E4E8E4D8E539442944D9454944E8F409443907E +9138973C974097C09199919F91A1919D995A9A5193839ADD936493569C380000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +60 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000937C9C459C3A93769C359350935193609EF1938F9F93529A937993578641 +5DD7934F65289377937B936170537059936772219359766F793779B57C627C5E +7CF596AE96B0863D9720882D89898B8D8B878B908D1A8E99979E979D97D5945F +97F1984194569461945B945A945C9465992B9741992A9933986E986C986D9931 +99AA9A5C9A589ADE9A029C4F9C5199F79C5399F899F699FB9DFC9F3999FC513E +9ABE56D29AFD5B4F6B149B487A727A739B9E9B9B9BA68B919BA59BA491BF0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +61 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00009BA2946C9BAF9D3396E697459D3697C897E4995D9D389B219D459B2C9B57 +9D3E9D379C5D9C619C659E089E8A9E899E8D9EB09EC89F459EFB9EFF620566EF +6B1B6B1D722572247C6D512E8642864956978978898A8B9759708C9B8D1C5C6A +8EA25E6D5E6E61D861DF61ED61EE61F161EA9C6C61EB9C6F61E99E0E65049F08 +9F1D9FA3650364FC5F606B1C66DA66DB66D87CF36AB98B9B8EA791C46ABA947A +6AB76AC79A619A639AD79C766C0B9FA5700C7067700172AB864A897D8B9D0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +62 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00008C538F65947B6FFC98CD98DD72019B309E16720371FD737674B874C096E7 +9E189EA274B69F7C74C27E9E9484765C9E1C76597C7197CA7657765A76A69EA3 +76EC9C7B9F97790C7913975079097910791257275C1379AC7A5F7C1C7C297C19 +7C205FC87C2D7C1D7C267C287C2267657C307E5C52BD7E565B667E5865F96788 +6CE66CCB7E574FBD5F8D7FB36018604880756B2970A681D07706825E85B485C6 +5A105CFC5CFE85B385B585BD85C785C485BF70C985CE85C885C585B185B60000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +63 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000085D28624957985B796BA866987E787E687E287DB87EB87EA7B29812887F3 +8A2E87D487DC87D39AD987D8582B584587D963FA87F487E887DD6E86894B894F +894C89468950586789495BDD656E8B238B338B308C878B4750D250DF8B3E8B31 +8B258B3769BA8B366B9D8B2480598B3D8B3A8C428C758C998C988C978CFE8D04 +8D028D008E5C6F8A8E608E577BC37BC28E658E678E5B8E5A90F68E5D98238E54 +8F468F478F488F4B71CD7499913B913E91A891A591A7984291AA93B5938C0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +64 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000093927F84939B939D938993A7938E8D0E939E9861939593888B73939F9C27 +938D945877D69B2D93A493A893B493A395D295D395D196B396D796DA5DC296DF +96D896DD97239722972597AC97AE97A84F664F684FE7503F97A550A6510F523E +53245365539B517F54CB55735571556B55F456225620569256BA569156B05759 +578A580F581258135847589B5900594D5AD15AD35B675C575C775CD55D755D8E +5DA55DB65DBF5E655ECD5EED5F945F9A5FBA6125615062A36360636463B60000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +65 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000640364B6651A7A255C2166E2670267A467AC68106806685E685A692C6929 +6A2D6A776A7A6ACA6AE66AF56B0D6B0E6BDC6BDD6BF66C1E6C636DA56E0F6E8A +6E846E8B6E7C6F4C6F486F496F9D6F996FF8702E702D705C79CC70BF70EA70E5 +71117112713F7139713B713D71777175717671717196719371B471DD71DE720E +591172187347734873EF7412743B74A4748D74B47673767776BC7819781B783D +78537854785878B778D878EE7922794D7986799979A379BC7AA77B377B590000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +66 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00007BD07C2F7C327C427C4E7C687CA97CED7DD07E077DD37E647F40791E8041 +806380BB6711672582488310836283128421841E84E284DE84E1857385D485F5 +863786458672874A87A987A587F5883488508887895489848B038C528CD88D0C +8D188DB08EBC8ED58FAA909C85E8915C922B9221927392F492F5933F93429386 +93BE93BC93BD93F193F293EF94229423942494679466959795CE95E7973B974D +98E499429B1D9B9889629D4964495E715E8561D3990E8002781E898889B70000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +67 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00005528557255BA55F055EE56B856B956C4805392B08B558B518B428B528B57 +8C438C778C768C9A8D068D078D098DAC8DAA8DAD8DAB8E6D8E788E738E6A8E6F +8E7B8EC28F528F518F4F8F508F538FB49140913F91B091AD93DE93C793CF93C2 +93DA93D093F993EC93CC93D993A993E693CA93D493EE93E393D593C493CE93C0 +93D293A593E7957D95DA95DB96E19729972B972C9728972697B397B797B697DD +97DE97DF985C9859985D985798BF98BD98BB98BE99489947994399A699A70000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +68 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00009A1A9A159A259A1D9A249A1B9A229A209A279A239A1E9A1C9A149AC29B0B +9B0A9B0E9B0C9B379BEA9BEB9BE09BDE9BE49BE69BE29BF09BD49BD79BEC9BDC +9BD99BE59BD59BE19BDA9D779D819D8A9D849D889D719D809D789D869D8B9D8C +9D7D9D6B9D749D759D709D699D859D739D7B9D829D6F9D799D7F9D879D689E94 +9E919EC09EFC9F2D9F409F419F4D9F569F579F58533756B256B556B358E35B45 +5DC65DC75EEE5EEF5FC05FC161F9651765166515651365DF66E866E366E40000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +69 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00006AF36AF06AEA6AE86AF96AF16AEE6AEF703C7035702F7037703470317042 +7038703F703A7039702A7040703B703370417213721472A8737D737C74BA76AB +76AA76BE76ED77CC77CE77CF77CD77F279257923792779287924792979B27A6E +7A6C7A6D7AF77C497C487C4A7C477C457CEE7E7B7E7E7E817E807FBA7FFF8079 +81DB81D982688269862285FF860185FE861B860085F6860486098605860C85FD +8819881088118817881388168963896689B989F78B608B6A8B5D8B688B630000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +6A +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00008B658B678B6D8DAE8E868E888E848F598F568F578F558F588F5A908D9143 +914191B791B591B291B3940B941393FB9420940F941493FE9415941094289419 +940D93F5940093F79407940E9416941293FA940993F8943C940A93FF93FC940C +93F69411940695DE95E095DF972E972F97B997BB97FD97FE986098629863985F +98C198C29950994E9959994C994B99539A329A349A319A2C9A2A9A369A299A2E +9A389A2D9AC79ACA9AC69B109B129B119C0B9C089BF79C059C129BF89C400000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +6B +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00009C079C0E9C069C179C149C099D9F9D999DA49D9D9D929D989D909D9B9DA0 +9D949D9C9DAA9D979DA19D9A9DA29DA89D9E9DA39DBF9DA99D969DA69DA79E99 +9E9B9E9A9EE59EE49EE79EE69F309F2E9F5B9F609F5E9F5D9F599F91513A5139 +5298529756C356BD56BE5B485B475DCB5DCF5EF161FD651B6B026AFC6B036AF8 +6B0070437044704A7048704970457046721D721A7219737E7517766A77D0792D +7931792F7C547C537CF27E8A7E877E887E8B7E867E8D7F4D7FBB803081DD0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +6C +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00008618862A8626861F8623861C86198627862E862186208629861E86258829 +881D881B88208824881C882B884A896D8969896E896B89FA8B798B788B458B7A +8B7B8D108D148DAF8E8E8E8C8F5E8F5B8F5D91469144914591B9943F943B9436 +9429943D94309439942A9437942C9440943195E595E495E39735973A97BF97E1 +986498C998C698C0995899569A399A3D9A469A449A429A419A3A9A3F9ACD9B15 +9B179B189B169B3A9B529C2B9C1D9C1C9C2C9C239C289C299C249C219DB70000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +6D +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00009DB69DBC9DC19DC79DCA9DCF9DBE9DC59DC39DBB9DB59DCE9DB99DBA9DAC +9DC89DB19DAD9DCC9DB39DCD9DB29E7A9E9C9EEB9EEE9EED9F1B9F189F1A9F31 +9F4E9F659F649F924EB956C656C556CB59715B4B5B4C5DD55DD15EF265216520 +652665226B0B6B086B096C0D7055705670577052721E721F72A9737F74D874D5 +74D974D7766D76AD793579B47A707A717C577C5C7C597C5B7C5A7CF47CF17E91 +7F4F7F8781DE826B863486358633862C86328636882C88288826882A88250000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +6E +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000897189BF89BE89FB8B7E8B848B828B868B858B7F8D158E958E948E9A8E92 +8E908E968E978F608F629147944C9450944A944B944F94479445944894499446 +973F97E3986A986998CB9954995B9A4E9A539A549A4C9A4F9A489A4A9A499A52 +9A509AD09B199B2B9B3B9B569B559C469C489C3F9C449C399C339C419C3C9C37 +9C349C329C3D9C369DDB9DD29DDE9DDA9DCB9DD09DDC9DD19DDF9DE99DD99DD8 +9DD69DF59DD59DDD9EB69EF09F359F339F329F429F6B9F959FA2513D52990000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +6F +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000058E858E759725B4D5DD8882F5F4F62016203620465296525659666EB6B11 +6B126B0F6BCA705B705A7222738273817383767077D47C677C667E95826C863A +86408639863C8631863B863E88308832882E883389768974897389FE8B8C8B8E +8B8B8B888C458D198E988F648F6391BC94629455945D9457945E97C497C59800 +9A569A599B1E9B1F9B209C529C589C509C4A9C4D9C4B9C559C599C4C9C4E9DFB +9DF79DEF9DE39DEB9DF89DE49DF69DE19DEE9DE69DF29DF09DE29DEC9DF40000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +70 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00009DF39DE89DED9EC29ED09EF29EF39F069F1C9F389F379F369F439F4F9F71 +9F709F6E9F6F56D356CD5B4E5C6D652D66ED66EE6B13705F7061705D70607223 +74DB74E577D5793879B779B67C6A7E977F89826D8643883888378835884B8B94 +8B958E9E8E9F8EA08E9D91BE91BD91C2946B9468946996E597469743974797C7 +97E59A5E9AD59B599C639C679C669C629C5E9C609E029DFE9E079E039E069E05 +9E009E019E099DFF9DFD9E049EA09F1E9F469F749F759F7656D4652E65B80000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +71 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00006B186B196B176B1A7062722672AA77D877D979397C697C6B7CF67E9A7E98 +7E9B7E9981E081E18646864786488979897A897C897B89FF8B988B998EA58EA4 +8EA3946E946D946F9471947397499872995F9C689C6E9C6D9E0B9E0D9E109E0F +9E129E119EA19EF59F099F479F789F7B9F7A9F79571E70667C6F883C8DB28EA6 +91C394749478947694759A609B2E9C749C739C719C759E149E139EF69F0A9FA4 +706870657CF7866A883E883D883F8B9E8C9C8EA98EC9974B9873987498CC0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +72 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000996199AB9A649A669A679B249E159E179F4862076B1E7227864C8EA89482 +948094819A699A689E19864B8B9F94839C799EB776759A6B9C7A9E1D7069706A +72299EA49F7E9F499F988AF68AFC8C6B8C6D8C938CF48E448E318E348E428E39 +8E358F3B8F2F8F388F338FA88FA69075907490789072907C907A913491929320 +933692F89333932F932292FC932B9304931A9310932693219315932E931995BB +96A796A896AA96D5970E97119716970D9713970F975B975C9766979898300000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +73 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00009838983B9837982D9839982499109928991E991B9921991A99ED99E299F1 +9AB89ABC9AFB9AED9B289B919D159D239D269D289D129D1B9ED89ED49F8D9F9C +512A511F5121513252F5568E5680569056855687568F58D558D358D158CE5B30 +5B2A5B245B7A5C375C685DBC5DBA5DBD5DB85E6B5F4C5FBD61C961C261C761E6 +61CB6232623464CE64CA64D864E064F064E664EC64F164E264ED6582658366D9 +66D66A806A946A846AA26A9C6ADB6AA36A7E6A976A906AA06B5C6BAE6BDA0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +74 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00006C086FD86FF16FDF6FE06FDB6FE46FEB6FEF6F806FEC6FE16FE96FD56FEE +6FF071E771DF71EE71E671E571ED71EC71F471E0723572467370737274A974B0 +74A674A876467642764C76EA77B377AA77B077AC77A777AD77EF78F778FA78F4 +78EF790179A779AA7A577ABF7C077C0D7BFE7BF77C0C7BE07CE07CDC7CDE7CE2 +7CDF7CD97CDD7E2E7E3E7E467E377E327E437E2B7E3D7E317E457E417E347E39 +7E487E357E3F7E2F7F447FF37FFC807180728070806F807381C681C381BA0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +75 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000081C281C081BF81BD81C981BE81E88209827185AA8584857E859C85918594 +85AF859B858785A8858A85A6866787C087D187B387D287C687AB87BB87BA87C8 +87CB893B893689448938893D89AC8B0E8B178B198B1B8B0A8B208B1D8B048B10 +8C418C3F8C738CFA8CFD8CFC8CF88CFB8DA88E498E4B8E488E4A8F448F3E8F42 +8F458F3F907F907D9084908190829080913991A3919E919C934D938293289375 +934A9365934B9318937E936C935B9370935A935495CA95CB95CC95C895C60000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +76 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000096B196B896D6971C971E97A097D3984698B699359A0199FF9BAE9BAB9BAA +9BAD9D3B9D3F9E8B9ECF9EDE9EDC9EDD9EDB9F3E9F4B53E2569556AE58D958D8 +5B385F5E61E3623364F464F264FE650664FA64FB64F765B766DC67266AB36AAC +6AC36ABB6AB86AC26AAE6AAF6B5F6B786BAF7009700B6FFE70066FFA7011700F +71FB71FC71FE71F87377737574A774BF751576567658765277BD77BF77BB77BC +790E79AE7A617A627A607AC47AC57C2B7C277C2A7C1E7C237C217CE77E540000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +77 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00007E557E5E7E5A7E617E527E597F487FF97FFB8077807681CD81CF820A85CF +85A985CD85D085C985B085BA85B987EF87EC87F287E0898689B289F48B288B39 +8B2C8B2B8C508D058E598E638E668E648E5F8E558EC08F498F4D908790839088 +91AB91AC91D09394938A939693A293B393AE93AC93B09398939A939795D495D6 +95D095D596E296DC96D996DB96DE972497A397A697AD97F9984D984F984C984E +985398BA993E993F993D992E99A59A0E9AC19B039B069B4F9B4E9B4D9BCA0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +78 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00009BC99BFD9BC89BC09D519D5D9D609EE09F159F2C513356A556A858DE58DF +58E25BF59F905EEC61F261F761F661F56500650F66E066DD6AE56ADD6ADA6AD3 +701B701F7028701A701D701570187206720D725872A27378737A74BD74CA74E3 +75877586765F766177C7791979B17A6B7A697C3E7C3F7C387C3D7C377C407E6B +7E6D7E797E697E6A7E737F857FB67FB97FB881D885E985DD85EA85D585E485E5 +85F787FB8805880D87F987FE8960895F8956895E8B418B5C8B588B498B5A0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +79 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00008B4E8B4F8B468B598D088D0A8E7C8E728E878E768E6C8E7A8E748F548F4E +8FAD908A908B91B191AE93E193D193DF93C393C893DC93DD93D693E293CD93D8 +93E493D793E895DC96B496E3972A9727976197DC97FB985E9858985B98BC9945 +99499A169A199B0D9BE89BE79BD69BDB9D899D619D729D6A9D6C9E929E979E93 +9EB452F856B756B656B456BC58E45B405B435B7D5BF65DC961F861FA65186514 +651966E667276AEC703E703070327210737B74CF766276657926792A792C0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +7A +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000792B7AC77AF67C4C7C437C4D7CEF7CF08FAE7E7D7E7C7E827F4C800081DA +826685FB85F9861185FA8606860B8607860A88148815896489BA89F88B708B6C +8B668B6F8B5F8B6B8D0F8D0D8E898E818E858E8291B491CB9418940393FD95E1 +973098C49952995199A89A2B9A309A379A359C139C0D9E799EB59EE89F2F9F5F +9F639F615137513856C156C056C259145C6C5DCD61FC61FE651D651C659566E9 +6AFB6B046AFA6BB2704C721B72A774D674D4766977D37C507E8F7E8C7FBC0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +7B +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00008617862D861A882388228821881F896A896C89BD8B748B778B7D8D138E8A +8E8D8E8B8F5F8FAF91BA942E94339435943A94389432942B95E2973897399732 +97FF9867986599579A459A439A409A3E9ACF9B549B519C2D9C259DAF9DB49DC2 +9DB89E9D9EEF9F199F5C9F669F67513C513B56C856CA56C95B7F5DD45DD25F4E +61FF65246B0A6B6170517058738074E4758A766E766C79B37C607C5F807E807D +81DF8972896F89FC8B808D168D178E918E938F619148944494519452973D0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +7C +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000973E97C397C1986B99559A559A4D9AD29B1A9C499C319C3E9C3B9DD39DD7 +9F349F6C9F6A9F9456CC5DD662006523652B652A66EC6B1074DA7ACA7C647C63 +7C657E937E967E9481E28638863F88318B8A9090908F9463946094649768986F +995C9A5A9A5B9A579AD39AD49AD19C549C579C569DE59E9F9EF456D158E9652C +705E7671767277D77F507F888836883988628B938B928B9682778D1B91C0946A +97429748974497C698709A5F9B229B589C5F9DF99DFA9E7C9E7D9F079F770000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +7D +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00009F725EF36B1670637C6C7C6E883B89C08EA191C1947294709871995E9AD6 +9B239ECC706477DA8B9A947797C99A629A657E9C8B9C8EAA91C5947D947E947C +9C779C789EF78C54947F9E1A72289A6A9B319E1B9E1E7C720000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 diff --git a/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/cp1250.enc b/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/cp1250.enc new file mode 100644 index 0000000000000000000000000000000000000000..070ad901bd6aee7640caa7152a79bcc77444693c --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/cp1250.enc @@ -0,0 +1,20 @@ +# Encoding file: cp1250, single-byte +S +003F 0 1 +00 +0000000100020003000400050006000700080009000A000B000C000D000E000F +0010001100120013001400150016001700180019001A001B001C001D001E001F +0020002100220023002400250026002700280029002A002B002C002D002E002F +0030003100320033003400350036003700380039003A003B003C003D003E003F +0040004100420043004400450046004700480049004A004B004C004D004E004F +0050005100520053005400550056005700580059005A005B005C005D005E005F +0060006100620063006400650066006700680069006A006B006C006D006E006F +0070007100720073007400750076007700780079007A007B007C007D007E007F +20AC0081201A0083201E2026202020210088203001602039015A0164017D0179 +009020182019201C201D202220132014009821220161203A015B0165017E017A +00A002C702D8014100A4010400A600A700A800A9015E00AB00AC00AD00AE017B +00B000B102DB014200B400B500B600B700B80105015F00BB013D02DD013E017C +015400C100C2010200C40139010600C7010C00C9011800CB011A00CD00CE010E +01100143014700D300D4015000D600D70158016E00DA017000DC00DD016200DF +015500E100E2010300E4013A010700E7010D00E9011900EB011B00ED00EE010F +01110144014800F300F4015100F600F70159016F00FA017100FC00FD016302D9 diff --git a/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/cp1251.enc b/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/cp1251.enc new file mode 100644 index 0000000000000000000000000000000000000000..376b1b40d89a829d9d5708d8d1fd02de10d044f2 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/cp1251.enc @@ -0,0 +1,20 @@ +# Encoding file: cp1251, single-byte +S +003F 0 1 +00 +0000000100020003000400050006000700080009000A000B000C000D000E000F +0010001100120013001400150016001700180019001A001B001C001D001E001F +0020002100220023002400250026002700280029002A002B002C002D002E002F +0030003100320033003400350036003700380039003A003B003C003D003E003F +0040004100420043004400450046004700480049004A004B004C004D004E004F +0050005100520053005400550056005700580059005A005B005C005D005E005F +0060006100620063006400650066006700680069006A006B006C006D006E006F +0070007100720073007400750076007700780079007A007B007C007D007E007F +04020403201A0453201E20262020202120AC203004092039040A040C040B040F +045220182019201C201D202220132014009821220459203A045A045C045B045F +00A0040E045E040800A4049000A600A7040100A9040400AB00AC00AD00AE0407 +00B000B104060456049100B500B600B704512116045400BB0458040504550457 +0410041104120413041404150416041704180419041A041B041C041D041E041F +0420042104220423042404250426042704280429042A042B042C042D042E042F +0430043104320433043404350436043704380439043A043B043C043D043E043F +0440044104420443044404450446044704480449044A044B044C044D044E044F diff --git a/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/cp1252.enc b/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/cp1252.enc new file mode 100644 index 0000000000000000000000000000000000000000..dd525ea4c58e6abd0f75552907e051b51bd49145 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/cp1252.enc @@ -0,0 +1,20 @@ +# Encoding file: cp1252, single-byte +S +003F 0 1 +00 +0000000100020003000400050006000700080009000A000B000C000D000E000F +0010001100120013001400150016001700180019001A001B001C001D001E001F +0020002100220023002400250026002700280029002A002B002C002D002E002F +0030003100320033003400350036003700380039003A003B003C003D003E003F +0040004100420043004400450046004700480049004A004B004C004D004E004F +0050005100520053005400550056005700580059005A005B005C005D005E005F +0060006100620063006400650066006700680069006A006B006C006D006E006F +0070007100720073007400750076007700780079007A007B007C007D007E007F +20AC0081201A0192201E20262020202102C62030016020390152008D017D008F +009020182019201C201D20222013201402DC21220161203A0153009D017E0178 +00A000A100A200A300A400A500A600A700A800A900AA00AB00AC00AD00AE00AF +00B000B100B200B300B400B500B600B700B800B900BA00BB00BC00BD00BE00BF +00C000C100C200C300C400C500C600C700C800C900CA00CB00CC00CD00CE00CF +00D000D100D200D300D400D500D600D700D800D900DA00DB00DC00DD00DE00DF +00E000E100E200E300E400E500E600E700E800E900EA00EB00EC00ED00EE00EF +00F000F100F200F300F400F500F600F700F800F900FA00FB00FC00FD00FE00FF diff --git a/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/cp1253.enc b/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/cp1253.enc new file mode 100644 index 0000000000000000000000000000000000000000..a8754c37a2efa35494b9e2209eb2731eccbdb6ef --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/cp1253.enc @@ -0,0 +1,20 @@ +# Encoding file: cp1253, single-byte +S +003F 0 1 +00 +0000000100020003000400050006000700080009000A000B000C000D000E000F +0010001100120013001400150016001700180019001A001B001C001D001E001F +0020002100220023002400250026002700280029002A002B002C002D002E002F +0030003100320033003400350036003700380039003A003B003C003D003E003F +0040004100420043004400450046004700480049004A004B004C004D004E004F +0050005100520053005400550056005700580059005A005B005C005D005E005F +0060006100620063006400650066006700680069006A006B006C006D006E006F +0070007100720073007400750076007700780079007A007B007C007D007E007F +20AC0081201A0192201E20262020202100882030008A2039008C008D008E008F +009020182019201C201D20222013201400982122009A203A009C009D009E009F +00A00385038600A300A400A500A600A700A800A9000000AB00AC00AD00AE2015 +00B000B100B200B3038400B500B600B703880389038A00BB038C00BD038E038F +0390039103920393039403950396039703980399039A039B039C039D039E039F +03A003A1000003A303A403A503A603A703A803A903AA03AB03AC03AD03AE03AF +03B003B103B203B303B403B503B603B703B803B903BA03BB03BC03BD03BE03BF +03C003C103C203C303C403C503C603C703C803C903CA03CB03CC03CD03CE0000 diff --git a/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/cp1254.enc b/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/cp1254.enc new file mode 100644 index 0000000000000000000000000000000000000000..b9e3b3c518d160faaec10b98249bd13f4bb87c69 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/cp1254.enc @@ -0,0 +1,20 @@ +# Encoding file: cp1254, single-byte +S +003F 0 1 +00 +0000000100020003000400050006000700080009000A000B000C000D000E000F +0010001100120013001400150016001700180019001A001B001C001D001E001F +0020002100220023002400250026002700280029002A002B002C002D002E002F +0030003100320033003400350036003700380039003A003B003C003D003E003F +0040004100420043004400450046004700480049004A004B004C004D004E004F +0050005100520053005400550056005700580059005A005B005C005D005E005F +0060006100620063006400650066006700680069006A006B006C006D006E006F +0070007100720073007400750076007700780079007A007B007C007D007E007F +20AC0081201A0192201E20262020202102C62030016020390152008D008E008F +009020182019201C201D20222013201402DC21220161203A0153009D009E0178 +00A000A100A200A300A400A500A600A700A800A900AA00AB00AC00AD00AE00AF +00B000B100B200B300B400B500B600B700B800B900BA00BB00BC00BD00BE00BF +00C000C100C200C300C400C500C600C700C800C900CA00CB00CC00CD00CE00CF +011E00D100D200D300D400D500D600D700D800D900DA00DB00DC0130015E00DF +00E000E100E200E300E400E500E600E700E800E900EA00EB00EC00ED00EE00EF +011F00F100F200F300F400F500F600F700F800F900FA00FB00FC0131015F00FF diff --git a/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/cp1255.enc b/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/cp1255.enc new file mode 100644 index 0000000000000000000000000000000000000000..6e78b954b7eeb839a4e584e193710f79b2f238e0 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/cp1255.enc @@ -0,0 +1,20 @@ +# Encoding file: cp1255, single-byte +S +003F 0 1 +00 +0000000100020003000400050006000700080009000A000B000C000D000E000F +0010001100120013001400150016001700180019001A001B001C001D001E001F +0020002100220023002400250026002700280029002A002B002C002D002E002F +0030003100320033003400350036003700380039003A003B003C003D003E003F +0040004100420043004400450046004700480049004A004B004C004D004E004F +0050005100520053005400550056005700580059005A005B005C005D005E005F +0060006100620063006400650066006700680069006A006B006C006D006E006F +0070007100720073007400750076007700780079007A007B007C007D007E007F +20AC0081201A0192201E20262020202102C62030008A2039008C008D008E008F +009020182019201C201D20222013201402DC2122009A203A009C009D009E009F +00A000A100A200A320AA00A500A600A700A800A900D700AB00AC00AD00AE00AF +00B000B100B200B300B400B500B600B700B800B900F700BB00BC00BD00BE00BF +05B005B105B205B305B405B505B605B705B805B9000005BB05BC05BD05BE05BF +05C005C105C205C305F005F105F205F305F40000000000000000000000000000 +05D005D105D205D305D405D505D605D705D805D905DA05DB05DC05DD05DE05DF +05E005E105E205E305E405E505E605E705E805E905EA00000000200E200F0000 diff --git a/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/cp1256.enc b/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/cp1256.enc new file mode 100644 index 0000000000000000000000000000000000000000..a98762a0868e19dec1f15094694f66b4620cd53a --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/cp1256.enc @@ -0,0 +1,20 @@ +# Encoding file: cp1256, single-byte +S +003F 0 1 +00 +0000000100020003000400050006000700080009000A000B000C000D000E000F +0010001100120013001400150016001700180019001A001B001C001D001E001F +0020002100220023002400250026002700280029002A002B002C002D002E002F +0030003100320033003400350036003700380039003A003B003C003D003E003F +0040004100420043004400450046004700480049004A004B004C004D004E004F +0050005100520053005400550056005700580059005A005B005C005D005E005F +0060006100620063006400650066006700680069006A006B006C006D006E006F +0070007100720073007400750076007700780079007A007B007C007D007E007F +20AC067E201A0192201E20262020202102C62030067920390152068606980688 +06AF20182019201C201D20222013201406A921220691203A0153200C200D06BA +00A0060C00A200A300A400A500A600A700A800A906BE00AB00AC00AD00AE00AF +00B000B100B200B300B400B500B600B700B800B9061B00BB00BC00BD00BE061F +06C1062106220623062406250626062706280629062A062B062C062D062E062F +063006310632063306340635063600D7063706380639063A0640064106420643 +00E0064400E2064506460647064800E700E800E900EA00EB0649064A00EE00EF +064B064C064D064E00F4064F065000F7065100F9065200FB00FC200E200F06D2 diff --git a/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/cp1257.enc b/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/cp1257.enc new file mode 100644 index 0000000000000000000000000000000000000000..4aa135dfc0c749f645c397dc4f39ff56811ce9c4 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/cp1257.enc @@ -0,0 +1,20 @@ +# Encoding file: cp1257, single-byte +S +003F 0 1 +00 +0000000100020003000400050006000700080009000A000B000C000D000E000F +0010001100120013001400150016001700180019001A001B001C001D001E001F +0020002100220023002400250026002700280029002A002B002C002D002E002F +0030003100320033003400350036003700380039003A003B003C003D003E003F +0040004100420043004400450046004700480049004A004B004C004D004E004F +0050005100520053005400550056005700580059005A005B005C005D005E005F +0060006100620063006400650066006700680069006A006B006C006D006E006F +0070007100720073007400750076007700780079007A007B007C007D007E007F +20AC0081201A0083201E20262020202100882030008A2039008C00A802C700B8 +009020182019201C201D20222013201400982122009A203A009C00AF02DB009F +00A0000000A200A300A4000000A600A700D800A9015600AB00AC00AD00AE00C6 +00B000B100B200B300B400B500B600B700F800B9015700BB00BC00BD00BE00E6 +0104012E0100010600C400C501180112010C00C90179011601220136012A013B +01600143014500D3014C00D500D600D701720141015A016A00DC017B017D00DF +0105012F0101010700E400E501190113010D00E9017A011701230137012B013C +01610144014600F3014D00F500F600F701730142015B016B00FC017C017E02D9 diff --git a/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/cp1258.enc b/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/cp1258.enc new file mode 100644 index 0000000000000000000000000000000000000000..95fdef882959ac09db866fab45506ef2188e0faf --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/cp1258.enc @@ -0,0 +1,20 @@ +# Encoding file: cp1258, single-byte +S +003F 0 1 +00 +0000000100020003000400050006000700080009000A000B000C000D000E000F +0010001100120013001400150016001700180019001A001B001C001D001E001F +0020002100220023002400250026002700280029002A002B002C002D002E002F +0030003100320033003400350036003700380039003A003B003C003D003E003F +0040004100420043004400450046004700480049004A004B004C004D004E004F +0050005100520053005400550056005700580059005A005B005C005D005E005F +0060006100620063006400650066006700680069006A006B006C006D006E006F +0070007100720073007400750076007700780079007A007B007C007D007E007F +20AC0081201A0192201E20262020202102C62030008A20390152008D008E008F +009020182019201C201D20222013201402DC2122009A203A0153009D009E0178 +00A000A100A200A300A400A500A600A700A800A900AA00AB00AC00AD00AE00AF +00B000B100B200B300B400B500B600B700B800B900BA00BB00BC00BD00BE00BF +00C000C100C2010200C400C500C600C700C800C900CA00CB030000CD00CE00CF +011000D1030900D300D401A000D600D700D800D900DA00DB00DC01AF030300DF +00E000E100E2010300E400E500E600E700E800E900EA00EB030100ED00EE00EF +011100F1032300F300F401A100F600F700F800F900FA00FB00FC01B020AB00FF diff --git a/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/cp437.enc b/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/cp437.enc new file mode 100644 index 0000000000000000000000000000000000000000..ecae4e65403ef7c1f352fbb789322a040f832d68 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/cp437.enc @@ -0,0 +1,20 @@ +# Encoding file: cp437, single-byte +S +003F 0 1 +00 +0000000100020003000400050006000700080009000A000B000C000D000E000F +0010001100120013001400150016001700180019001A001B001C001D001E001F +0020002100220023002400250026002700280029002A002B002C002D002E002F +0030003100320033003400350036003700380039003A003B003C003D003E003F +0040004100420043004400450046004700480049004A004B004C004D004E004F +0050005100520053005400550056005700580059005A005B005C005D005E005F +0060006100620063006400650066006700680069006A006B006C006D006E006F +0070007100720073007400750076007700780079007A007B007C007D007E007F +00C700FC00E900E200E400E000E500E700EA00EB00E800EF00EE00EC00C400C5 +00C900E600C600F400F600F200FB00F900FF00D600DC00A200A300A520A70192 +00E100ED00F300FA00F100D100AA00BA00BF231000AC00BD00BC00A100AB00BB +259125922593250225242561256225562555256325512557255D255C255B2510 +25142534252C251C2500253C255E255F255A25542569256625602550256C2567 +2568256425652559255825522553256B256A2518250C25882584258C25902580 +03B100DF039303C003A303C300B503C403A6039803A903B4221E03C603B52229 +226100B1226522642320232100F7224800B0221900B7221A207F00B225A000A0 diff --git a/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/cp737.enc b/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/cp737.enc new file mode 100644 index 0000000000000000000000000000000000000000..5b59661ea42d673be0c0ed4b8288406dcdd45826 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/cp737.enc @@ -0,0 +1,20 @@ +# Encoding file: cp737, single-byte +S +003F 0 1 +00 +0000000100020003000400050006000700080009000A000B000C000D000E000F +0010001100120013001400150016001700180019001A001B001C001D001E001F +0020002100220023002400250026002700280029002A002B002C002D002E002F +0030003100320033003400350036003700380039003A003B003C003D003E003F +0040004100420043004400450046004700480049004A004B004C004D004E004F +0050005100520053005400550056005700580059005A005B005C005D005E005F +0060006100620063006400650066006700680069006A006B006C006D006E006F +0070007100720073007400750076007700780079007A007B007C007D007E007F +039103920393039403950396039703980399039A039B039C039D039E039F03A0 +03A103A303A403A503A603A703A803A903B103B203B303B403B503B603B703B8 +03B903BA03BB03BC03BD03BE03BF03C003C103C303C203C403C503C603C703C8 +259125922593250225242561256225562555256325512557255D255C255B2510 +25142534252C251C2500253C255E255F255A25542569256625602550256C2567 +2568256425652559255825522553256B256A2518250C25882584258C25902580 +03C903AC03AD03AE03CA03AF03CC03CD03CB03CE038603880389038A038C038E +038F00B12265226403AA03AB00F7224800B0221900B7221A207F00B225A000A0 diff --git a/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/cp775.enc b/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/cp775.enc new file mode 100644 index 0000000000000000000000000000000000000000..71b65c322198cf084252d31eadcf3411b56b5f6c --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/cp775.enc @@ -0,0 +1,20 @@ +# Encoding file: cp775, single-byte +S +003F 0 1 +00 +0000000100020003000400050006000700080009000A000B000C000D000E000F +0010001100120013001400150016001700180019001A001B001C001D001E001F +0020002100220023002400250026002700280029002A002B002C002D002E002F +0030003100320033003400350036003700380039003A003B003C003D003E003F +0040004100420043004400450046004700480049004A004B004C004D004E004F +0050005100520053005400550056005700580059005A005B005C005D005E005F +0060006100620063006400650066006700680069006A006B006C006D006E006F +0070007100720073007400750076007700780079007A007B007C007D007E007F +010600FC00E9010100E4012300E501070142011301560157012B017900C400C5 +00C900E600C6014D00F6012200A2015A015B00D600DC00F800A300D800D700A4 +0100012A00F3017B017C017A201D00A600A900AE00AC00BD00BC014100AB00BB +259125922593250225240104010C01180116256325512557255D012E01602510 +25142534252C251C2500253C0172016A255A25542569256625602550256C017D +0105010D01190117012F01610173016B017E2518250C25882584258C25902580 +00D300DF014C014300F500D500B5014401360137013B013C0146011201452019 +00AD00B1201C00BE00B600A700F7201E00B0221900B700B900B300B225A000A0 diff --git a/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/cp850.enc b/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/cp850.enc new file mode 100644 index 0000000000000000000000000000000000000000..4e7a90d725f404359d4750cb6809068614f35bdd --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/cp850.enc @@ -0,0 +1,20 @@ +# Encoding file: cp850, single-byte +S +003F 0 1 +00 +0000000100020003000400050006000700080009000A000B000C000D000E000F +0010001100120013001400150016001700180019001A001B001C001D001E001F +0020002100220023002400250026002700280029002A002B002C002D002E002F +0030003100320033003400350036003700380039003A003B003C003D003E003F +0040004100420043004400450046004700480049004A004B004C004D004E004F +0050005100520053005400550056005700580059005A005B005C005D005E005F +0060006100620063006400650066006700680069006A006B006C006D006E006F +0070007100720073007400750076007700780079007A007B007C007D007E007F +00C700FC00E900E200E400E000E500E700EA00EB00E800EF00EE00EC00C400C5 +00C900E600C600F400F600F200FB00F900FF00D600DC00F800A300D800D70192 +00E100ED00F300FA00F100D100AA00BA00BF00AE00AC00BD00BC00A100AB00BB +2591259225932502252400C100C200C000A9256325512557255D00A200A52510 +25142534252C251C2500253C00E300C3255A25542569256625602550256C00A4 +00F000D000CA00CB00C8013100CD00CE00CF2518250C2588258400A600CC2580 +00D300DF00D400D200F500D500B500FE00DE00DA00DB00D900FD00DD00AF00B4 +00AD00B1201700BE00B600A700F700B800B000A800B700B900B300B225A000A0 diff --git a/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/cp852.enc b/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/cp852.enc new file mode 100644 index 0000000000000000000000000000000000000000..f34899eec544ce064f9b831d7931c94d4b5ccec6 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/cp852.enc @@ -0,0 +1,20 @@ +# Encoding file: cp852, single-byte +S +003F 0 1 +00 +0000000100020003000400050006000700080009000A000B000C000D000E000F +0010001100120013001400150016001700180019001A001B001C001D001E001F +0020002100220023002400250026002700280029002A002B002C002D002E002F +0030003100320033003400350036003700380039003A003B003C003D003E003F +0040004100420043004400450046004700480049004A004B004C004D004E004F +0050005100520053005400550056005700580059005A005B005C005D005E005F +0060006100620063006400650066006700680069006A006B006C006D006E006F +0070007100720073007400750076007700780079007A007B007C007D007E007F +00C700FC00E900E200E4016F010700E7014200EB0150015100EE017900C40106 +00C90139013A00F400F6013D013E015A015B00D600DC01640165014100D7010D +00E100ED00F300FA01040105017D017E0118011900AC017A010C015F00AB00BB +2591259225932502252400C100C2011A015E256325512557255D017B017C2510 +25142534252C251C2500253C01020103255A25542569256625602550256C00A4 +01110110010E00CB010F014700CD00CE011B2518250C258825840162016E2580 +00D300DF00D401430144014801600161015400DA0155017000FD00DD016300B4 +00AD02DD02DB02C702D800A700F700B800B000A802D901710158015925A000A0 diff --git a/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/cp855.enc b/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/cp855.enc new file mode 100644 index 0000000000000000000000000000000000000000..4d58b86cc2fd06b11347622a0f9bbd9e3cfa2a63 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/cp855.enc @@ -0,0 +1,20 @@ +# Encoding file: cp855, single-byte +S +003F 0 1 +00 +0000000100020003000400050006000700080009000A000B000C000D000E000F +0010001100120013001400150016001700180019001A001B001C001D001E001F +0020002100220023002400250026002700280029002A002B002C002D002E002F +0030003100320033003400350036003700380039003A003B003C003D003E003F +0040004100420043004400450046004700480049004A004B004C004D004E004F +0050005100520053005400550056005700580059005A005B005C005D005E005F +0060006100620063006400650066006700680069006A006B006C006D006E006F +0070007100720073007400750076007700780079007A007B007C007D007E007F +0452040204530403045104010454040404550405045604060457040704580408 +04590409045A040A045B040B045C040C045E040E045F040F044E042E044A042A +0430041004310411044604260434041404350415044404240433041300AB00BB +259125922593250225240445042504380418256325512557255D043904192510 +25142534252C251C2500253C043A041A255A25542569256625602550256C00A4 +043B041B043C041C043D041D043E041E043F2518250C25882584041F044F2580 +042F044004200441042104420422044304230436041604320412044C042C2116 +00AD044B042B0437041704480428044D042D044904290447042700A725A000A0 diff --git a/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/cp857.enc b/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/cp857.enc new file mode 100644 index 0000000000000000000000000000000000000000..b42ed55713a46d19b8f460febd1aba7ff469249a --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/cp857.enc @@ -0,0 +1,20 @@ +# Encoding file: cp857, single-byte +S +003F 0 1 +00 +0000000100020003000400050006000700080009000A000B000C000D000E000F +0010001100120013001400150016001700180019001A001B001C001D001E001F +0020002100220023002400250026002700280029002A002B002C002D002E002F +0030003100320033003400350036003700380039003A003B003C003D003E003F +0040004100420043004400450046004700480049004A004B004C004D004E004F +0050005100520053005400550056005700580059005A005B005C005D005E005F +0060006100620063006400650066006700680069006A006B006C006D006E006F +0070007100720073007400750076007700780079007A007B007C007D007E007F +00C700FC00E900E200E400E000E500E700EA00EB00E800EF00EE013100C400C5 +00C900E600C600F400F600F200FB00F9013000D600DC00F800A300D8015E015F +00E100ED00F300FA00F100D1011E011F00BF00AE00AC00BD00BC00A100AB00BB +2591259225932502252400C100C200C000A9256325512557255D00A200A52510 +25142534252C251C2500253C00E300C3255A25542569256625602550256C00A4 +00BA00AA00CA00CB00C8000000CD00CE00CF2518250C2588258400A600CC2580 +00D300DF00D400D200F500D500B5000000D700DA00DB00D900EC00FF00AF00B4 +00AD00B1000000BE00B600A700F700B800B000A800B700B900B300B225A000A0 diff --git a/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/cp860.enc b/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/cp860.enc new file mode 100644 index 0000000000000000000000000000000000000000..871943b3718441d70bb405ff6f20afa94539997f --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/cp860.enc @@ -0,0 +1,20 @@ +# Encoding file: cp860, single-byte +S +003F 0 1 +00 +0000000100020003000400050006000700080009000A000B000C000D000E000F +0010001100120013001400150016001700180019001A001B001C001D001E001F +0020002100220023002400250026002700280029002A002B002C002D002E002F +0030003100320033003400350036003700380039003A003B003C003D003E003F +0040004100420043004400450046004700480049004A004B004C004D004E004F +0050005100520053005400550056005700580059005A005B005C005D005E005F +0060006100620063006400650066006700680069006A006B006C006D006E006F +0070007100720073007400750076007700780079007A007B007C007D007E007F +00C700FC00E900E200E300E000C100E700EA00CA00E800CD00D400EC00C300C2 +00C900C000C800F400F500F200DA00F900CC00D500DC00A200A300D920A700D3 +00E100ED00F300FA00F100D100AA00BA00BF00D200AC00BD00BC00A100AB00BB +259125922593250225242561256225562555256325512557255D255C255B2510 +25142534252C251C2500253C255E255F255A25542569256625602550256C2567 +2568256425652559255825522553256B256A2518250C25882584258C25902580 +03B100DF039303C003A303C300B503C403A6039803A903B4221E03C603B52229 +226100B1226522642320232100F7224800B0221900B7221A207F00B225A000A0 diff --git a/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/cp861.enc b/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/cp861.enc new file mode 100644 index 0000000000000000000000000000000000000000..3f8f605e510abbb6e45ce207abad1dd7b7cc8b51 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/cp861.enc @@ -0,0 +1,20 @@ +# Encoding file: cp861, single-byte +S +003F 0 1 +00 +0000000100020003000400050006000700080009000A000B000C000D000E000F +0010001100120013001400150016001700180019001A001B001C001D001E001F +0020002100220023002400250026002700280029002A002B002C002D002E002F +0030003100320033003400350036003700380039003A003B003C003D003E003F +0040004100420043004400450046004700480049004A004B004C004D004E004F +0050005100520053005400550056005700580059005A005B005C005D005E005F +0060006100620063006400650066006700680069006A006B006C006D006E006F +0070007100720073007400750076007700780079007A007B007C007D007E007F +00C700FC00E900E200E400E000E500E700EA00EB00E800D000F000DE00C400C5 +00C900E600C600F400F600FE00FB00DD00FD00D600DC00F800A300D820A70192 +00E100ED00F300FA00C100CD00D300DA00BF231000AC00BD00BC00A100AB00BB +259125922593250225242561256225562555256325512557255D255C255B2510 +25142534252C251C2500253C255E255F255A25542569256625602550256C2567 +2568256425652559255825522553256B256A2518250C25882584258C25902580 +03B100DF039303C003A303C300B503C403A6039803A903B4221E03C603B52229 +226100B1226522642320232100F7224800B0221900B7221A207F00B225A000A0 diff --git a/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/cp862.enc b/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/cp862.enc new file mode 100644 index 0000000000000000000000000000000000000000..5f9d16cc298b455bc39c8e84fcd622747be63f6b --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/cp862.enc @@ -0,0 +1,20 @@ +# Encoding file: cp862, single-byte +S +003F 0 1 +00 +0000000100020003000400050006000700080009000A000B000C000D000E000F +0010001100120013001400150016001700180019001A001B001C001D001E001F +0020002100220023002400250026002700280029002A002B002C002D002E002F +0030003100320033003400350036003700380039003A003B003C003D003E003F +0040004100420043004400450046004700480049004A004B004C004D004E004F +0050005100520053005400550056005700580059005A005B005C005D005E005F +0060006100620063006400650066006700680069006A006B006C006D006E006F +0070007100720073007400750076007700780079007A007B007C007D007E007F +05D005D105D205D305D405D505D605D705D805D905DA05DB05DC05DD05DE05DF +05E005E105E205E305E405E505E605E705E805E905EA00A200A300A520A70192 +00E100ED00F300FA00F100D100AA00BA00BF231000AC00BD00BC00A100AB00BB +259125922593250225242561256225562555256325512557255D255C255B2510 +25142534252C251C2500253C255E255F255A25542569256625602550256C2567 +2568256425652559255825522553256B256A2518250C25882584258C25902580 +03B100DF039303C003A303C300B503C403A6039803A903B4221E03C603B52229 +226100B1226522642320232100F7224800B0221900B7221A207F00B225A000A0 diff --git a/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/cp863.enc b/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/cp863.enc new file mode 100644 index 0000000000000000000000000000000000000000..c8b8686f814128630f9d575180d2d6bfdf6a2185 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/cp863.enc @@ -0,0 +1,20 @@ +# Encoding file: cp863, single-byte +S +003F 0 1 +00 +0000000100020003000400050006000700080009000A000B000C000D000E000F +0010001100120013001400150016001700180019001A001B001C001D001E001F +0020002100220023002400250026002700280029002A002B002C002D002E002F +0030003100320033003400350036003700380039003A003B003C003D003E003F +0040004100420043004400450046004700480049004A004B004C004D004E004F +0050005100520053005400550056005700580059005A005B005C005D005E005F +0060006100620063006400650066006700680069006A006B006C006D006E006F +0070007100720073007400750076007700780079007A007B007C007D007E007F +00C700FC00E900E200C200E000B600E700EA00EB00E800EF00EE201700C000A7 +00C900C800CA00F400CB00CF00FB00F900A400D400DC00A200A300D900DB0192 +00A600B400F300FA00A800B800B300AF00CE231000AC00BD00BC00BE00AB00BB +259125922593250225242561256225562555256325512557255D255C255B2510 +25142534252C251C2500253C255E255F255A25542569256625602550256C2567 +2568256425652559255825522553256B256A2518250C25882584258C25902580 +03B100DF039303C003A303C300B503C403A6039803A903B4221E03C603B52229 +226100B1226522642320232100F7224800B0221900B7221A207F00B225A000A0 diff --git a/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/cp864.enc b/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/cp864.enc new file mode 100644 index 0000000000000000000000000000000000000000..71f9e62b1f9b423936cec3dc4382955b6f925398 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/cp864.enc @@ -0,0 +1,20 @@ +# Encoding file: cp864, single-byte +S +003F 0 1 +00 +0000000100020003000400050006000700080009000A000B000C000D000E000F +0010001100120013001400150016001700180019001A001B001C001D001E001F +00200021002200230024066A0026002700280029002A002B002C002D002E002F +0030003100320033003400350036003700380039003A003B003C003D003E003F +0040004100420043004400450046004700480049004A004B004C004D004E004F +0050005100520053005400550056005700580059005A005B005C005D005E005F +0060006100620063006400650066006700680069006A006B006C006D006E006F +0070007100720073007400750076007700780079007A007B007C007D007E007F +00B000B72219221A259225002502253C2524252C251C25342510250C25142518 +03B2221E03C600B100BD00BC224800AB00BBFEF7FEF8009B009CFEFBFEFC009F +00A000ADFE8200A300A4FE8400000000FE8EFE8FFE95FE99060CFE9DFEA1FEA5 +0660066106620663066406650666066706680669FED1061BFEB1FEB5FEB9061F +00A2FE80FE81FE83FE85FECAFE8BFE8DFE91FE93FE97FE9BFE9FFEA3FEA7FEA9 +FEABFEADFEAFFEB3FEB7FEBBFEBFFEC1FEC5FECBFECF00A600AC00F700D7FEC9 +0640FED3FED7FEDBFEDFFEE3FEE7FEEBFEEDFEEFFEF3FEBDFECCFECEFECDFEE1 +FE7D0651FEE5FEE9FEECFEF0FEF2FED0FED5FEF5FEF6FEDDFED9FEF125A00000 diff --git a/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/cp865.enc b/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/cp865.enc new file mode 100644 index 0000000000000000000000000000000000000000..543da9c5f381a51b616b8d327a100d53f4e00cf0 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/cp865.enc @@ -0,0 +1,20 @@ +# Encoding file: cp865, single-byte +S +003F 0 1 +00 +0000000100020003000400050006000700080009000A000B000C000D000E000F +0010001100120013001400150016001700180019001A001B001C001D001E001F +0020002100220023002400250026002700280029002A002B002C002D002E002F +0030003100320033003400350036003700380039003A003B003C003D003E003F +0040004100420043004400450046004700480049004A004B004C004D004E004F +0050005100520053005400550056005700580059005A005B005C005D005E005F +0060006100620063006400650066006700680069006A006B006C006D006E006F +0070007100720073007400750076007700780079007A007B007C007D007E007F +00C700FC00E900E200E400E000E500E700EA00EB00E800EF00EE00EC00C400C5 +00C900E600C600F400F600F200FB00F900FF00D600DC00F800A300D820A70192 +00E100ED00F300FA00F100D100AA00BA00BF231000AC00BD00BC00A100AB00A4 +259125922593250225242561256225562555256325512557255D255C255B2510 +25142534252C251C2500253C255E255F255A25542569256625602550256C2567 +2568256425652559255825522553256B256A2518250C25882584258C25902580 +03B100DF039303C003A303C300B503C403A6039803A903B4221E03C603B52229 +226100B1226522642320232100F7224800B0221900B7221A207F00B225A000A0 diff --git a/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/cp866.enc b/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/cp866.enc new file mode 100644 index 0000000000000000000000000000000000000000..b851cf5b8c68ac7a0c218e6a5844fdfadd9f648f --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/cp866.enc @@ -0,0 +1,20 @@ +# Encoding file: cp866, single-byte +S +003F 0 1 +00 +0000000100020003000400050006000700080009000A000B000C000D000E000F +0010001100120013001400150016001700180019001A001B001C001D001E001F +0020002100220023002400250026002700280029002A002B002C002D002E002F +0030003100320033003400350036003700380039003A003B003C003D003E003F +0040004100420043004400450046004700480049004A004B004C004D004E004F +0050005100520053005400550056005700580059005A005B005C005D005E005F +0060006100620063006400650066006700680069006A006B006C006D006E006F +0070007100720073007400750076007700780079007A007B007C007D007E007F +0410041104120413041404150416041704180419041A041B041C041D041E041F +0420042104220423042404250426042704280429042A042B042C042D042E042F +0430043104320433043404350436043704380439043A043B043C043D043E043F +259125922593250225242561256225562555256325512557255D255C255B2510 +25142534252C251C2500253C255E255F255A25542569256625602550256C2567 +2568256425652559255825522553256B256A2518250C25882584258C25902580 +0440044104420443044404450446044704480449044A044B044C044D044E044F +040104510404045404070457040E045E00B0221900B7221A211600A425A000A0 diff --git a/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/cp869.enc b/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/cp869.enc new file mode 100644 index 0000000000000000000000000000000000000000..9fd2929079ccc8b36c76f6bebf507e8e9463cac6 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/cp869.enc @@ -0,0 +1,20 @@ +# Encoding file: cp869, single-byte +S +003F 0 1 +00 +0000000100020003000400050006000700080009000A000B000C000D000E000F +0010001100120013001400150016001700180019001A001B001C001D001E001F +0020002100220023002400250026002700280029002A002B002C002D002E002F +0030003100320033003400350036003700380039003A003B003C003D003E003F +0040004100420043004400450046004700480049004A004B004C004D004E004F +0050005100520053005400550056005700580059005A005B005C005D005E005F +0060006100620063006400650066006700680069006A006B006C006D006E006F +0070007100720073007400750076007700780079007A007B007C007D007E007F +0080008100820083008400850386008700B700AC00A620182019038820150389 +038A03AA038C00930094038E03AB00A9038F00B200B303AC00A303AD03AE03AF +03CA039003CC03CD039103920393039403950396039700BD0398039900AB00BB +25912592259325022524039A039B039C039D256325512557255D039E039F2510 +25142534252C251C2500253C03A003A1255A25542569256625602550256C03A3 +03A403A503A603A703A803A903B103B203B32518250C2588258403B403B52580 +03B603B703B803B903BA03BB03BC03BD03BE03BF03C003C103C303C203C40384 +00AD00B103C503C603C700A703C8038500B000A803C903CB03B003CE25A000A0 diff --git a/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/cp874.enc b/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/cp874.enc new file mode 100644 index 0000000000000000000000000000000000000000..0487b97d98aade7304f45c178370a6bce15e384b --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/cp874.enc @@ -0,0 +1,20 @@ +# Encoding file: cp874, single-byte +S +003F 0 1 +00 +0000000100020003000400050006000700080009000A000B000C000D000E000F +0010001100120013001400150016001700180019001A001B001C001D001E001F +0020002100220023002400250026002700280029002A002B002C002D002E002F +0030003100320033003400350036003700380039003A003B003C003D003E003F +0040004100420043004400450046004700480049004A004B004C004D004E004F +0050005100520053005400550056005700580059005A005B005C005D005E005F +0060006100620063006400650066006700680069006A006B006C006D006E006F +0070007100720073007400750076007700780079007A007B007C007D007E007F +20AC008100820083008420260086008700880089008A008B008C008D008E008F +009020182019201C201D20222013201400980099009A009B009C009D009E009F +00A00E010E020E030E040E050E060E070E080E090E0A0E0B0E0C0E0D0E0E0E0F +0E100E110E120E130E140E150E160E170E180E190E1A0E1B0E1C0E1D0E1E0E1F +0E200E210E220E230E240E250E260E270E280E290E2A0E2B0E2C0E2D0E2E0E2F +0E300E310E320E330E340E350E360E370E380E390E3A00000000000000000E3F +0E400E410E420E430E440E450E460E470E480E490E4A0E4B0E4C0E4D0E4E0E4F +0E500E510E520E530E540E550E560E570E580E590E5A0E5B0000000000000000 diff --git a/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/cp932.enc b/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/cp932.enc new file mode 100644 index 0000000000000000000000000000000000000000..8da8cd69c30e9102fba9fc9895693f0069a4674f --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/cp932.enc @@ -0,0 +1,801 @@ +# Encoding file: cp932, multi-byte +M +003F 0 46 +00 +0000000100020003000400050006000700080009000A000B000C000D000E000F +0010001100120013001400150016001700180019001A001B001C001D001E001F +0020002100220023002400250026002700280029002A002B002C002D002E002F +0030003100320033003400350036003700380039003A003B003C003D003E003F +0040004100420043004400450046004700480049004A004B004C004D004E004F +0050005100520053005400550056005700580059005A005B005C005D005E005F +0060006100620063006400650066006700680069006A006B006C006D006E006F +0070007100720073007400750076007700780079007A007B007C007D007E007F +0080000000000000000000850086000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000FF61FF62FF63FF64FF65FF66FF67FF68FF69FF6AFF6BFF6CFF6DFF6EFF6F +FF70FF71FF72FF73FF74FF75FF76FF77FF78FF79FF7AFF7BFF7CFF7DFF7EFF7F +FF80FF81FF82FF83FF84FF85FF86FF87FF88FF89FF8AFF8BFF8CFF8DFF8EFF8F +FF90FF91FF92FF93FF94FF95FF96FF97FF98FF99FF9AFF9BFF9CFF9DFF9EFF9F +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +81 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +300030013002FF0CFF0E30FBFF1AFF1BFF1FFF01309B309C00B4FF4000A8FF3E +FFE3FF3F30FD30FE309D309E30034EDD30053006300730FC20152010FF0FFF3C +FF5E2225FF5C2026202520182019201C201DFF08FF0930143015FF3BFF3DFF5B +FF5D30083009300A300B300C300D300E300F30103011FF0BFF0D00B100D70000 +00F7FF1D2260FF1CFF1E22662267221E22342642264000B0203220332103FFE5 +FF04FFE0FFE1FF05FF03FF06FF0AFF2000A72606260525CB25CF25CE25C725C6 +25A125A025B325B225BD25BC203B301221922190219121933013000000000000 +000000000000000000000000000000002208220B2286228722822283222A2229 +0000000000000000000000000000000022272228FFE221D221D4220022030000 +0000000000000000000000000000000000000000222022A52312220222072261 +2252226A226B221A223D221D2235222B222C0000000000000000000000000000 +212B2030266F266D266A2020202100B6000000000000000025EF000000000000 +82 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000FF10 +FF11FF12FF13FF14FF15FF16FF17FF18FF190000000000000000000000000000 +FF21FF22FF23FF24FF25FF26FF27FF28FF29FF2AFF2BFF2CFF2DFF2EFF2FFF30 +FF31FF32FF33FF34FF35FF36FF37FF38FF39FF3A000000000000000000000000 +0000FF41FF42FF43FF44FF45FF46FF47FF48FF49FF4AFF4BFF4CFF4DFF4EFF4F +FF50FF51FF52FF53FF54FF55FF56FF57FF58FF59FF5A00000000000000003041 +30423043304430453046304730483049304A304B304C304D304E304F30503051 +30523053305430553056305730583059305A305B305C305D305E305F30603061 +30623063306430653066306730683069306A306B306C306D306E306F30703071 +30723073307430753076307730783079307A307B307C307D307E307F30803081 +30823083308430853086308730883089308A308B308C308D308E308F30903091 +3092309300000000000000000000000000000000000000000000000000000000 +83 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +30A130A230A330A430A530A630A730A830A930AA30AB30AC30AD30AE30AF30B0 +30B130B230B330B430B530B630B730B830B930BA30BB30BC30BD30BE30BF30C0 +30C130C230C330C430C530C630C730C830C930CA30CB30CC30CD30CE30CF30D0 +30D130D230D330D430D530D630D730D830D930DA30DB30DC30DD30DE30DF0000 +30E030E130E230E330E430E530E630E730E830E930EA30EB30EC30ED30EE30EF +30F030F130F230F330F430F530F6000000000000000000000000000000000391 +03920393039403950396039703980399039A039B039C039D039E039F03A003A1 +03A303A403A503A603A703A803A90000000000000000000000000000000003B1 +03B203B303B403B503B603B703B803B903BA03BB03BC03BD03BE03BF03C003C1 +03C303C403C503C603C703C803C9000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +84 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +04100411041204130414041504010416041704180419041A041B041C041D041E +041F0420042104220423042404250426042704280429042A042B042C042D042E +042F000000000000000000000000000000000000000000000000000000000000 +04300431043204330434043504510436043704380439043A043B043C043D0000 +043E043F0440044104420443044404450446044704480449044A044B044C044D +044E044F00000000000000000000000000000000000000000000000000002500 +2502250C251025182514251C252C25242534253C25012503250F2513251B2517 +25232533252B253B254B2520252F25282537253F251D25302525253825420000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +87 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +2460246124622463246424652466246724682469246A246B246C246D246E246F +2470247124722473216021612162216321642165216621672168216900003349 +33143322334D331833273303333633513357330D33263323332B334A333B339C +339D339E338E338F33C433A100000000000000000000000000000000337B0000 +301D301F211633CD212132A432A532A632A732A8323132323239337E337D337C +22522261222B222E2211221A22A52220221F22BF22352229222A000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +88 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000004E9C +55165A03963F54C0611B632859F690228475831C7A5060AA63E16E2565ED8466 +82A69BF56893572765A162715B9B59D0867B98F47D627DBE9B8E62167C9F88B7 +5B895EB563096697684895C7978D674F4EE54F0A4F4D4F9D504956F2593759D4 +5A015C0960DF610F61706613690570BA754F757079FB7DAD7DEF80C3840E8863 +8B029055907A533B4E954EA557DF80B290C178EF4E0058F16EA290387A328328 +828B9C2F5141537054BD54E156E059FB5F1598F26DEB80E4852D000000000000 +89 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +9662967096A097FB540B53F35B8770CF7FBD8FC296E8536F9D5C7ABA4E117893 +81FC6E26561855046B1D851A9C3B59E553A96D6674DC958F56424E91904B96F2 +834F990C53E155B65B305F71662066F368046C386CF36D29745B76C87A4E9834 +82F1885B8A6092ED6DB275AB76CA99C560A68B018D8A95B2698E53AD51860000 +5712583059445BB45EF6602863A963F46CBF6F14708E7114715971D5733F7E01 +827682D185979060925B9D1B586965BC6C5A752551F9592E59655F805FDC62BC +65FA6A2A6B276BB4738B7FC189569D2C9D0E9EC45CA16C96837B51045C4B61B6 +81C6687672614E594FFA537860696E297A4F97F34E0B53164EEE4F554F3D4FA1 +4F7352A053EF5609590F5AC15BB65BE179D16687679C67B66B4C6CB3706B73C2 +798D79BE7A3C7B8782B182DB8304837783EF83D387668AB256298CA88FE6904E +971E868A4FC45CE862117259753B81E582BD86FE8CC096C5991399D54ECB4F1A +89E356DE584A58CA5EFB5FEB602A6094606261D0621262D06539000000000000 +8A +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +9B41666668B06D777070754C76867D7582A587F9958B968E8C9D51F152BE5916 +54B35BB35D16616869826DAF788D84CB88578A7293A79AB86D6C99A886D957A3 +67FF86CE920E5283568754045ED362E164B9683C68386BBB737278BA7A6B899A +89D28D6B8F0390ED95A3969497695B665CB3697D984D984E639B7B206A2B0000 +6A7F68B69C0D6F5F5272559D607062EC6D3B6E076ED1845B89108F444E149C39 +53F6691B6A3A9784682A515C7AC384B291DC938C565B9D286822830584317CA5 +520882C574E64E7E4F8351A05BD2520A52D852E75DFB559A582A59E65B8C5B98 +5BDB5E725E7960A3611F616361BE63DB656267D1685368FA6B3E6B536C576F22 +6F976F4574B0751876E3770B7AFF7BA17C217DE97F367FF0809D8266839E89B3 +8ACC8CAB908494519593959195A2966597D3992882184E38542B5CB85DCC73A9 +764C773C5CA97FEB8D0B96C19811985498584F014F0E5371559C566857FA5947 +5B095BC45C905E0C5E7E5FCC63EE673A65D765E2671F68CB68C4000000000000 +8B +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +6A5F5E306BC56C176C7D757F79485B637A007D005FBD898F8A188CB48D778ECC +8F1D98E29A0E9B3C4E80507D510059935B9C622F628064EC6B3A72A075917947 +7FA987FB8ABC8B7063AC83CA97A05409540355AB68546A588A70782767759ECD +53745BA2811A865090064E184E454EC74F1153CA54385BAE5F13602565510000 +673D6C426C726CE3707874037A767AAE7B087D1A7CFE7D6665E7725B53BB5C45 +5DE862D262E063196E20865A8A318DDD92F86F0179A69B5A4EA84EAB4EAC4F9B +4FA050D151477AF6517151F653545321537F53EB55AC58835CE15F375F4A602F +6050606D631F65596A4B6CC172C272ED77EF80F881058208854E90F793E197FF +99579A5A4EF051DD5C2D6681696D5C4066F26975738968507C8150C552E45747 +5DFE932665A46B236B3D7434798179BD7B4B7DCA82B983CC887F895F8B398FD1 +91D1541F92804E5D503653E5533A72D7739677E982E68EAF99C699C899D25177 +611A865E55B07A7A50765BD3904796854E326ADB91E75C515C48000000000000 +8C +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +63987A9F6C9397748F617AAA718A96887C8268177E706851936C52F2541B85AB +8A137FA48ECD90E15366888879414FC250BE521151445553572D73EA578B5951 +5F625F8460756176616761A963B2643A656C666F68426E1375667A3D7CFB7D4C +7D997E4B7F6B830E834A86CD8A088A638B668EFD981A9D8F82B88FCE9BE80000 +5287621F64836FC09699684150916B206C7A6F547A747D5088408A2367084EF6 +503950265065517C5238526355A7570F58055ACC5EFA61B261F862F36372691C +6A29727D72AC732E7814786F7D79770C80A9898B8B198CE28ED290639375967A +98559A139E785143539F53B35E7B5F266E1B6E90738473FE7D4382378A008AFA +96504E4E500B53E4547C56FA59D15B645DF15EAB5F276238654567AF6E5672D0 +7CCA88B480A180E183F0864E8A878DE8923796C798679F134E944E924F0D5348 +5449543E5A2F5F8C5FA1609F68A76A8E745A78818A9E8AA48B7791904E5E9BC9 +4EA44F7C4FAF501950165149516C529F52B952FE539A53E35411000000000000 +8D +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +540E5589575157A2597D5B545B5D5B8F5DE55DE75DF75E785E835E9A5EB75F18 +6052614C629762D863A7653B6602664366F4676D6821689769CB6C5F6D2A6D69 +6E2F6E9D75327687786C7A3F7CE07D057D187D5E7DB18015800380AF80B18154 +818F822A8352884C88618B1B8CA28CFC90CA91759271783F92FC95A4964D0000 +980599999AD89D3B525B52AB53F7540858D562F76FE08C6A8F5F9EB9514B523B +544A56FD7A4091779D609ED273446F09817075115FFD60DA9AA872DB8FBC6B64 +98034ECA56F0576458BE5A5A606861C7660F6606683968B16DF775D57D3A826E +9B424E9B4F5053C955065D6F5DE65DEE67FB6C99747378028A50939688DF5750 +5EA7632B50B550AC518D670054C9585E59BB5BB05F69624D63A1683D6B736E08 +707D91C7728078157826796D658E7D3083DC88C18F09969B5264572867507F6A +8CA151B45742962A583A698A80B454B25D0E57FC78959DFA4F5C524A548B643E +6628671467F57A847B567D22932F685C9BAD7B395319518A5237000000000000 +8E +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +5BDF62F664AE64E6672D6BBA85A996D176909BD6634C93069BAB76BF66524E09 +509853C25C7160E864926563685F71E673CA75237B977E8286958B838CDB9178 +991065AC66AB6B8B4ED54ED44F3A4F7F523A53F853F255E356DB58EB59CB59C9 +59FF5B505C4D5E025E2B5FD7601D6307652F5B5C65AF65BD65E8679D6B620000 +6B7B6C0F7345794979C17CF87D197D2B80A2810281F389968A5E8A698A668A8C +8AEE8CC78CDC96CC98FC6B6F4E8B4F3C4F8D51505B575BFA6148630166426B21 +6ECB6CBB723E74BD75D478C1793A800C803381EA84948F9E6C509E7F5F0F8B58 +9D2B7AFA8EF85B8D96EB4E0353F157F759315AC95BA460896E7F6F0675BE8CEA +5B9F85007BE0507267F4829D5C61854A7E1E820E51995C0463688D66659C716E +793E7D1780058B1D8ECA906E86C790AA501F52FA5C3A6753707C7235914C91C8 +932B82E55BC25F3160F94E3B53D65B88624B67316B8A72E973E07A2E816B8DA3 +91529996511253D7546A5BFF63886A397DAC970056DA53CE5468000000000000 +8F +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +5B975C315DDE4FEE610162FE6D3279C079CB7D427E4D7FD281ED821F84908846 +89728B908E748F2F9031914B916C96C6919C4EC04F4F514553415F93620E67D4 +6C416E0B73637E2691CD928353D459195BBF6DD1795D7E2E7C9B587E719F51FA +88538FF04FCA5CFB662577AC7AE3821C99FF51C65FAA65EC696F6B896DF30000 +6E966F6476FE7D145DE190759187980651E6521D6240669166D96E1A5EB67DD2 +7F7266F885AF85F78AF852A953D959735E8F5F90605592E4966450B7511F52DD +5320534753EC54E8554655315617596859BE5A3C5BB55C065C0F5C115C1A5E84 +5E8A5EE05F70627F628462DB638C63776607660C662D6676677E68A26A1F6A35 +6CBC6D886E096E58713C7126716775C77701785D7901796579F07AE07B117CA7 +7D39809683D6848B8549885D88F38A1F8A3C8A548A738C618CDE91A49266937E +9418969C97984E0A4E084E1E4E575197527057CE583458CC5B225E3860C564FE +676167566D4472B675737A6384B88B7291B89320563157F498FE000000000000 +90 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +62ED690D6B9671ED7E548077827289E698DF87558FB15C3B4F384FE14FB55507 +5A205BDD5BE95FC3614E632F65B0664B68EE699B6D786DF1753375B9771F795E +79E67D3381E382AF85AA89AA8A3A8EAB8F9B903291DD97074EBA4EC152035875 +58EC5C0B751A5C3D814E8A0A8FC59663976D7B258ACF9808916256F353A80000 +9017543957825E2563A86C34708A77617C8B7FE088709042915493109318968F +745E9AC45D075D69657067A28DA896DB636E6749691983C5981796C088FE6F84 +647A5BF84E16702C755D662F51C4523652E259D35F8160276210653F6574661F +667468F268166B636E057272751F76DB7CBE805658F088FD897F8AA08A938ACB +901D91929752975965897A0E810696BB5E2D60DC621A65A56614679077F37A4D +7C4D7E3E810A8CAC8D648DE18E5F78A9520762D963A5644262988A2D7A837BC0 +8AAC96EA7D76820C87494ED95148534353605BA35C025C165DDD6226624764B0 +681368346CC96D456D1767D36F5C714E717D65CB7A7F7BAD7DDA000000000000 +91 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +7E4A7FA8817A821B823985A68A6E8CCE8DF59078907792AD929195839BAE524D +55846F387136516879857E5581B37CCE564C58515CA863AA66FE66FD695A72D9 +758F758E790E795679DF7C977D207D4486078A34963B90619F2050E7527553CC +53E2500955AA58EE594F723D5B8B5C64531D60E360F3635C6383633F63BB0000 +64CD65E966F95DE369CD69FD6F1571E54E8975E976F87A937CDF7DCF7D9C8061 +83498358846C84BC85FB88C58D709001906D9397971C9A1250CF5897618E81D3 +85358D0890204FC3507452475373606F6349675F6E2C8DB3901F4FD75C5E8CCA +65CF7D9A53528896517663C35B585B6B5C0A640D6751905C4ED6591A592A6C70 +8A51553E581559A560F0625367C182356955964099C49A284F5358065BFE8010 +5CB15E2F5F856020614B623466FF6CF06EDE80CE817F82D4888B8CB89000902E +968A9EDB9BDB4EE353F059277B2C918D984C9DF96EDD7027535355445B856258 +629E62D36CA26FEF74228A1794386FC18AFE833851E786F853EA000000000000 +92 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +53E94F4690548FB0596A81315DFD7AEA8FBF68DA8C3772F89C486A3D8AB04E39 +53585606576662C563A265E66B4E6DE16E5B70AD77ED7AEF7BAA7DBB803D80C6 +86CB8A95935B56E358C75F3E65AD66966A806BB575378AC7502477E557305F1B +6065667A6C6075F47A1A7F6E81F48718904599B37BC9755C7AF97B5184C40000 +901079E97A9283365AE177404E2D4EF25B995FE062BD663C67F16CE8866B8877 +8A3B914E92F399D06A177026732A82E784578CAF4E01514651CB558B5BF55E16 +5E335E815F145F355F6B5FB461F2631166A2671D6F6E7252753A773A80748139 +817887768ABF8ADC8D858DF3929A957798029CE552C5635776F467156C8873CD +8CC393AE96736D25589C690E69CC8FFD939A75DB901A585A680263B469FB4F43 +6F2C67D88FBB85267DB49354693F6F70576A58F75B2C7D2C722A540A91E39DB4 +4EAD4F4E505C507552438C9E544858245B9A5E1D5E955EAD5EF75F1F608C62B5 +633A63D068AF6C407887798E7A0B7DE082478A028AE68E449013000000000000 +93 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +90B8912D91D89F0E6CE5645864E265756EF476847B1B906993D16EBA54F25FB9 +64A48F4D8FED92445178586B59295C555E976DFB7E8F751C8CBC8EE2985B70B9 +4F1D6BBF6FB1753096FB514E54105835585759AC5C605F926597675C6E21767B +83DF8CED901490FD934D7825783A52AA5EA6571F597460125012515A51AC0000 +51CD520055105854585859575B955CF65D8B60BC6295642D6771684368BC68DF +76D76DD86E6F6D9B706F71C85F5375D879777B497B547B527CD67D7152308463 +856985E48A0E8B048C468E0F9003900F94199676982D9A3095D850CD52D5540C +58025C0E61A7649E6D1E77B37AE580F48404905392855CE09D07533F5F975FB3 +6D9C7279776379BF7BE46BD272EC8AAD68036A6151F87A8169345C4A9CF682EB +5BC59149701E56785C6F60C765666C8C8C5A90419813545166C7920D594890A3 +51854E4D51EA85998B0E7058637A934B696299B47E047577535769608EDF96E3 +6C5D4E8C5C3C5F108FE953028CD1808986795EFF65E54E735165000000000000 +94 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +59825C3F97EE4EFB598A5FCD8A8D6FE179B079625BE78471732B71B15E745FF5 +637B649A71C37C984E435EFC4E4B57DC56A260A96FC37D0D80FD813381BF8FB2 +899786A45DF4628A64AD898767776CE26D3E743678345A467F7582AD99AC4FF3 +5EC362DD63926557676F76C3724C80CC80BA8F29914D500D57F95A9268850000 +6973716472FD8CB758F28CE0966A9019877F79E477E784294F2F5265535A62CD +67CF6CCA767D7B947C95823685848FEB66DD6F2072067E1B83AB99C19EA651FD +7BB178727BB880877B486AE85E61808C75517560516B92626E8C767A91979AEA +4F107F70629C7B4F95A59CE9567A585986E496BC4F345224534A53CD53DB5E06 +642C6591677F6C3E6C4E724872AF73ED75547E41822C85E98CA97BC491C67169 +981298EF633D6669756A76E478D0854386EE532A5351542659835E875F7C60B2 +6249627962AB65906BD46CCC75B276AE789179D87DCB7F7780A588AB8AB98CBB +907F975E98DB6A0B7C3850995C3E5FAE67876BD8743577097F8E000000000000 +95 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +9F3B67CA7A175339758B9AED5F66819D83F180985F3C5FC575627B46903C6867 +59EB5A9B7D10767E8B2C4FF55F6A6A196C376F0274E2796888688A558C795EDF +63CF75C579D282D7932892F2849C86ED9C2D54C15F6C658C6D5C70158CA78CD3 +983B654F74F64E0D4ED857E0592B5A665BCC51A85E035E9C6016627665770000 +65A7666E6D6E72367B268150819A82998B5C8CA08CE68D74961C96444FAE64AB +6B66821E8461856A90E85C01695398A8847A85574F0F526F5FA95E45670D798F +8179890789866DF55F1762556CB84ECF72699B925206543B567458B361A4626E +711A596E7C897CDE7D1B96F06587805E4E194F75517558405E635E735F0A67C4 +4E26853D9589965B7C73980150FB58C1765678A7522577A585117B86504F5909 +72477BC77DE88FBA8FD4904D4FBF52C95A295F0197AD4FDD821792EA57036355 +6B69752B88DC8F147A4252DF58936155620A66AE6BCD7C3F83E950234FF85305 +5446583159495B9D5CF05CEF5D295E9662B16367653E65B9670B000000000000 +96 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +6CD56CE170F978327E2B80DE82B3840C84EC870289128A2A8C4A90A692D298FD +9CF39D6C4E4F4EA1508D5256574A59A85E3D5FD85FD9623F66B4671B67D068D2 +51927D2180AA81A88B008C8C8CBF927E96325420982C531750D5535C58A864B2 +6734726777667A4691E652C36CA16B8658005E4C5954672C7FFB51E176C60000 +646978E89B549EBB57CB59B96627679A6BCE54E969D95E55819C67959BAA67FE +9C52685D4EA64FE353C862B9672B6CAB8FC44FAD7E6D9EBF4E0761626E806F2B +85135473672A9B455DF37B955CAC5BC6871C6E4A84D17A14810859997C8D6C11 +772052D959227121725F77DB97279D61690B5A7F5A1851A5540D547D660E76DF +8FF792989CF459EA725D6EC5514D68C97DBF7DEC97629EBA64786A2183025984 +5B5F6BDB731B76F27DB280178499513267289ED976EE676252FF99055C24623B +7C7E8CB0554F60B67D0B958053014E5F51B6591C723A803691CE5F2577E25384 +5F797D0485AC8A338E8D975667F385AE9453610961086CB97652000000000000 +97 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +8AED8F38552F4F51512A52C753CB5BA55E7D60A0618263D6670967DA6E676D8C +733673377531795088D58A98904A909190F596C4878D59154E884F594E0E8A89 +8F3F981050AD5E7C59965BB95EB863DA63FA64C166DC694A69D86D0B6EB67194 +75287AAF7F8A8000844984C989818B218E0A9065967D990A617E62916B320000 +6C836D747FCC7FFC6DC07F8587BA88F8676583B1983C96F76D1B7D61843D916A +4E7153755D506B046FEB85CD862D89A75229540F5C65674E68A87406748375E2 +88CF88E191CC96E296785F8B73877ACB844E63A0756552896D416E9C74097559 +786B7C9296867ADC9F8D4FB6616E65C5865C4E864EAE50DA4E2151CC5BEE6599 +68816DBC731F764277AD7A1C7CE7826F8AD2907C91CF96759818529B7DD1502B +539867976DCB71D0743381E88F2A96A39C579E9F746058416D997D2F985E4EE4 +4F364F8B51B752B15DBA601C73B2793C82D3923496B796F6970A9E979F6266A6 +6B74521752A370C888C25EC9604B61906F2371497C3E7DF4806F000000000000 +98 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +84EE9023932C54429B6F6AD370898CC28DEF973252B45A415ECA5F046717697C +69946D6A6F0F726272FC7BED8001807E874B90CE516D9E937984808B93328AD6 +502D548C8A716B6A8CC4810760D167A09DF24E994E989C108A6B85C185686900 +6E7E789781550000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000005F0C +4E104E154E2A4E314E364E3C4E3F4E424E564E584E824E858C6B4E8A82125F0D +4E8E4E9E4E9F4EA04EA24EB04EB34EB64ECE4ECD4EC44EC64EC24ED74EDE4EED +4EDF4EF74F094F5A4F304F5B4F5D4F574F474F764F884F8F4F984F7B4F694F70 +4F914F6F4F864F9651184FD44FDF4FCE4FD84FDB4FD14FDA4FD04FE44FE5501A +50285014502A502550054F1C4FF650215029502C4FFE4FEF5011500650435047 +6703505550505048505A5056506C50785080509A508550B450B2000000000000 +99 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +50C950CA50B350C250D650DE50E550ED50E350EE50F950F55109510151025116 +51155114511A5121513A5137513C513B513F51405152514C515451627AF85169 +516A516E5180518256D8518C5189518F519151935195519651A451A651A251A9 +51AA51AB51B351B151B251B051B551BD51C551C951DB51E0865551E951ED0000 +51F051F551FE5204520B5214520E5227522A522E52335239524F5244524B524C +525E5254526A527452695273527F527D528D529452925271528852918FA88FA7 +52AC52AD52BC52B552C152CD52D752DE52E352E698ED52E052F352F552F852F9 +530653087538530D5310530F5315531A5323532F533153335338534053465345 +4E175349534D51D6535E5369536E5918537B53775382539653A053A653A553AE +53B053B653C37C1296D953DF66FC71EE53EE53E853ED53FA5401543D5440542C +542D543C542E54365429541D544E548F5475548E545F5471547754705492547B +5480547654845490548654C754A254B854A554AC54C454C854A8000000000000 +9A +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +54AB54C254A454BE54BC54D854E554E6550F551454FD54EE54ED54FA54E25539 +55405563554C552E555C55455556555755385533555D5599558054AF558A559F +557B557E5598559E55AE557C558355A9558755A855DA55C555DF55C455DC55E4 +55D4561455F7561655FE55FD561B55F9564E565071DF56345636563256380000 +566B5664562F566C566A56865680568A56A05694568F56A556AE56B656B456C2 +56BC56C156C356C056C856CE56D156D356D756EE56F9570056FF570457095708 +570B570D57135718571655C7571C572657375738574E573B5740574F576957C0 +57885761577F5789579357A057B357A457AA57B057C357C657D457D257D3580A +57D657E3580B5819581D587258215862584B58706BC05852583D5879588558B9 +589F58AB58BA58DE58BB58B858AE58C558D358D158D758D958D858E558DC58E4 +58DF58EF58FA58F958FB58FC58FD5902590A5910591B68A65925592C592D5932 +5938593E7AD259555950594E595A5958596259605967596C5969000000000000 +9B +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +59785981599D4F5E4FAB59A359B259C659E859DC598D59D959DA5A255A1F5A11 +5A1C5A095A1A5A405A6C5A495A355A365A625A6A5A9A5ABC5ABE5ACB5AC25ABD +5AE35AD75AE65AE95AD65AFA5AFB5B0C5B0B5B165B325AD05B2A5B365B3E5B43 +5B455B405B515B555B5A5B5B5B655B695B705B735B755B7865885B7A5B800000 +5B835BA65BB85BC35BC75BC95BD45BD05BE45BE65BE25BDE5BE55BEB5BF05BF6 +5BF35C055C075C085C0D5C135C205C225C285C385C395C415C465C4E5C535C50 +5C4F5B715C6C5C6E4E625C765C795C8C5C915C94599B5CAB5CBB5CB65CBC5CB7 +5CC55CBE5CC75CD95CE95CFD5CFA5CED5D8C5CEA5D0B5D155D175D5C5D1F5D1B +5D115D145D225D1A5D195D185D4C5D525D4E5D4B5D6C5D735D765D875D845D82 +5DA25D9D5DAC5DAE5DBD5D905DB75DBC5DC95DCD5DD35DD25DD65DDB5DEB5DF2 +5DF55E0B5E1A5E195E115E1B5E365E375E445E435E405E4E5E575E545E5F5E62 +5E645E475E755E765E7A9EBC5E7F5EA05EC15EC25EC85ED05ECF000000000000 +9C +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +5ED65EE35EDD5EDA5EDB5EE25EE15EE85EE95EEC5EF15EF35EF05EF45EF85EFE +5F035F095F5D5F5C5F0B5F115F165F295F2D5F385F415F485F4C5F4E5F2F5F51 +5F565F575F595F615F6D5F735F775F835F825F7F5F8A5F885F915F875F9E5F99 +5F985FA05FA85FAD5FBC5FD65FFB5FE45FF85FF15FDD60B35FFF602160600000 +601960106029600E6031601B6015602B6026600F603A605A6041606A6077605F +604A6046604D6063604360646042606C606B60596081608D60E76083609A6084 +609B60966097609260A7608B60E160B860E060D360B45FF060BD60C660B560D8 +614D6115610660F660F7610060F460FA6103612160FB60F1610D610E6147613E +61286127614A613F613C612C6134613D614261446173617761586159615A616B +6174616F61656171615F615D6153617561996196618761AC6194619A618A6191 +61AB61AE61CC61CA61C961F761C861C361C661BA61CB7F7961CD61E661E361F6 +61FA61F461FF61FD61FC61FE620062086209620D620C6214621B000000000000 +9D +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +621E6221622A622E6230623262336241624E625E6263625B62606268627C6282 +6289627E62926293629662D46283629462D762D162BB62CF62FF62C664D462C8 +62DC62CC62CA62C262C7629B62C9630C62EE62F163276302630862EF62F56350 +633E634D641C634F6396638E638063AB637663A3638F6389639F63B5636B0000 +636963BE63E963C063C663E363C963D263F663C4641664346406641364266436 +651D64176428640F6467646F6476644E652A6495649364A564A9648864BC64DA +64D264C564C764BB64D864C264F164E7820964E064E162AC64E364EF652C64F6 +64F464F264FA650064FD6518651C650565246523652B65346535653765366538 +754B654865566555654D6558655E655D65726578658265838B8A659B659F65AB +65B765C365C665C165C465CC65D265DB65D965E065E165F16772660A660365FB +6773663566366634661C664F664466496641665E665D666466676668665F6662 +667066836688668E668966846698669D66C166B966C966BE66BC000000000000 +9E +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +66C466B866D666DA66E0663F66E666E966F066F566F7670F6716671E67266727 +9738672E673F67366741673867376746675E67606759676367646789677067A9 +677C676A678C678B67A667A1678567B767EF67B467EC67B367E967B867E467DE +67DD67E267EE67B967CE67C667E76A9C681E684668296840684D6832684E0000 +68B3682B685968636877687F689F688F68AD6894689D689B68836AAE68B96874 +68B568A068BA690F688D687E690168CA690868D86922692668E1690C68CD68D4 +68E768D569366912690468D768E3692568F968E068EF6928692A691A69236921 +68C669796977695C6978696B6954697E696E69396974693D695969306961695E +695D6981696A69B269AE69D069BF69C169D369BE69CE5BE869CA69DD69BB69C3 +69A76A2E699169A0699C699569B469DE69E86A026A1B69FF6B0A69F969F269E7 +6A0569B16A1E69ED6A1469EB6A0A6A126AC16A236A136A446A0C6A726A366A78 +6A476A626A596A666A486A386A226A906A8D6AA06A846AA26AA3000000000000 +9F +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +6A9786176ABB6AC36AC26AB86AB36AAC6ADE6AD16ADF6AAA6ADA6AEA6AFB6B05 +86166AFA6B126B169B316B1F6B386B3776DC6B3998EE6B476B436B496B506B59 +6B546B5B6B5F6B616B786B796B7F6B806B846B836B8D6B986B956B9E6BA46BAA +6BAB6BAF6BB26BB16BB36BB76BBC6BC66BCB6BD36BDF6BEC6BEB6BF36BEF0000 +9EBE6C086C136C146C1B6C246C236C5E6C556C626C6A6C826C8D6C9A6C816C9B +6C7E6C686C736C926C906CC46CF16CD36CBD6CD76CC56CDD6CAE6CB16CBE6CBA +6CDB6CEF6CD96CEA6D1F884D6D366D2B6D3D6D386D196D356D336D126D0C6D63 +6D936D646D5A6D796D596D8E6D956FE46D856DF96E156E0A6DB56DC76DE66DB8 +6DC66DEC6DDE6DCC6DE86DD26DC56DFA6DD96DE46DD56DEA6DEE6E2D6E6E6E2E +6E196E726E5F6E3E6E236E6B6E2B6E766E4D6E1F6E436E3A6E4E6E246EFF6E1D +6E386E826EAA6E986EC96EB76ED36EBD6EAF6EC46EB26ED46ED56E8F6EA56EC2 +6E9F6F416F11704C6EEC6EF86EFE6F3F6EF26F316EEF6F326ECC000000000000 +E0 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +6F3E6F136EF76F866F7A6F786F816F806F6F6F5B6FF36F6D6F826F7C6F586F8E +6F916FC26F666FB36FA36FA16FA46FB96FC66FAA6FDF6FD56FEC6FD46FD86FF1 +6FEE6FDB7009700B6FFA70117001700F6FFE701B701A6F74701D7018701F7030 +703E7032705170637099709270AF70F170AC70B870B370AE70DF70CB70DD0000 +70D9710970FD711C711971657155718871667162714C7156716C718F71FB7184 +719571A871AC71D771B971BE71D271C971D471CE71E071EC71E771F571FC71F9 +71FF720D7210721B7228722D722C72307232723B723C723F72407246724B7258 +7274727E7282728172877292729672A272A772B972B272C372C672C472CE72D2 +72E272E072E172F972F7500F7317730A731C7316731D7334732F73297325733E +734E734F9ED87357736A7368737073787375737B737A73C873B373CE73BB73C0 +73E573EE73DE74A27405746F742573F87432743A7455743F745F74597441745C +746974707463746A7476747E748B749E74A774CA74CF74D473F1000000000000 +E1 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +74E074E374E774E974EE74F274F074F174F874F7750475037505750C750E750D +75157513751E7526752C753C7544754D754A7549755B7546755A756975647567 +756B756D75787576758675877574758A758975827594759A759D75A575A375C2 +75B375C375B575BD75B875BC75B175CD75CA75D275D975E375DE75FE75FF0000 +75FC760175F075FA75F275F3760B760D7609761F762776207621762276247634 +7630763B764776487646765C76587661766276687669766A7667766C76707672 +76767678767C768076837688768B768E769676937699769A76B076B476B876B9 +76BA76C276CD76D676D276DE76E176E576E776EA862F76FB7708770777047729 +7724771E77257726771B773777387747775A7768776B775B7765777F777E7779 +778E778B779177A0779E77B077B677B977BF77BC77BD77BB77C777CD77D777DA +77DC77E377EE77FC780C781279267820792A7845788E78747886787C789A788C +78A378B578AA78AF78D178C678CB78D478BE78BC78C578CA78EC000000000000 +E2 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +78E778DA78FD78F47907791279117919792C792B794079607957795F795A7955 +7953797A797F798A799D79A79F4B79AA79AE79B379B979BA79C979D579E779EC +79E179E37A087A0D7A187A197A207A1F79807A317A3B7A3E7A377A437A577A49 +7A617A627A699F9D7A707A797A7D7A887A977A957A987A967AA97AC87AB00000 +7AB67AC57AC47ABF90837AC77ACA7ACD7ACF7AD57AD37AD97ADA7ADD7AE17AE2 +7AE67AED7AF07B027B0F7B0A7B067B337B187B197B1E7B357B287B367B507B7A +7B047B4D7B0B7B4C7B457B757B657B747B677B707B717B6C7B6E7B9D7B987B9F +7B8D7B9C7B9A7B8B7B927B8F7B5D7B997BCB7BC17BCC7BCF7BB47BC67BDD7BE9 +7C117C147BE67BE57C607C007C077C137BF37BF77C177C0D7BF67C237C277C2A +7C1F7C377C2B7C3D7C4C7C437C547C4F7C407C507C587C5F7C647C567C657C6C +7C757C837C907CA47CAD7CA27CAB7CA17CA87CB37CB27CB17CAE7CB97CBD7CC0 +7CC57CC27CD87CD27CDC7CE29B3B7CEF7CF27CF47CF67CFA7D06000000000000 +E3 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +7D027D1C7D157D0A7D457D4B7D2E7D327D3F7D357D467D737D567D4E7D727D68 +7D6E7D4F7D637D937D897D5B7D8F7D7D7D9B7DBA7DAE7DA37DB57DC77DBD7DAB +7E3D7DA27DAF7DDC7DB87D9F7DB07DD87DDD7DE47DDE7DFB7DF27DE17E057E0A +7E237E217E127E317E1F7E097E0B7E227E467E667E3B7E357E397E437E370000 +7E327E3A7E677E5D7E567E5E7E597E5A7E797E6A7E697E7C7E7B7E837DD57E7D +8FAE7E7F7E887E897E8C7E927E907E937E947E967E8E7E9B7E9C7F387F3A7F45 +7F4C7F4D7F4E7F507F517F557F547F587F5F7F607F687F697F677F787F827F86 +7F837F887F877F8C7F947F9E7F9D7F9A7FA37FAF7FB27FB97FAE7FB67FB88B71 +7FC57FC67FCA7FD57FD47FE17FE67FE97FF37FF998DC80068004800B80128018 +8019801C80218028803F803B804A804680528058805A805F8062806880738072 +807080768079807D807F808480868085809B8093809A80AD519080AC80DB80E5 +80D980DD80C480DA80D6810980EF80F1811B81298123812F814B000000000000 +E4 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +968B8146813E8153815180FC8171816E81658166817481838188818A81808182 +81A0819581A481A3815F819381A981B081B581BE81B881BD81C081C281BA81C9 +81CD81D181D981D881C881DA81DF81E081E781FA81FB81FE8201820282058207 +820A820D821082168229822B82388233824082598258825D825A825F82640000 +82628268826A826B822E827182778278827E828D829282AB829F82BB82AC82E1 +82E382DF82D282F482F382FA8393830382FB82F982DE830682DC830982D98335 +83348316833283318340833983508345832F832B831783188385839A83AA839F +83A283968323838E8387838A837C83B58373837583A0838983A883F4841383EB +83CE83FD840383D8840B83C183F7840783E083F2840D8422842083BD84388506 +83FB846D842A843C855A84848477846B84AD846E848284698446842C846F8479 +843584CA846284B984BF849F84D984CD84BB84DA84D084C184C684D684A18521 +84FF84F485178518852C851F8515851484FC8540856385588548000000000000 +E5 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +85418602854B8555858085A485888591858A85A8856D8594859B85EA8587859C +8577857E859085C985BA85CF85B985D085D585DD85E585DC85F9860A8613860B +85FE85FA86068622861A8630863F864D4E558654865F86678671869386A386A9 +86AA868B868C86B686AF86C486C686B086C9882386AB86D486DE86E986EC0000 +86DF86DB86EF8712870687088700870386FB87118709870D86F9870A8734873F +8737873B87258729871A8760875F8778874C874E877487578768876E87598753 +8763876A880587A2879F878287AF87CB87BD87C087D096D687AB87C487B387C7 +87C687BB87EF87F287E0880F880D87FE87F687F7880E87D28811881688158822 +88218831883688398827883B8844884288528859885E8862886B8881887E889E +8875887D88B5887288828897889288AE889988A2888D88A488B088BF88B188C3 +88C488D488D888D988DD88F9890288FC88F488E888F28904890C890A89138943 +891E8925892A892B89418944893B89368938894C891D8960895E000000000000 +E6 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +89668964896D896A896F89748977897E89838988898A8993899889A189A989A6 +89AC89AF89B289BA89BD89BF89C089DA89DC89DD89E789F489F88A038A168A10 +8A0C8A1B8A1D8A258A368A418A5B8A528A468A488A7C8A6D8A6C8A628A858A82 +8A848AA88AA18A918AA58AA68A9A8AA38AC48ACD8AC28ADA8AEB8AF38AE70000 +8AE48AF18B148AE08AE28AF78ADE8ADB8B0C8B078B1A8AE18B168B108B178B20 +8B3397AB8B268B2B8B3E8B288B418B4C8B4F8B4E8B498B568B5B8B5A8B6B8B5F +8B6C8B6F8B748B7D8B808B8C8B8E8B928B938B968B998B9A8C3A8C418C3F8C48 +8C4C8C4E8C508C558C628C6C8C788C7A8C828C898C858C8A8C8D8C8E8C948C7C +8C98621D8CAD8CAA8CBD8CB28CB38CAE8CB68CC88CC18CE48CE38CDA8CFD8CFA +8CFB8D048D058D0A8D078D0F8D0D8D109F4E8D138CCD8D148D168D678D6D8D71 +8D738D818D998DC28DBE8DBA8DCF8DDA8DD68DCC8DDB8DCB8DEA8DEB8DDF8DE3 +8DFC8E088E098DFF8E1D8E1E8E108E1F8E428E358E308E348E4A000000000000 +E7 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +8E478E498E4C8E508E488E598E648E608E2A8E638E558E768E728E7C8E818E87 +8E858E848E8B8E8A8E938E918E948E998EAA8EA18EAC8EB08EC68EB18EBE8EC5 +8EC88ECB8EDB8EE38EFC8EFB8EEB8EFE8F0A8F058F158F128F198F138F1C8F1F +8F1B8F0C8F268F338F3B8F398F458F428F3E8F4C8F498F468F4E8F578F5C0000 +8F628F638F648F9C8F9F8FA38FAD8FAF8FB78FDA8FE58FE28FEA8FEF90878FF4 +90058FF98FFA901190159021900D901E9016900B90279036903590398FF8904F +905090519052900E9049903E90569058905E9068906F907696A890729082907D +90819080908A9089908F90A890AF90B190B590E290E4624890DB910291129119 +91329130914A9156915891639165916991739172918B9189918291A291AB91AF +91AA91B591B491BA91C091C191C991CB91D091D691DF91E191DB91FC91F591F6 +921E91FF9214922C92159211925E925792459249926492489295923F924B9250 +929C92969293929B925A92CF92B992B792E9930F92FA9344932E000000000000 +E8 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +93199322931A9323933A9335933B935C9360937C936E935693B093AC93AD9394 +93B993D693D793E893E593D893C393DD93D093C893E4941A9414941394039407 +94109436942B94359421943A944194529444945B94609462945E946A92299470 +94759477947D945A947C947E9481947F95829587958A95949596959895990000 +95A095A895A795AD95BC95BB95B995BE95CA6FF695C395CD95CC95D595D495D6 +95DC95E195E595E296219628962E962F9642964C964F964B9677965C965E965D +965F96669672966C968D96989695969796AA96A796B196B296B096B496B696B8 +96B996CE96CB96C996CD894D96DC970D96D596F99704970697089713970E9711 +970F971697199724972A97309739973D973E97449746974897429749975C9760 +97649766976852D2976B977197799785977C9781977A9786978B978F9790979C +97A897A697A397B397B497C397C697C897CB97DC97ED9F4F97F27ADF97F697F5 +980F980C9838982498219837983D9846984F984B986B986F9870000000000000 +E9 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +98719874987398AA98AF98B198B698C498C398C698E998EB9903990999129914 +99189921991D991E99249920992C992E993D993E9942994999459950994B9951 +9952994C99559997999899A599AD99AE99BC99DF99DB99DD99D899D199ED99EE +99F199F299FB99F89A019A0F9A0599E29A199A2B9A379A459A429A409A430000 +9A3E9A559A4D9A5B9A579A5F9A629A659A649A699A6B9A6A9AAD9AB09ABC9AC0 +9ACF9AD19AD39AD49ADE9ADF9AE29AE39AE69AEF9AEB9AEE9AF49AF19AF79AFB +9B069B189B1A9B1F9B229B239B259B279B289B299B2A9B2E9B2F9B329B449B43 +9B4F9B4D9B4E9B519B589B749B939B839B919B969B979B9F9BA09BA89BB49BC0 +9BCA9BB99BC69BCF9BD19BD29BE39BE29BE49BD49BE19C3A9BF29BF19BF09C15 +9C149C099C139C0C9C069C089C129C0A9C049C2E9C1B9C259C249C219C309C47 +9C329C469C3E9C5A9C609C679C769C789CE79CEC9CF09D099D089CEB9D039D06 +9D2A9D269DAF9D239D1F9D449D159D129D419D3F9D3E9D469D48000000000000 +EA +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +9D5D9D5E9D649D519D509D599D729D899D879DAB9D6F9D7A9D9A9DA49DA99DB2 +9DC49DC19DBB9DB89DBA9DC69DCF9DC29DD99DD39DF89DE69DED9DEF9DFD9E1A +9E1B9E1E9E759E799E7D9E819E889E8B9E8C9E929E959E919E9D9EA59EA99EB8 +9EAA9EAD97619ECC9ECE9ECF9ED09ED49EDC9EDE9EDD9EE09EE59EE89EEF0000 +9EF49EF69EF79EF99EFB9EFC9EFD9F079F0876B79F159F219F2C9F3E9F4A9F52 +9F549F639F5F9F609F619F669F679F6C9F6A9F779F729F769F959F9C9FA0582F +69C79059746451DC719900000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +ED +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +7E8A891C9348928884DC4FC970BB663168C892F966FB5F454E284EE14EFC4F00 +4F034F394F564F924F8A4F9A4F944FCD504050224FFF501E5046507050425094 +50F450D8514A5164519D51BE51EC5215529C52A652C052DB5300530753245372 +539353B253DDFA0E549C548A54A954FF55865759576557AC57C857C7FA0F0000 +FA10589E58B2590B5953595B595D596359A459BA5B565BC0752F5BD85BEC5C1E +5CA65CBA5CF55D275D53FA115D425D6D5DB85DB95DD05F215F345F675FB75FDE +605D6085608A60DE60D5612060F26111613761306198621362A663F56460649D +64CE654E66006615663B6609662E661E6624666566576659FA126673669966A0 +66B266BF66FA670EF929676667BB685267C06801684468CFFA136968FA146998 +69E26A306A6B6A466A736A7E6AE26AE46BD66C3F6C5C6C866C6F6CDA6D046D87 +6D6F6D966DAC6DCF6DF86DF26DFC6E396E5C6E276E3C6EBF6F886FB56FF57005 +70077028708570AB710F7104715C71467147FA1571C171FE72B1000000000000 +EE +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +72BE7324FA16737773BD73C973D673E373D2740773F57426742A7429742E7462 +7489749F7501756F7682769C769E769B76A6FA17774652AF7821784E7864787A +7930FA18FA19FA1A7994FA1B799B7AD17AE7FA1C7AEB7B9EFA1D7D487D5C7DB7 +7DA07DD67E527F477FA1FA1E83018362837F83C783F6844884B4855385590000 +856BFA1F85B0FA20FA21880788F58A128A378A798AA78ABE8ADFFA228AF68B53 +8B7F8CF08CF48D128D76FA238ECFFA24FA25906790DEFA269115912791DA91D7 +91DE91ED91EE91E491E592069210920A923A9240923C924E9259925192399267 +92A79277927892E792D792D992D0FA2792D592E092D39325932192FBFA28931E +92FF931D93029370935793A493C693DE93F89431944594489592F9DCFA29969D +96AF9733973B9743974D974F9751975598579865FA2AFA2B9927FA2C999E9A4E +9AD99ADC9B759B729B8F9BB19BBB9C009D709D6BFA2D9E199ED1000000002170 +217121722173217421752176217721782179FFE2FFE4FF07FF02000000000000 +FA +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +2170217121722173217421752176217721782179216021612162216321642165 +2166216721682169FFE2FFE4FF07FF0232312116212122357E8A891C93489288 +84DC4FC970BB663168C892F966FB5F454E284EE14EFC4F004F034F394F564F92 +4F8A4F9A4F944FCD504050224FFF501E504650705042509450F450D8514A0000 +5164519D51BE51EC5215529C52A652C052DB5300530753245372539353B253DD +FA0E549C548A54A954FF55865759576557AC57C857C7FA0FFA10589E58B2590B +5953595B595D596359A459BA5B565BC0752F5BD85BEC5C1E5CA65CBA5CF55D27 +5D53FA115D425D6D5DB85DB95DD05F215F345F675FB75FDE605D6085608A60DE +60D5612060F26111613761306198621362A663F56460649D64CE654E66006615 +663B6609662E661E6624666566576659FA126673669966A066B266BF66FA670E +F929676667BB685267C06801684468CFFA136968FA14699869E26A306A6B6A46 +6A736A7E6AE26AE46BD66C3F6C5C6C866C6F6CDA6D046D876D6F000000000000 +FB +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +6D966DAC6DCF6DF86DF26DFC6E396E5C6E276E3C6EBF6F886FB56FF570057007 +7028708570AB710F7104715C71467147FA1571C171FE72B172BE7324FA167377 +73BD73C973D673E373D2740773F57426742A7429742E74627489749F7501756F +7682769C769E769B76A6FA17774652AF7821784E7864787A7930FA18FA190000 +FA1A7994FA1B799B7AD17AE7FA1C7AEB7B9EFA1D7D487D5C7DB77DA07DD67E52 +7F477FA1FA1E83018362837F83C783F6844884B485538559856BFA1F85B0FA20 +FA21880788F58A128A378A798AA78ABE8ADFFA228AF68B538B7F8CF08CF48D12 +8D76FA238ECFFA24FA25906790DEFA269115912791DA91D791DE91ED91EE91E4 +91E592069210920A923A9240923C924E925992519239926792A79277927892E7 +92D792D992D0FA2792D592E092D39325932192FBFA28931E92FF931D93029370 +935793A493C693DE93F89431944594489592F9DCFA29969D96AF9733973B9743 +974D974F9751975598579865FA2AFA2B9927FA2C999E9A4E9AD9000000000000 +FC +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +9ADC9B759B729B8F9BB19BBB9C009D709D6BFA2D9E199ED10000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +R +8160 301C FF5E +8161 2016 2225 +817C 2212 FF0D +8191 00A2 FFE0 +8192 00A3 FFE1 +81CA 00AC FFE2 +81BE 222a +81BF 2229 +81DA 2220 +81DB 22a5 +81DF 2261 +81E0 2252 +81E3 221a +81E6 2235 +81E7 222b diff --git a/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/cp936.enc b/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/cp936.enc new file mode 100644 index 0000000000000000000000000000000000000000..37bcc80db0f5b601500a3ecb8083ae5f318e4109 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/cp936.enc @@ -0,0 +1,2162 @@ +# Encoding file: cp936, multi-byte +M +003F 0 127 +00 +0000000100020003000400050006000700080009000A000B000C000D000E000F +0010001100120013001400150016001700180019001A001B001C001D001E001F +0020002100220023002400250026002700280029002A002B002C002D002E002F +0030003100320033003400350036003700380039003A003B003C003D003E003F +0040004100420043004400450046004700480049004A004B004C004D004E004F +0050005100520053005400550056005700580059005A005B005C005D005E005F +0060006100620063006400650066006700680069006A006B006C006D006E006F +0070007100720073007400750076007700780079007A007B007C007D007E007F +20AC000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +81 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +4E024E044E054E064E0F4E124E174E1F4E204E214E234E264E294E2E4E2F4E31 +4E334E354E374E3C4E404E414E424E444E464E4A4E514E554E574E5A4E5B4E62 +4E634E644E654E674E684E6A4E6B4E6C4E6D4E6E4E6F4E724E744E754E764E77 +4E784E794E7A4E7B4E7C4E7D4E7F4E804E814E824E834E844E854E874E8A0000 +4E904E964E974E994E9C4E9D4E9E4EA34EAA4EAF4EB04EB14EB44EB64EB74EB8 +4EB94EBC4EBD4EBE4EC84ECC4ECF4ED04ED24EDA4EDB4EDC4EE04EE24EE64EE7 +4EE94EED4EEE4EEF4EF14EF44EF84EF94EFA4EFC4EFE4F004F024F034F044F05 +4F064F074F084F0B4F0C4F124F134F144F154F164F1C4F1D4F214F234F284F29 +4F2C4F2D4F2E4F314F334F354F374F394F3B4F3E4F3F4F404F414F424F444F45 +4F474F484F494F4A4F4B4F4C4F524F544F564F614F624F664F684F6A4F6B4F6D +4F6E4F714F724F754F774F784F794F7A4F7D4F804F814F824F854F864F874F8A +4F8C4F8E4F904F924F934F954F964F984F994F9A4F9C4F9E4F9F4FA14FA20000 +82 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +4FA44FAB4FAD4FB04FB14FB24FB34FB44FB64FB74FB84FB94FBA4FBB4FBC4FBD +4FBE4FC04FC14FC24FC64FC74FC84FC94FCB4FCC4FCD4FD24FD34FD44FD54FD6 +4FD94FDB4FE04FE24FE44FE54FE74FEB4FEC4FF04FF24FF44FF54FF64FF74FF9 +4FFB4FFC4FFD4FFF5000500150025003500450055006500750085009500A0000 +500B500E501050115013501550165017501B501D501E50205022502350245027 +502B502F5030503150325033503450355036503750385039503B503D503F5040 +504150425044504550465049504A504B504D5050505150525053505450565057 +50585059505B505D505E505F506050615062506350645066506750685069506A +506B506D506E506F50705071507250735074507550785079507A507C507D5081 +508250835084508650875089508A508B508C508E508F50905091509250935094 +50955096509750985099509A509B509C509D509E509F50A050A150A250A450A6 +50AA50AB50AD50AE50AF50B050B150B350B450B550B650B750B850B950BC0000 +83 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +50BD50BE50BF50C050C150C250C350C450C550C650C750C850C950CA50CB50CC +50CD50CE50D050D150D250D350D450D550D750D850D950DB50DC50DD50DE50DF +50E050E150E250E350E450E550E850E950EA50EB50EF50F050F150F250F450F6 +50F750F850F950FA50FC50FD50FE50FF51005101510251035104510551080000 +5109510A510C510D510E510F511051115113511451155116511751185119511A +511B511C511D511E511F512051225123512451255126512751285129512A512B +512C512D512E512F5130513151325133513451355136513751385139513A513B +513C513D513E51425147514A514C514E514F515051525153515751585159515B +515D515E515F5160516151635164516651675169516A516F5172517A517E517F +5183518451865187518A518B518E518F51905191519351945198519A519D519E +519F51A151A351A651A751A851A951AA51AD51AE51B451B851B951BA51BE51BF +51C151C251C351C551C851CA51CD51CE51D051D251D351D451D551D651D70000 +84 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +51D851D951DA51DC51DE51DF51E251E351E551E651E751E851E951EA51EC51EE +51F151F251F451F751FE520452055209520B520C520F5210521352145215521C +521E521F522152225223522552265227522A522C522F5231523252345235523C +523E524452455246524752485249524B524E524F525252535255525752580000 +5259525A525B525D525F526052625263526452665268526B526C526D526E5270 +52715273527452755276527752785279527A527B527C527E5280528352845285 +528652875289528A528B528C528D528E528F5291529252945295529652975298 +5299529A529C52A452A552A652A752AE52AF52B052B452B552B652B752B852B9 +52BA52BB52BC52BD52C052C152C252C452C552C652C852CA52CC52CD52CE52CF +52D152D352D452D552D752D952DA52DB52DC52DD52DE52E052E152E252E352E5 +52E652E752E852E952EA52EB52EC52ED52EE52EF52F152F252F352F452F552F6 +52F752F852FB52FC52FD530153025303530453075309530A530B530C530E0000 +85 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +53115312531353145318531B531C531E531F532253245325532753285329532B +532C532D532F533053315332533353345335533653375338533C533D53405342 +53445346534B534C534D5350535453585359535B535D53655368536A536C536D +537253765379537B537C537D537E53805381538353875388538A538E538F0000 +53905391539253935394539653975399539B539C539E53A053A153A453A753AA +53AB53AC53AD53AF53B053B153B253B353B453B553B753B853B953BA53BC53BD +53BE53C053C353C453C553C653C753CE53CF53D053D253D353D553DA53DC53DD +53DE53E153E253E753F453FA53FE53FF5400540254055407540B541454185419 +541A541C542254245425542A5430543354365437543A543D543F544154425444 +544554475449544C544D544E544F5451545A545D545E545F5460546154635465 +54675469546A546B546C546D546E546F547054745479547A547E547F54815483 +5485548754885489548A548D5491549354975498549C549E549F54A054A10000 +86 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +54A254A554AE54B054B254B554B654B754B954BA54BC54BE54C354C554CA54CB +54D654D854DB54E054E154E254E354E454EB54EC54EF54F054F154F454F554F6 +54F754F854F954FB54FE550055025503550455055508550A550B550C550D550E +5512551355155516551755185519551A551C551D551E551F5521552555260000 +55285529552B552D553255345535553655385539553A553B553D554055425545 +55475548554B554C554D554E554F5551555255535554555755585559555A555B +555D555E555F55605562556355685569556B556F557055715572557355745579 +557A557D557F55855586558C558D558E559055925593559555965597559A559B +559E55A055A155A255A355A455A555A655A855A955AA55AB55AC55AD55AE55AF +55B055B255B455B655B855BA55BC55BF55C055C155C255C355C655C755C855CA +55CB55CE55CF55D055D555D755D855D955DA55DB55DE55E055E255E755E955ED +55EE55F055F155F455F655F855F955FA55FB55FC55FF56025603560456050000 +87 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +56065607560A560B560D561056115612561356145615561656175619561A561C +561D5620562156225625562656285629562A562B562E562F5630563356355637 +5638563A563C563D563E5640564156425643564456455646564756485649564A +564B564F565056515652565356555656565A565B565D565E565F566056610000 +5663566556665667566D566E566F56705672567356745675567756785679567A +567D567E567F56805681568256835684568756885689568A568B568C568D5690 +56915692569456955696569756985699569A569B569C569D569E569F56A056A1 +56A256A456A556A656A756A856A956AA56AB56AC56AD56AE56B056B156B256B3 +56B456B556B656B856B956BA56BB56BD56BE56BF56C056C156C256C356C456C5 +56C656C756C856C956CB56CC56CD56CE56CF56D056D156D256D356D556D656D8 +56D956DC56E356E556E656E756E856E956EA56EC56EE56EF56F256F356F656F7 +56F856FB56FC57005701570257055707570B570C570D570E570F571057110000 +88 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +57125713571457155716571757185719571A571B571D571E5720572157225724 +572557265727572B5731573257345735573657375738573C573D573F57415743 +57445745574657485749574B5752575357545755575657585759576257635765 +5767576C576E5770577157725774577557785779577A577D577E577F57800000 +5781578757885789578A578D578E578F57905791579457955796579757985799 +579A579C579D579E579F57A557A857AA57AC57AF57B057B157B357B557B657B7 +57B957BA57BB57BC57BD57BE57BF57C057C157C457C557C657C757C857C957CA +57CC57CD57D057D157D357D657D757DB57DC57DE57E157E257E357E557E657E7 +57E857E957EA57EB57EC57EE57F057F157F257F357F557F657F757FB57FC57FE +57FF580158035804580558085809580A580C580E580F58105812581358145816 +58175818581A581B581C581D581F5822582358255826582758285829582B582C +582D582E582F58315832583358345836583758385839583A583B583C583D0000 +89 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +583E583F584058415842584358455846584758485849584A584B584E584F5850 +585258535855585658575859585A585B585C585D585F58605861586258635864 +5866586758685869586A586D586E586F58705871587258735874587558765877 +58785879587A587B587C587D587F58825884588658875888588A588B588C0000 +588D588E588F5890589158945895589658975898589B589C589D58A058A158A2 +58A358A458A558A658A758AA58AB58AC58AD58AE58AF58B058B158B258B358B4 +58B558B658B758B858B958BA58BB58BD58BE58BF58C058C258C358C458C658C7 +58C858C958CA58CB58CC58CD58CE58CF58D058D258D358D458D658D758D858D9 +58DA58DB58DC58DD58DE58DF58E058E158E258E358E558E658E758E858E958EA +58ED58EF58F158F258F458F558F758F858FA58FB58FC58FD58FE58FF59005901 +59035905590659085909590A590B590C590E591059115912591359175918591B +591D591E592059215922592359265928592C59305932593359355936593B0000 +8A +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +593D593E593F5940594359455946594A594C594D5950595259535959595B595C +595D595E595F5961596359645966596759685969596A596B596C596D596E596F +59705971597259755977597A597B597C597E597F598059855989598B598C598E +598F59905991599459955998599A599B599C599D599F59A059A159A259A60000 +59A759AC59AD59B059B159B359B459B559B659B759B859BA59BC59BD59BF59C0 +59C159C259C359C459C559C759C859C959CC59CD59CE59CF59D559D659D959DB +59DE59DF59E059E159E259E459E659E759E959EA59EB59ED59EE59EF59F059F1 +59F259F359F459F559F659F759F859FA59FC59FD59FE5A005A025A0A5A0B5A0D +5A0E5A0F5A105A125A145A155A165A175A195A1A5A1B5A1D5A1E5A215A225A24 +5A265A275A285A2A5A2B5A2C5A2D5A2E5A2F5A305A335A355A375A385A395A3A +5A3B5A3D5A3E5A3F5A415A425A435A445A455A475A485A4B5A4C5A4D5A4E5A4F +5A505A515A525A535A545A565A575A585A595A5B5A5C5A5D5A5E5A5F5A600000 +8B +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +5A615A635A645A655A665A685A695A6B5A6C5A6D5A6E5A6F5A705A715A725A73 +5A785A795A7B5A7C5A7D5A7E5A805A815A825A835A845A855A865A875A885A89 +5A8A5A8B5A8C5A8D5A8E5A8F5A905A915A935A945A955A965A975A985A995A9C +5A9D5A9E5A9F5AA05AA15AA25AA35AA45AA55AA65AA75AA85AA95AAB5AAC0000 +5AAD5AAE5AAF5AB05AB15AB45AB65AB75AB95ABA5ABB5ABC5ABD5ABF5AC05AC3 +5AC45AC55AC65AC75AC85ACA5ACB5ACD5ACE5ACF5AD05AD15AD35AD55AD75AD9 +5ADA5ADB5ADD5ADE5ADF5AE25AE45AE55AE75AE85AEA5AEC5AED5AEE5AEF5AF0 +5AF25AF35AF45AF55AF65AF75AF85AF95AFA5AFB5AFC5AFD5AFE5AFF5B005B01 +5B025B035B045B055B065B075B085B0A5B0B5B0C5B0D5B0E5B0F5B105B115B12 +5B135B145B155B185B195B1A5B1B5B1C5B1D5B1E5B1F5B205B215B225B235B24 +5B255B265B275B285B295B2A5B2B5B2C5B2D5B2E5B2F5B305B315B335B355B36 +5B385B395B3A5B3B5B3C5B3D5B3E5B3F5B415B425B435B445B455B465B470000 +8C +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +5B485B495B4A5B4B5B4C5B4D5B4E5B4F5B525B565B5E5B605B615B675B685B6B +5B6D5B6E5B6F5B725B745B765B775B785B795B7B5B7C5B7E5B7F5B825B865B8A +5B8D5B8E5B905B915B925B945B965B9F5BA75BA85BA95BAC5BAD5BAE5BAF5BB1 +5BB25BB75BBA5BBB5BBC5BC05BC15BC35BC85BC95BCA5BCB5BCD5BCE5BCF0000 +5BD15BD45BD55BD65BD75BD85BD95BDA5BDB5BDC5BE05BE25BE35BE65BE75BE9 +5BEA5BEB5BEC5BED5BEF5BF15BF25BF35BF45BF55BF65BF75BFD5BFE5C005C02 +5C035C055C075C085C0B5C0C5C0D5C0E5C105C125C135C175C195C1B5C1E5C1F +5C205C215C235C265C285C295C2A5C2B5C2D5C2E5C2F5C305C325C335C355C36 +5C375C435C445C465C475C4C5C4D5C525C535C545C565C575C585C5A5C5B5C5C +5C5D5C5F5C625C645C675C685C695C6A5C6B5C6C5C6D5C705C725C735C745C75 +5C765C775C785C7B5C7C5C7D5C7E5C805C835C845C855C865C875C895C8A5C8B +5C8E5C8F5C925C935C955C9D5C9E5C9F5CA05CA15CA45CA55CA65CA75CA80000 +8D +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +5CAA5CAE5CAF5CB05CB25CB45CB65CB95CBA5CBB5CBC5CBE5CC05CC25CC35CC5 +5CC65CC75CC85CC95CCA5CCC5CCD5CCE5CCF5CD05CD15CD35CD45CD55CD65CD7 +5CD85CDA5CDB5CDC5CDD5CDE5CDF5CE05CE25CE35CE75CE95CEB5CEC5CEE5CEF +5CF15CF25CF35CF45CF55CF65CF75CF85CF95CFA5CFC5CFD5CFE5CFF5D000000 +5D015D045D055D085D095D0A5D0B5D0C5D0D5D0F5D105D115D125D135D155D17 +5D185D195D1A5D1C5D1D5D1F5D205D215D225D235D255D285D2A5D2B5D2C5D2F +5D305D315D325D335D355D365D375D385D395D3A5D3B5D3C5D3F5D405D415D42 +5D435D445D455D465D485D495D4D5D4E5D4F5D505D515D525D535D545D555D56 +5D575D595D5A5D5C5D5E5D5F5D605D615D625D635D645D655D665D675D685D6A +5D6D5D6E5D705D715D725D735D755D765D775D785D795D7A5D7B5D7C5D7D5D7E +5D7F5D805D815D835D845D855D865D875D885D895D8A5D8B5D8C5D8D5D8E5D8F +5D905D915D925D935D945D955D965D975D985D9A5D9B5D9C5D9E5D9F5DA00000 +8E +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +5DA15DA25DA35DA45DA55DA65DA75DA85DA95DAA5DAB5DAC5DAD5DAE5DAF5DB0 +5DB15DB25DB35DB45DB55DB65DB85DB95DBA5DBB5DBC5DBD5DBE5DBF5DC05DC1 +5DC25DC35DC45DC65DC75DC85DC95DCA5DCB5DCC5DCE5DCF5DD05DD15DD25DD3 +5DD45DD55DD65DD75DD85DD95DDA5DDC5DDF5DE05DE35DE45DEA5DEC5DED0000 +5DF05DF55DF65DF85DF95DFA5DFB5DFC5DFF5E005E045E075E095E0A5E0B5E0D +5E0E5E125E135E175E1E5E1F5E205E215E225E235E245E255E285E295E2A5E2B +5E2C5E2F5E305E325E335E345E355E365E395E3A5E3E5E3F5E405E415E435E46 +5E475E485E495E4A5E4B5E4D5E4E5E4F5E505E515E525E535E565E575E585E59 +5E5A5E5C5E5D5E5F5E605E635E645E655E665E675E685E695E6A5E6B5E6C5E6D +5E6E5E6F5E705E715E755E775E795E7E5E815E825E835E855E885E895E8C5E8D +5E8E5E925E985E9B5E9D5EA15EA25EA35EA45EA85EA95EAA5EAB5EAC5EAE5EAF +5EB05EB15EB25EB45EBA5EBB5EBC5EBD5EBF5EC05EC15EC25EC35EC45EC50000 +8F +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +5EC65EC75EC85ECB5ECC5ECD5ECE5ECF5ED05ED45ED55ED75ED85ED95EDA5EDC +5EDD5EDE5EDF5EE05EE15EE25EE35EE45EE55EE65EE75EE95EEB5EEC5EED5EEE +5EEF5EF05EF15EF25EF35EF55EF85EF95EFB5EFC5EFD5F055F065F075F095F0C +5F0D5F0E5F105F125F145F165F195F1A5F1C5F1D5F1E5F215F225F235F240000 +5F285F2B5F2C5F2E5F305F325F335F345F355F365F375F385F3B5F3D5F3E5F3F +5F415F425F435F445F455F465F475F485F495F4A5F4B5F4C5F4D5F4E5F4F5F51 +5F545F595F5A5F5B5F5C5F5E5F5F5F605F635F655F675F685F6B5F6E5F6F5F72 +5F745F755F765F785F7A5F7D5F7E5F7F5F835F865F8D5F8E5F8F5F915F935F94 +5F965F9A5F9B5F9D5F9E5F9F5FA05FA25FA35FA45FA55FA65FA75FA95FAB5FAC +5FAF5FB05FB15FB25FB35FB45FB65FB85FB95FBA5FBB5FBE5FBF5FC05FC15FC2 +5FC75FC85FCA5FCB5FCE5FD35FD45FD55FDA5FDB5FDC5FDE5FDF5FE25FE35FE5 +5FE65FE85FE95FEC5FEF5FF05FF25FF35FF45FF65FF75FF95FFA5FFC60070000 +90 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +60086009600B600C60106011601360176018601A601E601F602260236024602C +602D602E603060316032603360346036603760386039603A603D603E60406044 +60456046604760486049604A604C604E604F605160536054605660576058605B +605C605E605F6060606160656066606E60716072607460756077607E60800000 +608160826085608660876088608A608B608E608F609060916093609560976098 +6099609C609E60A160A260A460A560A760A960AA60AE60B060B360B560B660B7 +60B960BA60BD60BE60BF60C060C160C260C360C460C760C860C960CC60CD60CE +60CF60D060D260D360D460D660D760D960DB60DE60E160E260E360E460E560EA +60F160F260F560F760F860FB60FC60FD60FE60FF61026103610461056107610A +610B610C611061116112611361146116611761186119611B611C611D611E6121 +6122612561286129612A612C612D612E612F6130613161326133613461356136 +613761386139613A613B613C613D613E61406141614261436144614561460000 +91 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +61476149614B614D614F61506152615361546156615761586159615A615B615C +615E615F6160616161636164616561666169616A616B616C616D616E616F6171 +617261736174617661786179617A617B617C617D617E617F6180618161826183 +618461856186618761886189618A618C618D618F619061916192619361950000 +6196619761986199619A619B619C619E619F61A061A161A261A361A461A561A6 +61AA61AB61AD61AE61AF61B061B161B261B361B461B561B661B861B961BA61BB +61BC61BD61BF61C061C161C361C461C561C661C761C961CC61CD61CE61CF61D0 +61D361D561D661D761D861D961DA61DB61DC61DD61DE61DF61E061E161E261E3 +61E461E561E761E861E961EA61EB61EC61ED61EE61EF61F061F161F261F361F4 +61F661F761F861F961FA61FB61FC61FD61FE6200620162026203620462056207 +6209621362146219621C621D621E622062236226622762286229622B622D622F +6230623162326235623662386239623A623B623C6242624462456246624A0000 +92 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +624F62506255625662576259625A625C625D625E625F62606261626262646265 +6268627162726274627562776278627A627B627D628162826283628562866287 +6288628B628C628D628E628F629062946299629C629D629E62A362A662A762A9 +62AA62AD62AE62AF62B062B262B362B462B662B762B862BA62BE62C062C10000 +62C362CB62CF62D162D562DD62DE62E062E162E462EA62EB62F062F262F562F8 +62F962FA62FB63006303630463056306630A630B630C630D630F631063126313 +63146315631763186319631C632663276329632C632D632E6330633163336334 +6335633663376338633B633C633E633F63406341634463476348634A63516352 +635363546356635763586359635A635B635C635D63606364636563666368636A +636B636C636F6370637263736374637563786379637C637D637E637F63816383 +638463856386638B638D639163936394639563976399639A639B639C639D639E +639F63A163A463A663AB63AF63B163B263B563B663B963BB63BD63BF63C00000 +93 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +63C163C263C363C563C763C863CA63CB63CC63D163D363D463D563D763D863D9 +63DA63DB63DC63DD63DF63E263E463E563E663E763E863EB63EC63EE63EF63F0 +63F163F363F563F763F963FA63FB63FC63FE640364046406640764086409640A +640D640E6411641264156416641764186419641A641D641F6422642364240000 +6425642764286429642B642E642F643064316432643364356436643764386439 +643B643C643E6440644264436449644B644C644D644E644F6450645164536455 +645664576459645A645B645C645D645F64606461646264636464646564666468 +646A646B646C646E646F64706471647264736474647564766477647B647C647D +647E647F648064816483648664886489648A648B648C648D648E648F64906493 +649464976498649A649B649C649D649F64A064A164A264A364A564A664A764A8 +64AA64AB64AF64B164B264B364B464B664B964BB64BD64BE64BF64C164C364C4 +64C664C764C864C964CA64CB64CC64CF64D164D364D464D564D664D964DA0000 +94 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +64DB64DC64DD64DF64E064E164E364E564E764E864E964EA64EB64EC64ED64EE +64EF64F064F164F264F364F464F564F664F764F864F964FA64FB64FC64FD64FE +64FF65016502650365046505650665076508650A650B650C650D650E650F6510 +6511651365146515651665176519651A651B651C651D651E651F652065210000 +6522652365246526652765286529652A652C652D65306531653265336537653A +653C653D6540654165426543654465466547654A654B654D654E655065526553 +655465576558655A655C655F6560656165646565656765686569656A656D656E +656F657165736575657665786579657A657B657C657D657E657F658065816582 +658365846585658665886589658A658D658E658F65926594659565966598659A +659D659E65A065A265A365A665A865AA65AC65AE65B165B265B365B465B565B6 +65B765B865BA65BB65BE65BF65C065C265C765C865C965CA65CD65D065D165D3 +65D465D565D865D965DA65DB65DC65DD65DE65DF65E165E365E465EA65EB0000 +95 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +65F265F365F465F565F865F965FB65FC65FD65FE65FF66016604660566076608 +6609660B660D661066116612661666176618661A661B661C661E662166226623 +662466266629662A662B662C662E663066326633663766386639663A663B663D +663F66406642664466456646664766486649664A664D664E6650665166580000 +6659665B665C665D665E666066626663666566676669666A666B666C666D6671 +66726673667566786679667B667C667D667F6680668166836685668666886689 +668A668B668D668E668F6690669266936694669566986699669A669B669C669E +669F66A066A166A266A366A466A566A666A966AA66AB66AC66AD66AF66B066B1 +66B266B366B566B666B766B866BA66BB66BC66BD66BF66C066C166C266C366C4 +66C566C666C766C866C966CA66CB66CC66CD66CE66CF66D066D166D266D366D4 +66D566D666D766D866DA66DE66DF66E066E166E266E366E466E566E766E866EA +66EB66EC66ED66EE66EF66F166F566F666F866FA66FB66FD6701670267030000 +96 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +6704670567066707670C670E670F671167126713671667186719671A671C671E +67206721672267236724672567276729672E6730673267336736673767386739 +673B673C673E673F6741674467456747674A674B674D67526754675567576758 +6759675A675B675D67626763676467666767676B676C676E6771677467760000 +67786779677A677B677D678067826783678567866788678A678C678D678E678F +679167926793679467966799679B679F67A067A167A467A667A967AC67AE67B1 +67B267B467B967BA67BB67BC67BD67BE67BF67C067C267C567C667C767C867C9 +67CA67CB67CC67CD67CE67D567D667D767DB67DF67E167E367E467E667E767E8 +67EA67EB67ED67EE67F267F567F667F767F867F967FA67FB67FC67FE68016802 +680368046806680D681068126814681568186819681A681B681C681E681F6820 +6822682368246825682668276828682B682C682D682E682F6830683168346835 +6836683A683B683F6847684B684D684F68526856685768586859685A685B0000 +97 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +685C685D685E685F686A686C686D686E686F6870687168726873687568786879 +687A687B687C687D687E687F688068826884688768886889688A688B688C688D +688E68906891689268946895689668986899689A689B689C689D689E689F68A0 +68A168A368A468A568A968AA68AB68AC68AE68B168B268B468B668B768B80000 +68B968BA68BB68BC68BD68BE68BF68C168C368C468C568C668C768C868CA68CC +68CE68CF68D068D168D368D468D668D768D968DB68DC68DD68DE68DF68E168E2 +68E468E568E668E768E868E968EA68EB68EC68ED68EF68F268F368F468F668F7 +68F868FB68FD68FE68FF69006902690369046906690769086909690A690C690F +69116913691469156916691769186919691A691B691C691D691E692169226923 +69256926692769286929692A692B692C692E692F693169326933693569366937 +6938693A693B693C693E694069416943694469456946694769486949694A694B +694C694D694E694F69506951695269536955695669586959695B695C695F0000 +98 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +6961696269646965696769686969696A696C696D696F69706972697369746975 +6976697A697B697D697E697F698169836985698A698B698C698E698F69906991 +69926993699669976999699A699D699E699F69A069A169A269A369A469A569A6 +69A969AA69AC69AE69AF69B069B269B369B569B669B869B969BA69BC69BD0000 +69BE69BF69C069C269C369C469C569C669C769C869C969CB69CD69CF69D169D2 +69D369D569D669D769D869D969DA69DC69DD69DE69E169E269E369E469E569E6 +69E769E869E969EA69EB69EC69EE69EF69F069F169F369F469F569F669F769F8 +69F969FA69FB69FC69FE6A006A016A026A036A046A056A066A076A086A096A0B +6A0C6A0D6A0E6A0F6A106A116A126A136A146A156A166A196A1A6A1B6A1C6A1D +6A1E6A206A226A236A246A256A266A276A296A2B6A2C6A2D6A2E6A306A326A33 +6A346A366A376A386A396A3A6A3B6A3C6A3F6A406A416A426A436A456A466A48 +6A496A4A6A4B6A4C6A4D6A4E6A4F6A516A526A536A546A556A566A576A5A0000 +99 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +6A5C6A5D6A5E6A5F6A606A626A636A646A666A676A686A696A6A6A6B6A6C6A6D +6A6E6A6F6A706A726A736A746A756A766A776A786A7A6A7B6A7D6A7E6A7F6A81 +6A826A836A856A866A876A886A896A8A6A8B6A8C6A8D6A8F6A926A936A946A95 +6A966A986A996A9A6A9B6A9C6A9D6A9E6A9F6AA16AA26AA36AA46AA56AA60000 +6AA76AA86AAA6AAD6AAE6AAF6AB06AB16AB26AB36AB46AB56AB66AB76AB86AB9 +6ABA6ABB6ABC6ABD6ABE6ABF6AC06AC16AC26AC36AC46AC56AC66AC76AC86AC9 +6ACA6ACB6ACC6ACD6ACE6ACF6AD06AD16AD26AD36AD46AD56AD66AD76AD86AD9 +6ADA6ADB6ADC6ADD6ADE6ADF6AE06AE16AE26AE36AE46AE56AE66AE76AE86AE9 +6AEA6AEB6AEC6AED6AEE6AEF6AF06AF16AF26AF36AF46AF56AF66AF76AF86AF9 +6AFA6AFB6AFC6AFD6AFE6AFF6B006B016B026B036B046B056B066B076B086B09 +6B0A6B0B6B0C6B0D6B0E6B0F6B106B116B126B136B146B156B166B176B186B19 +6B1A6B1B6B1C6B1D6B1E6B1F6B256B266B286B296B2A6B2B6B2C6B2D6B2E0000 +9A +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +6B2F6B306B316B336B346B356B366B386B3B6B3C6B3D6B3F6B406B416B426B44 +6B456B486B4A6B4B6B4D6B4E6B4F6B506B516B526B536B546B556B566B576B58 +6B5A6B5B6B5C6B5D6B5E6B5F6B606B616B686B696B6B6B6C6B6D6B6E6B6F6B70 +6B716B726B736B746B756B766B776B786B7A6B7D6B7E6B7F6B806B856B880000 +6B8C6B8E6B8F6B906B916B946B956B976B986B996B9C6B9D6B9E6B9F6BA06BA2 +6BA36BA46BA56BA66BA76BA86BA96BAB6BAC6BAD6BAE6BAF6BB06BB16BB26BB6 +6BB86BB96BBA6BBB6BBC6BBD6BBE6BC06BC36BC46BC66BC76BC86BC96BCA6BCC +6BCE6BD06BD16BD86BDA6BDC6BDD6BDE6BDF6BE06BE26BE36BE46BE56BE66BE7 +6BE86BE96BEC6BED6BEE6BF06BF16BF26BF46BF66BF76BF86BFA6BFB6BFC6BFE +6BFF6C006C016C026C036C046C086C096C0A6C0B6C0C6C0E6C126C176C1C6C1D +6C1E6C206C236C256C2B6C2C6C2D6C316C336C366C376C396C3A6C3B6C3C6C3E +6C3F6C436C446C456C486C4B6C4C6C4D6C4E6C4F6C516C526C536C566C580000 +9B +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +6C596C5A6C626C636C656C666C676C6B6C6C6C6D6C6E6C6F6C716C736C756C77 +6C786C7A6C7B6C7C6C7F6C806C846C876C8A6C8B6C8D6C8E6C916C926C956C96 +6C976C986C9A6C9C6C9D6C9E6CA06CA26CA86CAC6CAF6CB06CB46CB56CB66CB7 +6CBA6CC06CC16CC26CC36CC66CC76CC86CCB6CCD6CCE6CCF6CD16CD26CD80000 +6CD96CDA6CDC6CDD6CDF6CE46CE66CE76CE96CEC6CED6CF26CF46CF96CFF6D00 +6D026D036D056D066D086D096D0A6D0D6D0F6D106D116D136D146D156D166D18 +6D1C6D1D6D1F6D206D216D226D236D246D266D286D296D2C6D2D6D2F6D306D34 +6D366D376D386D3A6D3F6D406D426D446D496D4C6D506D556D566D576D586D5B +6D5D6D5F6D616D626D646D656D676D686D6B6D6C6D6D6D706D716D726D736D75 +6D766D796D7A6D7B6D7D6D7E6D7F6D806D816D836D846D866D876D8A6D8B6D8D +6D8F6D906D926D966D976D986D996D9A6D9C6DA26DA56DAC6DAD6DB06DB16DB3 +6DB46DB66DB76DB96DBA6DBB6DBC6DBD6DBE6DC16DC26DC36DC86DC96DCA0000 +9C +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +6DCD6DCE6DCF6DD06DD26DD36DD46DD56DD76DDA6DDB6DDC6DDF6DE26DE36DE5 +6DE76DE86DE96DEA6DED6DEF6DF06DF26DF46DF56DF66DF86DFA6DFD6DFE6DFF +6E006E016E026E036E046E066E076E086E096E0B6E0F6E126E136E156E186E19 +6E1B6E1C6E1E6E1F6E226E266E276E286E2A6E2C6E2E6E306E316E336E350000 +6E366E376E396E3B6E3C6E3D6E3E6E3F6E406E416E426E456E466E476E486E49 +6E4A6E4B6E4C6E4F6E506E516E526E556E576E596E5A6E5C6E5D6E5E6E606E61 +6E626E636E646E656E666E676E686E696E6A6E6C6E6D6E6F6E706E716E726E73 +6E746E756E766E776E786E796E7A6E7B6E7C6E7D6E806E816E826E846E876E88 +6E8A6E8B6E8C6E8D6E8E6E916E926E936E946E956E966E976E996E9A6E9B6E9D +6E9E6EA06EA16EA36EA46EA66EA86EA96EAB6EAC6EAD6EAE6EB06EB36EB56EB8 +6EB96EBC6EBE6EBF6EC06EC36EC46EC56EC66EC86EC96ECA6ECC6ECD6ECE6ED0 +6ED26ED66ED86ED96EDB6EDC6EDD6EE36EE76EEA6EEB6EEC6EED6EEE6EEF0000 +9D +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +6EF06EF16EF26EF36EF56EF66EF76EF86EFA6EFB6EFC6EFD6EFE6EFF6F006F01 +6F036F046F056F076F086F0A6F0B6F0C6F0D6F0E6F106F116F126F166F176F18 +6F196F1A6F1B6F1C6F1D6F1E6F1F6F216F226F236F256F266F276F286F2C6F2E +6F306F326F346F356F376F386F396F3A6F3B6F3C6F3D6F3F6F406F416F420000 +6F436F446F456F486F496F4A6F4C6F4E6F4F6F506F516F526F536F546F556F56 +6F576F596F5A6F5B6F5D6F5F6F606F616F636F646F656F676F686F696F6A6F6B +6F6C6F6F6F706F716F736F756F766F776F796F7B6F7D6F7E6F7F6F806F816F82 +6F836F856F866F876F8A6F8B6F8F6F906F916F926F936F946F956F966F976F98 +6F996F9A6F9B6F9D6F9E6F9F6FA06FA26FA36FA46FA56FA66FA86FA96FAA6FAB +6FAC6FAD6FAE6FAF6FB06FB16FB26FB46FB56FB76FB86FBA6FBB6FBC6FBD6FBE +6FBF6FC16FC36FC46FC56FC66FC76FC86FCA6FCB6FCC6FCD6FCE6FCF6FD06FD3 +6FD46FD56FD66FD76FD86FD96FDA6FDB6FDC6FDD6FDF6FE26FE36FE46FE50000 +9E +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +6FE66FE76FE86FE96FEA6FEB6FEC6FED6FF06FF16FF26FF36FF46FF56FF66FF7 +6FF86FF96FFA6FFB6FFC6FFD6FFE6FFF70007001700270037004700570067007 +70087009700A700B700C700D700E700F70107012701370147015701670177018 +7019701C701D701E701F702070217022702470257026702770287029702A0000 +702B702C702D702E702F70307031703270337034703670377038703A703B703C +703D703E703F7040704170427043704470457046704770487049704A704B704D +704E7050705170527053705470557056705770587059705A705B705C705D705F +7060706170627063706470657066706770687069706A706E7071707270737074 +70777079707A707B707D7081708270837084708670877088708B708C708D708F +70907091709370977098709A709B709E709F70A070A170A270A370A470A570A6 +70A770A870A970AA70B070B270B470B570B670BA70BE70BF70C470C570C670C7 +70C970CB70CC70CD70CE70CF70D070D170D270D370D470D570D670D770DA0000 +9F +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +70DC70DD70DE70E070E170E270E370E570EA70EE70F070F170F270F370F470F5 +70F670F870FA70FB70FC70FE70FF710071017102710371047105710671077108 +710B710C710D710E710F7111711271147117711B711C711D711E711F71207121 +7122712371247125712771287129712A712B712C712D712E7132713371340000 +7135713771387139713A713B713C713D713E713F714071417142714371447146 +714771487149714B714D714F7150715171527153715471557156715771587159 +715A715B715D715F716071617162716371657169716A716B716C716D716F7170 +717171747175717671777179717B717C717E717F718071817182718371857186 +718771887189718B718C718D718E7190719171927193719571967197719A719B +719C719D719E71A171A271A371A471A571A671A771A971AA71AB71AD71AE71AF +71B071B171B271B471B671B771B871BA71BB71BC71BD71BE71BF71C071C171C2 +71C471C571C671C771C871C971CA71CB71CC71CD71CF71D071D171D271D30000 +A0 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +71D671D771D871D971DA71DB71DC71DD71DE71DF71E171E271E371E471E671E8 +71E971EA71EB71EC71ED71EF71F071F171F271F371F471F571F671F771F871FA +71FB71FC71FD71FE71FF720072017202720372047205720772087209720A720B +720C720D720E720F7210721172127213721472157216721772187219721A0000 +721B721C721E721F722072217222722372247225722672277229722B722D722E +722F723272337234723A723C723E72407241724272437244724572467249724A +724B724E724F7250725172537254725572577258725A725C725E726072637264 +72657268726A726B726C726D7270727172737274727672777278727B727C727D +7282728372857286728772887289728C728E7290729172937294729572967297 +72987299729A729B729C729D729E72A072A172A272A372A472A572A672A772A8 +72A972AA72AB72AE72B172B272B372B572BA72BB72BC72BD72BE72BF72C072C5 +72C672C772C972CA72CB72CC72CF72D172D372D472D572D672D872DA72DB0000 +A1 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000030003001300200B702C902C700A8300330052014FF5E2016202620182019 +201C201D3014301530083009300A300B300C300D300E300F3016301730103011 +00B100D700F72236222722282211220F222A222922082237221A22A522252220 +23122299222B222E2261224C2248223D221D2260226E226F22642265221E2235 +22342642264000B0203220332103FF0400A4FFE0FFE1203000A7211626062605 +25CB25CF25CE25C725C625A125A025B325B2203B219221902191219330130000 +A2 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000217021712172217321742175217621772178217900000000000000000000 +000024882489248A248B248C248D248E248F2490249124922493249424952496 +249724982499249A249B247424752476247724782479247A247B247C247D247E +247F248024812482248324842485248624872460246124622463246424652466 +2467246824690000000032203221322232233224322532263227322832290000 +00002160216121622163216421652166216721682169216A216B000000000000 +A3 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000FF01FF02FF03FFE5FF05FF06FF07FF08FF09FF0AFF0BFF0CFF0DFF0EFF0F +FF10FF11FF12FF13FF14FF15FF16FF17FF18FF19FF1AFF1BFF1CFF1DFF1EFF1F +FF20FF21FF22FF23FF24FF25FF26FF27FF28FF29FF2AFF2BFF2CFF2DFF2EFF2F +FF30FF31FF32FF33FF34FF35FF36FF37FF38FF39FF3AFF3BFF3CFF3DFF3EFF3F +FF40FF41FF42FF43FF44FF45FF46FF47FF48FF49FF4AFF4BFF4CFF4DFF4EFF4F +FF50FF51FF52FF53FF54FF55FF56FF57FF58FF59FF5AFF5BFF5CFF5DFFE30000 +A4 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000304130423043304430453046304730483049304A304B304C304D304E304F +3050305130523053305430553056305730583059305A305B305C305D305E305F +3060306130623063306430653066306730683069306A306B306C306D306E306F +3070307130723073307430753076307730783079307A307B307C307D307E307F +3080308130823083308430853086308730883089308A308B308C308D308E308F +3090309130923093000000000000000000000000000000000000000000000000 +A5 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000030A130A230A330A430A530A630A730A830A930AA30AB30AC30AD30AE30AF +30B030B130B230B330B430B530B630B730B830B930BA30BB30BC30BD30BE30BF +30C030C130C230C330C430C530C630C730C830C930CA30CB30CC30CD30CE30CF +30D030D130D230D330D430D530D630D730D830D930DA30DB30DC30DD30DE30DF +30E030E130E230E330E430E530E630E730E830E930EA30EB30EC30ED30EE30EF +30F030F130F230F330F430F530F6000000000000000000000000000000000000 +A6 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000039103920393039403950396039703980399039A039B039C039D039E039F +03A003A103A303A403A503A603A703A803A90000000000000000000000000000 +000003B103B203B303B403B503B603B703B803B903BA03BB03BC03BD03BE03BF +03C003C103C303C403C503C603C703C803C90000000000000000000000000000 +FE35FE36FE39FE3AFE3FFE40FE3DFE3EFE41FE42FE43FE4400000000FE3BFE3C +FE37FE38FE310000FE33FE340000000000000000000000000000000000000000 +A7 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000004100411041204130414041504010416041704180419041A041B041C041D +041E041F0420042104220423042404250426042704280429042A042B042C042D +042E042F00000000000000000000000000000000000000000000000000000000 +000004300431043204330434043504510436043704380439043A043B043C043D +043E043F0440044104420443044404450446044704480449044A044B044C044D +044E044F00000000000000000000000000000000000000000000000000000000 +A8 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +02CA02CB02D920132015202520352105210921962197219821992215221F2223 +22522266226722BF2550255125522553255425552556255725582559255A255B +255C255D255E255F2560256125622563256425652566256725682569256A256B +256C256D256E256F257025712572257325812582258325842585258625870000 +25882589258A258B258C258D258E258F25932594259525BC25BD25E225E325E4 +25E5260922953012301D301E0000000000000000000000000000000000000000 +0000010100E101CE00E0011300E9011B00E8012B00ED01D000EC014D00F301D2 +00F2016B00FA01D400F901D601D801DA01DC00FC00EA02510000014401480000 +0261000000000000000031053106310731083109310A310B310C310D310E310F +3110311131123113311431153116311731183119311A311B311C311D311E311F +3120312131223123312431253126312731283129000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +A9 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +30213022302330243025302630273028302932A3338E338F339C339D339E33A1 +33C433CE33D133D233D5FE30FFE2FFE400002121323100002010000000000000 +30FC309B309C30FD30FE3006309D309EFE49FE4AFE4BFE4CFE4DFE4EFE4FFE50 +FE51FE52FE54FE55FE56FE57FE59FE5AFE5BFE5CFE5DFE5EFE5FFE60FE610000 +FE62FE63FE64FE65FE66FE68FE69FE6AFE6B0000000000000000000000000000 +0000000000000000000000003007000000000000000000000000000000000000 +00000000000000002500250125022503250425052506250725082509250A250B +250C250D250E250F2510251125122513251425152516251725182519251A251B +251C251D251E251F2520252125222523252425252526252725282529252A252B +252C252D252E252F2530253125322533253425352536253725382539253A253B +253C253D253E253F2540254125422543254425452546254725482549254A254B +0000000000000000000000000000000000000000000000000000000000000000 +AA +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +72DC72DD72DF72E272E372E472E572E672E772EA72EB72F572F672F972FD72FE +72FF73007302730473057306730773087309730B730C730D730F731073117312 +731473187319731A731F732073237324732673277328732D732F733073327333 +73357336733A733B733C733D7340734173427343734473457346734773480000 +7349734A734B734C734E734F7351735373547355735673587359735A735B735C +735D735E735F736173627363736473657366736773687369736A736B736E7370 +7371000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +AB +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +73727373737473757376737773787379737A737B737C737D737F738073817382 +7383738573867388738A738C738D738F73907392739373947395739773987399 +739A739C739D739E73A073A173A373A473A573A673A773A873AA73AC73AD73B1 +73B473B573B673B873B973BC73BD73BE73BF73C173C373C473C573C673C70000 +73CB73CC73CE73D273D373D473D573D673D773D873DA73DB73DC73DD73DF73E1 +73E273E373E473E673E873EA73EB73EC73EE73EF73F073F173F373F473F573F6 +73F7000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +AC +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +73F873F973FA73FB73FC73FD73FE73FF740074017402740474077408740B740C +740D740E741174127413741474157416741774187419741C741D741E741F7420 +74217423742474277429742B742D742F74317432743774387439743A743B743D +743E743F744074427443744474457446744774487449744A744B744C744D0000 +744E744F7450745174527453745474567458745D746074617462746374647465 +7466746774687469746A746B746C746E746F7471747274737474747574787479 +747A000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +AD +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +747B747C747D747F748274847485748674887489748A748C748D748F74917492 +7493749474957496749774987499749A749B749D749F74A074A174A274A374A4 +74A574A674AA74AB74AC74AD74AE74AF74B074B174B274B374B474B574B674B7 +74B874B974BB74BC74BD74BE74BF74C074C174C274C374C474C574C674C70000 +74C874C974CA74CB74CC74CD74CE74CF74D074D174D374D474D574D674D774D8 +74D974DA74DB74DD74DF74E174E574E774E874E974EA74EB74EC74ED74F074F1 +74F2000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +AE +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +74F374F574F874F974FA74FB74FC74FD74FE7500750175027503750575067507 +75087509750A750B750C750E751075127514751575167517751B751D751E7520 +752175227523752475267527752A752E753475367539753C753D753F75417542 +75437544754675477549754A754D755075517552755375557556755775580000 +755D755E755F75607561756275637564756775687569756B756C756D756E756F +757075717573757575767577757A757B757C757D757E75807581758275847585 +7587000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +AF +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +75887589758A758C758D758E7590759375957598759B759C759E75A275A675A7 +75A875A975AA75AD75B675B775BA75BB75BF75C075C175C675CB75CC75CE75CF +75D075D175D375D775D975DA75DC75DD75DF75E075E175E575E975EC75ED75EE +75EF75F275F375F575F675F775F875FA75FB75FD75FE76027604760676070000 +76087609760B760D760E760F76117612761376147616761A761C761D761E7621 +762376277628762C762E762F76317632763676377639763A763B763D76417642 +7644000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +B0 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +76457646764776487649764A764B764E764F7650765176527653765576577658 +7659765A765B765D765F766076617662766476657666766776687669766A766C +766D766E767076717672767376747675767676777679767A767C767F76807681 +768376857689768A768C768D768F769076927694769576977698769A769B0000 +769C769D769E769F76A076A176A276A376A576A676A776A876A976AA76AB76AC +76AD76AF76B076B376B576B676B776B876B976BA76BB76BC76BD76BE76C076C1 +76C3554A963F57C3632854CE550954C07691764C853C77EE827E788D72319698 +978D6C285B894FFA630966975CB880FA684880AE660276CE51F9655671AC7FF1 +888450B2596561CA6FB382AD634C625253ED54277B06516B75A45DF462D48DCB +9776628A8019575D97387F627238767D67CF767E64464F708D2562DC7A176591 +73ED642C6273822C9881677F7248626E62CC4F3474E3534A529E7ECA90A65E2E +6886699C81807ED168D278C5868C9551508D8C2482DE80DE5305891252650000 +B1 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +76C476C776C976CB76CC76D376D576D976DA76DC76DD76DE76E076E176E276E3 +76E476E676E776E876E976EA76EB76EC76ED76F076F376F576F676F776FA76FB +76FD76FF77007702770377057706770A770C770E770F77107711771277137714 +7715771677177718771B771C771D771E77217723772477257727772A772B0000 +772C772E773077317732773377347739773B773D773E773F7742774477457746 +77487749774A774B774C774D774E774F77527753775477557756775777587759 +775C858496F94FDD582199715B9D62B162A566B48C799C8D7206676F789160B2 +535153178F8880CC8D1D94A1500D72C8590760EB711988AB595482EF672C7B28 +5D297EF7752D6CF58E668FF8903C9F3B6BD491197B145F7C78A784D6853D6BD5 +6BD96BD65E015E8775F995ED655D5F0A5FC58F9F58C181C2907F965B97AD8FB9 +7F168D2C62414FBF53D8535E8FA88FA98FAB904D68075F6A819888689CD6618B +522B762A5F6C658C6FD26EE85BBE6448517551B067C44E1979C9997C70B30000 +B2 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +775D775E775F7760776477677769776A776D776E776F77707771777277737774 +7775777677777778777A777B777C7781778277837786778777887789778A778B +778F77907793779477957796779777987799779A779B779C779D779E77A177A3 +77A477A677A877AB77AD77AE77AF77B177B277B477B677B777B877B977BA0000 +77BC77BE77C077C177C277C377C477C577C677C777C877C977CA77CB77CC77CE +77CF77D077D177D277D377D477D577D677D877D977DA77DD77DE77DF77E077E1 +77E475C55E7673BB83E064AD62E894B56CE2535A52C3640F94C27B944F2F5E1B +82368116818A6E246CCA9A736355535C54FA886557E04E0D5E036B657C3F90E8 +601664E6731C88C16750624D8D22776C8E2991C75F6983DC8521991053C28695 +6B8B60ED60E8707F82CD82314ED36CA785CF64CD7CD969FD66F9834953957B56 +4FA7518C6D4B5C428E6D63D253C9832C833667E578B4643D5BDF5C945DEE8BE7 +62C667F48C7A640063BA8749998B8C177F2094F24EA7961098A4660C73160000 +B3 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +77E677E877EA77EF77F077F177F277F477F577F777F977FA77FB77FC78037804 +7805780678077808780A780B780E780F7810781378157819781B781E78207821 +782278247828782A782B782E782F78317832783378357836783D783F78417842 +78437844784678487849784A784B784D784F78517853785478587859785A0000 +785B785C785E785F7860786178627863786478657866786778687869786F7870 +78717872787378747875787678787879787A787B787D787E787F788078817882 +7883573A5C1D5E38957F507F80A05382655E7545553150218D856284949E671D +56326F6E5DE2543570928F66626F64A463A35F7B6F8890F481E38FB05C186668 +5FF16C8996488D81886C649179F057CE6A59621054484E587A0B60E96F848BDA +627F901E9A8B79E4540375F4630153196C608FDF5F1B9A70803B9F7F4F885C3A +8D647FC565A570BD514551B2866B5D075BA062BD916C75748E0C7A2061017B79 +4EC77EF877854E1181ED521D51FA6A7153A88E87950496CF6EC19664695A0000 +B4 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +7884788578867888788A788B788F789078927894789578967899789D789E78A0 +78A278A478A678A878A978AA78AB78AC78AD78AE78AF78B578B678B778B878BA +78BB78BC78BD78BF78C078C278C378C478C678C778C878CC78CD78CE78CF78D1 +78D278D378D678D778D878DA78DB78DC78DD78DE78DF78E078E178E278E30000 +78E478E578E678E778E978EA78EB78ED78EE78EF78F078F178F378F578F678F8 +78F978FB78FC78FD78FE78FF79007902790379047906790779087909790A790B +790C784050A877D7641089E6590463E35DDD7A7F693D4F20823955984E3275AE +7A975E625E8A95EF521B5439708A6376952457826625693F918755076DF37EAF +882262337EF075B5832878C196CC8F9E614874F78BCD6B64523A8D506B21806A +847156F153064ECE4E1B51D17C97918B7C074FC38E7F7BE17A9C64675D1450AC +810676017CB96DEC7FE067515B585BF878CB64AE641363AA632B9519642D8FBE +7B5476296253592754466B7950A362345E266B864EE38D37888B5F85902E0000 +B5 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +790D790E790F791079117912791479157916791779187919791A791B791C791D +791F792079217922792379257926792779287929792A792B792C792D792E792F +793079317932793379357936793779387939793D793F79427943794479457947 +794A794B794C794D794E794F7950795179527954795579587959796179630000 +796479667969796A796B796C796E79707971797279737974797579767979797B +797C797D797E797F798279837986798779887989798B798C798D798E79907991 +79926020803D62C54E39535590F863B880C665E66C2E4F4660EE6DE18BDE5F39 +86CB5F536321515A83616863520063638E4850125C9B79775BFC52307A3B60BC +905376D75FB75F9776848E6C706F767B7B4977AA51F3909358244F4E6EF48FEA +654C7B1B72C46DA47FDF5AE162B55E95573084827B2C5E1D5F1F90127F1498A0 +63826EC7789870B95178975B57AB75354F4375385E9760E659606DC06BBF7889 +53FC96D551CB52016389540A94938C038DCC7239789F87768FED8C0D53E00000 +B6 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +7993799479957996799779987999799B799C799D799E799F79A079A179A279A3 +79A479A579A679A879A979AA79AB79AC79AD79AE79AF79B079B179B279B479B5 +79B679B779B879BC79BF79C279C479C579C779C879CA79CC79CE79CF79D079D3 +79D479D679D779D979DA79DB79DC79DD79DE79E079E179E279E579E879EA0000 +79EC79EE79F179F279F379F479F579F679F779F979FA79FC79FE79FF7A017A04 +7A057A077A087A097A0A7A0C7A0F7A107A117A127A137A157A167A187A197A1B +7A1C4E0176EF53EE948998769F0E952D5B9A8BA24E224E1C51AC846361C252A8 +680B4F97606B51BB6D1E515C6296659796618C46901775D890FD77636BD2728A +72EC8BFB583577798D4C675C9540809A5EA66E2159927AEF77ED953B6BB565AD +7F0E58065151961F5BF958A954288E726566987F56E4949D76FE9041638754C6 +591A593A579B8EB267358DFA8235524160F0581586FE5CE89E454FC4989D8BB9 +5A2560765384627C904F9102997F6069800C513F80335C1499756D314E8C0000 +B7 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +7A1D7A1F7A217A227A247A257A267A277A287A297A2A7A2B7A2C7A2D7A2E7A2F +7A307A317A327A347A357A367A387A3A7A3E7A407A417A427A437A447A457A47 +7A487A497A4A7A4B7A4C7A4D7A4E7A4F7A507A527A537A547A557A567A587A59 +7A5A7A5B7A5C7A5D7A5E7A5F7A607A617A627A637A647A657A667A677A680000 +7A697A6A7A6B7A6C7A6D7A6E7A6F7A717A727A737A757A7B7A7C7A7D7A7E7A82 +7A857A877A897A8A7A8B7A8C7A8E7A8F7A907A937A947A997A9A7A9B7A9E7AA1 +7AA28D3053D17F5A7B4F4F104E4F96006CD573D085E95E06756A7FFB6A0A77FE +94927E4151E170E653CD8FD483038D2972AF996D6CDB574A82B365B980AA623F +963259A84EFF8BBF7EBA653E83F2975E556198DE80A5532A8BFD542080BA5E9F +6CB88D3982AC915A54296C1B52067EB7575F711A6C7E7C89594B4EFD5FFF6124 +7CAA4E305C0167AB87025CF0950B98CE75AF70FD902251AF7F1D8BBD594951E4 +4F5B5426592B657780A45B75627662C28F905E456C1F7B264F0F4FD8670D0000 +B8 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +7AA37AA47AA77AA97AAA7AAB7AAE7AAF7AB07AB17AB27AB47AB57AB67AB77AB8 +7AB97ABA7ABB7ABC7ABD7ABE7AC07AC17AC27AC37AC47AC57AC67AC77AC87AC9 +7ACA7ACC7ACD7ACE7ACF7AD07AD17AD27AD37AD47AD57AD77AD87ADA7ADB7ADC +7ADD7AE17AE27AE47AE77AE87AE97AEA7AEB7AEC7AEE7AF07AF17AF27AF30000 +7AF47AF57AF67AF77AF87AFB7AFC7AFE7B007B017B027B057B077B097B0C7B0D +7B0E7B107B127B137B167B177B187B1A7B1C7B1D7B1F7B217B227B237B277B29 +7B2D6D6E6DAA798F88B15F17752B629A8F854FEF91DC65A7812F81515E9C8150 +8D74526F89868D4B590D50854ED8961C723681798D1F5BCC8BA3964459877F1A +54905676560E8BE565396982949976D66E895E727518674667D17AFF809D8D76 +611F79C665628D635188521A94A27F38809B7EB25C976E2F67607BD9768B9AD8 +818F7F947CD5641E95507A3F544A54E56B4C640162089E3D80F3759952729769 +845B683C86E49601969494EC4E2A54047ED968398DDF801566F45E9A7FB90000 +B9 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +7B2F7B307B327B347B357B367B377B397B3B7B3D7B3F7B407B417B427B437B44 +7B467B487B4A7B4D7B4E7B537B557B577B597B5C7B5E7B5F7B617B637B647B65 +7B667B677B687B697B6A7B6B7B6C7B6D7B6F7B707B737B747B767B787B7A7B7C +7B7D7B7F7B817B827B837B847B867B877B887B897B8A7B8B7B8C7B8E7B8F0000 +7B917B927B937B967B987B997B9A7B9B7B9E7B9F7BA07BA37BA47BA57BAE7BAF +7BB07BB27BB37BB57BB67BB77BB97BBA7BBB7BBC7BBD7BBE7BBF7BC07BC27BC3 +7BC457C2803F68975DE5653B529F606D9F9A4F9B8EAC516C5BAB5F135DE96C5E +62F18D21517194A952FE6C9F82DF72D757A267848D2D591F8F9C83C754957B8D +4F306CBD5B6459D19F1353E486CA9AA88C3780A16545987E56FA96C7522E74DC +52505BE1630289024E5662D0602A68FA51735B9851A089C27BA199867F5060EF +704C8D2F51495E7F901B747089C4572D78455F529F9F95FA8F689B3C8BE17678 +684267DC8DEA8D35523D8F8A6EDA68CD950590ED56FD679C88F98FC754C80000 +BA +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +7BC57BC87BC97BCA7BCB7BCD7BCE7BCF7BD07BD27BD47BD57BD67BD77BD87BDB +7BDC7BDE7BDF7BE07BE27BE37BE47BE77BE87BE97BEB7BEC7BED7BEF7BF07BF2 +7BF37BF47BF57BF67BF87BF97BFA7BFB7BFD7BFF7C007C017C027C037C047C05 +7C067C087C097C0A7C0D7C0E7C107C117C127C137C147C157C177C187C190000 +7C1A7C1B7C1C7C1D7C1E7C207C217C227C237C247C257C287C297C2B7C2C7C2D +7C2E7C2F7C307C317C327C337C347C357C367C377C397C3A7C3B7C3C7C3D7C3E +7C429AB85B696D776C264EA55BB39A87916361A890AF97E9542B6DB55BD251FD +558A7F557FF064BC634D65F161BE608D710A6C576C49592F676D822A58D5568E +8C6A6BEB90DD597D801753F76D695475559D837783CF683879BE548C4F555408 +76D28C8996026CB36DB88D6B89109E648D3A563F9ED175D55F8872E0606854FC +4EA86A2A886160528F7054C470D886799E3F6D2A5B8F5F187EA255894FAF7334 +543C539A5019540E547C4E4E5FFD745A58F6846B80E1877472D07CCA6E560000 +BB +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +7C437C447C457C467C477C487C497C4A7C4B7C4C7C4E7C4F7C507C517C527C53 +7C547C557C567C577C587C597C5A7C5B7C5C7C5D7C5E7C5F7C607C617C627C63 +7C647C657C667C677C687C697C6A7C6B7C6C7C6D7C6E7C6F7C707C717C727C75 +7C767C777C787C797C7A7C7E7C7F7C807C817C827C837C847C857C867C870000 +7C887C8A7C8B7C8C7C8D7C8E7C8F7C907C937C947C967C997C9A7C9B7CA07CA1 +7CA37CA67CA77CA87CA97CAB7CAC7CAD7CAF7CB07CB47CB57CB67CB77CB87CBA +7CBB5F27864E552C62A44E926CAA623782B154D7534E733E6ED1753B52125316 +8BDD69D05F8A60006DEE574F6B2273AF68538FD87F13636260A3552475EA8C62 +71156DA35BA65E7B8352614C9EC478FA87577C27768751F060F6714C66435E4C +604D8C0E707063258F895FBD606286D456DE6BC160946167534960E066668D3F +79FD4F1A70E96C478BB38BF27ED88364660F5A5A9B426D516DF78C416D3B4F19 +706B83B7621660D1970D8D27797851FB573E57FA673A75787A3D79EF7B950000 +BC +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +7CBF7CC07CC27CC37CC47CC67CC97CCB7CCE7CCF7CD07CD17CD27CD37CD47CD8 +7CDA7CDB7CDD7CDE7CE17CE27CE37CE47CE57CE67CE77CE97CEA7CEB7CEC7CED +7CEE7CF07CF17CF27CF37CF47CF57CF67CF77CF97CFA7CFC7CFD7CFE7CFF7D00 +7D017D027D037D047D057D067D077D087D097D0B7D0C7D0D7D0E7D0F7D100000 +7D117D127D137D147D157D167D177D187D197D1A7D1B7D1C7D1D7D1E7D1F7D21 +7D237D247D257D267D287D297D2A7D2C7D2D7D2E7D307D317D327D337D347D35 +7D36808C99658FF96FC08BA59E2159EC7EE97F095409678168D88F917C4D96C6 +53CA602575BE6C7253735AC97EA7632451E0810A5DF184DF628051805B634F0E +796D524260B86D4E5BC45BC28BA18BB065E25FCC964559937EE77EAA560967B7 +59394F735BB652A0835A988A8D3E753294BE50477A3C4EF767B69A7E5AC16B7C +76D1575A5C167B3A95F4714E517C80A9827059787F04832768C067EC78B17877 +62E363617B804FED526A51CF835069DB92748DF58D3189C1952E7BAD4EF60000 +BD +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +7D377D387D397D3A7D3B7D3C7D3D7D3E7D3F7D407D417D427D437D447D457D46 +7D477D487D497D4A7D4B7D4C7D4D7D4E7D4F7D507D517D527D537D547D557D56 +7D577D587D597D5A7D5B7D5C7D5D7D5E7D5F7D607D617D627D637D647D657D66 +7D677D687D697D6A7D6B7D6C7D6D7D6F7D707D717D727D737D747D757D760000 +7D787D797D7A7D7B7D7C7D7D7D7E7D7F7D807D817D827D837D847D857D867D87 +7D887D897D8A7D8B7D8C7D8D7D8E7D8F7D907D917D927D937D947D957D967D97 +7D98506582305251996F6E106E856DA75EFA50F559DC5C066D466C5F7586848B +686859568BB253209171964D854969127901712680F64EA490CA6D479A845A07 +56BC640594F077EB4FA5811A72E189D2997A7F347EDE527F655991758F7F8F83 +53EB7A9663ED63A5768679F888579636622A52AB8282685467706377776B7AED +6D017ED389E359D0621285C982A5754C501F4ECB75A58BEB5C4A5DFE7B4B65A4 +91D14ECA6D25895F7D2795264EC58C288FDB9773664B79818FD170EC6D780000 +BE +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +7D997D9A7D9B7D9C7D9D7D9E7D9F7DA07DA17DA27DA37DA47DA57DA77DA87DA9 +7DAA7DAB7DAC7DAD7DAF7DB07DB17DB27DB37DB47DB57DB67DB77DB87DB97DBA +7DBB7DBC7DBD7DBE7DBF7DC07DC17DC27DC37DC47DC57DC67DC77DC87DC97DCA +7DCB7DCC7DCD7DCE7DCF7DD07DD17DD27DD37DD47DD57DD67DD77DD87DD90000 +7DDA7DDB7DDC7DDD7DDE7DDF7DE07DE17DE27DE37DE47DE57DE67DE77DE87DE9 +7DEA7DEB7DEC7DED7DEE7DEF7DF07DF17DF27DF37DF47DF57DF67DF77DF87DF9 +7DFA5C3D52B283465162830E775B66769CB84EAC60CA7CBE7CB37ECF4E958B66 +666F988897595883656C955C5F8475C997567ADF7ADE51C070AF7A9863EA7A76 +7EA0739697ED4E4570784E5D915253A9655165E781FC8205548E5C31759A97A0 +62D872D975BD5C459A7983CA5C40548077E94E3E6CAE805A62D2636E5DE85177 +8DDD8E1E952F4FF153E560E770AC526763509E435A1F5026773753777EE26485 +652B628963985014723589C951B38BC07EDD574783CC94A7519B541B5CFB0000 +BF +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +7DFB7DFC7DFD7DFE7DFF7E007E017E027E037E047E057E067E077E087E097E0A +7E0B7E0C7E0D7E0E7E0F7E107E117E127E137E147E157E167E177E187E197E1A +7E1B7E1C7E1D7E1E7E1F7E207E217E227E237E247E257E267E277E287E297E2A +7E2B7E2C7E2D7E2E7E2F7E307E317E327E337E347E357E367E377E387E390000 +7E3A7E3C7E3D7E3E7E3F7E407E427E437E447E457E467E487E497E4A7E4B7E4C +7E4D7E4E7E4F7E507E517E527E537E547E557E567E577E587E597E5A7E5B7E5C +7E5D4FCA7AE36D5A90E19A8F55805496536154AF5F0063E9697751EF6168520A +582A52D8574E780D770B5EB761777CE0625B62974EA27095800362F770E49760 +577782DB67EF68F578D5989779D158F354B353EF6E34514B523B5BA28BFE80AF +554357A660735751542D7A7A60505B5463A762A053E362635BC767AF54ED7A9F +82E691775E9388E4593857AE630E8DE880EF57577B774FA95FEB5BBD6B3E5321 +7B5072C2684677FF773665F751B54E8F76D45CBF7AA58475594E9B4150800000 +C0 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +7E5E7E5F7E607E617E627E637E647E657E667E677E687E697E6A7E6B7E6C7E6D +7E6E7E6F7E707E717E727E737E747E757E767E777E787E797E7A7E7B7E7C7E7D +7E7E7E7F7E807E817E837E847E857E867E877E887E897E8A7E8B7E8C7E8D7E8E +7E8F7E907E917E927E937E947E957E967E977E987E997E9A7E9C7E9D7E9E0000 +7EAE7EB47EBB7EBC7ED67EE47EEC7EF97F0A7F107F1E7F377F397F3B7F3C7F3D +7F3E7F3F7F407F417F437F467F477F487F497F4A7F4B7F4C7F4D7F4E7F4F7F52 +7F53998861276E8357646606634656F062EC62695ED39614578362C955878721 +814A8FA3556683B167658D5684DD5A6A680F62E67BEE961151706F9C8C3063FD +89C861D27F0670C26EE57405699472FC5ECA90CE67176D6A635E52B372628001 +4F6C59E5916A70D96D9D52D24E5096F7956D857E78CA7D2F5121579264C2808B +7C7B6CEA68F1695E51B7539868A872819ECE7BF172F879BB6F137406674E91CC +9CA4793C83898354540F68174E3D538952B1783E5386522950884F8B4FD00000 +C1 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +7F567F597F5B7F5C7F5D7F5E7F607F637F647F657F667F677F6B7F6C7F6D7F6F +7F707F737F757F767F777F787F7A7F7B7F7C7F7D7F7F7F807F827F837F847F85 +7F867F877F887F897F8B7F8D7F8F7F907F917F927F937F957F967F977F987F99 +7F9B7F9C7FA07FA27FA37FA57FA67FA87FA97FAA7FAB7FAC7FAD7FAE7FB10000 +7FB37FB47FB57FB67FB77FBA7FBB7FBE7FC07FC27FC37FC47FC67FC77FC87FC9 +7FCB7FCD7FCF7FD07FD17FD27FD37FD67FD77FD97FDA7FDB7FDC7FDD7FDE7FE2 +7FE375E27ACB7C926CA596B6529B748354E94FE9805483B28FDE95705EC9601C +6D9F5E18655B813894FE604B70BC7EC37CAE51C968817CB1826F4E248F8691CF +667E4EAE8C0564A9804A50DA759771CE5BE58FBD6F664E86648295635ED66599 +521788C270C852A3730E7433679778F797164E3490BB9CDE6DCB51DB8D41541D +62CE73B283F196F69F8494C34F367F9A51CC707596755CAD988653E64EE46E9C +740969B4786B998F7559521876246D4167F3516D9F99804B54997B3C7ABF0000 +C2 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +7FE47FE77FE87FEA7FEB7FEC7FED7FEF7FF27FF47FF57FF67FF77FF87FF97FFA +7FFD7FFE7FFF8002800780088009800A800E800F80118013801A801B801D801E +801F802180238024802B802C802D802E802F8030803280348039803A803C803E +8040804180448045804780488049804E804F8050805180538055805680570000 +8059805B805C805D805E805F806080618062806380648065806680678068806B +806C806D806E806F807080728073807480758076807780788079807A807B807C +807D9686578462E29647697C5A0464027BD36F0F964B82A6536298855E907089 +63B35364864F9C819E93788C97328DEF8D429E7F6F5E79845F559646622E9A74 +541594DD4FA365C55C655C617F1586516C2F5F8B73876EE47EFF5CE6631B5B6A +6EE653754E7163A0756562A18F6E4F264ED16CA67EB68BBA841D87BA7F57903B +95237BA99AA188F8843D6D1B9A867EDC59889EBB739B780186829A6C9A82561B +541757CB4E709EA653568FC881097792999286EE6EE1851366FC61626F2B0000 +C3 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +807E8081808280858088808A808D808E808F8090809180928094809580978099 +809E80A380A680A780A880AC80B080B380B580B680B880B980BB80C580C780C8 +80C980CA80CB80CF80D080D180D280D380D480D580D880DF80E080E280E380E6 +80EE80F580F780F980FB80FE80FF8100810181038104810581078108810B0000 +810C811581178119811B811C811D811F81208121812281238124812581268127 +81288129812A812B812D812E813081338134813581378139813A813B813C813D +813F8C298292832B76F26C135FD983BD732B8305951A6BDB77DB94C6536F8302 +51925E3D8C8C8D384E4873AB679A68859176970971646CA177095A9295416BCF +7F8E66275BD059B95A9A95E895F74EEC840C84996AAC76DF9530731B68A65B5F +772F919A97617CDC8FF78C1C5F257C7379D889C56CCC871C5BC65E4268C97720 +7EF55195514D52C95A297F05976282D763CF778485D079D26E3A5E9959998511 +706D6C1162BF76BF654F60AF95FD660E879F9E2394ED540D547D8C2C64780000 +C4 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +81408141814281438144814581478149814D814E814F8152815681578158815B +815C815D815E815F816181628163816481668168816A816B816C816F81728173 +81758176817781788181818381848185818681878189818B818C818D818E8190 +8192819381948195819681978199819A819E819F81A081A181A281A481A50000 +81A781A981AB81AC81AD81AE81AF81B081B181B281B481B581B681B781B881B9 +81BC81BD81BE81BF81C481C581C781C881C981CB81CD81CE81CF81D081D181D2 +81D3647986116A21819C78E864699B5462B9672B83AB58A89ED86CAB6F205BDE +964C8C0B725F67D062C772614EA959C66BCD589366AE5E5552DF6155672876EE +776672677A4662FF54EA545094A090A35A1C7EB36C164E435976801059485357 +753796BE56CA63208111607C95F96DD65462998151855AE980FD59AE9713502A +6CE55C3C62DF4F60533F817B90066EBA852B62C85E7478BE64B5637B5FF55A18 +917F9E1F5C3F634F80425B7D556E954A954D6D8560A867E072DE51DD5B810000 +C5 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +81D481D581D681D781D881D981DA81DB81DC81DD81DE81DF81E081E181E281E4 +81E581E681E881E981EB81EE81EF81F081F181F281F581F681F781F881F981FA +81FD81FF8203820782088209820A820B820E820F821182138215821682178218 +8219821A821D822082248225822682278229822E8232823A823C823D823F0000 +8240824182428243824582468248824A824C824D824E82508251825282538254 +8255825682578259825B825C825D825E82608261826282638264826582668267 +826962E76CDE725B626D94AE7EBD81136D53519C5F04597452AA601259736696 +8650759F632A61E67CEF8BFA54E66B279E256BB485D5545550766CA4556A8DB4 +722C5E156015743662CD6392724C5F986E436D3E65006F5876D878D076FC7554 +522453DB4E535E9E65C1802A80D6629B5486522870AE888D8DD16CE1547880DA +57F988F48D54966A914D4F696C9B55B776C6783062A870F96F8E5F6D84EC68DA +787C7BF781A8670B9E4F636778B0576F78129739627962AB528874356BD70000 +C6 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +826A826B826C826D82718275827682778278827B827C82808281828382858286 +82878289828C82908293829482958296829A829B829E82A082A282A382A782B2 +82B582B682BA82BB82BC82BF82C082C282C382C582C682C982D082D682D982DA +82DD82E282E782E882E982EA82EC82ED82EE82F082F282F382F582F682F80000 +82FA82FC82FD82FE82FF8300830A830B830D831083128313831683188319831D +831E831F83208321832283238324832583268329832A832E833083328337833B +833D5564813E75B276AE533975DE50FB5C418B6C7BC7504F72479A9798D86F02 +74E27968648777A562FC98918D2B54C180584E52576A82F9840D5E7351ED74F6 +8BC45C4F57616CFC98875A4678349B448FEB7C955256625194FA4EC683868461 +83E984B257D467345703666E6D668C3166DD7011671F6B3A6816621A59BB4E03 +51C46F0667D26C8F517668CB59476B6775665D0E81109F5065D7794879419A91 +8D775C824E5E4F01542F5951780C56686C148FC45F036C7D6CE38BAB63900000 +C7 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +833E833F83418342834483458348834A834B834C834D834E8353835583568357 +83588359835D836283708371837283738374837583768379837A837E837F8380 +838183828383838483878388838A838B838C838D838F83908391839483958396 +83978399839A839D839F83A183A283A383A483A583A683A783AC83AD83AE0000 +83AF83B583BB83BE83BF83C283C383C483C683C883C983CB83CD83CE83D083D1 +83D283D383D583D783D983DA83DB83DE83E283E383E483E683E783E883EB83EC +83ED60706D3D72756266948E94C553438FC17B7E4EDF8C264E7E9ED494B194B3 +524D6F5C90636D458C3458115D4C6B206B4967AA545B81547F8C589985375F3A +62A26A47953965726084686577A74E544FA85DE7979864AC7FD85CED4FCF7A8D +520783044E14602F7A8394A64FB54EB279E6743452E482B964D279BD5BDD6C81 +97528F7B6C22503E537F6E0564CE66746C3060C598778BF75E86743C7A7779CB +4E1890B174036C4256DA914B6CC58D8B533A86C666F28EAF5C489A716E200000 +C8 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +83EE83EF83F383F483F583F683F783FA83FB83FC83FE83FF8400840284058407 +84088409840A84108412841384148415841684178419841A841B841E841F8420 +8421842284238429842A842B842C842D842E842F843084328433843484358436 +84378439843A843B843E843F8440844184428443844484458447844884490000 +844A844B844C844D844E844F8450845284538454845584568458845D845E845F +8460846284648465846684678468846A846E846F84708472847484778479847B +847C53D65A369F8B8DA353BB570898A76743919B6CC9516875CA62F372AC5238 +529D7F3A7094763853749E4A69B7786E96C088D97FA4713671C3518967D374E4 +58E4651856B78BA9997662707ED560F970ED58EC4EC14EBA5FCD97E74EFB8BA4 +5203598A7EAB62544ECD65E5620E833884C98363878D71946EB65BB97ED25197 +63C967D480898339881551125B7A59828FB14E736C5D516589258F6F962E854A +745E951095F06DA682E55F3164926D128428816E9CC3585E8D5B4E0953C10000 +C9 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +847D847E847F848084818483848484858486848A848D848F8490849184928493 +8494849584968498849A849B849D849E849F84A084A284A384A484A584A684A7 +84A884A984AA84AB84AC84AD84AE84B084B184B384B584B684B784BB84BC84BE +84C084C284C384C584C684C784C884CB84CC84CE84CF84D284D484D584D70000 +84D884D984DA84DB84DC84DE84E184E284E484E784E884E984EA84EB84ED84EE +84EF84F184F284F384F484F584F684F784F884F984FA84FB84FD84FE85008501 +85024F1E6563685155D34E2764149A9A626B5AC2745F82726DA968EE50E7838E +7802674052396C997EB150BB5565715E7B5B665273CA82EB67495C715220717D +886B95EA965564C58D6181B355846C5562477F2E58924F2455468D4F664C4E0A +5C1A88F368A2634E7A0D70E7828D52FA97F65C1154E890B57ECD59628D4A86C7 +820C820D8D6664445C0461516D89793E8BBE78377533547B4F388EAB6DF15A20 +7EC5795E6C885BA15A76751A80BE614E6E1758F0751F7525727253477EF30000 +CA +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +8503850485058506850785088509850A850B850D850E850F8510851285148515 +851685188519851B851C851D851E852085228523852485258526852785288529 +852A852D852E852F8530853185328533853485358536853E853F854085418542 +8544854585468547854B854C854D854E854F8550855185528553855485550000 +85578558855A855B855C855D855F85608561856285638565856685678569856A +856B856C856D856E856F8570857185738575857685778578857C857D857F8580 +8581770176DB526980DC57235E08593172EE65BD6E7F8BD75C388671534177F3 +62FE65F64EC098DF86805B9E8BC653F277E24F7F5C4E9A7659CB5F0F793A58EB +4E1667FF4E8B62ED8A93901D52BF662F55DC566C90024ED54F8D91CA99706C0F +5E0260435BA489C68BD56536624B99965B885BFF6388552E53D77626517D852C +67A268B36B8A62928F9353D482126DD1758F4E668D4E5B70719F85AF669166D9 +7F7287009ECD9F205C5E672F8FF06811675F620D7AD658855EB665706F310000 +CB +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +85828583858685888589858A858B858C858D858E859085918592859385948595 +8596859785988599859A859D859E859F85A085A185A285A385A585A685A785A9 +85AB85AC85AD85B185B285B385B485B585B685B885BA85BB85BC85BD85BE85BF +85C085C285C385C485C585C685C785C885CA85CB85CC85CD85CE85D185D20000 +85D485D685D785D885D985DA85DB85DD85DE85DF85E085E185E285E385E585E6 +85E785E885EA85EB85EC85ED85EE85EF85F085F185F285F385F485F585F685F7 +85F860555237800D6454887075295E05681362F4971C53CC723D8C016C347761 +7A0E542E77AC987A821C8BF47855671470C165AF64955636601D79C153F84E1D +6B7B80865BFA55E356DB4F3A4F3C99725DF3677E80386002988290015B8B8BBC +8BF5641C825864DE55FD82CF91654FD77D20901F7C9F50F358516EAF5BBF8BC9 +80839178849C7B97867D968B968F7EE59AD3788E5C817A57904296A7795F5B59 +635F7B0B84D168AD55067F2974107D2295016240584C4ED65B83597958540000 +CC +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +85F985FA85FC85FD85FE860086018602860386048606860786088609860A860B +860C860D860E860F86108612861386148615861786188619861A861B861C861D +861E861F86208621862286238624862586268628862A862B862C862D862E862F +863086318632863386348635863686378639863A863B863D863E863F86400000 +864186428643864486458646864786488649864A864B864C8652865386558656 +865786588659865B865C865D865F866086618663866486658666866786688669 +866A736D631E8E4B8E0F80CE82D462AC53F06CF0915E592A60016C70574D644A +8D2A762B6EE9575B6A8075F06F6D8C2D8C0857666BEF889278B363A253F970AD +6C645858642A580268E0819B55107CD650188EBA6DCC8D9F70EB638F6D9B6ED4 +7EE68404684390036DD896768BA85957727985E4817E75BC8A8A68AF52548E22 +951163D098988E44557C4F5366FF568F60D56D9552435C4959296DFB586B7530 +751C606C82148146631167618FE2773A8DF38D3494C15E165385542C70C30000 +CD +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +866D866F86708672867386748675867686778678868386848685868686878688 +8689868E868F86908691869286948696869786988699869A869B869E869F86A0 +86A186A286A586A686AB86AD86AE86B286B386B786B886B986BB86BC86BD86BE +86BF86C186C286C386C586C886CC86CD86D286D386D586D686D786DA86DC0000 +86DD86E086E186E286E386E586E686E786E886EA86EB86EC86EF86F586F686F7 +86FA86FB86FC86FD86FF8701870487058706870B870C870E870F871087118714 +87166C405EF7505C4EAD5EAD633A8247901A6850916E77B3540C94DC5F647AE5 +687663457B527EDF75DB507762955934900F51F879C37A8156FE5F9290146D82 +5C60571F541051546E4D56E263A89893817F8715892A9000541E5C6F81C062D6 +625881319E3596409A6E9A7C692D59A562D3553E631654C786D96D3C5A0374E6 +889C6B6A59168C4C5F2F6E7E73A9987D4E3870F75B8C7897633D665A769660CB +5B9B5A494E0781556C6A738B4EA167897F515F8065FA671B5FD859845A010000 +CE +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +8719871B871D871F87208724872687278728872A872B872C872D872F87308732 +87338735873687388739873A873C873D8740874187428743874487458746874A +874B874D874F8750875187528754875587568758875A875B875C875D875E875F +876187628766876787688769876A876B876C876D876F87718772877387750000 +877787788779877A877F878087818784878687878789878A878C878E878F8790 +8791879287948795879687988799879A879B879C879D879E87A087A187A287A3 +87A45DCD5FAE537197E68FDD684556F4552F60DF4E3A6F4D7EF482C7840E59D4 +4F1F4F2A5C3E7EAC672A851A5473754F80C355829B4F4F4D6E2D8C135C096170 +536B761F6E29868A658795FB7EB9543B7A337D0A95EE55E17FC174EE631D8717 +6DA17A9D621165A1536763E16C835DEB545C94A84E4C6C618BEC5C4B65E0829C +68A7543E54346BCB6B664E9463425348821E4F0D4FAE575E620A96FE66647269 +52FF52A1609F8BEF661471996790897F785277FD6670563B54389521727A0000 +CF +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +87A587A687A787A987AA87AE87B087B187B287B487B687B787B887B987BB87BC +87BE87BF87C187C287C387C487C587C787C887C987CC87CD87CE87CF87D087D4 +87D587D687D787D887D987DA87DC87DD87DE87DF87E187E287E387E487E687E7 +87E887E987EB87EC87ED87EF87F087F187F287F387F487F587F687F787F80000 +87FA87FB87FC87FD87FF880088018802880488058806880788088809880B880C +880D880E880F8810881188128814881788188819881A881C881D881E881F8820 +88237A00606F5E0C6089819D591560DC718470EF6EAA6C5072806A8488AD5E2D +4E605AB3559C94E36D177CFB9699620F7EC6778E867E5323971E8F9666875CE1 +4FA072ED4E0B53A6590F54136380952851484ED99C9C7EA454B88D2488548237 +95F26D8E5F265ACC663E966973B0732E53BF817A99857FA15BAA967796507EBF +76F853A2957699997BB189446E584E617FD479658BE660F354CD4EAB98795DF7 +6A6150CF54118C618427785D9704524A54EE56A395006D885BB56DC666530000 +D0 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +882488258826882788288829882A882B882C882D882E882F8830883188338834 +8835883688378838883A883B883D883E883F8841884288438846884788488849 +884A884B884E884F8850885188528853885588568858885A885B885C885D885E +885F886088668867886A886D886F8871887388748875887688788879887A0000 +887B887C88808883888688878889888A888C888E888F88908891889388948895 +889788988899889A889B889D889E889F88A088A188A388A588A688A788A888A9 +88AA5C0F5B5D6821809655787B11654869544E9B6B47874E978B534F631F643A +90AA659C80C18C10519968B0537887F961C86CC46CFB8C225C5185AA82AF950C +6B238F9B65B05FFB5FC34FE18845661F8165732960FA51745211578B5F6290A2 +884C91925E78674F602759D3514451F680F853086C7996C4718A4F114FEE7F9E +673D55C5950879C088967EE3589F620C9700865A5618987B5F908BB884C49157 +53D965ED5E8F755C60647D6E5A7F7EEA7EED8F6955A75BA360AC65CB73840000 +D1 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +88AC88AE88AF88B088B288B388B488B588B688B888B988BA88BB88BD88BE88BF +88C088C388C488C788C888CA88CB88CC88CD88CF88D088D188D388D688D788DA +88DB88DC88DD88DE88E088E188E688E788E988EA88EB88EC88ED88EE88EF88F2 +88F588F688F788FA88FB88FD88FF890089018903890489058906890789080000 +8909890B890C890D890E890F891189148915891689178918891C891D891E891F +89208922892389248926892789288929892C892D892E892F8931893289338935 +89379009766377297EDA9774859B5B667A7496EA884052CB718F5FAA65EC8BE2 +5BFB9A6F5DE16B896C5B8BAD8BAF900A8FC5538B62BC9E269E2D54404E2B82BD +7259869C5D1688596DAF96C554D14E9A8BB6710954BD960970DF6DF976D04E25 +781487125CA95EF68A00989C960E708E6CBF594463A9773C884D6F1482735830 +71D5538C781A96C155015F6671305BB48C1A9A8C6B83592E9E2F79E76768626C +4F6F75A17F8A6D0B96336C274EF075D2517B68376F3E90808170599674760000 +D2 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +89388939893A893B893C893D893E893F89408942894389458946894789488949 +894A894B894C894D894E894F8950895189528953895489558956895789588959 +895A895B895C895D896089618962896389648965896789688969896A896B896C +896D896E896F8970897189728973897489758976897789788979897A897C0000 +897D897E8980898289848985898789888989898A898B898C898D898E898F8990 +899189928993899489958996899789988999899A899B899C899D899E899F89A0 +89A164475C2790657A918C2359DA54AC8200836F898180006930564E80367237 +91CE51B64E5F987563964E1A53F666F3814B591C6DB24E0058F9533B63D694F1 +4F9D4F0A886398905937905779FB4EEA80F075916C825B9C59E85F5D69058681 +501A5DF24E5977E34EE5827A6291661390915C794EBF5F7981C69038808475AB +4EA688D4610F6BC55FC64E4976CA6EA28BE38BAE8C0A8BD15F027FFC7FCC7ECE +8335836B56E06BB797F3963459FB541F94F66DEB5BC5996E5C395F1596900000 +D3 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +89A289A389A489A589A689A789A889A989AA89AB89AC89AD89AE89AF89B089B1 +89B289B389B489B589B689B789B889B989BA89BB89BC89BD89BE89BF89C089C3 +89CD89D389D489D589D789D889D989DB89DD89DF89E089E189E289E489E789E8 +89E989EA89EC89ED89EE89F089F189F289F489F589F689F789F889F989FA0000 +89FB89FC89FD89FE89FF8A018A028A038A048A058A068A088A098A0A8A0B8A0C +8A0D8A0E8A0F8A108A118A128A138A148A158A168A178A188A198A1A8A1B8A1C +8A1D537082F16A315A749E705E947F2883B984248425836787478FCE8D6276C8 +5F719896786C662054DF62E54F6381C375C85EB896CD8E0A86F9548F6CF36D8C +6C38607F52C775285E7D4F1860A05FE75C24753190AE94C072B96CB96E389149 +670953CB53F34F5191C98BF153C85E7C8FC26DE44E8E76C26986865E611A8206 +4F594FDE903E9C7C61096E1D6E1496854E885A3196E84E0E5C7F79B95B878BED +7FBD738957DF828B90C15401904755BB5CEA5FA161086B3272F180B28A890000 +D4 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +8A1E8A1F8A208A218A228A238A248A258A268A278A288A298A2A8A2B8A2C8A2D +8A2E8A2F8A308A318A328A338A348A358A368A378A388A398A3A8A3B8A3C8A3D +8A3F8A408A418A428A438A448A458A468A478A498A4A8A4B8A4C8A4D8A4E8A4F +8A508A518A528A538A548A558A568A578A588A598A5A8A5B8A5C8A5D8A5E0000 +8A5F8A608A618A628A638A648A658A668A678A688A698A6A8A6B8A6C8A6D8A6E +8A6F8A708A718A728A738A748A758A768A778A788A7A8A7B8A7C8A7D8A7E8A7F +8A806D745BD388D598848C6B9A6D9E336E0A51A4514357A38881539F63F48F95 +56ED54585706733F6E907F188FDC82D1613F6028966266F07EA68D8A8DC394A5 +5CB37CA4670860A6960580184E9190E75300966851418FD08574915D665597F5 +5B55531D78386742683D54C9707E5BB08F7D518D572854B1651266828D5E8D43 +810F846C906D7CDF51FF85FB67A365E96FA186A48E81566A90207682707671E5 +8D2362E952196CFD8D3C600E589E618E66FE8D60624E55B36E23672D8F670000 +D5 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +8A818A828A838A848A858A868A878A888A8B8A8C8A8D8A8E8A8F8A908A918A92 +8A948A958A968A978A988A998A9A8A9B8A9C8A9D8A9E8A9F8AA08AA18AA28AA3 +8AA48AA58AA68AA78AA88AA98AAA8AAB8AAC8AAD8AAE8AAF8AB08AB18AB28AB3 +8AB48AB58AB68AB78AB88AB98ABA8ABB8ABC8ABD8ABE8ABF8AC08AC18AC20000 +8AC38AC48AC58AC68AC78AC88AC98ACA8ACB8ACC8ACD8ACE8ACF8AD08AD18AD2 +8AD38AD48AD58AD68AD78AD88AD98ADA8ADB8ADC8ADD8ADE8ADF8AE08AE18AE2 +8AE394E195F87728680569A8548B4E4D70B88BC86458658B5B857A84503A5BE8 +77BB6BE18A797C986CBE76CF65A98F975D2D5C5586386808536062187AD96E5B +7EFD6A1F7AE05F706F335F20638C6DA867564E085E108D264ED780C07634969C +62DB662D627E6CBC8D7571677F695146808753EC906E629854F286F08F998005 +951785178FD96D5973CD659F771F7504782781FB8D1E94884FA6679575B98BCA +9707632F9547963584B8632377415F8172F04E896014657462EF6B63653F0000 +D6 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +8AE48AE58AE68AE78AE88AE98AEA8AEB8AEC8AED8AEE8AEF8AF08AF18AF28AF3 +8AF48AF58AF68AF78AF88AF98AFA8AFB8AFC8AFD8AFE8AFF8B008B018B028B03 +8B048B058B068B088B098B0A8B0B8B0C8B0D8B0E8B0F8B108B118B128B138B14 +8B158B168B178B188B198B1A8B1B8B1C8B1D8B1E8B1F8B208B218B228B230000 +8B248B258B278B288B298B2A8B2B8B2C8B2D8B2E8B2F8B308B318B328B338B34 +8B358B368B378B388B398B3A8B3B8B3C8B3D8B3E8B3F8B408B418B428B438B44 +8B455E2775C790D18BC1829D679D652F5431871877E580A281026C414E4B7EC7 +804C76F4690D6B966267503C4F84574063076B628DBE53EA65E87EB85FD7631A +63B781F381F47F6E5E1C5CD95236667A79E97A1A8D28709975D46EDE6CBB7A92 +4E2D76C55FE0949F88777EC879CD80BF91CD4EF24F17821F54685DDE6D328BCC +7CA58F7480985E1A549276B15B99663C9AA473E0682A86DB6731732A8BF88BDB +90107AF970DB716E62C477A956314E3B845767F152A986C08D2E94F87B510000 +D7 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +8B468B478B488B498B4A8B4B8B4C8B4D8B4E8B4F8B508B518B528B538B548B55 +8B568B578B588B598B5A8B5B8B5C8B5D8B5E8B5F8B608B618B628B638B648B65 +8B678B688B698B6A8B6B8B6D8B6E8B6F8B708B718B728B738B748B758B768B77 +8B788B798B7A8B7B8B7C8B7D8B7E8B7F8B808B818B828B838B848B858B860000 +8B878B888B898B8A8B8B8B8C8B8D8B8E8B8F8B908B918B928B938B948B958B96 +8B978B988B998B9A8B9B8B9C8B9D8B9E8B9F8BAC8BB18BBB8BC78BD08BEA8C09 +8C1E4F4F6CE8795D9A7B6293722A62FD4E1378168F6C64B08D5A7BC668695E84 +88C55986649E58EE72B6690E95258FFD8D5857607F008C0651C6634962D95353 +684C74228301914C55447740707C6D4A517954A88D4459FF6ECB6DC45B5C7D2B +4ED47C7D6ED35B5081EA6E0D5B579B0368D58E2A5B977EFC603B7EB590B98D70 +594F63CD79DF8DB3535265CF79568BC5963B7EC494BB7E825634918967007F6A +5C0A907566285DE64F5067DE505A4F5C57505EA7000000000000000000000000 +D8 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +8C388C398C3A8C3B8C3C8C3D8C3E8C3F8C408C428C438C448C458C488C4A8C4B +8C4D8C4E8C4F8C508C518C528C538C548C568C578C588C598C5B8C5C8C5D8C5E +8C5F8C608C638C648C658C668C678C688C698C6C8C6D8C6E8C6F8C708C718C72 +8C748C758C768C778C7B8C7C8C7D8C7E8C7F8C808C818C838C848C868C870000 +8C888C8B8C8D8C8E8C8F8C908C918C928C938C958C968C978C998C9A8C9B8C9C +8C9D8C9E8C9F8CA08CA18CA28CA38CA48CA58CA68CA78CA88CA98CAA8CAB8CAC +8CAD4E8D4E0C51404E105EFF53454E154E984E1E9B325B6C56694E2879BA4E3F +53154E47592D723B536E6C1056DF80E499976BD3777E9F174E364E9F9F104E5C +4E694E9382885B5B556C560F4EC4538D539D53A353A553AE97658D5D531A53F5 +5326532E533E8D5C5366536352025208520E522D5233523F5240524C525E5261 +525C84AF527D528252815290529351827F544EBB4EC34EC94EC24EE84EE14EEB +4EDE4F1B4EF34F224F644EF54F254F274F094F2B4F5E4F6765384F5A4F5D0000 +D9 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +8CAE8CAF8CB08CB18CB28CB38CB48CB58CB68CB78CB88CB98CBA8CBB8CBC8CBD +8CBE8CBF8CC08CC18CC28CC38CC48CC58CC68CC78CC88CC98CCA8CCB8CCC8CCD +8CCE8CCF8CD08CD18CD28CD38CD48CD58CD68CD78CD88CD98CDA8CDB8CDC8CDD +8CDE8CDF8CE08CE18CE28CE38CE48CE58CE68CE78CE88CE98CEA8CEB8CEC0000 +8CED8CEE8CEF8CF08CF18CF28CF38CF48CF58CF68CF78CF88CF98CFA8CFB8CFC +8CFD8CFE8CFF8D008D018D028D038D048D058D068D078D088D098D0A8D0B8D0C +8D0D4F5F4F574F324F3D4F764F744F914F894F834F8F4F7E4F7B4FAA4F7C4FAC +4F944FE64FE84FEA4FC54FDA4FE34FDC4FD14FDF4FF85029504C4FF3502C500F +502E502D4FFE501C500C50255028507E504350555048504E506C507B50A550A7 +50A950BA50D6510650ED50EC50E650EE5107510B4EDD6C3D4F584F654FCE9FA0 +6C467C74516E5DFD9EC999985181591452F9530D8A07531051EB591951554EA0 +51564EB3886E88A44EB5811488D279805B3488037FB851AB51B151BD51BC0000 +DA +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +8D0E8D0F8D108D118D128D138D148D158D168D178D188D198D1A8D1B8D1C8D20 +8D518D528D578D5F8D658D688D698D6A8D6C8D6E8D6F8D718D728D788D798D7A +8D7B8D7C8D7D8D7E8D7F8D808D828D838D868D878D888D898D8C8D8D8D8E8D8F +8D908D928D938D958D968D978D988D998D9A8D9B8D9C8D9D8D9E8DA08DA10000 +8DA28DA48DA58DA68DA78DA88DA98DAA8DAB8DAC8DAD8DAE8DAF8DB08DB28DB6 +8DB78DB98DBB8DBD8DC08DC18DC28DC58DC78DC88DC98DCA8DCD8DD08DD28DD3 +8DD451C7519651A251A58BA08BA68BA78BAA8BB48BB58BB78BC28BC38BCB8BCF +8BCE8BD28BD38BD48BD68BD88BD98BDC8BDF8BE08BE48BE88BE98BEE8BF08BF3 +8BF68BF98BFC8BFF8C008C028C048C078C0C8C0F8C118C128C148C158C168C19 +8C1B8C188C1D8C1F8C208C218C258C278C2A8C2B8C2E8C2F8C328C338C358C36 +5369537A961D962296219631962A963D963C964296499654965F9667966C9672 +96749688968D969796B09097909B909D909990AC90A190B490B390B690BA0000 +DB +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +8DD58DD88DD98DDC8DE08DE18DE28DE58DE68DE78DE98DED8DEE8DF08DF18DF2 +8DF48DF68DFC8DFE8DFF8E008E018E028E038E048E068E078E088E0B8E0D8E0E +8E108E118E128E138E158E168E178E188E198E1A8E1B8E1C8E208E218E248E25 +8E268E278E288E2B8E2D8E308E328E338E348E368E378E388E3B8E3C8E3E0000 +8E3F8E438E458E468E4C8E4D8E4E8E4F8E508E538E548E558E568E578E588E5A +8E5B8E5C8E5D8E5E8E5F8E608E618E628E638E648E658E678E688E6A8E6B8E6E +8E7190B890B090CF90C590BE90D090C490C790D390E690E290DC90D790DB90EB +90EF90FE91049122911E91239131912F913991439146520D594252A252AC52AD +52BE54FF52D052D652F053DF71EE77CD5EF451F551FC9B2F53B65F01755A5DEF +574C57A957A1587E58BC58C558D15729572C572A57335739572E572F575C573B +574257695785576B5786577C577B5768576D5776577357AD57A4578C57B257CF +57A757B4579357A057D557D857DA57D957D257B857F457EF57F857E457DD0000 +DC +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +8E738E758E778E788E798E7A8E7B8E7D8E7E8E808E828E838E848E868E888E89 +8E8A8E8B8E8C8E8D8E8E8E918E928E938E958E968E978E988E998E9A8E9B8E9D +8E9F8EA08EA18EA28EA38EA48EA58EA68EA78EA88EA98EAA8EAD8EAE8EB08EB1 +8EB38EB48EB58EB68EB78EB88EB98EBB8EBC8EBD8EBE8EBF8EC08EC18EC20000 +8EC38EC48EC58EC68EC78EC88EC98ECA8ECB8ECC8ECD8ECF8ED08ED18ED28ED3 +8ED48ED58ED68ED78ED88ED98EDA8EDB8EDC8EDD8EDE8EDF8EE08EE18EE28EE3 +8EE4580B580D57FD57ED5800581E5819584458205865586C58815889589A5880 +99A89F1961FF8279827D827F828F828A82A88284828E82918297829982AB82B8 +82BE82B082C882CA82E3829882B782AE82CB82CC82C182A982B482A182AA829F +82C482CE82A482E1830982F782E4830F830782DC82F482D282D8830C82FB82D3 +8311831A83068314831582E082D5831C8351835B835C83088392833C83348331 +839B835E832F834F83478343835F834083178360832D833A8333836683650000 +DD +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +8EE58EE68EE78EE88EE98EEA8EEB8EEC8EED8EEE8EEF8EF08EF18EF28EF38EF4 +8EF58EF68EF78EF88EF98EFA8EFB8EFC8EFD8EFE8EFF8F008F018F028F038F04 +8F058F068F078F088F098F0A8F0B8F0C8F0D8F0E8F0F8F108F118F128F138F14 +8F158F168F178F188F198F1A8F1B8F1C8F1D8F1E8F1F8F208F218F228F230000 +8F248F258F268F278F288F298F2A8F2B8F2C8F2D8F2E8F2F8F308F318F328F33 +8F348F358F368F378F388F398F3A8F3B8F3C8F3D8F3E8F3F8F408F418F428F43 +8F448368831B8369836C836A836D836E83B0837883B383B483A083AA8393839C +8385837C83B683A9837D83B8837B8398839E83A883BA83BC83C1840183E583D8 +58078418840B83DD83FD83D6841C84388411840683D483DF840F840383F883F9 +83EA83C583C0842683F083E1845C8451845A8459847384878488847A84898478 +843C844684698476848C848E8431846D84C184CD84D084E684BD84D384CA84BF +84BA84E084A184B984B4849784E584E3850C750D853884F08539851F853A0000 +DE +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +8F458F468F478F488F498F4A8F4B8F4C8F4D8F4E8F4F8F508F518F528F538F54 +8F558F568F578F588F598F5A8F5B8F5C8F5D8F5E8F5F8F608F618F628F638F64 +8F658F6A8F808F8C8F928F9D8FA08FA18FA28FA48FA58FA68FA78FAA8FAC8FAD +8FAE8FAF8FB28FB38FB48FB58FB78FB88FBA8FBB8FBC8FBF8FC08FC38FC60000 +8FC98FCA8FCB8FCC8FCD8FCF8FD28FD68FD78FDA8FE08FE18FE38FE78FEC8FEF +8FF18FF28FF48FF58FF68FFA8FFB8FFC8FFE8FFF90079008900C900E90139015 +90188556853B84FF84FC8559854885688564855E857A77A285438572857B85A4 +85A88587858F857985AE859C858585B985B785B085D385C185DC85FF86278605 +86298616863C5EFE5F08593C594180375955595A5958530F5C225C255C2C5C34 +624C626A629F62BB62CA62DA62D762EE632262F66339634B634363AD63F66371 +637A638E63B4636D63AC638A636963AE63BC63F263F863E063FF63C463DE63CE +645263C663BE64456441640B641B6420640C64266421645E6484646D64960000 +DF +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +9019901C902390249025902790289029902A902B902C90309031903290339034 +90379039903A903D903F904090439045904690489049904A904B904C904E9054 +905590569059905A905C905D905E905F906090619064906690679069906A906B +906C906F90709071907290739076907790789079907A907B907C907E90810000 +90849085908690879089908A908C908D908E908F90909092909490969098909A +909C909E909F90A090A490A590A790A890A990AB90AD90B290B790BC90BD90BF +90C0647A64B764B8649964BA64C064D064D764E464E265096525652E5F0B5FD2 +75195F11535F53F153FD53E953E853FB541254165406544B5452545354545456 +54435421545754595423543254825494547754715464549A549B548454765466 +549D54D054AD54C254B454D254A754A654D354D4547254A354D554BB54BF54CC +54D954DA54DC54A954AA54A454DD54CF54DE551B54E7552054FD551454F35522 +5523550F55115527552A5567558F55B55549556D55415555553F5550553C0000 +E0 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +90C290C390C690C890C990CB90CC90CD90D290D490D590D690D890D990DA90DE +90DF90E090E390E490E590E990EA90EC90EE90F090F190F290F390F590F690F7 +90F990FA90FB90FC90FF91009101910391059106910791089109910A910B910C +910D910E910F911091119112911391149115911691179118911A911B911C0000 +911D911F91209121912491259126912791289129912A912B912C912D912E9130 +9132913391349135913691379138913A913B913C913D913E913F914091419142 +91445537555655755576557755335530555C558B55D2558355B155B955885581 +559F557E55D65591557B55DF55BD55BE5594559955EA55F755C9561F55D155EB +55EC55D455E655DD55C455EF55E555F255F355CC55CD55E855F555E48F94561E +5608560C56015624562355FE56005627562D565856395657562C564D56625659 +565C564C5654568656645671566B567B567C5685569356AF56D456D756DD56E1 +56F556EB56F956FF5704570A5709571C5E0F5E195E145E115E315E3B5E3C0000 +E1 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +9145914791489151915391549155915691589159915B915C915F916091669167 +9168916B916D9173917A917B917C9180918191829183918491869188918A918E +918F9193919491959196919791989199919C919D919E919F91A091A191A491A5 +91A691A791A891A991AB91AC91B091B191B291B391B691B791B891B991BB0000 +91BC91BD91BE91BF91C091C191C291C391C491C591C691C891CB91D091D291D3 +91D491D591D691D791D891D991DA91DB91DD91DE91DF91E091E191E291E391E4 +91E55E375E445E545E5B5E5E5E615C8C5C7A5C8D5C905C965C885C985C995C91 +5C9A5C9C5CB55CA25CBD5CAC5CAB5CB15CA35CC15CB75CC45CD25CE45CCB5CE5 +5D025D035D275D265D2E5D245D1E5D065D1B5D585D3E5D345D3D5D6C5D5B5D6F +5D5D5D6B5D4B5D4A5D695D745D825D995D9D8C735DB75DC55F735F775F825F87 +5F895F8C5F955F995F9C5FA85FAD5FB55FBC88625F6172AD72B072B472B772B8 +72C372C172CE72CD72D272E872EF72E972F272F472F7730172F3730372FA0000 +E2 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +91E691E791E891E991EA91EB91EC91ED91EE91EF91F091F191F291F391F491F5 +91F691F791F891F991FA91FB91FC91FD91FE91FF920092019202920392049205 +9206920792089209920A920B920C920D920E920F921092119212921392149215 +9216921792189219921A921B921C921D921E921F922092219222922392240000 +92259226922792289229922A922B922C922D922E922F92309231923292339234 +92359236923792389239923A923B923C923D923E923F92409241924292439244 +924572FB731773137321730A731E731D7315732273397325732C733873317350 +734D73577360736C736F737E821B592598E7592459029963996799689969996A +996B996C99749977997D998099849987998A998D999099919993999499955E80 +5E915E8B5E965EA55EA05EB95EB55EBE5EB38D535ED25ED15EDB5EE85EEA81BA +5FC45FC95FD65FCF60035FEE60045FE15FE45FFE600560065FEA5FED5FF86019 +60356026601B600F600D6029602B600A603F602160786079607B607A60420000 +E3 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +9246924792489249924A924B924C924D924E924F925092519252925392549255 +9256925792589259925A925B925C925D925E925F926092619262926392649265 +9266926792689269926A926B926C926D926E926F927092719272927392759276 +927792789279927A927B927C927D927E927F9280928192829283928492850000 +9286928792889289928A928B928C928D928F9290929192929293929492959296 +929792989299929A929B929C929D929E929F92A092A192A292A392A492A592A6 +92A7606A607D6096609A60AD609D60836092608C609B60EC60BB60B160DD60D8 +60C660DA60B4612061266115612360F46100610E612B614A617561AC619461A7 +61B761D461F55FDD96B395E995EB95F195F395F595F695FC95FE960396049606 +9608960A960B960C960D960F96129615961696179619961A4E2C723F62156C35 +6C546C5C6C4A6CA36C856C906C946C8C6C686C696C746C766C866CA96CD06CD4 +6CAD6CF76CF86CF16CD76CB26CE06CD66CFA6CEB6CEE6CB16CD36CEF6CFE0000 +E4 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +92A892A992AA92AB92AC92AD92AF92B092B192B292B392B492B592B692B792B8 +92B992BA92BB92BC92BD92BE92BF92C092C192C292C392C492C592C692C792C9 +92CA92CB92CC92CD92CE92CF92D092D192D292D392D492D592D692D792D892D9 +92DA92DB92DC92DD92DE92DF92E092E192E292E392E492E592E692E792E80000 +92E992EA92EB92EC92ED92EE92EF92F092F192F292F392F492F592F692F792F8 +92F992FA92FB92FC92FD92FE92FF930093019302930393049305930693079308 +93096D396D276D0C6D436D486D076D046D196D0E6D2B6D4D6D2E6D356D1A6D4F +6D526D546D336D916D6F6D9E6DA06D5E6D936D946D5C6D606D7C6D636E1A6DC7 +6DC56DDE6E0E6DBF6DE06E116DE66DDD6DD96E166DAB6E0C6DAE6E2B6E6E6E4E +6E6B6EB26E5F6E866E536E546E326E256E446EDF6EB16E986EE06F2D6EE26EA5 +6EA76EBD6EBB6EB76ED76EB46ECF6E8F6EC26E9F6F626F466F476F246F156EF9 +6F2F6F366F4B6F746F2A6F096F296F896F8D6F8C6F786F726F7C6F7A6FD10000 +E5 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +930A930B930C930D930E930F9310931193129313931493159316931793189319 +931A931B931C931D931E931F9320932193229323932493259326932793289329 +932A932B932C932D932E932F9330933193329333933493359336933793389339 +933A933B933C933D933F93409341934293439344934593469347934893490000 +934A934B934C934D934E934F9350935193529353935493559356935793589359 +935A935B935C935D935E935F9360936193629363936493659366936793689369 +936B6FC96FA76FB96FB66FC26FE16FEE6FDE6FE06FEF701A7023701B70397035 +704F705E5B805B845B955B935BA55BB8752F9A9E64345BE45BEE89305BF08E47 +8B078FB68FD38FD58FE58FEE8FE48FE98FE68FF38FE890059004900B90269011 +900D9016902190359036902D902F9044905190529050906890589062905B66B9 +9074907D908290889083908B5F505F575F565F585C3B54AB5C505C595B715C63 +5C667FBC5F2A5F295F2D82745F3C9B3B5C6E59815983598D59A959AA59A30000 +E6 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +936C936D936E936F9370937193729373937493759376937793789379937A937B +937C937D937E937F9380938193829383938493859386938793889389938A938B +938C938D938E9390939193929393939493959396939793989399939A939B939C +939D939E939F93A093A193A293A393A493A593A693A793A893A993AA93AB0000 +93AC93AD93AE93AF93B093B193B293B393B493B593B693B793B893B993BA93BB +93BC93BD93BE93BF93C093C193C293C393C493C593C693C793C893C993CB93CC +93CD599759CA59AB599E59A459D259B259AF59D759BE5A055A0659DD5A0859E3 +59D859F95A0C5A095A325A345A115A235A135A405A675A4A5A555A3C5A625A75 +80EC5AAA5A9B5A775A7A5ABE5AEB5AB25AD25AD45AB85AE05AE35AF15AD65AE6 +5AD85ADC5B095B175B165B325B375B405C155C1C5B5A5B655B735B515B535B62 +9A759A779A789A7A9A7F9A7D9A809A819A859A889A8A9A909A929A939A969A98 +9A9B9A9C9A9D9A9F9AA09AA29AA39AA59AA77E9F7EA17EA37EA57EA87EA90000 +E7 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +93CE93CF93D093D193D293D393D493D593D793D893D993DA93DB93DC93DD93DE +93DF93E093E193E293E393E493E593E693E793E893E993EA93EB93EC93ED93EE +93EF93F093F193F293F393F493F593F693F793F893F993FA93FB93FC93FD93FE +93FF9400940194029403940494059406940794089409940A940B940C940D0000 +940E940F9410941194129413941494159416941794189419941A941B941C941D +941E941F9420942194229423942494259426942794289429942A942B942C942D +942E7EAD7EB07EBE7EC07EC17EC27EC97ECB7ECC7ED07ED47ED77EDB7EE07EE1 +7EE87EEB7EEE7EEF7EF17EF27F0D7EF67EFA7EFB7EFE7F017F027F037F077F08 +7F0B7F0C7F0F7F117F127F177F197F1C7F1B7F1F7F217F227F237F247F257F26 +7F277F2A7F2B7F2C7F2D7F2F7F307F317F327F337F355E7A757F5DDB753E9095 +738E739173AE73A2739F73CF73C273D173B773B373C073C973C873E573D9987C +740A73E973E773DE73BA73F2740F742A745B7426742574287430742E742C0000 +E8 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +942F9430943194329433943494359436943794389439943A943B943C943D943F +9440944194429443944494459446944794489449944A944B944C944D944E944F +9450945194529453945494559456945794589459945A945B945C945D945E945F +9460946194629463946494659466946794689469946A946C946D946E946F0000 +9470947194729473947494759476947794789479947A947B947C947D947E947F +9480948194829483948494919496949894C794CF94D394D494DA94E694FB951C +9520741B741A7441745C7457745574597477746D747E749C748E748074817487 +748B749E74A874A9749074A774D274BA97EA97EB97EC674C6753675E67486769 +67A56787676A6773679867A7677567A8679E67AD678B6777677C67F0680967D8 +680A67E967B0680C67D967B567DA67B367DD680067C367B867E2680E67C167FD +6832683368606861684E6862684468646883681D68556866684168676840683E +684A6849682968B5688F687468776893686B68C2696E68FC691F692068F90000 +E9 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +95279533953D95439548954B9555955A9560956E95749575957795789579957A +957B957C957D957E9580958195829583958495859586958795889589958A958B +958C958D958E958F9590959195929593959495959596959795989599959A959B +959C959D959E959F95A095A195A295A395A495A595A695A795A895A995AA0000 +95AB95AC95AD95AE95AF95B095B195B295B395B495B595B695B795B895B995BA +95BB95BC95BD95BE95BF95C095C195C295C395C495C595C695C795C895C995CA +95CB692468F0690B6901695768E369106971693969606942695D6984696B6980 +69986978693469CC6987698869CE6989696669636979699B69A769BB69AB69AD +69D469B169C169CA69DF699569E0698D69FF6A2F69ED6A176A186A6569F26A44 +6A3E6AA06A506A5B6A356A8E6A796A3D6A286A586A7C6A916A906AA96A976AAB +733773526B816B826B876B846B926B936B8D6B9A6B9B6BA16BAA8F6B8F6D8F71 +8F728F738F758F768F788F778F798F7A8F7C8F7E8F818F828F848F878F8B0000 +EA +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +95CC95CD95CE95CF95D095D195D295D395D495D595D695D795D895D995DA95DB +95DC95DD95DE95DF95E095E195E295E395E495E595E695E795EC95FF96079613 +9618961B961E96209623962496259626962796289629962B962C962D962F9630 +963796389639963A963E96419643964A964E964F965196529653965696570000 +96589659965A965C965D965E9660966396659666966B966D966E966F96709671 +967396789679967A967B967C967D967E967F9680968196829683968496879689 +968A8F8D8F8E8F8F8F988F9A8ECE620B6217621B621F6222622162256224622C +81E774EF74F474FF750F75117513653465EE65EF65F0660A6619677266036615 +6600708566F7661D66346631663666358006665F66546641664F665666616657 +66776684668C66A7669D66BE66DB66DC66E666E98D328D338D368D3B8D3D8D40 +8D458D468D488D498D478D4D8D558D5989C789CA89CB89CC89CE89CF89D089D1 +726E729F725D7266726F727E727F7284728B728D728F72926308633263B00000 +EB +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +968C968E96919692969396959696969A969B969D969E969F96A096A196A296A3 +96A496A596A696A896A996AA96AB96AC96AD96AE96AF96B196B296B496B596B7 +96B896BA96BB96BF96C296C396C896CA96CB96D096D196D396D496D696D796D8 +96D996DA96DB96DC96DD96DE96DF96E196E296E396E496E596E696E796EB0000 +96EC96ED96EE96F096F196F296F496F596F896FA96FB96FC96FD96FF97029703 +9705970A970B970C97109711971297149715971797189719971A971B971D971F +9720643F64D880046BEA6BF36BFD6BF56BF96C056C076C066C0D6C156C186C19 +6C1A6C216C296C246C2A6C3265356555656B724D72527256723086625216809F +809C809380BC670A80BD80B180AB80AD80B480B780E780E880E980EA80DB80C2 +80C480D980CD80D7671080DD80EB80F180F480ED810D810E80F280FC67158112 +8C5A8136811E812C811881328148814C815381748159815A817181608169817C +817D816D8167584D5AB58188818281916ED581A381AA81CC672681CA81BB0000 +EC +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +972197229723972497259726972797289729972B972C972E972F973197339734 +973597369737973A973B973C973D973F97409741974297439744974597469747 +97489749974A974B974C974D974E974F975097519754975597579758975A975C +975D975F97639764976697679768976A976B976C976D976E976F977097710000 +97729775977797789779977A977B977D977E977F978097819782978397849786 +978797889789978A978C978E978F979097939795979697979799979A979B979C +979D81C181A66B246B376B396B436B466B5998D198D298D398D598D998DA6BB3 +5F406BC289F365909F51659365BC65C665C465C365CC65CE65D265D67080709C +7096709D70BB70C070B770AB70B170E870CA711071137116712F71317173715C +716871457172714A7178717A719871B371B571A871A071E071D471E771F9721D +7228706C7118716671B9623E623D624362486249793B794079467949795B795C +7953795A796279577960796F7967797A7985798A799A79A779B35FD15FD00000 +ED +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +979E979F97A197A297A497A597A697A797A897A997AA97AC97AE97B097B197B3 +97B597B697B797B897B997BA97BB97BC97BD97BE97BF97C097C197C297C397C4 +97C597C697C797C897C997CA97CB97CC97CD97CE97CF97D097D197D297D397D4 +97D597D697D797D897D997DA97DB97DC97DD97DE97DF97E097E197E297E30000 +97E497E597E897EE97EF97F097F197F297F497F797F897F997FA97FB97FC97FD +97FE97FF9800980198029803980498059806980798089809980A980B980C980D +980E603C605D605A606760416059606360AB6106610D615D61A9619D61CB61D1 +62068080807F6C936CF66DFC77F677F87800780978177818781165AB782D781C +781D7839783A783B781F783C7825782C78237829784E786D7856785778267850 +7847784C786A789B7893789A7887789C78A178A378B278B978A578D478D978C9 +78EC78F2790578F479137924791E79349F9B9EF99EFB9EFC76F17704770D76F9 +77077708771A77227719772D7726773577387750775177477743775A77680000 +EE +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +980F9810981198129813981498159816981798189819981A981B981C981D981E +981F9820982198229823982498259826982798289829982A982B982C982D982E +982F9830983198329833983498359836983798389839983A983B983C983D983E +983F9840984198429843984498459846984798489849984A984B984C984D0000 +984E984F9850985198529853985498559856985798589859985A985B985C985D +985E985F9860986198629863986498659866986798689869986A986B986C986D +986E77627765777F778D777D7780778C7791779F77A077B077B577BD753A7540 +754E754B7548755B7572757975837F587F617F5F8A487F687F747F717F797F81 +7F7E76CD76E58832948594869487948B948A948C948D948F9490949494979495 +949A949B949C94A394A494AB94AA94AD94AC94AF94B094B294B494B694B794B8 +94B994BA94BC94BD94BF94C494C894C994CA94CB94CC94CD94CE94D094D194D2 +94D594D694D794D994D894DB94DE94DF94E094E294E494E594E794E894EA0000 +EF +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +986F98709871987298739874988B988E98929895989998A398A898A998AA98AB +98AC98AD98AE98AF98B098B198B298B398B498B598B698B798B898B998BA98BB +98BC98BD98BE98BF98C098C198C298C398C498C598C698C798C898C998CA98CB +98CC98CD98CF98D098D498D698D798DB98DC98DD98E098E198E298E398E40000 +98E598E698E998EA98EB98EC98ED98EE98EF98F098F198F298F398F498F598F6 +98F798F898F998FA98FB98FC98FD98FE98FF9900990199029903990499059906 +990794E994EB94EE94EF94F394F494F594F794F994FC94FD94FF950395029506 +95079509950A950D950E950F951295139514951595169518951B951D951E951F +9522952A952B9529952C953195329534953695379538953C953E953F95429535 +9544954595469549954C954E954F9552955395549556955795589559955B955E +955F955D95619562956495659566956795689569956A956B956C956F95719572 +9573953A77E777EC96C979D579ED79E379EB7A065D477A037A027A1E7A140000 +F0 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +99089909990A990B990C990E990F991199129913991499159916991799189919 +991A991B991C991D991E991F9920992199229923992499259926992799289929 +992A992B992C992D992F9930993199329933993499359936993799389939993A +993B993C993D993E993F99409941994299439944994599469947994899490000 +994A994B994C994D994E994F99509951995299539956995799589959995A995B +995C995D995E995F99609961996299649966997399789979997B997E99829983 +99897A397A377A519ECF99A57A707688768E7693769976A474DE74E0752C9E20 +9E229E289E299E2A9E2B9E2C9E329E319E369E389E379E399E3A9E3E9E419E42 +9E449E469E479E489E499E4B9E4C9E4E9E519E559E579E5A9E5B9E5C9E5E9E63 +9E669E679E689E699E6A9E6B9E6C9E719E6D9E7375927594759675A0759D75AC +75A375B375B475B875C475B175B075C375C275D675CD75E375E875E675E475EB +75E7760375F175FC75FF761076007605760C7617760A76257618761576190000 +F1 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +998C998E999A999B999C999D999E999F99A099A199A299A399A499A699A799A9 +99AA99AB99AC99AD99AE99AF99B099B199B299B399B499B599B699B799B899B9 +99BA99BB99BC99BD99BE99BF99C099C199C299C399C499C599C699C799C899C9 +99CA99CB99CC99CD99CE99CF99D099D199D299D399D499D599D699D799D80000 +99D999DA99DB99DC99DD99DE99DF99E099E199E299E399E499E599E699E799E8 +99E999EA99EB99EC99ED99EE99EF99F099F199F299F399F499F599F699F799F8 +99F9761B763C762276207640762D7630763F76357643763E7633764D765E7654 +765C7656766B766F7FCA7AE67A787A797A807A867A887A957AA67AA07AAC7AA8 +7AAD7AB3886488698872887D887F888288A288C688B788BC88C988E288CE88E3 +88E588F1891A88FC88E888FE88F0892189198913891B890A8934892B89368941 +8966897B758B80E576B276B477DC801280148016801C80208022802580268027 +802980288031800B803580438046804D80528069807189839878988098830000 +F2 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +99FA99FB99FC99FD99FE99FF9A009A019A029A039A049A059A069A079A089A09 +9A0A9A0B9A0C9A0D9A0E9A0F9A109A119A129A139A149A159A169A179A189A19 +9A1A9A1B9A1C9A1D9A1E9A1F9A209A219A229A239A249A259A269A279A289A29 +9A2A9A2B9A2C9A2D9A2E9A2F9A309A319A329A339A349A359A369A379A380000 +9A399A3A9A3B9A3C9A3D9A3E9A3F9A409A419A429A439A449A459A469A479A48 +9A499A4A9A4B9A4C9A4D9A4E9A4F9A509A519A529A539A549A559A569A579A58 +9A599889988C988D988F9894989A989B989E989F98A198A298A598A6864D8654 +866C866E867F867A867C867B86A8868D868B86AC869D86A786A386AA869386A9 +86B686C486B586CE86B086BA86B186AF86C986CF86B486E986F186F286ED86F3 +86D0871386DE86F486DF86D886D18703870786F88708870A870D87098723873B +871E8725872E871A873E87488734873187298737873F87828722877D877E877B +87608770874C876E878B87538763877C876487598765879387AF87A887D20000 +F3 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +9A5A9A5B9A5C9A5D9A5E9A5F9A609A619A629A639A649A659A669A679A689A69 +9A6A9A6B9A729A839A899A8D9A8E9A949A959A999AA69AA99AAA9AAB9AAC9AAD +9AAE9AAF9AB29AB39AB49AB59AB99ABB9ABD9ABE9ABF9AC39AC49AC69AC79AC8 +9AC99ACA9ACD9ACE9ACF9AD09AD29AD49AD59AD69AD79AD99ADA9ADB9ADC0000 +9ADD9ADE9AE09AE29AE39AE49AE59AE79AE89AE99AEA9AEC9AEE9AF09AF19AF2 +9AF39AF49AF59AF69AF79AF89AFA9AFC9AFD9AFE9AFF9B009B019B029B049B05 +9B0687C68788878587AD8797878387AB87E587AC87B587B387CB87D387BD87D1 +87C087CA87DB87EA87E087EE8816881387FE880A881B88218839883C7F367F42 +7F447F4582107AFA7AFD7B087B037B047B157B0A7B2B7B0F7B477B387B2A7B19 +7B2E7B317B207B257B247B337B3E7B1E7B587B5A7B457B757B4C7B5D7B607B6E +7B7B7B627B727B717B907BA67BA77BB87BAC7B9D7BA87B857BAA7B9C7BA27BAB +7BB47BD17BC17BCC7BDD7BDA7BE57BE67BEA7C0C7BFE7BFC7C0F7C167C0B0000 +F4 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +9B079B099B0A9B0B9B0C9B0D9B0E9B109B119B129B149B159B169B179B189B19 +9B1A9B1B9B1C9B1D9B1E9B209B219B229B249B259B269B279B289B299B2A9B2B +9B2C9B2D9B2E9B309B319B339B349B359B369B379B389B399B3A9B3D9B3E9B3F +9B409B469B4A9B4B9B4C9B4E9B509B529B539B559B569B579B589B599B5A0000 +9B5B9B5C9B5D9B5E9B5F9B609B619B629B639B649B659B669B679B689B699B6A +9B6B9B6C9B6D9B6E9B6F9B709B719B729B739B749B759B769B779B789B799B7A +9B7B7C1F7C2A7C267C387C417C4081FE82018202820481EC8844822182228223 +822D822F8228822B8238823B82338234823E82448249824B824F825A825F8268 +887E8885888888D888DF895E7F9D7F9F7FA77FAF7FB07FB27C7C65497C917C9D +7C9C7C9E7CA27CB27CBC7CBD7CC17CC77CCC7CCD7CC87CC57CD77CE8826E66A8 +7FBF7FCE7FD57FE57FE17FE67FE97FEE7FF37CF87D777DA67DAE7E477E9B9EB8 +9EB48D738D848D948D918DB18D678D6D8C478C49914A9150914E914F91640000 +F5 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +9B7C9B7D9B7E9B7F9B809B819B829B839B849B859B869B879B889B899B8A9B8B +9B8C9B8D9B8E9B8F9B909B919B929B939B949B959B969B979B989B999B9A9B9B +9B9C9B9D9B9E9B9F9BA09BA19BA29BA39BA49BA59BA69BA79BA89BA99BAA9BAB +9BAC9BAD9BAE9BAF9BB09BB19BB29BB39BB49BB59BB69BB79BB89BB99BBA0000 +9BBB9BBC9BBD9BBE9BBF9BC09BC19BC29BC39BC49BC59BC69BC79BC89BC99BCA +9BCB9BCC9BCD9BCE9BCF9BD09BD19BD29BD39BD49BD59BD69BD79BD89BD99BDA +9BDB9162916191709169916F917D917E917291749179918C91859190918D9191 +91A291A391AA91AD91AE91AF91B591B491BA8C559E7E8DB88DEB8E058E598E69 +8DB58DBF8DBC8DBA8DC48DD68DD78DDA8DDE8DCE8DCF8DDB8DC68DEC8DF78DF8 +8DE38DF98DFB8DE48E098DFD8E148E1D8E1F8E2C8E2E8E238E2F8E3A8E408E39 +8E358E3D8E318E498E418E428E518E528E4A8E708E768E7C8E6F8E748E858E8F +8E948E908E9C8E9E8C788C828C8A8C858C988C94659B89D689DE89DA89DC0000 +F6 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +9BDC9BDD9BDE9BDF9BE09BE19BE29BE39BE49BE59BE69BE79BE89BE99BEA9BEB +9BEC9BED9BEE9BEF9BF09BF19BF29BF39BF49BF59BF69BF79BF89BF99BFA9BFB +9BFC9BFD9BFE9BFF9C009C019C029C039C049C059C069C079C089C099C0A9C0B +9C0C9C0D9C0E9C0F9C109C119C129C139C149C159C169C179C189C199C1A0000 +9C1B9C1C9C1D9C1E9C1F9C209C219C229C239C249C259C269C279C289C299C2A +9C2B9C2C9C2D9C2E9C2F9C309C319C329C339C349C359C369C379C389C399C3A +9C3B89E589EB89EF8A3E8B26975396E996F396EF970697019708970F970E972A +972D9730973E9F809F839F859F869F879F889F899F8A9F8C9EFE9F0B9F0D96B9 +96BC96BD96CE96D277BF96E0928E92AE92C8933E936A93CA938F943E946B9C7F +9C829C859C869C879C887A239C8B9C8E9C909C919C929C949C959C9A9C9B9C9E +9C9F9CA09CA19CA29CA39CA59CA69CA79CA89CA99CAB9CAD9CAE9CB09CB19CB2 +9CB39CB49CB59CB69CB79CBA9CBB9CBC9CBD9CC49CC59CC69CC79CCA9CCB0000 +F7 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +9C3C9C3D9C3E9C3F9C409C419C429C439C449C459C469C479C489C499C4A9C4B +9C4C9C4D9C4E9C4F9C509C519C529C539C549C559C569C579C589C599C5A9C5B +9C5C9C5D9C5E9C5F9C609C619C629C639C649C659C669C679C689C699C6A9C6B +9C6C9C6D9C6E9C6F9C709C719C729C739C749C759C769C779C789C799C7A0000 +9C7B9C7D9C7E9C809C839C849C899C8A9C8C9C8F9C939C969C979C989C999C9D +9CAA9CAC9CAF9CB99CBE9CBF9CC09CC19CC29CC89CC99CD19CD29CDA9CDB9CE0 +9CE19CCC9CCD9CCE9CCF9CD09CD39CD49CD59CD79CD89CD99CDC9CDD9CDF9CE2 +977C978597919792979497AF97AB97A397B297B49AB19AB09AB79E589AB69ABA +9ABC9AC19AC09AC59AC29ACB9ACC9AD19B459B439B479B499B489B4D9B5198E8 +990D992E995599549ADF9AE19AE69AEF9AEB9AFB9AED9AF99B089B0F9B139B1F +9B239EBD9EBE7E3B9E829E879E889E8B9E9293D69E9D9E9F9EDB9EDC9EDD9EE0 +9EDF9EE29EE99EE79EE59EEA9EEF9F229F2C9F2F9F399F379F3D9F3E9F440000 +F8 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +9CE39CE49CE59CE69CE79CE89CE99CEA9CEB9CEC9CED9CEE9CEF9CF09CF19CF2 +9CF39CF49CF59CF69CF79CF89CF99CFA9CFB9CFC9CFD9CFE9CFF9D009D019D02 +9D039D049D059D069D079D089D099D0A9D0B9D0C9D0D9D0E9D0F9D109D119D12 +9D139D149D159D169D179D189D199D1A9D1B9D1C9D1D9D1E9D1F9D209D210000 +9D229D239D249D259D269D279D289D299D2A9D2B9D2C9D2D9D2E9D2F9D309D31 +9D329D339D349D359D369D379D389D399D3A9D3B9D3C9D3D9D3E9D3F9D409D41 +9D42000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +F9 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +9D439D449D459D469D479D489D499D4A9D4B9D4C9D4D9D4E9D4F9D509D519D52 +9D539D549D559D569D579D589D599D5A9D5B9D5C9D5D9D5E9D5F9D609D619D62 +9D639D649D659D669D679D689D699D6A9D6B9D6C9D6D9D6E9D6F9D709D719D72 +9D739D749D759D769D779D789D799D7A9D7B9D7C9D7D9D7E9D7F9D809D810000 +9D829D839D849D859D869D879D889D899D8A9D8B9D8C9D8D9D8E9D8F9D909D91 +9D929D939D949D959D969D979D989D999D9A9D9B9D9C9D9D9D9E9D9F9DA09DA1 +9DA2000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +FA +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +9DA39DA49DA59DA69DA79DA89DA99DAA9DAB9DAC9DAD9DAE9DAF9DB09DB19DB2 +9DB39DB49DB59DB69DB79DB89DB99DBA9DBB9DBC9DBD9DBE9DBF9DC09DC19DC2 +9DC39DC49DC59DC69DC79DC89DC99DCA9DCB9DCC9DCD9DCE9DCF9DD09DD19DD2 +9DD39DD49DD59DD69DD79DD89DD99DDA9DDB9DDC9DDD9DDE9DDF9DE09DE10000 +9DE29DE39DE49DE59DE69DE79DE89DE99DEA9DEB9DEC9DED9DEE9DEF9DF09DF1 +9DF29DF39DF49DF59DF69DF79DF89DF99DFA9DFB9DFC9DFD9DFE9DFF9E009E01 +9E02000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +FB +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +9E039E049E059E069E079E089E099E0A9E0B9E0C9E0D9E0E9E0F9E109E119E12 +9E139E149E159E169E179E189E199E1A9E1B9E1C9E1D9E1E9E249E279E2E9E30 +9E349E3B9E3C9E409E4D9E509E529E539E549E569E599E5D9E5F9E609E619E62 +9E659E6E9E6F9E729E749E759E769E779E789E799E7A9E7B9E7C9E7D9E800000 +9E819E839E849E859E869E899E8A9E8C9E8D9E8E9E8F9E909E919E949E959E96 +9E979E989E999E9A9E9B9E9C9E9E9EA09EA19EA29EA39EA49EA59EA79EA89EA9 +9EAA000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +FC +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +9EAB9EAC9EAD9EAE9EAF9EB09EB19EB29EB39EB59EB69EB79EB99EBA9EBC9EBF +9EC09EC19EC29EC39EC59EC69EC79EC89ECA9ECB9ECC9ED09ED29ED39ED59ED6 +9ED79ED99EDA9EDE9EE19EE39EE49EE69EE89EEB9EEC9EED9EEE9EF09EF19EF2 +9EF39EF49EF59EF69EF79EF89EFA9EFD9EFF9F009F019F029F039F049F050000 +9F069F079F089F099F0A9F0C9F0F9F119F129F149F159F169F189F1A9F1B9F1C +9F1D9F1E9F1F9F219F239F249F259F269F279F289F299F2A9F2B9F2D9F2E9F30 +9F31000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +FD +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +9F329F339F349F359F369F389F3A9F3C9F3F9F409F419F429F439F459F469F47 +9F489F499F4A9F4B9F4C9F4D9F4E9F4F9F529F539F549F559F569F579F589F59 +9F5A9F5B9F5C9F5D9F5E9F5F9F609F619F629F639F649F659F669F679F689F69 +9F6A9F6B9F6C9F6D9F6E9F6F9F709F719F729F739F749F759F769F779F780000 +9F799F7A9F7B9F7C9F7D9F7E9F819F829F8D9F8E9F8F9F909F919F929F939F94 +9F959F969F979F989F9C9F9D9F9E9FA19FA29FA39FA49FA5F92CF979F995F9E7 +F9F1000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +FE +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +FA0CFA0DFA0EFA0FFA11FA13FA14FA18FA1FFA20FA21FA23FA24FA27FA28FA29 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 diff --git a/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/cp949.enc b/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/cp949.enc new file mode 100644 index 0000000000000000000000000000000000000000..2f3ec39f949cc2e02698cd88c42a6d09420786ea --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/cp949.enc @@ -0,0 +1,2128 @@ +# Encoding file: cp949, multi-byte +M +003F 0 125 +00 +0000000100020003000400050006000700080009000A000B000C000D000E000F +0010001100120013001400150016001700180019001A001B001C001D001E001F +0020002100220023002400250026002700280029002A002B002C002D002E002F +0030003100320033003400350036003700380039003A003B003C003D003E003F +0040004100420043004400450046004700480049004A004B004C004D004E004F +0050005100520053005400550056005700580059005A005B005C005D005E005F +0060006100620063006400650066006700680069006A006B006C006D006E006F +0070007100720073007400750076007700780079007A007B007C007D007E007F +0080000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +81 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000AC02AC03AC05AC06AC0BAC0CAC0DAC0EAC0FAC18AC1EAC1FAC21AC22AC23 +AC25AC26AC27AC28AC29AC2AAC2BAC2EAC32AC33AC3400000000000000000000 +0000AC35AC36AC37AC3AAC3BAC3DAC3EAC3FAC41AC42AC43AC44AC45AC46AC47 +AC48AC49AC4AAC4CAC4EAC4FAC50AC51AC52AC53AC5500000000000000000000 +0000AC56AC57AC59AC5AAC5BAC5DAC5EAC5FAC60AC61AC62AC63AC64AC65AC66 +AC67AC68AC69AC6AAC6BAC6CAC6DAC6EAC6FAC72AC73AC75AC76AC79AC7BAC7C +AC7DAC7EAC7FAC82AC87AC88AC8DAC8EAC8FAC91AC92AC93AC95AC96AC97AC98 +AC99AC9AAC9BAC9EACA2ACA3ACA4ACA5ACA6ACA7ACABACADACAEACB1ACB2ACB3 +ACB4ACB5ACB6ACB7ACBAACBEACBFACC0ACC2ACC3ACC5ACC6ACC7ACC9ACCAACCB +ACCDACCEACCFACD0ACD1ACD2ACD3ACD4ACD6ACD8ACD9ACDAACDBACDCACDDACDE +ACDFACE2ACE3ACE5ACE6ACE9ACEBACEDACEEACF2ACF4ACF7ACF8ACF9ACFAACFB +ACFEACFFAD01AD02AD03AD05AD07AD08AD09AD0AAD0BAD0EAD10AD12AD130000 +82 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000AD14AD15AD16AD17AD19AD1AAD1BAD1DAD1EAD1FAD21AD22AD23AD24AD25 +AD26AD27AD28AD2AAD2BAD2EAD2FAD30AD31AD32AD3300000000000000000000 +0000AD36AD37AD39AD3AAD3BAD3DAD3EAD3FAD40AD41AD42AD43AD46AD48AD4A +AD4BAD4CAD4DAD4EAD4FAD51AD52AD53AD55AD56AD5700000000000000000000 +0000AD59AD5AAD5BAD5CAD5DAD5EAD5FAD60AD62AD64AD65AD66AD67AD68AD69 +AD6AAD6BAD6EAD6FAD71AD72AD77AD78AD79AD7AAD7EAD80AD83AD84AD85AD86 +AD87AD8AAD8BAD8DAD8EAD8FAD91AD92AD93AD94AD95AD96AD97AD98AD99AD9A +AD9BAD9EAD9FADA0ADA1ADA2ADA3ADA5ADA6ADA7ADA8ADA9ADAAADABADACADAD +ADAEADAFADB0ADB1ADB2ADB3ADB4ADB5ADB6ADB8ADB9ADBAADBBADBCADBDADBE +ADBFADC2ADC3ADC5ADC6ADC7ADC9ADCAADCBADCCADCDADCEADCFADD2ADD4ADD5 +ADD6ADD7ADD8ADD9ADDAADDBADDDADDEADDFADE1ADE2ADE3ADE5ADE6ADE7ADE8 +ADE9ADEAADEBADECADEDADEEADEFADF0ADF1ADF2ADF3ADF4ADF5ADF6ADF70000 +83 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000ADFAADFBADFDADFEAE02AE03AE04AE05AE06AE07AE0AAE0CAE0EAE0FAE10 +AE11AE12AE13AE15AE16AE17AE18AE19AE1AAE1BAE1C00000000000000000000 +0000AE1DAE1EAE1FAE20AE21AE22AE23AE24AE25AE26AE27AE28AE29AE2AAE2B +AE2CAE2DAE2EAE2FAE32AE33AE35AE36AE39AE3BAE3C00000000000000000000 +0000AE3DAE3EAE3FAE42AE44AE47AE48AE49AE4BAE4FAE51AE52AE53AE55AE57 +AE58AE59AE5AAE5BAE5EAE62AE63AE64AE66AE67AE6AAE6BAE6DAE6EAE6FAE71 +AE72AE73AE74AE75AE76AE77AE7AAE7EAE7FAE80AE81AE82AE83AE86AE87AE88 +AE89AE8AAE8BAE8DAE8EAE8FAE90AE91AE92AE93AE94AE95AE96AE97AE98AE99 +AE9AAE9BAE9CAE9DAE9EAE9FAEA0AEA1AEA2AEA3AEA4AEA5AEA6AEA7AEA8AEA9 +AEAAAEABAEACAEADAEAEAEAFAEB0AEB1AEB2AEB3AEB4AEB5AEB6AEB7AEB8AEB9 +AEBAAEBBAEBFAEC1AEC2AEC3AEC5AEC6AEC7AEC8AEC9AECAAECBAECEAED2AED3 +AED4AED5AED6AED7AEDAAEDBAEDDAEDEAEDFAEE0AEE1AEE2AEE3AEE4AEE50000 +84 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000AEE6AEE7AEE9AEEAAEECAEEEAEEFAEF0AEF1AEF2AEF3AEF5AEF6AEF7AEF9 +AEFAAEFBAEFDAEFEAEFFAF00AF01AF02AF03AF04AF0500000000000000000000 +0000AF06AF09AF0AAF0BAF0CAF0EAF0FAF11AF12AF13AF14AF15AF16AF17AF18 +AF19AF1AAF1BAF1CAF1DAF1EAF1FAF20AF21AF22AF2300000000000000000000 +0000AF24AF25AF26AF27AF28AF29AF2AAF2BAF2EAF2FAF31AF33AF35AF36AF37 +AF38AF39AF3AAF3BAF3EAF40AF44AF45AF46AF47AF4AAF4BAF4CAF4DAF4EAF4F +AF51AF52AF53AF54AF55AF56AF57AF58AF59AF5AAF5BAF5EAF5FAF60AF61AF62 +AF63AF66AF67AF68AF69AF6AAF6BAF6CAF6DAF6EAF6FAF70AF71AF72AF73AF74 +AF75AF76AF77AF78AF7AAF7BAF7CAF7DAF7EAF7FAF81AF82AF83AF85AF86AF87 +AF89AF8AAF8BAF8CAF8DAF8EAF8FAF92AF93AF94AF96AF97AF98AF99AF9AAF9B +AF9DAF9EAF9FAFA0AFA1AFA2AFA3AFA4AFA5AFA6AFA7AFA8AFA9AFAAAFABAFAC +AFADAFAEAFAFAFB0AFB1AFB2AFB3AFB4AFB5AFB6AFB7AFBAAFBBAFBDAFBE0000 +85 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000AFBFAFC1AFC2AFC3AFC4AFC5AFC6AFCAAFCCAFCFAFD0AFD1AFD2AFD3AFD5 +AFD6AFD7AFD8AFD9AFDAAFDBAFDDAFDEAFDFAFE0AFE100000000000000000000 +0000AFE2AFE3AFE4AFE5AFE6AFE7AFEAAFEBAFECAFEDAFEEAFEFAFF2AFF3AFF5 +AFF6AFF7AFF9AFFAAFFBAFFCAFFDAFFEAFFFB002B00300000000000000000000 +0000B005B006B007B008B009B00AB00BB00DB00EB00FB011B012B013B015B016 +B017B018B019B01AB01BB01EB01FB020B021B022B023B024B025B026B027B029 +B02AB02BB02CB02DB02EB02FB030B031B032B033B034B035B036B037B038B039 +B03AB03BB03CB03DB03EB03FB040B041B042B043B046B047B049B04BB04DB04F +B050B051B052B056B058B05AB05BB05CB05EB05FB060B061B062B063B064B065 +B066B067B068B069B06AB06BB06CB06DB06EB06FB070B071B072B073B074B075 +B076B077B078B079B07AB07BB07EB07FB081B082B083B085B086B087B088B089 +B08AB08BB08EB090B092B093B094B095B096B097B09BB09DB09EB0A3B0A40000 +86 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000B0A5B0A6B0A7B0AAB0B0B0B2B0B6B0B7B0B9B0BAB0BBB0BDB0BEB0BFB0C0 +B0C1B0C2B0C3B0C6B0CAB0CBB0CCB0CDB0CEB0CFB0D200000000000000000000 +0000B0D3B0D5B0D6B0D7B0D9B0DAB0DBB0DCB0DDB0DEB0DFB0E1B0E2B0E3B0E4 +B0E6B0E7B0E8B0E9B0EAB0EBB0ECB0EDB0EEB0EFB0F000000000000000000000 +0000B0F1B0F2B0F3B0F4B0F5B0F6B0F7B0F8B0F9B0FAB0FBB0FCB0FDB0FEB0FF +B100B101B102B103B104B105B106B107B10AB10DB10EB10FB111B114B115B116 +B117B11AB11EB11FB120B121B122B126B127B129B12AB12BB12DB12EB12FB130 +B131B132B133B136B13AB13BB13CB13DB13EB13FB142B143B145B146B147B149 +B14AB14BB14CB14DB14EB14FB152B153B156B157B159B15AB15BB15DB15EB15F +B161B162B163B164B165B166B167B168B169B16AB16BB16CB16DB16EB16FB170 +B171B172B173B174B175B176B177B17AB17BB17DB17EB17FB181B183B184B185 +B186B187B18AB18CB18EB18FB190B191B195B196B197B199B19AB19BB19D0000 +87 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000B19EB19FB1A0B1A1B1A2B1A3B1A4B1A5B1A6B1A7B1A9B1AAB1ABB1ACB1AD +B1AEB1AFB1B0B1B1B1B2B1B3B1B4B1B5B1B6B1B7B1B800000000000000000000 +0000B1B9B1BAB1BBB1BCB1BDB1BEB1BFB1C0B1C1B1C2B1C3B1C4B1C5B1C6B1C7 +B1C8B1C9B1CAB1CBB1CDB1CEB1CFB1D1B1D2B1D3B1D500000000000000000000 +0000B1D6B1D7B1D8B1D9B1DAB1DBB1DEB1E0B1E1B1E2B1E3B1E4B1E5B1E6B1E7 +B1EAB1EBB1EDB1EEB1EFB1F1B1F2B1F3B1F4B1F5B1F6B1F7B1F8B1FAB1FCB1FE +B1FFB200B201B202B203B206B207B209B20AB20DB20EB20FB210B211B212B213 +B216B218B21AB21BB21CB21DB21EB21FB221B222B223B224B225B226B227B228 +B229B22AB22BB22CB22DB22EB22FB230B231B232B233B235B236B237B238B239 +B23AB23BB23DB23EB23FB240B241B242B243B244B245B246B247B248B249B24A +B24BB24CB24DB24EB24FB250B251B252B253B254B255B256B257B259B25AB25B +B25DB25EB25FB261B262B263B264B265B266B267B26AB26BB26CB26DB26E0000 +88 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000B26FB270B271B272B273B276B277B278B279B27AB27BB27DB27EB27FB280 +B281B282B283B286B287B288B28AB28BB28CB28DB28E00000000000000000000 +0000B28FB292B293B295B296B297B29BB29CB29DB29EB29FB2A2B2A4B2A7B2A8 +B2A9B2ABB2ADB2AEB2AFB2B1B2B2B2B3B2B5B2B6B2B700000000000000000000 +0000B2B8B2B9B2BAB2BBB2BCB2BDB2BEB2BFB2C0B2C1B2C2B2C3B2C4B2C5B2C6 +B2C7B2CAB2CBB2CDB2CEB2CFB2D1B2D3B2D4B2D5B2D6B2D7B2DAB2DCB2DEB2DF +B2E0B2E1B2E3B2E7B2E9B2EAB2F0B2F1B2F2B2F6B2FCB2FDB2FEB302B303B305 +B306B307B309B30AB30BB30CB30DB30EB30FB312B316B317B318B319B31AB31B +B31DB31EB31FB320B321B322B323B324B325B326B327B328B329B32AB32BB32C +B32DB32EB32FB330B331B332B333B334B335B336B337B338B339B33AB33BB33C +B33DB33EB33FB340B341B342B343B344B345B346B347B348B349B34AB34BB34C +B34DB34EB34FB350B351B352B353B357B359B35AB35DB360B361B362B3630000 +89 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000B366B368B36AB36CB36DB36FB372B373B375B376B377B379B37AB37BB37C +B37DB37EB37FB382B386B387B388B389B38AB38BB38D00000000000000000000 +0000B38EB38FB391B392B393B395B396B397B398B399B39AB39BB39CB39DB39E +B39FB3A2B3A3B3A4B3A5B3A6B3A7B3A9B3AAB3ABB3AD00000000000000000000 +0000B3AEB3AFB3B0B3B1B3B2B3B3B3B4B3B5B3B6B3B7B3B8B3B9B3BAB3BBB3BC +B3BDB3BEB3BFB3C0B3C1B3C2B3C3B3C6B3C7B3C9B3CAB3CDB3CFB3D1B3D2B3D3 +B3D6B3D8B3DAB3DCB3DEB3DFB3E1B3E2B3E3B3E5B3E6B3E7B3E9B3EAB3EBB3EC +B3EDB3EEB3EFB3F0B3F1B3F2B3F3B3F4B3F5B3F6B3F7B3F8B3F9B3FAB3FBB3FD +B3FEB3FFB400B401B402B403B404B405B406B407B408B409B40AB40BB40CB40D +B40EB40FB411B412B413B414B415B416B417B419B41AB41BB41DB41EB41FB421 +B422B423B424B425B426B427B42AB42CB42DB42EB42FB430B431B432B433B435 +B436B437B438B439B43AB43BB43CB43DB43EB43FB440B441B442B443B4440000 +8A +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000B445B446B447B448B449B44AB44BB44CB44DB44EB44FB452B453B455B456 +B457B459B45AB45BB45CB45DB45EB45FB462B464B46600000000000000000000 +0000B467B468B469B46AB46BB46DB46EB46FB470B471B472B473B474B475B476 +B477B478B479B47AB47BB47CB47DB47EB47FB481B48200000000000000000000 +0000B483B484B485B486B487B489B48AB48BB48CB48DB48EB48FB490B491B492 +B493B494B495B496B497B498B499B49AB49BB49CB49EB49FB4A0B4A1B4A2B4A3 +B4A5B4A6B4A7B4A9B4AAB4ABB4ADB4AEB4AFB4B0B4B1B4B2B4B3B4B4B4B6B4B8 +B4BAB4BBB4BCB4BDB4BEB4BFB4C1B4C2B4C3B4C5B4C6B4C7B4C9B4CAB4CBB4CC +B4CDB4CEB4CFB4D1B4D2B4D3B4D4B4D6B4D7B4D8B4D9B4DAB4DBB4DEB4DFB4E1 +B4E2B4E5B4E7B4E8B4E9B4EAB4EBB4EEB4F0B4F2B4F3B4F4B4F5B4F6B4F7B4F9 +B4FAB4FBB4FCB4FDB4FEB4FFB500B501B502B503B504B505B506B507B508B509 +B50AB50BB50CB50DB50EB50FB510B511B512B513B516B517B519B51AB51D0000 +8B +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000B51EB51FB520B521B522B523B526B52BB52CB52DB52EB52FB532B533B535 +B536B537B539B53AB53BB53CB53DB53EB53FB542B54600000000000000000000 +0000B547B548B549B54AB54EB54FB551B552B553B555B556B557B558B559B55A +B55BB55EB562B563B564B565B566B567B568B569B56A00000000000000000000 +0000B56BB56CB56DB56EB56FB570B571B572B573B574B575B576B577B578B579 +B57AB57BB57CB57DB57EB57FB580B581B582B583B584B585B586B587B588B589 +B58AB58BB58CB58DB58EB58FB590B591B592B593B594B595B596B597B598B599 +B59AB59BB59CB59DB59EB59FB5A2B5A3B5A5B5A6B5A7B5A9B5ACB5ADB5AEB5AF +B5B2B5B6B5B7B5B8B5B9B5BAB5BEB5BFB5C1B5C2B5C3B5C5B5C6B5C7B5C8B5C9 +B5CAB5CBB5CEB5D2B5D3B5D4B5D5B5D6B5D7B5D9B5DAB5DBB5DCB5DDB5DEB5DF +B5E0B5E1B5E2B5E3B5E4B5E5B5E6B5E7B5E8B5E9B5EAB5EBB5EDB5EEB5EFB5F0 +B5F1B5F2B5F3B5F4B5F5B5F6B5F7B5F8B5F9B5FAB5FBB5FCB5FDB5FEB5FF0000 +8C +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000B600B601B602B603B604B605B606B607B608B609B60AB60BB60CB60DB60E +B60FB612B613B615B616B617B619B61AB61BB61CB61D00000000000000000000 +0000B61EB61FB620B621B622B623B624B626B627B628B629B62AB62BB62DB62E +B62FB630B631B632B633B635B636B637B638B639B63A00000000000000000000 +0000B63BB63CB63DB63EB63FB640B641B642B643B644B645B646B647B649B64A +B64BB64CB64DB64EB64FB650B651B652B653B654B655B656B657B658B659B65A +B65BB65CB65DB65EB65FB660B661B662B663B665B666B667B669B66AB66BB66C +B66DB66EB66FB670B671B672B673B674B675B676B677B678B679B67AB67BB67C +B67DB67EB67FB680B681B682B683B684B685B686B687B688B689B68AB68BB68C +B68DB68EB68FB690B691B692B693B694B695B696B697B698B699B69AB69BB69E +B69FB6A1B6A2B6A3B6A5B6A6B6A7B6A8B6A9B6AAB6ADB6AEB6AFB6B0B6B2B6B3 +B6B4B6B5B6B6B6B7B6B8B6B9B6BAB6BBB6BCB6BDB6BEB6BFB6C0B6C1B6C20000 +8D +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000B6C3B6C4B6C5B6C6B6C7B6C8B6C9B6CAB6CBB6CCB6CDB6CEB6CFB6D0B6D1 +B6D2B6D3B6D5B6D6B6D7B6D8B6D9B6DAB6DBB6DCB6DD00000000000000000000 +0000B6DEB6DFB6E0B6E1B6E2B6E3B6E4B6E5B6E6B6E7B6E8B6E9B6EAB6EBB6EC +B6EDB6EEB6EFB6F1B6F2B6F3B6F5B6F6B6F7B6F9B6FA00000000000000000000 +0000B6FBB6FCB6FDB6FEB6FFB702B703B704B706B707B708B709B70AB70BB70C +B70DB70EB70FB710B711B712B713B714B715B716B717B718B719B71AB71BB71C +B71DB71EB71FB720B721B722B723B724B725B726B727B72AB72BB72DB72EB731 +B732B733B734B735B736B737B73AB73CB73DB73EB73FB740B741B742B743B745 +B746B747B749B74AB74BB74DB74EB74FB750B751B752B753B756B757B758B759 +B75AB75BB75CB75DB75EB75FB761B762B763B765B766B767B769B76AB76BB76C +B76DB76EB76FB772B774B776B777B778B779B77AB77BB77EB77FB781B782B783 +B785B786B787B788B789B78AB78BB78EB793B794B795B79AB79BB79DB79E0000 +8E +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000B79FB7A1B7A2B7A3B7A4B7A5B7A6B7A7B7AAB7AEB7AFB7B0B7B1B7B2B7B3 +B7B6B7B7B7B9B7BAB7BBB7BCB7BDB7BEB7BFB7C0B7C100000000000000000000 +0000B7C2B7C3B7C4B7C5B7C6B7C8B7CAB7CBB7CCB7CDB7CEB7CFB7D0B7D1B7D2 +B7D3B7D4B7D5B7D6B7D7B7D8B7D9B7DAB7DBB7DCB7DD00000000000000000000 +0000B7DEB7DFB7E0B7E1B7E2B7E3B7E4B7E5B7E6B7E7B7E8B7E9B7EAB7EBB7EE +B7EFB7F1B7F2B7F3B7F5B7F6B7F7B7F8B7F9B7FAB7FBB7FEB802B803B804B805 +B806B80AB80BB80DB80EB80FB811B812B813B814B815B816B817B81AB81CB81E +B81FB820B821B822B823B826B827B829B82AB82BB82DB82EB82FB830B831B832 +B833B836B83AB83BB83CB83DB83EB83FB841B842B843B845B846B847B848B849 +B84AB84BB84CB84DB84EB84FB850B852B854B855B856B857B858B859B85AB85B +B85EB85FB861B862B863B865B866B867B868B869B86AB86BB86EB870B872B873 +B874B875B876B877B879B87AB87BB87DB87EB87FB880B881B882B883B8840000 +8F +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000B885B886B887B888B889B88AB88BB88CB88EB88FB890B891B892B893B894 +B895B896B897B898B899B89AB89BB89CB89DB89EB89F00000000000000000000 +0000B8A0B8A1B8A2B8A3B8A4B8A5B8A6B8A7B8A9B8AAB8ABB8ACB8ADB8AEB8AF +B8B1B8B2B8B3B8B5B8B6B8B7B8B9B8BAB8BBB8BCB8BD00000000000000000000 +0000B8BEB8BFB8C2B8C4B8C6B8C7B8C8B8C9B8CAB8CBB8CDB8CEB8CFB8D1B8D2 +B8D3B8D5B8D6B8D7B8D8B8D9B8DAB8DBB8DCB8DEB8E0B8E2B8E3B8E4B8E5B8E6 +B8E7B8EAB8EBB8EDB8EEB8EFB8F1B8F2B8F3B8F4B8F5B8F6B8F7B8FAB8FCB8FE +B8FFB900B901B902B903B905B906B907B908B909B90AB90BB90CB90DB90EB90F +B910B911B912B913B914B915B916B917B919B91AB91BB91CB91DB91EB91FB921 +B922B923B924B925B926B927B928B929B92AB92BB92CB92DB92EB92FB930B931 +B932B933B934B935B936B937B938B939B93AB93BB93EB93FB941B942B943B945 +B946B947B948B949B94AB94BB94DB94EB950B952B953B954B955B956B9570000 +90 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000B95AB95BB95DB95EB95FB961B962B963B964B965B966B967B96AB96CB96E +B96FB970B971B972B973B976B977B979B97AB97BB97D00000000000000000000 +0000B97EB97FB980B981B982B983B986B988B98BB98CB98FB990B991B992B993 +B994B995B996B997B998B999B99AB99BB99CB99DB99E00000000000000000000 +0000B99FB9A0B9A1B9A2B9A3B9A4B9A5B9A6B9A7B9A8B9A9B9AAB9ABB9AEB9AF +B9B1B9B2B9B3B9B5B9B6B9B7B9B8B9B9B9BAB9BBB9BEB9C0B9C2B9C3B9C4B9C5 +B9C6B9C7B9CAB9CBB9CDB9D3B9D4B9D5B9D6B9D7B9DAB9DCB9DFB9E0B9E2B9E6 +B9E7B9E9B9EAB9EBB9EDB9EEB9EFB9F0B9F1B9F2B9F3B9F6B9FBB9FCB9FDB9FE +B9FFBA02BA03BA04BA05BA06BA07BA09BA0ABA0BBA0CBA0DBA0EBA0FBA10BA11 +BA12BA13BA14BA16BA17BA18BA19BA1ABA1BBA1CBA1DBA1EBA1FBA20BA21BA22 +BA23BA24BA25BA26BA27BA28BA29BA2ABA2BBA2CBA2DBA2EBA2FBA30BA31BA32 +BA33BA34BA35BA36BA37BA3ABA3BBA3DBA3EBA3FBA41BA43BA44BA45BA460000 +91 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000BA47BA4ABA4CBA4FBA50BA51BA52BA56BA57BA59BA5ABA5BBA5DBA5EBA5F +BA60BA61BA62BA63BA66BA6ABA6BBA6CBA6DBA6EBA6F00000000000000000000 +0000BA72BA73BA75BA76BA77BA79BA7ABA7BBA7CBA7DBA7EBA7FBA80BA81BA82 +BA86BA88BA89BA8ABA8BBA8DBA8EBA8FBA90BA91BA9200000000000000000000 +0000BA93BA94BA95BA96BA97BA98BA99BA9ABA9BBA9CBA9DBA9EBA9FBAA0BAA1 +BAA2BAA3BAA4BAA5BAA6BAA7BAAABAADBAAEBAAFBAB1BAB3BAB4BAB5BAB6BAB7 +BABABABCBABEBABFBAC0BAC1BAC2BAC3BAC5BAC6BAC7BAC9BACABACBBACCBACD +BACEBACFBAD0BAD1BAD2BAD3BAD4BAD5BAD6BAD7BADABADBBADCBADDBADEBADF +BAE0BAE1BAE2BAE3BAE4BAE5BAE6BAE7BAE8BAE9BAEABAEBBAECBAEDBAEEBAEF +BAF0BAF1BAF2BAF3BAF4BAF5BAF6BAF7BAF8BAF9BAFABAFBBAFDBAFEBAFFBB01 +BB02BB03BB05BB06BB07BB08BB09BB0ABB0BBB0CBB0EBB10BB12BB13BB14BB15 +BB16BB17BB19BB1ABB1BBB1DBB1EBB1FBB21BB22BB23BB24BB25BB26BB270000 +92 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000BB28BB2ABB2CBB2DBB2EBB2FBB30BB31BB32BB33BB37BB39BB3ABB3FBB40 +BB41BB42BB43BB46BB48BB4ABB4BBB4CBB4EBB51BB5200000000000000000000 +0000BB53BB55BB56BB57BB59BB5ABB5BBB5CBB5DBB5EBB5FBB60BB62BB64BB65 +BB66BB67BB68BB69BB6ABB6BBB6DBB6EBB6FBB70BB7100000000000000000000 +0000BB72BB73BB74BB75BB76BB77BB78BB79BB7ABB7BBB7CBB7DBB7EBB7FBB80 +BB81BB82BB83BB84BB85BB86BB87BB89BB8ABB8BBB8DBB8EBB8FBB91BB92BB93 +BB94BB95BB96BB97BB98BB99BB9ABB9BBB9CBB9DBB9EBB9FBBA0BBA1BBA2BBA3 +BBA5BBA6BBA7BBA9BBAABBABBBADBBAEBBAFBBB0BBB1BBB2BBB3BBB5BBB6BBB8 +BBB9BBBABBBBBBBCBBBDBBBEBBBFBBC1BBC2BBC3BBC5BBC6BBC7BBC9BBCABBCB +BBCCBBCDBBCEBBCFBBD1BBD2BBD4BBD5BBD6BBD7BBD8BBD9BBDABBDBBBDCBBDD +BBDEBBDFBBE0BBE1BBE2BBE3BBE4BBE5BBE6BBE7BBE8BBE9BBEABBEBBBECBBED +BBEEBBEFBBF0BBF1BBF2BBF3BBF4BBF5BBF6BBF7BBFABBFBBBFDBBFEBC010000 +93 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000BC03BC04BC05BC06BC07BC0ABC0EBC10BC12BC13BC19BC1ABC20BC21BC22 +BC23BC26BC28BC2ABC2BBC2CBC2EBC2FBC32BC33BC3500000000000000000000 +0000BC36BC37BC39BC3ABC3BBC3CBC3DBC3EBC3FBC42BC46BC47BC48BC4ABC4B +BC4EBC4FBC51BC52BC53BC54BC55BC56BC57BC58BC5900000000000000000000 +0000BC5ABC5BBC5CBC5EBC5FBC60BC61BC62BC63BC64BC65BC66BC67BC68BC69 +BC6ABC6BBC6CBC6DBC6EBC6FBC70BC71BC72BC73BC74BC75BC76BC77BC78BC79 +BC7ABC7BBC7CBC7DBC7EBC7FBC80BC81BC82BC83BC86BC87BC89BC8ABC8DBC8F +BC90BC91BC92BC93BC96BC98BC9BBC9CBC9DBC9EBC9FBCA2BCA3BCA5BCA6BCA9 +BCAABCABBCACBCADBCAEBCAFBCB2BCB6BCB7BCB8BCB9BCBABCBBBCBEBCBFBCC1 +BCC2BCC3BCC5BCC6BCC7BCC8BCC9BCCABCCBBCCCBCCEBCD2BCD3BCD4BCD6BCD7 +BCD9BCDABCDBBCDDBCDEBCDFBCE0BCE1BCE2BCE3BCE4BCE5BCE6BCE7BCE8BCE9 +BCEABCEBBCECBCEDBCEEBCEFBCF0BCF1BCF2BCF3BCF7BCF9BCFABCFBBCFD0000 +94 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000BCFEBCFFBD00BD01BD02BD03BD06BD08BD0ABD0BBD0CBD0DBD0EBD0FBD11 +BD12BD13BD15BD16BD17BD18BD19BD1ABD1BBD1CBD1D00000000000000000000 +0000BD1EBD1FBD20BD21BD22BD23BD25BD26BD27BD28BD29BD2ABD2BBD2DBD2E +BD2FBD30BD31BD32BD33BD34BD35BD36BD37BD38BD3900000000000000000000 +0000BD3ABD3BBD3CBD3DBD3EBD3FBD41BD42BD43BD44BD45BD46BD47BD4ABD4B +BD4DBD4EBD4FBD51BD52BD53BD54BD55BD56BD57BD5ABD5BBD5CBD5DBD5EBD5F +BD60BD61BD62BD63BD65BD66BD67BD69BD6ABD6BBD6CBD6DBD6EBD6FBD70BD71 +BD72BD73BD74BD75BD76BD77BD78BD79BD7ABD7BBD7CBD7DBD7EBD7FBD82BD83 +BD85BD86BD8BBD8CBD8DBD8EBD8FBD92BD94BD96BD97BD98BD9BBD9DBD9EBD9F +BDA0BDA1BDA2BDA3BDA5BDA6BDA7BDA8BDA9BDAABDABBDACBDADBDAEBDAFBDB1 +BDB2BDB3BDB4BDB5BDB6BDB7BDB9BDBABDBBBDBCBDBDBDBEBDBFBDC0BDC1BDC2 +BDC3BDC4BDC5BDC6BDC7BDC8BDC9BDCABDCBBDCCBDCDBDCEBDCFBDD0BDD10000 +95 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000BDD2BDD3BDD6BDD7BDD9BDDABDDBBDDDBDDEBDDFBDE0BDE1BDE2BDE3BDE4 +BDE5BDE6BDE7BDE8BDEABDEBBDECBDEDBDEEBDEFBDF100000000000000000000 +0000BDF2BDF3BDF5BDF6BDF7BDF9BDFABDFBBDFCBDFDBDFEBDFFBE01BE02BE04 +BE06BE07BE08BE09BE0ABE0BBE0EBE0FBE11BE12BE1300000000000000000000 +0000BE15BE16BE17BE18BE19BE1ABE1BBE1EBE20BE21BE22BE23BE24BE25BE26 +BE27BE28BE29BE2ABE2BBE2CBE2DBE2EBE2FBE30BE31BE32BE33BE34BE35BE36 +BE37BE38BE39BE3ABE3BBE3CBE3DBE3EBE3FBE40BE41BE42BE43BE46BE47BE49 +BE4ABE4BBE4DBE4FBE50BE51BE52BE53BE56BE58BE5CBE5DBE5EBE5FBE62BE63 +BE65BE66BE67BE69BE6BBE6CBE6DBE6EBE6FBE72BE76BE77BE78BE79BE7ABE7E +BE7FBE81BE82BE83BE85BE86BE87BE88BE89BE8ABE8BBE8EBE92BE93BE94BE95 +BE96BE97BE9ABE9BBE9CBE9DBE9EBE9FBEA0BEA1BEA2BEA3BEA4BEA5BEA6BEA7 +BEA9BEAABEABBEACBEADBEAEBEAFBEB0BEB1BEB2BEB3BEB4BEB5BEB6BEB70000 +96 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000BEB8BEB9BEBABEBBBEBCBEBDBEBEBEBFBEC0BEC1BEC2BEC3BEC4BEC5BEC6 +BEC7BEC8BEC9BECABECBBECCBECDBECEBECFBED2BED300000000000000000000 +0000BED5BED6BED9BEDABEDBBEDCBEDDBEDEBEDFBEE1BEE2BEE6BEE7BEE8BEE9 +BEEABEEBBEEDBEEEBEEFBEF0BEF1BEF2BEF3BEF4BEF500000000000000000000 +0000BEF6BEF7BEF8BEF9BEFABEFBBEFCBEFDBEFEBEFFBF00BF02BF03BF04BF05 +BF06BF07BF0ABF0BBF0CBF0DBF0EBF0FBF10BF11BF12BF13BF14BF15BF16BF17 +BF1ABF1EBF1FBF20BF21BF22BF23BF24BF25BF26BF27BF28BF29BF2ABF2BBF2C +BF2DBF2EBF2FBF30BF31BF32BF33BF34BF35BF36BF37BF38BF39BF3ABF3BBF3C +BF3DBF3EBF3FBF42BF43BF45BF46BF47BF49BF4ABF4BBF4CBF4DBF4EBF4FBF52 +BF53BF54BF56BF57BF58BF59BF5ABF5BBF5CBF5DBF5EBF5FBF60BF61BF62BF63 +BF64BF65BF66BF67BF68BF69BF6ABF6BBF6CBF6DBF6EBF6FBF70BF71BF72BF73 +BF74BF75BF76BF77BF78BF79BF7ABF7BBF7CBF7DBF7EBF7FBF80BF81BF820000 +97 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000BF83BF84BF85BF86BF87BF88BF89BF8ABF8BBF8CBF8DBF8EBF8FBF90BF91 +BF92BF93BF95BF96BF97BF98BF99BF9ABF9BBF9CBF9D00000000000000000000 +0000BF9EBF9FBFA0BFA1BFA2BFA3BFA4BFA5BFA6BFA7BFA8BFA9BFAABFABBFAC +BFADBFAEBFAFBFB1BFB2BFB3BFB4BFB5BFB6BFB7BFB800000000000000000000 +0000BFB9BFBABFBBBFBCBFBDBFBEBFBFBFC0BFC1BFC2BFC3BFC4BFC6BFC7BFC8 +BFC9BFCABFCBBFCEBFCFBFD1BFD2BFD3BFD5BFD6BFD7BFD8BFD9BFDABFDBBFDD +BFDEBFE0BFE2BFE3BFE4BFE5BFE6BFE7BFE8BFE9BFEABFEBBFECBFEDBFEEBFEF +BFF0BFF1BFF2BFF3BFF4BFF5BFF6BFF7BFF8BFF9BFFABFFBBFFCBFFDBFFEBFFF +C000C001C002C003C004C005C006C007C008C009C00AC00BC00CC00DC00EC00F +C010C011C012C013C014C015C016C017C018C019C01AC01BC01CC01DC01EC01F +C020C021C022C023C024C025C026C027C028C029C02AC02BC02CC02DC02EC02F +C030C031C032C033C034C035C036C037C038C039C03AC03BC03DC03EC03F0000 +98 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000C040C041C042C043C044C045C046C047C048C049C04AC04BC04CC04DC04E +C04FC050C052C053C054C055C056C057C059C05AC05B00000000000000000000 +0000C05DC05EC05FC061C062C063C064C065C066C067C06AC06BC06CC06DC06E +C06FC070C071C072C073C074C075C076C077C078C07900000000000000000000 +0000C07AC07BC07CC07DC07EC07FC080C081C082C083C084C085C086C087C088 +C089C08AC08BC08CC08DC08EC08FC092C093C095C096C097C099C09AC09BC09C +C09DC09EC09FC0A2C0A4C0A6C0A7C0A8C0A9C0AAC0ABC0AEC0B1C0B2C0B7C0B8 +C0B9C0BAC0BBC0BEC0C2C0C3C0C4C0C6C0C7C0CAC0CBC0CDC0CEC0CFC0D1C0D2 +C0D3C0D4C0D5C0D6C0D7C0DAC0DEC0DFC0E0C0E1C0E2C0E3C0E6C0E7C0E9C0EA +C0EBC0EDC0EEC0EFC0F0C0F1C0F2C0F3C0F6C0F8C0FAC0FBC0FCC0FDC0FEC0FF +C101C102C103C105C106C107C109C10AC10BC10CC10DC10EC10FC111C112C113 +C114C116C117C118C119C11AC11BC121C122C125C128C129C12AC12BC12E0000 +99 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000C132C133C134C135C137C13AC13BC13DC13EC13FC141C142C143C144C145 +C146C147C14AC14EC14FC150C151C152C153C156C15700000000000000000000 +0000C159C15AC15BC15DC15EC15FC160C161C162C163C166C16AC16BC16CC16D +C16EC16FC171C172C173C175C176C177C179C17AC17B00000000000000000000 +0000C17CC17DC17EC17FC180C181C182C183C184C186C187C188C189C18AC18B +C18FC191C192C193C195C197C198C199C19AC19BC19EC1A0C1A2C1A3C1A4C1A6 +C1A7C1AAC1ABC1ADC1AEC1AFC1B1C1B2C1B3C1B4C1B5C1B6C1B7C1B8C1B9C1BA +C1BBC1BCC1BEC1BFC1C0C1C1C1C2C1C3C1C5C1C6C1C7C1C9C1CAC1CBC1CDC1CE +C1CFC1D0C1D1C1D2C1D3C1D5C1D6C1D9C1DAC1DBC1DCC1DDC1DEC1DFC1E1C1E2 +C1E3C1E5C1E6C1E7C1E9C1EAC1EBC1ECC1EDC1EEC1EFC1F2C1F4C1F5C1F6C1F7 +C1F8C1F9C1FAC1FBC1FEC1FFC201C202C203C205C206C207C208C209C20AC20B +C20EC210C212C213C214C215C216C217C21AC21BC21DC21EC221C222C2230000 +9A +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000C224C225C226C227C22AC22CC22EC230C233C235C236C237C238C239C23A +C23BC23CC23DC23EC23FC240C241C242C243C244C24500000000000000000000 +0000C246C247C249C24AC24BC24CC24DC24EC24FC252C253C255C256C257C259 +C25AC25BC25CC25DC25EC25FC261C262C263C264C26600000000000000000000 +0000C267C268C269C26AC26BC26EC26FC271C272C273C275C276C277C278C279 +C27AC27BC27EC280C282C283C284C285C286C287C28AC28BC28CC28DC28EC28F +C291C292C293C294C295C296C297C299C29AC29CC29EC29FC2A0C2A1C2A2C2A3 +C2A6C2A7C2A9C2AAC2ABC2AEC2AFC2B0C2B1C2B2C2B3C2B6C2B8C2BAC2BBC2BC +C2BDC2BEC2BFC2C0C2C1C2C2C2C3C2C4C2C5C2C6C2C7C2C8C2C9C2CAC2CBC2CC +C2CDC2CEC2CFC2D0C2D1C2D2C2D3C2D4C2D5C2D6C2D7C2D8C2D9C2DAC2DBC2DE +C2DFC2E1C2E2C2E5C2E6C2E7C2E8C2E9C2EAC2EEC2F0C2F2C2F3C2F4C2F5C2F7 +C2FAC2FDC2FEC2FFC301C302C303C304C305C306C307C30AC30BC30EC30F0000 +9B +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000C310C311C312C316C317C319C31AC31BC31DC31EC31FC320C321C322C323 +C326C327C32AC32BC32CC32DC32EC32FC330C331C33200000000000000000000 +0000C333C334C335C336C337C338C339C33AC33BC33CC33DC33EC33FC340C341 +C342C343C344C346C347C348C349C34AC34BC34CC34D00000000000000000000 +0000C34EC34FC350C351C352C353C354C355C356C357C358C359C35AC35BC35C +C35DC35EC35FC360C361C362C363C364C365C366C367C36AC36BC36DC36EC36F +C371C373C374C375C376C377C37AC37BC37EC37FC380C381C382C383C385C386 +C387C389C38AC38BC38DC38EC38FC390C391C392C393C394C395C396C397C398 +C399C39AC39BC39CC39DC39EC39FC3A0C3A1C3A2C3A3C3A4C3A5C3A6C3A7C3A8 +C3A9C3AAC3ABC3ACC3ADC3AEC3AFC3B0C3B1C3B2C3B3C3B4C3B5C3B6C3B7C3B8 +C3B9C3BAC3BBC3BCC3BDC3BEC3BFC3C1C3C2C3C3C3C4C3C5C3C6C3C7C3C8C3C9 +C3CAC3CBC3CCC3CDC3CEC3CFC3D0C3D1C3D2C3D3C3D4C3D5C3D6C3D7C3DA0000 +9C +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000C3DBC3DDC3DEC3E1C3E3C3E4C3E5C3E6C3E7C3EAC3EBC3ECC3EEC3EFC3F0 +C3F1C3F2C3F3C3F6C3F7C3F9C3FAC3FBC3FCC3FDC3FE00000000000000000000 +0000C3FFC400C401C402C403C404C405C406C407C409C40AC40BC40CC40DC40E +C40FC411C412C413C414C415C416C417C418C419C41A00000000000000000000 +0000C41BC41CC41DC41EC41FC420C421C422C423C425C426C427C428C429C42A +C42BC42DC42EC42FC431C432C433C435C436C437C438C439C43AC43BC43EC43F +C440C441C442C443C444C445C446C447C449C44AC44BC44CC44DC44EC44FC450 +C451C452C453C454C455C456C457C458C459C45AC45BC45CC45DC45EC45FC460 +C461C462C463C466C467C469C46AC46BC46DC46EC46FC470C471C472C473C476 +C477C478C47AC47BC47CC47DC47EC47FC481C482C483C484C485C486C487C488 +C489C48AC48BC48CC48DC48EC48FC490C491C492C493C495C496C497C498C499 +C49AC49BC49DC49EC49FC4A0C4A1C4A2C4A3C4A4C4A5C4A6C4A7C4A8C4A90000 +9D +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000C4AAC4ABC4ACC4ADC4AEC4AFC4B0C4B1C4B2C4B3C4B4C4B5C4B6C4B7C4B9 +C4BAC4BBC4BDC4BEC4BFC4C0C4C1C4C2C4C3C4C4C4C500000000000000000000 +0000C4C6C4C7C4C8C4C9C4CAC4CBC4CCC4CDC4CEC4CFC4D0C4D1C4D2C4D3C4D4 +C4D5C4D6C4D7C4D8C4D9C4DAC4DBC4DCC4DDC4DEC4DF00000000000000000000 +0000C4E0C4E1C4E2C4E3C4E4C4E5C4E6C4E7C4E8C4EAC4EBC4ECC4EDC4EEC4EF +C4F2C4F3C4F5C4F6C4F7C4F9C4FBC4FCC4FDC4FEC502C503C504C505C506C507 +C508C509C50AC50BC50DC50EC50FC511C512C513C515C516C517C518C519C51A +C51BC51DC51EC51FC520C521C522C523C524C525C526C527C52AC52BC52DC52E +C52FC531C532C533C534C535C536C537C53AC53CC53EC53FC540C541C542C543 +C546C547C54BC54FC550C551C552C556C55AC55BC55CC55FC562C563C565C566 +C567C569C56AC56BC56CC56DC56EC56FC572C576C577C578C579C57AC57BC57E +C57FC581C582C583C585C586C588C589C58AC58BC58EC590C592C593C5940000 +9E +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000C596C599C59AC59BC59DC59EC59FC5A1C5A2C5A3C5A4C5A5C5A6C5A7C5A8 +C5AAC5ABC5ACC5ADC5AEC5AFC5B0C5B1C5B2C5B3C5B600000000000000000000 +0000C5B7C5BAC5BFC5C0C5C1C5C2C5C3C5CBC5CDC5CFC5D2C5D3C5D5C5D6C5D7 +C5D9C5DAC5DBC5DCC5DDC5DEC5DFC5E2C5E4C5E6C5E700000000000000000000 +0000C5E8C5E9C5EAC5EBC5EFC5F1C5F2C5F3C5F5C5F8C5F9C5FAC5FBC602C603 +C604C609C60AC60BC60DC60EC60FC611C612C613C614C615C616C617C61AC61D +C61EC61FC620C621C622C623C626C627C629C62AC62BC62FC631C632C636C638 +C63AC63CC63DC63EC63FC642C643C645C646C647C649C64AC64BC64CC64DC64E +C64FC652C656C657C658C659C65AC65BC65EC65FC661C662C663C664C665C666 +C667C668C669C66AC66BC66DC66EC670C672C673C674C675C676C677C67AC67B +C67DC67EC67FC681C682C683C684C685C686C687C68AC68CC68EC68FC690C691 +C692C693C696C697C699C69AC69BC69DC69EC69FC6A0C6A1C6A2C6A3C6A60000 +9F +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000C6A8C6AAC6ABC6ACC6ADC6AEC6AFC6B2C6B3C6B5C6B6C6B7C6BBC6BCC6BD +C6BEC6BFC6C2C6C4C6C6C6C7C6C8C6C9C6CAC6CBC6CE00000000000000000000 +0000C6CFC6D1C6D2C6D3C6D5C6D6C6D7C6D8C6D9C6DAC6DBC6DEC6DFC6E2C6E3 +C6E4C6E5C6E6C6E7C6EAC6EBC6EDC6EEC6EFC6F1C6F200000000000000000000 +0000C6F3C6F4C6F5C6F6C6F7C6FAC6FBC6FCC6FEC6FFC700C701C702C703C706 +C707C709C70AC70BC70DC70EC70FC710C711C712C713C716C718C71AC71BC71C +C71DC71EC71FC722C723C725C726C727C729C72AC72BC72CC72DC72EC72FC732 +C734C736C738C739C73AC73BC73EC73FC741C742C743C745C746C747C748C749 +C74BC74EC750C759C75AC75BC75DC75EC75FC761C762C763C764C765C766C767 +C769C76AC76CC76DC76EC76FC770C771C772C773C776C777C779C77AC77BC77F +C780C781C782C786C78BC78CC78DC78FC792C793C795C799C79BC79CC79DC79E +C79FC7A2C7A7C7A8C7A9C7AAC7ABC7AEC7AFC7B1C7B2C7B3C7B5C7B6C7B70000 +A0 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000C7B8C7B9C7BAC7BBC7BEC7C2C7C3C7C4C7C5C7C6C7C7C7CAC7CBC7CDC7CF +C7D1C7D2C7D3C7D4C7D5C7D6C7D7C7D9C7DAC7DBC7DC00000000000000000000 +0000C7DEC7DFC7E0C7E1C7E2C7E3C7E5C7E6C7E7C7E9C7EAC7EBC7EDC7EEC7EF +C7F0C7F1C7F2C7F3C7F4C7F5C7F6C7F7C7F8C7F9C7FA00000000000000000000 +0000C7FBC7FCC7FDC7FEC7FFC802C803C805C806C807C809C80BC80CC80DC80E +C80FC812C814C817C818C819C81AC81BC81EC81FC821C822C823C825C826C827 +C828C829C82AC82BC82EC830C832C833C834C835C836C837C839C83AC83BC83D +C83EC83FC841C842C843C844C845C846C847C84AC84BC84EC84FC850C851C852 +C853C855C856C857C858C859C85AC85BC85CC85DC85EC85FC860C861C862C863 +C864C865C866C867C868C869C86AC86BC86CC86DC86EC86FC872C873C875C876 +C877C879C87BC87CC87DC87EC87FC882C884C888C889C88AC88EC88FC890C891 +C892C893C895C896C897C898C899C89AC89BC89CC89EC8A0C8A2C8A3C8A40000 +A1 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000C8A5C8A6C8A7C8A9C8AAC8ABC8ACC8ADC8AEC8AFC8B0C8B1C8B2C8B3C8B4 +C8B5C8B6C8B7C8B8C8B9C8BAC8BBC8BEC8BFC8C0C8C100000000000000000000 +0000C8C2C8C3C8C5C8C6C8C7C8C9C8CAC8CBC8CDC8CEC8CFC8D0C8D1C8D2C8D3 +C8D6C8D8C8DAC8DBC8DCC8DDC8DEC8DFC8E2C8E3C8E500000000000000000000 +0000C8E6C8E7C8E8C8E9C8EAC8EBC8ECC8EDC8EEC8EFC8F0C8F1C8F2C8F3C8F4 +C8F6C8F7C8F8C8F9C8FAC8FBC8FEC8FFC901C902C903C907C908C909C90AC90B +C90E30003001300200B72025202600A8300300AD20152225FF3C223C20182019 +201C201D3014301530083009300A300B300C300D300E300F3010301100B100D7 +00F7226022642265221E223400B0203220332103212BFFE0FFE1FFE526422640 +222022A52312220222072261225200A7203B2606260525CB25CF25CE25C725C6 +25A125A025B325B225BD25BC219221902191219321943013226A226B221A223D +221D2235222B222C2208220B2286228722822283222A222922272228FFE20000 +A2 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000C910C912C913C914C915C916C917C919C91AC91BC91CC91DC91EC91FC920 +C921C922C923C924C925C926C927C928C929C92AC92B00000000000000000000 +0000C92DC92EC92FC930C931C932C933C935C936C937C938C939C93AC93BC93C +C93DC93EC93FC940C941C942C943C944C945C946C94700000000000000000000 +0000C948C949C94AC94BC94CC94DC94EC94FC952C953C955C956C957C959C95A +C95BC95CC95DC95EC95FC962C964C965C966C967C968C969C96AC96BC96DC96E +C96F21D221D42200220300B4FF5E02C702D802DD02DA02D900B802DB00A100BF +02D0222E2211220F00A42109203025C125C025B725B626642660266126652667 +2663229925C825A325D025D1259225A425A525A825A725A625A92668260F260E +261C261E00B62020202121952197219921962198266D2669266A266C327F321C +211633C7212233C233D8212120AC00AE00000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +A3 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000C971C972C973C975C976C977C978C979C97AC97BC97DC97EC97FC980C981 +C982C983C984C985C986C987C98AC98BC98DC98EC98F00000000000000000000 +0000C991C992C993C994C995C996C997C99AC99CC99EC99FC9A0C9A1C9A2C9A3 +C9A4C9A5C9A6C9A7C9A8C9A9C9AAC9ABC9ACC9ADC9AE00000000000000000000 +0000C9AFC9B0C9B1C9B2C9B3C9B4C9B5C9B6C9B7C9B8C9B9C9BAC9BBC9BCC9BD +C9BEC9BFC9C2C9C3C9C5C9C6C9C9C9CBC9CCC9CDC9CEC9CFC9D2C9D4C9D7C9D8 +C9DBFF01FF02FF03FF04FF05FF06FF07FF08FF09FF0AFF0BFF0CFF0DFF0EFF0F +FF10FF11FF12FF13FF14FF15FF16FF17FF18FF19FF1AFF1BFF1CFF1DFF1EFF1F +FF20FF21FF22FF23FF24FF25FF26FF27FF28FF29FF2AFF2BFF2CFF2DFF2EFF2F +FF30FF31FF32FF33FF34FF35FF36FF37FF38FF39FF3AFF3BFFE6FF3DFF3EFF3F +FF40FF41FF42FF43FF44FF45FF46FF47FF48FF49FF4AFF4BFF4CFF4DFF4EFF4F +FF50FF51FF52FF53FF54FF55FF56FF57FF58FF59FF5AFF5BFF5CFF5DFFE30000 +A4 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000C9DEC9DFC9E1C9E3C9E5C9E6C9E8C9E9C9EAC9EBC9EEC9F2C9F3C9F4C9F5 +C9F6C9F7C9FAC9FBC9FDC9FEC9FFCA01CA02CA03CA0400000000000000000000 +0000CA05CA06CA07CA0ACA0ECA0FCA10CA11CA12CA13CA15CA16CA17CA19CA1A +CA1BCA1CCA1DCA1ECA1FCA20CA21CA22CA23CA24CA2500000000000000000000 +0000CA26CA27CA28CA2ACA2BCA2CCA2DCA2ECA2FCA30CA31CA32CA33CA34CA35 +CA36CA37CA38CA39CA3ACA3BCA3CCA3DCA3ECA3FCA40CA41CA42CA43CA44CA45 +CA46313131323133313431353136313731383139313A313B313C313D313E313F +3140314131423143314431453146314731483149314A314B314C314D314E314F +3150315131523153315431553156315731583159315A315B315C315D315E315F +3160316131623163316431653166316731683169316A316B316C316D316E316F +3170317131723173317431753176317731783179317A317B317C317D317E317F +3180318131823183318431853186318731883189318A318B318C318D318E0000 +A5 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000CA47CA48CA49CA4ACA4BCA4ECA4FCA51CA52CA53CA55CA56CA57CA58CA59 +CA5ACA5BCA5ECA62CA63CA64CA65CA66CA67CA69CA6A00000000000000000000 +0000CA6BCA6CCA6DCA6ECA6FCA70CA71CA72CA73CA74CA75CA76CA77CA78CA79 +CA7ACA7BCA7CCA7ECA7FCA80CA81CA82CA83CA85CA8600000000000000000000 +0000CA87CA88CA89CA8ACA8BCA8CCA8DCA8ECA8FCA90CA91CA92CA93CA94CA95 +CA96CA97CA99CA9ACA9BCA9CCA9DCA9ECA9FCAA0CAA1CAA2CAA3CAA4CAA5CAA6 +CAA7217021712172217321742175217621772178217900000000000000000000 +2160216121622163216421652166216721682169000000000000000000000000 +0000039103920393039403950396039703980399039A039B039C039D039E039F +03A003A103A303A403A503A603A703A803A90000000000000000000000000000 +000003B103B203B303B403B503B603B703B803B903BA03BB03BC03BD03BE03BF +03C003C103C303C403C503C603C703C803C90000000000000000000000000000 +A6 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000CAA8CAA9CAAACAABCAACCAADCAAECAAFCAB0CAB1CAB2CAB3CAB4CAB5CAB6 +CAB7CAB8CAB9CABACABBCABECABFCAC1CAC2CAC3CAC500000000000000000000 +0000CAC6CAC7CAC8CAC9CACACACBCACECAD0CAD2CAD4CAD5CAD6CAD7CADACADB +CADCCADDCADECADFCAE1CAE2CAE3CAE4CAE5CAE6CAE700000000000000000000 +0000CAE8CAE9CAEACAEBCAEDCAEECAEFCAF0CAF1CAF2CAF3CAF5CAF6CAF7CAF8 +CAF9CAFACAFBCAFCCAFDCAFECAFFCB00CB01CB02CB03CB04CB05CB06CB07CB09 +CB0A25002502250C251025182514251C252C25242534253C25012503250F2513 +251B251725232533252B253B254B2520252F25282537253F251D253025252538 +254225122511251A251925162515250E250D251E251F25212522252625272529 +252A252D252E25312532253525362539253A253D253E25402541254325442545 +2546254725482549254A00000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +A7 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000CB0BCB0CCB0DCB0ECB0FCB11CB12CB13CB15CB16CB17CB19CB1ACB1BCB1C +CB1DCB1ECB1FCB22CB23CB24CB25CB26CB27CB28CB2900000000000000000000 +0000CB2ACB2BCB2CCB2DCB2ECB2FCB30CB31CB32CB33CB34CB35CB36CB37CB38 +CB39CB3ACB3BCB3CCB3DCB3ECB3FCB40CB42CB43CB4400000000000000000000 +0000CB45CB46CB47CB4ACB4BCB4DCB4ECB4FCB51CB52CB53CB54CB55CB56CB57 +CB5ACB5BCB5CCB5ECB5FCB60CB61CB62CB63CB65CB66CB67CB68CB69CB6ACB6B +CB6C3395339633972113339833C433A333A433A533A63399339A339B339C339D +339E339F33A033A133A233CA338D338E338F33CF3388338933C833A733A833B0 +33B133B233B333B433B533B633B733B833B93380338133823383338433BA33BB +33BC33BD33BE33BF33903391339233933394212633C033C1338A338B338C33D6 +33C533AD33AE33AF33DB33A933AA33AB33AC33DD33D033D333C333C933DC33C6 +0000000000000000000000000000000000000000000000000000000000000000 +A8 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000CB6DCB6ECB6FCB70CB71CB72CB73CB74CB75CB76CB77CB7ACB7BCB7CCB7D +CB7ECB7FCB80CB81CB82CB83CB84CB85CB86CB87CB8800000000000000000000 +0000CB89CB8ACB8BCB8CCB8DCB8ECB8FCB90CB91CB92CB93CB94CB95CB96CB97 +CB98CB99CB9ACB9BCB9DCB9ECB9FCBA0CBA1CBA2CBA300000000000000000000 +0000CBA4CBA5CBA6CBA7CBA8CBA9CBAACBABCBACCBADCBAECBAFCBB0CBB1CBB2 +CBB3CBB4CBB5CBB6CBB7CBB9CBBACBBBCBBCCBBDCBBECBBFCBC0CBC1CBC2CBC3 +CBC400C600D000AA0126000001320000013F014100D8015200BA00DE0166014A +00003260326132623263326432653266326732683269326A326B326C326D326E +326F3270327132723273327432753276327732783279327A327B24D024D124D2 +24D324D424D524D624D724D824D924DA24DB24DC24DD24DE24DF24E024E124E2 +24E324E424E524E624E724E824E9246024612462246324642465246624672468 +2469246A246B246C246D246E00BD2153215400BC00BE215B215C215D215E0000 +A9 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000CBC5CBC6CBC7CBC8CBC9CBCACBCBCBCCCBCDCBCECBCFCBD0CBD1CBD2CBD3 +CBD5CBD6CBD7CBD8CBD9CBDACBDBCBDCCBDDCBDECBDF00000000000000000000 +0000CBE0CBE1CBE2CBE3CBE5CBE6CBE8CBEACBEBCBECCBEDCBEECBEFCBF0CBF1 +CBF2CBF3CBF4CBF5CBF6CBF7CBF8CBF9CBFACBFBCBFC00000000000000000000 +0000CBFDCBFECBFFCC00CC01CC02CC03CC04CC05CC06CC07CC08CC09CC0ACC0B +CC0ECC0FCC11CC12CC13CC15CC16CC17CC18CC19CC1ACC1BCC1ECC1FCC20CC23 +CC2400E6011100F001270131013301380140014200F8015300DF00FE0167014B +01493200320132023203320432053206320732083209320A320B320C320D320E +320F3210321132123213321432153216321732183219321A321B249C249D249E +249F24A024A124A224A324A424A524A624A724A824A924AA24AB24AC24AD24AE +24AF24B024B124B224B324B424B5247424752476247724782479247A247B247C +247D247E247F24802481248200B900B200B32074207F20812082208320840000 +AA +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000CC25CC26CC2ACC2BCC2DCC2FCC31CC32CC33CC34CC35CC36CC37CC3ACC3F +CC40CC41CC42CC43CC46CC47CC49CC4ACC4BCC4DCC4E00000000000000000000 +0000CC4FCC50CC51CC52CC53CC56CC5ACC5BCC5CCC5DCC5ECC5FCC61CC62CC63 +CC65CC67CC69CC6ACC6BCC6CCC6DCC6ECC6FCC71CC7200000000000000000000 +0000CC73CC74CC76CC77CC78CC79CC7ACC7BCC7CCC7DCC7ECC7FCC80CC81CC82 +CC83CC84CC85CC86CC87CC88CC89CC8ACC8BCC8CCC8DCC8ECC8FCC90CC91CC92 +CC93304130423043304430453046304730483049304A304B304C304D304E304F +3050305130523053305430553056305730583059305A305B305C305D305E305F +3060306130623063306430653066306730683069306A306B306C306D306E306F +3070307130723073307430753076307730783079307A307B307C307D307E307F +3080308130823083308430853086308730883089308A308B308C308D308E308F +3090309130923093000000000000000000000000000000000000000000000000 +AB +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000CC94CC95CC96CC97CC9ACC9BCC9DCC9ECC9FCCA1CCA2CCA3CCA4CCA5CCA6 +CCA7CCAACCAECCAFCCB0CCB1CCB2CCB3CCB6CCB7CCB900000000000000000000 +0000CCBACCBBCCBDCCBECCBFCCC0CCC1CCC2CCC3CCC6CCC8CCCACCCBCCCCCCCD +CCCECCCFCCD1CCD2CCD3CCD5CCD6CCD7CCD8CCD9CCDA00000000000000000000 +0000CCDBCCDCCCDDCCDECCDFCCE0CCE1CCE2CCE3CCE5CCE6CCE7CCE8CCE9CCEA +CCEBCCEDCCEECCEFCCF1CCF2CCF3CCF4CCF5CCF6CCF7CCF8CCF9CCFACCFBCCFC +CCFD30A130A230A330A430A530A630A730A830A930AA30AB30AC30AD30AE30AF +30B030B130B230B330B430B530B630B730B830B930BA30BB30BC30BD30BE30BF +30C030C130C230C330C430C530C630C730C830C930CA30CB30CC30CD30CE30CF +30D030D130D230D330D430D530D630D730D830D930DA30DB30DC30DD30DE30DF +30E030E130E230E330E430E530E630E730E830E930EA30EB30EC30ED30EE30EF +30F030F130F230F330F430F530F6000000000000000000000000000000000000 +AC +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000CCFECCFFCD00CD02CD03CD04CD05CD06CD07CD0ACD0BCD0DCD0ECD0FCD11 +CD12CD13CD14CD15CD16CD17CD1ACD1CCD1ECD1FCD2000000000000000000000 +0000CD21CD22CD23CD25CD26CD27CD29CD2ACD2BCD2DCD2ECD2FCD30CD31CD32 +CD33CD34CD35CD36CD37CD38CD3ACD3BCD3CCD3DCD3E00000000000000000000 +0000CD3FCD40CD41CD42CD43CD44CD45CD46CD47CD48CD49CD4ACD4BCD4CCD4D +CD4ECD4FCD50CD51CD52CD53CD54CD55CD56CD57CD58CD59CD5ACD5BCD5DCD5E +CD5F04100411041204130414041504010416041704180419041A041B041C041D +041E041F0420042104220423042404250426042704280429042A042B042C042D +042E042F00000000000000000000000000000000000000000000000000000000 +000004300431043204330434043504510436043704380439043A043B043C043D +043E043F0440044104420443044404450446044704480449044A044B044C044D +044E044F00000000000000000000000000000000000000000000000000000000 +AD +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000CD61CD62CD63CD65CD66CD67CD68CD69CD6ACD6BCD6ECD70CD72CD73CD74 +CD75CD76CD77CD79CD7ACD7BCD7CCD7DCD7ECD7FCD8000000000000000000000 +0000CD81CD82CD83CD84CD85CD86CD87CD89CD8ACD8BCD8CCD8DCD8ECD8FCD90 +CD91CD92CD93CD96CD97CD99CD9ACD9BCD9DCD9ECD9F00000000000000000000 +0000CDA0CDA1CDA2CDA3CDA6CDA8CDAACDABCDACCDADCDAECDAFCDB1CDB2CDB3 +CDB4CDB5CDB6CDB7CDB8CDB9CDBACDBBCDBCCDBDCDBECDBFCDC0CDC1CDC2CDC3 +CDC5000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +AE +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000CDC6CDC7CDC8CDC9CDCACDCBCDCDCDCECDCFCDD1CDD2CDD3CDD4CDD5CDD6 +CDD7CDD8CDD9CDDACDDBCDDCCDDDCDDECDDFCDE0CDE100000000000000000000 +0000CDE2CDE3CDE4CDE5CDE6CDE7CDE9CDEACDEBCDEDCDEECDEFCDF1CDF2CDF3 +CDF4CDF5CDF6CDF7CDFACDFCCDFECDFFCE00CE01CE0200000000000000000000 +0000CE03CE05CE06CE07CE09CE0ACE0BCE0DCE0ECE0FCE10CE11CE12CE13CE15 +CE16CE17CE18CE1ACE1BCE1CCE1DCE1ECE1FCE22CE23CE25CE26CE27CE29CE2A +CE2B000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +AF +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000CE2CCE2DCE2ECE2FCE32CE34CE36CE37CE38CE39CE3ACE3BCE3CCE3DCE3E +CE3FCE40CE41CE42CE43CE44CE45CE46CE47CE48CE4900000000000000000000 +0000CE4ACE4BCE4CCE4DCE4ECE4FCE50CE51CE52CE53CE54CE55CE56CE57CE5A +CE5BCE5DCE5ECE62CE63CE64CE65CE66CE67CE6ACE6C00000000000000000000 +0000CE6ECE6FCE70CE71CE72CE73CE76CE77CE79CE7ACE7BCE7DCE7ECE7FCE80 +CE81CE82CE83CE86CE88CE8ACE8BCE8CCE8DCE8ECE8FCE92CE93CE95CE96CE97 +CE99000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +B0 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000CE9ACE9BCE9CCE9DCE9ECE9FCEA2CEA6CEA7CEA8CEA9CEAACEABCEAECEAF +CEB0CEB1CEB2CEB3CEB4CEB5CEB6CEB7CEB8CEB9CEBA00000000000000000000 +0000CEBBCEBCCEBDCEBECEBFCEC0CEC2CEC3CEC4CEC5CEC6CEC7CEC8CEC9CECA +CECBCECCCECDCECECECFCED0CED1CED2CED3CED4CED500000000000000000000 +0000CED6CED7CED8CED9CEDACEDBCEDCCEDDCEDECEDFCEE0CEE1CEE2CEE3CEE6 +CEE7CEE9CEEACEEDCEEECEEFCEF0CEF1CEF2CEF3CEF6CEFACEFBCEFCCEFDCEFE +CEFFAC00AC01AC04AC07AC08AC09AC0AAC10AC11AC12AC13AC14AC15AC16AC17 +AC19AC1AAC1BAC1CAC1DAC20AC24AC2CAC2DAC2FAC30AC31AC38AC39AC3CAC40 +AC4BAC4DAC54AC58AC5CAC70AC71AC74AC77AC78AC7AAC80AC81AC83AC84AC85 +AC86AC89AC8AAC8BAC8CAC90AC94AC9CAC9DAC9FACA0ACA1ACA8ACA9ACAAACAC +ACAFACB0ACB8ACB9ACBBACBCACBDACC1ACC4ACC8ACCCACD5ACD7ACE0ACE1ACE4 +ACE7ACE8ACEAACECACEFACF0ACF1ACF3ACF5ACF6ACFCACFDAD00AD04AD060000 +B1 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000CF02CF03CF05CF06CF07CF09CF0ACF0BCF0CCF0DCF0ECF0FCF12CF14CF16 +CF17CF18CF19CF1ACF1BCF1DCF1ECF1FCF21CF22CF2300000000000000000000 +0000CF25CF26CF27CF28CF29CF2ACF2BCF2ECF32CF33CF34CF35CF36CF37CF39 +CF3ACF3BCF3CCF3DCF3ECF3FCF40CF41CF42CF43CF4400000000000000000000 +0000CF45CF46CF47CF48CF49CF4ACF4BCF4CCF4DCF4ECF4FCF50CF51CF52CF53 +CF56CF57CF59CF5ACF5BCF5DCF5ECF5FCF60CF61CF62CF63CF66CF68CF6ACF6B +CF6CAD0CAD0DAD0FAD11AD18AD1CAD20AD29AD2CAD2DAD34AD35AD38AD3CAD44 +AD45AD47AD49AD50AD54AD58AD61AD63AD6CAD6DAD70AD73AD74AD75AD76AD7B +AD7CAD7DAD7FAD81AD82AD88AD89AD8CAD90AD9CAD9DADA4ADB7ADC0ADC1ADC4 +ADC8ADD0ADD1ADD3ADDCADE0ADE4ADF8ADF9ADFCADFFAE00AE01AE08AE09AE0B +AE0DAE14AE30AE31AE34AE37AE38AE3AAE40AE41AE43AE45AE46AE4AAE4CAE4D +AE4EAE50AE54AE56AE5CAE5DAE5FAE60AE61AE65AE68AE69AE6CAE70AE780000 +B2 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000CF6DCF6ECF6FCF72CF73CF75CF76CF77CF79CF7ACF7BCF7CCF7DCF7ECF7F +CF81CF82CF83CF84CF86CF87CF88CF89CF8ACF8BCF8D00000000000000000000 +0000CF8ECF8FCF90CF91CF92CF93CF94CF95CF96CF97CF98CF99CF9ACF9BCF9C +CF9DCF9ECF9FCFA0CFA2CFA3CFA4CFA5CFA6CFA7CFA900000000000000000000 +0000CFAACFABCFACCFADCFAECFAFCFB1CFB2CFB3CFB4CFB5CFB6CFB7CFB8CFB9 +CFBACFBBCFBCCFBDCFBECFBFCFC0CFC1CFC2CFC3CFC5CFC6CFC7CFC8CFC9CFCA +CFCBAE79AE7BAE7CAE7DAE84AE85AE8CAEBCAEBDAEBEAEC0AEC4AECCAECDAECF +AED0AED1AED8AED9AEDCAEE8AEEBAEEDAEF4AEF8AEFCAF07AF08AF0DAF10AF2C +AF2DAF30AF32AF34AF3CAF3DAF3FAF41AF42AF43AF48AF49AF50AF5CAF5DAF64 +AF65AF79AF80AF84AF88AF90AF91AF95AF9CAFB8AFB9AFBCAFC0AFC7AFC8AFC9 +AFCBAFCDAFCEAFD4AFDCAFE8AFE9AFF0AFF1AFF4AFF8B000B001B004B00CB010 +B014B01CB01DB028B044B045B048B04AB04CB04EB053B054B055B057B0590000 +B3 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000CFCCCFCDCFCECFCFCFD0CFD1CFD2CFD3CFD4CFD5CFD6CFD7CFD8CFD9CFDA +CFDBCFDCCFDDCFDECFDFCFE2CFE3CFE5CFE6CFE7CFE900000000000000000000 +0000CFEACFEBCFECCFEDCFEECFEFCFF2CFF4CFF6CFF7CFF8CFF9CFFACFFBCFFD +CFFECFFFD001D002D003D005D006D007D008D009D00A00000000000000000000 +0000D00BD00CD00DD00ED00FD010D012D013D014D015D016D017D019D01AD01B +D01CD01DD01ED01FD020D021D022D023D024D025D026D027D028D029D02AD02B +D02CB05DB07CB07DB080B084B08CB08DB08FB091B098B099B09AB09CB09FB0A0 +B0A1B0A2B0A8B0A9B0ABB0ACB0ADB0AEB0AFB0B1B0B3B0B4B0B5B0B8B0BCB0C4 +B0C5B0C7B0C8B0C9B0D0B0D1B0D4B0D8B0E0B0E5B108B109B10BB10CB110B112 +B113B118B119B11BB11CB11DB123B124B125B128B12CB134B135B137B138B139 +B140B141B144B148B150B151B154B155B158B15CB160B178B179B17CB180B182 +B188B189B18BB18DB192B193B194B198B19CB1A8B1CCB1D0B1D4B1DCB1DD0000 +B4 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000D02ED02FD030D031D032D033D036D037D039D03AD03BD03DD03ED03FD040 +D041D042D043D046D048D04AD04BD04CD04DD04ED04F00000000000000000000 +0000D051D052D053D055D056D057D059D05AD05BD05CD05DD05ED05FD061D062 +D063D064D065D066D067D068D069D06AD06BD06ED06F00000000000000000000 +0000D071D072D073D075D076D077D078D079D07AD07BD07ED07FD080D082D083 +D084D085D086D087D088D089D08AD08BD08CD08DD08ED08FD090D091D092D093 +D094B1DFB1E8B1E9B1ECB1F0B1F9B1FBB1FDB204B205B208B20BB20CB214B215 +B217B219B220B234B23CB258B25CB260B268B269B274B275B27CB284B285B289 +B290B291B294B298B299B29AB2A0B2A1B2A3B2A5B2A6B2AAB2ACB2B0B2B4B2C8 +B2C9B2CCB2D0B2D2B2D8B2D9B2DBB2DDB2E2B2E4B2E5B2E6B2E8B2EBB2ECB2ED +B2EEB2EFB2F3B2F4B2F5B2F7B2F8B2F9B2FAB2FBB2FFB300B301B304B308B310 +B311B313B314B315B31CB354B355B356B358B35BB35CB35EB35FB364B3650000 +B5 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000D095D096D097D098D099D09AD09BD09CD09DD09ED09FD0A0D0A1D0A2D0A3 +D0A6D0A7D0A9D0AAD0ABD0ADD0AED0AFD0B0D0B1D0B200000000000000000000 +0000D0B3D0B6D0B8D0BAD0BBD0BCD0BDD0BED0BFD0C2D0C3D0C5D0C6D0C7D0CA +D0CBD0CCD0CDD0CED0CFD0D2D0D6D0D7D0D8D0D9D0DA00000000000000000000 +0000D0DBD0DED0DFD0E1D0E2D0E3D0E5D0E6D0E7D0E8D0E9D0EAD0EBD0EED0F2 +D0F3D0F4D0F5D0F6D0F7D0F9D0FAD0FBD0FCD0FDD0FED0FFD100D101D102D103 +D104B367B369B36BB36EB370B371B374B378B380B381B383B384B385B38CB390 +B394B3A0B3A1B3A8B3ACB3C4B3C5B3C8B3CBB3CCB3CEB3D0B3D4B3D5B3D7B3D9 +B3DBB3DDB3E0B3E4B3E8B3FCB410B418B41CB420B428B429B42BB434B450B451 +B454B458B460B461B463B465B46CB480B488B49DB4A4B4A8B4ACB4B5B4B7B4B9 +B4C0B4C4B4C8B4D0B4D5B4DCB4DDB4E0B4E3B4E4B4E6B4ECB4EDB4EFB4F1B4F8 +B514B515B518B51BB51CB524B525B527B528B529B52AB530B531B534B5380000 +B6 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000D105D106D107D108D109D10AD10BD10CD10ED10FD110D111D112D113D114 +D115D116D117D118D119D11AD11BD11CD11DD11ED11F00000000000000000000 +0000D120D121D122D123D124D125D126D127D128D129D12AD12BD12CD12DD12E +D12FD132D133D135D136D137D139D13BD13CD13DD13E00000000000000000000 +0000D13FD142D146D147D148D149D14AD14BD14ED14FD151D152D153D155D156 +D157D158D159D15AD15BD15ED160D162D163D164D165D166D167D169D16AD16B +D16DB540B541B543B544B545B54BB54CB54DB550B554B55CB55DB55FB560B561 +B5A0B5A1B5A4B5A8B5AAB5ABB5B0B5B1B5B3B5B4B5B5B5BBB5BCB5BDB5C0B5C4 +B5CCB5CDB5CFB5D0B5D1B5D8B5ECB610B611B614B618B625B62CB634B648B664 +B668B69CB69DB6A0B6A4B6ABB6ACB6B1B6D4B6F0B6F4B6F8B700B701B705B728 +B729B72CB72FB730B738B739B73BB744B748B74CB754B755B760B764B768B770 +B771B773B775B77CB77DB780B784B78CB78DB78FB790B791B792B796B7970000 +B7 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000D16ED16FD170D171D172D173D174D175D176D177D178D179D17AD17BD17D +D17ED17FD180D181D182D183D185D186D187D189D18A00000000000000000000 +0000D18BD18CD18DD18ED18FD190D191D192D193D194D195D196D197D198D199 +D19AD19BD19CD19DD19ED19FD1A2D1A3D1A5D1A6D1A700000000000000000000 +0000D1A9D1AAD1ABD1ACD1ADD1AED1AFD1B2D1B4D1B6D1B7D1B8D1B9D1BBD1BD +D1BED1BFD1C1D1C2D1C3D1C4D1C5D1C6D1C7D1C8D1C9D1CAD1CBD1CCD1CDD1CE +D1CFB798B799B79CB7A0B7A8B7A9B7ABB7ACB7ADB7B4B7B5B7B8B7C7B7C9B7EC +B7EDB7F0B7F4B7FCB7FDB7FFB800B801B807B808B809B80CB810B818B819B81B +B81DB824B825B828B82CB834B835B837B838B839B840B844B851B853B85CB85D +B860B864B86CB86DB86FB871B878B87CB88DB8A8B8B0B8B4B8B8B8C0B8C1B8C3 +B8C5B8CCB8D0B8D4B8DDB8DFB8E1B8E8B8E9B8ECB8F0B8F8B8F9B8FBB8FDB904 +B918B920B93CB93DB940B944B94CB94FB951B958B959B95CB960B968B9690000 +B8 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000D1D0D1D1D1D2D1D3D1D4D1D5D1D6D1D7D1D9D1DAD1DBD1DCD1DDD1DED1DF +D1E0D1E1D1E2D1E3D1E4D1E5D1E6D1E7D1E8D1E9D1EA00000000000000000000 +0000D1EBD1ECD1EDD1EED1EFD1F0D1F1D1F2D1F3D1F5D1F6D1F7D1F9D1FAD1FB +D1FCD1FDD1FED1FFD200D201D202D203D204D205D20600000000000000000000 +0000D208D20AD20BD20CD20DD20ED20FD211D212D213D214D215D216D217D218 +D219D21AD21BD21CD21DD21ED21FD220D221D222D223D224D225D226D227D228 +D229B96BB96DB974B975B978B97CB984B985B987B989B98AB98DB98EB9ACB9AD +B9B0B9B4B9BCB9BDB9BFB9C1B9C8B9C9B9CCB9CEB9CFB9D0B9D1B9D2B9D8B9D9 +B9DBB9DDB9DEB9E1B9E3B9E4B9E5B9E8B9ECB9F4B9F5B9F7B9F8B9F9B9FABA00 +BA01BA08BA15BA38BA39BA3CBA40BA42BA48BA49BA4BBA4DBA4EBA53BA54BA55 +BA58BA5CBA64BA65BA67BA68BA69BA70BA71BA74BA78BA83BA84BA85BA87BA8C +BAA8BAA9BAABBAACBAB0BAB2BAB8BAB9BABBBABDBAC4BAC8BAD8BAD9BAFC0000 +B9 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000D22AD22BD22ED22FD231D232D233D235D236D237D238D239D23AD23BD23E +D240D242D243D244D245D246D247D249D24AD24BD24C00000000000000000000 +0000D24DD24ED24FD250D251D252D253D254D255D256D257D258D259D25AD25B +D25DD25ED25FD260D261D262D263D265D266D267D26800000000000000000000 +0000D269D26AD26BD26CD26DD26ED26FD270D271D272D273D274D275D276D277 +D278D279D27AD27BD27CD27DD27ED27FD282D283D285D286D287D289D28AD28B +D28CBB00BB04BB0DBB0FBB11BB18BB1CBB20BB29BB2BBB34BB35BB36BB38BB3B +BB3CBB3DBB3EBB44BB45BB47BB49BB4DBB4FBB50BB54BB58BB61BB63BB6CBB88 +BB8CBB90BBA4BBA8BBACBBB4BBB7BBC0BBC4BBC8BBD0BBD3BBF8BBF9BBFCBBFF +BC00BC02BC08BC09BC0BBC0CBC0DBC0FBC11BC14BC15BC16BC17BC18BC1BBC1C +BC1DBC1EBC1FBC24BC25BC27BC29BC2DBC30BC31BC34BC38BC40BC41BC43BC44 +BC45BC49BC4CBC4DBC50BC5DBC84BC85BC88BC8BBC8CBC8EBC94BC95BC970000 +BA +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000D28DD28ED28FD292D293D294D296D297D298D299D29AD29BD29DD29ED29F +D2A1D2A2D2A3D2A5D2A6D2A7D2A8D2A9D2AAD2ABD2AD00000000000000000000 +0000D2AED2AFD2B0D2B2D2B3D2B4D2B5D2B6D2B7D2BAD2BBD2BDD2BED2C1D2C3 +D2C4D2C5D2C6D2C7D2CAD2CCD2CDD2CED2CFD2D0D2D100000000000000000000 +0000D2D2D2D3D2D5D2D6D2D7D2D9D2DAD2DBD2DDD2DED2DFD2E0D2E1D2E2D2E3 +D2E6D2E7D2E8D2E9D2EAD2EBD2ECD2EDD2EED2EFD2F2D2F3D2F5D2F6D2F7D2F9 +D2FABC99BC9ABCA0BCA1BCA4BCA7BCA8BCB0BCB1BCB3BCB4BCB5BCBCBCBDBCC0 +BCC4BCCDBCCFBCD0BCD1BCD5BCD8BCDCBCF4BCF5BCF6BCF8BCFCBD04BD05BD07 +BD09BD10BD14BD24BD2CBD40BD48BD49BD4CBD50BD58BD59BD64BD68BD80BD81 +BD84BD87BD88BD89BD8ABD90BD91BD93BD95BD99BD9ABD9CBDA4BDB0BDB8BDD4 +BDD5BDD8BDDCBDE9BDF0BDF4BDF8BE00BE03BE05BE0CBE0DBE10BE14BE1CBE1D +BE1FBE44BE45BE48BE4CBE4EBE54BE55BE57BE59BE5ABE5BBE60BE61BE640000 +BB +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000D2FBD2FCD2FDD2FED2FFD302D304D306D307D308D309D30AD30BD30FD311 +D312D313D315D317D318D319D31AD31BD31ED322D32300000000000000000000 +0000D324D326D327D32AD32BD32DD32ED32FD331D332D333D334D335D336D337 +D33AD33ED33FD340D341D342D343D346D347D348D34900000000000000000000 +0000D34AD34BD34CD34DD34ED34FD350D351D352D353D354D355D356D357D358 +D359D35AD35BD35CD35DD35ED35FD360D361D362D363D364D365D366D367D368 +D369BE68BE6ABE70BE71BE73BE74BE75BE7BBE7CBE7DBE80BE84BE8CBE8DBE8F +BE90BE91BE98BE99BEA8BED0BED1BED4BED7BED8BEE0BEE3BEE4BEE5BEECBF01 +BF08BF09BF18BF19BF1BBF1CBF1DBF40BF41BF44BF48BF50BF51BF55BF94BFB0 +BFC5BFCCBFCDBFD0BFD4BFDCBFDFBFE1C03CC051C058C05CC060C068C069C090 +C091C094C098C0A0C0A1C0A3C0A5C0ACC0ADC0AFC0B0C0B3C0B4C0B5C0B6C0BC +C0BDC0BFC0C0C0C1C0C5C0C8C0C9C0CCC0D0C0D8C0D9C0DBC0DCC0DDC0E40000 +BC +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000D36AD36BD36CD36DD36ED36FD370D371D372D373D374D375D376D377D378 +D379D37AD37BD37ED37FD381D382D383D385D386D38700000000000000000000 +0000D388D389D38AD38BD38ED392D393D394D395D396D397D39AD39BD39DD39E +D39FD3A1D3A2D3A3D3A4D3A5D3A6D3A7D3AAD3ACD3AE00000000000000000000 +0000D3AFD3B0D3B1D3B2D3B3D3B5D3B6D3B7D3B9D3BAD3BBD3BDD3BED3BFD3C0 +D3C1D3C2D3C3D3C6D3C7D3CAD3CBD3CCD3CDD3CED3CFD3D1D3D2D3D3D3D4D3D5 +D3D6C0E5C0E8C0ECC0F4C0F5C0F7C0F9C100C104C108C110C115C11CC11DC11E +C11FC120C123C124C126C127C12CC12DC12FC130C131C136C138C139C13CC140 +C148C149C14BC14CC14DC154C155C158C15CC164C165C167C168C169C170C174 +C178C185C18CC18DC18EC190C194C196C19CC19DC19FC1A1C1A5C1A8C1A9C1AC +C1B0C1BDC1C4C1C8C1CCC1D4C1D7C1D8C1E0C1E4C1E8C1F0C1F1C1F3C1FCC1FD +C200C204C20CC20DC20FC211C218C219C21CC21FC220C228C229C22BC22D0000 +BD +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000D3D7D3D9D3DAD3DBD3DCD3DDD3DED3DFD3E0D3E2D3E4D3E5D3E6D3E7D3E8 +D3E9D3EAD3EBD3EED3EFD3F1D3F2D3F3D3F5D3F6D3F700000000000000000000 +0000D3F8D3F9D3FAD3FBD3FED400D402D403D404D405D406D407D409D40AD40B +D40CD40DD40ED40FD410D411D412D413D414D415D41600000000000000000000 +0000D417D418D419D41AD41BD41CD41ED41FD420D421D422D423D424D425D426 +D427D428D429D42AD42BD42CD42DD42ED42FD430D431D432D433D434D435D436 +D437C22FC231C232C234C248C250C251C254C258C260C265C26CC26DC270C274 +C27CC27DC27FC281C288C289C290C298C29BC29DC2A4C2A5C2A8C2ACC2ADC2B4 +C2B5C2B7C2B9C2DCC2DDC2E0C2E3C2E4C2EBC2ECC2EDC2EFC2F1C2F6C2F8C2F9 +C2FBC2FCC300C308C309C30CC30DC313C314C315C318C31CC324C325C328C329 +C345C368C369C36CC370C372C378C379C37CC37DC384C388C38CC3C0C3D8C3D9 +C3DCC3DFC3E0C3E2C3E8C3E9C3EDC3F4C3F5C3F8C408C410C424C42CC4300000 +BE +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000D438D439D43AD43BD43CD43DD43ED43FD441D442D443D445D446D447D448 +D449D44AD44BD44CD44DD44ED44FD450D451D452D45300000000000000000000 +0000D454D455D456D457D458D459D45AD45BD45DD45ED45FD461D462D463D465 +D466D467D468D469D46AD46BD46CD46ED470D471D47200000000000000000000 +0000D473D474D475D476D477D47AD47BD47DD47ED481D483D484D485D486D487 +D48AD48CD48ED48FD490D491D492D493D495D496D497D498D499D49AD49BD49C +D49DC434C43CC43DC448C464C465C468C46CC474C475C479C480C494C49CC4B8 +C4BCC4E9C4F0C4F1C4F4C4F8C4FAC4FFC500C501C50CC510C514C51CC528C529 +C52CC530C538C539C53BC53DC544C545C548C549C54AC54CC54DC54EC553C554 +C555C557C558C559C55DC55EC560C561C564C568C570C571C573C574C575C57C +C57DC580C584C587C58CC58DC58FC591C595C597C598C59CC5A0C5A9C5B4C5B5 +C5B8C5B9C5BBC5BCC5BDC5BEC5C4C5C5C5C6C5C7C5C8C5C9C5CAC5CCC5CE0000 +BF +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000D49ED49FD4A0D4A1D4A2D4A3D4A4D4A5D4A6D4A7D4A8D4AAD4ABD4ACD4AD +D4AED4AFD4B0D4B1D4B2D4B3D4B4D4B5D4B6D4B7D4B800000000000000000000 +0000D4B9D4BAD4BBD4BCD4BDD4BED4BFD4C0D4C1D4C2D4C3D4C4D4C5D4C6D4C7 +D4C8D4C9D4CAD4CBD4CDD4CED4CFD4D1D4D2D4D3D4D500000000000000000000 +0000D4D6D4D7D4D8D4D9D4DAD4DBD4DDD4DED4E0D4E1D4E2D4E3D4E4D4E5D4E6 +D4E7D4E9D4EAD4EBD4EDD4EED4EFD4F1D4F2D4F3D4F4D4F5D4F6D4F7D4F9D4FA +D4FCC5D0C5D1C5D4C5D8C5E0C5E1C5E3C5E5C5ECC5EDC5EEC5F0C5F4C5F6C5F7 +C5FCC5FDC5FEC5FFC600C601C605C606C607C608C60CC610C618C619C61BC61C +C624C625C628C62CC62DC62EC630C633C634C635C637C639C63BC640C641C644 +C648C650C651C653C654C655C65CC65DC660C66CC66FC671C678C679C67CC680 +C688C689C68BC68DC694C695C698C69CC6A4C6A5C6A7C6A9C6B0C6B1C6B4C6B8 +C6B9C6BAC6C0C6C1C6C3C6C5C6CCC6CDC6D0C6D4C6DCC6DDC6E0C6E1C6E80000 +C0 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000D4FED4FFD500D501D502D503D505D506D507D509D50AD50BD50DD50ED50F +D510D511D512D513D516D518D519D51AD51BD51CD51D00000000000000000000 +0000D51ED51FD520D521D522D523D524D525D526D527D528D529D52AD52BD52C +D52DD52ED52FD530D531D532D533D534D535D536D53700000000000000000000 +0000D538D539D53AD53BD53ED53FD541D542D543D545D546D547D548D549D54A +D54BD54ED550D552D553D554D555D556D557D55AD55BD55DD55ED55FD561D562 +D563C6E9C6ECC6F0C6F8C6F9C6FDC704C705C708C70CC714C715C717C719C720 +C721C724C728C730C731C733C735C737C73CC73DC740C744C74AC74CC74DC74F +C751C752C753C754C755C756C757C758C75CC760C768C76BC774C775C778C77C +C77DC77EC783C784C785C787C788C789C78AC78EC790C791C794C796C797C798 +C79AC7A0C7A1C7A3C7A4C7A5C7A6C7ACC7ADC7B0C7B4C7BCC7BDC7BFC7C0C7C1 +C7C8C7C9C7CCC7CEC7D0C7D8C7DDC7E4C7E8C7ECC800C801C804C808C80A0000 +C1 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000D564D566D567D56AD56CD56ED56FD570D571D572D573D576D577D579D57A +D57BD57DD57ED57FD580D581D582D583D586D58AD58B00000000000000000000 +0000D58CD58DD58ED58FD591D592D593D594D595D596D597D598D599D59AD59B +D59CD59DD59ED59FD5A0D5A1D5A2D5A3D5A4D5A6D5A700000000000000000000 +0000D5A8D5A9D5AAD5ABD5ACD5ADD5AED5AFD5B0D5B1D5B2D5B3D5B4D5B5D5B6 +D5B7D5B8D5B9D5BAD5BBD5BCD5BDD5BED5BFD5C0D5C1D5C2D5C3D5C4D5C5D5C6 +D5C7C810C811C813C815C816C81CC81DC820C824C82CC82DC82FC831C838C83C +C840C848C849C84CC84DC854C870C871C874C878C87AC880C881C883C885C886 +C887C88BC88CC88DC894C89DC89FC8A1C8A8C8BCC8BDC8C4C8C8C8CCC8D4C8D5 +C8D7C8D9C8E0C8E1C8E4C8F5C8FCC8FDC900C904C905C906C90CC90DC90FC911 +C918C92CC934C950C951C954C958C960C961C963C96CC970C974C97CC988C989 +C98CC990C998C999C99BC99DC9C0C9C1C9C4C9C7C9C8C9CAC9D0C9D1C9D30000 +C2 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000D5CAD5CBD5CDD5CED5CFD5D1D5D3D5D4D5D5D5D6D5D7D5DAD5DCD5DED5DF +D5E0D5E1D5E2D5E3D5E6D5E7D5E9D5EAD5EBD5EDD5EE00000000000000000000 +0000D5EFD5F0D5F1D5F2D5F3D5F6D5F8D5FAD5FBD5FCD5FDD5FED5FFD602D603 +D605D606D607D609D60AD60BD60CD60DD60ED60FD61200000000000000000000 +0000D616D617D618D619D61AD61BD61DD61ED61FD621D622D623D625D626D627 +D628D629D62AD62BD62CD62ED62FD630D631D632D633D634D635D636D637D63A +D63BC9D5C9D6C9D9C9DAC9DCC9DDC9E0C9E2C9E4C9E7C9ECC9EDC9EFC9F0C9F1 +C9F8C9F9C9FCCA00CA08CA09CA0BCA0CCA0DCA14CA18CA29CA4CCA4DCA50CA54 +CA5CCA5DCA5FCA60CA61CA68CA7DCA84CA98CABCCABDCAC0CAC4CACCCACDCACF +CAD1CAD3CAD8CAD9CAE0CAECCAF4CB08CB10CB14CB18CB20CB21CB41CB48CB49 +CB4CCB50CB58CB59CB5DCB64CB78CB79CB9CCBB8CBD4CBE4CBE7CBE9CC0CCC0D +CC10CC14CC1CCC1DCC21CC22CC27CC28CC29CC2CCC2ECC30CC38CC39CC3B0000 +C3 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000D63DD63ED63FD641D642D643D644D646D647D64AD64CD64ED64FD650D652 +D653D656D657D659D65AD65BD65DD65ED65FD660D66100000000000000000000 +0000D662D663D664D665D666D668D66AD66BD66CD66DD66ED66FD672D673D675 +D676D677D678D679D67AD67BD67CD67DD67ED67FD68000000000000000000000 +0000D681D682D684D686D687D688D689D68AD68BD68ED68FD691D692D693D695 +D696D697D698D699D69AD69BD69CD69ED6A0D6A2D6A3D6A4D6A5D6A6D6A7D6A9 +D6AACC3CCC3DCC3ECC44CC45CC48CC4CCC54CC55CC57CC58CC59CC60CC64CC66 +CC68CC70CC75CC98CC99CC9CCCA0CCA8CCA9CCABCCACCCADCCB4CCB5CCB8CCBC +CCC4CCC5CCC7CCC9CCD0CCD4CCE4CCECCCF0CD01CD08CD09CD0CCD10CD18CD19 +CD1BCD1DCD24CD28CD2CCD39CD5CCD60CD64CD6CCD6DCD6FCD71CD78CD88CD94 +CD95CD98CD9CCDA4CDA5CDA7CDA9CDB0CDC4CDCCCDD0CDE8CDECCDF0CDF8CDF9 +CDFBCDFDCE04CE08CE0CCE14CE19CE20CE21CE24CE28CE30CE31CE33CE350000 +C4 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000D6ABD6ADD6AED6AFD6B1D6B2D6B3D6B4D6B5D6B6D6B7D6B8D6BAD6BCD6BD +D6BED6BFD6C0D6C1D6C2D6C3D6C6D6C7D6C9D6CAD6CB00000000000000000000 +0000D6CDD6CED6CFD6D0D6D2D6D3D6D5D6D6D6D8D6DAD6DBD6DCD6DDD6DED6DF +D6E1D6E2D6E3D6E5D6E6D6E7D6E9D6EAD6EBD6ECD6ED00000000000000000000 +0000D6EED6EFD6F1D6F2D6F3D6F4D6F6D6F7D6F8D6F9D6FAD6FBD6FED6FFD701 +D702D703D705D706D707D708D709D70AD70BD70CD70DD70ED70FD710D712D713 +D714CE58CE59CE5CCE5FCE60CE61CE68CE69CE6BCE6DCE74CE75CE78CE7CCE84 +CE85CE87CE89CE90CE91CE94CE98CEA0CEA1CEA3CEA4CEA5CEACCEADCEC1CEE4 +CEE5CEE8CEEBCEECCEF4CEF5CEF7CEF8CEF9CF00CF01CF04CF08CF10CF11CF13 +CF15CF1CCF20CF24CF2CCF2DCF2FCF30CF31CF38CF54CF55CF58CF5CCF64CF65 +CF67CF69CF70CF71CF74CF78CF80CF85CF8CCFA1CFA8CFB0CFC4CFE0CFE1CFE4 +CFE8CFF0CFF1CFF3CFF5CFFCD000D004D011D018D02DD034D035D038D03C0000 +C5 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000D715D716D717D71AD71BD71DD71ED71FD721D722D723D724D725D726D727 +D72AD72CD72ED72FD730D731D732D733D736D737D73900000000000000000000 +0000D73AD73BD73DD73ED73FD740D741D742D743D745D746D748D74AD74BD74C +D74DD74ED74FD752D753D755D75AD75BD75CD75DD75E00000000000000000000 +0000D75FD762D764D766D767D768D76AD76BD76DD76ED76FD771D772D773D775 +D776D777D778D779D77AD77BD77ED77FD780D782D783D784D785D786D787D78A +D78BD044D045D047D049D050D054D058D060D06CD06DD070D074D07CD07DD081 +D0A4D0A5D0A8D0ACD0B4D0B5D0B7D0B9D0C0D0C1D0C4D0C8D0C9D0D0D0D1D0D3 +D0D4D0D5D0DCD0DDD0E0D0E4D0ECD0EDD0EFD0F0D0F1D0F8D10DD130D131D134 +D138D13AD140D141D143D144D145D14CD14DD150D154D15CD15DD15FD161D168 +D16CD17CD184D188D1A0D1A1D1A4D1A8D1B0D1B1D1B3D1B5D1BAD1BCD1C0D1D8 +D1F4D1F8D207D209D210D22CD22DD230D234D23CD23DD23FD241D248D25C0000 +C6 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000D78DD78ED78FD791D792D793D794D795D796D797D79AD79CD79ED79FD7A0 +D7A1D7A2D7A30000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000D264D280D281D284D288D290D291D295D29CD2A0D2A4D2ACD2B1D2B8D2B9 +D2BCD2BFD2C0D2C2D2C8D2C9D2CBD2D4D2D8D2DCD2E4D2E5D2F0D2F1D2F4D2F8 +D300D301D303D305D30CD30DD30ED310D314D316D31CD31DD31FD320D321D325 +D328D329D32CD330D338D339D33BD33CD33DD344D345D37CD37DD380D384D38C +D38DD38FD390D391D398D399D39CD3A0D3A8D3A9D3ABD3ADD3B4D3B8D3BCD3C4 +D3C5D3C8D3C9D3D0D3D8D3E1D3E3D3ECD3EDD3F0D3F4D3FCD3FDD3FFD4010000 +C7 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000D408D41DD440D444D45CD460D464D46DD46FD478D479D47CD47FD480D482 +D488D489D48BD48DD494D4A9D4CCD4D0D4D4D4DCD4DFD4E8D4ECD4F0D4F8D4FB +D4FDD504D508D50CD514D515D517D53CD53DD540D544D54CD54DD54FD551D558 +D559D55CD560D565D568D569D56BD56DD574D575D578D57CD584D585D587D588 +D589D590D5A5D5C8D5C9D5CCD5D0D5D2D5D8D5D9D5DBD5DDD5E4D5E5D5E8D5EC +D5F4D5F5D5F7D5F9D600D601D604D608D610D611D613D614D615D61CD6200000 +C8 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000D624D62DD638D639D63CD640D645D648D649D64BD64DD651D654D655D658 +D65CD667D669D670D671D674D683D685D68CD68DD690D694D69DD69FD6A1D6A8 +D6ACD6B0D6B9D6BBD6C4D6C5D6C8D6CCD6D1D6D4D6D7D6D9D6E0D6E4D6E8D6F0 +D6F5D6FCD6FDD700D704D711D718D719D71CD720D728D729D72BD72DD734D735 +D738D73CD744D747D749D750D751D754D756D757D758D759D760D761D763D765 +D769D76CD770D774D77CD77DD781D788D789D78CD790D798D799D79BD79D0000 +CA +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00004F3D4F73504750F952A053EF547554E556095AC15BB6668767B667B767EF +6B4C73C275C27A3C82DB8304885788888A368CC88DCF8EFB8FE699D5523B5374 +5404606A61646BBC73CF811A89BA89D295A34F83520A58BE597859E65E725E79 +61C763C0674667EC687F6F97764E770B78F57A087AFF7C21809D826E82718AEB +95934E6B559D66F76E3478A37AED845B8910874E97A852D8574E582A5D4C611F +61BE6221656267D16A446E1B751875B376E377B07D3A90AF945194529F950000 +CB +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000053235CAC753280DB92409598525B580859DC5CA15D175EB75F3A5F4A6177 +6C5F757A75867CE07D737DB17F8C81548221859189418B1B92FC964D9C474ECB +4EF7500B51F1584F6137613E6168653969EA6F1175A5768676D67B8782A584CB +F90093A7958B55805BA25751F9017CB37FB991B5502853BB5C455DE862D2636E +64DA64E76E2070AC795B8DDD8E1EF902907D924592F84E7E4EF650655DFE5EFA +61066957817186548E4793759A2B4E5E5091677068405109528D52926AA20000 +CC +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000077BC92109ED452AB602F8FF2504861A963ED64CA683C6A846FC0818889A1 +96945805727D72AC75047D797E6D80A9898B8B7490639D5162896C7A6F547D50 +7F3A8A23517C614A7B9D8B199257938C4EAC4FD3501E50BE510652C152CD537F +577058835E9A5F91617661AC64CE656C666F66BB66F468976D87708570F1749F +74A574CA75D9786C78EC7ADF7AF67D457D938015803F811B83968B668F159015 +93E1980398389A5A9BE84FC25553583A59515B635C4660B86212684268B00000 +CD +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000068E86EAA754C767878CE7A3D7CFB7E6B7E7C8A088AA18C3F968E9DC453E4 +53E9544A547156FA59D15B645C3B5EAB62F765376545657266A067AF69C16CBD +75FC7690777E7A3F7F94800380A1818F82E682FD83F085C1883188B48AA5F903 +8F9C932E96C798679AD89F1354ED659B66F2688F7A408C379D6056F057645D11 +660668B168CD6EFE7428889E9BE46C68F9049AA84F9B516C5171529F5B545DE5 +6050606D62F163A7653B73D97A7A86A38CA2978F4E325BE16208679C74DC0000 +CE +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000079D183D38A878AB28DE8904E934B98465ED369E885FF90EDF90551A05B98 +5BEC616368FA6B3E704C742F74D87BA17F5083C589C08CAB95DC9928522E605D +62EC90024F8A5149532158D95EE366E06D38709A72C273D67B5080F1945B5366 +639B7F6B4E565080584A58DE602A612762D069D09B415B8F7D1880B18F5F4EA4 +50D154AC55AC5B0C5DA05DE7652A654E68216A4B72E1768E77EF7D5E7FF981A0 +854E86DF8F038F4E90CA99039A559BAB4E184E454E5D4EC74FF1517752FE0000 +CF +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000534053E353E5548E5614577557A25BC75D875ED061FC62D8655167B867E9 +69CB6B506BC66BEC6C426E9D707872D77396740377BF77E97A767D7F800981FC +8205820A82DF88628B338CFC8EC0901190B1926492B699D29A459CE99DD79F9C +570B5C4083CA97A097AB9EB4541B7A987FA488D98ECD90E158005C4863987A9F +5BAE5F137A797AAE828E8EAC5026523852F85377570862F363726B0A6DC37737 +53A5735785688E7695D5673A6AC36F708A6D8ECC994BF90666776B788CB40000 +D0 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00009B3CF90753EB572D594E63C669FB73EA78457ABA7AC57CFE8475898F8D73 +903595A852FB574775477B6083CC921EF9086A58514B524B5287621F68D86975 +969950C552A452E461C365A4683969FF747E7B4B82B983EB89B28B398FD19949 +F9094ECA599764D266116A8E7434798179BD82A9887E887F895FF90A93264F0B +53CA602562716C727D1A7D664E98516277DC80AF4F014F0E5176518055DC5668 +573B57FA57FC5914594759935BC45C905D0E5DF15E7E5FCC628065D765E30000 +D1 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000671E671F675E68CB68C46A5F6B3A6C236C7D6C826DC773987426742A7482 +74A37578757F788178EF794179477948797A7B957D007DBA7F888006802D808C +8A188B4F8C488D779321932498E299519A0E9A0F9A659E927DCA4F76540962EE +685491D155AB513AF90BF90C5A1C61E6F90D62CF62FFF90EF90FF910F911F912 +F91390A3F914F915F916F917F9188AFEF919F91AF91BF91C6696F91D7156F91E +F91F96E3F920634F637A5357F921678F69606E73F9227537F923F924F9250000 +D2 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00007D0DF926F927887256CA5A18F928F929F92AF92BF92C4E43F92D51675948 +67F08010F92E59735E74649A79CA5FF5606C62C8637B5BE75BD752AAF92F5974 +5F296012F930F931F9327459F933F934F935F936F937F93899D1F939F93AF93B +F93CF93DF93EF93FF940F941F942F9436FC3F944F94581BF8FB260F1F946F947 +8166F948F9495C3FF94AF94BF94CF94DF94EF94FF950F9515AE98A25677B7D10 +F952F953F954F955F956F95780FDF958F9595C3C6CE5533F6EBA591A83360000 +D3 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00004E394EB64F4655AE571858C75F5665B765E66A806BB56E4D77ED7AEF7C1E +7DDE86CB88929132935B64BB6FBE737A75B890545556574D61BA64D466C76DE1 +6E5B6F6D6FB975F0804381BD854189838AC78B5A931F6C9375537B548E0F905D +5510580258585E626207649E68E075767CD687B39EE84EE35788576E59275C0D +5CB15E365F85623464E173B381FA888B8CB8968A9EDB5B855FB760B350125200 +52305716583558575C0E5C605CF65D8B5EA65F9260BC63116389641768430000 +D4 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000068F96AC26DD86E216ED46FE471FE76DC777979B17A3B840489A98CED8DF3 +8E4890039014905390FD934D967697DC6BD27006725872A27368776379BF7BE4 +7E9B8B8058A960C7656665FD66BE6C8C711E71C98C5A98134E6D7A814EDD51AC +51CD52D5540C61A76771685068DF6D1E6F7C75BC77B37AE580F484639285515C +6597675C679375D87AC78373F95A8C469017982D5C6F81C0829A9041906F920D +5F975D9D6A5971C8767B7B4985E48B0491279A30558761F6F95B76697F850000 +D5 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000863F87BA88F8908FF95C6D1B70D973DE7D61843DF95D916A99F1F95E4E82 +53756B046B12703E721B862D9E1E524C8FA35D5064E5652C6B166FEB7C437E9C +85CD896489BD62C981D8881F5ECA67176D6A72FC7405746F878290DE4F865D0D +5FA0840A51B763A075654EAE5006516951C968816A117CAE7CB17CE7826F8AD2 +8F1B91CF4FB6513752F554425EEC616E623E65C56ADA6FFE792A85DC882395AD +9A629A6A9E979ECE529B66C66B77701D792B8F6297426190620065236F230000 +D6 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000714974897DF4806F84EE8F269023934A51BD521752A36D0C70C888C25EC9 +65826BAE6FC27C3E73754EE44F3656F9F95F5CBA5DBA601C73B27B2D7F9A7FCE +8046901E923496F6974898189F614F8B6FA779AE91B496B752DEF960648864C4 +6AD36F5E7018721076E780018606865C8DEF8F0597329B6F9DFA9E75788C797F +7DA083C993049E7F9E938AD658DF5F046727702774CF7C60807E512170287262 +78CA8CC28CDA8CF496F74E8650DA5BEE5ED6659971CE764277AD804A84FC0000 +D7 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000907C9B279F8D58D85A415C626A136DDA6F0F763B7D2F7E37851E893893E4 +964B528965D267F369B46D416E9C700F7409746075597624786B8B2C985E516D +622E96784F96502B5D196DEA7DB88F2A5F8B61446817F961968652D2808B51DC +51CC695E7A1C7DBE83F196754FDA52295398540F550E5C6560A7674E68A86D6C +728172F874067483F96275E27C6C7F797FB8838988CF88E191CC91D096E29BC9 +541D6F7E71D0749885FA8EAA96A39C579E9F67976DCB743381E89716782C0000 +D8 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00007ACB7B207C926469746A75F278BC78E899AC9B549EBB5BDE5E556F20819C +83AB90884E07534D5A295DD25F4E6162633D666966FC6EFF6F2B7063779E842C +8513883B8F1399459C3B551C62B9672B6CAB8309896A977A4EA159845FD85FD9 +671B7DB27F548292832B83BD8F1E909957CB59B95A925BD06627679A68856BCF +71647F758CB78CE390819B4581088C8A964C9A409EA55B5F6C13731B76F276DF +840C51AA8993514D519552C968C96C94770477207DBF7DEC97629EB56EC50000 +D9 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000851151A5540D547D660E669D69276E9F76BF7791831784C2879F91699298 +9CF488824FAE519252DF59C65E3D61556478647966AE67D06A216BCD6BDB725F +72617441773877DB801782BC83058B008B288C8C67286C90726776EE77667A46 +9DA96B7F6C92592267268499536F589359995EDF63CF663467736E3A732B7AD7 +82D7932852D95DEB61AE61CB620A62C764AB65E069596B666BCB712173F7755D +7E46821E8302856A8AA38CBF97279D6158A89ED85011520E543B554F65870000 +DA +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00006C767D0A7D0B805E868A958096EF52FF6C95726954735A9A5C3E5D4B5F4C +5FAE672A68B669636E3C6E4477097C737F8E85878B0E8FF797619EF45CB760B6 +610D61AB654F65FB65FC6C116CEF739F73C97DE195945BC6871C8B10525D535A +62CD640F64B267346A386CCA73C0749E7B947C957E1B818A823685848FEB96F9 +99C14F34534A53CD53DB62CC642C6500659169C36CEE6F5873ED7554762276E4 +76FC78D078FB792C7D46822C87E08FD4981298EF52C362D464A56E246F510000 +DB +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000767C8DCB91B192629AEE9B435023508D574A59A85C285E475F77623F653E +65B965C16609678B699C6EC278C57D2180AA8180822B82B384A1868C8A2A8B17 +90A696329F90500D4FF3F96357F95F9862DC6392676F6E43711976C380CC80DA +88F488F589198CE08F29914D966A4F2F4F705E1B67CF6822767D767E9B445E61 +6A0A716971D4756AF9647E41854385E998DC4F107B4F7F7095A551E15E0668B5 +6C3E6C4E6CDB72AF7BC483036CD5743A50FB528858C164D86A9774A776560000 +DC +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000078A7861795E29739F965535E5F018B8A8FA88FAF908A522577A59C499F08 +4E19500251755C5B5E77661E663A67C468C570B3750175C579C97ADD8F279920 +9A084FDD582158315BF6666E6B656D116E7A6F7D73E4752B83E988DC89138B5C +8F144F0F50D55310535C5B935FA9670D798F8179832F8514890789868F398F3B +99A59C12672C4E764FF859495C015CEF5CF0636768D270FD71A2742B7E2B84EC +8702902292D29CF34E0D4ED84FEF50855256526F5426549057E0592B5A660000 +DD +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00005B5A5B755BCC5E9CF9666276657765A76D6E6EA572367B267C3F7F368150 +8151819A8240829983A98A038CA08CE68CFB8D748DBA90E891DC961C964499D9 +9CE7531752065429567458B35954596E5FFF61A4626E66106C7E711A76C67C89 +7CDE7D1B82AC8CC196F0F9674F5B5F175F7F62C25D29670B68DA787C7E439D6C +4E1550995315532A535159835A625E8760B2618A624962796590678769A76BD4 +6BD66BD76BD86CB8F968743575FA7812789179D579D87C837DCB7FE180A50000 +DE +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000813E81C283F2871A88E88AB98B6C8CBB9119975E98DB9F3B56AC5B2A5F6C +658C6AB36BAF6D5C6FF17015725D73AD8CA78CD3983B61916C3780589A014E4D +4E8B4E9B4ED54F3A4F3C4F7F4FDF50FF53F253F8550655E356DB58EB59625A11 +5BEB5BFA5C045DF35E2B5F99601D6368659C65AF67F667FB68AD6B7B6C996CD7 +6E23700973457802793E7940796079C17BE97D177D728086820D838E84D186C7 +88DF8A508A5E8B1D8CDC8D668FAD90AA98FC99DF9E9D524AF9696714F96A0000 +DF +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00005098522A5C7165636C5573CA7523759D7B97849C917897304E7764926BBA +715E85A94E09F96B674968EE6E17829F8518886B63F76F81921298AF4E0A50B7 +50CF511F554655AA56175B405C195CE05E385E8A5EA05EC260F368516A616E58 +723D724072C076F879657BB17FD488F389F48A738C618CDE971C585E74BD8CFD +55C7F96C7A617D2282727272751F7525F96D7B19588558FB5DBC5E8F5EB65F90 +60556292637F654D669166D966F8681668F27280745E7B6E7D6E7DD67F720000 +E0 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000080E5821285AF897F8A93901D92E49ECD9F205915596D5E2D60DC66146673 +67906C506DC56F5F77F378A984C691CB932B4ED950CA514855845B0B5BA36247 +657E65CB6E32717D74017444748774BF766C79AA7DDA7E557FA8817A81B38239 +861A87EC8A758DE3907892919425994D9BAE53685C5169546CC46D296E2B820C +859B893B8A2D8AAA96EA9F67526166B96BB27E9687FE8D0D9583965D651D6D89 +71EEF96E57CE59D35BAC602760FA6210661F665F732973F976DB77017B6C0000 +E1 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00008056807281658AA091924E1652E26B726D177A057B397D30F96F8CB053EC +562F58515BB55C0F5C115DE2624063836414662D68B36CBC6D886EAF701F70A4 +71D27526758F758E76197B117BE07C2B7D207D39852C856D86078A34900D9061 +90B592B797F69A374FD75C6C675F6D917C9F7E8C8B168D16901F5B6B5DFD640D +84C0905C98E173875B8B609A677E6DDE8A1F8AA69001980C5237F9707051788E +9396887091D74FEE53D755FD56DA578258FD5AC25B885CAB5CC05E2561010000 +E2 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000620D624B6388641C653665786A396B8A6C346D196F3171E772E973787407 +74B27626776179C07A577AEA7CB97D8F7DAC7E617F9E81298331849084DA85EA +88968AB08B908F3890429083916C929692B9968B96A796A896D6970098089996 +9AD39B1A53D4587E59195B705BBF6DD16F5A719F742174B9808583FD5DE15F87 +5FAA604265EC6812696F6A536B896D356DF373E376FE77AC7B4D7D148123821C +834084F485638A628AC49187931E980699B4620C88538FF092655D075D270000 +E3 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00005D69745F819D87686FD562FE7FD2893689724E1E4E5850E752DD5347627F +66077E698805965E4F8D5319563659CB5AA45C385C4E5C4D5E025F11604365BD +662F664267BE67F4731C77E2793A7FC5849484CD89968A668A698AE18C558C7A +57F45BD45F0F606F62ED690D6B966E5C71847BD287558B588EFE98DF98FE4F38 +4F814FE1547B5A205BB8613C65B0666871FC7533795E7D33814E81E3839885AA +85CE87038A0A8EAB8F9BF9718FC559315BA45BE660895BE95C0B5FC36C810000 +E4 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000F9726DF1700B751A82AF8AF64EC05341F97396D96C0F4E9E4FC45152555E +5A255CE86211725982BD83AA86FE88598A1D963F96C599139D099D5D580A5CB3 +5DBD5E4460E1611563E16A026E2591029354984E9C109F775B895CB86309664F +6848773C96C1978D98549B9F65A18B018ECB95BC55355CA95DD65EB56697764C +83F495C758D362BC72CE9D284EF0592E600F663B6B8379E79D26539354C057C3 +5D16611B66D66DAF788D827E969897445384627C63966DB27E0A814B984D0000 +E5 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00006AFB7F4C9DAF9E1A4E5F503B51B6591C60F963F66930723A8036F97491CE +5F31F975F9767D0482E5846F84BB85E58E8DF9774F6FF978F97958E45B436059 +63DA6518656D6698F97A694A6A236D0B7001716C75D2760D79B37A70F97B7F8A +F97C8944F97D8B9391C0967DF97E990A57045FA165BC6F01760079A68A9E99AD +9B5A9F6C510461B662916A8D81C6504358305F6671098A008AFA5B7C86164FFA +513C56B4594463A96DF95DAA696D51864E884F59F97FF980F9815982F9820000 +E6 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000F9836B5F6C5DF98474B57916F9858207824583398F3F8F5DF9869918F987 +F988F9894EA6F98A57DF5F796613F98BF98C75AB7E798B6FF98D90069A5B56A5 +582759F85A1F5BB4F98E5EF6F98FF9906350633BF991693D6C876CBF6D8E6D93 +6DF56F14F99270DF71367159F99371C371D5F994784F786FF9957B757DE3F996 +7E2FF997884D8EDFF998F999F99A925BF99B9CF6F99CF99DF99E60856D85F99F +71B1F9A0F9A195B153ADF9A2F9A3F9A467D3F9A5708E71307430827682D20000 +E7 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000F9A695BB9AE59E7D66C4F9A771C18449F9A8F9A9584BF9AAF9AB5DB85F71 +F9AC6620668E697969AE6C386CF36E366F416FDA701B702F715071DF7370F9AD +745BF9AE74D476C87A4E7E93F9AFF9B082F18A608FCEF9B19348F9B29719F9B3 +F9B44E42502AF9B5520853E166F36C6D6FCA730A777F7A6282AE85DD8602F9B6 +88D48A638B7D8C6BF9B792B3F9B8971398104E944F0D4FC950B25348543E5433 +55DA586258BA59675A1B5BE4609FF9B961CA655665FF666468A76C5A6FB30000 +E8 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000070CF71AC73527B7D87088AA49C329F075C4B6C8373447389923A6EAB7465 +761F7A697E15860A514058C564C174EE751576707FC1909596CD99546E2674E6 +7AA97AAA81E586D987788A1B5A495B8C5B9B68A169006D6373A97413742C7897 +7DE97FEB81188155839E8C4C962E981166F05F8065FA67896C6A738B502D5A03 +6B6A77EE59165D6C5DCD7325754FF9BAF9BB50E551F9582F592D599659DA5BE5 +F9BCF9BD5DA262D76416649364FEF9BE66DCF9BF6A48F9C071FF7464F9C10000 +E9 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00007A887AAF7E477E5E80008170F9C287EF89818B209059F9C390809952617E +6B326D747E1F89258FB14FD150AD519752C757C758895BB95EB8614269956D8C +6E676EB6719474627528752C8073833884C98E0A939493DEF9C44E8E4F515076 +512A53C853CB53F35B875BD35C24611A618265F4725B7397744076C279507991 +79B97D067FBD828B85D5865E8FC2904790F591EA968596E896E952D65F6765ED +6631682F715C7A3690C1980A4E91F9C56A526B9E6F907189801882B885530000 +EA +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000904B969596F297FB851A9B314E90718A96C45143539F54E15713571257A3 +5A9B5AC45BC36028613F63F46C856D396E726E907230733F745782D188818F45 +9060F9C6966298589D1B67088D8A925E4F4D504950DE5371570D59D45A015C09 +617066906E2D7232744B7DEF80C3840E8466853F875F885B89188B02905597CB +9B4F4E734F915112516AF9C7552F55A95B7A5BA55E7C5E7D5EBE60A060DF6108 +610963C465386709F9C867D467DAF9C9696169626CB96D27F9CA6E38F9CB0000 +EB +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00006FE173367337F9CC745C7531F9CD7652F9CEF9CF7DAD81FE843888D58A98 +8ADB8AED8E308E42904A903E907A914991C9936EF9D0F9D15809F9D26BD38089 +80B2F9D3F9D45141596B5C39F9D5F9D66F6473A780E48D07F9D79217958FF9D8 +F9D9F9DAF9DB807F620E701C7D68878DF9DC57A0606961476BB78ABE928096B1 +4E59541F6DEB852D967097F398EE63D66CE3909151DD61C981BA9DF94F9D501A +51005B9C610F61FF64EC69056BC5759177E37FA98264858F87FB88638ABC0000 +EC +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00008B7091AB4E8C4EE54F0AF9DDF9DE593759E8F9DF5DF25F1B5F5B6021F9E0 +F9E1F9E2F9E3723E73E5F9E4757075CDF9E579FBF9E6800C8033808482E18351 +F9E7F9E88CBD8CB39087F9E9F9EA98F4990CF9EBF9EC703776CA7FCA7FCC7FFC +8B1A4EBA4EC152035370F9ED54BD56E059FB5BC55F155FCD6E6EF9EEF9EF7D6A +8335F9F086938A8DF9F1976D9777F9F2F9F34E004F5A4F7E58F965E56EA29038 +93B099B94EFB58EC598A59D96041F9F4F9F57A14F9F6834F8CC3516553440000 +ED +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000F9F7F9F8F9F94ECD52695B5582BF4ED4523A54A859C959FF5B505B575B5C +606361486ECB7099716E738674F775B578C17D2B800581EA8328851785C98AEE +8CC796CC4F5C52FA56BC65AB6628707C70B872357DBD828D914C96C09D725B71 +68E76B986F7A76DE5C9166AB6F5B7BB47C2A883696DC4E084ED75320583458BB +58EF596C5C075E335E845F35638C66B267566A1F6AA36B0C6F3F7246F9FA7350 +748B7AE07CA7817881DF81E7838A846C8523859485CF88DD8D1391AC95770000 +EE +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000969C518D54C957285BB0624D6750683D68936E3D6ED3707D7E2188C18CA1 +8F099F4B9F4E722D7B8F8ACD931A4F474F4E5132548059D05E9562B56775696E +6A176CAE6E1A72D9732A75BD7BB87D3582E783F9845785F78A5B8CAF8E879019 +90B896CE9F5F52E3540A5AE15BC2645865756EF472C4F9FB76847A4D7B1B7C4D +7E3E7FDF837B8B2B8CCA8D648DE18E5F8FEA8FF9906993D14F434F7A50B35168 +5178524D526A5861587C59605C085C555EDB609B623068136BBF6C086FB10000 +EF +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000714E742075307538755176727B4C7B8B7BAD7BC67E8F8A6E8F3E8F49923F +92939322942B96FB985A986B991E5207622A62986D5976647ACA7BC07D765360 +5CBE5E976F3870B97C9897119B8E9EDE63A5647A87764E014E954EAD505C5075 +544859C35B9A5E405EAD5EF75F8160C5633A653F657465CC6676667867FE6968 +6A896B636C406DC06DE86E1F6E5E701E70A1738E73FD753A775B7887798E7A0B +7A7D7CBE7D8E82478A028AEA8C9E912D914A91D8926692CC9320970697560000 +F0 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000975C98029F0E52365291557C58245E1D5F1F608C63D068AF6FDF796D7B2C +81CD85BA88FD8AF88E44918D9664969B973D984C9F4A4FCE514651CB52A95632 +5F145F6B63AA64CD65E9664166FA66F9671D689D68D769FD6F156F6E716771E5 +722A74AA773A7956795A79DF7A207A957C977CDF7D447E70808785FB86A48A54 +8ABF8D998E819020906D91E3963B96D59CE565CF7C078DB393C35B585C0A5352 +62D9731D50275B975F9E60B0616B68D56DD9742E7A2E7D427D9C7E31816B0000 +F1 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00008E2A8E35937E94184F5057505DE65EA7632B7F6A4E3B4F4F4F8F505A59DD +80C4546A546855FE594F5B995DDE5EDA665D673167F1682A6CE86D326E4A6F8D +70B773E075877C4C7D027D2C7DA2821F86DB8A3B8A858D708E8A8F339031914E +9152944499D07AF97CA54FCA510151C657C85BEF5CFB66596A3D6D5A6E966FEC +710C756F7AE388229021907596CB99FF83014E2D4EF2884691CD537D6ADB696B +6C41847A589E618E66FE62EF70DD751175C77E5284B88B498D084E4B53EA0000 +F2 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000054AB573057405FD763016307646F652F65E8667A679D67B36B626C606C9A +6F2C77E57825794979577D1980A2810281F3829D82B787188A8CF9FC8D048DBE +907276F47A197A377E548077550755D45875632F64226649664B686D699B6B84 +6D256EB173CD746874A1755B75B976E1771E778B79E67E097E1D81FB852F8897 +8A3A8CD18EEB8FB0903293AD9663967397074F8453F159EA5AC95E19684E74C6 +75BE79E97A9281A386ED8CEA8DCC8FED659F6715F9FD57F76F577DDD8F2F0000 +F3 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000093F696C65FB561F26F844E144F98501F53C955DF5D6F5DEE6B216B6478CB +7B9AF9FE8E498ECA906E6349643E77407A84932F947F9F6A64B06FAF71E674A8 +74DA7AC47C127E827CB27E988B9A8D0A947D9910994C52395BDF64E6672D7D2E +50ED53C358796158615961FA65AC7AD98B928B9650095021527555315A3C5EE0 +5F706134655E660C663666A269CD6EC46F32731676217A938139825983D684BC +50B557F05BC05BE85F6963A178267DB583DC852191C791F5518A67F57B560000 +F4 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00008CAC51C459BB60BD8655501CF9FF52545C3A617D621A62D364F265A56ECC +7620810A8E60965F96BB4EDF5343559859295DDD64C56CC96DFA73947A7F821B +85A68CE48E10907791E795E1962197C651F854F255865FB964A46F887DB48F1F +8F4D943550C95C166CBE6DFB751B77BB7C3D7C648A798AC2581E59BE5E166377 +7252758A776B8ADC8CBC8F125EF366746DF8807D83C18ACB97519BD6FA005243 +66FF6D956EEF7DE08AE6902E905E9AD4521D527F54E86194628462DB68A20000 +F5 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00006912695A6A3570927126785D7901790E79D27A0D8096827882D583498549 +8C828D859162918B91AE4FC356D171ED77D7870089F85BF85FD6675190A853E2 +585A5BF560A4618164607E3D80708525928364AE50AC5D146700589C62BD63A8 +690E69786A1E6E6B76BA79CB82BB84298ACF8DA88FFD9112914B919C93109318 +939A96DB9A369C0D4E11755C795D7AFA7B517BC97E2E84C48E598E748EF89010 +6625693F744351FA672E9EDC51455FE06C9687F2885D887760B481B584030000 +F6 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00008D0553D6543956345A365C31708A7FE0805A810681ED8DA391899A5F9DF2 +50744EC453A060FB6E2C5C644F88502455E45CD95E5F606568946CBB6DC471BE +75D475F476617A1A7A497DC77DFB7F6E81F486A98F1C96C999B39F52524752C5 +98ED89AA4E0367D26F064FB55BE267956C886D78741B782791DD937C87C479E4 +7A315FEB4ED654A4553E58AE59A560F0625362D6673669558235964099B199DD +502C53535544577CFA016258FA0264E2666B67DD6FC16FEF742274388A170000 +F7 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000094385451560657665F48619A6B4E705870AD7DBB8A95596A812B63A27708 +803D8CAA5854642D69BB5B955E116E6FFA038569514C53F0592A6020614B6B86 +6C706CF07B1E80CE82D48DC690B098B1FA0464C76FA464916504514E5410571F +8A0E615F6876FA0575DB7B527D71901A580669CC817F892A9000983950785957 +59AC6295900F9B2A615D727995D657615A465DF4628A64AD64FA67776CE26D3E +722C743678347F7782AD8DDB981752245742677F724874E38CA98FA692110000 +F8 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000962A516B53ED634C4F695504609665576C9B6D7F724C72FD7A1789878C9D +5F6D6F8E70F981A8610E4FBF504F624172477BC77DE87FE9904D97AD9A198CB6 +576A5E7367B0840D8A5554205B165E635EE25F0A658380BA853D9589965B4F48 +5305530D530F548654FA57035E036016629B62B16355FA066CE16D6675B17832 +80DE812F82DE846184B2888D8912900B92EA98FD9B915E4566B466DD70117206 +FA074FF5527D5F6A615367536A196F0274E2796888688C7998C798C49A430000 +F9 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000054C17A1F69538AF78C4A98A899AE5F7C62AB75B276AE88AB907F96425339 +5F3C5FC56CCC73CC7562758B7B4682FE999D4E4F903C4E0B4F5553A6590F5EC8 +66306CB37455837787668CC09050971E9C1558D15B7886508B149DB45BD26068 +608D65F16C576F226FA3701A7F557FF095919592965097D352728F4451FD542B +54B85563558A6ABB6DB57DD88266929C96779E79540854C876D286E495A495D4 +965C4EA24F0959EE5AE65DF760526297676D68416C866E2F7F38809B822A0000 +FA +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000FA08FA0998054EA5505554B35793595A5B695BB361C869776D77702387F9 +89E38A728AE7908299ED9AB852BE683850165E78674F8347884C4EAB541156AE +73E6911597FF9909995799995653589F865B8A3161B26AF6737B8ED26B4796AA +9A57595572008D6B97694FD45CF45F2661F8665B6CEB70AB738473B973FE7729 +774D7D437D627E2382378852FA0A8CE29249986F5B517A74884098015ACC4FE0 +5354593E5CFD633E6D7972F98105810783A292CF98304EA851445211578B0000 +FB +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00005F626CC26ECE7005705070AF719273E97469834A87A28861900890A293A3 +99A8516E5F5760E0616766B385598E4A91AF978B4E4E4E92547C58D558FA597D +5CB55F2762366248660A66676BEB6D696DCF6E566EF86F946FE06FE9705D72D0 +7425745A74E07693795C7CCA7E1E80E182A6846B84BF864E865F87748B778C6A +93AC9800986560D1621691775A5A660F6DF76E3E743F9B425FFD60DA7B0F54C4 +5F186C5E6CD36D2A70D87D0586798A0C9D3B5316548C5B056A3A706B75750000 +FC +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000798D79BE82B183EF8A718B418CA89774FA0B64F4652B78BA78BB7A6B4E38 +559A59505BA65E7B60A363DB6B61666568536E19716574B07D0890849A699C25 +6D3B6ED1733E8C4195CA51F05E4C5FA8604D60F66130614C6643664469A56CC1 +6E5F6EC96F62714C749C76877BC17C27835287579051968D9EC3532F56DE5EFB +5F8A6062609461F7666667036A9C6DEE6FAE7070736A7E6A81BE833486D48AA8 +8CC4528373725B966A6B940454EE56865B5D6548658566C9689F6D8D6DC60000 +FD +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000723B80B491759A4D4FAF5019539A540E543C558955C55E3F5F8C673D7166 +73DD900552DB52F3586458CE7104718F71FB85B08A13668885A855A76684714A +8431534955996BC15F595FBD63EE668971478AF18F1D9EBE4F11643A70CB7566 +866760648B4E9DF8514751F653086D3680F89ED166156B23709875D554035C79 +7D078A166B206B3D6B46543860706D3D7FD5820850D651DE559C566B56CD59EC +5B095E0C619961986231665E66E6719971B971BA72A779A77A007FB28A700000 diff --git a/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/cp950.enc b/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/cp950.enc new file mode 100644 index 0000000000000000000000000000000000000000..f33d7854a6a2686910837bb487b4555ceb1240a2 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/cp950.enc @@ -0,0 +1,1499 @@ +# Encoding file: cp950, multi-byte +M +003F 0 88 +00 +0000000100020003000400050006000700080009000A000B000C000D000E000F +0010001100120013001400150016001700180019001A001B001C001D001E001F +0020002100220023002400250026002700280029002A002B002C002D002E002F +0030003100320033003400350036003700380039003A003B003C003D003E003F +0040004100420043004400450046004700480049004A004B004C004D004E004F +0050005100520053005400550056005700580059005A005B005C005D005E005F +0060006100620063006400650066006700680069006A006B006C006D006E006F +0070007100720073007400750076007700780079007A007B007C007D007E007F +0080008100820083008400850086008700880089008A008B008C008D008E008F +0090009100920093009400950096009700980099009A009B009C009D009E009F +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +A1 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +3000FF0C30013002FF0E2027FF1BFF1AFF1FFF01FE3020262025FE50FE51FE52 +00B7FE54FE55FE56FE57FF5C2013FE312014FE332574FE34FE4FFF08FF09FE35 +FE36FF5BFF5DFE37FE3830143015FE39FE3A30103011FE3BFE3C300A300BFE3D +FE3E30083009FE3FFE40300C300DFE41FE42300E300FFE43FE44FE59FE5A0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000FE5BFE5CFE5DFE5E20182019201C201D301D301E20352032FF03FF06FF0A +203B00A7300325CB25CF25B325B225CE2606260525C725C625A125A025BD25BC +32A3210500AFFFE3FF3F02CDFE49FE4AFE4DFE4EFE4BFE4CFE5FFE60FE61FF0B +FF0D00D700F700B1221AFF1CFF1EFF1D226622672260221E22522261FE62FE63 +FE64FE65FE66FF5E2229222A22A52220221F22BF33D233D1222B222E22352234 +26402642229522992191219321902192219621972199219822252223FF0F0000 +A2 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +FF3C2215FE68FF04FFE53012FFE0FFE1FF05FF2021032109FE69FE6AFE6B33D5 +339C339D339E33CE33A1338E338F33C400B05159515B515E515D5161516355E7 +74E97CCE25812582258325842585258625872588258F258E258D258C258B258A +2589253C2534252C2524251C2594250025022595250C251025142518256D0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000256E2570256F2550255E256A256125E225E325E525E4257125722573FF10 +FF11FF12FF13FF14FF15FF16FF17FF18FF192160216121622163216421652166 +216721682169302130223023302430253026302730283029534153445345FF21 +FF22FF23FF24FF25FF26FF27FF28FF29FF2AFF2BFF2CFF2DFF2EFF2FFF30FF31 +FF32FF33FF34FF35FF36FF37FF38FF39FF3AFF41FF42FF43FF44FF45FF46FF47 +FF48FF49FF4AFF4BFF4CFF4DFF4EFF4FFF50FF51FF52FF53FF54FF55FF560000 +A3 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +FF57FF58FF59FF5A039103920393039403950396039703980399039A039B039C +039D039E039F03A003A103A303A403A503A603A703A803A903B103B203B303B4 +03B503B603B703B803B903BA03BB03BC03BD03BE03BF03C003C103C303C403C5 +03C603C703C803C931053106310731083109310A310B310C310D310E310F0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00003110311131123113311431153116311731183119311A311B311C311D311E +311F312031213122312331243125312631273128312902D902C902CA02C702CB +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000020AC00000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +A4 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +4E004E594E014E034E434E5D4E864E8C4EBA513F5165516B51E052005201529B +53155341535C53C84E094E0B4E084E0A4E2B4E3851E14E454E484E5F4E5E4E8E +4EA15140520352FA534353C953E3571F58EB5915592759735B505B515B535BF8 +5C0F5C225C385C715DDD5DE55DF15DF25DF35DFE5E725EFE5F0B5F13624D0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00004E114E104E0D4E2D4E304E394E4B5C394E884E914E954E924E944EA24EC1 +4EC04EC34EC64EC74ECD4ECA4ECB4EC4514351415167516D516E516C519751F6 +52065207520852FB52FE52FF53165339534853475345535E538453CB53CA53CD +58EC5929592B592A592D5B545C115C245C3A5C6F5DF45E7B5EFF5F145F155FC3 +62086236624B624E652F6587659765A465B965E566F0670867286B206B626B79 +6BCB6BD46BDB6C0F6C34706B722A7236723B72477259725B72AC738B4E190000 +A5 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +4E164E154E144E184E3B4E4D4E4F4E4E4EE54ED84ED44ED54ED64ED74EE34EE4 +4ED94EDE514551445189518A51AC51F951FA51F8520A52A0529F530553065317 +531D4EDF534A534953615360536F536E53BB53EF53E453F353EC53EE53E953E8 +53FC53F853F553EB53E653EA53F253F153F053E553ED53FB56DB56DA59160000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000592E5931597459765B555B835C3C5DE85DE75DE65E025E035E735E7C5F01 +5F185F175FC5620A625362546252625165A565E6672E672C672A672B672D6B63 +6BCD6C116C106C386C416C406C3E72AF7384738974DC74E67518751F75287529 +7530753175327533758B767D76AE76BF76EE77DB77E277F3793A79BE7A747ACB +4E1E4E1F4E524E534E694E994EA44EA64EA54EFF4F094F194F0A4F154F0D4F10 +4F114F0F4EF24EF64EFB4EF04EF34EFD4F014F0B514951475146514851680000 +A6 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +5171518D51B0521752115212520E521652A3530853215320537053715409540F +540C540A54105401540B54045411540D54085403540E5406541256E056DE56DD +573357305728572D572C572F57295919591A59375938598459785983597D5979 +598259815B575B585B875B885B855B895BFA5C165C795DDE5E065E765E740000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00005F0F5F1B5FD95FD6620E620C620D62106263625B6258653665E965E865EC +65ED66F266F36709673D6734673167356B216B646B7B6C166C5D6C576C596C5F +6C606C506C556C616C5B6C4D6C4E7070725F725D767E7AF97C737CF87F367F8A +7FBD80018003800C80128033807F8089808B808C81E381EA81F381FC820C821B +821F826E8272827E866B8840884C8863897F96214E324EA84F4D4F4F4F474F57 +4F5E4F344F5B4F554F304F504F514F3D4F3A4F384F434F544F3C4F464F630000 +A7 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +4F5C4F604F2F4F4E4F364F594F5D4F484F5A514C514B514D517551B651B75225 +52245229522A522852AB52A952AA52AC532353735375541D542D541E543E5426 +544E542754465443543354485442541B5429544A5439543B5438542E54355436 +5420543C54405431542B541F542C56EA56F056E456EB574A57515740574D0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00005747574E573E5750574F573B58EF593E599D599259A8599E59A359995996 +598D59A45993598A59A55B5D5B5C5B5A5B5B5B8C5B8B5B8F5C2C5C405C415C3F +5C3E5C905C915C945C8C5DEB5E0C5E8F5E875E8A5EF75F045F1F5F645F625F77 +5F795FD85FCC5FD75FCD5FF15FEB5FF85FEA6212621162846297629662806276 +6289626D628A627C627E627962736292626F6298626E62956293629162866539 +653B653865F166F4675F674E674F67506751675C6756675E6749674667600000 +A8 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +675367576B656BCF6C426C5E6C996C816C886C896C856C9B6C6A6C7A6C906C70 +6C8C6C686C966C926C7D6C836C726C7E6C746C866C766C8D6C946C986C827076 +707C707D707872627261726072C472C27396752C752B75377538768276EF77E3 +79C179C079BF7A767CFB7F5580968093809D8098809B809A80B2826F82920000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000828B828D898B89D28A008C378C468C558C9D8D648D708DB38EAB8ECA8F9B +8FB08FC28FC68FC58FC45DE1909190A290AA90A690A3914991C691CC9632962E +9631962A962C4E264E564E734E8B4E9B4E9E4EAB4EAC4F6F4F9D4F8D4F734F7F +4F6C4F9B4F8B4F864F834F704F754F884F694F7B4F964F7E4F8F4F914F7A5154 +51525155516951775176517851BD51FD523B52385237523A5230522E52365241 +52BE52BB5352535453535351536653775378537953D653D453D7547354750000 +A9 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +5496547854955480547B5477548454925486547C549054715476548C549A5462 +5468548B547D548E56FA57835777576A5769576157665764577C591C59495947 +59485944595459BE59BB59D459B959AE59D159C659D059CD59CB59D359CA59AF +59B359D259C55B5F5B645B635B975B9A5B985B9C5B995B9B5C1A5C485C450000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00005C465CB75CA15CB85CA95CAB5CB15CB35E185E1A5E165E155E1B5E115E78 +5E9A5E975E9C5E955E965EF65F265F275F295F805F815F7F5F7C5FDD5FE05FFD +5FF55FFF600F6014602F60356016602A6015602160276029602B601B62166215 +623F623E6240627F62C962CC62C462BF62C262B962D262DB62AB62D362D462CB +62C862A862BD62BC62D062D962C762CD62B562DA62B162D862D662D762C662AC +62CE653E65A765BC65FA66146613660C66066602660E6600660F6615660A0000 +AA +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +6607670D670B676D678B67956771679C677367776787679D6797676F6770677F +6789677E67906775679A6793677C676A67726B236B666B676B7F6C136C1B6CE3 +6CE86CF36CB16CCC6CE56CB36CBD6CBE6CBC6CE26CAB6CD56CD36CB86CC46CB9 +6CC16CAE6CD76CC56CF16CBF6CBB6CE16CDB6CCA6CAC6CEF6CDC6CD66CE00000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00007095708E7092708A7099722C722D723872487267726972C072CE72D972D7 +72D073A973A8739F73AB73A5753D759D7599759A768476C276F276F477E577FD +793E7940794179C979C87A7A7A797AFA7CFE7F547F8C7F8B800580BA80A580A2 +80B180A180AB80A980B480AA80AF81E581FE820D82B3829D829982AD82BD829F +82B982B182AC82A582AF82B882A382B082BE82B7864E8671521D88688ECB8FCE +8FD48FD190B590B890B190B691C791D195779580961C9640963F963B96440000 +AB +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +964296B996E89752975E4E9F4EAD4EAE4FE14FB54FAF4FBF4FE04FD14FCF4FDD +4FC34FB64FD84FDF4FCA4FD74FAE4FD04FC44FC24FDA4FCE4FDE4FB751575192 +519151A0524E5243524A524D524C524B524752C752C952C352C1530D5357537B +539A53DB54AC54C054A854CE54C954B854A654B354C754C254BD54AA54C10000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000054C454C854AF54AB54B154BB54A954A754BF56FF5782578B57A057A357A2 +57CE57AE579359555951594F594E595059DC59D859FF59E359E85A0359E559EA +59DA59E65A0159FB5B695BA35BA65BA45BA25BA55C015C4E5C4F5C4D5C4B5CD9 +5CD25DF75E1D5E255E1F5E7D5EA05EA65EFA5F085F2D5F655F885F855F8A5F8B +5F875F8C5F896012601D60206025600E6028604D60706068606260466043606C +606B606A6064624162DC6316630962FC62ED630162EE62FD630762F162F70000 +AC +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +62EF62EC62FE62F463116302653F654565AB65BD65E26625662D66206627662F +661F66286631662466F767FF67D367F167D467D067EC67B667AF67F567E967EF +67C467D167B467DA67E567B867CF67DE67F367B067D967E267DD67D26B6A6B83 +6B866BB56BD26BD76C1F6CC96D0B6D326D2A6D416D256D0C6D316D1E6D170000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00006D3B6D3D6D3E6D366D1B6CF56D396D276D386D296D2E6D356D0E6D2B70AB +70BA70B370AC70AF70AD70B870AE70A472307272726F727472E972E072E173B7 +73CA73BB73B273CD73C073B3751A752D754F754C754E754B75AB75A475A575A2 +75A3767876867687768876C876C676C376C5770176F976F87709770B76FE76FC +770777DC78027814780C780D794679497948794779B979BA79D179D279CB7A7F +7A817AFF7AFD7C7D7D027D057D007D097D077D047D067F387F8E7FBF80040000 +AD +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +8010800D8011803680D680E580DA80C380C480CC80E180DB80CE80DE80E480DD +81F4822282E78303830582E382DB82E6830482E58302830982D282D782F18301 +82DC82D482D182DE82D382DF82EF830686508679867B867A884D886B898189D4 +8A088A028A038C9E8CA08D748D738DB48ECD8ECC8FF08FE68FE28FEA8FE50000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00008FED8FEB8FE48FE890CA90CE90C190C3914B914A91CD95829650964B964C +964D9762976997CB97ED97F3980198A898DB98DF999699994E584EB3500C500D +50234FEF502650254FF8502950165006503C501F501A501250114FFA50005014 +50284FF15021500B501950184FF34FEE502D502A4FFE502B5009517C51A451A5 +51A251CD51CC51C651CB5256525C5254525B525D532A537F539F539D53DF54E8 +55105501553754FC54E554F2550654FA551454E954ED54E1550954EE54EA0000 +AE +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +54E65527550754FD550F5703570457C257D457CB57C35809590F59575958595A +5A115A185A1C5A1F5A1B5A1359EC5A205A235A295A255A0C5A095B6B5C585BB0 +5BB35BB65BB45BAE5BB55BB95BB85C045C515C555C505CED5CFD5CFB5CEA5CE8 +5CF05CF65D015CF45DEE5E2D5E2B5EAB5EAD5EA75F315F925F915F9060590000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00006063606560506055606D6069606F6084609F609A608D6094608C60856096 +624762F3630862FF634E633E632F635563426346634F6349633A6350633D632A +632B6328634D634C65486549659965C165C566426649664F66436652664C6645 +664166F867146715671768216838684868466853683968426854682968B36817 +684C6851683D67F468506840683C6843682A68456813681868416B8A6B896BB7 +6C236C276C286C266C246CF06D6A6D956D886D876D666D786D776D596D930000 +AF +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +6D6C6D896D6E6D5A6D746D696D8C6D8A6D796D856D656D9470CA70D870E470D9 +70C870CF7239727972FC72F972FD72F872F7738673ED740973EE73E073EA73DE +7554755D755C755A755975BE75C575C775B275B375BD75BC75B975C275B8768B +76B076CA76CD76CE7729771F7720772877E9783078277838781D783478370000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00007825782D7820781F7832795579507960795F7956795E795D7957795A79E4 +79E379E779DF79E679E979D87A847A887AD97B067B117C897D217D177D0B7D0A +7D207D227D147D107D157D1A7D1C7D0D7D197D1B7F3A7F5F7F947FC57FC18006 +8018801580198017803D803F80F1810280F0810580ED80F4810680F880F38108 +80FD810A80FC80EF81ED81EC82008210822A822B8228822C82BB832B83528354 +834A83388350834983358334834F833283398336831783408331832883430000 +B0 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +8654868A86AA869386A486A9868C86A3869C8870887788818882887D88798A18 +8A108A0E8A0C8A158A0A8A178A138A168A0F8A118C488C7A8C798CA18CA28D77 +8EAC8ED28ED48ECF8FB1900190068FF790008FFA8FF490038FFD90058FF89095 +90E190DD90E29152914D914C91D891DD91D791DC91D995839662966396610000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000965B965D96649658965E96BB98E299AC9AA89AD89B259B329B3C4E7E507A +507D505C50475043504C505A504950655076504E5055507550745077504F500F +506F506D515C519551F0526A526F52D252D952D852D55310530F5319533F5340 +533E53C366FC5546556A55665544555E55615543554A55315556554F5555552F +55645538552E555C552C55635533554155575708570B570957DF5805580A5806 +57E057E457FA5802583557F757F9592059625A365A415A495A665A6A5A400000 +B1 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +5A3C5A625A5A5A465A4A5B705BC75BC55BC45BC25BBF5BC65C095C085C075C60 +5C5C5C5D5D075D065D0E5D1B5D165D225D115D295D145D195D245D275D175DE2 +5E385E365E335E375EB75EB85EB65EB55EBE5F355F375F575F6C5F695F6B5F97 +5F995F9E5F985FA15FA05F9C607F60A3608960A060A860CB60B460E660BD0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000060C560BB60B560DC60BC60D860D560C660DF60B860DA60C7621A621B6248 +63A063A76372639663A263A563776367639863AA637163A963896383639B636B +63A863846388639963A163AC6392638F6380637B63696368637A655D65566551 +65596557555F654F655865556554659C659B65AC65CF65CB65CC65CE665D665A +666466686666665E66F952D7671B688168AF68A2689368B5687F687668B168A7 +689768B0688368C468AD688668856894689D68A8689F68A168826B326BBA0000 +B2 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +6BEB6BEC6C2B6D8E6DBC6DF36DD96DB26DE16DCC6DE46DFB6DFA6E056DC76DCB +6DAF6DD16DAE6DDE6DF96DB86DF76DF56DC56DD26E1A6DB56DDA6DEB6DD86DEA +6DF16DEE6DE86DC66DC46DAA6DEC6DBF6DE670F97109710A70FD70EF723D727D +7281731C731B73167313731973877405740A7403740673FE740D74E074F60000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000074F7751C75227565756675627570758F75D475D575B575CA75CD768E76D4 +76D276DB7737773E773C77367738773A786B7843784E79657968796D79FB7A92 +7A957B207B287B1B7B2C7B267B197B1E7B2E7C927C977C957D467D437D717D2E +7D397D3C7D407D307D337D447D2F7D427D327D317F3D7F9E7F9A7FCC7FCE7FD2 +801C804A8046812F81168123812B81298130812482028235823782368239838E +839E8398837883A2839683BD83AB8392838A8393838983A08377837B837C0000 +B3 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +838683A786555F6A86C786C086B686C486B586C686CB86B186AF86C98853889E +888888AB88928896888D888B8993898F8A2A8A1D8A238A258A318A2D8A1F8A1B +8A228C498C5A8CA98CAC8CAB8CA88CAA8CA78D678D668DBE8DBA8EDB8EDF9019 +900D901A90179023901F901D90109015901E9020900F90229016901B90140000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000090E890ED90FD915791CE91F591E691E391E791ED91E99589966A96759673 +96789670967496769677966C96C096EA96E97AE07ADF980298039B5A9CE59E75 +9E7F9EA59EBB50A2508D508550995091508050965098509A670051F152725274 +5275526952DE52DD52DB535A53A5557B558055A7557C558A559D55985582559C +55AA55945587558B558355B355AE559F553E55B2559A55BB55AC55B1557E5589 +55AB5599570D582F582A58345824583058315821581D582058F958FA59600000 +B4 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +5A775A9A5A7F5A925A9B5AA75B735B715BD25BCC5BD35BD05C0A5C0B5C315D4C +5D505D345D475DFD5E455E3D5E405E435E7E5ECA5EC15EC25EC45F3C5F6D5FA9 +5FAA5FA860D160E160B260B660E0611C612360FA611560F060FB60F4616860F1 +610E60F6610961006112621F624963A3638C63CF63C063E963C963C663CD0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000063D263E363D063E163D663ED63EE637663F463EA63DB645263DA63F9655E +6566656265636591659065AF666E667066746676666F6691667A667E667766FE +66FF671F671D68FA68D568E068D868D7690568DF68F568EE68E768F968D268F2 +68E368CB68CD690D6912690E68C968DA696E68FB6B3E6B3A6B3D6B986B966BBC +6BEF6C2E6C2F6C2C6E2F6E386E546E216E326E676E4A6E206E256E236E1B6E5B +6E586E246E566E6E6E2D6E266E6F6E346E4D6E3A6E2C6E436E1D6E3E6ECB0000 +B5 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +6E896E196E4E6E636E446E726E696E5F7119711A7126713071217136716E711C +724C728472807336732573347329743A742A743374227425743574367434742F +741B7426742875257526756B756A75E275DB75E375D975D875DE75E0767B767C +7696769376B476DC774F77ED785D786C786F7A0D7A087A0B7A057A007A980000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00007A977A967AE57AE37B497B567B467B507B527B547B4D7B4B7B4F7B517C9F +7CA57D5E7D507D687D557D2B7D6E7D727D617D667D627D707D7355847FD47FD5 +800B8052808581558154814B8151814E81398146813E814C815381748212821C +83E9840383F8840D83E083C5840B83C183EF83F183F48457840A83F0840C83CC +83FD83F283CA8438840E840483DC840783D483DF865B86DF86D986ED86D486DB +86E486D086DE885788C188C288B1898389968A3B8A608A558A5E8A3C8A410000 +B6 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +8A548A5B8A508A468A348A3A8A368A568C618C828CAF8CBC8CB38CBD8CC18CBB +8CC08CB48CB78CB68CBF8CB88D8A8D858D818DCE8DDD8DCB8DDA8DD18DCC8DDB +8DC68EFB8EF88EFC8F9C902E90359031903890329036910290F5910990FE9163 +916591CF9214921592239209921E920D9210920792119594958F958B95910000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000095939592958E968A968E968B967D96859686968D9672968496C196C596C4 +96C696C796EF96F297CC98059806980898E798EA98EF98E998F298ED99AE99AD +9EC39ECD9ED14E8250AD50B550B250B350C550BE50AC50B750BB50AF50C7527F +5277527D52DF52E652E452E252E3532F55DF55E855D355E655CE55DC55C755D1 +55E355E455EF55DA55E155C555C655E555C957125713585E585158585857585A +5854586B584C586D584A58625852584B59675AC15AC95ACC5ABE5ABD5ABC0000 +B7 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +5AB35AC25AB25D695D6F5E4C5E795EC95EC85F125F595FAC5FAE611A610F6148 +611F60F3611B60F961016108614E614C6144614D613E61346127610D61066137 +622162226413643E641E642A642D643D642C640F641C6414640D643664166417 +6406656C659F65B06697668966876688669666846698668D67036994696D0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000695A697769606954697569306982694A6968696B695E695369796986695D +6963695B6B476B726BC06BBF6BD36BFD6EA26EAF6ED36EB66EC26E906E9D6EC7 +6EC56EA56E986EBC6EBA6EAB6ED16E966E9C6EC46ED46EAA6EA76EB4714E7159 +7169716471497167715C716C7166714C7165715E714671687156723A72527337 +7345733F733E746F745A7455745F745E7441743F7459745B745C757675787600 +75F0760175F275F175FA75FF75F475F376DE76DF775B776B7766775E77630000 +B8 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +7779776A776C775C77657768776277EE788E78B078977898788C7889787C7891 +7893787F797A797F7981842C79BD7A1C7A1A7A207A147A1F7A1E7A9F7AA07B77 +7BC07B607B6E7B677CB17CB37CB57D937D797D917D817D8F7D5B7F6E7F697F6A +7F727FA97FA87FA480568058808680848171817081788165816E8173816B0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00008179817A81668205824784828477843D843184758466846B8449846C845B +843C8435846184638469846D8446865E865C865F86F9871387088707870086FE +86FB870287038706870A885988DF88D488D988DC88D888DD88E188CA88D588D2 +899C89E38A6B8A728A738A668A698A708A878A7C8A638AA08A718A858A6D8A62 +8A6E8A6C8A798A7B8A3E8A688C628C8A8C898CCA8CC78CC88CC48CB28CC38CC2 +8CC58DE18DDF8DE88DEF8DF38DFA8DEA8DE48DE68EB28F038F098EFE8F0A0000 +B9 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +8F9F8FB2904B904A905390429054903C905590509047904F904E904D9051903E +904191129117916C916A916991C9923792579238923D9240923E925B924B9264 +925192349249924D92459239923F925A959896989694969596CD96CB96C996CA +96F796FB96F996F6975697749776981098119813980A9812980C98FC98F40000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000098FD98FE99B399B199B49AE19CE99E829F0E9F139F2050E750EE50E550D6 +50ED50DA50D550CF50D150F150CE50E9516251F352835282533153AD55FE5600 +561B561755FD561456065609560D560E55F75616561F5608561055F657185716 +5875587E58835893588A58795885587D58FD592559225924596A59695AE15AE6 +5AE95AD75AD65AD85AE35B755BDE5BE75BE15BE55BE65BE85BE25BE45BDF5C0D +5C625D845D875E5B5E635E555E575E545ED35ED65F0A5F465F705FB961470000 +BA +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +613F614B617761626163615F615A61586175622A64876458645464A46478645F +647A645164676434646D647B657265A165D765D666A266A8669D699C69A86995 +69C169AE69D369CB699B69B769BB69AB69B469D069CD69AD69CC69A669C369A3 +6B496B4C6C336F336F146EFE6F136EF46F296F3E6F206F2C6F0F6F026F220000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00006EFF6EEF6F066F316F386F326F236F156F2B6F2F6F886F2A6EEC6F016EF2 +6ECC6EF771947199717D718A71847192723E729272967344735074647463746A +7470746D750475917627760D760B7609761376E176E37784777D777F776178C1 +789F78A778B378A978A3798E798F798D7A2E7A317AAA7AA97AED7AEF7BA17B95 +7B8B7B757B977B9D7B947B8F7BB87B877B847CB97CBD7CBE7DBB7DB07D9C7DBD +7DBE7DA07DCA7DB47DB27DB17DBA7DA27DBF7DB57DB87DAD7DD27DC77DAC0000 +BB +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +7F707FE07FE17FDF805E805A808781508180818F8188818A817F818281E781FA +82078214821E824B84C984BF84C684C48499849E84B2849C84CB84B884C084D3 +849084BC84D184CA873F871C873B872287258734871887558737872988F38902 +88F488F988F888FD88E8891A88EF8AA68A8C8A9E8AA38A8D8AA18A938AA40000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00008AAA8AA58AA88A988A918A9A8AA78C6A8C8D8C8C8CD38CD18CD28D6B8D99 +8D958DFC8F148F128F158F138FA390609058905C90639059905E9062905D905B +91199118911E917591789177917492789280928592989296927B9293929C92A8 +927C929195A195A895A995A395A595A49699969C969B96CC96D29700977C9785 +97F69817981898AF98B199039905990C990999C19AAF9AB09AE69B419B429CF4 +9CF69CF39EBC9F3B9F4A5104510050FB50F550F9510251085109510551DC0000 +BC +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +528752885289528D528A52F053B2562E563B56395632563F563456295653564E +565756745636562F56305880589F589E58B3589C58AE58A958A6596D5B095AFB +5B0B5AF55B0C5B085BEE5BEC5BE95BEB5C645C655D9D5D945E625E5F5E615EE2 +5EDA5EDF5EDD5EE35EE05F485F715FB75FB561766167616E615D615561820000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000617C6170616B617E61A7619061AB618E61AC619A61A4619461AE622E6469 +646F6479649E64B26488649064B064A56493649564A9649264AE64AD64AB649A +64AC649964A264B365756577657866AE66AB66B466B16A236A1F69E86A016A1E +6A1969FD6A216A136A0A69F36A026A0569ED6A116B506B4E6BA46BC56BC66F3F +6F7C6F846F516F666F546F866F6D6F5B6F786F6E6F8E6F7A6F706F646F976F58 +6ED56F6F6F606F5F719F71AC71B171A87256729B734E73577469748B74830000 +BD +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +747E7480757F76207629761F7624762676217622769A76BA76E4778E7787778C +7791778B78CB78C578BA78CA78BE78D578BC78D07A3F7A3C7A407A3D7A377A3B +7AAF7AAE7BAD7BB17BC47BB47BC67BC77BC17BA07BCC7CCA7DE07DF47DEF7DFB +7DD87DEC7DDD7DE87DE37DDA7DDE7DE97D9E7DD97DF27DF97F757F777FAF0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00007FE98026819B819C819D81A0819A81988517853D851A84EE852C852D8513 +851185238521851484EC852584FF850687828774877687608766877887688759 +8757874C8753885B885D89108907891289138915890A8ABC8AD28AC78AC48A95 +8ACB8AF88AB28AC98AC28ABF8AB08AD68ACD8AB68AB98ADB8C4C8C4E8C6C8CE0 +8CDE8CE68CE48CEC8CED8CE28CE38CDC8CEA8CE18D6D8D9F8DA38E2B8E108E1D +8E228E0F8E298E1F8E218E1E8EBA8F1D8F1B8F1F8F298F268F2A8F1C8F1E0000 +BE +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +8F259069906E9068906D90779130912D9127913191879189918B918392C592BB +92B792EA92AC92E492C192B392BC92D292C792F092B295AD95B1970497069707 +97099760978D978B978F9821982B981C98B3990A99139912991899DD99D099DF +99DB99D199D599D299D99AB79AEE9AEF9B279B459B449B779B6F9D069D090000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00009D039EA99EBE9ECE58A89F5251125118511451105115518051AA51DD5291 +529352F35659566B5679566956645678566A566856655671566F566C56625676 +58C158BE58C758C5596E5B1D5B345B785BF05C0E5F4A61B2619161A9618A61CD +61B661BE61CA61C8623064C564C164CB64BB64BC64DA64C464C764C264CD64BF +64D264D464BE657466C666C966B966C466C766B86A3D6A386A3A6A596A6B6A58 +6A396A446A626A616A4B6A476A356A5F6A486B596B776C056FC26FB16FA10000 +BF +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +6FC36FA46FC16FA76FB36FC06FB96FB66FA66FA06FB471BE71C971D071D271C8 +71D571B971CE71D971DC71C371C47368749C74A37498749F749E74E2750C750D +76347638763A76E776E577A0779E779F77A578E878DA78EC78E779A67A4D7A4E +7A467A4C7A4B7ABA7BD97C117BC97BE47BDB7BE17BE97BE67CD57CD67E0A0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00007E117E087E1B7E237E1E7E1D7E097E107F797FB27FF07FF17FEE802881B3 +81A981A881FB820882588259854A855985488568856985438549856D856A855E +8783879F879E87A2878D8861892A89328925892B892189AA89A68AE68AFA8AEB +8AF18B008ADC8AE78AEE8AFE8B018B028AF78AED8AF38AF68AFC8C6B8C6D8C93 +8CF48E448E318E348E428E398E358F3B8F2F8F388F338FA88FA6907590749078 +9072907C907A913491929320933692F89333932F932292FC932B9304931A0000 +C0 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +9310932693219315932E931995BB96A796A896AA96D5970E97119716970D9713 +970F975B975C9766979898309838983B9837982D9839982499109928991E991B +9921991A99ED99E299F19AB89ABC9AFB9AED9B289B919D159D239D269D289D12 +9D1B9ED89ED49F8D9F9C512A511F5121513252F5568E56805690568556870000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000568F58D558D358D158CE5B305B2A5B245B7A5C375C685DBC5DBA5DBD5DB8 +5E6B5F4C5FBD61C961C261C761E661CB6232623464CE64CA64D864E064F064E6 +64EC64F164E264ED6582658366D966D66A806A946A846AA26A9C6ADB6AA36A7E +6A976A906AA06B5C6BAE6BDA6C086FD86FF16FDF6FE06FDB6FE46FEB6FEF6F80 +6FEC6FE16FE96FD56FEE6FF071E771DF71EE71E671E571ED71EC71F471E07235 +72467370737274A974B074A674A876467642764C76EA77B377AA77B077AC0000 +C1 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +77A777AD77EF78F778FA78F478EF790179A779AA7A577ABF7C077C0D7BFE7BF7 +7C0C7BE07CE07CDC7CDE7CE27CDF7CD97CDD7E2E7E3E7E467E377E327E437E2B +7E3D7E317E457E417E347E397E487E357E3F7E2F7F447FF37FFC807180728070 +806F807381C681C381BA81C281C081BF81BD81C981BE81E88209827185AA0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00008584857E859C8591859485AF859B858785A8858A866787C087D187B387D2 +87C687AB87BB87BA87C887CB893B893689448938893D89AC8B0E8B178B198B1B +8B0A8B208B1D8B048B108C418C3F8C738CFA8CFD8CFC8CF88CFB8DA88E498E4B +8E488E4A8F448F3E8F428F458F3F907F907D9084908190829080913991A3919E +919C934D938293289375934A9365934B9318937E936C935B9370935A935495CA +95CB95CC95C895C696B196B896D6971C971E97A097D3984698B699359A010000 +C2 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +99FF9BAE9BAB9BAA9BAD9D3B9D3F9E8B9ECF9EDE9EDC9EDD9EDB9F3E9F4B53E2 +569556AE58D958D85B385F5D61E3623364F464F264FE650664FA64FB64F765B7 +66DC67266AB36AAC6AC36ABB6AB86AC26AAE6AAF6B5F6B786BAF7009700B6FFE +70066FFA7011700F71FB71FC71FE71F87377737574A774BF7515765676580000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000765277BD77BF77BB77BC790E79AE7A617A627A607AC47AC57C2B7C277C2A +7C1E7C237C217CE77E547E557E5E7E5A7E617E527E597F487FF97FFB80778076 +81CD81CF820A85CF85A985CD85D085C985B085BA85B985A687EF87EC87F287E0 +898689B289F48B288B398B2C8B2B8C508D058E598E638E668E648E5F8E558EC0 +8F498F4D90879083908891AB91AC91D09394938A939693A293B393AE93AC93B0 +9398939A939795D495D695D095D596E296DC96D996DB96DE972497A397A60000 +C3 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +97AD97F9984D984F984C984E985398BA993E993F993D992E99A59A0E9AC19B03 +9B069B4F9B4E9B4D9BCA9BC99BFD9BC89BC09D519D5D9D609EE09F159F2C5133 +56A558DE58DF58E25BF59F905EEC61F261F761F661F56500650F66E066DD6AE5 +6ADD6ADA6AD3701B701F7028701A701D701570187206720D725872A273780000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000737A74BD74CA74E375877586765F766177C7791979B17A6B7A697C3E7C3F +7C387C3D7C377C407E6B7E6D7E797E697E6A7F857E737FB67FB97FB881D885E9 +85DD85EA85D585E485E585F787FB8805880D87F987FE8960895F8956895E8B41 +8B5C8B588B498B5A8B4E8B4F8B468B598D088D0A8E7C8E728E878E768E6C8E7A +8E748F548F4E8FAD908A908B91B191AE93E193D193DF93C393C893DC93DD93D6 +93E293CD93D893E493D793E895DC96B496E3972A9727976197DC97FB985E0000 +C4 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +9858985B98BC994599499A169A199B0D9BE89BE79BD69BDB9D899D619D729D6A +9D6C9E929E979E939EB452F856A856B756B656B456BC58E45B405B435B7D5BF6 +5DC961F861FA65186514651966E667276AEC703E703070327210737B74CF7662 +76657926792A792C792B7AC77AF67C4C7C437C4D7CEF7CF08FAE7E7D7E7C0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00007E827F4C800081DA826685FB85F9861185FA8606860B8607860A88148815 +896489BA89F88B708B6C8B668B6F8B5F8B6B8D0F8D0D8E898E818E858E8291B4 +91CB9418940393FD95E1973098C49952995199A89A2B9A309A379A359C139C0D +9E799EB59EE89F2F9F5F9F639F615137513856C156C056C259145C6C5DCD61FC +61FE651D651C659566E96AFB6B046AFA6BB2704C721B72A774D674D4766977D3 +7C507E8F7E8C7FBC8617862D861A882388228821881F896A896C89BD8B740000 +C5 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +8B778B7D8D138E8A8E8D8E8B8F5F8FAF91BA942E94339435943A94389432942B +95E297389739973297FF9867986599579A459A439A409A3E9ACF9B549B519C2D +9C259DAF9DB49DC29DB89E9D9EEF9F199F5C9F669F67513C513B56C856CA56C9 +5B7F5DD45DD25F4E61FF65246B0A6B6170517058738074E4758A766E766C0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000079B37C607C5F807E807D81DF8972896F89FC8B808D168D178E918E938F61 +9148944494519452973D973E97C397C1986B99559A559A4D9AD29B1A9C499C31 +9C3E9C3B9DD39DD79F349F6C9F6A9F9456CC5DD662006523652B652A66EC6B10 +74DA7ACA7C647C637C657E937E967E9481E28638863F88318B8A9090908F9463 +946094649768986F995C9A5A9A5B9A579AD39AD49AD19C549C579C569DE59E9F +9EF456D158E9652C705E7671767277D77F507F888836883988628B938B920000 +C6 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +8B9682778D1B91C0946A97429748974497C698709A5F9B229B589C5F9DF99DFA +9E7C9E7D9F079F779F725EF36B1670637C6C7C6E883B89C08EA191C194729470 +9871995E9AD69B239ECC706477DA8B9A947797C99A629A657E9C8B9C8EAA91C5 +947D947E947C9C779C789EF78C54947F9E1A72289A6A9B319E1B9E1E7C720000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +C9 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +4E424E5C51F5531A53824E074E0C4E474E8D56D7FA0C5C6E5F734E0F51874E0E +4E2E4E934EC24EC94EC8519852FC536C53B957205903592C5C105DFF65E16BB3 +6BCC6C14723F4E314E3C4EE84EDC4EE94EE14EDD4EDA520C531C534C57225723 +5917592F5B815B845C125C3B5C745C735E045E805E825FC9620962506C150000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00006C366C436C3F6C3B72AE72B0738A79B8808A961E4F0E4F184F2C4EF54F14 +4EF14F004EF74F084F1D4F024F054F224F134F044EF44F1251B1521352095210 +52A65322531F534D538A540756E156DF572E572A5734593C5980597C5985597B +597E5977597F5B565C155C255C7C5C7A5C7B5C7E5DDF5E755E845F025F1A5F74 +5FD55FD45FCF625C625E626462616266626262596260625A626565EF65EE673E +67396738673B673A673F673C67336C186C466C526C5C6C4F6C4A6C546C4B0000 +CA +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +6C4C7071725E72B472B5738E752A767F7A757F518278827C8280827D827F864D +897E909990979098909B909496229624962096234F564F3B4F624F494F534F64 +4F3E4F674F524F5F4F414F584F2D4F334F3F4F61518F51B9521C521E522152AD +52AE530953635372538E538F54305437542A545454455419541C542554180000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000543D544F544154285424544756EE56E756E557415745574C5749574B5752 +5906594059A6599859A05997598E59A25990598F59A759A15B8E5B925C285C2A +5C8D5C8F5C885C8B5C895C925C8A5C865C935C955DE05E0A5E0E5E8B5E895E8C +5E885E8D5F055F1D5F785F765FD25FD15FD05FED5FE85FEE5FF35FE15FE45FE3 +5FFA5FEF5FF75FFB60005FF4623A6283628C628E628F629462876271627B627A +6270628162886277627D62726274653765F065F465F365F265F5674567470000 +CB +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +67596755674C6748675D674D675A674B6BD06C196C1A6C786C676C6B6C846C8B +6C8F6C716C6F6C696C9A6C6D6C876C956C9C6C666C736C656C7B6C8E7074707A +726372BF72BD72C372C672C172BA72C573957397739373947392753A75397594 +75957681793D80348095809980908092809C8290828F8285828E829182930000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000828A828382848C788FC98FBF909F90A190A5909E90A790A096309628962F +962D4E334F984F7C4F854F7D4F804F874F764F744F894F844F774F4C4F974F6A +4F9A4F794F814F784F904F9C4F944F9E4F924F824F954F6B4F6E519E51BC51BE +5235523252335246523152BC530A530B533C539253945487547F548154915482 +5488546B547A547E5465546C54745466548D546F546154605498546354675464 +56F756F9576F5772576D576B57715770577657805775577B5773577457620000 +CC +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +5768577D590C594559B559BA59CF59CE59B259CC59C159B659BC59C359D659B1 +59BD59C059C859B459C75B625B655B935B955C445C475CAE5CA45CA05CB55CAF +5CA85CAC5C9F5CA35CAD5CA25CAA5CA75C9D5CA55CB65CB05CA65E175E145E19 +5F285F225F235F245F545F825F7E5F7D5FDE5FE5602D602660196032600B0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00006034600A60176033601A601E602C6022600D6010602E60136011600C6009 +601C6214623D62AD62B462D162BE62AA62B662CA62AE62B362AF62BB62A962B0 +62B8653D65A865BB660965FC66046612660865FB6603660B660D660565FD6611 +661066F6670A6785676C678E67926776677B6798678667846774678D678C677A +679F679167996783677D67816778677967946B256B806B7E6BDE6C1D6C936CEC +6CEB6CEE6CD96CB66CD46CAD6CE76CB76CD06CC26CBA6CC36CC66CED6CF20000 +CD +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +6CD26CDD6CB46C8A6C9D6C806CDE6CC06D306CCD6CC76CB06CF96CCF6CE96CD1 +709470987085709370867084709170967082709A7083726A72D672CB72D872C9 +72DC72D272D472DA72CC72D173A473A173AD73A673A273A073AC739D74DD74E8 +753F7540753E758C759876AF76F376F176F076F577F877FC77F977FB77FA0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000077F77942793F79C57A787A7B7AFB7C757CFD8035808F80AE80A380B880B5 +80AD822082A082C082AB829A8298829B82B582A782AE82BC829E82BA82B482A8 +82A182A982C282A482C382B682A28670866F866D866E8C568FD28FCB8FD38FCD +8FD68FD58FD790B290B490AF90B390B09639963D963C963A96434FCD4FC54FD3 +4FB24FC94FCB4FC14FD44FDC4FD94FBB4FB34FDB4FC74FD64FBA4FC04FB94FEC +5244524952C052C2533D537C539753965399539854BA54A154AD54A554CF0000 +CE +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +54C3830D54B754AE54D654B654C554C654A0547054BC54A254BE547254DE54B0 +57B5579E579F57A4578C5797579D579B57945798578F579957A5579A579558F4 +590D595359E159DE59EE5A0059F159DD59FA59FD59FC59F659E459F259F759DB +59E959F359F559E059FE59F459ED5BA85C4C5CD05CD85CCC5CD75CCB5CDB0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00005CDE5CDA5CC95CC75CCA5CD65CD35CD45CCF5CC85CC65CCE5CDF5CF85DF9 +5E215E225E235E205E245EB05EA45EA25E9B5EA35EA55F075F2E5F565F866037 +603960546072605E6045605360476049605B604C60406042605F602460446058 +6066606E6242624362CF630D630B62F5630E630362EB62F9630F630C62F862F6 +63006313631462FA631562FB62F06541654365AA65BF6636662166326635661C +662666226633662B663A661D66346639662E670F671067C167F267C867BA0000 +CF +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +67DC67BB67F867D867C067B767C567EB67E467DF67B567CD67B367F767F667EE +67E367C267B967CE67E767F067B267FC67C667ED67CC67AE67E667DB67FA67C9 +67CA67C367EA67CB6B286B826B846BB66BD66BD86BE06C206C216D286D346D2D +6D1F6D3C6D3F6D126D0A6CDA6D336D046D196D3A6D1A6D116D006D1D6D420000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00006D016D186D376D036D0F6D406D076D206D2C6D086D226D096D1070B7709F +70BE70B170B070A170B470B570A972417249724A726C72707273726E72CA72E4 +72E872EB72DF72EA72E672E3738573CC73C273C873C573B973B673B573B473EB +73BF73C773BE73C373C673B873CB74EC74EE752E7547754875A775AA767976C4 +7708770377047705770A76F776FB76FA77E777E878067811781278057810780F +780E780978037813794A794C794B7945794479D579CD79CF79D679CE7A800000 +D0 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +7A7E7AD17B007B017C7A7C787C797C7F7C807C817D037D087D017F587F917F8D +7FBE8007800E800F8014803780D880C780E080D180C880C280D080C580E380D9 +80DC80CA80D580C980CF80D780E680CD81FF8221829482D982FE82F9830782E8 +830082D5833A82EB82D682F482EC82E182F282F5830C82FB82F682F082EA0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000082E482E082FA82F382ED86778674867C86738841884E8867886A886989D3 +8A048A078D728FE38FE18FEE8FE090F190BD90BF90D590C590BE90C790CB90C8 +91D491D39654964F96519653964A964E501E50055007501350225030501B4FF5 +4FF450335037502C4FF64FF75017501C502050275035502F5031500E515A5194 +519351CA51C451C551C851CE5261525A5252525E525F5255526252CD530E539E +552654E25517551254E754F354E4551A54FF5504550854EB5511550554F10000 +D1 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +550A54FB54F754F854E0550E5503550B5701570257CC583257D557D257BA57C6 +57BD57BC57B857B657BF57C757D057B957C1590E594A5A195A165A2D5A2E5A15 +5A0F5A175A0A5A1E5A335B6C5BA75BAD5BAC5C035C565C545CEC5CFF5CEE5CF1 +5CF75D005CF95E295E285EA85EAE5EAA5EAC5F335F305F67605D605A60670000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000604160A26088608060926081609D60836095609B60976087609C608E6219 +624662F263106356632C634463456336634363E46339634B634A633C63296341 +6334635863546359632D63476333635A63516338635763406348654A654665C6 +65C365C465C2664A665F6647665167126713681F681A684968326833683B684B +684F68166831681C6835682B682D682F684E68446834681D6812681468266828 +682E684D683A682568206B2C6B2F6B2D6B316B346B6D80826B886BE66BE40000 +D2 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +6BE86BE36BE26BE76C256D7A6D636D646D766D0D6D616D926D586D626D6D6D6F +6D916D8D6DEF6D7F6D866D5E6D676D606D976D706D7C6D5F6D826D986D2F6D68 +6D8B6D7E6D806D846D166D836D7B6D7D6D756D9070DC70D370D170DD70CB7F39 +70E270D770D270DE70E070D470CD70C570C670C770DA70CE70E1724272780000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000072777276730072FA72F472FE72F672F372FB730173D373D973E573D673BC +73E773E373E973DC73D273DB73D473DD73DA73D773D873E874DE74DF74F474F5 +7521755B755F75B075C175BB75C475C075BF75B675BA768A76C9771D771B7710 +771377127723771177157719771A772277277823782C78227835782F7828782E +782B782178297833782A78317954795B794F795C79537952795179EB79EC79E0 +79EE79ED79EA79DC79DE79DD7A867A897A857A8B7A8C7A8A7A877AD87B100000 +D3 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +7B047B137B057B0F7B087B0A7B0E7B097B127C847C917C8A7C8C7C887C8D7C85 +7D1E7D1D7D117D0E7D187D167D137D1F7D127D0F7D0C7F5C7F617F5E7F607F5D +7F5B7F967F927FC37FC27FC08016803E803980FA80F280F980F5810180FB8100 +8201822F82258333832D83448319835183258356833F83418326831C83220000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00008342834E831B832A8308833C834D8316832483208337832F832983478345 +834C8353831E832C834B832783488653865286A286A88696868D8691869E8687 +86978686868B869A868586A5869986A186A786958698868E869D869086948843 +8844886D88758876887288808871887F886F8883887E8874887C8A128C478C57 +8C7B8CA48CA38D768D788DB58DB78DB68ED18ED38FFE8FF590028FFF8FFB9004 +8FFC8FF690D690E090D990DA90E390DF90E590D890DB90D790DC90E491500000 +D4 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +914E914F91D591E291DA965C965F96BC98E39ADF9B2F4E7F5070506A5061505E +50605053504B505D50725048504D5041505B504A506250155045505F5069506B +5063506450465040506E50735057505151D0526B526D526C526E52D652D3532D +539C55755576553C554D55505534552A55515562553655355530555255450000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000550C55325565554E55395548552D553B5540554B570A570757FB581457E2 +57F657DC57F4580057ED57FD580857F8580B57F357CF580757EE57E357F257E5 +57EC57E1580E57FC581057E75801580C57F157E957F0580D5804595C5A605A58 +5A555A675A5E5A385A355A6D5A505A5F5A655A6C5A535A645A575A435A5D5A52 +5A445A5B5A485A8E5A3E5A4D5A395A4C5A705A695A475A515A565A425A5C5B72 +5B6E5BC15BC05C595D1E5D0B5D1D5D1A5D205D0C5D285D0D5D265D255D0F0000 +D5 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +5D305D125D235D1F5D2E5E3E5E345EB15EB45EB95EB25EB35F365F385F9B5F96 +5F9F608A6090608660BE60B060BA60D360D460CF60E460D960DD60C860B160DB +60B760CA60BF60C360CD60C063326365638A6382637D63BD639E63AD639D6397 +63AB638E636F63876390636E63AF6375639C636D63AE637C63A4633B639F0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00006378638563816391638D6370655365CD66656661665B6659665C66626718 +687968876890689C686D686E68AE68AB6956686F68A368AC68A96875687468B2 +688F68776892687C686B687268AA68806871687E689B6896688B68A0688968A4 +6878687B6891688C688A687D6B366B336B376B386B916B8F6B8D6B8E6B8C6C2A +6DC06DAB6DB46DB36E746DAC6DE96DE26DB76DF66DD46E006DC86DE06DDF6DD6 +6DBE6DE56DDC6DDD6DDB6DF46DCA6DBD6DED6DF06DBA6DD56DC26DCF6DC90000 +D6 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +6DD06DF26DD36DFD6DD76DCD6DE36DBB70FA710D70F7711770F4710C70F07104 +70F3711070FC70FF71067113710070F870F6710B7102710E727E727B727C727F +731D7317730773117318730A730872FF730F731E738873F673F873F574047401 +73FD7407740073FA73FC73FF740C740B73F474087564756375CE75D275CF0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000075CB75CC75D175D0768F768976D37739772F772D7731773277347733773D +7725773B7735784878527849784D784A784C782678457850796479677969796A +7963796B796179BB79FA79F879F679F77A8F7A947A907B357B477B347B257B30 +7B227B247B337B187B2A7B1D7B317B2B7B2D7B2F7B327B387B1A7B237C947C98 +7C967CA37D357D3D7D387D367D3A7D457D2C7D297D417D477D3E7D3F7D4A7D3B +7D287F637F957F9C7F9D7F9B7FCA7FCB7FCD7FD07FD17FC77FCF7FC9801F0000 +D7 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +801E801B804780438048811881258119811B812D811F812C811E812181158127 +811D8122821182388233823A823482328274839083A383A8838D837A837383A4 +8374838F8381839583998375839483A9837D8383838C839D839B83AA838B837E +83A583AF8388839783B0837F83A6838783AE8376839A8659865686BF86B70000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000086C286C186C586BA86B086C886B986B386B886CC86B486BB86BC86C386BD +86BE88528889889588A888A288AA889A889188A1889F889888A78899889B8897 +88A488AC888C8893888E898289D689D989D58A308A278A2C8A1E8C398C3B8C5C +8C5D8C7D8CA58D7D8D7B8D798DBC8DC28DB98DBF8DC18ED88EDE8EDD8EDC8ED7 +8EE08EE19024900B9011901C900C902190EF90EA90F090F490F290F390D490EB +90EC90E991569158915A9153915591EC91F491F191F391F891E491F991EA0000 +D8 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +91EB91F791E891EE957A95869588967C966D966B9671966F96BF976A980498E5 +9997509B50955094509E508B50A35083508C508E509D5068509C509250825087 +515F51D45312531153A453A7559155A855A555AD5577564555A255935588558F +55B5558155A3559255A4557D558C55A6557F559555A1558E570C582958370000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00005819581E58275823582857F558485825581C581B5833583F5836582E5839 +5838582D582C583B59615AAF5A945A9F5A7A5AA25A9E5A785AA65A7C5AA55AAC +5A955AAE5A375A845A8A5A975A835A8B5AA95A7B5A7D5A8C5A9C5A8F5A935A9D +5BEA5BCD5BCB5BD45BD15BCA5BCE5C0C5C305D375D435D6B5D415D4B5D3F5D35 +5D515D4E5D555D335D3A5D525D3D5D315D595D425D395D495D385D3C5D325D36 +5D405D455E445E415F585FA65FA55FAB60C960B960CC60E260CE60C461140000 +D9 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +60F2610A6116610560F5611360F860FC60FE60C161036118611D611060FF6104 +610B624A639463B163B063CE63E563E863EF63C3649D63F363CA63E063F663D5 +63F263F5646163DF63BE63DD63DC63C463D863D363C263C763CC63CB63C863F0 +63D763D965326567656A6564655C65686565658C659D659E65AE65D065D20000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000667C666C667B668066716679666A66726701690C68D3690468DC692A68EC +68EA68F1690F68D668F768EB68E468F66913691068F368E1690768CC69086970 +68B4691168EF68C6691468F868D068FD68FC68E8690B690A691768CE68C868DD +68DE68E668F468D1690668D468E96915692568C76B396B3B6B3F6B3C6B946B97 +6B996B956BBD6BF06BF26BF36C306DFC6E466E476E1F6E496E886E3C6E3D6E45 +6E626E2B6E3F6E416E5D6E736E1C6E336E4B6E406E516E3B6E036E2E6E5E0000 +DA +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +6E686E5C6E616E316E286E606E716E6B6E396E226E306E536E656E276E786E64 +6E776E556E796E526E666E356E366E5A7120711E712F70FB712E713171237125 +71227132711F7128713A711B724B725A7288728972867285728B7312730B7330 +73227331733373277332732D732673237335730C742E742C7430742B74160000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000741A7421742D743174247423741D74297420743274FB752F756F756C75E7 +75DA75E175E675DD75DF75E475D77695769276DA774677477744774D7745774A +774E774B774C77DE77EC786078647865785C786D7871786A786E787078697868 +785E786279747973797279707A027A0A7A037A0C7A047A997AE67AE47B4A7B3B +7B447B487B4C7B4E7B407B587B457CA27C9E7CA87CA17D587D6F7D637D537D56 +7D677D6A7D4F7D6D7D5C7D6B7D527D547D697D517D5F7D4E7F3E7F3F7F650000 +DB +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +7F667FA27FA07FA17FD78051804F805080FE80D48143814A8152814F8147813D +814D813A81E681EE81F781F881F98204823C823D823F8275833B83CF83F98423 +83C083E8841283E783E483FC83F6841083C683C883EB83E383BF840183DD83E5 +83D883FF83E183CB83CE83D683F583C98409840F83DE8411840683C283F30000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000083D583FA83C783D183EA841383C383EC83EE83C483FB83D783E2841B83DB +83FE86D886E286E686D386E386DA86EA86DD86EB86DC86EC86E986D786E886D1 +88488856885588BA88D788B988B888C088BE88B688BC88B788BD88B2890188C9 +89958998899789DD89DA89DB8A4E8A4D8A398A598A408A578A588A448A458A52 +8A488A518A4A8A4C8A4F8C5F8C818C808CBA8CBE8CB08CB98CB58D848D808D89 +8DD88DD38DCD8DC78DD68DDC8DCF8DD58DD98DC88DD78DC58EEF8EF78EFA0000 +DC +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +8EF98EE68EEE8EE58EF58EE78EE88EF68EEB8EF18EEC8EF48EE9902D9034902F +9106912C910490FF90FC910890F990FB9101910091079105910391619164915F +916291609201920A92259203921A9226920F920C9200921291FF91FD92069204 +92279202921C92249219921792059216957B958D958C95909687967E96880000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000096899683968096C296C896C396F196F0976C9770976E980798A998EB9CE6 +9EF94E834E844EB650BD50BF50C650AE50C450CA50B450C850C250B050C150BA +50B150CB50C950B650B851D7527A5278527B527C55C355DB55CC55D055CB55CA +55DD55C055D455C455E955BF55D2558D55CF55D555E255D655C855F255CD55D9 +55C25714585358685864584F584D5849586F5855584E585D58595865585B583D +5863587158FC5AC75AC45ACB5ABA5AB85AB15AB55AB05ABF5AC85ABB5AC60000 +DD +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +5AB75AC05ACA5AB45AB65ACD5AB95A905BD65BD85BD95C1F5C335D715D635D4A +5D655D725D6C5D5E5D685D675D625DF05E4F5E4E5E4A5E4D5E4B5EC55ECC5EC6 +5ECB5EC75F405FAF5FAD60F76149614A612B614561366132612E6146612F614F +612961406220916862236225622463C563F163EB641064126409642064240000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000064336443641F641564186439643764226423640C64266430642864416435 +642F640A641A644064256427640B63E7641B642E6421640E656F659265D36686 +668C66956690668B668A66996694667867206966695F6938694E69626971693F +6945696A6939694269576959697A694869496935696C6933693D696568F06978 +693469696940696F69446976695869416974694C693B694B6937695C694F6951 +69326952692F697B693C6B466B456B436B426B486B416B9BFA0D6BFB6BFC0000 +DE +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +6BF96BF76BF86E9B6ED66EC86E8F6EC06E9F6E936E946EA06EB16EB96EC66ED2 +6EBD6EC16E9E6EC96EB76EB06ECD6EA66ECF6EB26EBE6EC36EDC6ED86E996E92 +6E8E6E8D6EA46EA16EBF6EB36ED06ECA6E976EAE6EA371477154715271637160 +7141715D716271727178716A7161714271587143714B7170715F715071530000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00007144714D715A724F728D728C72917290728E733C7342733B733A7340734A +73497444744A744B7452745174577440744F7450744E74427446744D745474E1 +74FF74FE74FD751D75797577698375EF760F760375F775FE75FC75F975F87610 +75FB75F675ED75F575FD769976B576DD7755775F776077527756775A77697767 +77547759776D77E07887789A7894788F788478957885788678A1788378797899 +78807896787B797C7982797D79797A117A187A197A127A177A157A227A130000 +DF +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +7A1B7A107AA37AA27A9E7AEB7B667B647B6D7B747B697B727B657B737B717B70 +7B617B787B767B637CB27CB47CAF7D887D867D807D8D7D7F7D857D7A7D8E7D7B +7D837D7C7D8C7D947D847D7D7D927F6D7F6B7F677F687F6C7FA67FA57FA77FDB +7FDC8021816481608177815C8169815B816281726721815E81768167816F0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000081448161821D8249824482408242824584F1843F845684768479848F848D +846584518440848684678430844D847D845A845984748473845D8507845E8437 +843A8434847A8443847884328445842983D9844B842F8442842D845F84708439 +844E844C8452846F84C5848E843B8447843684338468847E8444842B84608454 +846E8450870B870486F7870C86FA86D686F5874D86F8870E8709870186F6870D +870588D688CB88CD88CE88DE88DB88DA88CC88D08985899B89DF89E589E40000 +E0 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +89E189E089E289DC89E68A768A868A7F8A618A3F8A778A828A848A758A838A81 +8A748A7A8C3C8C4B8C4A8C658C648C668C868C848C858CCC8D688D698D918D8C +8D8E8D8F8D8D8D938D948D908D928DF08DE08DEC8DF18DEE8DD08DE98DE38DE2 +8DE78DF28DEB8DF48F068EFF8F018F008F058F078F088F028F0B9052903F0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000090449049903D9110910D910F911191169114910B910E916E916F92489252 +9230923A926692339265925E9283922E924A9246926D926C924F92609267926F +92369261927092319254926392509272924E9253924C92569232959F959C959E +959B969296939691969796CE96FA96FD96F896F59773977797789772980F980D +980E98AC98F698F999AF99B299B099B59AAD9AAB9B5B9CEA9CED9CE79E809EFD +50E650D450D750E850F350DB50EA50DD50E450D350EC50F050EF50E350E00000 +E1 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +51D85280528152E952EB533053AC56275615560C561255FC560F561C56015613 +560255FA561D560455FF55F95889587C5890589858865881587F5874588B587A +58875891588E587658825888587B5894588F58FE596B5ADC5AEE5AE55AD55AEA +5ADA5AED5AEB5AF35AE25AE05ADB5AEC5ADE5ADD5AD95AE85ADF5B775BE00000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00005BE35C635D825D805D7D5D865D7A5D815D775D8A5D895D885D7E5D7C5D8D +5D795D7F5E585E595E535ED85ED15ED75ECE5EDC5ED55ED95ED25ED45F445F43 +5F6F5FB6612C61286141615E61716173615261536172616C618061746154617A +615B6165613B616A6161615662296227622B642B644D645B645D647464766472 +6473647D6475646664A6644E6482645E645C644B645364606450647F643F646C +646B645964656477657365A066A166A0669F67056704672269B169B669C90000 +E2 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +69A069CE699669B069AC69BC69916999698E69A7698D69A969BE69AF69BF69C4 +69BD69A469D469B969CA699A69CF69B3699369AA69A1699E69D96997699069C2 +69B569A569C66B4A6B4D6B4B6B9E6B9F6BA06BC36BC46BFE6ECE6EF56EF16F03 +6F256EF86F376EFB6F2E6F096F4E6F196F1A6F276F186F3B6F126EED6F0A0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00006F366F736EF96EEE6F2D6F406F306F3C6F356EEB6F076F0E6F436F056EFD +6EF66F396F1C6EFC6F3A6F1F6F0D6F1E6F086F21718771907189718071857182 +718F717B718671817197724472537297729572937343734D7351734C74627473 +7471747574727467746E750075027503757D759076167608760C76157611760A +761476B87781777C77857782776E7780776F777E778378B278AA78B478AD78A8 +787E78AB789E78A578A078AC78A278A47998798A798B79967995799479930000 +E3 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +79977988799279907A2B7A4A7A307A2F7A287A267AA87AAB7AAC7AEE7B887B9C +7B8A7B917B907B967B8D7B8C7B9B7B8E7B857B9852847B997BA47B827CBB7CBF +7CBC7CBA7DA77DB77DC27DA37DAA7DC17DC07DC57D9D7DCE7DC47DC67DCB7DCC +7DAF7DB97D967DBC7D9F7DA67DAE7DA97DA17DC97F737FE27FE37FE57FDE0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00008024805D805C8189818681838187818D818C818B8215849784A484A1849F +84BA84CE84C284AC84AE84AB84B984B484C184CD84AA849A84B184D0849D84A7 +84BB84A2849484C784CC849B84A984AF84A884D6849884B684CF84A084D784D4 +84D284DB84B084918661873387238728876B8740872E871E87218719871B8743 +872C8741873E874687208732872A872D873C8712873A87318735874287268727 +87388724871A8730871188F788E788F188F288FA88FE88EE88FC88F688FB0000 +E4 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +88F088EC88EB899D89A1899F899E89E989EB89E88AAB8A998A8B8A928A8F8A96 +8C3D8C688C698CD58CCF8CD78D968E098E028DFF8E0D8DFD8E0A8E038E078E06 +8E058DFE8E008E048F108F118F0E8F0D9123911C91209122911F911D911A9124 +9121911B917A91729179917392A592A49276929B927A92A0929492AA928D0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000092A6929A92AB92799297927F92A392EE928E9282929592A2927D928892A1 +928A9286928C929992A7927E928792A9929D928B922D969E96A196FF9758977D +977A977E978397809782977B97849781977F97CE97CD981698AD98AE99029900 +9907999D999C99C399B999BB99BA99C299BD99C79AB19AE39AE79B3E9B3F9B60 +9B619B5F9CF19CF29CF59EA750FF5103513050F85106510750F650FE510B510C +50FD510A528B528C52F152EF56485642564C56355641564A5649564656580000 +E5 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +565A56405633563D562C563E5638562A563A571A58AB589D58B158A058A358AF +58AC58A558A158FF5AFF5AF45AFD5AF75AF65B035AF85B025AF95B015B075B05 +5B0F5C675D995D975D9F5D925DA25D935D955DA05D9C5DA15D9A5D9E5E695E5D +5E605E5C7DF35EDB5EDE5EE15F495FB2618B6183617961B161B061A261890000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000619B619361AF61AD619F619261AA61A1618D616661B3622D646E64706496 +64A064856497649C648F648B648A648C64A3649F646864B164986576657A6579 +657B65B265B366B566B066A966B266B766AA66AF6A006A066A1769E569F86A15 +69F169E46A2069FF69EC69E26A1B6A1D69FE6A2769F269EE6A1469F769E76A40 +6A0869E669FB6A0D69FC69EB6A096A046A186A256A0F69F66A266A0769F46A16 +6B516BA56BA36BA26BA66C016C006BFF6C026F416F266F7E6F876FC66F920000 +E6 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +6F8D6F896F8C6F626F4F6F856F5A6F966F766F6C6F826F556F726F526F506F57 +6F946F936F5D6F006F616F6B6F7D6F676F906F536F8B6F696F7F6F956F636F77 +6F6A6F7B71B271AF719B71B071A0719A71A971B5719D71A5719E71A471A171AA +719C71A771B37298729A73587352735E735F7360735D735B7361735A73590000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000736274877489748A74867481747D74857488747C747975087507757E7625 +761E7619761D761C7623761A7628761B769C769D769E769B778D778F77897788 +78CD78BB78CF78CC78D178CE78D478C878C378C478C9799A79A179A0799C79A2 +799B6B767A397AB27AB47AB37BB77BCB7BBE7BAC7BCE7BAF7BB97BCA7BB57CC5 +7CC87CCC7CCB7DF77DDB7DEA7DE77DD77DE17E037DFA7DE67DF67DF17DF07DEE +7DDF7F767FAC7FB07FAD7FED7FEB7FEA7FEC7FE67FE88064806781A3819F0000 +E7 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +819E819581A2819981978216824F825382528250824E82518524853B850F8500 +8529850E8509850D851F850A8527851C84FB852B84FA8508850C84F4852A84F2 +851584F784EB84F384FC851284EA84E9851684FE8528851D852E850284FD851E +84F68531852684E784E884F084EF84F9851885208530850B8519852F86620000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000875687638764877787E1877387588754875B87528761875A8751875E876D +876A8750874E875F875D876F876C877A876E875C8765874F877B877587628767 +8769885A8905890C8914890B891789188919890689168911890E890989A289A4 +89A389ED89F089EC8ACF8AC68AB88AD38AD18AD48AD58ABB8AD78ABE8AC08AC5 +8AD88AC38ABA8ABD8AD98C3E8C4D8C8F8CE58CDF8CD98CE88CDA8CDD8CE78DA0 +8D9C8DA18D9B8E208E238E258E248E2E8E158E1B8E168E118E198E268E270000 +E8 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +8E148E128E188E138E1C8E178E1A8F2C8F248F188F1A8F208F238F168F179073 +9070906F9067906B912F912B9129912A91329126912E91859186918A91819182 +9184918092D092C392C492C092D992B692CF92F192DF92D892E992D792DD92CC +92EF92C292E892CA92C892CE92E692CD92D592C992E092DE92E792D192D30000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000092B592E192C692B4957C95AC95AB95AE95B096A496A296D3970597089702 +975A978A978E978897D097CF981E981D9826982998289820981B982798B29908 +98FA9911991499169917991599DC99CD99CF99D399D499CE99C999D699D899CB +99D799CC9AB39AEC9AEB9AF39AF29AF19B469B439B679B749B719B669B769B75 +9B709B689B649B6C9CFC9CFA9CFD9CFF9CF79D079D009CF99CFB9D089D059D04 +9E839ED39F0F9F10511C51135117511A511151DE533453E156705660566E0000 +E9 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +567356665663566D5672565E5677571C571B58C858BD58C958BF58BA58C258BC +58C65B175B195B1B5B215B145B135B105B165B285B1A5B205B1E5BEF5DAC5DB1 +5DA95DA75DB55DB05DAE5DAA5DA85DB25DAD5DAF5DB45E675E685E665E6F5EE9 +5EE75EE65EE85EE55F4B5FBC619D61A8619661C561B461C661C161CC61BA0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000061BF61B8618C64D764D664D064CF64C964BD648964C364DB64F364D96533 +657F657C65A266C866BE66C066CA66CB66CF66BD66BB66BA66CC67236A346A66 +6A496A676A326A686A3E6A5D6A6D6A766A5B6A516A286A5A6A3B6A3F6A416A6A +6A646A506A4F6A546A6F6A696A606A3C6A5E6A566A556A4D6A4E6A466B556B54 +6B566BA76BAA6BAB6BC86BC76C046C036C066FAD6FCB6FA36FC76FBC6FCE6FC8 +6F5E6FC46FBD6F9E6FCA6FA870046FA56FAE6FBA6FAC6FAA6FCF6FBF6FB80000 +EA +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +6FA26FC96FAB6FCD6FAF6FB26FB071C571C271BF71B871D671C071C171CB71D4 +71CA71C771CF71BD71D871BC71C671DA71DB729D729E736973667367736C7365 +736B736A747F749A74A074947492749574A1750B7580762F762D7631763D7633 +763C76357632763076BB76E6779A779D77A1779C779B77A277A3779577990000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000779778DD78E978E578EA78DE78E378DB78E178E278ED78DF78E079A47A44 +7A487A477AB67AB87AB57AB17AB77BDE7BE37BE77BDD7BD57BE57BDA7BE87BF9 +7BD47BEA7BE27BDC7BEB7BD87BDF7CD27CD47CD77CD07CD17E127E217E177E0C +7E1F7E207E137E0E7E1C7E157E1A7E227E0B7E0F7E167E0D7E147E257E247F43 +7F7B7F7C7F7A7FB17FEF802A8029806C81B181A681AE81B981B581AB81B081AC +81B481B281B781A781F282558256825785568545856B854D8553856185580000 +EB +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +854085468564854185628544855185478563853E855B8571854E856E85758555 +85678560858C8566855D85548565856C866386658664879B878F879787938792 +87888781879687988779878787A3878587908791879D87848794879C879A8789 +891E89268930892D892E89278931892289298923892F892C891F89F18AE00000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00008AE28AF28AF48AF58ADD8B148AE48ADF8AF08AC88ADE8AE18AE88AFF8AEF +8AFB8C918C928C908CF58CEE8CF18CF08CF38D6C8D6E8DA58DA78E338E3E8E38 +8E408E458E368E3C8E3D8E418E308E3F8EBD8F368F2E8F358F328F398F378F34 +90769079907B908690FA913391359136919391909191918D918F9327931E9308 +931F9306930F937A9338933C931B9323931293019346932D930E930D92CB931D +92FA9325931392F992F793349302932492FF932993399335932A9314930C0000 +EC +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +930B92FE9309930092FB931695BC95CD95BE95B995BA95B695BF95B595BD96A9 +96D4970B9712971097999797979497F097F89835982F98329924991F99279929 +999E99EE99EC99E599E499F099E399EA99E999E79AB99ABF9AB49ABB9AF69AFA +9AF99AF79B339B809B859B879B7C9B7E9B7B9B829B939B929B909B7A9B950000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00009B7D9B889D259D179D209D1E9D149D299D1D9D189D229D109D199D1F9E88 +9E869E879EAE9EAD9ED59ED69EFA9F129F3D51265125512251245120512952F4 +5693568C568D568656845683567E5682567F568158D658D458CF58D25B2D5B25 +5B325B235B2C5B275B265B2F5B2E5B7B5BF15BF25DB75E6C5E6A5FBE5FBB61C3 +61B561BC61E761E061E561E461E861DE64EF64E964E364EB64E464E865816580 +65B665DA66D26A8D6A966A816AA56A896A9F6A9B6AA16A9E6A876A936A8E0000 +ED +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +6A956A836AA86AA46A916A7F6AA66A9A6A856A8C6A926B5B6BAD6C096FCC6FA9 +6FF46FD46FE36FDC6FED6FE76FE66FDE6FF26FDD6FE26FE871E171F171E871F2 +71E471F071E27373736E736F749774B274AB749074AA74AD74B174A574AF7510 +75117512750F7584764376487649764776A476E977B577AB77B277B777B60000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000077B477B177A877F078F378FD790278FB78FC78F2790578F978FE790479AB +79A87A5C7A5B7A567A587A547A5A7ABE7AC07AC17C057C0F7BF27C007BFF7BFB +7C0E7BF47C0B7BF37C027C097C037C017BF87BFD7C067BF07BF17C107C0A7CE8 +7E2D7E3C7E427E3398487E387E2A7E497E407E477E297E4C7E307E3B7E367E44 +7E3A7F457F7F7F7E7F7D7FF47FF2802C81BB81C481CC81CA81C581C781BC81E9 +825B825A825C85838580858F85A7859585A0858B85A3857B85A4859A859E0000 +EE +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +8577857C858985A1857A85788557858E85968586858D8599859D858185A28582 +858885858579857685988590859F866887BE87AA87AD87C587B087AC87B987B5 +87BC87AE87C987C387C287CC87B787AF87C487CA87B487B687BF87B887BD87DE +87B289358933893C893E894189528937894289AD89AF89AE89F289F38B1E0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00008B188B168B118B058B0B8B228B0F8B128B158B078B0D8B088B068B1C8B13 +8B1A8C4F8C708C728C718C6F8C958C948CF98D6F8E4E8E4D8E538E508E4C8E47 +8F438F409085907E9138919A91A2919B9199919F91A1919D91A093A1938393AF +936493569347937C9358935C93769349935093519360936D938F934C936A9379 +935793559352934F93719377937B9361935E936393679380934E935995C795C0 +95C995C395C595B796AE96B096AC9720971F9718971D9719979A97A1979C0000 +EF +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +979E979D97D597D497F198419844984A9849984598439925992B992C992A9933 +9932992F992D99319930999899A399A19A0299FA99F499F799F999F899F699FB +99FD99FE99FC9A039ABE9AFE9AFD9B019AFC9B489B9A9BA89B9E9B9B9BA69BA1 +9BA59BA49B869BA29BA09BAF9D339D419D679D369D2E9D2F9D319D389D300000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00009D459D429D439D3E9D379D409D3D7FF59D2D9E8A9E899E8D9EB09EC89EDA +9EFB9EFF9F249F239F229F549FA05131512D512E5698569C5697569A569D5699 +59705B3C5C695C6A5DC05E6D5E6E61D861DF61ED61EE61F161EA61F061EB61D6 +61E964FF650464FD64F86501650364FC659465DB66DA66DB66D86AC56AB96ABD +6AE16AC66ABA6AB66AB76AC76AB46AAD6B5E6BC96C0B7007700C700D70017005 +7014700E6FFF70006FFB70266FFC6FF7700A720171FF71F9720371FD73760000 +F0 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +74B874C074B574C174BE74B674BB74C275147513765C76647659765076537657 +765A76A676BD76EC77C277BA78FF790C79137914790979107912791179AD79AC +7A5F7C1C7C297C197C207C1F7C2D7C1D7C267C287C227C257C307E5C7E507E56 +7E637E587E627E5F7E517E607E577E537FB57FB37FF77FF8807581D181D20000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000081D0825F825E85B485C685C085C385C285B385B585BD85C785C485BF85CB +85CE85C885C585B185B685D2862485B885B785BE866987E787E687E287DB87EB +87EA87E587DF87F387E487D487DC87D387ED87D887E387A487D787D9880187F4 +87E887DD8953894B894F894C89468950895189498B2A8B278B238B338B308B35 +8B478B2F8B3C8B3E8B318B258B378B268B368B2E8B248B3B8B3D8B3A8C428C75 +8C998C988C978CFE8D048D028D008E5C8E628E608E578E568E5E8E658E670000 +F1 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +8E5B8E5A8E618E5D8E698E548F468F478F488F4B9128913A913B913E91A891A5 +91A791AF91AA93B5938C939293B7939B939D938993A7938E93AA939E93A69395 +93889399939F938D93B1939193B293A493A893B493A393A595D295D395D196B3 +96D796DA5DC296DF96D896DD97239722972597AC97AE97A897AB97A497AA0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000097A297A597D797D997D697D897FA98509851985298B89941993C993A9A0F +9A0B9A099A0D9A049A119A0A9A059A079A069AC09ADC9B089B049B059B299B35 +9B4A9B4C9B4B9BC79BC69BC39BBF9BC19BB59BB89BD39BB69BC49BB99BBD9D5C +9D539D4F9D4A9D5B9D4B9D599D569D4C9D579D529D549D5F9D589D5A9E8E9E8C +9EDF9F019F009F169F259F2B9F2A9F299F289F4C9F5551345135529652F753B4 +56AB56AD56A656A756AA56AC58DA58DD58DB59125B3D5B3E5B3F5DC35E700000 +F2 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +5FBF61FB65076510650D6509650C650E658465DE65DD66DE6AE76AE06ACC6AD1 +6AD96ACB6ADF6ADC6AD06AEB6ACF6ACD6ADE6B606BB06C0C7019702770207016 +702B702170227023702970177024701C702A720C720A72077202720572A572A6 +72A472A372A174CB74C574B774C37516766077C977CA77C477F1791D791B0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00007921791C7917791E79B07A677A687C337C3C7C397C2C7C3B7CEC7CEA7E76 +7E757E787E707E777E6F7E7A7E727E747E687F4B7F4A7F837F867FB77FFD7FFE +807881D781D582648261826385EB85F185ED85D985E185E885DA85D785EC85F2 +85F885D885DF85E385DC85D185F085E685EF85DE85E2880087FA880387F687F7 +8809880C880B880687FC880887FF880A88028962895A895B89578961895C8958 +895D8959898889B789B689F68B508B488B4A8B408B538B568B548B4B8B550000 +F3 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +8B518B428B528B578C438C778C768C9A8D068D078D098DAC8DAA8DAD8DAB8E6D +8E788E738E6A8E6F8E7B8EC28F528F518F4F8F508F538FB49140913F91B091AD +93DE93C793CF93C293DA93D093F993EC93CC93D993A993E693CA93D493EE93E3 +93D593C493CE93C093D293E7957D95DA95DB96E19729972B972C972897260000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000097B397B797B697DD97DE97DF985C9859985D985798BF98BD98BB98BE9948 +9947994399A699A79A1A9A159A259A1D9A249A1B9A229A209A279A239A1E9A1C +9A149AC29B0B9B0A9B0E9B0C9B379BEA9BEB9BE09BDE9BE49BE69BE29BF09BD4 +9BD79BEC9BDC9BD99BE59BD59BE19BDA9D779D819D8A9D849D889D719D809D78 +9D869D8B9D8C9D7D9D6B9D749D759D709D699D859D739D7B9D829D6F9D799D7F +9D879D689E949E919EC09EFC9F2D9F409F419F4D9F569F579F58533756B20000 +F4 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +56B556B358E35B455DC65DC75EEE5EEF5FC05FC161F9651765166515651365DF +66E866E366E46AF36AF06AEA6AE86AF96AF16AEE6AEF703C7035702F70377034 +703170427038703F703A70397040703B703370417213721472A8737D737C74BA +76AB76AA76BE76ED77CC77CE77CF77CD77F27925792379277928792479290000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000079B27A6E7A6C7A6D7AF77C497C487C4A7C477C457CEE7E7B7E7E7E817E80 +7FBA7FFF807981DB81D9820B82688269862285FF860185FE861B860085F68604 +86098605860C85FD8819881088118817881388168963896689B989F78B608B6A +8B5D8B688B638B658B678B6D8DAE8E868E888E848F598F568F578F558F588F5A +908D9143914191B791B591B291B3940B941393FB9420940F941493FE94159410 +94289419940D93F5940093F79407940E9416941293FA940993F8940A93FF0000 +F5 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +93FC940C93F69411940695DE95E095DF972E972F97B997BB97FD97FE98609862 +9863985F98C198C29950994E9959994C994B99539A329A349A319A2C9A2A9A36 +9A299A2E9A389A2D9AC79ACA9AC69B109B129B119C0B9C089BF79C059C129BF8 +9C409C079C0E9C069C179C149C099D9F9D999DA49D9D9D929D989D909D9B0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00009DA09D949D9C9DAA9D979DA19D9A9DA29DA89D9E9DA39DBF9DA99D969DA6 +9DA79E999E9B9E9A9EE59EE49EE79EE69F309F2E9F5B9F609F5E9F5D9F599F91 +513A51395298529756C356BD56BE5B485B475DCB5DCF5EF161FD651B6B026AFC +6B036AF86B0070437044704A7048704970457046721D721A7219737E7517766A +77D0792D7931792F7C547C537CF27E8A7E877E887E8B7E867E8D7F4D7FBB8030 +81DD8618862A8626861F8623861C86198627862E862186208629861E86250000 +F6 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +8829881D881B88208824881C882B884A896D8969896E896B89FA8B798B788B45 +8B7A8B7B8D108D148DAF8E8E8E8C8F5E8F5B8F5D91469144914591B9943F943B +94369429943D943C94309439942A9437942C9440943195E595E495E39735973A +97BF97E1986498C998C698C0995899569A399A3D9A469A449A429A419A3A0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00009A3F9ACD9B159B179B189B169B3A9B529C2B9C1D9C1C9C2C9C239C289C29 +9C249C219DB79DB69DBC9DC19DC79DCA9DCF9DBE9DC59DC39DBB9DB59DCE9DB9 +9DBA9DAC9DC89DB19DAD9DCC9DB39DCD9DB29E7A9E9C9EEB9EEE9EED9F1B9F18 +9F1A9F319F4E9F659F649F924EB956C656C556CB59715B4B5B4C5DD55DD15EF2 +65216520652665226B0B6B086B096C0D7055705670577052721E721F72A9737F +74D874D574D974D7766D76AD793579B47A707A717C577C5C7C597C5B7C5A0000 +F7 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +7CF47CF17E917F4F7F8781DE826B863486358633862C86328636882C88288826 +882A8825897189BF89BE89FB8B7E8B848B828B868B858B7F8D158E958E948E9A +8E928E908E968E978F608F629147944C9450944A944B944F9447944594489449 +9446973F97E3986A986998CB9954995B9A4E9A539A549A4C9A4F9A489A4A0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00009A499A529A509AD09B199B2B9B3B9B569B559C469C489C3F9C449C399C33 +9C419C3C9C379C349C329C3D9C369DDB9DD29DDE9DDA9DCB9DD09DDC9DD19DDF +9DE99DD99DD89DD69DF59DD59DDD9EB69EF09F359F339F329F429F6B9F959FA2 +513D529958E858E759725B4D5DD8882F5F4F62016203620465296525659666EB +6B116B126B0F6BCA705B705A7222738273817383767077D47C677C667E95826C +863A86408639863C8631863B863E88308832882E883389768974897389FE0000 +F8 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +8B8C8B8E8B8B8B888C458D198E988F648F6391BC94629455945D9457945E97C4 +97C598009A569A599B1E9B1F9B209C529C589C509C4A9C4D9C4B9C559C599C4C +9C4E9DFB9DF79DEF9DE39DEB9DF89DE49DF69DE19DEE9DE69DF29DF09DE29DEC +9DF49DF39DE89DED9EC29ED09EF29EF39F069F1C9F389F379F369F439F4F0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00009F719F709F6E9F6F56D356CD5B4E5C6D652D66ED66EE6B13705F7061705D +7060722374DB74E577D5793879B779B67C6A7E977F89826D8643883888378835 +884B8B948B958E9E8E9F8EA08E9D91BE91BD91C2946B9468946996E597469743 +974797C797E59A5E9AD59B599C639C679C669C629C5E9C609E029DFE9E079E03 +9E069E059E009E019E099DFF9DFD9E049EA09F1E9F469F749F759F7656D4652E +65B86B186B196B176B1A7062722672AA77D877D979397C697C6B7CF67E9A0000 +F9 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +7E987E9B7E9981E081E18646864786488979897A897C897B89FF8B988B998EA5 +8EA48EA3946E946D946F9471947397499872995F9C689C6E9C6D9E0B9E0D9E10 +9E0F9E129E119EA19EF59F099F479F789F7B9F7A9F79571E70667C6F883C8DB2 +8EA691C394749478947694759A609C749C739C719C759E149E139EF69F0A0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00009FA4706870657CF7866A883E883D883F8B9E8C9C8EA98EC9974B98739874 +98CC996199AB9A649A669A679B249E159E179F4862076B1E7227864C8EA89482 +948094819A699A689B2E9E197229864B8B9F94839C799EB776759A6B9C7A9E1D +7069706A9EA49F7E9F499F98788192B988CF58BB60527CA75AFA255425662557 +2560256C2563255A2569255D255225642555255E256A256125582567255B2553 +25652556255F256B256225592568255C25512550256D256E2570256F25930000 diff --git a/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/dingbats.enc b/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/dingbats.enc new file mode 100644 index 0000000000000000000000000000000000000000..972948767d0055d123c9ef3096a95b4eef8b0996 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/dingbats.enc @@ -0,0 +1,20 @@ +# Encoding file: dingbats, single-byte +S +003F 1 1 +00 +0000000100020003000400050006000700080009000A000B000C000D000E000F +0010001100120013001400150016001700180019001A001B001C001D001E001F +00202701270227032704260E2706270727082709261B261E270C270D270E270F +2710271127122713271427152716271727182719271A271B271C271D271E271F +2720272127222723272427252726272726052729272A272B272C272D272E272F +2730273127322733273427352736273727382739273A273B273C273D273E273F +2740274127422743274427452746274727482749274A274B25CF274D25A0274F +27502751275225B225BC25C6275625D727582759275A275B275C275D275E007F +0080008100820083008400850086008700880089008A008B008C008D008E008F +0090009100920093009400950096009700980099009A009B009C009D009E009F +0000276127622763276427652766276726632666266526602460246124622463 +2464246524662467246824692776277727782779277A277B277C277D277E277F +2780278127822783278427852786278727882789278A278B278C278D278E278F +2790279127922793279421922194219527982799279A279B279C279D279E279F +27A027A127A227A327A427A527A627A727A827A927AA27AB27AC27AD27AE27AF +000027B127B227B327B427B527B627B727B827B927BA27BB27BC27BD27BE0000 diff --git a/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/ebcdic.enc b/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/ebcdic.enc new file mode 100644 index 0000000000000000000000000000000000000000..f451de59a59c122e23292085412b8bf112cfb151 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/ebcdic.enc @@ -0,0 +1,19 @@ +S +006F 0 1 +00 +0000000100020003008500090086007F0087008D008E000B000C000D000E000F +0010001100120013008F000A0008009700180019009C009D001C001D001E001F +0080008100820083008400920017001B00880089008A008B008C000500060007 +0090009100160093009400950096000400980099009A009B00140015009E001A +002000A000E200E400E000E100E300E500E700F10060002E003C0028002B007C +002600E900EA00EB00E800ED00EE00EF00EC00DF00210024002A0029003B009F +002D002F00C200C400C000C100C300C500C700D1005E002C0025005F003E003F +00F800C900CA00CB00C800CD00CE00CF00CC00A8003A002300400027003D0022 +00D800610062006300640065006600670068006900AB00BB00F000FD00FE00B1 +00B0006A006B006C006D006E006F00700071007200AA00BA00E600B800C600A4 +00B500AF0073007400750076007700780079007A00A100BF00D000DD00DE00AE +00A200A300A500B700A900A700B600BC00BD00BE00AC005B005C005D00B400D7 +00F900410042004300440045004600470048004900AD00F400F600F200F300F5 +00A6004A004B004C004D004E004F00500051005200B900FB00FC00DB00FA00FF +00D900F70053005400550056005700580059005A00B200D400D600D200D300D5 +003000310032003300340035003600370038003900B3007B00DC007D00DA007E diff --git a/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/euc-cn.enc b/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/euc-cn.enc new file mode 100644 index 0000000000000000000000000000000000000000..4b2f8c73ad798c18c3dbf139e9bdb206e60e0ce2 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/euc-cn.enc @@ -0,0 +1,1397 @@ +# Encoding file: euc-cn, multi-byte +M +003F 0 82 +00 +0000000100020003000400050006000700080009000A000B000C000D000E000F +0010001100120013001400150016001700180019001A001B001C001D001E001F +0020002100220023002400250026002700280029002A002B002C002D002E002F +0030003100320033003400350036003700380039003A003B003C003D003E003F +0040004100420043004400450046004700480049004A004B004C004D004E004F +0050005100520053005400550056005700580059005A005B005C005D005E005F +0060006100620063006400650066006700680069006A006B006C006D006E006F +0070007100720073007400750076007700780079007A007B007C007D007E007F +0080008100820083008400850086008700880089008A008B008C008D008E008F +0090009100920093009400950096009700980099009A009B009C009D009E009F +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +A1 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000030003001300230FB02C902C700A8300330052015FF5E2225202620182019 +201C201D3014301530083009300A300B300C300D300E300F3016301730103011 +00B100D700F72236222722282211220F222A222922082237221A22A522252220 +23122299222B222E2261224C2248223D221D2260226E226F22642265221E2235 +22342642264000B0203220332103FF0400A4FFE0FFE1203000A7211626062605 +25CB25CF25CE25C725C625A125A025B325B2203B219221902191219330130000 +A2 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000024882489248A248B248C248D248E248F2490249124922493249424952496 +249724982499249A249B247424752476247724782479247A247B247C247D247E +247F248024812482248324842485248624872460246124622463246424652466 +2467246824690000000032203221322232233224322532263227322832290000 +00002160216121622163216421652166216721682169216A216B000000000000 +A3 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000FF01FF02FF03FFE5FF05FF06FF07FF08FF09FF0AFF0BFF0CFF0DFF0EFF0F +FF10FF11FF12FF13FF14FF15FF16FF17FF18FF19FF1AFF1BFF1CFF1DFF1EFF1F +FF20FF21FF22FF23FF24FF25FF26FF27FF28FF29FF2AFF2BFF2CFF2DFF2EFF2F +FF30FF31FF32FF33FF34FF35FF36FF37FF38FF39FF3AFF3BFF3CFF3DFF3EFF3F +FF40FF41FF42FF43FF44FF45FF46FF47FF48FF49FF4AFF4BFF4CFF4DFF4EFF4F +FF50FF51FF52FF53FF54FF55FF56FF57FF58FF59FF5AFF5BFF5CFF5DFFE30000 +A4 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000304130423043304430453046304730483049304A304B304C304D304E304F +3050305130523053305430553056305730583059305A305B305C305D305E305F +3060306130623063306430653066306730683069306A306B306C306D306E306F +3070307130723073307430753076307730783079307A307B307C307D307E307F +3080308130823083308430853086308730883089308A308B308C308D308E308F +3090309130923093000000000000000000000000000000000000000000000000 +A5 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000030A130A230A330A430A530A630A730A830A930AA30AB30AC30AD30AE30AF +30B030B130B230B330B430B530B630B730B830B930BA30BB30BC30BD30BE30BF +30C030C130C230C330C430C530C630C730C830C930CA30CB30CC30CD30CE30CF +30D030D130D230D330D430D530D630D730D830D930DA30DB30DC30DD30DE30DF +30E030E130E230E330E430E530E630E730E830E930EA30EB30EC30ED30EE30EF +30F030F130F230F330F430F530F6000000000000000000000000000000000000 +A6 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000039103920393039403950396039703980399039A039B039C039D039E039F +03A003A103A303A403A503A603A703A803A90000000000000000000000000000 +000003B103B203B303B403B503B603B703B803B903BA03BB03BC03BD03BE03BF +03C003C103C303C403C503C603C703C803C90000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +A7 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000004100411041204130414041504010416041704180419041A041B041C041D +041E041F0420042104220423042404250426042704280429042A042B042C042D +042E042F00000000000000000000000000000000000000000000000000000000 +000004300431043204330434043504510436043704380439043A043B043C043D +043E043F0440044104420443044404450446044704480449044A044B044C044D +044E044F00000000000000000000000000000000000000000000000000000000 +A8 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000010100E101CE00E0011300E9011B00E8012B00ED01D000EC014D00F301D2 +00F2016B00FA01D400F901D601D801DA01DC00FC00EA00000000000000000000 +0000000000000000000031053106310731083109310A310B310C310D310E310F +3110311131123113311431153116311731183119311A311B311C311D311E311F +3120312131223123312431253126312731283129000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +A9 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00000000000000002500250125022503250425052506250725082509250A250B +250C250D250E250F2510251125122513251425152516251725182519251A251B +251C251D251E251F2520252125222523252425252526252725282529252A252B +252C252D252E252F2530253125322533253425352536253725382539253A253B +253C253D253E253F2540254125422543254425452546254725482549254A254B +0000000000000000000000000000000000000000000000000000000000000000 +B0 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000554A963F57C3632854CE550954C07691764C853C77EE827E788D72319698 +978D6C285B894FFA630966975CB880FA684880AE660276CE51F9655671AC7FF1 +888450B2596561CA6FB382AD634C625253ED54277B06516B75A45DF462D48DCB +9776628A8019575D97387F627238767D67CF767E64464F708D2562DC7A176591 +73ED642C6273822C9881677F7248626E62CC4F3474E3534A529E7ECA90A65E2E +6886699C81807ED168D278C5868C9551508D8C2482DE80DE5305891252650000 +B1 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000858496F94FDD582199715B9D62B162A566B48C799C8D7206676F789160B2 +535153178F8880CC8D1D94A1500D72C8590760EB711988AB595482EF672C7B28 +5D297EF7752D6CF58E668FF8903C9F3B6BD491197B145F7C78A784D6853D6BD5 +6BD96BD65E015E8775F995ED655D5F0A5FC58F9F58C181C2907F965B97AD8FB9 +7F168D2C62414FBF53D8535E8FA88FA98FAB904D68075F6A819888689CD6618B +522B762A5F6C658C6FD26EE85BBE6448517551B067C44E1979C9997C70B30000 +B2 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000075C55E7673BB83E064AD62E894B56CE2535A52C3640F94C27B944F2F5E1B +82368116818A6E246CCA9A736355535C54FA886557E04E0D5E036B657C3F90E8 +601664E6731C88C16750624D8D22776C8E2991C75F6983DC8521991053C28695 +6B8B60ED60E8707F82CD82314ED36CA785CF64CD7CD969FD66F9834953957B56 +4FA7518C6D4B5C428E6D63D253C9832C833667E578B4643D5BDF5C945DEE8BE7 +62C667F48C7A640063BA8749998B8C177F2094F24EA7961098A4660C73160000 +B3 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000573A5C1D5E38957F507F80A05382655E7545553150218D856284949E671D +56326F6E5DE2543570928F66626F64A463A35F7B6F8890F481E38FB05C186668 +5FF16C8996488D81886C649179F057CE6A59621054484E587A0B60E96F848BDA +627F901E9A8B79E4540375F4630153196C608FDF5F1B9A70803B9F7F4F885C3A +8D647FC565A570BD514551B2866B5D075BA062BD916C75748E0C7A2061017B79 +4EC77EF877854E1181ED521D51FA6A7153A88E87950496CF6EC19664695A0000 +B4 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000784050A877D7641089E6590463E35DDD7A7F693D4F20823955984E3275AE +7A975E625E8A95EF521B5439708A6376952457826625693F918755076DF37EAF +882262337EF075B5832878C196CC8F9E614874F78BCD6B64523A8D506B21806A +847156F153064ECE4E1B51D17C97918B7C074FC38E7F7BE17A9C64675D1450AC +810676017CB96DEC7FE067515B585BF878CB64AE641363AA632B9519642D8FBE +7B5476296253592754466B7950A362345E266B864EE38D37888B5F85902E0000 +B5 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00006020803D62C54E39535590F863B880C665E66C2E4F4660EE6DE18BDE5F39 +86CB5F536321515A83616863520063638E4850125C9B79775BFC52307A3B60BC +905376D75FB75F9776848E6C706F767B7B4977AA51F3909358244F4E6EF48FEA +654C7B1B72C46DA47FDF5AE162B55E95573084827B2C5E1D5F1F90127F1498A0 +63826EC7789870B95178975B57AB75354F4375385E9760E659606DC06BBF7889 +53FC96D551CB52016389540A94938C038DCC7239789F87768FED8C0D53E00000 +B6 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00004E0176EF53EE948998769F0E952D5B9A8BA24E224E1C51AC846361C252A8 +680B4F97606B51BB6D1E515C6296659796618C46901775D890FD77636BD2728A +72EC8BFB583577798D4C675C9540809A5EA66E2159927AEF77ED953B6BB565AD +7F0E58065151961F5BF958A954288E726566987F56E4949D76FE9041638754C6 +591A593A579B8EB267358DFA8235524160F0581586FE5CE89E454FC4989D8BB9 +5A2560765384627C904F9102997F6069800C513F80335C1499756D314E8C0000 +B7 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00008D3053D17F5A7B4F4F104E4F96006CD573D085E95E06756A7FFB6A0A77FE +94927E4151E170E653CD8FD483038D2972AF996D6CDB574A82B365B980AA623F +963259A84EFF8BBF7EBA653E83F2975E556198DE80A5532A8BFD542080BA5E9F +6CB88D3982AC915A54296C1B52067EB7575F711A6C7E7C89594B4EFD5FFF6124 +7CAA4E305C0167AB87025CF0950B98CE75AF70FD902251AF7F1D8BBD594951E4 +4F5B5426592B657780A45B75627662C28F905E456C1F7B264F0F4FD8670D0000 +B8 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00006D6E6DAA798F88B15F17752B629A8F854FEF91DC65A7812F81515E9C8150 +8D74526F89868D4B590D50854ED8961C723681798D1F5BCC8BA3964459877F1A +54905676560E8BE565396982949976D66E895E727518674667D17AFF809D8D76 +611F79C665628D635188521A94A27F38809B7EB25C976E2F67607BD9768B9AD8 +818F7F947CD5641E95507A3F544A54E56B4C640162089E3D80F3759952729769 +845B683C86E49601969494EC4E2A54047ED968398DDF801566F45E9A7FB90000 +B9 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000057C2803F68975DE5653B529F606D9F9A4F9B8EAC516C5BAB5F135DE96C5E +62F18D21517194A952FE6C9F82DF72D757A267848D2D591F8F9C83C754957B8D +4F306CBD5B6459D19F1353E486CA9AA88C3780A16545987E56FA96C7522E74DC +52505BE1630289024E5662D0602A68FA51735B9851A089C27BA199867F5060EF +704C8D2F51495E7F901B747089C4572D78455F529F9F95FA8F689B3C8BE17678 +684267DC8DEA8D35523D8F8A6EDA68CD950590ED56FD679C88F98FC754C80000 +BA +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00009AB85B696D776C264EA55BB39A87916361A890AF97E9542B6DB55BD251FD +558A7F557FF064BC634D65F161BE608D710A6C576C49592F676D822A58D5568E +8C6A6BEB90DD597D801753F76D695475559D837783CF683879BE548C4F555408 +76D28C8996026CB36DB88D6B89109E648D3A563F9ED175D55F8872E0606854FC +4EA86A2A886160528F7054C470D886799E3F6D2A5B8F5F187EA255894FAF7334 +543C539A5019540E547C4E4E5FFD745A58F6846B80E1877472D07CCA6E560000 +BB +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00005F27864E552C62A44E926CAA623782B154D7534E733E6ED1753B52125316 +8BDD69D05F8A60006DEE574F6B2273AF68538FD87F13636260A3552475EA8C62 +71156DA35BA65E7B8352614C9EC478FA87577C27768751F060F6714C66435E4C +604D8C0E707063258F895FBD606286D456DE6BC160946167534960E066668D3F +79FD4F1A70E96C478BB38BF27ED88364660F5A5A9B426D516DF78C416D3B4F19 +706B83B7621660D1970D8D27797851FB573E57FA673A75787A3D79EF7B950000 +BC +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000808C99658FF96FC08BA59E2159EC7EE97F095409678168D88F917C4D96C6 +53CA602575BE6C7253735AC97EA7632451E0810A5DF184DF628051805B634F0E +796D524260B86D4E5BC45BC28BA18BB065E25FCC964559937EE77EAA560967B7 +59394F735BB652A0835A988A8D3E753294BE50477A3C4EF767B69A7E5AC16B7C +76D1575A5C167B3A95F4714E517C80A9827059787F04832768C067EC78B17877 +62E363617B804FED526A51CF835069DB92748DF58D3189C1952E7BAD4EF60000 +BD +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000506582305251996F6E106E856DA75EFA50F559DC5C066D466C5F7586848B +686859568BB253209171964D854969127901712680F64EA490CA6D479A845A07 +56BC640594F077EB4FA5811A72E189D2997A7F347EDE527F655991758F7F8F83 +53EB7A9663ED63A5768679F888579636622A52AB8282685467706377776B7AED +6D017ED389E359D0621285C982A5754C501F4ECB75A58BEB5C4A5DFE7B4B65A4 +91D14ECA6D25895F7D2795264EC58C288FDB9773664B79818FD170EC6D780000 +BE +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00005C3D52B283465162830E775B66769CB84EAC60CA7CBE7CB37ECF4E958B66 +666F988897595883656C955C5F8475C997567ADF7ADE51C070AF7A9863EA7A76 +7EA0739697ED4E4570784E5D915253A9655165E781FC8205548E5C31759A97A0 +62D872D975BD5C459A7983CA5C40548077E94E3E6CAE805A62D2636E5DE85177 +8DDD8E1E952F4FF153E560E770AC526763509E435A1F5026773753777EE26485 +652B628963985014723589C951B38BC07EDD574783CC94A7519B541B5CFB0000 +BF +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00004FCA7AE36D5A90E19A8F55805496536154AF5F0063E9697751EF6168520A +582A52D8574E780D770B5EB761777CE0625B62974EA27095800362F770E49760 +577782DB67EF68F578D5989779D158F354B353EF6E34514B523B5BA28BFE80AF +554357A660735751542D7A7A60505B5463A762A053E362635BC767AF54ED7A9F +82E691775E9388E4593857AE630E8DE880EF57577B774FA95FEB5BBD6B3E5321 +7B5072C2684677FF773665F751B54E8F76D45CBF7AA58475594E9B4150800000 +C0 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000998861276E8357646606634656F062EC62695ED39614578362C955878721 +814A8FA3556683B167658D5684DD5A6A680F62E67BEE961151706F9C8C3063FD +89C861D27F0670C26EE57405699472FC5ECA90CE67176D6A635E52B372628001 +4F6C59E5916A70D96D9D52D24E5096F7956D857E78CA7D2F5121579264C2808B +7C7B6CEA68F1695E51B7539868A872819ECE7BF172F879BB6F137406674E91CC +9CA4793C83898354540F68174E3D538952B1783E5386522950884F8B4FD00000 +C1 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000075E27ACB7C926CA596B6529B748354E94FE9805483B28FDE95705EC9601C +6D9F5E18655B813894FE604B70BC7EC37CAE51C968817CB1826F4E248F8691CF +667E4EAE8C0564A9804A50DA759771CE5BE58FBD6F664E86648295635ED66599 +521788C270C852A3730E7433679778F797164E3490BB9CDE6DCB51DB8D41541D +62CE73B283F196F69F8494C34F367F9A51CC707596755CAD988653E64EE46E9C +740969B4786B998F7559521876246D4167F3516D9F99804B54997B3C7ABF0000 +C2 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00009686578462E29647697C5A0464027BD36F0F964B82A6536298855E907089 +63B35364864F9C819E93788C97328DEF8D429E7F6F5E79845F559646622E9A74 +541594DD4FA365C55C655C617F1586516C2F5F8B73876EE47EFF5CE6631B5B6A +6EE653754E7163A0756562A18F6E4F264ED16CA67EB68BBA841D87BA7F57903B +95237BA99AA188F8843D6D1B9A867EDC59889EBB739B780186829A6C9A82561B +541757CB4E709EA653568FC881097792999286EE6EE1851366FC61626F2B0000 +C3 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00008C298292832B76F26C135FD983BD732B8305951A6BDB77DB94C6536F8302 +51925E3D8C8C8D384E4873AB679A68859176970971646CA177095A9295416BCF +7F8E66275BD059B95A9A95E895F74EEC840C84996AAC76DF9530731B68A65B5F +772F919A97617CDC8FF78C1C5F257C7379D889C56CCC871C5BC65E4268C97720 +7EF55195514D52C95A297F05976282D763CF778485D079D26E3A5E9959998511 +706D6C1162BF76BF654F60AF95FD660E879F9E2394ED540D547D8C2C64780000 +C4 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000647986116A21819C78E864699B5462B9672B83AB58A89ED86CAB6F205BDE +964C8C0B725F67D062C772614EA959C66BCD589366AE5E5552DF6155672876EE +776672677A4662FF54EA545094A090A35A1C7EB36C164E435976801059485357 +753796BE56CA63208111607C95F96DD65462998151855AE980FD59AE9713502A +6CE55C3C62DF4F60533F817B90066EBA852B62C85E7478BE64B5637B5FF55A18 +917F9E1F5C3F634F80425B7D556E954A954D6D8560A867E072DE51DD5B810000 +C5 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000062E76CDE725B626D94AE7EBD81136D53519C5F04597452AA601259736696 +8650759F632A61E67CEF8BFA54E66B279E256BB485D5545550766CA4556A8DB4 +722C5E156015743662CD6392724C5F986E436D3E65006F5876D878D076FC7554 +522453DB4E535E9E65C1802A80D6629B5486522870AE888D8DD16CE1547880DA +57F988F48D54966A914D4F696C9B55B776C6783062A870F96F8E5F6D84EC68DA +787C7BF781A8670B9E4F636778B0576F78129739627962AB528874356BD70000 +C6 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00005564813E75B276AE533975DE50FB5C418B6C7BC7504F72479A9798D86F02 +74E27968648777A562FC98918D2B54C180584E52576A82F9840D5E7351ED74F6 +8BC45C4F57616CFC98875A4678349B448FEB7C955256625194FA4EC683868461 +83E984B257D467345703666E6D668C3166DD7011671F6B3A6816621A59BB4E03 +51C46F0667D26C8F517668CB59476B6775665D0E81109F5065D7794879419A91 +8D775C824E5E4F01542F5951780C56686C148FC45F036C7D6CE38BAB63900000 +C7 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000060706D3D72756266948E94C553438FC17B7E4EDF8C264E7E9ED494B194B3 +524D6F5C90636D458C3458115D4C6B206B4967AA545B81547F8C589985375F3A +62A26A47953965726084686577A74E544FA85DE7979864AC7FD85CED4FCF7A8D +520783044E14602F7A8394A64FB54EB279E6743452E482B964D279BD5BDD6C81 +97528F7B6C22503E537F6E0564CE66746C3060C598778BF75E86743C7A7779CB +4E1890B174036C4256DA914B6CC58D8B533A86C666F28EAF5C489A716E200000 +C8 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000053D65A369F8B8DA353BB570898A76743919B6CC9516875CA62F372AC5238 +529D7F3A7094763853749E4A69B7786E96C088D97FA4713671C3518967D374E4 +58E4651856B78BA9997662707ED560F970ED58EC4EC14EBA5FCD97E74EFB8BA4 +5203598A7EAB62544ECD65E5620E833884C98363878D71946EB65BB97ED25197 +63C967D480898339881551125B7A59828FB14E736C5D516589258F6F962E854A +745E951095F06DA682E55F3164926D128428816E9CC3585E8D5B4E0953C10000 +C9 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00004F1E6563685155D34E2764149A9A626B5AC2745F82726DA968EE50E7838E +7802674052396C997EB150BB5565715E7B5B665273CA82EB67495C715220717D +886B95EA965564C58D6181B355846C5562477F2E58924F2455468D4F664C4E0A +5C1A88F368A2634E7A0D70E7828D52FA97F65C1154E890B57ECD59628D4A86C7 +820C820D8D6664445C0461516D89793E8BBE78377533547B4F388EAB6DF15A20 +7EC5795E6C885BA15A76751A80BE614E6E1758F0751F7525727253477EF30000 +CA +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000770176DB526980DC57235E08593172EE65BD6E7F8BD75C388671534177F3 +62FE65F64EC098DF86805B9E8BC653F277E24F7F5C4E9A7659CB5F0F793A58EB +4E1667FF4E8B62ED8A93901D52BF662F55DC566C90024ED54F8D91CA99706C0F +5E0260435BA489C68BD56536624B99965B885BFF6388552E53D77626517D852C +67A268B36B8A62928F9353D482126DD1758F4E668D4E5B70719F85AF669166D9 +7F7287009ECD9F205C5E672F8FF06811675F620D7AD658855EB665706F310000 +CB +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000060555237800D6454887075295E05681362F4971C53CC723D8C016C347761 +7A0E542E77AC987A821C8BF47855671470C165AF64955636601D79C153F84E1D +6B7B80865BFA55E356DB4F3A4F3C99725DF3677E80386002988290015B8B8BBC +8BF5641C825864DE55FD82CF91654FD77D20901F7C9F50F358516EAF5BBF8BC9 +80839178849C7B97867D968B968F7EE59AD3788E5C817A57904296A7795F5B59 +635F7B0B84D168AD55067F2974107D2295016240584C4ED65B83597958540000 +CC +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000736D631E8E4B8E0F80CE82D462AC53F06CF0915E592A60016C70574D644A +8D2A762B6EE9575B6A8075F06F6D8C2D8C0857666BEF889278B363A253F970AD +6C645858642A580268E0819B55107CD650188EBA6DCC8D9F70EB638F6D9B6ED4 +7EE68404684390036DD896768BA85957727985E4817E75BC8A8A68AF52548E22 +951163D098988E44557C4F5366FF568F60D56D9552435C4959296DFB586B7530 +751C606C82148146631167618FE2773A8DF38D3494C15E165385542C70C30000 +CD +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00006C405EF7505C4EAD5EAD633A8247901A6850916E77B3540C94DC5F647AE5 +687663457B527EDF75DB507762955934900F51F879C37A8156FE5F9290146D82 +5C60571F541051546E4D56E263A89893817F8715892A9000541E5C6F81C062D6 +625881319E3596409A6E9A7C692D59A562D3553E631654C786D96D3C5A0374E6 +889C6B6A59168C4C5F2F6E7E73A9987D4E3870F75B8C7897633D665A769660CB +5B9B5A494E0781556C6A738B4EA167897F515F8065FA671B5FD859845A010000 +CE +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00005DCD5FAE537197E68FDD684556F4552F60DF4E3A6F4D7EF482C7840E59D4 +4F1F4F2A5C3E7EAC672A851A5473754F80C355829B4F4F4D6E2D8C135C096170 +536B761F6E29868A658795FB7EB9543B7A337D0A95EE55E17FC174EE631D8717 +6DA17A9D621165A1536763E16C835DEB545C94A84E4C6C618BEC5C4B65E0829C +68A7543E54346BCB6B664E9463425348821E4F0D4FAE575E620A96FE66647269 +52FF52A1609F8BEF661471996790897F785277FD6670563B54389521727A0000 +CF +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00007A00606F5E0C6089819D591560DC718470EF6EAA6C5072806A8488AD5E2D +4E605AB3559C94E36D177CFB9699620F7EC6778E867E5323971E8F9666875CE1 +4FA072ED4E0B53A6590F54136380952851484ED99C9C7EA454B88D2488548237 +95F26D8E5F265ACC663E966973B0732E53BF817A99857FA15BAA967796507EBF +76F853A2957699997BB189446E584E617FD479658BE660F354CD4EAB98795DF7 +6A6150CF54118C618427785D9704524A54EE56A395006D885BB56DC666530000 +D0 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00005C0F5B5D6821809655787B11654869544E9B6B47874E978B534F631F643A +90AA659C80C18C10519968B0537887F961C86CC46CFB8C225C5185AA82AF950C +6B238F9B65B05FFB5FC34FE18845661F8165732960FA51745211578B5F6290A2 +884C91925E78674F602759D3514451F680F853086C7996C4718A4F114FEE7F9E +673D55C5950879C088967EE3589F620C9700865A5618987B5F908BB884C49157 +53D965ED5E8F755C60647D6E5A7F7EEA7EED8F6955A75BA360AC65CB73840000 +D1 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00009009766377297EDA9774859B5B667A7496EA884052CB718F5FAA65EC8BE2 +5BFB9A6F5DE16B896C5B8BAD8BAF900A8FC5538B62BC9E269E2D54404E2B82BD +7259869C5D1688596DAF96C554D14E9A8BB6710954BD960970DF6DF976D04E25 +781487125CA95EF68A00989C960E708E6CBF594463A9773C884D6F1482735830 +71D5538C781A96C155015F6671305BB48C1A9A8C6B83592E9E2F79E76768626C +4F6F75A17F8A6D0B96336C274EF075D2517B68376F3E90808170599674760000 +D2 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000064475C2790657A918C2359DA54AC8200836F898180006930564E80367237 +91CE51B64E5F987563964E1A53F666F3814B591C6DB24E0058F9533B63D694F1 +4F9D4F0A886398905937905779FB4EEA80F075916C825B9C59E85F5D69058681 +501A5DF24E5977E34EE5827A6291661390915C794EBF5F7981C69038808475AB +4EA688D4610F6BC55FC64E4976CA6EA28BE38BAE8C0A8BD15F027FFC7FCC7ECE +8335836B56E06BB797F3963459FB541F94F66DEB5BC5996E5C395F1596900000 +D3 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000537082F16A315A749E705E947F2883B984248425836787478FCE8D6276C8 +5F719896786C662054DF62E54F6381C375C85EB896CD8E0A86F9548F6CF36D8C +6C38607F52C775285E7D4F1860A05FE75C24753190AE94C072B96CB96E389149 +670953CB53F34F5191C98BF153C85E7C8FC26DE44E8E76C26986865E611A8206 +4F594FDE903E9C7C61096E1D6E1496854E885A3196E84E0E5C7F79B95B878BED +7FBD738957DF828B90C15401904755BB5CEA5FA161086B3272F180B28A890000 +D4 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00006D745BD388D598848C6B9A6D9E336E0A51A4514357A38881539F63F48F95 +56ED54585706733F6E907F188FDC82D1613F6028966266F07EA68D8A8DC394A5 +5CB37CA4670860A6960580184E9190E75300966851418FD08574915D665597F5 +5B55531D78386742683D54C9707E5BB08F7D518D572854B1651266828D5E8D43 +810F846C906D7CDF51FF85FB67A365E96FA186A48E81566A90207682707671E5 +8D2362E952196CFD8D3C600E589E618E66FE8D60624E55B36E23672D8F670000 +D5 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000094E195F87728680569A8548B4E4D70B88BC86458658B5B857A84503A5BE8 +77BB6BE18A797C986CBE76CF65A98F975D2D5C5586386808536062187AD96E5B +7EFD6A1F7AE05F706F335F20638C6DA867564E085E108D264ED780C07634969C +62DB662D627E6CBC8D7571677F695146808753EC906E629854F286F08F998005 +951785178FD96D5973CD659F771F7504782781FB8D1E94884FA6679575B98BCA +9707632F9547963584B8632377415F8172F04E896014657462EF6B63653F0000 +D6 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00005E2775C790D18BC1829D679D652F5431871877E580A281026C414E4B7EC7 +804C76F4690D6B966267503C4F84574063076B628DBE53EA65E87EB85FD7631A +63B781F381F47F6E5E1C5CD95236667A79E97A1A8D28709975D46EDE6CBB7A92 +4E2D76C55FE0949F88777EC879CD80BF91CD4EF24F17821F54685DDE6D328BCC +7CA58F7480985E1A549276B15B99663C9AA473E0682A86DB6731732A8BF88BDB +90107AF970DB716E62C477A956314E3B845767F152A986C08D2E94F87B510000 +D7 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00004F4F6CE8795D9A7B6293722A62FD4E1378168F6C64B08D5A7BC668695E84 +88C55986649E58EE72B6690E95258FFD8D5857607F008C0651C6634962D95353 +684C74228301914C55447740707C6D4A517954A88D4459FF6ECB6DC45B5C7D2B +4ED47C7D6ED35B5081EA6E0D5B579B0368D58E2A5B977EFC603B7EB590B98D70 +594F63CD79DF8DB3535265CF79568BC5963B7EC494BB7E825634918967007F6A +5C0A907566285DE64F5067DE505A4F5C57505EA7000000000000000000000000 +D8 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00004E8D4E0C51404E105EFF53454E154E984E1E9B325B6C56694E2879BA4E3F +53154E47592D723B536E6C1056DF80E499976BD3777E9F174E364E9F9F104E5C +4E694E9382885B5B556C560F4EC4538D539D53A353A553AE97658D5D531A53F5 +5326532E533E8D5C5366536352025208520E522D5233523F5240524C525E5261 +525C84AF527D528252815290529351827F544EBB4EC34EC94EC24EE84EE14EEB +4EDE4F1B4EF34F224F644EF54F254F274F094F2B4F5E4F6765384F5A4F5D0000 +D9 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00004F5F4F574F324F3D4F764F744F914F894F834F8F4F7E4F7B4FAA4F7C4FAC +4F944FE64FE84FEA4FC54FDA4FE34FDC4FD14FDF4FF85029504C4FF3502C500F +502E502D4FFE501C500C50255028507E504350555048504E506C507B50A550A7 +50A950BA50D6510650ED50EC50E650EE5107510B4EDD6C3D4F584F654FCE9FA0 +6C467C74516E5DFD9EC999985181591452F9530D8A07531051EB591951554EA0 +51564EB3886E88A44EB5811488D279805B3488037FB851AB51B151BD51BC0000 +DA +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000051C7519651A251A58BA08BA68BA78BAA8BB48BB58BB78BC28BC38BCB8BCF +8BCE8BD28BD38BD48BD68BD88BD98BDC8BDF8BE08BE48BE88BE98BEE8BF08BF3 +8BF68BF98BFC8BFF8C008C028C048C078C0C8C0F8C118C128C148C158C168C19 +8C1B8C188C1D8C1F8C208C218C258C278C2A8C2B8C2E8C2F8C328C338C358C36 +5369537A961D962296219631962A963D963C964296499654965F9667966C9672 +96749688968D969796B09097909B909D909990AC90A190B490B390B690BA0000 +DB +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000090B890B090CF90C590BE90D090C490C790D390E690E290DC90D790DB90EB +90EF90FE91049122911E91239131912F913991439146520D594252A252AC52AD +52BE54FF52D052D652F053DF71EE77CD5EF451F551FC9B2F53B65F01755A5DEF +574C57A957A1587E58BC58C558D15729572C572A57335739572E572F575C573B +574257695785576B5786577C577B5768576D5776577357AD57A4578C57B257CF +57A757B4579357A057D557D857DA57D957D257B857F457EF57F857E457DD0000 +DC +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000580B580D57FD57ED5800581E5819584458205865586C58815889589A5880 +99A89F1961FF8279827D827F828F828A82A88284828E82918297829982AB82B8 +82BE82B082C882CA82E3829882B782AE82CB82CC82C182A982B482A182AA829F +82C482CE82A482E1830982F782E4830F830782DC82F482D282D8830C82FB82D3 +8311831A83068314831582E082D5831C8351835B835C83088392833C83348331 +839B835E832F834F83478343835F834083178360832D833A8333836683650000 +DD +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00008368831B8369836C836A836D836E83B0837883B383B483A083AA8393839C +8385837C83B683A9837D83B8837B8398839E83A883BA83BC83C1840183E583D8 +58078418840B83DD83FD83D6841C84388411840683D483DF840F840383F883F9 +83EA83C583C0842683F083E1845C8451845A8459847384878488847A84898478 +843C844684698476848C848E8431846D84C184CD84D084E684BD84D384CA84BF +84BA84E084A184B984B4849784E584E3850C750D853884F08539851F853A0000 +DE +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00008556853B84FF84FC8559854885688564855E857A77A285438572857B85A4 +85A88587858F857985AE859C858585B985B785B085D385C185DC85FF86278605 +86298616863C5EFE5F08593C594180375955595A5958530F5C225C255C2C5C34 +624C626A629F62BB62CA62DA62D762EE632262F66339634B634363AD63F66371 +637A638E63B4636D63AC638A636963AE63BC63F263F863E063FF63C463DE63CE +645263C663BE64456441640B641B6420640C64266421645E6484646D64960000 +DF +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000647A64B764B8649964BA64C064D064D764E464E265096525652E5F0B5FD2 +75195F11535F53F153FD53E953E853FB541254165406544B5452545354545456 +54435421545754595423543254825494547754715464549A549B548454765466 +549D54D054AD54C254B454D254A754A654D354D4547254A354D554BB54BF54CC +54D954DA54DC54A954AA54A454DD54CF54DE551B54E7552054FD551454F35522 +5523550F55115527552A5567558F55B55549556D55415555553F5550553C0000 +E0 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00005537555655755576557755335530555C558B55D2558355B155B955885581 +559F557E55D65591557B55DF55BD55BE5594559955EA55F755C9561F55D155EB +55EC55D455E655DD55C455EF55E555F255F355CC55CD55E855F555E48F94561E +5608560C56015624562355FE56005627562D565856395657562C564D56625659 +565C564C5654568656645671566B567B567C5685569356AF56D456D756DD56E1 +56F556EB56F956FF5704570A5709571C5E0F5E195E145E115E315E3B5E3C0000 +E1 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00005E375E445E545E5B5E5E5E615C8C5C7A5C8D5C905C965C885C985C995C91 +5C9A5C9C5CB55CA25CBD5CAC5CAB5CB15CA35CC15CB75CC45CD25CE45CCB5CE5 +5D025D035D275D265D2E5D245D1E5D065D1B5D585D3E5D345D3D5D6C5D5B5D6F +5D5D5D6B5D4B5D4A5D695D745D825D995D9D8C735DB75DC55F735F775F825F87 +5F895F8C5F955F995F9C5FA85FAD5FB55FBC88625F6172AD72B072B472B772B8 +72C372C172CE72CD72D272E872EF72E972F272F472F7730172F3730372FA0000 +E2 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000072FB731773137321730A731E731D7315732273397325732C733873317350 +734D73577360736C736F737E821B592598E7592459029963996799689969996A +996B996C99749977997D998099849987998A998D999099919993999499955E80 +5E915E8B5E965EA55EA05EB95EB55EBE5EB38D535ED25ED15EDB5EE85EEA81BA +5FC45FC95FD65FCF60035FEE60045FE15FE45FFE600560065FEA5FED5FF86019 +60356026601B600F600D6029602B600A603F602160786079607B607A60420000 +E3 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000606A607D6096609A60AD609D60836092608C609B60EC60BB60B160DD60D8 +60C660DA60B4612061266115612360F46100610E612B614A617561AC619461A7 +61B761D461F55FDD96B395E995EB95F195F395F595F695FC95FE960396049606 +9608960A960B960C960D960F96129615961696179619961A4E2C723F62156C35 +6C546C5C6C4A6CA36C856C906C946C8C6C686C696C746C766C866CA96CD06CD4 +6CAD6CF76CF86CF16CD76CB26CE06CD66CFA6CEB6CEE6CB16CD36CEF6CFE0000 +E4 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00006D396D276D0C6D436D486D076D046D196D0E6D2B6D4D6D2E6D356D1A6D4F +6D526D546D336D916D6F6D9E6DA06D5E6D936D946D5C6D606D7C6D636E1A6DC7 +6DC56DDE6E0E6DBF6DE06E116DE66DDD6DD96E166DAB6E0C6DAE6E2B6E6E6E4E +6E6B6EB26E5F6E866E536E546E326E256E446EDF6EB16E986EE06F2D6EE26EA5 +6EA76EBD6EBB6EB76ED76EB46ECF6E8F6EC26E9F6F626F466F476F246F156EF9 +6F2F6F366F4B6F746F2A6F096F296F896F8D6F8C6F786F726F7C6F7A6FD10000 +E5 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00006FC96FA76FB96FB66FC26FE16FEE6FDE6FE06FEF701A7023701B70397035 +704F705E5B805B845B955B935BA55BB8752F9A9E64345BE45BEE89305BF08E47 +8B078FB68FD38FD58FE58FEE8FE48FE98FE68FF38FE890059004900B90269011 +900D9016902190359036902D902F9044905190529050906890589062905B66B9 +9074907D908290889083908B5F505F575F565F585C3B54AB5C505C595B715C63 +5C667FBC5F2A5F295F2D82745F3C9B3B5C6E59815983598D59A959AA59A30000 +E6 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000599759CA59AB599E59A459D259B259AF59D759BE5A055A0659DD5A0859E3 +59D859F95A0C5A095A325A345A115A235A135A405A675A4A5A555A3C5A625A75 +80EC5AAA5A9B5A775A7A5ABE5AEB5AB25AD25AD45AB85AE05AE35AF15AD65AE6 +5AD85ADC5B095B175B165B325B375B405C155C1C5B5A5B655B735B515B535B62 +9A759A779A789A7A9A7F9A7D9A809A819A859A889A8A9A909A929A939A969A98 +9A9B9A9C9A9D9A9F9AA09AA29AA39AA59AA77E9F7EA17EA37EA57EA87EA90000 +E7 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00007EAD7EB07EBE7EC07EC17EC27EC97ECB7ECC7ED07ED47ED77EDB7EE07EE1 +7EE87EEB7EEE7EEF7EF17EF27F0D7EF67EFA7EFB7EFE7F017F027F037F077F08 +7F0B7F0C7F0F7F117F127F177F197F1C7F1B7F1F7F217F227F237F247F257F26 +7F277F2A7F2B7F2C7F2D7F2F7F307F317F327F337F355E7A757F5DDB753E9095 +738E739173AE73A2739F73CF73C273D173B773B373C073C973C873E573D9987C +740A73E973E773DE73BA73F2740F742A745B7426742574287430742E742C0000 +E8 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000741B741A7441745C7457745574597477746D747E749C748E748074817487 +748B749E74A874A9749074A774D274BA97EA97EB97EC674C6753675E67486769 +67A56787676A6773679867A7677567A8679E67AD678B6777677C67F0680967D8 +680A67E967B0680C67D967B567DA67B367DD680067C367B867E2680E67C167FD +6832683368606861684E6862684468646883681D68556866684168676840683E +684A6849682968B5688F687468776893686B68C2696E68FC691F692068F90000 +E9 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000692468F0690B6901695768E369106971693969606942695D6984696B6980 +69986978693469CC6987698869CE6989696669636979699B69A769BB69AB69AD +69D469B169C169CA69DF699569E0698D69FF6A2F69ED6A176A186A6569F26A44 +6A3E6AA06A506A5B6A356A8E6A796A3D6A286A586A7C6A916A906AA96A976AAB +733773526B816B826B876B846B926B936B8D6B9A6B9B6BA16BAA8F6B8F6D8F71 +8F728F738F758F768F788F778F798F7A8F7C8F7E8F818F828F848F878F8B0000 +EA +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00008F8D8F8E8F8F8F988F9A8ECE620B6217621B621F6222622162256224622C +81E774EF74F474FF750F75117513653465EE65EF65F0660A6619677266036615 +6600708566F7661D66346631663666358006665F66546641664F665666616657 +66776684668C66A7669D66BE66DB66DC66E666E98D328D338D368D3B8D3D8D40 +8D458D468D488D498D478D4D8D558D5989C789CA89CB89CC89CE89CF89D089D1 +726E729F725D7266726F727E727F7284728B728D728F72926308633263B00000 +EB +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000643F64D880046BEA6BF36BFD6BF56BF96C056C076C066C0D6C156C186C19 +6C1A6C216C296C246C2A6C3265356555656B724D72527256723086625216809F +809C809380BC670A80BD80B180AB80AD80B480B780E780E880E980EA80DB80C2 +80C480D980CD80D7671080DD80EB80F180F480ED810D810E80F280FC67158112 +8C5A8136811E812C811881328148814C815381748159815A817181608169817C +817D816D8167584D5AB58188818281916ED581A381AA81CC672681CA81BB0000 +EC +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000081C181A66B246B376B396B436B466B5998D198D298D398D598D998DA6BB3 +5F406BC289F365909F51659365BC65C665C465C365CC65CE65D265D67080709C +7096709D70BB70C070B770AB70B170E870CA711071137116712F71317173715C +716871457172714A7178717A719871B371B571A871A071E071D471E771F9721D +7228706C7118716671B9623E623D624362486249793B794079467949795B795C +7953795A796279577960796F7967797A7985798A799A79A779B35FD15FD00000 +ED +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000603C605D605A606760416059606360AB6106610D615D61A9619D61CB61D1 +62068080807F6C936CF66DFC77F677F87800780978177818781165AB782D781C +781D7839783A783B781F783C7825782C78237829784E786D7856785778267850 +7847784C786A789B7893789A7887789C78A178A378B278B978A578D478D978C9 +78EC78F2790578F479137924791E79349F9B9EF99EFB9EFC76F17704770D76F9 +77077708771A77227719772D7726773577387750775177477743775A77680000 +EE +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000077627765777F778D777D7780778C7791779F77A077B077B577BD753A7540 +754E754B7548755B7572757975837F587F617F5F8A487F687F747F717F797F81 +7F7E76CD76E58832948594869487948B948A948C948D948F9490949494979495 +949A949B949C94A394A494AB94AA94AD94AC94AF94B094B294B494B694B794B8 +94B994BA94BC94BD94BF94C494C894C994CA94CB94CC94CD94CE94D094D194D2 +94D594D694D794D994D894DB94DE94DF94E094E294E494E594E794E894EA0000 +EF +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000094E994EB94EE94EF94F394F494F594F794F994FC94FD94FF950395029506 +95079509950A950D950E950F951295139514951595169518951B951D951E951F +9522952A952B9529952C953195329534953695379538953C953E953F95429535 +9544954595469549954C954E954F9552955395549556955795589559955B955E +955F955D95619562956495659566956795689569956A956B956C956F95719572 +9573953A77E777EC96C979D579ED79E379EB7A065D477A037A027A1E7A140000 +F0 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00007A397A377A519ECF99A57A707688768E7693769976A474DE74E0752C9E20 +9E229E289E299E2A9E2B9E2C9E329E319E369E389E379E399E3A9E3E9E419E42 +9E449E469E479E489E499E4B9E4C9E4E9E519E559E579E5A9E5B9E5C9E5E9E63 +9E669E679E689E699E6A9E6B9E6C9E719E6D9E7375927594759675A0759D75AC +75A375B375B475B875C475B175B075C375C275D675CD75E375E875E675E475EB +75E7760375F175FC75FF761076007605760C7617760A76257618761576190000 +F1 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000761B763C762276207640762D7630763F76357643763E7633764D765E7654 +765C7656766B766F7FCA7AE67A787A797A807A867A887A957AA67AA07AAC7AA8 +7AAD7AB3886488698872887D887F888288A288C688B788BC88C988E288CE88E3 +88E588F1891A88FC88E888FE88F0892189198913891B890A8934892B89368941 +8966897B758B80E576B276B477DC801280148016801C80208022802580268027 +802980288031800B803580438046804D80528069807189839878988098830000 +F2 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00009889988C988D988F9894989A989B989E989F98A198A298A598A6864D8654 +866C866E867F867A867C867B86A8868D868B86AC869D86A786A386AA869386A9 +86B686C486B586CE86B086BA86B186AF86C986CF86B486E986F186F286ED86F3 +86D0871386DE86F486DF86D886D18703870786F88708870A870D87098723873B +871E8725872E871A873E87488734873187298737873F87828722877D877E877B +87608770874C876E878B87538763877C876487598765879387AF87A887D20000 +F3 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000087C68788878587AD8797878387AB87E587AC87B587B387CB87D387BD87D1 +87C087CA87DB87EA87E087EE8816881387FE880A881B88218839883C7F367F42 +7F447F4582107AFA7AFD7B087B037B047B157B0A7B2B7B0F7B477B387B2A7B19 +7B2E7B317B207B257B247B337B3E7B1E7B587B5A7B457B757B4C7B5D7B607B6E +7B7B7B627B727B717B907BA67BA77BB87BAC7B9D7BA87B857BAA7B9C7BA27BAB +7BB47BD17BC17BCC7BDD7BDA7BE57BE67BEA7C0C7BFE7BFC7C0F7C167C0B0000 +F4 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00007C1F7C2A7C267C387C417C4081FE82018202820481EC8844822182228223 +822D822F8228822B8238823B82338234823E82448249824B824F825A825F8268 +887E8885888888D888DF895E7F9D7F9F7FA77FAF7FB07FB27C7C65497C917C9D +7C9C7C9E7CA27CB27CBC7CBD7CC17CC77CCC7CCD7CC87CC57CD77CE8826E66A8 +7FBF7FCE7FD57FE57FE17FE67FE97FEE7FF37CF87D777DA67DAE7E477E9B9EB8 +9EB48D738D848D948D918DB18D678D6D8C478C49914A9150914E914F91640000 +F5 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00009162916191709169916F917D917E917291749179918C91859190918D9191 +91A291A391AA91AD91AE91AF91B591B491BA8C559E7E8DB88DEB8E058E598E69 +8DB58DBF8DBC8DBA8DC48DD68DD78DDA8DDE8DCE8DCF8DDB8DC68DEC8DF78DF8 +8DE38DF98DFB8DE48E098DFD8E148E1D8E1F8E2C8E2E8E238E2F8E3A8E408E39 +8E358E3D8E318E498E418E428E518E528E4A8E708E768E7C8E6F8E748E858E8F +8E948E908E9C8E9E8C788C828C8A8C858C988C94659B89D689DE89DA89DC0000 +F6 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000089E589EB89EF8A3E8B26975396E996F396EF970697019708970F970E972A +972D9730973E9F809F839F859F869F879F889F899F8A9F8C9EFE9F0B9F0D96B9 +96BC96BD96CE96D277BF96E0928E92AE92C8933E936A93CA938F943E946B9C7F +9C829C859C869C879C887A239C8B9C8E9C909C919C929C949C959C9A9C9B9C9E +9C9F9CA09CA19CA29CA39CA59CA69CA79CA89CA99CAB9CAD9CAE9CB09CB19CB2 +9CB39CB49CB59CB69CB79CBA9CBB9CBC9CBD9CC49CC59CC69CC79CCA9CCB0000 +F7 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00009CCC9CCD9CCE9CCF9CD09CD39CD49CD59CD79CD89CD99CDC9CDD9CDF9CE2 +977C978597919792979497AF97AB97A397B297B49AB19AB09AB79E589AB69ABA +9ABC9AC19AC09AC59AC29ACB9ACC9AD19B459B439B479B499B489B4D9B5198E8 +990D992E995599549ADF9AE19AE69AEF9AEB9AFB9AED9AF99B089B0F9B139B1F +9B239EBD9EBE7E3B9E829E879E889E8B9E9293D69E9D9E9F9EDB9EDC9EDD9EE0 +9EDF9EE29EE99EE79EE59EEA9EEF9F229F2C9F2F9F399F379F3D9F3E9F440000 diff --git a/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/euc-jp.enc b/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/euc-jp.enc new file mode 100644 index 0000000000000000000000000000000000000000..db56c888231c15f4b289344979eb92117e9de400 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/euc-jp.enc @@ -0,0 +1,1353 @@ +# Encoding file: euc-jp, multi-byte +M +003F 0 79 +00 +0000000100020003000400050006000700080009000A000B000C000D000E000F +0010001100120013001400150016001700180019001A001B001C001D001E001F +0020002100220023002400250026002700280029002A002B002C002D002E002F +0030003100320033003400350036003700380039003A003B003C003D003E003F +0040004100420043004400450046004700480049004A004B004C004D004E004F +0050005100520053005400550056005700580059005A005B005C005D005E005F +0060006100620063006400650066006700680069006A006B006C006D006E006F +0070007100720073007400750076007700780079007A007B007C007D007E007F +0080008100820083008400850086008700880089008A008B008C008D0000008F +0090009100920093009400950096009700980099009A009B009C009D009E009F +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +8E +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000FF61FF62FF63FF64FF65FF66FF67FF68FF69FF6AFF6BFF6CFF6DFF6EFF6F +FF70FF71FF72FF73FF74FF75FF76FF77FF78FF79FF7AFF7BFF7CFF7DFF7EFF7F +FF80FF81FF82FF83FF84FF85FF86FF87FF88FF89FF8AFF8BFF8CFF8DFF8EFF8F +FF90FF91FF92FF93FF94FF95FF96FF97FF98FF99FF9AFF9BFF9CFF9DFF9EFF9F +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +A1 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000300030013002FF0CFF0E30FBFF1AFF1BFF1FFF01309B309C00B4FF4000A8 +FF3EFFE3FF3F30FD30FE309D309E30034EDD30053006300730FC20152010FF0F +FF3C301C2016FF5C2026202520182019201C201DFF08FF0930143015FF3BFF3D +FF5BFF5D30083009300A300B300C300D300E300F30103011FF0B221200B100D7 +00F7FF1D2260FF1CFF1E22662267221E22342642264000B0203220332103FFE5 +FF0400A200A3FF05FF03FF06FF0AFF2000A72606260525CB25CF25CE25C70000 +A2 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000025C625A125A025B325B225BD25BC203B3012219221902191219330130000 +00000000000000000000000000000000000000002208220B2286228722822283 +222A2229000000000000000000000000000000002227222800AC21D221D42200 +220300000000000000000000000000000000000000000000222022A523122202 +220722612252226A226B221A223D221D2235222B222C00000000000000000000 +00000000212B2030266F266D266A2020202100B6000000000000000025EF0000 +A3 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +FF10FF11FF12FF13FF14FF15FF16FF17FF18FF19000000000000000000000000 +0000FF21FF22FF23FF24FF25FF26FF27FF28FF29FF2AFF2BFF2CFF2DFF2EFF2F +FF30FF31FF32FF33FF34FF35FF36FF37FF38FF39FF3A00000000000000000000 +0000FF41FF42FF43FF44FF45FF46FF47FF48FF49FF4AFF4BFF4CFF4DFF4EFF4F +FF50FF51FF52FF53FF54FF55FF56FF57FF58FF59FF5A00000000000000000000 +A4 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000304130423043304430453046304730483049304A304B304C304D304E304F +3050305130523053305430553056305730583059305A305B305C305D305E305F +3060306130623063306430653066306730683069306A306B306C306D306E306F +3070307130723073307430753076307730783079307A307B307C307D307E307F +3080308130823083308430853086308730883089308A308B308C308D308E308F +3090309130923093000000000000000000000000000000000000000000000000 +A5 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000030A130A230A330A430A530A630A730A830A930AA30AB30AC30AD30AE30AF +30B030B130B230B330B430B530B630B730B830B930BA30BB30BC30BD30BE30BF +30C030C130C230C330C430C530C630C730C830C930CA30CB30CC30CD30CE30CF +30D030D130D230D330D430D530D630D730D830D930DA30DB30DC30DD30DE30DF +30E030E130E230E330E430E530E630E730E830E930EA30EB30EC30ED30EE30EF +30F030F130F230F330F430F530F6000000000000000000000000000000000000 +A6 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000039103920393039403950396039703980399039A039B039C039D039E039F +03A003A103A303A403A503A603A703A803A90000000000000000000000000000 +000003B103B203B303B403B503B603B703B803B903BA03BB03BC03BD03BE03BF +03C003C103C303C403C503C603C703C803C90000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +A7 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000004100411041204130414041504010416041704180419041A041B041C041D +041E041F0420042104220423042404250426042704280429042A042B042C042D +042E042F00000000000000000000000000000000000000000000000000000000 +000004300431043204330434043504510436043704380439043A043B043C043D +043E043F0440044104420443044404450446044704480449044A044B044C044D +044E044F00000000000000000000000000000000000000000000000000000000 +A8 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000025002502250C251025182514251C252C25242534253C25012503250F2513 +251B251725232533252B253B254B2520252F25282537253F251D253025252538 +2542000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +B0 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00004E9C55165A03963F54C0611B632859F690228475831C7A5060AA63E16E25 +65ED846682A69BF56893572765A162715B9B59D0867B98F47D627DBE9B8E6216 +7C9F88B75B895EB563096697684895C7978D674F4EE54F0A4F4D4F9D504956F2 +593759D45A015C0960DF610F61706613690570BA754F757079FB7DAD7DEF80C3 +840E88638B029055907A533B4E954EA557DF80B290C178EF4E0058F16EA29038 +7A328328828B9C2F5141537054BD54E156E059FB5F1598F26DEB80E4852D0000 +B1 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00009662967096A097FB540B53F35B8770CF7FBD8FC296E8536F9D5C7ABA4E11 +789381FC6E26561855046B1D851A9C3B59E553A96D6674DC958F56424E91904B +96F2834F990C53E155B65B305F71662066F368046C386CF36D29745B76C87A4E +983482F1885B8A6092ED6DB275AB76CA99C560A68B018D8A95B2698E53AD5186 +5712583059445BB45EF6602863A963F46CBF6F14708E7114715971D5733F7E01 +827682D185979060925B9D1B586965BC6C5A752551F9592E59655F805FDC0000 +B2 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000062BC65FA6A2A6B276BB4738B7FC189569D2C9D0E9EC45CA16C96837B5104 +5C4B61B681C6687672614E594FFA537860696E297A4F97F34E0B53164EEE4F55 +4F3D4FA14F7352A053EF5609590F5AC15BB65BE179D16687679C67B66B4C6CB3 +706B73C2798D79BE7A3C7B8782B182DB8304837783EF83D387668AB256298CA8 +8FE6904E971E868A4FC45CE862117259753B81E582BD86FE8CC096C5991399D5 +4ECB4F1A89E356DE584A58CA5EFB5FEB602A6094606261D0621262D065390000 +B3 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00009B41666668B06D777070754C76867D7582A587F9958B968E8C9D51F152BE +591654B35BB35D16616869826DAF788D84CB88578A7293A79AB86D6C99A886D9 +57A367FF86CE920E5283568754045ED362E164B9683C68386BBB737278BA7A6B +899A89D28D6B8F0390ED95A3969497695B665CB3697D984D984E639B7B206A2B +6A7F68B69C0D6F5F5272559D607062EC6D3B6E076ED1845B89108F444E149C39 +53F6691B6A3A9784682A515C7AC384B291DC938C565B9D286822830584310000 +B4 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00007CA5520882C574E64E7E4F8351A05BD2520A52D852E75DFB559A582A59E6 +5B8C5B985BDB5E725E7960A3611F616361BE63DB656267D1685368FA6B3E6B53 +6C576F226F976F4574B0751876E3770B7AFF7BA17C217DE97F367FF0809D8266 +839E89B38ACC8CAB908494519593959195A2966597D3992882184E38542B5CB8 +5DCC73A9764C773C5CA97FEB8D0B96C19811985498584F014F0E5371559C5668 +57FA59475B095BC45C905E0C5E7E5FCC63EE673A65D765E2671F68CB68C40000 +B5 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00006A5F5E306BC56C176C7D757F79485B637A007D005FBD898F8A188CB48D77 +8ECC8F1D98E29A0E9B3C4E80507D510059935B9C622F628064EC6B3A72A07591 +79477FA987FB8ABC8B7063AC83CA97A05409540355AB68546A588A7078276775 +9ECD53745BA2811A865090064E184E454EC74F1153CA54385BAE5F1360256551 +673D6C426C726CE3707874037A767AAE7B087D1A7CFE7D6665E7725B53BB5C45 +5DE862D262E063196E20865A8A318DDD92F86F0179A69B5A4EA84EAB4EAC0000 +B6 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00004F9B4FA050D151477AF6517151F653545321537F53EB55AC58835CE15F37 +5F4A602F6050606D631F65596A4B6CC172C272ED77EF80F881058208854E90F7 +93E197FF99579A5A4EF051DD5C2D6681696D5C4066F26975738968507C8150C5 +52E457475DFE932665A46B236B3D7434798179BD7B4B7DCA82B983CC887F895F +8B398FD191D1541F92804E5D503653E5533A72D7739677E982E68EAF99C699C8 +99D25177611A865E55B07A7A50765BD3904796854E326ADB91E75C515C480000 +B7 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000063987A9F6C9397748F617AAA718A96887C8268177E706851936C52F2541B +85AB8A137FA48ECD90E15366888879414FC250BE521151445553572D73EA578B +59515F625F8460756176616761A963B2643A656C666F68426E1375667A3D7CFB +7D4C7D997E4B7F6B830E834A86CD8A088A638B668EFD981A9D8F82B88FCE9BE8 +5287621F64836FC09699684150916B206C7A6F547A747D5088408A2367084EF6 +503950265065517C5238526355A7570F58055ACC5EFA61B261F862F363720000 +B8 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000691C6A29727D72AC732E7814786F7D79770C80A9898B8B198CE28ED29063 +9375967A98559A139E785143539F53B35E7B5F266E1B6E90738473FE7D438237 +8A008AFA96504E4E500B53E4547C56FA59D15B645DF15EAB5F276238654567AF +6E5672D07CCA88B480A180E183F0864E8A878DE8923796C798679F134E944E92 +4F0D53485449543E5A2F5F8C5FA1609F68A76A8E745A78818A9E8AA48B779190 +4E5E9BC94EA44F7C4FAF501950165149516C529F52B952FE539A53E354110000 +B9 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000540E5589575157A2597D5B545B5D5B8F5DE55DE75DF75E785E835E9A5EB7 +5F186052614C629762D863A7653B6602664366F4676D6821689769CB6C5F6D2A +6D696E2F6E9D75327687786C7A3F7CE07D057D187D5E7DB18015800380AF80B1 +8154818F822A8352884C88618B1B8CA28CFC90CA91759271783F92FC95A4964D +980599999AD89D3B525B52AB53F7540858D562F76FE08C6A8F5F9EB9514B523B +544A56FD7A4091779D609ED273446F09817075115FFD60DA9AA872DB8FBC0000 +BA +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00006B6498034ECA56F0576458BE5A5A606861C7660F6606683968B16DF775D5 +7D3A826E9B424E9B4F5053C955065D6F5DE65DEE67FB6C99747378028A509396 +88DF57505EA7632B50B550AC518D670054C9585E59BB5BB05F69624D63A1683D +6B736E08707D91C7728078157826796D658E7D3083DC88C18F09969B52645728 +67507F6A8CA151B45742962A583A698A80B454B25D0E57FC78959DFA4F5C524A +548B643E6628671467F57A847B567D22932F685C9BAD7B395319518A52370000 +BB +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00005BDF62F664AE64E6672D6BBA85A996D176909BD6634C93069BAB76BF6652 +4E09509853C25C7160E864926563685F71E673CA75237B977E8286958B838CDB +9178991065AC66AB6B8B4ED54ED44F3A4F7F523A53F853F255E356DB58EB59CB +59C959FF5B505C4D5E025E2B5FD7601D6307652F5B5C65AF65BD65E8679D6B62 +6B7B6C0F7345794979C17CF87D197D2B80A2810281F389968A5E8A698A668A8C +8AEE8CC78CDC96CC98FC6B6F4E8B4F3C4F8D51505B575BFA6148630166420000 +BC +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00006B216ECB6CBB723E74BD75D478C1793A800C803381EA84948F9E6C509E7F +5F0F8B589D2B7AFA8EF85B8D96EB4E0353F157F759315AC95BA460896E7F6F06 +75BE8CEA5B9F85007BE0507267F4829D5C61854A7E1E820E51995C0463688D66 +659C716E793E7D1780058B1D8ECA906E86C790AA501F52FA5C3A6753707C7235 +914C91C8932B82E55BC25F3160F94E3B53D65B88624B67316B8A72E973E07A2E +816B8DA391529996511253D7546A5BFF63886A397DAC970056DA53CE54680000 +BD +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00005B975C315DDE4FEE610162FE6D3279C079CB7D427E4D7FD281ED821F8490 +884689728B908E748F2F9031914B916C96C6919C4EC04F4F514553415F93620E +67D46C416E0B73637E2691CD928353D459195BBF6DD1795D7E2E7C9B587E719F +51FA88538FF04FCA5CFB662577AC7AE3821C99FF51C65FAA65EC696F6B896DF3 +6E966F6476FE7D145DE190759187980651E6521D6240669166D96E1A5EB67DD2 +7F7266F885AF85F78AF852A953D959735E8F5F90605592E4966450B7511F0000 +BE +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000052DD5320534753EC54E8554655315617596859BE5A3C5BB55C065C0F5C11 +5C1A5E845E8A5EE05F70627F628462DB638C63776607660C662D6676677E68A2 +6A1F6A356CBC6D886E096E58713C7126716775C77701785D7901796579F07AE0 +7B117CA77D39809683D6848B8549885D88F38A1F8A3C8A548A738C618CDE91A4 +9266937E9418969C97984E0A4E084E1E4E575197527057CE583458CC5B225E38 +60C564FE676167566D4472B675737A6384B88B7291B89320563157F498FE0000 +BF +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000062ED690D6B9671ED7E548077827289E698DF87558FB15C3B4F384FE14FB5 +55075A205BDD5BE95FC3614E632F65B0664B68EE699B6D786DF1753375B9771F +795E79E67D3381E382AF85AA89AA8A3A8EAB8F9B903291DD97074EBA4EC15203 +587558EC5C0B751A5C3D814E8A0A8FC59663976D7B258ACF9808916256F353A8 +9017543957825E2563A86C34708A77617C8B7FE088709042915493109318968F +745E9AC45D075D69657067A28DA896DB636E6749691983C5981796C088FE0000 +C0 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00006F84647A5BF84E16702C755D662F51C4523652E259D35F8160276210653F +6574661F667468F268166B636E057272751F76DB7CBE805658F088FD897F8AA0 +8A938ACB901D91929752975965897A0E810696BB5E2D60DC621A65A566146790 +77F37A4D7C4D7E3E810A8CAC8D648DE18E5F78A9520762D963A5644262988A2D +7A837BC08AAC96EA7D76820C87494ED95148534353605BA35C025C165DDD6226 +624764B0681368346CC96D456D1767D36F5C714E717D65CB7A7F7BAD7DDA0000 +C1 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00007E4A7FA8817A821B823985A68A6E8CCE8DF59078907792AD929195839BAE +524D55846F387136516879857E5581B37CCE564C58515CA863AA66FE66FD695A +72D9758F758E790E795679DF7C977D207D4486078A34963B90619F2050E75275 +53CC53E2500955AA58EE594F723D5B8B5C64531D60E360F3635C6383633F63BB +64CD65E966F95DE369CD69FD6F1571E54E8975E976F87A937CDF7DCF7D9C8061 +83498358846C84BC85FB88C58D709001906D9397971C9A1250CF5897618E0000 +C2 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000081D385358D0890204FC3507452475373606F6349675F6E2C8DB3901F4FD7 +5C5E8CCA65CF7D9A53528896517663C35B585B6B5C0A640D6751905C4ED6591A +592A6C708A51553E581559A560F0625367C182356955964099C49A284F535806 +5BFE80105CB15E2F5F856020614B623466FF6CF06EDE80CE817F82D4888B8CB8 +9000902E968A9EDB9BDB4EE353F059277B2C918D984C9DF96EDD702753535544 +5B856258629E62D36CA26FEF74228A1794386FC18AFE833851E786F853EA0000 +C3 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000053E94F4690548FB0596A81315DFD7AEA8FBF68DA8C3772F89C486A3D8AB0 +4E3953585606576662C563A265E66B4E6DE16E5B70AD77ED7AEF7BAA7DBB803D +80C686CB8A95935B56E358C75F3E65AD66966A806BB575378AC7502477E55730 +5F1B6065667A6C6075F47A1A7F6E81F48718904599B37BC9755C7AF97B5184C4 +901079E97A9283365AE177404E2D4EF25B995FE062BD663C67F16CE8866B8877 +8A3B914E92F399D06A177026732A82E784578CAF4E01514651CB558B5BF50000 +C4 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00005E165E335E815F145F355F6B5FB461F2631166A2671D6F6E7252753A773A +80748139817887768ABF8ADC8D858DF3929A957798029CE552C5635776F46715 +6C8873CD8CC393AE96736D25589C690E69CC8FFD939A75DB901A585A680263B4 +69FB4F436F2C67D88FBB85267DB49354693F6F70576A58F75B2C7D2C722A540A +91E39DB44EAD4F4E505C507552438C9E544858245B9A5E1D5E955EAD5EF75F1F +608C62B5633A63D068AF6C407887798E7A0B7DE082478A028AE68E4490130000 +C5 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000090B8912D91D89F0E6CE5645864E265756EF476847B1B906993D16EBA54F2 +5FB964A48F4D8FED92445178586B59295C555E976DFB7E8F751C8CBC8EE2985B +70B94F1D6BBF6FB1753096FB514E54105835585759AC5C605F926597675C6E21 +767B83DF8CED901490FD934D7825783A52AA5EA6571F597460125012515A51AC +51CD520055105854585859575B955CF65D8B60BC6295642D6771684368BC68DF +76D76DD86E6F6D9B706F71C85F5375D879777B497B547B527CD67D7152300000 +C6 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00008463856985E48A0E8B048C468E0F9003900F94199676982D9A3095D850CD +52D5540C58025C0E61A7649E6D1E77B37AE580F48404905392855CE09D07533F +5F975FB36D9C7279776379BF7BE46BD272EC8AAD68036A6151F87A8169345C4A +9CF682EB5BC59149701E56785C6F60C765666C8C8C5A90419813545166C7920D +594890A351854E4D51EA85998B0E7058637A934B696299B47E04757753576960 +8EDF96E36C5D4E8C5C3C5F108FE953028CD1808986795EFF65E54E7351650000 +C7 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000059825C3F97EE4EFB598A5FCD8A8D6FE179B079625BE78471732B71B15E74 +5FF5637B649A71C37C984E435EFC4E4B57DC56A260A96FC37D0D80FD813381BF +8FB2899786A45DF4628A64AD898767776CE26D3E743678345A467F7582AD99AC +4FF35EC362DD63926557676F76C3724C80CC80BA8F29914D500D57F95A926885 +6973716472FD8CB758F28CE0966A9019877F79E477E784294F2F5265535A62CD +67CF6CCA767D7B947C95823685848FEB66DD6F2072067E1B83AB99C19EA60000 +C8 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000051FD7BB178727BB880877B486AE85E61808C75517560516B92626E8C767A +91979AEA4F107F70629C7B4F95A59CE9567A585986E496BC4F345224534A53CD +53DB5E06642C6591677F6C3E6C4E724872AF73ED75547E41822C85E98CA97BC4 +91C67169981298EF633D6669756A76E478D0854386EE532A5351542659835E87 +5F7C60B26249627962AB65906BD46CCC75B276AE789179D87DCB7F7780A588AB +8AB98CBB907F975E98DB6A0B7C3850995C3E5FAE67876BD8743577097F8E0000 +C9 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00009F3B67CA7A175339758B9AED5F66819D83F180985F3C5FC575627B46903C +686759EB5A9B7D10767E8B2C4FF55F6A6A196C376F0274E2796888688A558C79 +5EDF63CF75C579D282D7932892F2849C86ED9C2D54C15F6C658C6D5C70158CA7 +8CD3983B654F74F64E0D4ED857E0592B5A665BCC51A85E035E9C601662766577 +65A7666E6D6E72367B268150819A82998B5C8CA08CE68D74961C96444FAE64AB +6B66821E8461856A90E85C01695398A8847A85574F0F526F5FA95E45670D0000 +CA +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000798F8179890789866DF55F1762556CB84ECF72699B925206543B567458B3 +61A4626E711A596E7C897CDE7D1B96F06587805E4E194F75517558405E635E73 +5F0A67C44E26853D9589965B7C73980150FB58C1765678A7522577A585117B86 +504F590972477BC77DE88FBA8FD4904D4FBF52C95A295F0197AD4FDD821792EA +570363556B69752B88DC8F147A4252DF58936155620A66AE6BCD7C3F83E95023 +4FF853055446583159495B9D5CF05CEF5D295E9662B16367653E65B9670B0000 +CB +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00006CD56CE170F978327E2B80DE82B3840C84EC870289128A2A8C4A90A692D2 +98FD9CF39D6C4E4F4EA1508D5256574A59A85E3D5FD85FD9623F66B4671B67D0 +68D251927D2180AA81A88B008C8C8CBF927E96325420982C531750D5535C58A8 +64B26734726777667A4691E652C36CA16B8658005E4C5954672C7FFB51E176C6 +646978E89B549EBB57CB59B96627679A6BCE54E969D95E55819C67959BAA67FE +9C52685D4EA64FE353C862B9672B6CAB8FC44FAD7E6D9EBF4E0761626E800000 +CC +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00006F2B85135473672A9B455DF37B955CAC5BC6871C6E4A84D17A1481085999 +7C8D6C11772052D959227121725F77DB97279D61690B5A7F5A1851A5540D547D +660E76DF8FF792989CF459EA725D6EC5514D68C97DBF7DEC97629EBA64786A21 +830259845B5F6BDB731B76F27DB280178499513267289ED976EE676252FF9905 +5C24623B7C7E8CB0554F60B67D0B958053014E5F51B6591C723A803691CE5F25 +77E253845F797D0485AC8A338E8D975667F385AE9453610961086CB976520000 +CD +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00008AED8F38552F4F51512A52C753CB5BA55E7D60A0618263D6670967DA6E67 +6D8C733673377531795088D58A98904A909190F596C4878D59154E884F594E0E +8A898F3F981050AD5E7C59965BB95EB863DA63FA64C166DC694A69D86D0B6EB6 +719475287AAF7F8A8000844984C989818B218E0A9065967D990A617E62916B32 +6C836D747FCC7FFC6DC07F8587BA88F8676583B1983C96F76D1B7D61843D916A +4E7153755D506B046FEB85CD862D89A75229540F5C65674E68A8740674830000 +CE +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000075E288CF88E191CC96E296785F8B73877ACB844E63A0756552896D416E9C +74097559786B7C9296867ADC9F8D4FB6616E65C5865C4E864EAE50DA4E2151CC +5BEE659968816DBC731F764277AD7A1C7CE7826F8AD2907C91CF96759818529B +7DD1502B539867976DCB71D0743381E88F2A96A39C579E9F746058416D997D2F +985E4EE44F364F8B51B752B15DBA601C73B2793C82D3923496B796F6970A9E97 +9F6266A66B74521752A370C888C25EC9604B61906F2371497C3E7DF4806F0000 +CF +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000084EE9023932C54429B6F6AD370898CC28DEF973252B45A415ECA5F046717 +697C69946D6A6F0F726272FC7BED8001807E874B90CE516D9E937984808B9332 +8AD6502D548C8A716B6A8CC4810760D167A09DF24E994E989C108A6B85C18568 +69006E7E78978155000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +D0 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00005F0C4E104E154E2A4E314E364E3C4E3F4E424E564E584E824E858C6B4E8A +82125F0D4E8E4E9E4E9F4EA04EA24EB04EB34EB64ECE4ECD4EC44EC64EC24ED7 +4EDE4EED4EDF4EF74F094F5A4F304F5B4F5D4F574F474F764F884F8F4F984F7B +4F694F704F914F6F4F864F9651184FD44FDF4FCE4FD84FDB4FD14FDA4FD04FE4 +4FE5501A50285014502A502550054F1C4FF650215029502C4FFE4FEF50115006 +504350476703505550505048505A5056506C50785080509A508550B450B20000 +D1 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000050C950CA50B350C250D650DE50E550ED50E350EE50F950F5510951015102 +511651155114511A5121513A5137513C513B513F51405152514C515451627AF8 +5169516A516E5180518256D8518C5189518F519151935195519651A451A651A2 +51A951AA51AB51B351B151B251B051B551BD51C551C951DB51E0865551E951ED +51F051F551FE5204520B5214520E5227522A522E52335239524F5244524B524C +525E5254526A527452695273527F527D528D529452925271528852918FA80000 +D2 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00008FA752AC52AD52BC52B552C152CD52D752DE52E352E698ED52E052F352F5 +52F852F9530653087538530D5310530F5315531A5323532F5331533353385340 +534653454E175349534D51D6535E5369536E5918537B53775382539653A053A6 +53A553AE53B053B653C37C1296D953DF66FC71EE53EE53E853ED53FA5401543D +5440542C542D543C542E54365429541D544E548F5475548E545F547154775470 +5492547B5480547654845490548654C754A254B854A554AC54C454C854A80000 +D3 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000054AB54C254A454BE54BC54D854E554E6550F551454FD54EE54ED54FA54E2 +553955405563554C552E555C55455556555755385533555D5599558054AF558A +559F557B557E5598559E55AE557C558355A9558755A855DA55C555DF55C455DC +55E455D4561455F7561655FE55FD561B55F9564E565071DF5634563656325638 +566B5664562F566C566A56865680568A56A05694568F56A556AE56B656B456C2 +56BC56C156C356C056C856CE56D156D356D756EE56F9570056FF570457090000 +D4 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00005708570B570D57135718571655C7571C572657375738574E573B5740574F +576957C057885761577F5789579357A057B357A457AA57B057C357C657D457D2 +57D3580A57D657E3580B5819581D587258215862584B58706BC05852583D5879 +588558B9589F58AB58BA58DE58BB58B858AE58C558D358D158D758D958D858E5 +58DC58E458DF58EF58FA58F958FB58FC58FD5902590A5910591B68A65925592C +592D59325938593E7AD259555950594E595A5958596259605967596C59690000 +D5 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000059785981599D4F5E4FAB59A359B259C659E859DC598D59D959DA5A255A1F +5A115A1C5A095A1A5A405A6C5A495A355A365A625A6A5A9A5ABC5ABE5ACB5AC2 +5ABD5AE35AD75AE65AE95AD65AFA5AFB5B0C5B0B5B165B325AD05B2A5B365B3E +5B435B455B405B515B555B5A5B5B5B655B695B705B735B755B7865885B7A5B80 +5B835BA65BB85BC35BC75BC95BD45BD05BE45BE65BE25BDE5BE55BEB5BF05BF6 +5BF35C055C075C085C0D5C135C205C225C285C385C395C415C465C4E5C530000 +D6 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00005C505C4F5B715C6C5C6E4E625C765C795C8C5C915C94599B5CAB5CBB5CB6 +5CBC5CB75CC55CBE5CC75CD95CE95CFD5CFA5CED5D8C5CEA5D0B5D155D175D5C +5D1F5D1B5D115D145D225D1A5D195D185D4C5D525D4E5D4B5D6C5D735D765D87 +5D845D825DA25D9D5DAC5DAE5DBD5D905DB75DBC5DC95DCD5DD35DD25DD65DDB +5DEB5DF25DF55E0B5E1A5E195E115E1B5E365E375E445E435E405E4E5E575E54 +5E5F5E625E645E475E755E765E7A9EBC5E7F5EA05EC15EC25EC85ED05ECF0000 +D7 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00005ED65EE35EDD5EDA5EDB5EE25EE15EE85EE95EEC5EF15EF35EF05EF45EF8 +5EFE5F035F095F5D5F5C5F0B5F115F165F295F2D5F385F415F485F4C5F4E5F2F +5F515F565F575F595F615F6D5F735F775F835F825F7F5F8A5F885F915F875F9E +5F995F985FA05FA85FAD5FBC5FD65FFB5FE45FF85FF15FDD60B35FFF60216060 +601960106029600E6031601B6015602B6026600F603A605A6041606A6077605F +604A6046604D6063604360646042606C606B60596081608D60E76083609A0000 +D8 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00006084609B60966097609260A7608B60E160B860E060D360B45FF060BD60C6 +60B560D8614D6115610660F660F7610060F460FA6103612160FB60F1610D610E +6147613E61286127614A613F613C612C6134613D614261446173617761586159 +615A616B6174616F61656171615F615D6153617561996196618761AC6194619A +618A619161AB61AE61CC61CA61C961F761C861C361C661BA61CB7F7961CD61E6 +61E361F661FA61F461FF61FD61FC61FE620062086209620D620C6214621B0000 +D9 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000621E6221622A622E6230623262336241624E625E6263625B62606268627C +62826289627E62926293629662D46283629462D762D162BB62CF62FF62C664D4 +62C862DC62CC62CA62C262C7629B62C9630C62EE62F163276302630862EF62F5 +6350633E634D641C634F6396638E638063AB637663A3638F6389639F63B5636B +636963BE63E963C063C663E363C963D263F663C4641664346406641364266436 +651D64176428640F6467646F6476644E652A6495649364A564A9648864BC0000 +DA +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000064DA64D264C564C764BB64D864C264F164E7820964E064E162AC64E364EF +652C64F664F464F264FA650064FD6518651C650565246523652B653465356537 +65366538754B654865566555654D6558655E655D65726578658265838B8A659B +659F65AB65B765C365C665C165C465CC65D265DB65D965E065E165F16772660A +660365FB6773663566366634661C664F664466496641665E665D666466676668 +665F6662667066836688668E668966846698669D66C166B966C966BE66BC0000 +DB +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000066C466B866D666DA66E0663F66E666E966F066F566F7670F6716671E6726 +67279738672E673F67366741673867376746675E676067596763676467896770 +67A9677C676A678C678B67A667A1678567B767EF67B467EC67B367E967B867E4 +67DE67DD67E267EE67B967CE67C667E76A9C681E684668296840684D6832684E +68B3682B685968636877687F689F688F68AD6894689D689B68836AAE68B96874 +68B568A068BA690F688D687E690168CA690868D86922692668E1690C68CD0000 +DC +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000068D468E768D569366912690468D768E3692568F968E068EF6928692A691A +6923692168C669796977695C6978696B6954697E696E69396974693D69596930 +6961695E695D6981696A69B269AE69D069BF69C169D369BE69CE5BE869CA69DD +69BB69C369A76A2E699169A0699C699569B469DE69E86A026A1B69FF6B0A69F9 +69F269E76A0569B16A1E69ED6A1469EB6A0A6A126AC16A236A136A446A0C6A72 +6A366A786A476A626A596A666A486A386A226A906A8D6AA06A846AA26AA30000 +DD +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00006A9786176ABB6AC36AC26AB86AB36AAC6ADE6AD16ADF6AAA6ADA6AEA6AFB +6B0586166AFA6B126B169B316B1F6B386B3776DC6B3998EE6B476B436B496B50 +6B596B546B5B6B5F6B616B786B796B7F6B806B846B836B8D6B986B956B9E6BA4 +6BAA6BAB6BAF6BB26BB16BB36BB76BBC6BC66BCB6BD36BDF6BEC6BEB6BF36BEF +9EBE6C086C136C146C1B6C246C236C5E6C556C626C6A6C826C8D6C9A6C816C9B +6C7E6C686C736C926C906CC46CF16CD36CBD6CD76CC56CDD6CAE6CB16CBE0000 +DE +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00006CBA6CDB6CEF6CD96CEA6D1F884D6D366D2B6D3D6D386D196D356D336D12 +6D0C6D636D936D646D5A6D796D596D8E6D956FE46D856DF96E156E0A6DB56DC7 +6DE66DB86DC66DEC6DDE6DCC6DE86DD26DC56DFA6DD96DE46DD56DEA6DEE6E2D +6E6E6E2E6E196E726E5F6E3E6E236E6B6E2B6E766E4D6E1F6E436E3A6E4E6E24 +6EFF6E1D6E386E826EAA6E986EC96EB76ED36EBD6EAF6EC46EB26ED46ED56E8F +6EA56EC26E9F6F416F11704C6EEC6EF86EFE6F3F6EF26F316EEF6F326ECC0000 +DF +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00006F3E6F136EF76F866F7A6F786F816F806F6F6F5B6FF36F6D6F826F7C6F58 +6F8E6F916FC26F666FB36FA36FA16FA46FB96FC66FAA6FDF6FD56FEC6FD46FD8 +6FF16FEE6FDB7009700B6FFA70117001700F6FFE701B701A6F74701D7018701F +7030703E7032705170637099709270AF70F170AC70B870B370AE70DF70CB70DD +70D9710970FD711C711971657155718871667162714C7156716C718F71FB7184 +719571A871AC71D771B971BE71D271C971D471CE71E071EC71E771F571FC0000 +E0 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000071F971FF720D7210721B7228722D722C72307232723B723C723F72407246 +724B72587274727E7282728172877292729672A272A772B972B272C372C672C4 +72CE72D272E272E072E172F972F7500F7317730A731C7316731D7334732F7329 +7325733E734E734F9ED87357736A7368737073787375737B737A73C873B373CE +73BB73C073E573EE73DE74A27405746F742573F87432743A7455743F745F7459 +7441745C746974707463746A7476747E748B749E74A774CA74CF74D473F10000 +E1 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000074E074E374E774E974EE74F274F074F174F874F7750475037505750C750E +750D75157513751E7526752C753C7544754D754A7549755B7546755A75697564 +7567756B756D75787576758675877574758A758975827594759A759D75A575A3 +75C275B375C375B575BD75B875BC75B175CD75CA75D275D975E375DE75FE75FF +75FC760175F075FA75F275F3760B760D7609761F762776207621762276247634 +7630763B764776487646765C76587661766276687669766A7667766C76700000 +E2 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000767276767678767C768076837688768B768E769676937699769A76B076B4 +76B876B976BA76C276CD76D676D276DE76E176E576E776EA862F76FB77087707 +770477297724771E77257726771B773777387747775A7768776B775B7765777F +777E7779778E778B779177A0779E77B077B677B977BF77BC77BD77BB77C777CD +77D777DA77DC77E377EE77FC780C781279267820792A7845788E78747886787C +789A788C78A378B578AA78AF78D178C678CB78D478BE78BC78C578CA78EC0000 +E3 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000078E778DA78FD78F47907791279117919792C792B794079607957795F795A +79557953797A797F798A799D79A79F4B79AA79AE79B379B979BA79C979D579E7 +79EC79E179E37A087A0D7A187A197A207A1F79807A317A3B7A3E7A377A437A57 +7A497A617A627A699F9D7A707A797A7D7A887A977A957A987A967AA97AC87AB0 +7AB67AC57AC47ABF90837AC77ACA7ACD7ACF7AD57AD37AD97ADA7ADD7AE17AE2 +7AE67AED7AF07B027B0F7B0A7B067B337B187B197B1E7B357B287B367B500000 +E4 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00007B7A7B047B4D7B0B7B4C7B457B757B657B747B677B707B717B6C7B6E7B9D +7B987B9F7B8D7B9C7B9A7B8B7B927B8F7B5D7B997BCB7BC17BCC7BCF7BB47BC6 +7BDD7BE97C117C147BE67BE57C607C007C077C137BF37BF77C177C0D7BF67C23 +7C277C2A7C1F7C377C2B7C3D7C4C7C437C547C4F7C407C507C587C5F7C647C56 +7C657C6C7C757C837C907CA47CAD7CA27CAB7CA17CA87CB37CB27CB17CAE7CB9 +7CBD7CC07CC57CC27CD87CD27CDC7CE29B3B7CEF7CF27CF47CF67CFA7D060000 +E5 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00007D027D1C7D157D0A7D457D4B7D2E7D327D3F7D357D467D737D567D4E7D72 +7D687D6E7D4F7D637D937D897D5B7D8F7D7D7D9B7DBA7DAE7DA37DB57DC77DBD +7DAB7E3D7DA27DAF7DDC7DB87D9F7DB07DD87DDD7DE47DDE7DFB7DF27DE17E05 +7E0A7E237E217E127E317E1F7E097E0B7E227E467E667E3B7E357E397E437E37 +7E327E3A7E677E5D7E567E5E7E597E5A7E797E6A7E697E7C7E7B7E837DD57E7D +8FAE7E7F7E887E897E8C7E927E907E937E947E967E8E7E9B7E9C7F387F3A0000 +E6 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00007F457F4C7F4D7F4E7F507F517F557F547F587F5F7F607F687F697F677F78 +7F827F867F837F887F877F8C7F947F9E7F9D7F9A7FA37FAF7FB27FB97FAE7FB6 +7FB88B717FC57FC67FCA7FD57FD47FE17FE67FE97FF37FF998DC80068004800B +801280188019801C80218028803F803B804A804680528058805A805F80628068 +80738072807080768079807D807F808480868085809B8093809A80AD519080AC +80DB80E580D980DD80C480DA80D6810980EF80F1811B81298123812F814B0000 +E7 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000968B8146813E8153815180FC8171816E81658166817481838188818A8180 +818281A0819581A481A3815F819381A981B081B581BE81B881BD81C081C281BA +81C981CD81D181D981D881C881DA81DF81E081E781FA81FB81FE820182028205 +8207820A820D821082168229822B82388233824082598258825D825A825F8264 +82628268826A826B822E827182778278827E828D829282AB829F82BB82AC82E1 +82E382DF82D282F482F382FA8393830382FB82F982DE830682DC830982D90000 +E8 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000833583348316833283318340833983508345832F832B831783188385839A +83AA839F83A283968323838E8387838A837C83B58373837583A0838983A883F4 +841383EB83CE83FD840383D8840B83C183F7840783E083F2840D8422842083BD +8438850683FB846D842A843C855A84848477846B84AD846E848284698446842C +846F8479843584CA846284B984BF849F84D984CD84BB84DA84D084C184C684D6 +84A1852184FF84F485178518852C851F8515851484FC85408563855885480000 +E9 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000085418602854B8555858085A485888591858A85A8856D8594859B85EA8587 +859C8577857E859085C985BA85CF85B985D085D585DD85E585DC85F9860A8613 +860B85FE85FA86068622861A8630863F864D4E558654865F86678671869386A3 +86A986AA868B868C86B686AF86C486C686B086C9882386AB86D486DE86E986EC +86DF86DB86EF8712870687088700870386FB87118709870D86F9870A8734873F +8737873B87258729871A8760875F8778874C874E877487578768876E87590000 +EA +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000087538763876A880587A2879F878287AF87CB87BD87C087D096D687AB87C4 +87B387C787C687BB87EF87F287E0880F880D87FE87F687F7880E87D288118816 +8815882288218831883688398827883B8844884288528859885E8862886B8881 +887E889E8875887D88B5887288828897889288AE889988A2888D88A488B088BF +88B188C388C488D488D888D988DD88F9890288FC88F488E888F28904890C890A +89138943891E8925892A892B89418944893B89368938894C891D8960895E0000 +EB +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000089668964896D896A896F89748977897E89838988898A8993899889A189A9 +89A689AC89AF89B289BA89BD89BF89C089DA89DC89DD89E789F489F88A038A16 +8A108A0C8A1B8A1D8A258A368A418A5B8A528A468A488A7C8A6D8A6C8A628A85 +8A828A848AA88AA18A918AA58AA68A9A8AA38AC48ACD8AC28ADA8AEB8AF38AE7 +8AE48AF18B148AE08AE28AF78ADE8ADB8B0C8B078B1A8AE18B168B108B178B20 +8B3397AB8B268B2B8B3E8B288B418B4C8B4F8B4E8B498B568B5B8B5A8B6B0000 +EC +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00008B5F8B6C8B6F8B748B7D8B808B8C8B8E8B928B938B968B998B9A8C3A8C41 +8C3F8C488C4C8C4E8C508C558C628C6C8C788C7A8C828C898C858C8A8C8D8C8E +8C948C7C8C98621D8CAD8CAA8CBD8CB28CB38CAE8CB68CC88CC18CE48CE38CDA +8CFD8CFA8CFB8D048D058D0A8D078D0F8D0D8D109F4E8D138CCD8D148D168D67 +8D6D8D718D738D818D998DC28DBE8DBA8DCF8DDA8DD68DCC8DDB8DCB8DEA8DEB +8DDF8DE38DFC8E088E098DFF8E1D8E1E8E108E1F8E428E358E308E348E4A0000 +ED +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00008E478E498E4C8E508E488E598E648E608E2A8E638E558E768E728E7C8E81 +8E878E858E848E8B8E8A8E938E918E948E998EAA8EA18EAC8EB08EC68EB18EBE +8EC58EC88ECB8EDB8EE38EFC8EFB8EEB8EFE8F0A8F058F158F128F198F138F1C +8F1F8F1B8F0C8F268F338F3B8F398F458F428F3E8F4C8F498F468F4E8F578F5C +8F628F638F648F9C8F9F8FA38FAD8FAF8FB78FDA8FE58FE28FEA8FEF90878FF4 +90058FF98FFA901190159021900D901E9016900B90279036903590398FF80000 +EE +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000904F905090519052900E9049903E90569058905E9068906F907696A89072 +9082907D90819080908A9089908F90A890AF90B190B590E290E4624890DB9102 +9112911991329130914A9156915891639165916991739172918B9189918291A2 +91AB91AF91AA91B591B491BA91C091C191C991CB91D091D691DF91E191DB91FC +91F591F6921E91FF9214922C92159211925E925792459249926492489295923F +924B9250929C92969293929B925A92CF92B992B792E9930F92FA9344932E0000 +EF +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000093199322931A9323933A9335933B935C9360937C936E935693B093AC93AD +939493B993D693D793E893E593D893C393DD93D093C893E4941A941494139403 +940794109436942B94359421943A944194529444945B94609462945E946A9229 +947094759477947D945A947C947E9481947F95829587958A9594959695989599 +95A095A895A795AD95BC95BB95B995BE95CA6FF695C395CD95CC95D595D495D6 +95DC95E195E595E296219628962E962F9642964C964F964B9677965C965E0000 +F0 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000965D965F96669672966C968D96989695969796AA96A796B196B296B096B4 +96B696B896B996CE96CB96C996CD894D96DC970D96D596F99704970697089713 +970E9711970F971697199724972A97309739973D973E97449746974897429749 +975C976097649766976852D2976B977197799785977C9781977A9786978B978F +9790979C97A897A697A397B397B497C397C697C897CB97DC97ED9F4F97F27ADF +97F697F5980F980C9838982498219837983D9846984F984B986B986F98700000 +F1 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000098719874987398AA98AF98B198B698C498C398C698E998EB990399099912 +991499189921991D991E99249920992C992E993D993E9942994999459950994B +99519952994C99559997999899A599AD99AE99BC99DF99DB99DD99D899D199ED +99EE99F199F299FB99F89A019A0F9A0599E29A199A2B9A379A459A429A409A43 +9A3E9A559A4D9A5B9A579A5F9A629A659A649A699A6B9A6A9AAD9AB09ABC9AC0 +9ACF9AD19AD39AD49ADE9ADF9AE29AE39AE69AEF9AEB9AEE9AF49AF19AF70000 +F2 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00009AFB9B069B189B1A9B1F9B229B239B259B279B289B299B2A9B2E9B2F9B32 +9B449B439B4F9B4D9B4E9B519B589B749B939B839B919B969B979B9F9BA09BA8 +9BB49BC09BCA9BB99BC69BCF9BD19BD29BE39BE29BE49BD49BE19C3A9BF29BF1 +9BF09C159C149C099C139C0C9C069C089C129C0A9C049C2E9C1B9C259C249C21 +9C309C479C329C469C3E9C5A9C609C679C769C789CE79CEC9CF09D099D089CEB +9D039D069D2A9D269DAF9D239D1F9D449D159D129D419D3F9D3E9D469D480000 +F3 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00009D5D9D5E9D649D519D509D599D729D899D879DAB9D6F9D7A9D9A9DA49DA9 +9DB29DC49DC19DBB9DB89DBA9DC69DCF9DC29DD99DD39DF89DE69DED9DEF9DFD +9E1A9E1B9E1E9E759E799E7D9E819E889E8B9E8C9E929E959E919E9D9EA59EA9 +9EB89EAA9EAD97619ECC9ECE9ECF9ED09ED49EDC9EDE9EDD9EE09EE59EE89EEF +9EF49EF69EF79EF99EFB9EFC9EFD9F079F0876B79F159F219F2C9F3E9F4A9F52 +9F549F639F5F9F609F619F669F679F6C9F6A9F779F729F769F959F9C9FA00000 +F4 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000582F69C79059746451DC7199000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +R +A1C1 301C FF5E +A1C2 2016 2225 +A1DD 2212 FF0D +A1F1 00A2 FFE0 +A1F2 00A3 FFE1 +A2CC 00AC FFE2 diff --git a/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/euc-kr.enc b/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/euc-kr.enc new file mode 100644 index 0000000000000000000000000000000000000000..5e9bb93bbb0ae96e1d995570e4a336a1bcb00e42 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/euc-kr.enc @@ -0,0 +1,1533 @@ +# Encoding file: euc-kr, multi-byte +M +003F 0 90 +00 +0000000100020003000400050006000700080009000A000B000C000D000E000F +0010001100120013001400150016001700180019001A001B001C001D001E001F +0020002100220023002400250026002700280029002A002B002C002D002E002F +0030003100320033003400350036003700380039003A003B003C003D003E003F +0040004100420043004400450046004700480049004A004B004C004D004E004F +0050005100520053005400550056005700580059005A005B005C005D005E005F +0060006100620063006400650066006700680069006A006B006C006D006E006F +0070007100720073007400750076007700780079007A007B007C007D007E007F +0080008100820083008400850086008700880089008A008B008C008D008E008F +0090009100920093009400950096009700980099009A009B009C009D009E009F +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +A1 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000030003001300200B72025202600A8300300AD20152225FF3C223C20182019 +201C201D3014301530083009300A300B300C300D300E300F3010301100B100D7 +00F7226022642265221E223400B0203220332103212BFFE0FFE1FFE526422640 +222022A52312220222072261225200A7203B2606260525CB25CF25CE25C725C6 +25A125A025B325B225BD25BC219221902191219321943013226A226B221A223D +221D2235222B222C2208220B2286228722822283222A222922272228FFE20000 +A2 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000021D221D42200220300B4FF5E02C702D802DD02DA02D900B802DB00A100BF +02D0222E2211220F00A42109203025C125C025B725B626642660266126652667 +2663229925C825A325D025D1259225A425A525A825A725A625A92668260F260E +261C261E00B62020202121952197219921962198266D2669266A266C327F321C +211633C7212233C233D821210000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +A3 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000FF01FF02FF03FF04FF05FF06FF07FF08FF09FF0AFF0BFF0CFF0DFF0EFF0F +FF10FF11FF12FF13FF14FF15FF16FF17FF18FF19FF1AFF1BFF1CFF1DFF1EFF1F +FF20FF21FF22FF23FF24FF25FF26FF27FF28FF29FF2AFF2BFF2CFF2DFF2EFF2F +FF30FF31FF32FF33FF34FF35FF36FF37FF38FF39FF3AFF3BFFE6FF3DFF3EFF3F +FF40FF41FF42FF43FF44FF45FF46FF47FF48FF49FF4AFF4BFF4CFF4DFF4EFF4F +FF50FF51FF52FF53FF54FF55FF56FF57FF58FF59FF5AFF5BFF5CFF5DFFE30000 +A4 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000313131323133313431353136313731383139313A313B313C313D313E313F +3140314131423143314431453146314731483149314A314B314C314D314E314F +3150315131523153315431553156315731583159315A315B315C315D315E315F +3160316131623163316431653166316731683169316A316B316C316D316E316F +3170317131723173317431753176317731783179317A317B317C317D317E317F +3180318131823183318431853186318731883189318A318B318C318D318E0000 +A5 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000217021712172217321742175217621772178217900000000000000000000 +2160216121622163216421652166216721682169000000000000000000000000 +0000039103920393039403950396039703980399039A039B039C039D039E039F +03A003A103A303A403A503A603A703A803A90000000000000000000000000000 +000003B103B203B303B403B503B603B703B803B903BA03BB03BC03BD03BE03BF +03C003C103C303C403C503C603C703C803C90000000000000000000000000000 +A6 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000025002502250C251025182514251C252C25242534253C25012503250F2513 +251B251725232533252B253B254B2520252F25282537253F251D253025252538 +254225122511251A251925162515250E250D251E251F25212522252625272529 +252A252D252E25312532253525362539253A253D253E25402541254325442545 +2546254725482549254A00000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +A7 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00003395339633972113339833C433A333A433A533A63399339A339B339C339D +339E339F33A033A133A233CA338D338E338F33CF3388338933C833A733A833B0 +33B133B233B333B433B533B633B733B833B93380338133823383338433BA33BB +33BC33BD33BE33BF33903391339233933394212633C033C1338A338B338C33D6 +33C533AD33AE33AF33DB33A933AA33AB33AC33DD33D033D333C333C933DC33C6 +0000000000000000000000000000000000000000000000000000000000000000 +A8 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000000C600D000AA0126000001320000013F014100D8015200BA00DE0166014A +00003260326132623263326432653266326732683269326A326B326C326D326E +326F3270327132723273327432753276327732783279327A327B24D024D124D2 +24D324D424D524D624D724D824D924DA24DB24DC24DD24DE24DF24E024E124E2 +24E324E424E524E624E724E824E9246024612462246324642465246624672468 +2469246A246B246C246D246E00BD2153215400BC00BE215B215C215D215E0000 +A9 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000000E6011100F001270131013301380140014200F8015300DF00FE0167014B +01493200320132023203320432053206320732083209320A320B320C320D320E +320F3210321132123213321432153216321732183219321A321B249C249D249E +249F24A024A124A224A324A424A524A624A724A824A924AA24AB24AC24AD24AE +24AF24B024B124B224B324B424B5247424752476247724782479247A247B247C +247D247E247F24802481248200B900B200B32074207F20812082208320840000 +AA +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000304130423043304430453046304730483049304A304B304C304D304E304F +3050305130523053305430553056305730583059305A305B305C305D305E305F +3060306130623063306430653066306730683069306A306B306C306D306E306F +3070307130723073307430753076307730783079307A307B307C307D307E307F +3080308130823083308430853086308730883089308A308B308C308D308E308F +3090309130923093000000000000000000000000000000000000000000000000 +AB +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000030A130A230A330A430A530A630A730A830A930AA30AB30AC30AD30AE30AF +30B030B130B230B330B430B530B630B730B830B930BA30BB30BC30BD30BE30BF +30C030C130C230C330C430C530C630C730C830C930CA30CB30CC30CD30CE30CF +30D030D130D230D330D430D530D630D730D830D930DA30DB30DC30DD30DE30DF +30E030E130E230E330E430E530E630E730E830E930EA30EB30EC30ED30EE30EF +30F030F130F230F330F430F530F6000000000000000000000000000000000000 +AC +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000004100411041204130414041504010416041704180419041A041B041C041D +041E041F0420042104220423042404250426042704280429042A042B042C042D +042E042F00000000000000000000000000000000000000000000000000000000 +000004300431043204330434043504510436043704380439043A043B043C043D +043E043F0440044104420443044404450446044704480449044A044B044C044D +044E044F00000000000000000000000000000000000000000000000000000000 +B0 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000AC00AC01AC04AC07AC08AC09AC0AAC10AC11AC12AC13AC14AC15AC16AC17 +AC19AC1AAC1BAC1CAC1DAC20AC24AC2CAC2DAC2FAC30AC31AC38AC39AC3CAC40 +AC4BAC4DAC54AC58AC5CAC70AC71AC74AC77AC78AC7AAC80AC81AC83AC84AC85 +AC86AC89AC8AAC8BAC8CAC90AC94AC9CAC9DAC9FACA0ACA1ACA8ACA9ACAAACAC +ACAFACB0ACB8ACB9ACBBACBCACBDACC1ACC4ACC8ACCCACD5ACD7ACE0ACE1ACE4 +ACE7ACE8ACEAACECACEFACF0ACF1ACF3ACF5ACF6ACFCACFDAD00AD04AD060000 +B1 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000AD0CAD0DAD0FAD11AD18AD1CAD20AD29AD2CAD2DAD34AD35AD38AD3CAD44 +AD45AD47AD49AD50AD54AD58AD61AD63AD6CAD6DAD70AD73AD74AD75AD76AD7B +AD7CAD7DAD7FAD81AD82AD88AD89AD8CAD90AD9CAD9DADA4ADB7ADC0ADC1ADC4 +ADC8ADD0ADD1ADD3ADDCADE0ADE4ADF8ADF9ADFCADFFAE00AE01AE08AE09AE0B +AE0DAE14AE30AE31AE34AE37AE38AE3AAE40AE41AE43AE45AE46AE4AAE4CAE4D +AE4EAE50AE54AE56AE5CAE5DAE5FAE60AE61AE65AE68AE69AE6CAE70AE780000 +B2 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000AE79AE7BAE7CAE7DAE84AE85AE8CAEBCAEBDAEBEAEC0AEC4AECCAECDAECF +AED0AED1AED8AED9AEDCAEE8AEEBAEEDAEF4AEF8AEFCAF07AF08AF0DAF10AF2C +AF2DAF30AF32AF34AF3CAF3DAF3FAF41AF42AF43AF48AF49AF50AF5CAF5DAF64 +AF65AF79AF80AF84AF88AF90AF91AF95AF9CAFB8AFB9AFBCAFC0AFC7AFC8AFC9 +AFCBAFCDAFCEAFD4AFDCAFE8AFE9AFF0AFF1AFF4AFF8B000B001B004B00CB010 +B014B01CB01DB028B044B045B048B04AB04CB04EB053B054B055B057B0590000 +B3 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000B05DB07CB07DB080B084B08CB08DB08FB091B098B099B09AB09CB09FB0A0 +B0A1B0A2B0A8B0A9B0ABB0ACB0ADB0AEB0AFB0B1B0B3B0B4B0B5B0B8B0BCB0C4 +B0C5B0C7B0C8B0C9B0D0B0D1B0D4B0D8B0E0B0E5B108B109B10BB10CB110B112 +B113B118B119B11BB11CB11DB123B124B125B128B12CB134B135B137B138B139 +B140B141B144B148B150B151B154B155B158B15CB160B178B179B17CB180B182 +B188B189B18BB18DB192B193B194B198B19CB1A8B1CCB1D0B1D4B1DCB1DD0000 +B4 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000B1DFB1E8B1E9B1ECB1F0B1F9B1FBB1FDB204B205B208B20BB20CB214B215 +B217B219B220B234B23CB258B25CB260B268B269B274B275B27CB284B285B289 +B290B291B294B298B299B29AB2A0B2A1B2A3B2A5B2A6B2AAB2ACB2B0B2B4B2C8 +B2C9B2CCB2D0B2D2B2D8B2D9B2DBB2DDB2E2B2E4B2E5B2E6B2E8B2EBB2ECB2ED +B2EEB2EFB2F3B2F4B2F5B2F7B2F8B2F9B2FAB2FBB2FFB300B301B304B308B310 +B311B313B314B315B31CB354B355B356B358B35BB35CB35EB35FB364B3650000 +B5 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000B367B369B36BB36EB370B371B374B378B380B381B383B384B385B38CB390 +B394B3A0B3A1B3A8B3ACB3C4B3C5B3C8B3CBB3CCB3CEB3D0B3D4B3D5B3D7B3D9 +B3DBB3DDB3E0B3E4B3E8B3FCB410B418B41CB420B428B429B42BB434B450B451 +B454B458B460B461B463B465B46CB480B488B49DB4A4B4A8B4ACB4B5B4B7B4B9 +B4C0B4C4B4C8B4D0B4D5B4DCB4DDB4E0B4E3B4E4B4E6B4ECB4EDB4EFB4F1B4F8 +B514B515B518B51BB51CB524B525B527B528B529B52AB530B531B534B5380000 +B6 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000B540B541B543B544B545B54BB54CB54DB550B554B55CB55DB55FB560B561 +B5A0B5A1B5A4B5A8B5AAB5ABB5B0B5B1B5B3B5B4B5B5B5BBB5BCB5BDB5C0B5C4 +B5CCB5CDB5CFB5D0B5D1B5D8B5ECB610B611B614B618B625B62CB634B648B664 +B668B69CB69DB6A0B6A4B6ABB6ACB6B1B6D4B6F0B6F4B6F8B700B701B705B728 +B729B72CB72FB730B738B739B73BB744B748B74CB754B755B760B764B768B770 +B771B773B775B77CB77DB780B784B78CB78DB78FB790B791B792B796B7970000 +B7 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000B798B799B79CB7A0B7A8B7A9B7ABB7ACB7ADB7B4B7B5B7B8B7C7B7C9B7EC +B7EDB7F0B7F4B7FCB7FDB7FFB800B801B807B808B809B80CB810B818B819B81B +B81DB824B825B828B82CB834B835B837B838B839B840B844B851B853B85CB85D +B860B864B86CB86DB86FB871B878B87CB88DB8A8B8B0B8B4B8B8B8C0B8C1B8C3 +B8C5B8CCB8D0B8D4B8DDB8DFB8E1B8E8B8E9B8ECB8F0B8F8B8F9B8FBB8FDB904 +B918B920B93CB93DB940B944B94CB94FB951B958B959B95CB960B968B9690000 +B8 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000B96BB96DB974B975B978B97CB984B985B987B989B98AB98DB98EB9ACB9AD +B9B0B9B4B9BCB9BDB9BFB9C1B9C8B9C9B9CCB9CEB9CFB9D0B9D1B9D2B9D8B9D9 +B9DBB9DDB9DEB9E1B9E3B9E4B9E5B9E8B9ECB9F4B9F5B9F7B9F8B9F9B9FABA00 +BA01BA08BA15BA38BA39BA3CBA40BA42BA48BA49BA4BBA4DBA4EBA53BA54BA55 +BA58BA5CBA64BA65BA67BA68BA69BA70BA71BA74BA78BA83BA84BA85BA87BA8C +BAA8BAA9BAABBAACBAB0BAB2BAB8BAB9BABBBABDBAC4BAC8BAD8BAD9BAFC0000 +B9 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000BB00BB04BB0DBB0FBB11BB18BB1CBB20BB29BB2BBB34BB35BB36BB38BB3B +BB3CBB3DBB3EBB44BB45BB47BB49BB4DBB4FBB50BB54BB58BB61BB63BB6CBB88 +BB8CBB90BBA4BBA8BBACBBB4BBB7BBC0BBC4BBC8BBD0BBD3BBF8BBF9BBFCBBFF +BC00BC02BC08BC09BC0BBC0CBC0DBC0FBC11BC14BC15BC16BC17BC18BC1BBC1C +BC1DBC1EBC1FBC24BC25BC27BC29BC2DBC30BC31BC34BC38BC40BC41BC43BC44 +BC45BC49BC4CBC4DBC50BC5DBC84BC85BC88BC8BBC8CBC8EBC94BC95BC970000 +BA +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000BC99BC9ABCA0BCA1BCA4BCA7BCA8BCB0BCB1BCB3BCB4BCB5BCBCBCBDBCC0 +BCC4BCCDBCCFBCD0BCD1BCD5BCD8BCDCBCF4BCF5BCF6BCF8BCFCBD04BD05BD07 +BD09BD10BD14BD24BD2CBD40BD48BD49BD4CBD50BD58BD59BD64BD68BD80BD81 +BD84BD87BD88BD89BD8ABD90BD91BD93BD95BD99BD9ABD9CBDA4BDB0BDB8BDD4 +BDD5BDD8BDDCBDE9BDF0BDF4BDF8BE00BE03BE05BE0CBE0DBE10BE14BE1CBE1D +BE1FBE44BE45BE48BE4CBE4EBE54BE55BE57BE59BE5ABE5BBE60BE61BE640000 +BB +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000BE68BE6ABE70BE71BE73BE74BE75BE7BBE7CBE7DBE80BE84BE8CBE8DBE8F +BE90BE91BE98BE99BEA8BED0BED1BED4BED7BED8BEE0BEE3BEE4BEE5BEECBF01 +BF08BF09BF18BF19BF1BBF1CBF1DBF40BF41BF44BF48BF50BF51BF55BF94BFB0 +BFC5BFCCBFCDBFD0BFD4BFDCBFDFBFE1C03CC051C058C05CC060C068C069C090 +C091C094C098C0A0C0A1C0A3C0A5C0ACC0ADC0AFC0B0C0B3C0B4C0B5C0B6C0BC +C0BDC0BFC0C0C0C1C0C5C0C8C0C9C0CCC0D0C0D8C0D9C0DBC0DCC0DDC0E40000 +BC +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000C0E5C0E8C0ECC0F4C0F5C0F7C0F9C100C104C108C110C115C11CC11DC11E +C11FC120C123C124C126C127C12CC12DC12FC130C131C136C138C139C13CC140 +C148C149C14BC14CC14DC154C155C158C15CC164C165C167C168C169C170C174 +C178C185C18CC18DC18EC190C194C196C19CC19DC19FC1A1C1A5C1A8C1A9C1AC +C1B0C1BDC1C4C1C8C1CCC1D4C1D7C1D8C1E0C1E4C1E8C1F0C1F1C1F3C1FCC1FD +C200C204C20CC20DC20FC211C218C219C21CC21FC220C228C229C22BC22D0000 +BD +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000C22FC231C232C234C248C250C251C254C258C260C265C26CC26DC270C274 +C27CC27DC27FC281C288C289C290C298C29BC29DC2A4C2A5C2A8C2ACC2ADC2B4 +C2B5C2B7C2B9C2DCC2DDC2E0C2E3C2E4C2EBC2ECC2EDC2EFC2F1C2F6C2F8C2F9 +C2FBC2FCC300C308C309C30CC30DC313C314C315C318C31CC324C325C328C329 +C345C368C369C36CC370C372C378C379C37CC37DC384C388C38CC3C0C3D8C3D9 +C3DCC3DFC3E0C3E2C3E8C3E9C3EDC3F4C3F5C3F8C408C410C424C42CC4300000 +BE +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000C434C43CC43DC448C464C465C468C46CC474C475C479C480C494C49CC4B8 +C4BCC4E9C4F0C4F1C4F4C4F8C4FAC4FFC500C501C50CC510C514C51CC528C529 +C52CC530C538C539C53BC53DC544C545C548C549C54AC54CC54DC54EC553C554 +C555C557C558C559C55DC55EC560C561C564C568C570C571C573C574C575C57C +C57DC580C584C587C58CC58DC58FC591C595C597C598C59CC5A0C5A9C5B4C5B5 +C5B8C5B9C5BBC5BCC5BDC5BEC5C4C5C5C5C6C5C7C5C8C5C9C5CAC5CCC5CE0000 +BF +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000C5D0C5D1C5D4C5D8C5E0C5E1C5E3C5E5C5ECC5EDC5EEC5F0C5F4C5F6C5F7 +C5FCC5FDC5FEC5FFC600C601C605C606C607C608C60CC610C618C619C61BC61C +C624C625C628C62CC62DC62EC630C633C634C635C637C639C63BC640C641C644 +C648C650C651C653C654C655C65CC65DC660C66CC66FC671C678C679C67CC680 +C688C689C68BC68DC694C695C698C69CC6A4C6A5C6A7C6A9C6B0C6B1C6B4C6B8 +C6B9C6BAC6C0C6C1C6C3C6C5C6CCC6CDC6D0C6D4C6DCC6DDC6E0C6E1C6E80000 +C0 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000C6E9C6ECC6F0C6F8C6F9C6FDC704C705C708C70CC714C715C717C719C720 +C721C724C728C730C731C733C735C737C73CC73DC740C744C74AC74CC74DC74F +C751C752C753C754C755C756C757C758C75CC760C768C76BC774C775C778C77C +C77DC77EC783C784C785C787C788C789C78AC78EC790C791C794C796C797C798 +C79AC7A0C7A1C7A3C7A4C7A5C7A6C7ACC7ADC7B0C7B4C7BCC7BDC7BFC7C0C7C1 +C7C8C7C9C7CCC7CEC7D0C7D8C7DDC7E4C7E8C7ECC800C801C804C808C80A0000 +C1 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000C810C811C813C815C816C81CC81DC820C824C82CC82DC82FC831C838C83C +C840C848C849C84CC84DC854C870C871C874C878C87AC880C881C883C885C886 +C887C88BC88CC88DC894C89DC89FC8A1C8A8C8BCC8BDC8C4C8C8C8CCC8D4C8D5 +C8D7C8D9C8E0C8E1C8E4C8F5C8FCC8FDC900C904C905C906C90CC90DC90FC911 +C918C92CC934C950C951C954C958C960C961C963C96CC970C974C97CC988C989 +C98CC990C998C999C99BC99DC9C0C9C1C9C4C9C7C9C8C9CAC9D0C9D1C9D30000 +C2 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000C9D5C9D6C9D9C9DAC9DCC9DDC9E0C9E2C9E4C9E7C9ECC9EDC9EFC9F0C9F1 +C9F8C9F9C9FCCA00CA08CA09CA0BCA0CCA0DCA14CA18CA29CA4CCA4DCA50CA54 +CA5CCA5DCA5FCA60CA61CA68CA7DCA84CA98CABCCABDCAC0CAC4CACCCACDCACF +CAD1CAD3CAD8CAD9CAE0CAECCAF4CB08CB10CB14CB18CB20CB21CB41CB48CB49 +CB4CCB50CB58CB59CB5DCB64CB78CB79CB9CCBB8CBD4CBE4CBE7CBE9CC0CCC0D +CC10CC14CC1CCC1DCC21CC22CC27CC28CC29CC2CCC2ECC30CC38CC39CC3B0000 +C3 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000CC3CCC3DCC3ECC44CC45CC48CC4CCC54CC55CC57CC58CC59CC60CC64CC66 +CC68CC70CC75CC98CC99CC9CCCA0CCA8CCA9CCABCCACCCADCCB4CCB5CCB8CCBC +CCC4CCC5CCC7CCC9CCD0CCD4CCE4CCECCCF0CD01CD08CD09CD0CCD10CD18CD19 +CD1BCD1DCD24CD28CD2CCD39CD5CCD60CD64CD6CCD6DCD6FCD71CD78CD88CD94 +CD95CD98CD9CCDA4CDA5CDA7CDA9CDB0CDC4CDCCCDD0CDE8CDECCDF0CDF8CDF9 +CDFBCDFDCE04CE08CE0CCE14CE19CE20CE21CE24CE28CE30CE31CE33CE350000 +C4 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000CE58CE59CE5CCE5FCE60CE61CE68CE69CE6BCE6DCE74CE75CE78CE7CCE84 +CE85CE87CE89CE90CE91CE94CE98CEA0CEA1CEA3CEA4CEA5CEACCEADCEC1CEE4 +CEE5CEE8CEEBCEECCEF4CEF5CEF7CEF8CEF9CF00CF01CF04CF08CF10CF11CF13 +CF15CF1CCF20CF24CF2CCF2DCF2FCF30CF31CF38CF54CF55CF58CF5CCF64CF65 +CF67CF69CF70CF71CF74CF78CF80CF85CF8CCFA1CFA8CFB0CFC4CFE0CFE1CFE4 +CFE8CFF0CFF1CFF3CFF5CFFCD000D004D011D018D02DD034D035D038D03C0000 +C5 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000D044D045D047D049D050D054D058D060D06CD06DD070D074D07CD07DD081 +D0A4D0A5D0A8D0ACD0B4D0B5D0B7D0B9D0C0D0C1D0C4D0C8D0C9D0D0D0D1D0D3 +D0D4D0D5D0DCD0DDD0E0D0E4D0ECD0EDD0EFD0F0D0F1D0F8D10DD130D131D134 +D138D13AD140D141D143D144D145D14CD14DD150D154D15CD15DD15FD161D168 +D16CD17CD184D188D1A0D1A1D1A4D1A8D1B0D1B1D1B3D1B5D1BAD1BCD1C0D1D8 +D1F4D1F8D207D209D210D22CD22DD230D234D23CD23DD23FD241D248D25C0000 +C6 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000D264D280D281D284D288D290D291D295D29CD2A0D2A4D2ACD2B1D2B8D2B9 +D2BCD2BFD2C0D2C2D2C8D2C9D2CBD2D4D2D8D2DCD2E4D2E5D2F0D2F1D2F4D2F8 +D300D301D303D305D30CD30DD30ED310D314D316D31CD31DD31FD320D321D325 +D328D329D32CD330D338D339D33BD33CD33DD344D345D37CD37DD380D384D38C +D38DD38FD390D391D398D399D39CD3A0D3A8D3A9D3ABD3ADD3B4D3B8D3BCD3C4 +D3C5D3C8D3C9D3D0D3D8D3E1D3E3D3ECD3EDD3F0D3F4D3FCD3FDD3FFD4010000 +C7 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000D408D41DD440D444D45CD460D464D46DD46FD478D479D47CD47FD480D482 +D488D489D48BD48DD494D4A9D4CCD4D0D4D4D4DCD4DFD4E8D4ECD4F0D4F8D4FB +D4FDD504D508D50CD514D515D517D53CD53DD540D544D54CD54DD54FD551D558 +D559D55CD560D565D568D569D56BD56DD574D575D578D57CD584D585D587D588 +D589D590D5A5D5C8D5C9D5CCD5D0D5D2D5D8D5D9D5DBD5DDD5E4D5E5D5E8D5EC +D5F4D5F5D5F7D5F9D600D601D604D608D610D611D613D614D615D61CD6200000 +C8 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000D624D62DD638D639D63CD640D645D648D649D64BD64DD651D654D655D658 +D65CD667D669D670D671D674D683D685D68CD68DD690D694D69DD69FD6A1D6A8 +D6ACD6B0D6B9D6BBD6C4D6C5D6C8D6CCD6D1D6D4D6D7D6D9D6E0D6E4D6E8D6F0 +D6F5D6FCD6FDD700D704D711D718D719D71CD720D728D729D72BD72DD734D735 +D738D73CD744D747D749D750D751D754D756D757D758D759D760D761D763D765 +D769D76CD770D774D77CD77DD781D788D789D78CD790D798D799D79BD79D0000 +CA +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00004F3D4F73504750F952A053EF547554E556095AC15BB6668767B667B767EF +6B4C73C275C27A3C82DB8304885788888A368CC88DCF8EFB8FE699D5523B5374 +5404606A61646BBC73CF811A89BA89D295A34F83520A58BE597859E65E725E79 +61C763C0674667EC687F6F97764E770B78F57A087AFF7C21809D826E82718AEB +95934E6B559D66F76E3478A37AED845B8910874E97A852D8574E582A5D4C611F +61BE6221656267D16A446E1B751875B376E377B07D3A90AF945194529F950000 +CB +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000053235CAC753280DB92409598525B580859DC5CA15D175EB75F3A5F4A6177 +6C5F757A75867CE07D737DB17F8C81548221859189418B1B92FC964D9C474ECB +4EF7500B51F1584F6137613E6168653969EA6F1175A5768676D67B8782A584CB +F90093A7958B55805BA25751F9017CB37FB991B5502853BB5C455DE862D2636E +64DA64E76E2070AC795B8DDD8E1EF902907D924592F84E7E4EF650655DFE5EFA +61066957817186548E4793759A2B4E5E5091677068405109528D52926AA20000 +CC +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000077BC92109ED452AB602F8FF2504861A963ED64CA683C6A846FC0818889A1 +96945805727D72AC75047D797E6D80A9898B8B7490639D5162896C7A6F547D50 +7F3A8A23517C614A7B9D8B199257938C4EAC4FD3501E50BE510652C152CD537F +577058835E9A5F91617661AC64CE656C666F66BB66F468976D87708570F1749F +74A574CA75D9786C78EC7ADF7AF67D457D938015803F811B83968B668F159015 +93E1980398389A5A9BE84FC25553583A59515B635C4660B86212684268B00000 +CD +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000068E86EAA754C767878CE7A3D7CFB7E6B7E7C8A088AA18C3F968E9DC453E4 +53E9544A547156FA59D15B645C3B5EAB62F765376545657266A067AF69C16CBD +75FC7690777E7A3F7F94800380A1818F82E682FD83F085C1883188B48AA5F903 +8F9C932E96C798679AD89F1354ED659B66F2688F7A408C379D6056F057645D11 +660668B168CD6EFE7428889E9BE46C68F9049AA84F9B516C5171529F5B545DE5 +6050606D62F163A7653B73D97A7A86A38CA2978F4E325BE16208679C74DC0000 +CE +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000079D183D38A878AB28DE8904E934B98465ED369E885FF90EDF90551A05B98 +5BEC616368FA6B3E704C742F74D87BA17F5083C589C08CAB95DC9928522E605D +62EC90024F8A5149532158D95EE366E06D38709A72C273D67B5080F1945B5366 +639B7F6B4E565080584A58DE602A612762D069D09B415B8F7D1880B18F5F4EA4 +50D154AC55AC5B0C5DA05DE7652A654E68216A4B72E1768E77EF7D5E7FF981A0 +854E86DF8F038F4E90CA99039A559BAB4E184E454E5D4EC74FF1517752FE0000 +CF +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000534053E353E5548E5614577557A25BC75D875ED061FC62D8655167B867E9 +69CB6B506BC66BEC6C426E9D707872D77396740377BF77E97A767D7F800981FC +8205820A82DF88628B338CFC8EC0901190B1926492B699D29A459CE99DD79F9C +570B5C4083CA97A097AB9EB4541B7A987FA488D98ECD90E158005C4863987A9F +5BAE5F137A797AAE828E8EAC5026523852F85377570862F363726B0A6DC37737 +53A5735785688E7695D5673A6AC36F708A6D8ECC994BF90666776B788CB40000 +D0 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00009B3CF90753EB572D594E63C669FB73EA78457ABA7AC57CFE8475898F8D73 +903595A852FB574775477B6083CC921EF9086A58514B524B5287621F68D86975 +969950C552A452E461C365A4683969FF747E7B4B82B983EB89B28B398FD19949 +F9094ECA599764D266116A8E7434798179BD82A9887E887F895FF90A93264F0B +53CA602562716C727D1A7D664E98516277DC80AF4F014F0E5176518055DC5668 +573B57FA57FC5914594759935BC45C905D0E5DF15E7E5FCC628065D765E30000 +D1 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000671E671F675E68CB68C46A5F6B3A6C236C7D6C826DC773987426742A7482 +74A37578757F788178EF794179477948797A7B957D007DBA7F888006802D808C +8A188B4F8C488D779321932498E299519A0E9A0F9A659E927DCA4F76540962EE +685491D155AB513AF90BF90C5A1C61E6F90D62CF62FFF90EF90FF910F911F912 +F91390A3F914F915F916F917F9188AFEF919F91AF91BF91C6696F91D7156F91E +F91F96E3F920634F637A5357F921678F69606E73F9227537F923F924F9250000 +D2 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00007D0DF926F927887256CA5A18F928F929F92AF92BF92C4E43F92D51675948 +67F08010F92E59735E74649A79CA5FF5606C62C8637B5BE75BD752AAF92F5974 +5F296012F930F931F9327459F933F934F935F936F937F93899D1F939F93AF93B +F93CF93DF93EF93FF940F941F942F9436FC3F944F94581BF8FB260F1F946F947 +8166F948F9495C3FF94AF94BF94CF94DF94EF94FF950F9515AE98A25677B7D10 +F952F953F954F955F956F95780FDF958F9595C3C6CE5533F6EBA591A83360000 +D3 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00004E394EB64F4655AE571858C75F5665B765E66A806BB56E4D77ED7AEF7C1E +7DDE86CB88929132935B64BB6FBE737A75B890545556574D61BA64D466C76DE1 +6E5B6F6D6FB975F0804381BD854189838AC78B5A931F6C9375537B548E0F905D +5510580258585E626207649E68E075767CD687B39EE84EE35788576E59275C0D +5CB15E365F85623464E173B381FA888B8CB8968A9EDB5B855FB760B350125200 +52305716583558575C0E5C605CF65D8B5EA65F9260BC63116389641768430000 +D4 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000068F96AC26DD86E216ED46FE471FE76DC777979B17A3B840489A98CED8DF3 +8E4890039014905390FD934D967697DC6BD27006725872A27368776379BF7BE4 +7E9B8B8058A960C7656665FD66BE6C8C711E71C98C5A98134E6D7A814EDD51AC +51CD52D5540C61A76771685068DF6D1E6F7C75BC77B37AE580F484639285515C +6597675C679375D87AC78373F95A8C469017982D5C6F81C0829A9041906F920D +5F975D9D6A5971C8767B7B4985E48B0491279A30558761F6F95B76697F850000 +D5 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000863F87BA88F8908FF95C6D1B70D973DE7D61843DF95D916A99F1F95E4E82 +53756B046B12703E721B862D9E1E524C8FA35D5064E5652C6B166FEB7C437E9C +85CD896489BD62C981D8881F5ECA67176D6A72FC7405746F878290DE4F865D0D +5FA0840A51B763A075654EAE5006516951C968816A117CAE7CB17CE7826F8AD2 +8F1B91CF4FB6513752F554425EEC616E623E65C56ADA6FFE792A85DC882395AD +9A629A6A9E979ECE529B66C66B77701D792B8F6297426190620065236F230000 +D6 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000714974897DF4806F84EE8F269023934A51BD521752A36D0C70C888C25EC9 +65826BAE6FC27C3E73754EE44F3656F9F95F5CBA5DBA601C73B27B2D7F9A7FCE +8046901E923496F6974898189F614F8B6FA779AE91B496B752DEF960648864C4 +6AD36F5E7018721076E780018606865C8DEF8F0597329B6F9DFA9E75788C797F +7DA083C993049E7F9E938AD658DF5F046727702774CF7C60807E512170287262 +78CA8CC28CDA8CF496F74E8650DA5BEE5ED6659971CE764277AD804A84FC0000 +D7 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000907C9B279F8D58D85A415C626A136DDA6F0F763B7D2F7E37851E893893E4 +964B528965D267F369B46D416E9C700F7409746075597624786B8B2C985E516D +622E96784F96502B5D196DEA7DB88F2A5F8B61446817F961968652D2808B51DC +51CC695E7A1C7DBE83F196754FDA52295398540F550E5C6560A7674E68A86D6C +728172F874067483F96275E27C6C7F797FB8838988CF88E191CC91D096E29BC9 +541D6F7E71D0749885FA8EAA96A39C579E9F67976DCB743381E89716782C0000 +D8 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00007ACB7B207C926469746A75F278BC78E899AC9B549EBB5BDE5E556F20819C +83AB90884E07534D5A295DD25F4E6162633D666966FC6EFF6F2B7063779E842C +8513883B8F1399459C3B551C62B9672B6CAB8309896A977A4EA159845FD85FD9 +671B7DB27F548292832B83BD8F1E909957CB59B95A925BD06627679A68856BCF +71647F758CB78CE390819B4581088C8A964C9A409EA55B5F6C13731B76F276DF +840C51AA8993514D519552C968C96C94770477207DBF7DEC97629EB56EC50000 +D9 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000851151A5540D547D660E669D69276E9F76BF7791831784C2879F91699298 +9CF488824FAE519252DF59C65E3D61556478647966AE67D06A216BCD6BDB725F +72617441773877DB801782BC83058B008B288C8C67286C90726776EE77667A46 +9DA96B7F6C92592267268499536F589359995EDF63CF663467736E3A732B7AD7 +82D7932852D95DEB61AE61CB620A62C764AB65E069596B666BCB712173F7755D +7E46821E8302856A8AA38CBF97279D6158A89ED85011520E543B554F65870000 +DA +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00006C767D0A7D0B805E868A958096EF52FF6C95726954735A9A5C3E5D4B5F4C +5FAE672A68B669636E3C6E4477097C737F8E85878B0E8FF797619EF45CB760B6 +610D61AB654F65FB65FC6C116CEF739F73C97DE195945BC6871C8B10525D535A +62CD640F64B267346A386CCA73C0749E7B947C957E1B818A823685848FEB96F9 +99C14F34534A53CD53DB62CC642C6500659169C36CEE6F5873ED7554762276E4 +76FC78D078FB792C7D46822C87E08FD4981298EF52C362D464A56E246F510000 +DB +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000767C8DCB91B192629AEE9B435023508D574A59A85C285E475F77623F653E +65B965C16609678B699C6EC278C57D2180AA8180822B82B384A1868C8A2A8B17 +90A696329F90500D4FF3F96357F95F9862DC6392676F6E43711976C380CC80DA +88F488F589198CE08F29914D966A4F2F4F705E1B67CF6822767D767E9B445E61 +6A0A716971D4756AF9647E41854385E998DC4F107B4F7F7095A551E15E0668B5 +6C3E6C4E6CDB72AF7BC483036CD5743A50FB528858C164D86A9774A776560000 +DC +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000078A7861795E29739F965535E5F018B8A8FA88FAF908A522577A59C499F08 +4E19500251755C5B5E77661E663A67C468C570B3750175C579C97ADD8F279920 +9A084FDD582158315BF6666E6B656D116E7A6F7D73E4752B83E988DC89138B5C +8F144F0F50D55310535C5B935FA9670D798F8179832F8514890789868F398F3B +99A59C12672C4E764FF859495C015CEF5CF0636768D270FD71A2742B7E2B84EC +8702902292D29CF34E0D4ED84FEF50855256526F5426549057E0592B5A660000 +DD +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00005B5A5B755BCC5E9CF9666276657765A76D6E6EA572367B267C3F7F368150 +8151819A8240829983A98A038CA08CE68CFB8D748DBA90E891DC961C964499D9 +9CE7531752065429567458B35954596E5FFF61A4626E66106C7E711A76C67C89 +7CDE7D1B82AC8CC196F0F9674F5B5F175F7F62C25D29670B68DA787C7E439D6C +4E1550995315532A535159835A625E8760B2618A624962796590678769A76BD4 +6BD66BD76BD86CB8F968743575FA7812789179D579D87C837DCB7FE180A50000 +DE +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000813E81C283F2871A88E88AB98B6C8CBB9119975E98DB9F3B56AC5B2A5F6C +658C6AB36BAF6D5C6FF17015725D73AD8CA78CD3983B61916C3780589A014E4D +4E8B4E9B4ED54F3A4F3C4F7F4FDF50FF53F253F8550655E356DB58EB59625A11 +5BEB5BFA5C045DF35E2B5F99601D6368659C65AF67F667FB68AD6B7B6C996CD7 +6E23700973457802793E7940796079C17BE97D177D728086820D838E84D186C7 +88DF8A508A5E8B1D8CDC8D668FAD90AA98FC99DF9E9D524AF9696714F96A0000 +DF +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00005098522A5C7165636C5573CA7523759D7B97849C917897304E7764926BBA +715E85A94E09F96B674968EE6E17829F8518886B63F76F81921298AF4E0A50B7 +50CF511F554655AA56175B405C195CE05E385E8A5EA05EC260F368516A616E58 +723D724072C076F879657BB17FD488F389F48A738C618CDE971C585E74BD8CFD +55C7F96C7A617D2282727272751F7525F96D7B19588558FB5DBC5E8F5EB65F90 +60556292637F654D669166D966F8681668F27280745E7B6E7D6E7DD67F720000 +E0 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000080E5821285AF897F8A93901D92E49ECD9F205915596D5E2D60DC66146673 +67906C506DC56F5F77F378A984C691CB932B4ED950CA514855845B0B5BA36247 +657E65CB6E32717D74017444748774BF766C79AA7DDA7E557FA8817A81B38239 +861A87EC8A758DE3907892919425994D9BAE53685C5169546CC46D296E2B820C +859B893B8A2D8AAA96EA9F67526166B96BB27E9687FE8D0D9583965D651D6D89 +71EEF96E57CE59D35BAC602760FA6210661F665F732973F976DB77017B6C0000 +E1 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00008056807281658AA091924E1652E26B726D177A057B397D30F96F8CB053EC +562F58515BB55C0F5C115DE2624063836414662D68B36CBC6D886EAF701F70A4 +71D27526758F758E76197B117BE07C2B7D207D39852C856D86078A34900D9061 +90B592B797F69A374FD75C6C675F6D917C9F7E8C8B168D16901F5B6B5DFD640D +84C0905C98E173875B8B609A677E6DDE8A1F8AA69001980C5237F9707051788E +9396887091D74FEE53D755FD56DA578258FD5AC25B885CAB5CC05E2561010000 +E2 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000620D624B6388641C653665786A396B8A6C346D196F3171E772E973787407 +74B27626776179C07A577AEA7CB97D8F7DAC7E617F9E81298331849084DA85EA +88968AB08B908F3890429083916C929692B9968B96A796A896D6970098089996 +9AD39B1A53D4587E59195B705BBF6DD16F5A719F742174B9808583FD5DE15F87 +5FAA604265EC6812696F6A536B896D356DF373E376FE77AC7B4D7D148123821C +834084F485638A628AC49187931E980699B4620C88538FF092655D075D270000 +E3 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00005D69745F819D87686FD562FE7FD2893689724E1E4E5850E752DD5347627F +66077E698805965E4F8D5319563659CB5AA45C385C4E5C4D5E025F11604365BD +662F664267BE67F4731C77E2793A7FC5849484CD89968A668A698AE18C558C7A +57F45BD45F0F606F62ED690D6B966E5C71847BD287558B588EFE98DF98FE4F38 +4F814FE1547B5A205BB8613C65B0666871FC7533795E7D33814E81E3839885AA +85CE87038A0A8EAB8F9BF9718FC559315BA45BE660895BE95C0B5FC36C810000 +E4 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000F9726DF1700B751A82AF8AF64EC05341F97396D96C0F4E9E4FC45152555E +5A255CE86211725982BD83AA86FE88598A1D963F96C599139D099D5D580A5CB3 +5DBD5E4460E1611563E16A026E2591029354984E9C109F775B895CB86309664F +6848773C96C1978D98549B9F65A18B018ECB95BC55355CA95DD65EB56697764C +83F495C758D362BC72CE9D284EF0592E600F663B6B8379E79D26539354C057C3 +5D16611B66D66DAF788D827E969897445384627C63966DB27E0A814B984D0000 +E5 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00006AFB7F4C9DAF9E1A4E5F503B51B6591C60F963F66930723A8036F97491CE +5F31F975F9767D0482E5846F84BB85E58E8DF9774F6FF978F97958E45B436059 +63DA6518656D6698F97A694A6A236D0B7001716C75D2760D79B37A70F97B7F8A +F97C8944F97D8B9391C0967DF97E990A57045FA165BC6F01760079A68A9E99AD +9B5A9F6C510461B662916A8D81C6504358305F6671098A008AFA5B7C86164FFA +513C56B4594463A96DF95DAA696D51864E884F59F97FF980F9815982F9820000 +E6 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000F9836B5F6C5DF98474B57916F9858207824583398F3F8F5DF9869918F987 +F988F9894EA6F98A57DF5F796613F98BF98C75AB7E798B6FF98D90069A5B56A5 +582759F85A1F5BB4F98E5EF6F98FF9906350633BF991693D6C876CBF6D8E6D93 +6DF56F14F99270DF71367159F99371C371D5F994784F786FF9957B757DE3F996 +7E2FF997884D8EDFF998F999F99A925BF99B9CF6F99CF99DF99E60856D85F99F +71B1F9A0F9A195B153ADF9A2F9A3F9A467D3F9A5708E71307430827682D20000 +E7 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000F9A695BB9AE59E7D66C4F9A771C18449F9A8F9A9584BF9AAF9AB5DB85F71 +F9AC6620668E697969AE6C386CF36E366F416FDA701B702F715071DF7370F9AD +745BF9AE74D476C87A4E7E93F9AFF9B082F18A608FCEF9B19348F9B29719F9B3 +F9B44E42502AF9B5520853E166F36C6D6FCA730A777F7A6282AE85DD8602F9B6 +88D48A638B7D8C6BF9B792B3F9B8971398104E944F0D4FC950B25348543E5433 +55DA586258BA59675A1B5BE4609FF9B961CA655665FF666468A76C5A6FB30000 +E8 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000070CF71AC73527B7D87088AA49C329F075C4B6C8373447389923A6EAB7465 +761F7A697E15860A514058C564C174EE751576707FC1909596CD99546E2674E6 +7AA97AAA81E586D987788A1B5A495B8C5B9B68A169006D6373A97413742C7897 +7DE97FEB81188155839E8C4C962E981166F05F8065FA67896C6A738B502D5A03 +6B6A77EE59165D6C5DCD7325754FF9BAF9BB50E551F9582F592D599659DA5BE5 +F9BCF9BD5DA262D76416649364FEF9BE66DCF9BF6A48F9C071FF7464F9C10000 +E9 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00007A887AAF7E477E5E80008170F9C287EF89818B209059F9C390809952617E +6B326D747E1F89258FB14FD150AD519752C757C758895BB95EB8614269956D8C +6E676EB6719474627528752C8073833884C98E0A939493DEF9C44E8E4F515076 +512A53C853CB53F35B875BD35C24611A618265F4725B7397744076C279507991 +79B97D067FBD828B85D5865E8FC2904790F591EA968596E896E952D65F6765ED +6631682F715C7A3690C1980A4E91F9C56A526B9E6F907189801882B885530000 +EA +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000904B969596F297FB851A9B314E90718A96C45143539F54E15713571257A3 +5A9B5AC45BC36028613F63F46C856D396E726E907230733F745782D188818F45 +9060F9C6966298589D1B67088D8A925E4F4D504950DE5371570D59D45A015C09 +617066906E2D7232744B7DEF80C3840E8466853F875F885B89188B02905597CB +9B4F4E734F915112516AF9C7552F55A95B7A5BA55E7C5E7D5EBE60A060DF6108 +610963C465386709F9C867D467DAF9C9696169626CB96D27F9CA6E38F9CB0000 +EB +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00006FE173367337F9CC745C7531F9CD7652F9CEF9CF7DAD81FE843888D58A98 +8ADB8AED8E308E42904A903E907A914991C9936EF9D0F9D15809F9D26BD38089 +80B2F9D3F9D45141596B5C39F9D5F9D66F6473A780E48D07F9D79217958FF9D8 +F9D9F9DAF9DB807F620E701C7D68878DF9DC57A0606961476BB78ABE928096B1 +4E59541F6DEB852D967097F398EE63D66CE3909151DD61C981BA9DF94F9D501A +51005B9C610F61FF64EC69056BC5759177E37FA98264858F87FB88638ABC0000 +EC +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00008B7091AB4E8C4EE54F0AF9DDF9DE593759E8F9DF5DF25F1B5F5B6021F9E0 +F9E1F9E2F9E3723E73E5F9E4757075CDF9E579FBF9E6800C8033808482E18351 +F9E7F9E88CBD8CB39087F9E9F9EA98F4990CF9EBF9EC703776CA7FCA7FCC7FFC +8B1A4EBA4EC152035370F9ED54BD56E059FB5BC55F155FCD6E6EF9EEF9EF7D6A +8335F9F086938A8DF9F1976D9777F9F2F9F34E004F5A4F7E58F965E56EA29038 +93B099B94EFB58EC598A59D96041F9F4F9F57A14F9F6834F8CC3516553440000 +ED +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000F9F7F9F8F9F94ECD52695B5582BF4ED4523A54A859C959FF5B505B575B5C +606361486ECB7099716E738674F775B578C17D2B800581EA8328851785C98AEE +8CC796CC4F5C52FA56BC65AB6628707C70B872357DBD828D914C96C09D725B71 +68E76B986F7A76DE5C9166AB6F5B7BB47C2A883696DC4E084ED75320583458BB +58EF596C5C075E335E845F35638C66B267566A1F6AA36B0C6F3F7246F9FA7350 +748B7AE07CA7817881DF81E7838A846C8523859485CF88DD8D1391AC95770000 +EE +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000969C518D54C957285BB0624D6750683D68936E3D6ED3707D7E2188C18CA1 +8F099F4B9F4E722D7B8F8ACD931A4F474F4E5132548059D05E9562B56775696E +6A176CAE6E1A72D9732A75BD7BB87D3582E783F9845785F78A5B8CAF8E879019 +90B896CE9F5F52E3540A5AE15BC2645865756EF472C4F9FB76847A4D7B1B7C4D +7E3E7FDF837B8B2B8CCA8D648DE18E5F8FEA8FF9906993D14F434F7A50B35168 +5178524D526A5861587C59605C085C555EDB609B623068136BBF6C086FB10000 +EF +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000714E742075307538755176727B4C7B8B7BAD7BC67E8F8A6E8F3E8F49923F +92939322942B96FB985A986B991E5207622A62986D5976647ACA7BC07D765360 +5CBE5E976F3870B97C9897119B8E9EDE63A5647A87764E014E954EAD505C5075 +544859C35B9A5E405EAD5EF75F8160C5633A653F657465CC6676667867FE6968 +6A896B636C406DC06DE86E1F6E5E701E70A1738E73FD753A775B7887798E7A0B +7A7D7CBE7D8E82478A028AEA8C9E912D914A91D8926692CC9320970697560000 +F0 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000975C98029F0E52365291557C58245E1D5F1F608C63D068AF6FDF796D7B2C +81CD85BA88FD8AF88E44918D9664969B973D984C9F4A4FCE514651CB52A95632 +5F145F6B63AA64CD65E9664166FA66F9671D689D68D769FD6F156F6E716771E5 +722A74AA773A7956795A79DF7A207A957C977CDF7D447E70808785FB86A48A54 +8ABF8D998E819020906D91E3963B96D59CE565CF7C078DB393C35B585C0A5352 +62D9731D50275B975F9E60B0616B68D56DD9742E7A2E7D427D9C7E31816B0000 +F1 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00008E2A8E35937E94184F5057505DE65EA7632B7F6A4E3B4F4F4F8F505A59DD +80C4546A546855FE594F5B995DDE5EDA665D673167F1682A6CE86D326E4A6F8D +70B773E075877C4C7D027D2C7DA2821F86DB8A3B8A858D708E8A8F339031914E +9152944499D07AF97CA54FCA510151C657C85BEF5CFB66596A3D6D5A6E966FEC +710C756F7AE388229021907596CB99FF83014E2D4EF2884691CD537D6ADB696B +6C41847A589E618E66FE62EF70DD751175C77E5284B88B498D084E4B53EA0000 +F2 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000054AB573057405FD763016307646F652F65E8667A679D67B36B626C606C9A +6F2C77E57825794979577D1980A2810281F3829D82B787188A8CF9FC8D048DBE +907276F47A197A377E548077550755D45875632F64226649664B686D699B6B84 +6D256EB173CD746874A1755B75B976E1771E778B79E67E097E1D81FB852F8897 +8A3A8CD18EEB8FB0903293AD9663967397074F8453F159EA5AC95E19684E74C6 +75BE79E97A9281A386ED8CEA8DCC8FED659F6715F9FD57F76F577DDD8F2F0000 +F3 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000093F696C65FB561F26F844E144F98501F53C955DF5D6F5DEE6B216B6478CB +7B9AF9FE8E498ECA906E6349643E77407A84932F947F9F6A64B06FAF71E674A8 +74DA7AC47C127E827CB27E988B9A8D0A947D9910994C52395BDF64E6672D7D2E +50ED53C358796158615961FA65AC7AD98B928B9650095021527555315A3C5EE0 +5F706134655E660C663666A269CD6EC46F32731676217A938139825983D684BC +50B557F05BC05BE85F6963A178267DB583DC852191C791F5518A67F57B560000 +F4 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00008CAC51C459BB60BD8655501CF9FF52545C3A617D621A62D364F265A56ECC +7620810A8E60965F96BB4EDF5343559859295DDD64C56CC96DFA73947A7F821B +85A68CE48E10907791E795E1962197C651F854F255865FB964A46F887DB48F1F +8F4D943550C95C166CBE6DFB751B77BB7C3D7C648A798AC2581E59BE5E166377 +7252758A776B8ADC8CBC8F125EF366746DF8807D83C18ACB97519BD6FA005243 +66FF6D956EEF7DE08AE6902E905E9AD4521D527F54E86194628462DB68A20000 +F5 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00006912695A6A3570927126785D7901790E79D27A0D8096827882D583498549 +8C828D859162918B91AE4FC356D171ED77D7870089F85BF85FD6675190A853E2 +585A5BF560A4618164607E3D80708525928364AE50AC5D146700589C62BD63A8 +690E69786A1E6E6B76BA79CB82BB84298ACF8DA88FFD9112914B919C93109318 +939A96DB9A369C0D4E11755C795D7AFA7B517BC97E2E84C48E598E748EF89010 +6625693F744351FA672E9EDC51455FE06C9687F2885D887760B481B584030000 +F6 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00008D0553D6543956345A365C31708A7FE0805A810681ED8DA391899A5F9DF2 +50744EC453A060FB6E2C5C644F88502455E45CD95E5F606568946CBB6DC471BE +75D475F476617A1A7A497DC77DFB7F6E81F486A98F1C96C999B39F52524752C5 +98ED89AA4E0367D26F064FB55BE267956C886D78741B782791DD937C87C479E4 +7A315FEB4ED654A4553E58AE59A560F0625362D6673669558235964099B199DD +502C53535544577CFA016258FA0264E2666B67DD6FC16FEF742274388A170000 +F7 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000094385451560657665F48619A6B4E705870AD7DBB8A95596A812B63A27708 +803D8CAA5854642D69BB5B955E116E6FFA038569514C53F0592A6020614B6B86 +6C706CF07B1E80CE82D48DC690B098B1FA0464C76FA464916504514E5410571F +8A0E615F6876FA0575DB7B527D71901A580669CC817F892A9000983950785957 +59AC6295900F9B2A615D727995D657615A465DF4628A64AD64FA67776CE26D3E +722C743678347F7782AD8DDB981752245742677F724874E38CA98FA692110000 +F8 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000962A516B53ED634C4F695504609665576C9B6D7F724C72FD7A1789878C9D +5F6D6F8E70F981A8610E4FBF504F624172477BC77DE87FE9904D97AD9A198CB6 +576A5E7367B0840D8A5554205B165E635EE25F0A658380BA853D9589965B4F48 +5305530D530F548654FA57035E036016629B62B16355FA066CE16D6675B17832 +80DE812F82DE846184B2888D8912900B92EA98FD9B915E4566B466DD70117206 +FA074FF5527D5F6A615367536A196F0274E2796888688C7998C798C49A430000 +F9 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000054C17A1F69538AF78C4A98A899AE5F7C62AB75B276AE88AB907F96425339 +5F3C5FC56CCC73CC7562758B7B4682FE999D4E4F903C4E0B4F5553A6590F5EC8 +66306CB37455837787668CC09050971E9C1558D15B7886508B149DB45BD26068 +608D65F16C576F226FA3701A7F557FF095919592965097D352728F4451FD542B +54B85563558A6ABB6DB57DD88266929C96779E79540854C876D286E495A495D4 +965C4EA24F0959EE5AE65DF760526297676D68416C866E2F7F38809B822A0000 +FA +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000FA08FA0998054EA5505554B35793595A5B695BB361C869776D77702387F9 +89E38A728AE7908299ED9AB852BE683850165E78674F8347884C4EAB541156AE +73E6911597FF9909995799995653589F865B8A3161B26AF6737B8ED26B4796AA +9A57595572008D6B97694FD45CF45F2661F8665B6CEB70AB738473B973FE7729 +774D7D437D627E2382378852FA0A8CE29249986F5B517A74884098015ACC4FE0 +5354593E5CFD633E6D7972F98105810783A292CF98304EA851445211578B0000 +FB +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00005F626CC26ECE7005705070AF719273E97469834A87A28861900890A293A3 +99A8516E5F5760E0616766B385598E4A91AF978B4E4E4E92547C58D558FA597D +5CB55F2762366248660A66676BEB6D696DCF6E566EF86F946FE06FE9705D72D0 +7425745A74E07693795C7CCA7E1E80E182A6846B84BF864E865F87748B778C6A +93AC9800986560D1621691775A5A660F6DF76E3E743F9B425FFD60DA7B0F54C4 +5F186C5E6CD36D2A70D87D0586798A0C9D3B5316548C5B056A3A706B75750000 +FC +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000798D79BE82B183EF8A718B418CA89774FA0B64F4652B78BA78BB7A6B4E38 +559A59505BA65E7B60A363DB6B61666568536E19716574B07D0890849A699C25 +6D3B6ED1733E8C4195CA51F05E4C5FA8604D60F66130614C6643664469A56CC1 +6E5F6EC96F62714C749C76877BC17C27835287579051968D9EC3532F56DE5EFB +5F8A6062609461F7666667036A9C6DEE6FAE7070736A7E6A81BE833486D48AA8 +8CC4528373725B966A6B940454EE56865B5D6548658566C9689F6D8D6DC60000 +FD +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000723B80B491759A4D4FAF5019539A540E543C558955C55E3F5F8C673D7166 +73DD900552DB52F3586458CE7104718F71FB85B08A13668885A855A76684714A +8431534955996BC15F595FBD63EE668971478AF18F1D9EBE4F11643A70CB7566 +866760648B4E9DF8514751F653086D3680F89ED166156B23709875D554035C79 +7D078A166B206B3D6B46543860706D3D7FD5820850D651DE559C566B56CD59EC +5B095E0C619961986231665E66E6719971B971BA72A779A77A007FB28A700000 diff --git a/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/gb12345.enc b/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/gb12345.enc new file mode 100644 index 0000000000000000000000000000000000000000..3f3f4d254586a07e90d26155dda61b886029fbc4 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/gb12345.enc @@ -0,0 +1,1414 @@ +# Encoding file: gb12345, double-byte +D +233F 0 83 +21 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000030003001300230FB02C902C700A8300330052015FF5E2225202620182019 +201C201D3014301530083009300A300B300C300D300E300F3016301730103011 +00B100D700F72236222722282211220F222A222922082237221A22A522252220 +23122299222B222E2261224C2248223D221D2260226E226F22642265221E2235 +22342642264000B0203220332103FF0400A4FFE0FFE1203000A7211626062605 +25CB25CF25CE25C725C625A125A025B325B2203B219221902191219330130000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +22 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000024882489248A248B248C248D248E248F2490249124922493249424952496 +249724982499249A249B247424752476247724782479247A247B247C247D247E +247F248024812482248324842485248624872460246124622463246424652466 +2467246824690000000032203221322232233224322532263227322832290000 +00002160216121622163216421652166216721682169216A216B000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +23 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000FF01FF02FF03FFE5FF05FF06FF07FF08FF09FF0AFF0BFF0CFF0DFF0EFF0F +FF10FF11FF12FF13FF14FF15FF16FF17FF18FF19FF1AFF1BFF1CFF1DFF1EFF1F +FF20FF21FF22FF23FF24FF25FF26FF27FF28FF29FF2AFF2BFF2CFF2DFF2EFF2F +FF30FF31FF32FF33FF34FF35FF36FF37FF38FF39FF3AFF3BFF3CFF3DFF3EFF3F +FF40FF41FF42FF43FF44FF45FF46FF47FF48FF49FF4AFF4BFF4CFF4DFF4EFF4F +FF50FF51FF52FF53FF54FF55FF56FF57FF58FF59FF5AFF5BFF5CFF5DFFE30000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +24 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000304130423043304430453046304730483049304A304B304C304D304E304F +3050305130523053305430553056305730583059305A305B305C305D305E305F +3060306130623063306430653066306730683069306A306B306C306D306E306F +3070307130723073307430753076307730783079307A307B307C307D307E307F +3080308130823083308430853086308730883089308A308B308C308D308E308F +3090309130923093000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +25 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000030A130A230A330A430A530A630A730A830A930AA30AB30AC30AD30AE30AF +30B030B130B230B330B430B530B630B730B830B930BA30BB30BC30BD30BE30BF +30C030C130C230C330C430C530C630C730C830C930CA30CB30CC30CD30CE30CF +30D030D130D230D330D430D530D630D730D830D930DA30DB30DC30DD30DE30DF +30E030E130E230E330E430E530E630E730E830E930EA30EB30EC30ED30EE30EF +30F030F130F230F330F430F530F6000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +26 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000039103920393039403950396039703980399039A039B039C039D039E039F +03A003A103A303A403A503A603A703A803A90000000000000000000000000000 +000003B103B203B303B403B503B603B703B803B903BA03BB03BC03BD03BE03BF +03C003C103C303C403C503C603C703C803C90000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +27 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000004100411041204130414041504010416041704180419041A041B041C041D +041E041F0420042104220423042404250426042704280429042A042B042C042D +042E042F00000000000000000000000000000000000000000000000000000000 +000004300431043204330434043504510436043704380439043A043B043C043D +043E043F0440044104420443044404450446044704480449044A044B044C044D +044E044F00000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +28 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000010100E101CE00E0011300E9011B00E8012B00ED01D000EC014D00F301D2 +00F2016B00FA01D400F901D601D801DA01DC00FC00EA00000000000000000000 +0000000000000000000031053106310731083109310A310B310C310D310E310F +3110311131123113311431153116311731183119311A311B311C311D311E311F +3120312131223123312431253126312731283129000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +29 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00000000000000002500250125022503250425052506250725082509250A250B +250C250D250E250F2510251125122513251425152516251725182519251A251B +251C251D251E251F2520252125222523252425252526252725282529252A252B +252C252D252E252F2530253125322533253425352536253725382539253A253B +253C253D253E253F2540254125422543254425452546254725482549254A254B +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +30 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000554A963F57C3632854CE550954C0769A764C85F977EE827E7919611B9698 +978D6C285B894FFA630966975CB880FA68489AAF660276CE51F9655671AC7FF1 +895650B2596561CA6FB382AD634C625253ED54277B06516B75A45DF462D48DCB +9776628A801958E997387F777238767D67CF767E64FA4F70655762DC7A176591 +73ED642C6273822C9812677F7248626E62CC4F3474E3534A8FA67D4690A65E6B +6886699C81807D8168D278C5868C938A508D8B1782DE80DE5305891252650000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +31 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000858496F94FDD582198FD5BF662B1583166B48C799B917206676F789160B2 +535153178F2980CC8C9D92C7500D72FD5099618A711988AB595482EF672C7B28 +5D297DB3752D6CF58E668FF8903C9F3B6BD491197B465F7C78A784D6853D7562 +65836BD65E635E8775F99589655D5F0A5FC58F9F58C181C2907F965B97AD908A +7DE88CB662414FBF8B8A535E8FA88FAF8FAE904D6A195F6A819888689C49618B +522B765F5F6C658C70156FF18CD364EF517551B067C44E1979C9990570B30000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +32 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000075C55E7673BB83E064AD64A592626CE2535A52C3640F92517B944F2F5E1B +82368116818A6E246CCA99C16355535C54FA88DC57E04E0D5E036B657C3F90E8 +601664E6731C88C16750624D8CA1776C8E2991C75F6983DC8521991053C38836 +6B98615A615871E684BC825950096EC485CF64CD7CD969FD66F9834953A07B56 +5074518C6E2C5C648E6D63D253C9832C833667E578B4643D5BDF5C945DEE8A6B +62C667F48C7A6519647B87EC995E8B927E8F93DF752395E1986B660C73160000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +33 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000583456175E389577511F81785EE0655E66A2553150218D8562849214671D +56326F6E5DE2543570928ECA626F64A463A35FB96F8890F481E38FB058756668 +5FF16C8996738D81896F64917A3157CE6A59621054484E587A0B61F26F848AA0 +627F901E9A0179E4540375F4630153196C6090725F1B99B3803B9F524F885C3A +8D647FC565A571BE5145885D87F25D075BF562BD916C75878E8A7A2061017C4C +4EC77DA27785919C81ED521D51FA6A7153A88E8792E496DB6EC19664695A0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +34 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000790E513277D7641089F8865563E35DDD7A7F693D50B3823955984E327621 +7A975E625E8A95D652755439708A6376931857826625693F918755076DF37D14 +882262337DBD75B5832878C196CC8FAD614874F78A5E6B64523A8CDC6B218070 +847156F153065F9E53E251D17C97918B7C074FC38EA57BE17AC464675D1450AC +810676017CB96DEC7FE067515B585BF878CB64AE641363AA632B932F642D9054 +7B5476296253592754466B7950A362345E366B864EE38CB8888B5F85902E0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +35 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00006020803D64D44E3955AE913264A381BD65E66C2E4F46619A6DE18A955F48 +86CB757664CB9EE885696A94520064178E4850125CF679B15C0E52307A3B60BC +905376D75FB75F9776848E6C71C8767B7B4977AA51F3912758244F4E6EF48FEA +65757B1B72C46ECC7FDF5AE162B55E95573084827B2C5E1D5F1F905E7DE0985B +63826EC778989EDE5178975B588A96FB4F4375385E9760E659606FB16BBF7889 +53FC96D551CB52016389540A91E38ABF8DCC7239789F87768FED8ADC758A0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +36 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00004E0176EF53EE91D898029F0E93205B9A8A024E22677151AC846361C252D5 +68DF4F97606B51CD6D1E515C62969B2596618C46901775D890FD77636BD272A2 +73688B80583577798CED675C934D809A5EA66E2159927AEF77ED935B6BB565B7 +7DDE58065151968A5C0D58A956788E726566981356E4920D76FE9041638754C6 +591A596A579B8EB267358DFA8235524160F058AE86FE5CE89D5D4FC4984D8A1B +5A2560E15384627C904F910299136069800C51528033723E990C6D314E8C0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +37 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00008CB3767C7F707B4F4F104E4F95A56CD573D085E95E06756A7FFB6A0A792C +91E97E4151E1716953CD8FD47BC48CA972AF98EF6CDB574A82B365B980AA623F +963259A84EFF8A2A7D21653E83F2975E556198DB80A5532A8AB9542080BA5EE2 +6CB88CBB82AC915A54296C1B52067D1B58B3711A6C7E7C89596E4EFD5FFF61A4 +7CDE8C505C01695387025CF092D298A8760B70FD902299AE7E2B8AF759499CF3 +4F5B5426592B6577819A5B75627662C28F3B5E456C1F7B264F0F4FD8670D0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +38 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00006D6E6DAA798F88B15F17752B64AB8F144FEF91DC65A7812F81515E9C8150 +8D74526F89868CE65FA950854ED8961C723681798CA05BCC8A0396445A667E1B +54905676560E8A7265396982922384CB6E895E797518674667D17AFF809D8D95 +611F79C665628D1B5CA1525B92FC7F38809B7DB15D176E2F67607BD9768B9AD8 +818F7F947CD5641E93AC7A3F544A54E56B4C64F162089D3F80F3759952729769 +845B683C86E495A39694927B500B54047D6668398DDF801566F45E9A7FB90000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +39 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000057C2803F68975DE5653B529F606D9F944F9B8EAC516C5BAB5F13978F6C5E +62F18CA25171920E52FE6E9D82DF72D757A269CB8CFC591F8F9C83C754957B8D +4F306CBD5B6459D19F1353E488319AA88C3780A16545986756FA96C7522E74DC +526E5BE1630289024E5662D0602A68FA95DC5B9851A089C07BA199287F506163 +704C8CAB51495EE3901B7470898F572D78456B789F9C95A88ECC9B3C8A6D7678 +68426AC38DEA8CB4528A8F256EDA68CD934B90ED570B679C88F9904E54C80000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +3A +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00009AB85B696D776C264EA55BB399ED916361A890AF97D3542B6DB55BD251FD +558A7F557FF064BC634D65F161BE608D710A6C576F22592F676D822A58D5568E +8C6A6BEB90DD597D8017865F6D695475559D837783CF683879BE548C4F555408 +76D28C8995A16CB36DB88D6B89109DB48CC0563F9ED175D55F8872E0606854FC +4EA86A2A886160528F5F54C470D886799D3B6D2A5B8F5F187D0555894FAF7334 +543C539A50195F8C547C4E4E5FFD745A58FA846B80E1877472D07CCA6E560000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +3B +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00005F27864E552C8B774E926EEC623782B1562983EF733E6ED1756B52835316 +8A7169D05F8A61F76DEE58DE6B6174B0685390847DE963DB60A3559A76138C62 +71656E195BA65E7B8352614C9EC478FA87577C27768751F060F6714C66435E4C +604D8B0A707063EE8F1D5FBD606286D456DE6BC160946167534960E066668CC4 +7A62670371F4532F8AF18AA87E6A8477660F5A5A9B426E3E6DF78C416D3B4F19 +706B7372621660D1970D8CA8798D64CA573E57FA6A5F75787A3D7A4D7B950000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +3C +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000808C99518FF96FC08B4F9DC459EC7E3E7DDD5409697568D88F2F7C4D96C6 +53CA602575BE6C7253735AC97D1A64E05E7E810A5DF1858A628051805B634F0E +796D529160B86FDF5BC45BC28A088A1865E25FCC969B59937E7C7D00560967B7 +593E4F735BB652A083A298308CC87532924050477A3C50F967B699D55AC16BB2 +76E358055C167B8B9593714E517C80A9827159787DD87E6D6AA267EC78B19E7C +63C064BF7C215109526A51CF85A66ABB94528E108CE4898B93757BAD4EF60000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +3D +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000050658266528D991E6F386FFA6F975EFA50F559DC5C076F3F6C5F75868523 +69F3596C8B1B532091AC964D854969127901712681A04EA490CA6F869A555B0C +56BC652A927877EF50E5811A72E189D299037E737D5E527F655991758F4E8F03 +53EB7A9663ED63A5768679F88857968E622A52AB7BC0685467706377776B7AED +6F547D5089E359D0621285C982A5754C501F4ECB75A58AA15C4A5DFE7B4B65A4 +91D14ECA6D25895F7DCA932650C58B3990329773664979818FD171FC6D780000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +3E +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000076E152C1834651628396775B66769BE84EAC9A5A7CBE7CB37D934E958B66 +666F9838975C5883656C93E15F9175D997567ADF7AF651C870AF7A9863EA7A76 +7CFE739697ED4E4570784E5D915253A96551820A81FC8205548E5C31759A97A0 +62D872D975BD5C4599D283CA5C40548077E982096CAE805A62D264DA5DE85177 +8DDD8E1E92F84FF153E561FC70AC528763509D515A1F5026773753777D796485 +652B628963985014723589BA51B38A237D76574783CC921E8ECD541B5CFB0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +3F +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00004FCA7AE36D5A90E199FF55805496536154AF958B63E9697751F16168520A +582A52D8574E780D770B5EB761777CE0625B62974EA27095800362F770E49760 +577782DB67EF68F578D5984679D16BBB54B353EF6E34514B523B5BA28AB280AF +554358BE61C75751542D7A7A60505B5463A7647353E362635BC767AF54ED7A9F +82E691775EAB89328A8757AE630E8DE880EF584A7B7751085FEB5BEC6B3E5321 +7B5072C268467926773666E051B5866776D45DCB7ABA8475594E9B4150800000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +40 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000994B61276F7057646606634656F062EC64F45ED395CA578362C95587881F +81D88FA35566840A4F868CF485CD5A6A6B0465147C4395CC862D703E8B95652C +89BD61F67E9C721B6FEB7405699472FC5ECA90CE67176D6A648852DE72628001 +4F6C59E5916A70D96F8752D26A0296F79433857E78CA7D2F512158D864C2808B +985E6CEA68F1695E51B7539868A872819ECE7C6C72F896E270557406674E88CF +9BC979AE83898354540F68179E9753B252F5792B6B77522950884F8B4FD00000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +41 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000075E27ACB7C92701D96B8529B748354E95006806F84EE9023942E5EC96190 +6F237C3E658281C993C8620071497DF47CE751C968817CB1826F51698F1B91CF +667E4EAE8AD264A9804A50DA764271CE5BE5907C6F664E86648294105ED66599 +521788C270C852A373757433679778F7971681E891309C576DCB51DB8CC3541D +62CE73B283F196F69F6192344F367F9A51CC974896755DBA981853E64EE46E9C +740969B4786B993E7559528976246D4167F3516D9F8D807E56A87C607ABF0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +42 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000968658DF650F96B46A135A41645F7C0D6F0F964B860676E798715EEC7210 +64C46EF7865C9B6F9E93788C97328DEF8CC29E7F6F5E798493329678622E9A62 +541592C14FA365C55C655C627E37616E6C2F5F8B73876FFE7DD15DD265235B7F +706453754E8263A0756563848F2A502B4F966DEA7DB88AD6863F87BA7F85908F +947C7C6E9A3E88F8843D6D1B99F17D615ABD9EBB746A78BC879E99AC99E1561B +55CE57CB8CB79EA58CE390818109779E9945883B6EFF851366FC61626F2B0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +43 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00008B3E8292832B76F26C135FD983BD732B830593286BDB77DB925A536F8302 +51925E3D8C8C8CBF9EBD73AB679A68859176970971646CA177095A9293826BCF +7F8E66275BD059B95A9A958060B65011840C84996AAC76DF9333731B59225B5F +772F919A97617CDC8FF78B0E5F4C7C7379D889936CCC871C5BC65E4268C97720 +7DBF5195514D52C95A297DEC976282D763CF778485D079D26E3A5EDF59998511 +6EC56C1162BF76BF654F61AB95A9660E879F9CF49298540D547D8B2C64780000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +44 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000647986116A21819C78E864699B5462B9672B83AB58A89ED86CAB6F205BDE +964C8B00725F67D062C77261755D59C66BCD589366AE5E5552DF6155672876EE +776672677A4662FF54EA5450920990A35A1C7D0D6C164E435976801059485357 +753796E356CA6493816660F19B276DD65462991251855AE980FD59AE9713502A +6CE55C3C64EC4F60533F81A990066EBA852B62C85E7478BE6506637B5FF55A18 +91C09CE55C3F634F80765B7D5699947793B36D8560A86AB8737051DD5BE70000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +45 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000064F06FD8725B626D92157D1081BF6FC38FB25F04597452AA601259736696 +86507627632A61E67CEF8AFE54E66B509DD76BC685D5561450766F1A556A8DB4 +722C5E156015743662CD6392724C5F986E436D3E65006F5876E478D076FC7554 +522453DB4E539F9065C1802A80D6629B5486522870AE888D8DD16CE1547880DA +57F988F48CE0966A914D4F696C9B567476C6783062A870F96F8E5F6D84EC68DA +787C7BF781A8670B9D6C636778B0576F78129739627962AB528874356BD70000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +46 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00005564813E75B276AE533975DE50FB5C418B6C7BC7504F72479A1998C46F02 +74E27968648777A562FC983B8CA754C180584E52576A860B840D5E73619174F6 +8A555C4F57616F5198175A4678349B448FEB7C95525664B292EA50D583868461 +83E984B257D46A385703666E6D668B5C66DD7011671F6B3A68F2621A59BB4E03 +51C46F0667D26C8F517668CB59476B6775665D0E81CD9F4A65D7794879419A0E +8D778C484E5E4F0155535951780C56686C238FC468C46C7D6CE38A1663900000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +47 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000060706D3D727D626691FA925B534390777C3D4EDF8B194E7E9ED493229257 +524D6F5B90636DFA8B7458795D4C6B206B4969CD55C681547F8C58BB85945F3A +64366A47936C657260846A4B77A755AC50D15DE7979864AC7FF95CED4FCF7AC5 +520783044E14602F7ACA6B3D4FB589AA79E6743452E482B964D279BD5BE26C81 +97528F156C2B50BE537F6E0564CE66746C3060C598038ACB617674CA7AAE79CB +4E1890B174036C4256DA914B6CC58DA8534086C666F28EC05C489A456E200000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +48 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000053D65A369F728DA353BB570898746B0A919B6CC9516875CA62F372AC5238 +52F87F3A7094763853749D7269B778BA96C088D97FA4713671C3518967D374E4 +58E4651856B78B93995264FE7E5E60F971B158EC4EC14EBA5FCD97CC4EFB8A8D +5203598A7D0962544ECD65E5620E833884C969AE878D71946EB65BB97D685197 +63C967D480898339881551125B7A59828FB14E736C5D516589258EDF962E854A +745E92ED958F6F6482E55F316492705185A9816E9C13585E8CFD4E0953C10000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +49 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000050986563685155D355AA64149A3763835AC2745F82726F8068EE50E7838E +78026BBA52396C997D1750BB5565715E7BE966EC73CA82EB67495C715220717D +886B9583965D64C58D0D81B355846C5562477E55589250B755468CDE664C4E0A +5C1A88F368A2634E7A0D71D2828D52FA97F65C1154E890B57D3959628CD286C7 +820C63688D66651D5C0461FE6D89793E8A2D78377533547B4F388EAB6DF15A20 +7D33795E6C885BE95B38751A814E614E6EF28072751F7525727253477E690000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +4A +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000770176DB526952DD80565E2B5931734565BD6FD58A695C388671534177F3 +62FE66424EC098DF87555BE68B5853F277E24F7F5C4E99DB59CB5F0F793A58EB +4E1667FF4E8B62ED8A93901D52E2662F55DC566C90694ED54F8D91CB98FE6C0F +5E0260435BA489968A666536624B99965B8858FD6388552E53D776267378852C +6A1E68B36B8A62928F3853D482126DD1758F66F88D165B70719F85AF669166D9 +7F7287009ECD9F205C6C88538FF06A39675F620D7AEA58855EB665786F310000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +4B +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000060555237800D6454887075295E25681362F4971C96D9723D8AB06C347761 +7A0E542E77AC9806821C8AAC78A96714720D65AF64955636601D79C153F87D72 +6B7B80865BFA55E356DB4F3A4F3C98FC5DF39B068073616B980C90015B8B8A1F +8AA6641C825864FB55FD860791654FD77D20901F7C9F50F358516EAF5BBF8A34 +80859178849C7B9796D6968B96A87D8F9AD3788E6B727A57904296A7795F5B6B +640D7B0B84D168AD55067E2E74637D2293966240584C4ED65B83597958540000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +4C +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000737A64BB8E4B8E0F80CE82D462AC81FA6CF0915E592A614B6C70574D6524 +8CAA7671705858C76A8075F06F6D8B5A8AC757666BEF889278B363A2560670AD +6E6F5858642A580268E0819B55107CD650188EBA6DCC8D9F71D9638F6FE46ED4 +7E278404684390036DD896768A0E5957727985E49A3075BC8B0468AF52548E22 +92BB63D0984C8E44557C9AD466FF568F60D56D9552435C4959296DFB586B7530 +751C606C821481466311689D8FE2773A8DF38CBC94355E165EF3807D70F40000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +4D +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00006C405EF7505C4EAD5EAD633A8247901A6850916E77B3540C92855F647AE5 +687663457B527D7175DB50776295982D900F51F879C37A8157165F9290145857 +5C60571F541051546E4D571863A8983D817F8715892A9000541E5C6F81C062D6 +625881319D15964099B199DD6A6259A562D3553E631654C786D97AAA5A0374E6 +896A6B6A59168C4C5F4E706373A998114E3870F75B8C7897633D665A769660CB +5B9B5A49842C81556C6A738B4EA167897DB25F8065FA671B5FD859845A010000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +4E +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00005DCD5FAE537197CB90556845570D552F60DF72326FF07DAD8466840E59D4 +504950DE5C3E7DEF672A851A5473754F80C355829B4F4F4D6E2D8B025C096170 +885B761F6E29868A6587805E7D0B543B7A697D0A554F55E17FC174EE64BE8778 +6E267AA9621165A1536763E16C835DEB55DA93A270CF6C618AA35C4B7121856A +68A7543E54346BCB6B664E9463425348821E4F0D4FAE5862620A972766647269 +52FF52D9609F8AA4661471996790897F785277FD6670563B5438932B72A70000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +4F +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00007A00606F5E0C6089819D591560DC718470EF6EAA6C5072806A8489725E2D +7FD25AB3559C92916D177CFB969962327D30778E87665323971E8F4466875CFD +4FE072F94E0B53A6590F56876380934151484ED99BAE7E9654B88CE2929C8237 +95916D8E5F265ACC986F96AA73FE737B7E23817A99217FA161B2967796507DAB +76F853A2947299997BB189446E5891097FD479658A7360F397FF4EAB98055DF7 +6A6150CF54118C61856D785D9704524A54EE56C292B76D885BB56DC666C90000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +50 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00005C0F5B5D68218096562F7B11654869544E9B6B47874E978B5354633E643A +90AA659C81058AE75BEB68B0537887F961C86CC470098B1D5C5185AA82AF92C5 +6B238F9B65B05FFB5FC34FE191C1661F8165732960FA82085211578B5F6290A2 +884C91925E78674F602759D3514451F680F853086C7996C4718A4F114FEE7F9E +673D55C592B979C088967D89589F620C9700865A561898085F908A3184C49157 +53D965ED5E8F755C60647D6E5A7F7DD27E8C8ED255A75BA361F865CB73840000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +51 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00009078766C77297D629774859B5B787A7496EA884052DB718F5FAA65EC8A62 +5C0B99B45DE16B896C5B8A138A0A905C8FC558D362BC9D099D2854404E2B82BD +7259869C5D1688596DAF96C5555E4E9E8A1D710954BD95B970DF6DF99E7D56B4 +781487125CA95EF68A00985495BB708E6CBF594463A9773C884D6F1482775830 +71D553AD786F96C155015F6671305BB48AFA9A576B83592E9D2679E7694A63DA +4F6F760D7F8A6D0B967D6C274EF07662990A6A236F3E90808170599674760000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +52 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00006447582F90657A918B2159DA54AC820085E5898180006930564E8036723A +91CE51B64E5F98016396696D844966F3814B591C6DB24E0058F991AB63D692A5 +4F9D4F0A886398245937907A79FB510080F075916C825B9C59E85F5D690587FB +501A5DF24E5977E34EE585DD6291661390915C7951045F7981C69038808475AB +4EA688D4610F6BC561B67FA976CA6EA28A638B708ABC8B6F5F027FFC7FCC7E79 +8335852D56E06BB797F3967059FB541F92806DEB5BC598F25C395F1596B10000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +53 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000537082F16AFB5B309DF961C97E93746987A271DF719288058FCE8D0F76C8 +5F717A4E786C662055B264C150AD81C376705EB896CD8E3486F9548F6CF36D8C +6C38607F52C775285E7D512A60A061825C24753190F5923E73366CB96E389149 +670953CB53F34F5191C98A9853C85E7C8FC26DE44E8E76C26986865E611A8F3F +99184FDE903E9B5A61096E1D6F0196854E885A3196E882075DBC79B95B878A9E +7FBD738957DF828B9B315401904755BB5CEA5FA161086B32734480B28B7D0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +54 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00006D745BD388D598108C6B99AD9D1B6DF551A4514357A38881539F63F48F45 +571254E15713733F6E907DE3906082D198586028966266F07D048D8A8E8D9470 +5CB37CA4670860A695B2801896F29116530096955141904B85F49196668897F5 +5B55531D783896DC683D54C9707E5BB08F09518D572854B1652266AB8D0A8D1C +81DF846C906D7CDF947F85FB68D765E96FA186A48E81566A902076827AC871E5 +8CAC64C752476FA48CCA600E589E618E66FE8D08624E55B36E23672D8ECB0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +55 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000935895987728680569A8548B4E4D70B88A5064589F4B5B857A8450B55BE8 +77BB6C088A797C986CBE76DE65AC8F3E5D845C55863868E7536062307AD96E5B +7DBB6A1F7AE05F706F335F35638C6F3267564E085E338CEC4ED781397634969C +62DB662D627E6CBC8D9971677F695146808753EC906E629854F287C48F4D8005 +937A851790196D5973CD659F771F7504782781FB8C9E91DD5075679575B98A3A +9707632F93AE966384B86399775C5F817319722D6014657462EF6B63653F0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +56 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00005E407665912D8B49829D679D652F5431871877E580A281026C414E4B7E54 +807776F4690D6B9657F7503C4F84574063076B628DBE887965E87D195FD7646F +64F281F381F47F6E5E5F5CD95236667A79E97A1A8CEA709975D46EEF6CBB7A92 +4E2D76C55FE0941888777D427A2E816B91CD4EF28846821F54685DDE6D328B05 +7CA58EF880985E1A549276BA5B99665D9A5F73E0682A86DB6731732A8AF88A85 +90107AF971ED716E62C477DA56D14E3B845767F152A986C08CAF94447BC90000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +57 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00004F4F6CE8795D99D06293722A62FD5C0878DA8F4964B08CFA7BC66A01838A +88DD599D649E58EF72C0690E93108FFD8D05589C7DB48AC46E96634962D95353 +684C74228301914C55447740707C6FC1517954A88CC759FF6ECB6DC45B5C7D2B +4ED47C7D6ED35B5081EA6F2C5B579B0368D58E2A5B977D9C7E3D7E3191128D70 +594F63CD79DF8DB3535265CF79568A5B963B7D44947D7E825634918967007F6A +5C0A907566285DE64F5067DE505A4F5C57505EA7000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +58 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00004E8D4E0C51404E105EFF53454E154E984E1E9B325B6C56694E2879BA4E3F +53154E47592D723B536E6C1056DF80E499976BD3777E9F174E364E9F9F104E5C +4E694E9382885B5B55C7560F4EC45399539D53B453A553AE97688D0B531A53F5 +532D5331533E8CFE5366536352025208520E52445233528C5274524C525E5261 +525C84AF527D528252815290529351827F544EBB4EC34EC94EC24EE84EE14EEB +4EDE50B44EF34F224F644EF5500050964F094F474F5E4F6765384F5A4F5D0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +59 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00004F5F4F574F324F3D4F764F744F914F894F834F8F4F7E4F7B51154F7C5102 +4F945114513C51374FC54FDA4FE34FDC4FD14FDF4FF85029504C4FF3502C500F +502E502D4FFE501C500C5025502850E8504350555048504E506C50C2513B5110 +513A50BA50D6510650ED50EC50E650EE5107510B4EDD6C3D4F5850C94FCE9FA0 +6C467CF4516E5DFD9ECC999856C5591452F9530D8A0753109CEC591951554EA0 +51564EB3886E88A4893B81E088D279805B3488037FB851AB51B151BD51BC0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +5A +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000051C7519651A251A58A018A108A0C8A158B338A4E8A258A418A368A468A54 +8A588A528A868A848A7F8A708A7C8A758A6C8A6E8ACD8AE28A618A9A8AA58A91 +8A928ACF8AD18AC98ADB8AD78AC28AB68AF68AEB8B148B018AE48AED8AFC8AF3 +8AE68AEE8ADE8B288B9C8B168B1A8B108B2B8B2D8B568B598B4E8B9E8B6B8B96 +5369537A961D962296219631962A963D963C964296589654965F9689966C9672 +96749688968D969796B09097909B913A9099911490A190B490B390B691340000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +5B +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000090B890B090DF90C590BE913690C490C79106914890E290DC90D790DB90EB +90EF90FE91049122911E91239131912F91399143914682BB595052F152AC52AD +52BE54FF52D052D652F053DF71EE77CD5EF451F551FC9B2F53B65F01755A5DF0 +574C580A57A1587E58BC58C558D15729572C572A573358D9572E572F58E2573B +5742576958E0576B58DA577C577B5768576D5776577357E157A4578C584F57CF +57A75816579357A057D55852581D586457D257B857F457EF57F857E457DD0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +5C +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000580B580D57FD57ED5800581E5819584458205865586C58815889589A5880 +99A89F1961FF8279827D827F828F828A82A88284828E8291858C829982AB8553 +82BE82B085F682CA82E3829882B782AE83A7840784EF82A982B482A182AA829F +82C482E782A482E1830982F782E48622830782DC82F482D282D8830C82FB82D3 +8526831A8306584B716282E082D5831C8351855884FD83088392833C83348331 +839B854E832F834F8347834385888340831785BA832D833A833372966ECE0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +5D +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00008541831B85CE855284C08452846483B083788494843583A083AA8393839C +8385837C859F83A9837D8555837B8398839E83A89DAF849383C1840183E583D8 +58078418840B83DD83FD83D6841C84388411840683D483DF840F840383F883F9 +83EA83C583C07E0883F083E1845C8451845A8459847385468488847A85628478 +843C844684698476851E848E8431846D84C184CD84D09A4084BD84D384CA84BF +84BA863A84A184B984B4849793A38577850C750D853884F0861E851F85FA0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +5E +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00008556853B84FF84FC8559854885688564855E857A77A285438604857B85A4 +85A88587858F857985EA859C858585B985B785B0861A85C185DC85FF86278605 +86298616863C5EFE5F08593C596980375955595A5958530F5C225C255C2C5C37 +624C636B647662BB62CA62DA62D762EE649F62F66339634B634363AD63F66371 +637A638E6451636D63AC638A636963AE645C63F263F863E064B363C463DE63CE +645263C663BE65046441640B641B6420640C64266421645E6516646D64960000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +5F +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000647A64F764FC6499651B64C064D064D764E464E265096525652E5F0B5FD2 +75195F11535F53F1563053E953E853FB541254165406544B563856C8545456A6 +54435421550454BC5423543254825494547754715464549A5680548454765466 +565D54D054AD54C254B4566054A754A6563555F6547254A3566654BB54BF54CC +567254DA568C54A954AA54A4566554CF54DE561C54E7562E54FD551454F355E9 +5523550F55115527552A5616558F55B5554956C055415555553F5550553C0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +60 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00005537555655755576557755335530555C558B55D2558355B155B955885581 +559F557E55D65591557B55DF560D56B35594559955EA55F755C9561F55D156C1 +55EC55D455E655DD55C455EF55E555F2566F55CC55CD55E855F555E48F61561E +5608560C560156B6562355FE56005627562D565856395657562C564D56625659 +5695564C5654568656645671566B567B567C5685569356AF56D456D756DD56E1 +570756EB56F956FF5704570A5709571C5E435E195E145E115E6C5E585E570000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +61 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00005E375E445E545E5B5E5E5E615C8C5C7A5C8D5C905D875C885CF45C995C91 +5D505C9C5CB55CA25D2C5CAC5CAB5CB15CA35CC15CB75DA75CD25DA05CCB5D22 +5D975D0D5D275D265D2E5D245D1E5D065D1B5DB85D3E5D345D3D5D6C5D5B5D6F +5D815D6B5D4B5D4A5D695D745D825D995D9D8C735DB75DD45F735F775F825F87 +5F89540E5FA05F995F9C5FA85FAD5FB55FBC88625F6172AD72B072B473777341 +72C372C172CE72CD72D272E8736A72E9733B72F472F7730172F3736B72FA0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +62 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000072FB731773137380730A731E731D737C732273397325732C733873317350 +734D73577360736C736F737E821B592598E75924590298E0993398E9993C98EA +98EB98ED98F4990999114F59991B9937993F994399489949994A994C99625E80 +5EE15E8B5E965EA55EA05EB95EB55EBE5EB38CE15ED25ED15EDB5EE85EEA81BA +5FC45FC95FD661FA61AE5FEE616A5FE15FE4613E60B561345FEA5FED5FF86019 +60356026601B600F600D6029602B600A61CC6021615F61E860FB613760420000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +63 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000606A60F26096609A6173609D60836092608C609B611C60BB60B160DD60D8 +60C660DA60B4612061926115612360F46100610E612B614A617561AC619461A7 +61B761D461F55FDD96B39582958695C8958E9594958C95E595AD95AB9B2E95AC +95BE95B69B2995BF95BD95BC95C395CB95D495D095D595DE4E2C723F62156C35 +6C546C5C6C4A70436C856C906C946C8C6C686C696C746C766C866F596CD06CD4 +6CAD702770186CF16CD76CB26CE06CD66FFC6CEB6CEE6CB16CD36CEF6D870000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +64 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00006D396D276D0C6D796E5E6D076D046D196D0E6D2B6FAE6D2E6D356D1A700F +6EF86F6F6D336D916D6F6DF66F7F6D5E6D936D946D5C6D606D7C6D636E1A6DC7 +6DC56DDE70066DBF6DE06FA06DE66DDD6DD9700B6DAB6E0C6DAE6E2B6E6E6E4E +6E6B6EB26E5F6E866E536E546E326E256E4470676EB16E9870446F2D70056EA5 +6EA76EBD6EBB6EB76F776EB46ECF6E8F6EC26E9F6F627020701F6F246F156EF9 +6F2F6F3670326F746F2A6F096F296F896F8D6F8C6F786F726F7C6F7A70280000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +65 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00006FC96FA76FB96FB66FC26FE16FEE6FDE6FE06FEF701A7023701B70397035 +705D705E5B805B845B955B935BA55BB8752F9A2B64345BE45BEE89305BF08E47 +8B078FB68FD38FD58FE58FEE8FE490878FE690158FE890059004900B90909011 +900D9016902190359036902D902F9044905190529050906890589062905B66B9 +9074907D908290889083908B5F505F575F565F585C3B54AB5C505C595B715C63 +5C687FBC5F335F295F2D82745F3C9B3B5C6E59815983598D5AF55AD759A30000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +66 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000599759CA5B00599E59A459D259B259AF59D759BE5A6D5B0859DD5B4C59E3 +59D859F95A0C5A095AA75AFB5A115A235A135A405A675A4A5A555A3C5A625B0B +80EC5AAA5A9B5A775A7A5ABE5AEB5AB25B215B2A5AB85AE05AE35B195AD65AE6 +5AD85ADC5B095B175B165B325B375B405C155C1C5B5A5B655B735B515B535B62 +99D499DF99D99A369A5B99D199D89A4D9A4A99E29A6A9A0F9A0D9A059A429A2D +9A169A419A2E9A389A439A449A4F9A659A647CF97D067D027D077D087E8A0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +67 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00007D1C7D157D137D3A7D327D317E107D3C7D407D3F7D5D7D4E7D737D867D83 +7D887DBE7DBA7DCB7DD47DC47D9E7DAC7DB97DA37DB07DC77DD97DD77DF97DF2 +7E627DE67DF67DF17E0B7DE17E097E1D7E1F7E1E7E2D7E0A7E117E7D7E397E35 +7E327E467E457E887E5A7E527E6E7E7E7E707E6F7E985E7A757F5DDB753E9095 +738E74A3744B73A2739F73CF73C274CF73B773B373C073C973C873E573D9980A +740A73E973E773DE74BD743F7489742A745B7426742574287430742E742C0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +68 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000741B741A7441745C74577455745974A6746D747E749C74D4748074817487 +748B749E74A874A9749074A774DA74BA97D997DE97DC674C6753675E674869AA +6AEA6787676A677367986898677568D66A05689F678B6777677C67F06ADB67D8 +6AF367E967B06AE867D967B567DA67B367DD680067C367B867E26ADF67C16A89 +68326833690F6A48684E6968684469BF6883681D68556A3A68416A9C68406B12 +684A6849682968B5688F687468776893686B6B1E696E68FC6ADD69E768F90000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +69 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00006B0F68F0690B6901695768E369106971693969606942695D6B16696B6980 +69986978693469CC6AEC6ADA69CE6AF8696669636979699B69A769BB69AB69AD +69D469B169C169CA6AB369956AE7698D69FF6AA369ED6A176A186A6569F26A44 +6A3E6AA06A506A5B6A356A8E6AD36A3D6A286A586ADE6A916A906AA96A976AAB +733773526B816B826BA46B846B9E6BAE6B8D6BAB6B9B6BAF6BAA8ED48EDB8EF2 +8EFB8F648EF98EFC8EEB8EE48F628EFA8EFE8F0A8F078F058F128F268F1E0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +6A +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00008F1F8F1C8F338F468F548ECE62146227621B621F62226221622562246229 +81E7750C74F474FF750F75117513653465EE65EF65F0660A66C7677266036615 +6600708566F7661D66346631663666358006665F66C46641664F668966616657 +66776684668C66D6669D66BE66DB66DC66E666E98CC18CB08CBA8CBD8D048CB2 +8CC58D108CD18CDA8CD58CEB8CE78CFB899889AC89A189BF89A689AF89B289B7 +726E729F725D7266726F727E727F7284728B728D728F72926308633263B00000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +6B +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000643F64D880046BEA6BF36BFD6BFF6BF96C056C0C6C066C0D6C156C186C19 +6C1A6C216C2C6C246C2A6C3265356555656B725872527256723086625216809F +809C809380BC670A80BD80B180AB80AD80B480B76727815680E981DA80DB80C2 +80C480D980CD80D7671080DD811B80F180F480ED81BE810E80F280FC67158112 +8C5A8161811E812C811881328148814C815381748159815A817181608169817C +817D816D8167584D5AB58188818281CF6ED581A381AA81CC672681CA81BB0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +6C +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000081C181A66B5F6B376B396B436B466B5998AE98AF98B698BC98C698C86BB3 +5F408F4289F365909F4F659565BC65C665C465C365CC65CE65D265D6716C7152 +7096719770BB70C070B770AB70B171C170CA7110711371DC712F71317173715C +716871457172714A7178717A719871B371B571A871A071E071D471E771F9721D +7228706C71FE716671B9623E623D624362486249793B794079467949795B795C +7953795A79B079577960798E7967797A79AA798A799A79A779B35FD15FD00000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +6D +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000061DF605D605A606760416059606361646106610D615D61A9619D61CB61E3 +62078080807F6C936FA96DFC78EF77F878AD780978687818781165AB782D78B8 +781D7839792A7931781F783C7825782C78237829784E786D786478FD78267850 +7847784C786A78E77893789A788778E378A178A378B278B978A578D478D978C9 +78EC78F2790578F479137924791E79349F959EF99EFB9EFC76F17704779876F9 +77077708771A77227719772D772677357738775E77BC77477743775A77680000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +6E +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000077627765777F778D777D7780778C7791779F77A077B077B577BD753A7540 +754E754B7548755B7572757975837F587F617F5F8A487F687F867F717F797F88 +7F7E76CD76E5883291D291D391D491D991D791D591F791E791E4934691F591F9 +9208922692459211921092019227920492259200923A9266923792339255923D +9238925E926C926D923F9460923092499248924D922E9239943892AC92A0927A +92AA92EE92CF940392E3943A92B192A693A7929692CC92A993F59293927F0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +6F +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000093A9929A931A92AB9283940B92A892A39412933892F193D792E592F092EF +92E892BC92DD92F69426942792C392DF92E6931293069369931B934093019315 +932E934393079308931F93199365934793769354936493AA9370938493E493D8 +9428938793CC939893B893BF93A693B093B5944C93E293DC93DD93CD93DE93C3 +93C793D19414941D93F794659413946D9420947993F99419944A9432943F9454 +9463937E77E777EC96C979D579ED79E379EB7A065D477A037A027A1E7A140000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +70 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00007A397A377A619ECF99A57A707688768E7693769976A474DE74E0752C9CE9 +9CF69D079D069D239D879E159D1D9D1F9DE59D2F9DD99D309D429E1E9D539E1D +9D609D529DF39D5C9D619D939D6A9D6F9D899D989D9A9DC09DA59DA99DC29DBC +9E1A9DD39DDA9DEF9DE69DF29DF89E0C9DFA9E1B7592759476647658759D7667 +75A375B375B475B875C475B175B075C375C2760275CD75E3764675E675E47647 +75E7760375F175FC75FF761076007649760C761E760A7625763B761576190000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +71 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000761B763C762276207640762D7630766D76357643766E7633764D76697654 +765C76567672766F7FCA7AE67A787A797A807A867A887A957AC77AA07AAC7AA8 +7AB67AB3886488698872887D887F888288A2896088B788BC88C9893388CE895D +894788F1891A88FC88E888FE88F08921891989138938890A8964892B89368941 +8966897B758B80E576B876B477DC801280148016801C8020802E80258026802C +802980288031800B803580438046807980528075807189839807980E980F0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +72 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00009821981C6F4198269837984E98539873986298599865986C9870864D8654 +866C87E38806867A867C867B86A8868D868B8706869D86A786A386AA869386A9 +86B686C486B5882386B086BA86B186AF86C987F686B486E986FA87EF86ED8784 +86D0871386DE881086DF86D886D18703870786F88708870A870D87098723873B +871E8725872E871A873E87C88734873187298737873F87828722877D8811877B +87608770874C876E878B8753876387BB876487598765879387AF87CE87D20000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +73 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000087C68788878587AD8797878387AB87E587AC87B587B387CB87D387BD87D1 +87C087CA87DB87EA87E087EE8816881387FE880A881B88218839883C7F367F4C +7F447F4582107AFA7AFD7B087BE47B047B677B0A7B2B7B0F7B477B387B2A7B19 +7B2E7B317B207B257B247B337C697B1E7B587BF37B457B757B4C7B8F7B607B6E +7B7B7B627B727B717B907C007BCB7BB87BAC7B9D7C5C7B857C1E7B9C7BA27C2B +7BB47C237BC17BCC7BDD7BDA7BE57BE67BEA7C0C7BFE7BFC7C0F7C6A7C0B0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +74 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00007C1F7C2A7C267C387C5F7C4081FE82018202820481EC8844822182228264 +822D822F8228822B8238826B82338234823E82448249824B824F825A825F8268 +887E88CA888888D888DF895E7F9D7FA57FA77FAF7FB07FB27C7C65497C917CF2 +7CF67C9E7CA27CB27CBC7CBD7CDD7CC77CCC7CCD7CC87CC57CD77CE8826E66A8 +7FBF7FCE7FD57FE57FE17FE67FE97FEE7FF37CF87E367DA67DAE7E477E9B9EA9 +9EB48D738D848D948D918DB28D678D6D8C478C49914A9150914E914F91640000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +75 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00009162916191709169916F91C591C3917291749179918C91859190918D9191 +91A291A391AA91AD91AE91AF91B591B491BA8C559E7A8E898DEB8E058E598E69 +8DB58DBF8DBC8DBA8E4C8DD68DD78DDA8E928DCE8DCF8DDB8DC68DEC8E7A8E55 +8DE38E9A8E8B8DE48E098DFD8E148E1D8E1F8E938E2E8E238E918E3A8E408E39 +8E358E3D8E318E498E418E428EA18E638E4A8E708E768E7C8E6F8E748E858EAA +8E948E908EA68E9E8C788C828C8A8C858C988C94659B89D689F489DA89DC0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +76 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000089E589EB89F68A3E8B26975A96E9974296EF9706973D9708970F970E972A +97449730973E9F549F5F9F599F609F5C9F669F6C9F6A9F779EFD9EFF9F0996B9 +96BC96BD96CE96D277BF8B8E928E947E92C893E8936A93CA938F943E946B9B77 +9B749B819B839B8E9C787A4C9B929C5F9B909BAD9B9A9BAA9B9E9C6D9BAB9B9D +9C589BC19C7A9C319C399C239C379BC09BCA9BC79BFD9BD69BEA9BEB9BE19BE4 +9BE79BDD9BE29BF09BDB9BF49BD49C5D9C089C109C0D9C129C099BFF9C200000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +77 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00009C329C2D9C289C259C299C339C3E9C489C3B9C359C459C569C549C529C67 +977C978597C397BD979497C997AB97A397B297B49AB19AB09AB79DBB9AB69ABA +9ABC9AC19AC09ACF9AC29AD69AD59AD19B459B439B589B4E9B489B4D9B519957 +995C992E995599549ADF9AE19AE69AEF9AEB9AFB9AED9AF99B089B0F9B229B1F +9B234E489EBE7E3B9E829E879E889E8B9E9293D69E9D9E9F9EDB9EDC9EDD9EE0 +9EDF9EE29EF79EE79EE59EF29EEF9F229F2C9F2F9F399F379F3D9F3E9F440000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +78 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000896C95C693365F4685147E94538251B24E119F635679515A6DC09F156597 +56419AEE83034E3089075E727A4098B35E7F95A49B0D52128FF45F597A6B98E2 +51E050A24EF7835085915118636E6372524B5938774F8721814A7E8D91CC66C6 +5E1877AD9E7556C99EF46FDB61DE77C770309EB5884A95E282F951ED62514EC6 +673497C67C647E3497A69EAF786E820D672F677E56CC53F098B16AAF7F4E6D82 +7CF04E074FC27E6B9E7956AE9B1A846F53F690C179A67C72613F4E919AD20000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +79 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000075C796BB53EA7DFB88FD79CD78437B5151C6000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 diff --git a/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/gb1988.enc b/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/gb1988.enc new file mode 100644 index 0000000000000000000000000000000000000000..298732ccc2300e57a32b3139ee674c7f5019835e --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/gb1988.enc @@ -0,0 +1,20 @@ +# Encoding file: gb1988, single-byte +S +003F 0 1 +00 +0000000100020003000400050006000700080009000A000B000C000D000E000F +0010001100120013001400150016001700180019001A001B001C001D001E001F +002000210022002300A500250026002700280029002A002B002C002D002E002F +0030003100320033003400350036003700380039003A003B003C003D003E003F +0040004100420043004400450046004700480049004A004B004C004D004E004F +0050005100520053005400550056005700580059005A005B005C005D005E005F +0060006100620063006400650066006700680069006A006B006C006D006E006F +0070007100720073007400750076007700780079007A007B007C007D203E007F +0080008100820083008400850086008700880089008A008B008C008D008E008F +0090009100920093009400950096009700980099009A009B009C009D009E009F +0000FF61FF62FF63FF64FF65FF66FF67FF68FF69FF6AFF6BFF6CFF6DFF6EFF6F +FF70FF71FF72FF73FF74FF75FF76FF77FF78FF79FF7AFF7BFF7CFF7DFF7EFF7F +FF80FF81FF82FF83FF84FF85FF86FF87FF88FF89FF8AFF8BFF8CFF8DFF8EFF8F +FF90FF91FF92FF93FF94FF95FF96FF97FF98FF99FF9AFF9BFF9CFF9DFF9EFF9F +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 diff --git a/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/gb2312-raw.enc b/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/gb2312-raw.enc new file mode 100644 index 0000000000000000000000000000000000000000..813d7a6f3707068b67946aa377a3e409ee1967b1 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/gb2312-raw.enc @@ -0,0 +1,1380 @@ +# Encoding file: gb2312, double-byte +D +233F 0 81 +21 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000030003001300230FB02C902C700A8300330052015FF5E2225202620182019 +201C201D3014301530083009300A300B300C300D300E300F3016301730103011 +00B100D700F72236222722282211220F222A222922082237221A22A522252220 +23122299222B222E2261224C2248223D221D2260226E226F22642265221E2235 +22342642264000B0203220332103FF0400A4FFE0FFE1203000A7211626062605 +25CB25CF25CE25C725C625A125A025B325B2203B219221902191219330130000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +22 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000024882489248A248B248C248D248E248F2490249124922493249424952496 +249724982499249A249B247424752476247724782479247A247B247C247D247E +247F248024812482248324842485248624872460246124622463246424652466 +2467246824690000000032203221322232233224322532263227322832290000 +00002160216121622163216421652166216721682169216A216B000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +23 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000FF01FF02FF03FFE5FF05FF06FF07FF08FF09FF0AFF0BFF0CFF0DFF0EFF0F +FF10FF11FF12FF13FF14FF15FF16FF17FF18FF19FF1AFF1BFF1CFF1DFF1EFF1F +FF20FF21FF22FF23FF24FF25FF26FF27FF28FF29FF2AFF2BFF2CFF2DFF2EFF2F +FF30FF31FF32FF33FF34FF35FF36FF37FF38FF39FF3AFF3BFF3CFF3DFF3EFF3F +FF40FF41FF42FF43FF44FF45FF46FF47FF48FF49FF4AFF4BFF4CFF4DFF4EFF4F +FF50FF51FF52FF53FF54FF55FF56FF57FF58FF59FF5AFF5BFF5CFF5DFFE30000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +24 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000304130423043304430453046304730483049304A304B304C304D304E304F +3050305130523053305430553056305730583059305A305B305C305D305E305F +3060306130623063306430653066306730683069306A306B306C306D306E306F +3070307130723073307430753076307730783079307A307B307C307D307E307F +3080308130823083308430853086308730883089308A308B308C308D308E308F +3090309130923093000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +25 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000030A130A230A330A430A530A630A730A830A930AA30AB30AC30AD30AE30AF +30B030B130B230B330B430B530B630B730B830B930BA30BB30BC30BD30BE30BF +30C030C130C230C330C430C530C630C730C830C930CA30CB30CC30CD30CE30CF +30D030D130D230D330D430D530D630D730D830D930DA30DB30DC30DD30DE30DF +30E030E130E230E330E430E530E630E730E830E930EA30EB30EC30ED30EE30EF +30F030F130F230F330F430F530F6000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +26 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000039103920393039403950396039703980399039A039B039C039D039E039F +03A003A103A303A403A503A603A703A803A90000000000000000000000000000 +000003B103B203B303B403B503B603B703B803B903BA03BB03BC03BD03BE03BF +03C003C103C303C403C503C603C703C803C90000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +27 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000004100411041204130414041504010416041704180419041A041B041C041D +041E041F0420042104220423042404250426042704280429042A042B042C042D +042E042F00000000000000000000000000000000000000000000000000000000 +000004300431043204330434043504510436043704380439043A043B043C043D +043E043F0440044104420443044404450446044704480449044A044B044C044D +044E044F00000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +28 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000010100E101CE00E0011300E9011B00E8012B00ED01D000EC014D00F301D2 +00F2016B00FA01D400F901D601D801DA01DC00FC00EA00000000000000000000 +0000000000000000000031053106310731083109310A310B310C310D310E310F +3110311131123113311431153116311731183119311A311B311C311D311E311F +3120312131223123312431253126312731283129000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +29 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00000000000000002500250125022503250425052506250725082509250A250B +250C250D250E250F2510251125122513251425152516251725182519251A251B +251C251D251E251F2520252125222523252425252526252725282529252A252B +252C252D252E252F2530253125322533253425352536253725382539253A253B +253C253D253E253F2540254125422543254425452546254725482549254A254B +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +30 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000554A963F57C3632854CE550954C07691764C853C77EE827E788D72319698 +978D6C285B894FFA630966975CB880FA684880AE660276CE51F9655671AC7FF1 +888450B2596561CA6FB382AD634C625253ED54277B06516B75A45DF462D48DCB +9776628A8019575D97387F627238767D67CF767E64464F708D2562DC7A176591 +73ED642C6273822C9881677F7248626E62CC4F3474E3534A529E7ECA90A65E2E +6886699C81807ED168D278C5868C9551508D8C2482DE80DE5305891252650000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +31 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000858496F94FDD582199715B9D62B162A566B48C799C8D7206676F789160B2 +535153178F8880CC8D1D94A1500D72C8590760EB711988AB595482EF672C7B28 +5D297EF7752D6CF58E668FF8903C9F3B6BD491197B145F7C78A784D6853D6BD5 +6BD96BD65E015E8775F995ED655D5F0A5FC58F9F58C181C2907F965B97AD8FB9 +7F168D2C62414FBF53D8535E8FA88FA98FAB904D68075F6A819888689CD6618B +522B762A5F6C658C6FD26EE85BBE6448517551B067C44E1979C9997C70B30000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +32 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000075C55E7673BB83E064AD62E894B56CE2535A52C3640F94C27B944F2F5E1B +82368116818A6E246CCA9A736355535C54FA886557E04E0D5E036B657C3F90E8 +601664E6731C88C16750624D8D22776C8E2991C75F6983DC8521991053C28695 +6B8B60ED60E8707F82CD82314ED36CA785CF64CD7CD969FD66F9834953957B56 +4FA7518C6D4B5C428E6D63D253C9832C833667E578B4643D5BDF5C945DEE8BE7 +62C667F48C7A640063BA8749998B8C177F2094F24EA7961098A4660C73160000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +33 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000573A5C1D5E38957F507F80A05382655E7545553150218D856284949E671D +56326F6E5DE2543570928F66626F64A463A35F7B6F8890F481E38FB05C186668 +5FF16C8996488D81886C649179F057CE6A59621054484E587A0B60E96F848BDA +627F901E9A8B79E4540375F4630153196C608FDF5F1B9A70803B9F7F4F885C3A +8D647FC565A570BD514551B2866B5D075BA062BD916C75748E0C7A2061017B79 +4EC77EF877854E1181ED521D51FA6A7153A88E87950496CF6EC19664695A0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +34 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000784050A877D7641089E6590463E35DDD7A7F693D4F20823955984E3275AE +7A975E625E8A95EF521B5439708A6376952457826625693F918755076DF37EAF +882262337EF075B5832878C196CC8F9E614874F78BCD6B64523A8D506B21806A +847156F153064ECE4E1B51D17C97918B7C074FC38E7F7BE17A9C64675D1450AC +810676017CB96DEC7FE067515B585BF878CB64AE641363AA632B9519642D8FBE +7B5476296253592754466B7950A362345E266B864EE38D37888B5F85902E0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +35 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00006020803D62C54E39535590F863B880C665E66C2E4F4660EE6DE18BDE5F39 +86CB5F536321515A83616863520063638E4850125C9B79775BFC52307A3B60BC +905376D75FB75F9776848E6C706F767B7B4977AA51F3909358244F4E6EF48FEA +654C7B1B72C46DA47FDF5AE162B55E95573084827B2C5E1D5F1F90127F1498A0 +63826EC7789870B95178975B57AB75354F4375385E9760E659606DC06BBF7889 +53FC96D551CB52016389540A94938C038DCC7239789F87768FED8C0D53E00000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +36 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00004E0176EF53EE948998769F0E952D5B9A8BA24E224E1C51AC846361C252A8 +680B4F97606B51BB6D1E515C6296659796618C46901775D890FD77636BD2728A +72EC8BFB583577798D4C675C9540809A5EA66E2159927AEF77ED953B6BB565AD +7F0E58065151961F5BF958A954288E726566987F56E4949D76FE9041638754C6 +591A593A579B8EB267358DFA8235524160F0581586FE5CE89E454FC4989D8BB9 +5A2560765384627C904F9102997F6069800C513F80335C1499756D314E8C0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +37 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00008D3053D17F5A7B4F4F104E4F96006CD573D085E95E06756A7FFB6A0A77FE +94927E4151E170E653CD8FD483038D2972AF996D6CDB574A82B365B980AA623F +963259A84EFF8BBF7EBA653E83F2975E556198DE80A5532A8BFD542080BA5E9F +6CB88D3982AC915A54296C1B52067EB7575F711A6C7E7C89594B4EFD5FFF6124 +7CAA4E305C0167AB87025CF0950B98CE75AF70FD902251AF7F1D8BBD594951E4 +4F5B5426592B657780A45B75627662C28F905E456C1F7B264F0F4FD8670D0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +38 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00006D6E6DAA798F88B15F17752B629A8F854FEF91DC65A7812F81515E9C8150 +8D74526F89868D4B590D50854ED8961C723681798D1F5BCC8BA3964459877F1A +54905676560E8BE565396982949976D66E895E727518674667D17AFF809D8D76 +611F79C665628D635188521A94A27F38809B7EB25C976E2F67607BD9768B9AD8 +818F7F947CD5641E95507A3F544A54E56B4C640162089E3D80F3759952729769 +845B683C86E49601969494EC4E2A54047ED968398DDF801566F45E9A7FB90000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +39 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000057C2803F68975DE5653B529F606D9F9A4F9B8EAC516C5BAB5F135DE96C5E +62F18D21517194A952FE6C9F82DF72D757A267848D2D591F8F9C83C754957B8D +4F306CBD5B6459D19F1353E486CA9AA88C3780A16545987E56FA96C7522E74DC +52505BE1630289024E5662D0602A68FA51735B9851A089C27BA199867F5060EF +704C8D2F51495E7F901B747089C4572D78455F529F9F95FA8F689B3C8BE17678 +684267DC8DEA8D35523D8F8A6EDA68CD950590ED56FD679C88F98FC754C80000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +3A +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00009AB85B696D776C264EA55BB39A87916361A890AF97E9542B6DB55BD251FD +558A7F557FF064BC634D65F161BE608D710A6C576C49592F676D822A58D5568E +8C6A6BEB90DD597D801753F76D695475559D837783CF683879BE548C4F555408 +76D28C8996026CB36DB88D6B89109E648D3A563F9ED175D55F8872E0606854FC +4EA86A2A886160528F7054C470D886799E3F6D2A5B8F5F187EA255894FAF7334 +543C539A5019540E547C4E4E5FFD745A58F6846B80E1877472D07CCA6E560000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +3B +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00005F27864E552C62A44E926CAA623782B154D7534E733E6ED1753B52125316 +8BDD69D05F8A60006DEE574F6B2273AF68538FD87F13636260A3552475EA8C62 +71156DA35BA65E7B8352614C9EC478FA87577C27768751F060F6714C66435E4C +604D8C0E707063258F895FBD606286D456DE6BC160946167534960E066668D3F +79FD4F1A70E96C478BB38BF27ED88364660F5A5A9B426D516DF78C416D3B4F19 +706B83B7621660D1970D8D27797851FB573E57FA673A75787A3D79EF7B950000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +3C +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000808C99658FF96FC08BA59E2159EC7EE97F095409678168D88F917C4D96C6 +53CA602575BE6C7253735AC97EA7632451E0810A5DF184DF628051805B634F0E +796D524260B86D4E5BC45BC28BA18BB065E25FCC964559937EE77EAA560967B7 +59394F735BB652A0835A988A8D3E753294BE50477A3C4EF767B69A7E5AC16B7C +76D1575A5C167B3A95F4714E517C80A9827059787F04832768C067EC78B17877 +62E363617B804FED526A51CF835069DB92748DF58D3189C1952E7BAD4EF60000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +3D +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000506582305251996F6E106E856DA75EFA50F559DC5C066D466C5F7586848B +686859568BB253209171964D854969127901712680F64EA490CA6D479A845A07 +56BC640594F077EB4FA5811A72E189D2997A7F347EDE527F655991758F7F8F83 +53EB7A9663ED63A5768679F888579636622A52AB8282685467706377776B7AED +6D017ED389E359D0621285C982A5754C501F4ECB75A58BEB5C4A5DFE7B4B65A4 +91D14ECA6D25895F7D2795264EC58C288FDB9773664B79818FD170EC6D780000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +3E +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00005C3D52B283465162830E775B66769CB84EAC60CA7CBE7CB37ECF4E958B66 +666F988897595883656C955C5F8475C997567ADF7ADE51C070AF7A9863EA7A76 +7EA0739697ED4E4570784E5D915253A9655165E781FC8205548E5C31759A97A0 +62D872D975BD5C459A7983CA5C40548077E94E3E6CAE805A62D2636E5DE85177 +8DDD8E1E952F4FF153E560E770AC526763509E435A1F5026773753777EE26485 +652B628963985014723589C951B38BC07EDD574783CC94A7519B541B5CFB0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +3F +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00004FCA7AE36D5A90E19A8F55805496536154AF5F0063E9697751EF6168520A +582A52D8574E780D770B5EB761777CE0625B62974EA27095800362F770E49760 +577782DB67EF68F578D5989779D158F354B353EF6E34514B523B5BA28BFE80AF +554357A660735751542D7A7A60505B5463A762A053E362635BC767AF54ED7A9F +82E691775E9388E4593857AE630E8DE880EF57577B774FA95FEB5BBD6B3E5321 +7B5072C2684677FF773665F751B54E8F76D45CBF7AA58475594E9B4150800000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +40 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000998861276E8357646606634656F062EC62695ED39614578362C955878721 +814A8FA3556683B167658D5684DD5A6A680F62E67BEE961151706F9C8C3063FD +89C861D27F0670C26EE57405699472FC5ECA90CE67176D6A635E52B372628001 +4F6C59E5916A70D96D9D52D24E5096F7956D857E78CA7D2F5121579264C2808B +7C7B6CEA68F1695E51B7539868A872819ECE7BF172F879BB6F137406674E91CC +9CA4793C83898354540F68174E3D538952B1783E5386522950884F8B4FD00000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +41 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000075E27ACB7C926CA596B6529B748354E94FE9805483B28FDE95705EC9601C +6D9F5E18655B813894FE604B70BC7EC37CAE51C968817CB1826F4E248F8691CF +667E4EAE8C0564A9804A50DA759771CE5BE58FBD6F664E86648295635ED66599 +521788C270C852A3730E7433679778F797164E3490BB9CDE6DCB51DB8D41541D +62CE73B283F196F69F8494C34F367F9A51CC707596755CAD988653E64EE46E9C +740969B4786B998F7559521876246D4167F3516D9F99804B54997B3C7ABF0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +42 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00009686578462E29647697C5A0464027BD36F0F964B82A6536298855E907089 +63B35364864F9C819E93788C97328DEF8D429E7F6F5E79845F559646622E9A74 +541594DD4FA365C55C655C617F1586516C2F5F8B73876EE47EFF5CE6631B5B6A +6EE653754E7163A0756562A18F6E4F264ED16CA67EB68BBA841D87BA7F57903B +95237BA99AA188F8843D6D1B9A867EDC59889EBB739B780186829A6C9A82561B +541757CB4E709EA653568FC881097792999286EE6EE1851366FC61626F2B0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +43 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00008C298292832B76F26C135FD983BD732B8305951A6BDB77DB94C6536F8302 +51925E3D8C8C8D384E4873AB679A68859176970971646CA177095A9295416BCF +7F8E66275BD059B95A9A95E895F74EEC840C84996AAC76DF9530731B68A65B5F +772F919A97617CDC8FF78C1C5F257C7379D889C56CCC871C5BC65E4268C97720 +7EF55195514D52C95A297F05976282D763CF778485D079D26E3A5E9959998511 +706D6C1162BF76BF654F60AF95FD660E879F9E2394ED540D547D8C2C64780000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +44 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000647986116A21819C78E864699B5462B9672B83AB58A89ED86CAB6F205BDE +964C8C0B725F67D062C772614EA959C66BCD589366AE5E5552DF6155672876EE +776672677A4662FF54EA545094A090A35A1C7EB36C164E435976801059485357 +753796BE56CA63208111607C95F96DD65462998151855AE980FD59AE9713502A +6CE55C3C62DF4F60533F817B90066EBA852B62C85E7478BE64B5637B5FF55A18 +917F9E1F5C3F634F80425B7D556E954A954D6D8560A867E072DE51DD5B810000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +45 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000062E76CDE725B626D94AE7EBD81136D53519C5F04597452AA601259736696 +8650759F632A61E67CEF8BFA54E66B279E256BB485D5545550766CA4556A8DB4 +722C5E156015743662CD6392724C5F986E436D3E65006F5876D878D076FC7554 +522453DB4E535E9E65C1802A80D6629B5486522870AE888D8DD16CE1547880DA +57F988F48D54966A914D4F696C9B55B776C6783062A870F96F8E5F6D84EC68DA +787C7BF781A8670B9E4F636778B0576F78129739627962AB528874356BD70000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +46 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00005564813E75B276AE533975DE50FB5C418B6C7BC7504F72479A9798D86F02 +74E27968648777A562FC98918D2B54C180584E52576A82F9840D5E7351ED74F6 +8BC45C4F57616CFC98875A4678349B448FEB7C955256625194FA4EC683868461 +83E984B257D467345703666E6D668C3166DD7011671F6B3A6816621A59BB4E03 +51C46F0667D26C8F517668CB59476B6775665D0E81109F5065D7794879419A91 +8D775C824E5E4F01542F5951780C56686C148FC45F036C7D6CE38BAB63900000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +47 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000060706D3D72756266948E94C553438FC17B7E4EDF8C264E7E9ED494B194B3 +524D6F5C90636D458C3458115D4C6B206B4967AA545B81547F8C589985375F3A +62A26A47953965726084686577A74E544FA85DE7979864AC7FD85CED4FCF7A8D +520783044E14602F7A8394A64FB54EB279E6743452E482B964D279BD5BDD6C81 +97528F7B6C22503E537F6E0564CE66746C3060C598778BF75E86743C7A7779CB +4E1890B174036C4256DA914B6CC58D8B533A86C666F28EAF5C489A716E200000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +48 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000053D65A369F8B8DA353BB570898A76743919B6CC9516875CA62F372AC5238 +529D7F3A7094763853749E4A69B7786E96C088D97FA4713671C3518967D374E4 +58E4651856B78BA9997662707ED560F970ED58EC4EC14EBA5FCD97E74EFB8BA4 +5203598A7EAB62544ECD65E5620E833884C98363878D71946EB65BB97ED25197 +63C967D480898339881551125B7A59828FB14E736C5D516589258F6F962E854A +745E951095F06DA682E55F3164926D128428816E9CC3585E8D5B4E0953C10000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +49 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00004F1E6563685155D34E2764149A9A626B5AC2745F82726DA968EE50E7838E +7802674052396C997EB150BB5565715E7B5B665273CA82EB67495C715220717D +886B95EA965564C58D6181B355846C5562477F2E58924F2455468D4F664C4E0A +5C1A88F368A2634E7A0D70E7828D52FA97F65C1154E890B57ECD59628D4A86C7 +820C820D8D6664445C0461516D89793E8BBE78377533547B4F388EAB6DF15A20 +7EC5795E6C885BA15A76751A80BE614E6E1758F0751F7525727253477EF30000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +4A +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000770176DB526980DC57235E08593172EE65BD6E7F8BD75C388671534177F3 +62FE65F64EC098DF86805B9E8BC653F277E24F7F5C4E9A7659CB5F0F793A58EB +4E1667FF4E8B62ED8A93901D52BF662F55DC566C90024ED54F8D91CA99706C0F +5E0260435BA489C68BD56536624B99965B885BFF6388552E53D77626517D852C +67A268B36B8A62928F9353D482126DD1758F4E668D4E5B70719F85AF669166D9 +7F7287009ECD9F205C5E672F8FF06811675F620D7AD658855EB665706F310000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +4B +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000060555237800D6454887075295E05681362F4971C53CC723D8C016C347761 +7A0E542E77AC987A821C8BF47855671470C165AF64955636601D79C153F84E1D +6B7B80865BFA55E356DB4F3A4F3C99725DF3677E80386002988290015B8B8BBC +8BF5641C825864DE55FD82CF91654FD77D20901F7C9F50F358516EAF5BBF8BC9 +80839178849C7B97867D968B968F7EE59AD3788E5C817A57904296A7795F5B59 +635F7B0B84D168AD55067F2974107D2295016240584C4ED65B83597958540000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +4C +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000736D631E8E4B8E0F80CE82D462AC53F06CF0915E592A60016C70574D644A +8D2A762B6EE9575B6A8075F06F6D8C2D8C0857666BEF889278B363A253F970AD +6C645858642A580268E0819B55107CD650188EBA6DCC8D9F70EB638F6D9B6ED4 +7EE68404684390036DD896768BA85957727985E4817E75BC8A8A68AF52548E22 +951163D098988E44557C4F5366FF568F60D56D9552435C4959296DFB586B7530 +751C606C82148146631167618FE2773A8DF38D3494C15E165385542C70C30000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +4D +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00006C405EF7505C4EAD5EAD633A8247901A6850916E77B3540C94DC5F647AE5 +687663457B527EDF75DB507762955934900F51F879C37A8156FE5F9290146D82 +5C60571F541051546E4D56E263A89893817F8715892A9000541E5C6F81C062D6 +625881319E3596409A6E9A7C692D59A562D3553E631654C786D96D3C5A0374E6 +889C6B6A59168C4C5F2F6E7E73A9987D4E3870F75B8C7897633D665A769660CB +5B9B5A494E0781556C6A738B4EA167897F515F8065FA671B5FD859845A010000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +4E +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00005DCD5FAE537197E68FDD684556F4552F60DF4E3A6F4D7EF482C7840E59D4 +4F1F4F2A5C3E7EAC672A851A5473754F80C355829B4F4F4D6E2D8C135C096170 +536B761F6E29868A658795FB7EB9543B7A337D0A95EE55E17FC174EE631D8717 +6DA17A9D621165A1536763E16C835DEB545C94A84E4C6C618BEC5C4B65E0829C +68A7543E54346BCB6B664E9463425348821E4F0D4FAE575E620A96FE66647269 +52FF52A1609F8BEF661471996790897F785277FD6670563B54389521727A0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +4F +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00007A00606F5E0C6089819D591560DC718470EF6EAA6C5072806A8488AD5E2D +4E605AB3559C94E36D177CFB9699620F7EC6778E867E5323971E8F9666875CE1 +4FA072ED4E0B53A6590F54136380952851484ED99C9C7EA454B88D2488548237 +95F26D8E5F265ACC663E966973B0732E53BF817A99857FA15BAA967796507EBF +76F853A2957699997BB189446E584E617FD479658BE660F354CD4EAB98795DF7 +6A6150CF54118C618427785D9704524A54EE56A395006D885BB56DC666530000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +50 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00005C0F5B5D6821809655787B11654869544E9B6B47874E978B534F631F643A +90AA659C80C18C10519968B0537887F961C86CC46CFB8C225C5185AA82AF950C +6B238F9B65B05FFB5FC34FE18845661F8165732960FA51745211578B5F6290A2 +884C91925E78674F602759D3514451F680F853086C7996C4718A4F114FEE7F9E +673D55C5950879C088967EE3589F620C9700865A5618987B5F908BB884C49157 +53D965ED5E8F755C60647D6E5A7F7EEA7EED8F6955A75BA360AC65CB73840000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +51 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00009009766377297EDA9774859B5B667A7496EA884052CB718F5FAA65EC8BE2 +5BFB9A6F5DE16B896C5B8BAD8BAF900A8FC5538B62BC9E269E2D54404E2B82BD +7259869C5D1688596DAF96C554D14E9A8BB6710954BD960970DF6DF976D04E25 +781487125CA95EF68A00989C960E708E6CBF594463A9773C884D6F1482735830 +71D5538C781A96C155015F6671305BB48C1A9A8C6B83592E9E2F79E76768626C +4F6F75A17F8A6D0B96336C274EF075D2517B68376F3E90808170599674760000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +52 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000064475C2790657A918C2359DA54AC8200836F898180006930564E80367237 +91CE51B64E5F987563964E1A53F666F3814B591C6DB24E0058F9533B63D694F1 +4F9D4F0A886398905937905779FB4EEA80F075916C825B9C59E85F5D69058681 +501A5DF24E5977E34EE5827A6291661390915C794EBF5F7981C69038808475AB +4EA688D4610F6BC55FC64E4976CA6EA28BE38BAE8C0A8BD15F027FFC7FCC7ECE +8335836B56E06BB797F3963459FB541F94F66DEB5BC5996E5C395F1596900000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +53 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000537082F16A315A749E705E947F2883B984248425836787478FCE8D6276C8 +5F719896786C662054DF62E54F6381C375C85EB896CD8E0A86F9548F6CF36D8C +6C38607F52C775285E7D4F1860A05FE75C24753190AE94C072B96CB96E389149 +670953CB53F34F5191C98BF153C85E7C8FC26DE44E8E76C26986865E611A8206 +4F594FDE903E9C7C61096E1D6E1496854E885A3196E84E0E5C7F79B95B878BED +7FBD738957DF828B90C15401904755BB5CEA5FA161086B3272F180B28A890000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +54 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00006D745BD388D598848C6B9A6D9E336E0A51A4514357A38881539F63F48F95 +56ED54585706733F6E907F188FDC82D1613F6028966266F07EA68D8A8DC394A5 +5CB37CA4670860A6960580184E9190E75300966851418FD08574915D665597F5 +5B55531D78386742683D54C9707E5BB08F7D518D572854B1651266828D5E8D43 +810F846C906D7CDF51FF85FB67A365E96FA186A48E81566A90207682707671E5 +8D2362E952196CFD8D3C600E589E618E66FE8D60624E55B36E23672D8F670000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +55 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000094E195F87728680569A8548B4E4D70B88BC86458658B5B857A84503A5BE8 +77BB6BE18A797C986CBE76CF65A98F975D2D5C5586386808536062187AD96E5B +7EFD6A1F7AE05F706F335F20638C6DA867564E085E108D264ED780C07634969C +62DB662D627E6CBC8D7571677F695146808753EC906E629854F286F08F998005 +951785178FD96D5973CD659F771F7504782781FB8D1E94884FA6679575B98BCA +9707632F9547963584B8632377415F8172F04E896014657462EF6B63653F0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +56 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00005E2775C790D18BC1829D679D652F5431871877E580A281026C414E4B7EC7 +804C76F4690D6B966267503C4F84574063076B628DBE53EA65E87EB85FD7631A +63B781F381F47F6E5E1C5CD95236667A79E97A1A8D28709975D46EDE6CBB7A92 +4E2D76C55FE0949F88777EC879CD80BF91CD4EF24F17821F54685DDE6D328BCC +7CA58F7480985E1A549276B15B99663C9AA473E0682A86DB6731732A8BF88BDB +90107AF970DB716E62C477A956314E3B845767F152A986C08D2E94F87B510000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +57 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00004F4F6CE8795D9A7B6293722A62FD4E1378168F6C64B08D5A7BC668695E84 +88C55986649E58EE72B6690E95258FFD8D5857607F008C0651C6634962D95353 +684C74228301914C55447740707C6D4A517954A88D4459FF6ECB6DC45B5C7D2B +4ED47C7D6ED35B5081EA6E0D5B579B0368D58E2A5B977EFC603B7EB590B98D70 +594F63CD79DF8DB3535265CF79568BC5963B7EC494BB7E825634918967007F6A +5C0A907566285DE64F5067DE505A4F5C57505EA7000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +58 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00004E8D4E0C51404E105EFF53454E154E984E1E9B325B6C56694E2879BA4E3F +53154E47592D723B536E6C1056DF80E499976BD3777E9F174E364E9F9F104E5C +4E694E9382885B5B556C560F4EC4538D539D53A353A553AE97658D5D531A53F5 +5326532E533E8D5C5366536352025208520E522D5233523F5240524C525E5261 +525C84AF527D528252815290529351827F544EBB4EC34EC94EC24EE84EE14EEB +4EDE4F1B4EF34F224F644EF54F254F274F094F2B4F5E4F6765384F5A4F5D0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +59 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00004F5F4F574F324F3D4F764F744F914F894F834F8F4F7E4F7B4FAA4F7C4FAC +4F944FE64FE84FEA4FC54FDA4FE34FDC4FD14FDF4FF85029504C4FF3502C500F +502E502D4FFE501C500C50255028507E504350555048504E506C507B50A550A7 +50A950BA50D6510650ED50EC50E650EE5107510B4EDD6C3D4F584F654FCE9FA0 +6C467C74516E5DFD9EC999985181591452F9530D8A07531051EB591951554EA0 +51564EB3886E88A44EB5811488D279805B3488037FB851AB51B151BD51BC0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +5A +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000051C7519651A251A58BA08BA68BA78BAA8BB48BB58BB78BC28BC38BCB8BCF +8BCE8BD28BD38BD48BD68BD88BD98BDC8BDF8BE08BE48BE88BE98BEE8BF08BF3 +8BF68BF98BFC8BFF8C008C028C048C078C0C8C0F8C118C128C148C158C168C19 +8C1B8C188C1D8C1F8C208C218C258C278C2A8C2B8C2E8C2F8C328C338C358C36 +5369537A961D962296219631962A963D963C964296499654965F9667966C9672 +96749688968D969796B09097909B909D909990AC90A190B490B390B690BA0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +5B +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000090B890B090CF90C590BE90D090C490C790D390E690E290DC90D790DB90EB +90EF90FE91049122911E91239131912F913991439146520D594252A252AC52AD +52BE54FF52D052D652F053DF71EE77CD5EF451F551FC9B2F53B65F01755A5DEF +574C57A957A1587E58BC58C558D15729572C572A57335739572E572F575C573B +574257695785576B5786577C577B5768576D5776577357AD57A4578C57B257CF +57A757B4579357A057D557D857DA57D957D257B857F457EF57F857E457DD0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +5C +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000580B580D57FD57ED5800581E5819584458205865586C58815889589A5880 +99A89F1961FF8279827D827F828F828A82A88284828E82918297829982AB82B8 +82BE82B082C882CA82E3829882B782AE82CB82CC82C182A982B482A182AA829F +82C482CE82A482E1830982F782E4830F830782DC82F482D282D8830C82FB82D3 +8311831A83068314831582E082D5831C8351835B835C83088392833C83348331 +839B835E832F834F83478343835F834083178360832D833A8333836683650000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +5D +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00008368831B8369836C836A836D836E83B0837883B383B483A083AA8393839C +8385837C83B683A9837D83B8837B8398839E83A883BA83BC83C1840183E583D8 +58078418840B83DD83FD83D6841C84388411840683D483DF840F840383F883F9 +83EA83C583C0842683F083E1845C8451845A8459847384878488847A84898478 +843C844684698476848C848E8431846D84C184CD84D084E684BD84D384CA84BF +84BA84E084A184B984B4849784E584E3850C750D853884F08539851F853A0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +5E +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00008556853B84FF84FC8559854885688564855E857A77A285438572857B85A4 +85A88587858F857985AE859C858585B985B785B085D385C185DC85FF86278605 +86298616863C5EFE5F08593C594180375955595A5958530F5C225C255C2C5C34 +624C626A629F62BB62CA62DA62D762EE632262F66339634B634363AD63F66371 +637A638E63B4636D63AC638A636963AE63BC63F263F863E063FF63C463DE63CE +645263C663BE64456441640B641B6420640C64266421645E6484646D64960000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +5F +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000647A64B764B8649964BA64C064D064D764E464E265096525652E5F0B5FD2 +75195F11535F53F153FD53E953E853FB541254165406544B5452545354545456 +54435421545754595423543254825494547754715464549A549B548454765466 +549D54D054AD54C254B454D254A754A654D354D4547254A354D554BB54BF54CC +54D954DA54DC54A954AA54A454DD54CF54DE551B54E7552054FD551454F35522 +5523550F55115527552A5567558F55B55549556D55415555553F5550553C0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +60 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00005537555655755576557755335530555C558B55D2558355B155B955885581 +559F557E55D65591557B55DF55BD55BE5594559955EA55F755C9561F55D155EB +55EC55D455E655DD55C455EF55E555F255F355CC55CD55E855F555E48F94561E +5608560C56015624562355FE56005627562D565856395657562C564D56625659 +565C564C5654568656645671566B567B567C5685569356AF56D456D756DD56E1 +56F556EB56F956FF5704570A5709571C5E0F5E195E145E115E315E3B5E3C0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +61 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00005E375E445E545E5B5E5E5E615C8C5C7A5C8D5C905C965C885C985C995C91 +5C9A5C9C5CB55CA25CBD5CAC5CAB5CB15CA35CC15CB75CC45CD25CE45CCB5CE5 +5D025D035D275D265D2E5D245D1E5D065D1B5D585D3E5D345D3D5D6C5D5B5D6F +5D5D5D6B5D4B5D4A5D695D745D825D995D9D8C735DB75DC55F735F775F825F87 +5F895F8C5F955F995F9C5FA85FAD5FB55FBC88625F6172AD72B072B472B772B8 +72C372C172CE72CD72D272E872EF72E972F272F472F7730172F3730372FA0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +62 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000072FB731773137321730A731E731D7315732273397325732C733873317350 +734D73577360736C736F737E821B592598E7592459029963996799689969996A +996B996C99749977997D998099849987998A998D999099919993999499955E80 +5E915E8B5E965EA55EA05EB95EB55EBE5EB38D535ED25ED15EDB5EE85EEA81BA +5FC45FC95FD65FCF60035FEE60045FE15FE45FFE600560065FEA5FED5FF86019 +60356026601B600F600D6029602B600A603F602160786079607B607A60420000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +63 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000606A607D6096609A60AD609D60836092608C609B60EC60BB60B160DD60D8 +60C660DA60B4612061266115612360F46100610E612B614A617561AC619461A7 +61B761D461F55FDD96B395E995EB95F195F395F595F695FC95FE960396049606 +9608960A960B960C960D960F96129615961696179619961A4E2C723F62156C35 +6C546C5C6C4A6CA36C856C906C946C8C6C686C696C746C766C866CA96CD06CD4 +6CAD6CF76CF86CF16CD76CB26CE06CD66CFA6CEB6CEE6CB16CD36CEF6CFE0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +64 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00006D396D276D0C6D436D486D076D046D196D0E6D2B6D4D6D2E6D356D1A6D4F +6D526D546D336D916D6F6D9E6DA06D5E6D936D946D5C6D606D7C6D636E1A6DC7 +6DC56DDE6E0E6DBF6DE06E116DE66DDD6DD96E166DAB6E0C6DAE6E2B6E6E6E4E +6E6B6EB26E5F6E866E536E546E326E256E446EDF6EB16E986EE06F2D6EE26EA5 +6EA76EBD6EBB6EB76ED76EB46ECF6E8F6EC26E9F6F626F466F476F246F156EF9 +6F2F6F366F4B6F746F2A6F096F296F896F8D6F8C6F786F726F7C6F7A6FD10000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +65 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00006FC96FA76FB96FB66FC26FE16FEE6FDE6FE06FEF701A7023701B70397035 +704F705E5B805B845B955B935BA55BB8752F9A9E64345BE45BEE89305BF08E47 +8B078FB68FD38FD58FE58FEE8FE48FE98FE68FF38FE890059004900B90269011 +900D9016902190359036902D902F9044905190529050906890589062905B66B9 +9074907D908290889083908B5F505F575F565F585C3B54AB5C505C595B715C63 +5C667FBC5F2A5F295F2D82745F3C9B3B5C6E59815983598D59A959AA59A30000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +66 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000599759CA59AB599E59A459D259B259AF59D759BE5A055A0659DD5A0859E3 +59D859F95A0C5A095A325A345A115A235A135A405A675A4A5A555A3C5A625A75 +80EC5AAA5A9B5A775A7A5ABE5AEB5AB25AD25AD45AB85AE05AE35AF15AD65AE6 +5AD85ADC5B095B175B165B325B375B405C155C1C5B5A5B655B735B515B535B62 +9A759A779A789A7A9A7F9A7D9A809A819A859A889A8A9A909A929A939A969A98 +9A9B9A9C9A9D9A9F9AA09AA29AA39AA59AA77E9F7EA17EA37EA57EA87EA90000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +67 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00007EAD7EB07EBE7EC07EC17EC27EC97ECB7ECC7ED07ED47ED77EDB7EE07EE1 +7EE87EEB7EEE7EEF7EF17EF27F0D7EF67EFA7EFB7EFE7F017F027F037F077F08 +7F0B7F0C7F0F7F117F127F177F197F1C7F1B7F1F7F217F227F237F247F257F26 +7F277F2A7F2B7F2C7F2D7F2F7F307F317F327F337F355E7A757F5DDB753E9095 +738E739173AE73A2739F73CF73C273D173B773B373C073C973C873E573D9987C +740A73E973E773DE73BA73F2740F742A745B7426742574287430742E742C0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +68 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000741B741A7441745C7457745574597477746D747E749C748E748074817487 +748B749E74A874A9749074A774D274BA97EA97EB97EC674C6753675E67486769 +67A56787676A6773679867A7677567A8679E67AD678B6777677C67F0680967D8 +680A67E967B0680C67D967B567DA67B367DD680067C367B867E2680E67C167FD +6832683368606861684E6862684468646883681D68556866684168676840683E +684A6849682968B5688F687468776893686B68C2696E68FC691F692068F90000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +69 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000692468F0690B6901695768E369106971693969606942695D6984696B6980 +69986978693469CC6987698869CE6989696669636979699B69A769BB69AB69AD +69D469B169C169CA69DF699569E0698D69FF6A2F69ED6A176A186A6569F26A44 +6A3E6AA06A506A5B6A356A8E6A796A3D6A286A586A7C6A916A906AA96A976AAB +733773526B816B826B876B846B926B936B8D6B9A6B9B6BA16BAA8F6B8F6D8F71 +8F728F738F758F768F788F778F798F7A8F7C8F7E8F818F828F848F878F8B0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +6A +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00008F8D8F8E8F8F8F988F9A8ECE620B6217621B621F6222622162256224622C +81E774EF74F474FF750F75117513653465EE65EF65F0660A6619677266036615 +6600708566F7661D66346631663666358006665F66546641664F665666616657 +66776684668C66A7669D66BE66DB66DC66E666E98D328D338D368D3B8D3D8D40 +8D458D468D488D498D478D4D8D558D5989C789CA89CB89CC89CE89CF89D089D1 +726E729F725D7266726F727E727F7284728B728D728F72926308633263B00000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +6B +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000643F64D880046BEA6BF36BFD6BF56BF96C056C076C066C0D6C156C186C19 +6C1A6C216C296C246C2A6C3265356555656B724D72527256723086625216809F +809C809380BC670A80BD80B180AB80AD80B480B780E780E880E980EA80DB80C2 +80C480D980CD80D7671080DD80EB80F180F480ED810D810E80F280FC67158112 +8C5A8136811E812C811881328148814C815381748159815A817181608169817C +817D816D8167584D5AB58188818281916ED581A381AA81CC672681CA81BB0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +6C +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000081C181A66B246B376B396B436B466B5998D198D298D398D598D998DA6BB3 +5F406BC289F365909F51659365BC65C665C465C365CC65CE65D265D67080709C +7096709D70BB70C070B770AB70B170E870CA711071137116712F71317173715C +716871457172714A7178717A719871B371B571A871A071E071D471E771F9721D +7228706C7118716671B9623E623D624362486249793B794079467949795B795C +7953795A796279577960796F7967797A7985798A799A79A779B35FD15FD00000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +6D +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000603C605D605A606760416059606360AB6106610D615D61A9619D61CB61D1 +62068080807F6C936CF66DFC77F677F87800780978177818781165AB782D781C +781D7839783A783B781F783C7825782C78237829784E786D7856785778267850 +7847784C786A789B7893789A7887789C78A178A378B278B978A578D478D978C9 +78EC78F2790578F479137924791E79349F9B9EF99EFB9EFC76F17704770D76F9 +77077708771A77227719772D7726773577387750775177477743775A77680000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +6E +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000077627765777F778D777D7780778C7791779F77A077B077B577BD753A7540 +754E754B7548755B7572757975837F587F617F5F8A487F687F747F717F797F81 +7F7E76CD76E58832948594869487948B948A948C948D948F9490949494979495 +949A949B949C94A394A494AB94AA94AD94AC94AF94B094B294B494B694B794B8 +94B994BA94BC94BD94BF94C494C894C994CA94CB94CC94CD94CE94D094D194D2 +94D594D694D794D994D894DB94DE94DF94E094E294E494E594E794E894EA0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +6F +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000094E994EB94EE94EF94F394F494F594F794F994FC94FD94FF950395029506 +95079509950A950D950E950F951295139514951595169518951B951D951E951F +9522952A952B9529952C953195329534953695379538953C953E953F95429535 +9544954595469549954C954E954F9552955395549556955795589559955B955E +955F955D95619562956495659566956795689569956A956B956C956F95719572 +9573953A77E777EC96C979D579ED79E379EB7A065D477A037A027A1E7A140000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +70 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00007A397A377A519ECF99A57A707688768E7693769976A474DE74E0752C9E20 +9E229E289E299E2A9E2B9E2C9E329E319E369E389E379E399E3A9E3E9E419E42 +9E449E469E479E489E499E4B9E4C9E4E9E519E559E579E5A9E5B9E5C9E5E9E63 +9E669E679E689E699E6A9E6B9E6C9E719E6D9E7375927594759675A0759D75AC +75A375B375B475B875C475B175B075C375C275D675CD75E375E875E675E475EB +75E7760375F175FC75FF761076007605760C7617760A76257618761576190000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +71 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000761B763C762276207640762D7630763F76357643763E7633764D765E7654 +765C7656766B766F7FCA7AE67A787A797A807A867A887A957AA67AA07AAC7AA8 +7AAD7AB3886488698872887D887F888288A288C688B788BC88C988E288CE88E3 +88E588F1891A88FC88E888FE88F0892189198913891B890A8934892B89368941 +8966897B758B80E576B276B477DC801280148016801C80208022802580268027 +802980288031800B803580438046804D80528069807189839878988098830000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +72 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00009889988C988D988F9894989A989B989E989F98A198A298A598A6864D8654 +866C866E867F867A867C867B86A8868D868B86AC869D86A786A386AA869386A9 +86B686C486B586CE86B086BA86B186AF86C986CF86B486E986F186F286ED86F3 +86D0871386DE86F486DF86D886D18703870786F88708870A870D87098723873B +871E8725872E871A873E87488734873187298737873F87828722877D877E877B +87608770874C876E878B87538763877C876487598765879387AF87A887D20000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +73 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000087C68788878587AD8797878387AB87E587AC87B587B387CB87D387BD87D1 +87C087CA87DB87EA87E087EE8816881387FE880A881B88218839883C7F367F42 +7F447F4582107AFA7AFD7B087B037B047B157B0A7B2B7B0F7B477B387B2A7B19 +7B2E7B317B207B257B247B337B3E7B1E7B587B5A7B457B757B4C7B5D7B607B6E +7B7B7B627B727B717B907BA67BA77BB87BAC7B9D7BA87B857BAA7B9C7BA27BAB +7BB47BD17BC17BCC7BDD7BDA7BE57BE67BEA7C0C7BFE7BFC7C0F7C167C0B0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +74 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00007C1F7C2A7C267C387C417C4081FE82018202820481EC8844822182228223 +822D822F8228822B8238823B82338234823E82448249824B824F825A825F8268 +887E8885888888D888DF895E7F9D7F9F7FA77FAF7FB07FB27C7C65497C917C9D +7C9C7C9E7CA27CB27CBC7CBD7CC17CC77CCC7CCD7CC87CC57CD77CE8826E66A8 +7FBF7FCE7FD57FE57FE17FE67FE97FEE7FF37CF87D777DA67DAE7E477E9B9EB8 +9EB48D738D848D948D918DB18D678D6D8C478C49914A9150914E914F91640000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +75 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00009162916191709169916F917D917E917291749179918C91859190918D9191 +91A291A391AA91AD91AE91AF91B591B491BA8C559E7E8DB88DEB8E058E598E69 +8DB58DBF8DBC8DBA8DC48DD68DD78DDA8DDE8DCE8DCF8DDB8DC68DEC8DF78DF8 +8DE38DF98DFB8DE48E098DFD8E148E1D8E1F8E2C8E2E8E238E2F8E3A8E408E39 +8E358E3D8E318E498E418E428E518E528E4A8E708E768E7C8E6F8E748E858E8F +8E948E908E9C8E9E8C788C828C8A8C858C988C94659B89D689DE89DA89DC0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +76 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000089E589EB89EF8A3E8B26975396E996F396EF970697019708970F970E972A +972D9730973E9F809F839F859F869F879F889F899F8A9F8C9EFE9F0B9F0D96B9 +96BC96BD96CE96D277BF96E0928E92AE92C8933E936A93CA938F943E946B9C7F +9C829C859C869C879C887A239C8B9C8E9C909C919C929C949C959C9A9C9B9C9E +9C9F9CA09CA19CA29CA39CA59CA69CA79CA89CA99CAB9CAD9CAE9CB09CB19CB2 +9CB39CB49CB59CB69CB79CBA9CBB9CBC9CBD9CC49CC59CC69CC79CCA9CCB0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +77 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00009CCC9CCD9CCE9CCF9CD09CD39CD49CD59CD79CD89CD99CDC9CDD9CDF9CE2 +977C978597919792979497AF97AB97A397B297B49AB19AB09AB79E589AB69ABA +9ABC9AC19AC09AC59AC29ACB9ACC9AD19B459B439B479B499B489B4D9B5198E8 +990D992E995599549ADF9AE19AE69AEF9AEB9AFB9AED9AF99B089B0F9B139B1F +9B239EBD9EBE7E3B9E829E879E889E8B9E9293D69E9D9E9F9EDB9EDC9EDD9EE0 +9EDF9EE29EE99EE79EE59EEA9EEF9F229F2C9F2F9F399F379F3D9F3E9F440000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 diff --git a/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/gb2312.enc b/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/gb2312.enc new file mode 100644 index 0000000000000000000000000000000000000000..4b2f8c73ad798c18c3dbf139e9bdb206e60e0ce2 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/gb2312.enc @@ -0,0 +1,1397 @@ +# Encoding file: euc-cn, multi-byte +M +003F 0 82 +00 +0000000100020003000400050006000700080009000A000B000C000D000E000F +0010001100120013001400150016001700180019001A001B001C001D001E001F +0020002100220023002400250026002700280029002A002B002C002D002E002F +0030003100320033003400350036003700380039003A003B003C003D003E003F +0040004100420043004400450046004700480049004A004B004C004D004E004F +0050005100520053005400550056005700580059005A005B005C005D005E005F +0060006100620063006400650066006700680069006A006B006C006D006E006F +0070007100720073007400750076007700780079007A007B007C007D007E007F +0080008100820083008400850086008700880089008A008B008C008D008E008F +0090009100920093009400950096009700980099009A009B009C009D009E009F +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +A1 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000030003001300230FB02C902C700A8300330052015FF5E2225202620182019 +201C201D3014301530083009300A300B300C300D300E300F3016301730103011 +00B100D700F72236222722282211220F222A222922082237221A22A522252220 +23122299222B222E2261224C2248223D221D2260226E226F22642265221E2235 +22342642264000B0203220332103FF0400A4FFE0FFE1203000A7211626062605 +25CB25CF25CE25C725C625A125A025B325B2203B219221902191219330130000 +A2 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000024882489248A248B248C248D248E248F2490249124922493249424952496 +249724982499249A249B247424752476247724782479247A247B247C247D247E +247F248024812482248324842485248624872460246124622463246424652466 +2467246824690000000032203221322232233224322532263227322832290000 +00002160216121622163216421652166216721682169216A216B000000000000 +A3 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000FF01FF02FF03FFE5FF05FF06FF07FF08FF09FF0AFF0BFF0CFF0DFF0EFF0F +FF10FF11FF12FF13FF14FF15FF16FF17FF18FF19FF1AFF1BFF1CFF1DFF1EFF1F +FF20FF21FF22FF23FF24FF25FF26FF27FF28FF29FF2AFF2BFF2CFF2DFF2EFF2F +FF30FF31FF32FF33FF34FF35FF36FF37FF38FF39FF3AFF3BFF3CFF3DFF3EFF3F +FF40FF41FF42FF43FF44FF45FF46FF47FF48FF49FF4AFF4BFF4CFF4DFF4EFF4F +FF50FF51FF52FF53FF54FF55FF56FF57FF58FF59FF5AFF5BFF5CFF5DFFE30000 +A4 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000304130423043304430453046304730483049304A304B304C304D304E304F +3050305130523053305430553056305730583059305A305B305C305D305E305F +3060306130623063306430653066306730683069306A306B306C306D306E306F +3070307130723073307430753076307730783079307A307B307C307D307E307F +3080308130823083308430853086308730883089308A308B308C308D308E308F +3090309130923093000000000000000000000000000000000000000000000000 +A5 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000030A130A230A330A430A530A630A730A830A930AA30AB30AC30AD30AE30AF +30B030B130B230B330B430B530B630B730B830B930BA30BB30BC30BD30BE30BF +30C030C130C230C330C430C530C630C730C830C930CA30CB30CC30CD30CE30CF +30D030D130D230D330D430D530D630D730D830D930DA30DB30DC30DD30DE30DF +30E030E130E230E330E430E530E630E730E830E930EA30EB30EC30ED30EE30EF +30F030F130F230F330F430F530F6000000000000000000000000000000000000 +A6 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000039103920393039403950396039703980399039A039B039C039D039E039F +03A003A103A303A403A503A603A703A803A90000000000000000000000000000 +000003B103B203B303B403B503B603B703B803B903BA03BB03BC03BD03BE03BF +03C003C103C303C403C503C603C703C803C90000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +A7 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000004100411041204130414041504010416041704180419041A041B041C041D +041E041F0420042104220423042404250426042704280429042A042B042C042D +042E042F00000000000000000000000000000000000000000000000000000000 +000004300431043204330434043504510436043704380439043A043B043C043D +043E043F0440044104420443044404450446044704480449044A044B044C044D +044E044F00000000000000000000000000000000000000000000000000000000 +A8 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000010100E101CE00E0011300E9011B00E8012B00ED01D000EC014D00F301D2 +00F2016B00FA01D400F901D601D801DA01DC00FC00EA00000000000000000000 +0000000000000000000031053106310731083109310A310B310C310D310E310F +3110311131123113311431153116311731183119311A311B311C311D311E311F +3120312131223123312431253126312731283129000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +A9 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00000000000000002500250125022503250425052506250725082509250A250B +250C250D250E250F2510251125122513251425152516251725182519251A251B +251C251D251E251F2520252125222523252425252526252725282529252A252B +252C252D252E252F2530253125322533253425352536253725382539253A253B +253C253D253E253F2540254125422543254425452546254725482549254A254B +0000000000000000000000000000000000000000000000000000000000000000 +B0 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000554A963F57C3632854CE550954C07691764C853C77EE827E788D72319698 +978D6C285B894FFA630966975CB880FA684880AE660276CE51F9655671AC7FF1 +888450B2596561CA6FB382AD634C625253ED54277B06516B75A45DF462D48DCB +9776628A8019575D97387F627238767D67CF767E64464F708D2562DC7A176591 +73ED642C6273822C9881677F7248626E62CC4F3474E3534A529E7ECA90A65E2E +6886699C81807ED168D278C5868C9551508D8C2482DE80DE5305891252650000 +B1 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000858496F94FDD582199715B9D62B162A566B48C799C8D7206676F789160B2 +535153178F8880CC8D1D94A1500D72C8590760EB711988AB595482EF672C7B28 +5D297EF7752D6CF58E668FF8903C9F3B6BD491197B145F7C78A784D6853D6BD5 +6BD96BD65E015E8775F995ED655D5F0A5FC58F9F58C181C2907F965B97AD8FB9 +7F168D2C62414FBF53D8535E8FA88FA98FAB904D68075F6A819888689CD6618B +522B762A5F6C658C6FD26EE85BBE6448517551B067C44E1979C9997C70B30000 +B2 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000075C55E7673BB83E064AD62E894B56CE2535A52C3640F94C27B944F2F5E1B +82368116818A6E246CCA9A736355535C54FA886557E04E0D5E036B657C3F90E8 +601664E6731C88C16750624D8D22776C8E2991C75F6983DC8521991053C28695 +6B8B60ED60E8707F82CD82314ED36CA785CF64CD7CD969FD66F9834953957B56 +4FA7518C6D4B5C428E6D63D253C9832C833667E578B4643D5BDF5C945DEE8BE7 +62C667F48C7A640063BA8749998B8C177F2094F24EA7961098A4660C73160000 +B3 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000573A5C1D5E38957F507F80A05382655E7545553150218D856284949E671D +56326F6E5DE2543570928F66626F64A463A35F7B6F8890F481E38FB05C186668 +5FF16C8996488D81886C649179F057CE6A59621054484E587A0B60E96F848BDA +627F901E9A8B79E4540375F4630153196C608FDF5F1B9A70803B9F7F4F885C3A +8D647FC565A570BD514551B2866B5D075BA062BD916C75748E0C7A2061017B79 +4EC77EF877854E1181ED521D51FA6A7153A88E87950496CF6EC19664695A0000 +B4 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000784050A877D7641089E6590463E35DDD7A7F693D4F20823955984E3275AE +7A975E625E8A95EF521B5439708A6376952457826625693F918755076DF37EAF +882262337EF075B5832878C196CC8F9E614874F78BCD6B64523A8D506B21806A +847156F153064ECE4E1B51D17C97918B7C074FC38E7F7BE17A9C64675D1450AC +810676017CB96DEC7FE067515B585BF878CB64AE641363AA632B9519642D8FBE +7B5476296253592754466B7950A362345E266B864EE38D37888B5F85902E0000 +B5 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00006020803D62C54E39535590F863B880C665E66C2E4F4660EE6DE18BDE5F39 +86CB5F536321515A83616863520063638E4850125C9B79775BFC52307A3B60BC +905376D75FB75F9776848E6C706F767B7B4977AA51F3909358244F4E6EF48FEA +654C7B1B72C46DA47FDF5AE162B55E95573084827B2C5E1D5F1F90127F1498A0 +63826EC7789870B95178975B57AB75354F4375385E9760E659606DC06BBF7889 +53FC96D551CB52016389540A94938C038DCC7239789F87768FED8C0D53E00000 +B6 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00004E0176EF53EE948998769F0E952D5B9A8BA24E224E1C51AC846361C252A8 +680B4F97606B51BB6D1E515C6296659796618C46901775D890FD77636BD2728A +72EC8BFB583577798D4C675C9540809A5EA66E2159927AEF77ED953B6BB565AD +7F0E58065151961F5BF958A954288E726566987F56E4949D76FE9041638754C6 +591A593A579B8EB267358DFA8235524160F0581586FE5CE89E454FC4989D8BB9 +5A2560765384627C904F9102997F6069800C513F80335C1499756D314E8C0000 +B7 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00008D3053D17F5A7B4F4F104E4F96006CD573D085E95E06756A7FFB6A0A77FE +94927E4151E170E653CD8FD483038D2972AF996D6CDB574A82B365B980AA623F +963259A84EFF8BBF7EBA653E83F2975E556198DE80A5532A8BFD542080BA5E9F +6CB88D3982AC915A54296C1B52067EB7575F711A6C7E7C89594B4EFD5FFF6124 +7CAA4E305C0167AB87025CF0950B98CE75AF70FD902251AF7F1D8BBD594951E4 +4F5B5426592B657780A45B75627662C28F905E456C1F7B264F0F4FD8670D0000 +B8 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00006D6E6DAA798F88B15F17752B629A8F854FEF91DC65A7812F81515E9C8150 +8D74526F89868D4B590D50854ED8961C723681798D1F5BCC8BA3964459877F1A +54905676560E8BE565396982949976D66E895E727518674667D17AFF809D8D76 +611F79C665628D635188521A94A27F38809B7EB25C976E2F67607BD9768B9AD8 +818F7F947CD5641E95507A3F544A54E56B4C640162089E3D80F3759952729769 +845B683C86E49601969494EC4E2A54047ED968398DDF801566F45E9A7FB90000 +B9 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000057C2803F68975DE5653B529F606D9F9A4F9B8EAC516C5BAB5F135DE96C5E +62F18D21517194A952FE6C9F82DF72D757A267848D2D591F8F9C83C754957B8D +4F306CBD5B6459D19F1353E486CA9AA88C3780A16545987E56FA96C7522E74DC +52505BE1630289024E5662D0602A68FA51735B9851A089C27BA199867F5060EF +704C8D2F51495E7F901B747089C4572D78455F529F9F95FA8F689B3C8BE17678 +684267DC8DEA8D35523D8F8A6EDA68CD950590ED56FD679C88F98FC754C80000 +BA +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00009AB85B696D776C264EA55BB39A87916361A890AF97E9542B6DB55BD251FD +558A7F557FF064BC634D65F161BE608D710A6C576C49592F676D822A58D5568E +8C6A6BEB90DD597D801753F76D695475559D837783CF683879BE548C4F555408 +76D28C8996026CB36DB88D6B89109E648D3A563F9ED175D55F8872E0606854FC +4EA86A2A886160528F7054C470D886799E3F6D2A5B8F5F187EA255894FAF7334 +543C539A5019540E547C4E4E5FFD745A58F6846B80E1877472D07CCA6E560000 +BB +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00005F27864E552C62A44E926CAA623782B154D7534E733E6ED1753B52125316 +8BDD69D05F8A60006DEE574F6B2273AF68538FD87F13636260A3552475EA8C62 +71156DA35BA65E7B8352614C9EC478FA87577C27768751F060F6714C66435E4C +604D8C0E707063258F895FBD606286D456DE6BC160946167534960E066668D3F +79FD4F1A70E96C478BB38BF27ED88364660F5A5A9B426D516DF78C416D3B4F19 +706B83B7621660D1970D8D27797851FB573E57FA673A75787A3D79EF7B950000 +BC +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000808C99658FF96FC08BA59E2159EC7EE97F095409678168D88F917C4D96C6 +53CA602575BE6C7253735AC97EA7632451E0810A5DF184DF628051805B634F0E +796D524260B86D4E5BC45BC28BA18BB065E25FCC964559937EE77EAA560967B7 +59394F735BB652A0835A988A8D3E753294BE50477A3C4EF767B69A7E5AC16B7C +76D1575A5C167B3A95F4714E517C80A9827059787F04832768C067EC78B17877 +62E363617B804FED526A51CF835069DB92748DF58D3189C1952E7BAD4EF60000 +BD +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000506582305251996F6E106E856DA75EFA50F559DC5C066D466C5F7586848B +686859568BB253209171964D854969127901712680F64EA490CA6D479A845A07 +56BC640594F077EB4FA5811A72E189D2997A7F347EDE527F655991758F7F8F83 +53EB7A9663ED63A5768679F888579636622A52AB8282685467706377776B7AED +6D017ED389E359D0621285C982A5754C501F4ECB75A58BEB5C4A5DFE7B4B65A4 +91D14ECA6D25895F7D2795264EC58C288FDB9773664B79818FD170EC6D780000 +BE +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00005C3D52B283465162830E775B66769CB84EAC60CA7CBE7CB37ECF4E958B66 +666F988897595883656C955C5F8475C997567ADF7ADE51C070AF7A9863EA7A76 +7EA0739697ED4E4570784E5D915253A9655165E781FC8205548E5C31759A97A0 +62D872D975BD5C459A7983CA5C40548077E94E3E6CAE805A62D2636E5DE85177 +8DDD8E1E952F4FF153E560E770AC526763509E435A1F5026773753777EE26485 +652B628963985014723589C951B38BC07EDD574783CC94A7519B541B5CFB0000 +BF +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00004FCA7AE36D5A90E19A8F55805496536154AF5F0063E9697751EF6168520A +582A52D8574E780D770B5EB761777CE0625B62974EA27095800362F770E49760 +577782DB67EF68F578D5989779D158F354B353EF6E34514B523B5BA28BFE80AF +554357A660735751542D7A7A60505B5463A762A053E362635BC767AF54ED7A9F +82E691775E9388E4593857AE630E8DE880EF57577B774FA95FEB5BBD6B3E5321 +7B5072C2684677FF773665F751B54E8F76D45CBF7AA58475594E9B4150800000 +C0 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000998861276E8357646606634656F062EC62695ED39614578362C955878721 +814A8FA3556683B167658D5684DD5A6A680F62E67BEE961151706F9C8C3063FD +89C861D27F0670C26EE57405699472FC5ECA90CE67176D6A635E52B372628001 +4F6C59E5916A70D96D9D52D24E5096F7956D857E78CA7D2F5121579264C2808B +7C7B6CEA68F1695E51B7539868A872819ECE7BF172F879BB6F137406674E91CC +9CA4793C83898354540F68174E3D538952B1783E5386522950884F8B4FD00000 +C1 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000075E27ACB7C926CA596B6529B748354E94FE9805483B28FDE95705EC9601C +6D9F5E18655B813894FE604B70BC7EC37CAE51C968817CB1826F4E248F8691CF +667E4EAE8C0564A9804A50DA759771CE5BE58FBD6F664E86648295635ED66599 +521788C270C852A3730E7433679778F797164E3490BB9CDE6DCB51DB8D41541D +62CE73B283F196F69F8494C34F367F9A51CC707596755CAD988653E64EE46E9C +740969B4786B998F7559521876246D4167F3516D9F99804B54997B3C7ABF0000 +C2 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00009686578462E29647697C5A0464027BD36F0F964B82A6536298855E907089 +63B35364864F9C819E93788C97328DEF8D429E7F6F5E79845F559646622E9A74 +541594DD4FA365C55C655C617F1586516C2F5F8B73876EE47EFF5CE6631B5B6A +6EE653754E7163A0756562A18F6E4F264ED16CA67EB68BBA841D87BA7F57903B +95237BA99AA188F8843D6D1B9A867EDC59889EBB739B780186829A6C9A82561B +541757CB4E709EA653568FC881097792999286EE6EE1851366FC61626F2B0000 +C3 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00008C298292832B76F26C135FD983BD732B8305951A6BDB77DB94C6536F8302 +51925E3D8C8C8D384E4873AB679A68859176970971646CA177095A9295416BCF +7F8E66275BD059B95A9A95E895F74EEC840C84996AAC76DF9530731B68A65B5F +772F919A97617CDC8FF78C1C5F257C7379D889C56CCC871C5BC65E4268C97720 +7EF55195514D52C95A297F05976282D763CF778485D079D26E3A5E9959998511 +706D6C1162BF76BF654F60AF95FD660E879F9E2394ED540D547D8C2C64780000 +C4 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000647986116A21819C78E864699B5462B9672B83AB58A89ED86CAB6F205BDE +964C8C0B725F67D062C772614EA959C66BCD589366AE5E5552DF6155672876EE +776672677A4662FF54EA545094A090A35A1C7EB36C164E435976801059485357 +753796BE56CA63208111607C95F96DD65462998151855AE980FD59AE9713502A +6CE55C3C62DF4F60533F817B90066EBA852B62C85E7478BE64B5637B5FF55A18 +917F9E1F5C3F634F80425B7D556E954A954D6D8560A867E072DE51DD5B810000 +C5 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000062E76CDE725B626D94AE7EBD81136D53519C5F04597452AA601259736696 +8650759F632A61E67CEF8BFA54E66B279E256BB485D5545550766CA4556A8DB4 +722C5E156015743662CD6392724C5F986E436D3E65006F5876D878D076FC7554 +522453DB4E535E9E65C1802A80D6629B5486522870AE888D8DD16CE1547880DA +57F988F48D54966A914D4F696C9B55B776C6783062A870F96F8E5F6D84EC68DA +787C7BF781A8670B9E4F636778B0576F78129739627962AB528874356BD70000 +C6 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00005564813E75B276AE533975DE50FB5C418B6C7BC7504F72479A9798D86F02 +74E27968648777A562FC98918D2B54C180584E52576A82F9840D5E7351ED74F6 +8BC45C4F57616CFC98875A4678349B448FEB7C955256625194FA4EC683868461 +83E984B257D467345703666E6D668C3166DD7011671F6B3A6816621A59BB4E03 +51C46F0667D26C8F517668CB59476B6775665D0E81109F5065D7794879419A91 +8D775C824E5E4F01542F5951780C56686C148FC45F036C7D6CE38BAB63900000 +C7 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000060706D3D72756266948E94C553438FC17B7E4EDF8C264E7E9ED494B194B3 +524D6F5C90636D458C3458115D4C6B206B4967AA545B81547F8C589985375F3A +62A26A47953965726084686577A74E544FA85DE7979864AC7FD85CED4FCF7A8D +520783044E14602F7A8394A64FB54EB279E6743452E482B964D279BD5BDD6C81 +97528F7B6C22503E537F6E0564CE66746C3060C598778BF75E86743C7A7779CB +4E1890B174036C4256DA914B6CC58D8B533A86C666F28EAF5C489A716E200000 +C8 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000053D65A369F8B8DA353BB570898A76743919B6CC9516875CA62F372AC5238 +529D7F3A7094763853749E4A69B7786E96C088D97FA4713671C3518967D374E4 +58E4651856B78BA9997662707ED560F970ED58EC4EC14EBA5FCD97E74EFB8BA4 +5203598A7EAB62544ECD65E5620E833884C98363878D71946EB65BB97ED25197 +63C967D480898339881551125B7A59828FB14E736C5D516589258F6F962E854A +745E951095F06DA682E55F3164926D128428816E9CC3585E8D5B4E0953C10000 +C9 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00004F1E6563685155D34E2764149A9A626B5AC2745F82726DA968EE50E7838E +7802674052396C997EB150BB5565715E7B5B665273CA82EB67495C715220717D +886B95EA965564C58D6181B355846C5562477F2E58924F2455468D4F664C4E0A +5C1A88F368A2634E7A0D70E7828D52FA97F65C1154E890B57ECD59628D4A86C7 +820C820D8D6664445C0461516D89793E8BBE78377533547B4F388EAB6DF15A20 +7EC5795E6C885BA15A76751A80BE614E6E1758F0751F7525727253477EF30000 +CA +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000770176DB526980DC57235E08593172EE65BD6E7F8BD75C388671534177F3 +62FE65F64EC098DF86805B9E8BC653F277E24F7F5C4E9A7659CB5F0F793A58EB +4E1667FF4E8B62ED8A93901D52BF662F55DC566C90024ED54F8D91CA99706C0F +5E0260435BA489C68BD56536624B99965B885BFF6388552E53D77626517D852C +67A268B36B8A62928F9353D482126DD1758F4E668D4E5B70719F85AF669166D9 +7F7287009ECD9F205C5E672F8FF06811675F620D7AD658855EB665706F310000 +CB +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000060555237800D6454887075295E05681362F4971C53CC723D8C016C347761 +7A0E542E77AC987A821C8BF47855671470C165AF64955636601D79C153F84E1D +6B7B80865BFA55E356DB4F3A4F3C99725DF3677E80386002988290015B8B8BBC +8BF5641C825864DE55FD82CF91654FD77D20901F7C9F50F358516EAF5BBF8BC9 +80839178849C7B97867D968B968F7EE59AD3788E5C817A57904296A7795F5B59 +635F7B0B84D168AD55067F2974107D2295016240584C4ED65B83597958540000 +CC +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000736D631E8E4B8E0F80CE82D462AC53F06CF0915E592A60016C70574D644A +8D2A762B6EE9575B6A8075F06F6D8C2D8C0857666BEF889278B363A253F970AD +6C645858642A580268E0819B55107CD650188EBA6DCC8D9F70EB638F6D9B6ED4 +7EE68404684390036DD896768BA85957727985E4817E75BC8A8A68AF52548E22 +951163D098988E44557C4F5366FF568F60D56D9552435C4959296DFB586B7530 +751C606C82148146631167618FE2773A8DF38D3494C15E165385542C70C30000 +CD +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00006C405EF7505C4EAD5EAD633A8247901A6850916E77B3540C94DC5F647AE5 +687663457B527EDF75DB507762955934900F51F879C37A8156FE5F9290146D82 +5C60571F541051546E4D56E263A89893817F8715892A9000541E5C6F81C062D6 +625881319E3596409A6E9A7C692D59A562D3553E631654C786D96D3C5A0374E6 +889C6B6A59168C4C5F2F6E7E73A9987D4E3870F75B8C7897633D665A769660CB +5B9B5A494E0781556C6A738B4EA167897F515F8065FA671B5FD859845A010000 +CE +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00005DCD5FAE537197E68FDD684556F4552F60DF4E3A6F4D7EF482C7840E59D4 +4F1F4F2A5C3E7EAC672A851A5473754F80C355829B4F4F4D6E2D8C135C096170 +536B761F6E29868A658795FB7EB9543B7A337D0A95EE55E17FC174EE631D8717 +6DA17A9D621165A1536763E16C835DEB545C94A84E4C6C618BEC5C4B65E0829C +68A7543E54346BCB6B664E9463425348821E4F0D4FAE575E620A96FE66647269 +52FF52A1609F8BEF661471996790897F785277FD6670563B54389521727A0000 +CF +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00007A00606F5E0C6089819D591560DC718470EF6EAA6C5072806A8488AD5E2D +4E605AB3559C94E36D177CFB9699620F7EC6778E867E5323971E8F9666875CE1 +4FA072ED4E0B53A6590F54136380952851484ED99C9C7EA454B88D2488548237 +95F26D8E5F265ACC663E966973B0732E53BF817A99857FA15BAA967796507EBF +76F853A2957699997BB189446E584E617FD479658BE660F354CD4EAB98795DF7 +6A6150CF54118C618427785D9704524A54EE56A395006D885BB56DC666530000 +D0 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00005C0F5B5D6821809655787B11654869544E9B6B47874E978B534F631F643A +90AA659C80C18C10519968B0537887F961C86CC46CFB8C225C5185AA82AF950C +6B238F9B65B05FFB5FC34FE18845661F8165732960FA51745211578B5F6290A2 +884C91925E78674F602759D3514451F680F853086C7996C4718A4F114FEE7F9E +673D55C5950879C088967EE3589F620C9700865A5618987B5F908BB884C49157 +53D965ED5E8F755C60647D6E5A7F7EEA7EED8F6955A75BA360AC65CB73840000 +D1 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00009009766377297EDA9774859B5B667A7496EA884052CB718F5FAA65EC8BE2 +5BFB9A6F5DE16B896C5B8BAD8BAF900A8FC5538B62BC9E269E2D54404E2B82BD +7259869C5D1688596DAF96C554D14E9A8BB6710954BD960970DF6DF976D04E25 +781487125CA95EF68A00989C960E708E6CBF594463A9773C884D6F1482735830 +71D5538C781A96C155015F6671305BB48C1A9A8C6B83592E9E2F79E76768626C +4F6F75A17F8A6D0B96336C274EF075D2517B68376F3E90808170599674760000 +D2 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000064475C2790657A918C2359DA54AC8200836F898180006930564E80367237 +91CE51B64E5F987563964E1A53F666F3814B591C6DB24E0058F9533B63D694F1 +4F9D4F0A886398905937905779FB4EEA80F075916C825B9C59E85F5D69058681 +501A5DF24E5977E34EE5827A6291661390915C794EBF5F7981C69038808475AB +4EA688D4610F6BC55FC64E4976CA6EA28BE38BAE8C0A8BD15F027FFC7FCC7ECE +8335836B56E06BB797F3963459FB541F94F66DEB5BC5996E5C395F1596900000 +D3 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000537082F16A315A749E705E947F2883B984248425836787478FCE8D6276C8 +5F719896786C662054DF62E54F6381C375C85EB896CD8E0A86F9548F6CF36D8C +6C38607F52C775285E7D4F1860A05FE75C24753190AE94C072B96CB96E389149 +670953CB53F34F5191C98BF153C85E7C8FC26DE44E8E76C26986865E611A8206 +4F594FDE903E9C7C61096E1D6E1496854E885A3196E84E0E5C7F79B95B878BED +7FBD738957DF828B90C15401904755BB5CEA5FA161086B3272F180B28A890000 +D4 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00006D745BD388D598848C6B9A6D9E336E0A51A4514357A38881539F63F48F95 +56ED54585706733F6E907F188FDC82D1613F6028966266F07EA68D8A8DC394A5 +5CB37CA4670860A6960580184E9190E75300966851418FD08574915D665597F5 +5B55531D78386742683D54C9707E5BB08F7D518D572854B1651266828D5E8D43 +810F846C906D7CDF51FF85FB67A365E96FA186A48E81566A90207682707671E5 +8D2362E952196CFD8D3C600E589E618E66FE8D60624E55B36E23672D8F670000 +D5 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000094E195F87728680569A8548B4E4D70B88BC86458658B5B857A84503A5BE8 +77BB6BE18A797C986CBE76CF65A98F975D2D5C5586386808536062187AD96E5B +7EFD6A1F7AE05F706F335F20638C6DA867564E085E108D264ED780C07634969C +62DB662D627E6CBC8D7571677F695146808753EC906E629854F286F08F998005 +951785178FD96D5973CD659F771F7504782781FB8D1E94884FA6679575B98BCA +9707632F9547963584B8632377415F8172F04E896014657462EF6B63653F0000 +D6 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00005E2775C790D18BC1829D679D652F5431871877E580A281026C414E4B7EC7 +804C76F4690D6B966267503C4F84574063076B628DBE53EA65E87EB85FD7631A +63B781F381F47F6E5E1C5CD95236667A79E97A1A8D28709975D46EDE6CBB7A92 +4E2D76C55FE0949F88777EC879CD80BF91CD4EF24F17821F54685DDE6D328BCC +7CA58F7480985E1A549276B15B99663C9AA473E0682A86DB6731732A8BF88BDB +90107AF970DB716E62C477A956314E3B845767F152A986C08D2E94F87B510000 +D7 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00004F4F6CE8795D9A7B6293722A62FD4E1378168F6C64B08D5A7BC668695E84 +88C55986649E58EE72B6690E95258FFD8D5857607F008C0651C6634962D95353 +684C74228301914C55447740707C6D4A517954A88D4459FF6ECB6DC45B5C7D2B +4ED47C7D6ED35B5081EA6E0D5B579B0368D58E2A5B977EFC603B7EB590B98D70 +594F63CD79DF8DB3535265CF79568BC5963B7EC494BB7E825634918967007F6A +5C0A907566285DE64F5067DE505A4F5C57505EA7000000000000000000000000 +D8 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00004E8D4E0C51404E105EFF53454E154E984E1E9B325B6C56694E2879BA4E3F +53154E47592D723B536E6C1056DF80E499976BD3777E9F174E364E9F9F104E5C +4E694E9382885B5B556C560F4EC4538D539D53A353A553AE97658D5D531A53F5 +5326532E533E8D5C5366536352025208520E522D5233523F5240524C525E5261 +525C84AF527D528252815290529351827F544EBB4EC34EC94EC24EE84EE14EEB +4EDE4F1B4EF34F224F644EF54F254F274F094F2B4F5E4F6765384F5A4F5D0000 +D9 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00004F5F4F574F324F3D4F764F744F914F894F834F8F4F7E4F7B4FAA4F7C4FAC +4F944FE64FE84FEA4FC54FDA4FE34FDC4FD14FDF4FF85029504C4FF3502C500F +502E502D4FFE501C500C50255028507E504350555048504E506C507B50A550A7 +50A950BA50D6510650ED50EC50E650EE5107510B4EDD6C3D4F584F654FCE9FA0 +6C467C74516E5DFD9EC999985181591452F9530D8A07531051EB591951554EA0 +51564EB3886E88A44EB5811488D279805B3488037FB851AB51B151BD51BC0000 +DA +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000051C7519651A251A58BA08BA68BA78BAA8BB48BB58BB78BC28BC38BCB8BCF +8BCE8BD28BD38BD48BD68BD88BD98BDC8BDF8BE08BE48BE88BE98BEE8BF08BF3 +8BF68BF98BFC8BFF8C008C028C048C078C0C8C0F8C118C128C148C158C168C19 +8C1B8C188C1D8C1F8C208C218C258C278C2A8C2B8C2E8C2F8C328C338C358C36 +5369537A961D962296219631962A963D963C964296499654965F9667966C9672 +96749688968D969796B09097909B909D909990AC90A190B490B390B690BA0000 +DB +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000090B890B090CF90C590BE90D090C490C790D390E690E290DC90D790DB90EB +90EF90FE91049122911E91239131912F913991439146520D594252A252AC52AD +52BE54FF52D052D652F053DF71EE77CD5EF451F551FC9B2F53B65F01755A5DEF +574C57A957A1587E58BC58C558D15729572C572A57335739572E572F575C573B +574257695785576B5786577C577B5768576D5776577357AD57A4578C57B257CF +57A757B4579357A057D557D857DA57D957D257B857F457EF57F857E457DD0000 +DC +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000580B580D57FD57ED5800581E5819584458205865586C58815889589A5880 +99A89F1961FF8279827D827F828F828A82A88284828E82918297829982AB82B8 +82BE82B082C882CA82E3829882B782AE82CB82CC82C182A982B482A182AA829F +82C482CE82A482E1830982F782E4830F830782DC82F482D282D8830C82FB82D3 +8311831A83068314831582E082D5831C8351835B835C83088392833C83348331 +839B835E832F834F83478343835F834083178360832D833A8333836683650000 +DD +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00008368831B8369836C836A836D836E83B0837883B383B483A083AA8393839C +8385837C83B683A9837D83B8837B8398839E83A883BA83BC83C1840183E583D8 +58078418840B83DD83FD83D6841C84388411840683D483DF840F840383F883F9 +83EA83C583C0842683F083E1845C8451845A8459847384878488847A84898478 +843C844684698476848C848E8431846D84C184CD84D084E684BD84D384CA84BF +84BA84E084A184B984B4849784E584E3850C750D853884F08539851F853A0000 +DE +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00008556853B84FF84FC8559854885688564855E857A77A285438572857B85A4 +85A88587858F857985AE859C858585B985B785B085D385C185DC85FF86278605 +86298616863C5EFE5F08593C594180375955595A5958530F5C225C255C2C5C34 +624C626A629F62BB62CA62DA62D762EE632262F66339634B634363AD63F66371 +637A638E63B4636D63AC638A636963AE63BC63F263F863E063FF63C463DE63CE +645263C663BE64456441640B641B6420640C64266421645E6484646D64960000 +DF +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000647A64B764B8649964BA64C064D064D764E464E265096525652E5F0B5FD2 +75195F11535F53F153FD53E953E853FB541254165406544B5452545354545456 +54435421545754595423543254825494547754715464549A549B548454765466 +549D54D054AD54C254B454D254A754A654D354D4547254A354D554BB54BF54CC +54D954DA54DC54A954AA54A454DD54CF54DE551B54E7552054FD551454F35522 +5523550F55115527552A5567558F55B55549556D55415555553F5550553C0000 +E0 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00005537555655755576557755335530555C558B55D2558355B155B955885581 +559F557E55D65591557B55DF55BD55BE5594559955EA55F755C9561F55D155EB +55EC55D455E655DD55C455EF55E555F255F355CC55CD55E855F555E48F94561E +5608560C56015624562355FE56005627562D565856395657562C564D56625659 +565C564C5654568656645671566B567B567C5685569356AF56D456D756DD56E1 +56F556EB56F956FF5704570A5709571C5E0F5E195E145E115E315E3B5E3C0000 +E1 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00005E375E445E545E5B5E5E5E615C8C5C7A5C8D5C905C965C885C985C995C91 +5C9A5C9C5CB55CA25CBD5CAC5CAB5CB15CA35CC15CB75CC45CD25CE45CCB5CE5 +5D025D035D275D265D2E5D245D1E5D065D1B5D585D3E5D345D3D5D6C5D5B5D6F +5D5D5D6B5D4B5D4A5D695D745D825D995D9D8C735DB75DC55F735F775F825F87 +5F895F8C5F955F995F9C5FA85FAD5FB55FBC88625F6172AD72B072B472B772B8 +72C372C172CE72CD72D272E872EF72E972F272F472F7730172F3730372FA0000 +E2 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000072FB731773137321730A731E731D7315732273397325732C733873317350 +734D73577360736C736F737E821B592598E7592459029963996799689969996A +996B996C99749977997D998099849987998A998D999099919993999499955E80 +5E915E8B5E965EA55EA05EB95EB55EBE5EB38D535ED25ED15EDB5EE85EEA81BA +5FC45FC95FD65FCF60035FEE60045FE15FE45FFE600560065FEA5FED5FF86019 +60356026601B600F600D6029602B600A603F602160786079607B607A60420000 +E3 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000606A607D6096609A60AD609D60836092608C609B60EC60BB60B160DD60D8 +60C660DA60B4612061266115612360F46100610E612B614A617561AC619461A7 +61B761D461F55FDD96B395E995EB95F195F395F595F695FC95FE960396049606 +9608960A960B960C960D960F96129615961696179619961A4E2C723F62156C35 +6C546C5C6C4A6CA36C856C906C946C8C6C686C696C746C766C866CA96CD06CD4 +6CAD6CF76CF86CF16CD76CB26CE06CD66CFA6CEB6CEE6CB16CD36CEF6CFE0000 +E4 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00006D396D276D0C6D436D486D076D046D196D0E6D2B6D4D6D2E6D356D1A6D4F +6D526D546D336D916D6F6D9E6DA06D5E6D936D946D5C6D606D7C6D636E1A6DC7 +6DC56DDE6E0E6DBF6DE06E116DE66DDD6DD96E166DAB6E0C6DAE6E2B6E6E6E4E +6E6B6EB26E5F6E866E536E546E326E256E446EDF6EB16E986EE06F2D6EE26EA5 +6EA76EBD6EBB6EB76ED76EB46ECF6E8F6EC26E9F6F626F466F476F246F156EF9 +6F2F6F366F4B6F746F2A6F096F296F896F8D6F8C6F786F726F7C6F7A6FD10000 +E5 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00006FC96FA76FB96FB66FC26FE16FEE6FDE6FE06FEF701A7023701B70397035 +704F705E5B805B845B955B935BA55BB8752F9A9E64345BE45BEE89305BF08E47 +8B078FB68FD38FD58FE58FEE8FE48FE98FE68FF38FE890059004900B90269011 +900D9016902190359036902D902F9044905190529050906890589062905B66B9 +9074907D908290889083908B5F505F575F565F585C3B54AB5C505C595B715C63 +5C667FBC5F2A5F295F2D82745F3C9B3B5C6E59815983598D59A959AA59A30000 +E6 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000599759CA59AB599E59A459D259B259AF59D759BE5A055A0659DD5A0859E3 +59D859F95A0C5A095A325A345A115A235A135A405A675A4A5A555A3C5A625A75 +80EC5AAA5A9B5A775A7A5ABE5AEB5AB25AD25AD45AB85AE05AE35AF15AD65AE6 +5AD85ADC5B095B175B165B325B375B405C155C1C5B5A5B655B735B515B535B62 +9A759A779A789A7A9A7F9A7D9A809A819A859A889A8A9A909A929A939A969A98 +9A9B9A9C9A9D9A9F9AA09AA29AA39AA59AA77E9F7EA17EA37EA57EA87EA90000 +E7 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00007EAD7EB07EBE7EC07EC17EC27EC97ECB7ECC7ED07ED47ED77EDB7EE07EE1 +7EE87EEB7EEE7EEF7EF17EF27F0D7EF67EFA7EFB7EFE7F017F027F037F077F08 +7F0B7F0C7F0F7F117F127F177F197F1C7F1B7F1F7F217F227F237F247F257F26 +7F277F2A7F2B7F2C7F2D7F2F7F307F317F327F337F355E7A757F5DDB753E9095 +738E739173AE73A2739F73CF73C273D173B773B373C073C973C873E573D9987C +740A73E973E773DE73BA73F2740F742A745B7426742574287430742E742C0000 +E8 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000741B741A7441745C7457745574597477746D747E749C748E748074817487 +748B749E74A874A9749074A774D274BA97EA97EB97EC674C6753675E67486769 +67A56787676A6773679867A7677567A8679E67AD678B6777677C67F0680967D8 +680A67E967B0680C67D967B567DA67B367DD680067C367B867E2680E67C167FD +6832683368606861684E6862684468646883681D68556866684168676840683E +684A6849682968B5688F687468776893686B68C2696E68FC691F692068F90000 +E9 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000692468F0690B6901695768E369106971693969606942695D6984696B6980 +69986978693469CC6987698869CE6989696669636979699B69A769BB69AB69AD +69D469B169C169CA69DF699569E0698D69FF6A2F69ED6A176A186A6569F26A44 +6A3E6AA06A506A5B6A356A8E6A796A3D6A286A586A7C6A916A906AA96A976AAB +733773526B816B826B876B846B926B936B8D6B9A6B9B6BA16BAA8F6B8F6D8F71 +8F728F738F758F768F788F778F798F7A8F7C8F7E8F818F828F848F878F8B0000 +EA +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00008F8D8F8E8F8F8F988F9A8ECE620B6217621B621F6222622162256224622C +81E774EF74F474FF750F75117513653465EE65EF65F0660A6619677266036615 +6600708566F7661D66346631663666358006665F66546641664F665666616657 +66776684668C66A7669D66BE66DB66DC66E666E98D328D338D368D3B8D3D8D40 +8D458D468D488D498D478D4D8D558D5989C789CA89CB89CC89CE89CF89D089D1 +726E729F725D7266726F727E727F7284728B728D728F72926308633263B00000 +EB +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000643F64D880046BEA6BF36BFD6BF56BF96C056C076C066C0D6C156C186C19 +6C1A6C216C296C246C2A6C3265356555656B724D72527256723086625216809F +809C809380BC670A80BD80B180AB80AD80B480B780E780E880E980EA80DB80C2 +80C480D980CD80D7671080DD80EB80F180F480ED810D810E80F280FC67158112 +8C5A8136811E812C811881328148814C815381748159815A817181608169817C +817D816D8167584D5AB58188818281916ED581A381AA81CC672681CA81BB0000 +EC +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000081C181A66B246B376B396B436B466B5998D198D298D398D598D998DA6BB3 +5F406BC289F365909F51659365BC65C665C465C365CC65CE65D265D67080709C +7096709D70BB70C070B770AB70B170E870CA711071137116712F71317173715C +716871457172714A7178717A719871B371B571A871A071E071D471E771F9721D +7228706C7118716671B9623E623D624362486249793B794079467949795B795C +7953795A796279577960796F7967797A7985798A799A79A779B35FD15FD00000 +ED +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000603C605D605A606760416059606360AB6106610D615D61A9619D61CB61D1 +62068080807F6C936CF66DFC77F677F87800780978177818781165AB782D781C +781D7839783A783B781F783C7825782C78237829784E786D7856785778267850 +7847784C786A789B7893789A7887789C78A178A378B278B978A578D478D978C9 +78EC78F2790578F479137924791E79349F9B9EF99EFB9EFC76F17704770D76F9 +77077708771A77227719772D7726773577387750775177477743775A77680000 +EE +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000077627765777F778D777D7780778C7791779F77A077B077B577BD753A7540 +754E754B7548755B7572757975837F587F617F5F8A487F687F747F717F797F81 +7F7E76CD76E58832948594869487948B948A948C948D948F9490949494979495 +949A949B949C94A394A494AB94AA94AD94AC94AF94B094B294B494B694B794B8 +94B994BA94BC94BD94BF94C494C894C994CA94CB94CC94CD94CE94D094D194D2 +94D594D694D794D994D894DB94DE94DF94E094E294E494E594E794E894EA0000 +EF +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000094E994EB94EE94EF94F394F494F594F794F994FC94FD94FF950395029506 +95079509950A950D950E950F951295139514951595169518951B951D951E951F +9522952A952B9529952C953195329534953695379538953C953E953F95429535 +9544954595469549954C954E954F9552955395549556955795589559955B955E +955F955D95619562956495659566956795689569956A956B956C956F95719572 +9573953A77E777EC96C979D579ED79E379EB7A065D477A037A027A1E7A140000 +F0 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00007A397A377A519ECF99A57A707688768E7693769976A474DE74E0752C9E20 +9E229E289E299E2A9E2B9E2C9E329E319E369E389E379E399E3A9E3E9E419E42 +9E449E469E479E489E499E4B9E4C9E4E9E519E559E579E5A9E5B9E5C9E5E9E63 +9E669E679E689E699E6A9E6B9E6C9E719E6D9E7375927594759675A0759D75AC +75A375B375B475B875C475B175B075C375C275D675CD75E375E875E675E475EB +75E7760375F175FC75FF761076007605760C7617760A76257618761576190000 +F1 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000761B763C762276207640762D7630763F76357643763E7633764D765E7654 +765C7656766B766F7FCA7AE67A787A797A807A867A887A957AA67AA07AAC7AA8 +7AAD7AB3886488698872887D887F888288A288C688B788BC88C988E288CE88E3 +88E588F1891A88FC88E888FE88F0892189198913891B890A8934892B89368941 +8966897B758B80E576B276B477DC801280148016801C80208022802580268027 +802980288031800B803580438046804D80528069807189839878988098830000 +F2 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00009889988C988D988F9894989A989B989E989F98A198A298A598A6864D8654 +866C866E867F867A867C867B86A8868D868B86AC869D86A786A386AA869386A9 +86B686C486B586CE86B086BA86B186AF86C986CF86B486E986F186F286ED86F3 +86D0871386DE86F486DF86D886D18703870786F88708870A870D87098723873B +871E8725872E871A873E87488734873187298737873F87828722877D877E877B +87608770874C876E878B87538763877C876487598765879387AF87A887D20000 +F3 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000087C68788878587AD8797878387AB87E587AC87B587B387CB87D387BD87D1 +87C087CA87DB87EA87E087EE8816881387FE880A881B88218839883C7F367F42 +7F447F4582107AFA7AFD7B087B037B047B157B0A7B2B7B0F7B477B387B2A7B19 +7B2E7B317B207B257B247B337B3E7B1E7B587B5A7B457B757B4C7B5D7B607B6E +7B7B7B627B727B717B907BA67BA77BB87BAC7B9D7BA87B857BAA7B9C7BA27BAB +7BB47BD17BC17BCC7BDD7BDA7BE57BE67BEA7C0C7BFE7BFC7C0F7C167C0B0000 +F4 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00007C1F7C2A7C267C387C417C4081FE82018202820481EC8844822182228223 +822D822F8228822B8238823B82338234823E82448249824B824F825A825F8268 +887E8885888888D888DF895E7F9D7F9F7FA77FAF7FB07FB27C7C65497C917C9D +7C9C7C9E7CA27CB27CBC7CBD7CC17CC77CCC7CCD7CC87CC57CD77CE8826E66A8 +7FBF7FCE7FD57FE57FE17FE67FE97FEE7FF37CF87D777DA67DAE7E477E9B9EB8 +9EB48D738D848D948D918DB18D678D6D8C478C49914A9150914E914F91640000 +F5 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00009162916191709169916F917D917E917291749179918C91859190918D9191 +91A291A391AA91AD91AE91AF91B591B491BA8C559E7E8DB88DEB8E058E598E69 +8DB58DBF8DBC8DBA8DC48DD68DD78DDA8DDE8DCE8DCF8DDB8DC68DEC8DF78DF8 +8DE38DF98DFB8DE48E098DFD8E148E1D8E1F8E2C8E2E8E238E2F8E3A8E408E39 +8E358E3D8E318E498E418E428E518E528E4A8E708E768E7C8E6F8E748E858E8F +8E948E908E9C8E9E8C788C828C8A8C858C988C94659B89D689DE89DA89DC0000 +F6 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000089E589EB89EF8A3E8B26975396E996F396EF970697019708970F970E972A +972D9730973E9F809F839F859F869F879F889F899F8A9F8C9EFE9F0B9F0D96B9 +96BC96BD96CE96D277BF96E0928E92AE92C8933E936A93CA938F943E946B9C7F +9C829C859C869C879C887A239C8B9C8E9C909C919C929C949C959C9A9C9B9C9E +9C9F9CA09CA19CA29CA39CA59CA69CA79CA89CA99CAB9CAD9CAE9CB09CB19CB2 +9CB39CB49CB59CB69CB79CBA9CBB9CBC9CBD9CC49CC59CC69CC79CCA9CCB0000 +F7 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00009CCC9CCD9CCE9CCF9CD09CD39CD49CD59CD79CD89CD99CDC9CDD9CDF9CE2 +977C978597919792979497AF97AB97A397B297B49AB19AB09AB79E589AB69ABA +9ABC9AC19AC09AC59AC29ACB9ACC9AD19B459B439B479B499B489B4D9B5198E8 +990D992E995599549ADF9AE19AE69AEF9AEB9AFB9AED9AF99B089B0F9B139B1F +9B239EBD9EBE7E3B9E829E879E889E8B9E9293D69E9D9E9F9EDB9EDC9EDD9EE0 +9EDF9EE29EE99EE79EE59EEA9EEF9F229F2C9F2F9F399F379F3D9F3E9F440000 diff --git a/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/iso2022-jp.enc b/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/iso2022-jp.enc new file mode 100644 index 0000000000000000000000000000000000000000..f6dabe56d32a4f526c7617a1ce864c755d942f35 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/iso2022-jp.enc @@ -0,0 +1,12 @@ +# Encoding file: iso2022-jp, escape-driven +E +name iso2022-jp +init {} +final {} +ascii \x1b(B +jis0201 \x1b(J +jis0208 \x1b$B +jis0208 \x1b$@ +jis0212 \x1b$(D +gb2312 \x1b$A +ksc5601 \x1b$(C diff --git a/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/iso2022-kr.enc b/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/iso2022-kr.enc new file mode 100644 index 0000000000000000000000000000000000000000..d20ce2bc126cf66550286309c5a167acda2e29dc --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/iso2022-kr.enc @@ -0,0 +1,7 @@ +# Encoding file: iso2022-kr, escape-driven +E +name iso2022-kr +init \x1b$)C +final {} +iso8859-1 \x0f +ksc5601 \x0e diff --git a/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/iso2022.enc b/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/iso2022.enc new file mode 100644 index 0000000000000000000000000000000000000000..a58f8e3e297ea002161efa8d6146fe64b1daf321 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/iso2022.enc @@ -0,0 +1,14 @@ +# Encoding file: iso2022, escape-driven +E +name iso2022 +init {} +final {} +iso8859-1 \x1b(B +jis0201 \x1b(J +gb1988 \x1b(T +jis0208 \x1b$B +jis0208 \x1b$@ +jis0212 \x1b$(D +gb2312 \x1b$A +ksc5601 \x1b$(C +jis0208 \x1b&@\x1b$B diff --git a/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/iso8859-1.enc b/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/iso8859-1.enc new file mode 100644 index 0000000000000000000000000000000000000000..045d8fa28b448ef90dd4b5ad2642c1e4942ca324 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/iso8859-1.enc @@ -0,0 +1,20 @@ +# Encoding file: iso8859-1, single-byte +S +003F 0 1 +00 +0000000100020003000400050006000700080009000A000B000C000D000E000F +0010001100120013001400150016001700180019001A001B001C001D001E001F +0020002100220023002400250026002700280029002A002B002C002D002E002F +0030003100320033003400350036003700380039003A003B003C003D003E003F +0040004100420043004400450046004700480049004A004B004C004D004E004F +0050005100520053005400550056005700580059005A005B005C005D005E005F +0060006100620063006400650066006700680069006A006B006C006D006E006F +0070007100720073007400750076007700780079007A007B007C007D007E007F +0080008100820083008400850086008700880089008A008B008C008D008E008F +0090009100920093009400950096009700980099009A009B009C009D009E009F +00A000A100A200A300A400A500A600A700A800A900AA00AB00AC00AD00AE00AF +00B000B100B200B300B400B500B600B700B800B900BA00BB00BC00BD00BE00BF +00C000C100C200C300C400C500C600C700C800C900CA00CB00CC00CD00CE00CF +00D000D100D200D300D400D500D600D700D800D900DA00DB00DC00DD00DE00DF +00E000E100E200E300E400E500E600E700E800E900EA00EB00EC00ED00EE00EF +00F000F100F200F300F400F500F600F700F800F900FA00FB00FC00FD00FE00FF diff --git a/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/iso8859-10.enc b/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/iso8859-10.enc new file mode 100644 index 0000000000000000000000000000000000000000..934b3b920ba5ad3a777cc582c2456f90774b02fb --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/iso8859-10.enc @@ -0,0 +1,20 @@ +# Encoding file: iso8859-10, single-byte +S +003F 0 1 +00 +0000000100020003000400050006000700080009000A000B000C000D000E000F +0010001100120013001400150016001700180019001A001B001C001D001E001F +0020002100220023002400250026002700280029002A002B002C002D002E002F +0030003100320033003400350036003700380039003A003B003C003D003E003F +0040004100420043004400450046004700480049004A004B004C004D004E004F +0050005100520053005400550056005700580059005A005B005C005D005E005F +0060006100620063006400650066006700680069006A006B006C006D006E006F +0070007100720073007400750076007700780079007A007B007C007D007E007F +0080008100820083008400850086008700880089008A008B008C008D008E008F +0090009100920093009400950096009700980099009A009B009C009D009E009F +00A0010401120122012A0128013600A7013B011001600166017D00AD016A014A +00B0010501130123012B0129013700B7013C011101610167017E2015016B014B +010000C100C200C300C400C500C6012E010C00C9011800CB011600CD00CE00CF +00D00145014C00D300D400D500D6016800D8017200DA00DB00DC00DD00DE00DF +010100E100E200E300E400E500E6012F010D00E9011900EB011700ED00EE00EF +00F00146014D00F300F400F500F6016900F8017300FA00FB00FC00FD00FE0138 diff --git a/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/iso8859-11.enc b/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/iso8859-11.enc new file mode 100644 index 0000000000000000000000000000000000000000..d68345358cec5914c8ea532fe6b07cf7c4260bb8 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/iso8859-11.enc @@ -0,0 +1,20 @@ +# Encoding file: iso8859-11, single-byte +S +003F 0 1 +00 +0000000100020003000400050006000700080009000A000B000C000D000E000F +0010001100120013001400150016001700180019001A001B001C001D001E001F +0020002100220023002400250026002700280029002A002B002C002D002E002F +0030003100320033003400350036003700380039003A003B003C003D003E003F +0040004100420043004400450046004700480049004A004B004C004D004E004F +0050005100520053005400550056005700580059005A005B005C005D005E005F +0060006100620063006400650066006700680069006A006B006C006D006E006F +0070007100720073007400750076007700780079007A007B007C007D007E007F +0080008100820083008400850086008700880089008A008B008C008D008E008F +0090009100920093009400950096009700980099009A009B009C009D009E009F +00A00E010E020E030E040E050E060E070E080E090E0A0E0B0E0C0E0D0E0E0E0F +0E100E110E120E130E140E150E160E170E180E190E1A0E1B0E1C0E1D0E1E0E1F +0E200E210E220E230E240E250E260E270E280E290E2A0E2B0E2C0E2D0E2E0E2F +0E300E310E320E330E340E350E360E370E380E390E3A00000000000000000E3F +0E400E410E420E430E440E450E460E470E480E490E4A0E4B0E4C0E4D0E4E0E4F +0E500E510E520E530E540E550E560E570E580E590E5A0E5B0000000000000000 diff --git a/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/iso8859-13.enc b/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/iso8859-13.enc new file mode 100644 index 0000000000000000000000000000000000000000..b7edcaf38f42902061c0cf53d14afdaa712aabc0 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/iso8859-13.enc @@ -0,0 +1,20 @@ +# Encoding file: iso8859-13, single-byte +S +003F 0 1 +00 +0000000100020003000400050006000700080009000A000B000C000D000E000F +0010001100120013001400150016001700180019001A001B001C001D001E001F +0020002100220023002400250026002700280029002A002B002C002D002E002F +0030003100320033003400350036003700380039003A003B003C003D003E003F +0040004100420043004400450046004700480049004A004B004C004D004E004F +0050005100520053005400550056005700580059005A005B005C005D005E005F +0060006100620063006400650066006700680069006A006B006C006D006E006F +0070007100720073007400750076007700780079007A007B007C007D007E007F +0080008100820083008400850086008700880089008A008B008C008D008E008F +0090009100920093009400950096009700980099009A009B009C009D009E009F +00A0201D00A200A300A4201E00A600A700D800A9015600AB00AC00AD00AE00C6 +00B000B100B200B3201C00B500B600B700F800B9015700BB00BC00BD00BE00E6 +0104012E0100010600C400C501180112010C00C90179011601220136012A013B +01600143014500D3014C00D500D600D701720141015A016A00DC017B017D00DF +0105012F0101010700E400E501190113010D00E9017A011701230137012B013C +01610144014600F3014D00F500F600F701730142015B016B00FC017C017E2019 diff --git a/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/iso8859-14.enc b/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/iso8859-14.enc new file mode 100644 index 0000000000000000000000000000000000000000..a65ba05b9afc1240c9dd2f265349b76b3130903c --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/iso8859-14.enc @@ -0,0 +1,20 @@ +# Encoding file: iso8859-14, single-byte +S +003F 0 1 +00 +0000000100020003000400050006000700080009000A000B000C000D000E000F +0010001100120013001400150016001700180019001A001B001C001D001E001F +0020002100220023002400250026002700280029002A002B002C002D002E002F +0030003100320033003400350036003700380039003A003B003C003D003E003F +0040004100420043004400450046004700480049004A004B004C004D004E004F +0050005100520053005400550056005700580059005A005B005C005D005E005F +0060006100620063006400650066006700680069006A006B006C006D006E006F +0070007100720073007400750076007700780079007A007B007C007D007E007F +0080008100820083008400850086008700880089008A008B008C008D008E008F +0090009100920093009400950096009700980099009A009B009C009D009E009F +00A01E021E0300A3010A010B1E0A00A71E8000A91E821E0B1EF200AD00AE0178 +1E1E1E1F012001211E401E4100B61E561E811E571E831E601EF31E841E851E61 +00C000C100C200C300C400C500C600C700C800C900CA00CB00CC00CD00CE00CF +017400D100D200D300D400D500D61E6A00D800D900DA00DB00DC00DD017600DF +00E000E100E200E300E400E500E600E700E800E900EA00EB00EC00ED00EE00EF +017500F100F200F300F400F500F61E6B00F800F900FA00FB00FC00FD017700FF diff --git a/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/iso8859-15.enc b/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/iso8859-15.enc new file mode 100644 index 0000000000000000000000000000000000000000..823af466e5b935e856e7c9a1d0bcb5eceb3b70be --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/iso8859-15.enc @@ -0,0 +1,20 @@ +# Encoding file: iso8859-15, single-byte +S +003F 0 1 +00 +0000000100020003000400050006000700080009000A000B000C000D000E000F +0010001100120013001400150016001700180019001A001B001C001D001E001F +0020002100220023002400250026002700280029002A002B002C002D002E002F +0030003100320033003400350036003700380039003A003B003C003D003E003F +0040004100420043004400450046004700480049004A004B004C004D004E004F +0050005100520053005400550056005700580059005A005B005C005D005E005F +0060006100620063006400650066006700680069006A006B006C006D006E006F +0070007100720073007400750076007700780079007A007B007C007D007E007F +0080008100820083008400850086008700880089008A008B008C008D008E008F +0090009100920093009400950096009700980099009A009B009C009D009E009F +00A000A100A200A320AC00A5016000A7016100A900AA00AB00AC00AD00AE00AF +00B000B100B200B3017D00B500B600B7017E00B900BA00BB01520153017800BF +00C000C100C200C300C400C500C600C700C800C900CA00CB00CC00CD00CE00CF +00D000D100D200D300D400D500D600D700D800D900DA00DB00DC00DD00DE00DF +00E000E100E200E300E400E500E600E700E800E900EA00EB00EC00ED00EE00EF +00F000F100F200F300F400F500F600F700F800F900FA00FB00FC00FD00FE00FF diff --git a/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/iso8859-16.enc b/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/iso8859-16.enc new file mode 100644 index 0000000000000000000000000000000000000000..da3370932f41ea4e3173907129b183c386a88fdb --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/iso8859-16.enc @@ -0,0 +1,20 @@ +# Encoding file: iso8859-16, single-byte +S +003F 0 1 +00 +0000000100020003000400050006000700080009000A000B000C000D000E000F +0010001100120013001400150016001700180019001A001B001C001D001E001F +0020002100220023002400250026002700280029002A002B002C002D002E002F +0030003100320033003400350036003700380039003A003B003C003D003E003F +0040004100420043004400450046004700480049004A004B004C004D004E004F +0050005100520053005400550056005700580059005A005B005C005D005E005F +0060006100620063006400650066006700680069006A006B006C006D006E006F +0070007100720073007400750076007700780079007A007B007C007D007E007F +0080008100820083008400850086008700880089008A008B008C008D008E008F +0090009100920093009400950096009700980099009A009B009C009D009E009F +00A001040105014120AC201E016000A7016100A9021800AB017900AD017A017B +00B000B1010C0142017D201D00B600B7017E010D021900BB015201530178017C +00C000C100C2010200C4010600C600C700C800C900CA00CB00CC00CD00CE00CF +0110014300D200D300D4015000D6015A017000D900DA00DB00DC0118021A00DF +00E000E100E2010300E4010700E600E700E800E900EA00EB00EC00ED00EE00EF +0111014400F200F300F4015100F6015B017100F900FA00FB00FC0119021B00FF diff --git a/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/iso8859-2.enc b/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/iso8859-2.enc new file mode 100644 index 0000000000000000000000000000000000000000..16faab66ed793f66bf64572c8238ab73e431f657 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/iso8859-2.enc @@ -0,0 +1,20 @@ +# Encoding file: iso8859-2, single-byte +S +003F 0 1 +00 +0000000100020003000400050006000700080009000A000B000C000D000E000F +0010001100120013001400150016001700180019001A001B001C001D001E001F +0020002100220023002400250026002700280029002A002B002C002D002E002F +0030003100320033003400350036003700380039003A003B003C003D003E003F +0040004100420043004400450046004700480049004A004B004C004D004E004F +0050005100520053005400550056005700580059005A005B005C005D005E005F +0060006100620063006400650066006700680069006A006B006C006D006E006F +0070007100720073007400750076007700780079007A007B007C007D007E007F +0080008100820083008400850086008700880089008A008B008C008D008E008F +0090009100920093009400950096009700980099009A009B009C009D009E009F +00A0010402D8014100A4013D015A00A700A80160015E0164017900AD017D017B +00B0010502DB014200B4013E015B02C700B80161015F0165017A02DD017E017C +015400C100C2010200C40139010600C7010C00C9011800CB011A00CD00CE010E +01100143014700D300D4015000D600D70158016E00DA017000DC00DD016200DF +015500E100E2010300E4013A010700E7010D00E9011900EB011B00ED00EE010F +01110144014800F300F4015100F600F70159016F00FA017100FC00FD016302D9 diff --git a/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/iso8859-3.enc b/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/iso8859-3.enc new file mode 100644 index 0000000000000000000000000000000000000000..c914bce7af30184725481de6daf9ec14644fd53f --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/iso8859-3.enc @@ -0,0 +1,20 @@ +# Encoding file: iso8859-3, single-byte +S +003F 0 1 +00 +0000000100020003000400050006000700080009000A000B000C000D000E000F +0010001100120013001400150016001700180019001A001B001C001D001E001F +0020002100220023002400250026002700280029002A002B002C002D002E002F +0030003100320033003400350036003700380039003A003B003C003D003E003F +0040004100420043004400450046004700480049004A004B004C004D004E004F +0050005100520053005400550056005700580059005A005B005C005D005E005F +0060006100620063006400650066006700680069006A006B006C006D006E006F +0070007100720073007400750076007700780079007A007B007C007D007E007F +0080008100820083008400850086008700880089008A008B008C008D008E008F +0090009100920093009400950096009700980099009A009B009C009D009E009F +00A0012602D800A300A40000012400A700A80130015E011E013400AD0000017B +00B0012700B200B300B400B5012500B700B80131015F011F013500BD0000017C +00C000C100C2000000C4010A010800C700C800C900CA00CB00CC00CD00CE00CF +000000D100D200D300D4012000D600D7011C00D900DA00DB00DC016C015C00DF +00E000E100E2000000E4010B010900E700E800E900EA00EB00EC00ED00EE00EF +000000F100F200F300F4012100F600F7011D00F900FA00FB00FC016D015D02D9 diff --git a/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/iso8859-4.enc b/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/iso8859-4.enc new file mode 100644 index 0000000000000000000000000000000000000000..ef5c5a99825b58b9e1c1fc7624dd24946a5093fc --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/iso8859-4.enc @@ -0,0 +1,20 @@ +# Encoding file: iso8859-4, single-byte +S +003F 0 1 +00 +0000000100020003000400050006000700080009000A000B000C000D000E000F +0010001100120013001400150016001700180019001A001B001C001D001E001F +0020002100220023002400250026002700280029002A002B002C002D002E002F +0030003100320033003400350036003700380039003A003B003C003D003E003F +0040004100420043004400450046004700480049004A004B004C004D004E004F +0050005100520053005400550056005700580059005A005B005C005D005E005F +0060006100620063006400650066006700680069006A006B006C006D006E006F +0070007100720073007400750076007700780079007A007B007C007D007E007F +0080008100820083008400850086008700880089008A008B008C008D008E008F +0090009100920093009400950096009700980099009A009B009C009D009E009F +00A001040138015600A40128013B00A700A8016001120122016600AD017D00AF +00B0010502DB015700B40129013C02C700B80161011301230167014A017E014B +010000C100C200C300C400C500C6012E010C00C9011800CB011600CD00CE012A +01100145014C013600D400D500D600D700D8017200DA00DB00DC0168016A00DF +010100E100E200E300E400E500E6012F010D00E9011900EB011700ED00EE012B +01110146014D013700F400F500F600F700F8017300FA00FB00FC0169016B02D9 diff --git a/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/iso8859-5.enc b/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/iso8859-5.enc new file mode 100644 index 0000000000000000000000000000000000000000..bf4ee82b66283e8c9b4b898210bb0c43db7b63da --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/iso8859-5.enc @@ -0,0 +1,20 @@ +# Encoding file: iso8859-5, single-byte +S +003F 0 1 +00 +0000000100020003000400050006000700080009000A000B000C000D000E000F +0010001100120013001400150016001700180019001A001B001C001D001E001F +0020002100220023002400250026002700280029002A002B002C002D002E002F +0030003100320033003400350036003700380039003A003B003C003D003E003F +0040004100420043004400450046004700480049004A004B004C004D004E004F +0050005100520053005400550056005700580059005A005B005C005D005E005F +0060006100620063006400650066006700680069006A006B006C006D006E006F +0070007100720073007400750076007700780079007A007B007C007D007E007F +0080008100820083008400850086008700880089008A008B008C008D008E008F +0090009100920093009400950096009700980099009A009B009C009D009E009F +00A0040104020403040404050406040704080409040A040B040C00AD040E040F +0410041104120413041404150416041704180419041A041B041C041D041E041F +0420042104220423042404250426042704280429042A042B042C042D042E042F +0430043104320433043404350436043704380439043A043B043C043D043E043F +0440044104420443044404450446044704480449044A044B044C044D044E044F +2116045104520453045404550456045704580459045A045B045C00A7045E045F diff --git a/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/iso8859-6.enc b/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/iso8859-6.enc new file mode 100644 index 0000000000000000000000000000000000000000..19ddefbc7bf13db439ff3390970666b41f5a9df1 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/iso8859-6.enc @@ -0,0 +1,20 @@ +# Encoding file: iso8859-6, single-byte +S +003F 0 1 +00 +0000000100020003000400050006000700080009000A000B000C000D000E000F +0010001100120013001400150016001700180019001A001B001C001D001E001F +0020002100220023002400250026002700280029002A002B002C002D002E002F +0030003100320033003400350036003700380039003A003B003C003D003E003F +0040004100420043004400450046004700480049004A004B004C004D004E004F +0050005100520053005400550056005700580059005A005B005C005D005E005F +0060006100620063006400650066006700680069006A006B006C006D006E006F +0070007100720073007400750076007700780079007A007B007C007D007E007F +0080008100820083008400850086008700880089008A008B008C008D008E008F +0090009100920093009400950096009700980099009A009B009C009D009E009F +00A000000000000000A40000000000000000000000000000060C00AD00000000 +00000000000000000000000000000000000000000000061B000000000000061F +0000062106220623062406250626062706280629062A062B062C062D062E062F +0630063106320633063406350636063706380639063A00000000000000000000 +0640064106420643064406450646064706480649064A064B064C064D064E064F +0650065106520000000000000000000000000000000000000000000000000000 diff --git a/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/iso8859-7.enc b/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/iso8859-7.enc new file mode 100644 index 0000000000000000000000000000000000000000..a46112f145825b7aea946481ed9a039e81ed6e1b --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/iso8859-7.enc @@ -0,0 +1,20 @@ +# Encoding file: iso8859-7, single-byte +S +003F 0 1 +00 +0000000100020003000400050006000700080009000A000B000C000D000E000F +0010001100120013001400150016001700180019001A001B001C001D001E001F +0020002100220023002400250026002700280029002A002B002C002D002E002F +0030003100320033003400350036003700380039003A003B003C003D003E003F +0040004100420043004400450046004700480049004A004B004C004D004E004F +0050005100520053005400550056005700580059005A005B005C005D005E005F +0060006100620063006400650066006700680069006A006B006C006D006E006F +0070007100720073007400750076007700780079007A007B007C007D007E007F +0080008100820083008400850086008700880089008A008B008C008D008E008F +0090009100920093009400950096009700980099009A009B009C009D009E009F +00A02018201900A320AC20AF00A600A700A800A9037A00AB00AC00AD00002015 +00B000B100B200B303840385038600B703880389038A00BB038C00BD038E038F +0390039103920393039403950396039703980399039A039B039C039D039E039F +03A003A1000003A303A403A503A603A703A803A903AA03AB03AC03AD03AE03AF +03B003B103B203B303B403B503B603B703B803B903BA03BB03BC03BD03BE03BF +03C003C103C203C303C403C503C603C703C803C903CA03CB03CC03CD03CE0000 diff --git a/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/iso8859-8.enc b/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/iso8859-8.enc new file mode 100644 index 0000000000000000000000000000000000000000..579fa5b47ea10dc492b7735664488567139c4254 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/iso8859-8.enc @@ -0,0 +1,20 @@ +# Encoding file: iso8859-8, single-byte +S +003F 0 1 +00 +0000000100020003000400050006000700080009000A000B000C000D000E000F +0010001100120013001400150016001700180019001A001B001C001D001E001F +0020002100220023002400250026002700280029002A002B002C002D002E002F +0030003100320033003400350036003700380039003A003B003C003D003E003F +0040004100420043004400450046004700480049004A004B004C004D004E004F +0050005100520053005400550056005700580059005A005B005C005D005E005F +0060006100620063006400650066006700680069006A006B006C006D006E006F +0070007100720073007400750076007700780079007A007B007C007D007E007F +0080008100820083008400850086008700880089008A008B008C008D008E008F +0090009100920093009400950096009700980099009A009B009C009D009E009F +00A0000000A200A300A400A500A600A700A800A900D700AB00AC00AD00AE00AF +00B000B100B200B300B400B500B600B700B800B900F700BB00BC00BD00BE0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000002017 +05D005D105D205D305D405D505D605D705D805D905DA05DB05DC05DD05DE05DF +05E005E105E205E305E405E505E605E705E805E905EA00000000200E200F0000 diff --git a/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/iso8859-9.enc b/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/iso8859-9.enc new file mode 100644 index 0000000000000000000000000000000000000000..6eed3f1a8717d96aa95d9c7b1654b13dacce4f22 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/iso8859-9.enc @@ -0,0 +1,20 @@ +# Encoding file: iso8859-9, single-byte +S +003F 0 1 +00 +0000000100020003000400050006000700080009000A000B000C000D000E000F +0010001100120013001400150016001700180019001A001B001C001D001E001F +0020002100220023002400250026002700280029002A002B002C002D002E002F +0030003100320033003400350036003700380039003A003B003C003D003E003F +0040004100420043004400450046004700480049004A004B004C004D004E004F +0050005100520053005400550056005700580059005A005B005C005D005E005F +0060006100620063006400650066006700680069006A006B006C006D006E006F +0070007100720073007400750076007700780079007A007B007C007D007E007F +0080008100820083008400850086008700880089008A008B008C008D008E008F +0090009100920093009400950096009700980099009A009B009C009D009E009F +00A000A100A200A300A400A500A600A700A800A900AA00AB00AC00AD00AE00AF +00B000B100B200B300B400B500B600B700B800B900BA00BB00BC00BD00BE00BF +00C000C100C200C300C400C500C600C700C800C900CA00CB00CC00CD00CE00CF +011E00D100D200D300D400D500D600D700D800D900DA00DB00DC0130015E00DF +00E000E100E200E300E400E500E600E700E800E900EA00EB00EC00ED00EE00EF +011F00F100F200F300F400F500F600F700F800F900FA00FB00FC0131015F00FF diff --git a/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/jis0201.enc b/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/jis0201.enc new file mode 100644 index 0000000000000000000000000000000000000000..64f423f16201391f064c7298d278186c1c5a6408 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/jis0201.enc @@ -0,0 +1,20 @@ +# Encoding file: jis0201, single-byte +S +003F 0 1 +00 +0000000100020003000400050006000700080009000A000B000C000D000E000F +0010001100120013001400150016001700180019001A001B001C001D001E001F +0020002100220023002400250026002700280029002A002B002C002D002E002F +0030003100320033003400350036003700380039003A003B003C003D003E003F +0040004100420043004400450046004700480049004A004B004C004D004E004F +0050005100520053005400550056005700580059005A005B005C005D005E005F +0060006100620063006400650066006700680069006A006B006C006D006E006F +0070007100720073007400750076007700780079007A007B007C007D203E007F +0080008100820083008400850086008700880089008A008B008C008D008E008F +0090009100920093009400950096009700980099009A009B009C009D009E009F +0000FF61FF62FF63FF64FF65FF66FF67FF68FF69FF6AFF6BFF6CFF6DFF6EFF6F +FF70FF71FF72FF73FF74FF75FF76FF77FF78FF79FF7AFF7BFF7CFF7DFF7EFF7F +FF80FF81FF82FF83FF84FF85FF86FF87FF88FF89FF8AFF8BFF8CFF8DFF8EFF8F +FF90FF91FF92FF93FF94FF95FF96FF97FF98FF99FF9AFF9BFF9CFF9DFF9EFF9F +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 diff --git a/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/jis0208.enc b/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/jis0208.enc new file mode 100644 index 0000000000000000000000000000000000000000..11c49a4a2ba626ff06d7ac0c8dcafe037ef19d46 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/jis0208.enc @@ -0,0 +1,1319 @@ +# Encoding file: jis0208, double-byte +D +2129 0 77 +21 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000300030013002FF0CFF0E30FBFF1AFF1BFF1FFF01309B309C00B4FF4000A8 +FF3EFFE3FF3F30FD30FE309D309E30034EDD30053006300730FC20152010FF0F +FF3C301C2016FF5C2026202520182019201C201DFF08FF0930143015FF3BFF3D +FF5BFF5D30083009300A300B300C300D300E300F30103011FF0B221200B100D7 +00F7FF1D2260FF1CFF1E22662267221E22342642264000B0203220332103FFE5 +FF0400A200A3FF05FF03FF06FF0AFF2000A72606260525CB25CF25CE25C70000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +22 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000025C625A125A025B325B225BD25BC203B3012219221902191219330130000 +00000000000000000000000000000000000000002208220B2286228722822283 +222A2229000000000000000000000000000000002227222800AC21D221D42200 +220300000000000000000000000000000000000000000000222022A523122202 +220722612252226A226B221A223D221D2235222B222C00000000000000000000 +00000000212B2030266F266D266A2020202100B6000000000000000025EF0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +23 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +FF10FF11FF12FF13FF14FF15FF16FF17FF18FF19000000000000000000000000 +0000FF21FF22FF23FF24FF25FF26FF27FF28FF29FF2AFF2BFF2CFF2DFF2EFF2F +FF30FF31FF32FF33FF34FF35FF36FF37FF38FF39FF3A00000000000000000000 +0000FF41FF42FF43FF44FF45FF46FF47FF48FF49FF4AFF4BFF4CFF4DFF4EFF4F +FF50FF51FF52FF53FF54FF55FF56FF57FF58FF59FF5A00000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +24 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000304130423043304430453046304730483049304A304B304C304D304E304F +3050305130523053305430553056305730583059305A305B305C305D305E305F +3060306130623063306430653066306730683069306A306B306C306D306E306F +3070307130723073307430753076307730783079307A307B307C307D307E307F +3080308130823083308430853086308730883089308A308B308C308D308E308F +3090309130923093000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +25 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000030A130A230A330A430A530A630A730A830A930AA30AB30AC30AD30AE30AF +30B030B130B230B330B430B530B630B730B830B930BA30BB30BC30BD30BE30BF +30C030C130C230C330C430C530C630C730C830C930CA30CB30CC30CD30CE30CF +30D030D130D230D330D430D530D630D730D830D930DA30DB30DC30DD30DE30DF +30E030E130E230E330E430E530E630E730E830E930EA30EB30EC30ED30EE30EF +30F030F130F230F330F430F530F6000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +26 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000039103920393039403950396039703980399039A039B039C039D039E039F +03A003A103A303A403A503A603A703A803A90000000000000000000000000000 +000003B103B203B303B403B503B603B703B803B903BA03BB03BC03BD03BE03BF +03C003C103C303C403C503C603C703C803C90000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +27 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000004100411041204130414041504010416041704180419041A041B041C041D +041E041F0420042104220423042404250426042704280429042A042B042C042D +042E042F00000000000000000000000000000000000000000000000000000000 +000004300431043204330434043504510436043704380439043A043B043C043D +043E043F0440044104420443044404450446044704480449044A044B044C044D +044E044F00000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +28 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000025002502250C251025182514251C252C25242534253C25012503250F2513 +251B251725232533252B253B254B2520252F25282537253F251D253025252538 +2542000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +30 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00004E9C55165A03963F54C0611B632859F690228475831C7A5060AA63E16E25 +65ED846682A69BF56893572765A162715B9B59D0867B98F47D627DBE9B8E6216 +7C9F88B75B895EB563096697684895C7978D674F4EE54F0A4F4D4F9D504956F2 +593759D45A015C0960DF610F61706613690570BA754F757079FB7DAD7DEF80C3 +840E88638B029055907A533B4E954EA557DF80B290C178EF4E0058F16EA29038 +7A328328828B9C2F5141537054BD54E156E059FB5F1598F26DEB80E4852D0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +31 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00009662967096A097FB540B53F35B8770CF7FBD8FC296E8536F9D5C7ABA4E11 +789381FC6E26561855046B1D851A9C3B59E553A96D6674DC958F56424E91904B +96F2834F990C53E155B65B305F71662066F368046C386CF36D29745B76C87A4E +983482F1885B8A6092ED6DB275AB76CA99C560A68B018D8A95B2698E53AD5186 +5712583059445BB45EF6602863A963F46CBF6F14708E7114715971D5733F7E01 +827682D185979060925B9D1B586965BC6C5A752551F9592E59655F805FDC0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +32 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000062BC65FA6A2A6B276BB4738B7FC189569D2C9D0E9EC45CA16C96837B5104 +5C4B61B681C6687672614E594FFA537860696E297A4F97F34E0B53164EEE4F55 +4F3D4FA14F7352A053EF5609590F5AC15BB65BE179D16687679C67B66B4C6CB3 +706B73C2798D79BE7A3C7B8782B182DB8304837783EF83D387668AB256298CA8 +8FE6904E971E868A4FC45CE862117259753B81E582BD86FE8CC096C5991399D5 +4ECB4F1A89E356DE584A58CA5EFB5FEB602A6094606261D0621262D065390000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +33 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00009B41666668B06D777070754C76867D7582A587F9958B968E8C9D51F152BE +591654B35BB35D16616869826DAF788D84CB88578A7293A79AB86D6C99A886D9 +57A367FF86CE920E5283568754045ED362E164B9683C68386BBB737278BA7A6B +899A89D28D6B8F0390ED95A3969497695B665CB3697D984D984E639B7B206A2B +6A7F68B69C0D6F5F5272559D607062EC6D3B6E076ED1845B89108F444E149C39 +53F6691B6A3A9784682A515C7AC384B291DC938C565B9D286822830584310000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +34 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00007CA5520882C574E64E7E4F8351A05BD2520A52D852E75DFB559A582A59E6 +5B8C5B985BDB5E725E7960A3611F616361BE63DB656267D1685368FA6B3E6B53 +6C576F226F976F4574B0751876E3770B7AFF7BA17C217DE97F367FF0809D8266 +839E89B38ACC8CAB908494519593959195A2966597D3992882184E38542B5CB8 +5DCC73A9764C773C5CA97FEB8D0B96C19811985498584F014F0E5371559C5668 +57FA59475B095BC45C905E0C5E7E5FCC63EE673A65D765E2671F68CB68C40000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +35 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00006A5F5E306BC56C176C7D757F79485B637A007D005FBD898F8A188CB48D77 +8ECC8F1D98E29A0E9B3C4E80507D510059935B9C622F628064EC6B3A72A07591 +79477FA987FB8ABC8B7063AC83CA97A05409540355AB68546A588A7078276775 +9ECD53745BA2811A865090064E184E454EC74F1153CA54385BAE5F1360256551 +673D6C426C726CE3707874037A767AAE7B087D1A7CFE7D6665E7725B53BB5C45 +5DE862D262E063196E20865A8A318DDD92F86F0179A69B5A4EA84EAB4EAC0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +36 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00004F9B4FA050D151477AF6517151F653545321537F53EB55AC58835CE15F37 +5F4A602F6050606D631F65596A4B6CC172C272ED77EF80F881058208854E90F7 +93E197FF99579A5A4EF051DD5C2D6681696D5C4066F26975738968507C8150C5 +52E457475DFE932665A46B236B3D7434798179BD7B4B7DCA82B983CC887F895F +8B398FD191D1541F92804E5D503653E5533A72D7739677E982E68EAF99C699C8 +99D25177611A865E55B07A7A50765BD3904796854E326ADB91E75C515C480000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +37 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000063987A9F6C9397748F617AAA718A96887C8268177E706851936C52F2541B +85AB8A137FA48ECD90E15366888879414FC250BE521151445553572D73EA578B +59515F625F8460756176616761A963B2643A656C666F68426E1375667A3D7CFB +7D4C7D997E4B7F6B830E834A86CD8A088A638B668EFD981A9D8F82B88FCE9BE8 +5287621F64836FC09699684150916B206C7A6F547A747D5088408A2367084EF6 +503950265065517C5238526355A7570F58055ACC5EFA61B261F862F363720000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +38 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000691C6A29727D72AC732E7814786F7D79770C80A9898B8B198CE28ED29063 +9375967A98559A139E785143539F53B35E7B5F266E1B6E90738473FE7D438237 +8A008AFA96504E4E500B53E4547C56FA59D15B645DF15EAB5F276238654567AF +6E5672D07CCA88B480A180E183F0864E8A878DE8923796C798679F134E944E92 +4F0D53485449543E5A2F5F8C5FA1609F68A76A8E745A78818A9E8AA48B779190 +4E5E9BC94EA44F7C4FAF501950165149516C529F52B952FE539A53E354110000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +39 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000540E5589575157A2597D5B545B5D5B8F5DE55DE75DF75E785E835E9A5EB7 +5F186052614C629762D863A7653B6602664366F4676D6821689769CB6C5F6D2A +6D696E2F6E9D75327687786C7A3F7CE07D057D187D5E7DB18015800380AF80B1 +8154818F822A8352884C88618B1B8CA28CFC90CA91759271783F92FC95A4964D +980599999AD89D3B525B52AB53F7540858D562F76FE08C6A8F5F9EB9514B523B +544A56FD7A4091779D609ED273446F09817075115FFD60DA9AA872DB8FBC0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +3A +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00006B6498034ECA56F0576458BE5A5A606861C7660F6606683968B16DF775D5 +7D3A826E9B424E9B4F5053C955065D6F5DE65DEE67FB6C99747378028A509396 +88DF57505EA7632B50B550AC518D670054C9585E59BB5BB05F69624D63A1683D +6B736E08707D91C7728078157826796D658E7D3083DC88C18F09969B52645728 +67507F6A8CA151B45742962A583A698A80B454B25D0E57FC78959DFA4F5C524A +548B643E6628671467F57A847B567D22932F685C9BAD7B395319518A52370000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +3B +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00005BDF62F664AE64E6672D6BBA85A996D176909BD6634C93069BAB76BF6652 +4E09509853C25C7160E864926563685F71E673CA75237B977E8286958B838CDB +9178991065AC66AB6B8B4ED54ED44F3A4F7F523A53F853F255E356DB58EB59CB +59C959FF5B505C4D5E025E2B5FD7601D6307652F5B5C65AF65BD65E8679D6B62 +6B7B6C0F7345794979C17CF87D197D2B80A2810281F389968A5E8A698A668A8C +8AEE8CC78CDC96CC98FC6B6F4E8B4F3C4F8D51505B575BFA6148630166420000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +3C +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00006B216ECB6CBB723E74BD75D478C1793A800C803381EA84948F9E6C509E7F +5F0F8B589D2B7AFA8EF85B8D96EB4E0353F157F759315AC95BA460896E7F6F06 +75BE8CEA5B9F85007BE0507267F4829D5C61854A7E1E820E51995C0463688D66 +659C716E793E7D1780058B1D8ECA906E86C790AA501F52FA5C3A6753707C7235 +914C91C8932B82E55BC25F3160F94E3B53D65B88624B67316B8A72E973E07A2E +816B8DA391529996511253D7546A5BFF63886A397DAC970056DA53CE54680000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +3D +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00005B975C315DDE4FEE610162FE6D3279C079CB7D427E4D7FD281ED821F8490 +884689728B908E748F2F9031914B916C96C6919C4EC04F4F514553415F93620E +67D46C416E0B73637E2691CD928353D459195BBF6DD1795D7E2E7C9B587E719F +51FA88538FF04FCA5CFB662577AC7AE3821C99FF51C65FAA65EC696F6B896DF3 +6E966F6476FE7D145DE190759187980651E6521D6240669166D96E1A5EB67DD2 +7F7266F885AF85F78AF852A953D959735E8F5F90605592E4966450B7511F0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +3E +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000052DD5320534753EC54E8554655315617596859BE5A3C5BB55C065C0F5C11 +5C1A5E845E8A5EE05F70627F628462DB638C63776607660C662D6676677E68A2 +6A1F6A356CBC6D886E096E58713C7126716775C77701785D7901796579F07AE0 +7B117CA77D39809683D6848B8549885D88F38A1F8A3C8A548A738C618CDE91A4 +9266937E9418969C97984E0A4E084E1E4E575197527057CE583458CC5B225E38 +60C564FE676167566D4472B675737A6384B88B7291B89320563157F498FE0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +3F +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000062ED690D6B9671ED7E548077827289E698DF87558FB15C3B4F384FE14FB5 +55075A205BDD5BE95FC3614E632F65B0664B68EE699B6D786DF1753375B9771F +795E79E67D3381E382AF85AA89AA8A3A8EAB8F9B903291DD97074EBA4EC15203 +587558EC5C0B751A5C3D814E8A0A8FC59663976D7B258ACF9808916256F353A8 +9017543957825E2563A86C34708A77617C8B7FE088709042915493109318968F +745E9AC45D075D69657067A28DA896DB636E6749691983C5981796C088FE0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +40 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00006F84647A5BF84E16702C755D662F51C4523652E259D35F8160276210653F +6574661F667468F268166B636E057272751F76DB7CBE805658F088FD897F8AA0 +8A938ACB901D91929752975965897A0E810696BB5E2D60DC621A65A566146790 +77F37A4D7C4D7E3E810A8CAC8D648DE18E5F78A9520762D963A5644262988A2D +7A837BC08AAC96EA7D76820C87494ED95148534353605BA35C025C165DDD6226 +624764B0681368346CC96D456D1767D36F5C714E717D65CB7A7F7BAD7DDA0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +41 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00007E4A7FA8817A821B823985A68A6E8CCE8DF59078907792AD929195839BAE +524D55846F387136516879857E5581B37CCE564C58515CA863AA66FE66FD695A +72D9758F758E790E795679DF7C977D207D4486078A34963B90619F2050E75275 +53CC53E2500955AA58EE594F723D5B8B5C64531D60E360F3635C6383633F63BB +64CD65E966F95DE369CD69FD6F1571E54E8975E976F87A937CDF7DCF7D9C8061 +83498358846C84BC85FB88C58D709001906D9397971C9A1250CF5897618E0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +42 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000081D385358D0890204FC3507452475373606F6349675F6E2C8DB3901F4FD7 +5C5E8CCA65CF7D9A53528896517663C35B585B6B5C0A640D6751905C4ED6591A +592A6C708A51553E581559A560F0625367C182356955964099C49A284F535806 +5BFE80105CB15E2F5F856020614B623466FF6CF06EDE80CE817F82D4888B8CB8 +9000902E968A9EDB9BDB4EE353F059277B2C918D984C9DF96EDD702753535544 +5B856258629E62D36CA26FEF74228A1794386FC18AFE833851E786F853EA0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +43 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000053E94F4690548FB0596A81315DFD7AEA8FBF68DA8C3772F89C486A3D8AB0 +4E3953585606576662C563A265E66B4E6DE16E5B70AD77ED7AEF7BAA7DBB803D +80C686CB8A95935B56E358C75F3E65AD66966A806BB575378AC7502477E55730 +5F1B6065667A6C6075F47A1A7F6E81F48718904599B37BC9755C7AF97B5184C4 +901079E97A9283365AE177404E2D4EF25B995FE062BD663C67F16CE8866B8877 +8A3B914E92F399D06A177026732A82E784578CAF4E01514651CB558B5BF50000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +44 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00005E165E335E815F145F355F6B5FB461F2631166A2671D6F6E7252753A773A +80748139817887768ABF8ADC8D858DF3929A957798029CE552C5635776F46715 +6C8873CD8CC393AE96736D25589C690E69CC8FFD939A75DB901A585A680263B4 +69FB4F436F2C67D88FBB85267DB49354693F6F70576A58F75B2C7D2C722A540A +91E39DB44EAD4F4E505C507552438C9E544858245B9A5E1D5E955EAD5EF75F1F +608C62B5633A63D068AF6C407887798E7A0B7DE082478A028AE68E4490130000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +45 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000090B8912D91D89F0E6CE5645864E265756EF476847B1B906993D16EBA54F2 +5FB964A48F4D8FED92445178586B59295C555E976DFB7E8F751C8CBC8EE2985B +70B94F1D6BBF6FB1753096FB514E54105835585759AC5C605F926597675C6E21 +767B83DF8CED901490FD934D7825783A52AA5EA6571F597460125012515A51AC +51CD520055105854585859575B955CF65D8B60BC6295642D6771684368BC68DF +76D76DD86E6F6D9B706F71C85F5375D879777B497B547B527CD67D7152300000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +46 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00008463856985E48A0E8B048C468E0F9003900F94199676982D9A3095D850CD +52D5540C58025C0E61A7649E6D1E77B37AE580F48404905392855CE09D07533F +5F975FB36D9C7279776379BF7BE46BD272EC8AAD68036A6151F87A8169345C4A +9CF682EB5BC59149701E56785C6F60C765666C8C8C5A90419813545166C7920D +594890A351854E4D51EA85998B0E7058637A934B696299B47E04757753576960 +8EDF96E36C5D4E8C5C3C5F108FE953028CD1808986795EFF65E54E7351650000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +47 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000059825C3F97EE4EFB598A5FCD8A8D6FE179B079625BE78471732B71B15E74 +5FF5637B649A71C37C984E435EFC4E4B57DC56A260A96FC37D0D80FD813381BF +8FB2899786A45DF4628A64AD898767776CE26D3E743678345A467F7582AD99AC +4FF35EC362DD63926557676F76C3724C80CC80BA8F29914D500D57F95A926885 +6973716472FD8CB758F28CE0966A9019877F79E477E784294F2F5265535A62CD +67CF6CCA767D7B947C95823685848FEB66DD6F2072067E1B83AB99C19EA60000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +48 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000051FD7BB178727BB880877B486AE85E61808C75517560516B92626E8C767A +91979AEA4F107F70629C7B4F95A59CE9567A585986E496BC4F345224534A53CD +53DB5E06642C6591677F6C3E6C4E724872AF73ED75547E41822C85E98CA97BC4 +91C67169981298EF633D6669756A76E478D0854386EE532A5351542659835E87 +5F7C60B26249627962AB65906BD46CCC75B276AE789179D87DCB7F7780A588AB +8AB98CBB907F975E98DB6A0B7C3850995C3E5FAE67876BD8743577097F8E0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +49 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00009F3B67CA7A175339758B9AED5F66819D83F180985F3C5FC575627B46903C +686759EB5A9B7D10767E8B2C4FF55F6A6A196C376F0274E2796888688A558C79 +5EDF63CF75C579D282D7932892F2849C86ED9C2D54C15F6C658C6D5C70158CA7 +8CD3983B654F74F64E0D4ED857E0592B5A665BCC51A85E035E9C601662766577 +65A7666E6D6E72367B268150819A82998B5C8CA08CE68D74961C96444FAE64AB +6B66821E8461856A90E85C01695398A8847A85574F0F526F5FA95E45670D0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +4A +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000798F8179890789866DF55F1762556CB84ECF72699B925206543B567458B3 +61A4626E711A596E7C897CDE7D1B96F06587805E4E194F75517558405E635E73 +5F0A67C44E26853D9589965B7C73980150FB58C1765678A7522577A585117B86 +504F590972477BC77DE88FBA8FD4904D4FBF52C95A295F0197AD4FDD821792EA +570363556B69752B88DC8F147A4252DF58936155620A66AE6BCD7C3F83E95023 +4FF853055446583159495B9D5CF05CEF5D295E9662B16367653E65B9670B0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +4B +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00006CD56CE170F978327E2B80DE82B3840C84EC870289128A2A8C4A90A692D2 +98FD9CF39D6C4E4F4EA1508D5256574A59A85E3D5FD85FD9623F66B4671B67D0 +68D251927D2180AA81A88B008C8C8CBF927E96325420982C531750D5535C58A8 +64B26734726777667A4691E652C36CA16B8658005E4C5954672C7FFB51E176C6 +646978E89B549EBB57CB59B96627679A6BCE54E969D95E55819C67959BAA67FE +9C52685D4EA64FE353C862B9672B6CAB8FC44FAD7E6D9EBF4E0761626E800000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +4C +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00006F2B85135473672A9B455DF37B955CAC5BC6871C6E4A84D17A1481085999 +7C8D6C11772052D959227121725F77DB97279D61690B5A7F5A1851A5540D547D +660E76DF8FF792989CF459EA725D6EC5514D68C97DBF7DEC97629EBA64786A21 +830259845B5F6BDB731B76F27DB280178499513267289ED976EE676252FF9905 +5C24623B7C7E8CB0554F60B67D0B958053014E5F51B6591C723A803691CE5F25 +77E253845F797D0485AC8A338E8D975667F385AE9453610961086CB976520000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +4D +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00008AED8F38552F4F51512A52C753CB5BA55E7D60A0618263D6670967DA6E67 +6D8C733673377531795088D58A98904A909190F596C4878D59154E884F594E0E +8A898F3F981050AD5E7C59965BB95EB863DA63FA64C166DC694A69D86D0B6EB6 +719475287AAF7F8A8000844984C989818B218E0A9065967D990A617E62916B32 +6C836D747FCC7FFC6DC07F8587BA88F8676583B1983C96F76D1B7D61843D916A +4E7153755D506B046FEB85CD862D89A75229540F5C65674E68A8740674830000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +4E +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000075E288CF88E191CC96E296785F8B73877ACB844E63A0756552896D416E9C +74097559786B7C9296867ADC9F8D4FB6616E65C5865C4E864EAE50DA4E2151CC +5BEE659968816DBC731F764277AD7A1C7CE7826F8AD2907C91CF96759818529B +7DD1502B539867976DCB71D0743381E88F2A96A39C579E9F746058416D997D2F +985E4EE44F364F8B51B752B15DBA601C73B2793C82D3923496B796F6970A9E97 +9F6266A66B74521752A370C888C25EC9604B61906F2371497C3E7DF4806F0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +4F +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000084EE9023932C54429B6F6AD370898CC28DEF973252B45A415ECA5F046717 +697C69946D6A6F0F726272FC7BED8001807E874B90CE516D9E937984808B9332 +8AD6502D548C8A716B6A8CC4810760D167A09DF24E994E989C108A6B85C18568 +69006E7E78978155000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +50 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00005F0C4E104E154E2A4E314E364E3C4E3F4E424E564E584E824E858C6B4E8A +82125F0D4E8E4E9E4E9F4EA04EA24EB04EB34EB64ECE4ECD4EC44EC64EC24ED7 +4EDE4EED4EDF4EF74F094F5A4F304F5B4F5D4F574F474F764F884F8F4F984F7B +4F694F704F914F6F4F864F9651184FD44FDF4FCE4FD84FDB4FD14FDA4FD04FE4 +4FE5501A50285014502A502550054F1C4FF650215029502C4FFE4FEF50115006 +504350476703505550505048505A5056506C50785080509A508550B450B20000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +51 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000050C950CA50B350C250D650DE50E550ED50E350EE50F950F5510951015102 +511651155114511A5121513A5137513C513B513F51405152514C515451627AF8 +5169516A516E5180518256D8518C5189518F519151935195519651A451A651A2 +51A951AA51AB51B351B151B251B051B551BD51C551C951DB51E0865551E951ED +51F051F551FE5204520B5214520E5227522A522E52335239524F5244524B524C +525E5254526A527452695273527F527D528D529452925271528852918FA80000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +52 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00008FA752AC52AD52BC52B552C152CD52D752DE52E352E698ED52E052F352F5 +52F852F9530653087538530D5310530F5315531A5323532F5331533353385340 +534653454E175349534D51D6535E5369536E5918537B53775382539653A053A6 +53A553AE53B053B653C37C1296D953DF66FC71EE53EE53E853ED53FA5401543D +5440542C542D543C542E54365429541D544E548F5475548E545F547154775470 +5492547B5480547654845490548654C754A254B854A554AC54C454C854A80000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +53 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000054AB54C254A454BE54BC54D854E554E6550F551454FD54EE54ED54FA54E2 +553955405563554C552E555C55455556555755385533555D5599558054AF558A +559F557B557E5598559E55AE557C558355A9558755A855DA55C555DF55C455DC +55E455D4561455F7561655FE55FD561B55F9564E565071DF5634563656325638 +566B5664562F566C566A56865680568A56A05694568F56A556AE56B656B456C2 +56BC56C156C356C056C856CE56D156D356D756EE56F9570056FF570457090000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +54 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00005708570B570D57135718571655C7571C572657375738574E573B5740574F +576957C057885761577F5789579357A057B357A457AA57B057C357C657D457D2 +57D3580A57D657E3580B5819581D587258215862584B58706BC05852583D5879 +588558B9589F58AB58BA58DE58BB58B858AE58C558D358D158D758D958D858E5 +58DC58E458DF58EF58FA58F958FB58FC58FD5902590A5910591B68A65925592C +592D59325938593E7AD259555950594E595A5958596259605967596C59690000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +55 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000059785981599D4F5E4FAB59A359B259C659E859DC598D59D959DA5A255A1F +5A115A1C5A095A1A5A405A6C5A495A355A365A625A6A5A9A5ABC5ABE5ACB5AC2 +5ABD5AE35AD75AE65AE95AD65AFA5AFB5B0C5B0B5B165B325AD05B2A5B365B3E +5B435B455B405B515B555B5A5B5B5B655B695B705B735B755B7865885B7A5B80 +5B835BA65BB85BC35BC75BC95BD45BD05BE45BE65BE25BDE5BE55BEB5BF05BF6 +5BF35C055C075C085C0D5C135C205C225C285C385C395C415C465C4E5C530000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +56 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00005C505C4F5B715C6C5C6E4E625C765C795C8C5C915C94599B5CAB5CBB5CB6 +5CBC5CB75CC55CBE5CC75CD95CE95CFD5CFA5CED5D8C5CEA5D0B5D155D175D5C +5D1F5D1B5D115D145D225D1A5D195D185D4C5D525D4E5D4B5D6C5D735D765D87 +5D845D825DA25D9D5DAC5DAE5DBD5D905DB75DBC5DC95DCD5DD35DD25DD65DDB +5DEB5DF25DF55E0B5E1A5E195E115E1B5E365E375E445E435E405E4E5E575E54 +5E5F5E625E645E475E755E765E7A9EBC5E7F5EA05EC15EC25EC85ED05ECF0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +57 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00005ED65EE35EDD5EDA5EDB5EE25EE15EE85EE95EEC5EF15EF35EF05EF45EF8 +5EFE5F035F095F5D5F5C5F0B5F115F165F295F2D5F385F415F485F4C5F4E5F2F +5F515F565F575F595F615F6D5F735F775F835F825F7F5F8A5F885F915F875F9E +5F995F985FA05FA85FAD5FBC5FD65FFB5FE45FF85FF15FDD60B35FFF60216060 +601960106029600E6031601B6015602B6026600F603A605A6041606A6077605F +604A6046604D6063604360646042606C606B60596081608D60E76083609A0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +58 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00006084609B60966097609260A7608B60E160B860E060D360B45FF060BD60C6 +60B560D8614D6115610660F660F7610060F460FA6103612160FB60F1610D610E +6147613E61286127614A613F613C612C6134613D614261446173617761586159 +615A616B6174616F61656171615F615D6153617561996196618761AC6194619A +618A619161AB61AE61CC61CA61C961F761C861C361C661BA61CB7F7961CD61E6 +61E361F661FA61F461FF61FD61FC61FE620062086209620D620C6214621B0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +59 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000621E6221622A622E6230623262336241624E625E6263625B62606268627C +62826289627E62926293629662D46283629462D762D162BB62CF62FF62C664D4 +62C862DC62CC62CA62C262C7629B62C9630C62EE62F163276302630862EF62F5 +6350633E634D641C634F6396638E638063AB637663A3638F6389639F63B5636B +636963BE63E963C063C663E363C963D263F663C4641664346406641364266436 +651D64176428640F6467646F6476644E652A6495649364A564A9648864BC0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +5A +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000064DA64D264C564C764BB64D864C264F164E7820964E064E162AC64E364EF +652C64F664F464F264FA650064FD6518651C650565246523652B653465356537 +65366538754B654865566555654D6558655E655D65726578658265838B8A659B +659F65AB65B765C365C665C165C465CC65D265DB65D965E065E165F16772660A +660365FB6773663566366634661C664F664466496641665E665D666466676668 +665F6662667066836688668E668966846698669D66C166B966C966BE66BC0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +5B +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000066C466B866D666DA66E0663F66E666E966F066F566F7670F6716671E6726 +67279738672E673F67366741673867376746675E676067596763676467896770 +67A9677C676A678C678B67A667A1678567B767EF67B467EC67B367E967B867E4 +67DE67DD67E267EE67B967CE67C667E76A9C681E684668296840684D6832684E +68B3682B685968636877687F689F688F68AD6894689D689B68836AAE68B96874 +68B568A068BA690F688D687E690168CA690868D86922692668E1690C68CD0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +5C +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000068D468E768D569366912690468D768E3692568F968E068EF6928692A691A +6923692168C669796977695C6978696B6954697E696E69396974693D69596930 +6961695E695D6981696A69B269AE69D069BF69C169D369BE69CE5BE869CA69DD +69BB69C369A76A2E699169A0699C699569B469DE69E86A026A1B69FF6B0A69F9 +69F269E76A0569B16A1E69ED6A1469EB6A0A6A126AC16A236A136A446A0C6A72 +6A366A786A476A626A596A666A486A386A226A906A8D6AA06A846AA26AA30000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +5D +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00006A9786176ABB6AC36AC26AB86AB36AAC6ADE6AD16ADF6AAA6ADA6AEA6AFB +6B0586166AFA6B126B169B316B1F6B386B3776DC6B3998EE6B476B436B496B50 +6B596B546B5B6B5F6B616B786B796B7F6B806B846B836B8D6B986B956B9E6BA4 +6BAA6BAB6BAF6BB26BB16BB36BB76BBC6BC66BCB6BD36BDF6BEC6BEB6BF36BEF +9EBE6C086C136C146C1B6C246C236C5E6C556C626C6A6C826C8D6C9A6C816C9B +6C7E6C686C736C926C906CC46CF16CD36CBD6CD76CC56CDD6CAE6CB16CBE0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +5E +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00006CBA6CDB6CEF6CD96CEA6D1F884D6D366D2B6D3D6D386D196D356D336D12 +6D0C6D636D936D646D5A6D796D596D8E6D956FE46D856DF96E156E0A6DB56DC7 +6DE66DB86DC66DEC6DDE6DCC6DE86DD26DC56DFA6DD96DE46DD56DEA6DEE6E2D +6E6E6E2E6E196E726E5F6E3E6E236E6B6E2B6E766E4D6E1F6E436E3A6E4E6E24 +6EFF6E1D6E386E826EAA6E986EC96EB76ED36EBD6EAF6EC46EB26ED46ED56E8F +6EA56EC26E9F6F416F11704C6EEC6EF86EFE6F3F6EF26F316EEF6F326ECC0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +5F +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00006F3E6F136EF76F866F7A6F786F816F806F6F6F5B6FF36F6D6F826F7C6F58 +6F8E6F916FC26F666FB36FA36FA16FA46FB96FC66FAA6FDF6FD56FEC6FD46FD8 +6FF16FEE6FDB7009700B6FFA70117001700F6FFE701B701A6F74701D7018701F +7030703E7032705170637099709270AF70F170AC70B870B370AE70DF70CB70DD +70D9710970FD711C711971657155718871667162714C7156716C718F71FB7184 +719571A871AC71D771B971BE71D271C971D471CE71E071EC71E771F571FC0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +60 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000071F971FF720D7210721B7228722D722C72307232723B723C723F72407246 +724B72587274727E7282728172877292729672A272A772B972B272C372C672C4 +72CE72D272E272E072E172F972F7500F7317730A731C7316731D7334732F7329 +7325733E734E734F9ED87357736A7368737073787375737B737A73C873B373CE +73BB73C073E573EE73DE74A27405746F742573F87432743A7455743F745F7459 +7441745C746974707463746A7476747E748B749E74A774CA74CF74D473F10000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +61 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000074E074E374E774E974EE74F274F074F174F874F7750475037505750C750E +750D75157513751E7526752C753C7544754D754A7549755B7546755A75697564 +7567756B756D75787576758675877574758A758975827594759A759D75A575A3 +75C275B375C375B575BD75B875BC75B175CD75CA75D275D975E375DE75FE75FF +75FC760175F075FA75F275F3760B760D7609761F762776207621762276247634 +7630763B764776487646765C76587661766276687669766A7667766C76700000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +62 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000767276767678767C768076837688768B768E769676937699769A76B076B4 +76B876B976BA76C276CD76D676D276DE76E176E576E776EA862F76FB77087707 +770477297724771E77257726771B773777387747775A7768776B775B7765777F +777E7779778E778B779177A0779E77B077B677B977BF77BC77BD77BB77C777CD +77D777DA77DC77E377EE77FC780C781279267820792A7845788E78747886787C +789A788C78A378B578AA78AF78D178C678CB78D478BE78BC78C578CA78EC0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +63 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000078E778DA78FD78F47907791279117919792C792B794079607957795F795A +79557953797A797F798A799D79A79F4B79AA79AE79B379B979BA79C979D579E7 +79EC79E179E37A087A0D7A187A197A207A1F79807A317A3B7A3E7A377A437A57 +7A497A617A627A699F9D7A707A797A7D7A887A977A957A987A967AA97AC87AB0 +7AB67AC57AC47ABF90837AC77ACA7ACD7ACF7AD57AD37AD97ADA7ADD7AE17AE2 +7AE67AED7AF07B027B0F7B0A7B067B337B187B197B1E7B357B287B367B500000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +64 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00007B7A7B047B4D7B0B7B4C7B457B757B657B747B677B707B717B6C7B6E7B9D +7B987B9F7B8D7B9C7B9A7B8B7B927B8F7B5D7B997BCB7BC17BCC7BCF7BB47BC6 +7BDD7BE97C117C147BE67BE57C607C007C077C137BF37BF77C177C0D7BF67C23 +7C277C2A7C1F7C377C2B7C3D7C4C7C437C547C4F7C407C507C587C5F7C647C56 +7C657C6C7C757C837C907CA47CAD7CA27CAB7CA17CA87CB37CB27CB17CAE7CB9 +7CBD7CC07CC57CC27CD87CD27CDC7CE29B3B7CEF7CF27CF47CF67CFA7D060000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +65 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00007D027D1C7D157D0A7D457D4B7D2E7D327D3F7D357D467D737D567D4E7D72 +7D687D6E7D4F7D637D937D897D5B7D8F7D7D7D9B7DBA7DAE7DA37DB57DC77DBD +7DAB7E3D7DA27DAF7DDC7DB87D9F7DB07DD87DDD7DE47DDE7DFB7DF27DE17E05 +7E0A7E237E217E127E317E1F7E097E0B7E227E467E667E3B7E357E397E437E37 +7E327E3A7E677E5D7E567E5E7E597E5A7E797E6A7E697E7C7E7B7E837DD57E7D +8FAE7E7F7E887E897E8C7E927E907E937E947E967E8E7E9B7E9C7F387F3A0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +66 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00007F457F4C7F4D7F4E7F507F517F557F547F587F5F7F607F687F697F677F78 +7F827F867F837F887F877F8C7F947F9E7F9D7F9A7FA37FAF7FB27FB97FAE7FB6 +7FB88B717FC57FC67FCA7FD57FD47FE17FE67FE97FF37FF998DC80068004800B +801280188019801C80218028803F803B804A804680528058805A805F80628068 +80738072807080768079807D807F808480868085809B8093809A80AD519080AC +80DB80E580D980DD80C480DA80D6810980EF80F1811B81298123812F814B0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +67 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000968B8146813E8153815180FC8171816E81658166817481838188818A8180 +818281A0819581A481A3815F819381A981B081B581BE81B881BD81C081C281BA +81C981CD81D181D981D881C881DA81DF81E081E781FA81FB81FE820182028205 +8207820A820D821082168229822B82388233824082598258825D825A825F8264 +82628268826A826B822E827182778278827E828D829282AB829F82BB82AC82E1 +82E382DF82D282F482F382FA8393830382FB82F982DE830682DC830982D90000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +68 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000833583348316833283318340833983508345832F832B831783188385839A +83AA839F83A283968323838E8387838A837C83B58373837583A0838983A883F4 +841383EB83CE83FD840383D8840B83C183F7840783E083F2840D8422842083BD +8438850683FB846D842A843C855A84848477846B84AD846E848284698446842C +846F8479843584CA846284B984BF849F84D984CD84BB84DA84D084C184C684D6 +84A1852184FF84F485178518852C851F8515851484FC85408563855885480000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +69 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000085418602854B8555858085A485888591858A85A8856D8594859B85EA8587 +859C8577857E859085C985BA85CF85B985D085D585DD85E585DC85F9860A8613 +860B85FE85FA86068622861A8630863F864D4E558654865F86678671869386A3 +86A986AA868B868C86B686AF86C486C686B086C9882386AB86D486DE86E986EC +86DF86DB86EF8712870687088700870386FB87118709870D86F9870A8734873F +8737873B87258729871A8760875F8778874C874E877487578768876E87590000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +6A +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000087538763876A880587A2879F878287AF87CB87BD87C087D096D687AB87C4 +87B387C787C687BB87EF87F287E0880F880D87FE87F687F7880E87D288118816 +8815882288218831883688398827883B8844884288528859885E8862886B8881 +887E889E8875887D88B5887288828897889288AE889988A2888D88A488B088BF +88B188C388C488D488D888D988DD88F9890288FC88F488E888F28904890C890A +89138943891E8925892A892B89418944893B89368938894C891D8960895E0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +6B +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000089668964896D896A896F89748977897E89838988898A8993899889A189A9 +89A689AC89AF89B289BA89BD89BF89C089DA89DC89DD89E789F489F88A038A16 +8A108A0C8A1B8A1D8A258A368A418A5B8A528A468A488A7C8A6D8A6C8A628A85 +8A828A848AA88AA18A918AA58AA68A9A8AA38AC48ACD8AC28ADA8AEB8AF38AE7 +8AE48AF18B148AE08AE28AF78ADE8ADB8B0C8B078B1A8AE18B168B108B178B20 +8B3397AB8B268B2B8B3E8B288B418B4C8B4F8B4E8B498B568B5B8B5A8B6B0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +6C +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00008B5F8B6C8B6F8B748B7D8B808B8C8B8E8B928B938B968B998B9A8C3A8C41 +8C3F8C488C4C8C4E8C508C558C628C6C8C788C7A8C828C898C858C8A8C8D8C8E +8C948C7C8C98621D8CAD8CAA8CBD8CB28CB38CAE8CB68CC88CC18CE48CE38CDA +8CFD8CFA8CFB8D048D058D0A8D078D0F8D0D8D109F4E8D138CCD8D148D168D67 +8D6D8D718D738D818D998DC28DBE8DBA8DCF8DDA8DD68DCC8DDB8DCB8DEA8DEB +8DDF8DE38DFC8E088E098DFF8E1D8E1E8E108E1F8E428E358E308E348E4A0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +6D +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00008E478E498E4C8E508E488E598E648E608E2A8E638E558E768E728E7C8E81 +8E878E858E848E8B8E8A8E938E918E948E998EAA8EA18EAC8EB08EC68EB18EBE +8EC58EC88ECB8EDB8EE38EFC8EFB8EEB8EFE8F0A8F058F158F128F198F138F1C +8F1F8F1B8F0C8F268F338F3B8F398F458F428F3E8F4C8F498F468F4E8F578F5C +8F628F638F648F9C8F9F8FA38FAD8FAF8FB78FDA8FE58FE28FEA8FEF90878FF4 +90058FF98FFA901190159021900D901E9016900B90279036903590398FF80000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +6E +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000904F905090519052900E9049903E90569058905E9068906F907696A89072 +9082907D90819080908A9089908F90A890AF90B190B590E290E4624890DB9102 +9112911991329130914A9156915891639165916991739172918B9189918291A2 +91AB91AF91AA91B591B491BA91C091C191C991CB91D091D691DF91E191DB91FC +91F591F6921E91FF9214922C92159211925E925792459249926492489295923F +924B9250929C92969293929B925A92CF92B992B792E9930F92FA9344932E0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +6F +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000093199322931A9323933A9335933B935C9360937C936E935693B093AC93AD +939493B993D693D793E893E593D893C393DD93D093C893E4941A941494139403 +940794109436942B94359421943A944194529444945B94609462945E946A9229 +947094759477947D945A947C947E9481947F95829587958A9594959695989599 +95A095A895A795AD95BC95BB95B995BE95CA6FF695C395CD95CC95D595D495D6 +95DC95E195E595E296219628962E962F9642964C964F964B9677965C965E0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +70 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000965D965F96669672966C968D96989695969796AA96A796B196B296B096B4 +96B696B896B996CE96CB96C996CD894D96DC970D96D596F99704970697089713 +970E9711970F971697199724972A97309739973D973E97449746974897429749 +975C976097649766976852D2976B977197799785977C9781977A9786978B978F +9790979C97A897A697A397B397B497C397C697C897CB97DC97ED9F4F97F27ADF +97F697F5980F980C9838982498219837983D9846984F984B986B986F98700000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +71 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000098719874987398AA98AF98B198B698C498C398C698E998EB990399099912 +991499189921991D991E99249920992C992E993D993E9942994999459950994B +99519952994C99559997999899A599AD99AE99BC99DF99DB99DD99D899D199ED +99EE99F199F299FB99F89A019A0F9A0599E29A199A2B9A379A459A429A409A43 +9A3E9A559A4D9A5B9A579A5F9A629A659A649A699A6B9A6A9AAD9AB09ABC9AC0 +9ACF9AD19AD39AD49ADE9ADF9AE29AE39AE69AEF9AEB9AEE9AF49AF19AF70000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +72 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00009AFB9B069B189B1A9B1F9B229B239B259B279B289B299B2A9B2E9B2F9B32 +9B449B439B4F9B4D9B4E9B519B589B749B939B839B919B969B979B9F9BA09BA8 +9BB49BC09BCA9BB99BC69BCF9BD19BD29BE39BE29BE49BD49BE19C3A9BF29BF1 +9BF09C159C149C099C139C0C9C069C089C129C0A9C049C2E9C1B9C259C249C21 +9C309C479C329C469C3E9C5A9C609C679C769C789CE79CEC9CF09D099D089CEB +9D039D069D2A9D269DAF9D239D1F9D449D159D129D419D3F9D3E9D469D480000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +73 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00009D5D9D5E9D649D519D509D599D729D899D879DAB9D6F9D7A9D9A9DA49DA9 +9DB29DC49DC19DBB9DB89DBA9DC69DCF9DC29DD99DD39DF89DE69DED9DEF9DFD +9E1A9E1B9E1E9E759E799E7D9E819E889E8B9E8C9E929E959E919E9D9EA59EA9 +9EB89EAA9EAD97619ECC9ECE9ECF9ED09ED49EDC9EDE9EDD9EE09EE59EE89EEF +9EF49EF69EF79EF99EFB9EFC9EFD9F079F0876B79F159F219F2C9F3E9F4A9F52 +9F549F639F5F9F609F619F669F679F6C9F6A9F779F729F769F959F9C9FA00000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +74 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000582F69C79059746451DC7199000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +R +2141 301C FF5E +2142 2016 2225 +215D 2212 FF0D +2171 00A2 FFE0 +2172 00A3 FFE1 +224C 00AC FFE2 diff --git a/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/jis0212.enc b/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/jis0212.enc new file mode 100644 index 0000000000000000000000000000000000000000..cddbbba9d209b3547ebc1b9b520ad82c8796aef1 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/jis0212.enc @@ -0,0 +1,1159 @@ +# Encoding file: jis0212, double-byte +D +2244 0 68 +22 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000002D8 +02C700B802D902DD00AF02DB02DA007E03840385000000000000000000000000 +0000000000A100A600BF00000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000BA00AA00A900AE2122 +00A4211600000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +26 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000038603880389038A03AA0000038C0000038E03AB0000038F000000000000 +000003AC03AD03AE03AF03CA039003CC03C203CD03CB03B003CE000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +27 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000004020403040404050406040704080409040A040B040C040E040F0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000004520453045404550456045704580459045A045B045C045E045F0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +29 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000000C60110000001260000013200000141013F0000014A00D8015200000166 +00DE000000000000000000000000000000000000000000000000000000000000 +000000E6011100F00127013101330138014201400149014B00F8015300DF0167 +00FE000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +2A +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000000C100C000C400C2010201CD0100010400C500C301060108010C00C7010A +010E00C900C800CB00CA011A0116011201180000011C011E01220120012400CD +00CC00CF00CE01CF0130012A012E0128013401360139013D013B014301470145 +00D100D300D200D600D401D10150014C00D5015401580156015A015C0160015E +0164016200DA00D900DC00DB016C01D30170016A0172016E016801D701DB01D9 +01D5017400DD017801760179017D017B00000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +2B +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000000E100E000E400E2010301CE0101010500E500E301070109010D00E7010B +010F00E900E800EB00EA011B01170113011901F5011D011F00000121012500ED +00EC00EF00EE01D00000012B012F012901350137013A013E013C014401480146 +00F100F300F200F600F401D20151014D00F5015501590157015B015D0161015F +0165016300FA00F900FC00FB016D01D40171016B0173016F016901D801DC01DA +01D6017500FD00FF0177017A017E017C00000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +30 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00004E024E044E054E0C4E124E1F4E234E244E284E2B4E2E4E2F4E304E354E40 +4E414E444E474E514E5A4E5C4E634E684E694E744E754E794E7F4E8D4E964E97 +4E9D4EAF4EB94EC34ED04EDA4EDB4EE04EE14EE24EE84EEF4EF14EF34EF54EFD +4EFE4EFF4F004F024F034F084F0B4F0C4F124F154F164F174F194F2E4F314F60 +4F334F354F374F394F3B4F3E4F404F424F484F494F4B4F4C4F524F544F564F58 +4F5F4F634F6A4F6C4F6E4F714F774F784F794F7A4F7D4F7E4F814F824F840000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +31 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00004F854F894F8A4F8C4F8E4F904F924F934F944F974F994F9A4F9E4F9F4FB2 +4FB74FB94FBB4FBC4FBD4FBE4FC04FC14FC54FC64FC84FC94FCB4FCC4FCD4FCF +4FD24FDC4FE04FE24FF04FF24FFC4FFD4FFF5000500150045007500A500C500E +5010501350175018501B501C501D501E50225027502E50305032503350355040 +5041504250455046504A504C504E50515052505350575059505F506050625063 +50665067506A506D50705071503B5081508350845086508A508E508F50900000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +32 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00005092509350945096509B509C509E509F50A050A150A250AA50AF50B050B9 +50BA50BD50C050C350C450C750CC50CE50D050D350D450D850DC50DD50DF50E2 +50E450E650E850E950EF50F150F650FA50FE5103510651075108510B510C510D +510E50F2511051175119511B511C511D511E512351275128512C512D512F5131 +513351345135513851395142514A514F5153515551575158515F51645166517E +51835184518B518E5198519D51A151A351AD51B851BA51BC51BE51BF51C20000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +33 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000051C851CF51D151D251D351D551D851DE51E251E551EE51F251F351F451F7 +5201520252055212521352155216521852225228523152325235523C52455249 +525552575258525A525C525F526052615266526E527752785279528052825285 +528A528C52935295529652975298529A529C52A452A552A652A752AF52B052B6 +52B752B852BA52BB52BD52C052C452C652C852CC52CF52D152D452D652DB52DC +52E152E552E852E952EA52EC52F052F152F452F652F753005303530A530B0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +34 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000530C531153135318531B531C531E531F5325532753285329532B532C532D +533053325335533C533D533E5342534C534B5359535B536153635365536C536D +53725379537E538353875388538E539353945399539D53A153A453AA53AB53AF +53B253B453B553B753B853BA53BD53C053C553CF53D253D353D553DA53DD53DE +53E053E653E753F554025413541A542154275428542A542F5431543454355443 +54445447544D544F545E54625464546654675469546B546D546E5474547F0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +35 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000054815483548554885489548D549154955496549C549F54A154A654A754A9 +54AA54AD54AE54B154B754B954BA54BB54BF54C654CA54CD54CE54E054EA54EC +54EF54F654FC54FE54FF55005501550555085509550C550D550E5515552A552B +553255355536553B553C553D554155475549554A554D555055515558555A555B +555E5560556155645566557F5581558255865588558E558F5591559255935594 +559755A355A455AD55B255BF55C155C355C655C955CB55CC55CE55D155D20000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +36 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000055D355D755D855DB55DE55E255E955F655FF56055608560A560D560E560F +5610561156125619562C56305633563556375639563B563C563D563F56405641 +5643564456465649564B564D564F5654565E566056615662566356665669566D +566F567156725675568456855688568B568C56955699569A569D569E569F56A6 +56A756A856A956AB56AC56AD56B156B356B756BE56C556C956CA56CB56CF56D0 +56CC56CD56D956DC56DD56DF56E156E456E556E656E756E856F156EB56ED0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +37 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000056F656F7570157025707570A570C57115715571A571B571D572057225723 +572457255729572A572C572E572F57335734573D573E573F57455746574C574D +57525762576557675768576B576D576E576F5770577157735774577557775779 +577A577B577C577E57815783578C579457975799579A579C579D579E579F57A1 +579557A757A857A957AC57B857BD57C757C857CC57CF57D557DD57DE57E457E6 +57E757E957ED57F057F557F657F857FD57FE57FF580358045808580957E10000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +38 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000580C580D581B581E581F582058265827582D58325839583F5849584C584D +584F58505855585F58615864586758685878587C587F58805881588758885889 +588A588C588D588F589058945896589D58A058A158A258A658A958B158B258C4 +58BC58C258C858CD58CE58D058D258D458D658DA58DD58E158E258E958F35905 +5906590B590C5912591359148641591D5921592359245928592F593059335935 +5936593F59435946595259535959595B595D595E595F59615963596B596D0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +39 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000596F5972597559765979597B597C598B598C598E599259955997599F59A4 +59A759AD59AE59AF59B059B359B759BA59BC59C159C359C459C859CA59CD59D2 +59DD59DE59DF59E359E459E759EE59EF59F159F259F459F75A005A045A0C5A0D +5A0E5A125A135A1E5A235A245A275A285A2A5A2D5A305A445A455A475A485A4C +5A505A555A5E5A635A655A675A6D5A775A7A5A7B5A7E5A8B5A905A935A965A99 +5A9C5A9E5A9F5AA05AA25AA75AAC5AB15AB25AB35AB55AB85ABA5ABB5ABF0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +3A +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00005AC45AC65AC85ACF5ADA5ADC5AE05AE55AEA5AEE5AF55AF65AFD5B005B01 +5B085B175B345B195B1B5B1D5B215B255B2D5B385B415B4B5B4C5B525B565B5E +5B685B6E5B6F5B7C5B7D5B7E5B7F5B815B845B865B8A5B8E5B905B915B935B94 +5B965BA85BA95BAC5BAD5BAF5BB15BB25BB75BBA5BBC5BC05BC15BCD5BCF5BD6 +5BD75BD85BD95BDA5BE05BEF5BF15BF45BFD5C0C5C175C1E5C1F5C235C265C29 +5C2B5C2C5C2E5C305C325C355C365C595C5A5C5C5C625C635C675C685C690000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +3B +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00005C6D5C705C745C755C7A5C7B5C7C5C7D5C875C885C8A5C8F5C925C9D5C9F +5CA05CA25CA35CA65CAA5CB25CB45CB55CBA5CC95CCB5CD25CDD5CD75CEE5CF1 +5CF25CF45D015D065D0D5D125D2B5D235D245D265D275D315D345D395D3D5D3F +5D425D435D465D485D555D515D595D4A5D5F5D605D615D625D645D6A5D6D5D70 +5D795D7A5D7E5D7F5D815D835D885D8A5D925D935D945D955D995D9B5D9F5DA0 +5DA75DAB5DB05DB45DB85DB95DC35DC75DCB5DD05DCE5DD85DD95DE05DE40000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +3C +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00005DE95DF85DF95E005E075E0D5E125E145E155E185E1F5E205E2E5E285E32 +5E355E3E5E4B5E505E495E515E565E585E5B5E5C5E5E5E685E6A5E6B5E6C5E6D +5E6E5E705E805E8B5E8E5EA25EA45EA55EA85EAA5EAC5EB15EB35EBD5EBE5EBF +5EC65ECC5ECB5ECE5ED15ED25ED45ED55EDC5EDE5EE55EEB5F025F065F075F08 +5F0E5F195F1C5F1D5F215F225F235F245F285F2B5F2C5F2E5F305F345F365F3B +5F3D5F3F5F405F445F455F475F4D5F505F545F585F5B5F605F635F645F670000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +3D +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00005F6F5F725F745F755F785F7A5F7D5F7E5F895F8D5F8F5F965F9C5F9D5FA2 +5FA75FAB5FA45FAC5FAF5FB05FB15FB85FC45FC75FC85FC95FCB5FD05FD15FD2 +5FD35FD45FDE5FE15FE25FE85FE95FEA5FEC5FED5FEE5FEF5FF25FF35FF65FFA +5FFC6007600A600D6013601460176018601A601F6024602D6033603560406047 +60486049604C6051605460566057605D606160676071607E607F608260866088 +608A608E6091609360956098609D609E60A260A460A560A860B060B160B70000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +3E +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000060BB60BE60C260C460C860C960CA60CB60CE60CF60D460D560D960DB60DD +60DE60E260E560F260F560F860FC60FD61026107610A610C6110611161126113 +6114611661176119611C611E6122612A612B6130613161356136613761396141 +614561466149615E6160616C61726178617B617C617F6180618161836184618B +618D6192619361976198619C619D619F61A061A561A861AA61AD61B861B961BC +61C061C161C261CE61CF61D561DC61DD61DE61DF61E161E261E761E961E50000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +3F +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000061EC61ED61EF620162036204620762136215621C62206222622362276229 +622B6239623D6242624362446246624C62506251625262546256625A625C6264 +626D626F6273627A627D628D628E628F629062A662A862B362B662B762BA62BE +62BF62C462CE62D562D662DA62EA62F262F462FC62FD63036304630A630B630D +63106313631663186329632A632D633563366339633C63416342634363446346 +634A634B634E6352635363546358635B63656366636C636D6371637463750000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +40 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00006378637C637D637F638263846387638A6390639463956399639A639E63A4 +63A663AD63AE63AF63BD63C163C563C863CE63D163D363D463D563DC63E063E5 +63EA63EC63F263F363F563F863F96409640A6410641264146418641E64206422 +642464256429642A642F64306435643D643F644B644F6451645264536454645A +645B645C645D645F646064616463646D64736474647B647D64856487648F6490 +649164986499649B649D649F64A164A364A664A864AC64B364BD64BE64BF0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +41 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000064C464C964CA64CB64CC64CE64D064D164D564D764E464E564E964EA64ED +64F064F564F764FB64FF6501650465086509650A650F6513651465166519651B +651E651F652265266529652E6531653A653C653D654365476549655065526554 +655F65606567656B657A657D65816585658A659265956598659D65A065A365A6 +65AE65B265B365B465BF65C265C865C965CE65D065D465D665D865DF65F065F2 +65F465F565F965FE65FF6600660466086609660D6611661266156616661D0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +42 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000661E662166226623662466266629662A662B662C662E6630663166336639 +6637664066456646664A664C6651664E665766586659665B665C6660666166FB +666A666B666C667E66736675667F667766786679667B6680667C668B668C668D +669066926699669A669B669C669F66A066A466AD66B166B266B566BB66BF66C0 +66C266C366C866CC66CE66CF66D466DB66DF66E866EB66EC66EE66FA67056707 +670E67136719671C672067226733673E674567476748674C67546755675D0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +43 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00006766676C676E67746776677B67816784678E678F67916793679667986799 +679B67B067B167B267B567BB67BC67BD67F967C067C267C367C567C867C967D2 +67D767D967DC67E167E667F067F267F667F7685268146819681D681F68286827 +682C682D682F683068316833683B683F68446845684A684C685568576858685B +686B686E686F68706871687268756879687A687B687C68826884688668886896 +6898689A689C68A168A368A568A968AA68AE68B268BB68C568C868CC68CF0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +44 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000068D068D168D368D668D968DC68DD68E568E868EA68EB68EC68ED68F068F1 +68F568F668FB68FC68FD69066909690A69106911691369166917693169336935 +6938693B694269456949694E6957695B696369646965696669686969696C6970 +69716972697A697B697F6980698D69926996699869A169A569A669A869AB69AD +69AF69B769B869BA69BC69C569C869D169D669D769E269E569EE69EF69F169F3 +69F569FE6A006A016A036A0F6A116A156A1A6A1D6A206A246A286A306A320000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +45 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00006A346A376A3B6A3E6A3F6A456A466A496A4A6A4E6A506A516A526A556A56 +6A5B6A646A676A6A6A716A736A7E6A816A836A866A876A896A8B6A916A9B6A9D +6A9E6A9F6AA56AAB6AAF6AB06AB16AB46ABD6ABE6ABF6AC66AC96AC86ACC6AD0 +6AD46AD56AD66ADC6ADD6AE46AE76AEC6AF06AF16AF26AFC6AFD6B026B036B06 +6B076B096B0F6B106B116B176B1B6B1E6B246B286B2B6B2C6B2F6B356B366B3B +6B3F6B466B4A6B4D6B526B566B586B5D6B606B676B6B6B6E6B706B756B7D0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +46 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00006B7E6B826B856B976B9B6B9F6BA06BA26BA36BA86BA96BAC6BAD6BAE6BB0 +6BB86BB96BBD6BBE6BC36BC46BC96BCC6BD66BDA6BE16BE36BE66BE76BEE6BF1 +6BF76BF96BFF6C026C046C056C096C0D6C0E6C106C126C196C1F6C266C276C28 +6C2C6C2E6C336C356C366C3A6C3B6C3F6C4A6C4B6C4D6C4F6C526C546C596C5B +6C5C6C6B6C6D6C6F6C746C766C786C796C7B6C856C866C876C896C946C956C97 +6C986C9C6C9F6CB06CB26CB46CC26CC66CCD6CCF6CD06CD16CD26CD46CD60000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +47 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00006CDA6CDC6CE06CE76CE96CEB6CEC6CEE6CF26CF46D046D076D0A6D0E6D0F +6D116D136D1A6D266D276D286C676D2E6D2F6D316D396D3C6D3F6D576D5E6D5F +6D616D656D676D6F6D706D7C6D826D876D916D926D946D966D976D986DAA6DAC +6DB46DB76DB96DBD6DBF6DC46DC86DCA6DCE6DCF6DD66DDB6DDD6DDF6DE06DE2 +6DE56DE96DEF6DF06DF46DF66DFC6E006E046E1E6E226E276E326E366E396E3B +6E3C6E446E456E486E496E4B6E4F6E516E526E536E546E576E5C6E5D6E5E0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +48 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00006E626E636E686E736E7B6E7D6E8D6E936E996EA06EA76EAD6EAE6EB16EB3 +6EBB6EBF6EC06EC16EC36EC76EC86ECA6ECD6ECE6ECF6EEB6EED6EEE6EF96EFB +6EFD6F046F086F0A6F0C6F0D6F166F186F1A6F1B6F266F296F2A6F2F6F306F33 +6F366F3B6F3C6F2D6F4F6F516F526F536F576F596F5A6F5D6F5E6F616F626F68 +6F6C6F7D6F7E6F836F876F886F8B6F8C6F8D6F906F926F936F946F966F9A6F9F +6FA06FA56FA66FA76FA86FAE6FAF6FB06FB56FB66FBC6FC56FC76FC86FCA0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +49 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00006FDA6FDE6FE86FE96FF06FF56FF96FFC6FFD7000700570067007700D7017 +70207023702F703470377039703C7043704470487049704A704B70547055705D +705E704E70647065706C706E70757076707E7081708570867094709570967097 +7098709B70A470AB70B070B170B470B770CA70D170D370D470D570D670D870DC +70E470FA71037104710571067107710B710C710F711E7120712B712D712F7130 +713171387141714571467147714A714B715071527157715A715C715E71600000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +4A +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000071687179718071857187718C7192719A719B71A071A271AF71B071B271B3 +71BA71BF71C071C171C471CB71CC71D371D671D971DA71DC71F871FE72007207 +7208720972137217721A721D721F7224722B722F723472387239724172427243 +7245724E724F7250725372557256725A725C725E726072637268726B726E726F +727172777278727B727C727F72847289728D728E7293729B72A872AD72AE72B1 +72B472BE72C172C772C972CC72D572D672D872DF72E572F372F472FA72FB0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +4B +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000072FE7302730473057307730B730D7312731373187319731E732273247327 +7328732C733173327335733A733B733D7343734D7350735273567358735D735E +735F7360736673677369736B736C736E736F737173777379737C738073817383 +73857386738E73907393739573977398739C739E739F73A073A273A573A673AA +73AB73AD73B573B773B973BC73BD73BF73C573C673C973CB73CC73CF73D273D3 +73D673D973DD73E173E373E673E773E973F473F573F773F973FA73FB73FD0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +4C +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000073FF7400740174047407740A7411741A741B7424742674287429742A742B +742C742D742E742F74307431743974407443744474467447744B744D74517452 +7457745D7462746674677468746B746D746E7471747274807481748574867487 +7489748F74907491749274987499749A749C749F74A074A174A374A674A874A9 +74AA74AB74AE74AF74B174B274B574B974BB74BF74C874C974CC74D074D374D8 +74DA74DB74DE74DF74E474E874EA74EB74EF74F474FA74FB74FC74FF75060000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +4D +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000075127516751775207521752475277529752A752F75367539753D753E753F +7540754375477548754E755075527557755E755F7561756F75717579757A757B +757C757D757E7581758575907592759375957599759C75A275A475B475BA75BF +75C075C175C475C675CC75CE75CF75D775DC75DF75E075E175E475E775EC75EE +75EF75F175F9760076027603760476077608760A760C760F7612761376157616 +7619761B761C761D761E7623762576267629762D763276337635763876390000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +4E +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000763A763C764A764076417643764476457649764B76557659765F76647665 +766D766E766F7671767476817685768C768D7695769B769C769D769F76A076A2 +76A376A476A576A676A776A876AA76AD76BD76C176C576C976CB76CC76CE76D4 +76D976E076E676E876EC76F076F176F676F976FC77007706770A770E77127714 +771577177719771A771C77227728772D772E772F7734773577367739773D773E +774277457746774A774D774E774F775277567757775C775E775F776077620000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +4F +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000077647767776A776C7770777277737774777A777D77807784778C778D7794 +77957796779A779F77A277A777AA77AE77AF77B177B577BE77C377C977D177D2 +77D577D977DE77DF77E077E477E677EA77EC77F077F177F477F877FB78057806 +7809780D780E7811781D782178227823782D782E783078357837784378447847 +7848784C784E7852785C785E78607861786378647868786A786E787A787E788A +788F7894789878A1789D789E789F78A478A878AC78AD78B078B178B278B30000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +50 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000078BB78BD78BF78C778C878C978CC78CE78D278D378D578D678E478DB78DF +78E078E178E678EA78F278F3790078F678F778FA78FB78FF7906790C7910791A +791C791E791F7920792579277929792D793179347935793B793D793F79447945 +7946794A794B794F795179547958795B795C79677969796B79727979797B797C +797E798B798C799179937994799579967998799B799C79A179A879A979AB79AF +79B179B479B879BB79C279C479C779C879CA79CF79D479D679DA79DD79DE0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +51 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000079E079E279E579EA79EB79ED79F179F879FC7A027A037A077A097A0A7A0C +7A117A157A1B7A1E7A217A277A2B7A2D7A2F7A307A347A357A387A397A3A7A44 +7A457A477A487A4C7A557A567A597A5C7A5D7A5F7A607A657A677A6A7A6D7A75 +7A787A7E7A807A827A857A867A8A7A8B7A907A917A947A9E7AA07AA37AAC7AB3 +7AB57AB97ABB7ABC7AC67AC97ACC7ACE7AD17ADB7AE87AE97AEB7AEC7AF17AF4 +7AFB7AFD7AFE7B077B147B1F7B237B277B297B2A7B2B7B2D7B2E7B2F7B300000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +52 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00007B317B347B3D7B3F7B407B417B477B4E7B557B607B647B667B697B6A7B6D +7B6F7B727B737B777B847B897B8E7B907B917B967B9B7B9E7BA07BA57BAC7BAF +7BB07BB27BB57BB67BBA7BBB7BBC7BBD7BC27BC57BC87BCA7BD47BD67BD77BD9 +7BDA7BDB7BE87BEA7BF27BF47BF57BF87BF97BFA7BFC7BFE7C017C027C037C04 +7C067C097C0B7C0C7C0E7C0F7C197C1B7C207C257C267C287C2C7C317C337C34 +7C367C397C3A7C467C4A7C557C517C527C537C597C5A7C5B7C5C7C5D7C5E0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +53 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00007C617C637C677C697C6D7C6E7C707C727C797C7C7C7D7C867C877C8F7C94 +7C9E7CA07CA67CB07CB67CB77CBA7CBB7CBC7CBF7CC47CC77CC87CC97CCD7CCF +7CD37CD47CD57CD77CD97CDA7CDD7CE67CE97CEB7CF57D037D077D087D097D0F +7D117D127D137D167D1D7D1E7D237D267D2A7D2D7D317D3C7D3D7D3E7D407D41 +7D477D487D4D7D517D537D577D597D5A7D5C7D5D7D657D677D6A7D707D787D7A +7D7B7D7F7D817D827D837D857D867D887D8B7D8C7D8D7D917D967D977D9D0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +54 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00007D9E7DA67DA77DAA7DB37DB67DB77DB97DC27DC37DC47DC57DC67DCC7DCD +7DCE7DD77DD97E007DE27DE57DE67DEA7DEB7DED7DF17DF57DF67DF97DFA7E08 +7E107E117E157E177E1C7E1D7E207E277E287E2C7E2D7E2F7E337E367E3F7E44 +7E457E477E4E7E507E527E587E5F7E617E627E657E6B7E6E7E6F7E737E787E7E +7E817E867E877E8A7E8D7E917E957E987E9A7E9D7E9E7F3C7F3B7F3D7F3E7F3F +7F437F447F477F4F7F527F537F5B7F5C7F5D7F617F637F647F657F667F6D0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +55 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00007F717F7D7F7E7F7F7F807F8B7F8D7F8F7F907F917F967F977F9C7FA17FA2 +7FA67FAA7FAD7FB47FBC7FBF7FC07FC37FC87FCE7FCF7FDB7FDF7FE37FE57FE8 +7FEC7FEE7FEF7FF27FFA7FFD7FFE7FFF80078008800A800D800E800F80118013 +80148016801D801E801F802080248026802C802E80308034803580378039803A +803C803E80408044806080648066806D8071807580818088808E809C809E80A6 +80A780AB80B880B980C880CD80CF80D280D480D580D780D880E080ED80EE0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +56 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000080F080F280F380F680F980FA80FE8103810B811681178118811C811E8120 +81248127812C81308135813A813C81458147814A814C81528157816081618167 +81688169816D816F817781818190818481858186818B818E81968198819B819E +81A281AE81B281B481BB81CB81C381C581CA81CE81CF81D581D781DB81DD81DE +81E181E481EB81EC81F081F181F281F581F681F881F981FD81FF82008203820F +821382148219821A821D82218222822882328234823A82438244824582460000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +57 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000824B824E824F82518256825C826082638267826D8274827B827D827F8280 +82818283828482878289828A828E8291829482968298829A829B82A082A182A3 +82A482A782A882A982AA82AE82B082B282B482B782BA82BC82BE82BF82C682D0 +82D582DA82E082E282E482E882EA82ED82EF82F682F782FD82FE830083018307 +8308830A830B8354831B831D831E831F83218322832C832D832E833083338337 +833A833C833D8342834383448347834D834E8351835583568357837083780000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +58 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000837D837F8380838283848386838D83928394839583988399839B839C839D +83A683A783A983AC83BE83BF83C083C783C983CF83D083D183D483DD835383E8 +83EA83F683F883F983FC84018406840A840F84118415841983AD842F84398445 +84478448844A844D844F84518452845684588459845A845C8460846484658467 +846A84708473847484768478847C847D84818485849284938495849E84A684A8 +84A984AA84AF84B184B484BA84BD84BE84C084C284C784C884CC84CF84D30000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +59 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000084DC84E784EA84EF84F084F184F284F7853284FA84FB84FD850285038507 +850C850E8510851C851E85228523852485258527852A852B852F853385348536 +853F8546854F855085518552855385568559855C855D855E855F856085618562 +8564856B856F8579857A857B857D857F8581858585868589858B858C858F8593 +8598859D859F85A085A285A585A785B485B685B785B885BC85BD85BE85BF85C2 +85C785CA85CB85CE85AD85D885DA85DF85E085E685E885ED85F385F685FC0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +5A +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000085FF860086048605860D860E86108611861286188619861B861E86218627 +862986368638863A863C863D864086428646865286538656865786588659865D +866086618662866386648669866C866F867586768677867A868D869186968698 +869A869C86A186A686A786A886AD86B186B386B486B586B786B886B986BF86C0 +86C186C386C586D186D286D586D786DA86DC86E086E386E586E7868886FA86FC +86FD870487058707870B870E870F8710871387148719871E871F872187230000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +5B +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00008728872E872F873187328739873A873C873D873E874087438745874D8758 +875D876187648765876F87718772877B8783878487858786878787888789878B +878C879087938795879787988799879E87A087A387A787AC87AD87AE87B187B5 +87BE87BF87C187C887C987CA87CE87D587D687D987DA87DC87DF87E287E387E4 +87EA87EB87ED87F187F387F887FA87FF8801880388068809880A880B88108819 +8812881388148818881A881B881C881E881F8828882D882E8830883288350000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +5C +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000883A883C88418843884588488849884A884B884E8851885588568858885A +885C885F88608864886988718879887B88808898889A889B889C889F88A088A8 +88AA88BA88BD88BE88C088CA88CB88CC88CD88CE88D188D288D388DB88DE88E7 +88EF88F088F188F588F789018906890D890E890F8915891689188919891A891C +892089268927892889308931893289358939893A893E89408942894589468949 +894F89528957895A895B895C896189628963896B896E897089738975897A0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +5D +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000897B897C897D8989898D899089948995899B899C899F89A089A589B089B4 +89B589B689B789BC89D489D589D689D789D889E589E989EB89ED89F189F389F6 +89F989FD89FF8A048A058A078A0F8A118A128A148A158A1E8A208A228A248A26 +8A2B8A2C8A2F8A358A378A3D8A3E8A408A438A458A478A498A4D8A4E8A538A56 +8A578A588A5C8A5D8A618A658A678A758A768A778A798A7A8A7B8A7E8A7F8A80 +8A838A868A8B8A8F8A908A928A968A978A998A9F8AA78AA98AAE8AAF8AB30000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +5E +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00008AB68AB78ABB8ABE8AC38AC68AC88AC98ACA8AD18AD38AD48AD58AD78ADD +8ADF8AEC8AF08AF48AF58AF68AFC8AFF8B058B068B0B8B118B1C8B1E8B1F8B0A +8B2D8B308B378B3C8B428B438B448B458B468B488B528B538B548B598B4D8B5E +8B638B6D8B768B788B798B7C8B7E8B818B848B858B8B8B8D8B8F8B948B958B9C +8B9E8B9F8C388C398C3D8C3E8C458C478C498C4B8C4F8C518C538C548C578C58 +8C5B8C5D8C598C638C648C668C688C698C6D8C738C758C768C7B8C7E8C860000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +5F +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00008C878C8B8C908C928C938C998C9B8C9C8CA48CB98CBA8CC58CC68CC98CCB +8CCF8CD68CD58CD98CDD8CE18CE88CEC8CEF8CF08CF28CF58CF78CF88CFE8CFF +8D018D038D098D128D178D1B8D658D698D6C8D6E8D7F8D828D848D888D8D8D90 +8D918D958D9E8D9F8DA08DA68DAB8DAC8DAF8DB28DB58DB78DB98DBB8DC08DC5 +8DC68DC78DC88DCA8DCE8DD18DD48DD58DD78DD98DE48DE58DE78DEC8DF08DBC +8DF18DF28DF48DFD8E018E048E058E068E0B8E118E148E168E208E218E220000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +60 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00008E238E268E278E318E338E368E378E388E398E3D8E408E418E4B8E4D8E4E +8E4F8E548E5B8E5C8E5D8E5E8E618E628E698E6C8E6D8E6F8E708E718E798E7A +8E7B8E828E838E898E908E928E958E9A8E9B8E9D8E9E8EA28EA78EA98EAD8EAE +8EB38EB58EBA8EBB8EC08EC18EC38EC48EC78ECF8ED18ED48EDC8EE88EEE8EF0 +8EF18EF78EF98EFA8EED8F008F028F078F088F0F8F108F168F178F188F1E8F20 +8F218F238F258F278F288F2C8F2D8F2E8F348F358F368F378F3A8F408F410000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +61 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00008F438F478F4F8F518F528F538F548F558F588F5D8F5E8F658F9D8FA08FA1 +8FA48FA58FA68FB58FB68FB88FBE8FC08FC18FC68FCA8FCB8FCD8FD08FD28FD3 +8FD58FE08FE38FE48FE88FEE8FF18FF58FF68FFB8FFE900290049008900C9018 +901B90289029902F902A902C902D903390349037903F90439044904C905B905D +906290669067906C90709074907990859088908B908C908E9090909590979098 +9099909B90A090A190A290A590B090B290B390B490B690BD90CC90BE90C30000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +62 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000090C490C590C790C890D590D790D890D990DC90DD90DF90E590D290F690EB +90EF90F090F490FE90FF91009104910591069108910D91109114911691179118 +911A911C911E912091259122912391279129912E912F91319134913691379139 +913A913C913D914391479148914F915391579159915A915B916191649167916D +91749179917A917B9181918391859186918A918E91919193919491959198919E +91A191A691A891AC91AD91AE91B091B191B291B391B691BB91BC91BD91BF0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +63 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000091C291C391C591D391D491D791D991DA91DE91E491E591E991EA91EC91ED +91EE91EF91F091F191F791F991FB91FD9200920192049205920692079209920A +920C92109212921392169218921C921D92239224922592269228922E922F9230 +92339235923692389239923A923C923E92409242924392469247924A924D924E +924F925192589259925C925D926092619265926792689269926E926F92709275 +9276927792789279927B927C927D927F92889289928A928D928E929292970000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +64 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00009299929F92A092A492A592A792A892AB92AF92B292B692B892BA92BB92BC +92BD92BF92C092C192C292C392C592C692C792C892CB92CC92CD92CE92D092D3 +92D592D792D892D992DC92DD92DF92E092E192E392E592E792E892EC92EE92F0 +92F992FB92FF930093029308930D931193149315931C931D931E931F93219324 +932593279329932A933393349336933793479348934993509351935293559357 +9358935A935E9364936593679369936A936D936F937093719373937493760000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +65 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000937A937D937F9380938193829388938A938B938D938F939293959398939B +939E93A193A393A493A693A893AB93B493B593B693BA93A993C193C493C593C6 +93C793C993CA93CB93CC93CD93D393D993DC93DE93DF93E293E693E793F993F7 +93F893FA93FB93FD94019402940494089409940D940E940F941594169417941F +942E942F9431943294339434943B943F943D944394459448944A944C94559459 +945C945F946194639468946B946D946E946F9471947294849483957895790000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +66 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000957E95849588958C958D958E959D959E959F95A195A695A995AB95AC95B4 +95B695BA95BD95BF95C695C895C995CB95D095D195D295D395D995DA95DD95DE +95DF95E095E495E6961D961E9622962496259626962C96319633963796389639 +963A963C963D9641965296549656965796589661966E9674967B967C967E967F +9681968296839684968996919696969A969D969F96A496A596A696A996AE96AF +96B396BA96CA96D25DB296D896DA96DD96DE96DF96E996EF96F196FA97020000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +67 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000970397059709971A971B971D97219722972397289731973397419743974A +974E974F975597579758975A975B97639767976A976E9773977697779778977B +977D977F978097899795979697979799979A979E979F97A297AC97AE97B197B2 +97B597B697B897B997BA97BC97BE97BF97C197C497C597C797C997CA97CC97CD +97CE97D097D197D497D797D897D997DD97DE97E097DB97E197E497EF97F197F4 +97F797F897FA9807980A9819980D980E98149816981C981E9820982398260000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +68 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000982B982E982F98309832983398359825983E98449847984A985198529853 +985698579859985A9862986398659866986A986C98AB98AD98AE98B098B498B7 +98B898BA98BB98BF98C298C598C898CC98E198E398E598E698E798EA98F398F6 +9902990799089911991599169917991A991B991C991F992299269927992B9931 +99329933993499359939993A993B993C99409941994699479948994D994E9954 +99589959995B995C995E995F9960999B999D999F99A699B099B199B299B50000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +69 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000099B999BA99BD99BF99C399C999D399D499D999DA99DC99DE99E799EA99EB +99EC99F099F499F599F999FD99FE9A029A039A049A0B9A0C9A109A119A169A1E +9A209A229A239A249A279A2D9A2E9A339A359A369A389A479A419A449A4A9A4B +9A4C9A4E9A519A549A569A5D9AAA9AAC9AAE9AAF9AB29AB49AB59AB69AB99ABB +9ABE9ABF9AC19AC39AC69AC89ACE9AD09AD29AD59AD69AD79ADB9ADC9AE09AE4 +9AE59AE79AE99AEC9AF29AF39AF59AF99AFA9AFD9AFF9B009B019B029B030000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +6A +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00009B049B059B089B099B0B9B0C9B0D9B0E9B109B129B169B199B1B9B1C9B20 +9B269B2B9B2D9B339B349B359B379B399B3A9B3D9B489B4B9B4C9B559B569B57 +9B5B9B5E9B619B639B659B669B689B6A9B6B9B6C9B6D9B6E9B739B759B779B78 +9B799B7F9B809B849B859B869B879B899B8A9B8B9B8D9B8F9B909B949B9A9B9D +9B9E9BA69BA79BA99BAC9BB09BB19BB29BB79BB89BBB9BBC9BBE9BBF9BC19BC7 +9BC89BCE9BD09BD79BD89BDD9BDF9BE59BE79BEA9BEB9BEF9BF39BF79BF80000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +6B +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00009BF99BFA9BFD9BFF9C009C029C0B9C0F9C119C169C189C199C1A9C1C9C1E +9C229C239C269C279C289C299C2A9C319C359C369C379C3D9C419C439C449C45 +9C499C4A9C4E9C4F9C509C539C549C569C589C5B9C5D9C5E9C5F9C639C699C6A +9C5C9C6B9C689C6E9C709C729C759C779C7B9CE69CF29CF79CF99D0B9D029D11 +9D179D189D1C9D1D9D1E9D2F9D309D329D339D349D3A9D3C9D459D3D9D429D43 +9D479D4A9D539D549D5F9D639D629D659D699D6A9D6B9D709D769D779D7B0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +6C +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00009D7C9D7E9D839D849D869D8A9D8D9D8E9D929D939D959D969D979D989DA1 +9DAA9DAC9DAE9DB19DB59DB99DBC9DBF9DC39DC79DC99DCA9DD49DD59DD69DD7 +9DDA9DDE9DDF9DE09DE59DE79DE99DEB9DEE9DF09DF39DF49DFE9E0A9E029E07 +9E0E9E109E119E129E159E169E199E1C9E1D9E7A9E7B9E7C9E809E829E839E84 +9E859E879E8E9E8F9E969E989E9B9E9E9EA49EA89EAC9EAE9EAF9EB09EB39EB4 +9EB59EC69EC89ECB9ED59EDF9EE49EE79EEC9EED9EEE9EF09EF19EF29EF50000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +6D +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00009EF89EFF9F029F039F099F0F9F109F119F129F149F169F179F199F1A9F1B +9F1F9F229F269F2A9F2B9F2F9F319F329F349F379F399F3A9F3C9F3D9F3F9F41 +9F439F449F459F469F479F539F559F569F579F589F5A9F5D9F5E9F689F699F6D +9F6E9F6F9F709F719F739F759F7A9F7D9F8F9F909F919F929F949F969F979F9E +9FA19FA29FA39FA5000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 diff --git a/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/koi8-r.enc b/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/koi8-r.enc new file mode 100644 index 0000000000000000000000000000000000000000..49bf2ea65cf85811e8f32d219b5ebbfe3792bd71 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/koi8-r.enc @@ -0,0 +1,20 @@ +# Encoding file: koi8-r, single-byte +S +003F 0 1 +00 +0000000100020003000400050006000700080009000A000B000C000D000E000F +0010001100120013001400150016001700180019001A001B001C001D001E001F +0020002100220023002400250026002700280029002A002B002C002D002E002F +0030003100320033003400350036003700380039003A003B003C003D003E003F +0040004100420043004400450046004700480049004A004B004C004D004E004F +0050005100520053005400550056005700580059005A005B005C005D005E005F +0060006100620063006400650066006700680069006A006B006C006D006E006F +0070007100720073007400750076007700780079007A007B007C007D007E007F +25002502250C251025142518251C2524252C2534253C258025842588258C2590 +259125922593232025A02219221A22482264226500A0232100B000B200B700F7 +25502551255204512553255425552556255725582559255A255B255C255D255E +255F25602561040125622563256425652566256725682569256A256B256C00A9 +044E0430043104460434043504440433044504380439043A043B043C043D043E +043F044F044004410442044304360432044C044B04370448044D04490447044A +042E0410041104260414041504240413042504180419041A041B041C041D041E +041F042F042004210422042304160412042C042B04170428042D04290427042A diff --git a/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/koi8-ru.enc b/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/koi8-ru.enc new file mode 100644 index 0000000000000000000000000000000000000000..52a8b364c121c57cceeb047463d568f098f741da --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/koi8-ru.enc @@ -0,0 +1,20 @@ +# Encoding file: koi8-ru, single-byte +S +003F 0 1 +00 +0000000100020003000400050006000700080009000A000B000C000D000E000F +0010001100120013001400150016001700180019001A001B001C001D001E001F +0020002100220023002400250026002700280029002A002B002C002D002E002F +0030003100320033003400350036003700380039003A003B003C003D003E003F +0040004100420043004400450046004700480049004A004B004C004D004E004F +0050005100520053005400550056005700580059005A005B005C005D005E005F +0060006100620063006400650066006700680069006A006B006C006D006E006F +0070007100720073007400750076007700780079007A007B007C007D007E007F +25002502250C251025142518251C2524252C2534253C258025842588258C2590 +259125922593232025A02219221A22482264226500A0232100B000B200B700F7 +25502551255204510454255404560457255725582559255A255B0491045E255E +255F25602561040104042563040604072566256725682569256A0490040E00A9 +044E0430043104460434043504440433044504380439043A043B043C043D043E +043F044F044004410442044304360432044C044B04370448044D04490447044A +042E0410041104260414041504240413042504180419041A041B041C041D041E +041F042F042004210422042304160412042C042B04170428042D04290427042A diff --git a/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/koi8-t.enc b/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/koi8-t.enc new file mode 100644 index 0000000000000000000000000000000000000000..23b2de77e25d161d32c5eb7d28a5cc7eb06454e4 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/koi8-t.enc @@ -0,0 +1,20 @@ +# Encoding file: koi8-t, single-byte +S +003F 0 1 +00 +0000000100020003000400050006000700080009000A000B000C000D000E000F +0010001100120013001400150016001700180019001A001B001C001D001E001F +0020002100220023002400250026002700280029002A002B002C002D002E002F +0030003100320033003400350036003700380039003A003B003C003D003E003F +0040004100420043004400450046004700480049004A004B004C004D004E004F +0050005100520053005400550056005700580059005A005B005C005D005E005F +0060006100620063006400650066006700680069006A006B006C006D006E006F +0070007100720073007400750076007700780079007A007B007C007D007E007F +049B0493201A0492201E2026202020210000203004B3203904B204B704B60000 +049A20182019201C201D202220132014000021220000203A0000000000000000 +000004EF04EE045100A404E300A600A700000000000000AB00AC00AD00AE0000 +00B000B100B20401000004E200B600B700002116000000BB00000000000000A9 +044E0430043104460434043504440433044504380439043A043B043C043D043E +043F044F044004410442044304360432044C044B04370448044D04490447044A +042E0410041104260414041504240413042504180419041A041B041C041D041E +041F042F042004210422042304160412042C042B04170428042D04290427042A diff --git a/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/koi8-u.enc b/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/koi8-u.enc new file mode 100644 index 0000000000000000000000000000000000000000..332f924ca4f0e77a5fb8a2ed5df1a6a108b65a75 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/koi8-u.enc @@ -0,0 +1,20 @@ +# Encoding file: koi8-u, single-byte +S +003F 0 1 +00 +0000000100020003000400050006000700080009000A000B000C000D000E000F +0010001100120013001400150016001700180019001A001B001C001D001E001F +0020002100220023002400250026002700280029002A002B002C002D002E002F +0030003100320033003400350036003700380039003A003B003C003D003E003F +0040004100420043004400450046004700480049004A004B004C004D004E004F +0050005100520053005400550056005700580059005A005B005C005D005E005F +0060006100620063006400650066006700680069006A006B006C006D006E006F +0070007100720073007400750076007700780079007A007B007C007D007E007F +25002502250C251025142518251C2524252C2534253C258025842588258C2590 +259125922593232025A02219221A22482264226500A0232100B000B200B700F7 +25502551255204510454255404560457255725582559255A255B0491255D255E +255F25602561040104042563040604072566256725682569256A0490256C00A9 +044E0430043104460434043504440433044504380439043A043B043C043D043E +043F044F044004410442044304360432044C044B04370448044D04490447044A +042E0410041104260414041504240413042504180419041A041B041C041D041E +041F042F042004210422042304160412042C042B04170428042D04290427042A diff --git a/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/ksc5601.enc b/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/ksc5601.enc new file mode 100644 index 0000000000000000000000000000000000000000..bec61d0ff846c818f887f458bf528b2e15d9cf67 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/ksc5601.enc @@ -0,0 +1,1516 @@ +# Encoding file: ksc5601, double-byte +D +233F 0 89 +21 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000030003001300200B72025202600A8300300AD20152225FF3C223C20182019 +201C201D3014301530083009300A300B300C300D300E300F3010301100B100D7 +00F7226022642265221E223400B0203220332103212BFFE0FFE1FFE526422640 +222022A52312220222072261225200A7203B2606260525CB25CF25CE25C725C6 +25A125A025B325B225BD25BC219221902191219321943013226A226B221A223D +221D2235222B222C2208220B2286228722822283222A222922272228FFE20000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +22 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000021D221D42200220300B4FF5E02C702D802DD02DA02D900B802DB00A100BF +02D0222E2211220F00A42109203025C125C025B725B626642660266126652667 +2663229925C825A325D025D1259225A425A525A825A725A625A92668260F260E +261C261E00B62020202121952197219921962198266D2669266A266C327F321C +211633C7212233C233D821210000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +23 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000FF01FF02FF03FF04FF05FF06FF07FF08FF09FF0AFF0BFF0CFF0DFF0EFF0F +FF10FF11FF12FF13FF14FF15FF16FF17FF18FF19FF1AFF1BFF1CFF1DFF1EFF1F +FF20FF21FF22FF23FF24FF25FF26FF27FF28FF29FF2AFF2BFF2CFF2DFF2EFF2F +FF30FF31FF32FF33FF34FF35FF36FF37FF38FF39FF3AFF3BFFE6FF3DFF3EFF3F +FF40FF41FF42FF43FF44FF45FF46FF47FF48FF49FF4AFF4BFF4CFF4DFF4EFF4F +FF50FF51FF52FF53FF54FF55FF56FF57FF58FF59FF5AFF5BFF5CFF5DFFE30000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +24 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000313131323133313431353136313731383139313A313B313C313D313E313F +3140314131423143314431453146314731483149314A314B314C314D314E314F +3150315131523153315431553156315731583159315A315B315C315D315E315F +3160316131623163316431653166316731683169316A316B316C316D316E316F +3170317131723173317431753176317731783179317A317B317C317D317E317F +3180318131823183318431853186318731883189318A318B318C318D318E0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +25 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000217021712172217321742175217621772178217900000000000000000000 +2160216121622163216421652166216721682169000000000000000000000000 +0000039103920393039403950396039703980399039A039B039C039D039E039F +03A003A103A303A403A503A603A703A803A90000000000000000000000000000 +000003B103B203B303B403B503B603B703B803B903BA03BB03BC03BD03BE03BF +03C003C103C303C403C503C603C703C803C90000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +26 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000025002502250C251025182514251C252C25242534253C25012503250F2513 +251B251725232533252B253B254B2520252F25282537253F251D253025252538 +254225122511251A251925162515250E250D251E251F25212522252625272529 +252A252D252E25312532253525362539253A253D253E25402541254325442545 +2546254725482549254A00000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +27 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00003395339633972113339833C433A333A433A533A63399339A339B339C339D +339E339F33A033A133A233CA338D338E338F33CF3388338933C833A733A833B0 +33B133B233B333B433B533B633B733B833B93380338133823383338433BA33BB +33BC33BD33BE33BF33903391339233933394212633C033C1338A338B338C33D6 +33C533AD33AE33AF33DB33A933AA33AB33AC33DD33D033D333C333C933DC33C6 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +28 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000000C600D000AA0126000001320000013F014100D8015200BA00DE0166014A +00003260326132623263326432653266326732683269326A326B326C326D326E +326F3270327132723273327432753276327732783279327A327B24D024D124D2 +24D324D424D524D624D724D824D924DA24DB24DC24DD24DE24DF24E024E124E2 +24E324E424E524E624E724E824E9246024612462246324642465246624672468 +2469246A246B246C246D246E00BD2153215400BC00BE215B215C215D215E0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +29 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000000E6011100F001270131013301380140014200F8015300DF00FE0167014B +01493200320132023203320432053206320732083209320A320B320C320D320E +320F3210321132123213321432153216321732183219321A321B249C249D249E +249F24A024A124A224A324A424A524A624A724A824A924AA24AB24AC24AD24AE +24AF24B024B124B224B324B424B5247424752476247724782479247A247B247C +247D247E247F24802481248200B900B200B32074207F20812082208320840000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +2A +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000304130423043304430453046304730483049304A304B304C304D304E304F +3050305130523053305430553056305730583059305A305B305C305D305E305F +3060306130623063306430653066306730683069306A306B306C306D306E306F +3070307130723073307430753076307730783079307A307B307C307D307E307F +3080308130823083308430853086308730883089308A308B308C308D308E308F +3090309130923093000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +2B +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000030A130A230A330A430A530A630A730A830A930AA30AB30AC30AD30AE30AF +30B030B130B230B330B430B530B630B730B830B930BA30BB30BC30BD30BE30BF +30C030C130C230C330C430C530C630C730C830C930CA30CB30CC30CD30CE30CF +30D030D130D230D330D430D530D630D730D830D930DA30DB30DC30DD30DE30DF +30E030E130E230E330E430E530E630E730E830E930EA30EB30EC30ED30EE30EF +30F030F130F230F330F430F530F6000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +2C +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000004100411041204130414041504010416041704180419041A041B041C041D +041E041F0420042104220423042404250426042704280429042A042B042C042D +042E042F00000000000000000000000000000000000000000000000000000000 +000004300431043204330434043504510436043704380439043A043B043C043D +043E043F0440044104420443044404450446044704480449044A044B044C044D +044E044F00000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +30 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000AC00AC01AC04AC07AC08AC09AC0AAC10AC11AC12AC13AC14AC15AC16AC17 +AC19AC1AAC1BAC1CAC1DAC20AC24AC2CAC2DAC2FAC30AC31AC38AC39AC3CAC40 +AC4BAC4DAC54AC58AC5CAC70AC71AC74AC77AC78AC7AAC80AC81AC83AC84AC85 +AC86AC89AC8AAC8BAC8CAC90AC94AC9CAC9DAC9FACA0ACA1ACA8ACA9ACAAACAC +ACAFACB0ACB8ACB9ACBBACBCACBDACC1ACC4ACC8ACCCACD5ACD7ACE0ACE1ACE4 +ACE7ACE8ACEAACECACEFACF0ACF1ACF3ACF5ACF6ACFCACFDAD00AD04AD060000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +31 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000AD0CAD0DAD0FAD11AD18AD1CAD20AD29AD2CAD2DAD34AD35AD38AD3CAD44 +AD45AD47AD49AD50AD54AD58AD61AD63AD6CAD6DAD70AD73AD74AD75AD76AD7B +AD7CAD7DAD7FAD81AD82AD88AD89AD8CAD90AD9CAD9DADA4ADB7ADC0ADC1ADC4 +ADC8ADD0ADD1ADD3ADDCADE0ADE4ADF8ADF9ADFCADFFAE00AE01AE08AE09AE0B +AE0DAE14AE30AE31AE34AE37AE38AE3AAE40AE41AE43AE45AE46AE4AAE4CAE4D +AE4EAE50AE54AE56AE5CAE5DAE5FAE60AE61AE65AE68AE69AE6CAE70AE780000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +32 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000AE79AE7BAE7CAE7DAE84AE85AE8CAEBCAEBDAEBEAEC0AEC4AECCAECDAECF +AED0AED1AED8AED9AEDCAEE8AEEBAEEDAEF4AEF8AEFCAF07AF08AF0DAF10AF2C +AF2DAF30AF32AF34AF3CAF3DAF3FAF41AF42AF43AF48AF49AF50AF5CAF5DAF64 +AF65AF79AF80AF84AF88AF90AF91AF95AF9CAFB8AFB9AFBCAFC0AFC7AFC8AFC9 +AFCBAFCDAFCEAFD4AFDCAFE8AFE9AFF0AFF1AFF4AFF8B000B001B004B00CB010 +B014B01CB01DB028B044B045B048B04AB04CB04EB053B054B055B057B0590000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +33 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000B05DB07CB07DB080B084B08CB08DB08FB091B098B099B09AB09CB09FB0A0 +B0A1B0A2B0A8B0A9B0ABB0ACB0ADB0AEB0AFB0B1B0B3B0B4B0B5B0B8B0BCB0C4 +B0C5B0C7B0C8B0C9B0D0B0D1B0D4B0D8B0E0B0E5B108B109B10BB10CB110B112 +B113B118B119B11BB11CB11DB123B124B125B128B12CB134B135B137B138B139 +B140B141B144B148B150B151B154B155B158B15CB160B178B179B17CB180B182 +B188B189B18BB18DB192B193B194B198B19CB1A8B1CCB1D0B1D4B1DCB1DD0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +34 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000B1DFB1E8B1E9B1ECB1F0B1F9B1FBB1FDB204B205B208B20BB20CB214B215 +B217B219B220B234B23CB258B25CB260B268B269B274B275B27CB284B285B289 +B290B291B294B298B299B29AB2A0B2A1B2A3B2A5B2A6B2AAB2ACB2B0B2B4B2C8 +B2C9B2CCB2D0B2D2B2D8B2D9B2DBB2DDB2E2B2E4B2E5B2E6B2E8B2EBB2ECB2ED +B2EEB2EFB2F3B2F4B2F5B2F7B2F8B2F9B2FAB2FBB2FFB300B301B304B308B310 +B311B313B314B315B31CB354B355B356B358B35BB35CB35EB35FB364B3650000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +35 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000B367B369B36BB36EB370B371B374B378B380B381B383B384B385B38CB390 +B394B3A0B3A1B3A8B3ACB3C4B3C5B3C8B3CBB3CCB3CEB3D0B3D4B3D5B3D7B3D9 +B3DBB3DDB3E0B3E4B3E8B3FCB410B418B41CB420B428B429B42BB434B450B451 +B454B458B460B461B463B465B46CB480B488B49DB4A4B4A8B4ACB4B5B4B7B4B9 +B4C0B4C4B4C8B4D0B4D5B4DCB4DDB4E0B4E3B4E4B4E6B4ECB4EDB4EFB4F1B4F8 +B514B515B518B51BB51CB524B525B527B528B529B52AB530B531B534B5380000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +36 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000B540B541B543B544B545B54BB54CB54DB550B554B55CB55DB55FB560B561 +B5A0B5A1B5A4B5A8B5AAB5ABB5B0B5B1B5B3B5B4B5B5B5BBB5BCB5BDB5C0B5C4 +B5CCB5CDB5CFB5D0B5D1B5D8B5ECB610B611B614B618B625B62CB634B648B664 +B668B69CB69DB6A0B6A4B6ABB6ACB6B1B6D4B6F0B6F4B6F8B700B701B705B728 +B729B72CB72FB730B738B739B73BB744B748B74CB754B755B760B764B768B770 +B771B773B775B77CB77DB780B784B78CB78DB78FB790B791B792B796B7970000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +37 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000B798B799B79CB7A0B7A8B7A9B7ABB7ACB7ADB7B4B7B5B7B8B7C7B7C9B7EC +B7EDB7F0B7F4B7FCB7FDB7FFB800B801B807B808B809B80CB810B818B819B81B +B81DB824B825B828B82CB834B835B837B838B839B840B844B851B853B85CB85D +B860B864B86CB86DB86FB871B878B87CB88DB8A8B8B0B8B4B8B8B8C0B8C1B8C3 +B8C5B8CCB8D0B8D4B8DDB8DFB8E1B8E8B8E9B8ECB8F0B8F8B8F9B8FBB8FDB904 +B918B920B93CB93DB940B944B94CB94FB951B958B959B95CB960B968B9690000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +38 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000B96BB96DB974B975B978B97CB984B985B987B989B98AB98DB98EB9ACB9AD +B9B0B9B4B9BCB9BDB9BFB9C1B9C8B9C9B9CCB9CEB9CFB9D0B9D1B9D2B9D8B9D9 +B9DBB9DDB9DEB9E1B9E3B9E4B9E5B9E8B9ECB9F4B9F5B9F7B9F8B9F9B9FABA00 +BA01BA08BA15BA38BA39BA3CBA40BA42BA48BA49BA4BBA4DBA4EBA53BA54BA55 +BA58BA5CBA64BA65BA67BA68BA69BA70BA71BA74BA78BA83BA84BA85BA87BA8C +BAA8BAA9BAABBAACBAB0BAB2BAB8BAB9BABBBABDBAC4BAC8BAD8BAD9BAFC0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +39 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000BB00BB04BB0DBB0FBB11BB18BB1CBB20BB29BB2BBB34BB35BB36BB38BB3B +BB3CBB3DBB3EBB44BB45BB47BB49BB4DBB4FBB50BB54BB58BB61BB63BB6CBB88 +BB8CBB90BBA4BBA8BBACBBB4BBB7BBC0BBC4BBC8BBD0BBD3BBF8BBF9BBFCBBFF +BC00BC02BC08BC09BC0BBC0CBC0DBC0FBC11BC14BC15BC16BC17BC18BC1BBC1C +BC1DBC1EBC1FBC24BC25BC27BC29BC2DBC30BC31BC34BC38BC40BC41BC43BC44 +BC45BC49BC4CBC4DBC50BC5DBC84BC85BC88BC8BBC8CBC8EBC94BC95BC970000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +3A +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000BC99BC9ABCA0BCA1BCA4BCA7BCA8BCB0BCB1BCB3BCB4BCB5BCBCBCBDBCC0 +BCC4BCCDBCCFBCD0BCD1BCD5BCD8BCDCBCF4BCF5BCF6BCF8BCFCBD04BD05BD07 +BD09BD10BD14BD24BD2CBD40BD48BD49BD4CBD50BD58BD59BD64BD68BD80BD81 +BD84BD87BD88BD89BD8ABD90BD91BD93BD95BD99BD9ABD9CBDA4BDB0BDB8BDD4 +BDD5BDD8BDDCBDE9BDF0BDF4BDF8BE00BE03BE05BE0CBE0DBE10BE14BE1CBE1D +BE1FBE44BE45BE48BE4CBE4EBE54BE55BE57BE59BE5ABE5BBE60BE61BE640000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +3B +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000BE68BE6ABE70BE71BE73BE74BE75BE7BBE7CBE7DBE80BE84BE8CBE8DBE8F +BE90BE91BE98BE99BEA8BED0BED1BED4BED7BED8BEE0BEE3BEE4BEE5BEECBF01 +BF08BF09BF18BF19BF1BBF1CBF1DBF40BF41BF44BF48BF50BF51BF55BF94BFB0 +BFC5BFCCBFCDBFD0BFD4BFDCBFDFBFE1C03CC051C058C05CC060C068C069C090 +C091C094C098C0A0C0A1C0A3C0A5C0ACC0ADC0AFC0B0C0B3C0B4C0B5C0B6C0BC +C0BDC0BFC0C0C0C1C0C5C0C8C0C9C0CCC0D0C0D8C0D9C0DBC0DCC0DDC0E40000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +3C +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000C0E5C0E8C0ECC0F4C0F5C0F7C0F9C100C104C108C110C115C11CC11DC11E +C11FC120C123C124C126C127C12CC12DC12FC130C131C136C138C139C13CC140 +C148C149C14BC14CC14DC154C155C158C15CC164C165C167C168C169C170C174 +C178C185C18CC18DC18EC190C194C196C19CC19DC19FC1A1C1A5C1A8C1A9C1AC +C1B0C1BDC1C4C1C8C1CCC1D4C1D7C1D8C1E0C1E4C1E8C1F0C1F1C1F3C1FCC1FD +C200C204C20CC20DC20FC211C218C219C21CC21FC220C228C229C22BC22D0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +3D +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000C22FC231C232C234C248C250C251C254C258C260C265C26CC26DC270C274 +C27CC27DC27FC281C288C289C290C298C29BC29DC2A4C2A5C2A8C2ACC2ADC2B4 +C2B5C2B7C2B9C2DCC2DDC2E0C2E3C2E4C2EBC2ECC2EDC2EFC2F1C2F6C2F8C2F9 +C2FBC2FCC300C308C309C30CC30DC313C314C315C318C31CC324C325C328C329 +C345C368C369C36CC370C372C378C379C37CC37DC384C388C38CC3C0C3D8C3D9 +C3DCC3DFC3E0C3E2C3E8C3E9C3EDC3F4C3F5C3F8C408C410C424C42CC4300000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +3E +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000C434C43CC43DC448C464C465C468C46CC474C475C479C480C494C49CC4B8 +C4BCC4E9C4F0C4F1C4F4C4F8C4FAC4FFC500C501C50CC510C514C51CC528C529 +C52CC530C538C539C53BC53DC544C545C548C549C54AC54CC54DC54EC553C554 +C555C557C558C559C55DC55EC560C561C564C568C570C571C573C574C575C57C +C57DC580C584C587C58CC58DC58FC591C595C597C598C59CC5A0C5A9C5B4C5B5 +C5B8C5B9C5BBC5BCC5BDC5BEC5C4C5C5C5C6C5C7C5C8C5C9C5CAC5CCC5CE0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +3F +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000C5D0C5D1C5D4C5D8C5E0C5E1C5E3C5E5C5ECC5EDC5EEC5F0C5F4C5F6C5F7 +C5FCC5FDC5FEC5FFC600C601C605C606C607C608C60CC610C618C619C61BC61C +C624C625C628C62CC62DC62EC630C633C634C635C637C639C63BC640C641C644 +C648C650C651C653C654C655C65CC65DC660C66CC66FC671C678C679C67CC680 +C688C689C68BC68DC694C695C698C69CC6A4C6A5C6A7C6A9C6B0C6B1C6B4C6B8 +C6B9C6BAC6C0C6C1C6C3C6C5C6CCC6CDC6D0C6D4C6DCC6DDC6E0C6E1C6E80000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +40 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000C6E9C6ECC6F0C6F8C6F9C6FDC704C705C708C70CC714C715C717C719C720 +C721C724C728C730C731C733C735C737C73CC73DC740C744C74AC74CC74DC74F +C751C752C753C754C755C756C757C758C75CC760C768C76BC774C775C778C77C +C77DC77EC783C784C785C787C788C789C78AC78EC790C791C794C796C797C798 +C79AC7A0C7A1C7A3C7A4C7A5C7A6C7ACC7ADC7B0C7B4C7BCC7BDC7BFC7C0C7C1 +C7C8C7C9C7CCC7CEC7D0C7D8C7DDC7E4C7E8C7ECC800C801C804C808C80A0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +41 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000C810C811C813C815C816C81CC81DC820C824C82CC82DC82FC831C838C83C +C840C848C849C84CC84DC854C870C871C874C878C87AC880C881C883C885C886 +C887C88BC88CC88DC894C89DC89FC8A1C8A8C8BCC8BDC8C4C8C8C8CCC8D4C8D5 +C8D7C8D9C8E0C8E1C8E4C8F5C8FCC8FDC900C904C905C906C90CC90DC90FC911 +C918C92CC934C950C951C954C958C960C961C963C96CC970C974C97CC988C989 +C98CC990C998C999C99BC99DC9C0C9C1C9C4C9C7C9C8C9CAC9D0C9D1C9D30000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +42 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000C9D5C9D6C9D9C9DAC9DCC9DDC9E0C9E2C9E4C9E7C9ECC9EDC9EFC9F0C9F1 +C9F8C9F9C9FCCA00CA08CA09CA0BCA0CCA0DCA14CA18CA29CA4CCA4DCA50CA54 +CA5CCA5DCA5FCA60CA61CA68CA7DCA84CA98CABCCABDCAC0CAC4CACCCACDCACF +CAD1CAD3CAD8CAD9CAE0CAECCAF4CB08CB10CB14CB18CB20CB21CB41CB48CB49 +CB4CCB50CB58CB59CB5DCB64CB78CB79CB9CCBB8CBD4CBE4CBE7CBE9CC0CCC0D +CC10CC14CC1CCC1DCC21CC22CC27CC28CC29CC2CCC2ECC30CC38CC39CC3B0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +43 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000CC3CCC3DCC3ECC44CC45CC48CC4CCC54CC55CC57CC58CC59CC60CC64CC66 +CC68CC70CC75CC98CC99CC9CCCA0CCA8CCA9CCABCCACCCADCCB4CCB5CCB8CCBC +CCC4CCC5CCC7CCC9CCD0CCD4CCE4CCECCCF0CD01CD08CD09CD0CCD10CD18CD19 +CD1BCD1DCD24CD28CD2CCD39CD5CCD60CD64CD6CCD6DCD6FCD71CD78CD88CD94 +CD95CD98CD9CCDA4CDA5CDA7CDA9CDB0CDC4CDCCCDD0CDE8CDECCDF0CDF8CDF9 +CDFBCDFDCE04CE08CE0CCE14CE19CE20CE21CE24CE28CE30CE31CE33CE350000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +44 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000CE58CE59CE5CCE5FCE60CE61CE68CE69CE6BCE6DCE74CE75CE78CE7CCE84 +CE85CE87CE89CE90CE91CE94CE98CEA0CEA1CEA3CEA4CEA5CEACCEADCEC1CEE4 +CEE5CEE8CEEBCEECCEF4CEF5CEF7CEF8CEF9CF00CF01CF04CF08CF10CF11CF13 +CF15CF1CCF20CF24CF2CCF2DCF2FCF30CF31CF38CF54CF55CF58CF5CCF64CF65 +CF67CF69CF70CF71CF74CF78CF80CF85CF8CCFA1CFA8CFB0CFC4CFE0CFE1CFE4 +CFE8CFF0CFF1CFF3CFF5CFFCD000D004D011D018D02DD034D035D038D03C0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +45 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000D044D045D047D049D050D054D058D060D06CD06DD070D074D07CD07DD081 +D0A4D0A5D0A8D0ACD0B4D0B5D0B7D0B9D0C0D0C1D0C4D0C8D0C9D0D0D0D1D0D3 +D0D4D0D5D0DCD0DDD0E0D0E4D0ECD0EDD0EFD0F0D0F1D0F8D10DD130D131D134 +D138D13AD140D141D143D144D145D14CD14DD150D154D15CD15DD15FD161D168 +D16CD17CD184D188D1A0D1A1D1A4D1A8D1B0D1B1D1B3D1B5D1BAD1BCD1C0D1D8 +D1F4D1F8D207D209D210D22CD22DD230D234D23CD23DD23FD241D248D25C0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +46 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000D264D280D281D284D288D290D291D295D29CD2A0D2A4D2ACD2B1D2B8D2B9 +D2BCD2BFD2C0D2C2D2C8D2C9D2CBD2D4D2D8D2DCD2E4D2E5D2F0D2F1D2F4D2F8 +D300D301D303D305D30CD30DD30ED310D314D316D31CD31DD31FD320D321D325 +D328D329D32CD330D338D339D33BD33CD33DD344D345D37CD37DD380D384D38C +D38DD38FD390D391D398D399D39CD3A0D3A8D3A9D3ABD3ADD3B4D3B8D3BCD3C4 +D3C5D3C8D3C9D3D0D3D8D3E1D3E3D3ECD3EDD3F0D3F4D3FCD3FDD3FFD4010000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +47 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000D408D41DD440D444D45CD460D464D46DD46FD478D479D47CD47FD480D482 +D488D489D48BD48DD494D4A9D4CCD4D0D4D4D4DCD4DFD4E8D4ECD4F0D4F8D4FB +D4FDD504D508D50CD514D515D517D53CD53DD540D544D54CD54DD54FD551D558 +D559D55CD560D565D568D569D56BD56DD574D575D578D57CD584D585D587D588 +D589D590D5A5D5C8D5C9D5CCD5D0D5D2D5D8D5D9D5DBD5DDD5E4D5E5D5E8D5EC +D5F4D5F5D5F7D5F9D600D601D604D608D610D611D613D614D615D61CD6200000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +48 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000D624D62DD638D639D63CD640D645D648D649D64BD64DD651D654D655D658 +D65CD667D669D670D671D674D683D685D68CD68DD690D694D69DD69FD6A1D6A8 +D6ACD6B0D6B9D6BBD6C4D6C5D6C8D6CCD6D1D6D4D6D7D6D9D6E0D6E4D6E8D6F0 +D6F5D6FCD6FDD700D704D711D718D719D71CD720D728D729D72BD72DD734D735 +D738D73CD744D747D749D750D751D754D756D757D758D759D760D761D763D765 +D769D76CD770D774D77CD77DD781D788D789D78CD790D798D799D79BD79D0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +4A +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00004F3D4F73504750F952A053EF547554E556095AC15BB6668767B667B767EF +6B4C73C275C27A3C82DB8304885788888A368CC88DCF8EFB8FE699D5523B5374 +5404606A61646BBC73CF811A89BA89D295A34F83520A58BE597859E65E725E79 +61C763C0674667EC687F6F97764E770B78F57A087AFF7C21809D826E82718AEB +95934E6B559D66F76E3478A37AED845B8910874E97A852D8574E582A5D4C611F +61BE6221656267D16A446E1B751875B376E377B07D3A90AF945194529F950000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +4B +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000053235CAC753280DB92409598525B580859DC5CA15D175EB75F3A5F4A6177 +6C5F757A75867CE07D737DB17F8C81548221859189418B1B92FC964D9C474ECB +4EF7500B51F1584F6137613E6168653969EA6F1175A5768676D67B8782A584CB +F90093A7958B55805BA25751F9017CB37FB991B5502853BB5C455DE862D2636E +64DA64E76E2070AC795B8DDD8E1EF902907D924592F84E7E4EF650655DFE5EFA +61066957817186548E4793759A2B4E5E5091677068405109528D52926AA20000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +4C +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000077BC92109ED452AB602F8FF2504861A963ED64CA683C6A846FC0818889A1 +96945805727D72AC75047D797E6D80A9898B8B7490639D5162896C7A6F547D50 +7F3A8A23517C614A7B9D8B199257938C4EAC4FD3501E50BE510652C152CD537F +577058835E9A5F91617661AC64CE656C666F66BB66F468976D87708570F1749F +74A574CA75D9786C78EC7ADF7AF67D457D938015803F811B83968B668F159015 +93E1980398389A5A9BE84FC25553583A59515B635C4660B86212684268B00000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +4D +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000068E86EAA754C767878CE7A3D7CFB7E6B7E7C8A088AA18C3F968E9DC453E4 +53E9544A547156FA59D15B645C3B5EAB62F765376545657266A067AF69C16CBD +75FC7690777E7A3F7F94800380A1818F82E682FD83F085C1883188B48AA5F903 +8F9C932E96C798679AD89F1354ED659B66F2688F7A408C379D6056F057645D11 +660668B168CD6EFE7428889E9BE46C68F9049AA84F9B516C5171529F5B545DE5 +6050606D62F163A7653B73D97A7A86A38CA2978F4E325BE16208679C74DC0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +4E +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000079D183D38A878AB28DE8904E934B98465ED369E885FF90EDF90551A05B98 +5BEC616368FA6B3E704C742F74D87BA17F5083C589C08CAB95DC9928522E605D +62EC90024F8A5149532158D95EE366E06D38709A72C273D67B5080F1945B5366 +639B7F6B4E565080584A58DE602A612762D069D09B415B8F7D1880B18F5F4EA4 +50D154AC55AC5B0C5DA05DE7652A654E68216A4B72E1768E77EF7D5E7FF981A0 +854E86DF8F038F4E90CA99039A559BAB4E184E454E5D4EC74FF1517752FE0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +4F +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000534053E353E5548E5614577557A25BC75D875ED061FC62D8655167B867E9 +69CB6B506BC66BEC6C426E9D707872D77396740377BF77E97A767D7F800981FC +8205820A82DF88628B338CFC8EC0901190B1926492B699D29A459CE99DD79F9C +570B5C4083CA97A097AB9EB4541B7A987FA488D98ECD90E158005C4863987A9F +5BAE5F137A797AAE828E8EAC5026523852F85377570862F363726B0A6DC37737 +53A5735785688E7695D5673A6AC36F708A6D8ECC994BF90666776B788CB40000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +50 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00009B3CF90753EB572D594E63C669FB73EA78457ABA7AC57CFE8475898F8D73 +903595A852FB574775477B6083CC921EF9086A58514B524B5287621F68D86975 +969950C552A452E461C365A4683969FF747E7B4B82B983EB89B28B398FD19949 +F9094ECA599764D266116A8E7434798179BD82A9887E887F895FF90A93264F0B +53CA602562716C727D1A7D664E98516277DC80AF4F014F0E5176518055DC5668 +573B57FA57FC5914594759935BC45C905D0E5DF15E7E5FCC628065D765E30000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +51 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000671E671F675E68CB68C46A5F6B3A6C236C7D6C826DC773987426742A7482 +74A37578757F788178EF794179477948797A7B957D007DBA7F888006802D808C +8A188B4F8C488D779321932498E299519A0E9A0F9A659E927DCA4F76540962EE +685491D155AB513AF90BF90C5A1C61E6F90D62CF62FFF90EF90FF910F911F912 +F91390A3F914F915F916F917F9188AFEF919F91AF91BF91C6696F91D7156F91E +F91F96E3F920634F637A5357F921678F69606E73F9227537F923F924F9250000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +52 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00007D0DF926F927887256CA5A18F928F929F92AF92BF92C4E43F92D51675948 +67F08010F92E59735E74649A79CA5FF5606C62C8637B5BE75BD752AAF92F5974 +5F296012F930F931F9327459F933F934F935F936F937F93899D1F939F93AF93B +F93CF93DF93EF93FF940F941F942F9436FC3F944F94581BF8FB260F1F946F947 +8166F948F9495C3FF94AF94BF94CF94DF94EF94FF950F9515AE98A25677B7D10 +F952F953F954F955F956F95780FDF958F9595C3C6CE5533F6EBA591A83360000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +53 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00004E394EB64F4655AE571858C75F5665B765E66A806BB56E4D77ED7AEF7C1E +7DDE86CB88929132935B64BB6FBE737A75B890545556574D61BA64D466C76DE1 +6E5B6F6D6FB975F0804381BD854189838AC78B5A931F6C9375537B548E0F905D +5510580258585E626207649E68E075767CD687B39EE84EE35788576E59275C0D +5CB15E365F85623464E173B381FA888B8CB8968A9EDB5B855FB760B350125200 +52305716583558575C0E5C605CF65D8B5EA65F9260BC63116389641768430000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +54 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000068F96AC26DD86E216ED46FE471FE76DC777979B17A3B840489A98CED8DF3 +8E4890039014905390FD934D967697DC6BD27006725872A27368776379BF7BE4 +7E9B8B8058A960C7656665FD66BE6C8C711E71C98C5A98134E6D7A814EDD51AC +51CD52D5540C61A76771685068DF6D1E6F7C75BC77B37AE580F484639285515C +6597675C679375D87AC78373F95A8C469017982D5C6F81C0829A9041906F920D +5F975D9D6A5971C8767B7B4985E48B0491279A30558761F6F95B76697F850000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +55 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000863F87BA88F8908FF95C6D1B70D973DE7D61843DF95D916A99F1F95E4E82 +53756B046B12703E721B862D9E1E524C8FA35D5064E5652C6B166FEB7C437E9C +85CD896489BD62C981D8881F5ECA67176D6A72FC7405746F878290DE4F865D0D +5FA0840A51B763A075654EAE5006516951C968816A117CAE7CB17CE7826F8AD2 +8F1B91CF4FB6513752F554425EEC616E623E65C56ADA6FFE792A85DC882395AD +9A629A6A9E979ECE529B66C66B77701D792B8F6297426190620065236F230000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +56 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000714974897DF4806F84EE8F269023934A51BD521752A36D0C70C888C25EC9 +65826BAE6FC27C3E73754EE44F3656F9F95F5CBA5DBA601C73B27B2D7F9A7FCE +8046901E923496F6974898189F614F8B6FA779AE91B496B752DEF960648864C4 +6AD36F5E7018721076E780018606865C8DEF8F0597329B6F9DFA9E75788C797F +7DA083C993049E7F9E938AD658DF5F046727702774CF7C60807E512170287262 +78CA8CC28CDA8CF496F74E8650DA5BEE5ED6659971CE764277AD804A84FC0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +57 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000907C9B279F8D58D85A415C626A136DDA6F0F763B7D2F7E37851E893893E4 +964B528965D267F369B46D416E9C700F7409746075597624786B8B2C985E516D +622E96784F96502B5D196DEA7DB88F2A5F8B61446817F961968652D2808B51DC +51CC695E7A1C7DBE83F196754FDA52295398540F550E5C6560A7674E68A86D6C +728172F874067483F96275E27C6C7F797FB8838988CF88E191CC91D096E29BC9 +541D6F7E71D0749885FA8EAA96A39C579E9F67976DCB743381E89716782C0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +58 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00007ACB7B207C926469746A75F278BC78E899AC9B549EBB5BDE5E556F20819C +83AB90884E07534D5A295DD25F4E6162633D666966FC6EFF6F2B7063779E842C +8513883B8F1399459C3B551C62B9672B6CAB8309896A977A4EA159845FD85FD9 +671B7DB27F548292832B83BD8F1E909957CB59B95A925BD06627679A68856BCF +71647F758CB78CE390819B4581088C8A964C9A409EA55B5F6C13731B76F276DF +840C51AA8993514D519552C968C96C94770477207DBF7DEC97629EB56EC50000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +59 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000851151A5540D547D660E669D69276E9F76BF7791831784C2879F91699298 +9CF488824FAE519252DF59C65E3D61556478647966AE67D06A216BCD6BDB725F +72617441773877DB801782BC83058B008B288C8C67286C90726776EE77667A46 +9DA96B7F6C92592267268499536F589359995EDF63CF663467736E3A732B7AD7 +82D7932852D95DEB61AE61CB620A62C764AB65E069596B666BCB712173F7755D +7E46821E8302856A8AA38CBF97279D6158A89ED85011520E543B554F65870000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +5A +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00006C767D0A7D0B805E868A958096EF52FF6C95726954735A9A5C3E5D4B5F4C +5FAE672A68B669636E3C6E4477097C737F8E85878B0E8FF797619EF45CB760B6 +610D61AB654F65FB65FC6C116CEF739F73C97DE195945BC6871C8B10525D535A +62CD640F64B267346A386CCA73C0749E7B947C957E1B818A823685848FEB96F9 +99C14F34534A53CD53DB62CC642C6500659169C36CEE6F5873ED7554762276E4 +76FC78D078FB792C7D46822C87E08FD4981298EF52C362D464A56E246F510000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +5B +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000767C8DCB91B192629AEE9B435023508D574A59A85C285E475F77623F653E +65B965C16609678B699C6EC278C57D2180AA8180822B82B384A1868C8A2A8B17 +90A696329F90500D4FF3F96357F95F9862DC6392676F6E43711976C380CC80DA +88F488F589198CE08F29914D966A4F2F4F705E1B67CF6822767D767E9B445E61 +6A0A716971D4756AF9647E41854385E998DC4F107B4F7F7095A551E15E0668B5 +6C3E6C4E6CDB72AF7BC483036CD5743A50FB528858C164D86A9774A776560000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +5C +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000078A7861795E29739F965535E5F018B8A8FA88FAF908A522577A59C499F08 +4E19500251755C5B5E77661E663A67C468C570B3750175C579C97ADD8F279920 +9A084FDD582158315BF6666E6B656D116E7A6F7D73E4752B83E988DC89138B5C +8F144F0F50D55310535C5B935FA9670D798F8179832F8514890789868F398F3B +99A59C12672C4E764FF859495C015CEF5CF0636768D270FD71A2742B7E2B84EC +8702902292D29CF34E0D4ED84FEF50855256526F5426549057E0592B5A660000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +5D +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00005B5A5B755BCC5E9CF9666276657765A76D6E6EA572367B267C3F7F368150 +8151819A8240829983A98A038CA08CE68CFB8D748DBA90E891DC961C964499D9 +9CE7531752065429567458B35954596E5FFF61A4626E66106C7E711A76C67C89 +7CDE7D1B82AC8CC196F0F9674F5B5F175F7F62C25D29670B68DA787C7E439D6C +4E1550995315532A535159835A625E8760B2618A624962796590678769A76BD4 +6BD66BD76BD86CB8F968743575FA7812789179D579D87C837DCB7FE180A50000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +5E +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000813E81C283F2871A88E88AB98B6C8CBB9119975E98DB9F3B56AC5B2A5F6C +658C6AB36BAF6D5C6FF17015725D73AD8CA78CD3983B61916C3780589A014E4D +4E8B4E9B4ED54F3A4F3C4F7F4FDF50FF53F253F8550655E356DB58EB59625A11 +5BEB5BFA5C045DF35E2B5F99601D6368659C65AF67F667FB68AD6B7B6C996CD7 +6E23700973457802793E7940796079C17BE97D177D728086820D838E84D186C7 +88DF8A508A5E8B1D8CDC8D668FAD90AA98FC99DF9E9D524AF9696714F96A0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +5F +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00005098522A5C7165636C5573CA7523759D7B97849C917897304E7764926BBA +715E85A94E09F96B674968EE6E17829F8518886B63F76F81921298AF4E0A50B7 +50CF511F554655AA56175B405C195CE05E385E8A5EA05EC260F368516A616E58 +723D724072C076F879657BB17FD488F389F48A738C618CDE971C585E74BD8CFD +55C7F96C7A617D2282727272751F7525F96D7B19588558FB5DBC5E8F5EB65F90 +60556292637F654D669166D966F8681668F27280745E7B6E7D6E7DD67F720000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +60 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000080E5821285AF897F8A93901D92E49ECD9F205915596D5E2D60DC66146673 +67906C506DC56F5F77F378A984C691CB932B4ED950CA514855845B0B5BA36247 +657E65CB6E32717D74017444748774BF766C79AA7DDA7E557FA8817A81B38239 +861A87EC8A758DE3907892919425994D9BAE53685C5169546CC46D296E2B820C +859B893B8A2D8AAA96EA9F67526166B96BB27E9687FE8D0D9583965D651D6D89 +71EEF96E57CE59D35BAC602760FA6210661F665F732973F976DB77017B6C0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +61 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00008056807281658AA091924E1652E26B726D177A057B397D30F96F8CB053EC +562F58515BB55C0F5C115DE2624063836414662D68B36CBC6D886EAF701F70A4 +71D27526758F758E76197B117BE07C2B7D207D39852C856D86078A34900D9061 +90B592B797F69A374FD75C6C675F6D917C9F7E8C8B168D16901F5B6B5DFD640D +84C0905C98E173875B8B609A677E6DDE8A1F8AA69001980C5237F9707051788E +9396887091D74FEE53D755FD56DA578258FD5AC25B885CAB5CC05E2561010000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +62 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000620D624B6388641C653665786A396B8A6C346D196F3171E772E973787407 +74B27626776179C07A577AEA7CB97D8F7DAC7E617F9E81298331849084DA85EA +88968AB08B908F3890429083916C929692B9968B96A796A896D6970098089996 +9AD39B1A53D4587E59195B705BBF6DD16F5A719F742174B9808583FD5DE15F87 +5FAA604265EC6812696F6A536B896D356DF373E376FE77AC7B4D7D148123821C +834084F485638A628AC49187931E980699B4620C88538FF092655D075D270000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +63 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00005D69745F819D87686FD562FE7FD2893689724E1E4E5850E752DD5347627F +66077E698805965E4F8D5319563659CB5AA45C385C4E5C4D5E025F11604365BD +662F664267BE67F4731C77E2793A7FC5849484CD89968A668A698AE18C558C7A +57F45BD45F0F606F62ED690D6B966E5C71847BD287558B588EFE98DF98FE4F38 +4F814FE1547B5A205BB8613C65B0666871FC7533795E7D33814E81E3839885AA +85CE87038A0A8EAB8F9BF9718FC559315BA45BE660895BE95C0B5FC36C810000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +64 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000F9726DF1700B751A82AF8AF64EC05341F97396D96C0F4E9E4FC45152555E +5A255CE86211725982BD83AA86FE88598A1D963F96C599139D099D5D580A5CB3 +5DBD5E4460E1611563E16A026E2591029354984E9C109F775B895CB86309664F +6848773C96C1978D98549B9F65A18B018ECB95BC55355CA95DD65EB56697764C +83F495C758D362BC72CE9D284EF0592E600F663B6B8379E79D26539354C057C3 +5D16611B66D66DAF788D827E969897445384627C63966DB27E0A814B984D0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +65 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00006AFB7F4C9DAF9E1A4E5F503B51B6591C60F963F66930723A8036F97491CE +5F31F975F9767D0482E5846F84BB85E58E8DF9774F6FF978F97958E45B436059 +63DA6518656D6698F97A694A6A236D0B7001716C75D2760D79B37A70F97B7F8A +F97C8944F97D8B9391C0967DF97E990A57045FA165BC6F01760079A68A9E99AD +9B5A9F6C510461B662916A8D81C6504358305F6671098A008AFA5B7C86164FFA +513C56B4594463A96DF95DAA696D51864E884F59F97FF980F9815982F9820000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +66 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000F9836B5F6C5DF98474B57916F9858207824583398F3F8F5DF9869918F987 +F988F9894EA6F98A57DF5F796613F98BF98C75AB7E798B6FF98D90069A5B56A5 +582759F85A1F5BB4F98E5EF6F98FF9906350633BF991693D6C876CBF6D8E6D93 +6DF56F14F99270DF71367159F99371C371D5F994784F786FF9957B757DE3F996 +7E2FF997884D8EDFF998F999F99A925BF99B9CF6F99CF99DF99E60856D85F99F +71B1F9A0F9A195B153ADF9A2F9A3F9A467D3F9A5708E71307430827682D20000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +67 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000F9A695BB9AE59E7D66C4F9A771C18449F9A8F9A9584BF9AAF9AB5DB85F71 +F9AC6620668E697969AE6C386CF36E366F416FDA701B702F715071DF7370F9AD +745BF9AE74D476C87A4E7E93F9AFF9B082F18A608FCEF9B19348F9B29719F9B3 +F9B44E42502AF9B5520853E166F36C6D6FCA730A777F7A6282AE85DD8602F9B6 +88D48A638B7D8C6BF9B792B3F9B8971398104E944F0D4FC950B25348543E5433 +55DA586258BA59675A1B5BE4609FF9B961CA655665FF666468A76C5A6FB30000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +68 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000070CF71AC73527B7D87088AA49C329F075C4B6C8373447389923A6EAB7465 +761F7A697E15860A514058C564C174EE751576707FC1909596CD99546E2674E6 +7AA97AAA81E586D987788A1B5A495B8C5B9B68A169006D6373A97413742C7897 +7DE97FEB81188155839E8C4C962E981166F05F8065FA67896C6A738B502D5A03 +6B6A77EE59165D6C5DCD7325754FF9BAF9BB50E551F9582F592D599659DA5BE5 +F9BCF9BD5DA262D76416649364FEF9BE66DCF9BF6A48F9C071FF7464F9C10000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +69 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00007A887AAF7E477E5E80008170F9C287EF89818B209059F9C390809952617E +6B326D747E1F89258FB14FD150AD519752C757C758895BB95EB8614269956D8C +6E676EB6719474627528752C8073833884C98E0A939493DEF9C44E8E4F515076 +512A53C853CB53F35B875BD35C24611A618265F4725B7397744076C279507991 +79B97D067FBD828B85D5865E8FC2904790F591EA968596E896E952D65F6765ED +6631682F715C7A3690C1980A4E91F9C56A526B9E6F907189801882B885530000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +6A +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000904B969596F297FB851A9B314E90718A96C45143539F54E15713571257A3 +5A9B5AC45BC36028613F63F46C856D396E726E907230733F745782D188818F45 +9060F9C6966298589D1B67088D8A925E4F4D504950DE5371570D59D45A015C09 +617066906E2D7232744B7DEF80C3840E8466853F875F885B89188B02905597CB +9B4F4E734F915112516AF9C7552F55A95B7A5BA55E7C5E7D5EBE60A060DF6108 +610963C465386709F9C867D467DAF9C9696169626CB96D27F9CA6E38F9CB0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +6B +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00006FE173367337F9CC745C7531F9CD7652F9CEF9CF7DAD81FE843888D58A98 +8ADB8AED8E308E42904A903E907A914991C9936EF9D0F9D15809F9D26BD38089 +80B2F9D3F9D45141596B5C39F9D5F9D66F6473A780E48D07F9D79217958FF9D8 +F9D9F9DAF9DB807F620E701C7D68878DF9DC57A0606961476BB78ABE928096B1 +4E59541F6DEB852D967097F398EE63D66CE3909151DD61C981BA9DF94F9D501A +51005B9C610F61FF64EC69056BC5759177E37FA98264858F87FB88638ABC0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +6C +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00008B7091AB4E8C4EE54F0AF9DDF9DE593759E8F9DF5DF25F1B5F5B6021F9E0 +F9E1F9E2F9E3723E73E5F9E4757075CDF9E579FBF9E6800C8033808482E18351 +F9E7F9E88CBD8CB39087F9E9F9EA98F4990CF9EBF9EC703776CA7FCA7FCC7FFC +8B1A4EBA4EC152035370F9ED54BD56E059FB5BC55F155FCD6E6EF9EEF9EF7D6A +8335F9F086938A8DF9F1976D9777F9F2F9F34E004F5A4F7E58F965E56EA29038 +93B099B94EFB58EC598A59D96041F9F4F9F57A14F9F6834F8CC3516553440000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +6D +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000F9F7F9F8F9F94ECD52695B5582BF4ED4523A54A859C959FF5B505B575B5C +606361486ECB7099716E738674F775B578C17D2B800581EA8328851785C98AEE +8CC796CC4F5C52FA56BC65AB6628707C70B872357DBD828D914C96C09D725B71 +68E76B986F7A76DE5C9166AB6F5B7BB47C2A883696DC4E084ED75320583458BB +58EF596C5C075E335E845F35638C66B267566A1F6AA36B0C6F3F7246F9FA7350 +748B7AE07CA7817881DF81E7838A846C8523859485CF88DD8D1391AC95770000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +6E +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000969C518D54C957285BB0624D6750683D68936E3D6ED3707D7E2188C18CA1 +8F099F4B9F4E722D7B8F8ACD931A4F474F4E5132548059D05E9562B56775696E +6A176CAE6E1A72D9732A75BD7BB87D3582E783F9845785F78A5B8CAF8E879019 +90B896CE9F5F52E3540A5AE15BC2645865756EF472C4F9FB76847A4D7B1B7C4D +7E3E7FDF837B8B2B8CCA8D648DE18E5F8FEA8FF9906993D14F434F7A50B35168 +5178524D526A5861587C59605C085C555EDB609B623068136BBF6C086FB10000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +6F +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000714E742075307538755176727B4C7B8B7BAD7BC67E8F8A6E8F3E8F49923F +92939322942B96FB985A986B991E5207622A62986D5976647ACA7BC07D765360 +5CBE5E976F3870B97C9897119B8E9EDE63A5647A87764E014E954EAD505C5075 +544859C35B9A5E405EAD5EF75F8160C5633A653F657465CC6676667867FE6968 +6A896B636C406DC06DE86E1F6E5E701E70A1738E73FD753A775B7887798E7A0B +7A7D7CBE7D8E82478A028AEA8C9E912D914A91D8926692CC9320970697560000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +70 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000975C98029F0E52365291557C58245E1D5F1F608C63D068AF6FDF796D7B2C +81CD85BA88FD8AF88E44918D9664969B973D984C9F4A4FCE514651CB52A95632 +5F145F6B63AA64CD65E9664166FA66F9671D689D68D769FD6F156F6E716771E5 +722A74AA773A7956795A79DF7A207A957C977CDF7D447E70808785FB86A48A54 +8ABF8D998E819020906D91E3963B96D59CE565CF7C078DB393C35B585C0A5352 +62D9731D50275B975F9E60B0616B68D56DD9742E7A2E7D427D9C7E31816B0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +71 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00008E2A8E35937E94184F5057505DE65EA7632B7F6A4E3B4F4F4F8F505A59DD +80C4546A546855FE594F5B995DDE5EDA665D673167F1682A6CE86D326E4A6F8D +70B773E075877C4C7D027D2C7DA2821F86DB8A3B8A858D708E8A8F339031914E +9152944499D07AF97CA54FCA510151C657C85BEF5CFB66596A3D6D5A6E966FEC +710C756F7AE388229021907596CB99FF83014E2D4EF2884691CD537D6ADB696B +6C41847A589E618E66FE62EF70DD751175C77E5284B88B498D084E4B53EA0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +72 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000054AB573057405FD763016307646F652F65E8667A679D67B36B626C606C9A +6F2C77E57825794979577D1980A2810281F3829D82B787188A8CF9FC8D048DBE +907276F47A197A377E548077550755D45875632F64226649664B686D699B6B84 +6D256EB173CD746874A1755B75B976E1771E778B79E67E097E1D81FB852F8897 +8A3A8CD18EEB8FB0903293AD9663967397074F8453F159EA5AC95E19684E74C6 +75BE79E97A9281A386ED8CEA8DCC8FED659F6715F9FD57F76F577DDD8F2F0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +73 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000093F696C65FB561F26F844E144F98501F53C955DF5D6F5DEE6B216B6478CB +7B9AF9FE8E498ECA906E6349643E77407A84932F947F9F6A64B06FAF71E674A8 +74DA7AC47C127E827CB27E988B9A8D0A947D9910994C52395BDF64E6672D7D2E +50ED53C358796158615961FA65AC7AD98B928B9650095021527555315A3C5EE0 +5F706134655E660C663666A269CD6EC46F32731676217A938139825983D684BC +50B557F05BC05BE85F6963A178267DB583DC852191C791F5518A67F57B560000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +74 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00008CAC51C459BB60BD8655501CF9FF52545C3A617D621A62D364F265A56ECC +7620810A8E60965F96BB4EDF5343559859295DDD64C56CC96DFA73947A7F821B +85A68CE48E10907791E795E1962197C651F854F255865FB964A46F887DB48F1F +8F4D943550C95C166CBE6DFB751B77BB7C3D7C648A798AC2581E59BE5E166377 +7252758A776B8ADC8CBC8F125EF366746DF8807D83C18ACB97519BD6FA005243 +66FF6D956EEF7DE08AE6902E905E9AD4521D527F54E86194628462DB68A20000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +75 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00006912695A6A3570927126785D7901790E79D27A0D8096827882D583498549 +8C828D859162918B91AE4FC356D171ED77D7870089F85BF85FD6675190A853E2 +585A5BF560A4618164607E3D80708525928364AE50AC5D146700589C62BD63A8 +690E69786A1E6E6B76BA79CB82BB84298ACF8DA88FFD9112914B919C93109318 +939A96DB9A369C0D4E11755C795D7AFA7B517BC97E2E84C48E598E748EF89010 +6625693F744351FA672E9EDC51455FE06C9687F2885D887760B481B584030000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +76 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00008D0553D6543956345A365C31708A7FE0805A810681ED8DA391899A5F9DF2 +50744EC453A060FB6E2C5C644F88502455E45CD95E5F606568946CBB6DC471BE +75D475F476617A1A7A497DC77DFB7F6E81F486A98F1C96C999B39F52524752C5 +98ED89AA4E0367D26F064FB55BE267956C886D78741B782791DD937C87C479E4 +7A315FEB4ED654A4553E58AE59A560F0625362D6673669558235964099B199DD +502C53535544577CFA016258FA0264E2666B67DD6FC16FEF742274388A170000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +77 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000094385451560657665F48619A6B4E705870AD7DBB8A95596A812B63A27708 +803D8CAA5854642D69BB5B955E116E6FFA038569514C53F0592A6020614B6B86 +6C706CF07B1E80CE82D48DC690B098B1FA0464C76FA464916504514E5410571F +8A0E615F6876FA0575DB7B527D71901A580669CC817F892A9000983950785957 +59AC6295900F9B2A615D727995D657615A465DF4628A64AD64FA67776CE26D3E +722C743678347F7782AD8DDB981752245742677F724874E38CA98FA692110000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +78 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000962A516B53ED634C4F695504609665576C9B6D7F724C72FD7A1789878C9D +5F6D6F8E70F981A8610E4FBF504F624172477BC77DE87FE9904D97AD9A198CB6 +576A5E7367B0840D8A5554205B165E635EE25F0A658380BA853D9589965B4F48 +5305530D530F548654FA57035E036016629B62B16355FA066CE16D6675B17832 +80DE812F82DE846184B2888D8912900B92EA98FD9B915E4566B466DD70117206 +FA074FF5527D5F6A615367536A196F0274E2796888688C7998C798C49A430000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +79 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000054C17A1F69538AF78C4A98A899AE5F7C62AB75B276AE88AB907F96425339 +5F3C5FC56CCC73CC7562758B7B4682FE999D4E4F903C4E0B4F5553A6590F5EC8 +66306CB37455837787668CC09050971E9C1558D15B7886508B149DB45BD26068 +608D65F16C576F226FA3701A7F557FF095919592965097D352728F4451FD542B +54B85563558A6ABB6DB57DD88266929C96779E79540854C876D286E495A495D4 +965C4EA24F0959EE5AE65DF760526297676D68416C866E2F7F38809B822A0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +7A +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000FA08FA0998054EA5505554B35793595A5B695BB361C869776D77702387F9 +89E38A728AE7908299ED9AB852BE683850165E78674F8347884C4EAB541156AE +73E6911597FF9909995799995653589F865B8A3161B26AF6737B8ED26B4796AA +9A57595572008D6B97694FD45CF45F2661F8665B6CEB70AB738473B973FE7729 +774D7D437D627E2382378852FA0A8CE29249986F5B517A74884098015ACC4FE0 +5354593E5CFD633E6D7972F98105810783A292CF98304EA851445211578B0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +7B +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00005F626CC26ECE7005705070AF719273E97469834A87A28861900890A293A3 +99A8516E5F5760E0616766B385598E4A91AF978B4E4E4E92547C58D558FA597D +5CB55F2762366248660A66676BEB6D696DCF6E566EF86F946FE06FE9705D72D0 +7425745A74E07693795C7CCA7E1E80E182A6846B84BF864E865F87748B778C6A +93AC9800986560D1621691775A5A660F6DF76E3E743F9B425FFD60DA7B0F54C4 +5F186C5E6CD36D2A70D87D0586798A0C9D3B5316548C5B056A3A706B75750000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +7C +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000798D79BE82B183EF8A718B418CA89774FA0B64F4652B78BA78BB7A6B4E38 +559A59505BA65E7B60A363DB6B61666568536E19716574B07D0890849A699C25 +6D3B6ED1733E8C4195CA51F05E4C5FA8604D60F66130614C6643664469A56CC1 +6E5F6EC96F62714C749C76877BC17C27835287579051968D9EC3532F56DE5EFB +5F8A6062609461F7666667036A9C6DEE6FAE7070736A7E6A81BE833486D48AA8 +8CC4528373725B966A6B940454EE56865B5D6548658566C9689F6D8D6DC60000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +7D +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000723B80B491759A4D4FAF5019539A540E543C558955C55E3F5F8C673D7166 +73DD900552DB52F3586458CE7104718F71FB85B08A13668885A855A76684714A +8431534955996BC15F595FBD63EE668971478AF18F1D9EBE4F11643A70CB7566 +866760648B4E9DF8514751F653086D3680F89ED166156B23709875D554035C79 +7D078A166B206B3D6B46543860706D3D7FD5820850D651DE559C566B56CD59EC +5B095E0C619961986231665E66E6719971B971BA72A779A77A007FB28A700000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 diff --git a/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/macCentEuro.enc b/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/macCentEuro.enc new file mode 100644 index 0000000000000000000000000000000000000000..dde616a4cb72619ac7f2043ff90a4f4b52cd5241 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/macCentEuro.enc @@ -0,0 +1,20 @@ +# Encoding file: macCentEuro, single-byte +S +003F 0 1 +00 +0000000100020003000400050006000700080009000A000B000C000D000E000F +0010001100120013001400150016001700180019001A001B001C001D001E001F +0020002100220023002400250026002700280029002A002B002C002D002E002F +0030003100320033003400350036003700380039003A003B003C003D003E003F +0040004100420043004400450046004700480049004A004B004C004D004E004F +0050005100520053005400550056005700580059005A005B005C005D005E005F +0060006100620063006400650066006700680069006A006B006C006D006E006F +0070007100720073007400750076007700780079007A007B007C007D007E007F +00C40100010100C9010400D600DC00E10105010C00E4010D0106010700E90179 +017A010E00ED010F01120113011600F3011700F400F600F500FA011A011B00FC +202000B0011800A300A7202200B600DF00AE00A92122011900A822600123012E +012F012A22642265012B0136220222110142013B013C013D013E0139013A0145 +0146014300AC221A01440147220600AB00BB202600A00148015000D50151014C +20132014201C201D2018201900F725CA014D0154015501582039203A01590156 +01570160201A201E0161015A015B00C10164016500CD017D017E016A00D300D4 +016B016E00DA016F017001710172017300DD00FD0137017B0141017C012202C7 diff --git a/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/macCroatian.enc b/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/macCroatian.enc new file mode 100644 index 0000000000000000000000000000000000000000..c23d0f0b77230435ea4dce64004ee77f3983c47b --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/macCroatian.enc @@ -0,0 +1,20 @@ +# Encoding file: macCroatian, single-byte +S +003F 0 1 +00 +0000000100020003000400050006000700080009000A000B000C000D000E000F +0010001100120013001400150016001700180019001A001B001C001D001E001F +0020002100220023002400250026002700280029002A002B002C002D002E002F +0030003100320033003400350036003700380039003A003B003C003D003E003F +0040004100420043004400450046004700480049004A004B004C004D004E004F +0050005100520053005400550056005700580059005A005B005C005D005E005F +0060006100620063006400650066006700680069006A006B006C006D006E006F +0070007100720073007400750076007700780079007A007B007C007D007E007F +00C400C500C700C900D100D600DC00E100E000E200E400E300E500E700E900E8 +00EA00EB00ED00EC00EE00EF00F100F300F200F400F600F500FA00F900FB00FC +202000B000A200A300A7202200B600DF00AE0160212200B400A82260017D00D8 +221E00B122642265220600B522022211220F0161222B00AA00BA03A9017E00F8 +00BF00A100AC221A01922248010600AB010C202600A000C000C300D501520153 +01102014201C201D2018201900F725CAF8FF00A9204420AC2039203A00C600BB +201300B7201A201E203000C2010700C1010D00C800CD00CE00CF00CC00D300D4 +011100D200DA00DB00D9013102C602DC00AF03C000CB02DA00B800CA00E602C7 diff --git a/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/macCyrillic.enc b/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/macCyrillic.enc new file mode 100644 index 0000000000000000000000000000000000000000..e657739bdaf9f582aa21ad439803bd949bd575cd --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/macCyrillic.enc @@ -0,0 +1,20 @@ +# Encoding file: macCyrillic, single-byte +S +003F 0 1 +00 +0000000100020003000400050006000700080009000A000B000C000D000E000F +0010001100120013001400150016001700180019001A001B001C001D001E001F +0020002100220023002400250026002700280029002A002B002C002D002E002F +0030003100320033003400350036003700380039003A003B003C003D003E003F +0040004100420043004400450046004700480049004A004B004C004D004E004F +0050005100520053005400550056005700580059005A005B005C005D005E005F +0060006100620063006400650066006700680069006A006B006C006D006E006F +0070007100720073007400750076007700780079007A007B007C007D007E007F +0410041104120413041404150416041704180419041A041B041C041D041E041F +0420042104220423042404250426042704280429042A042B042C042D042E042F +202000B0049000A300A7202200B6040600AE00A9212204020452226004030453 +221E00B122642265045600B504910408040404540407045704090459040A045A +0458040500AC221A01922248220600AB00BB202600A0040B045B040C045C0455 +20132014201C201D2018201900F7201E040E045E040F045F211604010451044F +0430043104320433043404350436043704380439043A043B043C043D043E043F +0440044104420443044404450446044704480449044A044B044C044D044E20AC diff --git a/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/macDingbats.enc b/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/macDingbats.enc new file mode 100644 index 0000000000000000000000000000000000000000..28449cdd651be288dc6d4d28f59eb6f4d3dc5ef9 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/macDingbats.enc @@ -0,0 +1,20 @@ +# Encoding file: macDingbats, single-byte +S +003F 1 1 +00 +0000000100020003000400050006000700080009000A000B000C000D000E000F +0010001100120013001400150016001700180019001A001B001C001D001E001F +00202701270227032704260E2706270727082709261B261E270C270D270E270F +2710271127122713271427152716271727182719271A271B271C271D271E271F +2720272127222723272427252726272726052729272A272B272C272D272E272F +2730273127322733273427352736273727382739273A273B273C273D273E273F +2740274127422743274427452746274727482749274A274B25CF274D25A0274F +27502751275225B225BC25C6275625D727582759275A275B275C275D275E007F +F8D7F8D8F8D9F8DAF8DBF8DCF8DDF8DEF8DFF8E0F8E1F8E2F8E3F8E4008E008F +0090009100920093009400950096009700980099009A009B009C009D009E009F +0000276127622763276427652766276726632666266526602460246124622463 +2464246524662467246824692776277727782779277A277B277C277D277E277F +2780278127822783278427852786278727882789278A278B278C278D278E278F +2790279127922793279421922194219527982799279A279B279C279D279E279F +27A027A127A227A327A427A527A627A727A827A927AA27AB27AC27AD27AE27AF +000027B127B227B327B427B527B627B727B827B927BA27BB27BC27BD27BE0000 diff --git a/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/macGreek.enc b/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/macGreek.enc new file mode 100644 index 0000000000000000000000000000000000000000..67b9953dd25284b36346ab6d56429784aa1af35f --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/macGreek.enc @@ -0,0 +1,20 @@ +# Encoding file: macGreek, single-byte +S +003F 0 1 +00 +0000000100020003000400050006000700080009000A000B000C000D000E000F +0010001100120013001400150016001700180019001A001B001C001D001E001F +0020002100220023002400250026002700280029002A002B002C002D002E002F +0030003100320033003400350036003700380039003A003B003C003D003E003F +0040004100420043004400450046004700480049004A004B004C004D004E004F +0050005100520053005400550056005700580059005A005B005C005D005E005F +0060006100620063006400650066006700680069006A006B006C006D006E006F +0070007100720073007400750076007700780079007A007B007C007D007E007F +00C400B900B200C900B300D600DC038500E000E200E4038400A800E700E900E8 +00EA00EB00A3212200EE00EF202200BD203000F400F600A600AD00F900FB00FC +2020039303940398039B039E03A000DF00AE00A903A303AA00A7226000B000B7 +039100B12264226500A503920395039603970399039A039C03A603AB03A803A9 +03AC039D00AC039F03A1224803A400AB00BB202600A003A503A7038603880153 +20132015201C201D2018201900F70389038A038C038E03AD03AE03AF03CC038F +03CD03B103B203C803B403B503C603B303B703B903BE03BA03BB03BC03BD03BF +03C003CE03C103C303C403B803C903C203C703C503B603CA03CB039003B0F8A0 diff --git a/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/macIceland.enc b/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/macIceland.enc new file mode 100644 index 0000000000000000000000000000000000000000..c6360698ae55fa06128d42b4bbca0c4e84646623 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/macIceland.enc @@ -0,0 +1,20 @@ +# Encoding file: macIceland, single-byte +S +003F 0 1 +00 +0000000100020003000400050006000700080009000A000B000C000D000E000F +0010001100120013001400150016001700180019001A001B001C001D001E001F +0020002100220023002400250026002700280029002A002B002C002D002E002F +0030003100320033003400350036003700380039003A003B003C003D003E003F +0040004100420043004400450046004700480049004A004B004C004D004E004F +0050005100520053005400550056005700580059005A005B005C005D005E005F +0060006100620063006400650066006700680069006A006B006C006D006E006F +0070007100720073007400750076007700780079007A007B007C007D007E007F +00C400C500C700C900D100D600DC00E100E000E200E400E300E500E700E900E8 +00EA00EB00ED00EC00EE00EF00F100F300F200F400F600F500FA00F900FB00FC +00DD00B000A200A300A7202200B600DF00AE00A9212200B400A8226000C600D8 +221E00B12264226500A500B522022211220F03C0222B00AA00BA03A900E600F8 +00BF00A100AC221A01922248220600AB00BB202600A000C000C300D501520153 +20132014201C201D2018201900F725CA00FF0178204420AC00D000F000DE00FE +00FD00B7201A201E203000C200CA00C100CB00C800CD00CE00CF00CC00D300D4 +F8FF00D200DA00DB00D9013102C602DC00AF02D802D902DA00B802DD02DB02C7 diff --git a/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/macJapan.enc b/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/macJapan.enc new file mode 100644 index 0000000000000000000000000000000000000000..dba24bd8e3f3284609d79362f24b49f386cf0550 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/macJapan.enc @@ -0,0 +1,785 @@ +# Encoding file: macJapan, multi-byte +M +003F 0 46 +00 +0000000100020003000400050006000700080009000A000B000C000D000E000F +0010001100120013001400150016001700180019001A001B001C001D001E001F +0020002100220023002400250026002700280029002A002B002C002D002E002F +0030003100320033003400350036003700380039003A003B003C003D003E003F +0040004100420043004400450046004700480049004A004B004C004D004E004F +0050005100520053005400550056005700580059005A005B005C005D005E005F +0060006100620063006400650066006700680069006A006B006C006D006E006F +0070007100720073007400750076007700780079007A007B007C007D007E007F +0080000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00A0FF61FF62FF63FF64FF65FF66FF67FF68FF69FF6AFF6BFF6CFF6DFF6EFF6F +FF70FF71FF72FF73FF74FF75FF76FF77FF78FF79FF7AFF7BFF7CFF7DFF7EFF7F +FF80FF81FF82FF83FF84FF85FF86FF87FF88FF89FF8AFF8BFF8CFF8DFF8EFF8F +FF90FF91FF92FF93FF94FF95FF96FF97FF98FF99FF9AFF9BFF9CFF9DFF9EFF9F +0000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000A921222026 +81 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +300030013002FF0CFF0E30FBFF1AFF1BFF1FFF01309B309C00B4FF4000A8FF3E +203EFF3F30FD30FE309D309E30034EDD30053006300730FC20142010FF0FFF3C +301C2016FF5C22EF202520182019201C201DFF08FF0930143015FF3BFF3DFF5B +FF5D30083009300A300B300C300D300E300F30103011FF0B221200B100D70000 +00F7FF1D2260FF1CFF1E22662267221E22342642264000B0203220332103FFE5 +FF0400A200A3FF05FF03FF06FF0AFF2000A72606260525CB25CF25CE25C725C6 +25A125A025B325B225BD25BC203B301221922190219121933013000000000000 +000000000000000000000000000000002208220B2286228722822283222A2229 +000000000000000000000000000000002227222800AC21D221D4220022030000 +0000000000000000000000000000000000000000222022A52312220222072261 +2252226A226B221A223D221D2235222B222C0000000000000000000000000000 +212B2030266F266D266A2020202100B6000000000000000025EF000000000000 +82 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000FF10 +FF11FF12FF13FF14FF15FF16FF17FF18FF190000000000000000000000000000 +FF21FF22FF23FF24FF25FF26FF27FF28FF29FF2AFF2BFF2CFF2DFF2EFF2FFF30 +FF31FF32FF33FF34FF35FF36FF37FF38FF39FF3A000000000000000000000000 +0000FF41FF42FF43FF44FF45FF46FF47FF48FF49FF4AFF4BFF4CFF4DFF4EFF4F +FF50FF51FF52FF53FF54FF55FF56FF57FF58FF59FF5A00000000000000003041 +30423043304430453046304730483049304A304B304C304D304E304F30503051 +30523053305430553056305730583059305A305B305C305D305E305F30603061 +30623063306430653066306730683069306A306B306C306D306E306F30703071 +30723073307430753076307730783079307A307B307C307D307E307F30803081 +30823083308430853086308730883089308A308B308C308D308E308F30903091 +3092309300000000000000000000000000000000000000000000000000000000 +83 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +30A130A230A330A430A530A630A730A830A930AA30AB30AC30AD30AE30AF30B0 +30B130B230B330B430B530B630B730B830B930BA30BB30BC30BD30BE30BF30C0 +30C130C230C330C430C530C630C730C830C930CA30CB30CC30CD30CE30CF30D0 +30D130D230D330D430D530D630D730D830D930DA30DB30DC30DD30DE30DF0000 +30E030E130E230E330E430E530E630E730E830E930EA30EB30EC30ED30EE30EF +30F030F130F230F330F430F530F6000000000000000000000000000000000391 +03920393039403950396039703980399039A039B039C039D039E039F03A003A1 +03A303A403A503A603A703A803A90000000000000000000000000000000003B1 +03B203B303B403B503B603B703B803B903BA03BB03BC03BD03BE03BF03C003C1 +03C303C403C503C603C703C803C9000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +84 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +04100411041204130414041504010416041704180419041A041B041C041D041E +041F0420042104220423042404250426042704280429042A042B042C042D042E +042F000000000000000000000000000000000000000000000000000000000000 +04300431043204330434043504510436043704380439043A043B043C043D0000 +043E043F0440044104420443044404450446044704480449044A044B044C044D +044E044F00000000000000000000000000000000000000000000000000002500 +2502250C251025182514251C252C25242534253C25012503250F2513251B2517 +25232533252B253B254B2520252F25282537253F251D25302525253825420000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +85 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +2460246124622463246424652466246724682469246A246B246C246D246E246F +2470247124722473000000000000000000000000000000000000000024742475 +2476247724782479247A247B247C247D247E247F248024812482248324842485 +2486248700000000000000000000000000000000000000002776277727780000 +2779277A277B277C277D277E0000000000000000000000000000000000000000 +0000F8A124882489248A248B248C248D248E248F249000000000000000002160 +216121622163216421652166216721682169216A216BF8A2F8A3F8A400000000 +0000000000002170217121722173217421752176217721782179217A217BF8A5 +F8A6F8A700000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000249C249D249E249F24A0 +24A124A224A324A424A524A624A724A824A924AA24AB24AC24AD24AE24AF24B0 +24B124B224B324B424B500000000000000000000000000000000000000000000 +86 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +339C339F339D33A033A4F8A833A133A5339E33A2338EF8A9338F33C433963397 +F8AA339833B333B233B133B0210933D433CB3390338533863387F8AB00000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000211633CD2121F8AC2664 +2667266126622660266326652666000000000000000000000000000000000000 +0000000000003020260E30040000000000000000000000000000000000000000 +0000000000000000000000000000261E261C261D261F21C621C421C5F8AD21E8 +21E621E721E9F8AEF8AFF8B0F8B1000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +87 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +3230322A322B322C322D322E322F32403237324232433239323A3231323E3234 +3232323B323632333235323C323D323F32380000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000059275C0F32A432A532A632A732A832A93296329D3298329E63A732993349 +3322334D3314331633053333334E330333363318331533273351334A33393357 +330D334233233326333B332B00000000000000000000000000003300331E332A +3331334700000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000337E337D337C337B0000000000000000000000000000 +0000000000000000000000000000000000000000337FF8B2F8B3000000000000 +88 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +222E221F22BF0000000000000000000000000000000000000000000000000000 +0000000000000000301DF8B40000000000000000000000000000000000000000 +000000000000000000000000000000003094000030F730F830F930FA00000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000004E9C +55165A03963F54C0611B632859F690228475831C7A5060AA63E16E2565ED8466 +82A69BF56893572765A162715B9B59D0867B98F47D627DBE9B8E62167C9F88B7 +5B895EB563096697684895C7978D674F4EE54F0A4F4D4F9D504956F2593759D4 +5A015C0960DF610F61706613690570BA754F757079FB7DAD7DEF80C3840E8863 +8B029055907A533B4E954EA557DF80B290C178EF4E0058F16EA290387A328328 +828B9C2F5141537054BD54E156E059FB5F1598F26DEB80E4852D000000000000 +89 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +9662967096A097FB540B53F35B8770CF7FBD8FC296E8536F9D5C7ABA4E117893 +81FC6E26561855046B1D851A9C3B59E553A96D6674DC958F56424E91904B96F2 +834F990C53E155B65B305F71662066F368046C386CF36D29745B76C87A4E9834 +82F1885B8A6092ED6DB275AB76CA99C560A68B018D8A95B2698E53AD51860000 +5712583059445BB45EF6602863A963F46CBF6F14708E7114715971D5733F7E01 +827682D185979060925B9D1B586965BC6C5A752551F9592E59655F805FDC62BC +65FA6A2A6B276BB4738B7FC189569D2C9D0E9EC45CA16C96837B51045C4B61B6 +81C6687672614E594FFA537860696E297A4F97F34E0B53164EEE4F554F3D4FA1 +4F7352A053EF5609590F5AC15BB65BE179D16687679C67B66B4C6CB3706B73C2 +798D79BE7A3C7B8782B182DB8304837783EF83D387668AB256298CA88FE6904E +971E868A4FC45CE862117259753B81E582BD86FE8CC096C5991399D54ECB4F1A +89E356DE584A58CA5EFB5FEB602A6094606261D0621262D06539000000000000 +8A +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +9B41666668B06D777070754C76867D7582A587F9958B968E8C9D51F152BE5916 +54B35BB35D16616869826DAF788D84CB88578A7293A79AB86D6C99A886D957A3 +67FF86CE920E5283568754045ED362E164B9683C68386BBB737278BA7A6B899A +89D28D6B8F0390ED95A3969497695B665CB3697D984D984E639B7B206A2B0000 +6A7F68B69C0D6F5F5272559D607062EC6D3B6E076ED1845B89108F444E149C39 +53F6691B6A3A9784682A515C7AC384B291DC938C565B9D286822830584317CA5 +520882C574E64E7E4F8351A05BD2520A52D852E75DFB559A582A59E65B8C5B98 +5BDB5E725E7960A3611F616361BE63DB656267D1685368FA6B3E6B536C576F22 +6F976F4574B0751876E3770B7AFF7BA17C217DE97F367FF0809D8266839E89B3 +8ACC8CAB908494519593959195A2966597D3992882184E38542B5CB85DCC73A9 +764C773C5CA97FEB8D0B96C19811985498584F014F0E5371559C566857FA5947 +5B095BC45C905E0C5E7E5FCC63EE673A65D765E2671F68CB68C4000000000000 +8B +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +6A5F5E306BC56C176C7D757F79485B637A007D005FBD898F8A188CB48D778ECC +8F1D98E29A0E9B3C4E80507D510059935B9C622F628064EC6B3A72A075917947 +7FA987FB8ABC8B7063AC83CA97A05409540355AB68546A588A70782767759ECD +53745BA2811A865090064E184E454EC74F1153CA54385BAE5F13602565510000 +673D6C426C726CE3707874037A767AAE7B087D1A7CFE7D6665E7725B53BB5C45 +5DE862D262E063196E20865A8A318DDD92F86F0179A69B5A4EA84EAB4EAC4F9B +4FA050D151477AF6517151F653545321537F53EB55AC58835CE15F375F4A602F +6050606D631F65596A4B6CC172C272ED77EF80F881058208854E90F793E197FF +99579A5A4EF051DD5C2D6681696D5C4066F26975738968507C8150C552E45747 +5DFE932665A46B236B3D7434798179BD7B4B7DCA82B983CC887F895F8B398FD1 +91D1541F92804E5D503653E5533A72D7739677E982E68EAF99C699C899D25177 +611A865E55B07A7A50765BD3904796854E326ADB91E75C515C48000000000000 +8C +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +63987A9F6C9397748F617AAA718A96887C8268177E706851936C52F2541B85AB +8A137FA48ECD90E15366888879414FC250BE521151445553572D73EA578B5951 +5F625F8460756176616761A963B2643A656C666F68426E1375667A3D7CFB7D4C +7D997E4B7F6B830E834A86CD8A088A638B668EFD981A9D8F82B88FCE9BE80000 +5287621F64836FC09699684150916B206C7A6F547A747D5088408A2367084EF6 +503950265065517C5238526355A7570F58055ACC5EFA61B261F862F36372691C +6A29727D72AC732E7814786F7D79770C80A9898B8B198CE28ED290639375967A +98559A139E785143539F53B35E7B5F266E1B6E90738473FE7D4382378A008AFA +96504E4E500B53E4547C56FA59D15B645DF15EAB5F276238654567AF6E5672D0 +7CCA88B480A180E183F0864E8A878DE8923796C798679F134E944E924F0D5348 +5449543E5A2F5F8C5FA1609F68A76A8E745A78818A9E8AA48B7791904E5E9BC9 +4EA44F7C4FAF501950165149516C529F52B952FE539A53E35411000000000000 +8D +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +540E5589575157A2597D5B545B5D5B8F5DE55DE75DF75E785E835E9A5EB75F18 +6052614C629762D863A7653B6602664366F4676D6821689769CB6C5F6D2A6D69 +6E2F6E9D75327687786C7A3F7CE07D057D187D5E7DB18015800380AF80B18154 +818F822A8352884C88618B1B8CA28CFC90CA91759271783F92FC95A4964D0000 +980599999AD89D3B525B52AB53F7540858D562F76FE08C6A8F5F9EB9514B523B +544A56FD7A4091779D609ED273446F09817075115FFD60DA9AA872DB8FBC6B64 +98034ECA56F0576458BE5A5A606861C7660F6606683968B16DF775D57D3A826E +9B424E9B4F5053C955065D6F5DE65DEE67FB6C99747378028A50939688DF5750 +5EA7632B50B550AC518D670054C9585E59BB5BB05F69624D63A1683D6B736E08 +707D91C7728078157826796D658E7D3083DC88C18F09969B5264572867507F6A +8CA151B45742962A583A698A80B454B25D0E57FC78959DFA4F5C524A548B643E +6628671467F57A847B567D22932F685C9BAD7B395319518A5237000000000000 +8E +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +5BDF62F664AE64E6672D6BBA85A996D176909BD6634C93069BAB76BF66524E09 +509853C25C7160E864926563685F71E673CA75237B977E8286958B838CDB9178 +991065AC66AB6B8B4ED54ED44F3A4F7F523A53F853F255E356DB58EB59CB59C9 +59FF5B505C4D5E025E2B5FD7601D6307652F5B5C65AF65BD65E8679D6B620000 +6B7B6C0F7345794979C17CF87D197D2B80A2810281F389968A5E8A698A668A8C +8AEE8CC78CDC96CC98FC6B6F4E8B4F3C4F8D51505B575BFA6148630166426B21 +6ECB6CBB723E74BD75D478C1793A800C803381EA84948F9E6C509E7F5F0F8B58 +9D2B7AFA8EF85B8D96EB4E0353F157F759315AC95BA460896E7F6F0675BE8CEA +5B9F85007BE0507267F4829D5C61854A7E1E820E51995C0463688D66659C716E +793E7D1780058B1D8ECA906E86C790AA501F52FA5C3A6753707C7235914C91C8 +932B82E55BC25F3160F94E3B53D65B88624B67316B8A72E973E07A2E816B8DA3 +91529996511253D7546A5BFF63886A397DAC970056DA53CE5468000000000000 +8F +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +5B975C315DDE4FEE610162FE6D3279C079CB7D427E4D7FD281ED821F84908846 +89728B908E748F2F9031914B916C96C6919C4EC04F4F514553415F93620E67D4 +6C416E0B73637E2691CD928353D459195BBF6DD1795D7E2E7C9B587E719F51FA +88538FF04FCA5CFB662577AC7AE3821C99FF51C65FAA65EC696F6B896DF30000 +6E966F6476FE7D145DE190759187980651E6521D6240669166D96E1A5EB67DD2 +7F7266F885AF85F78AF852A953D959735E8F5F90605592E4966450B7511F52DD +5320534753EC54E8554655315617596859BE5A3C5BB55C065C0F5C115C1A5E84 +5E8A5EE05F70627F628462DB638C63776607660C662D6676677E68A26A1F6A35 +6CBC6D886E096E58713C7126716775C77701785D7901796579F07AE07B117CA7 +7D39809683D6848B8549885D88F38A1F8A3C8A548A738C618CDE91A49266937E +9418969C97984E0A4E084E1E4E575197527057CE583458CC5B225E3860C564FE +676167566D4472B675737A6384B88B7291B89320563157F498FE000000000000 +90 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +62ED690D6B9671ED7E548077827289E698DF87558FB15C3B4F384FE14FB55507 +5A205BDD5BE95FC3614E632F65B0664B68EE699B6D786DF1753375B9771F795E +79E67D3381E382AF85AA89AA8A3A8EAB8F9B903291DD97074EBA4EC152035875 +58EC5C0B751A5C3D814E8A0A8FC59663976D7B258ACF9808916256F353A80000 +9017543957825E2563A86C34708A77617C8B7FE088709042915493109318968F +745E9AC45D075D69657067A28DA896DB636E6749691983C5981796C088FE6F84 +647A5BF84E16702C755D662F51C4523652E259D35F8160276210653F6574661F +667468F268166B636E057272751F76DB7CBE805658F088FD897F8AA08A938ACB +901D91929752975965897A0E810696BB5E2D60DC621A65A56614679077F37A4D +7C4D7E3E810A8CAC8D648DE18E5F78A9520762D963A5644262988A2D7A837BC0 +8AAC96EA7D76820C87494ED95148534353605BA35C025C165DDD6226624764B0 +681368346CC96D456D1767D36F5C714E717D65CB7A7F7BAD7DDA000000000000 +91 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +7E4A7FA8817A821B823985A68A6E8CCE8DF59078907792AD929195839BAE524D +55846F387136516879857E5581B37CCE564C58515CA863AA66FE66FD695A72D9 +758F758E790E795679DF7C977D207D4486078A34963B90619F2050E7527553CC +53E2500955AA58EE594F723D5B8B5C64531D60E360F3635C6383633F63BB0000 +64CD65E966F95DE369CD69FD6F1571E54E8975E976F87A937CDF7DCF7D9C8061 +83498358846C84BC85FB88C58D709001906D9397971C9A1250CF5897618E81D3 +85358D0890204FC3507452475373606F6349675F6E2C8DB3901F4FD75C5E8CCA +65CF7D9A53528896517663C35B585B6B5C0A640D6751905C4ED6591A592A6C70 +8A51553E581559A560F0625367C182356955964099C49A284F5358065BFE8010 +5CB15E2F5F856020614B623466FF6CF06EDE80CE817F82D4888B8CB89000902E +968A9EDB9BDB4EE353F059277B2C918D984C9DF96EDD7027535355445B856258 +629E62D36CA26FEF74228A1794386FC18AFE833851E786F853EA000000000000 +92 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +53E94F4690548FB0596A81315DFD7AEA8FBF68DA8C3772F89C486A3D8AB04E39 +53585606576662C563A265E66B4E6DE16E5B70AD77ED7AEF7BAA7DBB803D80C6 +86CB8A95935B56E358C75F3E65AD66966A806BB575378AC7502477E557305F1B +6065667A6C6075F47A1A7F6E81F48718904599B37BC9755C7AF97B5184C40000 +901079E97A9283365AE177404E2D4EF25B995FE062BD663C67F16CE8866B8877 +8A3B914E92F399D06A177026732A82E784578CAF4E01514651CB558B5BF55E16 +5E335E815F145F355F6B5FB461F2631166A2671D6F6E7252753A773A80748139 +817887768ABF8ADC8D858DF3929A957798029CE552C5635776F467156C8873CD +8CC393AE96736D25589C690E69CC8FFD939A75DB901A585A680263B469FB4F43 +6F2C67D88FBB85267DB49354693F6F70576A58F75B2C7D2C722A540A91E39DB4 +4EAD4F4E505C507552438C9E544858245B9A5E1D5E955EAD5EF75F1F608C62B5 +633A63D068AF6C407887798E7A0B7DE082478A028AE68E449013000000000000 +93 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +90B8912D91D89F0E6CE5645864E265756EF476847B1B906993D16EBA54F25FB9 +64A48F4D8FED92445178586B59295C555E976DFB7E8F751C8CBC8EE2985B70B9 +4F1D6BBF6FB1753096FB514E54105835585759AC5C605F926597675C6E21767B +83DF8CED901490FD934D7825783A52AA5EA6571F597460125012515A51AC0000 +51CD520055105854585859575B955CF65D8B60BC6295642D6771684368BC68DF +76D76DD86E6F6D9B706F71C85F5375D879777B497B547B527CD67D7152308463 +856985E48A0E8B048C468E0F9003900F94199676982D9A3095D850CD52D5540C +58025C0E61A7649E6D1E77B37AE580F48404905392855CE09D07533F5F975FB3 +6D9C7279776379BF7BE46BD272EC8AAD68036A6151F87A8169345C4A9CF682EB +5BC59149701E56785C6F60C765666C8C8C5A90419813545166C7920D594890A3 +51854E4D51EA85998B0E7058637A934B696299B47E047577535769608EDF96E3 +6C5D4E8C5C3C5F108FE953028CD1808986795EFF65E54E735165000000000000 +94 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +59825C3F97EE4EFB598A5FCD8A8D6FE179B079625BE78471732B71B15E745FF5 +637B649A71C37C984E435EFC4E4B57DC56A260A96FC37D0D80FD813381BF8FB2 +899786A45DF4628A64AD898767776CE26D3E743678345A467F7582AD99AC4FF3 +5EC362DD63926557676F76C3724C80CC80BA8F29914D500D57F95A9268850000 +6973716472FD8CB758F28CE0966A9019877F79E477E784294F2F5265535A62CD +67CF6CCA767D7B947C95823685848FEB66DD6F2072067E1B83AB99C19EA651FD +7BB178727BB880877B486AE85E61808C75517560516B92626E8C767A91979AEA +4F107F70629C7B4F95A59CE9567A585986E496BC4F345224534A53CD53DB5E06 +642C6591677F6C3E6C4E724872AF73ED75547E41822C85E98CA97BC491C67169 +981298EF633D6669756A76E478D0854386EE532A5351542659835E875F7C60B2 +6249627962AB65906BD46CCC75B276AE789179D87DCB7F7780A588AB8AB98CBB +907F975E98DB6A0B7C3850995C3E5FAE67876BD8743577097F8E000000000000 +95 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +9F3B67CA7A175339758B9AED5F66819D83F180985F3C5FC575627B46903C6867 +59EB5A9B7D10767E8B2C4FF55F6A6A196C376F0274E2796888688A558C795EDF +63CF75C579D282D7932892F2849C86ED9C2D54C15F6C658C6D5C70158CA78CD3 +983B654F74F64E0D4ED857E0592B5A665BCC51A85E035E9C6016627665770000 +65A7666E6D6E72367B268150819A82998B5C8CA08CE68D74961C96444FAE64AB +6B66821E8461856A90E85C01695398A8847A85574F0F526F5FA95E45670D798F +8179890789866DF55F1762556CB84ECF72699B925206543B567458B361A4626E +711A596E7C897CDE7D1B96F06587805E4E194F75517558405E635E735F0A67C4 +4E26853D9589965B7C73980150FB58C1765678A7522577A585117B86504F5909 +72477BC77DE88FBA8FD4904D4FBF52C95A295F0197AD4FDD821792EA57036355 +6B69752B88DC8F147A4252DF58936155620A66AE6BCD7C3F83E950234FF85305 +5446583159495B9D5CF05CEF5D295E9662B16367653E65B9670B000000000000 +96 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +6CD56CE170F978327E2B80DE82B3840C84EC870289128A2A8C4A90A692D298FD +9CF39D6C4E4F4EA1508D5256574A59A85E3D5FD85FD9623F66B4671B67D068D2 +51927D2180AA81A88B008C8C8CBF927E96325420982C531750D5535C58A864B2 +6734726777667A4691E652C36CA16B8658005E4C5954672C7FFB51E176C60000 +646978E89B549EBB57CB59B96627679A6BCE54E969D95E55819C67959BAA67FE +9C52685D4EA64FE353C862B9672B6CAB8FC44FAD7E6D9EBF4E0761626E806F2B +85135473672A9B455DF37B955CAC5BC6871C6E4A84D17A14810859997C8D6C11 +772052D959227121725F77DB97279D61690B5A7F5A1851A5540D547D660E76DF +8FF792989CF459EA725D6EC5514D68C97DBF7DEC97629EBA64786A2183025984 +5B5F6BDB731B76F27DB280178499513267289ED976EE676252FF99055C24623B +7C7E8CB0554F60B67D0B958053014E5F51B6591C723A803691CE5F2577E25384 +5F797D0485AC8A338E8D975667F385AE9453610961086CB97652000000000000 +97 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +8AED8F38552F4F51512A52C753CB5BA55E7D60A0618263D6670967DA6E676D8C +733673377531795088D58A98904A909190F596C4878D59154E884F594E0E8A89 +8F3F981050AD5E7C59965BB95EB863DA63FA64C166DC694A69D86D0B6EB67194 +75287AAF7F8A8000844984C989818B218E0A9065967D990A617E62916B320000 +6C836D747FCC7FFC6DC07F8587BA88F8676583B1983C96F76D1B7D61843D916A +4E7153755D506B046FEB85CD862D89A75229540F5C65674E68A87406748375E2 +88CF88E191CC96E296785F8B73877ACB844E63A0756552896D416E9C74097559 +786B7C9296867ADC9F8D4FB6616E65C5865C4E864EAE50DA4E2151CC5BEE6599 +68816DBC731F764277AD7A1C7CE7826F8AD2907C91CF96759818529B7DD1502B +539867976DCB71D0743381E88F2A96A39C579E9F746058416D997D2F985E4EE4 +4F364F8B51B752B15DBA601C73B2793C82D3923496B796F6970A9E979F6266A6 +6B74521752A370C888C25EC9604B61906F2371497C3E7DF4806F000000000000 +98 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +84EE9023932C54429B6F6AD370898CC28DEF973252B45A415ECA5F046717697C +69946D6A6F0F726272FC7BED8001807E874B90CE516D9E937984808B93328AD6 +502D548C8A716B6A8CC4810760D167A09DF24E994E989C108A6B85C185686900 +6E7E789781550000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000005F0C +4E104E154E2A4E314E364E3C4E3F4E424E564E584E824E858C6B4E8A82125F0D +4E8E4E9E4E9F4EA04EA24EB04EB34EB64ECE4ECD4EC44EC64EC24ED74EDE4EED +4EDF4EF74F094F5A4F304F5B4F5D4F574F474F764F884F8F4F984F7B4F694F70 +4F914F6F4F864F9651184FD44FDF4FCE4FD84FDB4FD14FDA4FD04FE44FE5501A +50285014502A502550054F1C4FF650215029502C4FFE4FEF5011500650435047 +6703505550505048505A5056506C50785080509A508550B450B2000000000000 +99 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +50C950CA50B350C250D650DE50E550ED50E350EE50F950F55109510151025116 +51155114511A5121513A5137513C513B513F51405152514C515451627AF85169 +516A516E5180518256D8518C5189518F519151935195519651A451A651A251A9 +51AA51AB51B351B151B251B051B551BD51C551C951DB51E0865551E951ED0000 +51F051F551FE5204520B5214520E5227522A522E52335239524F5244524B524C +525E5254526A527452695273527F527D528D529452925271528852918FA88FA7 +52AC52AD52BC52B552C152CD52D752DE52E352E698ED52E052F352F552F852F9 +530653087538530D5310530F5315531A5323532F533153335338534053465345 +4E175349534D51D6535E5369536E5918537B53775382539653A053A653A553AE +53B053B653C37C1296D953DF66FC71EE53EE53E853ED53FA5401543D5440542C +542D543C542E54365429541D544E548F5475548E545F5471547754705492547B +5480547654845490548654C754A254B854A554AC54C454C854A8000000000000 +9A +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +54AB54C254A454BE54BC54D854E554E6550F551454FD54EE54ED54FA54E25539 +55405563554C552E555C55455556555755385533555D5599558054AF558A559F +557B557E5598559E55AE557C558355A9558755A855DA55C555DF55C455DC55E4 +55D4561455F7561655FE55FD561B55F9564E565071DF56345636563256380000 +566B5664562F566C566A56865680568A56A05694568F56A556AE56B656B456C2 +56BC56C156C356C056C856CE56D156D356D756EE56F9570056FF570457095708 +570B570D57135718571655C7571C572657375738574E573B5740574F576957C0 +57885761577F5789579357A057B357A457AA57B057C357C657D457D257D3580A +57D657E3580B5819581D587258215862584B58706BC05852583D5879588558B9 +589F58AB58BA58DE58BB58B858AE58C558D358D158D758D958D858E558DC58E4 +58DF58EF58FA58F958FB58FC58FD5902590A5910591B68A65925592C592D5932 +5938593E7AD259555950594E595A5958596259605967596C5969000000000000 +9B +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +59785981599D4F5E4FAB59A359B259C659E859DC598D59D959DA5A255A1F5A11 +5A1C5A095A1A5A405A6C5A495A355A365A625A6A5A9A5ABC5ABE5ACB5AC25ABD +5AE35AD75AE65AE95AD65AFA5AFB5B0C5B0B5B165B325AD05B2A5B365B3E5B43 +5B455B405B515B555B5A5B5B5B655B695B705B735B755B7865885B7A5B800000 +5B835BA65BB85BC35BC75BC95BD45BD05BE45BE65BE25BDE5BE55BEB5BF05BF6 +5BF35C055C075C085C0D5C135C205C225C285C385C395C415C465C4E5C535C50 +5C4F5B715C6C5C6E4E625C765C795C8C5C915C94599B5CAB5CBB5CB65CBC5CB7 +5CC55CBE5CC75CD95CE95CFD5CFA5CED5D8C5CEA5D0B5D155D175D5C5D1F5D1B +5D115D145D225D1A5D195D185D4C5D525D4E5D4B5D6C5D735D765D875D845D82 +5DA25D9D5DAC5DAE5DBD5D905DB75DBC5DC95DCD5DD35DD25DD65DDB5DEB5DF2 +5DF55E0B5E1A5E195E115E1B5E365E375E445E435E405E4E5E575E545E5F5E62 +5E645E475E755E765E7A9EBC5E7F5EA05EC15EC25EC85ED05ECF000000000000 +9C +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +5ED65EE35EDD5EDA5EDB5EE25EE15EE85EE95EEC5EF15EF35EF05EF45EF85EFE +5F035F095F5D5F5C5F0B5F115F165F295F2D5F385F415F485F4C5F4E5F2F5F51 +5F565F575F595F615F6D5F735F775F835F825F7F5F8A5F885F915F875F9E5F99 +5F985FA05FA85FAD5FBC5FD65FFB5FE45FF85FF15FDD60B35FFF602160600000 +601960106029600E6031601B6015602B6026600F603A605A6041606A6077605F +604A6046604D6063604360646042606C606B60596081608D60E76083609A6084 +609B60966097609260A7608B60E160B860E060D360B45FF060BD60C660B560D8 +614D6115610660F660F7610060F460FA6103612160FB60F1610D610E6147613E +61286127614A613F613C612C6134613D614261446173617761586159615A616B +6174616F61656171615F615D6153617561996196618761AC6194619A618A6191 +61AB61AE61CC61CA61C961F761C861C361C661BA61CB7F7961CD61E661E361F6 +61FA61F461FF61FD61FC61FE620062086209620D620C6214621B000000000000 +9D +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +621E6221622A622E6230623262336241624E625E6263625B62606268627C6282 +6289627E62926293629662D46283629462D762D162BB62CF62FF62C664D462C8 +62DC62CC62CA62C262C7629B62C9630C62EE62F163276302630862EF62F56350 +633E634D641C634F6396638E638063AB637663A3638F6389639F63B5636B0000 +636963BE63E963C063C663E363C963D263F663C4641664346406641364266436 +651D64176428640F6467646F6476644E652A6495649364A564A9648864BC64DA +64D264C564C764BB64D864C264F164E7820964E064E162AC64E364EF652C64F6 +64F464F264FA650064FD6518651C650565246523652B65346535653765366538 +754B654865566555654D6558655E655D65726578658265838B8A659B659F65AB +65B765C365C665C165C465CC65D265DB65D965E065E165F16772660A660365FB +6773663566366634661C664F664466496641665E665D666466676668665F6662 +667066836688668E668966846698669D66C166B966C966BE66BC000000000000 +9E +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +66C466B866D666DA66E0663F66E666E966F066F566F7670F6716671E67266727 +9738672E673F67366741673867376746675E67606759676367646789677067A9 +677C676A678C678B67A667A1678567B767EF67B467EC67B367E967B867E467DE +67DD67E267EE67B967CE67C667E76A9C681E684668296840684D6832684E0000 +68B3682B685968636877687F689F688F68AD6894689D689B68836AAE68B96874 +68B568A068BA690F688D687E690168CA690868D86922692668E1690C68CD68D4 +68E768D569366912690468D768E3692568F968E068EF6928692A691A69236921 +68C669796977695C6978696B6954697E696E69396974693D695969306961695E +695D6981696A69B269AE69D069BF69C169D369BE69CE5BE869CA69DD69BB69C3 +69A76A2E699169A0699C699569B469DE69E86A026A1B69FF6B0A69F969F269E7 +6A0569B16A1E69ED6A1469EB6A0A6A126AC16A236A136A446A0C6A726A366A78 +6A476A626A596A666A486A386A226A906A8D6AA06A846AA26AA3000000000000 +9F +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +6A9786176ABB6AC36AC26AB86AB36AAC6ADE6AD16ADF6AAA6ADA6AEA6AFB6B05 +86166AFA6B126B169B316B1F6B386B3776DC6B3998EE6B476B436B496B506B59 +6B546B5B6B5F6B616B786B796B7F6B806B846B836B8D6B986B956B9E6BA46BAA +6BAB6BAF6BB26BB16BB36BB76BBC6BC66BCB6BD36BDF6BEC6BEB6BF36BEF0000 +9EBE6C086C136C146C1B6C246C236C5E6C556C626C6A6C826C8D6C9A6C816C9B +6C7E6C686C736C926C906CC46CF16CD36CBD6CD76CC56CDD6CAE6CB16CBE6CBA +6CDB6CEF6CD96CEA6D1F884D6D366D2B6D3D6D386D196D356D336D126D0C6D63 +6D936D646D5A6D796D596D8E6D956FE46D856DF96E156E0A6DB56DC76DE66DB8 +6DC66DEC6DDE6DCC6DE86DD26DC56DFA6DD96DE46DD56DEA6DEE6E2D6E6E6E2E +6E196E726E5F6E3E6E236E6B6E2B6E766E4D6E1F6E436E3A6E4E6E246EFF6E1D +6E386E826EAA6E986EC96EB76ED36EBD6EAF6EC46EB26ED46ED56E8F6EA56EC2 +6E9F6F416F11704C6EEC6EF86EFE6F3F6EF26F316EEF6F326ECC000000000000 +E0 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +6F3E6F136EF76F866F7A6F786F816F806F6F6F5B6FF36F6D6F826F7C6F586F8E +6F916FC26F666FB36FA36FA16FA46FB96FC66FAA6FDF6FD56FEC6FD46FD86FF1 +6FEE6FDB7009700B6FFA70117001700F6FFE701B701A6F74701D7018701F7030 +703E7032705170637099709270AF70F170AC70B870B370AE70DF70CB70DD0000 +70D9710970FD711C711971657155718871667162714C7156716C718F71FB7184 +719571A871AC71D771B971BE71D271C971D471CE71E071EC71E771F571FC71F9 +71FF720D7210721B7228722D722C72307232723B723C723F72407246724B7258 +7274727E7282728172877292729672A272A772B972B272C372C672C472CE72D2 +72E272E072E172F972F7500F7317730A731C7316731D7334732F73297325733E +734E734F9ED87357736A7368737073787375737B737A73C873B373CE73BB73C0 +73E573EE73DE74A27405746F742573F87432743A7455743F745F74597441745C +746974707463746A7476747E748B749E74A774CA74CF74D473F1000000000000 +E1 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +74E074E374E774E974EE74F274F074F174F874F7750475037505750C750E750D +75157513751E7526752C753C7544754D754A7549755B7546755A756975647567 +756B756D75787576758675877574758A758975827594759A759D75A575A375C2 +75B375C375B575BD75B875BC75B175CD75CA75D275D975E375DE75FE75FF0000 +75FC760175F075FA75F275F3760B760D7609761F762776207621762276247634 +7630763B764776487646765C76587661766276687669766A7667766C76707672 +76767678767C768076837688768B768E769676937699769A76B076B476B876B9 +76BA76C276CD76D676D276DE76E176E576E776EA862F76FB7708770777047729 +7724771E77257726771B773777387747775A7768776B775B7765777F777E7779 +778E778B779177A0779E77B077B677B977BF77BC77BD77BB77C777CD77D777DA +77DC77E377EE77FC780C781279267820792A7845788E78747886787C789A788C +78A378B578AA78AF78D178C678CB78D478BE78BC78C578CA78EC000000000000 +E2 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +78E778DA78FD78F47907791279117919792C792B794079607957795F795A7955 +7953797A797F798A799D79A79F4B79AA79AE79B379B979BA79C979D579E779EC +79E179E37A087A0D7A187A197A207A1F79807A317A3B7A3E7A377A437A577A49 +7A617A627A699F9D7A707A797A7D7A887A977A957A987A967AA97AC87AB00000 +7AB67AC57AC47ABF90837AC77ACA7ACD7ACF7AD57AD37AD97ADA7ADD7AE17AE2 +7AE67AED7AF07B027B0F7B0A7B067B337B187B197B1E7B357B287B367B507B7A +7B047B4D7B0B7B4C7B457B757B657B747B677B707B717B6C7B6E7B9D7B987B9F +7B8D7B9C7B9A7B8B7B927B8F7B5D7B997BCB7BC17BCC7BCF7BB47BC67BDD7BE9 +7C117C147BE67BE57C607C007C077C137BF37BF77C177C0D7BF67C237C277C2A +7C1F7C377C2B7C3D7C4C7C437C547C4F7C407C507C587C5F7C647C567C657C6C +7C757C837C907CA47CAD7CA27CAB7CA17CA87CB37CB27CB17CAE7CB97CBD7CC0 +7CC57CC27CD87CD27CDC7CE29B3B7CEF7CF27CF47CF67CFA7D06000000000000 +E3 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +7D027D1C7D157D0A7D457D4B7D2E7D327D3F7D357D467D737D567D4E7D727D68 +7D6E7D4F7D637D937D897D5B7D8F7D7D7D9B7DBA7DAE7DA37DB57DC77DBD7DAB +7E3D7DA27DAF7DDC7DB87D9F7DB07DD87DDD7DE47DDE7DFB7DF27DE17E057E0A +7E237E217E127E317E1F7E097E0B7E227E467E667E3B7E357E397E437E370000 +7E327E3A7E677E5D7E567E5E7E597E5A7E797E6A7E697E7C7E7B7E837DD57E7D +8FAE7E7F7E887E897E8C7E927E907E937E947E967E8E7E9B7E9C7F387F3A7F45 +7F4C7F4D7F4E7F507F517F557F547F587F5F7F607F687F697F677F787F827F86 +7F837F887F877F8C7F947F9E7F9D7F9A7FA37FAF7FB27FB97FAE7FB67FB88B71 +7FC57FC67FCA7FD57FD47FE17FE67FE97FF37FF998DC80068004800B80128018 +8019801C80218028803F803B804A804680528058805A805F8062806880738072 +807080768079807D807F808480868085809B8093809A80AD519080AC80DB80E5 +80D980DD80C480DA80D6810980EF80F1811B81298123812F814B000000000000 +E4 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +968B8146813E8153815180FC8171816E81658166817481838188818A81808182 +81A0819581A481A3815F819381A981B081B581BE81B881BD81C081C281BA81C9 +81CD81D181D981D881C881DA81DF81E081E781FA81FB81FE8201820282058207 +820A820D821082168229822B82388233824082598258825D825A825F82640000 +82628268826A826B822E827182778278827E828D829282AB829F82BB82AC82E1 +82E382DF82D282F482F382FA8393830382FB82F982DE830682DC830982D98335 +83348316833283318340833983508345832F832B831783188385839A83AA839F +83A283968323838E8387838A837C83B58373837583A0838983A883F4841383EB +83CE83FD840383D8840B83C183F7840783E083F2840D8422842083BD84388506 +83FB846D842A843C855A84848477846B84AD846E848284698446842C846F8479 +843584CA846284B984BF849F84D984CD84BB84DA84D084C184C684D684A18521 +84FF84F485178518852C851F8515851484FC8540856385588548000000000000 +E5 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +85418602854B8555858085A485888591858A85A8856D8594859B85EA8587859C +8577857E859085C985BA85CF85B985D085D585DD85E585DC85F9860A8613860B +85FE85FA86068622861A8630863F864D4E558654865F86678671869386A386A9 +86AA868B868C86B686AF86C486C686B086C9882386AB86D486DE86E986EC0000 +86DF86DB86EF8712870687088700870386FB87118709870D86F9870A8734873F +8737873B87258729871A8760875F8778874C874E877487578768876E87598753 +8763876A880587A2879F878287AF87CB87BD87C087D096D687AB87C487B387C7 +87C687BB87EF87F287E0880F880D87FE87F687F7880E87D28811881688158822 +88218831883688398827883B8844884288528859885E8862886B8881887E889E +8875887D88B5887288828897889288AE889988A2888D88A488B088BF88B188C3 +88C488D488D888D988DD88F9890288FC88F488E888F28904890C890A89138943 +891E8925892A892B89418944893B89368938894C891D8960895E000000000000 +E6 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +89668964896D896A896F89748977897E89838988898A8993899889A189A989A6 +89AC89AF89B289BA89BD89BF89C089DA89DC89DD89E789F489F88A038A168A10 +8A0C8A1B8A1D8A258A368A418A5B8A528A468A488A7C8A6D8A6C8A628A858A82 +8A848AA88AA18A918AA58AA68A9A8AA38AC48ACD8AC28ADA8AEB8AF38AE70000 +8AE48AF18B148AE08AE28AF78ADE8ADB8B0C8B078B1A8AE18B168B108B178B20 +8B3397AB8B268B2B8B3E8B288B418B4C8B4F8B4E8B498B568B5B8B5A8B6B8B5F +8B6C8B6F8B748B7D8B808B8C8B8E8B928B938B968B998B9A8C3A8C418C3F8C48 +8C4C8C4E8C508C558C628C6C8C788C7A8C828C898C858C8A8C8D8C8E8C948C7C +8C98621D8CAD8CAA8CBD8CB28CB38CAE8CB68CC88CC18CE48CE38CDA8CFD8CFA +8CFB8D048D058D0A8D078D0F8D0D8D109F4E8D138CCD8D148D168D678D6D8D71 +8D738D818D998DC28DBE8DBA8DCF8DDA8DD68DCC8DDB8DCB8DEA8DEB8DDF8DE3 +8DFC8E088E098DFF8E1D8E1E8E108E1F8E428E358E308E348E4A000000000000 +E7 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +8E478E498E4C8E508E488E598E648E608E2A8E638E558E768E728E7C8E818E87 +8E858E848E8B8E8A8E938E918E948E998EAA8EA18EAC8EB08EC68EB18EBE8EC5 +8EC88ECB8EDB8EE38EFC8EFB8EEB8EFE8F0A8F058F158F128F198F138F1C8F1F +8F1B8F0C8F268F338F3B8F398F458F428F3E8F4C8F498F468F4E8F578F5C0000 +8F628F638F648F9C8F9F8FA38FAD8FAF8FB78FDA8FE58FE28FEA8FEF90878FF4 +90058FF98FFA901190159021900D901E9016900B90279036903590398FF8904F +905090519052900E9049903E90569058905E9068906F907696A890729082907D +90819080908A9089908F90A890AF90B190B590E290E4624890DB910291129119 +91329130914A9156915891639165916991739172918B9189918291A291AB91AF +91AA91B591B491BA91C091C191C991CB91D091D691DF91E191DB91FC91F591F6 +921E91FF9214922C92159211925E925792459249926492489295923F924B9250 +929C92969293929B925A92CF92B992B792E9930F92FA9344932E000000000000 +E8 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +93199322931A9323933A9335933B935C9360937C936E935693B093AC93AD9394 +93B993D693D793E893E593D893C393DD93D093C893E4941A9414941394039407 +94109436942B94359421943A944194529444945B94609462945E946A92299470 +94759477947D945A947C947E9481947F95829587958A95949596959895990000 +95A095A895A795AD95BC95BB95B995BE95CA6FF695C395CD95CC95D595D495D6 +95DC95E195E595E296219628962E962F9642964C964F964B9677965C965E965D +965F96669672966C968D96989695969796AA96A796B196B296B096B496B696B8 +96B996CE96CB96C996CD894D96DC970D96D596F99704970697089713970E9711 +970F971697199724972A97309739973D973E97449746974897429749975C9760 +97649766976852D2976B977197799785977C9781977A9786978B978F9790979C +97A897A697A397B397B497C397C697C897CB97DC97ED9F4F97F27ADF97F697F5 +980F980C9838982498219837983D9846984F984B986B986F9870000000000000 +E9 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +98719874987398AA98AF98B198B698C498C398C698E998EB9903990999129914 +99189921991D991E99249920992C992E993D993E9942994999459950994B9951 +9952994C99559997999899A599AD99AE99BC99DF99DB99DD99D899D199ED99EE +99F199F299FB99F89A019A0F9A0599E29A199A2B9A379A459A429A409A430000 +9A3E9A559A4D9A5B9A579A5F9A629A659A649A699A6B9A6A9AAD9AB09ABC9AC0 +9ACF9AD19AD39AD49ADE9ADF9AE29AE39AE69AEF9AEB9AEE9AF49AF19AF79AFB +9B069B189B1A9B1F9B229B239B259B279B289B299B2A9B2E9B2F9B329B449B43 +9B4F9B4D9B4E9B519B589B749B939B839B919B969B979B9F9BA09BA89BB49BC0 +9BCA9BB99BC69BCF9BD19BD29BE39BE29BE49BD49BE19C3A9BF29BF19BF09C15 +9C149C099C139C0C9C069C089C129C0A9C049C2E9C1B9C259C249C219C309C47 +9C329C469C3E9C5A9C609C679C769C789CE79CEC9CF09D099D089CEB9D039D06 +9D2A9D269DAF9D239D1F9D449D159D129D419D3F9D3E9D469D48000000000000 +EA +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +9D5D9D5E9D649D519D509D599D729D899D879DAB9D6F9D7A9D9A9DA49DA99DB2 +9DC49DC19DBB9DB89DBA9DC69DCF9DC29DD99DD39DF89DE69DED9DEF9DFD9E1A +9E1B9E1E9E759E799E7D9E819E889E8B9E8C9E929E959E919E9D9EA59EA99EB8 +9EAA9EAD97619ECC9ECE9ECF9ED09ED49EDC9EDE9EDD9EE09EE59EE89EEF0000 +9EF49EF69EF79EF99EFB9EFC9EFD9F079F0876B79F159F219F2C9F3E9F4A9F52 +9F549F639F5F9F609F619F669F679F6C9F6A9F779F729F769F959F9C9FA0582F +69C79059746451DC719900000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +EB +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000F8B5F8B60000000000000000000000000000000000000000000000000000 +F8B7FE33000000000000000000000000000000000000F8B8FE31F8B900000000 +F8BAF8BBF8BCF8BDFE300000000000000000FE35FE36FE39FE3AF8BEF8BFFE37 +FE38FE3FFE40FE3DFE3EFE41FE42FE43FE44FE3BFE3C00000000000000000000 +0000F8C000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +EC +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000F8C1 +0000F8C20000F8C30000F8C40000F8C500000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000F8C600000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000F8C70000F8C80000F8C9000000000000000000000000F8CA000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +ED +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +F8CB0000F8CC0000F8CD0000F8CE0000F8CF0000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00000000F8D00000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000000000000F8D10000F8D20000F8D3000000000000000000000000F8D40000 +00000000000000000000F8D5F8D6000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 diff --git a/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/macRoman.enc b/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/macRoman.enc new file mode 100644 index 0000000000000000000000000000000000000000..15de26623f32d554209ee8856c892e54161bcbe8 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/macRoman.enc @@ -0,0 +1,20 @@ +# Encoding file: macRoman, single-byte +S +003F 0 1 +00 +0000000100020003000400050006000700080009000A000B000C000D000E000F +0010001100120013001400150016001700180019001A001B001C001D001E001F +0020002100220023002400250026002700280029002A002B002C002D002E002F +0030003100320033003400350036003700380039003A003B003C003D003E003F +0040004100420043004400450046004700480049004A004B004C004D004E004F +0050005100520053005400550056005700580059005A005B005C005D005E005F +0060006100620063006400650066006700680069006A006B006C006D006E006F +0070007100720073007400750076007700780079007A007B007C007D007E007F +00C400C500C700C900D100D600DC00E100E000E200E400E300E500E700E900E8 +00EA00EB00ED00EC00EE00EF00F100F300F200F400F600F500FA00F900FB00FC +202000B000A200A300A7202200B600DF00AE00A9212200B400A8226000C600D8 +221E00B12264226500A500B522022211220F03C0222B00AA00BA03A900E600F8 +00BF00A100AC221A01922248220600AB00BB202600A000C000C300D501520153 +20132014201C201D2018201900F725CA00FF0178204420AC2039203AFB01FB02 +202100B7201A201E203000C200CA00C100CB00C800CD00CE00CF00CC00D300D4 +F8FF00D200DA00DB00D9013102C602DC00AF02D802D902DA00B802DD02DB02C7 diff --git a/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/macRomania.enc b/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/macRomania.enc new file mode 100644 index 0000000000000000000000000000000000000000..ce41cf427f257dfaa63c6d577c17d28f6563758f --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/macRomania.enc @@ -0,0 +1,20 @@ +# Encoding file: macRomania, single-byte +S +003F 0 1 +00 +0000000100020003000400050006000700080009000A000B000C000D000E000F +0010001100120013001400150016001700180019001A001B001C001D001E001F +0020002100220023002400250026002700280029002A002B002C002D002E002F +0030003100320033003400350036003700380039003A003B003C003D003E003F +0040004100420043004400450046004700480049004A004B004C004D004E004F +0050005100520053005400550056005700580059005A005B005C005D005E005F +0060006100620063006400650066006700680069006A006B006C006D006E006F +0070007100720073007400750076007700780079007A007B007C007D007E007F +00C400C500C700C900D100D600DC00E100E000E200E400E300E500E700E900E8 +00EA00EB00ED00EC00EE00EF00F100F300F200F400F600F500FA00F900FB00FC +202000B000A200A300A7202200B600DF00AE00A9212200B400A822600102015E +221E00B12264226500A500B522022211220F03C0222B00AA00BA21260103015F +00BF00A100AC221A01922248220600AB00BB202600A000C000C300D501520153 +20132014201C201D2018201900F725CA00FF0178204400A42039203A01620163 +202100B7201A201E203000C200CA00C100CB00C800CD00CE00CF00CC00D300D4 +F8FF00D200DA00DB00D9013102C602DC00AF02D802D902DA00B802DD02DB02C7 diff --git a/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/macThai.enc b/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/macThai.enc new file mode 100644 index 0000000000000000000000000000000000000000..7d9c8ad4a2b3afec156a5696dc0245d330d745b1 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/macThai.enc @@ -0,0 +1,20 @@ +# Encoding file: macThai, single-byte +S +003F 0 1 +00 +0000000100020003000400050006000700080009000A000B000C000D000E000F +0010001100120013001400150016001700180019001A001B001C001D001E001F +0020002100220023002400250026002700280029002A002B002C002D002E002F +0030003100320033003400350036003700380039003A003B003C003D003E003F +0040004100420043004400450046004700480049004A004B004C004D004E004F +0050005100520053005400550056005700580059005A005B005C005D005E005F +0060006100620063006400650066006700680069006A006B006C006D006E006F +0070007100720073007400750076007700780079007A007B007C007D007E007F +00AB00BB2026F88CF88FF892F895F898F88BF88EF891F894F897201C201DF899 +FFFD2022F884F889F885F886F887F888F88AF88DF890F893F89620182019FFFD +00A00E010E020E030E040E050E060E070E080E090E0A0E0B0E0C0E0D0E0E0E0F +0E100E110E120E130E140E150E160E170E180E190E1A0E1B0E1C0E1D0E1E0E1F +0E200E210E220E230E240E250E260E270E280E290E2A0E2B0E2C0E2D0E2E0E2F +0E300E310E320E330E340E350E360E370E380E390E3AFEFF200B201320140E3F +0E400E410E420E430E440E450E460E470E480E490E4A0E4B0E4C0E4D21220E4F +0E500E510E520E530E540E550E560E570E580E5900AE00A9FFFDFFFDFFFDFFFD diff --git a/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/macTurkish.enc b/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/macTurkish.enc new file mode 100644 index 0000000000000000000000000000000000000000..f9542ae5c8583e95286acc1fac0fc4323a7378ac --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/macTurkish.enc @@ -0,0 +1,20 @@ +# Encoding file: macTurkish, single-byte +S +003F 0 1 +00 +0000000100020003000400050006000700080009000A000B000C000D000E000F +0010001100120013001400150016001700180019001A001B001C001D001E001F +0020002100220023002400250026002700280029002A002B002C002D002E002F +0030003100320033003400350036003700380039003A003B003C003D003E003F +0040004100420043004400450046004700480049004A004B004C004D004E004F +0050005100520053005400550056005700580059005A005B005C005D005E005F +0060006100620063006400650066006700680069006A006B006C006D006E006F +0070007100720073007400750076007700780079007A007B007C007D007E007F +00C400C500C700C900D100D600DC00E100E000E200E400E300E500E700E900E8 +00EA00EB00ED00EC00EE00EF00F100F300F200F400F600F500FA00F900FB00FC +202000B000A200A300A7202200B600DF00AE00A9212200B400A8226000C600D8 +221E00B12264226500A500B522022211220F03C0222B00AA00BA03A900E600F8 +00BF00A100AC221A01922248220600AB00BB202600A000C000C300D501520153 +20132014201C201D2018201900F725CA00FF0178011E011F01300131015E015F +202100B7201A201E203000C200CA00C100CB00C800CD00CE00CF00CC00D300D4 +F8FF00D200DA00DB00D9F8A002C602DC00AF02D802D902DA00B802DD02DB02C7 diff --git a/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/macUkraine.enc b/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/macUkraine.enc new file mode 100644 index 0000000000000000000000000000000000000000..643cc45e9efb143293c7e054acdf959508d19a7b --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/macUkraine.enc @@ -0,0 +1,20 @@ +# Encoding file: macUkraine, single-byte +S +003F 0 1 +00 +0000000100020003000400050006000700080009000A000B000C000D000E000F +0010001100120013001400150016001700180019001A001B001C001D001E001F +0020002100220023002400250026002700280029002A002B002C002D002E002F +0030003100320033003400350036003700380039003A003B003C003D003E003F +0040004100420043004400450046004700480049004A004B004C004D004E004F +0050005100520053005400550056005700580059005A005B005C005D005E005F +0060006100620063006400650066006700680069006A006B006C006D006E006F +0070007100720073007400750076007700780079007A007B007C007D007E007F +0410041104120413041404150416041704180419041A041B041C041D041E041F +0420042104220423042404250426042704280429042A042B042C042D042E042F +202000B0049000A300A7202200B6040600AE00A9212204020452226004030453 +221E00B122642265045600B504910408040404540407045704090459040A045A +0458040500AC221A01922248220600AB00BB202600A0040B045B040C045C0455 +20132014201C201D2018201900F7201E040E045E040F045F211604010451044F +0430043104320433043404350436043704380439043A043B043C043D043E043F +0440044104420443044404450446044704480449044A044B044C044D044E00A4 diff --git a/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/shiftjis.enc b/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/shiftjis.enc new file mode 100644 index 0000000000000000000000000000000000000000..140aec4c15169a946ae9f4d8d133c930e417e804 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/shiftjis.enc @@ -0,0 +1,690 @@ +# Encoding file: shiftjis, multi-byte +M +003F 0 40 +00 +0000000100020003000400050006000700080009000A000B000C000D000E000F +0010001100120013001400150016001700180019001A001B001C001D001E001F +0020002100220023002400250026002700280029002A002B002C002D002E002F +0030003100320033003400350036003700380039003A003B003C003D003E003F +0040004100420043004400450046004700480049004A004B004C004D004E004F +0050005100520053005400550056005700580059005A005B005C005D005E005F +0060006100620063006400650066006700680069006A006B006C006D006E006F +0070007100720073007400750076007700780079007A007B007C007D007E007F +0080000000000000000000850086008700000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000FF61FF62FF63FF64FF65FF66FF67FF68FF69FF6AFF6BFF6CFF6DFF6EFF6F +FF70FF71FF72FF73FF74FF75FF76FF77FF78FF79FF7AFF7BFF7CFF7DFF7EFF7F +FF80FF81FF82FF83FF84FF85FF86FF87FF88FF89FF8AFF8BFF8CFF8DFF8EFF8F +FF90FF91FF92FF93FF94FF95FF96FF97FF98FF99FF9AFF9BFF9CFF9DFF9EFF9F +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +81 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +300030013002FF0CFF0E30FBFF1AFF1BFF1FFF01309B309C00B4FF4000A8FF3E +FFE3FF3F30FD30FE309D309E30034EDD30053006300730FC20152010FF0FFF3C +301C2016FF5C2026202520182019201C201DFF08FF0930143015FF3BFF3DFF5B +FF5D30083009300A300B300C300D300E300F30103011FF0B221200B100D70000 +00F7FF1D2260FF1CFF1E22662267221E22342642264000B0203220332103FFE5 +FF0400A200A3FF05FF03FF06FF0AFF2000A72606260525CB25CF25CE25C725C6 +25A125A025B325B225BD25BC203B301221922190219121933013000000000000 +000000000000000000000000000000002208220B2286228722822283222A2229 +000000000000000000000000000000002227222800AC21D221D4220022030000 +0000000000000000000000000000000000000000222022A52312220222072261 +2252226A226B221A223D221D2235222B222C0000000000000000000000000000 +212B2030266F266D266A2020202100B6000000000000000025EF000000000000 +82 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000FF10 +FF11FF12FF13FF14FF15FF16FF17FF18FF190000000000000000000000000000 +FF21FF22FF23FF24FF25FF26FF27FF28FF29FF2AFF2BFF2CFF2DFF2EFF2FFF30 +FF31FF32FF33FF34FF35FF36FF37FF38FF39FF3A000000000000000000000000 +0000FF41FF42FF43FF44FF45FF46FF47FF48FF49FF4AFF4BFF4CFF4DFF4EFF4F +FF50FF51FF52FF53FF54FF55FF56FF57FF58FF59FF5A00000000000000003041 +30423043304430453046304730483049304A304B304C304D304E304F30503051 +30523053305430553056305730583059305A305B305C305D305E305F30603061 +30623063306430653066306730683069306A306B306C306D306E306F30703071 +30723073307430753076307730783079307A307B307C307D307E307F30803081 +30823083308430853086308730883089308A308B308C308D308E308F30903091 +3092309300000000000000000000000000000000000000000000000000000000 +83 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +30A130A230A330A430A530A630A730A830A930AA30AB30AC30AD30AE30AF30B0 +30B130B230B330B430B530B630B730B830B930BA30BB30BC30BD30BE30BF30C0 +30C130C230C330C430C530C630C730C830C930CA30CB30CC30CD30CE30CF30D0 +30D130D230D330D430D530D630D730D830D930DA30DB30DC30DD30DE30DF0000 +30E030E130E230E330E430E530E630E730E830E930EA30EB30EC30ED30EE30EF +30F030F130F230F330F430F530F6000000000000000000000000000000000391 +03920393039403950396039703980399039A039B039C039D039E039F03A003A1 +03A303A403A503A603A703A803A90000000000000000000000000000000003B1 +03B203B303B403B503B603B703B803B903BA03BB03BC03BD03BE03BF03C003C1 +03C303C403C503C603C703C803C9000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +84 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +04100411041204130414041504010416041704180419041A041B041C041D041E +041F0420042104220423042404250426042704280429042A042B042C042D042E +042F000000000000000000000000000000000000000000000000000000000000 +04300431043204330434043504510436043704380439043A043B043C043D0000 +043E043F0440044104420443044404450446044704480449044A044B044C044D +044E044F00000000000000000000000000000000000000000000000000002500 +2502250C251025182514251C252C25242534253C25012503250F2513251B2517 +25232533252B253B254B2520252F25282537253F251D25302525253825420000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +88 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000004E9C +55165A03963F54C0611B632859F690228475831C7A5060AA63E16E2565ED8466 +82A69BF56893572765A162715B9B59D0867B98F47D627DBE9B8E62167C9F88B7 +5B895EB563096697684895C7978D674F4EE54F0A4F4D4F9D504956F2593759D4 +5A015C0960DF610F61706613690570BA754F757079FB7DAD7DEF80C3840E8863 +8B029055907A533B4E954EA557DF80B290C178EF4E0058F16EA290387A328328 +828B9C2F5141537054BD54E156E059FB5F1598F26DEB80E4852D000000000000 +89 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +9662967096A097FB540B53F35B8770CF7FBD8FC296E8536F9D5C7ABA4E117893 +81FC6E26561855046B1D851A9C3B59E553A96D6674DC958F56424E91904B96F2 +834F990C53E155B65B305F71662066F368046C386CF36D29745B76C87A4E9834 +82F1885B8A6092ED6DB275AB76CA99C560A68B018D8A95B2698E53AD51860000 +5712583059445BB45EF6602863A963F46CBF6F14708E7114715971D5733F7E01 +827682D185979060925B9D1B586965BC6C5A752551F9592E59655F805FDC62BC +65FA6A2A6B276BB4738B7FC189569D2C9D0E9EC45CA16C96837B51045C4B61B6 +81C6687672614E594FFA537860696E297A4F97F34E0B53164EEE4F554F3D4FA1 +4F7352A053EF5609590F5AC15BB65BE179D16687679C67B66B4C6CB3706B73C2 +798D79BE7A3C7B8782B182DB8304837783EF83D387668AB256298CA88FE6904E +971E868A4FC45CE862117259753B81E582BD86FE8CC096C5991399D54ECB4F1A +89E356DE584A58CA5EFB5FEB602A6094606261D0621262D06539000000000000 +8A +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +9B41666668B06D777070754C76867D7582A587F9958B968E8C9D51F152BE5916 +54B35BB35D16616869826DAF788D84CB88578A7293A79AB86D6C99A886D957A3 +67FF86CE920E5283568754045ED362E164B9683C68386BBB737278BA7A6B899A +89D28D6B8F0390ED95A3969497695B665CB3697D984D984E639B7B206A2B0000 +6A7F68B69C0D6F5F5272559D607062EC6D3B6E076ED1845B89108F444E149C39 +53F6691B6A3A9784682A515C7AC384B291DC938C565B9D286822830584317CA5 +520882C574E64E7E4F8351A05BD2520A52D852E75DFB559A582A59E65B8C5B98 +5BDB5E725E7960A3611F616361BE63DB656267D1685368FA6B3E6B536C576F22 +6F976F4574B0751876E3770B7AFF7BA17C217DE97F367FF0809D8266839E89B3 +8ACC8CAB908494519593959195A2966597D3992882184E38542B5CB85DCC73A9 +764C773C5CA97FEB8D0B96C19811985498584F014F0E5371559C566857FA5947 +5B095BC45C905E0C5E7E5FCC63EE673A65D765E2671F68CB68C4000000000000 +8B +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +6A5F5E306BC56C176C7D757F79485B637A007D005FBD898F8A188CB48D778ECC +8F1D98E29A0E9B3C4E80507D510059935B9C622F628064EC6B3A72A075917947 +7FA987FB8ABC8B7063AC83CA97A05409540355AB68546A588A70782767759ECD +53745BA2811A865090064E184E454EC74F1153CA54385BAE5F13602565510000 +673D6C426C726CE3707874037A767AAE7B087D1A7CFE7D6665E7725B53BB5C45 +5DE862D262E063196E20865A8A318DDD92F86F0179A69B5A4EA84EAB4EAC4F9B +4FA050D151477AF6517151F653545321537F53EB55AC58835CE15F375F4A602F +6050606D631F65596A4B6CC172C272ED77EF80F881058208854E90F793E197FF +99579A5A4EF051DD5C2D6681696D5C4066F26975738968507C8150C552E45747 +5DFE932665A46B236B3D7434798179BD7B4B7DCA82B983CC887F895F8B398FD1 +91D1541F92804E5D503653E5533A72D7739677E982E68EAF99C699C899D25177 +611A865E55B07A7A50765BD3904796854E326ADB91E75C515C48000000000000 +8C +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +63987A9F6C9397748F617AAA718A96887C8268177E706851936C52F2541B85AB +8A137FA48ECD90E15366888879414FC250BE521151445553572D73EA578B5951 +5F625F8460756176616761A963B2643A656C666F68426E1375667A3D7CFB7D4C +7D997E4B7F6B830E834A86CD8A088A638B668EFD981A9D8F82B88FCE9BE80000 +5287621F64836FC09699684150916B206C7A6F547A747D5088408A2367084EF6 +503950265065517C5238526355A7570F58055ACC5EFA61B261F862F36372691C +6A29727D72AC732E7814786F7D79770C80A9898B8B198CE28ED290639375967A +98559A139E785143539F53B35E7B5F266E1B6E90738473FE7D4382378A008AFA +96504E4E500B53E4547C56FA59D15B645DF15EAB5F276238654567AF6E5672D0 +7CCA88B480A180E183F0864E8A878DE8923796C798679F134E944E924F0D5348 +5449543E5A2F5F8C5FA1609F68A76A8E745A78818A9E8AA48B7791904E5E9BC9 +4EA44F7C4FAF501950165149516C529F52B952FE539A53E35411000000000000 +8D +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +540E5589575157A2597D5B545B5D5B8F5DE55DE75DF75E785E835E9A5EB75F18 +6052614C629762D863A7653B6602664366F4676D6821689769CB6C5F6D2A6D69 +6E2F6E9D75327687786C7A3F7CE07D057D187D5E7DB18015800380AF80B18154 +818F822A8352884C88618B1B8CA28CFC90CA91759271783F92FC95A4964D0000 +980599999AD89D3B525B52AB53F7540858D562F76FE08C6A8F5F9EB9514B523B +544A56FD7A4091779D609ED273446F09817075115FFD60DA9AA872DB8FBC6B64 +98034ECA56F0576458BE5A5A606861C7660F6606683968B16DF775D57D3A826E +9B424E9B4F5053C955065D6F5DE65DEE67FB6C99747378028A50939688DF5750 +5EA7632B50B550AC518D670054C9585E59BB5BB05F69624D63A1683D6B736E08 +707D91C7728078157826796D658E7D3083DC88C18F09969B5264572867507F6A +8CA151B45742962A583A698A80B454B25D0E57FC78959DFA4F5C524A548B643E +6628671467F57A847B567D22932F685C9BAD7B395319518A5237000000000000 +8E +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +5BDF62F664AE64E6672D6BBA85A996D176909BD6634C93069BAB76BF66524E09 +509853C25C7160E864926563685F71E673CA75237B977E8286958B838CDB9178 +991065AC66AB6B8B4ED54ED44F3A4F7F523A53F853F255E356DB58EB59CB59C9 +59FF5B505C4D5E025E2B5FD7601D6307652F5B5C65AF65BD65E8679D6B620000 +6B7B6C0F7345794979C17CF87D197D2B80A2810281F389968A5E8A698A668A8C +8AEE8CC78CDC96CC98FC6B6F4E8B4F3C4F8D51505B575BFA6148630166426B21 +6ECB6CBB723E74BD75D478C1793A800C803381EA84948F9E6C509E7F5F0F8B58 +9D2B7AFA8EF85B8D96EB4E0353F157F759315AC95BA460896E7F6F0675BE8CEA +5B9F85007BE0507267F4829D5C61854A7E1E820E51995C0463688D66659C716E +793E7D1780058B1D8ECA906E86C790AA501F52FA5C3A6753707C7235914C91C8 +932B82E55BC25F3160F94E3B53D65B88624B67316B8A72E973E07A2E816B8DA3 +91529996511253D7546A5BFF63886A397DAC970056DA53CE5468000000000000 +8F +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +5B975C315DDE4FEE610162FE6D3279C079CB7D427E4D7FD281ED821F84908846 +89728B908E748F2F9031914B916C96C6919C4EC04F4F514553415F93620E67D4 +6C416E0B73637E2691CD928353D459195BBF6DD1795D7E2E7C9B587E719F51FA +88538FF04FCA5CFB662577AC7AE3821C99FF51C65FAA65EC696F6B896DF30000 +6E966F6476FE7D145DE190759187980651E6521D6240669166D96E1A5EB67DD2 +7F7266F885AF85F78AF852A953D959735E8F5F90605592E4966450B7511F52DD +5320534753EC54E8554655315617596859BE5A3C5BB55C065C0F5C115C1A5E84 +5E8A5EE05F70627F628462DB638C63776607660C662D6676677E68A26A1F6A35 +6CBC6D886E096E58713C7126716775C77701785D7901796579F07AE07B117CA7 +7D39809683D6848B8549885D88F38A1F8A3C8A548A738C618CDE91A49266937E +9418969C97984E0A4E084E1E4E575197527057CE583458CC5B225E3860C564FE +676167566D4472B675737A6384B88B7291B89320563157F498FE000000000000 +90 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +62ED690D6B9671ED7E548077827289E698DF87558FB15C3B4F384FE14FB55507 +5A205BDD5BE95FC3614E632F65B0664B68EE699B6D786DF1753375B9771F795E +79E67D3381E382AF85AA89AA8A3A8EAB8F9B903291DD97074EBA4EC152035875 +58EC5C0B751A5C3D814E8A0A8FC59663976D7B258ACF9808916256F353A80000 +9017543957825E2563A86C34708A77617C8B7FE088709042915493109318968F +745E9AC45D075D69657067A28DA896DB636E6749691983C5981796C088FE6F84 +647A5BF84E16702C755D662F51C4523652E259D35F8160276210653F6574661F +667468F268166B636E057272751F76DB7CBE805658F088FD897F8AA08A938ACB +901D91929752975965897A0E810696BB5E2D60DC621A65A56614679077F37A4D +7C4D7E3E810A8CAC8D648DE18E5F78A9520762D963A5644262988A2D7A837BC0 +8AAC96EA7D76820C87494ED95148534353605BA35C025C165DDD6226624764B0 +681368346CC96D456D1767D36F5C714E717D65CB7A7F7BAD7DDA000000000000 +91 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +7E4A7FA8817A821B823985A68A6E8CCE8DF59078907792AD929195839BAE524D +55846F387136516879857E5581B37CCE564C58515CA863AA66FE66FD695A72D9 +758F758E790E795679DF7C977D207D4486078A34963B90619F2050E7527553CC +53E2500955AA58EE594F723D5B8B5C64531D60E360F3635C6383633F63BB0000 +64CD65E966F95DE369CD69FD6F1571E54E8975E976F87A937CDF7DCF7D9C8061 +83498358846C84BC85FB88C58D709001906D9397971C9A1250CF5897618E81D3 +85358D0890204FC3507452475373606F6349675F6E2C8DB3901F4FD75C5E8CCA +65CF7D9A53528896517663C35B585B6B5C0A640D6751905C4ED6591A592A6C70 +8A51553E581559A560F0625367C182356955964099C49A284F5358065BFE8010 +5CB15E2F5F856020614B623466FF6CF06EDE80CE817F82D4888B8CB89000902E +968A9EDB9BDB4EE353F059277B2C918D984C9DF96EDD7027535355445B856258 +629E62D36CA26FEF74228A1794386FC18AFE833851E786F853EA000000000000 +92 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +53E94F4690548FB0596A81315DFD7AEA8FBF68DA8C3772F89C486A3D8AB04E39 +53585606576662C563A265E66B4E6DE16E5B70AD77ED7AEF7BAA7DBB803D80C6 +86CB8A95935B56E358C75F3E65AD66966A806BB575378AC7502477E557305F1B +6065667A6C6075F47A1A7F6E81F48718904599B37BC9755C7AF97B5184C40000 +901079E97A9283365AE177404E2D4EF25B995FE062BD663C67F16CE8866B8877 +8A3B914E92F399D06A177026732A82E784578CAF4E01514651CB558B5BF55E16 +5E335E815F145F355F6B5FB461F2631166A2671D6F6E7252753A773A80748139 +817887768ABF8ADC8D858DF3929A957798029CE552C5635776F467156C8873CD +8CC393AE96736D25589C690E69CC8FFD939A75DB901A585A680263B469FB4F43 +6F2C67D88FBB85267DB49354693F6F70576A58F75B2C7D2C722A540A91E39DB4 +4EAD4F4E505C507552438C9E544858245B9A5E1D5E955EAD5EF75F1F608C62B5 +633A63D068AF6C407887798E7A0B7DE082478A028AE68E449013000000000000 +93 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +90B8912D91D89F0E6CE5645864E265756EF476847B1B906993D16EBA54F25FB9 +64A48F4D8FED92445178586B59295C555E976DFB7E8F751C8CBC8EE2985B70B9 +4F1D6BBF6FB1753096FB514E54105835585759AC5C605F926597675C6E21767B +83DF8CED901490FD934D7825783A52AA5EA6571F597460125012515A51AC0000 +51CD520055105854585859575B955CF65D8B60BC6295642D6771684368BC68DF +76D76DD86E6F6D9B706F71C85F5375D879777B497B547B527CD67D7152308463 +856985E48A0E8B048C468E0F9003900F94199676982D9A3095D850CD52D5540C +58025C0E61A7649E6D1E77B37AE580F48404905392855CE09D07533F5F975FB3 +6D9C7279776379BF7BE46BD272EC8AAD68036A6151F87A8169345C4A9CF682EB +5BC59149701E56785C6F60C765666C8C8C5A90419813545166C7920D594890A3 +51854E4D51EA85998B0E7058637A934B696299B47E047577535769608EDF96E3 +6C5D4E8C5C3C5F108FE953028CD1808986795EFF65E54E735165000000000000 +94 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +59825C3F97EE4EFB598A5FCD8A8D6FE179B079625BE78471732B71B15E745FF5 +637B649A71C37C984E435EFC4E4B57DC56A260A96FC37D0D80FD813381BF8FB2 +899786A45DF4628A64AD898767776CE26D3E743678345A467F7582AD99AC4FF3 +5EC362DD63926557676F76C3724C80CC80BA8F29914D500D57F95A9268850000 +6973716472FD8CB758F28CE0966A9019877F79E477E784294F2F5265535A62CD +67CF6CCA767D7B947C95823685848FEB66DD6F2072067E1B83AB99C19EA651FD +7BB178727BB880877B486AE85E61808C75517560516B92626E8C767A91979AEA +4F107F70629C7B4F95A59CE9567A585986E496BC4F345224534A53CD53DB5E06 +642C6591677F6C3E6C4E724872AF73ED75547E41822C85E98CA97BC491C67169 +981298EF633D6669756A76E478D0854386EE532A5351542659835E875F7C60B2 +6249627962AB65906BD46CCC75B276AE789179D87DCB7F7780A588AB8AB98CBB +907F975E98DB6A0B7C3850995C3E5FAE67876BD8743577097F8E000000000000 +95 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +9F3B67CA7A175339758B9AED5F66819D83F180985F3C5FC575627B46903C6867 +59EB5A9B7D10767E8B2C4FF55F6A6A196C376F0274E2796888688A558C795EDF +63CF75C579D282D7932892F2849C86ED9C2D54C15F6C658C6D5C70158CA78CD3 +983B654F74F64E0D4ED857E0592B5A665BCC51A85E035E9C6016627665770000 +65A7666E6D6E72367B268150819A82998B5C8CA08CE68D74961C96444FAE64AB +6B66821E8461856A90E85C01695398A8847A85574F0F526F5FA95E45670D798F +8179890789866DF55F1762556CB84ECF72699B925206543B567458B361A4626E +711A596E7C897CDE7D1B96F06587805E4E194F75517558405E635E735F0A67C4 +4E26853D9589965B7C73980150FB58C1765678A7522577A585117B86504F5909 +72477BC77DE88FBA8FD4904D4FBF52C95A295F0197AD4FDD821792EA57036355 +6B69752B88DC8F147A4252DF58936155620A66AE6BCD7C3F83E950234FF85305 +5446583159495B9D5CF05CEF5D295E9662B16367653E65B9670B000000000000 +96 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +6CD56CE170F978327E2B80DE82B3840C84EC870289128A2A8C4A90A692D298FD +9CF39D6C4E4F4EA1508D5256574A59A85E3D5FD85FD9623F66B4671B67D068D2 +51927D2180AA81A88B008C8C8CBF927E96325420982C531750D5535C58A864B2 +6734726777667A4691E652C36CA16B8658005E4C5954672C7FFB51E176C60000 +646978E89B549EBB57CB59B96627679A6BCE54E969D95E55819C67959BAA67FE +9C52685D4EA64FE353C862B9672B6CAB8FC44FAD7E6D9EBF4E0761626E806F2B +85135473672A9B455DF37B955CAC5BC6871C6E4A84D17A14810859997C8D6C11 +772052D959227121725F77DB97279D61690B5A7F5A1851A5540D547D660E76DF +8FF792989CF459EA725D6EC5514D68C97DBF7DEC97629EBA64786A2183025984 +5B5F6BDB731B76F27DB280178499513267289ED976EE676252FF99055C24623B +7C7E8CB0554F60B67D0B958053014E5F51B6591C723A803691CE5F2577E25384 +5F797D0485AC8A338E8D975667F385AE9453610961086CB9765200000000FF5E +97 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +8AED8F38552F4F51512A52C753CB5BA55E7D60A0618263D6670967DA6E676D8C +733673377531795088D58A98904A909190F596C4878D59154E884F594E0E8A89 +8F3F981050AD5E7C59965BB95EB863DA63FA64C166DC694A69D86D0B6EB67194 +75287AAF7F8A8000844984C989818B218E0A9065967D990A617E62916B320000 +6C836D747FCC7FFC6DC07F8587BA88F8676583B1983C96F76D1B7D61843D916A +4E7153755D506B046FEB85CD862D89A75229540F5C65674E68A87406748375E2 +88CF88E191CC96E296785F8B73877ACB844E63A0756552896D416E9C74097559 +786B7C9296867ADC9F8D4FB6616E65C5865C4E864EAE50DA4E2151CC5BEE6599 +68816DBC731F764277AD7A1C7CE7826F8AD2907C91CF96759818529B7DD1502B +539867976DCB71D0743381E88F2A96A39C579E9F746058416D997D2F985E4EE4 +4F364F8B51B752B15DBA601C73B2793C82D3923496B796F6970A9E979F6266A6 +6B74521752A370C888C25EC9604B61906F2371497C3E7DF4806F000000000000 +98 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +84EE9023932C54429B6F6AD370898CC28DEF973252B45A415ECA5F046717697C +69946D6A6F0F726272FC7BED8001807E874B90CE516D9E937984808B93328AD6 +502D548C8A716B6A8CC4810760D167A09DF24E994E989C108A6B85C185686900 +6E7E789781550000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000005F0C +4E104E154E2A4E314E364E3C4E3F4E424E564E584E824E858C6B4E8A82125F0D +4E8E4E9E4E9F4EA04EA24EB04EB34EB64ECE4ECD4EC44EC64EC24ED74EDE4EED +4EDF4EF74F094F5A4F304F5B4F5D4F574F474F764F884F8F4F984F7B4F694F70 +4F914F6F4F864F9651184FD44FDF4FCE4FD84FDB4FD14FDA4FD04FE44FE5501A +50285014502A502550054F1C4FF650215029502C4FFE4FEF5011500650435047 +6703505550505048505A5056506C50785080509A508550B450B2000000000000 +99 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +50C950CA50B350C250D650DE50E550ED50E350EE50F950F55109510151025116 +51155114511A5121513A5137513C513B513F51405152514C515451627AF85169 +516A516E5180518256D8518C5189518F519151935195519651A451A651A251A9 +51AA51AB51B351B151B251B051B551BD51C551C951DB51E0865551E951ED0000 +51F051F551FE5204520B5214520E5227522A522E52335239524F5244524B524C +525E5254526A527452695273527F527D528D529452925271528852918FA88FA7 +52AC52AD52BC52B552C152CD52D752DE52E352E698ED52E052F352F552F852F9 +530653087538530D5310530F5315531A5323532F533153335338534053465345 +4E175349534D51D6535E5369536E5918537B53775382539653A053A653A553AE +53B053B653C37C1296D953DF66FC71EE53EE53E853ED53FA5401543D5440542C +542D543C542E54365429541D544E548F5475548E545F5471547754705492547B +5480547654845490548654C754A254B854A554AC54C454C854A8000000000000 +9A +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +54AB54C254A454BE54BC54D854E554E6550F551454FD54EE54ED54FA54E25539 +55405563554C552E555C55455556555755385533555D5599558054AF558A559F +557B557E5598559E55AE557C558355A9558755A855DA55C555DF55C455DC55E4 +55D4561455F7561655FE55FD561B55F9564E565071DF56345636563256380000 +566B5664562F566C566A56865680568A56A05694568F56A556AE56B656B456C2 +56BC56C156C356C056C856CE56D156D356D756EE56F9570056FF570457095708 +570B570D57135718571655C7571C572657375738574E573B5740574F576957C0 +57885761577F5789579357A057B357A457AA57B057C357C657D457D257D3580A +57D657E3580B5819581D587258215862584B58706BC05852583D5879588558B9 +589F58AB58BA58DE58BB58B858AE58C558D358D158D758D958D858E558DC58E4 +58DF58EF58FA58F958FB58FC58FD5902590A5910591B68A65925592C592D5932 +5938593E7AD259555950594E595A5958596259605967596C5969000000000000 +9B +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +59785981599D4F5E4FAB59A359B259C659E859DC598D59D959DA5A255A1F5A11 +5A1C5A095A1A5A405A6C5A495A355A365A625A6A5A9A5ABC5ABE5ACB5AC25ABD +5AE35AD75AE65AE95AD65AFA5AFB5B0C5B0B5B165B325AD05B2A5B365B3E5B43 +5B455B405B515B555B5A5B5B5B655B695B705B735B755B7865885B7A5B800000 +5B835BA65BB85BC35BC75BC95BD45BD05BE45BE65BE25BDE5BE55BEB5BF05BF6 +5BF35C055C075C085C0D5C135C205C225C285C385C395C415C465C4E5C535C50 +5C4F5B715C6C5C6E4E625C765C795C8C5C915C94599B5CAB5CBB5CB65CBC5CB7 +5CC55CBE5CC75CD95CE95CFD5CFA5CED5D8C5CEA5D0B5D155D175D5C5D1F5D1B +5D115D145D225D1A5D195D185D4C5D525D4E5D4B5D6C5D735D765D875D845D82 +5DA25D9D5DAC5DAE5DBD5D905DB75DBC5DC95DCD5DD35DD25DD65DDB5DEB5DF2 +5DF55E0B5E1A5E195E115E1B5E365E375E445E435E405E4E5E575E545E5F5E62 +5E645E475E755E765E7A9EBC5E7F5EA05EC15EC25EC85ED05ECF000000000000 +9C +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +5ED65EE35EDD5EDA5EDB5EE25EE15EE85EE95EEC5EF15EF35EF05EF45EF85EFE +5F035F095F5D5F5C5F0B5F115F165F295F2D5F385F415F485F4C5F4E5F2F5F51 +5F565F575F595F615F6D5F735F775F835F825F7F5F8A5F885F915F875F9E5F99 +5F985FA05FA85FAD5FBC5FD65FFB5FE45FF85FF15FDD60B35FFF602160600000 +601960106029600E6031601B6015602B6026600F603A605A6041606A6077605F +604A6046604D6063604360646042606C606B60596081608D60E76083609A6084 +609B60966097609260A7608B60E160B860E060D360B45FF060BD60C660B560D8 +614D6115610660F660F7610060F460FA6103612160FB60F1610D610E6147613E +61286127614A613F613C612C6134613D614261446173617761586159615A616B +6174616F61656171615F615D6153617561996196618761AC6194619A618A6191 +61AB61AE61CC61CA61C961F761C861C361C661BA61CB7F7961CD61E661E361F6 +61FA61F461FF61FD61FC61FE620062086209620D620C6214621B000000000000 +9D +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +621E6221622A622E6230623262336241624E625E6263625B62606268627C6282 +6289627E62926293629662D46283629462D762D162BB62CF62FF62C664D462C8 +62DC62CC62CA62C262C7629B62C9630C62EE62F163276302630862EF62F56350 +633E634D641C634F6396638E638063AB637663A3638F6389639F63B5636B0000 +636963BE63E963C063C663E363C963D263F663C4641664346406641364266436 +651D64176428640F6467646F6476644E652A6495649364A564A9648864BC64DA +64D264C564C764BB64D864C264F164E7820964E064E162AC64E364EF652C64F6 +64F464F264FA650064FD6518651C650565246523652B65346535653765366538 +754B654865566555654D6558655E655D65726578658265838B8A659B659F65AB +65B765C365C665C165C465CC65D265DB65D965E065E165F16772660A660365FB +6773663566366634661C664F664466496641665E665D666466676668665F6662 +667066836688668E668966846698669D66C166B966C966BE66BC000000000000 +9E +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +66C466B866D666DA66E0663F66E666E966F066F566F7670F6716671E67266727 +9738672E673F67366741673867376746675E67606759676367646789677067A9 +677C676A678C678B67A667A1678567B767EF67B467EC67B367E967B867E467DE +67DD67E267EE67B967CE67C667E76A9C681E684668296840684D6832684E0000 +68B3682B685968636877687F689F688F68AD6894689D689B68836AAE68B96874 +68B568A068BA690F688D687E690168CA690868D86922692668E1690C68CD68D4 +68E768D569366912690468D768E3692568F968E068EF6928692A691A69236921 +68C669796977695C6978696B6954697E696E69396974693D695969306961695E +695D6981696A69B269AE69D069BF69C169D369BE69CE5BE869CA69DD69BB69C3 +69A76A2E699169A0699C699569B469DE69E86A026A1B69FF6B0A69F969F269E7 +6A0569B16A1E69ED6A1469EB6A0A6A126AC16A236A136A446A0C6A726A366A78 +6A476A626A596A666A486A386A226A906A8D6AA06A846AA26AA3000000000000 +9F +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +6A9786176ABB6AC36AC26AB86AB36AAC6ADE6AD16ADF6AAA6ADA6AEA6AFB6B05 +86166AFA6B126B169B316B1F6B386B3776DC6B3998EE6B476B436B496B506B59 +6B546B5B6B5F6B616B786B796B7F6B806B846B836B8D6B986B956B9E6BA46BAA +6BAB6BAF6BB26BB16BB36BB76BBC6BC66BCB6BD36BDF6BEC6BEB6BF36BEF0000 +9EBE6C086C136C146C1B6C246C236C5E6C556C626C6A6C826C8D6C9A6C816C9B +6C7E6C686C736C926C906CC46CF16CD36CBD6CD76CC56CDD6CAE6CB16CBE6CBA +6CDB6CEF6CD96CEA6D1F884D6D366D2B6D3D6D386D196D356D336D126D0C6D63 +6D936D646D5A6D796D596D8E6D956FE46D856DF96E156E0A6DB56DC76DE66DB8 +6DC66DEC6DDE6DCC6DE86DD26DC56DFA6DD96DE46DD56DEA6DEE6E2D6E6E6E2E +6E196E726E5F6E3E6E236E6B6E2B6E766E4D6E1F6E436E3A6E4E6E246EFF6E1D +6E386E826EAA6E986EC96EB76ED36EBD6EAF6EC46EB26ED46ED56E8F6EA56EC2 +6E9F6F416F11704C6EEC6EF86EFE6F3F6EF26F316EEF6F326ECC000000000000 +E0 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +6F3E6F136EF76F866F7A6F786F816F806F6F6F5B6FF36F6D6F826F7C6F586F8E +6F916FC26F666FB36FA36FA16FA46FB96FC66FAA6FDF6FD56FEC6FD46FD86FF1 +6FEE6FDB7009700B6FFA70117001700F6FFE701B701A6F74701D7018701F7030 +703E7032705170637099709270AF70F170AC70B870B370AE70DF70CB70DD0000 +70D9710970FD711C711971657155718871667162714C7156716C718F71FB7184 +719571A871AC71D771B971BE71D271C971D471CE71E071EC71E771F571FC71F9 +71FF720D7210721B7228722D722C72307232723B723C723F72407246724B7258 +7274727E7282728172877292729672A272A772B972B272C372C672C472CE72D2 +72E272E072E172F972F7500F7317730A731C7316731D7334732F73297325733E +734E734F9ED87357736A7368737073787375737B737A73C873B373CE73BB73C0 +73E573EE73DE74A27405746F742573F87432743A7455743F745F74597441745C +746974707463746A7476747E748B749E74A774CA74CF74D473F1000000000000 +E1 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +74E074E374E774E974EE74F274F074F174F874F7750475037505750C750E750D +75157513751E7526752C753C7544754D754A7549755B7546755A756975647567 +756B756D75787576758675877574758A758975827594759A759D75A575A375C2 +75B375C375B575BD75B875BC75B175CD75CA75D275D975E375DE75FE75FF0000 +75FC760175F075FA75F275F3760B760D7609761F762776207621762276247634 +7630763B764776487646765C76587661766276687669766A7667766C76707672 +76767678767C768076837688768B768E769676937699769A76B076B476B876B9 +76BA76C276CD76D676D276DE76E176E576E776EA862F76FB7708770777047729 +7724771E77257726771B773777387747775A7768776B775B7765777F777E7779 +778E778B779177A0779E77B077B677B977BF77BC77BD77BB77C777CD77D777DA +77DC77E377EE77FC780C781279267820792A7845788E78747886787C789A788C +78A378B578AA78AF78D178C678CB78D478BE78BC78C578CA78EC000000000000 +E2 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +78E778DA78FD78F47907791279117919792C792B794079607957795F795A7955 +7953797A797F798A799D79A79F4B79AA79AE79B379B979BA79C979D579E779EC +79E179E37A087A0D7A187A197A207A1F79807A317A3B7A3E7A377A437A577A49 +7A617A627A699F9D7A707A797A7D7A887A977A957A987A967AA97AC87AB00000 +7AB67AC57AC47ABF90837AC77ACA7ACD7ACF7AD57AD37AD97ADA7ADD7AE17AE2 +7AE67AED7AF07B027B0F7B0A7B067B337B187B197B1E7B357B287B367B507B7A +7B047B4D7B0B7B4C7B457B757B657B747B677B707B717B6C7B6E7B9D7B987B9F +7B8D7B9C7B9A7B8B7B927B8F7B5D7B997BCB7BC17BCC7BCF7BB47BC67BDD7BE9 +7C117C147BE67BE57C607C007C077C137BF37BF77C177C0D7BF67C237C277C2A +7C1F7C377C2B7C3D7C4C7C437C547C4F7C407C507C587C5F7C647C567C657C6C +7C757C837C907CA47CAD7CA27CAB7CA17CA87CB37CB27CB17CAE7CB97CBD7CC0 +7CC57CC27CD87CD27CDC7CE29B3B7CEF7CF27CF47CF67CFA7D06000000000000 +E3 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +7D027D1C7D157D0A7D457D4B7D2E7D327D3F7D357D467D737D567D4E7D727D68 +7D6E7D4F7D637D937D897D5B7D8F7D7D7D9B7DBA7DAE7DA37DB57DC77DBD7DAB +7E3D7DA27DAF7DDC7DB87D9F7DB07DD87DDD7DE47DDE7DFB7DF27DE17E057E0A +7E237E217E127E317E1F7E097E0B7E227E467E667E3B7E357E397E437E370000 +7E327E3A7E677E5D7E567E5E7E597E5A7E797E6A7E697E7C7E7B7E837DD57E7D +8FAE7E7F7E887E897E8C7E927E907E937E947E967E8E7E9B7E9C7F387F3A7F45 +7F4C7F4D7F4E7F507F517F557F547F587F5F7F607F687F697F677F787F827F86 +7F837F887F877F8C7F947F9E7F9D7F9A7FA37FAF7FB27FB97FAE7FB67FB88B71 +7FC57FC67FCA7FD57FD47FE17FE67FE97FF37FF998DC80068004800B80128018 +8019801C80218028803F803B804A804680528058805A805F8062806880738072 +807080768079807D807F808480868085809B8093809A80AD519080AC80DB80E5 +80D980DD80C480DA80D6810980EF80F1811B81298123812F814B000000000000 +E4 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +968B8146813E8153815180FC8171816E81658166817481838188818A81808182 +81A0819581A481A3815F819381A981B081B581BE81B881BD81C081C281BA81C9 +81CD81D181D981D881C881DA81DF81E081E781FA81FB81FE8201820282058207 +820A820D821082168229822B82388233824082598258825D825A825F82640000 +82628268826A826B822E827182778278827E828D829282AB829F82BB82AC82E1 +82E382DF82D282F482F382FA8393830382FB82F982DE830682DC830982D98335 +83348316833283318340833983508345832F832B831783188385839A83AA839F +83A283968323838E8387838A837C83B58373837583A0838983A883F4841383EB +83CE83FD840383D8840B83C183F7840783E083F2840D8422842083BD84388506 +83FB846D842A843C855A84848477846B84AD846E848284698446842C846F8479 +843584CA846284B984BF849F84D984CD84BB84DA84D084C184C684D684A18521 +84FF84F485178518852C851F8515851484FC8540856385588548000000000000 +E5 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +85418602854B8555858085A485888591858A85A8856D8594859B85EA8587859C +8577857E859085C985BA85CF85B985D085D585DD85E585DC85F9860A8613860B +85FE85FA86068622861A8630863F864D4E558654865F86678671869386A386A9 +86AA868B868C86B686AF86C486C686B086C9882386AB86D486DE86E986EC0000 +86DF86DB86EF8712870687088700870386FB87118709870D86F9870A8734873F +8737873B87258729871A8760875F8778874C874E877487578768876E87598753 +8763876A880587A2879F878287AF87CB87BD87C087D096D687AB87C487B387C7 +87C687BB87EF87F287E0880F880D87FE87F687F7880E87D28811881688158822 +88218831883688398827883B8844884288528859885E8862886B8881887E889E +8875887D88B5887288828897889288AE889988A2888D88A488B088BF88B188C3 +88C488D488D888D988DD88F9890288FC88F488E888F28904890C890A89138943 +891E8925892A892B89418944893B89368938894C891D8960895E000000000000 +E6 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +89668964896D896A896F89748977897E89838988898A8993899889A189A989A6 +89AC89AF89B289BA89BD89BF89C089DA89DC89DD89E789F489F88A038A168A10 +8A0C8A1B8A1D8A258A368A418A5B8A528A468A488A7C8A6D8A6C8A628A858A82 +8A848AA88AA18A918AA58AA68A9A8AA38AC48ACD8AC28ADA8AEB8AF38AE70000 +8AE48AF18B148AE08AE28AF78ADE8ADB8B0C8B078B1A8AE18B168B108B178B20 +8B3397AB8B268B2B8B3E8B288B418B4C8B4F8B4E8B498B568B5B8B5A8B6B8B5F +8B6C8B6F8B748B7D8B808B8C8B8E8B928B938B968B998B9A8C3A8C418C3F8C48 +8C4C8C4E8C508C558C628C6C8C788C7A8C828C898C858C8A8C8D8C8E8C948C7C +8C98621D8CAD8CAA8CBD8CB28CB38CAE8CB68CC88CC18CE48CE38CDA8CFD8CFA +8CFB8D048D058D0A8D078D0F8D0D8D109F4E8D138CCD8D148D168D678D6D8D71 +8D738D818D998DC28DBE8DBA8DCF8DDA8DD68DCC8DDB8DCB8DEA8DEB8DDF8DE3 +8DFC8E088E098DFF8E1D8E1E8E108E1F8E428E358E308E348E4A000000000000 +E7 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +8E478E498E4C8E508E488E598E648E608E2A8E638E558E768E728E7C8E818E87 +8E858E848E8B8E8A8E938E918E948E998EAA8EA18EAC8EB08EC68EB18EBE8EC5 +8EC88ECB8EDB8EE38EFC8EFB8EEB8EFE8F0A8F058F158F128F198F138F1C8F1F +8F1B8F0C8F268F338F3B8F398F458F428F3E8F4C8F498F468F4E8F578F5C0000 +8F628F638F648F9C8F9F8FA38FAD8FAF8FB78FDA8FE58FE28FEA8FEF90878FF4 +90058FF98FFA901190159021900D901E9016900B90279036903590398FF8904F +905090519052900E9049903E90569058905E9068906F907696A890729082907D +90819080908A9089908F90A890AF90B190B590E290E4624890DB910291129119 +91329130914A9156915891639165916991739172918B9189918291A291AB91AF +91AA91B591B491BA91C091C191C991CB91D091D691DF91E191DB91FC91F591F6 +921E91FF9214922C92159211925E925792459249926492489295923F924B9250 +929C92969293929B925A92CF92B992B792E9930F92FA9344932E000000000000 +E8 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +93199322931A9323933A9335933B935C9360937C936E935693B093AC93AD9394 +93B993D693D793E893E593D893C393DD93D093C893E4941A9414941394039407 +94109436942B94359421943A944194529444945B94609462945E946A92299470 +94759477947D945A947C947E9481947F95829587958A95949596959895990000 +95A095A895A795AD95BC95BB95B995BE95CA6FF695C395CD95CC95D595D495D6 +95DC95E195E595E296219628962E962F9642964C964F964B9677965C965E965D +965F96669672966C968D96989695969796AA96A796B196B296B096B496B696B8 +96B996CE96CB96C996CD894D96DC970D96D596F99704970697089713970E9711 +970F971697199724972A97309739973D973E97449746974897429749975C9760 +97649766976852D2976B977197799785977C9781977A9786978B978F9790979C +97A897A697A397B397B497C397C697C897CB97DC97ED9F4F97F27ADF97F697F5 +980F980C9838982498219837983D9846984F984B986B986F9870000000000000 +E9 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +98719874987398AA98AF98B198B698C498C398C698E998EB9903990999129914 +99189921991D991E99249920992C992E993D993E9942994999459950994B9951 +9952994C99559997999899A599AD99AE99BC99DF99DB99DD99D899D199ED99EE +99F199F299FB99F89A019A0F9A0599E29A199A2B9A379A459A429A409A430000 +9A3E9A559A4D9A5B9A579A5F9A629A659A649A699A6B9A6A9AAD9AB09ABC9AC0 +9ACF9AD19AD39AD49ADE9ADF9AE29AE39AE69AEF9AEB9AEE9AF49AF19AF79AFB +9B069B189B1A9B1F9B229B239B259B279B289B299B2A9B2E9B2F9B329B449B43 +9B4F9B4D9B4E9B519B589B749B939B839B919B969B979B9F9BA09BA89BB49BC0 +9BCA9BB99BC69BCF9BD19BD29BE39BE29BE49BD49BE19C3A9BF29BF19BF09C15 +9C149C099C139C0C9C069C089C129C0A9C049C2E9C1B9C259C249C219C309C47 +9C329C469C3E9C5A9C609C679C769C789CE79CEC9CF09D099D089CEB9D039D06 +9D2A9D269DAF9D239D1F9D449D159D129D419D3F9D3E9D469D48000000000000 +EA +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +9D5D9D5E9D649D519D509D599D729D899D879DAB9D6F9D7A9D9A9DA49DA99DB2 +9DC49DC19DBB9DB89DBA9DC69DCF9DC29DD99DD39DF89DE69DED9DEF9DFD9E1A +9E1B9E1E9E759E799E7D9E819E889E8B9E8C9E929E959E919E9D9EA59EA99EB8 +9EAA9EAD97619ECC9ECE9ECF9ED09ED49EDC9EDE9EDD9EE09EE59EE89EEF0000 +9EF49EF69EF79EF99EFB9EFC9EFD9F079F0876B79F159F219F2C9F3E9F4A9F52 +9F549F639F5F9F609F619F669F679F6C9F6A9F779F729F769F959F9C9FA0582F +69C79059746451DC719900000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +R +8160 301C FF5E +8161 2016 2225 +817C 2212 FF0D +8191 00A2 FFE0 +8192 00A3 FFE1 +81CA 00AC FFE2 diff --git a/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/symbol.enc b/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/symbol.enc new file mode 100644 index 0000000000000000000000000000000000000000..ffda9e3ee606693f3cbf84b10e418ad4fef2cd05 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/symbol.enc @@ -0,0 +1,20 @@ +# Encoding file: symbol, single-byte +S +003F 1 1 +00 +0000000100020003000400050006000700080009000A000B000C000D000E000F +0010001100120013001400150016001700180019001A001B001C001D001E001F +0020002122000023220300250026220D002800292217002B002C2212002E002F +0030003100320033003400350036003700380039003A003B003C003D003E003F +22450391039203A70394039503A603930397039903D1039A039B039C039D039F +03A0039803A103A303A403A503C203A9039E03A80396005B2234005D22A5005F +F8E503B103B203C703B403B503C603B303B703B903D503BA03BB03BC03BD03BF +03C003B803C103C303C403C503D603C903BE03C803B6007B007C007D223C007F +0080008100820083008400850086008700880089008A008B008C008D008E008F +0090009100920093009400950096009700980099009A009B009C009D009E009F +000003D2203222642044221E0192266326662665266021942190219121922193 +00B000B12033226500D7221D2202202200F72260226122482026F8E6F8E721B5 +21352111211C21182297229522052229222A2283228722842282228622082209 +2220220700AE00A92122220F221A22C500AC2227222821D421D021D121D221D3 +22C42329F8E8F8E9F8EA2211F8EBF8ECF8EDF8EEF8EFF8F0F8F1F8F2F8F3F8F4 +F8FF232A222B2320F8F52321F8F6F8F7F8F8F8F9F8FAF8FBF8FCF8FDF8FE0000 diff --git a/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/tis-620.enc b/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/tis-620.enc new file mode 100644 index 0000000000000000000000000000000000000000..2e9142a4b237a075154f8042eb9f45163007f19c --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/tcl8.6/encoding/tis-620.enc @@ -0,0 +1,20 @@ +# Encoding file: tis-620, single-byte +S +003F 0 1 +00 +0000000100020003000400050006000700080009000A000B000C000D000E000F +0010001100120013001400150016001700180019001A001B001C001D001E001F +0020002100220023002400250026002700280029002A002B002C002D002E002F +0030003100320033003400350036003700380039003A003B003C003D003E003F +0040004100420043004400450046004700480049004A004B004C004D004E004F +0050005100520053005400550056005700580059005A005B005C005D005E005F +0060006100620063006400650066006700680069006A006B006C006D006E006F +0070007100720073007400750076007700780079007A007B007C007D007E0000 +0000000000000000000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000000000000000000 +00000E010E020E030E040E050E060E070E080E090E0A0E0B0E0C0E0D0E0E0E0F +0E100E110E120E130E140E150E160E170E180E190E1A0E1B0E1C0E1D0E1E0E1F +0E200E210E220E230E240E250E260E270E280E290E2A0E2B0E2C0E2D0E2E0E2F +0E300E310E320E330E340E350E360E370E380E390E3A00000000000000000E3F +0E400E410E420E430E440E450E460E470E480E490E4A0E4B0E4C0E4D0E4E0E4F +0E500E510E520E530E540E550E560E570E580E590E5A0E5B0000000000000000 diff --git a/miniconda3/envs/active_proaction/lib/tcl8.6/history.tcl b/miniconda3/envs/active_proaction/lib/tcl8.6/history.tcl new file mode 100644 index 0000000000000000000000000000000000000000..79b76048038ef7233253ee796c1da5a866cf13ec --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/tcl8.6/history.tcl @@ -0,0 +1,335 @@ +# history.tcl -- +# +# Implementation of the history command. +# +# Copyright (c) 1997 Sun Microsystems, Inc. +# +# See the file "license.terms" for information on usage and redistribution of +# this file, and for a DISCLAIMER OF ALL WARRANTIES. +# + +# The tcl::history array holds the history list and some additional +# bookkeeping variables. +# +# nextid the index used for the next history list item. +# keep the max size of the history list +# oldest the index of the oldest item in the history. + +namespace eval ::tcl { + variable history + if {![info exists history]} { + array set history { + nextid 0 + keep 20 + oldest -20 + } + } + + namespace ensemble create -command ::tcl::history -map { + add ::tcl::HistAdd + change ::tcl::HistChange + clear ::tcl::HistClear + event ::tcl::HistEvent + info ::tcl::HistInfo + keep ::tcl::HistKeep + nextid ::tcl::HistNextID + redo ::tcl::HistRedo + } +} + +# history -- +# +# This is the main history command. See the man page for its interface. +# This does some argument checking and calls the helper ensemble in the +# tcl namespace. + +proc ::history {args} { + # If no command given, we're doing 'history info'. Can't be done with an + # ensemble unknown handler, as those don't fire when no subcommand is + # given at all. + + if {![llength $args]} { + set args info + } + + # Tricky stuff needed to make stack and errors come out right! + tailcall apply {arglist {tailcall ::tcl::history {*}$arglist} ::tcl} $args +} + +# (unnamed) -- +# +# Callback when [::history] is destroyed. Destroys the implementation. +# +# Parameters: +# oldName what the command was called. +# newName what the command is now called (an empty string). +# op the operation (= delete). +# +# Results: +# none +# +# Side Effects: +# The implementation of the [::history] command ceases to exist. + +trace add command ::history delete [list apply {{oldName newName op} { + variable history + unset -nocomplain history + foreach c [info procs ::tcl::Hist*] { + rename $c {} + } + rename ::tcl::history {} +} ::tcl}] + +# tcl::HistAdd -- +# +# Add an item to the history, and optionally eval it at the global scope +# +# Parameters: +# event the command to add +# exec (optional) a substring of "exec" causes the command to +# be evaled. +# Results: +# If executing, then the results of the command are returned +# +# Side Effects: +# Adds to the history list + +proc ::tcl::HistAdd {event {exec {}}} { + variable history + + if { + [prefix longest {exec {}} $exec] eq "" + && [llength [info level 0]] == 3 + } then { + return -code error "bad argument \"$exec\": should be \"exec\"" + } + + # Do not add empty commands to the history + if {[string trim $event] eq ""} { + return "" + } + + # Maintain the history + set history([incr history(nextid)]) $event + unset -nocomplain history([incr history(oldest)]) + + # Only execute if 'exec' (or non-empty prefix of it) given + if {$exec eq ""} { + return "" + } + tailcall eval $event +} + +# tcl::HistKeep -- +# +# Set or query the limit on the length of the history list +# +# Parameters: +# limit (optional) the length of the history list +# +# Results: +# If no limit is specified, the current limit is returned +# +# Side Effects: +# Updates history(keep) if a limit is specified + +proc ::tcl::HistKeep {{count {}}} { + variable history + if {[llength [info level 0]] == 1} { + return $history(keep) + } + if {![string is integer -strict $count] || ($count < 0)} { + return -code error "illegal keep count \"$count\"" + } + set oldold $history(oldest) + set history(oldest) [expr {$history(nextid) - $count}] + for {} {$oldold <= $history(oldest)} {incr oldold} { + unset -nocomplain history($oldold) + } + set history(keep) $count +} + +# tcl::HistClear -- +# +# Erase the history list +# +# Parameters: +# none +# +# Results: +# none +# +# Side Effects: +# Resets the history array, except for the keep limit + +proc ::tcl::HistClear {} { + variable history + set keep $history(keep) + unset history + array set history [list \ + nextid 0 \ + keep $keep \ + oldest -$keep \ + ] +} + +# tcl::HistInfo -- +# +# Return a pretty-printed version of the history list +# +# Parameters: +# num (optional) the length of the history list to return +# +# Results: +# A formatted history list + +proc ::tcl::HistInfo {{count {}}} { + variable history + if {[llength [info level 0]] == 1} { + set count [expr {$history(keep) + 1}] + } elseif {![string is integer -strict $count]} { + return -code error "bad integer \"$count\"" + } + set result {} + set newline "" + for {set i [expr {$history(nextid) - $count + 1}]} \ + {$i <= $history(nextid)} {incr i} { + if {![info exists history($i)]} { + continue + } + set cmd [string map [list \n \n\t] [string trimright $history($i) \ \n]] + append result $newline[format "%6d %s" $i $cmd] + set newline \n + } + return $result +} + +# tcl::HistRedo -- +# +# Fetch the previous or specified event, execute it, and then replace +# the current history item with that event. +# +# Parameters: +# event (optional) index of history item to redo. Defaults to -1, +# which means the previous event. +# +# Results: +# Those of the command being redone. +# +# Side Effects: +# Replaces the current history list item with the one being redone. + +proc ::tcl::HistRedo {{event -1}} { + variable history + + set i [HistIndex $event] + if {$i == $history(nextid)} { + return -code error "cannot redo the current event" + } + set cmd $history($i) + HistChange $cmd 0 + tailcall eval $cmd +} + +# tcl::HistIndex -- +# +# Map from an event specifier to an index in the history list. +# +# Parameters: +# event index of history item to redo. +# If this is a positive number, it is used directly. +# If it is a negative number, then it counts back to a previous +# event, where -1 is the most recent event. +# A string can be matched, either by being the prefix of a +# command or by matching a command with string match. +# +# Results: +# The index into history, or an error if the index didn't match. + +proc ::tcl::HistIndex {event} { + variable history + if {![string is integer -strict $event]} { + for {set i [expr {$history(nextid)-1}]} {[info exists history($i)]} \ + {incr i -1} { + if {[string match $event* $history($i)]} { + return $i + } + if {[string match $event $history($i)]} { + return $i + } + } + return -code error "no event matches \"$event\"" + } elseif {$event <= 0} { + set i [expr {$history(nextid) + $event}] + } else { + set i $event + } + if {$i <= $history(oldest)} { + return -code error "event \"$event\" is too far in the past" + } + if {$i > $history(nextid)} { + return -code error "event \"$event\" hasn't occurred yet" + } + return $i +} + +# tcl::HistEvent -- +# +# Map from an event specifier to the value in the history list. +# +# Parameters: +# event index of history item to redo. See index for a description of +# possible event patterns. +# +# Results: +# The value from the history list. + +proc ::tcl::HistEvent {{event -1}} { + variable history + set i [HistIndex $event] + if {![info exists history($i)]} { + return "" + } + return [string trimright $history($i) \ \n] +} + +# tcl::HistChange -- +# +# Replace a value in the history list. +# +# Parameters: +# newValue The new value to put into the history list. +# event (optional) index of history item to redo. See index for a +# description of possible event patterns. This defaults to 0, +# which specifies the current event. +# +# Side Effects: +# Changes the history list. + +proc ::tcl::HistChange {newValue {event 0}} { + variable history + set i [HistIndex $event] + set history($i) $newValue +} + +# tcl::HistNextID -- +# +# Returns the number of the next history event. +# +# Parameters: +# None. +# +# Side Effects: +# None. + +proc ::tcl::HistNextID {} { + variable history + return [expr {$history(nextid) + 1}] +} + +return + +# Local Variables: +# mode: tcl +# fill-column: 78 +# End: diff --git a/miniconda3/envs/active_proaction/lib/tcl8.6/http1.0/http.tcl b/miniconda3/envs/active_proaction/lib/tcl8.6/http1.0/http.tcl new file mode 100644 index 0000000000000000000000000000000000000000..ce112d801d45a06f55ca3c00c28aff409fd97e1a --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/tcl8.6/http1.0/http.tcl @@ -0,0 +1,377 @@ +# http.tcl +# Client-side HTTP for GET, POST, and HEAD commands. +# These routines can be used in untrusted code that uses the Safesock +# security policy. +# These procedures use a callback interface to avoid using vwait, +# which is not defined in the safe base. +# +# See the http.n man page for documentation + +package provide http 1.0 + +array set http { + -accept */* + -proxyhost {} + -proxyport {} + -useragent {Tcl http client package 1.0} + -proxyfilter httpProxyRequired +} +proc http_config {args} { + global http + set options [lsort [array names http -*]] + set usage [join $options ", "] + if {[llength $args] == 0} { + set result {} + foreach name $options { + lappend result $name $http($name) + } + return $result + } + regsub -all -- - $options {} options + set pat ^-([join $options |])$ + if {[llength $args] == 1} { + set flag [lindex $args 0] + if {[regexp -- $pat $flag]} { + return $http($flag) + } else { + return -code error "Unknown option $flag, must be: $usage" + } + } else { + foreach {flag value} $args { + if {[regexp -- $pat $flag]} { + set http($flag) $value + } else { + return -code error "Unknown option $flag, must be: $usage" + } + } + } +} + + proc httpFinish { token {errormsg ""} } { + upvar #0 $token state + global errorInfo errorCode + if {[string length $errormsg] != 0} { + set state(error) [list $errormsg $errorInfo $errorCode] + set state(status) error + } + catch {close $state(sock)} + catch {after cancel $state(after)} + if {[info exists state(-command)]} { + if {[catch {eval $state(-command) {$token}} err]} { + if {[string length $errormsg] == 0} { + set state(error) [list $err $errorInfo $errorCode] + set state(status) error + } + } + unset state(-command) + } +} +proc http_reset { token {why reset} } { + upvar #0 $token state + set state(status) $why + catch {fileevent $state(sock) readable {}} + httpFinish $token + if {[info exists state(error)]} { + set errorlist $state(error) + unset state(error) + eval error $errorlist + } +} +proc http_get { url args } { + global http + if {![info exists http(uid)]} { + set http(uid) 0 + } + set token http#[incr http(uid)] + upvar #0 $token state + http_reset $token + array set state { + -blocksize 8192 + -validate 0 + -headers {} + -timeout 0 + state header + meta {} + currentsize 0 + totalsize 0 + type text/html + body {} + status "" + } + set options {-blocksize -channel -command -handler -headers \ + -progress -query -validate -timeout} + set usage [join $options ", "] + regsub -all -- - $options {} options + set pat ^-([join $options |])$ + foreach {flag value} $args { + if {[regexp $pat $flag]} { + # Validate numbers + if {[info exists state($flag)] && \ + [regexp {^[0-9]+$} $state($flag)] && \ + ![regexp {^[0-9]+$} $value]} { + return -code error "Bad value for $flag ($value), must be integer" + } + set state($flag) $value + } else { + return -code error "Unknown option $flag, can be: $usage" + } + } + if {! [regexp -nocase {^(http://)?([^/:]+)(:([0-9]+))?(/.*)?$} $url \ + x proto host y port srvurl]} { + error "Unsupported URL: $url" + } + if {[string length $port] == 0} { + set port 80 + } + if {[string length $srvurl] == 0} { + set srvurl / + } + if {[string length $proto] == 0} { + set url http://$url + } + set state(url) $url + if {![catch {$http(-proxyfilter) $host} proxy]} { + set phost [lindex $proxy 0] + set pport [lindex $proxy 1] + } + if {$state(-timeout) > 0} { + set state(after) [after $state(-timeout) [list http_reset $token timeout]] + } + if {[info exists phost] && [string length $phost]} { + set srvurl $url + set s [socket $phost $pport] + } else { + set s [socket $host $port] + } + set state(sock) $s + + # Send data in cr-lf format, but accept any line terminators + + fconfigure $s -translation {auto crlf} -buffersize $state(-blocksize) + + # The following is disallowed in safe interpreters, but the socket + # is already in non-blocking mode in that case. + + catch {fconfigure $s -blocking off} + set len 0 + set how GET + if {[info exists state(-query)]} { + set len [string length $state(-query)] + if {$len > 0} { + set how POST + } + } elseif {$state(-validate)} { + set how HEAD + } + puts $s "$how $srvurl HTTP/1.0" + puts $s "Accept: $http(-accept)" + puts $s "Host: $host" + puts $s "User-Agent: $http(-useragent)" + foreach {key value} $state(-headers) { + regsub -all \[\n\r\] $value {} value + set key [string trim $key] + if {[string length $key]} { + puts $s "$key: $value" + } + } + if {$len > 0} { + puts $s "Content-Length: $len" + puts $s "Content-Type: application/x-www-form-urlencoded" + puts $s "" + fconfigure $s -translation {auto binary} + puts -nonewline $s $state(-query) + } else { + puts $s "" + } + flush $s + fileevent $s readable [list httpEvent $token] + if {! [info exists state(-command)]} { + http_wait $token + } + return $token +} +proc http_data {token} { + upvar #0 $token state + return $state(body) +} +proc http_status {token} { + upvar #0 $token state + return $state(status) +} +proc http_code {token} { + upvar #0 $token state + return $state(http) +} +proc http_size {token} { + upvar #0 $token state + return $state(currentsize) +} + + proc httpEvent {token} { + upvar #0 $token state + set s $state(sock) + + if {[eof $s]} { + httpEof $token + return + } + if {$state(state) == "header"} { + set n [gets $s line] + if {$n == 0} { + set state(state) body + if {![regexp -nocase ^text $state(type)]} { + # Turn off conversions for non-text data + fconfigure $s -translation binary + if {[info exists state(-channel)]} { + fconfigure $state(-channel) -translation binary + } + } + if {[info exists state(-channel)] && + ![info exists state(-handler)]} { + # Initiate a sequence of background fcopies + fileevent $s readable {} + httpCopyStart $s $token + } + } elseif {$n > 0} { + if {[regexp -nocase {^content-type:(.+)$} $line x type]} { + set state(type) [string trim $type] + } + if {[regexp -nocase {^content-length:(.+)$} $line x length]} { + set state(totalsize) [string trim $length] + } + if {[regexp -nocase {^([^:]+):(.+)$} $line x key value]} { + lappend state(meta) $key $value + } elseif {[regexp ^HTTP $line]} { + set state(http) $line + } + } + } else { + if {[catch { + if {[info exists state(-handler)]} { + set n [eval $state(-handler) {$s $token}] + } else { + set block [read $s $state(-blocksize)] + set n [string length $block] + if {$n >= 0} { + append state(body) $block + } + } + if {$n >= 0} { + incr state(currentsize) $n + } + } err]} { + httpFinish $token $err + } else { + if {[info exists state(-progress)]} { + eval $state(-progress) {$token $state(totalsize) $state(currentsize)} + } + } + } +} + proc httpCopyStart {s token} { + upvar #0 $token state + if {[catch { + fcopy $s $state(-channel) -size $state(-blocksize) -command \ + [list httpCopyDone $token] + } err]} { + httpFinish $token $err + } +} + proc httpCopyDone {token count {error {}}} { + upvar #0 $token state + set s $state(sock) + incr state(currentsize) $count + if {[info exists state(-progress)]} { + eval $state(-progress) {$token $state(totalsize) $state(currentsize)} + } + if {([string length $error] != 0)} { + httpFinish $token $error + } elseif {[eof $s]} { + httpEof $token + } else { + httpCopyStart $s $token + } +} + proc httpEof {token} { + upvar #0 $token state + if {$state(state) == "header"} { + # Premature eof + set state(status) eof + } else { + set state(status) ok + } + set state(state) eof + httpFinish $token +} +proc http_wait {token} { + upvar #0 $token state + if {![info exists state(status)] || [string length $state(status)] == 0} { + vwait $token\(status) + } + if {[info exists state(error)]} { + set errorlist $state(error) + unset state(error) + eval error $errorlist + } + return $state(status) +} + +# Call http_formatQuery with an even number of arguments, where the first is +# a name, the second is a value, the third is another name, and so on. + +proc http_formatQuery {args} { + set result "" + set sep "" + foreach i $args { + append result $sep [httpMapReply $i] + if {$sep != "="} { + set sep = + } else { + set sep & + } + } + return $result +} + +# do x-www-urlencoded character mapping +# The spec says: "non-alphanumeric characters are replaced by '%HH'" +# 1 leave alphanumerics characters alone +# 2 Convert every other character to an array lookup +# 3 Escape constructs that are "special" to the tcl parser +# 4 "subst" the result, doing all the array substitutions + + proc httpMapReply {string} { + global httpFormMap + set alphanumeric a-zA-Z0-9 + if {![info exists httpFormMap]} { + + for {set i 1} {$i <= 256} {incr i} { + set c [format %c $i] + if {![string match \[$alphanumeric\] $c]} { + set httpFormMap($c) %[format %.2x $i] + } + } + # These are handled specially + array set httpFormMap { + " " + \n %0d%0a + } + } + regsub -all \[^$alphanumeric\] $string {$httpFormMap(&)} string + regsub -all \n $string {\\n} string + regsub -all \t $string {\\t} string + regsub -all {[][{})\\]\)} $string {\\&} string + return [subst $string] +} + +# Default proxy filter. + proc httpProxyRequired {host} { + global http + if {[info exists http(-proxyhost)] && [string length $http(-proxyhost)]} { + if {![info exists http(-proxyport)] || ![string length $http(-proxyport)]} { + set http(-proxyport) 8080 + } + return [list $http(-proxyhost) $http(-proxyport)] + } else { + return {} + } +} diff --git a/miniconda3/envs/active_proaction/lib/tcl8.6/http1.0/pkgIndex.tcl b/miniconda3/envs/active_proaction/lib/tcl8.6/http1.0/pkgIndex.tcl new file mode 100644 index 0000000000000000000000000000000000000000..ab6170f7f623e269c442ceef76e21b1cc4fb8c6f --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/tcl8.6/http1.0/pkgIndex.tcl @@ -0,0 +1,11 @@ +# Tcl package index file, version 1.0 +# This file is generated by the "pkg_mkIndex" command +# and sourced either when an application starts up or +# by a "package unknown" script. It invokes the +# "package ifneeded" command to set up package-related +# information so that packages will be loaded automatically +# in response to "package require" commands. When this +# script is sourced, the variable $dir must contain the +# full path name of this file's directory. + +package ifneeded http 1.0 [list tclPkgSetup $dir http 1.0 {{http.tcl source {httpCopyDone httpCopyStart httpEof httpEvent httpFinish httpMapReply httpProxyRequired http_code http_config http_data http_formatQuery http_get http_reset http_size http_status http_wait}}}] diff --git a/miniconda3/envs/active_proaction/lib/tcl8.6/init.tcl b/miniconda3/envs/active_proaction/lib/tcl8.6/init.tcl new file mode 100644 index 0000000000000000000000000000000000000000..5f360cdb3546e6c1428d2d04f8d9bf51cd76df9b --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/tcl8.6/init.tcl @@ -0,0 +1,828 @@ +# init.tcl -- +# +# Default system startup file for Tcl-based applications. Defines +# "unknown" procedure and auto-load facilities. +# +# Copyright (c) 1991-1993 The Regents of the University of California. +# Copyright (c) 1994-1996 Sun Microsystems, Inc. +# Copyright (c) 1998-1999 Scriptics Corporation. +# Copyright (c) 2004 Kevin B. Kenny. +# +# All rights reserved. +# +# See the file "license.terms" for information on usage and redistribution +# of this file, and for a DISCLAIMER OF ALL WARRANTIES. +# + +# This test intentionally written in pre-7.5 Tcl +if {[info commands package] == ""} { + error "version mismatch: library\nscripts expect Tcl version 7.5b1 or later but the loaded version is\nonly [info patchlevel]" +} +package require -exact Tcl 8.6.15 + +# Compute the auto path to use in this interpreter. +# The values on the path come from several locations: +# +# The environment variable TCLLIBPATH +# +# tcl_library, which is the directory containing this init.tcl script. +# [tclInit] (Tcl_Init()) searches around for the directory containing this +# init.tcl and defines tcl_library to that location before sourcing it. +# +# The parent directory of tcl_library. Adding the parent +# means that packages in peer directories will be found automatically. +# +# Also add the directory ../lib relative to the directory where the +# executable is located. This is meant to find binary packages for the +# same architecture as the current executable. +# +# tcl_pkgPath, which is set by the platform-specific initialization routines +# On UNIX it is compiled in +# On Windows, it is not used +# +# (Ticket 41c9857bdd) In a safe interpreter, this file does not set +# ::auto_path (other than to {} if it is undefined). The caller, typically +# a Safe Base command, is responsible for setting ::auto_path. + +if {![info exists auto_path]} { + if {[info exists env(TCLLIBPATH)] && (![interp issafe])} { + set auto_path $env(TCLLIBPATH) + } else { + set auto_path "" + } +} + +namespace eval tcl { + if {![interp issafe]} { + variable Dir + foreach Dir [list $::tcl_library [file dirname $::tcl_library]] { + if {$Dir ni $::auto_path} { + lappend ::auto_path $Dir + } + } + set Dir [file join [file dirname [file dirname \ + [info nameofexecutable]]] lib] + if {$Dir ni $::auto_path} { + lappend ::auto_path $Dir + } + if {[info exists ::tcl_pkgPath]} { catch { + foreach Dir $::tcl_pkgPath { + if {$Dir ni $::auto_path} { + lappend ::auto_path $Dir + } + } + }} + + variable Path [encoding dirs] + set Dir [file join $::tcl_library encoding] + if {$Dir ni $Path} { + lappend Path $Dir + encoding dirs $Path + } + unset Dir Path + } + + # TIP #255 min and max functions + namespace eval mathfunc { + proc min {args} { + if {![llength $args]} { + return -code error \ + "not enough arguments to math function \"min\"" + } + set val Inf + foreach arg $args { + # This will handle forcing the numeric value without + # ruining the internal type of a numeric object + if {[catch {expr {double($arg)}} err]} { + return -code error $err + } + if {$arg < $val} {set val $arg} + } + return $val + } + proc max {args} { + if {![llength $args]} { + return -code error \ + "not enough arguments to math function \"max\"" + } + set val -Inf + foreach arg $args { + # This will handle forcing the numeric value without + # ruining the internal type of a numeric object + if {[catch {expr {double($arg)}} err]} { + return -code error $err + } + if {$arg > $val} {set val $arg} + } + return $val + } + namespace export min max + } +} + +# Windows specific end of initialization + +if {(![interp issafe]) && ($tcl_platform(platform) eq "windows")} { + namespace eval tcl { + proc EnvTraceProc {lo n1 n2 op} { + global env + set x $env($n2) + set env($lo) $x + set env([string toupper $lo]) $x + } + proc InitWinEnv {} { + global env tcl_platform + foreach p [array names env] { + set u [string toupper $p] + if {$u ne $p} { + switch -- $u { + COMSPEC - + PATH { + set temp $env($p) + unset env($p) + set env($u) $temp + trace add variable env($p) write \ + [namespace code [list EnvTraceProc $p]] + trace add variable env($u) write \ + [namespace code [list EnvTraceProc $p]] + } + } + } + } + if {![info exists env(COMSPEC)]} { + set env(COMSPEC) cmd.exe + } + } + InitWinEnv + } +} + +# Setup the unknown package handler + + +if {[interp issafe]} { + package unknown {::tcl::tm::UnknownHandler ::tclPkgUnknown} +} else { + # Set up search for Tcl Modules (TIP #189). + # and setup platform specific unknown package handlers + if {$tcl_platform(os) eq "Darwin" + && $tcl_platform(platform) eq "unix"} { + package unknown {::tcl::tm::UnknownHandler \ + {::tcl::MacOSXPkgUnknown ::tclPkgUnknown}} + } else { + package unknown {::tcl::tm::UnknownHandler ::tclPkgUnknown} + } + + # Set up the 'clock' ensemble + + namespace eval ::tcl::clock [list variable TclLibDir $::tcl_library] + + proc ::tcl::initClock {} { + # Auto-loading stubs for 'clock.tcl' + + foreach cmd {add format scan} { + proc ::tcl::clock::$cmd args { + variable TclLibDir + source -encoding utf-8 [file join $TclLibDir clock.tcl] + return [uplevel 1 [info level 0]] + } + } + + rename ::tcl::initClock {} + } + ::tcl::initClock +} + +# Conditionalize for presence of exec. + +if {[namespace which -command exec] eq ""} { + + # Some machines do not have exec. Also, on all + # platforms, safe interpreters do not have exec. + + set auto_noexec 1 +} + +# Define a log command (which can be overwritten to log errors +# differently, specially when stderr is not available) + +if {[namespace which -command tclLog] eq ""} { + proc tclLog {string} { + catch {puts stderr $string} + } +} + +# unknown -- +# This procedure is called when a Tcl command is invoked that doesn't +# exist in the interpreter. It takes the following steps to make the +# command available: +# +# 1. See if the autoload facility can locate the command in a +# Tcl script file. If so, load it and execute it. +# 2. If the command was invoked interactively at top-level: +# (a) see if the command exists as an executable UNIX program. +# If so, "exec" the command. +# (b) see if the command requests csh-like history substitution +# in one of the common forms !!, !, or ^old^new. If +# so, emulate csh's history substitution. +# (c) see if the command is a unique abbreviation for another +# command. If so, invoke the command. +# +# Arguments: +# args - A list whose elements are the words of the original +# command, including the command name. + +proc unknown args { + variable ::tcl::UnknownPending + global auto_noexec auto_noload env tcl_interactive errorInfo errorCode + + if {[info exists errorInfo]} { + set savedErrorInfo $errorInfo + } + if {[info exists errorCode]} { + set savedErrorCode $errorCode + } + + set name [lindex $args 0] + if {![info exists auto_noload]} { + # + # Make sure we're not trying to load the same proc twice. + # + if {[info exists UnknownPending($name)]} { + return -code error "self-referential recursion\ + in \"unknown\" for command \"$name\"" + } + set UnknownPending($name) pending + set ret [catch { + auto_load $name [uplevel 1 {::namespace current}] + } msg opts] + unset UnknownPending($name) + if {$ret != 0} { + dict append opts -errorinfo "\n (autoloading \"$name\")" + return -options $opts $msg + } + if {![array size UnknownPending]} { + unset UnknownPending + } + if {$msg} { + if {[info exists savedErrorCode]} { + set ::errorCode $savedErrorCode + } else { + unset -nocomplain ::errorCode + } + if {[info exists savedErrorInfo]} { + set errorInfo $savedErrorInfo + } else { + unset -nocomplain errorInfo + } + set code [catch {uplevel 1 $args} msg opts] + if {$code == 1} { + # + # Compute stack trace contribution from the [uplevel]. + # Note the dependence on how Tcl_AddErrorInfo, etc. + # construct the stack trace. + # + set errInfo [dict get $opts -errorinfo] + set errCode [dict get $opts -errorcode] + set cinfo $args + if {[string bytelength $cinfo] > 150} { + set cinfo [string range $cinfo 0 150] + while {[string bytelength $cinfo] > 150} { + set cinfo [string range $cinfo 0 end-1] + } + append cinfo ... + } + set tail "\n (\"uplevel\" body line 1)\n invoked\ + from within\n\"uplevel 1 \$args\"" + set expect "$msg\n while executing\n\"$cinfo\"$tail" + if {$errInfo eq $expect} { + # + # The stack has only the eval from the expanded command + # Do not generate any stack trace here. + # + dict unset opts -errorinfo + dict incr opts -level + return -options $opts $msg + } + # + # Stack trace is nested, trim off just the contribution + # from the extra "eval" of $args due to the "catch" above. + # + set last [string last $tail $errInfo] + if {$last + [string length $tail] != [string length $errInfo]} { + # Very likely cannot happen + return -options $opts $msg + } + set errInfo [string range $errInfo 0 $last-1] + set tail "\"$cinfo\"" + set last [string last $tail $errInfo] + if {$last < 0 || $last + [string length $tail] != [string length $errInfo]} { + return -code error -errorcode $errCode \ + -errorinfo $errInfo $msg + } + set errInfo [string range $errInfo 0 $last-1] + set tail "\n invoked from within\n" + set last [string last $tail $errInfo] + if {$last + [string length $tail] == [string length $errInfo]} { + return -code error -errorcode $errCode \ + -errorinfo [string range $errInfo 0 $last-1] $msg + } + set tail "\n while executing\n" + set last [string last $tail $errInfo] + if {$last + [string length $tail] == [string length $errInfo]} { + return -code error -errorcode $errCode \ + -errorinfo [string range $errInfo 0 $last-1] $msg + } + return -options $opts $msg + } else { + dict incr opts -level + return -options $opts $msg + } + } + } + + if {([info level] == 1) && ([info script] eq "") + && [info exists tcl_interactive] && $tcl_interactive} { + if {![info exists auto_noexec]} { + set new [auto_execok $name] + if {$new ne ""} { + set redir "" + if {[namespace which -command console] eq ""} { + set redir ">&@stdout <@stdin" + } + uplevel 1 [list ::catch \ + [concat exec $redir $new [lrange $args 1 end]] \ + ::tcl::UnknownResult ::tcl::UnknownOptions] + dict incr ::tcl::UnknownOptions -level + return -options $::tcl::UnknownOptions $::tcl::UnknownResult + } + } + if {$name eq "!!"} { + set newcmd [history event] + } elseif {[regexp {^!(.+)$} $name -> event]} { + set newcmd [history event $event] + } elseif {[regexp {^\^([^^]*)\^([^^]*)\^?$} $name -> old new]} { + set newcmd [history event -1] + catch {regsub -all -- $old $newcmd $new newcmd} + } + if {[info exists newcmd]} { + tclLog $newcmd + history change $newcmd 0 + uplevel 1 [list ::catch $newcmd \ + ::tcl::UnknownResult ::tcl::UnknownOptions] + dict incr ::tcl::UnknownOptions -level + return -options $::tcl::UnknownOptions $::tcl::UnknownResult + } + + set ret [catch [list uplevel 1 [list info commands $name*]] candidates] + if {$name eq "::"} { + set name "" + } + if {$ret != 0} { + dict append opts -errorinfo \ + "\n (expanding command prefix \"$name\" in unknown)" + return -options $opts $candidates + } + # Filter out bogus matches when $name contained + # a glob-special char [Bug 946952] + if {$name eq ""} { + # Handle empty $name separately due to strangeness + # in [string first] (See RFE 1243354) + set cmds $candidates + } else { + set cmds [list] + foreach x $candidates { + if {[string first $name $x] == 0} { + lappend cmds $x + } + } + } + if {[llength $cmds] == 1} { + uplevel 1 [list ::catch [lreplace $args 0 0 [lindex $cmds 0]] \ + ::tcl::UnknownResult ::tcl::UnknownOptions] + dict incr ::tcl::UnknownOptions -level + return -options $::tcl::UnknownOptions $::tcl::UnknownResult + } + if {[llength $cmds]} { + return -code error "ambiguous command name \"$name\": [lsort $cmds]" + } + } + return -code error -errorcode [list TCL LOOKUP COMMAND $name] \ + "invalid command name \"$name\"" +} + +# auto_load -- +# Checks a collection of library directories to see if a procedure +# is defined in one of them. If so, it sources the appropriate +# library file to create the procedure. Returns 1 if it successfully +# loaded the procedure, 0 otherwise. +# +# Arguments: +# cmd - Name of the command to find and load. +# namespace (optional) The namespace where the command is being used - must be +# a canonical namespace as returned [namespace current] +# for instance. If not given, namespace current is used. + +proc auto_load {cmd {namespace {}}} { + global auto_index auto_path + + # qualify names: + if {$namespace eq ""} { + set namespace [uplevel 1 [list ::namespace current]] + } + set nameList [auto_qualify $cmd $namespace] + # workaround non canonical auto_index entries that might be around + # from older auto_mkindex versions + if {$cmd ni $nameList} {lappend nameList $cmd} + + # try to load (and create sub-cmd handler "_sub_load_cmd" for further usage): + foreach name $nameList [set _sub_load_cmd { + # via auto_index: + if {[info exists auto_index($name)]} { + namespace inscope :: $auto_index($name) + # There's a couple of ways to look for a command of a given + # name. One is to use + # info commands $name + # Unfortunately, if the name has glob-magic chars in it like * + # or [], it may not match. For our purposes here, a better + # route is to use + # namespace which -command $name + if {[namespace which -command $name] ne ""} { + return 1 + } + } + }] + + # load auto_index if possible: + if {![info exists auto_path]} { + return 0 + } + if {![auto_load_index]} { + return 0 + } + + # try again (something new could be loaded): + foreach name $nameList $_sub_load_cmd + + return 0 +} + +# auto_load_index -- +# Loads the contents of tclIndex files on the auto_path directory +# list. This is usually invoked within auto_load to load the index +# of available commands. Returns 1 if the index is loaded, and 0 if +# the index is already loaded and up to date. +# +# Arguments: +# None. + +proc auto_load_index {} { + variable ::tcl::auto_oldpath + global auto_index auto_path + + if {[info exists auto_oldpath] && ($auto_oldpath eq $auto_path)} { + return 0 + } + set auto_oldpath $auto_path + + # Check if we are a safe interpreter. In that case, we support only + # newer format tclIndex files. + + set issafe [interp issafe] + for {set i [expr {[llength $auto_path] - 1}]} {$i >= 0} {incr i -1} { + set dir [lindex $auto_path $i] + set f "" + if {$issafe} { + catch {source -encoding utf-8 [file join $dir tclIndex]} + } elseif {[catch {set f [open [file join $dir tclIndex]]}]} { + continue + } else { + set error [catch { + fconfigure $f -eofchar "\x1A {}" -encoding utf-8 + set id [gets $f] + if {$id eq "# Tcl autoload index file, version 2.0"} { + eval [read $f] + } elseif {$id eq "# Tcl autoload index file: each line identifies a Tcl"} { + while {[gets $f line] >= 0} { + if {([string index $line 0] eq "#") \ + || ([llength $line] != 2)} { + continue + } + set name [lindex $line 0] + set auto_index($name) \ + "source -encoding utf-8 [file join $dir [lindex $line 1]]" + } + } else { + error "[file join $dir tclIndex] isn't a proper Tcl index file" + } + } msg opts] + if {$f ne ""} { + close $f + } + if {$error} { + return -options $opts $msg + } + } + } + return 1 +} + +# auto_qualify -- +# +# Compute a fully qualified names list for use in the auto_index array. +# For historical reasons, commands in the global namespace do not have leading +# :: in the index key. The list has two elements when the command name is +# relative (no leading ::) and the namespace is not the global one. Otherwise +# only one name is returned (and searched in the auto_index). +# +# Arguments - +# cmd The command name. Can be any name accepted for command +# invocations (Like "foo::::bar"). +# namespace The namespace where the command is being used - must be +# a canonical namespace as returned by [namespace current] +# for instance. + +proc auto_qualify {cmd namespace} { + + # count separators and clean them up + # (making sure that foo:::::bar will be treated as foo::bar) + set n [regsub -all {::+} $cmd :: cmd] + + # Ignore namespace if the name starts with :: + # Handle special case of only leading :: + + # Before each return case we give an example of which category it is + # with the following form : + # (inputCmd, inputNameSpace) -> output + + if {[string match ::* $cmd]} { + if {$n > 1} { + # (::foo::bar , *) -> ::foo::bar + return [list $cmd] + } else { + # (::global , *) -> global + return [list [string range $cmd 2 end]] + } + } + + # Potentially returning 2 elements to try : + # (if the current namespace is not the global one) + + if {$n == 0} { + if {$namespace eq "::"} { + # (nocolons , ::) -> nocolons + return [list $cmd] + } else { + # (nocolons , ::sub) -> ::sub::nocolons nocolons + return [list ${namespace}::$cmd $cmd] + } + } elseif {$namespace eq "::"} { + # (foo::bar , ::) -> ::foo::bar + return [list ::$cmd] + } else { + # (foo::bar , ::sub) -> ::sub::foo::bar ::foo::bar + return [list ${namespace}::$cmd ::$cmd] + } +} + +# auto_import -- +# +# Invoked during "namespace import" to make see if the imported commands +# reside in an autoloaded library. If so, the commands are loaded so +# that they will be available for the import links. If not, then this +# procedure does nothing. +# +# Arguments - +# pattern The pattern of commands being imported (like "foo::*") +# a canonical namespace as returned by [namespace current] + +proc auto_import {pattern} { + global auto_index + + # If no namespace is specified, this will be an error case + + if {![string match *::* $pattern]} { + return + } + + set ns [uplevel 1 [list ::namespace current]] + set patternList [auto_qualify $pattern $ns] + + auto_load_index + + foreach pattern $patternList { + foreach name [array names auto_index $pattern] { + if {([namespace which -command $name] eq "") + && ([namespace qualifiers $pattern] eq [namespace qualifiers $name])} { + namespace inscope :: $auto_index($name) + } + } + } +} + +# auto_execok -- +# +# Returns string that indicates name of program to execute if +# name corresponds to a shell builtin or an executable in the +# Windows search path, or "" otherwise. Builds an associative +# array auto_execs that caches information about previous checks, +# for speed. +# +# Arguments: +# name - Name of a command. + +if {$tcl_platform(platform) eq "windows"} { +# Windows version. +# +# Note that file executable doesn't work under Windows, so we have to +# look for files with .exe, .com, or .bat extensions. Also, the path +# may be in the Path or PATH environment variables, and path +# components are separated with semicolons, not colons as under Unix. +# +proc auto_execok name { + global auto_execs env tcl_platform + + if {[info exists auto_execs($name)]} { + return $auto_execs($name) + } + set auto_execs($name) "" + + set shellBuiltins [list assoc cls copy date del dir echo erase exit ftype \ + md mkdir mklink move rd ren rename rmdir start time type ver vol] + if {[info exists env(PATHEXT)]} { + # Add an initial ; to have the {} extension check first. + set execExtensions [split ";$env(PATHEXT)" ";"] + } else { + set execExtensions [list {} .com .exe .bat .cmd] + } + + if {[string tolower $name] in $shellBuiltins} { + # When this is command.com for some reason on Win2K, Tcl won't + # exec it unless the case is right, which this corrects. COMSPEC + # may not point to a real file, so do the check. + set cmd $env(COMSPEC) + if {[file exists $cmd]} { + set cmd [file attributes $cmd -shortname] + } + return [set auto_execs($name) [list $cmd /c $name]] + } + + if {[llength [file split $name]] != 1} { + foreach ext $execExtensions { + set file ${name}${ext} + if {[file exists $file] && ![file isdirectory $file]} { + return [set auto_execs($name) [list $file]] + } + } + return "" + } + + set path "[file dirname [info nameofexecutable]];.;" + if {[info exists env(SystemRoot)]} { + set windir $env(SystemRoot) + } elseif {[info exists env(WINDIR)]} { + set windir $env(WINDIR) + } + if {[info exists windir]} { + append path "$windir/system32;$windir/system;$windir;" + } + + foreach var {PATH Path path} { + if {[info exists env($var)]} { + append path ";$env($var)" + } + } + + foreach ext $execExtensions { + unset -nocomplain checked + foreach dir [split $path {;}] { + # Skip already checked directories + if {[info exists checked($dir)] || ($dir eq "")} { + continue + } + set checked($dir) {} + set file [file join $dir ${name}${ext}] + if {[file exists $file] && ![file isdirectory $file]} { + return [set auto_execs($name) [list $file]] + } + } + } + return "" +} + +} else { +# Unix version. +# +proc auto_execok name { + global auto_execs env + + if {[info exists auto_execs($name)]} { + return $auto_execs($name) + } + set auto_execs($name) "" + if {[llength [file split $name]] != 1} { + if {[file executable $name] && ![file isdirectory $name]} { + set auto_execs($name) [list $name] + } + return $auto_execs($name) + } + foreach dir [split $env(PATH) :] { + if {$dir eq ""} { + set dir . + } + set file [file join $dir $name] + if {[file executable $file] && ![file isdirectory $file]} { + set auto_execs($name) [list $file] + return $auto_execs($name) + } + } + return "" +} + +} + +# ::tcl::CopyDirectory -- +# +# This procedure is called by Tcl's core when attempts to call the +# filesystem's copydirectory function fail. The semantics of the call +# are that 'dest' does not yet exist, i.e. dest should become the exact +# image of src. If dest does exist, we throw an error. +# +# Note that making changes to this procedure can change the results +# of running Tcl's tests. +# +# Arguments: +# action - "renaming" or "copying" +# src - source directory +# dest - destination directory +proc tcl::CopyDirectory {action src dest} { + set nsrc [file normalize $src] + set ndest [file normalize $dest] + + if {$action eq "renaming"} { + # Can't rename volumes. We could give a more precise + # error message here, but that would break the test suite. + if {$nsrc in [file volumes]} { + return -code error "error $action \"$src\" to\ + \"$dest\": trying to rename a volume or move a directory\ + into itself" + } + } + if {[file exists $dest]} { + if {$nsrc eq $ndest} { + return -code error "error $action \"$src\" to\ + \"$dest\": trying to rename a volume or move a directory\ + into itself" + } + if {$action eq "copying"} { + # We used to throw an error here, but, looking more closely + # at the core copy code in tclFCmd.c, if the destination + # exists, then we should only call this function if -force + # is true, which means we just want to over-write. So, + # the following code is now commented out. + # + # return -code error "error $action \"$src\" to\ + # \"$dest\": file already exists" + } else { + # Depending on the platform, and on the current + # working directory, the directories '.', '..' + # can be returned in various combinations. Anyway, + # if any other file is returned, we must signal an error. + set existing [glob -nocomplain -directory $dest * .*] + lappend existing {*}[glob -nocomplain -directory $dest \ + -type hidden * .*] + foreach s $existing { + if {[file tail $s] ni {. ..}} { + return -code error "error $action \"$src\" to\ + \"$dest\": file already exists" + } + } + } + } else { + if {[string first $nsrc $ndest] >= 0} { + set srclen [expr {[llength [file split $nsrc]] - 1}] + set ndest [lindex [file split $ndest] $srclen] + if {$ndest eq [file tail $nsrc]} { + return -code error "error $action \"$src\" to\ + \"$dest\": trying to rename a volume or move a directory\ + into itself" + } + } + file mkdir $dest + } + # Have to be careful to capture both visible and hidden files. + # We will also be more generous to the file system and not + # assume the hidden and non-hidden lists are non-overlapping. + # + # On Unix 'hidden' files begin with '.'. On other platforms + # or filesystems hidden files may have other interpretations. + set filelist [concat [glob -nocomplain -directory $src *] \ + [glob -nocomplain -directory $src -types hidden *]] + + foreach s [lsort -unique $filelist] { + if {[file tail $s] ni {. ..}} { + file copy -force -- $s [file join $dest [file tail $s]] + } + } + return +} diff --git a/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/af.msg b/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/af.msg new file mode 100644 index 0000000000000000000000000000000000000000..08926157c3743f46d068ff8c614321af0d5e99ee --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/af.msg @@ -0,0 +1,49 @@ +# created by tools/loadICU.tcl -- do not edit +namespace eval ::tcl::clock { + ::msgcat::mcset af DAYS_OF_WEEK_ABBREV [list \ + "So"\ + "Ma"\ + "Di"\ + "Wo"\ + "Do"\ + "Vr"\ + "Sa"] + ::msgcat::mcset af DAYS_OF_WEEK_FULL [list \ + "Sondag"\ + "Maandag"\ + "Dinsdag"\ + "Woensdag"\ + "Donderdag"\ + "Vrydag"\ + "Saterdag"] + ::msgcat::mcset af MONTHS_ABBREV [list \ + "Jan"\ + "Feb"\ + "Mar"\ + "Apr"\ + "Mei"\ + "Jun"\ + "Jul"\ + "Aug"\ + "Sep"\ + "Okt"\ + "Nov"\ + "Des"\ + ""] + ::msgcat::mcset af MONTHS_FULL [list \ + "Januarie"\ + "Februarie"\ + "Maart"\ + "April"\ + "Mei"\ + "Junie"\ + "Julie"\ + "Augustus"\ + "September"\ + "Oktober"\ + "November"\ + "Desember"\ + ""] + ::msgcat::mcset af AM "VM" + ::msgcat::mcset af PM "NM" +} diff --git a/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/af_za.msg b/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/af_za.msg new file mode 100644 index 0000000000000000000000000000000000000000..fef48ad48fe899ab4bbc86f28edcf11edb66c5d8 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/af_za.msg @@ -0,0 +1,6 @@ +# created by tools/loadICU.tcl -- do not edit +namespace eval ::tcl::clock { + ::msgcat::mcset af_ZA DATE_FORMAT "%d %B %Y" + ::msgcat::mcset af_ZA TIME_FORMAT_12 "%l:%M:%S %P" + ::msgcat::mcset af_ZA DATE_TIME_FORMAT "%d %B %Y %l:%M:%S %P %z" +} diff --git a/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/ar.msg b/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/ar.msg new file mode 100644 index 0000000000000000000000000000000000000000..257157fd0e84065c8cf3bb2b58826781579d5e79 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/ar.msg @@ -0,0 +1,54 @@ +# created by tools/loadICU.tcl -- do not edit +namespace eval ::tcl::clock { + ::msgcat::mcset ar DAYS_OF_WEEK_ABBREV [list \ + "\u062d"\ + "\u0646"\ + "\u062b"\ + "\u0631"\ + "\u062e"\ + "\u062c"\ + "\u0633"] + ::msgcat::mcset ar DAYS_OF_WEEK_FULL [list \ + "\u0627\u0644\u0623\u062d\u062f"\ + "\u0627\u0644\u0627\u062b\u0646\u064a\u0646"\ + "\u0627\u0644\u062b\u0644\u0627\u062b\u0627\u0621"\ + "\u0627\u0644\u0623\u0631\u0628\u0639\u0627\u0621"\ + "\u0627\u0644\u062e\u0645\u064a\u0633"\ + "\u0627\u0644\u062c\u0645\u0639\u0629"\ + "\u0627\u0644\u0633\u0628\u062a"] + ::msgcat::mcset ar MONTHS_ABBREV [list \ + "\u064a\u0646\u0627"\ + "\u0641\u0628\u0631"\ + "\u0645\u0627\u0631"\ + "\u0623\u0628\u0631"\ + "\u0645\u0627\u064a"\ + "\u064a\u0648\u0646"\ + "\u064a\u0648\u0644"\ + "\u0623\u063a\u0633"\ + "\u0633\u0628\u062a"\ + "\u0623\u0643\u062a"\ + "\u0646\u0648\u0641"\ + "\u062f\u064a\u0633"\ + ""] + ::msgcat::mcset ar MONTHS_FULL [list \ + "\u064a\u0646\u0627\u064a\u0631"\ + "\u0641\u0628\u0631\u0627\u064a\u0631"\ + "\u0645\u0627\u0631\u0633"\ + "\u0623\u0628\u0631\u064a\u0644"\ + "\u0645\u0627\u064a\u0648"\ + "\u064a\u0648\u0646\u064a\u0648"\ + "\u064a\u0648\u0644\u064a\u0648"\ + "\u0623\u063a\u0633\u0637\u0633"\ + "\u0633\u0628\u062a\u0645\u0628\u0631"\ + "\u0623\u0643\u062a\u0648\u0628\u0631"\ + "\u0646\u0648\u0641\u0645\u0628\u0631"\ + "\u062f\u064a\u0633\u0645\u0628\u0631"\ + ""] + ::msgcat::mcset ar BCE "\u0642.\u0645" + ::msgcat::mcset ar CE "\u0645" + ::msgcat::mcset ar AM "\u0635" + ::msgcat::mcset ar PM "\u0645" + ::msgcat::mcset ar DATE_FORMAT "%d/%m/%Y" + ::msgcat::mcset ar TIME_FORMAT_12 "%I:%M:%S %P" + ::msgcat::mcset ar DATE_TIME_FORMAT "%d/%m/%Y %I:%M:%S %P %z" +} diff --git a/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/ar_in.msg b/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/ar_in.msg new file mode 100644 index 0000000000000000000000000000000000000000..185e49c377ac8c8c0eef18c068a11b28fa6fadcb --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/ar_in.msg @@ -0,0 +1,6 @@ +# created by tools/loadICU.tcl -- do not edit +namespace eval ::tcl::clock { + ::msgcat::mcset ar_IN DATE_FORMAT "%A %d %B %Y" + ::msgcat::mcset ar_IN TIME_FORMAT_12 "%I:%M:%S %z" + ::msgcat::mcset ar_IN DATE_TIME_FORMAT "%A %d %B %Y %I:%M:%S %z %z" +} diff --git a/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/ar_jo.msg b/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/ar_jo.msg new file mode 100644 index 0000000000000000000000000000000000000000..0f5e26975e8eaf3f6e097403ead544f8da63a00e --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/ar_jo.msg @@ -0,0 +1,39 @@ +# created by tools/loadICU.tcl -- do not edit +namespace eval ::tcl::clock { + ::msgcat::mcset ar_JO DAYS_OF_WEEK_ABBREV [list \ + "\u0627\u0644\u0623\u062d\u062f"\ + "\u0627\u0644\u0627\u062b\u0646\u064a\u0646"\ + "\u0627\u0644\u062b\u0644\u0627\u062b\u0627\u0621"\ + "\u0627\u0644\u0623\u0631\u0628\u0639\u0627\u0621"\ + "\u0627\u0644\u062e\u0645\u064a\u0633"\ + "\u0627\u0644\u062c\u0645\u0639\u0629"\ + "\u0627\u0644\u0633\u0628\u062a"] + ::msgcat::mcset ar_JO MONTHS_ABBREV [list \ + "\u0643\u0627\u0646\u0648\u0646 \u0627\u0644\u062b\u0627\u0646\u064a"\ + "\u0634\u0628\u0627\u0637"\ + "\u0622\u0630\u0627\u0631"\ + "\u0646\u064a\u0633\u0627\u0646"\ + "\u0646\u0648\u0627\u0631"\ + "\u062d\u0632\u064a\u0631\u0627\u0646"\ + "\u062a\u0645\u0648\u0632"\ + "\u0622\u0628"\ + "\u0623\u064a\u0644\u0648\u0644"\ + "\u062a\u0634\u0631\u064a\u0646 \u0627\u0644\u0623\u0648\u0644"\ + "\u062a\u0634\u0631\u064a\u0646 \u0627\u0644\u062b\u0627\u0646\u064a"\ + "\u0643\u0627\u0646\u0648\u0646 \u0627\u0644\u0623\u0648\u0644"\ + ""] + ::msgcat::mcset ar_JO MONTHS_FULL [list \ + "\u0643\u0627\u0646\u0648\u0646 \u0627\u0644\u062b\u0627\u0646\u064a"\ + "\u0634\u0628\u0627\u0637"\ + "\u0622\u0630\u0627\u0631"\ + "\u0646\u064a\u0633\u0627\u0646"\ + "\u0646\u0648\u0627\u0631"\ + "\u062d\u0632\u064a\u0631\u0627\u0646"\ + "\u062a\u0645\u0648\u0632"\ + "\u0622\u0628"\ + "\u0623\u064a\u0644\u0648\u0644"\ + "\u062a\u0634\u0631\u064a\u0646 \u0627\u0644\u0623\u0648\u0644"\ + "\u062a\u0634\u0631\u064a\u0646 \u0627\u0644\u062b\u0627\u0646\u064a"\ + "\u0643\u0627\u0646\u0648\u0646 \u0627\u0644\u0623\u0648\u0644"\ + ""] +} diff --git a/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/ar_lb.msg b/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/ar_lb.msg new file mode 100644 index 0000000000000000000000000000000000000000..e62acd35092b7bc3f9ade6c5a34dae2baa12aa30 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/ar_lb.msg @@ -0,0 +1,39 @@ +# created by tools/loadICU.tcl -- do not edit +namespace eval ::tcl::clock { + ::msgcat::mcset ar_LB DAYS_OF_WEEK_ABBREV [list \ + "\u0627\u0644\u0623\u062d\u062f"\ + "\u0627\u0644\u0627\u062b\u0646\u064a\u0646"\ + "\u0627\u0644\u062b\u0644\u0627\u062b\u0627\u0621"\ + "\u0627\u0644\u0623\u0631\u0628\u0639\u0627\u0621"\ + "\u0627\u0644\u062e\u0645\u064a\u0633"\ + "\u0627\u0644\u062c\u0645\u0639\u0629"\ + "\u0627\u0644\u0633\u0628\u062a"] + ::msgcat::mcset ar_LB MONTHS_ABBREV [list \ + "\u0643\u0627\u0646\u0648\u0646 \u0627\u0644\u062b\u0627\u0646\u064a"\ + "\u0634\u0628\u0627\u0637"\ + "\u0622\u0630\u0627\u0631"\ + "\u0646\u064a\u0633\u0627\u0646"\ + "\u0646\u0648\u0627\u0631"\ + "\u062d\u0632\u064a\u0631\u0627\u0646"\ + "\u062a\u0645\u0648\u0632"\ + "\u0622\u0628"\ + "\u0623\u064a\u0644\u0648\u0644"\ + "\u062a\u0634\u0631\u064a\u0646 \u0627\u0644\u0623\u0648\u0644"\ + "\u062a\u0634\u0631\u064a\u0646 \u0627\u0644\u062b\u0627\u0646\u064a"\ + "\u0643\u0627\u0646\u0648\u0646 \u0627\u0644\u0623\u0648\u0644"\ + ""] + ::msgcat::mcset ar_LB MONTHS_FULL [list \ + "\u0643\u0627\u0646\u0648\u0646 \u0627\u0644\u062b\u0627\u0646\u064a"\ + "\u0634\u0628\u0627\u0637"\ + "\u0622\u0630\u0627\u0631"\ + "\u0646\u064a\u0633\u0627\u0646"\ + "\u0646\u0648\u0627\u0631"\ + "\u062d\u0632\u064a\u0631\u0627\u0646"\ + "\u062a\u0645\u0648\u0632"\ + "\u0622\u0628"\ + "\u0623\u064a\u0644\u0648\u0644"\ + "\u062a\u0634\u0631\u064a\u0646 \u0627\u0644\u0623\u0648\u0644"\ + "\u062a\u0634\u0631\u064a\u0646 \u0627\u0644\u062b\u0627\u0646\u064a"\ + "\u0643\u0627\u0646\u0648\u0646 \u0627\u0644\u0623\u0648\u0644"\ + ""] +} diff --git a/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/ar_sy.msg b/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/ar_sy.msg new file mode 100644 index 0000000000000000000000000000000000000000..d5e1c873a1c2b7790d7d539cbb59a3d2e5ae02dd --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/ar_sy.msg @@ -0,0 +1,39 @@ +# created by tools/loadICU.tcl -- do not edit +namespace eval ::tcl::clock { + ::msgcat::mcset ar_SY DAYS_OF_WEEK_ABBREV [list \ + "\u0627\u0644\u0623\u062d\u062f"\ + "\u0627\u0644\u0627\u062b\u0646\u064a\u0646"\ + "\u0627\u0644\u062b\u0644\u0627\u062b\u0627\u0621"\ + "\u0627\u0644\u0623\u0631\u0628\u0639\u0627\u0621"\ + "\u0627\u0644\u062e\u0645\u064a\u0633"\ + "\u0627\u0644\u062c\u0645\u0639\u0629"\ + "\u0627\u0644\u0633\u0628\u062a"] + ::msgcat::mcset ar_SY MONTHS_ABBREV [list \ + "\u0643\u0627\u0646\u0648\u0646 \u0627\u0644\u062b\u0627\u0646\u064a"\ + "\u0634\u0628\u0627\u0637"\ + "\u0622\u0630\u0627\u0631"\ + "\u0646\u064a\u0633\u0627\u0646"\ + "\u0646\u0648\u0627\u0631"\ + "\u062d\u0632\u064a\u0631\u0627\u0646"\ + "\u062a\u0645\u0648\u0632"\ + "\u0622\u0628"\ + "\u0623\u064a\u0644\u0648\u0644"\ + "\u062a\u0634\u0631\u064a\u0646 \u0627\u0644\u0623\u0648\u0644"\ + "\u062a\u0634\u0631\u064a\u0646 \u0627\u0644\u062b\u0627\u0646\u064a"\ + "\u0643\u0627\u0646\u0648\u0646 \u0627\u0644\u0623\u0648\u0644"\ + ""] + ::msgcat::mcset ar_SY MONTHS_FULL [list \ + "\u0643\u0627\u0646\u0648\u0646 \u0627\u0644\u062b\u0627\u0646\u064a"\ + "\u0634\u0628\u0627\u0637"\ + "\u0622\u0630\u0627\u0631"\ + "\u0646\u064a\u0633\u0627\u0646"\ + "\u0646\u0648\u0627\u0631\u0627\u0646"\ + "\u062d\u0632\u064a\u0631"\ + "\u062a\u0645\u0648\u0632"\ + "\u0622\u0628"\ + "\u0623\u064a\u0644\u0648\u0644"\ + "\u062a\u0634\u0631\u064a\u0646 \u0627\u0644\u0623\u0648\u0644"\ + "\u062a\u0634\u0631\u064a\u0646 \u0627\u0644\u062b\u0627\u0646\u064a"\ + "\u0643\u0627\u0646\u0648\u0646 \u0627\u0644\u0623\u0648\u0644"\ + ""] +} diff --git a/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/be.msg b/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/be.msg new file mode 100644 index 0000000000000000000000000000000000000000..379a1d7e6cdfdd824a8a14214f89f0a3308b7e81 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/be.msg @@ -0,0 +1,52 @@ +# created by tools/loadICU.tcl -- do not edit +namespace eval ::tcl::clock { + ::msgcat::mcset be DAYS_OF_WEEK_ABBREV [list \ + "\u043d\u0434"\ + "\u043f\u043d"\ + "\u0430\u0442"\ + "\u0441\u0440"\ + "\u0447\u0446"\ + "\u043f\u0442"\ + "\u0441\u0431"] + ::msgcat::mcset be DAYS_OF_WEEK_FULL [list \ + "\u043d\u044f\u0434\u0437\u0435\u043b\u044f"\ + "\u043f\u0430\u043d\u044f\u0434\u0437\u0435\u043b\u0430\u043a"\ + "\u0430\u045e\u0442\u043e\u0440\u0430\u043a"\ + "\u0441\u0435\u0440\u0430\u0434\u0430"\ + "\u0447\u0430\u0446\u0432\u0435\u0440"\ + "\u043f\u044f\u0442\u043d\u0456\u0446\u0430"\ + "\u0441\u0443\u0431\u043e\u0442\u0430"] + ::msgcat::mcset be MONTHS_ABBREV [list \ + "\u0441\u0442\u0434"\ + "\u043b\u044e\u0442"\ + "\u0441\u043a\u0432"\ + "\u043a\u0440\u0441"\ + "\u043c\u0430\u0439"\ + "\u0447\u0440\u0432"\ + "\u043b\u043f\u043d"\ + "\u0436\u043d\u0432"\ + "\u0432\u0440\u0441"\ + "\u043a\u0441\u0442"\ + "\u043b\u0441\u0442"\ + "\u0441\u043d\u0436"\ + ""] + ::msgcat::mcset be MONTHS_FULL [list \ + "\u0441\u0442\u0443\u0434\u0437\u0435\u043d\u044f"\ + "\u043b\u044e\u0442\u0430\u0433\u0430"\ + "\u0441\u0430\u043a\u0430\u0432\u0456\u043a\u0430"\ + "\u043a\u0440\u0430\u0441\u0430\u0432\u0456\u043a\u0430"\ + "\u043c\u0430\u044f"\ + "\u0447\u0440\u0432\u0435\u043d\u044f"\ + "\u043b\u0456\u043f\u0435\u043d\u044f"\ + "\u0436\u043d\u0456\u045e\u043d\u044f"\ + "\u0432\u0435\u0440\u0430\u0441\u043d\u044f"\ + "\u043a\u0430\u0441\u0442\u0440\u044b\u0447\u043d\u0456\u043a\u0430"\ + "\u043b\u0438\u0441\u0442\u0430\u043f\u0430\u0434\u0430"\ + "\u0441\u043d\u0435\u0436\u043d\u044f"\ + ""] + ::msgcat::mcset be BCE "\u0434\u0430 \u043d.\u0435." + ::msgcat::mcset be CE "\u043d.\u0435." + ::msgcat::mcset be DATE_FORMAT "%e.%m.%Y" + ::msgcat::mcset be TIME_FORMAT "%k.%M.%S" + ::msgcat::mcset be DATE_TIME_FORMAT "%e.%m.%Y %k.%M.%S %z" +} diff --git a/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/bg.msg b/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/bg.msg new file mode 100644 index 0000000000000000000000000000000000000000..ff177590779190f4567ed65be78b51c3e0b8287b --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/bg.msg @@ -0,0 +1,52 @@ +# created by tools/loadICU.tcl -- do not edit +namespace eval ::tcl::clock { + ::msgcat::mcset bg DAYS_OF_WEEK_ABBREV [list \ + "\u041d\u0434"\ + "\u041f\u043d"\ + "\u0412\u0442"\ + "\u0421\u0440"\ + "\u0427\u0442"\ + "\u041f\u0442"\ + "\u0421\u0431"] + ::msgcat::mcset bg DAYS_OF_WEEK_FULL [list \ + "\u041d\u0435\u0434\u0435\u043b\u044f"\ + "\u041f\u043e\u043d\u0435\u0434\u0435\u043b\u043d\u0438\u043a"\ + "\u0412\u0442\u043e\u0440\u043d\u0438\u043a"\ + "\u0421\u0440\u044f\u0434\u0430"\ + "\u0427\u0435\u0442\u0432\u044a\u0440\u0442\u044a\u043a"\ + "\u041f\u0435\u0442\u044a\u043a"\ + "\u0421\u044a\u0431\u043e\u0442\u0430"] + ::msgcat::mcset bg MONTHS_ABBREV [list \ + "I"\ + "II"\ + "III"\ + "IV"\ + "V"\ + "VI"\ + "VII"\ + "VIII"\ + "IX"\ + "X"\ + "XI"\ + "XII"\ + ""] + ::msgcat::mcset bg MONTHS_FULL [list \ + "\u042f\u043d\u0443\u0430\u0440\u0438"\ + "\u0424\u0435\u0432\u0440\u0443\u0430\u0440\u0438"\ + "\u041c\u0430\u0440\u0442"\ + "\u0410\u043f\u0440\u0438\u043b"\ + "\u041c\u0430\u0439"\ + "\u042e\u043d\u0438"\ + "\u042e\u043b\u0438"\ + "\u0410\u0432\u0433\u0443\u0441\u0442"\ + "\u0421\u0435\u043f\u0442\u0435\u043c\u0432\u0440\u0438"\ + "\u041e\u043a\u0442\u043e\u043c\u0432\u0440\u0438"\ + "\u041d\u043e\u0435\u043c\u0432\u0440\u0438"\ + "\u0414\u0435\u043a\u0435\u043c\u0432\u0440\u0438"\ + ""] + ::msgcat::mcset bg BCE "\u043f\u0440.\u043d.\u0435." + ::msgcat::mcset bg CE "\u043d.\u0435." + ::msgcat::mcset bg DATE_FORMAT "%Y-%m-%e" + ::msgcat::mcset bg TIME_FORMAT "%k:%M:%S" + ::msgcat::mcset bg DATE_TIME_FORMAT "%Y-%m-%e %k:%M:%S %z" +} diff --git a/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/bn.msg b/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/bn.msg new file mode 100644 index 0000000000000000000000000000000000000000..664b9d84c05532ad24be7e3ade9f5e6a53a691ea --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/bn.msg @@ -0,0 +1,49 @@ +# created by tools/loadICU.tcl -- do not edit +namespace eval ::tcl::clock { + ::msgcat::mcset bn DAYS_OF_WEEK_ABBREV [list \ + "\u09b0\u09ac\u09bf"\ + "\u09b8\u09cb\u09ae"\ + "\u09ae\u0999\u0997\u09b2"\ + "\u09ac\u09c1\u09a7"\ + "\u09ac\u09c3\u09b9\u09b8\u09cd\u09aa\u09a4\u09bf"\ + "\u09b6\u09c1\u0995\u09cd\u09b0"\ + "\u09b6\u09a8\u09bf"] + ::msgcat::mcset bn DAYS_OF_WEEK_FULL [list \ + "\u09b0\u09ac\u09bf\u09ac\u09be\u09b0"\ + "\u09b8\u09cb\u09ae\u09ac\u09be\u09b0"\ + "\u09ae\u0999\u0997\u09b2\u09ac\u09be\u09b0"\ + "\u09ac\u09c1\u09a7\u09ac\u09be\u09b0"\ + "\u09ac\u09c3\u09b9\u09b8\u09cd\u09aa\u09a4\u09bf\u09ac\u09be\u09b0"\ + "\u09b6\u09c1\u0995\u09cd\u09b0\u09ac\u09be\u09b0"\ + "\u09b6\u09a8\u09bf\u09ac\u09be\u09b0"] + ::msgcat::mcset bn MONTHS_ABBREV [list \ + "\u099c\u09be\u09a8\u09c1\u09df\u09be\u09b0\u09c0"\ + "\u09ab\u09c7\u09ac\u09cd\u09b0\u09c1\u09df\u09be\u09b0\u09c0"\ + "\u09ae\u09be\u09b0\u09cd\u099a"\ + "\u098f\u09aa\u09cd\u09b0\u09bf\u09b2"\ + "\u09ae\u09c7"\ + "\u099c\u09c1\u09a8"\ + "\u099c\u09c1\u09b2\u09be\u0987"\ + "\u0986\u0997\u09b8\u09cd\u099f"\ + "\u09b8\u09c7\u09aa\u09cd\u099f\u09c7\u09ae\u09cd\u09ac\u09b0"\ + "\u0985\u0995\u09cd\u099f\u09cb\u09ac\u09b0"\ + "\u09a8\u09ad\u09c7\u09ae\u09cd\u09ac\u09b0"\ + "\u09a1\u09bf\u09b8\u09c7\u09ae\u09cd\u09ac\u09b0"\ + ""] + ::msgcat::mcset bn MONTHS_FULL [list \ + "\u099c\u09be\u09a8\u09c1\u09df\u09be\u09b0\u09c0"\ + "\u09ab\u09c7\u09ac\u09cd\u09b0\u09c1\u09df\u09be\u09b0\u09c0"\ + "\u09ae\u09be\u09b0\u09cd\u099a"\ + "\u098f\u09aa\u09cd\u09b0\u09bf\u09b2"\ + "\u09ae\u09c7"\ + "\u099c\u09c1\u09a8"\ + "\u099c\u09c1\u09b2\u09be\u0987"\ + "\u0986\u0997\u09b8\u09cd\u099f"\ + "\u09b8\u09c7\u09aa\u09cd\u099f\u09c7\u09ae\u09cd\u09ac\u09b0"\ + "\u0985\u0995\u09cd\u099f\u09cb\u09ac\u09b0"\ + "\u09a8\u09ad\u09c7\u09ae\u09cd\u09ac\u09b0"\ + "\u09a1\u09bf\u09b8\u09c7\u09ae\u09cd\u09ac\u09b0"\ + ""] + ::msgcat::mcset bn AM "\u09aa\u09c2\u09b0\u09cd\u09ac\u09be\u09b9\u09cd\u09a3" + ::msgcat::mcset bn PM "\u0985\u09aa\u09b0\u09be\u09b9\u09cd\u09a3" +} diff --git a/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/bn_in.msg b/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/bn_in.msg new file mode 100644 index 0000000000000000000000000000000000000000..28c000f23595f3da231fefbb1d3b08030abe1e66 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/bn_in.msg @@ -0,0 +1,6 @@ +# created by tools/loadICU.tcl -- do not edit +namespace eval ::tcl::clock { + ::msgcat::mcset bn_IN DATE_FORMAT "%A %d %b %Y" + ::msgcat::mcset bn_IN TIME_FORMAT_12 "%I:%M:%S %z" + ::msgcat::mcset bn_IN DATE_TIME_FORMAT "%A %d %b %Y %I:%M:%S %z %z" +} diff --git a/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/ca.msg b/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/ca.msg new file mode 100644 index 0000000000000000000000000000000000000000..36c977257b7cb2119718216288728067a1749747 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/ca.msg @@ -0,0 +1,50 @@ +# created by tools/loadICU.tcl -- do not edit +namespace eval ::tcl::clock { + ::msgcat::mcset ca DAYS_OF_WEEK_ABBREV [list \ + "dg."\ + "dl."\ + "dt."\ + "dc."\ + "dj."\ + "dv."\ + "ds."] + ::msgcat::mcset ca DAYS_OF_WEEK_FULL [list \ + "diumenge"\ + "dilluns"\ + "dimarts"\ + "dimecres"\ + "dijous"\ + "divendres"\ + "dissabte"] + ::msgcat::mcset ca MONTHS_ABBREV [list \ + "gen."\ + "feb."\ + "mar\u00e7"\ + "abr."\ + "maig"\ + "juny"\ + "jul."\ + "ag."\ + "set."\ + "oct."\ + "nov."\ + "des."\ + ""] + ::msgcat::mcset ca MONTHS_FULL [list \ + "gener"\ + "febrer"\ + "mar\u00e7"\ + "abril"\ + "maig"\ + "juny"\ + "juliol"\ + "agost"\ + "setembre"\ + "octubre"\ + "novembre"\ + "desembre"\ + ""] + ::msgcat::mcset ca DATE_FORMAT "%d/%m/%Y" + ::msgcat::mcset ca TIME_FORMAT "%H:%M:%S" + ::msgcat::mcset ca DATE_TIME_FORMAT "%d/%m/%Y %H:%M:%S %z" +} diff --git a/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/cs.msg b/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/cs.msg new file mode 100644 index 0000000000000000000000000000000000000000..8db8bdd86f6079a48a5f7f15ac9e6923d2a76532 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/cs.msg @@ -0,0 +1,54 @@ +# created by tools/loadICU.tcl -- do not edit +namespace eval ::tcl::clock { + ::msgcat::mcset cs DAYS_OF_WEEK_ABBREV [list \ + "Ne"\ + "Po"\ + "\u00dat"\ + "St"\ + "\u010ct"\ + "P\u00e1"\ + "So"] + ::msgcat::mcset cs DAYS_OF_WEEK_FULL [list \ + "Ned\u011ble"\ + "Pond\u011bl\u00ed"\ + "\u00dater\u00fd"\ + "St\u0159eda"\ + "\u010ctvrtek"\ + "P\u00e1tek"\ + "Sobota"] + ::msgcat::mcset cs MONTHS_ABBREV [list \ + "I"\ + "II"\ + "III"\ + "IV"\ + "V"\ + "VI"\ + "VII"\ + "VIII"\ + "IX"\ + "X"\ + "XI"\ + "XII"\ + ""] + ::msgcat::mcset cs MONTHS_FULL [list \ + "leden"\ + "\u00fanor"\ + "b\u0159ezen"\ + "duben"\ + "kv\u011bten"\ + "\u010derven"\ + "\u010dervenec"\ + "srpen"\ + "z\u00e1\u0159\u00ed"\ + "\u0159\u00edjen"\ + "listopad"\ + "prosinec"\ + ""] + ::msgcat::mcset cs BCE "p\u0159.Kr." + ::msgcat::mcset cs CE "po Kr." + ::msgcat::mcset cs AM "dop." + ::msgcat::mcset cs PM "odp." + ::msgcat::mcset cs DATE_FORMAT "%e.%m.%Y" + ::msgcat::mcset cs TIME_FORMAT "%k:%M:%S" + ::msgcat::mcset cs DATE_TIME_FORMAT "%e.%m.%Y %k:%M:%S %z" +} diff --git a/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/da.msg b/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/da.msg new file mode 100644 index 0000000000000000000000000000000000000000..e4fec7f027b11ffd9078e169fb4cd22416a6879f --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/da.msg @@ -0,0 +1,52 @@ +# created by tools/loadICU.tcl -- do not edit +namespace eval ::tcl::clock { + ::msgcat::mcset da DAYS_OF_WEEK_ABBREV [list \ + "s\u00f8"\ + "ma"\ + "ti"\ + "on"\ + "to"\ + "fr"\ + "l\u00f8"] + ::msgcat::mcset da DAYS_OF_WEEK_FULL [list \ + "s\u00f8ndag"\ + "mandag"\ + "tirsdag"\ + "onsdag"\ + "torsdag"\ + "fredag"\ + "l\u00f8rdag"] + ::msgcat::mcset da MONTHS_ABBREV [list \ + "jan"\ + "feb"\ + "mar"\ + "apr"\ + "maj"\ + "jun"\ + "jul"\ + "aug"\ + "sep"\ + "okt"\ + "nov"\ + "dec"\ + ""] + ::msgcat::mcset da MONTHS_FULL [list \ + "januar"\ + "februar"\ + "marts"\ + "april"\ + "maj"\ + "juni"\ + "juli"\ + "august"\ + "september"\ + "oktober"\ + "november"\ + "december"\ + ""] + ::msgcat::mcset da BCE "f.Kr." + ::msgcat::mcset da CE "e.Kr." + ::msgcat::mcset da DATE_FORMAT "%d-%m-%Y" + ::msgcat::mcset da TIME_FORMAT "%H:%M:%S" + ::msgcat::mcset da DATE_TIME_FORMAT "%d-%m-%Y %H:%M:%S %z" +} diff --git a/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/de.msg b/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/de.msg new file mode 100644 index 0000000000000000000000000000000000000000..9eb31454b5ce32f90f68e6518378c008a662f5f1 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/de.msg @@ -0,0 +1,54 @@ +# created by tools/loadICU.tcl -- do not edit +namespace eval ::tcl::clock { + ::msgcat::mcset de DAYS_OF_WEEK_ABBREV [list \ + "So"\ + "Mo"\ + "Di"\ + "Mi"\ + "Do"\ + "Fr"\ + "Sa"] + ::msgcat::mcset de DAYS_OF_WEEK_FULL [list \ + "Sonntag"\ + "Montag"\ + "Dienstag"\ + "Mittwoch"\ + "Donnerstag"\ + "Freitag"\ + "Samstag"] + ::msgcat::mcset de MONTHS_ABBREV [list \ + "Jan"\ + "Feb"\ + "Mrz"\ + "Apr"\ + "Mai"\ + "Jun"\ + "Jul"\ + "Aug"\ + "Sep"\ + "Okt"\ + "Nov"\ + "Dez"\ + ""] + ::msgcat::mcset de MONTHS_FULL [list \ + "Januar"\ + "Februar"\ + "M\u00e4rz"\ + "April"\ + "Mai"\ + "Juni"\ + "Juli"\ + "August"\ + "September"\ + "Oktober"\ + "November"\ + "Dezember"\ + ""] + ::msgcat::mcset de BCE "v. Chr." + ::msgcat::mcset de CE "n. Chr." + ::msgcat::mcset de AM "vorm." + ::msgcat::mcset de PM "nachm." + ::msgcat::mcset de DATE_FORMAT "%d.%m.%Y" + ::msgcat::mcset de TIME_FORMAT "%H:%M:%S" + ::msgcat::mcset de DATE_TIME_FORMAT "%d.%m.%Y %H:%M:%S %z" +} diff --git a/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/de_at.msg b/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/de_at.msg new file mode 100644 index 0000000000000000000000000000000000000000..61bc266698ca72e52c9ec6ad118ccd52ddb548c2 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/de_at.msg @@ -0,0 +1,35 @@ +# created by tools/loadICU.tcl -- do not edit +namespace eval ::tcl::clock { + ::msgcat::mcset de_AT MONTHS_ABBREV [list \ + "J\u00e4n"\ + "Feb"\ + "M\u00e4r"\ + "Apr"\ + "Mai"\ + "Jun"\ + "Jul"\ + "Aug"\ + "Sep"\ + "Okt"\ + "Nov"\ + "Dez"\ + ""] + ::msgcat::mcset de_AT MONTHS_FULL [list \ + "J\u00e4nner"\ + "Februar"\ + "M\u00e4rz"\ + "April"\ + "Mai"\ + "Juni"\ + "Juli"\ + "August"\ + "September"\ + "Oktober"\ + "November"\ + "Dezember"\ + ""] + ::msgcat::mcset de_AT DATE_FORMAT "%Y-%m-%d" + ::msgcat::mcset de_AT TIME_FORMAT "%T" + ::msgcat::mcset de_AT TIME_FORMAT_12 "%T" + ::msgcat::mcset de_AT DATE_TIME_FORMAT "%a %d %b %Y %T %z" +} diff --git a/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/de_be.msg b/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/de_be.msg new file mode 100644 index 0000000000000000000000000000000000000000..3614763a3c35bf0e54c0dc47ed564f8c1b499ca1 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/de_be.msg @@ -0,0 +1,53 @@ +# created by tools/loadICU.tcl -- do not edit +namespace eval ::tcl::clock { + ::msgcat::mcset de_BE DAYS_OF_WEEK_ABBREV [list \ + "Son"\ + "Mon"\ + "Die"\ + "Mit"\ + "Don"\ + "Fre"\ + "Sam"] + ::msgcat::mcset de_BE DAYS_OF_WEEK_FULL [list \ + "Sonntag"\ + "Montag"\ + "Dienstag"\ + "Mittwoch"\ + "Donnerstag"\ + "Freitag"\ + "Samstag"] + ::msgcat::mcset de_BE MONTHS_ABBREV [list \ + "Jan"\ + "Feb"\ + "M\u00e4r"\ + "Apr"\ + "Mai"\ + "Jun"\ + "Jul"\ + "Aug"\ + "Sep"\ + "Okt"\ + "Nov"\ + "Dez"\ + ""] + ::msgcat::mcset de_BE MONTHS_FULL [list \ + "Januar"\ + "Februar"\ + "M\u00e4rz"\ + "April"\ + "Mai"\ + "Juni"\ + "Juli"\ + "August"\ + "September"\ + "Oktober"\ + "November"\ + "Dezember"\ + ""] + ::msgcat::mcset de_BE AM "vorm" + ::msgcat::mcset de_BE PM "nachm" + ::msgcat::mcset de_BE DATE_FORMAT "%Y-%m-%d" + ::msgcat::mcset de_BE TIME_FORMAT "%T" + ::msgcat::mcset de_BE TIME_FORMAT_12 "%T" + ::msgcat::mcset de_BE DATE_TIME_FORMAT "%a %d %b %Y %T %z" +} diff --git a/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/el.msg b/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/el.msg new file mode 100644 index 0000000000000000000000000000000000000000..ac19f62def15335167aa126a5bd6650c4bedd1ca --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/el.msg @@ -0,0 +1,52 @@ +# created by tools/loadICU.tcl -- do not edit +namespace eval ::tcl::clock { + ::msgcat::mcset el DAYS_OF_WEEK_ABBREV [list \ + "\u039a\u03c5\u03c1"\ + "\u0394\u03b5\u03c5"\ + "\u03a4\u03c1\u03b9"\ + "\u03a4\u03b5\u03c4"\ + "\u03a0\u03b5\u03bc"\ + "\u03a0\u03b1\u03c1"\ + "\u03a3\u03b1\u03b2"] + ::msgcat::mcset el DAYS_OF_WEEK_FULL [list \ + "\u039a\u03c5\u03c1\u03b9\u03b1\u03ba\u03ae"\ + "\u0394\u03b5\u03c5\u03c4\u03ad\u03c1\u03b1"\ + "\u03a4\u03c1\u03af\u03c4\u03b7"\ + "\u03a4\u03b5\u03c4\u03ac\u03c1\u03c4\u03b7"\ + "\u03a0\u03ad\u03bc\u03c0\u03c4\u03b7"\ + "\u03a0\u03b1\u03c1\u03b1\u03c3\u03ba\u03b5\u03c5\u03ae"\ + "\u03a3\u03ac\u03b2\u03b2\u03b1\u03c4\u03bf"] + ::msgcat::mcset el MONTHS_ABBREV [list \ + "\u0399\u03b1\u03bd"\ + "\u03a6\u03b5\u03b2"\ + "\u039c\u03b1\u03c1"\ + "\u0391\u03c0\u03c1"\ + "\u039c\u03b1\u03ca"\ + "\u0399\u03bf\u03c5\u03bd"\ + "\u0399\u03bf\u03c5\u03bb"\ + "\u0391\u03c5\u03b3"\ + "\u03a3\u03b5\u03c0"\ + "\u039f\u03ba\u03c4"\ + "\u039d\u03bf\u03b5"\ + "\u0394\u03b5\u03ba"\ + ""] + ::msgcat::mcset el MONTHS_FULL [list \ + "\u0399\u03b1\u03bd\u03bf\u03c5\u03ac\u03c1\u03b9\u03bf\u03c2"\ + "\u03a6\u03b5\u03b2\u03c1\u03bf\u03c5\u03ac\u03c1\u03b9\u03bf\u03c2"\ + "\u039c\u03ac\u03c1\u03c4\u03b9\u03bf\u03c2"\ + "\u0391\u03c0\u03c1\u03af\u03bb\u03b9\u03bf\u03c2"\ + "\u039c\u03ac\u03ca\u03bf\u03c2"\ + "\u0399\u03bf\u03cd\u03bd\u03b9\u03bf\u03c2"\ + "\u0399\u03bf\u03cd\u03bb\u03b9\u03bf\u03c2"\ + "\u0391\u03cd\u03b3\u03bf\u03c5\u03c3\u03c4\u03bf\u03c2"\ + "\u03a3\u03b5\u03c0\u03c4\u03ad\u03bc\u03b2\u03c1\u03b9\u03bf\u03c2"\ + "\u039f\u03ba\u03c4\u03ce\u03b2\u03c1\u03b9\u03bf\u03c2"\ + "\u039d\u03bf\u03ad\u03bc\u03b2\u03c1\u03b9\u03bf\u03c2"\ + "\u0394\u03b5\u03ba\u03ad\u03bc\u03b2\u03c1\u03b9\u03bf\u03c2"\ + ""] + ::msgcat::mcset el AM "\u03c0\u03bc" + ::msgcat::mcset el PM "\u03bc\u03bc" + ::msgcat::mcset el DATE_FORMAT "%e/%m/%Y" + ::msgcat::mcset el TIME_FORMAT_12 "%l:%M:%S %P" + ::msgcat::mcset el DATE_TIME_FORMAT "%e/%m/%Y %l:%M:%S %P %z" +} diff --git a/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/en_au.msg b/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/en_au.msg new file mode 100644 index 0000000000000000000000000000000000000000..7f9870c924cf9590a720d790b1e14faceb66a56a --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/en_au.msg @@ -0,0 +1,7 @@ +# created by tools/loadICU.tcl -- do not edit +namespace eval ::tcl::clock { + ::msgcat::mcset en_AU DATE_FORMAT "%e/%m/%Y" + ::msgcat::mcset en_AU TIME_FORMAT "%H:%M:%S" + ::msgcat::mcset en_AU TIME_FORMAT_12 "%I:%M:%S %P %z" + ::msgcat::mcset en_AU DATE_TIME_FORMAT "%e/%m/%Y %H:%M:%S %z" +} diff --git a/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/en_be.msg b/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/en_be.msg new file mode 100644 index 0000000000000000000000000000000000000000..5072986dc0f6aef8dd680563f778ef1017252e97 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/en_be.msg @@ -0,0 +1,7 @@ +# created by tools/loadICU.tcl -- do not edit +namespace eval ::tcl::clock { + ::msgcat::mcset en_BE DATE_FORMAT "%d %b %Y" + ::msgcat::mcset en_BE TIME_FORMAT "%k:%M:%S" + ::msgcat::mcset en_BE TIME_FORMAT_12 "%k h %M min %S s %z" + ::msgcat::mcset en_BE DATE_TIME_FORMAT "%d %b %Y %k:%M:%S %z" +} diff --git a/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/en_bw.msg b/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/en_bw.msg new file mode 100644 index 0000000000000000000000000000000000000000..8fd20c7e3a8dff031501a2ded266f7c20b5d344e --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/en_bw.msg @@ -0,0 +1,6 @@ +# created by tools/loadICU.tcl -- do not edit +namespace eval ::tcl::clock { + ::msgcat::mcset en_BW DATE_FORMAT "%d %B %Y" + ::msgcat::mcset en_BW TIME_FORMAT_12 "%l:%M:%S %P" + ::msgcat::mcset en_BW DATE_TIME_FORMAT "%d %B %Y %l:%M:%S %P %z" +} diff --git a/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/en_ca.msg b/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/en_ca.msg new file mode 100644 index 0000000000000000000000000000000000000000..278efe717f6f06836741592396256337a0322fd7 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/en_ca.msg @@ -0,0 +1,7 @@ +# created by tools/loadICU.tcl -- do not edit +namespace eval ::tcl::clock { + ::msgcat::mcset en_CA DATE_FORMAT "%d/%m/%y" + ::msgcat::mcset en_CA TIME_FORMAT "%r" + ::msgcat::mcset en_CA TIME_FORMAT_12 "%I:%M:%S %p" + ::msgcat::mcset en_CA DATE_TIME_FORMAT "%a %d %b %Y %r %z" +} diff --git a/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/en_gb.msg b/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/en_gb.msg new file mode 100644 index 0000000000000000000000000000000000000000..5c61c43c6e180d379e44e3a10d45b64b782e8bfc --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/en_gb.msg @@ -0,0 +1,7 @@ +# created by tools/loadICU.tcl -- do not edit +namespace eval ::tcl::clock { + ::msgcat::mcset en_GB DATE_FORMAT "%d/%m/%y" + ::msgcat::mcset en_GB TIME_FORMAT "%T" + ::msgcat::mcset en_GB TIME_FORMAT_12 "%T" + ::msgcat::mcset en_GB DATE_TIME_FORMAT "%a %d %b %Y %T %z" +} diff --git a/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/en_hk.msg b/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/en_hk.msg new file mode 100644 index 0000000000000000000000000000000000000000..8b33bc067ad99e738745ba9d9bf29e25d94205bd --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/en_hk.msg @@ -0,0 +1,8 @@ +# created by tools/loadICU.tcl -- do not edit +namespace eval ::tcl::clock { + ::msgcat::mcset en_HK AM "AM" + ::msgcat::mcset en_HK PM "PM" + ::msgcat::mcset en_HK DATE_FORMAT "%B %e, %Y" + ::msgcat::mcset en_HK TIME_FORMAT_12 "%l:%M:%S %P" + ::msgcat::mcset en_HK DATE_TIME_FORMAT "%B %e, %Y %l:%M:%S %P %z" +} diff --git a/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/en_ie.msg b/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/en_ie.msg new file mode 100644 index 0000000000000000000000000000000000000000..ba621cf2c819eafd3909e90afc0e7f240f9e4234 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/en_ie.msg @@ -0,0 +1,7 @@ +# created by tools/loadICU.tcl -- do not edit +namespace eval ::tcl::clock { + ::msgcat::mcset en_IE DATE_FORMAT "%d/%m/%y" + ::msgcat::mcset en_IE TIME_FORMAT "%T" + ::msgcat::mcset en_IE TIME_FORMAT_12 "%T" + ::msgcat::mcset en_IE DATE_TIME_FORMAT "%a %d %b %Y %T %z" +} diff --git a/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/en_in.msg b/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/en_in.msg new file mode 100644 index 0000000000000000000000000000000000000000..a1f155d2c58101bc3f4551e8c14cc7ab6931a62f --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/en_in.msg @@ -0,0 +1,8 @@ +# created by tools/loadICU.tcl -- do not edit +namespace eval ::tcl::clock { + ::msgcat::mcset en_IN AM "AM" + ::msgcat::mcset en_IN PM "PM" + ::msgcat::mcset en_IN DATE_FORMAT "%d %B %Y" + ::msgcat::mcset en_IN TIME_FORMAT "%H:%M:%S" + ::msgcat::mcset en_IN DATE_TIME_FORMAT "%d %B %Y %H:%M:%S %z" +} diff --git a/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/en_nz.msg b/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/en_nz.msg new file mode 100644 index 0000000000000000000000000000000000000000..b419017a91d9e3db7435c34a68bd54a224454bf9 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/en_nz.msg @@ -0,0 +1,7 @@ +# created by tools/loadICU.tcl -- do not edit +namespace eval ::tcl::clock { + ::msgcat::mcset en_NZ DATE_FORMAT "%e/%m/%Y" + ::msgcat::mcset en_NZ TIME_FORMAT "%H:%M:%S" + ::msgcat::mcset en_NZ TIME_FORMAT_12 "%I:%M:%S %P %z" + ::msgcat::mcset en_NZ DATE_TIME_FORMAT "%e/%m/%Y %H:%M:%S %z" +} diff --git a/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/en_ph.msg b/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/en_ph.msg new file mode 100644 index 0000000000000000000000000000000000000000..682666d5a6354a89683b50f1b7d8be282b56fc3b --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/en_ph.msg @@ -0,0 +1,8 @@ +# created by tools/loadICU.tcl -- do not edit +namespace eval ::tcl::clock { + ::msgcat::mcset en_PH AM "AM" + ::msgcat::mcset en_PH PM "PM" + ::msgcat::mcset en_PH DATE_FORMAT "%B %e, %Y" + ::msgcat::mcset en_PH TIME_FORMAT_12 "%l:%M:%S %P" + ::msgcat::mcset en_PH DATE_TIME_FORMAT "%B %e, %Y %l:%M:%S %P %z" +} diff --git a/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/en_sg.msg b/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/en_sg.msg new file mode 100644 index 0000000000000000000000000000000000000000..4dc5b1d379fc8183c2f544f87edecd2fff594011 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/en_sg.msg @@ -0,0 +1,6 @@ +# created by tools/loadICU.tcl -- do not edit +namespace eval ::tcl::clock { + ::msgcat::mcset en_SG DATE_FORMAT "%d %b %Y" + ::msgcat::mcset en_SG TIME_FORMAT_12 "%P %I:%M:%S" + ::msgcat::mcset en_SG DATE_TIME_FORMAT "%d %b %Y %P %I:%M:%S %z" +} diff --git a/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/en_za.msg b/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/en_za.msg new file mode 100644 index 0000000000000000000000000000000000000000..fe43797fda976a1328445a338fe7deab323d647f --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/en_za.msg @@ -0,0 +1,6 @@ +# created by tools/loadICU.tcl -- do not edit +namespace eval ::tcl::clock { + ::msgcat::mcset en_ZA DATE_FORMAT "%Y/%m/%d" + ::msgcat::mcset en_ZA TIME_FORMAT_12 "%I:%M:%S" + ::msgcat::mcset en_ZA DATE_TIME_FORMAT "%Y/%m/%d %I:%M:%S %z" +} diff --git a/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/en_zw.msg b/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/en_zw.msg new file mode 100644 index 0000000000000000000000000000000000000000..2a5804fa7f13608b94b0725efc619435736552fc --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/en_zw.msg @@ -0,0 +1,6 @@ +# created by tools/loadICU.tcl -- do not edit +namespace eval ::tcl::clock { + ::msgcat::mcset en_ZW DATE_FORMAT "%d %B %Y" + ::msgcat::mcset en_ZW TIME_FORMAT_12 "%l:%M:%S %P" + ::msgcat::mcset en_ZW DATE_TIME_FORMAT "%d %B %Y %l:%M:%S %P %z" +} diff --git a/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/eo.msg b/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/eo.msg new file mode 100644 index 0000000000000000000000000000000000000000..1d2a24fece6b010f0020fb9b814ac9ab1ae07445 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/eo.msg @@ -0,0 +1,54 @@ +# created by tools/loadICU.tcl -- do not edit +namespace eval ::tcl::clock { + ::msgcat::mcset eo DAYS_OF_WEEK_ABBREV [list \ + "di"\ + "lu"\ + "ma"\ + "me"\ + "\u0135a"\ + "ve"\ + "sa"] + ::msgcat::mcset eo DAYS_OF_WEEK_FULL [list \ + "diman\u0109o"\ + "lundo"\ + "mardo"\ + "merkredo"\ + "\u0135a\u016ddo"\ + "vendredo"\ + "sabato"] + ::msgcat::mcset eo MONTHS_ABBREV [list \ + "jan"\ + "feb"\ + "mar"\ + "apr"\ + "maj"\ + "jun"\ + "jul"\ + "a\u016dg"\ + "sep"\ + "okt"\ + "nov"\ + "dec"\ + ""] + ::msgcat::mcset eo MONTHS_FULL [list \ + "januaro"\ + "februaro"\ + "marto"\ + "aprilo"\ + "majo"\ + "junio"\ + "julio"\ + "a\u016dgusto"\ + "septembro"\ + "oktobro"\ + "novembro"\ + "decembro"\ + ""] + ::msgcat::mcset eo BCE "aK" + ::msgcat::mcset eo CE "pK" + ::msgcat::mcset eo AM "atm" + ::msgcat::mcset eo PM "ptm" + ::msgcat::mcset eo DATE_FORMAT "%Y-%b-%d" + ::msgcat::mcset eo TIME_FORMAT "%H:%M:%S" + ::msgcat::mcset eo DATE_TIME_FORMAT "%Y-%b-%d %H:%M:%S %z" +} diff --git a/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/es.msg b/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/es.msg new file mode 100644 index 0000000000000000000000000000000000000000..a24f0a1bb2aa78a8f35360b5e0d61192485a8657 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/es.msg @@ -0,0 +1,52 @@ +# created by tools/loadICU.tcl -- do not edit +namespace eval ::tcl::clock { + ::msgcat::mcset es DAYS_OF_WEEK_ABBREV [list \ + "dom"\ + "lun"\ + "mar"\ + "mi\u00e9"\ + "jue"\ + "vie"\ + "s\u00e1b"] + ::msgcat::mcset es DAYS_OF_WEEK_FULL [list \ + "domingo"\ + "lunes"\ + "martes"\ + "mi\u00e9rcoles"\ + "jueves"\ + "viernes"\ + "s\u00e1bado"] + ::msgcat::mcset es MONTHS_ABBREV [list \ + "ene"\ + "feb"\ + "mar"\ + "abr"\ + "may"\ + "jun"\ + "jul"\ + "ago"\ + "sep"\ + "oct"\ + "nov"\ + "dic"\ + ""] + ::msgcat::mcset es MONTHS_FULL [list \ + "enero"\ + "febrero"\ + "marzo"\ + "abril"\ + "mayo"\ + "junio"\ + "julio"\ + "agosto"\ + "septiembre"\ + "octubre"\ + "noviembre"\ + "diciembre"\ + ""] + ::msgcat::mcset es BCE "a.C." + ::msgcat::mcset es CE "d.C." + ::msgcat::mcset es DATE_FORMAT "%e de %B de %Y" + ::msgcat::mcset es TIME_FORMAT "%k:%M:%S" + ::msgcat::mcset es DATE_TIME_FORMAT "%e de %B de %Y %k:%M:%S %z" +} diff --git a/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/es_ar.msg b/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/es_ar.msg new file mode 100644 index 0000000000000000000000000000000000000000..7d350274ec27838924cf024bd097361386ef4719 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/es_ar.msg @@ -0,0 +1,6 @@ +# created by tools/loadICU.tcl -- do not edit +namespace eval ::tcl::clock { + ::msgcat::mcset es_AR DATE_FORMAT "%d/%m/%Y" + ::msgcat::mcset es_AR TIME_FORMAT "%H:%M:%S" + ::msgcat::mcset es_AR DATE_TIME_FORMAT "%d/%m/%Y %H:%M:%S %z" +} diff --git a/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/es_bo.msg b/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/es_bo.msg new file mode 100644 index 0000000000000000000000000000000000000000..498ad0d14f2ea7a9d9708803d35559ad937a0dac --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/es_bo.msg @@ -0,0 +1,6 @@ +# created by tools/loadICU.tcl -- do not edit +namespace eval ::tcl::clock { + ::msgcat::mcset es_BO DATE_FORMAT "%d-%m-%Y" + ::msgcat::mcset es_BO TIME_FORMAT_12 "%I:%M:%S %P" + ::msgcat::mcset es_BO DATE_TIME_FORMAT "%d-%m-%Y %I:%M:%S %P %z" +} diff --git a/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/es_cl.msg b/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/es_cl.msg new file mode 100644 index 0000000000000000000000000000000000000000..31d465c99720177b13a1aac133856ac2f8fd1cf4 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/es_cl.msg @@ -0,0 +1,6 @@ +# created by tools/loadICU.tcl -- do not edit +namespace eval ::tcl::clock { + ::msgcat::mcset es_CL DATE_FORMAT "%d-%m-%Y" + ::msgcat::mcset es_CL TIME_FORMAT_12 "%I:%M:%S %P" + ::msgcat::mcset es_CL DATE_TIME_FORMAT "%d-%m-%Y %I:%M:%S %P %z" +} diff --git a/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/es_co.msg b/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/es_co.msg new file mode 100644 index 0000000000000000000000000000000000000000..77e57f0be7bee914212540dff7d44ab77cb5f937 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/es_co.msg @@ -0,0 +1,6 @@ +# created by tools/loadICU.tcl -- do not edit +namespace eval ::tcl::clock { + ::msgcat::mcset es_CO DATE_FORMAT "%e/%m/%Y" + ::msgcat::mcset es_CO TIME_FORMAT_12 "%I:%M:%S %P" + ::msgcat::mcset es_CO DATE_TIME_FORMAT "%e/%m/%Y %I:%M:%S %P %z" +} diff --git a/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/es_cr.msg b/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/es_cr.msg new file mode 100644 index 0000000000000000000000000000000000000000..7a652fa41532077db2525999d8ec16d3b858896a --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/es_cr.msg @@ -0,0 +1,6 @@ +# created by tools/loadICU.tcl -- do not edit +namespace eval ::tcl::clock { + ::msgcat::mcset es_CR DATE_FORMAT "%d/%m/%Y" + ::msgcat::mcset es_CR TIME_FORMAT_12 "%I:%M:%S %P" + ::msgcat::mcset es_CR DATE_TIME_FORMAT "%d/%m/%Y %I:%M:%S %P %z" +} diff --git a/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/es_do.msg b/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/es_do.msg new file mode 100644 index 0000000000000000000000000000000000000000..0e283da84744a0fac4250b580bf325c42ceba0d8 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/es_do.msg @@ -0,0 +1,6 @@ +# created by tools/loadICU.tcl -- do not edit +namespace eval ::tcl::clock { + ::msgcat::mcset es_DO DATE_FORMAT "%m/%d/%Y" + ::msgcat::mcset es_DO TIME_FORMAT_12 "%I:%M:%S %P" + ::msgcat::mcset es_DO DATE_TIME_FORMAT "%m/%d/%Y %I:%M:%S %P %z" +} diff --git a/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/es_ec.msg b/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/es_ec.msg new file mode 100644 index 0000000000000000000000000000000000000000..9e921e02eef6c3656be7be6f3f0c6b1d130065f3 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/es_ec.msg @@ -0,0 +1,6 @@ +# created by tools/loadICU.tcl -- do not edit +namespace eval ::tcl::clock { + ::msgcat::mcset es_EC DATE_FORMAT "%d/%m/%Y" + ::msgcat::mcset es_EC TIME_FORMAT_12 "%I:%M:%S %P" + ::msgcat::mcset es_EC DATE_TIME_FORMAT "%d/%m/%Y %I:%M:%S %P %z" +} diff --git a/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/es_gt.msg b/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/es_gt.msg new file mode 100644 index 0000000000000000000000000000000000000000..ecd6faf9191c9eb348e8e620a8b264c32e1a25d8 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/es_gt.msg @@ -0,0 +1,6 @@ +# created by tools/loadICU.tcl -- do not edit +namespace eval ::tcl::clock { + ::msgcat::mcset es_GT DATE_FORMAT "%e/%m/%Y" + ::msgcat::mcset es_GT TIME_FORMAT_12 "%I:%M:%S %P" + ::msgcat::mcset es_GT DATE_TIME_FORMAT "%e/%m/%Y %I:%M:%S %P %z" +} diff --git a/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/es_hn.msg b/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/es_hn.msg new file mode 100644 index 0000000000000000000000000000000000000000..a758ca2b6118c92384333f7beb6513939672e81e --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/es_hn.msg @@ -0,0 +1,6 @@ +# created by tools/loadICU.tcl -- do not edit +namespace eval ::tcl::clock { + ::msgcat::mcset es_HN DATE_FORMAT "%m-%d-%Y" + ::msgcat::mcset es_HN TIME_FORMAT_12 "%I:%M:%S %P" + ::msgcat::mcset es_HN DATE_TIME_FORMAT "%m-%d-%Y %I:%M:%S %P %z" +} diff --git a/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/es_mx.msg b/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/es_mx.msg new file mode 100644 index 0000000000000000000000000000000000000000..7cfb545b2510013caf703a7914c827112aed49c5 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/es_mx.msg @@ -0,0 +1,6 @@ +# created by tools/loadICU.tcl -- do not edit +namespace eval ::tcl::clock { + ::msgcat::mcset es_MX DATE_FORMAT "%e/%m/%Y" + ::msgcat::mcset es_MX TIME_FORMAT_12 "%I:%M:%S %P" + ::msgcat::mcset es_MX DATE_TIME_FORMAT "%e/%m/%Y %I:%M:%S %P %z" +} diff --git a/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/es_ni.msg b/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/es_ni.msg new file mode 100644 index 0000000000000000000000000000000000000000..7c394953a3d069ae78355c632ae28a25fbf111d2 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/es_ni.msg @@ -0,0 +1,6 @@ +# created by tools/loadICU.tcl -- do not edit +namespace eval ::tcl::clock { + ::msgcat::mcset es_NI DATE_FORMAT "%m-%d-%Y" + ::msgcat::mcset es_NI TIME_FORMAT_12 "%I:%M:%S %P" + ::msgcat::mcset es_NI DATE_TIME_FORMAT "%m-%d-%Y %I:%M:%S %P %z" +} diff --git a/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/es_pa.msg b/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/es_pa.msg new file mode 100644 index 0000000000000000000000000000000000000000..cecacdce095cd64cb5f7c131da19ee303e9cdb9d --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/es_pa.msg @@ -0,0 +1,6 @@ +# created by tools/loadICU.tcl -- do not edit +namespace eval ::tcl::clock { + ::msgcat::mcset es_PA DATE_FORMAT "%m/%d/%Y" + ::msgcat::mcset es_PA TIME_FORMAT_12 "%I:%M:%S %P" + ::msgcat::mcset es_PA DATE_TIME_FORMAT "%m/%d/%Y %I:%M:%S %P %z" +} diff --git a/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/es_pe.msg b/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/es_pe.msg new file mode 100644 index 0000000000000000000000000000000000000000..9f90595fce588d0b1e55fd7bf44cf4ebc90c2549 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/es_pe.msg @@ -0,0 +1,6 @@ +# created by tools/loadICU.tcl -- do not edit +namespace eval ::tcl::clock { + ::msgcat::mcset es_PE DATE_FORMAT "%d/%m/%Y" + ::msgcat::mcset es_PE TIME_FORMAT_12 "%I:%M:%S %P" + ::msgcat::mcset es_PE DATE_TIME_FORMAT "%d/%m/%Y %I:%M:%S %P %z" +} diff --git a/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/es_pr.msg b/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/es_pr.msg new file mode 100644 index 0000000000000000000000000000000000000000..8511b126ed0be24c044315366f7c75b87aa70f36 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/es_pr.msg @@ -0,0 +1,6 @@ +# created by tools/loadICU.tcl -- do not edit +namespace eval ::tcl::clock { + ::msgcat::mcset es_PR DATE_FORMAT "%m-%d-%Y" + ::msgcat::mcset es_PR TIME_FORMAT_12 "%I:%M:%S %P" + ::msgcat::mcset es_PR DATE_TIME_FORMAT "%m-%d-%Y %I:%M:%S %P %z" +} diff --git a/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/es_py.msg b/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/es_py.msg new file mode 100644 index 0000000000000000000000000000000000000000..aa93d36b013409b4d3f570c82d48bd255ea4a977 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/es_py.msg @@ -0,0 +1,6 @@ +# created by tools/loadICU.tcl -- do not edit +namespace eval ::tcl::clock { + ::msgcat::mcset es_PY DATE_FORMAT "%d/%m/%Y" + ::msgcat::mcset es_PY TIME_FORMAT_12 "%I:%M:%S %P" + ::msgcat::mcset es_PY DATE_TIME_FORMAT "%d/%m/%Y %I:%M:%S %P %z" +} diff --git a/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/es_sv.msg b/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/es_sv.msg new file mode 100644 index 0000000000000000000000000000000000000000..fc7954d6a5df82779ca4d64d4b881666e1f2bfba --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/es_sv.msg @@ -0,0 +1,6 @@ +# created by tools/loadICU.tcl -- do not edit +namespace eval ::tcl::clock { + ::msgcat::mcset es_SV DATE_FORMAT "%m-%d-%Y" + ::msgcat::mcset es_SV TIME_FORMAT_12 "%I:%M:%S %P" + ::msgcat::mcset es_SV DATE_TIME_FORMAT "%m-%d-%Y %I:%M:%S %P %z" +} diff --git a/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/es_uy.msg b/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/es_uy.msg new file mode 100644 index 0000000000000000000000000000000000000000..b33525c0bd768c67ffe986839c45f3cc92a092a9 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/es_uy.msg @@ -0,0 +1,6 @@ +# created by tools/loadICU.tcl -- do not edit +namespace eval ::tcl::clock { + ::msgcat::mcset es_UY DATE_FORMAT "%d/%m/%Y" + ::msgcat::mcset es_UY TIME_FORMAT_12 "%I:%M:%S %P" + ::msgcat::mcset es_UY DATE_TIME_FORMAT "%d/%m/%Y %I:%M:%S %P %z" +} diff --git a/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/es_ve.msg b/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/es_ve.msg new file mode 100644 index 0000000000000000000000000000000000000000..7c2a7b0a55e0cb0207159a2bc6852d76f21ae8eb --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/es_ve.msg @@ -0,0 +1,6 @@ +# created by tools/loadICU.tcl -- do not edit +namespace eval ::tcl::clock { + ::msgcat::mcset es_VE DATE_FORMAT "%d/%m/%Y" + ::msgcat::mcset es_VE TIME_FORMAT_12 "%I:%M:%S %P" + ::msgcat::mcset es_VE DATE_TIME_FORMAT "%d/%m/%Y %I:%M:%S %P %z" +} diff --git a/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/et.msg b/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/et.msg new file mode 100644 index 0000000000000000000000000000000000000000..8d32e9e5ecfbd24e0b60376433c492c6fef31a1d --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/et.msg @@ -0,0 +1,52 @@ +# created by tools/loadICU.tcl -- do not edit +namespace eval ::tcl::clock { + ::msgcat::mcset et DAYS_OF_WEEK_ABBREV [list \ + "P"\ + "E"\ + "T"\ + "K"\ + "N"\ + "R"\ + "L"] + ::msgcat::mcset et DAYS_OF_WEEK_FULL [list \ + "p\u00fchap\u00e4ev"\ + "esmasp\u00e4ev"\ + "teisip\u00e4ev"\ + "kolmap\u00e4ev"\ + "neljap\u00e4ev"\ + "reede"\ + "laup\u00e4ev"] + ::msgcat::mcset et MONTHS_ABBREV [list \ + "Jaan"\ + "Veebr"\ + "M\u00e4rts"\ + "Apr"\ + "Mai"\ + "Juuni"\ + "Juuli"\ + "Aug"\ + "Sept"\ + "Okt"\ + "Nov"\ + "Dets"\ + ""] + ::msgcat::mcset et MONTHS_FULL [list \ + "Jaanuar"\ + "Veebruar"\ + "M\u00e4rts"\ + "Aprill"\ + "Mai"\ + "Juuni"\ + "Juuli"\ + "August"\ + "September"\ + "Oktoober"\ + "November"\ + "Detsember"\ + ""] + ::msgcat::mcset et BCE "e.m.a." + ::msgcat::mcset et CE "m.a.j." + ::msgcat::mcset et DATE_FORMAT "%e-%m-%Y" + ::msgcat::mcset et TIME_FORMAT "%k:%M:%S" + ::msgcat::mcset et DATE_TIME_FORMAT "%e-%m-%Y %k:%M:%S %z" +} diff --git a/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/eu.msg b/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/eu.msg new file mode 100644 index 0000000000000000000000000000000000000000..cf708b6b20cf2b6b8d2f716afa5b62f9c62ceeba --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/eu.msg @@ -0,0 +1,47 @@ +# created by tools/loadICU.tcl -- do not edit +namespace eval ::tcl::clock { + ::msgcat::mcset eu DAYS_OF_WEEK_ABBREV [list \ + "igandea"\ + "astelehena"\ + "asteartea"\ + "asteazkena"\ + "osteguna"\ + "ostirala"\ + "larunbata"] + ::msgcat::mcset eu DAYS_OF_WEEK_FULL [list \ + "igandea"\ + "astelehena"\ + "asteartea"\ + "asteazkena"\ + "osteguna"\ + "ostirala"\ + "larunbata"] + ::msgcat::mcset eu MONTHS_ABBREV [list \ + "urt"\ + "ots"\ + "mar"\ + "api"\ + "mai"\ + "eka"\ + "uzt"\ + "abu"\ + "ira"\ + "urr"\ + "aza"\ + "abe"\ + ""] + ::msgcat::mcset eu MONTHS_FULL [list \ + "urtarrila"\ + "otsaila"\ + "martxoa"\ + "apirila"\ + "maiatza"\ + "ekaina"\ + "uztaila"\ + "abuztua"\ + "iraila"\ + "urria"\ + "azaroa"\ + "abendua"\ + ""] +} diff --git a/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/eu_es.msg b/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/eu_es.msg new file mode 100644 index 0000000000000000000000000000000000000000..2694418d3cb2acc40d6b3b38f70ae98f26d948c2 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/eu_es.msg @@ -0,0 +1,7 @@ +# created by tools/loadICU.tcl -- do not edit +namespace eval ::tcl::clock { + ::msgcat::mcset eu_ES DATE_FORMAT "%a, %Yeko %bren %da" + ::msgcat::mcset eu_ES TIME_FORMAT "%T" + ::msgcat::mcset eu_ES TIME_FORMAT_12 "%T" + ::msgcat::mcset eu_ES DATE_TIME_FORMAT "%y-%m-%d %T %z" +} diff --git a/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/fa.msg b/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/fa.msg new file mode 100644 index 0000000000000000000000000000000000000000..89b2f90894a4336f0f5cc15365b08e3a07539a20 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/fa.msg @@ -0,0 +1,47 @@ +# created by tools/loadICU.tcl -- do not edit +namespace eval ::tcl::clock { + ::msgcat::mcset fa DAYS_OF_WEEK_ABBREV [list \ + "\u06cc\u2214"\ + "\u062f\u2214"\ + "\u0633\u2214"\ + "\u0686\u2214"\ + "\u067e\u2214"\ + "\u062c\u2214"\ + "\u0634\u2214"] + ::msgcat::mcset fa DAYS_OF_WEEK_FULL [list \ + "\u06cc\u06cc\u200c\u0634\u0646\u0628\u0647"\ + "\u062f\u0648\u0634\u0646\u0628\u0647"\ + "\u0633\u0647\u200c\u0634\u0646\u0628\u0647"\ + "\u0686\u0647\u0627\u0631\u0634\u0646\u0628\u0647"\ + "\u067e\u0646\u062c\u200c\u0634\u0646\u0628\u0647"\ + "\u062c\u0645\u0639\u0647"\ + "\u0634\u0646\u0628\u0647"] + ::msgcat::mcset fa MONTHS_ABBREV [list \ + "\u0698\u0627\u0646"\ + "\u0641\u0648\u0631"\ + "\u0645\u0627\u0631"\ + "\u0622\u0648\u0631"\ + "\u0645\u0640\u0647"\ + "\u0698\u0648\u0646"\ + "\u0698\u0648\u06cc"\ + "\u0627\u0648\u062a"\ + "\u0633\u067e\u062a"\ + "\u0627\u0643\u062a"\ + "\u0646\u0648\u0627"\ + "\u062f\u0633\u0627"\ + ""] + ::msgcat::mcset fa MONTHS_FULL [list \ + "\u0698\u0627\u0646\u0648\u06cc\u0647"\ + "\u0641\u0648\u0631\u0648\u06cc\u0647"\ + "\u0645\u0627\u0631\u0633"\ + "\u0622\u0648\u0631\u06cc\u0644"\ + "\u0645\u0647"\ + "\u0698\u0648\u0626\u0646"\ + "\u0698\u0648\u0626\u06cc\u0647"\ + "\u0627\u0648\u062a"\ + "\u0633\u067e\u062a\u0627\u0645\u0628\u0631"\ + "\u0627\u0643\u062a\u0628\u0631"\ + "\u0646\u0648\u0627\u0645\u0628\u0631"\ + "\u062f\u0633\u0627\u0645\u0628\u0631"\ + ""] +} diff --git a/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/fa_in.msg b/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/fa_in.msg new file mode 100644 index 0000000000000000000000000000000000000000..adc9e91d370bb85b0141bedf05e35e98b43f9ad6 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/fa_in.msg @@ -0,0 +1,52 @@ +# created by tools/loadICU.tcl -- do not edit +namespace eval ::tcl::clock { + ::msgcat::mcset fa_IN DAYS_OF_WEEK_ABBREV [list \ + "\u06cc\u2214"\ + "\u062f\u2214"\ + "\u0633\u2214"\ + "\u0686\u2214"\ + "\u067e\u2214"\ + "\u062c\u2214"\ + "\u0634\u2214"] + ::msgcat::mcset fa_IN DAYS_OF_WEEK_FULL [list \ + "\u06cc\u06cc\u200c\u0634\u0646\u0628\u0647"\ + "\u062f\u0648\u0634\u0646\u0628\u0647"\ + "\u0633\u0647\u200c\u0634\u0646\u0628\u0647"\ + "\u0686\u0647\u0627\u0631\u0634\u0646\u0628\u0647"\ + "\u067e\u0646\u062c\u200c\u0634\u0646\u0628\u0647"\ + "\u062c\u0645\u0639\u0647"\ + "\u0634\u0646\u0628\u0647"] + ::msgcat::mcset fa_IN MONTHS_ABBREV [list \ + "\u0698\u0627\u0646"\ + "\u0641\u0648\u0631"\ + "\u0645\u0627\u0631"\ + "\u0622\u0648\u0631"\ + "\u0645\u0640\u0647"\ + "\u0698\u0648\u0646"\ + "\u0698\u0648\u06cc"\ + "\u0627\u0648\u062a"\ + "\u0633\u067e\u062a"\ + "\u0627\u0643\u062a"\ + "\u0646\u0648\u0627"\ + "\u062f\u0633\u0627"\ + ""] + ::msgcat::mcset fa_IN MONTHS_FULL [list \ + "\u0698\u0627\u0646\u0648\u06cc\u0647"\ + "\u0641\u0648\u0631\u0648\u06cc\u0647"\ + "\u0645\u0627\u0631\u0633"\ + "\u0622\u0648\u0631\u06cc\u0644"\ + "\u0645\u0647"\ + "\u0698\u0648\u0626\u0646"\ + "\u0698\u0648\u0626\u06cc\u0647"\ + "\u0627\u0648\u062a"\ + "\u0633\u067e\u062a\u0627\u0645\u0628\u0631"\ + "\u0627\u0643\u062a\u0628\u0631"\ + "\u0646\u0648\u0627\u0645\u0628\u0631"\ + "\u062f\u0633\u0627\u0645\u0628\u0631"\ + ""] + ::msgcat::mcset fa_IN AM "\u0635\u0628\u062d" + ::msgcat::mcset fa_IN PM "\u0639\u0635\u0631" + ::msgcat::mcset fa_IN DATE_FORMAT "%A %d %B %Y" + ::msgcat::mcset fa_IN TIME_FORMAT_12 "%I:%M:%S %z" + ::msgcat::mcset fa_IN DATE_TIME_FORMAT "%A %d %B %Y %I:%M:%S %z %z" +} diff --git a/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/fa_ir.msg b/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/fa_ir.msg new file mode 100644 index 0000000000000000000000000000000000000000..597ce9d72caa68c7c195ab4ac8709a82f8f8192f --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/fa_ir.msg @@ -0,0 +1,9 @@ +# created by tools/loadICU.tcl -- do not edit +namespace eval ::tcl::clock { + ::msgcat::mcset fa_IR AM "\u0635\u0628\u062d" + ::msgcat::mcset fa_IR PM "\u0639\u0635\u0631" + ::msgcat::mcset fa_IR DATE_FORMAT "%d\u2044%m\u2044%Y" + ::msgcat::mcset fa_IR TIME_FORMAT "%S:%M:%H" + ::msgcat::mcset fa_IR TIME_FORMAT_12 "%S:%M:%l %P" + ::msgcat::mcset fa_IR DATE_TIME_FORMAT "%d\u2044%m\u2044%Y %S:%M:%H %z" +} diff --git a/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/fi.msg b/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/fi.msg new file mode 100644 index 0000000000000000000000000000000000000000..acabba09b433ea886930c37b229b6264a2d81add --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/fi.msg @@ -0,0 +1,50 @@ +# created by tools/loadICU.tcl -- do not edit +namespace eval ::tcl::clock { + ::msgcat::mcset fi DAYS_OF_WEEK_ABBREV [list \ + "su"\ + "ma"\ + "ti"\ + "ke"\ + "to"\ + "pe"\ + "la"] + ::msgcat::mcset fi DAYS_OF_WEEK_FULL [list \ + "sunnuntai"\ + "maanantai"\ + "tiistai"\ + "keskiviikko"\ + "torstai"\ + "perjantai"\ + "lauantai"] + ::msgcat::mcset fi MONTHS_ABBREV [list \ + "tammi"\ + "helmi"\ + "maalis"\ + "huhti"\ + "touko"\ + "kes\u00e4"\ + "hein\u00e4"\ + "elo"\ + "syys"\ + "loka"\ + "marras"\ + "joulu"\ + ""] + ::msgcat::mcset fi MONTHS_FULL [list \ + "tammikuu"\ + "helmikuu"\ + "maaliskuu"\ + "huhtikuu"\ + "toukokuu"\ + "kes\u00e4kuu"\ + "hein\u00e4kuu"\ + "elokuu"\ + "syyskuu"\ + "lokakuu"\ + "marraskuu"\ + "joulukuu"\ + ""] + ::msgcat::mcset fi DATE_FORMAT "%e.%m.%Y" + ::msgcat::mcset fi TIME_FORMAT "%k:%M:%S" + ::msgcat::mcset fi DATE_TIME_FORMAT "%e.%m.%Y %k:%M:%S %z" +} diff --git a/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/fo.msg b/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/fo.msg new file mode 100644 index 0000000000000000000000000000000000000000..4696e6289ab332d32690d2c5d5d5bafff094ae1a --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/fo.msg @@ -0,0 +1,47 @@ +# created by tools/loadICU.tcl -- do not edit +namespace eval ::tcl::clock { + ::msgcat::mcset fo DAYS_OF_WEEK_ABBREV [list \ + "sun"\ + "m\u00e1n"\ + "t\u00fds"\ + "mik"\ + "h\u00f3s"\ + "fr\u00ed"\ + "ley"] + ::msgcat::mcset fo DAYS_OF_WEEK_FULL [list \ + "sunnudagur"\ + "m\u00e1nadagur"\ + "t\u00fdsdagur"\ + "mikudagur"\ + "h\u00f3sdagur"\ + "fr\u00edggjadagur"\ + "leygardagur"] + ::msgcat::mcset fo MONTHS_ABBREV [list \ + "jan"\ + "feb"\ + "mar"\ + "apr"\ + "mai"\ + "jun"\ + "jul"\ + "aug"\ + "sep"\ + "okt"\ + "nov"\ + "des"\ + ""] + ::msgcat::mcset fo MONTHS_FULL [list \ + "januar"\ + "februar"\ + "mars"\ + "apr\u00edl"\ + "mai"\ + "juni"\ + "juli"\ + "august"\ + "september"\ + "oktober"\ + "november"\ + "desember"\ + ""] +} diff --git a/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/fo_fo.msg b/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/fo_fo.msg new file mode 100644 index 0000000000000000000000000000000000000000..2392b8e6734d6f811cadb5c4ed6aa62147829309 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/fo_fo.msg @@ -0,0 +1,7 @@ +# created by tools/loadICU.tcl -- do not edit +namespace eval ::tcl::clock { + ::msgcat::mcset fo_FO DATE_FORMAT "%d/%m-%Y" + ::msgcat::mcset fo_FO TIME_FORMAT "%T" + ::msgcat::mcset fo_FO TIME_FORMAT_12 "%T" + ::msgcat::mcset fo_FO DATE_TIME_FORMAT "%a %d %b %Y %T %z" +} diff --git a/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/fr.msg b/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/fr.msg new file mode 100644 index 0000000000000000000000000000000000000000..55b19bf949e4e0b07d28d69f23a5c44aad764062 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/fr.msg @@ -0,0 +1,52 @@ +# created by tools/loadICU.tcl -- do not edit +namespace eval ::tcl::clock { + ::msgcat::mcset fr DAYS_OF_WEEK_ABBREV [list \ + "dim."\ + "lun."\ + "mar."\ + "mer."\ + "jeu."\ + "ven."\ + "sam."] + ::msgcat::mcset fr DAYS_OF_WEEK_FULL [list \ + "dimanche"\ + "lundi"\ + "mardi"\ + "mercredi"\ + "jeudi"\ + "vendredi"\ + "samedi"] + ::msgcat::mcset fr MONTHS_ABBREV [list \ + "janv."\ + "f\u00e9vr."\ + "mars"\ + "avr."\ + "mai"\ + "juin"\ + "juil."\ + "ao\u00fbt"\ + "sept."\ + "oct."\ + "nov."\ + "d\u00e9c."\ + ""] + ::msgcat::mcset fr MONTHS_FULL [list \ + "janvier"\ + "f\u00e9vrier"\ + "mars"\ + "avril"\ + "mai"\ + "juin"\ + "juillet"\ + "ao\u00fbt"\ + "septembre"\ + "octobre"\ + "novembre"\ + "d\u00e9cembre"\ + ""] + ::msgcat::mcset fr BCE "av. J.-C." + ::msgcat::mcset fr CE "ap. J.-C." + ::msgcat::mcset fr DATE_FORMAT "%e %B %Y" + ::msgcat::mcset fr TIME_FORMAT "%H:%M:%S" + ::msgcat::mcset fr DATE_TIME_FORMAT "%e %B %Y %H:%M:%S %z" +} diff --git a/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/fr_be.msg b/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/fr_be.msg new file mode 100644 index 0000000000000000000000000000000000000000..cdb13bd75f307b2498698ebaef0c572877dfe9eb --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/fr_be.msg @@ -0,0 +1,7 @@ +# created by tools/loadICU.tcl -- do not edit +namespace eval ::tcl::clock { + ::msgcat::mcset fr_BE DATE_FORMAT "%d/%m/%y" + ::msgcat::mcset fr_BE TIME_FORMAT "%T" + ::msgcat::mcset fr_BE TIME_FORMAT_12 "%T" + ::msgcat::mcset fr_BE DATE_TIME_FORMAT "%a %d %b %Y %T %z" +} diff --git a/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/fr_ca.msg b/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/fr_ca.msg new file mode 100644 index 0000000000000000000000000000000000000000..00ccfffcb473d24d682104771f2c9e502285c8d4 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/fr_ca.msg @@ -0,0 +1,7 @@ +# created by tools/loadICU.tcl -- do not edit +namespace eval ::tcl::clock { + ::msgcat::mcset fr_CA DATE_FORMAT "%Y-%m-%d" + ::msgcat::mcset fr_CA TIME_FORMAT "%T" + ::msgcat::mcset fr_CA TIME_FORMAT_12 "%T" + ::msgcat::mcset fr_CA DATE_TIME_FORMAT "%a %d %b %Y %T %z" +} diff --git a/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/fr_ch.msg b/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/fr_ch.msg new file mode 100644 index 0000000000000000000000000000000000000000..7e2bac73d8023f0be9847d123901cbba0fe2ae53 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/fr_ch.msg @@ -0,0 +1,7 @@ +# created by tools/loadICU.tcl -- do not edit +namespace eval ::tcl::clock { + ::msgcat::mcset fr_CH DATE_FORMAT "%d. %m. %y" + ::msgcat::mcset fr_CH TIME_FORMAT "%T" + ::msgcat::mcset fr_CH TIME_FORMAT_12 "%T" + ::msgcat::mcset fr_CH DATE_TIME_FORMAT "%a %d %b %Y %T %z" +} diff --git a/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/ga.msg b/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/ga.msg new file mode 100644 index 0000000000000000000000000000000000000000..6edf13aab1c71a7ea1d1f0d4959cdda3ab923653 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/ga.msg @@ -0,0 +1,47 @@ +# created by tools/loadICU.tcl -- do not edit +namespace eval ::tcl::clock { + ::msgcat::mcset ga DAYS_OF_WEEK_ABBREV [list \ + "Domh"\ + "Luan"\ + "M\u00e1irt"\ + "C\u00e9ad"\ + "D\u00e9ar"\ + "Aoine"\ + "Sath"] + ::msgcat::mcset ga DAYS_OF_WEEK_FULL [list \ + "D\u00e9 Domhnaigh"\ + "D\u00e9 Luain"\ + "D\u00e9 M\u00e1irt"\ + "D\u00e9 C\u00e9adaoin"\ + "D\u00e9ardaoin"\ + "D\u00e9 hAoine"\ + "D\u00e9 Sathairn"] + ::msgcat::mcset ga MONTHS_ABBREV [list \ + "Ean"\ + "Feabh"\ + "M\u00e1rta"\ + "Aib"\ + "Beal"\ + "Meith"\ + "I\u00fail"\ + "L\u00fan"\ + "MF\u00f3mh"\ + "DF\u00f3mh"\ + "Samh"\ + "Noll"\ + ""] + ::msgcat::mcset ga MONTHS_FULL [list \ + "Ean\u00e1ir"\ + "Feabhra"\ + "M\u00e1rta"\ + "Aibre\u00e1n"\ + "M\u00ed na Bealtaine"\ + "Meith"\ + "I\u00fail"\ + "L\u00fanasa"\ + "Me\u00e1n F\u00f3mhair"\ + "Deireadh F\u00f3mhair"\ + "M\u00ed na Samhna"\ + "M\u00ed na Nollag"\ + ""] +} diff --git a/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/ga_ie.msg b/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/ga_ie.msg new file mode 100644 index 0000000000000000000000000000000000000000..b6acbbc273ec0b7bb2c9dead694fba4d371fac6d --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/ga_ie.msg @@ -0,0 +1,7 @@ +# created by tools/loadICU.tcl -- do not edit +namespace eval ::tcl::clock { + ::msgcat::mcset ga_IE DATE_FORMAT "%d.%m.%y" + ::msgcat::mcset ga_IE TIME_FORMAT "%T" + ::msgcat::mcset ga_IE TIME_FORMAT_12 "%T" + ::msgcat::mcset ga_IE DATE_TIME_FORMAT "%a %d %b %Y %T %z" +} diff --git a/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/gl.msg b/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/gl.msg new file mode 100644 index 0000000000000000000000000000000000000000..4b869e8550665690bf621afdf659cd9d39e9cb2c --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/gl.msg @@ -0,0 +1,47 @@ +# created by tools/loadICU.tcl -- do not edit +namespace eval ::tcl::clock { + ::msgcat::mcset gl DAYS_OF_WEEK_ABBREV [list \ + "Dom"\ + "Lun"\ + "Mar"\ + "M\u00e9r"\ + "Xov"\ + "Ven"\ + "S\u00e1b"] + ::msgcat::mcset gl DAYS_OF_WEEK_FULL [list \ + "Domingo"\ + "Luns"\ + "Martes"\ + "M\u00e9rcores"\ + "Xoves"\ + "Venres"\ + "S\u00e1bado"] + ::msgcat::mcset gl MONTHS_ABBREV [list \ + "Xan"\ + "Feb"\ + "Mar"\ + "Abr"\ + "Mai"\ + "Xu\u00f1"\ + "Xul"\ + "Ago"\ + "Set"\ + "Out"\ + "Nov"\ + "Dec"\ + ""] + ::msgcat::mcset gl MONTHS_FULL [list \ + "Xaneiro"\ + "Febreiro"\ + "Marzo"\ + "Abril"\ + "Maio"\ + "Xu\u00f1o"\ + "Xullo"\ + "Agosto"\ + "Setembro"\ + "Outubro"\ + "Novembro"\ + "Decembro"\ + ""] +} diff --git a/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/gl_es.msg b/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/gl_es.msg new file mode 100644 index 0000000000000000000000000000000000000000..d4ed2704b374b7f7a621482b9ebb8cd2c2d52b2d --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/gl_es.msg @@ -0,0 +1,6 @@ +# created by tools/loadICU.tcl -- do not edit +namespace eval ::tcl::clock { + ::msgcat::mcset gl_ES DATE_FORMAT "%d %B %Y" + ::msgcat::mcset gl_ES TIME_FORMAT_12 "%l:%M:%S %P" + ::msgcat::mcset gl_ES DATE_TIME_FORMAT "%d %B %Y %l:%M:%S %P %z" +} diff --git a/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/gv.msg b/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/gv.msg new file mode 100644 index 0000000000000000000000000000000000000000..7d332ad5c40b14dadf4ed342662787c283c7a772 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/gv.msg @@ -0,0 +1,47 @@ +# created by tools/loadICU.tcl -- do not edit +namespace eval ::tcl::clock { + ::msgcat::mcset gv DAYS_OF_WEEK_ABBREV [list \ + "Jed"\ + "Jel"\ + "Jem"\ + "Jerc"\ + "Jerd"\ + "Jeh"\ + "Jes"] + ::msgcat::mcset gv DAYS_OF_WEEK_FULL [list \ + "Jedoonee"\ + "Jelhein"\ + "Jemayrt"\ + "Jercean"\ + "Jerdein"\ + "Jeheiney"\ + "Jesarn"] + ::msgcat::mcset gv MONTHS_ABBREV [list \ + "J-guer"\ + "T-arree"\ + "Mayrnt"\ + "Avrril"\ + "Boaldyn"\ + "M-souree"\ + "J-souree"\ + "Luanistyn"\ + "M-fouyir"\ + "J-fouyir"\ + "M.Houney"\ + "M.Nollick"\ + ""] + ::msgcat::mcset gv MONTHS_FULL [list \ + "Jerrey-geuree"\ + "Toshiaght-arree"\ + "Mayrnt"\ + "Averil"\ + "Boaldyn"\ + "Mean-souree"\ + "Jerrey-souree"\ + "Luanistyn"\ + "Mean-fouyir"\ + "Jerrey-fouyir"\ + "Mee Houney"\ + "Mee ny Nollick"\ + ""] +} diff --git a/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/gv_gb.msg b/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/gv_gb.msg new file mode 100644 index 0000000000000000000000000000000000000000..5e96e6f3cd699726995bf54773b5c938f2215912 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/gv_gb.msg @@ -0,0 +1,6 @@ +# created by tools/loadICU.tcl -- do not edit +namespace eval ::tcl::clock { + ::msgcat::mcset gv_GB DATE_FORMAT "%d %B %Y" + ::msgcat::mcset gv_GB TIME_FORMAT_12 "%l:%M:%S %P" + ::msgcat::mcset gv_GB DATE_TIME_FORMAT "%d %B %Y %l:%M:%S %P %z" +} diff --git a/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/he.msg b/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/he.msg new file mode 100644 index 0000000000000000000000000000000000000000..4fd921d695580d913869978074a8bc5f1e6b5b71 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/he.msg @@ -0,0 +1,52 @@ +# created by tools/loadICU.tcl -- do not edit +namespace eval ::tcl::clock { + ::msgcat::mcset he DAYS_OF_WEEK_ABBREV [list \ + "\u05d0"\ + "\u05d1"\ + "\u05d2"\ + "\u05d3"\ + "\u05d4"\ + "\u05d5"\ + "\u05e9"] + ::msgcat::mcset he DAYS_OF_WEEK_FULL [list \ + "\u05d9\u05d5\u05dd \u05e8\u05d0\u05e9\u05d5\u05df"\ + "\u05d9\u05d5\u05dd \u05e9\u05e0\u05d9"\ + "\u05d9\u05d5\u05dd \u05e9\u05dc\u05d9\u05e9\u05d9"\ + "\u05d9\u05d5\u05dd \u05e8\u05d1\u05d9\u05e2\u05d9"\ + "\u05d9\u05d5\u05dd \u05d7\u05de\u05d9\u05e9\u05d9"\ + "\u05d9\u05d5\u05dd \u05e9\u05d9\u05e9\u05d9"\ + "\u05e9\u05d1\u05ea"] + ::msgcat::mcset he MONTHS_ABBREV [list \ + "\u05d9\u05e0\u05d5"\ + "\u05e4\u05d1\u05e8"\ + "\u05de\u05e8\u05e5"\ + "\u05d0\u05e4\u05e8"\ + "\u05de\u05d0\u05d9"\ + "\u05d9\u05d5\u05e0"\ + "\u05d9\u05d5\u05dc"\ + "\u05d0\u05d5\u05d2"\ + "\u05e1\u05e4\u05d8"\ + "\u05d0\u05d5\u05e7"\ + "\u05e0\u05d5\u05d1"\ + "\u05d3\u05e6\u05de"\ + ""] + ::msgcat::mcset he MONTHS_FULL [list \ + "\u05d9\u05e0\u05d5\u05d0\u05e8"\ + "\u05e4\u05d1\u05e8\u05d5\u05d0\u05e8"\ + "\u05de\u05e8\u05e5"\ + "\u05d0\u05e4\u05e8\u05d9\u05dc"\ + "\u05de\u05d0\u05d9"\ + "\u05d9\u05d5\u05e0\u05d9"\ + "\u05d9\u05d5\u05dc\u05d9"\ + "\u05d0\u05d5\u05d2\u05d5\u05e1\u05d8"\ + "\u05e1\u05e4\u05d8\u05de\u05d1\u05e8"\ + "\u05d0\u05d5\u05e7\u05d8\u05d5\u05d1\u05e8"\ + "\u05e0\u05d5\u05d1\u05de\u05d1\u05e8"\ + "\u05d3\u05e6\u05de\u05d1\u05e8"\ + ""] + ::msgcat::mcset he BCE "\u05dc\u05e1\u05d4\u0022\u05e0" + ::msgcat::mcset he CE "\u05dc\u05e4\u05e1\u05d4\u0022\u05e0" + ::msgcat::mcset he DATE_FORMAT "%d/%m/%Y" + ::msgcat::mcset he TIME_FORMAT "%H:%M:%S" + ::msgcat::mcset he DATE_TIME_FORMAT "%d/%m/%Y %H:%M:%S %z" +} diff --git a/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/hi.msg b/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/hi.msg new file mode 100644 index 0000000000000000000000000000000000000000..50c9fb8093dd47839afcc1321751c56171a060d3 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/hi.msg @@ -0,0 +1,39 @@ +# created by tools/loadICU.tcl -- do not edit +namespace eval ::tcl::clock { + ::msgcat::mcset hi DAYS_OF_WEEK_FULL [list \ + "\u0930\u0935\u093f\u0935\u093e\u0930"\ + "\u0938\u094b\u092e\u0935\u093e\u0930"\ + "\u092e\u0902\u0917\u0932\u0935\u093e\u0930"\ + "\u092c\u0941\u0927\u0935\u093e\u0930"\ + "\u0917\u0941\u0930\u0941\u0935\u093e\u0930"\ + "\u0936\u0941\u0915\u094d\u0930\u0935\u093e\u0930"\ + "\u0936\u0928\u093f\u0935\u093e\u0930"] + ::msgcat::mcset hi MONTHS_ABBREV [list \ + "\u091c\u0928\u0935\u0930\u0940"\ + "\u092b\u093c\u0930\u0935\u0930\u0940"\ + "\u092e\u093e\u0930\u094d\u091a"\ + "\u0905\u092a\u094d\u0930\u0947\u0932"\ + "\u092e\u0908"\ + "\u091c\u0942\u0928"\ + "\u091c\u0941\u0932\u093e\u0908"\ + "\u0905\u0917\u0938\u094d\u0924"\ + "\u0938\u093f\u0924\u092e\u094d\u092c\u0930"\ + "\u0905\u0915\u094d\u091f\u0942\u092c\u0930"\ + "\u0928\u0935\u092e\u094d\u092c\u0930"\ + "\u0926\u093f\u0938\u092e\u094d\u092c\u0930"] + ::msgcat::mcset hi MONTHS_FULL [list \ + "\u091c\u0928\u0935\u0930\u0940"\ + "\u092b\u093c\u0930\u0935\u0930\u0940"\ + "\u092e\u093e\u0930\u094d\u091a"\ + "\u0905\u092a\u094d\u0930\u0947\u0932"\ + "\u092e\u0908"\ + "\u091c\u0942\u0928"\ + "\u091c\u0941\u0932\u093e\u0908"\ + "\u0905\u0917\u0938\u094d\u0924"\ + "\u0938\u093f\u0924\u092e\u094d\u092c\u0930"\ + "\u0905\u0915\u094d\u091f\u0942\u092c\u0930"\ + "\u0928\u0935\u092e\u094d\u092c\u0930"\ + "\u0926\u093f\u0938\u092e\u094d\u092c\u0930"] + ::msgcat::mcset hi AM "\u0908\u0938\u093e\u092a\u0942\u0930\u094d\u0935" + ::msgcat::mcset hi PM "." +} diff --git a/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/hi_in.msg b/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/hi_in.msg new file mode 100644 index 0000000000000000000000000000000000000000..239793f1ec666a677cbc68741a4c132f6025c95d --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/hi_in.msg @@ -0,0 +1,6 @@ +# created by tools/loadICU.tcl -- do not edit +namespace eval ::tcl::clock { + ::msgcat::mcset hi_IN DATE_FORMAT "%d %M %Y" + ::msgcat::mcset hi_IN TIME_FORMAT_12 "%I:%M:%S %P" + ::msgcat::mcset hi_IN DATE_TIME_FORMAT "%d %M %Y %I:%M:%S %P %z" +} diff --git a/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/hr.msg b/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/hr.msg new file mode 100644 index 0000000000000000000000000000000000000000..cec145b083039f22c68ec0120ce1dfc092d920b0 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/hr.msg @@ -0,0 +1,50 @@ +# created by tools/loadICU.tcl -- do not edit +namespace eval ::tcl::clock { + ::msgcat::mcset hr DAYS_OF_WEEK_ABBREV [list \ + "ned"\ + "pon"\ + "uto"\ + "sri"\ + "\u010det"\ + "pet"\ + "sub"] + ::msgcat::mcset hr DAYS_OF_WEEK_FULL [list \ + "nedjelja"\ + "ponedjeljak"\ + "utorak"\ + "srijeda"\ + "\u010detvrtak"\ + "petak"\ + "subota"] + ::msgcat::mcset hr MONTHS_ABBREV [list \ + "sij"\ + "vel"\ + "o\u017eu"\ + "tra"\ + "svi"\ + "lip"\ + "srp"\ + "kol"\ + "ruj"\ + "lis"\ + "stu"\ + "pro"\ + ""] + ::msgcat::mcset hr MONTHS_FULL [list \ + "sije\u010danj"\ + "velja\u010da"\ + "o\u017eujak"\ + "travanj"\ + "svibanj"\ + "lipanj"\ + "srpanj"\ + "kolovoz"\ + "rujan"\ + "listopad"\ + "studeni"\ + "prosinac"\ + ""] + ::msgcat::mcset hr DATE_FORMAT "%Y.%m.%d" + ::msgcat::mcset hr TIME_FORMAT "%H:%M:%S" + ::msgcat::mcset hr DATE_TIME_FORMAT "%Y.%m.%d %H:%M:%S %z" +} diff --git a/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/hu.msg b/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/hu.msg new file mode 100644 index 0000000000000000000000000000000000000000..e5e68d925876c5840eab2616674ef5df913078e2 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/hu.msg @@ -0,0 +1,54 @@ +# created by tools/loadICU.tcl -- do not edit +namespace eval ::tcl::clock { + ::msgcat::mcset hu DAYS_OF_WEEK_ABBREV [list \ + "V"\ + "H"\ + "K"\ + "Sze"\ + "Cs"\ + "P"\ + "Szo"] + ::msgcat::mcset hu DAYS_OF_WEEK_FULL [list \ + "vas\u00e1rnap"\ + "h\u00e9tf\u0151"\ + "kedd"\ + "szerda"\ + "cs\u00fct\u00f6rt\u00f6k"\ + "p\u00e9ntek"\ + "szombat"] + ::msgcat::mcset hu MONTHS_ABBREV [list \ + "jan."\ + "febr."\ + "m\u00e1rc."\ + "\u00e1pr."\ + "m\u00e1j."\ + "j\u00fan."\ + "j\u00fal."\ + "aug."\ + "szept."\ + "okt."\ + "nov."\ + "dec."\ + ""] + ::msgcat::mcset hu MONTHS_FULL [list \ + "janu\u00e1r"\ + "febru\u00e1r"\ + "m\u00e1rcius"\ + "\u00e1prilis"\ + "m\u00e1jus"\ + "j\u00fanius"\ + "j\u00falius"\ + "augusztus"\ + "szeptember"\ + "okt\u00f3ber"\ + "november"\ + "december"\ + ""] + ::msgcat::mcset hu BCE "i.e." + ::msgcat::mcset hu CE "i.u." + ::msgcat::mcset hu AM "DE" + ::msgcat::mcset hu PM "DU" + ::msgcat::mcset hu DATE_FORMAT "%Y.%m.%d." + ::msgcat::mcset hu TIME_FORMAT "%k:%M:%S" + ::msgcat::mcset hu DATE_TIME_FORMAT "%Y.%m.%d. %k:%M:%S %z" +} diff --git a/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/id.msg b/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/id.msg new file mode 100644 index 0000000000000000000000000000000000000000..17c6bb59d47c7e4b2bcf123ce653c54eb558c6a3 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/id.msg @@ -0,0 +1,47 @@ +# created by tools/loadICU.tcl -- do not edit +namespace eval ::tcl::clock { + ::msgcat::mcset id DAYS_OF_WEEK_ABBREV [list \ + "Min"\ + "Sen"\ + "Sel"\ + "Rab"\ + "Kam"\ + "Jum"\ + "Sab"] + ::msgcat::mcset id DAYS_OF_WEEK_FULL [list \ + "Minggu"\ + "Senin"\ + "Selasa"\ + "Rabu"\ + "Kamis"\ + "Jumat"\ + "Sabtu"] + ::msgcat::mcset id MONTHS_ABBREV [list \ + "Jan"\ + "Peb"\ + "Mar"\ + "Apr"\ + "Mei"\ + "Jun"\ + "Jul"\ + "Agu"\ + "Sep"\ + "Okt"\ + "Nov"\ + "Des"\ + ""] + ::msgcat::mcset id MONTHS_FULL [list \ + "Januari"\ + "Pebruari"\ + "Maret"\ + "April"\ + "Mei"\ + "Juni"\ + "Juli"\ + "Agustus"\ + "September"\ + "Oktober"\ + "November"\ + "Desember"\ + ""] +} diff --git a/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/id_id.msg b/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/id_id.msg new file mode 100644 index 0000000000000000000000000000000000000000..bb672c11eea46eae59bf84a31c2e47a8a7e00b12 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/id_id.msg @@ -0,0 +1,6 @@ +# created by tools/loadICU.tcl -- do not edit +namespace eval ::tcl::clock { + ::msgcat::mcset id_ID DATE_FORMAT "%d %B %Y" + ::msgcat::mcset id_ID TIME_FORMAT_12 "%l:%M:%S %P" + ::msgcat::mcset id_ID DATE_TIME_FORMAT "%d %B %Y %l:%M:%S %P %z" +} diff --git a/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/is.msg b/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/is.msg new file mode 100644 index 0000000000000000000000000000000000000000..adc2d2a374ff6838172253f1d57e7f6875f4e905 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/is.msg @@ -0,0 +1,50 @@ +# created by tools/loadICU.tcl -- do not edit +namespace eval ::tcl::clock { + ::msgcat::mcset is DAYS_OF_WEEK_ABBREV [list \ + "sun."\ + "m\u00e1n."\ + "\u00feri."\ + "mi\u00f0."\ + "fim."\ + "f\u00f6s."\ + "lau."] + ::msgcat::mcset is DAYS_OF_WEEK_FULL [list \ + "sunnudagur"\ + "m\u00e1nudagur"\ + "\u00feri\u00f0judagur"\ + "mi\u00f0vikudagur"\ + "fimmtudagur"\ + "f\u00f6studagur"\ + "laugardagur"] + ::msgcat::mcset is MONTHS_ABBREV [list \ + "jan."\ + "feb."\ + "mar."\ + "apr."\ + "ma\u00ed"\ + "j\u00fan."\ + "j\u00fal."\ + "\u00e1g\u00fa."\ + "sep."\ + "okt."\ + "n\u00f3v."\ + "des."\ + ""] + ::msgcat::mcset is MONTHS_FULL [list \ + "jan\u00faar"\ + "febr\u00faar"\ + "mars"\ + "apr\u00edl"\ + "ma\u00ed"\ + "j\u00fan\u00ed"\ + "j\u00fal\u00ed"\ + "\u00e1g\u00fast"\ + "september"\ + "okt\u00f3ber"\ + "n\u00f3vember"\ + "desember"\ + ""] + ::msgcat::mcset is DATE_FORMAT "%e.%m.%Y" + ::msgcat::mcset is TIME_FORMAT "%H:%M:%S" + ::msgcat::mcset is DATE_TIME_FORMAT "%e.%m.%Y %H:%M:%S %z" +} diff --git a/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/it.msg b/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/it.msg new file mode 100644 index 0000000000000000000000000000000000000000..b641cdec7b3a9958e33ab03960cb88a78a3df4c9 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/it.msg @@ -0,0 +1,54 @@ +# created by tools/loadICU.tcl -- do not edit +namespace eval ::tcl::clock { + ::msgcat::mcset it DAYS_OF_WEEK_ABBREV [list \ + "dom"\ + "lun"\ + "mar"\ + "mer"\ + "gio"\ + "ven"\ + "sab"] + ::msgcat::mcset it DAYS_OF_WEEK_FULL [list \ + "domenica"\ + "luned\u00ec"\ + "marted\u00ec"\ + "mercoled\u00ec"\ + "gioved\u00ec"\ + "venerd\u00ec"\ + "sabato"] + ::msgcat::mcset it MONTHS_ABBREV [list \ + "gen"\ + "feb"\ + "mar"\ + "apr"\ + "mag"\ + "giu"\ + "lug"\ + "ago"\ + "set"\ + "ott"\ + "nov"\ + "dic"\ + ""] + ::msgcat::mcset it MONTHS_FULL [list \ + "gennaio"\ + "febbraio"\ + "marzo"\ + "aprile"\ + "maggio"\ + "giugno"\ + "luglio"\ + "agosto"\ + "settembre"\ + "ottobre"\ + "novembre"\ + "dicembre"\ + ""] + ::msgcat::mcset it BCE "aC" + ::msgcat::mcset it CE "dC" + ::msgcat::mcset it AM "m." + ::msgcat::mcset it PM "p." + ::msgcat::mcset it DATE_FORMAT "%d %B %Y" + ::msgcat::mcset it TIME_FORMAT "%H:%M:%S" + ::msgcat::mcset it DATE_TIME_FORMAT "%d %B %Y %H:%M:%S %z" +} diff --git a/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/it_ch.msg b/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/it_ch.msg new file mode 100644 index 0000000000000000000000000000000000000000..b36ed36873ded884391fdad351fbe941521b668b --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/it_ch.msg @@ -0,0 +1,6 @@ +# created by tools/loadICU.tcl -- do not edit +namespace eval ::tcl::clock { + ::msgcat::mcset it_CH DATE_FORMAT "%e. %B %Y" + ::msgcat::mcset it_CH TIME_FORMAT "%H:%M:%S" + ::msgcat::mcset it_CH DATE_TIME_FORMAT "%e. %B %Y %H:%M:%S %z" +} diff --git a/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/ja.msg b/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/ja.msg new file mode 100644 index 0000000000000000000000000000000000000000..cf70c2f326043e83efc1792226331764d271be6f --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/ja.msg @@ -0,0 +1,44 @@ +# created by tools/loadICU.tcl -- do not edit +namespace eval ::tcl::clock { + ::msgcat::mcset ja DAYS_OF_WEEK_ABBREV [list \ + "\u65e5"\ + "\u6708"\ + "\u706b"\ + "\u6c34"\ + "\u6728"\ + "\u91d1"\ + "\u571f"] + ::msgcat::mcset ja DAYS_OF_WEEK_FULL [list \ + "\u65e5\u66dc\u65e5"\ + "\u6708\u66dc\u65e5"\ + "\u706b\u66dc\u65e5"\ + "\u6c34\u66dc\u65e5"\ + "\u6728\u66dc\u65e5"\ + "\u91d1\u66dc\u65e5"\ + "\u571f\u66dc\u65e5"] + ::msgcat::mcset ja MONTHS_FULL [list \ + "1\u6708"\ + "2\u6708"\ + "3\u6708"\ + "4\u6708"\ + "5\u6708"\ + "6\u6708"\ + "7\u6708"\ + "8\u6708"\ + "9\u6708"\ + "10\u6708"\ + "11\u6708"\ + "12\u6708"] + ::msgcat::mcset ja BCE "\u7d00\u5143\u524d" + ::msgcat::mcset ja CE "\u897f\u66a6" + ::msgcat::mcset ja AM "\u5348\u524d" + ::msgcat::mcset ja PM "\u5348\u5f8c" + ::msgcat::mcset ja DATE_FORMAT "%Y/%m/%d" + ::msgcat::mcset ja TIME_FORMAT "%k:%M:%S" + ::msgcat::mcset ja TIME_FORMAT_12 "%P %I:%M:%S" + ::msgcat::mcset ja DATE_TIME_FORMAT "%Y/%m/%d %k:%M:%S %z" + ::msgcat::mcset ja LOCALE_DATE_FORMAT "%EY\u5e74%m\u6708%d\u65e5" + ::msgcat::mcset ja LOCALE_TIME_FORMAT "%H\u6642%M\u5206%S\u79d2" + ::msgcat::mcset ja LOCALE_DATE_TIME_FORMAT "%EY\u5e74%m\u6708%d\u65e5 (%a) %H\u6642%M\u5206%S\u79d2 %z" + ::msgcat::mcset ja LOCALE_ERAS "{-9223372036854775808 \u897f\u66a6 0} {-3061011600 \u660e\u6cbb 1867} {-1812186000 \u5927\u6b63 1911} {-1357635600 \u662d\u548c 1925} {600220800 \u5e73\u6210 1988} {1556668800 \u4ee4\u548c 2018}" +} diff --git a/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/kl.msg b/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/kl.msg new file mode 100644 index 0000000000000000000000000000000000000000..d877bfe6af30d0d4b3dcb51d7b65bade8b5999eb --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/kl.msg @@ -0,0 +1,47 @@ +# created by tools/loadICU.tcl -- do not edit +namespace eval ::tcl::clock { + ::msgcat::mcset kl DAYS_OF_WEEK_ABBREV [list \ + "sab"\ + "ata"\ + "mar"\ + "pin"\ + "sis"\ + "tal"\ + "arf"] + ::msgcat::mcset kl DAYS_OF_WEEK_FULL [list \ + "sabaat"\ + "ataasinngorneq"\ + "marlunngorneq"\ + "pingasunngorneq"\ + "sisamanngorneq"\ + "tallimanngorneq"\ + "arfininngorneq"] + ::msgcat::mcset kl MONTHS_ABBREV [list \ + "jan"\ + "feb"\ + "mar"\ + "apr"\ + "maj"\ + "jun"\ + "jul"\ + "aug"\ + "sep"\ + "okt"\ + "nov"\ + "dec"\ + ""] + ::msgcat::mcset kl MONTHS_FULL [list \ + "januari"\ + "februari"\ + "martsi"\ + "aprili"\ + "maji"\ + "juni"\ + "juli"\ + "augustusi"\ + "septemberi"\ + "oktoberi"\ + "novemberi"\ + "decemberi"\ + ""] +} diff --git a/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/kl_gl.msg b/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/kl_gl.msg new file mode 100644 index 0000000000000000000000000000000000000000..403aa10f94b0a9441d8ee9606f95c2a44863fe5b --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/kl_gl.msg @@ -0,0 +1,7 @@ +# created by tools/loadICU.tcl -- do not edit +namespace eval ::tcl::clock { + ::msgcat::mcset kl_GL DATE_FORMAT "%d %b %Y" + ::msgcat::mcset kl_GL TIME_FORMAT "%T" + ::msgcat::mcset kl_GL TIME_FORMAT_12 "%T" + ::msgcat::mcset kl_GL DATE_TIME_FORMAT "%a %d %b %Y %T %z" +} diff --git a/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/ko.msg b/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/ko.msg new file mode 100644 index 0000000000000000000000000000000000000000..0cd17a19f328236312146380c7af76156d61fd3f --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/ko.msg @@ -0,0 +1,55 @@ +# created by tools/loadICU.tcl -- do not edit +namespace eval ::tcl::clock { + ::msgcat::mcset ko DAYS_OF_WEEK_ABBREV [list \ + "\uc77c"\ + "\uc6d4"\ + "\ud654"\ + "\uc218"\ + "\ubaa9"\ + "\uae08"\ + "\ud1a0"] + ::msgcat::mcset ko DAYS_OF_WEEK_FULL [list \ + "\uc77c\uc694\uc77c"\ + "\uc6d4\uc694\uc77c"\ + "\ud654\uc694\uc77c"\ + "\uc218\uc694\uc77c"\ + "\ubaa9\uc694\uc77c"\ + "\uae08\uc694\uc77c"\ + "\ud1a0\uc694\uc77c"] + ::msgcat::mcset ko MONTHS_ABBREV [list \ + "1\uc6d4"\ + "2\uc6d4"\ + "3\uc6d4"\ + "4\uc6d4"\ + "5\uc6d4"\ + "6\uc6d4"\ + "7\uc6d4"\ + "8\uc6d4"\ + "9\uc6d4"\ + "10\uc6d4"\ + "11\uc6d4"\ + "12\uc6d4"\ + ""] + ::msgcat::mcset ko MONTHS_FULL [list \ + "1\uc6d4"\ + "2\uc6d4"\ + "3\uc6d4"\ + "4\uc6d4"\ + "5\uc6d4"\ + "6\uc6d4"\ + "7\uc6d4"\ + "8\uc6d4"\ + "9\uc6d4"\ + "10\uc6d4"\ + "11\uc6d4"\ + "12\uc6d4"\ + ""] + ::msgcat::mcset ko AM "\uc624\uc804" + ::msgcat::mcset ko PM "\uc624\ud6c4" + ::msgcat::mcset ko DATE_FORMAT "%Y-%m-%d" + ::msgcat::mcset ko TIME_FORMAT_12 "%P %l:%M:%S" + ::msgcat::mcset ko DATE_TIME_FORMAT "%Y-%m-%d %P %l:%M:%S %z" + ::msgcat::mcset ko LOCALE_DATE_FORMAT "%Y\ub144%B%Od\uc77c" + ::msgcat::mcset ko LOCALE_TIME_FORMAT "%H\uc2dc%M\ubd84%S\ucd08" + ::msgcat::mcset ko LOCALE_DATE_TIME_FORMAT "%A %Y\ub144%B%Od\uc77c%H\uc2dc%M\ubd84%S\ucd08 %z" +} diff --git a/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/ko_kr.msg b/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/ko_kr.msg new file mode 100644 index 0000000000000000000000000000000000000000..ea5bbd724890093d3f2da781bc1dfdc0983d48ec --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/ko_kr.msg @@ -0,0 +1,8 @@ +# created by tools/loadICU.tcl -- do not edit +namespace eval ::tcl::clock { + ::msgcat::mcset ko_KR BCE "\uae30\uc6d0\uc804" + ::msgcat::mcset ko_KR CE "\uc11c\uae30" + ::msgcat::mcset ko_KR DATE_FORMAT "%Y.%m.%d" + ::msgcat::mcset ko_KR TIME_FORMAT_12 "%P %l:%M:%S" + ::msgcat::mcset ko_KR DATE_TIME_FORMAT "%Y.%m.%d %P %l:%M:%S %z" +} diff --git a/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/kok.msg b/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/kok.msg new file mode 100644 index 0000000000000000000000000000000000000000..0869f2078bf4f4c3d07247c7e3b48a5390985311 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/kok.msg @@ -0,0 +1,39 @@ +# created by tools/loadICU.tcl -- do not edit +namespace eval ::tcl::clock { + ::msgcat::mcset kok DAYS_OF_WEEK_FULL [list \ + "\u0906\u0926\u093f\u0924\u094d\u092f\u0935\u093e\u0930"\ + "\u0938\u094b\u092e\u0935\u093e\u0930"\ + "\u092e\u0902\u0917\u0933\u093e\u0930"\ + "\u092c\u0941\u0927\u0935\u093e\u0930"\ + "\u0917\u0941\u0930\u0941\u0935\u093e\u0930"\ + "\u0936\u0941\u0915\u094d\u0930\u0935\u093e\u0930"\ + "\u0936\u0928\u093f\u0935\u093e\u0930"] + ::msgcat::mcset kok MONTHS_ABBREV [list \ + "\u091c\u093e\u0928\u0947\u0935\u093e\u0930\u0940"\ + "\u092b\u0947\u092c\u0943\u0935\u093e\u0930\u0940"\ + "\u092e\u093e\u0930\u094d\u091a"\ + "\u090f\u092a\u094d\u0930\u093f\u0932"\ + "\u092e\u0947"\ + "\u091c\u0942\u0928"\ + "\u091c\u0941\u0932\u0948"\ + "\u0913\u0917\u0938\u094d\u091f"\ + "\u0938\u0947\u092a\u094d\u091f\u0947\u0902\u092c\u0930"\ + "\u0913\u0915\u094d\u091f\u094b\u092c\u0930"\ + "\u0928\u094b\u0935\u094d\u0939\u0947\u0902\u092c\u0930"\ + "\u0921\u093f\u0938\u0947\u0902\u092c\u0930"] + ::msgcat::mcset kok MONTHS_FULL [list \ + "\u091c\u093e\u0928\u0947\u0935\u093e\u0930\u0940"\ + "\u092b\u0947\u092c\u094d\u0930\u0941\u0935\u093e\u0930\u0940"\ + "\u092e\u093e\u0930\u094d\u091a"\ + "\u090f\u092a\u094d\u0930\u093f\u0932"\ + "\u092e\u0947"\ + "\u091c\u0942\u0928"\ + "\u091c\u0941\u0932\u0948"\ + "\u0913\u0917\u0938\u094d\u091f"\ + "\u0938\u0947\u092a\u094d\u091f\u0947\u0902\u092c\u0930"\ + "\u0913\u0915\u094d\u091f\u094b\u092c\u0930"\ + "\u0928\u094b\u0935\u094d\u0939\u0947\u0902\u092c\u0930"\ + "\u0921\u093f\u0938\u0947\u0902\u092c\u0930"] + ::msgcat::mcset kok AM "\u0915\u094d\u0930\u093f\u0938\u094d\u0924\u092a\u0942\u0930\u094d\u0935" + ::msgcat::mcset kok PM "\u0915\u094d\u0930\u093f\u0938\u094d\u0924\u0936\u0916\u093e" +} diff --git a/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/kok_in.msg b/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/kok_in.msg new file mode 100644 index 0000000000000000000000000000000000000000..abcb1ff883699c995fc108baf1cb828f712b9032 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/kok_in.msg @@ -0,0 +1,6 @@ +# created by tools/loadICU.tcl -- do not edit +namespace eval ::tcl::clock { + ::msgcat::mcset kok_IN DATE_FORMAT "%d %M %Y" + ::msgcat::mcset kok_IN TIME_FORMAT_12 "%I:%M:%S %P" + ::msgcat::mcset kok_IN DATE_TIME_FORMAT "%d %M %Y %I:%M:%S %P %z" +} diff --git a/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/kw.msg b/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/kw.msg new file mode 100644 index 0000000000000000000000000000000000000000..aaf79b3242982053b90567cf4f974e1866051f37 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/kw.msg @@ -0,0 +1,47 @@ +# created by tools/loadICU.tcl -- do not edit +namespace eval ::tcl::clock { + ::msgcat::mcset kw DAYS_OF_WEEK_ABBREV [list \ + "Sul"\ + "Lun"\ + "Mth"\ + "Mhr"\ + "Yow"\ + "Gwe"\ + "Sad"] + ::msgcat::mcset kw DAYS_OF_WEEK_FULL [list \ + "De Sul"\ + "De Lun"\ + "De Merth"\ + "De Merher"\ + "De Yow"\ + "De Gwener"\ + "De Sadorn"] + ::msgcat::mcset kw MONTHS_ABBREV [list \ + "Gen"\ + "Whe"\ + "Mer"\ + "Ebr"\ + "Me"\ + "Evn"\ + "Gor"\ + "Est"\ + "Gwn"\ + "Hed"\ + "Du"\ + "Kev"\ + ""] + ::msgcat::mcset kw MONTHS_FULL [list \ + "Mys Genver"\ + "Mys Whevrel"\ + "Mys Merth"\ + "Mys Ebrel"\ + "Mys Me"\ + "Mys Evan"\ + "Mys Gortheren"\ + "Mye Est"\ + "Mys Gwyngala"\ + "Mys Hedra"\ + "Mys Du"\ + "Mys Kevardhu"\ + ""] +} diff --git a/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/kw_gb.msg b/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/kw_gb.msg new file mode 100644 index 0000000000000000000000000000000000000000..296768043ace0d2e12e69cbfae2bf65d6602ab5c --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/kw_gb.msg @@ -0,0 +1,6 @@ +# created by tools/loadICU.tcl -- do not edit +namespace eval ::tcl::clock { + ::msgcat::mcset kw_GB DATE_FORMAT "%d %B %Y" + ::msgcat::mcset kw_GB TIME_FORMAT_12 "%l:%M:%S %P" + ::msgcat::mcset kw_GB DATE_TIME_FORMAT "%d %B %Y %l:%M:%S %P %z" +} diff --git a/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/lt.msg b/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/lt.msg new file mode 100644 index 0000000000000000000000000000000000000000..27b09850bc1f900e1d3a88be05862acd77e8ef31 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/lt.msg @@ -0,0 +1,52 @@ +# created by tools/loadICU.tcl -- do not edit +namespace eval ::tcl::clock { + ::msgcat::mcset lt DAYS_OF_WEEK_ABBREV [list \ + "Sk"\ + "Pr"\ + "An"\ + "Tr"\ + "Kt"\ + "Pn"\ + "\u0160t"] + ::msgcat::mcset lt DAYS_OF_WEEK_FULL [list \ + "Sekmadienis"\ + "Pirmadienis"\ + "Antradienis"\ + "Tre\u010diadienis"\ + "Ketvirtadienis"\ + "Penktadienis"\ + "\u0160e\u0161tadienis"] + ::msgcat::mcset lt MONTHS_ABBREV [list \ + "Sau"\ + "Vas"\ + "Kov"\ + "Bal"\ + "Geg"\ + "Bir"\ + "Lie"\ + "Rgp"\ + "Rgs"\ + "Spa"\ + "Lap"\ + "Grd"\ + ""] + ::msgcat::mcset lt MONTHS_FULL [list \ + "Sausio"\ + "Vasario"\ + "Kovo"\ + "Baland\u017eio"\ + "Gegu\u017e\u0117s"\ + "Bir\u017eelio"\ + "Liepos"\ + "Rugpj\u016b\u010dio"\ + "Rugs\u0117jo"\ + "Spalio"\ + "Lapkri\u010dio"\ + "Gruod\u017eio"\ + ""] + ::msgcat::mcset lt BCE "pr.Kr." + ::msgcat::mcset lt CE "po.Kr." + ::msgcat::mcset lt DATE_FORMAT "%Y.%m.%e" + ::msgcat::mcset lt TIME_FORMAT "%H.%M.%S" + ::msgcat::mcset lt DATE_TIME_FORMAT "%Y.%m.%e %H.%M.%S %z" +} diff --git a/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/lv.msg b/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/lv.msg new file mode 100644 index 0000000000000000000000000000000000000000..a037b151cc531d0fbb9f6ec82ca25ce067cc40ea --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/lv.msg @@ -0,0 +1,52 @@ +# created by tools/loadICU.tcl -- do not edit +namespace eval ::tcl::clock { + ::msgcat::mcset lv DAYS_OF_WEEK_ABBREV [list \ + "Sv"\ + "P"\ + "O"\ + "T"\ + "C"\ + "Pk"\ + "S"] + ::msgcat::mcset lv DAYS_OF_WEEK_FULL [list \ + "sv\u0113tdiena"\ + "pirmdiena"\ + "otrdiena"\ + "tre\u0161diena"\ + "ceturdien"\ + "piektdiena"\ + "sestdiena"] + ::msgcat::mcset lv MONTHS_ABBREV [list \ + "Jan"\ + "Feb"\ + "Mar"\ + "Apr"\ + "Maijs"\ + "J\u016bn"\ + "J\u016bl"\ + "Aug"\ + "Sep"\ + "Okt"\ + "Nov"\ + "Dec"\ + ""] + ::msgcat::mcset lv MONTHS_FULL [list \ + "janv\u0101ris"\ + "febru\u0101ris"\ + "marts"\ + "apr\u012blis"\ + "maijs"\ + "j\u016bnijs"\ + "j\u016blijs"\ + "augusts"\ + "septembris"\ + "oktobris"\ + "novembris"\ + "decembris"\ + ""] + ::msgcat::mcset lv BCE "pm\u0113" + ::msgcat::mcset lv CE "m\u0113" + ::msgcat::mcset lv DATE_FORMAT "%Y.%e.%m" + ::msgcat::mcset lv TIME_FORMAT "%H:%M:%S" + ::msgcat::mcset lv DATE_TIME_FORMAT "%Y.%e.%m %H:%M:%S %z" +} diff --git a/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/mk.msg b/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/mk.msg new file mode 100644 index 0000000000000000000000000000000000000000..41cf60db81d1f2240f64754bbef96d50634528a2 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/mk.msg @@ -0,0 +1,52 @@ +# created by tools/loadICU.tcl -- do not edit +namespace eval ::tcl::clock { + ::msgcat::mcset mk DAYS_OF_WEEK_ABBREV [list \ + "\u043d\u0435\u0434."\ + "\u043f\u043e\u043d."\ + "\u0432\u0442."\ + "\u0441\u0440\u0435."\ + "\u0447\u0435\u0442."\ + "\u043f\u0435\u0442."\ + "\u0441\u0430\u0431."] + ::msgcat::mcset mk DAYS_OF_WEEK_FULL [list \ + "\u043d\u0435\u0434\u0435\u043b\u0430"\ + "\u043f\u043e\u043d\u0435\u0434\u0435\u043b\u043d\u0438\u043a"\ + "\u0432\u0442\u043e\u0440\u043d\u0438\u043a"\ + "\u0441\u0440\u0435\u0434\u0430"\ + "\u0447\u0435\u0442\u0432\u0440\u0442\u043e\u043a"\ + "\u043f\u0435\u0442\u043e\u043a"\ + "\u0441\u0430\u0431\u043e\u0442\u0430"] + ::msgcat::mcset mk MONTHS_ABBREV [list \ + "\u0458\u0430\u043d."\ + "\u0444\u0435\u0432."\ + "\u043c\u0430\u0440."\ + "\u0430\u043f\u0440."\ + "\u043c\u0430\u0458."\ + "\u0458\u0443\u043d."\ + "\u0458\u0443\u043b."\ + "\u0430\u0432\u0433."\ + "\u0441\u0435\u043f\u0442."\ + "\u043e\u043a\u0442."\ + "\u043d\u043e\u0435\u043c."\ + "\u0434\u0435\u043a\u0435\u043c."\ + ""] + ::msgcat::mcset mk MONTHS_FULL [list \ + "\u0458\u0430\u043d\u0443\u0430\u0440\u0438"\ + "\u0444\u0435\u0432\u0440\u0443\u0430\u0440\u0438"\ + "\u043c\u0430\u0440\u0442"\ + "\u0430\u043f\u0440\u0438\u043b"\ + "\u043c\u0430\u0458"\ + "\u0458\u0443\u043d\u0438"\ + "\u0458\u0443\u043b\u0438"\ + "\u0430\u0432\u0433\u0443\u0441\u0442"\ + "\u0441\u0435\u043f\u0442\u0435\u043c\u0432\u0440\u0438"\ + "\u043e\u043a\u0442\u043e\u043c\u0432\u0440\u0438"\ + "\u043d\u043e\u0435\u043c\u0432\u0440\u0438"\ + "\u0434\u0435\u043a\u0435\u043c\u0432\u0440\u0438"\ + ""] + ::msgcat::mcset mk BCE "\u043f\u0440.\u043d.\u0435." + ::msgcat::mcset mk CE "\u0430\u0435." + ::msgcat::mcset mk DATE_FORMAT "%e.%m.%Y" + ::msgcat::mcset mk TIME_FORMAT "%H:%M:%S %z" + ::msgcat::mcset mk DATE_TIME_FORMAT "%e.%m.%Y %H:%M:%S %z %z" +} diff --git a/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/mr.msg b/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/mr.msg new file mode 100644 index 0000000000000000000000000000000000000000..cea427a9065c619748b2807040a5314cc0915c1e --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/mr.msg @@ -0,0 +1,39 @@ +# created by tools/loadICU.tcl -- do not edit +namespace eval ::tcl::clock { + ::msgcat::mcset mr DAYS_OF_WEEK_FULL [list \ + "\u0930\u0935\u093f\u0935\u093e\u0930"\ + "\u0938\u094b\u092e\u0935\u093e\u0930"\ + "\u092e\u0902\u0917\u0933\u0935\u093e\u0930"\ + "\u092e\u0902\u0917\u0933\u0935\u093e\u0930"\ + "\u0917\u0941\u0930\u0941\u0935\u093e\u0930"\ + "\u0936\u0941\u0915\u094d\u0930\u0935\u093e\u0930"\ + "\u0936\u0928\u093f\u0935\u093e\u0930"] + ::msgcat::mcset mr MONTHS_ABBREV [list \ + "\u091c\u093e\u0928\u0947\u0935\u093e\u0930\u0940"\ + "\u092b\u0947\u092c\u0943\u0935\u093e\u0930\u0940"\ + "\u092e\u093e\u0930\u094d\u091a"\ + "\u090f\u092a\u094d\u0930\u093f\u0932"\ + "\u092e\u0947"\ + "\u091c\u0942\u0928"\ + "\u091c\u0941\u0932\u0948"\ + "\u0913\u0917\u0938\u094d\u091f"\ + "\u0938\u0947\u092a\u094d\u091f\u0947\u0902\u092c\u0930"\ + "\u0913\u0915\u094d\u091f\u094b\u092c\u0930"\ + "\u0928\u094b\u0935\u094d\u0939\u0947\u0902\u092c\u0930"\ + "\u0921\u093f\u0938\u0947\u0902\u092c\u0930"] + ::msgcat::mcset mr MONTHS_FULL [list \ + "\u091c\u093e\u0928\u0947\u0935\u093e\u0930\u0940"\ + "\u092b\u0947\u092c\u0943\u0935\u093e\u0930\u0940"\ + "\u092e\u093e\u0930\u094d\u091a"\ + "\u090f\u092a\u094d\u0930\u093f\u0932"\ + "\u092e\u0947"\ + "\u091c\u0942\u0928"\ + "\u091c\u0941\u0932\u0948"\ + "\u0913\u0917\u0938\u094d\u091f"\ + "\u0938\u0947\u092a\u094d\u091f\u0947\u0902\u092c\u0930"\ + "\u0913\u0915\u094d\u091f\u094b\u092c\u0930"\ + "\u0928\u094b\u0935\u094d\u0939\u0947\u0902\u092c\u0930"\ + "\u0921\u093f\u0938\u0947\u0902\u092c\u0930"] + ::msgcat::mcset mr AM "BC" + ::msgcat::mcset mr PM "AD" +} diff --git a/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/mr_in.msg b/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/mr_in.msg new file mode 100644 index 0000000000000000000000000000000000000000..1889da5c4525a8c1c5fe1be62bb5bd29746c5d5c --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/mr_in.msg @@ -0,0 +1,6 @@ +# created by tools/loadICU.tcl -- do not edit +namespace eval ::tcl::clock { + ::msgcat::mcset mr_IN DATE_FORMAT "%d %M %Y" + ::msgcat::mcset mr_IN TIME_FORMAT_12 "%I:%M:%S %P" + ::msgcat::mcset mr_IN DATE_TIME_FORMAT "%d %M %Y %I:%M:%S %P %z" +} diff --git a/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/ms.msg b/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/ms.msg new file mode 100644 index 0000000000000000000000000000000000000000..e954431b7b7bfc876c3a1c53d22d3843546dee2d --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/ms.msg @@ -0,0 +1,47 @@ +# created by tools/loadICU.tcl -- do not edit +namespace eval ::tcl::clock { + ::msgcat::mcset ms DAYS_OF_WEEK_ABBREV [list \ + "Aha"\ + "Isn"\ + "Sei"\ + "Rab"\ + "Kha"\ + "Jum"\ + "Sab"] + ::msgcat::mcset ms DAYS_OF_WEEK_FULL [list \ + "Ahad"\ + "Isnin"\ + "Selasa"\ + "Rahu"\ + "Khamis"\ + "Jumaat"\ + "Sabtu"] + ::msgcat::mcset ms MONTHS_ABBREV [list \ + "Jan"\ + "Feb"\ + "Mac"\ + "Apr"\ + "Mei"\ + "Jun"\ + "Jul"\ + "Ogos"\ + "Sep"\ + "Okt"\ + "Nov"\ + "Dis"\ + ""] + ::msgcat::mcset ms MONTHS_FULL [list \ + "Januari"\ + "Februari"\ + "Mac"\ + "April"\ + "Mei"\ + "Jun"\ + "Julai"\ + "Ogos"\ + "September"\ + "Oktober"\ + "November"\ + "Disember"\ + ""] +} diff --git a/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/ms_my.msg b/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/ms_my.msg new file mode 100644 index 0000000000000000000000000000000000000000..c1f93d421c0aee7a060f1b4cafda4a819408e14b --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/ms_my.msg @@ -0,0 +1,6 @@ +# created by tools/loadICU.tcl -- do not edit +namespace eval ::tcl::clock { + ::msgcat::mcset ms_MY DATE_FORMAT "%A %d %b %Y" + ::msgcat::mcset ms_MY TIME_FORMAT_12 "%I:%M:%S %z" + ::msgcat::mcset ms_MY DATE_TIME_FORMAT "%A %d %b %Y %I:%M:%S %z %z" +} diff --git a/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/mt.msg b/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/mt.msg new file mode 100644 index 0000000000000000000000000000000000000000..ddd5446421c107df913ea38e0aed61a48245951a --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/mt.msg @@ -0,0 +1,27 @@ +# created by tools/loadICU.tcl -- do not edit +namespace eval ::tcl::clock { + ::msgcat::mcset mt DAYS_OF_WEEK_ABBREV [list \ + "\u0126ad"\ + "Tne"\ + "Tli"\ + "Erb"\ + "\u0126am"\ + "\u0120im"] + ::msgcat::mcset mt MONTHS_ABBREV [list \ + "Jan"\ + "Fra"\ + "Mar"\ + "Apr"\ + "Mej"\ + "\u0120un"\ + "Lul"\ + "Awi"\ + "Set"\ + "Ott"\ + "Nov"] + ::msgcat::mcset mt BCE "QK" + ::msgcat::mcset mt CE "" + ::msgcat::mcset mt DATE_FORMAT "%A, %e ta %B, %Y" + ::msgcat::mcset mt TIME_FORMAT_12 "%l:%M:%S %P" + ::msgcat::mcset mt DATE_TIME_FORMAT "%A, %e ta %B, %Y %l:%M:%S %P %z" +} diff --git a/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/nb.msg b/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/nb.msg new file mode 100644 index 0000000000000000000000000000000000000000..90d49a3394915f3f78b63fe09ee78b88266d6e95 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/nb.msg @@ -0,0 +1,52 @@ +# created by tools/loadICU.tcl -- do not edit +namespace eval ::tcl::clock { + ::msgcat::mcset nb DAYS_OF_WEEK_ABBREV [list \ + "s\u00f8"\ + "ma"\ + "ti"\ + "on"\ + "to"\ + "fr"\ + "l\u00f8"] + ::msgcat::mcset nb DAYS_OF_WEEK_FULL [list \ + "s\u00f8ndag"\ + "mandag"\ + "tirsdag"\ + "onsdag"\ + "torsdag"\ + "fredag"\ + "l\u00f8rdag"] + ::msgcat::mcset nb MONTHS_ABBREV [list \ + "jan"\ + "feb"\ + "mar"\ + "apr"\ + "mai"\ + "jun"\ + "jul"\ + "aug"\ + "sep"\ + "okt"\ + "nov"\ + "des"\ + ""] + ::msgcat::mcset nb MONTHS_FULL [list \ + "januar"\ + "februar"\ + "mars"\ + "april"\ + "mai"\ + "juni"\ + "juli"\ + "august"\ + "september"\ + "oktober"\ + "november"\ + "desember"\ + ""] + ::msgcat::mcset nb BCE "f.Kr." + ::msgcat::mcset nb CE "e.Kr." + ::msgcat::mcset nb DATE_FORMAT "%e. %B %Y" + ::msgcat::mcset nb TIME_FORMAT "%H:%M:%S" + ::msgcat::mcset nb DATE_TIME_FORMAT "%e. %B %Y %H:%M:%S %z" +} diff --git a/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/nl.msg b/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/nl.msg new file mode 100644 index 0000000000000000000000000000000000000000..4c5c675518623c91e6883bcbe78fade21d5482ab --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/nl.msg @@ -0,0 +1,50 @@ +# created by tools/loadICU.tcl -- do not edit +namespace eval ::tcl::clock { + ::msgcat::mcset nl DAYS_OF_WEEK_ABBREV [list \ + "zo"\ + "ma"\ + "di"\ + "wo"\ + "do"\ + "vr"\ + "za"] + ::msgcat::mcset nl DAYS_OF_WEEK_FULL [list \ + "zondag"\ + "maandag"\ + "dinsdag"\ + "woensdag"\ + "donderdag"\ + "vrijdag"\ + "zaterdag"] + ::msgcat::mcset nl MONTHS_ABBREV [list \ + "jan"\ + "feb"\ + "mrt"\ + "apr"\ + "mei"\ + "jun"\ + "jul"\ + "aug"\ + "sep"\ + "okt"\ + "nov"\ + "dec"\ + ""] + ::msgcat::mcset nl MONTHS_FULL [list \ + "januari"\ + "februari"\ + "maart"\ + "april"\ + "mei"\ + "juni"\ + "juli"\ + "augustus"\ + "september"\ + "oktober"\ + "november"\ + "december"\ + ""] + ::msgcat::mcset nl DATE_FORMAT "%e %B %Y" + ::msgcat::mcset nl TIME_FORMAT "%k:%M:%S" + ::msgcat::mcset nl DATE_TIME_FORMAT "%e %B %Y %k:%M:%S %z" +} diff --git a/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/nl_be.msg b/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/nl_be.msg new file mode 100644 index 0000000000000000000000000000000000000000..4b19670fc6dc2c3a4412fa8f49b2de77347b5cc3 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/nl_be.msg @@ -0,0 +1,7 @@ +# created by tools/loadICU.tcl -- do not edit +namespace eval ::tcl::clock { + ::msgcat::mcset nl_BE DATE_FORMAT "%d-%m-%y" + ::msgcat::mcset nl_BE TIME_FORMAT "%T" + ::msgcat::mcset nl_BE TIME_FORMAT_12 "%T" + ::msgcat::mcset nl_BE DATE_TIME_FORMAT "%a %d %b %Y %T %z" +} diff --git a/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/nn.msg b/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/nn.msg new file mode 100644 index 0000000000000000000000000000000000000000..bd61ac9493955b92806bfa55c43c769d5c522cb4 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/nn.msg @@ -0,0 +1,52 @@ +# created by tools/loadICU.tcl -- do not edit +namespace eval ::tcl::clock { + ::msgcat::mcset nn DAYS_OF_WEEK_ABBREV [list \ + "su"\ + "m\u00e5"\ + "ty"\ + "on"\ + "to"\ + "fr"\ + "lau"] + ::msgcat::mcset nn DAYS_OF_WEEK_FULL [list \ + "sundag"\ + "m\u00e5ndag"\ + "tysdag"\ + "onsdag"\ + "torsdag"\ + "fredag"\ + "laurdag"] + ::msgcat::mcset nn MONTHS_ABBREV [list \ + "jan"\ + "feb"\ + "mar"\ + "apr"\ + "mai"\ + "jun"\ + "jul"\ + "aug"\ + "sep"\ + "okt"\ + "nov"\ + "des"\ + ""] + ::msgcat::mcset nn MONTHS_FULL [list \ + "januar"\ + "februar"\ + "mars"\ + "april"\ + "mai"\ + "juni"\ + "juli"\ + "august"\ + "september"\ + "oktober"\ + "november"\ + "desember"\ + ""] + ::msgcat::mcset nn BCE "f.Kr." + ::msgcat::mcset nn CE "e.Kr." + ::msgcat::mcset nn DATE_FORMAT "%e. %B %Y" + ::msgcat::mcset nn TIME_FORMAT "%H:%M:%S" + ::msgcat::mcset nn DATE_TIME_FORMAT "%e. %B %Y %H:%M:%S %z" +} diff --git a/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/pl.msg b/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/pl.msg new file mode 100644 index 0000000000000000000000000000000000000000..d206f4b71a7879a4d7b859f6ae2bd42854fabc21 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/pl.msg @@ -0,0 +1,52 @@ +# created by tools/loadICU.tcl -- do not edit +namespace eval ::tcl::clock { + ::msgcat::mcset pl DAYS_OF_WEEK_ABBREV [list \ + "N"\ + "Pn"\ + "Wt"\ + "\u015ar"\ + "Cz"\ + "Pt"\ + "So"] + ::msgcat::mcset pl DAYS_OF_WEEK_FULL [list \ + "niedziela"\ + "poniedzia\u0142ek"\ + "wtorek"\ + "\u015broda"\ + "czwartek"\ + "pi\u0105tek"\ + "sobota"] + ::msgcat::mcset pl MONTHS_ABBREV [list \ + "sty"\ + "lut"\ + "mar"\ + "kwi"\ + "maj"\ + "cze"\ + "lip"\ + "sie"\ + "wrz"\ + "pa\u017a"\ + "lis"\ + "gru"\ + ""] + ::msgcat::mcset pl MONTHS_FULL [list \ + "stycze\u0144"\ + "luty"\ + "marzec"\ + "kwiecie\u0144"\ + "maj"\ + "czerwiec"\ + "lipiec"\ + "sierpie\u0144"\ + "wrzesie\u0144"\ + "pa\u017adziernik"\ + "listopad"\ + "grudzie\u0144"\ + ""] + ::msgcat::mcset pl BCE "p.n.e." + ::msgcat::mcset pl CE "n.e." + ::msgcat::mcset pl DATE_FORMAT "%Y-%m-%d" + ::msgcat::mcset pl TIME_FORMAT "%H:%M:%S" + ::msgcat::mcset pl DATE_TIME_FORMAT "%Y-%m-%d %H:%M:%S %z" +} diff --git a/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/pt.msg b/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/pt.msg new file mode 100644 index 0000000000000000000000000000000000000000..96fdb35a682eae0a5344a20f31a5d3ed6e1f9207 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/pt.msg @@ -0,0 +1,50 @@ +# created by tools/loadICU.tcl -- do not edit +namespace eval ::tcl::clock { + ::msgcat::mcset pt DAYS_OF_WEEK_ABBREV [list \ + "Dom"\ + "Seg"\ + "Ter"\ + "Qua"\ + "Qui"\ + "Sex"\ + "S\u00e1b"] + ::msgcat::mcset pt DAYS_OF_WEEK_FULL [list \ + "Domingo"\ + "Segunda-feira"\ + "Ter\u00e7a-feira"\ + "Quarta-feira"\ + "Quinta-feira"\ + "Sexta-feira"\ + "S\u00e1bado"] + ::msgcat::mcset pt MONTHS_ABBREV [list \ + "Jan"\ + "Fev"\ + "Mar"\ + "Abr"\ + "Mai"\ + "Jun"\ + "Jul"\ + "Ago"\ + "Set"\ + "Out"\ + "Nov"\ + "Dez"\ + ""] + ::msgcat::mcset pt MONTHS_FULL [list \ + "Janeiro"\ + "Fevereiro"\ + "Mar\u00e7o"\ + "Abril"\ + "Maio"\ + "Junho"\ + "Julho"\ + "Agosto"\ + "Setembro"\ + "Outubro"\ + "Novembro"\ + "Dezembro"\ + ""] + ::msgcat::mcset pt DATE_FORMAT "%d-%m-%Y" + ::msgcat::mcset pt TIME_FORMAT "%k:%M:%S" + ::msgcat::mcset pt DATE_TIME_FORMAT "%d-%m-%Y %k:%M:%S %z" +} diff --git a/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/pt_br.msg b/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/pt_br.msg new file mode 100644 index 0000000000000000000000000000000000000000..86843279bd7e7059565f6009010fd78f76dd928c --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/pt_br.msg @@ -0,0 +1,7 @@ +# created by tools/loadICU.tcl -- do not edit +namespace eval ::tcl::clock { + ::msgcat::mcset pt_BR DATE_FORMAT "%d-%m-%Y" + ::msgcat::mcset pt_BR TIME_FORMAT "%T" + ::msgcat::mcset pt_BR TIME_FORMAT_12 "%T" + ::msgcat::mcset pt_BR DATE_TIME_FORMAT "%a %d %b %Y %T %z" +} diff --git a/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/ro.msg b/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/ro.msg new file mode 100644 index 0000000000000000000000000000000000000000..bdd7c6197222ebe646efabcaf0ec00ca50348aa7 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/ro.msg @@ -0,0 +1,52 @@ +# created by tools/loadICU.tcl -- do not edit +namespace eval ::tcl::clock { + ::msgcat::mcset ro DAYS_OF_WEEK_ABBREV [list \ + "D"\ + "L"\ + "Ma"\ + "Mi"\ + "J"\ + "V"\ + "S"] + ::msgcat::mcset ro DAYS_OF_WEEK_FULL [list \ + "duminic\u0103"\ + "luni"\ + "mar\u0163i"\ + "miercuri"\ + "joi"\ + "vineri"\ + "s\u00eemb\u0103t\u0103"] + ::msgcat::mcset ro MONTHS_ABBREV [list \ + "Ian"\ + "Feb"\ + "Mar"\ + "Apr"\ + "Mai"\ + "Iun"\ + "Iul"\ + "Aug"\ + "Sep"\ + "Oct"\ + "Nov"\ + "Dec"\ + ""] + ::msgcat::mcset ro MONTHS_FULL [list \ + "ianuarie"\ + "februarie"\ + "martie"\ + "aprilie"\ + "mai"\ + "iunie"\ + "iulie"\ + "august"\ + "septembrie"\ + "octombrie"\ + "noiembrie"\ + "decembrie"\ + ""] + ::msgcat::mcset ro BCE "d.C." + ::msgcat::mcset ro CE "\u00ee.d.C." + ::msgcat::mcset ro DATE_FORMAT "%d.%m.%Y" + ::msgcat::mcset ro TIME_FORMAT "%H:%M:%S" + ::msgcat::mcset ro DATE_TIME_FORMAT "%d.%m.%Y %H:%M:%S %z" +} diff --git a/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/ru.msg b/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/ru.msg new file mode 100644 index 0000000000000000000000000000000000000000..65b075d6b01c7899e7c9d4bcfe76a8707b012b3b --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/ru.msg @@ -0,0 +1,52 @@ +# created by tools/loadICU.tcl -- do not edit +namespace eval ::tcl::clock { + ::msgcat::mcset ru DAYS_OF_WEEK_ABBREV [list \ + "\u0412\u0441"\ + "\u041f\u043d"\ + "\u0412\u0442"\ + "\u0421\u0440"\ + "\u0427\u0442"\ + "\u041f\u0442"\ + "\u0421\u0431"] + ::msgcat::mcset ru DAYS_OF_WEEK_FULL [list \ + "\u0432\u043e\u0441\u043a\u0440\u0435\u0441\u0435\u043d\u044c\u0435"\ + "\u043f\u043e\u043d\u0435\u0434\u0435\u043b\u044c\u043d\u0438\u043a"\ + "\u0432\u0442\u043e\u0440\u043d\u0438\u043a"\ + "\u0441\u0440\u0435\u0434\u0430"\ + "\u0447\u0435\u0442\u0432\u0435\u0440\u0433"\ + "\u043f\u044f\u0442\u043d\u0438\u0446\u0430"\ + "\u0441\u0443\u0431\u0431\u043e\u0442\u0430"] + ::msgcat::mcset ru MONTHS_ABBREV [list \ + "\u044f\u043d\u0432"\ + "\u0444\u0435\u0432"\ + "\u043c\u0430\u0440"\ + "\u0430\u043f\u0440"\ + "\u043c\u0430\u0439"\ + "\u0438\u044e\u043d"\ + "\u0438\u044e\u043b"\ + "\u0430\u0432\u0433"\ + "\u0441\u0435\u043d"\ + "\u043e\u043a\u0442"\ + "\u043d\u043e\u044f"\ + "\u0434\u0435\u043a"\ + ""] + ::msgcat::mcset ru MONTHS_FULL [list \ + "\u042f\u043d\u0432\u0430\u0440\u044c"\ + "\u0424\u0435\u0432\u0440\u0430\u043b\u044c"\ + "\u041c\u0430\u0440\u0442"\ + "\u0410\u043f\u0440\u0435\u043b\u044c"\ + "\u041c\u0430\u0439"\ + "\u0418\u044e\u043d\u044c"\ + "\u0418\u044e\u043b\u044c"\ + "\u0410\u0432\u0433\u0443\u0441\u0442"\ + "\u0421\u0435\u043d\u0442\u044f\u0431\u0440\u044c"\ + "\u041e\u043a\u0442\u044f\u0431\u0440\u044c"\ + "\u041d\u043e\u044f\u0431\u0440\u044c"\ + "\u0414\u0435\u043a\u0430\u0431\u0440\u044c"\ + ""] + ::msgcat::mcset ru BCE "\u0434\u043e \u043d.\u044d." + ::msgcat::mcset ru CE "\u043d.\u044d." + ::msgcat::mcset ru DATE_FORMAT "%d.%m.%Y" + ::msgcat::mcset ru TIME_FORMAT "%k:%M:%S" + ::msgcat::mcset ru DATE_TIME_FORMAT "%d.%m.%Y %k:%M:%S %z" +} diff --git a/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/ru_ua.msg b/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/ru_ua.msg new file mode 100644 index 0000000000000000000000000000000000000000..6e1f8a86e8dea968b603d101395847edb7bb62ff --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/tcl8.6/msgs/ru_ua.msg @@ -0,0 +1,6 @@ +# created by tools/loadICU.tcl -- do not edit +namespace eval ::tcl::clock { + ::msgcat::mcset ru_UA DATE_FORMAT "%d.%m.%Y" + ::msgcat::mcset ru_UA TIME_FORMAT "%k:%M:%S" + ::msgcat::mcset ru_UA DATE_TIME_FORMAT "%d.%m.%Y %k:%M:%S %z" +} diff --git a/miniconda3/envs/active_proaction/lib/tcl8.6/package.tcl b/miniconda3/envs/active_proaction/lib/tcl8.6/package.tcl new file mode 100644 index 0000000000000000000000000000000000000000..7b2b2e94a44190122183f333a9af2cb846a2e5e0 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/tcl8.6/package.tcl @@ -0,0 +1,751 @@ +# package.tcl -- +# +# utility procs formerly in init.tcl which can be loaded on demand +# for package management. +# +# Copyright (c) 1991-1993 The Regents of the University of California. +# Copyright (c) 1994-1998 Sun Microsystems, Inc. +# +# See the file "license.terms" for information on usage and redistribution +# of this file, and for a DISCLAIMER OF ALL WARRANTIES. +# + +namespace eval tcl::Pkg {} + +# ::tcl::Pkg::CompareExtension -- +# +# Used internally by pkg_mkIndex to compare the extension of a file to a given +# extension. On Windows, it uses a case-insensitive comparison because the +# file system can be file insensitive. +# +# Arguments: +# fileName name of a file whose extension is compared +# ext (optional) The extension to compare against; you must +# provide the starting dot. +# Defaults to [info sharedlibextension] +# +# Results: +# Returns 1 if the extension matches, 0 otherwise + +proc tcl::Pkg::CompareExtension {fileName {ext {}}} { + global tcl_platform + if {$ext eq ""} {set ext [info sharedlibextension]} + if {$tcl_platform(platform) eq "windows"} { + return [string equal -nocase [file extension $fileName] $ext] + } else { + # Some unices add trailing numbers after the .so, so + # we could have something like '.so.1.2'. + set root $fileName + while {1} { + set currExt [file extension $root] + if {$currExt eq $ext} { + return 1 + } + + # The current extension does not match; if it is not a numeric + # value, quit, as we are only looking to ignore version number + # extensions. Otherwise we might return 1 in this case: + # tcl::Pkg::CompareExtension foo.so.bar .so + # which should not match. + + if {![string is integer -strict [string range $currExt 1 end]]} { + return 0 + } + set root [file rootname $root] + } + } +} + +# pkg_mkIndex -- +# This procedure creates a package index in a given directory. The package +# index consists of a "pkgIndex.tcl" file whose contents are a Tcl script that +# sets up package information with "package require" commands. The commands +# describe all of the packages defined by the files given as arguments. +# +# Arguments: +# -direct (optional) If this flag is present, the generated +# code in pkgMkIndex.tcl will cause the package to be +# loaded when "package require" is executed, rather +# than lazily when the first reference to an exported +# procedure in the package is made. +# -verbose (optional) Verbose output; the name of each file that +# was successfully processed is printed out. Additionally, +# if processing of a file failed a message is printed. +# -load pat (optional) Preload any packages whose names match +# the pattern. Used to handle DLLs that depend on +# other packages during their Init procedure. +# dir - Name of the directory in which to create the index. +# args - Any number of additional arguments, each giving +# a glob pattern that matches the names of one or +# more shared libraries or Tcl script files in +# dir. + +proc pkg_mkIndex {args} { + set usage {"pkg_mkIndex ?-direct? ?-lazy? ?-load pattern? ?-verbose? ?--? dir ?pattern ...?"} + + set argCount [llength $args] + if {$argCount < 1} { + return -code error "wrong # args: should be\n$usage" + } + + set more "" + set direct 1 + set doVerbose 0 + set loadPat "" + for {set idx 0} {$idx < $argCount} {incr idx} { + set flag [lindex $args $idx] + switch -glob -- $flag { + -- { + # done with the flags + incr idx + break + } + -verbose { + set doVerbose 1 + } + -lazy { + set direct 0 + append more " -lazy" + } + -direct { + append more " -direct" + } + -load { + incr idx + set loadPat [lindex $args $idx] + append more " -load $loadPat" + } + -* { + return -code error "unknown flag $flag: should be\n$usage" + } + default { + # done with the flags + break + } + } + } + + set dir [lindex $args $idx] + set patternList [lrange $args [expr {$idx + 1}] end] + if {![llength $patternList]} { + set patternList [list "*.tcl" "*[info sharedlibextension]"] + } + + try { + set fileList [glob -directory $dir -tails -types {r f} -- \ + {*}$patternList] + } on error {msg opt} { + return -options $opt $msg + } + foreach file $fileList { + # For each file, figure out what commands and packages it provides. + # To do this, create a child interpreter, load the file into the + # interpreter, and get a list of the new commands and packages that + # are defined. + + if {$file eq "pkgIndex.tcl"} { + continue + } + + set c [interp create] + + # Load into the child any packages currently loaded in the parent + # interpreter that match the -load pattern. + + if {$loadPat ne ""} { + if {$doVerbose} { + tclLog "currently loaded packages: '[info loaded]'" + tclLog "trying to load all packages matching $loadPat" + } + if {![llength [info loaded]]} { + tclLog "warning: no packages are currently loaded, nothing" + tclLog "can possibly match '$loadPat'" + } + } + foreach pkg [info loaded] { + if {![string match -nocase $loadPat [lindex $pkg 1]]} { + continue + } + if {$doVerbose} { + tclLog "package [lindex $pkg 1] matches '$loadPat'" + } + try { + load [lindex $pkg 0] [lindex $pkg 1] $c + } on error err { + if {$doVerbose} { + tclLog "warning: load [lindex $pkg 0]\ + [lindex $pkg 1]\nfailed with: $err" + } + } on ok {} { + if {$doVerbose} { + tclLog "loaded [lindex $pkg 0] [lindex $pkg 1]" + } + } + if {[lindex $pkg 1] eq "Tk"} { + # Withdraw . if Tk was loaded, to avoid showing a window. + $c eval [list wm withdraw .] + } + } + + $c eval { + # Stub out the package command so packages can require other + # packages. + + rename package __package_orig + proc package {what args} { + switch -- $what { + require { + return; # Ignore transitive requires + } + default { + __package_orig $what {*}$args + } + } + } + proc tclPkgUnknown args {} + package unknown tclPkgUnknown + + # Stub out the unknown command so package can call into each other + # during their initialization. + + proc unknown {args} {} + + # Stub out the auto_import mechanism + + proc auto_import {args} {} + + # reserve the ::tcl namespace for support procs and temporary + # variables. This might make it awkward to generate a + # pkgIndex.tcl file for the ::tcl namespace. + + namespace eval ::tcl { + variable dir ;# Current directory being processed + variable file ;# Current file being processed + variable direct ;# -direct flag value + variable x ;# Loop variable + variable debug ;# For debugging + variable type ;# "load" or "source", for -direct + variable namespaces ;# Existing namespaces (e.g., ::tcl) + variable packages ;# Existing packages (e.g., Tcl) + variable origCmds ;# Existing commands + variable newCmds ;# Newly created commands + variable newPkgs {} ;# Newly created packages + } + } + + $c eval [list set ::tcl::dir $dir] + $c eval [list set ::tcl::file $file] + $c eval [list set ::tcl::direct $direct] + + # Download needed procedures into the child because we've just deleted + # the unknown procedure. This doesn't handle procedures with default + # arguments. + + foreach p {::tcl::Pkg::CompareExtension} { + $c eval [list namespace eval [namespace qualifiers $p] {}] + $c eval [list proc $p [info args $p] [info body $p]] + } + + try { + $c eval { + set ::tcl::debug "loading or sourcing" + + # we need to track command defined by each package even in the + # -direct case, because they are needed internally by the + # "partial pkgIndex.tcl" step above. + + proc ::tcl::GetAllNamespaces {{root ::}} { + set list $root + foreach ns [namespace children $root] { + lappend list {*}[::tcl::GetAllNamespaces $ns] + } + return $list + } + + # init the list of existing namespaces, packages, commands + + foreach ::tcl::x [::tcl::GetAllNamespaces] { + set ::tcl::namespaces($::tcl::x) 1 + } + foreach ::tcl::x [package names] { + if {[package provide $::tcl::x] ne ""} { + set ::tcl::packages($::tcl::x) 1 + } + } + set ::tcl::origCmds [info commands] + + # Try to load the file if it has the shared library extension, + # otherwise source it. It's important not to try to load + # files that aren't shared libraries, because on some systems + # (like SunOS) the loader will abort the whole application + # when it gets an error. + + if {[::tcl::Pkg::CompareExtension $::tcl::file [info sharedlibextension]]} { + # The "file join ." command below is necessary. Without + # it, if the file name has no \'s and we're on UNIX, the + # load command will invoke the LD_LIBRARY_PATH search + # mechanism, which could cause the wrong file to be used. + + set ::tcl::debug loading + load [file join $::tcl::dir $::tcl::file] + set ::tcl::type load + } else { + set ::tcl::debug sourcing + source -encoding utf-8 [file join $::tcl::dir $::tcl::file] + set ::tcl::type source + } + + # As a performance optimization, if we are creating direct + # load packages, don't bother figuring out the set of commands + # created by the new packages. We only need that list for + # setting up the autoloading used in the non-direct case. + if {!$::tcl::direct} { + # See what new namespaces appeared, and import commands + # from them. Only exported commands go into the index. + + foreach ::tcl::x [::tcl::GetAllNamespaces] { + if {![info exists ::tcl::namespaces($::tcl::x)]} { + namespace import -force ${::tcl::x}::* + } + + # Figure out what commands appeared + + foreach ::tcl::x [info commands] { + set ::tcl::newCmds($::tcl::x) 1 + } + foreach ::tcl::x $::tcl::origCmds { + unset -nocomplain ::tcl::newCmds($::tcl::x) + } + foreach ::tcl::x [array names ::tcl::newCmds] { + # determine which namespace a command comes from + + set ::tcl::abs [namespace origin $::tcl::x] + + # special case so that global names have no + # leading ::, this is required by the unknown + # command + + set ::tcl::abs \ + [lindex [auto_qualify $::tcl::abs ::] 0] + + if {$::tcl::x ne $::tcl::abs} { + # Name changed during qualification + + set ::tcl::newCmds($::tcl::abs) 1 + unset ::tcl::newCmds($::tcl::x) + } + } + } + } + + # Look through the packages that appeared, and if there is a + # version provided, then record it + + foreach ::tcl::x [package names] { + if {[package provide $::tcl::x] ne "" + && ![info exists ::tcl::packages($::tcl::x)]} { + lappend ::tcl::newPkgs \ + [list $::tcl::x [package provide $::tcl::x]] + } + } + } + } on error msg { + set what [$c eval set ::tcl::debug] + if {$doVerbose} { + tclLog "warning: error while $what $file: $msg" + } + } on ok {} { + set what [$c eval set ::tcl::debug] + if {$doVerbose} { + tclLog "successful $what of $file" + } + set type [$c eval set ::tcl::type] + set cmds [lsort [$c eval array names ::tcl::newCmds]] + set pkgs [$c eval set ::tcl::newPkgs] + if {$doVerbose} { + if {!$direct} { + tclLog "commands provided were $cmds" + } + tclLog "packages provided were $pkgs" + } + if {[llength $pkgs] > 1} { + tclLog "warning: \"$file\" provides more than one package ($pkgs)" + } + foreach pkg $pkgs { + # cmds is empty/not used in the direct case + lappend files($pkg) [list $file $type $cmds] + } + + if {$doVerbose} { + tclLog "processed $file" + } + } + interp delete $c + } + + append index "# Tcl package index file, version 1.1\n" + append index "# This file is generated by the \"pkg_mkIndex$more\" command\n" + append index "# and sourced either when an application starts up or\n" + append index "# by a \"package unknown\" script. It invokes the\n" + append index "# \"package ifneeded\" command to set up package-related\n" + append index "# information so that packages will be loaded automatically\n" + append index "# in response to \"package require\" commands. When this\n" + append index "# script is sourced, the variable \$dir must contain the\n" + append index "# full path name of this file's directory.\n" + + foreach pkg [lsort [array names files]] { + set cmd {} + lassign $pkg name version + lappend cmd ::tcl::Pkg::Create -name $name -version $version + foreach spec [lsort -index 0 $files($pkg)] { + foreach {file type procs} $spec { + if {$direct} { + set procs {} + } + lappend cmd "-$type" [list $file $procs] + } + } + append index "\n[eval $cmd]" + } + + set f [open [file join $dir pkgIndex.tcl] w] + puts $f $index + close $f +} + +# tclPkgSetup -- +# This is a utility procedure use by pkgIndex.tcl files. It is invoked as +# part of a "package ifneeded" script. It calls "package provide" to indicate +# that a package is available, then sets entries in the auto_index array so +# that the package's files will be auto-loaded when the commands are used. +# +# Arguments: +# dir - Directory containing all the files for this package. +# pkg - Name of the package (no version number). +# version - Version number for the package, such as 2.1.3. +# files - List of files that constitute the package. Each +# element is a sub-list with three elements. The first +# is the name of a file relative to $dir, the second is +# "load" or "source", indicating whether the file is a +# loadable binary or a script to source, and the third +# is a list of commands defined by this file. + +proc tclPkgSetup {dir pkg version files} { + global auto_index + + package provide $pkg $version + foreach fileInfo $files { + set f [lindex $fileInfo 0] + set type [lindex $fileInfo 1] + foreach cmd [lindex $fileInfo 2] { + if {$type eq "load"} { + set auto_index($cmd) [list load [file join $dir $f] $pkg] + } else { + set auto_index($cmd) [list source -encoding utf-8 [file join $dir $f]] + } + } + } +} + +# tclPkgUnknown -- +# This procedure provides the default for the "package unknown" function. It +# is invoked when a package that's needed can't be found. It scans the +# auto_path directories and their immediate children looking for pkgIndex.tcl +# files and sources any such files that are found to setup the package +# database. As it searches, it will recognize changes to the auto_path and +# scan any new directories. +# +# Arguments: +# name - Name of desired package. Not used. +# version - Version of desired package. Not used. +# exact - Either "-exact" or omitted. Not used. + +proc tclPkgUnknown {name args} { + global auto_path env + + if {![info exists auto_path]} { + return + } + # Cache the auto_path, because it may change while we run through the + # first set of pkgIndex.tcl files + set old_path [set use_path $auto_path] + while {[llength $use_path]} { + set dir [lindex $use_path end] + + # Make sure we only scan each directory one time. + if {[info exists tclSeenPath($dir)]} { + set use_path [lrange $use_path 0 end-1] + continue + } + set tclSeenPath($dir) 1 + + # Get the pkgIndex.tcl files in subdirectories of auto_path directories. + # - Safe Base interpreters have a restricted "glob" command that + # works in this case. + # - The "catch" was essential when there was no safe glob and every + # call in a safe interp failed; it is retained only for corner + # cases in which the eventual call to glob returns an error. + catch { + foreach file [glob -directory $dir -join -nocomplain \ + * pkgIndex.tcl] { + set dir [file dirname $file] + if {![info exists procdDirs($dir)]} { + try { + source -encoding utf-8 $file + } trap {POSIX EACCES} {} { + # $file was not readable; silently ignore + continue + } on error msg { + tclLog "error reading package index file $file: $msg" + } on ok {} { + set procdDirs($dir) 1 + } + } + } + } + set dir [lindex $use_path end] + if {![info exists procdDirs($dir)]} { + set file [file join $dir pkgIndex.tcl] + # safe interps usually don't have "file exists", + if {([interp issafe] || [file exists $file])} { + try { + source -encoding utf-8 $file + } trap {POSIX EACCES} {} { + # $file was not readable; silently ignore + continue + } on error msg { + tclLog "error reading package index file $file: $msg" + } on ok {} { + set procdDirs($dir) 1 + } + } + } + + set use_path [lrange $use_path 0 end-1] + + # Check whether any of the index scripts we [source]d above set a new + # value for $::auto_path. If so, then find any new directories on the + # $::auto_path, and lappend them to the $use_path we are working from. + # This gives index scripts the (arguably unwise) power to expand the + # index script search path while the search is in progress. + set index 0 + if {[llength $old_path] == [llength $auto_path]} { + foreach dir $auto_path old $old_path { + if {$dir ne $old} { + # This entry in $::auto_path has changed. + break + } + incr index + } + } + + # $index now points to the first element of $auto_path that has + # changed, or the beginning if $auto_path has changed length Scan the + # new elements of $auto_path for directories to add to $use_path. + # Don't add directories we've already seen, or ones already on the + # $use_path. + foreach dir [lrange $auto_path $index end] { + if {![info exists tclSeenPath($dir)] && ($dir ni $use_path)} { + lappend use_path $dir + } + } + set old_path $auto_path + } +} + +# tcl::MacOSXPkgUnknown -- +# This procedure extends the "package unknown" function for MacOSX. It scans +# the Resources/Scripts directories of the immediate children of the auto_path +# directories for pkgIndex files. +# +# Arguments: +# original - original [package unknown] procedure +# name - Name of desired package. Not used. +# version - Version of desired package. Not used. +# exact - Either "-exact" or omitted. Not used. + +proc tcl::MacOSXPkgUnknown {original name args} { + # First do the cross-platform default search + uplevel 1 $original [linsert $args 0 $name] + + # Now do MacOSX specific searching + global auto_path + + if {![info exists auto_path]} { + return + } + # Cache the auto_path, because it may change while we run through the + # first set of pkgIndex.tcl files + set old_path [set use_path $auto_path] + while {[llength $use_path]} { + set dir [lindex $use_path end] + + # Make sure we only scan each directory one time. + if {[info exists tclSeenPath($dir)]} { + set use_path [lrange $use_path 0 end-1] + continue + } + set tclSeenPath($dir) 1 + + # get the pkgIndex files out of the subdirectories + # Safe interpreters do not use tcl::MacOSXPkgUnknown - see init.tcl. + foreach file [glob -directory $dir -join -nocomplain \ + * Resources Scripts pkgIndex.tcl] { + set dir [file dirname $file] + if {![info exists procdDirs($dir)]} { + try { + source $file + } trap {POSIX EACCES} {} { + # $file was not readable; silently ignore + continue + } on error msg { + tclLog "error reading package index file $file: $msg" + } on ok {} { + set procdDirs($dir) 1 + } + } + } + set use_path [lrange $use_path 0 end-1] + + # Check whether any of the index scripts we [source]d above set a new + # value for $::auto_path. If so, then find any new directories on the + # $::auto_path, and lappend them to the $use_path we are working from. + # This gives index scripts the (arguably unwise) power to expand the + # index script search path while the search is in progress. + set index 0 + if {[llength $old_path] == [llength $auto_path]} { + foreach dir $auto_path old $old_path { + if {$dir ne $old} { + # This entry in $::auto_path has changed. + break + } + incr index + } + } + + # $index now points to the first element of $auto_path that has + # changed, or the beginning if $auto_path has changed length Scan the + # new elements of $auto_path for directories to add to $use_path. + # Don't add directories we've already seen, or ones already on the + # $use_path. + foreach dir [lrange $auto_path $index end] { + if {![info exists tclSeenPath($dir)] && ($dir ni $use_path)} { + lappend use_path $dir + } + } + set old_path $auto_path + } +} + +# ::tcl::Pkg::Create -- +# +# Given a package specification generate a "package ifneeded" statement +# for the package, suitable for inclusion in a pkgIndex.tcl file. +# +# Arguments: +# args arguments used by the Create function: +# -name packageName +# -version packageVersion +# -load {filename ?{procs}?} +# ... +# -source {filename ?{procs}?} +# ... +# +# Any number of -load and -source parameters may be +# specified, so long as there is at least one -load or +# -source parameter. If the procs component of a module +# specifier is left off, that module will be set up for +# direct loading; otherwise, it will be set up for lazy +# loading. If both -source and -load are specified, the +# -load'ed files will be loaded first, followed by the +# -source'd files. +# +# Results: +# An appropriate "package ifneeded" statement for the package. + +proc ::tcl::Pkg::Create {args} { + append err(usage) "[lindex [info level 0] 0] " + append err(usage) "-name packageName -version packageVersion" + append err(usage) "?-load {filename ?{procs}?}? ... " + append err(usage) "?-source {filename ?{procs}?}? ..." + + set err(wrongNumArgs) "wrong # args: should be \"$err(usage)\"" + set err(valueMissing) "value for \"%s\" missing: should be \"$err(usage)\"" + set err(unknownOpt) "unknown option \"%s\": should be \"$err(usage)\"" + set err(noLoadOrSource) "at least one of -load and -source must be given" + + # process arguments + set len [llength $args] + if {$len < 6} { + error $err(wrongNumArgs) + } + + # Initialize parameters + array set opts {-name {} -version {} -source {} -load {}} + + # process parameters + for {set i 0} {$i < $len} {incr i} { + set flag [lindex $args $i] + incr i + switch -glob -- $flag { + "-name" - + "-version" { + if {$i >= $len} { + error [format $err(valueMissing) $flag] + } + set opts($flag) [lindex $args $i] + } + "-source" - + "-load" { + if {$i >= $len} { + error [format $err(valueMissing) $flag] + } + lappend opts($flag) [lindex $args $i] + } + default { + error [format $err(unknownOpt) [lindex $args $i]] + } + } + } + + # Validate the parameters + if {![llength $opts(-name)]} { + error [format $err(valueMissing) "-name"] + } + if {![llength $opts(-version)]} { + error [format $err(valueMissing) "-version"] + } + + if {!([llength $opts(-source)] || [llength $opts(-load)])} { + error $err(noLoadOrSource) + } + + # OK, now everything is good. Generate the package ifneeded statement. + set cmdline "package ifneeded $opts(-name) $opts(-version) " + + set cmdList {} + set lazyFileList {} + + # Handle -load and -source specs + foreach key {load source} { + foreach filespec $opts(-$key) { + lassign $filespec filename proclist + + if { [llength $proclist] == 0 } { + set cmd "\[list $key \[file join \$dir [list $filename]\]\]" + lappend cmdList $cmd + } else { + lappend lazyFileList [list $filename $key $proclist] + } + } + } + + if {[llength $lazyFileList]} { + lappend cmdList "\[list tclPkgSetup \$dir $opts(-name)\ + $opts(-version) [list $lazyFileList]\]" + } + append cmdline [join $cmdList "\\n"] + return $cmdline +} + +interp alias {} ::pkg::create {} ::tcl::Pkg::Create diff --git a/miniconda3/envs/active_proaction/lib/tcl8.6/parray.tcl b/miniconda3/envs/active_proaction/lib/tcl8.6/parray.tcl new file mode 100644 index 0000000000000000000000000000000000000000..a9c2cb15a9bd81339f2d91535b3758bb4785023e --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/tcl8.6/parray.tcl @@ -0,0 +1,28 @@ +# parray: +# Print the contents of a global array on stdout. +# +# Copyright (c) 1991-1993 The Regents of the University of California. +# Copyright (c) 1994 Sun Microsystems, Inc. +# +# See the file "license.terms" for information on usage and redistribution +# of this file, and for a DISCLAIMER OF ALL WARRANTIES. +# + +proc parray {a {pattern *}} { + upvar 1 $a array + if {![array exists array]} { + return -code error "\"$a\" isn't an array" + } + set maxl 0 + set names [lsort [array names array $pattern]] + foreach name $names { + if {[string length $name] > $maxl} { + set maxl [string length $name] + } + } + set maxl [expr {$maxl + [string length $a] + 2}] + foreach name $names { + set nameString [format %s(%s) $a $name] + puts stdout [format "%-*s = %s" $maxl $nameString $array($name)] + } +} diff --git a/miniconda3/envs/active_proaction/lib/tcl8.6/safe.tcl b/miniconda3/envs/active_proaction/lib/tcl8.6/safe.tcl new file mode 100644 index 0000000000000000000000000000000000000000..7a8fcdbdccea1ab3d8f0b4f110a41c2dc20ba8a6 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/tcl8.6/safe.tcl @@ -0,0 +1,1293 @@ +# safe.tcl -- +# +# This file provide a safe loading/sourcing mechanism for safe interpreters. +# It implements a virtual path mechanism to hide the real pathnames from the +# child. It runs in a parent interpreter and sets up data structure and +# aliases that will be invoked when used from a child interpreter. +# +# See the safe.n man page for details. +# +# Copyright (c) 1996-1997 Sun Microsystems, Inc. +# +# See the file "license.terms" for information on usage and redistribution of +# this file, and for a DISCLAIMER OF ALL WARRANTIES. + +# +# The implementation is based on namespaces. These naming conventions are +# followed: +# Private procs starts with uppercase. +# Public procs are exported and starts with lowercase +# + +# Needed utilities package +package require opt 0.4.8 + +# Create the safe namespace +namespace eval ::safe { + # Exported API: + namespace export interpCreate interpInit interpConfigure interpDelete \ + interpAddToAccessPath interpFindInAccessPath setLogCmd +} + +# Helper function to resolve the dual way of specifying staticsok (either +# by -noStatics or -statics 0) +proc ::safe::InterpStatics {} { + foreach v {Args statics noStatics} { + upvar $v $v + } + set flag [::tcl::OptProcArgGiven -noStatics] + if {$flag && (!$noStatics == !$statics) + && ([::tcl::OptProcArgGiven -statics])} { + return -code error\ + "conflicting values given for -statics and -noStatics" + } + if {$flag} { + return [expr {!$noStatics}] + } else { + return $statics + } +} + +# Helper function to resolve the dual way of specifying nested loading +# (either by -nestedLoadOk or -nested 1) +proc ::safe::InterpNested {} { + foreach v {Args nested nestedLoadOk} { + upvar $v $v + } + set flag [::tcl::OptProcArgGiven -nestedLoadOk] + # note that the test here is the opposite of the "InterpStatics" one + # (it is not -noNested... because of the wanted default value) + if {$flag && (!$nestedLoadOk != !$nested) + && ([::tcl::OptProcArgGiven -nested])} { + return -code error\ + "conflicting values given for -nested and -nestedLoadOk" + } + if {$flag} { + # another difference with "InterpStatics" + return $nestedLoadOk + } else { + return $nested + } +} + +#### +# +# API entry points that needs argument parsing : +# +#### + +# Interface/entry point function and front end for "Create" +proc ::safe::interpCreate {args} { + set Args [::tcl::OptKeyParse ::safe::interpCreate $args] + RejectExcessColons $slave + InterpCreate $slave $accessPath \ + [InterpStatics] [InterpNested] $deleteHook +} + +proc ::safe::interpInit {args} { + set Args [::tcl::OptKeyParse ::safe::interpIC $args] + if {![::interp exists $slave]} { + return -code error "\"$slave\" is not an interpreter" + } + RejectExcessColons $slave + InterpInit $slave $accessPath \ + [InterpStatics] [InterpNested] $deleteHook +} + +# Check that the given child is "one of us" +proc ::safe::CheckInterp {child} { + namespace upvar ::safe [VarName $child] state + if {![info exists state] || ![::interp exists $child]} { + return -code error \ + "\"$child\" is not an interpreter managed by ::safe::" + } +} + +# Interface/entry point function and front end for "Configure". This code +# is awfully pedestrian because it would need more coupling and support +# between the way we store the configuration values in safe::interp's and +# the Opt package. Obviously we would like an OptConfigure to avoid +# duplicating all this code everywhere. +# -> TODO (the app should share or access easily the program/value stored +# by opt) + +# This is even more complicated by the boolean flags with no values that +# we had the bad idea to support for the sake of user simplicity in +# create/init but which makes life hard in configure... +# So this will be hopefully written and some integrated with opt1.0 +# (hopefully for tcl8.1 ?) +proc ::safe::interpConfigure {args} { + switch [llength $args] { + 1 { + # If we have exactly 1 argument the semantic is to return all + # the current configuration. We still call OptKeyParse though + # we know that "child" is our given argument because it also + # checks for the "-help" option. + set Args [::tcl::OptKeyParse ::safe::interpIC $args] + CheckInterp $slave + namespace upvar ::safe [VarName $slave] state + + return [join [list \ + [list -accessPath $state(access_path)] \ + [list -statics $state(staticsok)] \ + [list -nested $state(nestedok)] \ + [list -deleteHook $state(cleanupHook)]]] + } + 2 { + # If we have exactly 2 arguments the semantic is a "configure + # get" + lassign $args slave arg + + # get the flag sub program (we 'know' about Opt's internal + # representation of data) + set desc [lindex [::tcl::OptKeyGetDesc ::safe::interpIC] 2] + set hits [::tcl::OptHits desc $arg] + if {$hits > 1} { + return -code error [::tcl::OptAmbigous $desc $arg] + } elseif {$hits == 0} { + return -code error [::tcl::OptFlagUsage $desc $arg] + } + CheckInterp $slave + namespace upvar ::safe [VarName $slave] state + + set item [::tcl::OptCurDesc $desc] + set name [::tcl::OptName $item] + switch -exact -- $name { + -accessPath { + return [list -accessPath $state(access_path)] + } + -statics { + return [list -statics $state(staticsok)] + } + -nested { + return [list -nested $state(nestedok)] + } + -deleteHook { + return [list -deleteHook $state(cleanupHook)] + } + -noStatics { + # it is most probably a set in fact but we would need + # then to jump to the set part and it is not *sure* + # that it is a set action that the user want, so force + # it to use the unambiguous -statics ?value? instead: + return -code error\ + "ambigous query (get or set -noStatics ?)\ + use -statics instead" + } + -nestedLoadOk { + return -code error\ + "ambigous query (get or set -nestedLoadOk ?)\ + use -nested instead" + } + default { + return -code error "unknown flag $name (bug)" + } + } + } + default { + # Otherwise we want to parse the arguments like init and + # create did + set Args [::tcl::OptKeyParse ::safe::interpIC $args] + CheckInterp $slave + namespace upvar ::safe [VarName $slave] state + + # Get the current (and not the default) values of whatever has + # not been given: + if {![::tcl::OptProcArgGiven -accessPath]} { + set doreset 0 + set accessPath $state(access_path) + } else { + set doreset 1 + } + if { + ![::tcl::OptProcArgGiven -statics] + && ![::tcl::OptProcArgGiven -noStatics] + } then { + set statics $state(staticsok) + } else { + set statics [InterpStatics] + } + if { + [::tcl::OptProcArgGiven -nested] || + [::tcl::OptProcArgGiven -nestedLoadOk] + } then { + set nested [InterpNested] + } else { + set nested $state(nestedok) + } + if {![::tcl::OptProcArgGiven -deleteHook]} { + set deleteHook $state(cleanupHook) + } + # we can now reconfigure : + InterpSetConfig $slave $accessPath $statics $nested $deleteHook + # auto_reset the child (to completely synch the new access_path) + if {$doreset} { + if {[catch {::interp eval $slave {auto_reset}} msg]} { + Log $slave "auto_reset failed: $msg" + } else { + Log $slave "successful auto_reset" NOTICE + } + + # Sync the paths used to search for Tcl modules. + ::interp eval $slave {tcl::tm::path remove {*}[tcl::tm::list]} + if {[llength $state(tm_path_slave)] > 0} { + ::interp eval $slave [list \ + ::tcl::tm::add {*}[lreverse $state(tm_path_slave)]] + } + + # Remove stale "package ifneeded" data for non-loaded packages. + # - Not for loaded packages, because "package forget" erases + # data from "package provide" as well as "package ifneeded". + # - This is OK because the script cannot reload any version of + # the package unless it first does "package forget". + foreach pkg [::interp eval $slave {package names}] { + if {[::interp eval $slave [list package provide $pkg]] eq ""} { + ::interp eval $slave [list package forget $pkg] + } + } + } + return + } + } +} + +#### +# +# Functions that actually implements the exported APIs +# +#### + +# +# safe::InterpCreate : doing the real job +# +# This procedure creates a safe interpreter and initializes it with the safe +# base aliases. +# NB: child name must be simple alphanumeric string, no spaces, no (), no +# {},... {because the state array is stored as part of the name} +# +# Returns the child name. +# +# Optional Arguments : +# + child name : if empty, generated name will be used +# + access_path: path list controlling where load/source can occur, +# if empty: the parent auto_path will be used. +# + staticsok : flag, if 0 :no static package can be loaded (load {} Xxx) +# if 1 :static packages are ok. +# + nestedok: flag, if 0 :no loading to sub-sub interps (load xx xx sub) +# if 1 : multiple levels are ok. + +# use the full name and no indent so auto_mkIndex can find us +proc ::safe::InterpCreate { + child + access_path + staticsok + nestedok + deletehook + } { + # Create the child. + # If evaluated in ::safe, the interpreter command for foo is ::foo; + # but for foo::bar is safe::foo::bar. So evaluate in :: instead. + if {$child ne ""} { + namespace eval :: [list ::interp create -safe $child] + } else { + # empty argument: generate child name + set child [::interp create -safe] + } + Log $child "Created" NOTICE + + # Initialize it. (returns child name) + InterpInit $child $access_path $staticsok $nestedok $deletehook +} + +# +# InterpSetConfig (was setAccessPath) : +# Sets up child virtual auto_path and corresponding structure within +# the parent. Also sets the tcl_library in the child to be the first +# directory in the path. +# NB: If you change the path after the child has been initialized you +# probably need to call "auto_reset" in the child in order that it gets +# the right auto_index() array values. + +proc ::safe::InterpSetConfig {child access_path staticsok nestedok deletehook} { + global auto_path + + # determine and store the access path if empty + if {$access_path eq ""} { + set access_path $auto_path + + # Make sure that tcl_library is in auto_path and at the first + # position (needed by setAccessPath) + set where [lsearch -exact $access_path [info library]] + if {$where < 0} { + # not found, add it. + set access_path [linsert $access_path 0 [info library]] + Log $child "tcl_library was not in auto_path,\ + added it to slave's access_path" NOTICE + } elseif {$where != 0} { + # not first, move it first + set access_path [linsert \ + [lreplace $access_path $where $where] \ + 0 [info library]] + Log $child "tcl_libray was not in first in auto_path,\ + moved it to front of slave's access_path" NOTICE + } + + # Add 1st level subdirs (will searched by auto loading from tcl + # code in the child using glob and thus fail, so we add them here + # so by default it works the same). + set access_path [AddSubDirs $access_path] + } + + Log $child "Setting accessPath=($access_path) staticsok=$staticsok\ + nestedok=$nestedok deletehook=($deletehook)" NOTICE + + namespace upvar ::safe [VarName $child] state + + # clear old autopath if it existed + # build new one + # Extend the access list with the paths used to look for Tcl Modules. + # We save the virtual form separately as well, as syncing it with the + # child has to be deferred until the necessary commands are present for + # setup. + + set norm_access_path {} + set slave_access_path {} + set map_access_path {} + set remap_access_path {} + set slave_tm_path {} + + set i 0 + foreach dir $access_path { + set token [PathToken $i] + lappend slave_access_path $token + lappend map_access_path $token $dir + lappend remap_access_path $dir $token + lappend norm_access_path [file normalize $dir] + incr i + } + + set morepaths [::tcl::tm::list] + set firstpass 1 + while {[llength $morepaths]} { + set addpaths $morepaths + set morepaths {} + + foreach dir $addpaths { + # Prevent the addition of dirs on the tm list to the + # result if they are already known. + if {[dict exists $remap_access_path $dir]} { + if {$firstpass} { + # $dir is in [::tcl::tm::list] and belongs in the slave_tm_path. + # Later passes handle subdirectories, which belong in the + # access path but not in the module path. + lappend slave_tm_path [dict get $remap_access_path $dir] + } + continue + } + + set token [PathToken $i] + lappend access_path $dir + lappend slave_access_path $token + lappend map_access_path $token $dir + lappend remap_access_path $dir $token + lappend norm_access_path [file normalize $dir] + if {$firstpass} { + # $dir is in [::tcl::tm::list] and belongs in the slave_tm_path. + # Later passes handle subdirectories, which belong in the + # access path but not in the module path. + lappend slave_tm_path $token + } + incr i + + # [Bug 2854929] + # Recursively find deeper paths which may contain + # modules. Required to handle modules with names like + # 'platform::shell', which translate into + # 'platform/shell-X.tm', i.e arbitrarily deep + # subdirectories. + lappend morepaths {*}[glob -nocomplain -directory $dir -type d *] + } + set firstpass 0 + } + + set state(access_path) $access_path + set state(access_path,map) $map_access_path + set state(access_path,remap) $remap_access_path + set state(access_path,norm) $norm_access_path + set state(access_path,slave) $slave_access_path + set state(tm_path_slave) $slave_tm_path + set state(staticsok) $staticsok + set state(nestedok) $nestedok + set state(cleanupHook) $deletehook + + SyncAccessPath $child + return +} + +# +# +# FindInAccessPath: +# Search for a real directory and returns its virtual Id (including the +# "$") +proc ::safe::interpFindInAccessPath {child path} { + CheckInterp $child + namespace upvar ::safe [VarName $child] state + + if {![dict exists $state(access_path,remap) $path]} { + return -code error "$path not found in access path" + } + + return [dict get $state(access_path,remap) $path] +} + +# +# addToAccessPath: +# add (if needed) a real directory to access path and return its +# virtual token (including the "$"). +proc ::safe::interpAddToAccessPath {child path} { + # first check if the directory is already in there + # (inlined interpFindInAccessPath). + CheckInterp $child + namespace upvar ::safe [VarName $child] state + + if {[dict exists $state(access_path,remap) $path]} { + return [dict get $state(access_path,remap) $path] + } + + # new one, add it: + set token [PathToken [llength $state(access_path)]] + + lappend state(access_path) $path + lappend state(access_path,slave) $token + lappend state(access_path,map) $token $path + lappend state(access_path,remap) $path $token + lappend state(access_path,norm) [file normalize $path] + + SyncAccessPath $child + return $token +} + +# This procedure applies the initializations to an already existing +# interpreter. It is useful when you want to install the safe base aliases +# into a preexisting safe interpreter. +proc ::safe::InterpInit { + child + access_path + staticsok + nestedok + deletehook + } { + # Configure will generate an access_path when access_path is empty. + InterpSetConfig $child $access_path $staticsok $nestedok $deletehook + + # NB we need to add [namespace current], aliases are always absolute + # paths. + + # These aliases let the child load files to define new commands + # This alias lets the child use the encoding names, convertfrom, + # convertto, and system, but not "encoding system " to set the + # system encoding. + # Handling Tcl Modules, we need a restricted form of Glob. + # This alias interposes on the 'exit' command and cleanly terminates + # the child. + + foreach {command alias} { + source AliasSource + load AliasLoad + encoding AliasEncoding + exit interpDelete + glob AliasGlob + } { + ::interp alias $child $command {} [namespace current]::$alias $child + } + + # This alias lets the child have access to a subset of the 'file' + # command functionality. + + ::interp expose $child file + foreach subcommand {dirname extension rootname tail} { + ::interp alias $child ::tcl::file::$subcommand {} \ + ::safe::AliasFileSubcommand $child $subcommand + } + foreach subcommand { + atime attributes copy delete executable exists isdirectory isfile + link lstat mtime mkdir nativename normalize owned readable readlink + rename size stat tempfile type volumes writable + } { + ::interp alias $child ::tcl::file::$subcommand {} \ + ::safe::BadSubcommand $child file $subcommand + } + + # Subcommands of info + foreach {subcommand alias} { + nameofexecutable AliasExeName + } { + ::interp alias $child ::tcl::info::$subcommand \ + {} [namespace current]::$alias $child + } + + # The allowed child variables already have been set by Tcl_MakeSafe(3) + + # Source init.tcl and tm.tcl into the child, to get auto_load and + # other procedures defined: + + if {[catch {::interp eval $child { + source -encoding utf-8 [file join $tcl_library init.tcl] + }} msg opt]} { + Log $child "can't source init.tcl ($msg)" + return -options $opt "can't source init.tcl into slave $child ($msg)" + } + + if {[catch {::interp eval $child { + source -encoding utf-8 [file join $tcl_library tm.tcl] + }} msg opt]} { + Log $child "can't source tm.tcl ($msg)" + return -options $opt "can't source tm.tcl into slave $child ($msg)" + } + + # Sync the paths used to search for Tcl modules. This can be done only + # now, after tm.tcl was loaded. + namespace upvar ::safe [VarName $child] state + if {[llength $state(tm_path_slave)] > 0} { + ::interp eval $child [list \ + ::tcl::tm::add {*}[lreverse $state(tm_path_slave)]] + } + return $child +} + +# Add (only if needed, avoid duplicates) 1 level of sub directories to an +# existing path list. Also removes non directories from the returned +# list. +proc ::safe::AddSubDirs {pathList} { + set res {} + foreach dir $pathList { + if {[file isdirectory $dir]} { + # check that we don't have it yet as a children of a previous + # dir + if {$dir ni $res} { + lappend res $dir + } + foreach sub [glob -directory $dir -nocomplain *] { + if {[file isdirectory $sub] && ($sub ni $res)} { + # new sub dir, add it ! + lappend res $sub + } + } + } + } + return $res +} + +# This procedure deletes a safe interpreter managed by Safe Tcl and cleans up +# associated state. +# - The command will also delete non-Safe-Base interpreters. +# - This is regrettable, but to avoid breaking existing code this should be +# amended at the next major revision by uncommenting "CheckInterp". + +proc ::safe::interpDelete {child} { + Log $child "About to delete" NOTICE + + # CheckInterp $child + namespace upvar ::safe [VarName $child] state + + # When an interpreter is deleted with [interp delete], any sub-interpreters + # are deleted automatically, but this leaves behind their data in the Safe + # Base. To clean up properly, we call safe::interpDelete recursively on each + # Safe Base sub-interpreter, so each one is deleted cleanly and not by + # the automatic mechanism built into [interp delete]. + foreach sub [interp children $child] { + if {[info exists ::safe::[VarName [list $child $sub]]]} { + ::safe::interpDelete [list $child $sub] + } + } + + # If the child has a cleanup hook registered, call it. Check the + # existence because we might be called to delete an interp which has + # not been registered with us at all + + if {[info exists state(cleanupHook)]} { + set hook $state(cleanupHook) + if {[llength $hook]} { + # remove the hook now, otherwise if the hook calls us somehow, + # we'll loop + unset state(cleanupHook) + try { + {*}$hook $child + } on error err { + Log $child "Delete hook error ($err)" + } + } + } + + # Discard the global array of state associated with the child, and + # delete the interpreter. + + if {[info exists state]} { + unset state + } + + # if we have been called twice, the interp might have been deleted + # already + if {[::interp exists $child]} { + ::interp delete $child + Log $child "Deleted" NOTICE + } + + return +} + +# Set (or get) the logging mechanism + +proc ::safe::setLogCmd {args} { + variable Log + set la [llength $args] + if {$la == 0} { + return $Log + } elseif {$la == 1} { + set Log [lindex $args 0] + } else { + set Log $args + } + + if {$Log eq ""} { + # Disable logging completely. Calls to it will be compiled out + # of all users. + proc ::safe::Log {args} {} + } else { + # Activate logging, define proper command. + + proc ::safe::Log {child msg {type ERROR}} { + variable Log + {*}$Log "$type for slave $child : $msg" + return + } + } +} + +# ------------------- END OF PUBLIC METHODS ------------ + +# +# Sets the child auto_path to the parent recorded value. Also sets +# tcl_library to the first token of the virtual path. +# +proc ::safe::SyncAccessPath {child} { + namespace upvar ::safe [VarName $child] state + + set slave_access_path $state(access_path,slave) + ::interp eval $child [list set auto_path $slave_access_path] + + Log $child "auto_path in $child has been set to $slave_access_path"\ + NOTICE + + # This code assumes that info library is the first element in the + # list of auto_path's. See -> InterpSetConfig for the code which + # ensures this condition. + + ::interp eval $child [list \ + set tcl_library [lindex $slave_access_path 0]] +} + +# Returns the virtual token for directory number N. +proc ::safe::PathToken {n} { + # We need to have a ":" in the token string so [file join] on the + # mac won't turn it into a relative path. + return "\$p(:$n:)" ;# Form tested by case 7.2 +} + +# +# translate virtual path into real path +# +proc ::safe::TranslatePath {child path} { + namespace upvar ::safe [VarName $child] state + + # somehow strip the namespaces 'functionality' out (the danger is that + # we would strip valid macintosh "../" queries... : + if {[string match "*::*" $path] || [string match "*..*" $path]} { + return -code error "invalid characters in path $path" + } + + # Use a cached map instead of computed local vars and subst. + + return [string map $state(access_path,map) $path] +} + +# file name control (limit access to files/resources that should be a +# valid tcl source file) +proc ::safe::CheckFileName {child file} { + # This used to limit what can be sourced to ".tcl" and forbid files + # with more than 1 dot and longer than 14 chars, but I changed that + # for 8.4 as a safe interp has enough internal protection already to + # allow sourcing anything. - hobbs + + if {![file exists $file]} { + # don't tell the file path + return -code error "no such file or directory" + } + + if {![file readable $file]} { + # don't tell the file path + return -code error "not readable" + } +} + +# AliasFileSubcommand handles selected subcommands of [file] in safe +# interpreters that are *almost* safe. In particular, it just acts to +# prevent discovery of what home directories exist. + +proc ::safe::AliasFileSubcommand {child subcommand name} { + if {[string match ~* $name]} { + set name ./$name + } + tailcall ::interp invokehidden $child tcl:file:$subcommand $name +} + +# AliasGlob is the target of the "glob" alias in safe interpreters. + +proc ::safe::AliasGlob {child args} { + Log $child "GLOB ! $args" NOTICE + set cmd {} + set at 0 + array set got { + -directory 0 + -nocomplain 0 + -join 0 + -tails 0 + -- 0 + } + + if {$::tcl_platform(platform) eq "windows"} { + set dirPartRE {^(.*)[\\/]([^\\/]*)$} + } else { + set dirPartRE {^(.*)/([^/]*)$} + } + + set dir {} + set virtualdir {} + + while {$at < [llength $args]} { + switch -glob -- [set opt [lindex $args $at]] { + -nocomplain - -- - -tails { + lappend cmd $opt + set got($opt) 1 + incr at + } + -join { + set got($opt) 1 + incr at + } + -types - -type { + lappend cmd -types [lindex $args [incr at]] + incr at + } + -directory { + if {$got($opt)} { + return -code error \ + {"-directory" cannot be used with "-path"} + } + set got($opt) 1 + set virtualdir [lindex $args [incr at]] + incr at + } + -* { + Log $child "Safe base rejecting glob option '$opt'" + return -code error "Safe base rejecting glob option '$opt'" + } + default { + break + } + } + if {$got(--)} break + } + + # Get the real path from the virtual one and check that the path is in the + # access path of that child. Done after basic argument processing so that + # we know if -nocomplain is set. + if {$got(-directory)} { + try { + set dir [TranslatePath $child $virtualdir] + DirInAccessPath $child $dir + } on error msg { + Log $child $msg + if {$got(-nocomplain)} return + return -code error "permission denied" + } + if {$got(--)} { + set cmd [linsert $cmd end-1 -directory $dir] + } else { + lappend cmd -directory $dir + } + } else { + # The code after this "if ... else" block would conspire to return with + # no results in this case, if it were allowed to proceed. Instead, + # return now and reduce the number of cases to be considered later. + Log $child {option -directory must be supplied} + if {$got(-nocomplain)} return + return -code error "permission denied" + } + + # Apply the -join semantics ourselves. + if {$got(-join)} { + set args [lreplace $args $at end [join [lrange $args $at end] "/"]] + } + + # Process the pattern arguments. If we've done a join there is only one + # pattern argument. + + set firstPattern [llength $cmd] + foreach opt [lrange $args $at end] { + if {![regexp $dirPartRE $opt -> thedir thefile]} { + set thedir . + # The *.tm search comes here. + } + # "Special" treatment for (joined) argument {*/pkgIndex.tcl}. + # Do the expansion of "*" here, and filter out any directories that are + # not in the access path. The outcome is to lappend to cmd a path of + # the form $virtualdir/subdir/pkgIndex.tcl for each subdirectory subdir, + # after removing any subdir that are not in the access path. + if {($thedir eq "*") && ($thefile eq "pkgIndex.tcl")} { + set mapped 0 + foreach d [glob -directory [TranslatePath $child $virtualdir] \ + -types d -tails *] { + catch { + DirInAccessPath $child \ + [TranslatePath $child [file join $virtualdir $d]] + lappend cmd [file join $d $thefile] + set mapped 1 + } + } + if {$mapped} continue + # Don't [continue] if */pkgIndex.tcl has no matches in the access + # path. The pattern will now receive the same treatment as a + # "non-special" pattern (and will fail because it includes a "*" in + # the directory name). + } + # Any directory pattern that is not an exact (i.e. non-glob) match to a + # directory in the access path will be rejected here. + # - Rejections include any directory pattern that has glob matching + # patterns "*", "?", backslashes, braces or square brackets, (UNLESS + # it corresponds to a genuine directory name AND that directory is in + # the access path). + # - The only "special matching characters" that remain in patterns for + # processing by glob are in the filename tail. + # - [file join $anything ~${foo}] is ~${foo}, which is not an exact + # match to any directory in the access path. Hence directory patterns + # that begin with "~" are rejected here. Tests safe-16.[5-8] check + # that "file join" remains as required and does not expand ~${foo}. + # - Bug [3529949] relates to unwanted expansion of ~${foo} and this is + # how the present code avoids the bug. All tests safe-16.* relate. + try { + DirInAccessPath $child [TranslatePath $child \ + [file join $virtualdir $thedir]] + } on error msg { + Log $child $msg + if {$got(-nocomplain)} continue + return -code error "permission denied" + } + lappend cmd $opt + } + + Log $child "GLOB = $cmd" NOTICE + + if {$got(-nocomplain) && [llength $cmd] eq $firstPattern} { + return + } + try { + # >>>>>>>>>> HERE'S THE CALL TO SAFE INTERP GLOB <<<<<<<<<< + # - Pattern arguments added to cmd have NOT been translated from tokens. + # Only the virtualdir is translated (to dir). + # - In the pkgIndex.tcl case, there is no "*" in the pattern arguments, + # which are a list of names each with tail pkgIndex.tcl. The purpose + # of the call to glob is to remove the names for which the file does + # not exist. + set entries [::interp invokehidden $child glob {*}$cmd] + } on error msg { + # This is the only place that a call with -nocomplain and no invalid + # "dash-options" can return an error. + Log $child $msg + return -code error "script error" + } + + Log $child "GLOB < $entries" NOTICE + + # Translate path back to what the child should see. + set res {} + set l [string length $dir] + foreach p $entries { + if {[string equal -length $l $dir $p]} { + set p [string replace $p 0 [expr {$l-1}] $virtualdir] + } + lappend res $p + } + + Log $child "GLOB > $res" NOTICE + return $res +} + +# AliasSource is the target of the "source" alias in safe interpreters. + +proc ::safe::AliasSource {child args} { + set argc [llength $args] + # Extended for handling of Tcl Modules to allow not only "source + # filename", but "source -encoding E filename" as well. + if {[lindex $args 0] eq "-encoding"} { + incr argc -2 + set encoding [lindex $args 1] + set at 2 + if {$encoding eq "identity"} { + Log $child "attempt to use the identity encoding" + return -code error "permission denied" + } + } else { + set at 0 + set encoding {} + } + if {$argc != 1} { + set msg "wrong # args: should be \"source ?-encoding E? fileName\"" + Log $child "$msg ($args)" + return -code error $msg + } + set file [lindex $args $at] + + # get the real path from the virtual one. + if {[catch { + set realfile [TranslatePath $child $file] + } msg]} { + Log $child $msg + return -code error "permission denied" + } + + # check that the path is in the access path of that child + if {[catch { + FileInAccessPath $child $realfile + } msg]} { + Log $child $msg + return -code error "permission denied" + } + + # Check that the filename exists and is readable. If it is not, deliver + # this -errorcode so that caller in tclPkgUnknown does not write a message + # to tclLog. Has no effect on other callers of ::source, which are in + # "package ifneeded" scripts. + if {[catch { + CheckFileName $child $realfile + } msg]} { + Log $child "$realfile:$msg" + return -code error -errorcode {POSIX EACCES} $msg + } + + # Passed all the tests, lets source it. Note that we do this all manually + # because we want to control [info script] in the child so information + # doesn't leak so much. [Bug 2913625] + set old [::interp eval $child {info script}] + set replacementMsg "script error" + set code [catch { + set f [open $realfile] + fconfigure $f -eofchar "\x1A {}" + if {$encoding ne ""} { + fconfigure $f -encoding $encoding + } + set contents [read $f] + close $f + ::interp eval $child [list info script $file] + } msg opt] + if {$code == 0} { + # See [Bug 1d26e580cf] + if {[string index $contents 0] eq "\uFEFF"} { + set contents [string range $contents 1 end] + } + set code [catch {::interp eval $child $contents} msg opt] + set replacementMsg $msg + } + catch {interp eval $child [list info script $old]} + # Note that all non-errors are fine result codes from [source], so we must + # take a little care to do it properly. [Bug 2923613] + if {$code == 1} { + Log $child $msg + return -code error $replacementMsg + } + return -code $code -options $opt $msg +} + +# AliasLoad is the target of the "load" alias in safe interpreters. + +proc ::safe::AliasLoad {child file args} { + set argc [llength $args] + if {$argc > 2} { + set msg "load error: too many arguments" + Log $child "$msg ($argc) {$file $args}" + return -code error $msg + } + + # package name (can be empty if file is not). + set package [lindex $args 0] + + namespace upvar ::safe [VarName $child] state + + # Determine where to load. load use a relative interp path and {} + # means self, so we can directly and safely use passed arg. + set target [lindex $args 1] + if {$target ne ""} { + # we will try to load into a sub sub interp; check that we want to + # authorize that. + if {!$state(nestedok)} { + Log $child "loading to a sub interp (nestedok)\ + disabled (trying to load $package to $target)" + return -code error "permission denied (nested load)" + } + } + + # Determine what kind of load is requested + if {$file eq ""} { + # static package loading + if {$package eq ""} { + set msg "load error: empty filename and no package name" + Log $child $msg + return -code error $msg + } + if {!$state(staticsok)} { + Log $child "static packages loading disabled\ + (trying to load $package to $target)" + return -code error "permission denied (static package)" + } + } else { + # file loading + + # get the real path from the virtual one. + try { + set file [TranslatePath $child $file] + } on error msg { + Log $child $msg + return -code error "permission denied" + } + + # check the translated path + try { + FileInAccessPath $child $file + } on error msg { + Log $child $msg + return -code error "permission denied (path)" + } + } + + try { + return [::interp invokehidden $child load $file $package $target] + } on error msg { + # Some packages return no error message. + set msg0 "load of binary library for package $package failed" + if {$msg eq {}} { + set msg $msg0 + } else { + set msg "$msg0: $msg" + } + Log $child $msg + return -code error $msg + } +} + +# FileInAccessPath raises an error if the file is not found in the list of +# directories contained in the (parent side recorded) child's access path. + +# the security here relies on "file dirname" answering the proper +# result... needs checking ? +proc ::safe::FileInAccessPath {child file} { + namespace upvar ::safe [VarName $child] state + set access_path $state(access_path) + + if {[file isdirectory $file]} { + return -code error "\"$file\": is a directory" + } + set parent [file dirname $file] + + # Normalize paths for comparison since lsearch knows nothing of + # potential pathname anomalies. + set norm_parent [file normalize $parent] + + namespace upvar ::safe [VarName $child] state + if {$norm_parent ni $state(access_path,norm)} { + return -code error "\"$file\": not in access_path" + } +} + +proc ::safe::DirInAccessPath {child dir} { + namespace upvar ::safe [VarName $child] state + set access_path $state(access_path) + + if {[file isfile $dir]} { + return -code error "\"$dir\": is a file" + } + + # Normalize paths for comparison since lsearch knows nothing of + # potential pathname anomalies. + set norm_dir [file normalize $dir] + + namespace upvar ::safe [VarName $child] state + if {$norm_dir ni $state(access_path,norm)} { + return -code error "\"$dir\": not in access_path" + } +} + +# This procedure is used to report an attempt to use an unsafe member of an +# ensemble command. + +proc ::safe::BadSubcommand {child command subcommand args} { + set msg "not allowed to invoke subcommand $subcommand of $command" + Log $child $msg + return -code error -errorcode {TCL SAFE SUBCOMMAND} $msg +} + +# AliasEncoding is the target of the "encoding" alias in safe interpreters. + +proc ::safe::AliasEncoding {child option args} { + # Note that [encoding dirs] is not supported in safe children at all + set subcommands {convertfrom convertto names system} + try { + set option [tcl::prefix match -error [list -level 1 -errorcode \ + [list TCL LOOKUP INDEX option $option]] $subcommands $option] + # Special case: [encoding system] ok, but [encoding system foo] not + if {$option eq "system" && [llength $args]} { + return -code error -errorcode {TCL WRONGARGS} \ + "wrong # args: should be \"encoding system\"" + } + } on error {msg options} { + Log $child $msg + return -options $options $msg + } + tailcall ::interp invokehidden $child encoding $option {*}$args +} + +# Various minor hiding of platform features. [Bug 2913625] + +proc ::safe::AliasExeName {child} { + return "" +} + +# ------------------------------------------------------------------------------ +# Using Interpreter Names with Namespace Qualifiers +# ------------------------------------------------------------------------------ +# (1) We wish to preserve compatibility with existing code, in which Safe Base +# interpreter names have no namespace qualifiers. +# (2) safe::interpCreate and the rest of the Safe Base previously could not +# accept namespace qualifiers in an interpreter name. +# (3) The interp command will accept namespace qualifiers in an interpreter +# name, but accepts distinct interpreters that will have the same command +# name (e.g. foo, ::foo, and :::foo) (bug 66c2e8c974). +# (4) To satisfy these constraints, Safe Base interpreter names will be fully +# qualified namespace names with no excess colons and with the leading "::" +# omitted. +# (5) Trailing "::" implies a namespace tail {}, which interp reads as {{}}. +# Reject such names. +# (6) We could: +# (a) EITHER reject usable but non-compliant names (e.g. excess colons) in +# interpCreate, interpInit; +# (b) OR accept such names and then translate to a compliant name in every +# command. +# The problem with (b) is that the user will expect to use the name with the +# interp command and will find that it is not recognised. +# E.g "interpCreate ::foo" creates interpreter "foo", and the user's name +# "::foo" works with all the Safe Base commands, but "interp eval ::foo" +# fails. +# So we choose (a). +# (7) The command +# namespace upvar ::safe S$child state +# becomes +# namespace upvar ::safe [VarName $child] state +# ------------------------------------------------------------------------------ + +proc ::safe::RejectExcessColons {child} { + set stripped [regsub -all -- {:::*} $child ::] + if {[string range $stripped end-1 end] eq {::}} { + return -code error {interpreter name must not end in "::"} + } + if {$stripped ne $child} { + set msg {interpreter name has excess colons in namespace separators} + return -code error $msg + } + if {[string range $stripped 0 1] eq {::}} { + return -code error {interpreter name must not begin "::"} + } + return +} + +proc ::safe::VarName {child} { + # return S$child + return S[string map {:: @N @ @A} $child] +} + +proc ::safe::Setup {} { + #### + # + # Setup the arguments parsing + # + #### + + # Share the descriptions + set temp [::tcl::OptKeyRegister { + {-accessPath -list {} "access path for the slave"} + {-noStatics "prevent loading of statically linked pkgs"} + {-statics true "loading of statically linked pkgs"} + {-nestedLoadOk "allow nested loading"} + {-nested false "nested loading"} + {-deleteHook -script {} "delete hook"} + }] + + # create case (slave is optional) + ::tcl::OptKeyRegister { + {?slave? -name {} "name of the slave (optional)"} + } ::safe::interpCreate + + # adding the flags sub programs to the command program (relying on Opt's + # internal implementation details) + lappend ::tcl::OptDesc(::safe::interpCreate) $::tcl::OptDesc($temp) + + # init and configure (slave is needed) + ::tcl::OptKeyRegister { + {slave -name {} "name of the slave"} + } ::safe::interpIC + + # adding the flags sub programs to the command program (relying on Opt's + # internal implementation details) + lappend ::tcl::OptDesc(::safe::interpIC) $::tcl::OptDesc($temp) + + # temp not needed anymore + ::tcl::OptKeyDelete $temp + + #### + # + # Default: No logging. + # + #### + + setLogCmd {} + + # Log eventually. + # To enable error logging, set Log to {puts stderr} for instance, + # via setLogCmd. + return +} + +namespace eval ::safe { + # internal variables + + # Log command, set via 'setLogCmd'. Logging is disabled when empty. + variable Log {} + + # The package maintains a state array per child interp under its + # control. The name of this array is S. This array is + # brought into scope where needed, using 'namespace upvar'. The S + # prefix is used to avoid that a child interp called "Log" smashes + # the "Log" variable. + # + # The array's elements are: + # + # access_path : List of paths accessible to the child. + # access_path,norm : Ditto, in normalized form. + # access_path,slave : Ditto, as the path tokens as seen by the child. + # access_path,map : dict ( token -> path ) + # access_path,remap : dict ( path -> token ) + # tm_path_slave : List of TM root directories, as tokens seen by the child. + # staticsok : Value of option -statics + # nestedok : Value of option -nested + # cleanupHook : Value of option -deleteHook +} + +::safe::Setup diff --git a/miniconda3/envs/active_proaction/lib/tcl8.6/tclAppInit.c b/miniconda3/envs/active_proaction/lib/tcl8.6/tclAppInit.c new file mode 100644 index 0000000000000000000000000000000000000000..552f9e4b2426327929f79700720e085794a2a0f8 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/tcl8.6/tclAppInit.c @@ -0,0 +1,176 @@ +/* + * tclAppInit.c -- + * + * Provides a default version of the main program and Tcl_AppInit + * procedure for tclsh and other Tcl-based applications (without Tk). + * + * Copyright (c) 1993 The Regents of the University of California. + * Copyright (c) 1994-1997 Sun Microsystems, Inc. + * Copyright (c) 1998-1999 Scriptics Corporation. + * + * See the file "license.terms" for information on usage and redistribution of + * this file, and for a DISCLAIMER OF ALL WARRANTIES. + */ + +#undef BUILD_tcl +#undef STATIC_BUILD +#include "tcl.h" +#if TCL_MAJOR_VERSION < 9 && TCL_MINOR_VERSION < 7 +# define Tcl_LibraryInitProc Tcl_PackageInitProc +# define Tcl_StaticLibrary Tcl_StaticPackage +#endif + +#ifdef TCL_TEST +extern Tcl_LibraryInitProc Tcltest_Init; +extern Tcl_LibraryInitProc Tcltest_SafeInit; +#endif /* TCL_TEST */ + +#ifdef TCL_XT_TEST +extern void XtToolkitInitialize(void); +extern Tcl_LibraryInitProc Tclxttest_Init; +#endif /* TCL_XT_TEST */ + +/* + * The following #if block allows you to change the AppInit function by using + * a #define of TCL_LOCAL_APPINIT instead of rewriting this entire file. The + * #if checks for that #define and uses Tcl_AppInit if it does not exist. + */ + +#ifndef TCL_LOCAL_APPINIT +#define TCL_LOCAL_APPINIT Tcl_AppInit +#endif +#ifndef MODULE_SCOPE +# define MODULE_SCOPE extern +#endif +MODULE_SCOPE int TCL_LOCAL_APPINIT(Tcl_Interp *); +MODULE_SCOPE int main(int, char **); + +/* + * The following #if block allows you to change how Tcl finds the startup + * script, prime the library or encoding paths, fiddle with the argv, etc., + * without needing to rewrite Tcl_Main() + */ + +#ifdef TCL_LOCAL_MAIN_HOOK +MODULE_SCOPE int TCL_LOCAL_MAIN_HOOK(int *argc, char ***argv); +#endif + +/* + *---------------------------------------------------------------------- + * + * main -- + * + * This is the main program for the application. + * + * Results: + * None: Tcl_Main never returns here, so this procedure never returns + * either. + * + * Side effects: + * Just about anything, since from here we call arbitrary Tcl code. + * + *---------------------------------------------------------------------- + */ + +int +main( + int argc, /* Number of command-line arguments. */ + char *argv[]) /* Values of command-line arguments. */ +{ +#ifdef TCL_XT_TEST + XtToolkitInitialize(); +#endif + +#ifdef TCL_LOCAL_MAIN_HOOK + TCL_LOCAL_MAIN_HOOK(&argc, &argv); +#elif (TCL_MAJOR_VERSION > 8 || TCL_MINOR_VERSION > 6) && (!defined(_WIN32) || defined(UNICODE)) + /* New in Tcl 8.7. This doesn't work on Windows without UNICODE */ + TclZipfs_AppHook(&argc, &argv); +#endif + + Tcl_Main(argc, argv, TCL_LOCAL_APPINIT); + return 0; /* Needed only to prevent compiler warning. */ +} + +/* + *---------------------------------------------------------------------- + * + * Tcl_AppInit -- + * + * This procedure performs application-specific initialization. Most + * applications, especially those that incorporate additional packages, + * will have their own version of this procedure. + * + * Results: + * Returns a standard Tcl completion code, and leaves an error message in + * the interp's result if an error occurs. + * + * Side effects: + * Depends on the startup script. + * + *---------------------------------------------------------------------- + */ + +int +Tcl_AppInit( + Tcl_Interp *interp) /* Interpreter for application. */ +{ + if ((Tcl_Init)(interp) == TCL_ERROR) { + return TCL_ERROR; + } + +#ifdef TCL_XT_TEST + if (Tclxttest_Init(interp) == TCL_ERROR) { + return TCL_ERROR; + } +#endif + +#ifdef TCL_TEST + if (Tcltest_Init(interp) == TCL_ERROR) { + return TCL_ERROR; + } + Tcl_StaticLibrary(interp, "Tcltest", Tcltest_Init, Tcltest_SafeInit); +#endif /* TCL_TEST */ + + /* + * Call the init procedures for included packages. Each call should look + * like this: + * + * if (Mod_Init(interp) == TCL_ERROR) { + * return TCL_ERROR; + * } + * + * where "Mod" is the name of the module. (Dynamically-loadable packages + * should have the same entry-point name.) + */ + + /* + * Call Tcl_CreateCommand for application-specific commands, if they + * weren't already created by the init procedures called above. + */ + + /* + * Specify a user-specific startup file to invoke if the application is + * run interactively. Typically the startup file is "~/.apprc" where "app" + * is the name of the application. If this line is deleted then no + * user-specific startup file will be run under any conditions. + */ + +#ifdef DJGPP + (Tcl_ObjSetVar2)(interp, Tcl_NewStringObj("tcl_rcFileName", -1), NULL, + Tcl_NewStringObj("~/tclsh.rc", -1), TCL_GLOBAL_ONLY); +#else + (Tcl_ObjSetVar2)(interp, Tcl_NewStringObj("tcl_rcFileName", -1), NULL, + Tcl_NewStringObj("~/.tclshrc", -1), TCL_GLOBAL_ONLY); +#endif + + return TCL_OK; +} + +/* + * Local Variables: + * mode: c + * c-basic-offset: 4 + * fill-column: 78 + * End: + */ diff --git a/miniconda3/envs/active_proaction/lib/tcl8.6/tclIndex b/miniconda3/envs/active_proaction/lib/tcl8.6/tclIndex new file mode 100644 index 0000000000000000000000000000000000000000..88a7bc082a4f6285abf3d3335d1c3e24a8d180ed --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/tcl8.6/tclIndex @@ -0,0 +1,85 @@ +# Tcl autoload index file, version 2.0 +# This file is generated by the "auto_mkindex" command +# and sourced to set up indexing information for one or +# more commands. Typically each line is a command that +# sets an element in the auto_index array, where the +# element name is the name of a command and the value is +# a script that loads the command. + +set auto_index(auto_reset) [list source -encoding utf-8 [file join $dir auto.tcl]] +set auto_index(tcl_findLibrary) [list source -encoding utf-8 [file join $dir auto.tcl]] +set auto_index(auto_mkindex) [list source -encoding utf-8 [file join $dir auto.tcl]] +set auto_index(auto_mkindex_old) [list source -encoding utf-8 [file join $dir auto.tcl]] +set auto_index(::auto_mkindex_parser::init) [list source -encoding utf-8 [file join $dir auto.tcl]] +set auto_index(::auto_mkindex_parser::cleanup) [list source -encoding utf-8 [file join $dir auto.tcl]] +set auto_index(::auto_mkindex_parser::mkindex) [list source -encoding utf-8 [file join $dir auto.tcl]] +set auto_index(::auto_mkindex_parser::hook) [list source -encoding utf-8 [file join $dir auto.tcl]] +set auto_index(::auto_mkindex_parser::slavehook) [list source -encoding utf-8 [file join $dir auto.tcl]] +set auto_index(::auto_mkindex_parser::command) [list source -encoding utf-8 [file join $dir auto.tcl]] +set auto_index(::auto_mkindex_parser::commandInit) [list source -encoding utf-8 [file join $dir auto.tcl]] +set auto_index(::auto_mkindex_parser::fullname) [list source -encoding utf-8 [file join $dir auto.tcl]] +set auto_index(::tcl::history) [list source -encoding utf-8 [file join $dir history.tcl]] +set auto_index(history) [list source -encoding utf-8 [file join $dir history.tcl]] +set auto_index(::tcl::HistAdd) [list source -encoding utf-8 [file join $dir history.tcl]] +set auto_index(::tcl::HistKeep) [list source -encoding utf-8 [file join $dir history.tcl]] +set auto_index(::tcl::HistClear) [list source -encoding utf-8 [file join $dir history.tcl]] +set auto_index(::tcl::HistInfo) [list source -encoding utf-8 [file join $dir history.tcl]] +set auto_index(::tcl::HistRedo) [list source -encoding utf-8 [file join $dir history.tcl]] +set auto_index(::tcl::HistIndex) [list source -encoding utf-8 [file join $dir history.tcl]] +set auto_index(::tcl::HistEvent) [list source -encoding utf-8 [file join $dir history.tcl]] +set auto_index(::tcl::HistChange) [list source -encoding utf-8 [file join $dir history.tcl]] +set auto_index(::tcl::HistNextID) [list source -encoding utf-8 [file join $dir history.tcl]] +set auto_index(::tcl::Pkg::CompareExtension) [list source -encoding utf-8 [file join $dir package.tcl]] +set auto_index(pkg_mkIndex) [list source -encoding utf-8 [file join $dir package.tcl]] +set auto_index(tclPkgSetup) [list source -encoding utf-8 [file join $dir package.tcl]] +set auto_index(tclPkgUnknown) [list source -encoding utf-8 [file join $dir package.tcl]] +set auto_index(::tcl::MacOSXPkgUnknown) [list source -encoding utf-8 [file join $dir package.tcl]] +set auto_index(::pkg::create) [list source -encoding utf-8 [file join $dir package.tcl]] +set auto_index(parray) [list source -encoding utf-8 [file join $dir parray.tcl]] +set auto_index(::safe::InterpStatics) [list source -encoding utf-8 [file join $dir safe.tcl]] +set auto_index(::safe::InterpNested) [list source -encoding utf-8 [file join $dir safe.tcl]] +set auto_index(::safe::interpCreate) [list source -encoding utf-8 [file join $dir safe.tcl]] +set auto_index(::safe::interpInit) [list source -encoding utf-8 [file join $dir safe.tcl]] +set auto_index(::safe::CheckInterp) [list source -encoding utf-8 [file join $dir safe.tcl]] +set auto_index(::safe::interpConfigure) [list source -encoding utf-8 [file join $dir safe.tcl]] +set auto_index(::safe::InterpCreate) [list source -encoding utf-8 [file join $dir safe.tcl]] +set auto_index(::safe::InterpSetConfig) [list source -encoding utf-8 [file join $dir safe.tcl]] +set auto_index(::safe::interpFindInAccessPath) [list source -encoding utf-8 [file join $dir safe.tcl]] +set auto_index(::safe::interpAddToAccessPath) [list source -encoding utf-8 [file join $dir safe.tcl]] +set auto_index(::safe::InterpInit) [list source -encoding utf-8 [file join $dir safe.tcl]] +set auto_index(::safe::AddSubDirs) [list source -encoding utf-8 [file join $dir safe.tcl]] +set auto_index(::safe::interpDelete) [list source -encoding utf-8 [file join $dir safe.tcl]] +set auto_index(::safe::setLogCmd) [list source -encoding utf-8 [file join $dir safe.tcl]] +set auto_index(::safe::SyncAccessPath) [list source -encoding utf-8 [file join $dir safe.tcl]] +set auto_index(::safe::PathToken) [list source -encoding utf-8 [file join $dir safe.tcl]] +set auto_index(::safe::TranslatePath) [list source -encoding utf-8 [file join $dir safe.tcl]] +set auto_index(::safe::Log) [list source -encoding utf-8 [file join $dir safe.tcl]] +set auto_index(::safe::CheckFileName) [list source -encoding utf-8 [file join $dir safe.tcl]] +set auto_index(::safe::AliasFileSubcommand) [list source -encoding utf-8 [file join $dir safe.tcl]] +set auto_index(::safe::AliasGlob) [list source -encoding utf-8 [file join $dir safe.tcl]] +set auto_index(::safe::AliasSource) [list source -encoding utf-8 [file join $dir safe.tcl]] +set auto_index(::safe::AliasLoad) [list source -encoding utf-8 [file join $dir safe.tcl]] +set auto_index(::safe::FileInAccessPath) [list source -encoding utf-8 [file join $dir safe.tcl]] +set auto_index(::safe::DirInAccessPath) [list source -encoding utf-8 [file join $dir safe.tcl]] +set auto_index(::safe::BadSubcommand) [list source -encoding utf-8 [file join $dir safe.tcl]] +set auto_index(::safe::AliasEncoding) [list source -encoding utf-8 [file join $dir safe.tcl]] +set auto_index(::safe::AliasExeName) [list source -encoding utf-8 [file join $dir safe.tcl]] +set auto_index(::safe::RejectExcessColons) [list source -encoding utf-8 [file join $dir safe.tcl]] +set auto_index(::safe::VarName) [list source -encoding utf-8 [file join $dir safe.tcl]] +set auto_index(::safe::Setup) [list source -encoding utf-8 [file join $dir safe.tcl]] +set auto_index(::tcl::tm::path) [list source -encoding utf-8 [file join $dir tm.tcl]] +set auto_index(::tcl::tm::add) [list source -encoding utf-8 [file join $dir tm.tcl]] +set auto_index(::tcl::tm::remove) [list source -encoding utf-8 [file join $dir tm.tcl]] +set auto_index(::tcl::tm::list) [list source -encoding utf-8 [file join $dir tm.tcl]] +set auto_index(::tcl::tm::UnknownHandler) [list source -encoding utf-8 [file join $dir tm.tcl]] +set auto_index(::tcl::tm::Defaults) [list source -encoding utf-8 [file join $dir tm.tcl]] +set auto_index(::tcl::tm::roots) [list source -encoding utf-8 [file join $dir tm.tcl]] +set auto_index(::tcl::UpdateWordBreakREs) [list source -encoding utf-8 [file join $dir word.tcl]] +set auto_index(tcl_wordBreakAfter) [list source -encoding utf-8 [file join $dir word.tcl]] +set auto_index(tcl_wordBreakBefore) [list source -encoding utf-8 [file join $dir word.tcl]] +set auto_index(tcl_endOfWord) [list source -encoding utf-8 [file join $dir word.tcl]] +set auto_index(tcl_startOfNextWord) [list source -encoding utf-8 [file join $dir word.tcl]] +set auto_index(tcl_startOfPreviousWord) [list source -encoding utf-8 [file join $dir word.tcl]] +if {[namespace exists ::tcl::unsupported]} { + set auto_index(timerate) {namespace import ::tcl::unsupported::timerate} +} diff --git a/miniconda3/envs/active_proaction/lib/tcl8.6/tm.tcl b/miniconda3/envs/active_proaction/lib/tcl8.6/tm.tcl new file mode 100644 index 0000000000000000000000000000000000000000..796d09f3e9bc137a41ae3beb828dba1e428f1cd8 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/tcl8.6/tm.tcl @@ -0,0 +1,380 @@ +# -*- tcl -*- +# +# Searching for Tcl Modules. Defines a procedure, declares it as the primary +# command for finding packages, however also uses the former 'package unknown' +# command as a fallback. +# +# Locates all possible packages in a directory via a less restricted glob. The +# targeted directory is derived from the name of the requested package, i.e. +# the TM scan will look only at directories which can contain the requested +# package. It will register all packages it found in the directory so that +# future requests have a higher chance of being fulfilled by the ifneeded +# database without having to come to us again. +# +# We do not remember where we have been and simply rescan targeted directories +# when invoked again. The reasoning is this: +# +# - The only way we get back to the same directory is if someone is trying to +# [package require] something that wasn't there on the first scan. +# +# Either +# 1) It is there now: If we rescan, you get it; if not you don't. +# +# This covers the possibility that the application asked for a package +# late, and the package was actually added to the installation after the +# application was started. It should still be able to find it. +# +# 2) It still is not there: Either way, you don't get it, but the rescan +# takes time. This is however an error case and we don't care that much +# about it +# +# 3) It was there the first time; but for some reason a "package forget" has +# been run, and "package" doesn't know about it anymore. +# +# This can be an indication that the application wishes to reload some +# functionality. And should work as well. +# +# Note that this also strikes a balance between doing a glob targeting a +# single package, and thus most likely requiring multiple globs of the same +# directory when the application is asking for many packages, and trying to +# glob for _everything_ in all subdirectories when looking for a package, +# which comes with a heavy startup cost. +# +# We scan for regular packages only if no satisfying module was found. + +namespace eval ::tcl::tm { + # Default paths. None yet. + + variable paths {} + + # The regex pattern a file name has to match to make it a Tcl Module. + + set pkgpattern {^([_[:alpha:]][:_[:alnum:]]*)-([[:digit:]].*)[.]tm$} + + # Export the public API + + namespace export path + namespace ensemble create -command path -subcommands {add remove list} +} + +# ::tcl::tm::path implementations -- +# +# Public API to the module path. See specification. +# +# Arguments +# cmd - The subcommand to execute +# args - The paths to add/remove. Must not appear querying the +# path with 'list'. +# +# Results +# No result for subcommands 'add' and 'remove'. A list of paths for +# 'list'. +# +# Side effects +# The subcommands 'add' and 'remove' manipulate the list of paths to +# search for Tcl Modules. The subcommand 'list' has no side effects. + +proc ::tcl::tm::add {args} { + # PART OF THE ::tcl::tm::path ENSEMBLE + # + # The path is added at the head to the list of module paths. + # + # The command enforces the restriction that no path may be an ancestor + # directory of any other path on the list. If the new path violates this + # restriction an error will be raised. + # + # If the path is already present as is no error will be raised and no + # action will be taken. + + variable paths + + # We use a copy of the path as source during validation, and extend it as + # well. Because we not only have to detect if the new paths are bogus with + # respect to the existing paths, but also between themselves. Otherwise we + # can still add bogus paths, by specifying them in a single call. This + # makes the use of the new paths simpler as well, a trivial assignment of + # the collected paths to the official state var. + + set newpaths $paths + foreach p $args { + if {($p eq "") || ($p in $newpaths)} { + # Ignore any path which is empty or already on the list. + continue + } + + # Search for paths which are subdirectories of the new one. If there + # are any then the new path violates the restriction about ancestors. + + set pos [lsearch -glob $newpaths ${p}/*] + # Cannot use "in", we need the position for the message. + if {$pos >= 0} { + return -code error \ + "$p is ancestor of existing module path [lindex $newpaths $pos]." + } + + # Now look for existing paths which are ancestors of the new one. This + # reverse question forces us to loop over the existing paths, as each + # element is the pattern, not the new path :( + + foreach ep $newpaths { + if {[string match ${ep}/* $p]} { + return -code error \ + "$p is subdirectory of existing module path $ep." + } + } + + set newpaths [linsert $newpaths 0 $p] + } + + # The validation of the input is complete and successful, and everything + # in newpaths is either an old path, or added. We can now extend the + # official list of paths, a simple assignment is sufficient. + + set paths $newpaths + return +} + +proc ::tcl::tm::remove {args} { + # PART OF THE ::tcl::tm::path ENSEMBLE + # + # Removes the path from the list of module paths. The command is silently + # ignored if the path is not on the list. + + variable paths + + foreach p $args { + set pos [lsearch -exact $paths $p] + if {$pos >= 0} { + set paths [lreplace $paths $pos $pos] + } + } +} + +proc ::tcl::tm::list {} { + # PART OF THE ::tcl::tm::path ENSEMBLE + + variable paths + return $paths +} + +# ::tcl::tm::UnknownHandler -- +# +# Unknown handler for Tcl Modules, i.e. packages in module form. +# +# Arguments +# original - Original [package unknown] procedure. +# name - Name of desired package. +# version - Version of desired package. Can be the +# empty string. +# exact - Either -exact or omitted. +# +# Name, version, and exact are used to determine satisfaction. The +# original is called iff no satisfaction was achieved. The name is also +# used to compute the directory to target in the search. +# +# Results +# None. +# +# Side effects +# May populate the package ifneeded database with additional provide +# scripts. + +proc ::tcl::tm::UnknownHandler {original name args} { + # Import the list of paths to search for packages in module form. + # Import the pattern used to check package names in detail. + + variable paths + variable pkgpattern + + # Without paths to search we can do nothing. (Except falling back to the + # regular search). + + if {[llength $paths]} { + set pkgpath [string map {:: /} $name] + set pkgroot [file dirname $pkgpath] + if {$pkgroot eq "."} { + set pkgroot "" + } + + # We don't remember a copy of the paths while looping. Tcl Modules are + # unable to change the list while we are searching for them. This also + # simplifies the loop, as we cannot get additional directories while + # iterating over the list. A simple foreach is sufficient. + + set satisfied 0 + foreach path $paths { + if {![interp issafe] && ![file exists $path]} { + continue + } + set currentsearchpath [file join $path $pkgroot] + if {![interp issafe] && ![file exists $currentsearchpath]} { + continue + } + set strip [llength [file split $path]] + + # Get the module files out of the subdirectories. + # - Safe Base interpreters have a restricted "glob" command that + # works in this case. + # - The "catch" was essential when there was no safe glob and every + # call in a safe interp failed; it is retained only for corner + # cases in which the eventual call to glob returns an error. + + catch { + # We always look for _all_ possible modules in the current + # path, to get the max result out of the glob. + + foreach file [glob -nocomplain -directory $currentsearchpath *.tm] { + set pkgfilename [join [lrange [file split $file] $strip end] ::] + + if {![regexp -- $pkgpattern $pkgfilename --> pkgname pkgversion]} { + # Ignore everything not matching our pattern for + # package names. + continue + } + try { + package vcompare $pkgversion 0 + } on error {} { + # Ignore everything where the version part is not + # acceptable to "package vcompare". + continue + } + + if {([package ifneeded $pkgname $pkgversion] ne {}) + && (![interp issafe]) + } { + # There's already a provide script registered for + # this version of this package. Since all units of + # code claiming to be the same version of the same + # package ought to be identical, just stick with + # the one we already have. + # This does not apply to Safe Base interpreters because + # the token-to-directory mapping may have changed. + continue + } + + # We have found a candidate, generate a "provide script" + # for it, and remember it. Note that we are using ::list + # to do this; locally [list] means something else without + # the namespace specifier. + + # NOTE. When making changes to the format of the provide + # command generated below CHECK that the 'LOCATE' + # procedure in core file 'platform/shell.tcl' still + # understands it, or, if not, update its implementation + # appropriately. + # + # Right now LOCATE's implementation assumes that the path + # of the package file is the last element in the list. + + package ifneeded $pkgname $pkgversion \ + "[::list package provide $pkgname $pkgversion];[::list source -encoding utf-8 $file]" + + # We abort in this unknown handler only if we got a + # satisfying candidate for the requested package. + # Otherwise we still have to fallback to the regular + # package search to complete the processing. + + if {($pkgname eq $name) + && [package vsatisfies $pkgversion {*}$args]} { + set satisfied 1 + + # We do not abort the loop, and keep adding provide + # scripts for every candidate in the directory, just + # remember to not fall back to the regular search + # anymore. + } + } + } + } + + if {$satisfied} { + return + } + } + + # Fallback to previous command, if existing. See comment above about + # ::list... + + if {[llength $original]} { + uplevel 1 $original [::linsert $args 0 $name] + } +} + +# ::tcl::tm::Defaults -- +# +# Determines the default search paths. +# +# Arguments +# None +# +# Results +# None. +# +# Side effects +# May add paths to the list of defaults. + +proc ::tcl::tm::Defaults {} { + global env tcl_platform + + regexp {^(\d+)\.(\d+)} [package provide Tcl] - major minor + set exe [file normalize [info nameofexecutable]] + + # Note that we're using [::list], not [list] because [list] means + # something other than [::list] in this namespace. + roots [::list \ + [file dirname [info library]] \ + [file join [file dirname [file dirname $exe]] lib] \ + ] + + if {$tcl_platform(platform) eq "windows"} { + set sep ";" + } else { + set sep ":" + } + for {set n $minor} {$n >= 0} {incr n -1} { + foreach ev [::list \ + TCL${major}.${n}_TM_PATH \ + TCL${major}_${n}_TM_PATH \ + ] { + if {![info exists env($ev)]} continue + foreach p [split $env($ev) $sep] { + path add $p + } + } + } + return +} + +# ::tcl::tm::roots -- +# +# Public API to the module path. See specification. +# +# Arguments +# paths - List of 'root' paths to derive search paths from. +# +# Results +# No result. +# +# Side effects +# Calls 'path add' to paths to the list of module search paths. + +proc ::tcl::tm::roots {paths} { + regexp {^(\d+)\.(\d+)} [package provide Tcl] - major minor + foreach pa $paths { + set p [file join $pa tcl$major] + for {set n $minor} {$n >= 0} {incr n -1} { + set px [file join $p ${major}.${n}] + if {![interp issafe]} {set px [file normalize $px]} + path add $px + } + set px [file join $p site-tcl] + if {![interp issafe]} {set px [file normalize $px]} + path add $px + } + return +} + +# Initialization. Set up the default paths, then insert the new handler into +# the chain. + +if {![interp issafe]} {::tcl::tm::Defaults} diff --git a/miniconda3/envs/active_proaction/lib/tcl8.6/word.tcl b/miniconda3/envs/active_proaction/lib/tcl8.6/word.tcl new file mode 100644 index 0000000000000000000000000000000000000000..a993918b44c590b0b1eba3d7ae64cebf195e644a --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/tcl8.6/word.tcl @@ -0,0 +1,154 @@ +# word.tcl -- +# +# This file defines various procedures for computing word boundaries in +# strings. This file is primarily needed so Tk text and entry widgets behave +# properly for different platforms. +# +# Copyright (c) 1996 Sun Microsystems, Inc. +# Copyright (c) 1998 Scriptics Corporation. +# +# See the file "license.terms" for information on usage and redistribution +# of this file, and for a DISCLAIMER OF ALL WARRANTIES. + +# The following variables are used to determine which characters are +# interpreted as white space. + +if {$::tcl_platform(platform) eq "windows"} { + # Windows style - any but a Unicode space char + if {![info exists ::tcl_wordchars]} { + set ::tcl_wordchars {\S} + } + if {![info exists ::tcl_nonwordchars]} { + set ::tcl_nonwordchars {\s} + } +} else { + # Motif style - any Unicode word char (number, letter, or underscore) + if {![info exists ::tcl_wordchars]} { + set ::tcl_wordchars {\w} + } + if {![info exists ::tcl_nonwordchars]} { + set ::tcl_nonwordchars {\W} + } +} + +# Arrange for caches of the real matcher REs to be kept, which enables the REs +# themselves to be cached for greater performance (and somewhat greater +# clarity too). + +namespace eval ::tcl { + variable WordBreakRE + array set WordBreakRE {} + + proc UpdateWordBreakREs args { + # Ignores the arguments + global tcl_wordchars tcl_nonwordchars + variable WordBreakRE + + # To keep the RE strings short... + set letter $tcl_wordchars + set space $tcl_nonwordchars + + set WordBreakRE(after) "$letter$space|$space$letter" + set WordBreakRE(before) "^.*($letter$space|$space$letter)" + set WordBreakRE(end) "$space*$letter+$space" + set WordBreakRE(next) "$letter*$space+$letter" + set WordBreakRE(previous) "$space*($letter+)$space*\$" + } + + # Initialize the cache + UpdateWordBreakREs + trace add variable ::tcl_wordchars write ::tcl::UpdateWordBreakREs + trace add variable ::tcl_nonwordchars write ::tcl::UpdateWordBreakREs +} + +# tcl_wordBreakAfter -- +# +# This procedure returns the index of the first word boundary after the +# starting point in the given string, or -1 if there are no more boundaries in +# the given string. The index returned refers to the first character of the +# pair that comprises a boundary. +# +# Arguments: +# str - String to search. +# start - Index into string specifying starting point. + +proc tcl_wordBreakAfter {str start} { + variable ::tcl::WordBreakRE + set result {-1 -1} + regexp -indices -start $start -- $WordBreakRE(after) $str result + return [lindex $result 1] +} + +# tcl_wordBreakBefore -- +# +# This procedure returns the index of the first word boundary before the +# starting point in the given string, or -1 if there are no more boundaries in +# the given string. The index returned refers to the second character of the +# pair that comprises a boundary. +# +# Arguments: +# str - String to search. +# start - Index into string specifying starting point. + +proc tcl_wordBreakBefore {str start} { + variable ::tcl::WordBreakRE + set result {-1 -1} + regexp -indices -- $WordBreakRE(before) [string range $str 0 $start] result + return [lindex $result 1] +} + +# tcl_endOfWord -- +# +# This procedure returns the index of the first end-of-word location after a +# starting index in the given string. An end-of-word location is defined to be +# the first whitespace character following the first non-whitespace character +# after the starting point. Returns -1 if there are no more words after the +# starting point. +# +# Arguments: +# str - String to search. +# start - Index into string specifying starting point. + +proc tcl_endOfWord {str start} { + variable ::tcl::WordBreakRE + set result {-1 -1} + regexp -indices -start $start -- $WordBreakRE(end) $str result + return [lindex $result 1] +} + +# tcl_startOfNextWord -- +# +# This procedure returns the index of the first start-of-word location after a +# starting index in the given string. A start-of-word location is defined to +# be a non-whitespace character following a whitespace character. Returns -1 +# if there are no more start-of-word locations after the starting point. +# +# Arguments: +# str - String to search. +# start - Index into string specifying starting point. + +proc tcl_startOfNextWord {str start} { + variable ::tcl::WordBreakRE + set result {-1 -1} + regexp -indices -start $start -- $WordBreakRE(next) $str result + return [lindex $result 1] +} + +# tcl_startOfPreviousWord -- +# +# This procedure returns the index of the first start-of-word location before +# a starting index in the given string. +# +# Arguments: +# str - String to search. +# start - Index into string specifying starting point. + +proc tcl_startOfPreviousWord {str start} { + variable ::tcl::WordBreakRE + set word {-1 -1} + if {$start > 0} { + regexp -indices -- $WordBreakRE(previous) [string range [string range $str 0 $start] 0 end-1] \ + result word + } + return [lindex $word 0] +} diff --git a/miniconda3/envs/active_proaction/lib/tcl8/8.4/platform-1.0.19.tm b/miniconda3/envs/active_proaction/lib/tcl8/8.4/platform-1.0.19.tm new file mode 100644 index 0000000000000000000000000000000000000000..63d4d7601c16cf5d4afd4d808934906079ddfc3e --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/tcl8/8.4/platform-1.0.19.tm @@ -0,0 +1,450 @@ +# -*- tcl -*- +# ### ### ### ######### ######### ######### +## Overview + +# Heuristics to assemble a platform identifier from publicly available +# information. The identifier describes the platform of the currently +# running tcl shell. This is a mixture of the runtime environment and +# of build-time properties of the executable itself. +# +# Examples: +# <1> A tcl shell executing on a x86_64 processor, but having a +# wordsize of 4 was compiled for the x86 environment, i.e. 32 +# bit, and loaded packages have to match that, and not the +# actual cpu. +# +# <2> The hp/solaris 32/64 bit builds of the core cannot be +# distinguished by looking at tcl_platform. As packages have to +# match the 32/64 information we have to look in more places. In +# this case we inspect the executable itself (magic numbers, +# i.e. fileutil::magic::filetype). +# +# The basic information used comes out of the 'os' and 'machine' +# entries of the 'tcl_platform' array. A number of general and +# os/machine specific transformation are applied to get a canonical +# result. +# +# General +# Only the first element of 'os' is used - we don't care whether we +# are on "Windows NT" or "Windows XP" or whatever. +# +# Machine specific +# % amd64 -> x86_64 +# % arm* -> arm +# % sun4* -> sparc +# % ia32* -> ix86 +# % intel -> ix86 +# % i*86* -> ix86 +# % Power* -> powerpc +# % x86_64 + wordSize 4 => x86 code +# +# OS specific +# % AIX are always powerpc machines +# % HP-UX 9000/800 etc means parisc +# % linux has to take glibc version into account +# % sunos -> solaris, and keep version number +# +# NOTE: A platform like linux glibc 2.3, which can use glibc 2.2 stuff +# has to provide all possible allowed platform identifiers when +# searching search. Ditto a solaris 2.8 platform can use solaris 2.6 +# packages. Etc. This is handled by the other procedure, see below. + +# ### ### ### ######### ######### ######### +## Requirements + +namespace eval ::platform {} + +# ### ### ### ######### ######### ######### +## Implementation + +# -- platform::generic +# +# Assembles an identifier for the generic platform. It leaves out +# details like kernel version, libc version, etc. + +proc ::platform::generic {} { + global tcl_platform + + set plat [string tolower [lindex $tcl_platform(os) 0]] + set cpu $tcl_platform(machine) + + switch -glob -- $cpu { + sun4* { + set cpu sparc + } + intel - + ia32* - + i*86* { + set cpu ix86 + } + x86_64 { + if {$tcl_platform(wordSize) == 4} { + # See Example <1> at the top of this file. + set cpu ix86 + } + } + ppc - + "Power*" { + set cpu powerpc + } + "arm*" { + set cpu arm + } + ia64 { + if {$tcl_platform(wordSize) == 4} { + append cpu _32 + } + } + } + + switch -glob -- $plat { + windows { + if {$tcl_platform(platform) == "unix"} { + set plat cygwin + } else { + set plat win32 + } + if {$cpu eq "amd64"} { + # Do not check wordSize, win32-x64 is an IL32P64 platform. + set cpu x86_64 + } + } + sunos { + set plat solaris + if {[string match "ix86" $cpu]} { + if {$tcl_platform(wordSize) == 8} { + set cpu x86_64 + } + } elseif {![string match "ia64*" $cpu]} { + # sparc + if {$tcl_platform(wordSize) == 8} { + append cpu 64 + } + } + } + darwin { + set plat macosx + # Correctly identify the cpu when running as a 64bit + # process on a machine with a 32bit kernel + if {$cpu eq "ix86"} { + if {$tcl_platform(wordSize) == 8} { + set cpu x86_64 + } + } + } + aix { + set cpu powerpc + if {$tcl_platform(wordSize) == 8} { + append cpu 64 + } + } + hp-ux { + set plat hpux + if {![string match "ia64*" $cpu]} { + set cpu parisc + if {$tcl_platform(wordSize) == 8} { + append cpu 64 + } + } + } + osf1 { + set plat tru64 + } + default { + set plat [lindex [split $plat _-] 0] + } + } + + return "${plat}-${cpu}" +} + +# -- platform::identify +# +# Assembles an identifier for the exact platform, by extending the +# generic identifier. I.e. it adds in details like kernel version, +# libc version, etc., if they are relevant for the loading of +# packages on the platform. + +proc ::platform::identify {} { + global tcl_platform + + set id [generic] + regexp {^([^-]+)-([^-]+)$} $id -> plat cpu + + switch -- $plat { + solaris { + regsub {^5} $tcl_platform(osVersion) 2 text + append plat $text + return "${plat}-${cpu}" + } + macosx { + set major [lindex [split $tcl_platform(osVersion) .] 0] + if {$major > 19} { + set minor [lindex [split $tcl_platform(osVersion) .] 1] + incr major -9 + append plat $major.[expr {$minor - 1}] + } else { + incr major -4 + append plat 10.$major + return "${plat}-${cpu}" + } + return "${plat}-${cpu}" + } + linux { + # Look for the libc*.so and determine its version + # (libc5/6, libc6 further glibc 2.X) + + set v unknown + + # Determine in which directory to look. /lib, or /lib64. + # For that we use the tcl_platform(wordSize). + # + # We could use the 'cpu' info, per the equivalence below, + # that however would be restricted to intel. And this may + # be a arm, mips, etc. system. The wordsize is more + # fundamental. + # + # ix86 <=> (wordSize == 4) <=> 32 bit ==> /lib + # x86_64 <=> (wordSize == 8) <=> 64 bit ==> /lib64 + # + # Do not look into /lib64 even if present, if the cpu + # doesn't fit. + + # TODO: Determine the prefixes (i386, x86_64, ...) for + # other cpus. The path after the generic one is utterly + # specific to intel right now. Ok, on Ubuntu, possibly + # other Debian systems we may apparently be able to query + # the necessary CPU code. If we can't we simply use the + # hardwired fallback. + + switch -exact -- $tcl_platform(wordSize) { + 4 { + lappend bases /lib + if {[catch { + exec dpkg-architecture -qDEB_HOST_MULTIARCH + } res]} { + lappend bases /lib/i386-linux-gnu + } else { + # dpkg-arch returns the full tripled, not just cpu. + lappend bases /lib/$res + } + } + 8 { + lappend bases /lib64 + if {[catch { + exec dpkg-architecture -qDEB_HOST_MULTIARCH + } res]} { + lappend bases /lib/x86_64-linux-gnu + } else { + # dpkg-arch returns the full tripled, not just cpu. + lappend bases /lib/$res + } + } + default { + return -code error "Bad wordSize $tcl_platform(wordSize), expected 4 or 8" + } + } + + foreach base $bases { + if {[LibcVersion $base -> v]} break + } + + append plat -$v + return "${plat}-${cpu}" + } + } + + return $id +} + +proc ::platform::LibcVersion {base _->_ vv} { + upvar 1 $vv v + set libclist [lsort [glob -nocomplain -directory $base libc*]] + + if {![llength $libclist]} { return 0 } + + set libc [lindex $libclist 0] + + # Try executing the library first. This should succeed + # for a glibc library, and return the version + # information. + + if {![catch { + set vdata [lindex [split [exec $libc] \n] 0] + }]} { + regexp {version ([0-9]+(\.[0-9]+)*)} $vdata -> v + foreach {major minor} [split $v .] break + set v glibc${major}.${minor} + return 1 + } else { + # We had trouble executing the library. We are now + # inspecting its name to determine the version + # number. This code by Larry McVoy. + + if {[regexp -- {libc-([0-9]+)\.([0-9]+)} $libc -> major minor]} { + set v glibc${major}.${minor} + return 1 + } + } + return 0 +} + +# -- platform::patterns +# +# Given an exact platform identifier, i.e. _not_ the generic +# identifier it assembles a list of exact platform identifier +# describing platform which should be compatible with the +# input. +# +# I.e. packages for all platforms in the result list should be +# loadable on the specified platform. + +# << Should we add the generic identifier to the list as well ? In +# general it is not compatible I believe. So better not. In many +# cases the exact identifier is identical to the generic one +# anyway. +# >> + +proc ::platform::patterns {id} { + set res [list $id] + if {$id eq "tcl"} {return $res} + + switch -glob -- $id { + solaris*-* { + if {[regexp {solaris([^-]*)-(.*)} $id -> v cpu]} { + if {$v eq ""} {return $id} + foreach {major minor} [split $v .] break + incr minor -1 + for {set j $minor} {$j >= 6} {incr j -1} { + lappend res solaris${major}.${j}-${cpu} + } + } + } + linux*-* { + if {[regexp {linux-glibc([^-]*)-(.*)} $id -> v cpu]} { + foreach {major minor} [split $v .] break + incr minor -1 + for {set j $minor} {$j >= 0} {incr j -1} { + lappend res linux-glibc${major}.${j}-${cpu} + } + } + } + macosx-powerpc { + lappend res macosx-universal + } + macosx-x86_64 { + lappend res macosx-i386-x86_64 + } + macosx-ix86 { + lappend res macosx-universal macosx-i386-x86_64 + } + macosx*-* { + # 10.5+,11.0+ + if {[regexp {macosx([^-]*)-(.*)} $id -> v cpu]} { + + switch -exact -- $cpu { + ix86 { + lappend alt i386-x86_64 + lappend alt universal + } + x86_64 { + if {[lindex [split $::tcl_platform(osVersion) .] 0] < 19} { + set alt i386-x86_64 + } else { + set alt {} + } + } + arm { + lappend alt x86_64 + } + default { set alt {} } + } + + if {$v ne ""} { + foreach {major minor} [split $v .] break + + set res {} + if {$major eq 13} { + # Add 13.0 to 13.minor to patterns. + for {set j $minor} {$j >= 0} {incr j -1} { + lappend res macosx${major}.${j}-${cpu} + foreach a $alt { + lappend res macosx${major}.${j}-$a + } + } + set major 12 + set minor 5 + } + if {$major eq 12} { + # Add 12.0 to 12.minor to patterns. + for {set j $minor} {$j >= 0} {incr j -1} { + lappend res macosx${major}.${j}-${cpu} + foreach a $alt { + lappend res macosx${major}.${j}-$a + } + } + set major 11 + set minor 5 + } + if {$major eq 11} { + # Add 11.0 to 11.minor to patterns. + for {set j $minor} {$j >= 0} {incr j -1} { + lappend res macosx${major}.${j}-${cpu} + foreach a $alt { + lappend res macosx${major}.${j}-$a + } + } + set major 10 + set minor 15 + } + # Add 10.5 to 10.minor to patterns. + for {set j $minor} {$j >= 5} {incr j -1} { + if {$cpu ne "arm"} { + lappend res macosx${major}.${j}-${cpu} + } + foreach a $alt { + lappend res macosx${major}.${j}-$a + } + } + + # Add unversioned patterns for 10.3/10.4 builds. + lappend res macosx-${cpu} + foreach a $alt { + lappend res macosx-$a + } + } else { + # No version, just do unversioned patterns. + foreach a $alt { + lappend res macosx-$a + } + } + } else { + # no v, no cpu ... nothing + } + } + } + lappend res tcl ; # Pure tcl packages are always compatible. + return $res +} + + +# ### ### ### ######### ######### ######### +## Ready + +package provide platform 1.0.19 + +# ### ### ### ######### ######### ######### +## Demo application + +if {[info exists argv0] && ($argv0 eq [info script])} { + puts ==================================== + parray tcl_platform + puts ==================================== + puts Generic\ identification:\ [::platform::generic] + puts Exact\ identification:\ \ \ [::platform::identify] + puts ==================================== + puts Search\ patterns: + puts *\ [join [::platform::patterns [::platform::identify]] \n*\ ] + puts ==================================== + exit 0 +} diff --git a/miniconda3/envs/active_proaction/lib/tcl8/8.4/platform/shell-1.1.4.tm b/miniconda3/envs/active_proaction/lib/tcl8/8.4/platform/shell-1.1.4.tm new file mode 100644 index 0000000000000000000000000000000000000000..053ce5350b7435b19ff88558f35322bdb28eeb7b --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/tcl8/8.4/platform/shell-1.1.4.tm @@ -0,0 +1,241 @@ + +# -*- tcl -*- +# ### ### ### ######### ######### ######### +## Overview + +# Higher-level commands which invoke the functionality of this package +# for an arbitrary tcl shell (tclsh, wish, ...). This is required by a +# repository as while the tcl shell executing packages uses the same +# platform in general as a repository application there can be +# differences in detail (i.e. 32/64 bit builds). + +# ### ### ### ######### ######### ######### +## Requirements + +package require platform +namespace eval ::platform::shell {} + +# ### ### ### ######### ######### ######### +## Implementation + +# -- platform::shell::generic + +proc ::platform::shell::generic {shell} { + # Argument is the path to a tcl shell. + + CHECK $shell + LOCATE base out + + set code {} + # Forget any preexisting platform package, it might be in + # conflict with this one. + lappend code {package forget platform} + # Inject our platform package + lappend code [list source -encoding utf-8 $base] + # Query and print the architecture + lappend code {puts [platform::generic]} + # And done + lappend code {exit 0} + + set arch [RUN $shell [join $code \n]] + + if {$out} {file delete -force $base} + return $arch +} + +# -- platform::shell::identify + +proc ::platform::shell::identify {shell} { + # Argument is the path to a tcl shell. + + CHECK $shell + LOCATE base out + + set code {} + # Forget any preexisting platform package, it might be in + # conflict with this one. + lappend code {package forget platform} + # Inject our platform package + lappend code [list source -encoding utf-8 $base] + # Query and print the architecture + lappend code {puts [platform::identify]} + # And done + lappend code {exit 0} + + set arch [RUN $shell [join $code \n]] + + if {$out} {file delete -force $base} + return $arch +} + +# -- platform::shell::platform + +proc ::platform::shell::platform {shell} { + # Argument is the path to a tcl shell. + + CHECK $shell + + set code {} + lappend code {puts $tcl_platform(platform)} + lappend code {exit 0} + + return [RUN $shell [join $code \n]] +} + +# ### ### ### ######### ######### ######### +## Internal helper commands. + +proc ::platform::shell::CHECK {shell} { + if {![file exists $shell]} { + return -code error "Shell \"$shell\" does not exist" + } + if {![file executable $shell]} { + return -code error "Shell \"$shell\" is not executable (permissions)" + } + return +} + +proc ::platform::shell::LOCATE {bv ov} { + upvar 1 $bv base $ov out + + # Locate the platform package for injection into the specified + # shell. We are using package management to find it, wherever it + # is, instead of using hardwired relative paths. This allows us to + # install the two packages as TMs without breaking the code + # here. If the found package is wrapped we copy the code somewhere + # where the spawned shell will be able to read it. + + # This code is brittle, it needs has to adapt to whatever changes + # are made to the TM code, i.e. the "provide" statement generated by + # tm.tcl + + set pl [package ifneeded platform [package require platform]] + set base [lindex $pl end] + + set out 0 + if {[lindex [file system $base]] ne "native"} { + set temp [TEMP] + file copy -force $base $temp + set base $temp + set out 1 + } + return +} + +proc ::platform::shell::RUN {shell code} { + set c [TEMP] + set cc [open $c w] + puts $cc $code + close $cc + + set e [TEMP] + + set code [catch { + exec $shell $c 2> $e + } res] + + file delete $c + + if {$code} { + append res \n[read [set chan [open $e r]]][close $chan] + file delete $e + return -code error "Shell \"$shell\" is not executable ($res)" + } + + file delete $e + return $res +} + +proc ::platform::shell::TEMP {} { + set prefix platform + + # This code is copied out of Tcllib's fileutil package. + # (TempFile/tempfile) + + set tmpdir [DIR] + + set chars "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789" + set nrand_chars 10 + set maxtries 10 + set access [list RDWR CREAT EXCL TRUNC] + set permission 0600 + set channel "" + set checked_dir_writable 0 + set mypid [pid] + for {set i 0} {$i < $maxtries} {incr i} { + set newname $prefix + for {set j 0} {$j < $nrand_chars} {incr j} { + append newname [string index $chars \ + [expr {int(rand()*62)}]] + } + set newname [file join $tmpdir $newname] + if {[file exists $newname]} { + after 1 + } else { + if {[catch {open $newname $access $permission} channel]} { + if {!$checked_dir_writable} { + set dirname [file dirname $newname] + if {![file writable $dirname]} { + return -code error "Directory $dirname is not writable" + } + set checked_dir_writable 1 + } + } else { + # Success + close $channel + return [file normalize $newname] + } + } + } + if {$channel ne ""} { + return -code error "Failed to open a temporary file: $channel" + } else { + return -code error "Failed to find an unused temporary file name" + } +} + +proc ::platform::shell::DIR {} { + # This code is copied out of Tcllib's fileutil package. + # (TempDir/tempdir) + + global tcl_platform env + + set attempdirs [list] + + foreach tmp {TMPDIR TEMP TMP} { + if { [info exists env($tmp)] } { + lappend attempdirs $env($tmp) + } + } + + switch $tcl_platform(platform) { + windows { + lappend attempdirs "C:\\TEMP" "C:\\TMP" "\\TEMP" "\\TMP" + } + macintosh { + set tmpdir $env(TRASH_FOLDER) ;# a better place? + } + default { + lappend attempdirs \ + [file join / tmp] \ + [file join / var tmp] \ + [file join / usr tmp] + } + } + + lappend attempdirs [pwd] + + foreach tmp $attempdirs { + if { [file isdirectory $tmp] && [file writable $tmp] } { + return [file normalize $tmp] + } + } + + # Fail if nothing worked. + return -code error "Unable to determine a proper directory for temporary files" +} + +# ### ### ### ######### ######### ######### +## Ready + +package provide platform::shell 1.1.4 diff --git a/miniconda3/envs/active_proaction/lib/tcl8/8.5/msgcat-1.6.1.tm b/miniconda3/envs/active_proaction/lib/tcl8/8.5/msgcat-1.6.1.tm new file mode 100644 index 0000000000000000000000000000000000000000..e11247040389edb864df27a97b11305e293271b2 --- /dev/null +++ b/miniconda3/envs/active_proaction/lib/tcl8/8.5/msgcat-1.6.1.tm @@ -0,0 +1,1210 @@ +# msgcat.tcl -- +# +# This file defines various procedures which implement a +# message catalog facility for Tcl programs. It should be +# loaded with the command "package require msgcat". +# +# Copyright (c) 2010-2015 Harald Oehlmann. +# Copyright (c) 1998-2000 Ajuba Solutions. +# Copyright (c) 1998 Mark Harrison. +# +# See the file "license.terms" for information on usage and redistribution +# of this file, and for a DISCLAIMER OF ALL WARRANTIES. + +package require Tcl 8.5- +# When the version number changes, be sure to update the pkgIndex.tcl file, +# and the installation directory in the Makefiles. +package provide msgcat 1.6.1 + +namespace eval msgcat { + namespace export mc mcexists mcload mclocale mcmax mcmset mcpreferences mcset\ + mcunknown mcflset mcflmset mcloadedlocales mcforgetpackage\ + mcpackageconfig mcpackagelocale + + # Records the list of locales to search + variable Loclist {} + + # List of currently loaded locales + variable LoadedLocales {} + + # Records the locale of the currently sourced message catalogue file + variable FileLocale + + # Configuration values per Package (e.g. client namespace). + # The dict key is of the form "