Add files using upload-large-folder tool
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
- bioagent-bench/.venv/lib/python3.14/site-packages/_virtualenv.py +101 -0
- bioagent-bench/.venv/lib/python3.14/site-packages/aiohttp-3.13.5.dist-info/INSTALLER +1 -0
- bioagent-bench/.venv/lib/python3.14/site-packages/aiohttp-3.13.5.dist-info/METADATA +262 -0
- bioagent-bench/.venv/lib/python3.14/site-packages/aiohttp-3.13.5.dist-info/RECORD +84 -0
- bioagent-bench/.venv/lib/python3.14/site-packages/aiohttp-3.13.5.dist-info/REQUESTED +0 -0
- bioagent-bench/.venv/lib/python3.14/site-packages/aiohttp-3.13.5.dist-info/WHEEL +7 -0
- bioagent-bench/.venv/lib/python3.14/site-packages/aiohttp-3.13.5.dist-info/licenses/LICENSE.txt +13 -0
- bioagent-bench/.venv/lib/python3.14/site-packages/aiohttp-3.13.5.dist-info/licenses/vendor/llhttp/LICENSE +22 -0
- bioagent-bench/.venv/lib/python3.14/site-packages/aiohttp-3.13.5.dist-info/top_level.txt +1 -0
- bioagent-bench/.venv/lib/python3.14/site-packages/aiosignal-1.4.0.dist-info/INSTALLER +1 -0
- bioagent-bench/.venv/lib/python3.14/site-packages/aiosignal-1.4.0.dist-info/METADATA +112 -0
- bioagent-bench/.venv/lib/python3.14/site-packages/aiosignal-1.4.0.dist-info/RECORD +9 -0
- bioagent-bench/.venv/lib/python3.14/site-packages/aiosignal-1.4.0.dist-info/REQUESTED +0 -0
- bioagent-bench/.venv/lib/python3.14/site-packages/aiosignal-1.4.0.dist-info/WHEEL +5 -0
- bioagent-bench/.venv/lib/python3.14/site-packages/aiosignal-1.4.0.dist-info/licenses/LICENSE +201 -0
- bioagent-bench/.venv/lib/python3.14/site-packages/aiosignal-1.4.0.dist-info/top_level.txt +1 -0
- bioagent-bench/.venv/lib/python3.14/site-packages/annotated_doc-0.0.4.dist-info/INSTALLER +1 -0
- bioagent-bench/.venv/lib/python3.14/site-packages/annotated_doc-0.0.4.dist-info/METADATA +145 -0
- bioagent-bench/.venv/lib/python3.14/site-packages/annotated_doc-0.0.4.dist-info/WHEEL +4 -0
- bioagent-bench/.venv/lib/python3.14/site-packages/annotated_doc-0.0.4.dist-info/entry_points.txt +4 -0
- bioagent-bench/.venv/lib/python3.14/site-packages/annotated_doc-0.0.4.dist-info/licenses/LICENSE +21 -0
- bioagent-bench/.venv/lib/python3.14/site-packages/attr/__init__.py +104 -0
- bioagent-bench/.venv/lib/python3.14/site-packages/attr/__init__.pyi +389 -0
- bioagent-bench/.venv/lib/python3.14/site-packages/attr/_cmp.py +160 -0
- bioagent-bench/.venv/lib/python3.14/site-packages/attr/_cmp.pyi +13 -0
- bioagent-bench/.venv/lib/python3.14/site-packages/attr/_compat.py +99 -0
- bioagent-bench/.venv/lib/python3.14/site-packages/attr/_config.py +31 -0
- bioagent-bench/.venv/lib/python3.14/site-packages/attr/_funcs.py +497 -0
- bioagent-bench/.venv/lib/python3.14/site-packages/attr/_make.py +0 -0
- bioagent-bench/.venv/lib/python3.14/site-packages/attr/_next_gen.py +674 -0
- bioagent-bench/.venv/lib/python3.14/site-packages/attr/_typing_compat.pyi +15 -0
- bioagent-bench/.venv/lib/python3.14/site-packages/attr/_version_info.pyi +9 -0
- bioagent-bench/.venv/lib/python3.14/site-packages/attr/converters.py +162 -0
- bioagent-bench/.venv/lib/python3.14/site-packages/attr/converters.pyi +19 -0
- bioagent-bench/.venv/lib/python3.14/site-packages/attr/exceptions.py +95 -0
- bioagent-bench/.venv/lib/python3.14/site-packages/attr/exceptions.pyi +17 -0
- bioagent-bench/.venv/lib/python3.14/site-packages/attr/filters.py +72 -0
- bioagent-bench/.venv/lib/python3.14/site-packages/attr/filters.pyi +6 -0
- bioagent-bench/.venv/lib/python3.14/site-packages/attr/py.typed +0 -0
- bioagent-bench/.venv/lib/python3.14/site-packages/attr/setters.py +79 -0
- bioagent-bench/.venv/lib/python3.14/site-packages/attr/setters.pyi +20 -0
- bioagent-bench/.venv/lib/python3.14/site-packages/attr/validators.py +750 -0
- bioagent-bench/.venv/lib/python3.14/site-packages/attr/validators.pyi +140 -0
- bioagent-bench/.venv/lib/python3.14/site-packages/attrs-26.1.0.dist-info/INSTALLER +1 -0
- bioagent-bench/.venv/lib/python3.14/site-packages/attrs-26.1.0.dist-info/METADATA +199 -0
- bioagent-bench/.venv/lib/python3.14/site-packages/attrs-26.1.0.dist-info/RECORD +37 -0
- bioagent-bench/.venv/lib/python3.14/site-packages/attrs-26.1.0.dist-info/REQUESTED +0 -0
- bioagent-bench/.venv/lib/python3.14/site-packages/attrs-26.1.0.dist-info/WHEEL +4 -0
- bioagent-bench/.venv/lib/python3.14/site-packages/attrs-26.1.0.dist-info/licenses/LICENSE +21 -0
- bioagent-bench/.venv/lib/python3.14/site-packages/attrs/__init__.py +72 -0
bioagent-bench/.venv/lib/python3.14/site-packages/_virtualenv.py
ADDED
|
@@ -0,0 +1,101 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Patches that are applied at runtime to the virtual environment."""
|
| 2 |
+
|
| 3 |
+
import os
|
| 4 |
+
import sys
|
| 5 |
+
|
| 6 |
+
VIRTUALENV_PATCH_FILE = os.path.join(__file__)
|
| 7 |
+
|
| 8 |
+
|
| 9 |
+
def patch_dist(dist):
|
| 10 |
+
"""
|
| 11 |
+
Distutils allows user to configure some arguments via a configuration file:
|
| 12 |
+
https://docs.python.org/3.11/install/index.html#distutils-configuration-files.
|
| 13 |
+
|
| 14 |
+
Some of this arguments though don't make sense in context of the virtual environment files, let's fix them up.
|
| 15 |
+
""" # noqa: D205
|
| 16 |
+
# we cannot allow some install config as that would get packages installed outside of the virtual environment
|
| 17 |
+
old_parse_config_files = dist.Distribution.parse_config_files
|
| 18 |
+
|
| 19 |
+
def parse_config_files(self, *args, **kwargs):
|
| 20 |
+
result = old_parse_config_files(self, *args, **kwargs)
|
| 21 |
+
install = self.get_option_dict("install")
|
| 22 |
+
|
| 23 |
+
if "prefix" in install: # the prefix governs where to install the libraries
|
| 24 |
+
install["prefix"] = VIRTUALENV_PATCH_FILE, os.path.abspath(sys.prefix)
|
| 25 |
+
for base in ("purelib", "platlib", "headers", "scripts", "data"):
|
| 26 |
+
key = f"install_{base}"
|
| 27 |
+
if key in install: # do not allow global configs to hijack venv paths
|
| 28 |
+
install.pop(key, None)
|
| 29 |
+
return result
|
| 30 |
+
|
| 31 |
+
dist.Distribution.parse_config_files = parse_config_files
|
| 32 |
+
|
| 33 |
+
|
| 34 |
+
# Import hook that patches some modules to ignore configuration values that break package installation in case
|
| 35 |
+
# of virtual environments.
|
| 36 |
+
_DISTUTILS_PATCH = "distutils.dist", "setuptools.dist"
|
| 37 |
+
# https://docs.python.org/3/library/importlib.html#setting-up-an-importer
|
| 38 |
+
|
| 39 |
+
|
| 40 |
+
class _Finder:
|
| 41 |
+
"""A meta path finder that allows patching the imported distutils modules."""
|
| 42 |
+
|
| 43 |
+
fullname = None
|
| 44 |
+
|
| 45 |
+
# lock[0] is threading.Lock(), but initialized lazily to avoid importing threading very early at startup,
|
| 46 |
+
# because there are gevent-based applications that need to be first to import threading by themselves.
|
| 47 |
+
# See https://github.com/pypa/virtualenv/issues/1895 for details.
|
| 48 |
+
lock = [] # noqa: RUF012
|
| 49 |
+
|
| 50 |
+
def find_spec(self, fullname, path, target=None): # noqa: ARG002
|
| 51 |
+
if fullname in _DISTUTILS_PATCH and self.fullname is None:
|
| 52 |
+
# initialize lock[0] lazily
|
| 53 |
+
if len(self.lock) == 0:
|
| 54 |
+
import threading
|
| 55 |
+
|
| 56 |
+
lock = threading.Lock()
|
| 57 |
+
# there is possibility that two threads T1 and T2 are simultaneously running into find_spec,
|
| 58 |
+
# observing .lock as empty, and further going into hereby initialization. However due to the GIL,
|
| 59 |
+
# list.append() operation is atomic and this way only one of the threads will "win" to put the lock
|
| 60 |
+
# - that every thread will use - into .lock[0].
|
| 61 |
+
# https://docs.python.org/3/faq/library.html#what-kinds-of-global-value-mutation-are-thread-safe
|
| 62 |
+
self.lock.append(lock)
|
| 63 |
+
|
| 64 |
+
from functools import partial
|
| 65 |
+
from importlib.util import find_spec
|
| 66 |
+
|
| 67 |
+
with self.lock[0]:
|
| 68 |
+
self.fullname = fullname
|
| 69 |
+
try:
|
| 70 |
+
spec = find_spec(fullname, path)
|
| 71 |
+
if spec is not None:
|
| 72 |
+
# https://www.python.org/dev/peps/pep-0451/#how-loading-will-work
|
| 73 |
+
is_new_api = hasattr(spec.loader, "exec_module")
|
| 74 |
+
func_name = "exec_module" if is_new_api else "load_module"
|
| 75 |
+
old = getattr(spec.loader, func_name)
|
| 76 |
+
func = self.exec_module if is_new_api else self.load_module
|
| 77 |
+
if old is not func:
|
| 78 |
+
try: # noqa: SIM105
|
| 79 |
+
setattr(spec.loader, func_name, partial(func, old))
|
| 80 |
+
except AttributeError:
|
| 81 |
+
pass # C-Extension loaders are r/o such as zipimporter with <3.7
|
| 82 |
+
return spec
|
| 83 |
+
finally:
|
| 84 |
+
self.fullname = None
|
| 85 |
+
return None
|
| 86 |
+
|
| 87 |
+
@staticmethod
|
| 88 |
+
def exec_module(old, module):
|
| 89 |
+
old(module)
|
| 90 |
+
if module.__name__ in _DISTUTILS_PATCH:
|
| 91 |
+
patch_dist(module)
|
| 92 |
+
|
| 93 |
+
@staticmethod
|
| 94 |
+
def load_module(old, name):
|
| 95 |
+
module = old(name)
|
| 96 |
+
if module.__name__ in _DISTUTILS_PATCH:
|
| 97 |
+
patch_dist(module)
|
| 98 |
+
return module
|
| 99 |
+
|
| 100 |
+
|
| 101 |
+
sys.meta_path.insert(0, _Finder())
|
bioagent-bench/.venv/lib/python3.14/site-packages/aiohttp-3.13.5.dist-info/INSTALLER
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
uv
|
bioagent-bench/.venv/lib/python3.14/site-packages/aiohttp-3.13.5.dist-info/METADATA
ADDED
|
@@ -0,0 +1,262 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Metadata-Version: 2.4
|
| 2 |
+
Name: aiohttp
|
| 3 |
+
Version: 3.13.5
|
| 4 |
+
Summary: Async http client/server framework (asyncio)
|
| 5 |
+
Maintainer-email: aiohttp team <team@aiohttp.org>
|
| 6 |
+
License: Apache-2.0 AND MIT
|
| 7 |
+
Project-URL: Homepage, https://github.com/aio-libs/aiohttp
|
| 8 |
+
Project-URL: Chat: Matrix, https://matrix.to/#/#aio-libs:matrix.org
|
| 9 |
+
Project-URL: Chat: Matrix Space, https://matrix.to/#/#aio-libs-space:matrix.org
|
| 10 |
+
Project-URL: CI: GitHub Actions, https://github.com/aio-libs/aiohttp/actions?query=workflow%3ACI
|
| 11 |
+
Project-URL: Coverage: codecov, https://codecov.io/github/aio-libs/aiohttp
|
| 12 |
+
Project-URL: Docs: Changelog, https://docs.aiohttp.org/en/stable/changes.html
|
| 13 |
+
Project-URL: Docs: RTD, https://docs.aiohttp.org
|
| 14 |
+
Project-URL: GitHub: issues, https://github.com/aio-libs/aiohttp/issues
|
| 15 |
+
Project-URL: GitHub: repo, https://github.com/aio-libs/aiohttp
|
| 16 |
+
Classifier: Development Status :: 5 - Production/Stable
|
| 17 |
+
Classifier: Framework :: AsyncIO
|
| 18 |
+
Classifier: Intended Audience :: Developers
|
| 19 |
+
Classifier: Operating System :: POSIX
|
| 20 |
+
Classifier: Operating System :: MacOS :: MacOS X
|
| 21 |
+
Classifier: Operating System :: Microsoft :: Windows
|
| 22 |
+
Classifier: Programming Language :: Python
|
| 23 |
+
Classifier: Programming Language :: Python :: 3
|
| 24 |
+
Classifier: Programming Language :: Python :: 3.9
|
| 25 |
+
Classifier: Programming Language :: Python :: 3.10
|
| 26 |
+
Classifier: Programming Language :: Python :: 3.11
|
| 27 |
+
Classifier: Programming Language :: Python :: 3.12
|
| 28 |
+
Classifier: Programming Language :: Python :: 3.13
|
| 29 |
+
Classifier: Programming Language :: Python :: 3.14
|
| 30 |
+
Classifier: Topic :: Internet :: WWW/HTTP
|
| 31 |
+
Requires-Python: >=3.9
|
| 32 |
+
Description-Content-Type: text/x-rst
|
| 33 |
+
License-File: LICENSE.txt
|
| 34 |
+
License-File: vendor/llhttp/LICENSE
|
| 35 |
+
Requires-Dist: aiohappyeyeballs>=2.5.0
|
| 36 |
+
Requires-Dist: aiosignal>=1.4.0
|
| 37 |
+
Requires-Dist: async-timeout<6.0,>=4.0; python_version < "3.11"
|
| 38 |
+
Requires-Dist: attrs>=17.3.0
|
| 39 |
+
Requires-Dist: frozenlist>=1.1.1
|
| 40 |
+
Requires-Dist: multidict<7.0,>=4.5
|
| 41 |
+
Requires-Dist: propcache>=0.2.0
|
| 42 |
+
Requires-Dist: yarl<2.0,>=1.17.0
|
| 43 |
+
Provides-Extra: speedups
|
| 44 |
+
Requires-Dist: aiodns>=3.3.0; extra == "speedups"
|
| 45 |
+
Requires-Dist: Brotli>=1.2; platform_python_implementation == "CPython" and extra == "speedups"
|
| 46 |
+
Requires-Dist: brotlicffi>=1.2; platform_python_implementation != "CPython" and extra == "speedups"
|
| 47 |
+
Requires-Dist: backports.zstd; (platform_python_implementation == "CPython" and python_version < "3.14") and extra == "speedups"
|
| 48 |
+
Dynamic: license-file
|
| 49 |
+
|
| 50 |
+
==================================
|
| 51 |
+
Async http client/server framework
|
| 52 |
+
==================================
|
| 53 |
+
|
| 54 |
+
.. image:: https://raw.githubusercontent.com/aio-libs/aiohttp/master/docs/aiohttp-plain.svg
|
| 55 |
+
:height: 64px
|
| 56 |
+
:width: 64px
|
| 57 |
+
:alt: aiohttp logo
|
| 58 |
+
|
| 59 |
+
|
|
| 60 |
+
|
| 61 |
+
.. image:: https://github.com/aio-libs/aiohttp/workflows/CI/badge.svg
|
| 62 |
+
:target: https://github.com/aio-libs/aiohttp/actions?query=workflow%3ACI
|
| 63 |
+
:alt: GitHub Actions status for master branch
|
| 64 |
+
|
| 65 |
+
.. image:: https://codecov.io/gh/aio-libs/aiohttp/branch/master/graph/badge.svg
|
| 66 |
+
:target: https://codecov.io/gh/aio-libs/aiohttp
|
| 67 |
+
:alt: codecov.io status for master branch
|
| 68 |
+
|
| 69 |
+
.. image:: https://badge.fury.io/py/aiohttp.svg
|
| 70 |
+
:target: https://pypi.org/project/aiohttp
|
| 71 |
+
:alt: Latest PyPI package version
|
| 72 |
+
|
| 73 |
+
.. image:: https://img.shields.io/pypi/dm/aiohttp
|
| 74 |
+
:target: https://pypistats.org/packages/aiohttp
|
| 75 |
+
:alt: Downloads count
|
| 76 |
+
|
| 77 |
+
.. image:: https://readthedocs.org/projects/aiohttp/badge/?version=latest
|
| 78 |
+
:target: https://docs.aiohttp.org/
|
| 79 |
+
:alt: Latest Read The Docs
|
| 80 |
+
|
| 81 |
+
.. image:: https://img.shields.io/endpoint?url=https://codspeed.io/badge.json
|
| 82 |
+
:target: https://codspeed.io/aio-libs/aiohttp
|
| 83 |
+
:alt: Codspeed.io status for aiohttp
|
| 84 |
+
|
| 85 |
+
|
| 86 |
+
Key Features
|
| 87 |
+
============
|
| 88 |
+
|
| 89 |
+
- Supports both client and server side of HTTP protocol.
|
| 90 |
+
- Supports both client and server Web-Sockets out-of-the-box and avoids
|
| 91 |
+
Callback Hell.
|
| 92 |
+
- Provides Web-server with middleware and pluggable routing.
|
| 93 |
+
|
| 94 |
+
|
| 95 |
+
Getting started
|
| 96 |
+
===============
|
| 97 |
+
|
| 98 |
+
Client
|
| 99 |
+
------
|
| 100 |
+
|
| 101 |
+
To get something from the web:
|
| 102 |
+
|
| 103 |
+
.. code-block:: python
|
| 104 |
+
|
| 105 |
+
import aiohttp
|
| 106 |
+
import asyncio
|
| 107 |
+
|
| 108 |
+
async def main():
|
| 109 |
+
|
| 110 |
+
async with aiohttp.ClientSession() as session:
|
| 111 |
+
async with session.get('http://python.org') as response:
|
| 112 |
+
|
| 113 |
+
print("Status:", response.status)
|
| 114 |
+
print("Content-type:", response.headers['content-type'])
|
| 115 |
+
|
| 116 |
+
html = await response.text()
|
| 117 |
+
print("Body:", html[:15], "...")
|
| 118 |
+
|
| 119 |
+
asyncio.run(main())
|
| 120 |
+
|
| 121 |
+
This prints:
|
| 122 |
+
|
| 123 |
+
.. code-block::
|
| 124 |
+
|
| 125 |
+
Status: 200
|
| 126 |
+
Content-type: text/html; charset=utf-8
|
| 127 |
+
Body: <!doctype html> ...
|
| 128 |
+
|
| 129 |
+
Coming from `requests <https://requests.readthedocs.io/>`_ ? Read `why we need so many lines <https://aiohttp.readthedocs.io/en/latest/http_request_lifecycle.html>`_.
|
| 130 |
+
|
| 131 |
+
Server
|
| 132 |
+
------
|
| 133 |
+
|
| 134 |
+
An example using a simple server:
|
| 135 |
+
|
| 136 |
+
.. code-block:: python
|
| 137 |
+
|
| 138 |
+
# examples/server_simple.py
|
| 139 |
+
from aiohttp import web
|
| 140 |
+
|
| 141 |
+
async def handle(request):
|
| 142 |
+
name = request.match_info.get('name', "Anonymous")
|
| 143 |
+
text = "Hello, " + name
|
| 144 |
+
return web.Response(text=text)
|
| 145 |
+
|
| 146 |
+
async def wshandle(request):
|
| 147 |
+
ws = web.WebSocketResponse()
|
| 148 |
+
await ws.prepare(request)
|
| 149 |
+
|
| 150 |
+
async for msg in ws:
|
| 151 |
+
if msg.type == web.WSMsgType.text:
|
| 152 |
+
await ws.send_str("Hello, {}".format(msg.data))
|
| 153 |
+
elif msg.type == web.WSMsgType.binary:
|
| 154 |
+
await ws.send_bytes(msg.data)
|
| 155 |
+
elif msg.type == web.WSMsgType.close:
|
| 156 |
+
break
|
| 157 |
+
|
| 158 |
+
return ws
|
| 159 |
+
|
| 160 |
+
|
| 161 |
+
app = web.Application()
|
| 162 |
+
app.add_routes([web.get('/', handle),
|
| 163 |
+
web.get('/echo', wshandle),
|
| 164 |
+
web.get('/{name}', handle)])
|
| 165 |
+
|
| 166 |
+
if __name__ == '__main__':
|
| 167 |
+
web.run_app(app)
|
| 168 |
+
|
| 169 |
+
|
| 170 |
+
Documentation
|
| 171 |
+
=============
|
| 172 |
+
|
| 173 |
+
https://aiohttp.readthedocs.io/
|
| 174 |
+
|
| 175 |
+
|
| 176 |
+
Demos
|
| 177 |
+
=====
|
| 178 |
+
|
| 179 |
+
https://github.com/aio-libs/aiohttp-demos
|
| 180 |
+
|
| 181 |
+
|
| 182 |
+
External links
|
| 183 |
+
==============
|
| 184 |
+
|
| 185 |
+
* `Third party libraries
|
| 186 |
+
<http://aiohttp.readthedocs.io/en/latest/third_party.html>`_
|
| 187 |
+
* `Built with aiohttp
|
| 188 |
+
<http://aiohttp.readthedocs.io/en/latest/built_with.html>`_
|
| 189 |
+
* `Powered by aiohttp
|
| 190 |
+
<http://aiohttp.readthedocs.io/en/latest/powered_by.html>`_
|
| 191 |
+
|
| 192 |
+
Feel free to make a Pull Request for adding your link to these pages!
|
| 193 |
+
|
| 194 |
+
|
| 195 |
+
Communication channels
|
| 196 |
+
======================
|
| 197 |
+
|
| 198 |
+
*aio-libs Discussions*: https://github.com/aio-libs/aiohttp/discussions
|
| 199 |
+
|
| 200 |
+
*Matrix*: `#aio-libs:matrix.org <https://matrix.to/#/#aio-libs:matrix.org>`_
|
| 201 |
+
|
| 202 |
+
We support `Stack Overflow
|
| 203 |
+
<https://stackoverflow.com/questions/tagged/aiohttp>`_.
|
| 204 |
+
Please add *aiohttp* tag to your question there.
|
| 205 |
+
|
| 206 |
+
Requirements
|
| 207 |
+
============
|
| 208 |
+
|
| 209 |
+
- attrs_
|
| 210 |
+
- multidict_
|
| 211 |
+
- yarl_
|
| 212 |
+
- frozenlist_
|
| 213 |
+
|
| 214 |
+
Optionally you may install the aiodns_ library (highly recommended for sake of speed).
|
| 215 |
+
|
| 216 |
+
.. _aiodns: https://pypi.python.org/pypi/aiodns
|
| 217 |
+
.. _attrs: https://github.com/python-attrs/attrs
|
| 218 |
+
.. _multidict: https://pypi.python.org/pypi/multidict
|
| 219 |
+
.. _frozenlist: https://pypi.org/project/frozenlist/
|
| 220 |
+
.. _yarl: https://pypi.python.org/pypi/yarl
|
| 221 |
+
.. _async-timeout: https://pypi.python.org/pypi/async_timeout
|
| 222 |
+
|
| 223 |
+
License
|
| 224 |
+
=======
|
| 225 |
+
|
| 226 |
+
``aiohttp`` is offered under the Apache 2 license.
|
| 227 |
+
|
| 228 |
+
|
| 229 |
+
Keepsafe
|
| 230 |
+
========
|
| 231 |
+
|
| 232 |
+
The aiohttp community would like to thank Keepsafe
|
| 233 |
+
(https://www.getkeepsafe.com) for its support in the early days of
|
| 234 |
+
the project.
|
| 235 |
+
|
| 236 |
+
|
| 237 |
+
Source code
|
| 238 |
+
===========
|
| 239 |
+
|
| 240 |
+
The latest developer version is available in a GitHub repository:
|
| 241 |
+
https://github.com/aio-libs/aiohttp
|
| 242 |
+
|
| 243 |
+
Benchmarks
|
| 244 |
+
==========
|
| 245 |
+
|
| 246 |
+
If you are interested in efficiency, the AsyncIO community maintains a
|
| 247 |
+
list of benchmarks on the official wiki:
|
| 248 |
+
https://github.com/python/asyncio/wiki/Benchmarks
|
| 249 |
+
|
| 250 |
+
--------
|
| 251 |
+
|
| 252 |
+
.. image:: https://img.shields.io/matrix/aio-libs:matrix.org?label=Discuss%20on%20Matrix%20at%20%23aio-libs%3Amatrix.org&logo=matrix&server_fqdn=matrix.org&style=flat
|
| 253 |
+
:target: https://matrix.to/#/%23aio-libs:matrix.org
|
| 254 |
+
:alt: Matrix Room — #aio-libs:matrix.org
|
| 255 |
+
|
| 256 |
+
.. image:: https://img.shields.io/matrix/aio-libs-space:matrix.org?label=Discuss%20on%20Matrix%20at%20%23aio-libs-space%3Amatrix.org&logo=matrix&server_fqdn=matrix.org&style=flat
|
| 257 |
+
:target: https://matrix.to/#/%23aio-libs-space:matrix.org
|
| 258 |
+
:alt: Matrix Space — #aio-libs-space:matrix.org
|
| 259 |
+
|
| 260 |
+
.. image:: https://insights.linuxfoundation.org/api/badge/health-score?project=aiohttp
|
| 261 |
+
:target: https://insights.linuxfoundation.org/project/aiohttp
|
| 262 |
+
:alt: LFX Health Score
|
bioagent-bench/.venv/lib/python3.14/site-packages/aiohttp-3.13.5.dist-info/RECORD
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
aiohttp-3.13.5.dist-info/INSTALLER,sha256=5hhM4Q4mYTT9z6QB6PGpUAW81PGNFrYrdXMj4oM_6ak,2
|
| 2 |
+
aiohttp-3.13.5.dist-info/METADATA,sha256=yVHd0XDIuuar5cgTh5EZI2mDXCREeUCWCZ-VA6gWvUQ,8145
|
| 3 |
+
aiohttp-3.13.5.dist-info/RECORD,,
|
| 4 |
+
aiohttp-3.13.5.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
| 5 |
+
aiohttp-3.13.5.dist-info/WHEEL,sha256=a6EB0SZmvnUxj7CP1sYpBVvB6TTNx-Vzw2sye5KrYcM,190
|
| 6 |
+
aiohttp-3.13.5.dist-info/licenses/LICENSE.txt,sha256=n4DQ2311WpQdtFchcsJw7L2PCCuiFd3QlZhZQu2Uqes,588
|
| 7 |
+
aiohttp-3.13.5.dist-info/licenses/vendor/llhttp/LICENSE,sha256=68qFTgE0zSVtZzYnwgSZ9CV363S6zwi58ltianPJEnc,1105
|
| 8 |
+
aiohttp-3.13.5.dist-info/top_level.txt,sha256=iv-JIaacmTl-hSho3QmphcKnbRRYx1st47yjz_178Ro,8
|
| 9 |
+
aiohttp/.hash/_cparser.pxd.hash,sha256=pjs-sEXNw_eijXGAedwG-BHnlFp8B7sOCgUagIWaU2A,121
|
| 10 |
+
aiohttp/.hash/_find_header.pxd.hash,sha256=_mbpD6vM-CVCKq3ulUvsOAz5Wdo88wrDzfpOsMQaMNA,125
|
| 11 |
+
aiohttp/.hash/_http_parser.pyx.hash,sha256=T47Ily1qaTY3xOHgBgJZE5A_bKruDtCG_droC3m7BD8,125
|
| 12 |
+
aiohttp/.hash/_http_writer.pyx.hash,sha256=DO9V6lTsDngY8e4y5O0ghHRc-RNGq-pVt_dLNHJy7xA,125
|
| 13 |
+
aiohttp/.hash/hdrs.py.hash,sha256=v6IaKbsxjsdQxBzhb5AjP0x_9G3rUe84D7avf7AI4cs,116
|
| 14 |
+
aiohttp/__init__.py,sha256=r1a3wmBz41XCNY0dqSnCcgfqrDYSDYD-_vKBN3Bfy3Y,8302
|
| 15 |
+
aiohttp/_cookie_helpers.py,sha256=_p7y-B8OCAk7FLjByiuwFIpDLGuNoJn3_vixzymAFnE,13659
|
| 16 |
+
aiohttp/_cparser.pxd,sha256=UnbUYCHg4NdXfgyRVYAMv2KTLWClB4P-xCrvtj_r7ew,4295
|
| 17 |
+
aiohttp/_find_header.pxd,sha256=0GfwFCPN2zxEKTO1_MA5sYq2UfzsG8kcV3aTqvwlz3g,68
|
| 18 |
+
aiohttp/_headers.pxi,sha256=n701k28dVPjwRnx5j6LpJhLTfj7dqu2vJt7f0O60Oyg,2007
|
| 19 |
+
aiohttp/_http_parser.cpython-314-x86_64-linux-gnu.so,sha256=IUYlPnjodpfpj5PSYVsS2YCRQaoU_Fa2Vhl9KqtWxY0,2872800
|
| 20 |
+
aiohttp/_http_parser.pyx,sha256=veuwNKb6YzBJoO3nbvrkOCaTzbcROS5MVksUJhDHNgg,30036
|
| 21 |
+
aiohttp/_http_writer.cpython-314-x86_64-linux-gnu.so,sha256=SabbqWzAMlxn_yCyCOTi44eWa8DZ4fc-xFmjtrJoIGA,460736
|
| 22 |
+
aiohttp/_http_writer.pyx,sha256=TXNOC90txk4wnPakxex_ygSbr3xq1UxaCi2T4gv2teY,4690
|
| 23 |
+
aiohttp/_websocket/.hash/mask.pxd.hash,sha256=Y0zBddk_ck3pi9-BFzMcpkcvCKvwvZ4GTtZFb9u1nxQ,128
|
| 24 |
+
aiohttp/_websocket/.hash/mask.pyx.hash,sha256=90owpXYM8_kIma4KUcOxhWSk-Uv4NVMBoCYeFM1B3d0,128
|
| 25 |
+
aiohttp/_websocket/.hash/reader_c.pxd.hash,sha256=5xf3oobk6vx4xbJm-xtZ1_QufB8fYFtLQV2MNdqUc1w,132
|
| 26 |
+
aiohttp/_websocket/__init__.py,sha256=Mar3R9_vBN_Ea4lsW7iTAVXD7OKswKPGqF5xgSyt77k,44
|
| 27 |
+
aiohttp/_websocket/helpers.py,sha256=P-XLv8IUaihKzDenVUqfKU5DJbWE5HvG8uhvUZK8Ic4,5038
|
| 28 |
+
aiohttp/_websocket/mask.cpython-314-x86_64-linux-gnu.so,sha256=88tnUQHEMXouHomgg4mRztaJvg4OxXrmHc5enx9xRn0,242640
|
| 29 |
+
aiohttp/_websocket/mask.pxd,sha256=sBmZ1Amym9kW4Ge8lj1fLZ7mPPya4LzLdpkQExQXv5M,112
|
| 30 |
+
aiohttp/_websocket/mask.pyx,sha256=BHjOtV0O0w7xp9p0LNADRJvGmgfPn9sGeJvSs0fL__4,1397
|
| 31 |
+
aiohttp/_websocket/models.py,sha256=XAzjs_8JYszWXIgZ6R3ZRrF-tX9Q_6LiD49WRYojopM,2121
|
| 32 |
+
aiohttp/_websocket/reader.py,sha256=eC4qS0c5sOeQ2ebAHLaBpIaTVFaSKX79pY2xvh3Pqyw,1030
|
| 33 |
+
aiohttp/_websocket/reader_c.cpython-314-x86_64-linux-gnu.so,sha256=_yZPMlMBz0T9mTaoMvmRV9pYjcdpscnDTy70JhJ-f1M,1783832
|
| 34 |
+
aiohttp/_websocket/reader_c.pxd,sha256=nl_njtDrzlQU0rjgGGjZDB-swguE0tX_bCPobkShVa4,2625
|
| 35 |
+
aiohttp/_websocket/reader_c.py,sha256=V5YtZ2gj2BjE2Q-W9sR_MdAl1VAm1pB7ZjozVJcOpbg,18868
|
| 36 |
+
aiohttp/_websocket/reader_py.py,sha256=V5YtZ2gj2BjE2Q-W9sR_MdAl1VAm1pB7ZjozVJcOpbg,18868
|
| 37 |
+
aiohttp/_websocket/writer.py,sha256=2OvSktPmNh_g20h1cXJt2Xu8u6IvswnPjdur7OwBbJk,11261
|
| 38 |
+
aiohttp/abc.py,sha256=M66F4S6m00bIEn7y4ha_XLTMDmVQ9dPihfOVB0pGfOo,7149
|
| 39 |
+
aiohttp/base_protocol.py,sha256=Tp8cxUPQvv9kUPk3w6lAzk6d2MAzV3scwI_3Go3C47c,3025
|
| 40 |
+
aiohttp/client.py,sha256=JkHGrrJq1pSI7QEJw0jZKx5TLLzM87of8Yx-62m4x6g,58795
|
| 41 |
+
aiohttp/client_exceptions.py,sha256=t6vDg0ZhHDvij6E89Nv473zLpNu3CyMPAp0LqLHOc9I,11744
|
| 42 |
+
aiohttp/client_middleware_digest_auth.py,sha256=rInzAPEmFsaF42oVORmYSx56og1B7jZUSmmIdFD0MQ8,17641
|
| 43 |
+
aiohttp/client_middlewares.py,sha256=kP5N9CMzQPMGPIEydeVUiLUTLsw8Vl8Gr4qAWYdu3vM,1918
|
| 44 |
+
aiohttp/client_proto.py,sha256=eimrsOVNMt_y62gmXZ4JoBI5VZ0kGaW6WnqMkB1cnNQ,12179
|
| 45 |
+
aiohttp/client_reqrep.py,sha256=eEREDrZ0M8ZFTt1wjHduR-P8_sm40K65gNz-iMGYask,53391
|
| 46 |
+
aiohttp/client_ws.py,sha256=1CIjIXwyzOMIYw6AjUES4-qUwbyVHW1seJKQfg_Rta8,15109
|
| 47 |
+
aiohttp/compression_utils.py,sha256=hJ2LXhN2OWukFHm5b78TJFGKcAiL2kthi9Sf5PRYO-U,11738
|
| 48 |
+
aiohttp/connector.py,sha256=0AFVMAx7NwkIbovQ0qecQ3JO2bpEZpxMG_OnGZ3tP3E,69451
|
| 49 |
+
aiohttp/cookiejar.py,sha256=e28ZMQwJ5P0vbPX1OX4Se7-k3zeGvocFEqzGhwpG53k,18922
|
| 50 |
+
aiohttp/formdata.py,sha256=0cxe-naBSFp_NHB1l-TUSbhesU4dpNvwJMzhsLYoSns,6625
|
| 51 |
+
aiohttp/hdrs.py,sha256=2rj5MyA-6yRdYPhW5UKkW4iNWhEAlGIOSBH5D4FmKNE,5111
|
| 52 |
+
aiohttp/helpers.py,sha256=Q1307PCEnWz4RP8crUw8dk58c0YF2Ei3JywkKfRxz5E,30629
|
| 53 |
+
aiohttp/http.py,sha256=8o8j8xH70OWjnfTWA9V44NR785QPxEPrUtzMXiAVpwc,1842
|
| 54 |
+
aiohttp/http_exceptions.py,sha256=Z4IiKYxyfn1Pe947OfqW6NjXoVd12bDI4eKBZKC3Htw,3085
|
| 55 |
+
aiohttp/http_parser.py,sha256=TIvopmjIH3TSTrVTbbqxpBWBpkEuOaNjkzES0-fm4-4,40472
|
| 56 |
+
aiohttp/http_websocket.py,sha256=8VXFKw6KQUEmPg48GtRMB37v0gTK7A0inoxXuDxMZEc,842
|
| 57 |
+
aiohttp/http_writer.py,sha256=4sbiFD_RkE0x_xlAPXwGrL0iLS53L72Qw13hBPaQLls,12508
|
| 58 |
+
aiohttp/log.py,sha256=BbNKx9e3VMIm0xYjZI0IcBBoS7wjdeIeSaiJE7-qK2g,325
|
| 59 |
+
aiohttp/multipart.py,sha256=qMDEHLf64qQcPQLZv4RdwKUDB2L1CC_vN-5Z-P8wDzw,42805
|
| 60 |
+
aiohttp/payload.py,sha256=O6nsYNULL7AeM2cyJ6TYX73ncVnL5xJwt5AegxwMKqw,40874
|
| 61 |
+
aiohttp/payload_streamer.py,sha256=ZzEYyfzcjGWkVkK3XR2pBthSCSIykYvY3Wr5cGQ2eTc,2211
|
| 62 |
+
aiohttp/py.typed,sha256=sow9soTwP9T_gEAQSVh7Gb8855h04Nwmhs2We-JRgZM,7
|
| 63 |
+
aiohttp/pytest_plugin.py,sha256=z4XwqmsKdyJCKxbGiA5kFf90zcedvomqk4RqjZbhKNk,12901
|
| 64 |
+
aiohttp/resolver.py,sha256=gsrfUpFf8iHlcHfJvY-1fiBHW3PRvRVNb5lNZBg3zlY,10031
|
| 65 |
+
aiohttp/streams.py,sha256=i32xpXEjGL2c6ifepnBxBto5y9wXobzzYAIsi8kAkKI,23920
|
| 66 |
+
aiohttp/tcp_helpers.py,sha256=BSadqVWaBpMFDRWnhaaR941N9MiDZ7bdTrxgCb0CW-M,961
|
| 67 |
+
aiohttp/test_utils.py,sha256=7hMcJnOUSkZ54Axgdvveeth5y6R_B2T-0H2xX7mKWYc,23130
|
| 68 |
+
aiohttp/tracing.py,sha256=-6aaW6l0J9uJD45LzR4cijYH0j62pt0U_nn_aVzFku4,14558
|
| 69 |
+
aiohttp/typedefs.py,sha256=wUlqwe9Mw9W8jT3HsYJcYk00qP3EMPz3nTkYXmeNN48,1657
|
| 70 |
+
aiohttp/web.py,sha256=JzSNmejg5G6YeFAnkIgZfytqbU86sNu844yYKmoUpqs,17852
|
| 71 |
+
aiohttp/web_app.py,sha256=lGU_aAMN-h3wy-LTTHi6SeKH8ydt1G51BXcCspgD5ZA,19452
|
| 72 |
+
aiohttp/web_exceptions.py,sha256=aXW8MStpRS7JOFxYDPgPlWojMJP9RhxyAqvq2g0jOCE,10495
|
| 73 |
+
aiohttp/web_fileresponse.py,sha256=arimioSXf0rZQ46H9ejCip4hVN6ri_faFWfuP_XL_us,16374
|
| 74 |
+
aiohttp/web_log.py,sha256=1hhC05PJizS2POVfNxncorNM_fjYHMx2TbcpP6isxkQ,8624
|
| 75 |
+
aiohttp/web_middlewares.py,sha256=sFI0AgeNjdyAjuz92QtMIpngmJSOxrqe2Jfbs4BNUu0,4165
|
| 76 |
+
aiohttp/web_protocol.py,sha256=ZEwjomG6Y2olq2b967UXDezwYnuLJJHDNl48SgHpKJs,27210
|
| 77 |
+
aiohttp/web_request.py,sha256=xNCrsUQSqTB64G1_9QiC9xfQmdgkJwYkGfPBwnfIYQo,30406
|
| 78 |
+
aiohttp/web_response.py,sha256=DofOPOU4be_upiqouWjxfhMLyubtRFvOGnJZbIamH6s,29366
|
| 79 |
+
aiohttp/web_routedef.py,sha256=VT1GAx6BrawoDh5RwBwBu5wSABSqgWwAe74AUCyZAEo,6110
|
| 80 |
+
aiohttp/web_runner.py,sha256=v1G1nKiOOQgFnTSR4IMc6I9ReEFDMaHtMLvO_roDM-A,11786
|
| 81 |
+
aiohttp/web_server.py,sha256=-9WDKUAiR9ll-rSdwXSqG6YjaoW79d1R4y0BGSqgUMA,2888
|
| 82 |
+
aiohttp/web_urldispatcher.py,sha256=9pJ6b3LuujtZuAURNYh0tdhgCJn2ZFrakeEySNwNqhU,44512
|
| 83 |
+
aiohttp/web_ws.py,sha256=lItgmyatkXh0M6EY7JoZnSZkUl6R0wv8B88X4ILqQbU,22739
|
| 84 |
+
aiohttp/worker.py,sha256=o6BL8dbCGYysB76i_yGGvYagc9gyy2PyW1UisiOznjA,8345
|
bioagent-bench/.venv/lib/python3.14/site-packages/aiohttp-3.13.5.dist-info/REQUESTED
ADDED
|
File without changes
|
bioagent-bench/.venv/lib/python3.14/site-packages/aiohttp-3.13.5.dist-info/WHEEL
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Wheel-Version: 1.0
|
| 2 |
+
Generator: setuptools (82.0.1)
|
| 3 |
+
Root-Is-Purelib: false
|
| 4 |
+
Tag: cp314-cp314-manylinux_2_17_x86_64
|
| 5 |
+
Tag: cp314-cp314-manylinux2014_x86_64
|
| 6 |
+
Tag: cp314-cp314-manylinux_2_28_x86_64
|
| 7 |
+
|
bioagent-bench/.venv/lib/python3.14/site-packages/aiohttp-3.13.5.dist-info/licenses/LICENSE.txt
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Copyright aio-libs contributors.
|
| 2 |
+
|
| 3 |
+
Licensed under the Apache License, Version 2.0 (the "License");
|
| 4 |
+
you may not use this file except in compliance with the License.
|
| 5 |
+
You may obtain a copy of the License at
|
| 6 |
+
|
| 7 |
+
http://www.apache.org/licenses/LICENSE-2.0
|
| 8 |
+
|
| 9 |
+
Unless required by applicable law or agreed to in writing, software
|
| 10 |
+
distributed under the License is distributed on an "AS IS" BASIS,
|
| 11 |
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 12 |
+
See the License for the specific language governing permissions and
|
| 13 |
+
limitations under the License.
|
bioagent-bench/.venv/lib/python3.14/site-packages/aiohttp-3.13.5.dist-info/licenses/vendor/llhttp/LICENSE
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
This software is licensed under the MIT License.
|
| 2 |
+
|
| 3 |
+
Copyright Fedor Indutny, 2018.
|
| 4 |
+
|
| 5 |
+
Permission is hereby granted, free of charge, to any person obtaining a
|
| 6 |
+
copy of this software and associated documentation files (the
|
| 7 |
+
"Software"), to deal in the Software without restriction, including
|
| 8 |
+
without limitation the rights to use, copy, modify, merge, publish,
|
| 9 |
+
distribute, sublicense, and/or sell copies of the Software, and to permit
|
| 10 |
+
persons to whom the Software is furnished to do so, subject to the
|
| 11 |
+
following conditions:
|
| 12 |
+
|
| 13 |
+
The above copyright notice and this permission notice shall be included
|
| 14 |
+
in all copies or substantial portions of the Software.
|
| 15 |
+
|
| 16 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
| 17 |
+
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
| 18 |
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
|
| 19 |
+
NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
| 20 |
+
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
| 21 |
+
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
| 22 |
+
USE OR OTHER DEALINGS IN THE SOFTWARE.
|
bioagent-bench/.venv/lib/python3.14/site-packages/aiohttp-3.13.5.dist-info/top_level.txt
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
aiohttp
|
bioagent-bench/.venv/lib/python3.14/site-packages/aiosignal-1.4.0.dist-info/INSTALLER
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
uv
|
bioagent-bench/.venv/lib/python3.14/site-packages/aiosignal-1.4.0.dist-info/METADATA
ADDED
|
@@ -0,0 +1,112 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Metadata-Version: 2.4
|
| 2 |
+
Name: aiosignal
|
| 3 |
+
Version: 1.4.0
|
| 4 |
+
Summary: aiosignal: a list of registered asynchronous callbacks
|
| 5 |
+
Home-page: https://github.com/aio-libs/aiosignal
|
| 6 |
+
Maintainer: aiohttp team <team@aiohttp.org>
|
| 7 |
+
Maintainer-email: team@aiohttp.org
|
| 8 |
+
License: Apache 2.0
|
| 9 |
+
Project-URL: Chat: Gitter, https://gitter.im/aio-libs/Lobby
|
| 10 |
+
Project-URL: CI: GitHub Actions, https://github.com/aio-libs/aiosignal/actions
|
| 11 |
+
Project-URL: Coverage: codecov, https://codecov.io/github/aio-libs/aiosignal
|
| 12 |
+
Project-URL: Docs: RTD, https://docs.aiosignal.org
|
| 13 |
+
Project-URL: GitHub: issues, https://github.com/aio-libs/aiosignal/issues
|
| 14 |
+
Project-URL: GitHub: repo, https://github.com/aio-libs/aiosignal
|
| 15 |
+
Classifier: License :: OSI Approved :: Apache Software License
|
| 16 |
+
Classifier: Intended Audience :: Developers
|
| 17 |
+
Classifier: Programming Language :: Python
|
| 18 |
+
Classifier: Programming Language :: Python :: 3
|
| 19 |
+
Classifier: Programming Language :: Python :: 3 :: Only
|
| 20 |
+
Classifier: Development Status :: 5 - Production/Stable
|
| 21 |
+
Classifier: Operating System :: POSIX
|
| 22 |
+
Classifier: Operating System :: MacOS :: MacOS X
|
| 23 |
+
Classifier: Operating System :: Microsoft :: Windows
|
| 24 |
+
Classifier: Framework :: AsyncIO
|
| 25 |
+
Requires-Python: >=3.9
|
| 26 |
+
Description-Content-Type: text/x-rst
|
| 27 |
+
License-File: LICENSE
|
| 28 |
+
Requires-Dist: frozenlist>=1.1.0
|
| 29 |
+
Requires-Dist: typing-extensions>=4.2; python_version < "3.13"
|
| 30 |
+
Dynamic: license-file
|
| 31 |
+
|
| 32 |
+
=========
|
| 33 |
+
aiosignal
|
| 34 |
+
=========
|
| 35 |
+
|
| 36 |
+
.. image:: https://github.com/aio-libs/aiosignal/workflows/CI/badge.svg
|
| 37 |
+
:target: https://github.com/aio-libs/aiosignal/actions?query=workflow%3ACI
|
| 38 |
+
:alt: GitHub status for master branch
|
| 39 |
+
|
| 40 |
+
.. image:: https://codecov.io/gh/aio-libs/aiosignal/branch/master/graph/badge.svg?flag=pytest
|
| 41 |
+
:target: https://codecov.io/gh/aio-libs/aiosignal?flags[0]=pytest
|
| 42 |
+
:alt: codecov.io status for master branch
|
| 43 |
+
|
| 44 |
+
.. image:: https://badge.fury.io/py/aiosignal.svg
|
| 45 |
+
:target: https://pypi.org/project/aiosignal
|
| 46 |
+
:alt: Latest PyPI package version
|
| 47 |
+
|
| 48 |
+
.. image:: https://readthedocs.org/projects/aiosignal/badge/?version=latest
|
| 49 |
+
:target: https://aiosignal.readthedocs.io/
|
| 50 |
+
:alt: Latest Read The Docs
|
| 51 |
+
|
| 52 |
+
.. image:: https://img.shields.io/discourse/topics?server=https%3A%2F%2Faio-libs.discourse.group%2F
|
| 53 |
+
:target: https://aio-libs.discourse.group/
|
| 54 |
+
:alt: Discourse group for io-libs
|
| 55 |
+
|
| 56 |
+
.. image:: https://badges.gitter.im/Join%20Chat.svg
|
| 57 |
+
:target: https://gitter.im/aio-libs/Lobby
|
| 58 |
+
:alt: Chat on Gitter
|
| 59 |
+
|
| 60 |
+
Introduction
|
| 61 |
+
============
|
| 62 |
+
|
| 63 |
+
A project to manage callbacks in `asyncio` projects.
|
| 64 |
+
|
| 65 |
+
``Signal`` is a list of registered asynchronous callbacks.
|
| 66 |
+
|
| 67 |
+
The signal's life-cycle has two stages: after creation its content
|
| 68 |
+
could be filled by using standard list operations: ``sig.append()``
|
| 69 |
+
etc.
|
| 70 |
+
|
| 71 |
+
After you call ``sig.freeze()`` the signal is *frozen*: adding, removing
|
| 72 |
+
and dropping callbacks is forbidden.
|
| 73 |
+
|
| 74 |
+
The only available operation is calling the previously registered
|
| 75 |
+
callbacks by using ``await sig.send(data)``.
|
| 76 |
+
|
| 77 |
+
For concrete usage examples see the `Signals
|
| 78 |
+
<https://docs.aiohttp.org/en/stable/web_advanced.html#aiohttp-web-signals>
|
| 79 |
+
section of the `Web Server Advanced
|
| 80 |
+
<https://docs.aiohttp.org/en/stable/web_advanced.html>` chapter of the `aiohttp
|
| 81 |
+
documentation`_.
|
| 82 |
+
|
| 83 |
+
|
| 84 |
+
Installation
|
| 85 |
+
------------
|
| 86 |
+
|
| 87 |
+
::
|
| 88 |
+
|
| 89 |
+
$ pip install aiosignal
|
| 90 |
+
|
| 91 |
+
|
| 92 |
+
Documentation
|
| 93 |
+
=============
|
| 94 |
+
|
| 95 |
+
https://aiosignal.readthedocs.io/
|
| 96 |
+
|
| 97 |
+
License
|
| 98 |
+
=======
|
| 99 |
+
|
| 100 |
+
``aiosignal`` is offered under the Apache 2 license.
|
| 101 |
+
|
| 102 |
+
Source code
|
| 103 |
+
===========
|
| 104 |
+
|
| 105 |
+
The project is hosted on GitHub_
|
| 106 |
+
|
| 107 |
+
Please file an issue in the `bug tracker
|
| 108 |
+
<https://github.com/aio-libs/aiosignal/issues>`_ if you have found a bug
|
| 109 |
+
or have some suggestions to improve the library.
|
| 110 |
+
|
| 111 |
+
.. _GitHub: https://github.com/aio-libs/aiosignal
|
| 112 |
+
.. _aiohttp documentation: https://docs.aiohttp.org/
|
bioagent-bench/.venv/lib/python3.14/site-packages/aiosignal-1.4.0.dist-info/RECORD
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
aiosignal-1.4.0.dist-info/INSTALLER,sha256=5hhM4Q4mYTT9z6QB6PGpUAW81PGNFrYrdXMj4oM_6ak,2
|
| 2 |
+
aiosignal-1.4.0.dist-info/METADATA,sha256=CSR-8dqLxpZyjUcTDnAuQwf299EB1sSFv_nzpxznAI0,3662
|
| 3 |
+
aiosignal-1.4.0.dist-info/RECORD,,
|
| 4 |
+
aiosignal-1.4.0.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
| 5 |
+
aiosignal-1.4.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
| 6 |
+
aiosignal-1.4.0.dist-info/licenses/LICENSE,sha256=b9UkPpLdf5jsacesN3co50kFcJ_1J6W_mNbQJjwE9bY,11332
|
| 7 |
+
aiosignal-1.4.0.dist-info/top_level.txt,sha256=z45aNOKGDdrI1roqZY3BGXQ22kJFPHBmVdwtLYLtXC0,10
|
| 8 |
+
aiosignal/__init__.py,sha256=TIkmUG9HTBt4dfq2nISYBiZiRB2xwvFtEZydLP0HPL4,1537
|
| 9 |
+
aiosignal/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
bioagent-bench/.venv/lib/python3.14/site-packages/aiosignal-1.4.0.dist-info/REQUESTED
ADDED
|
File without changes
|
bioagent-bench/.venv/lib/python3.14/site-packages/aiosignal-1.4.0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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Apache License
|
| 2 |
+
Version 2.0, January 2004
|
| 3 |
+
http://www.apache.org/licenses/
|
| 4 |
+
|
| 5 |
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
| 6 |
+
|
| 7 |
+
1. Definitions.
|
| 8 |
+
|
| 9 |
+
"License" shall mean the terms and conditions for use, reproduction,
|
| 10 |
+
and distribution as defined by Sections 1 through 9 of this document.
|
| 11 |
+
|
| 12 |
+
"Licensor" shall mean the copyright owner or entity authorized by
|
| 13 |
+
the copyright owner that is granting the License.
|
| 14 |
+
|
| 15 |
+
"Legal Entity" shall mean the union of the acting entity and all
|
| 16 |
+
other entities that control, are controlled by, or are under common
|
| 17 |
+
control with that entity. For the purposes of this definition,
|
| 18 |
+
"control" means (i) the power, direct or indirect, to cause the
|
| 19 |
+
direction or management of such entity, whether by contract or
|
| 20 |
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
| 21 |
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
| 22 |
+
|
| 23 |
+
"You" (or "Your") shall mean an individual or Legal Entity
|
| 24 |
+
exercising permissions granted by this License.
|
| 25 |
+
|
| 26 |
+
"Source" form shall mean the preferred form for making modifications,
|
| 27 |
+
including but not limited to software source code, documentation
|
| 28 |
+
source, and configuration files.
|
| 29 |
+
|
| 30 |
+
"Object" form shall mean any form resulting from mechanical
|
| 31 |
+
transformation or translation of a Source form, including but
|
| 32 |
+
not limited to compiled object code, generated documentation,
|
| 33 |
+
and conversions to other media types.
|
| 34 |
+
|
| 35 |
+
"Work" shall mean the work of authorship, whether in Source or
|
| 36 |
+
Object form, made available under the License, as indicated by a
|
| 37 |
+
copyright notice that is included in or attached to the work
|
| 38 |
+
(an example is provided in the Appendix below).
|
| 39 |
+
|
| 40 |
+
"Derivative Works" shall mean any work, whether in Source or Object
|
| 41 |
+
form, that is based on (or derived from) the Work and for which the
|
| 42 |
+
editorial revisions, annotations, elaborations, or other modifications
|
| 43 |
+
represent, as a whole, an original work of authorship. For the purposes
|
| 44 |
+
of this License, Derivative Works shall not include works that remain
|
| 45 |
+
separable from, or merely link (or bind by name) to the interfaces of,
|
| 46 |
+
the Work and Derivative Works thereof.
|
| 47 |
+
|
| 48 |
+
"Contribution" shall mean any work of authorship, including
|
| 49 |
+
the original version of the Work and any modifications or additions
|
| 50 |
+
to that Work or Derivative Works thereof, that is intentionally
|
| 51 |
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
| 52 |
+
or by an individual or Legal Entity authorized to submit on behalf of
|
| 53 |
+
the copyright owner. For the purposes of this definition, "submitted"
|
| 54 |
+
means any form of electronic, verbal, or written communication sent
|
| 55 |
+
to the Licensor or its representatives, including but not limited to
|
| 56 |
+
communication on electronic mailing lists, source code control systems,
|
| 57 |
+
and issue tracking systems that are managed by, or on behalf of, the
|
| 58 |
+
Licensor for the purpose of discussing and improving the Work, but
|
| 59 |
+
excluding communication that is conspicuously marked or otherwise
|
| 60 |
+
designated in writing by the copyright owner as "Not a Contribution."
|
| 61 |
+
|
| 62 |
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
| 63 |
+
on behalf of whom a Contribution has been received by Licensor and
|
| 64 |
+
subsequently incorporated within the Work.
|
| 65 |
+
|
| 66 |
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
| 67 |
+
this License, each Contributor hereby grants to You a perpetual,
|
| 68 |
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
| 69 |
+
copyright license to reproduce, prepare Derivative Works of,
|
| 70 |
+
publicly display, publicly perform, sublicense, and distribute the
|
| 71 |
+
Work and such Derivative Works in Source or Object form.
|
| 72 |
+
|
| 73 |
+
3. Grant of Patent License. Subject to the terms and conditions of
|
| 74 |
+
this License, each Contributor hereby grants to You a perpetual,
|
| 75 |
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
| 76 |
+
(except as stated in this section) patent license to make, have made,
|
| 77 |
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
| 78 |
+
where such license applies only to those patent claims licensable
|
| 79 |
+
by such Contributor that are necessarily infringed by their
|
| 80 |
+
Contribution(s) alone or by combination of their Contribution(s)
|
| 81 |
+
with the Work to which such Contribution(s) was submitted. If You
|
| 82 |
+
institute patent litigation against any entity (including a
|
| 83 |
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
| 84 |
+
or a Contribution incorporated within the Work constitutes direct
|
| 85 |
+
or contributory patent infringement, then any patent licenses
|
| 86 |
+
granted to You under this License for that Work shall terminate
|
| 87 |
+
as of the date such litigation is filed.
|
| 88 |
+
|
| 89 |
+
4. Redistribution. You may reproduce and distribute copies of the
|
| 90 |
+
Work or Derivative Works thereof in any medium, with or without
|
| 91 |
+
modifications, and in Source or Object form, provided that You
|
| 92 |
+
meet the following conditions:
|
| 93 |
+
|
| 94 |
+
(a) You must give any other recipients of the Work or
|
| 95 |
+
Derivative Works a copy of this License; and
|
| 96 |
+
|
| 97 |
+
(b) You must cause any modified files to carry prominent notices
|
| 98 |
+
stating that You changed the files; and
|
| 99 |
+
|
| 100 |
+
(c) You must retain, in the Source form of any Derivative Works
|
| 101 |
+
that You distribute, all copyright, patent, trademark, and
|
| 102 |
+
attribution notices from the Source form of the Work,
|
| 103 |
+
excluding those notices that do not pertain to any part of
|
| 104 |
+
the Derivative Works; and
|
| 105 |
+
|
| 106 |
+
(d) If the Work includes a "NOTICE" text file as part of its
|
| 107 |
+
distribution, then any Derivative Works that You distribute must
|
| 108 |
+
include a readable copy of the attribution notices contained
|
| 109 |
+
within such NOTICE file, excluding those notices that do not
|
| 110 |
+
pertain to any part of the Derivative Works, in at least one
|
| 111 |
+
of the following places: within a NOTICE text file distributed
|
| 112 |
+
as part of the Derivative Works; within the Source form or
|
| 113 |
+
documentation, if provided along with the Derivative Works; or,
|
| 114 |
+
within a display generated by the Derivative Works, if and
|
| 115 |
+
wherever such third-party notices normally appear. The contents
|
| 116 |
+
of the NOTICE file are for informational purposes only and
|
| 117 |
+
do not modify the License. You may add Your own attribution
|
| 118 |
+
notices within Derivative Works that You distribute, alongside
|
| 119 |
+
or as an addendum to the NOTICE text from the Work, provided
|
| 120 |
+
that such additional attribution notices cannot be construed
|
| 121 |
+
as modifying the License.
|
| 122 |
+
|
| 123 |
+
You may add Your own copyright statement to Your modifications and
|
| 124 |
+
may provide additional or different license terms and conditions
|
| 125 |
+
for use, reproduction, or distribution of Your modifications, or
|
| 126 |
+
for any such Derivative Works as a whole, provided Your use,
|
| 127 |
+
reproduction, and distribution of the Work otherwise complies with
|
| 128 |
+
the conditions stated in this License.
|
| 129 |
+
|
| 130 |
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
| 131 |
+
any Contribution intentionally submitted for inclusion in the Work
|
| 132 |
+
by You to the Licensor shall be under the terms and conditions of
|
| 133 |
+
this License, without any additional terms or conditions.
|
| 134 |
+
Notwithstanding the above, nothing herein shall supersede or modify
|
| 135 |
+
the terms of any separate license agreement you may have executed
|
| 136 |
+
with Licensor regarding such Contributions.
|
| 137 |
+
|
| 138 |
+
6. Trademarks. This License does not grant permission to use the trade
|
| 139 |
+
names, trademarks, service marks, or product names of the Licensor,
|
| 140 |
+
except as required for reasonable and customary use in describing the
|
| 141 |
+
origin of the Work and reproducing the content of the NOTICE file.
|
| 142 |
+
|
| 143 |
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
| 144 |
+
agreed to in writing, Licensor provides the Work (and each
|
| 145 |
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
| 146 |
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
| 147 |
+
implied, including, without limitation, any warranties or conditions
|
| 148 |
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
| 149 |
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
| 150 |
+
appropriateness of using or redistributing the Work and assume any
|
| 151 |
+
risks associated with Your exercise of permissions under this License.
|
| 152 |
+
|
| 153 |
+
8. Limitation of Liability. In no event and under no legal theory,
|
| 154 |
+
whether in tort (including negligence), contract, or otherwise,
|
| 155 |
+
unless required by applicable law (such as deliberate and grossly
|
| 156 |
+
negligent acts) or agreed to in writing, shall any Contributor be
|
| 157 |
+
liable to You for damages, including any direct, indirect, special,
|
| 158 |
+
incidental, or consequential damages of any character arising as a
|
| 159 |
+
result of this License or out of the use or inability to use the
|
| 160 |
+
Work (including but not limited to damages for loss of goodwill,
|
| 161 |
+
work stoppage, computer failure or malfunction, or any and all
|
| 162 |
+
other commercial damages or losses), even if such Contributor
|
| 163 |
+
has been advised of the possibility of such damages.
|
| 164 |
+
|
| 165 |
+
9. Accepting Warranty or Additional Liability. While redistributing
|
| 166 |
+
the Work or Derivative Works thereof, You may choose to offer,
|
| 167 |
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
| 168 |
+
or other liability obligations and/or rights consistent with this
|
| 169 |
+
License. However, in accepting such obligations, You may act only
|
| 170 |
+
on Your own behalf and on Your sole responsibility, not on behalf
|
| 171 |
+
of any other Contributor, and only if You agree to indemnify,
|
| 172 |
+
defend, and hold each Contributor harmless for any liability
|
| 173 |
+
incurred by, or claims asserted against, such Contributor by reason
|
| 174 |
+
of your accepting any such warranty or additional liability.
|
| 175 |
+
|
| 176 |
+
END OF TERMS AND CONDITIONS
|
| 177 |
+
|
| 178 |
+
APPENDIX: How to apply the Apache License to your work.
|
| 179 |
+
|
| 180 |
+
To apply the Apache License to your work, attach the following
|
| 181 |
+
boilerplate notice, with the fields enclosed by brackets "{}"
|
| 182 |
+
replaced with your own identifying information. (Don't include
|
| 183 |
+
the brackets!) The text should be enclosed in the appropriate
|
| 184 |
+
comment syntax for the file format. We also recommend that a
|
| 185 |
+
file or class name and description of purpose be included on the
|
| 186 |
+
same "printed page" as the copyright notice for easier
|
| 187 |
+
identification within third-party archives.
|
| 188 |
+
|
| 189 |
+
Copyright 2013-2019 Nikolay Kim and Andrew Svetlov
|
| 190 |
+
|
| 191 |
+
Licensed under the Apache License, Version 2.0 (the "License");
|
| 192 |
+
you may not use this file except in compliance with the License.
|
| 193 |
+
You may obtain a copy of the License at
|
| 194 |
+
|
| 195 |
+
http://www.apache.org/licenses/LICENSE-2.0
|
| 196 |
+
|
| 197 |
+
Unless required by applicable law or agreed to in writing, software
|
| 198 |
+
distributed under the License is distributed on an "AS IS" BASIS,
|
| 199 |
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 200 |
+
See the License for the specific language governing permissions and
|
| 201 |
+
limitations under the License.
|
bioagent-bench/.venv/lib/python3.14/site-packages/aiosignal-1.4.0.dist-info/top_level.txt
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
aiosignal
|
bioagent-bench/.venv/lib/python3.14/site-packages/annotated_doc-0.0.4.dist-info/INSTALLER
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
uv
|
bioagent-bench/.venv/lib/python3.14/site-packages/annotated_doc-0.0.4.dist-info/METADATA
ADDED
|
@@ -0,0 +1,145 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Metadata-Version: 2.4
|
| 2 |
+
Name: annotated-doc
|
| 3 |
+
Version: 0.0.4
|
| 4 |
+
Summary: Document parameters, class attributes, return types, and variables inline, with Annotated.
|
| 5 |
+
Author-Email: =?utf-8?q?Sebasti=C3=A1n_Ram=C3=ADrez?= <tiangolo@gmail.com>
|
| 6 |
+
License-Expression: MIT
|
| 7 |
+
License-File: LICENSE
|
| 8 |
+
Classifier: Intended Audience :: Information Technology
|
| 9 |
+
Classifier: Intended Audience :: System Administrators
|
| 10 |
+
Classifier: Operating System :: OS Independent
|
| 11 |
+
Classifier: Programming Language :: Python :: 3
|
| 12 |
+
Classifier: Programming Language :: Python
|
| 13 |
+
Classifier: Topic :: Internet
|
| 14 |
+
Classifier: Topic :: Software Development :: Libraries :: Application Frameworks
|
| 15 |
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
| 16 |
+
Classifier: Topic :: Software Development :: Libraries
|
| 17 |
+
Classifier: Topic :: Software Development
|
| 18 |
+
Classifier: Typing :: Typed
|
| 19 |
+
Classifier: Development Status :: 4 - Beta
|
| 20 |
+
Classifier: Intended Audience :: Developers
|
| 21 |
+
Classifier: Programming Language :: Python :: 3 :: Only
|
| 22 |
+
Classifier: Programming Language :: Python :: 3.8
|
| 23 |
+
Classifier: Programming Language :: Python :: 3.9
|
| 24 |
+
Classifier: Programming Language :: Python :: 3.10
|
| 25 |
+
Classifier: Programming Language :: Python :: 3.11
|
| 26 |
+
Classifier: Programming Language :: Python :: 3.12
|
| 27 |
+
Classifier: Programming Language :: Python :: 3.13
|
| 28 |
+
Classifier: Programming Language :: Python :: 3.14
|
| 29 |
+
Project-URL: Homepage, https://github.com/fastapi/annotated-doc
|
| 30 |
+
Project-URL: Documentation, https://github.com/fastapi/annotated-doc
|
| 31 |
+
Project-URL: Repository, https://github.com/fastapi/annotated-doc
|
| 32 |
+
Project-URL: Issues, https://github.com/fastapi/annotated-doc/issues
|
| 33 |
+
Project-URL: Changelog, https://github.com/fastapi/annotated-doc/release-notes.md
|
| 34 |
+
Requires-Python: >=3.8
|
| 35 |
+
Description-Content-Type: text/markdown
|
| 36 |
+
|
| 37 |
+
# Annotated Doc
|
| 38 |
+
|
| 39 |
+
Document parameters, class attributes, return types, and variables inline, with `Annotated`.
|
| 40 |
+
|
| 41 |
+
<a href="https://github.com/fastapi/annotated-doc/actions?query=workflow%3ATest+event%3Apush+branch%3Amain" target="_blank">
|
| 42 |
+
<img src="https://github.com/fastapi/annotated-doc/actions/workflows/test.yml/badge.svg?event=push&branch=main" alt="Test">
|
| 43 |
+
</a>
|
| 44 |
+
<a href="https://coverage-badge.samuelcolvin.workers.dev/redirect/fastapi/annotated-doc" target="_blank">
|
| 45 |
+
<img src="https://coverage-badge.samuelcolvin.workers.dev/fastapi/annotated-doc.svg" alt="Coverage">
|
| 46 |
+
</a>
|
| 47 |
+
<a href="https://pypi.org/project/annotated-doc" target="_blank">
|
| 48 |
+
<img src="https://img.shields.io/pypi/v/annotated-doc?color=%2334D058&label=pypi%20package" alt="Package version">
|
| 49 |
+
</a>
|
| 50 |
+
<a href="https://pypi.org/project/annotated-doc" target="_blank">
|
| 51 |
+
<img src="https://img.shields.io/pypi/pyversions/annotated-doc.svg?color=%2334D058" alt="Supported Python versions">
|
| 52 |
+
</a>
|
| 53 |
+
|
| 54 |
+
## Installation
|
| 55 |
+
|
| 56 |
+
```bash
|
| 57 |
+
pip install annotated-doc
|
| 58 |
+
```
|
| 59 |
+
|
| 60 |
+
Or with `uv`:
|
| 61 |
+
|
| 62 |
+
```Python
|
| 63 |
+
uv add annotated-doc
|
| 64 |
+
```
|
| 65 |
+
|
| 66 |
+
## Usage
|
| 67 |
+
|
| 68 |
+
Import `Doc` and pass a single literal string with the documentation for the specific parameter, class attribute, return type, or variable.
|
| 69 |
+
|
| 70 |
+
For example, to document a parameter `name` in a function `hi` you could do:
|
| 71 |
+
|
| 72 |
+
```Python
|
| 73 |
+
from typing import Annotated
|
| 74 |
+
|
| 75 |
+
from annotated_doc import Doc
|
| 76 |
+
|
| 77 |
+
def hi(name: Annotated[str, Doc("Who to say hi to")]) -> None:
|
| 78 |
+
print(f"Hi, {name}!")
|
| 79 |
+
```
|
| 80 |
+
|
| 81 |
+
You can also use it to document class attributes:
|
| 82 |
+
|
| 83 |
+
```Python
|
| 84 |
+
from typing import Annotated
|
| 85 |
+
|
| 86 |
+
from annotated_doc import Doc
|
| 87 |
+
|
| 88 |
+
class User:
|
| 89 |
+
name: Annotated[str, Doc("The user's name")]
|
| 90 |
+
age: Annotated[int, Doc("The user's age")]
|
| 91 |
+
```
|
| 92 |
+
|
| 93 |
+
The same way, you could document return types and variables, or anything that could have a type annotation with `Annotated`.
|
| 94 |
+
|
| 95 |
+
## Who Uses This
|
| 96 |
+
|
| 97 |
+
`annotated-doc` was made for:
|
| 98 |
+
|
| 99 |
+
* [FastAPI](https://fastapi.tiangolo.com/)
|
| 100 |
+
* [Typer](https://typer.tiangolo.com/)
|
| 101 |
+
* [SQLModel](https://sqlmodel.tiangolo.com/)
|
| 102 |
+
* [Asyncer](https://asyncer.tiangolo.com/)
|
| 103 |
+
|
| 104 |
+
`annotated-doc` is supported by [griffe-typingdoc](https://github.com/mkdocstrings/griffe-typingdoc), which powers reference documentation like the one in the [FastAPI Reference](https://fastapi.tiangolo.com/reference/).
|
| 105 |
+
|
| 106 |
+
## Reasons not to use `annotated-doc`
|
| 107 |
+
|
| 108 |
+
You are already comfortable with one of the existing docstring formats, like:
|
| 109 |
+
|
| 110 |
+
* Sphinx
|
| 111 |
+
* numpydoc
|
| 112 |
+
* Google
|
| 113 |
+
* Keras
|
| 114 |
+
|
| 115 |
+
Your team is already comfortable using them.
|
| 116 |
+
|
| 117 |
+
You prefer having the documentation about parameters all together in a docstring, separated from the code defining them.
|
| 118 |
+
|
| 119 |
+
You care about a specific set of users, using one specific editor, and that editor already has support for the specific docstring format you use.
|
| 120 |
+
|
| 121 |
+
## Reasons to use `annotated-doc`
|
| 122 |
+
|
| 123 |
+
* No micro-syntax to learn for newcomers, it’s **just Python** syntax.
|
| 124 |
+
* **Editing** would be already fully supported by default by any editor (current or future) supporting Python syntax, including syntax errors, syntax highlighting, etc.
|
| 125 |
+
* **Rendering** would be relatively straightforward to implement by static tools (tools that don't need runtime execution), as the information can be extracted from the AST they normally already create.
|
| 126 |
+
* **Deduplication of information**: the name of a parameter would be defined in a single place, not duplicated inside of a docstring.
|
| 127 |
+
* **Elimination** of the possibility of having **inconsistencies** when removing a parameter or class variable and **forgetting to remove** its documentation.
|
| 128 |
+
* **Minimization** of the probability of adding a new parameter or class variable and **forgetting to add its documentation**.
|
| 129 |
+
* **Elimination** of the possibility of having **inconsistencies** between the **name** of a parameter in the **signature** and the name in the docstring when it is renamed.
|
| 130 |
+
* **Access** to the documentation string for each symbol at **runtime**, including existing (older) Python versions.
|
| 131 |
+
* A more formalized way to document other symbols, like type aliases, that could use Annotated.
|
| 132 |
+
* **Support** for apps using FastAPI, Typer and others.
|
| 133 |
+
* **AI Accessibility**: AI tools will have an easier way understanding each parameter as the distance from documentation to parameter is much closer.
|
| 134 |
+
|
| 135 |
+
## History
|
| 136 |
+
|
| 137 |
+
I ([@tiangolo](https://github.com/tiangolo)) originally wanted for this to be part of the Python standard library (in [PEP 727](https://peps.python.org/pep-0727/)), but the proposal was withdrawn as there was a fair amount of negative feedback and opposition.
|
| 138 |
+
|
| 139 |
+
The conclusion was that this was better done as an external effort, in a third-party library.
|
| 140 |
+
|
| 141 |
+
So, here it is, with a simpler approach, as a third-party library, in a way that can be used by others, starting with FastAPI and friends.
|
| 142 |
+
|
| 143 |
+
## License
|
| 144 |
+
|
| 145 |
+
This project is licensed under the terms of the MIT license.
|
bioagent-bench/.venv/lib/python3.14/site-packages/annotated_doc-0.0.4.dist-info/WHEEL
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Wheel-Version: 1.0
|
| 2 |
+
Generator: pdm-backend (2.4.5)
|
| 3 |
+
Root-Is-Purelib: true
|
| 4 |
+
Tag: py3-none-any
|
bioagent-bench/.venv/lib/python3.14/site-packages/annotated_doc-0.0.4.dist-info/entry_points.txt
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
[console_scripts]
|
| 2 |
+
|
| 3 |
+
[gui_scripts]
|
| 4 |
+
|
bioagent-bench/.venv/lib/python3.14/site-packages/annotated_doc-0.0.4.dist-info/licenses/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
The MIT License (MIT)
|
| 2 |
+
|
| 3 |
+
Copyright (c) 2025 Sebastián Ramírez
|
| 4 |
+
|
| 5 |
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
| 6 |
+
of this software and associated documentation files (the "Software"), to deal
|
| 7 |
+
in the Software without restriction, including without limitation the rights
|
| 8 |
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
| 9 |
+
copies of the Software, and to permit persons to whom the Software is
|
| 10 |
+
furnished to do so, subject to the following conditions:
|
| 11 |
+
|
| 12 |
+
The above copyright notice and this permission notice shall be included in
|
| 13 |
+
all copies or substantial portions of the Software.
|
| 14 |
+
|
| 15 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
| 16 |
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
| 17 |
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
| 18 |
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
| 19 |
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
| 20 |
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
| 21 |
+
THE SOFTWARE.
|
bioagent-bench/.venv/lib/python3.14/site-packages/attr/__init__.py
ADDED
|
@@ -0,0 +1,104 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# SPDX-License-Identifier: MIT
|
| 2 |
+
|
| 3 |
+
"""
|
| 4 |
+
Classes Without Boilerplate
|
| 5 |
+
"""
|
| 6 |
+
|
| 7 |
+
from functools import partial
|
| 8 |
+
from typing import Callable, Literal, Protocol
|
| 9 |
+
|
| 10 |
+
from . import converters, exceptions, filters, setters, validators
|
| 11 |
+
from ._cmp import cmp_using
|
| 12 |
+
from ._config import get_run_validators, set_run_validators
|
| 13 |
+
from ._funcs import asdict, assoc, astuple, has, resolve_types
|
| 14 |
+
from ._make import (
|
| 15 |
+
NOTHING,
|
| 16 |
+
Attribute,
|
| 17 |
+
Converter,
|
| 18 |
+
Factory,
|
| 19 |
+
_Nothing,
|
| 20 |
+
attrib,
|
| 21 |
+
attrs,
|
| 22 |
+
evolve,
|
| 23 |
+
fields,
|
| 24 |
+
fields_dict,
|
| 25 |
+
make_class,
|
| 26 |
+
validate,
|
| 27 |
+
)
|
| 28 |
+
from ._next_gen import define, field, frozen, mutable
|
| 29 |
+
from ._version_info import VersionInfo
|
| 30 |
+
|
| 31 |
+
|
| 32 |
+
s = attributes = attrs
|
| 33 |
+
ib = attr = attrib
|
| 34 |
+
dataclass = partial(attrs, auto_attribs=True) # happy Easter ;)
|
| 35 |
+
|
| 36 |
+
|
| 37 |
+
class AttrsInstance(Protocol):
|
| 38 |
+
pass
|
| 39 |
+
|
| 40 |
+
|
| 41 |
+
NothingType = Literal[_Nothing.NOTHING]
|
| 42 |
+
|
| 43 |
+
__all__ = [
|
| 44 |
+
"NOTHING",
|
| 45 |
+
"Attribute",
|
| 46 |
+
"AttrsInstance",
|
| 47 |
+
"Converter",
|
| 48 |
+
"Factory",
|
| 49 |
+
"NothingType",
|
| 50 |
+
"asdict",
|
| 51 |
+
"assoc",
|
| 52 |
+
"astuple",
|
| 53 |
+
"attr",
|
| 54 |
+
"attrib",
|
| 55 |
+
"attributes",
|
| 56 |
+
"attrs",
|
| 57 |
+
"cmp_using",
|
| 58 |
+
"converters",
|
| 59 |
+
"define",
|
| 60 |
+
"evolve",
|
| 61 |
+
"exceptions",
|
| 62 |
+
"field",
|
| 63 |
+
"fields",
|
| 64 |
+
"fields_dict",
|
| 65 |
+
"filters",
|
| 66 |
+
"frozen",
|
| 67 |
+
"get_run_validators",
|
| 68 |
+
"has",
|
| 69 |
+
"ib",
|
| 70 |
+
"make_class",
|
| 71 |
+
"mutable",
|
| 72 |
+
"resolve_types",
|
| 73 |
+
"s",
|
| 74 |
+
"set_run_validators",
|
| 75 |
+
"setters",
|
| 76 |
+
"validate",
|
| 77 |
+
"validators",
|
| 78 |
+
]
|
| 79 |
+
|
| 80 |
+
|
| 81 |
+
def _make_getattr(mod_name: str) -> Callable:
|
| 82 |
+
"""
|
| 83 |
+
Create a metadata proxy for packaging information that uses *mod_name* in
|
| 84 |
+
its warnings and errors.
|
| 85 |
+
"""
|
| 86 |
+
|
| 87 |
+
def __getattr__(name: str) -> str:
|
| 88 |
+
if name not in ("__version__", "__version_info__"):
|
| 89 |
+
msg = f"module {mod_name} has no attribute {name}"
|
| 90 |
+
raise AttributeError(msg)
|
| 91 |
+
|
| 92 |
+
from importlib.metadata import metadata
|
| 93 |
+
|
| 94 |
+
meta = metadata("attrs")
|
| 95 |
+
|
| 96 |
+
if name == "__version_info__":
|
| 97 |
+
return VersionInfo._from_version_string(meta["version"])
|
| 98 |
+
|
| 99 |
+
return meta["version"]
|
| 100 |
+
|
| 101 |
+
return __getattr__
|
| 102 |
+
|
| 103 |
+
|
| 104 |
+
__getattr__ = _make_getattr(__name__)
|
bioagent-bench/.venv/lib/python3.14/site-packages/attr/__init__.pyi
ADDED
|
@@ -0,0 +1,389 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import enum
|
| 2 |
+
import sys
|
| 3 |
+
|
| 4 |
+
from typing import (
|
| 5 |
+
Any,
|
| 6 |
+
Callable,
|
| 7 |
+
Generic,
|
| 8 |
+
Literal,
|
| 9 |
+
Mapping,
|
| 10 |
+
Protocol,
|
| 11 |
+
Sequence,
|
| 12 |
+
TypeVar,
|
| 13 |
+
overload,
|
| 14 |
+
)
|
| 15 |
+
|
| 16 |
+
# `import X as X` is required to make these public
|
| 17 |
+
from . import converters as converters
|
| 18 |
+
from . import exceptions as exceptions
|
| 19 |
+
from . import filters as filters
|
| 20 |
+
from . import setters as setters
|
| 21 |
+
from . import validators as validators
|
| 22 |
+
from ._cmp import cmp_using as cmp_using
|
| 23 |
+
from ._typing_compat import AttrsInstance_
|
| 24 |
+
from ._version_info import VersionInfo
|
| 25 |
+
from attrs import (
|
| 26 |
+
define as define,
|
| 27 |
+
field as field,
|
| 28 |
+
mutable as mutable,
|
| 29 |
+
frozen as frozen,
|
| 30 |
+
_EqOrderType,
|
| 31 |
+
_ValidatorType,
|
| 32 |
+
_ConverterType,
|
| 33 |
+
_ReprArgType,
|
| 34 |
+
_OnSetAttrType,
|
| 35 |
+
_OnSetAttrArgType,
|
| 36 |
+
_FieldTransformer,
|
| 37 |
+
_ValidatorArgType,
|
| 38 |
+
)
|
| 39 |
+
|
| 40 |
+
if sys.version_info >= (3, 10):
|
| 41 |
+
from typing import TypeGuard, TypeAlias
|
| 42 |
+
else:
|
| 43 |
+
from typing_extensions import TypeGuard, TypeAlias
|
| 44 |
+
|
| 45 |
+
if sys.version_info >= (3, 11):
|
| 46 |
+
from typing import dataclass_transform
|
| 47 |
+
else:
|
| 48 |
+
from typing_extensions import dataclass_transform
|
| 49 |
+
|
| 50 |
+
__version__: str
|
| 51 |
+
__version_info__: VersionInfo
|
| 52 |
+
__title__: str
|
| 53 |
+
__description__: str
|
| 54 |
+
__url__: str
|
| 55 |
+
__uri__: str
|
| 56 |
+
__author__: str
|
| 57 |
+
__email__: str
|
| 58 |
+
__license__: str
|
| 59 |
+
__copyright__: str
|
| 60 |
+
|
| 61 |
+
_T = TypeVar("_T")
|
| 62 |
+
_C = TypeVar("_C", bound=type)
|
| 63 |
+
|
| 64 |
+
_FilterType = Callable[["Attribute[_T]", _T], bool]
|
| 65 |
+
|
| 66 |
+
# We subclass this here to keep the protocol's qualified name clean.
|
| 67 |
+
class AttrsInstance(AttrsInstance_, Protocol):
|
| 68 |
+
pass
|
| 69 |
+
|
| 70 |
+
_A = TypeVar("_A", bound=type[AttrsInstance])
|
| 71 |
+
|
| 72 |
+
class _Nothing(enum.Enum):
|
| 73 |
+
NOTHING = enum.auto()
|
| 74 |
+
|
| 75 |
+
NOTHING = _Nothing.NOTHING
|
| 76 |
+
NothingType: TypeAlias = Literal[_Nothing.NOTHING]
|
| 77 |
+
|
| 78 |
+
# NOTE: Factory lies about its return type to make this possible:
|
| 79 |
+
# `x: List[int] # = Factory(list)`
|
| 80 |
+
# Work around mypy issue #4554 in the common case by using an overload.
|
| 81 |
+
|
| 82 |
+
@overload
|
| 83 |
+
def Factory(factory: Callable[[], _T]) -> _T: ...
|
| 84 |
+
@overload
|
| 85 |
+
def Factory(
|
| 86 |
+
factory: Callable[[Any], _T],
|
| 87 |
+
takes_self: Literal[True],
|
| 88 |
+
) -> _T: ...
|
| 89 |
+
@overload
|
| 90 |
+
def Factory(
|
| 91 |
+
factory: Callable[[], _T],
|
| 92 |
+
takes_self: Literal[False],
|
| 93 |
+
) -> _T: ...
|
| 94 |
+
|
| 95 |
+
In = TypeVar("In")
|
| 96 |
+
Out = TypeVar("Out")
|
| 97 |
+
|
| 98 |
+
class Converter(Generic[In, Out]):
|
| 99 |
+
@overload
|
| 100 |
+
def __init__(self, converter: Callable[[In], Out]) -> None: ...
|
| 101 |
+
@overload
|
| 102 |
+
def __init__(
|
| 103 |
+
self,
|
| 104 |
+
converter: Callable[[In, AttrsInstance, Attribute], Out],
|
| 105 |
+
*,
|
| 106 |
+
takes_self: Literal[True],
|
| 107 |
+
takes_field: Literal[True],
|
| 108 |
+
) -> None: ...
|
| 109 |
+
@overload
|
| 110 |
+
def __init__(
|
| 111 |
+
self,
|
| 112 |
+
converter: Callable[[In, Attribute], Out],
|
| 113 |
+
*,
|
| 114 |
+
takes_field: Literal[True],
|
| 115 |
+
) -> None: ...
|
| 116 |
+
@overload
|
| 117 |
+
def __init__(
|
| 118 |
+
self,
|
| 119 |
+
converter: Callable[[In, AttrsInstance], Out],
|
| 120 |
+
*,
|
| 121 |
+
takes_self: Literal[True],
|
| 122 |
+
) -> None: ...
|
| 123 |
+
|
| 124 |
+
class Attribute(Generic[_T]):
|
| 125 |
+
name: str
|
| 126 |
+
default: _T | None
|
| 127 |
+
validator: _ValidatorType[_T] | None
|
| 128 |
+
repr: _ReprArgType
|
| 129 |
+
cmp: _EqOrderType
|
| 130 |
+
eq: _EqOrderType
|
| 131 |
+
order: _EqOrderType
|
| 132 |
+
hash: bool | None
|
| 133 |
+
init: bool
|
| 134 |
+
converter: Converter | None
|
| 135 |
+
metadata: dict[Any, Any]
|
| 136 |
+
type: type[_T] | None
|
| 137 |
+
kw_only: bool
|
| 138 |
+
on_setattr: _OnSetAttrType
|
| 139 |
+
alias: str | None
|
| 140 |
+
|
| 141 |
+
def evolve(self, **changes: Any) -> "Attribute[Any]": ...
|
| 142 |
+
|
| 143 |
+
# NOTE: We had several choices for the annotation to use for type arg:
|
| 144 |
+
# 1) Type[_T]
|
| 145 |
+
# - Pros: Handles simple cases correctly
|
| 146 |
+
# - Cons: Might produce less informative errors in the case of conflicting
|
| 147 |
+
# TypeVars e.g. `attr.ib(default='bad', type=int)`
|
| 148 |
+
# 2) Callable[..., _T]
|
| 149 |
+
# - Pros: Better error messages than #1 for conflicting TypeVars
|
| 150 |
+
# - Cons: Terrible error messages for validator checks.
|
| 151 |
+
# e.g. attr.ib(type=int, validator=validate_str)
|
| 152 |
+
# -> error: Cannot infer function type argument
|
| 153 |
+
# 3) type (and do all of the work in the mypy plugin)
|
| 154 |
+
# - Pros: Simple here, and we could customize the plugin with our own errors.
|
| 155 |
+
# - Cons: Would need to write mypy plugin code to handle all the cases.
|
| 156 |
+
# We chose option #1.
|
| 157 |
+
|
| 158 |
+
# `attr` lies about its return type to make the following possible:
|
| 159 |
+
# attr() -> Any
|
| 160 |
+
# attr(8) -> int
|
| 161 |
+
# attr(validator=<some callable>) -> Whatever the callable expects.
|
| 162 |
+
# This makes this type of assignments possible:
|
| 163 |
+
# x: int = attr(8)
|
| 164 |
+
#
|
| 165 |
+
# This form catches explicit None or no default but with no other arguments
|
| 166 |
+
# returns Any.
|
| 167 |
+
@overload
|
| 168 |
+
def attrib(
|
| 169 |
+
default: None = ...,
|
| 170 |
+
validator: None = ...,
|
| 171 |
+
repr: _ReprArgType = ...,
|
| 172 |
+
cmp: _EqOrderType | None = ...,
|
| 173 |
+
hash: bool | None = ...,
|
| 174 |
+
init: bool = ...,
|
| 175 |
+
metadata: Mapping[Any, Any] | None = ...,
|
| 176 |
+
type: None = ...,
|
| 177 |
+
converter: None = ...,
|
| 178 |
+
factory: None = ...,
|
| 179 |
+
kw_only: bool | None = ...,
|
| 180 |
+
eq: _EqOrderType | None = ...,
|
| 181 |
+
order: _EqOrderType | None = ...,
|
| 182 |
+
on_setattr: _OnSetAttrArgType | None = ...,
|
| 183 |
+
alias: str | None = ...,
|
| 184 |
+
) -> Any: ...
|
| 185 |
+
|
| 186 |
+
# This form catches an explicit None or no default and infers the type from the
|
| 187 |
+
# other arguments.
|
| 188 |
+
@overload
|
| 189 |
+
def attrib(
|
| 190 |
+
default: None = ...,
|
| 191 |
+
validator: _ValidatorArgType[_T] | None = ...,
|
| 192 |
+
repr: _ReprArgType = ...,
|
| 193 |
+
cmp: _EqOrderType | None = ...,
|
| 194 |
+
hash: bool | None = ...,
|
| 195 |
+
init: bool = ...,
|
| 196 |
+
metadata: Mapping[Any, Any] | None = ...,
|
| 197 |
+
type: type[_T] | None = ...,
|
| 198 |
+
converter: _ConverterType
|
| 199 |
+
| list[_ConverterType]
|
| 200 |
+
| tuple[_ConverterType]
|
| 201 |
+
| None = ...,
|
| 202 |
+
factory: Callable[[], _T] | None = ...,
|
| 203 |
+
kw_only: bool | None = ...,
|
| 204 |
+
eq: _EqOrderType | None = ...,
|
| 205 |
+
order: _EqOrderType | None = ...,
|
| 206 |
+
on_setattr: _OnSetAttrArgType | None = ...,
|
| 207 |
+
alias: str | None = ...,
|
| 208 |
+
) -> _T: ...
|
| 209 |
+
|
| 210 |
+
# This form catches an explicit default argument.
|
| 211 |
+
@overload
|
| 212 |
+
def attrib(
|
| 213 |
+
default: _T,
|
| 214 |
+
validator: _ValidatorArgType[_T] | None = ...,
|
| 215 |
+
repr: _ReprArgType = ...,
|
| 216 |
+
cmp: _EqOrderType | None = ...,
|
| 217 |
+
hash: bool | None = ...,
|
| 218 |
+
init: bool = ...,
|
| 219 |
+
metadata: Mapping[Any, Any] | None = ...,
|
| 220 |
+
type: type[_T] | None = ...,
|
| 221 |
+
converter: _ConverterType
|
| 222 |
+
| list[_ConverterType]
|
| 223 |
+
| tuple[_ConverterType]
|
| 224 |
+
| None = ...,
|
| 225 |
+
factory: Callable[[], _T] | None = ...,
|
| 226 |
+
kw_only: bool | None = ...,
|
| 227 |
+
eq: _EqOrderType | None = ...,
|
| 228 |
+
order: _EqOrderType | None = ...,
|
| 229 |
+
on_setattr: _OnSetAttrArgType | None = ...,
|
| 230 |
+
alias: str | None = ...,
|
| 231 |
+
) -> _T: ...
|
| 232 |
+
|
| 233 |
+
# This form covers type=non-Type: e.g. forward references (str), Any
|
| 234 |
+
@overload
|
| 235 |
+
def attrib(
|
| 236 |
+
default: _T | None = ...,
|
| 237 |
+
validator: _ValidatorArgType[_T] | None = ...,
|
| 238 |
+
repr: _ReprArgType = ...,
|
| 239 |
+
cmp: _EqOrderType | None = ...,
|
| 240 |
+
hash: bool | None = ...,
|
| 241 |
+
init: bool = ...,
|
| 242 |
+
metadata: Mapping[Any, Any] | None = ...,
|
| 243 |
+
type: object = ...,
|
| 244 |
+
converter: _ConverterType
|
| 245 |
+
| list[_ConverterType]
|
| 246 |
+
| tuple[_ConverterType]
|
| 247 |
+
| None = ...,
|
| 248 |
+
factory: Callable[[], _T] | None = ...,
|
| 249 |
+
kw_only: bool | None = ...,
|
| 250 |
+
eq: _EqOrderType | None = ...,
|
| 251 |
+
order: _EqOrderType | None = ...,
|
| 252 |
+
on_setattr: _OnSetAttrArgType | None = ...,
|
| 253 |
+
alias: str | None = ...,
|
| 254 |
+
) -> Any: ...
|
| 255 |
+
@overload
|
| 256 |
+
@dataclass_transform(order_default=True, field_specifiers=(attrib, field))
|
| 257 |
+
def attrs(
|
| 258 |
+
maybe_cls: _C,
|
| 259 |
+
these: dict[str, Any] | None = ...,
|
| 260 |
+
repr_ns: str | None = ...,
|
| 261 |
+
repr: bool = ...,
|
| 262 |
+
cmp: _EqOrderType | None = ...,
|
| 263 |
+
hash: bool | None = ...,
|
| 264 |
+
init: bool = ...,
|
| 265 |
+
slots: bool = ...,
|
| 266 |
+
frozen: bool = ...,
|
| 267 |
+
weakref_slot: bool = ...,
|
| 268 |
+
str: bool = ...,
|
| 269 |
+
auto_attribs: bool = ...,
|
| 270 |
+
kw_only: bool = ...,
|
| 271 |
+
cache_hash: bool = ...,
|
| 272 |
+
auto_exc: bool = ...,
|
| 273 |
+
eq: _EqOrderType | None = ...,
|
| 274 |
+
order: _EqOrderType | None = ...,
|
| 275 |
+
auto_detect: bool = ...,
|
| 276 |
+
collect_by_mro: bool = ...,
|
| 277 |
+
getstate_setstate: bool | None = ...,
|
| 278 |
+
on_setattr: _OnSetAttrArgType | None = ...,
|
| 279 |
+
field_transformer: _FieldTransformer | None = ...,
|
| 280 |
+
match_args: bool = ...,
|
| 281 |
+
unsafe_hash: bool | None = ...,
|
| 282 |
+
) -> _C: ...
|
| 283 |
+
@overload
|
| 284 |
+
@dataclass_transform(order_default=True, field_specifiers=(attrib, field))
|
| 285 |
+
def attrs(
|
| 286 |
+
maybe_cls: None = ...,
|
| 287 |
+
these: dict[str, Any] | None = ...,
|
| 288 |
+
repr_ns: str | None = ...,
|
| 289 |
+
repr: bool = ...,
|
| 290 |
+
cmp: _EqOrderType | None = ...,
|
| 291 |
+
hash: bool | None = ...,
|
| 292 |
+
init: bool = ...,
|
| 293 |
+
slots: bool = ...,
|
| 294 |
+
frozen: bool = ...,
|
| 295 |
+
weakref_slot: bool = ...,
|
| 296 |
+
str: bool = ...,
|
| 297 |
+
auto_attribs: bool = ...,
|
| 298 |
+
kw_only: bool = ...,
|
| 299 |
+
cache_hash: bool = ...,
|
| 300 |
+
auto_exc: bool = ...,
|
| 301 |
+
eq: _EqOrderType | None = ...,
|
| 302 |
+
order: _EqOrderType | None = ...,
|
| 303 |
+
auto_detect: bool = ...,
|
| 304 |
+
collect_by_mro: bool = ...,
|
| 305 |
+
getstate_setstate: bool | None = ...,
|
| 306 |
+
on_setattr: _OnSetAttrArgType | None = ...,
|
| 307 |
+
field_transformer: _FieldTransformer | None = ...,
|
| 308 |
+
match_args: bool = ...,
|
| 309 |
+
unsafe_hash: bool | None = ...,
|
| 310 |
+
) -> Callable[[_C], _C]: ...
|
| 311 |
+
def fields(cls: type[AttrsInstance] | AttrsInstance) -> Any: ...
|
| 312 |
+
def fields_dict(cls: type[AttrsInstance]) -> dict[str, Attribute[Any]]: ...
|
| 313 |
+
def validate(inst: AttrsInstance) -> None: ...
|
| 314 |
+
def resolve_types(
|
| 315 |
+
cls: _A,
|
| 316 |
+
globalns: dict[str, Any] | None = ...,
|
| 317 |
+
localns: dict[str, Any] | None = ...,
|
| 318 |
+
attribs: list[Attribute[Any]] | None = ...,
|
| 319 |
+
include_extras: bool = ...,
|
| 320 |
+
) -> _A: ...
|
| 321 |
+
|
| 322 |
+
# TODO: add support for returning a proper attrs class from the mypy plugin
|
| 323 |
+
# we use Any instead of _CountingAttr so that e.g. `make_class('Foo',
|
| 324 |
+
# [attr.ib()])` is valid
|
| 325 |
+
def make_class(
|
| 326 |
+
name: str,
|
| 327 |
+
attrs: list[str] | tuple[str, ...] | dict[str, Any],
|
| 328 |
+
bases: tuple[type, ...] = ...,
|
| 329 |
+
class_body: dict[str, Any] | None = ...,
|
| 330 |
+
repr_ns: str | None = ...,
|
| 331 |
+
repr: bool = ...,
|
| 332 |
+
cmp: _EqOrderType | None = ...,
|
| 333 |
+
hash: bool | None = ...,
|
| 334 |
+
init: bool = ...,
|
| 335 |
+
slots: bool = ...,
|
| 336 |
+
frozen: bool = ...,
|
| 337 |
+
weakref_slot: bool = ...,
|
| 338 |
+
str: bool = ...,
|
| 339 |
+
auto_attribs: bool = ...,
|
| 340 |
+
kw_only: bool = ...,
|
| 341 |
+
cache_hash: bool = ...,
|
| 342 |
+
auto_exc: bool = ...,
|
| 343 |
+
eq: _EqOrderType | None = ...,
|
| 344 |
+
order: _EqOrderType | None = ...,
|
| 345 |
+
collect_by_mro: bool = ...,
|
| 346 |
+
on_setattr: _OnSetAttrArgType | None = ...,
|
| 347 |
+
field_transformer: _FieldTransformer | None = ...,
|
| 348 |
+
) -> type: ...
|
| 349 |
+
|
| 350 |
+
# _funcs --
|
| 351 |
+
|
| 352 |
+
# TODO: add support for returning TypedDict from the mypy plugin
|
| 353 |
+
# FIXME: asdict/astuple do not honor their factory args. Waiting on one of
|
| 354 |
+
# these:
|
| 355 |
+
# https://github.com/python/mypy/issues/4236
|
| 356 |
+
# https://github.com/python/typing/issues/253
|
| 357 |
+
# XXX: remember to fix attrs.asdict/astuple too!
|
| 358 |
+
def asdict(
|
| 359 |
+
inst: AttrsInstance,
|
| 360 |
+
recurse: bool = ...,
|
| 361 |
+
filter: _FilterType[Any] | None = ...,
|
| 362 |
+
dict_factory: type[Mapping[Any, Any]] = ...,
|
| 363 |
+
retain_collection_types: bool = ...,
|
| 364 |
+
value_serializer: Callable[[type, Attribute[Any], Any], Any] | None = ...,
|
| 365 |
+
tuple_keys: bool | None = ...,
|
| 366 |
+
) -> dict[str, Any]: ...
|
| 367 |
+
|
| 368 |
+
# TODO: add support for returning NamedTuple from the mypy plugin
|
| 369 |
+
def astuple(
|
| 370 |
+
inst: AttrsInstance,
|
| 371 |
+
recurse: bool = ...,
|
| 372 |
+
filter: _FilterType[Any] | None = ...,
|
| 373 |
+
tuple_factory: type[Sequence[Any]] = ...,
|
| 374 |
+
retain_collection_types: bool = ...,
|
| 375 |
+
) -> tuple[Any, ...]: ...
|
| 376 |
+
def has(cls: type) -> TypeGuard[type[AttrsInstance]]: ...
|
| 377 |
+
def assoc(inst: _T, **changes: Any) -> _T: ...
|
| 378 |
+
def evolve(inst: _T, **changes: Any) -> _T: ...
|
| 379 |
+
|
| 380 |
+
# _config --
|
| 381 |
+
|
| 382 |
+
def set_run_validators(run: bool) -> None: ...
|
| 383 |
+
def get_run_validators() -> bool: ...
|
| 384 |
+
|
| 385 |
+
# aliases --
|
| 386 |
+
|
| 387 |
+
s = attributes = attrs
|
| 388 |
+
ib = attr = attrib
|
| 389 |
+
dataclass = attrs # Technically, partial(attrs, auto_attribs=True) ;)
|
bioagent-bench/.venv/lib/python3.14/site-packages/attr/_cmp.py
ADDED
|
@@ -0,0 +1,160 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# SPDX-License-Identifier: MIT
|
| 2 |
+
|
| 3 |
+
|
| 4 |
+
import functools
|
| 5 |
+
import types
|
| 6 |
+
|
| 7 |
+
from ._make import __ne__
|
| 8 |
+
|
| 9 |
+
|
| 10 |
+
_operation_names = {"eq": "==", "lt": "<", "le": "<=", "gt": ">", "ge": ">="}
|
| 11 |
+
|
| 12 |
+
|
| 13 |
+
def cmp_using(
|
| 14 |
+
eq=None,
|
| 15 |
+
lt=None,
|
| 16 |
+
le=None,
|
| 17 |
+
gt=None,
|
| 18 |
+
ge=None,
|
| 19 |
+
require_same_type=True,
|
| 20 |
+
class_name="Comparable",
|
| 21 |
+
):
|
| 22 |
+
"""
|
| 23 |
+
Create a class that can be passed into `attrs.field`'s ``eq``, ``order``,
|
| 24 |
+
and ``cmp`` arguments to customize field comparison.
|
| 25 |
+
|
| 26 |
+
The resulting class will have a full set of ordering methods if at least
|
| 27 |
+
one of ``{lt, le, gt, ge}`` and ``eq`` are provided.
|
| 28 |
+
|
| 29 |
+
Args:
|
| 30 |
+
eq (typing.Callable | None):
|
| 31 |
+
Callable used to evaluate equality of two objects.
|
| 32 |
+
|
| 33 |
+
lt (typing.Callable | None):
|
| 34 |
+
Callable used to evaluate whether one object is less than another
|
| 35 |
+
object.
|
| 36 |
+
|
| 37 |
+
le (typing.Callable | None):
|
| 38 |
+
Callable used to evaluate whether one object is less than or equal
|
| 39 |
+
to another object.
|
| 40 |
+
|
| 41 |
+
gt (typing.Callable | None):
|
| 42 |
+
Callable used to evaluate whether one object is greater than
|
| 43 |
+
another object.
|
| 44 |
+
|
| 45 |
+
ge (typing.Callable | None):
|
| 46 |
+
Callable used to evaluate whether one object is greater than or
|
| 47 |
+
equal to another object.
|
| 48 |
+
|
| 49 |
+
require_same_type (bool):
|
| 50 |
+
When `True`, equality and ordering methods will return
|
| 51 |
+
`NotImplemented` if objects are not of the same type.
|
| 52 |
+
|
| 53 |
+
class_name (str | None): Name of class. Defaults to "Comparable".
|
| 54 |
+
|
| 55 |
+
See `comparison` for more details.
|
| 56 |
+
|
| 57 |
+
.. versionadded:: 21.1.0
|
| 58 |
+
"""
|
| 59 |
+
|
| 60 |
+
body = {
|
| 61 |
+
"__slots__": ["value"],
|
| 62 |
+
"__init__": _make_init(),
|
| 63 |
+
"_requirements": [],
|
| 64 |
+
"_is_comparable_to": _is_comparable_to,
|
| 65 |
+
}
|
| 66 |
+
|
| 67 |
+
# Add operations.
|
| 68 |
+
num_order_functions = 0
|
| 69 |
+
has_eq_function = False
|
| 70 |
+
|
| 71 |
+
if eq is not None:
|
| 72 |
+
has_eq_function = True
|
| 73 |
+
body["__eq__"] = _make_operator("eq", eq)
|
| 74 |
+
body["__ne__"] = __ne__
|
| 75 |
+
|
| 76 |
+
if lt is not None:
|
| 77 |
+
num_order_functions += 1
|
| 78 |
+
body["__lt__"] = _make_operator("lt", lt)
|
| 79 |
+
|
| 80 |
+
if le is not None:
|
| 81 |
+
num_order_functions += 1
|
| 82 |
+
body["__le__"] = _make_operator("le", le)
|
| 83 |
+
|
| 84 |
+
if gt is not None:
|
| 85 |
+
num_order_functions += 1
|
| 86 |
+
body["__gt__"] = _make_operator("gt", gt)
|
| 87 |
+
|
| 88 |
+
if ge is not None:
|
| 89 |
+
num_order_functions += 1
|
| 90 |
+
body["__ge__"] = _make_operator("ge", ge)
|
| 91 |
+
|
| 92 |
+
type_ = types.new_class(
|
| 93 |
+
class_name, (object,), {}, lambda ns: ns.update(body)
|
| 94 |
+
)
|
| 95 |
+
|
| 96 |
+
# Add same type requirement.
|
| 97 |
+
if require_same_type:
|
| 98 |
+
type_._requirements.append(_check_same_type)
|
| 99 |
+
|
| 100 |
+
# Add total ordering if at least one operation was defined.
|
| 101 |
+
if 0 < num_order_functions < 4:
|
| 102 |
+
if not has_eq_function:
|
| 103 |
+
# functools.total_ordering requires __eq__ to be defined,
|
| 104 |
+
# so raise early error here to keep a nice stack.
|
| 105 |
+
msg = "eq must be define is order to complete ordering from lt, le, gt, ge."
|
| 106 |
+
raise ValueError(msg)
|
| 107 |
+
type_ = functools.total_ordering(type_)
|
| 108 |
+
|
| 109 |
+
return type_
|
| 110 |
+
|
| 111 |
+
|
| 112 |
+
def _make_init():
|
| 113 |
+
"""
|
| 114 |
+
Create __init__ method.
|
| 115 |
+
"""
|
| 116 |
+
|
| 117 |
+
def __init__(self, value):
|
| 118 |
+
"""
|
| 119 |
+
Initialize object with *value*.
|
| 120 |
+
"""
|
| 121 |
+
self.value = value
|
| 122 |
+
|
| 123 |
+
return __init__
|
| 124 |
+
|
| 125 |
+
|
| 126 |
+
def _make_operator(name, func):
|
| 127 |
+
"""
|
| 128 |
+
Create operator method.
|
| 129 |
+
"""
|
| 130 |
+
|
| 131 |
+
def method(self, other):
|
| 132 |
+
if not self._is_comparable_to(other):
|
| 133 |
+
return NotImplemented
|
| 134 |
+
|
| 135 |
+
result = func(self.value, other.value)
|
| 136 |
+
if result is NotImplemented:
|
| 137 |
+
return NotImplemented
|
| 138 |
+
|
| 139 |
+
return result
|
| 140 |
+
|
| 141 |
+
method.__name__ = f"__{name}__"
|
| 142 |
+
method.__doc__ = (
|
| 143 |
+
f"Return a {_operation_names[name]} b. Computed by attrs."
|
| 144 |
+
)
|
| 145 |
+
|
| 146 |
+
return method
|
| 147 |
+
|
| 148 |
+
|
| 149 |
+
def _is_comparable_to(self, other):
|
| 150 |
+
"""
|
| 151 |
+
Check whether `other` is comparable to `self`.
|
| 152 |
+
"""
|
| 153 |
+
return all(func(self, other) for func in self._requirements)
|
| 154 |
+
|
| 155 |
+
|
| 156 |
+
def _check_same_type(self, other):
|
| 157 |
+
"""
|
| 158 |
+
Return True if *self* and *other* are of the same type, False otherwise.
|
| 159 |
+
"""
|
| 160 |
+
return other.value.__class__ is self.value.__class__
|
bioagent-bench/.venv/lib/python3.14/site-packages/attr/_cmp.pyi
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from typing import Any, Callable
|
| 2 |
+
|
| 3 |
+
_CompareWithType = Callable[[Any, Any], bool]
|
| 4 |
+
|
| 5 |
+
def cmp_using(
|
| 6 |
+
eq: _CompareWithType | None = ...,
|
| 7 |
+
lt: _CompareWithType | None = ...,
|
| 8 |
+
le: _CompareWithType | None = ...,
|
| 9 |
+
gt: _CompareWithType | None = ...,
|
| 10 |
+
ge: _CompareWithType | None = ...,
|
| 11 |
+
require_same_type: bool = ...,
|
| 12 |
+
class_name: str = ...,
|
| 13 |
+
) -> type: ...
|
bioagent-bench/.venv/lib/python3.14/site-packages/attr/_compat.py
ADDED
|
@@ -0,0 +1,99 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# SPDX-License-Identifier: MIT
|
| 2 |
+
|
| 3 |
+
import inspect
|
| 4 |
+
import platform
|
| 5 |
+
import sys
|
| 6 |
+
import threading
|
| 7 |
+
|
| 8 |
+
from collections.abc import Mapping, Sequence # noqa: F401
|
| 9 |
+
from typing import _GenericAlias
|
| 10 |
+
|
| 11 |
+
|
| 12 |
+
PYPY = platform.python_implementation() == "PyPy"
|
| 13 |
+
PY_3_10_PLUS = sys.version_info[:2] >= (3, 10)
|
| 14 |
+
PY_3_11_PLUS = sys.version_info[:2] >= (3, 11)
|
| 15 |
+
PY_3_12_PLUS = sys.version_info[:2] >= (3, 12)
|
| 16 |
+
PY_3_13_PLUS = sys.version_info[:2] >= (3, 13)
|
| 17 |
+
PY_3_14_PLUS = sys.version_info[:2] >= (3, 14)
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
if PY_3_14_PLUS:
|
| 21 |
+
import annotationlib
|
| 22 |
+
|
| 23 |
+
# We request forward-ref annotations to not break in the presence of
|
| 24 |
+
# forward references.
|
| 25 |
+
|
| 26 |
+
def _get_annotations(cls):
|
| 27 |
+
return annotationlib.get_annotations(
|
| 28 |
+
cls, format=annotationlib.Format.FORWARDREF
|
| 29 |
+
)
|
| 30 |
+
|
| 31 |
+
else:
|
| 32 |
+
|
| 33 |
+
def _get_annotations(cls):
|
| 34 |
+
"""
|
| 35 |
+
Get annotations for *cls*.
|
| 36 |
+
"""
|
| 37 |
+
return cls.__dict__.get("__annotations__", {})
|
| 38 |
+
|
| 39 |
+
|
| 40 |
+
class _AnnotationExtractor:
|
| 41 |
+
"""
|
| 42 |
+
Extract type annotations from a callable, returning None whenever there
|
| 43 |
+
is none.
|
| 44 |
+
"""
|
| 45 |
+
|
| 46 |
+
__slots__ = ["sig"]
|
| 47 |
+
|
| 48 |
+
def __init__(self, callable):
|
| 49 |
+
try:
|
| 50 |
+
self.sig = inspect.signature(callable)
|
| 51 |
+
except (ValueError, TypeError): # inspect failed
|
| 52 |
+
self.sig = None
|
| 53 |
+
|
| 54 |
+
def get_first_param_type(self):
|
| 55 |
+
"""
|
| 56 |
+
Return the type annotation of the first argument if it's not empty.
|
| 57 |
+
"""
|
| 58 |
+
if not self.sig:
|
| 59 |
+
return None
|
| 60 |
+
|
| 61 |
+
params = list(self.sig.parameters.values())
|
| 62 |
+
if params and params[0].annotation is not inspect.Parameter.empty:
|
| 63 |
+
return params[0].annotation
|
| 64 |
+
|
| 65 |
+
return None
|
| 66 |
+
|
| 67 |
+
def get_return_type(self):
|
| 68 |
+
"""
|
| 69 |
+
Return the return type if it's not empty.
|
| 70 |
+
"""
|
| 71 |
+
if (
|
| 72 |
+
self.sig
|
| 73 |
+
and self.sig.return_annotation is not inspect.Signature.empty
|
| 74 |
+
):
|
| 75 |
+
return self.sig.return_annotation
|
| 76 |
+
|
| 77 |
+
return None
|
| 78 |
+
|
| 79 |
+
|
| 80 |
+
# Thread-local global to track attrs instances which are already being repr'd.
|
| 81 |
+
# This is needed because there is no other (thread-safe) way to pass info
|
| 82 |
+
# about the instances that are already being repr'd through the call stack
|
| 83 |
+
# in order to ensure we don't perform infinite recursion.
|
| 84 |
+
#
|
| 85 |
+
# For instance, if an instance contains a dict which contains that instance,
|
| 86 |
+
# we need to know that we're already repr'ing the outside instance from within
|
| 87 |
+
# the dict's repr() call.
|
| 88 |
+
#
|
| 89 |
+
# This lives here rather than in _make.py so that the functions in _make.py
|
| 90 |
+
# don't have a direct reference to the thread-local in their globals dict.
|
| 91 |
+
# If they have such a reference, it breaks cloudpickle.
|
| 92 |
+
repr_context = threading.local()
|
| 93 |
+
|
| 94 |
+
|
| 95 |
+
def get_generic_base(cl):
|
| 96 |
+
"""If this is a generic class (A[str]), return the generic base for it."""
|
| 97 |
+
if cl.__class__ is _GenericAlias:
|
| 98 |
+
return cl.__origin__
|
| 99 |
+
return None
|
bioagent-bench/.venv/lib/python3.14/site-packages/attr/_config.py
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# SPDX-License-Identifier: MIT
|
| 2 |
+
|
| 3 |
+
__all__ = ["get_run_validators", "set_run_validators"]
|
| 4 |
+
|
| 5 |
+
_run_validators = True
|
| 6 |
+
|
| 7 |
+
|
| 8 |
+
def set_run_validators(run):
|
| 9 |
+
"""
|
| 10 |
+
Set whether or not validators are run. By default, they are run.
|
| 11 |
+
|
| 12 |
+
.. deprecated:: 21.3.0 It will not be removed, but it also will not be
|
| 13 |
+
moved to new ``attrs`` namespace. Use `attrs.validators.set_disabled()`
|
| 14 |
+
instead.
|
| 15 |
+
"""
|
| 16 |
+
if not isinstance(run, bool):
|
| 17 |
+
msg = "'run' must be bool."
|
| 18 |
+
raise TypeError(msg)
|
| 19 |
+
global _run_validators
|
| 20 |
+
_run_validators = run
|
| 21 |
+
|
| 22 |
+
|
| 23 |
+
def get_run_validators():
|
| 24 |
+
"""
|
| 25 |
+
Return whether or not validators are run.
|
| 26 |
+
|
| 27 |
+
.. deprecated:: 21.3.0 It will not be removed, but it also will not be
|
| 28 |
+
moved to new ``attrs`` namespace. Use `attrs.validators.get_disabled()`
|
| 29 |
+
instead.
|
| 30 |
+
"""
|
| 31 |
+
return _run_validators
|
bioagent-bench/.venv/lib/python3.14/site-packages/attr/_funcs.py
ADDED
|
@@ -0,0 +1,497 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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TR, NOTHING, fields
|
| 8 |
+
from .exceptions import AttrsAttributeNotFoundError
|
| 9 |
+
|
| 10 |
+
|
| 11 |
+
_ATOMIC_TYPES = frozenset(
|
| 12 |
+
{
|
| 13 |
+
type(None),
|
| 14 |
+
bool,
|
| 15 |
+
int,
|
| 16 |
+
float,
|
| 17 |
+
str,
|
| 18 |
+
complex,
|
| 19 |
+
bytes,
|
| 20 |
+
type(...),
|
| 21 |
+
type,
|
| 22 |
+
range,
|
| 23 |
+
property,
|
| 24 |
+
}
|
| 25 |
+
)
|
| 26 |
+
|
| 27 |
+
|
| 28 |
+
def asdict(
|
| 29 |
+
inst,
|
| 30 |
+
recurse=True,
|
| 31 |
+
filter=None,
|
| 32 |
+
dict_factory=dict,
|
| 33 |
+
retain_collection_types=False,
|
| 34 |
+
value_serializer=None,
|
| 35 |
+
):
|
| 36 |
+
"""
|
| 37 |
+
Return the *attrs* attribute values of *inst* as a dict.
|
| 38 |
+
|
| 39 |
+
Optionally recurse into other *attrs*-decorated classes.
|
| 40 |
+
|
| 41 |
+
Args:
|
| 42 |
+
inst: Instance of an *attrs*-decorated class.
|
| 43 |
+
|
| 44 |
+
recurse (bool): Recurse into classes that are also *attrs*-decorated.
|
| 45 |
+
|
| 46 |
+
filter (~typing.Callable):
|
| 47 |
+
A callable whose return code determines whether an attribute or
|
| 48 |
+
element is included (`True`) or dropped (`False`). Is called with
|
| 49 |
+
the `attrs.Attribute` as the first argument and the value as the
|
| 50 |
+
second argument.
|
| 51 |
+
|
| 52 |
+
dict_factory (~typing.Callable):
|
| 53 |
+
A callable to produce dictionaries from. For example, to produce
|
| 54 |
+
ordered dictionaries instead of normal Python dictionaries, pass in
|
| 55 |
+
``collections.OrderedDict``.
|
| 56 |
+
|
| 57 |
+
retain_collection_types (bool):
|
| 58 |
+
Do not convert to `list` when encountering an attribute whose type
|
| 59 |
+
is `tuple` or `set`. Only meaningful if *recurse* is `True`.
|
| 60 |
+
|
| 61 |
+
value_serializer (typing.Callable | None):
|
| 62 |
+
A hook that is called for every attribute or dict key/value. It
|
| 63 |
+
receives the current instance, field and value and must return the
|
| 64 |
+
(updated) value. The hook is run *after* the optional *filter* has
|
| 65 |
+
been applied.
|
| 66 |
+
|
| 67 |
+
Returns:
|
| 68 |
+
Return type of *dict_factory*.
|
| 69 |
+
|
| 70 |
+
Raises:
|
| 71 |
+
attrs.exceptions.NotAnAttrsClassError:
|
| 72 |
+
If *cls* is not an *attrs* class.
|
| 73 |
+
|
| 74 |
+
.. versionadded:: 16.0.0 *dict_factory*
|
| 75 |
+
.. versionadded:: 16.1.0 *retain_collection_types*
|
| 76 |
+
.. versionadded:: 20.3.0 *value_serializer*
|
| 77 |
+
.. versionadded:: 21.3.0
|
| 78 |
+
If a dict has a collection for a key, it is serialized as a tuple.
|
| 79 |
+
"""
|
| 80 |
+
attrs = fields(inst.__class__)
|
| 81 |
+
rv = dict_factory()
|
| 82 |
+
for a in attrs:
|
| 83 |
+
v = getattr(inst, a.name)
|
| 84 |
+
if filter is not None and not filter(a, v):
|
| 85 |
+
continue
|
| 86 |
+
|
| 87 |
+
if value_serializer is not None:
|
| 88 |
+
v = value_serializer(inst, a, v)
|
| 89 |
+
|
| 90 |
+
if recurse is True:
|
| 91 |
+
value_type = type(v)
|
| 92 |
+
if value_type in _ATOMIC_TYPES:
|
| 93 |
+
rv[a.name] = v
|
| 94 |
+
elif has(value_type):
|
| 95 |
+
rv[a.name] = asdict(
|
| 96 |
+
v,
|
| 97 |
+
recurse=True,
|
| 98 |
+
filter=filter,
|
| 99 |
+
dict_factory=dict_factory,
|
| 100 |
+
retain_collection_types=retain_collection_types,
|
| 101 |
+
value_serializer=value_serializer,
|
| 102 |
+
)
|
| 103 |
+
elif issubclass(value_type, (tuple, list, set, frozenset)):
|
| 104 |
+
cf = value_type if retain_collection_types is True else list
|
| 105 |
+
items = [
|
| 106 |
+
_asdict_anything(
|
| 107 |
+
i,
|
| 108 |
+
is_key=False,
|
| 109 |
+
filter=filter,
|
| 110 |
+
dict_factory=dict_factory,
|
| 111 |
+
retain_collection_types=retain_collection_types,
|
| 112 |
+
value_serializer=value_serializer,
|
| 113 |
+
)
|
| 114 |
+
for i in v
|
| 115 |
+
]
|
| 116 |
+
try:
|
| 117 |
+
rv[a.name] = cf(items)
|
| 118 |
+
except TypeError:
|
| 119 |
+
if not issubclass(cf, tuple):
|
| 120 |
+
raise
|
| 121 |
+
# Workaround for TypeError: cf.__new__() missing 1 required
|
| 122 |
+
# positional argument (which appears, for a namedturle)
|
| 123 |
+
rv[a.name] = cf(*items)
|
| 124 |
+
elif issubclass(value_type, dict):
|
| 125 |
+
df = dict_factory
|
| 126 |
+
rv[a.name] = df(
|
| 127 |
+
(
|
| 128 |
+
_asdict_anything(
|
| 129 |
+
kk,
|
| 130 |
+
is_key=True,
|
| 131 |
+
filter=filter,
|
| 132 |
+
dict_factory=df,
|
| 133 |
+
retain_collection_types=retain_collection_types,
|
| 134 |
+
value_serializer=value_serializer,
|
| 135 |
+
),
|
| 136 |
+
_asdict_anything(
|
| 137 |
+
vv,
|
| 138 |
+
is_key=False,
|
| 139 |
+
filter=filter,
|
| 140 |
+
dict_factory=df,
|
| 141 |
+
retain_collection_types=retain_collection_types,
|
| 142 |
+
value_serializer=value_serializer,
|
| 143 |
+
),
|
| 144 |
+
)
|
| 145 |
+
for kk, vv in v.items()
|
| 146 |
+
)
|
| 147 |
+
else:
|
| 148 |
+
rv[a.name] = v
|
| 149 |
+
else:
|
| 150 |
+
rv[a.name] = v
|
| 151 |
+
return rv
|
| 152 |
+
|
| 153 |
+
|
| 154 |
+
def _asdict_anything(
|
| 155 |
+
val,
|
| 156 |
+
is_key,
|
| 157 |
+
filter,
|
| 158 |
+
dict_factory,
|
| 159 |
+
retain_collection_types,
|
| 160 |
+
value_serializer,
|
| 161 |
+
):
|
| 162 |
+
"""
|
| 163 |
+
``asdict`` only works on attrs instances, this works on anything.
|
| 164 |
+
"""
|
| 165 |
+
val_type = type(val)
|
| 166 |
+
if val_type in _ATOMIC_TYPES:
|
| 167 |
+
rv = val
|
| 168 |
+
if value_serializer is not None:
|
| 169 |
+
rv = value_serializer(None, None, rv)
|
| 170 |
+
elif getattr(val_type, "__attrs_attrs__", None) is not None:
|
| 171 |
+
# Attrs class.
|
| 172 |
+
rv = asdict(
|
| 173 |
+
val,
|
| 174 |
+
recurse=True,
|
| 175 |
+
filter=filter,
|
| 176 |
+
dict_factory=dict_factory,
|
| 177 |
+
retain_collection_types=retain_collection_types,
|
| 178 |
+
value_serializer=value_serializer,
|
| 179 |
+
)
|
| 180 |
+
elif issubclass(val_type, (tuple, list, set, frozenset)):
|
| 181 |
+
if retain_collection_types is True:
|
| 182 |
+
cf = val.__class__
|
| 183 |
+
elif is_key:
|
| 184 |
+
cf = tuple
|
| 185 |
+
else:
|
| 186 |
+
cf = list
|
| 187 |
+
|
| 188 |
+
rv = cf(
|
| 189 |
+
[
|
| 190 |
+
_asdict_anything(
|
| 191 |
+
i,
|
| 192 |
+
is_key=False,
|
| 193 |
+
filter=filter,
|
| 194 |
+
dict_factory=dict_factory,
|
| 195 |
+
retain_collection_types=retain_collection_types,
|
| 196 |
+
value_serializer=value_serializer,
|
| 197 |
+
)
|
| 198 |
+
for i in val
|
| 199 |
+
]
|
| 200 |
+
)
|
| 201 |
+
elif issubclass(val_type, dict):
|
| 202 |
+
df = dict_factory
|
| 203 |
+
rv = df(
|
| 204 |
+
(
|
| 205 |
+
_asdict_anything(
|
| 206 |
+
kk,
|
| 207 |
+
is_key=True,
|
| 208 |
+
filter=filter,
|
| 209 |
+
dict_factory=df,
|
| 210 |
+
retain_collection_types=retain_collection_types,
|
| 211 |
+
value_serializer=value_serializer,
|
| 212 |
+
),
|
| 213 |
+
_asdict_anything(
|
| 214 |
+
vv,
|
| 215 |
+
is_key=False,
|
| 216 |
+
filter=filter,
|
| 217 |
+
dict_factory=df,
|
| 218 |
+
retain_collection_types=retain_collection_types,
|
| 219 |
+
value_serializer=value_serializer,
|
| 220 |
+
),
|
| 221 |
+
)
|
| 222 |
+
for kk, vv in val.items()
|
| 223 |
+
)
|
| 224 |
+
else:
|
| 225 |
+
rv = val
|
| 226 |
+
if value_serializer is not None:
|
| 227 |
+
rv = value_serializer(None, None, rv)
|
| 228 |
+
|
| 229 |
+
return rv
|
| 230 |
+
|
| 231 |
+
|
| 232 |
+
def astuple(
|
| 233 |
+
inst,
|
| 234 |
+
recurse=True,
|
| 235 |
+
filter=None,
|
| 236 |
+
tuple_factory=tuple,
|
| 237 |
+
retain_collection_types=False,
|
| 238 |
+
):
|
| 239 |
+
"""
|
| 240 |
+
Return the *attrs* attribute values of *inst* as a tuple.
|
| 241 |
+
|
| 242 |
+
Optionally recurse into other *attrs*-decorated classes.
|
| 243 |
+
|
| 244 |
+
Args:
|
| 245 |
+
inst: Instance of an *attrs*-decorated class.
|
| 246 |
+
|
| 247 |
+
recurse (bool):
|
| 248 |
+
Recurse into classes that are also *attrs*-decorated.
|
| 249 |
+
|
| 250 |
+
filter (~typing.Callable):
|
| 251 |
+
A callable whose return code determines whether an attribute or
|
| 252 |
+
element is included (`True`) or dropped (`False`). Is called with
|
| 253 |
+
the `attrs.Attribute` as the first argument and the value as the
|
| 254 |
+
second argument.
|
| 255 |
+
|
| 256 |
+
tuple_factory (~typing.Callable):
|
| 257 |
+
A callable to produce tuples from. For example, to produce lists
|
| 258 |
+
instead of tuples.
|
| 259 |
+
|
| 260 |
+
retain_collection_types (bool):
|
| 261 |
+
Do not convert to `list` or `dict` when encountering an attribute
|
| 262 |
+
which type is `tuple`, `dict` or `set`. Only meaningful if
|
| 263 |
+
*recurse* is `True`.
|
| 264 |
+
|
| 265 |
+
Returns:
|
| 266 |
+
Return type of *tuple_factory*
|
| 267 |
+
|
| 268 |
+
Raises:
|
| 269 |
+
attrs.exceptions.NotAnAttrsClassError:
|
| 270 |
+
If *cls* is not an *attrs* class.
|
| 271 |
+
|
| 272 |
+
.. versionadded:: 16.2.0
|
| 273 |
+
"""
|
| 274 |
+
attrs = fields(inst.__class__)
|
| 275 |
+
rv = []
|
| 276 |
+
retain = retain_collection_types # Very long. :/
|
| 277 |
+
for a in attrs:
|
| 278 |
+
v = getattr(inst, a.name)
|
| 279 |
+
if filter is not None and not filter(a, v):
|
| 280 |
+
continue
|
| 281 |
+
value_type = type(v)
|
| 282 |
+
if recurse is True:
|
| 283 |
+
if value_type in _ATOMIC_TYPES:
|
| 284 |
+
rv.append(v)
|
| 285 |
+
elif has(value_type):
|
| 286 |
+
rv.append(
|
| 287 |
+
astuple(
|
| 288 |
+
v,
|
| 289 |
+
recurse=True,
|
| 290 |
+
filter=filter,
|
| 291 |
+
tuple_factory=tuple_factory,
|
| 292 |
+
retain_collection_types=retain,
|
| 293 |
+
)
|
| 294 |
+
)
|
| 295 |
+
elif issubclass(value_type, (tuple, list, set, frozenset)):
|
| 296 |
+
cf = v.__class__ if retain is True else list
|
| 297 |
+
items = [
|
| 298 |
+
(
|
| 299 |
+
astuple(
|
| 300 |
+
j,
|
| 301 |
+
recurse=True,
|
| 302 |
+
filter=filter,
|
| 303 |
+
tuple_factory=tuple_factory,
|
| 304 |
+
retain_collection_types=retain,
|
| 305 |
+
)
|
| 306 |
+
if has(j.__class__)
|
| 307 |
+
else j
|
| 308 |
+
)
|
| 309 |
+
for j in v
|
| 310 |
+
]
|
| 311 |
+
try:
|
| 312 |
+
rv.append(cf(items))
|
| 313 |
+
except TypeError:
|
| 314 |
+
if not issubclass(cf, tuple):
|
| 315 |
+
raise
|
| 316 |
+
# Workaround for TypeError: cf.__new__() missing 1 required
|
| 317 |
+
# positional argument (which appears, for a namedturle)
|
| 318 |
+
rv.append(cf(*items))
|
| 319 |
+
elif issubclass(value_type, dict):
|
| 320 |
+
df = value_type if retain is True else dict
|
| 321 |
+
rv.append(
|
| 322 |
+
df(
|
| 323 |
+
(
|
| 324 |
+
(
|
| 325 |
+
astuple(
|
| 326 |
+
kk,
|
| 327 |
+
tuple_factory=tuple_factory,
|
| 328 |
+
retain_collection_types=retain,
|
| 329 |
+
)
|
| 330 |
+
if has(kk.__class__)
|
| 331 |
+
else kk
|
| 332 |
+
),
|
| 333 |
+
(
|
| 334 |
+
astuple(
|
| 335 |
+
vv,
|
| 336 |
+
tuple_factory=tuple_factory,
|
| 337 |
+
retain_collection_types=retain,
|
| 338 |
+
)
|
| 339 |
+
if has(vv.__class__)
|
| 340 |
+
else vv
|
| 341 |
+
),
|
| 342 |
+
)
|
| 343 |
+
for kk, vv in v.items()
|
| 344 |
+
)
|
| 345 |
+
)
|
| 346 |
+
else:
|
| 347 |
+
rv.append(v)
|
| 348 |
+
else:
|
| 349 |
+
rv.append(v)
|
| 350 |
+
|
| 351 |
+
return rv if tuple_factory is list else tuple_factory(rv)
|
| 352 |
+
|
| 353 |
+
|
| 354 |
+
def has(cls):
|
| 355 |
+
"""
|
| 356 |
+
Check whether *cls* is a class with *attrs* attributes.
|
| 357 |
+
|
| 358 |
+
Args:
|
| 359 |
+
cls (type): Class to introspect.
|
| 360 |
+
|
| 361 |
+
Raises:
|
| 362 |
+
TypeError: If *cls* is not a class.
|
| 363 |
+
|
| 364 |
+
Returns:
|
| 365 |
+
bool:
|
| 366 |
+
"""
|
| 367 |
+
attrs = getattr(cls, "__attrs_attrs__", None)
|
| 368 |
+
if attrs is not None:
|
| 369 |
+
return True
|
| 370 |
+
|
| 371 |
+
# No attrs, maybe it's a specialized generic (A[str])?
|
| 372 |
+
generic_base = get_generic_base(cls)
|
| 373 |
+
if generic_base is not None:
|
| 374 |
+
generic_attrs = getattr(generic_base, "__attrs_attrs__", None)
|
| 375 |
+
if generic_attrs is not None:
|
| 376 |
+
# Stick it on here for speed next time.
|
| 377 |
+
cls.__attrs_attrs__ = generic_attrs
|
| 378 |
+
return generic_attrs is not None
|
| 379 |
+
return False
|
| 380 |
+
|
| 381 |
+
|
| 382 |
+
def assoc(inst, **changes):
|
| 383 |
+
"""
|
| 384 |
+
Copy *inst* and apply *changes*.
|
| 385 |
+
|
| 386 |
+
This is different from `evolve` that applies the changes to the arguments
|
| 387 |
+
that create the new instance.
|
| 388 |
+
|
| 389 |
+
`evolve`'s behavior is preferable, but there are `edge cases`_ where it
|
| 390 |
+
doesn't work. Therefore `assoc` is deprecated, but will not be removed.
|
| 391 |
+
|
| 392 |
+
.. _`edge cases`: https://github.com/python-attrs/attrs/issues/251
|
| 393 |
+
|
| 394 |
+
Args:
|
| 395 |
+
inst: Instance of a class with *attrs* attributes.
|
| 396 |
+
|
| 397 |
+
changes: Keyword changes in the new copy.
|
| 398 |
+
|
| 399 |
+
Returns:
|
| 400 |
+
A copy of inst with *changes* incorporated.
|
| 401 |
+
|
| 402 |
+
Raises:
|
| 403 |
+
attrs.exceptions.AttrsAttributeNotFoundError:
|
| 404 |
+
If *attr_name* couldn't be found on *cls*.
|
| 405 |
+
|
| 406 |
+
attrs.exceptions.NotAnAttrsClassError:
|
| 407 |
+
If *cls* is not an *attrs* class.
|
| 408 |
+
|
| 409 |
+
.. deprecated:: 17.1.0
|
| 410 |
+
Use `attrs.evolve` instead if you can. This function will not be
|
| 411 |
+
removed du to the slightly different approach compared to
|
| 412 |
+
`attrs.evolve`, though.
|
| 413 |
+
"""
|
| 414 |
+
new = copy.copy(inst)
|
| 415 |
+
attrs = fields(inst.__class__)
|
| 416 |
+
for k, v in changes.items():
|
| 417 |
+
a = getattr(attrs, k, NOTHING)
|
| 418 |
+
if a is NOTHING:
|
| 419 |
+
msg = f"{k} is not an attrs attribute on {new.__class__}."
|
| 420 |
+
raise AttrsAttributeNotFoundError(msg)
|
| 421 |
+
_OBJ_SETATTR(new, k, v)
|
| 422 |
+
return new
|
| 423 |
+
|
| 424 |
+
|
| 425 |
+
def resolve_types(
|
| 426 |
+
cls, globalns=None, localns=None, attribs=None, include_extras=True
|
| 427 |
+
):
|
| 428 |
+
"""
|
| 429 |
+
Resolve any strings and forward annotations in type annotations.
|
| 430 |
+
|
| 431 |
+
This is only required if you need concrete types in :class:`Attribute`'s
|
| 432 |
+
*type* field. In other words, you don't need to resolve your types if you
|
| 433 |
+
only use them for static type checking.
|
| 434 |
+
|
| 435 |
+
With no arguments, names will be looked up in the module in which the class
|
| 436 |
+
was created. If this is not what you want, for example, if the name only
|
| 437 |
+
exists inside a method, you may pass *globalns* or *localns* to specify
|
| 438 |
+
other dictionaries in which to look up these names. See the docs of
|
| 439 |
+
`typing.get_type_hints` for more details.
|
| 440 |
+
|
| 441 |
+
Args:
|
| 442 |
+
cls (type): Class to resolve.
|
| 443 |
+
|
| 444 |
+
globalns (dict | None): Dictionary containing global variables.
|
| 445 |
+
|
| 446 |
+
localns (dict | None): Dictionary containing local variables.
|
| 447 |
+
|
| 448 |
+
attribs (list | None):
|
| 449 |
+
List of attribs for the given class. This is necessary when calling
|
| 450 |
+
from inside a ``field_transformer`` since *cls* is not an *attrs*
|
| 451 |
+
class yet.
|
| 452 |
+
|
| 453 |
+
include_extras (bool):
|
| 454 |
+
Resolve more accurately, if possible. Pass ``include_extras`` to
|
| 455 |
+
``typing.get_hints``, if supported by the typing module. On
|
| 456 |
+
supported Python versions (3.9+), this resolves the types more
|
| 457 |
+
accurately.
|
| 458 |
+
|
| 459 |
+
Raises:
|
| 460 |
+
TypeError: If *cls* is not a class.
|
| 461 |
+
|
| 462 |
+
attrs.exceptions.NotAnAttrsClassError:
|
| 463 |
+
If *cls* is not an *attrs* class and you didn't pass any attribs.
|
| 464 |
+
|
| 465 |
+
NameError: If types cannot be resolved because of missing variables.
|
| 466 |
+
|
| 467 |
+
Returns:
|
| 468 |
+
*cls* so you can use this function also as a class decorator. Please
|
| 469 |
+
note that you have to apply it **after** `attrs.define`. That means the
|
| 470 |
+
decorator has to come in the line **before** `attrs.define`.
|
| 471 |
+
|
| 472 |
+
.. versionadded:: 20.1.0
|
| 473 |
+
.. versionadded:: 21.1.0 *attribs*
|
| 474 |
+
.. versionadded:: 23.1.0 *include_extras*
|
| 475 |
+
"""
|
| 476 |
+
# Since calling get_type_hints is expensive we cache whether we've
|
| 477 |
+
# done it already.
|
| 478 |
+
if getattr(cls, "__attrs_types_resolved__", None) != cls:
|
| 479 |
+
import typing
|
| 480 |
+
|
| 481 |
+
kwargs = {
|
| 482 |
+
"globalns": globalns,
|
| 483 |
+
"localns": localns,
|
| 484 |
+
"include_extras": include_extras,
|
| 485 |
+
}
|
| 486 |
+
|
| 487 |
+
hints = typing.get_type_hints(cls, **kwargs)
|
| 488 |
+
for field in fields(cls) if attribs is None else attribs:
|
| 489 |
+
if field.name in hints:
|
| 490 |
+
# Since fields have been frozen we must work around it.
|
| 491 |
+
_OBJ_SETATTR(field, "type", hints[field.name])
|
| 492 |
+
# We store the class we resolved so that subclasses know they haven't
|
| 493 |
+
# been resolved.
|
| 494 |
+
cls.__attrs_types_resolved__ = cls
|
| 495 |
+
|
| 496 |
+
# Return the class so you can use it as a decorator too.
|
| 497 |
+
return cls
|
bioagent-bench/.venv/lib/python3.14/site-packages/attr/_make.py
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
bioagent-bench/.venv/lib/python3.14/site-packages/attr/_next_gen.py
ADDED
|
@@ -0,0 +1,674 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# SPDX-License-Identifier: MIT
|
| 2 |
+
|
| 3 |
+
"""
|
| 4 |
+
These are keyword-only APIs that call `attr.s` and `attr.ib` with different
|
| 5 |
+
default values.
|
| 6 |
+
"""
|
| 7 |
+
|
| 8 |
+
from functools import partial
|
| 9 |
+
|
| 10 |
+
from . import setters
|
| 11 |
+
from ._funcs import asdict as _asdict
|
| 12 |
+
from ._funcs import astuple as _astuple
|
| 13 |
+
from ._make import (
|
| 14 |
+
_DEFAULT_ON_SETATTR,
|
| 15 |
+
NOTHING,
|
| 16 |
+
_frozen_setattrs,
|
| 17 |
+
attrib,
|
| 18 |
+
attrs,
|
| 19 |
+
)
|
| 20 |
+
from .exceptions import NotAnAttrsClassError, UnannotatedAttributeError
|
| 21 |
+
|
| 22 |
+
|
| 23 |
+
def define(
|
| 24 |
+
maybe_cls=None,
|
| 25 |
+
*,
|
| 26 |
+
these=None,
|
| 27 |
+
repr=None,
|
| 28 |
+
unsafe_hash=None,
|
| 29 |
+
hash=None,
|
| 30 |
+
init=None,
|
| 31 |
+
slots=True,
|
| 32 |
+
frozen=False,
|
| 33 |
+
weakref_slot=True,
|
| 34 |
+
str=False,
|
| 35 |
+
auto_attribs=None,
|
| 36 |
+
kw_only=False,
|
| 37 |
+
cache_hash=False,
|
| 38 |
+
auto_exc=True,
|
| 39 |
+
eq=None,
|
| 40 |
+
order=False,
|
| 41 |
+
auto_detect=True,
|
| 42 |
+
getstate_setstate=None,
|
| 43 |
+
on_setattr=None,
|
| 44 |
+
field_transformer=None,
|
| 45 |
+
match_args=True,
|
| 46 |
+
force_kw_only=False,
|
| 47 |
+
):
|
| 48 |
+
r"""
|
| 49 |
+
A class decorator that adds :term:`dunder methods` according to
|
| 50 |
+
:term:`fields <field>` specified using :doc:`type annotations <types>`,
|
| 51 |
+
`field()` calls, or the *these* argument.
|
| 52 |
+
|
| 53 |
+
Since *attrs* patches or replaces an existing class, you cannot use
|
| 54 |
+
`object.__init_subclass__` with *attrs* classes, because it runs too early.
|
| 55 |
+
As a replacement, you can define ``__attrs_init_subclass__`` on your class.
|
| 56 |
+
It will be called by *attrs* classes that subclass it after they're
|
| 57 |
+
created. See also :ref:`init-subclass`.
|
| 58 |
+
|
| 59 |
+
Args:
|
| 60 |
+
slots (bool):
|
| 61 |
+
Create a :term:`slotted class <slotted classes>` that's more
|
| 62 |
+
memory-efficient. Slotted classes are generally superior to the
|
| 63 |
+
default dict classes, but have some gotchas you should know about,
|
| 64 |
+
so we encourage you to read the :term:`glossary entry <slotted
|
| 65 |
+
classes>`.
|
| 66 |
+
|
| 67 |
+
auto_detect (bool):
|
| 68 |
+
Instead of setting the *init*, *repr*, *eq*, and *hash* arguments
|
| 69 |
+
explicitly, assume they are set to True **unless any** of the
|
| 70 |
+
involved methods for one of the arguments is implemented in the
|
| 71 |
+
*current* class (meaning, it is *not* inherited from some base
|
| 72 |
+
class).
|
| 73 |
+
|
| 74 |
+
So, for example by implementing ``__eq__`` on a class yourself,
|
| 75 |
+
*attrs* will deduce ``eq=False`` and will create *neither*
|
| 76 |
+
``__eq__`` *nor* ``__ne__`` (but Python classes come with a
|
| 77 |
+
sensible ``__ne__`` by default, so it *should* be enough to only
|
| 78 |
+
implement ``__eq__`` in most cases).
|
| 79 |
+
|
| 80 |
+
Passing :data:`True` or :data:`False` to *init*, *repr*, *eq*, or *hash*
|
| 81 |
+
overrides whatever *auto_detect* would determine.
|
| 82 |
+
|
| 83 |
+
auto_exc (bool):
|
| 84 |
+
If the class subclasses `BaseException` (which implicitly includes
|
| 85 |
+
any subclass of any exception), the following happens to behave
|
| 86 |
+
like a well-behaved Python exception class:
|
| 87 |
+
|
| 88 |
+
- the values for *eq*, *order*, and *hash* are ignored and the
|
| 89 |
+
instances compare and hash by the instance's ids [#]_ ,
|
| 90 |
+
- all attributes that are either passed into ``__init__`` or have a
|
| 91 |
+
default value are additionally available as a tuple in the
|
| 92 |
+
``args`` attribute,
|
| 93 |
+
- the value of *str* is ignored leaving ``__str__`` to base
|
| 94 |
+
classes.
|
| 95 |
+
|
| 96 |
+
.. [#]
|
| 97 |
+
Note that *attrs* will *not* remove existing implementations of
|
| 98 |
+
``__hash__`` or the equality methods. It just won't add own
|
| 99 |
+
ones.
|
| 100 |
+
|
| 101 |
+
on_setattr (~typing.Callable | list[~typing.Callable] | None | ~typing.Literal[attrs.setters.NO_OP]):
|
| 102 |
+
A callable that is run whenever the user attempts to set an
|
| 103 |
+
attribute (either by assignment like ``i.x = 42`` or by using
|
| 104 |
+
`setattr` like ``setattr(i, "x", 42)``). It receives the same
|
| 105 |
+
arguments as validators: the instance, the attribute that is being
|
| 106 |
+
modified, and the new value.
|
| 107 |
+
|
| 108 |
+
If no exception is raised, the attribute is set to the return value
|
| 109 |
+
of the callable.
|
| 110 |
+
|
| 111 |
+
If a list of callables is passed, they're automatically wrapped in
|
| 112 |
+
an `attrs.setters.pipe`.
|
| 113 |
+
|
| 114 |
+
If left None, the default behavior is to run converters and
|
| 115 |
+
validators whenever an attribute is set.
|
| 116 |
+
|
| 117 |
+
init (bool):
|
| 118 |
+
Create a ``__init__`` method that initializes the *attrs*
|
| 119 |
+
attributes. Leading underscores are stripped for the argument name,
|
| 120 |
+
unless an alias is set on the attribute.
|
| 121 |
+
|
| 122 |
+
.. seealso::
|
| 123 |
+
`init` shows advanced ways to customize the generated
|
| 124 |
+
``__init__`` method, including executing code before and after.
|
| 125 |
+
|
| 126 |
+
repr(bool):
|
| 127 |
+
Create a ``__repr__`` method with a human readable representation
|
| 128 |
+
of *attrs* attributes.
|
| 129 |
+
|
| 130 |
+
str (bool):
|
| 131 |
+
Create a ``__str__`` method that is identical to ``__repr__``. This
|
| 132 |
+
is usually not necessary except for `Exception`\ s.
|
| 133 |
+
|
| 134 |
+
eq (bool | None):
|
| 135 |
+
If True or None (default), add ``__eq__`` and ``__ne__`` methods
|
| 136 |
+
that check two instances for equality.
|
| 137 |
+
|
| 138 |
+
.. seealso::
|
| 139 |
+
`comparison` describes how to customize the comparison behavior
|
| 140 |
+
going as far comparing NumPy arrays.
|
| 141 |
+
|
| 142 |
+
order (bool | None):
|
| 143 |
+
If True, add ``__lt__``, ``__le__``, ``__gt__``, and ``__ge__``
|
| 144 |
+
methods that behave like *eq* above and allow instances to be
|
| 145 |
+
ordered.
|
| 146 |
+
|
| 147 |
+
They compare the instances as if they were tuples of their *attrs*
|
| 148 |
+
attributes if and only if the types of both classes are
|
| 149 |
+
*identical*.
|
| 150 |
+
|
| 151 |
+
If `None` mirror value of *eq*.
|
| 152 |
+
|
| 153 |
+
.. seealso:: `comparison`
|
| 154 |
+
|
| 155 |
+
unsafe_hash (bool | None):
|
| 156 |
+
If None (default), the ``__hash__`` method is generated according
|
| 157 |
+
how *eq* and *frozen* are set.
|
| 158 |
+
|
| 159 |
+
1. If *both* are True, *attrs* will generate a ``__hash__`` for
|
| 160 |
+
you.
|
| 161 |
+
2. If *eq* is True and *frozen* is False, ``__hash__`` will be set
|
| 162 |
+
to None, marking it unhashable (which it is).
|
| 163 |
+
3. If *eq* is False, ``__hash__`` will be left untouched meaning
|
| 164 |
+
the ``__hash__`` method of the base class will be used. If the
|
| 165 |
+
base class is `object`, this means it will fall back to id-based
|
| 166 |
+
hashing.
|
| 167 |
+
|
| 168 |
+
Although not recommended, you can decide for yourself and force
|
| 169 |
+
*attrs* to create one (for example, if the class is immutable even
|
| 170 |
+
though you didn't freeze it programmatically) by passing True or
|
| 171 |
+
not. Both of these cases are rather special and should be used
|
| 172 |
+
carefully.
|
| 173 |
+
|
| 174 |
+
.. seealso::
|
| 175 |
+
|
| 176 |
+
- Our documentation on `hashing`,
|
| 177 |
+
- Python's documentation on `object.__hash__`,
|
| 178 |
+
- and the `GitHub issue that led to the default \ behavior
|
| 179 |
+
<https://github.com/python-attrs/attrs/issues/136>`_ for more
|
| 180 |
+
details.
|
| 181 |
+
|
| 182 |
+
hash (bool | None):
|
| 183 |
+
Deprecated alias for *unsafe_hash*. *unsafe_hash* takes precedence.
|
| 184 |
+
|
| 185 |
+
cache_hash (bool):
|
| 186 |
+
Ensure that the object's hash code is computed only once and stored
|
| 187 |
+
on the object. If this is set to True, hashing must be either
|
| 188 |
+
explicitly or implicitly enabled for this class. If the hash code
|
| 189 |
+
is cached, avoid any reassignments of fields involved in hash code
|
| 190 |
+
computation or mutations of the objects those fields point to after
|
| 191 |
+
object creation. If such changes occur, the behavior of the
|
| 192 |
+
object's hash code is undefined.
|
| 193 |
+
|
| 194 |
+
frozen (bool):
|
| 195 |
+
Make instances immutable after initialization. If someone attempts
|
| 196 |
+
to modify a frozen instance, `attrs.exceptions.FrozenInstanceError`
|
| 197 |
+
is raised.
|
| 198 |
+
|
| 199 |
+
.. note::
|
| 200 |
+
|
| 201 |
+
1. This is achieved by installing a custom ``__setattr__``
|
| 202 |
+
method on your class, so you can't implement your own.
|
| 203 |
+
|
| 204 |
+
2. True immutability is impossible in Python.
|
| 205 |
+
|
| 206 |
+
3. This *does* have a minor a runtime performance `impact
|
| 207 |
+
<how-frozen>` when initializing new instances. In other
|
| 208 |
+
words: ``__init__`` is slightly slower with ``frozen=True``.
|
| 209 |
+
|
| 210 |
+
4. If a class is frozen, you cannot modify ``self`` in
|
| 211 |
+
``__attrs_post_init__`` or a self-written ``__init__``. You
|
| 212 |
+
can circumvent that limitation by using
|
| 213 |
+
``object.__setattr__(self, "attribute_name", value)``.
|
| 214 |
+
|
| 215 |
+
5. Subclasses of a frozen class are frozen too.
|
| 216 |
+
|
| 217 |
+
kw_only (bool):
|
| 218 |
+
Make attributes keyword-only in the generated ``__init__`` (if
|
| 219 |
+
*init* is False, this parameter is ignored). Attributes that
|
| 220 |
+
explicitly set ``kw_only=False`` are not affected; base class
|
| 221 |
+
attributes are also not affected.
|
| 222 |
+
|
| 223 |
+
Also see *force_kw_only*.
|
| 224 |
+
|
| 225 |
+
weakref_slot (bool):
|
| 226 |
+
Make instances weak-referenceable. This has no effect unless
|
| 227 |
+
*slots* is True.
|
| 228 |
+
|
| 229 |
+
field_transformer (~typing.Callable | None):
|
| 230 |
+
A function that is called with the original class object and all
|
| 231 |
+
fields right before *attrs* finalizes the class. You can use this,
|
| 232 |
+
for example, to automatically add converters or validators to
|
| 233 |
+
fields based on their types.
|
| 234 |
+
|
| 235 |
+
.. seealso:: `transform-fields`
|
| 236 |
+
|
| 237 |
+
match_args (bool):
|
| 238 |
+
If True (default), set ``__match_args__`` on the class to support
|
| 239 |
+
:pep:`634` (*Structural Pattern Matching*). It is a tuple of all
|
| 240 |
+
non-keyword-only ``__init__`` parameter names on Python 3.10 and
|
| 241 |
+
later. Ignored on older Python versions.
|
| 242 |
+
|
| 243 |
+
collect_by_mro (bool):
|
| 244 |
+
If True, *attrs* collects attributes from base classes correctly
|
| 245 |
+
according to the `method resolution order
|
| 246 |
+
<https://docs.python.org/3/howto/mro.html>`_. If False, *attrs*
|
| 247 |
+
will mimic the (wrong) behavior of `dataclasses` and :pep:`681`.
|
| 248 |
+
|
| 249 |
+
See also `issue #428
|
| 250 |
+
<https://github.com/python-attrs/attrs/issues/428>`_.
|
| 251 |
+
|
| 252 |
+
force_kw_only (bool):
|
| 253 |
+
A back-compat flag for restoring pre-25.4.0 behavior. If True and
|
| 254 |
+
``kw_only=True``, all attributes are made keyword-only, including
|
| 255 |
+
base class attributes, and those set to ``kw_only=False`` at the
|
| 256 |
+
attribute level. Defaults to False.
|
| 257 |
+
|
| 258 |
+
See also `issue #980
|
| 259 |
+
<https://github.com/python-attrs/attrs/issues/980>`_.
|
| 260 |
+
|
| 261 |
+
getstate_setstate (bool | None):
|
| 262 |
+
.. note::
|
| 263 |
+
|
| 264 |
+
This is usually only interesting for slotted classes and you
|
| 265 |
+
should probably just set *auto_detect* to True.
|
| 266 |
+
|
| 267 |
+
If True, ``__getstate__`` and ``__setstate__`` are generated and
|
| 268 |
+
attached to the class. This is necessary for slotted classes to be
|
| 269 |
+
pickleable. If left None, it's True by default for slotted classes
|
| 270 |
+
and False for dict classes.
|
| 271 |
+
|
| 272 |
+
If *auto_detect* is True, and *getstate_setstate* is left None, and
|
| 273 |
+
**either** ``__getstate__`` or ``__setstate__`` is detected
|
| 274 |
+
directly on the class (meaning: not inherited), it is set to False
|
| 275 |
+
(this is usually what you want).
|
| 276 |
+
|
| 277 |
+
auto_attribs (bool | None):
|
| 278 |
+
If True, look at type annotations to determine which attributes to
|
| 279 |
+
use, like `dataclasses`. If False, it will only look for explicit
|
| 280 |
+
:func:`field` class attributes, like classic *attrs*.
|
| 281 |
+
|
| 282 |
+
If left None, it will guess:
|
| 283 |
+
|
| 284 |
+
1. If any attributes are annotated and no unannotated
|
| 285 |
+
`attrs.field`\ s are found, it assumes *auto_attribs=True*.
|
| 286 |
+
2. Otherwise it assumes *auto_attribs=False* and tries to collect
|
| 287 |
+
`attrs.field`\ s.
|
| 288 |
+
|
| 289 |
+
If *attrs* decides to look at type annotations, **all** fields
|
| 290 |
+
**must** be annotated. If *attrs* encounters a field that is set to
|
| 291 |
+
a :func:`field` / `attr.ib` but lacks a type annotation, an
|
| 292 |
+
`attrs.exceptions.UnannotatedAttributeError` is raised. Use
|
| 293 |
+
``field_name: typing.Any = field(...)`` if you don't want to set a
|
| 294 |
+
type.
|
| 295 |
+
|
| 296 |
+
.. warning::
|
| 297 |
+
|
| 298 |
+
For features that use the attribute name to create decorators
|
| 299 |
+
(for example, :ref:`validators <validators>`), you still *must*
|
| 300 |
+
assign :func:`field` / `attr.ib` to them. Otherwise Python will
|
| 301 |
+
either not find the name or try to use the default value to
|
| 302 |
+
call, for example, ``validator`` on it.
|
| 303 |
+
|
| 304 |
+
Attributes annotated as `typing.ClassVar`, and attributes that are
|
| 305 |
+
neither annotated nor set to an `field()` are **ignored**.
|
| 306 |
+
|
| 307 |
+
these (dict[str, object]):
|
| 308 |
+
A dictionary of name to the (private) return value of `field()`
|
| 309 |
+
mappings. This is useful to avoid the definition of your attributes
|
| 310 |
+
within the class body because you can't (for example, if you want
|
| 311 |
+
to add ``__repr__`` methods to Django models) or don't want to.
|
| 312 |
+
|
| 313 |
+
If *these* is not `None`, *attrs* will *not* search the class body
|
| 314 |
+
for attributes and will *not* remove any attributes from it.
|
| 315 |
+
|
| 316 |
+
The order is deduced from the order of the attributes inside
|
| 317 |
+
*these*.
|
| 318 |
+
|
| 319 |
+
Arguably, this is a rather obscure feature.
|
| 320 |
+
|
| 321 |
+
.. versionadded:: 20.1.0
|
| 322 |
+
.. versionchanged:: 21.3.0 Converters are also run ``on_setattr``.
|
| 323 |
+
.. versionadded:: 22.2.0
|
| 324 |
+
*unsafe_hash* as an alias for *hash* (for :pep:`681` compliance).
|
| 325 |
+
.. versionchanged:: 24.1.0
|
| 326 |
+
Instances are not compared as tuples of attributes anymore, but using a
|
| 327 |
+
big ``and`` condition. This is faster and has more correct behavior for
|
| 328 |
+
uncomparable values like `math.nan`.
|
| 329 |
+
.. versionadded:: 24.1.0
|
| 330 |
+
If a class has an *inherited* classmethod called
|
| 331 |
+
``__attrs_init_subclass__``, it is executed after the class is created.
|
| 332 |
+
.. deprecated:: 24.1.0 *hash* is deprecated in favor of *unsafe_hash*.
|
| 333 |
+
.. versionadded:: 24.3.0
|
| 334 |
+
Unless already present, a ``__replace__`` method is automatically
|
| 335 |
+
created for `copy.replace` (Python 3.13+ only).
|
| 336 |
+
.. versionchanged:: 25.4.0
|
| 337 |
+
*kw_only* now only applies to attributes defined in the current class,
|
| 338 |
+
and respects attribute-level ``kw_only=False`` settings.
|
| 339 |
+
.. versionadded:: 25.4.0
|
| 340 |
+
Added *force_kw_only* to go back to the previous *kw_only* behavior.
|
| 341 |
+
|
| 342 |
+
.. note::
|
| 343 |
+
|
| 344 |
+
The main differences to the classic `attr.s` are:
|
| 345 |
+
|
| 346 |
+
- Automatically detect whether or not *auto_attribs* should be `True`
|
| 347 |
+
(c.f. *auto_attribs* parameter).
|
| 348 |
+
- Converters and validators run when attributes are set by default --
|
| 349 |
+
if *frozen* is `False`.
|
| 350 |
+
- *slots=True*
|
| 351 |
+
|
| 352 |
+
Usually, this has only upsides and few visible effects in everyday
|
| 353 |
+
programming. But it *can* lead to some surprising behaviors, so
|
| 354 |
+
please make sure to read :term:`slotted classes`.
|
| 355 |
+
|
| 356 |
+
- *auto_exc=True*
|
| 357 |
+
- *auto_detect=True*
|
| 358 |
+
- *order=False*
|
| 359 |
+
- *force_kw_only=False*
|
| 360 |
+
- Some options that were only relevant on Python 2 or were kept around
|
| 361 |
+
for backwards-compatibility have been removed.
|
| 362 |
+
|
| 363 |
+
"""
|
| 364 |
+
|
| 365 |
+
def do_it(cls, auto_attribs):
|
| 366 |
+
return attrs(
|
| 367 |
+
maybe_cls=cls,
|
| 368 |
+
these=these,
|
| 369 |
+
repr=repr,
|
| 370 |
+
hash=hash,
|
| 371 |
+
unsafe_hash=unsafe_hash,
|
| 372 |
+
init=init,
|
| 373 |
+
slots=slots,
|
| 374 |
+
frozen=frozen,
|
| 375 |
+
weakref_slot=weakref_slot,
|
| 376 |
+
str=str,
|
| 377 |
+
auto_attribs=auto_attribs,
|
| 378 |
+
kw_only=kw_only,
|
| 379 |
+
cache_hash=cache_hash,
|
| 380 |
+
auto_exc=auto_exc,
|
| 381 |
+
eq=eq,
|
| 382 |
+
order=order,
|
| 383 |
+
auto_detect=auto_detect,
|
| 384 |
+
collect_by_mro=True,
|
| 385 |
+
getstate_setstate=getstate_setstate,
|
| 386 |
+
on_setattr=on_setattr,
|
| 387 |
+
field_transformer=field_transformer,
|
| 388 |
+
match_args=match_args,
|
| 389 |
+
force_kw_only=force_kw_only,
|
| 390 |
+
)
|
| 391 |
+
|
| 392 |
+
def wrap(cls):
|
| 393 |
+
"""
|
| 394 |
+
Making this a wrapper ensures this code runs during class creation.
|
| 395 |
+
|
| 396 |
+
We also ensure that frozen-ness of classes is inherited.
|
| 397 |
+
"""
|
| 398 |
+
nonlocal frozen, on_setattr
|
| 399 |
+
|
| 400 |
+
had_on_setattr = on_setattr not in (None, setters.NO_OP)
|
| 401 |
+
|
| 402 |
+
# By default, mutable classes convert & validate on setattr.
|
| 403 |
+
if frozen is False and on_setattr is None:
|
| 404 |
+
on_setattr = _DEFAULT_ON_SETATTR
|
| 405 |
+
|
| 406 |
+
# However, if we subclass a frozen class, we inherit the immutability
|
| 407 |
+
# and disable on_setattr.
|
| 408 |
+
for base_cls in cls.__bases__:
|
| 409 |
+
if base_cls.__setattr__ is _frozen_setattrs:
|
| 410 |
+
if had_on_setattr:
|
| 411 |
+
msg = "Frozen classes can't use on_setattr (frozen-ness was inherited)."
|
| 412 |
+
raise ValueError(msg)
|
| 413 |
+
|
| 414 |
+
on_setattr = setters.NO_OP
|
| 415 |
+
break
|
| 416 |
+
|
| 417 |
+
if auto_attribs is not None:
|
| 418 |
+
return do_it(cls, auto_attribs)
|
| 419 |
+
|
| 420 |
+
try:
|
| 421 |
+
return do_it(cls, True)
|
| 422 |
+
except UnannotatedAttributeError:
|
| 423 |
+
return do_it(cls, False)
|
| 424 |
+
|
| 425 |
+
# maybe_cls's type depends on the usage of the decorator. It's a class
|
| 426 |
+
# if it's used as `@attrs` but `None` if used as `@attrs()`.
|
| 427 |
+
if maybe_cls is None:
|
| 428 |
+
return wrap
|
| 429 |
+
|
| 430 |
+
return wrap(maybe_cls)
|
| 431 |
+
|
| 432 |
+
|
| 433 |
+
mutable = define
|
| 434 |
+
frozen = partial(define, frozen=True, on_setattr=None)
|
| 435 |
+
|
| 436 |
+
|
| 437 |
+
def field(
|
| 438 |
+
*,
|
| 439 |
+
default=NOTHING,
|
| 440 |
+
validator=None,
|
| 441 |
+
repr=True,
|
| 442 |
+
hash=None,
|
| 443 |
+
init=True,
|
| 444 |
+
metadata=None,
|
| 445 |
+
type=None,
|
| 446 |
+
converter=None,
|
| 447 |
+
factory=None,
|
| 448 |
+
kw_only=None,
|
| 449 |
+
eq=None,
|
| 450 |
+
order=None,
|
| 451 |
+
on_setattr=None,
|
| 452 |
+
alias=None,
|
| 453 |
+
):
|
| 454 |
+
"""
|
| 455 |
+
Create a new :term:`field` / :term:`attribute` on a class.
|
| 456 |
+
|
| 457 |
+
.. warning::
|
| 458 |
+
|
| 459 |
+
Does **nothing** unless the class is also decorated with
|
| 460 |
+
`attrs.define` (or similar)!
|
| 461 |
+
|
| 462 |
+
Args:
|
| 463 |
+
default:
|
| 464 |
+
A value that is used if an *attrs*-generated ``__init__`` is used
|
| 465 |
+
and no value is passed while instantiating or the attribute is
|
| 466 |
+
excluded using ``init=False``.
|
| 467 |
+
|
| 468 |
+
If the value is an instance of `attrs.Factory`, its callable will
|
| 469 |
+
be used to construct a new value (useful for mutable data types
|
| 470 |
+
like lists or dicts).
|
| 471 |
+
|
| 472 |
+
If a default is not set (or set manually to `attrs.NOTHING`), a
|
| 473 |
+
value *must* be supplied when instantiating; otherwise a
|
| 474 |
+
`TypeError` will be raised.
|
| 475 |
+
|
| 476 |
+
.. seealso:: `defaults`
|
| 477 |
+
|
| 478 |
+
factory (~typing.Callable):
|
| 479 |
+
Syntactic sugar for ``default=attr.Factory(factory)``.
|
| 480 |
+
|
| 481 |
+
validator (~typing.Callable | list[~typing.Callable]):
|
| 482 |
+
Callable that is called by *attrs*-generated ``__init__`` methods
|
| 483 |
+
after the instance has been initialized. They receive the
|
| 484 |
+
initialized instance, the :func:`~attrs.Attribute`, and the passed
|
| 485 |
+
value.
|
| 486 |
+
|
| 487 |
+
The return value is *not* inspected so the validator has to throw
|
| 488 |
+
an exception itself.
|
| 489 |
+
|
| 490 |
+
If a `list` is passed, its items are treated as validators and must
|
| 491 |
+
all pass.
|
| 492 |
+
|
| 493 |
+
Validators can be globally disabled and re-enabled using
|
| 494 |
+
`attrs.validators.get_disabled` / `attrs.validators.set_disabled`.
|
| 495 |
+
|
| 496 |
+
The validator can also be set using decorator notation as shown
|
| 497 |
+
below.
|
| 498 |
+
|
| 499 |
+
.. seealso:: :ref:`validators`
|
| 500 |
+
|
| 501 |
+
repr (bool | ~typing.Callable):
|
| 502 |
+
Include this attribute in the generated ``__repr__`` method. If
|
| 503 |
+
True, include the attribute; if False, omit it. By default, the
|
| 504 |
+
built-in ``repr()`` function is used. To override how the attribute
|
| 505 |
+
value is formatted, pass a ``callable`` that takes a single value
|
| 506 |
+
and returns a string. Note that the resulting string is used as-is,
|
| 507 |
+
which means it will be used directly *instead* of calling
|
| 508 |
+
``repr()`` (the default).
|
| 509 |
+
|
| 510 |
+
eq (bool | ~typing.Callable):
|
| 511 |
+
If True (default), include this attribute in the generated
|
| 512 |
+
``__eq__`` and ``__ne__`` methods that check two instances for
|
| 513 |
+
equality. To override how the attribute value is compared, pass a
|
| 514 |
+
callable that takes a single value and returns the value to be
|
| 515 |
+
compared.
|
| 516 |
+
|
| 517 |
+
.. seealso:: `comparison`
|
| 518 |
+
|
| 519 |
+
order (bool | ~typing.Callable):
|
| 520 |
+
If True (default), include this attributes in the generated
|
| 521 |
+
``__lt__``, ``__le__``, ``__gt__`` and ``__ge__`` methods. To
|
| 522 |
+
override how the attribute value is ordered, pass a callable that
|
| 523 |
+
takes a single value and returns the value to be ordered.
|
| 524 |
+
|
| 525 |
+
.. seealso:: `comparison`
|
| 526 |
+
|
| 527 |
+
hash (bool | None):
|
| 528 |
+
Include this attribute in the generated ``__hash__`` method. If
|
| 529 |
+
None (default), mirror *eq*'s value. This is the correct behavior
|
| 530 |
+
according the Python spec. Setting this value to anything else
|
| 531 |
+
than None is *discouraged*.
|
| 532 |
+
|
| 533 |
+
.. seealso:: `hashing`
|
| 534 |
+
|
| 535 |
+
init (bool):
|
| 536 |
+
Include this attribute in the generated ``__init__`` method.
|
| 537 |
+
|
| 538 |
+
It is possible to set this to False and set a default value. In
|
| 539 |
+
that case this attributed is unconditionally initialized with the
|
| 540 |
+
specified default value or factory.
|
| 541 |
+
|
| 542 |
+
.. seealso:: `init`
|
| 543 |
+
|
| 544 |
+
converter (typing.Callable | Converter):
|
| 545 |
+
A callable that is called by *attrs*-generated ``__init__`` methods
|
| 546 |
+
to convert attribute's value to the desired format.
|
| 547 |
+
|
| 548 |
+
If a vanilla callable is passed, it is given the passed-in value as
|
| 549 |
+
the only positional argument. It is possible to receive additional
|
| 550 |
+
arguments by wrapping the callable in a `Converter`.
|
| 551 |
+
|
| 552 |
+
Either way, the returned value will be used as the new value of the
|
| 553 |
+
attribute. The value is converted before being passed to the
|
| 554 |
+
validator, if any.
|
| 555 |
+
|
| 556 |
+
.. seealso:: :ref:`converters`
|
| 557 |
+
|
| 558 |
+
metadata (dict | None):
|
| 559 |
+
An arbitrary mapping, to be used by third-party code.
|
| 560 |
+
|
| 561 |
+
.. seealso:: `extending-metadata`.
|
| 562 |
+
|
| 563 |
+
type (type):
|
| 564 |
+
The type of the attribute. Nowadays, the preferred method to
|
| 565 |
+
specify the type is using a variable annotation (see :pep:`526`).
|
| 566 |
+
This argument is provided for backwards-compatibility and for usage
|
| 567 |
+
with `make_class`. Regardless of the approach used, the type will
|
| 568 |
+
be stored on ``Attribute.type``.
|
| 569 |
+
|
| 570 |
+
Please note that *attrs* doesn't do anything with this metadata by
|
| 571 |
+
itself. You can use it as part of your own code or for `static type
|
| 572 |
+
checking <types>`.
|
| 573 |
+
|
| 574 |
+
kw_only (bool | None):
|
| 575 |
+
Make this attribute keyword-only in the generated ``__init__`` (if
|
| 576 |
+
*init* is False, this parameter is ignored). If None (default),
|
| 577 |
+
mirror the setting from `attrs.define`.
|
| 578 |
+
|
| 579 |
+
on_setattr (~typing.Callable | list[~typing.Callable] | None | ~typing.Literal[attrs.setters.NO_OP]):
|
| 580 |
+
Allows to overwrite the *on_setattr* setting from `attr.s`. If left
|
| 581 |
+
None, the *on_setattr* value from `attr.s` is used. Set to
|
| 582 |
+
`attrs.setters.NO_OP` to run **no** `setattr` hooks for this
|
| 583 |
+
attribute -- regardless of the setting in `define()`.
|
| 584 |
+
|
| 585 |
+
alias (str | None):
|
| 586 |
+
Override this attribute's parameter name in the generated
|
| 587 |
+
``__init__`` method. If left None, default to ``name`` stripped
|
| 588 |
+
of leading underscores. See `private-attributes`.
|
| 589 |
+
|
| 590 |
+
.. versionadded:: 20.1.0
|
| 591 |
+
.. versionchanged:: 21.1.0
|
| 592 |
+
*eq*, *order*, and *cmp* also accept a custom callable
|
| 593 |
+
.. versionadded:: 22.2.0 *alias*
|
| 594 |
+
.. versionadded:: 23.1.0
|
| 595 |
+
The *type* parameter has been re-added; mostly for `attrs.make_class`.
|
| 596 |
+
Please note that type checkers ignore this metadata.
|
| 597 |
+
.. versionchanged:: 25.4.0
|
| 598 |
+
*kw_only* can now be None, and its default is also changed from False to
|
| 599 |
+
None.
|
| 600 |
+
|
| 601 |
+
.. seealso::
|
| 602 |
+
|
| 603 |
+
`attr.ib`
|
| 604 |
+
"""
|
| 605 |
+
return attrib(
|
| 606 |
+
default=default,
|
| 607 |
+
validator=validator,
|
| 608 |
+
repr=repr,
|
| 609 |
+
hash=hash,
|
| 610 |
+
init=init,
|
| 611 |
+
metadata=metadata,
|
| 612 |
+
type=type,
|
| 613 |
+
converter=converter,
|
| 614 |
+
factory=factory,
|
| 615 |
+
kw_only=kw_only,
|
| 616 |
+
eq=eq,
|
| 617 |
+
order=order,
|
| 618 |
+
on_setattr=on_setattr,
|
| 619 |
+
alias=alias,
|
| 620 |
+
)
|
| 621 |
+
|
| 622 |
+
|
| 623 |
+
def asdict(inst, *, recurse=True, filter=None, value_serializer=None):
|
| 624 |
+
"""
|
| 625 |
+
Same as `attr.asdict`, except that collections types are always retained
|
| 626 |
+
and dict is always used as *dict_factory*.
|
| 627 |
+
|
| 628 |
+
.. versionadded:: 21.3.0
|
| 629 |
+
"""
|
| 630 |
+
return _asdict(
|
| 631 |
+
inst=inst,
|
| 632 |
+
recurse=recurse,
|
| 633 |
+
filter=filter,
|
| 634 |
+
value_serializer=value_serializer,
|
| 635 |
+
retain_collection_types=True,
|
| 636 |
+
)
|
| 637 |
+
|
| 638 |
+
|
| 639 |
+
def astuple(inst, *, recurse=True, filter=None):
|
| 640 |
+
"""
|
| 641 |
+
Same as `attr.astuple`, except that collections types are always retained
|
| 642 |
+
and `tuple` is always used as the *tuple_factory*.
|
| 643 |
+
|
| 644 |
+
.. versionadded:: 21.3.0
|
| 645 |
+
"""
|
| 646 |
+
return _astuple(
|
| 647 |
+
inst=inst, recurse=recurse, filter=filter, retain_collection_types=True
|
| 648 |
+
)
|
| 649 |
+
|
| 650 |
+
|
| 651 |
+
def inspect(cls):
|
| 652 |
+
"""
|
| 653 |
+
Inspect the class and return its effective build parameters.
|
| 654 |
+
|
| 655 |
+
Warning:
|
| 656 |
+
This feature is currently **experimental** and is not covered by our
|
| 657 |
+
strict backwards-compatibility guarantees.
|
| 658 |
+
|
| 659 |
+
Args:
|
| 660 |
+
cls: The *attrs*-decorated class to inspect.
|
| 661 |
+
|
| 662 |
+
Returns:
|
| 663 |
+
The effective build parameters of the class.
|
| 664 |
+
|
| 665 |
+
Raises:
|
| 666 |
+
NotAnAttrsClassError: If the class is not an *attrs*-decorated class.
|
| 667 |
+
|
| 668 |
+
.. versionadded:: 25.4.0
|
| 669 |
+
"""
|
| 670 |
+
try:
|
| 671 |
+
return cls.__dict__["__attrs_props__"]
|
| 672 |
+
except KeyError:
|
| 673 |
+
msg = f"{cls!r} is not an attrs-decorated class."
|
| 674 |
+
raise NotAnAttrsClassError(msg) from None
|
bioagent-bench/.venv/lib/python3.14/site-packages/attr/_typing_compat.pyi
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from typing import Any, ClassVar, Protocol
|
| 2 |
+
|
| 3 |
+
# MYPY is a special constant in mypy which works the same way as `TYPE_CHECKING`.
|
| 4 |
+
MYPY = False
|
| 5 |
+
|
| 6 |
+
if MYPY:
|
| 7 |
+
# A protocol to be able to statically accept an attrs class.
|
| 8 |
+
class AttrsInstance_(Protocol):
|
| 9 |
+
__attrs_attrs__: ClassVar[Any]
|
| 10 |
+
|
| 11 |
+
else:
|
| 12 |
+
# For type checkers without plug-in support use an empty protocol that
|
| 13 |
+
# will (hopefully) be combined into a union.
|
| 14 |
+
class AttrsInstance_(Protocol):
|
| 15 |
+
pass
|
bioagent-bench/.venv/lib/python3.14/site-packages/attr/_version_info.pyi
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
class VersionInfo:
|
| 2 |
+
@property
|
| 3 |
+
def year(self) -> int: ...
|
| 4 |
+
@property
|
| 5 |
+
def minor(self) -> int: ...
|
| 6 |
+
@property
|
| 7 |
+
def micro(self) -> int: ...
|
| 8 |
+
@property
|
| 9 |
+
def releaselevel(self) -> str: ...
|
bioagent-bench/.venv/lib/python3.14/site-packages/attr/converters.py
ADDED
|
@@ -0,0 +1,162 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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| 12 |
+
|
| 13 |
+
__all__ = [
|
| 14 |
+
"default_if_none",
|
| 15 |
+
"optional",
|
| 16 |
+
"pipe",
|
| 17 |
+
"to_bool",
|
| 18 |
+
]
|
| 19 |
+
|
| 20 |
+
|
| 21 |
+
def optional(converter):
|
| 22 |
+
"""
|
| 23 |
+
A converter that allows an attribute to be optional. An optional attribute
|
| 24 |
+
is one which can be set to `None`.
|
| 25 |
+
|
| 26 |
+
Type annotations will be inferred from the wrapped converter's, if it has
|
| 27 |
+
any.
|
| 28 |
+
|
| 29 |
+
Args:
|
| 30 |
+
converter (typing.Callable):
|
| 31 |
+
the converter that is used for non-`None` values.
|
| 32 |
+
|
| 33 |
+
.. versionadded:: 17.1.0
|
| 34 |
+
"""
|
| 35 |
+
|
| 36 |
+
if isinstance(converter, Converter):
|
| 37 |
+
|
| 38 |
+
def optional_converter(val, inst, field):
|
| 39 |
+
if val is None:
|
| 40 |
+
return None
|
| 41 |
+
return converter(val, inst, field)
|
| 42 |
+
|
| 43 |
+
else:
|
| 44 |
+
|
| 45 |
+
def optional_converter(val):
|
| 46 |
+
if val is None:
|
| 47 |
+
return None
|
| 48 |
+
return converter(val)
|
| 49 |
+
|
| 50 |
+
xtr = _AnnotationExtractor(converter)
|
| 51 |
+
|
| 52 |
+
t = xtr.get_first_param_type()
|
| 53 |
+
if t:
|
| 54 |
+
optional_converter.__annotations__["val"] = typing.Optional[t]
|
| 55 |
+
|
| 56 |
+
rt = xtr.get_return_type()
|
| 57 |
+
if rt:
|
| 58 |
+
optional_converter.__annotations__["return"] = typing.Optional[rt]
|
| 59 |
+
|
| 60 |
+
if isinstance(converter, Converter):
|
| 61 |
+
return Converter(optional_converter, takes_self=True, takes_field=True)
|
| 62 |
+
|
| 63 |
+
return optional_converter
|
| 64 |
+
|
| 65 |
+
|
| 66 |
+
def default_if_none(default=NOTHING, factory=None):
|
| 67 |
+
"""
|
| 68 |
+
A converter that allows to replace `None` values by *default* or the result
|
| 69 |
+
of *factory*.
|
| 70 |
+
|
| 71 |
+
Args:
|
| 72 |
+
default:
|
| 73 |
+
Value to be used if `None` is passed. Passing an instance of
|
| 74 |
+
`attrs.Factory` is supported, however the ``takes_self`` option is
|
| 75 |
+
*not*.
|
| 76 |
+
|
| 77 |
+
factory (typing.Callable):
|
| 78 |
+
A callable that takes no parameters whose result is used if `None`
|
| 79 |
+
is passed.
|
| 80 |
+
|
| 81 |
+
Raises:
|
| 82 |
+
TypeError: If **neither** *default* or *factory* is passed.
|
| 83 |
+
|
| 84 |
+
TypeError: If **both** *default* and *factory* are passed.
|
| 85 |
+
|
| 86 |
+
ValueError:
|
| 87 |
+
If an instance of `attrs.Factory` is passed with
|
| 88 |
+
``takes_self=True``.
|
| 89 |
+
|
| 90 |
+
.. versionadded:: 18.2.0
|
| 91 |
+
"""
|
| 92 |
+
if default is NOTHING and factory is None:
|
| 93 |
+
msg = "Must pass either `default` or `factory`."
|
| 94 |
+
raise TypeError(msg)
|
| 95 |
+
|
| 96 |
+
if default is not NOTHING and factory is not None:
|
| 97 |
+
msg = "Must pass either `default` or `factory` but not both."
|
| 98 |
+
raise TypeError(msg)
|
| 99 |
+
|
| 100 |
+
if factory is not None:
|
| 101 |
+
default = Factory(factory)
|
| 102 |
+
|
| 103 |
+
if isinstance(default, Factory):
|
| 104 |
+
if default.takes_self:
|
| 105 |
+
msg = "`takes_self` is not supported by default_if_none."
|
| 106 |
+
raise ValueError(msg)
|
| 107 |
+
|
| 108 |
+
def default_if_none_converter(val):
|
| 109 |
+
if val is not None:
|
| 110 |
+
return val
|
| 111 |
+
|
| 112 |
+
return default.factory()
|
| 113 |
+
|
| 114 |
+
else:
|
| 115 |
+
|
| 116 |
+
def default_if_none_converter(val):
|
| 117 |
+
if val is not None:
|
| 118 |
+
return val
|
| 119 |
+
|
| 120 |
+
return default
|
| 121 |
+
|
| 122 |
+
return default_if_none_converter
|
| 123 |
+
|
| 124 |
+
|
| 125 |
+
def to_bool(val):
|
| 126 |
+
"""
|
| 127 |
+
Convert "boolean" strings (for example, from environment variables) to real
|
| 128 |
+
booleans.
|
| 129 |
+
|
| 130 |
+
Values mapping to `True`:
|
| 131 |
+
|
| 132 |
+
- ``True``
|
| 133 |
+
- ``"true"`` / ``"t"``
|
| 134 |
+
- ``"yes"`` / ``"y"``
|
| 135 |
+
- ``"on"``
|
| 136 |
+
- ``"1"``
|
| 137 |
+
- ``1``
|
| 138 |
+
|
| 139 |
+
Values mapping to `False`:
|
| 140 |
+
|
| 141 |
+
- ``False``
|
| 142 |
+
- ``"false"`` / ``"f"``
|
| 143 |
+
- ``"no"`` / ``"n"``
|
| 144 |
+
- ``"off"``
|
| 145 |
+
- ``"0"``
|
| 146 |
+
- ``0``
|
| 147 |
+
|
| 148 |
+
Raises:
|
| 149 |
+
ValueError: For any other value.
|
| 150 |
+
|
| 151 |
+
.. versionadded:: 21.3.0
|
| 152 |
+
"""
|
| 153 |
+
if isinstance(val, str):
|
| 154 |
+
val = val.lower()
|
| 155 |
+
|
| 156 |
+
if val in (True, "true", "t", "yes", "y", "on", "1", 1):
|
| 157 |
+
return True
|
| 158 |
+
if val in (False, "false", "f", "no", "n", "off", "0", 0):
|
| 159 |
+
return False
|
| 160 |
+
|
| 161 |
+
msg = f"Cannot convert value to bool: {val!r}"
|
| 162 |
+
raise ValueError(msg)
|
bioagent-bench/.venv/lib/python3.14/site-packages/attr/converters.pyi
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from typing import Callable, Any, overload
|
| 2 |
+
|
| 3 |
+
from attrs import _ConverterType, _CallableConverterType
|
| 4 |
+
|
| 5 |
+
@overload
|
| 6 |
+
def pipe(*validators: _CallableConverterType) -> _CallableConverterType: ...
|
| 7 |
+
@overload
|
| 8 |
+
def pipe(*validators: _ConverterType) -> _ConverterType: ...
|
| 9 |
+
@overload
|
| 10 |
+
def optional(converter: _CallableConverterType) -> _CallableConverterType: ...
|
| 11 |
+
@overload
|
| 12 |
+
def optional(converter: _ConverterType) -> _ConverterType: ...
|
| 13 |
+
@overload
|
| 14 |
+
def default_if_none(default: Any) -> _CallableConverterType: ...
|
| 15 |
+
@overload
|
| 16 |
+
def default_if_none(
|
| 17 |
+
*, factory: Callable[[], Any]
|
| 18 |
+
) -> _CallableConverterType: ...
|
| 19 |
+
def to_bool(val: str | int | bool) -> bool: ...
|
bioagent-bench/.venv/lib/python3.14/site-packages/attr/exceptions.py
ADDED
|
@@ -0,0 +1,95 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# SPDX-License-Identifier: MIT
|
| 2 |
+
|
| 3 |
+
from __future__ import annotations
|
| 4 |
+
|
| 5 |
+
|
| 6 |
+
class FrozenError(AttributeError):
|
| 7 |
+
"""
|
| 8 |
+
A frozen/immutable instance or attribute have been attempted to be
|
| 9 |
+
modified.
|
| 10 |
+
|
| 11 |
+
It mirrors the behavior of ``namedtuples`` by using the same error message
|
| 12 |
+
and subclassing `AttributeError`.
|
| 13 |
+
|
| 14 |
+
.. versionadded:: 20.1.0
|
| 15 |
+
"""
|
| 16 |
+
|
| 17 |
+
def __init__(self):
|
| 18 |
+
msg = "can't set attribute"
|
| 19 |
+
super().__init__(msg)
|
| 20 |
+
self.msg = msg
|
| 21 |
+
|
| 22 |
+
|
| 23 |
+
class FrozenInstanceError(FrozenError):
|
| 24 |
+
"""
|
| 25 |
+
A frozen instance has been attempted to be modified.
|
| 26 |
+
|
| 27 |
+
.. versionadded:: 16.1.0
|
| 28 |
+
"""
|
| 29 |
+
|
| 30 |
+
|
| 31 |
+
class FrozenAttributeError(FrozenError):
|
| 32 |
+
"""
|
| 33 |
+
A frozen attribute has been attempted to be modified.
|
| 34 |
+
|
| 35 |
+
.. versionadded:: 20.1.0
|
| 36 |
+
"""
|
| 37 |
+
|
| 38 |
+
|
| 39 |
+
class AttrsAttributeNotFoundError(ValueError):
|
| 40 |
+
"""
|
| 41 |
+
An *attrs* function couldn't find an attribute that the user asked for.
|
| 42 |
+
|
| 43 |
+
.. versionadded:: 16.2.0
|
| 44 |
+
"""
|
| 45 |
+
|
| 46 |
+
|
| 47 |
+
class NotAnAttrsClassError(ValueError):
|
| 48 |
+
"""
|
| 49 |
+
A non-*attrs* class has been passed into an *attrs* function.
|
| 50 |
+
|
| 51 |
+
.. versionadded:: 16.2.0
|
| 52 |
+
"""
|
| 53 |
+
|
| 54 |
+
|
| 55 |
+
class DefaultAlreadySetError(RuntimeError):
|
| 56 |
+
"""
|
| 57 |
+
A default has been set when defining the field and is attempted to be reset
|
| 58 |
+
using the decorator.
|
| 59 |
+
|
| 60 |
+
.. versionadded:: 17.1.0
|
| 61 |
+
"""
|
| 62 |
+
|
| 63 |
+
|
| 64 |
+
class UnannotatedAttributeError(RuntimeError):
|
| 65 |
+
"""
|
| 66 |
+
A class with ``auto_attribs=True`` has a field without a type annotation.
|
| 67 |
+
|
| 68 |
+
.. versionadded:: 17.3.0
|
| 69 |
+
"""
|
| 70 |
+
|
| 71 |
+
|
| 72 |
+
class PythonTooOldError(RuntimeError):
|
| 73 |
+
"""
|
| 74 |
+
It was attempted to use an *attrs* feature that requires a newer Python
|
| 75 |
+
version.
|
| 76 |
+
|
| 77 |
+
.. versionadded:: 18.2.0
|
| 78 |
+
"""
|
| 79 |
+
|
| 80 |
+
|
| 81 |
+
class NotCallableError(TypeError):
|
| 82 |
+
"""
|
| 83 |
+
A field requiring a callable has been set with a value that is not
|
| 84 |
+
callable.
|
| 85 |
+
|
| 86 |
+
.. versionadded:: 19.2.0
|
| 87 |
+
"""
|
| 88 |
+
|
| 89 |
+
def __init__(self, msg, value):
|
| 90 |
+
super(TypeError, self).__init__(msg, value)
|
| 91 |
+
self.msg = msg
|
| 92 |
+
self.value = value
|
| 93 |
+
|
| 94 |
+
def __str__(self):
|
| 95 |
+
return str(self.msg)
|
bioagent-bench/.venv/lib/python3.14/site-packages/attr/exceptions.pyi
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from typing import Any
|
| 2 |
+
|
| 3 |
+
class FrozenError(AttributeError):
|
| 4 |
+
msg: str = ...
|
| 5 |
+
|
| 6 |
+
class FrozenInstanceError(FrozenError): ...
|
| 7 |
+
class FrozenAttributeError(FrozenError): ...
|
| 8 |
+
class AttrsAttributeNotFoundError(ValueError): ...
|
| 9 |
+
class NotAnAttrsClassError(ValueError): ...
|
| 10 |
+
class DefaultAlreadySetError(RuntimeError): ...
|
| 11 |
+
class UnannotatedAttributeError(RuntimeError): ...
|
| 12 |
+
class PythonTooOldError(RuntimeError): ...
|
| 13 |
+
|
| 14 |
+
class NotCallableError(TypeError):
|
| 15 |
+
msg: str = ...
|
| 16 |
+
value: Any = ...
|
| 17 |
+
def __init__(self, msg: str, value: Any) -> None: ...
|
bioagent-bench/.venv/lib/python3.14/site-packages/attr/filters.py
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# SPDX-License-Identifier: MIT
|
| 2 |
+
|
| 3 |
+
"""
|
| 4 |
+
Commonly useful filters for `attrs.asdict` and `attrs.astuple`.
|
| 5 |
+
"""
|
| 6 |
+
|
| 7 |
+
from ._make import Attribute
|
| 8 |
+
|
| 9 |
+
|
| 10 |
+
def _split_what(what):
|
| 11 |
+
"""
|
| 12 |
+
Returns a tuple of `frozenset`s of classes and attributes.
|
| 13 |
+
"""
|
| 14 |
+
return (
|
| 15 |
+
frozenset(cls for cls in what if isinstance(cls, type)),
|
| 16 |
+
frozenset(cls for cls in what if isinstance(cls, str)),
|
| 17 |
+
frozenset(cls for cls in what if isinstance(cls, Attribute)),
|
| 18 |
+
)
|
| 19 |
+
|
| 20 |
+
|
| 21 |
+
def include(*what):
|
| 22 |
+
"""
|
| 23 |
+
Create a filter that only allows *what*.
|
| 24 |
+
|
| 25 |
+
Args:
|
| 26 |
+
what (list[type, str, attrs.Attribute]):
|
| 27 |
+
What to include. Can be a type, a name, or an attribute.
|
| 28 |
+
|
| 29 |
+
Returns:
|
| 30 |
+
Callable:
|
| 31 |
+
A callable that can be passed to `attrs.asdict`'s and
|
| 32 |
+
`attrs.astuple`'s *filter* argument.
|
| 33 |
+
|
| 34 |
+
.. versionchanged:: 23.1.0 Accept strings with field names.
|
| 35 |
+
"""
|
| 36 |
+
cls, names, attrs = _split_what(what)
|
| 37 |
+
|
| 38 |
+
def include_(attribute, value):
|
| 39 |
+
return (
|
| 40 |
+
value.__class__ in cls
|
| 41 |
+
or attribute.name in names
|
| 42 |
+
or attribute in attrs
|
| 43 |
+
)
|
| 44 |
+
|
| 45 |
+
return include_
|
| 46 |
+
|
| 47 |
+
|
| 48 |
+
def exclude(*what):
|
| 49 |
+
"""
|
| 50 |
+
Create a filter that does **not** allow *what*.
|
| 51 |
+
|
| 52 |
+
Args:
|
| 53 |
+
what (list[type, str, attrs.Attribute]):
|
| 54 |
+
What to exclude. Can be a type, a name, or an attribute.
|
| 55 |
+
|
| 56 |
+
Returns:
|
| 57 |
+
Callable:
|
| 58 |
+
A callable that can be passed to `attrs.asdict`'s and
|
| 59 |
+
`attrs.astuple`'s *filter* argument.
|
| 60 |
+
|
| 61 |
+
.. versionchanged:: 23.3.0 Accept field name string as input argument
|
| 62 |
+
"""
|
| 63 |
+
cls, names, attrs = _split_what(what)
|
| 64 |
+
|
| 65 |
+
def exclude_(attribute, value):
|
| 66 |
+
return not (
|
| 67 |
+
value.__class__ in cls
|
| 68 |
+
or attribute.name in names
|
| 69 |
+
or attribute in attrs
|
| 70 |
+
)
|
| 71 |
+
|
| 72 |
+
return exclude_
|
bioagent-bench/.venv/lib/python3.14/site-packages/attr/filters.pyi
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from typing import Any
|
| 2 |
+
|
| 3 |
+
from . import Attribute, _FilterType
|
| 4 |
+
|
| 5 |
+
def include(*what: type | str | Attribute[Any]) -> _FilterType[Any]: ...
|
| 6 |
+
def exclude(*what: type | str | Attribute[Any]) -> _FilterType[Any]: ...
|
bioagent-bench/.venv/lib/python3.14/site-packages/attr/py.typed
ADDED
|
File without changes
|
bioagent-bench/.venv/lib/python3.14/site-packages/attr/setters.py
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# SPDX-License-Identifier: MIT
|
| 2 |
+
|
| 3 |
+
"""
|
| 4 |
+
Commonly used hooks for on_setattr.
|
| 5 |
+
"""
|
| 6 |
+
|
| 7 |
+
from . import _config
|
| 8 |
+
from .exceptions import FrozenAttributeError
|
| 9 |
+
|
| 10 |
+
|
| 11 |
+
def pipe(*setters):
|
| 12 |
+
"""
|
| 13 |
+
Run all *setters* and return the return value of the last one.
|
| 14 |
+
|
| 15 |
+
.. versionadded:: 20.1.0
|
| 16 |
+
"""
|
| 17 |
+
|
| 18 |
+
def wrapped_pipe(instance, attrib, new_value):
|
| 19 |
+
rv = new_value
|
| 20 |
+
|
| 21 |
+
for setter in setters:
|
| 22 |
+
rv = setter(instance, attrib, rv)
|
| 23 |
+
|
| 24 |
+
return rv
|
| 25 |
+
|
| 26 |
+
return wrapped_pipe
|
| 27 |
+
|
| 28 |
+
|
| 29 |
+
def frozen(_, __, ___):
|
| 30 |
+
"""
|
| 31 |
+
Prevent an attribute to be modified.
|
| 32 |
+
|
| 33 |
+
.. versionadded:: 20.1.0
|
| 34 |
+
"""
|
| 35 |
+
raise FrozenAttributeError
|
| 36 |
+
|
| 37 |
+
|
| 38 |
+
def validate(instance, attrib, new_value):
|
| 39 |
+
"""
|
| 40 |
+
Run *attrib*'s validator on *new_value* if it has one.
|
| 41 |
+
|
| 42 |
+
.. versionadded:: 20.1.0
|
| 43 |
+
"""
|
| 44 |
+
if _config._run_validators is False:
|
| 45 |
+
return new_value
|
| 46 |
+
|
| 47 |
+
v = attrib.validator
|
| 48 |
+
if not v:
|
| 49 |
+
return new_value
|
| 50 |
+
|
| 51 |
+
v(instance, attrib, new_value)
|
| 52 |
+
|
| 53 |
+
return new_value
|
| 54 |
+
|
| 55 |
+
|
| 56 |
+
def convert(instance, attrib, new_value):
|
| 57 |
+
"""
|
| 58 |
+
Run *attrib*'s converter -- if it has one -- on *new_value* and return the
|
| 59 |
+
result.
|
| 60 |
+
|
| 61 |
+
.. versionadded:: 20.1.0
|
| 62 |
+
"""
|
| 63 |
+
c = attrib.converter
|
| 64 |
+
if c:
|
| 65 |
+
# This can be removed once we drop 3.8 and use attrs.Converter instead.
|
| 66 |
+
from ._make import Converter
|
| 67 |
+
|
| 68 |
+
if not isinstance(c, Converter):
|
| 69 |
+
return c(new_value)
|
| 70 |
+
|
| 71 |
+
return c(new_value, instance, attrib)
|
| 72 |
+
|
| 73 |
+
return new_value
|
| 74 |
+
|
| 75 |
+
|
| 76 |
+
# Sentinel for disabling class-wide *on_setattr* hooks for certain attributes.
|
| 77 |
+
# Sphinx's autodata stopped working, so the docstring is inlined in the API
|
| 78 |
+
# docs.
|
| 79 |
+
NO_OP = object()
|
bioagent-bench/.venv/lib/python3.14/site-packages/attr/setters.pyi
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from typing import Any, NewType, NoReturn, TypeVar
|
| 2 |
+
|
| 3 |
+
from . import Attribute
|
| 4 |
+
from attrs import _OnSetAttrType
|
| 5 |
+
|
| 6 |
+
_T = TypeVar("_T")
|
| 7 |
+
|
| 8 |
+
def frozen(
|
| 9 |
+
instance: Any, attribute: Attribute[Any], new_value: Any
|
| 10 |
+
) -> NoReturn: ...
|
| 11 |
+
def pipe(*setters: _OnSetAttrType) -> _OnSetAttrType: ...
|
| 12 |
+
def validate(instance: Any, attribute: Attribute[_T], new_value: _T) -> _T: ...
|
| 13 |
+
|
| 14 |
+
# convert is allowed to return Any, because they can be chained using pipe.
|
| 15 |
+
def convert(
|
| 16 |
+
instance: Any, attribute: Attribute[Any], new_value: Any
|
| 17 |
+
) -> Any: ...
|
| 18 |
+
|
| 19 |
+
_NoOpType = NewType("_NoOpType", object)
|
| 20 |
+
NO_OP: _NoOpType
|
bioagent-bench/.venv/lib/python3.14/site-packages/attr/validators.py
ADDED
|
@@ -0,0 +1,750 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# SPDX-License-Identifier: MIT
|
| 2 |
+
|
| 3 |
+
"""
|
| 4 |
+
Commonly useful validators.
|
| 5 |
+
"""
|
| 6 |
+
|
| 7 |
+
import operator
|
| 8 |
+
import re
|
| 9 |
+
|
| 10 |
+
from contextlib import contextmanager
|
| 11 |
+
from re import Pattern
|
| 12 |
+
|
| 13 |
+
from ._config import get_run_validators, set_run_validators
|
| 14 |
+
from ._make import _AndValidator, and_, attrib, attrs
|
| 15 |
+
from .converters import default_if_none
|
| 16 |
+
from .exceptions import NotCallableError
|
| 17 |
+
|
| 18 |
+
|
| 19 |
+
__all__ = [
|
| 20 |
+
"and_",
|
| 21 |
+
"deep_iterable",
|
| 22 |
+
"deep_mapping",
|
| 23 |
+
"disabled",
|
| 24 |
+
"ge",
|
| 25 |
+
"get_disabled",
|
| 26 |
+
"gt",
|
| 27 |
+
"in_",
|
| 28 |
+
"instance_of",
|
| 29 |
+
"is_callable",
|
| 30 |
+
"le",
|
| 31 |
+
"lt",
|
| 32 |
+
"matches_re",
|
| 33 |
+
"max_len",
|
| 34 |
+
"min_len",
|
| 35 |
+
"not_",
|
| 36 |
+
"optional",
|
| 37 |
+
"or_",
|
| 38 |
+
"set_disabled",
|
| 39 |
+
]
|
| 40 |
+
|
| 41 |
+
|
| 42 |
+
def set_disabled(disabled):
|
| 43 |
+
"""
|
| 44 |
+
Globally disable or enable running validators.
|
| 45 |
+
|
| 46 |
+
By default, they are run.
|
| 47 |
+
|
| 48 |
+
Args:
|
| 49 |
+
disabled (bool): If `True`, disable running all validators.
|
| 50 |
+
|
| 51 |
+
.. warning::
|
| 52 |
+
|
| 53 |
+
This function is not thread-safe!
|
| 54 |
+
|
| 55 |
+
.. versionadded:: 21.3.0
|
| 56 |
+
"""
|
| 57 |
+
set_run_validators(not disabled)
|
| 58 |
+
|
| 59 |
+
|
| 60 |
+
def get_disabled():
|
| 61 |
+
"""
|
| 62 |
+
Return a bool indicating whether validators are currently disabled or not.
|
| 63 |
+
|
| 64 |
+
Returns:
|
| 65 |
+
bool:`True` if validators are currently disabled.
|
| 66 |
+
|
| 67 |
+
.. versionadded:: 21.3.0
|
| 68 |
+
"""
|
| 69 |
+
return not get_run_validators()
|
| 70 |
+
|
| 71 |
+
|
| 72 |
+
@contextmanager
|
| 73 |
+
def disabled():
|
| 74 |
+
"""
|
| 75 |
+
Context manager that disables running validators within its context.
|
| 76 |
+
|
| 77 |
+
.. warning::
|
| 78 |
+
|
| 79 |
+
This context manager is not thread-safe!
|
| 80 |
+
|
| 81 |
+
.. versionadded:: 21.3.0
|
| 82 |
+
.. versionchanged:: 26.1.0 The contextmanager is nestable.
|
| 83 |
+
"""
|
| 84 |
+
prev = get_run_validators()
|
| 85 |
+
set_run_validators(False)
|
| 86 |
+
try:
|
| 87 |
+
yield
|
| 88 |
+
finally:
|
| 89 |
+
set_run_validators(prev)
|
| 90 |
+
|
| 91 |
+
|
| 92 |
+
@attrs(repr=False, slots=True, unsafe_hash=True)
|
| 93 |
+
class _InstanceOfValidator:
|
| 94 |
+
type = attrib()
|
| 95 |
+
|
| 96 |
+
def __call__(self, inst, attr, value):
|
| 97 |
+
"""
|
| 98 |
+
We use a callable class to be able to change the ``__repr__``.
|
| 99 |
+
"""
|
| 100 |
+
if not isinstance(value, self.type):
|
| 101 |
+
msg = f"'{attr.name}' must be {self.type!r} (got {value!r} that is a {value.__class__!r})."
|
| 102 |
+
raise TypeError(
|
| 103 |
+
msg,
|
| 104 |
+
attr,
|
| 105 |
+
self.type,
|
| 106 |
+
value,
|
| 107 |
+
)
|
| 108 |
+
|
| 109 |
+
def __repr__(self):
|
| 110 |
+
return f"<instance_of validator for type {self.type!r}>"
|
| 111 |
+
|
| 112 |
+
|
| 113 |
+
def instance_of(type):
|
| 114 |
+
"""
|
| 115 |
+
A validator that raises a `TypeError` if the initializer is called with a
|
| 116 |
+
wrong type for this particular attribute (checks are performed using
|
| 117 |
+
`isinstance` therefore it's also valid to pass a tuple of types).
|
| 118 |
+
|
| 119 |
+
Args:
|
| 120 |
+
type (type | tuple[type]): The type to check for.
|
| 121 |
+
|
| 122 |
+
Raises:
|
| 123 |
+
TypeError:
|
| 124 |
+
With a human readable error message, the attribute (of type
|
| 125 |
+
`attrs.Attribute`), the expected type, and the value it got.
|
| 126 |
+
"""
|
| 127 |
+
return _InstanceOfValidator(type)
|
| 128 |
+
|
| 129 |
+
|
| 130 |
+
@attrs(repr=False, frozen=True, slots=True)
|
| 131 |
+
class _MatchesReValidator:
|
| 132 |
+
pattern = attrib()
|
| 133 |
+
match_func = attrib()
|
| 134 |
+
|
| 135 |
+
def __call__(self, inst, attr, value):
|
| 136 |
+
"""
|
| 137 |
+
We use a callable class to be able to change the ``__repr__``.
|
| 138 |
+
"""
|
| 139 |
+
if not self.match_func(value):
|
| 140 |
+
msg = f"'{attr.name}' must match regex {self.pattern.pattern!r} ({value!r} doesn't)"
|
| 141 |
+
raise ValueError(
|
| 142 |
+
msg,
|
| 143 |
+
attr,
|
| 144 |
+
self.pattern,
|
| 145 |
+
value,
|
| 146 |
+
)
|
| 147 |
+
|
| 148 |
+
def __repr__(self):
|
| 149 |
+
return f"<matches_re validator for pattern {self.pattern!r}>"
|
| 150 |
+
|
| 151 |
+
|
| 152 |
+
def matches_re(regex, flags=0, func=None):
|
| 153 |
+
r"""
|
| 154 |
+
A validator that raises `ValueError` if the initializer is called with a
|
| 155 |
+
string that doesn't match *regex*.
|
| 156 |
+
|
| 157 |
+
Args:
|
| 158 |
+
regex (str, re.Pattern):
|
| 159 |
+
A regex string or precompiled pattern to match against
|
| 160 |
+
|
| 161 |
+
flags (int):
|
| 162 |
+
Flags that will be passed to the underlying re function (default 0)
|
| 163 |
+
|
| 164 |
+
func (typing.Callable):
|
| 165 |
+
Which underlying `re` function to call. Valid options are
|
| 166 |
+
`re.fullmatch`, `re.search`, and `re.match`; the default `None`
|
| 167 |
+
means `re.fullmatch`. For performance reasons, the pattern is
|
| 168 |
+
always precompiled using `re.compile`.
|
| 169 |
+
|
| 170 |
+
.. versionadded:: 19.2.0
|
| 171 |
+
.. versionchanged:: 21.3.0 *regex* can be a pre-compiled pattern.
|
| 172 |
+
"""
|
| 173 |
+
valid_funcs = (re.fullmatch, None, re.search, re.match)
|
| 174 |
+
if func not in valid_funcs:
|
| 175 |
+
msg = "'func' must be one of {}.".format(
|
| 176 |
+
", ".join(
|
| 177 |
+
sorted((e and e.__name__) or "None" for e in set(valid_funcs))
|
| 178 |
+
)
|
| 179 |
+
)
|
| 180 |
+
raise ValueError(msg)
|
| 181 |
+
|
| 182 |
+
if isinstance(regex, Pattern):
|
| 183 |
+
if flags:
|
| 184 |
+
msg = "'flags' can only be used with a string pattern; pass flags to re.compile() instead"
|
| 185 |
+
raise TypeError(msg)
|
| 186 |
+
pattern = regex
|
| 187 |
+
else:
|
| 188 |
+
pattern = re.compile(regex, flags)
|
| 189 |
+
|
| 190 |
+
if func is re.match:
|
| 191 |
+
match_func = pattern.match
|
| 192 |
+
elif func is re.search:
|
| 193 |
+
match_func = pattern.search
|
| 194 |
+
else:
|
| 195 |
+
match_func = pattern.fullmatch
|
| 196 |
+
|
| 197 |
+
return _MatchesReValidator(pattern, match_func)
|
| 198 |
+
|
| 199 |
+
|
| 200 |
+
@attrs(repr=False, slots=True, unsafe_hash=True)
|
| 201 |
+
class _OptionalValidator:
|
| 202 |
+
validator = attrib()
|
| 203 |
+
|
| 204 |
+
def __call__(self, inst, attr, value):
|
| 205 |
+
if value is None:
|
| 206 |
+
return
|
| 207 |
+
|
| 208 |
+
self.validator(inst, attr, value)
|
| 209 |
+
|
| 210 |
+
def __repr__(self):
|
| 211 |
+
return f"<optional validator for {self.validator!r} or None>"
|
| 212 |
+
|
| 213 |
+
|
| 214 |
+
def optional(validator):
|
| 215 |
+
"""
|
| 216 |
+
A validator that makes an attribute optional. An optional attribute is one
|
| 217 |
+
which can be set to `None` in addition to satisfying the requirements of
|
| 218 |
+
the sub-validator.
|
| 219 |
+
|
| 220 |
+
Args:
|
| 221 |
+
validator
|
| 222 |
+
(typing.Callable | tuple[typing.Callable] | list[typing.Callable]):
|
| 223 |
+
A validator (or validators) that is used for non-`None` values.
|
| 224 |
+
|
| 225 |
+
.. versionadded:: 15.1.0
|
| 226 |
+
.. versionchanged:: 17.1.0 *validator* can be a list of validators.
|
| 227 |
+
.. versionchanged:: 23.1.0 *validator* can also be a tuple of validators.
|
| 228 |
+
"""
|
| 229 |
+
if isinstance(validator, (list, tuple)):
|
| 230 |
+
return _OptionalValidator(_AndValidator(validator))
|
| 231 |
+
|
| 232 |
+
return _OptionalValidator(validator)
|
| 233 |
+
|
| 234 |
+
|
| 235 |
+
@attrs(repr=False, slots=True, unsafe_hash=True)
|
| 236 |
+
class _InValidator:
|
| 237 |
+
options = attrib()
|
| 238 |
+
_original_options = attrib(hash=False)
|
| 239 |
+
|
| 240 |
+
def __call__(self, inst, attr, value):
|
| 241 |
+
try:
|
| 242 |
+
in_options = value in self.options
|
| 243 |
+
except TypeError: # e.g. `1 in "abc"`
|
| 244 |
+
in_options = False
|
| 245 |
+
|
| 246 |
+
if not in_options:
|
| 247 |
+
msg = f"'{attr.name}' must be in {self._original_options!r} (got {value!r})"
|
| 248 |
+
raise ValueError(
|
| 249 |
+
msg,
|
| 250 |
+
attr,
|
| 251 |
+
self._original_options,
|
| 252 |
+
value,
|
| 253 |
+
)
|
| 254 |
+
|
| 255 |
+
def __repr__(self):
|
| 256 |
+
return f"<in_ validator with options {self._original_options!r}>"
|
| 257 |
+
|
| 258 |
+
|
| 259 |
+
def in_(options):
|
| 260 |
+
"""
|
| 261 |
+
A validator that raises a `ValueError` if the initializer is called with a
|
| 262 |
+
value that does not belong in the *options* provided.
|
| 263 |
+
|
| 264 |
+
The check is performed using ``value in options``, so *options* has to
|
| 265 |
+
support that operation.
|
| 266 |
+
|
| 267 |
+
To keep the validator hashable, dicts, lists, and sets are transparently
|
| 268 |
+
transformed into a `tuple`.
|
| 269 |
+
|
| 270 |
+
Args:
|
| 271 |
+
options: Allowed options.
|
| 272 |
+
|
| 273 |
+
Raises:
|
| 274 |
+
ValueError:
|
| 275 |
+
With a human readable error message, the attribute (of type
|
| 276 |
+
`attrs.Attribute`), the expected options, and the value it got.
|
| 277 |
+
|
| 278 |
+
.. versionadded:: 17.1.0
|
| 279 |
+
.. versionchanged:: 22.1.0
|
| 280 |
+
The ValueError was incomplete until now and only contained the human
|
| 281 |
+
readable error message. Now it contains all the information that has
|
| 282 |
+
been promised since 17.1.0.
|
| 283 |
+
.. versionchanged:: 24.1.0
|
| 284 |
+
*options* that are a list, dict, or a set are now transformed into a
|
| 285 |
+
tuple to keep the validator hashable.
|
| 286 |
+
"""
|
| 287 |
+
repr_options = options
|
| 288 |
+
if isinstance(options, (list, dict, set)):
|
| 289 |
+
options = tuple(options)
|
| 290 |
+
|
| 291 |
+
return _InValidator(options, repr_options)
|
| 292 |
+
|
| 293 |
+
|
| 294 |
+
@attrs(repr=False, slots=False, unsafe_hash=True)
|
| 295 |
+
class _IsCallableValidator:
|
| 296 |
+
def __call__(self, inst, attr, value):
|
| 297 |
+
"""
|
| 298 |
+
We use a callable class to be able to change the ``__repr__``.
|
| 299 |
+
"""
|
| 300 |
+
if not callable(value):
|
| 301 |
+
message = (
|
| 302 |
+
"'{name}' must be callable "
|
| 303 |
+
"(got {value!r} that is a {actual!r})."
|
| 304 |
+
)
|
| 305 |
+
raise NotCallableError(
|
| 306 |
+
msg=message.format(
|
| 307 |
+
name=attr.name, value=value, actual=value.__class__
|
| 308 |
+
),
|
| 309 |
+
value=value,
|
| 310 |
+
)
|
| 311 |
+
|
| 312 |
+
def __repr__(self):
|
| 313 |
+
return "<is_callable validator>"
|
| 314 |
+
|
| 315 |
+
|
| 316 |
+
def is_callable():
|
| 317 |
+
"""
|
| 318 |
+
A validator that raises a `attrs.exceptions.NotCallableError` if the
|
| 319 |
+
initializer is called with a value for this particular attribute that is
|
| 320 |
+
not callable.
|
| 321 |
+
|
| 322 |
+
.. versionadded:: 19.1.0
|
| 323 |
+
|
| 324 |
+
Raises:
|
| 325 |
+
attrs.exceptions.NotCallableError:
|
| 326 |
+
With a human readable error message containing the attribute
|
| 327 |
+
(`attrs.Attribute`) name, and the value it got.
|
| 328 |
+
"""
|
| 329 |
+
return _IsCallableValidator()
|
| 330 |
+
|
| 331 |
+
|
| 332 |
+
@attrs(repr=False, slots=True, unsafe_hash=True)
|
| 333 |
+
class _DeepIterable:
|
| 334 |
+
member_validator = attrib(validator=is_callable())
|
| 335 |
+
iterable_validator = attrib(
|
| 336 |
+
default=None, validator=optional(is_callable())
|
| 337 |
+
)
|
| 338 |
+
|
| 339 |
+
def __call__(self, inst, attr, value):
|
| 340 |
+
"""
|
| 341 |
+
We use a callable class to be able to change the ``__repr__``.
|
| 342 |
+
"""
|
| 343 |
+
if self.iterable_validator is not None:
|
| 344 |
+
self.iterable_validator(inst, attr, value)
|
| 345 |
+
|
| 346 |
+
for member in value:
|
| 347 |
+
self.member_validator(inst, attr, member)
|
| 348 |
+
|
| 349 |
+
def __repr__(self):
|
| 350 |
+
iterable_identifier = (
|
| 351 |
+
""
|
| 352 |
+
if self.iterable_validator is None
|
| 353 |
+
else f" {self.iterable_validator!r}"
|
| 354 |
+
)
|
| 355 |
+
return (
|
| 356 |
+
f"<deep_iterable validator for{iterable_identifier}"
|
| 357 |
+
f" iterables of {self.member_validator!r}>"
|
| 358 |
+
)
|
| 359 |
+
|
| 360 |
+
|
| 361 |
+
def deep_iterable(member_validator, iterable_validator=None):
|
| 362 |
+
"""
|
| 363 |
+
A validator that performs deep validation of an iterable.
|
| 364 |
+
|
| 365 |
+
Args:
|
| 366 |
+
member_validator: Validator(s) to apply to iterable members.
|
| 367 |
+
|
| 368 |
+
iterable_validator:
|
| 369 |
+
Validator(s) to apply to iterable itself (optional).
|
| 370 |
+
|
| 371 |
+
Raises
|
| 372 |
+
TypeError: if any sub-validators fail
|
| 373 |
+
|
| 374 |
+
.. versionadded:: 19.1.0
|
| 375 |
+
|
| 376 |
+
.. versionchanged:: 25.4.0
|
| 377 |
+
*member_validator* and *iterable_validator* can now be a list or tuple
|
| 378 |
+
of validators.
|
| 379 |
+
"""
|
| 380 |
+
if isinstance(member_validator, (list, tuple)):
|
| 381 |
+
member_validator = and_(*member_validator)
|
| 382 |
+
if isinstance(iterable_validator, (list, tuple)):
|
| 383 |
+
iterable_validator = and_(*iterable_validator)
|
| 384 |
+
return _DeepIterable(member_validator, iterable_validator)
|
| 385 |
+
|
| 386 |
+
|
| 387 |
+
@attrs(repr=False, slots=True, unsafe_hash=True)
|
| 388 |
+
class _DeepMapping:
|
| 389 |
+
key_validator = attrib(validator=optional(is_callable()))
|
| 390 |
+
value_validator = attrib(validator=optional(is_callable()))
|
| 391 |
+
mapping_validator = attrib(validator=optional(is_callable()))
|
| 392 |
+
|
| 393 |
+
def __call__(self, inst, attr, value):
|
| 394 |
+
"""
|
| 395 |
+
We use a callable class to be able to change the ``__repr__``.
|
| 396 |
+
"""
|
| 397 |
+
if self.mapping_validator is not None:
|
| 398 |
+
self.mapping_validator(inst, attr, value)
|
| 399 |
+
|
| 400 |
+
for key in value:
|
| 401 |
+
if self.key_validator is not None:
|
| 402 |
+
self.key_validator(inst, attr, key)
|
| 403 |
+
if self.value_validator is not None:
|
| 404 |
+
self.value_validator(inst, attr, value[key])
|
| 405 |
+
|
| 406 |
+
def __repr__(self):
|
| 407 |
+
return f"<deep_mapping validator for objects mapping {self.key_validator!r} to {self.value_validator!r}>"
|
| 408 |
+
|
| 409 |
+
|
| 410 |
+
def deep_mapping(
|
| 411 |
+
key_validator=None, value_validator=None, mapping_validator=None
|
| 412 |
+
):
|
| 413 |
+
"""
|
| 414 |
+
A validator that performs deep validation of a dictionary.
|
| 415 |
+
|
| 416 |
+
All validators are optional, but at least one of *key_validator* or
|
| 417 |
+
*value_validator* must be provided.
|
| 418 |
+
|
| 419 |
+
Args:
|
| 420 |
+
key_validator: Validator(s) to apply to dictionary keys.
|
| 421 |
+
|
| 422 |
+
value_validator: Validator(s) to apply to dictionary values.
|
| 423 |
+
|
| 424 |
+
mapping_validator:
|
| 425 |
+
Validator(s) to apply to top-level mapping attribute.
|
| 426 |
+
|
| 427 |
+
.. versionadded:: 19.1.0
|
| 428 |
+
|
| 429 |
+
.. versionchanged:: 25.4.0
|
| 430 |
+
*key_validator* and *value_validator* are now optional, but at least one
|
| 431 |
+
of them must be provided.
|
| 432 |
+
|
| 433 |
+
.. versionchanged:: 25.4.0
|
| 434 |
+
*key_validator*, *value_validator*, and *mapping_validator* can now be a
|
| 435 |
+
list or tuple of validators.
|
| 436 |
+
|
| 437 |
+
Raises:
|
| 438 |
+
TypeError: If any sub-validator fails on validation.
|
| 439 |
+
|
| 440 |
+
ValueError:
|
| 441 |
+
If neither *key_validator* nor *value_validator* is provided on
|
| 442 |
+
instantiation.
|
| 443 |
+
"""
|
| 444 |
+
if key_validator is None and value_validator is None:
|
| 445 |
+
msg = (
|
| 446 |
+
"At least one of key_validator or value_validator must be provided"
|
| 447 |
+
)
|
| 448 |
+
raise ValueError(msg)
|
| 449 |
+
|
| 450 |
+
if isinstance(key_validator, (list, tuple)):
|
| 451 |
+
key_validator = and_(*key_validator)
|
| 452 |
+
if isinstance(value_validator, (list, tuple)):
|
| 453 |
+
value_validator = and_(*value_validator)
|
| 454 |
+
if isinstance(mapping_validator, (list, tuple)):
|
| 455 |
+
mapping_validator = and_(*mapping_validator)
|
| 456 |
+
|
| 457 |
+
return _DeepMapping(key_validator, value_validator, mapping_validator)
|
| 458 |
+
|
| 459 |
+
|
| 460 |
+
@attrs(repr=False, frozen=True, slots=True)
|
| 461 |
+
class _NumberValidator:
|
| 462 |
+
bound = attrib()
|
| 463 |
+
compare_op = attrib()
|
| 464 |
+
compare_func = attrib()
|
| 465 |
+
|
| 466 |
+
def __call__(self, inst, attr, value):
|
| 467 |
+
"""
|
| 468 |
+
We use a callable class to be able to change the ``__repr__``.
|
| 469 |
+
"""
|
| 470 |
+
if not self.compare_func(value, self.bound):
|
| 471 |
+
msg = f"'{attr.name}' must be {self.compare_op} {self.bound}: {value}"
|
| 472 |
+
raise ValueError(msg)
|
| 473 |
+
|
| 474 |
+
def __repr__(self):
|
| 475 |
+
return f"<Validator for x {self.compare_op} {self.bound}>"
|
| 476 |
+
|
| 477 |
+
|
| 478 |
+
def lt(val):
|
| 479 |
+
"""
|
| 480 |
+
A validator that raises `ValueError` if the initializer is called with a
|
| 481 |
+
number larger or equal to *val*.
|
| 482 |
+
|
| 483 |
+
The validator uses `operator.lt` to compare the values.
|
| 484 |
+
|
| 485 |
+
Args:
|
| 486 |
+
val: Exclusive upper bound for values.
|
| 487 |
+
|
| 488 |
+
.. versionadded:: 21.3.0
|
| 489 |
+
"""
|
| 490 |
+
return _NumberValidator(val, "<", operator.lt)
|
| 491 |
+
|
| 492 |
+
|
| 493 |
+
def le(val):
|
| 494 |
+
"""
|
| 495 |
+
A validator that raises `ValueError` if the initializer is called with a
|
| 496 |
+
number greater than *val*.
|
| 497 |
+
|
| 498 |
+
The validator uses `operator.le` to compare the values.
|
| 499 |
+
|
| 500 |
+
Args:
|
| 501 |
+
val: Inclusive upper bound for values.
|
| 502 |
+
|
| 503 |
+
.. versionadded:: 21.3.0
|
| 504 |
+
"""
|
| 505 |
+
return _NumberValidator(val, "<=", operator.le)
|
| 506 |
+
|
| 507 |
+
|
| 508 |
+
def ge(val):
|
| 509 |
+
"""
|
| 510 |
+
A validator that raises `ValueError` if the initializer is called with a
|
| 511 |
+
number smaller than *val*.
|
| 512 |
+
|
| 513 |
+
The validator uses `operator.ge` to compare the values.
|
| 514 |
+
|
| 515 |
+
Args:
|
| 516 |
+
val: Inclusive lower bound for values
|
| 517 |
+
|
| 518 |
+
.. versionadded:: 21.3.0
|
| 519 |
+
"""
|
| 520 |
+
return _NumberValidator(val, ">=", operator.ge)
|
| 521 |
+
|
| 522 |
+
|
| 523 |
+
def gt(val):
|
| 524 |
+
"""
|
| 525 |
+
A validator that raises `ValueError` if the initializer is called with a
|
| 526 |
+
number smaller or equal to *val*.
|
| 527 |
+
|
| 528 |
+
The validator uses `operator.gt` to compare the values.
|
| 529 |
+
|
| 530 |
+
Args:
|
| 531 |
+
val: Exclusive lower bound for values
|
| 532 |
+
|
| 533 |
+
.. versionadded:: 21.3.0
|
| 534 |
+
"""
|
| 535 |
+
return _NumberValidator(val, ">", operator.gt)
|
| 536 |
+
|
| 537 |
+
|
| 538 |
+
@attrs(repr=False, frozen=True, slots=True)
|
| 539 |
+
class _MaxLengthValidator:
|
| 540 |
+
max_length = attrib()
|
| 541 |
+
|
| 542 |
+
def __call__(self, inst, attr, value):
|
| 543 |
+
"""
|
| 544 |
+
We use a callable class to be able to change the ``__repr__``.
|
| 545 |
+
"""
|
| 546 |
+
if len(value) > self.max_length:
|
| 547 |
+
msg = f"Length of '{attr.name}' must be <= {self.max_length}: {len(value)}"
|
| 548 |
+
raise ValueError(msg)
|
| 549 |
+
|
| 550 |
+
def __repr__(self):
|
| 551 |
+
return f"<max_len validator for {self.max_length}>"
|
| 552 |
+
|
| 553 |
+
|
| 554 |
+
def max_len(length):
|
| 555 |
+
"""
|
| 556 |
+
A validator that raises `ValueError` if the initializer is called
|
| 557 |
+
with a string or iterable that is longer than *length*.
|
| 558 |
+
|
| 559 |
+
Args:
|
| 560 |
+
length (int): Maximum length of the string or iterable
|
| 561 |
+
|
| 562 |
+
.. versionadded:: 21.3.0
|
| 563 |
+
"""
|
| 564 |
+
return _MaxLengthValidator(length)
|
| 565 |
+
|
| 566 |
+
|
| 567 |
+
@attrs(repr=False, frozen=True, slots=True)
|
| 568 |
+
class _MinLengthValidator:
|
| 569 |
+
min_length = attrib()
|
| 570 |
+
|
| 571 |
+
def __call__(self, inst, attr, value):
|
| 572 |
+
"""
|
| 573 |
+
We use a callable class to be able to change the ``__repr__``.
|
| 574 |
+
"""
|
| 575 |
+
if len(value) < self.min_length:
|
| 576 |
+
msg = f"Length of '{attr.name}' must be >= {self.min_length}: {len(value)}"
|
| 577 |
+
raise ValueError(msg)
|
| 578 |
+
|
| 579 |
+
def __repr__(self):
|
| 580 |
+
return f"<min_len validator for {self.min_length}>"
|
| 581 |
+
|
| 582 |
+
|
| 583 |
+
def min_len(length):
|
| 584 |
+
"""
|
| 585 |
+
A validator that raises `ValueError` if the initializer is called
|
| 586 |
+
with a string or iterable that is shorter than *length*.
|
| 587 |
+
|
| 588 |
+
Args:
|
| 589 |
+
length (int): Minimum length of the string or iterable
|
| 590 |
+
|
| 591 |
+
.. versionadded:: 22.1.0
|
| 592 |
+
"""
|
| 593 |
+
return _MinLengthValidator(length)
|
| 594 |
+
|
| 595 |
+
|
| 596 |
+
@attrs(repr=False, slots=True, unsafe_hash=True)
|
| 597 |
+
class _SubclassOfValidator:
|
| 598 |
+
type = attrib()
|
| 599 |
+
|
| 600 |
+
def __call__(self, inst, attr, value):
|
| 601 |
+
"""
|
| 602 |
+
We use a callable class to be able to change the ``__repr__``.
|
| 603 |
+
"""
|
| 604 |
+
if not issubclass(value, self.type):
|
| 605 |
+
msg = f"'{attr.name}' must be a subclass of {self.type!r} (got {value!r})."
|
| 606 |
+
raise TypeError(
|
| 607 |
+
msg,
|
| 608 |
+
attr,
|
| 609 |
+
self.type,
|
| 610 |
+
value,
|
| 611 |
+
)
|
| 612 |
+
|
| 613 |
+
def __repr__(self):
|
| 614 |
+
return f"<subclass_of validator for type {self.type!r}>"
|
| 615 |
+
|
| 616 |
+
|
| 617 |
+
def _subclass_of(type):
|
| 618 |
+
"""
|
| 619 |
+
A validator that raises a `TypeError` if the initializer is called with a
|
| 620 |
+
wrong type for this particular attribute (checks are performed using
|
| 621 |
+
`issubclass` therefore it's also valid to pass a tuple of types).
|
| 622 |
+
|
| 623 |
+
Args:
|
| 624 |
+
type (type | tuple[type, ...]): The type(s) to check for.
|
| 625 |
+
|
| 626 |
+
Raises:
|
| 627 |
+
TypeError:
|
| 628 |
+
With a human readable error message, the attribute (of type
|
| 629 |
+
`attrs.Attribute`), the expected type, and the value it got.
|
| 630 |
+
"""
|
| 631 |
+
return _SubclassOfValidator(type)
|
| 632 |
+
|
| 633 |
+
|
| 634 |
+
@attrs(repr=False, slots=True, unsafe_hash=True)
|
| 635 |
+
class _NotValidator:
|
| 636 |
+
validator = attrib()
|
| 637 |
+
msg = attrib(
|
| 638 |
+
converter=default_if_none(
|
| 639 |
+
"not_ validator child '{validator!r}' "
|
| 640 |
+
"did not raise a captured error"
|
| 641 |
+
)
|
| 642 |
+
)
|
| 643 |
+
exc_types = attrib(
|
| 644 |
+
validator=deep_iterable(
|
| 645 |
+
member_validator=_subclass_of(Exception),
|
| 646 |
+
iterable_validator=instance_of(tuple),
|
| 647 |
+
),
|
| 648 |
+
)
|
| 649 |
+
|
| 650 |
+
def __call__(self, inst, attr, value):
|
| 651 |
+
try:
|
| 652 |
+
self.validator(inst, attr, value)
|
| 653 |
+
except self.exc_types:
|
| 654 |
+
pass # suppress error to invert validity
|
| 655 |
+
else:
|
| 656 |
+
raise ValueError(
|
| 657 |
+
self.msg.format(
|
| 658 |
+
validator=self.validator,
|
| 659 |
+
exc_types=self.exc_types,
|
| 660 |
+
),
|
| 661 |
+
attr,
|
| 662 |
+
self.validator,
|
| 663 |
+
value,
|
| 664 |
+
self.exc_types,
|
| 665 |
+
)
|
| 666 |
+
|
| 667 |
+
def __repr__(self):
|
| 668 |
+
return f"<not_ validator wrapping {self.validator!r}, capturing {self.exc_types!r}>"
|
| 669 |
+
|
| 670 |
+
|
| 671 |
+
def not_(validator, *, msg=None, exc_types=(ValueError, TypeError)):
|
| 672 |
+
"""
|
| 673 |
+
A validator that wraps and logically 'inverts' the validator passed to it.
|
| 674 |
+
It will raise a `ValueError` if the provided validator *doesn't* raise a
|
| 675 |
+
`ValueError` or `TypeError` (by default), and will suppress the exception
|
| 676 |
+
if the provided validator *does*.
|
| 677 |
+
|
| 678 |
+
Intended to be used with existing validators to compose logic without
|
| 679 |
+
needing to create inverted variants, for example, ``not_(in_(...))``.
|
| 680 |
+
|
| 681 |
+
Args:
|
| 682 |
+
validator: A validator to be logically inverted.
|
| 683 |
+
|
| 684 |
+
msg (str):
|
| 685 |
+
Message to raise if validator fails. Formatted with keys
|
| 686 |
+
``exc_types`` and ``validator``.
|
| 687 |
+
|
| 688 |
+
exc_types (tuple[type, ...]):
|
| 689 |
+
Exception type(s) to capture. Other types raised by child
|
| 690 |
+
validators will not be intercepted and pass through.
|
| 691 |
+
|
| 692 |
+
Raises:
|
| 693 |
+
ValueError:
|
| 694 |
+
With a human readable error message, the attribute (of type
|
| 695 |
+
`attrs.Attribute`), the validator that failed to raise an
|
| 696 |
+
exception, the value it got, and the expected exception types.
|
| 697 |
+
|
| 698 |
+
.. versionadded:: 22.2.0
|
| 699 |
+
"""
|
| 700 |
+
try:
|
| 701 |
+
exc_types = tuple(exc_types)
|
| 702 |
+
except TypeError:
|
| 703 |
+
exc_types = (exc_types,)
|
| 704 |
+
return _NotValidator(validator, msg, exc_types)
|
| 705 |
+
|
| 706 |
+
|
| 707 |
+
@attrs(repr=False, slots=True, unsafe_hash=True)
|
| 708 |
+
class _OrValidator:
|
| 709 |
+
validators = attrib()
|
| 710 |
+
|
| 711 |
+
def __call__(self, inst, attr, value):
|
| 712 |
+
for v in self.validators:
|
| 713 |
+
try:
|
| 714 |
+
v(inst, attr, value)
|
| 715 |
+
except Exception: # noqa: BLE001, PERF203, S112
|
| 716 |
+
continue
|
| 717 |
+
else:
|
| 718 |
+
return
|
| 719 |
+
|
| 720 |
+
msg = f"None of {self.validators!r} satisfied for value {value!r}"
|
| 721 |
+
raise ValueError(msg)
|
| 722 |
+
|
| 723 |
+
def __repr__(self):
|
| 724 |
+
return f"<or validator wrapping {self.validators!r}>"
|
| 725 |
+
|
| 726 |
+
|
| 727 |
+
def or_(*validators):
|
| 728 |
+
"""
|
| 729 |
+
A validator that composes multiple validators into one.
|
| 730 |
+
|
| 731 |
+
When called on a value, it runs all wrapped validators until one of them is
|
| 732 |
+
satisfied.
|
| 733 |
+
|
| 734 |
+
Args:
|
| 735 |
+
validators (~collections.abc.Iterable[typing.Callable]):
|
| 736 |
+
Arbitrary number of validators.
|
| 737 |
+
|
| 738 |
+
Raises:
|
| 739 |
+
ValueError:
|
| 740 |
+
If no validator is satisfied. Raised with a human-readable error
|
| 741 |
+
message listing all the wrapped validators and the value that
|
| 742 |
+
failed all of them.
|
| 743 |
+
|
| 744 |
+
.. versionadded:: 24.1.0
|
| 745 |
+
"""
|
| 746 |
+
vals = []
|
| 747 |
+
for v in validators:
|
| 748 |
+
vals.extend(v.validators if isinstance(v, _OrValidator) else [v])
|
| 749 |
+
|
| 750 |
+
return _OrValidator(tuple(vals))
|
bioagent-bench/.venv/lib/python3.14/site-packages/attr/validators.pyi
ADDED
|
@@ -0,0 +1,140 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from types import UnionType
|
| 2 |
+
from typing import (
|
| 3 |
+
Any,
|
| 4 |
+
AnyStr,
|
| 5 |
+
Callable,
|
| 6 |
+
Container,
|
| 7 |
+
ContextManager,
|
| 8 |
+
Iterable,
|
| 9 |
+
Mapping,
|
| 10 |
+
Match,
|
| 11 |
+
Pattern,
|
| 12 |
+
TypeVar,
|
| 13 |
+
overload,
|
| 14 |
+
)
|
| 15 |
+
|
| 16 |
+
from attrs import _ValidatorType
|
| 17 |
+
from attrs import _ValidatorArgType
|
| 18 |
+
|
| 19 |
+
_T = TypeVar("_T")
|
| 20 |
+
_T1 = TypeVar("_T1")
|
| 21 |
+
_T2 = TypeVar("_T2")
|
| 22 |
+
_T3 = TypeVar("_T3")
|
| 23 |
+
_T4 = TypeVar("_T4")
|
| 24 |
+
_T5 = TypeVar("_T5")
|
| 25 |
+
_T6 = TypeVar("_T6")
|
| 26 |
+
_I = TypeVar("_I", bound=Iterable)
|
| 27 |
+
_K = TypeVar("_K")
|
| 28 |
+
_V = TypeVar("_V")
|
| 29 |
+
_M = TypeVar("_M", bound=Mapping)
|
| 30 |
+
|
| 31 |
+
def set_disabled(run: bool) -> None: ...
|
| 32 |
+
def get_disabled() -> bool: ...
|
| 33 |
+
def disabled() -> ContextManager[None]: ...
|
| 34 |
+
|
| 35 |
+
# To be more precise on instance_of use some overloads.
|
| 36 |
+
# If there are more than 3 items in the tuple then we fall back to Any
|
| 37 |
+
@overload
|
| 38 |
+
def instance_of(type: type[_T]) -> _ValidatorType[_T]: ...
|
| 39 |
+
@overload
|
| 40 |
+
def instance_of(type: tuple[type[_T]]) -> _ValidatorType[_T]: ...
|
| 41 |
+
@overload
|
| 42 |
+
def instance_of(
|
| 43 |
+
type: tuple[type[_T1], type[_T2]],
|
| 44 |
+
) -> _ValidatorType[_T1 | _T2]: ...
|
| 45 |
+
@overload
|
| 46 |
+
def instance_of(
|
| 47 |
+
type: tuple[type[_T1], type[_T2], type[_T3]],
|
| 48 |
+
) -> _ValidatorType[_T1 | _T2 | _T3]: ...
|
| 49 |
+
@overload
|
| 50 |
+
def instance_of(type: tuple[type, ...]) -> _ValidatorType[Any]: ...
|
| 51 |
+
@overload
|
| 52 |
+
def instance_of(type: UnionType) -> _ValidatorType[Any]: ...
|
| 53 |
+
def optional(
|
| 54 |
+
validator: (
|
| 55 |
+
_ValidatorType[_T]
|
| 56 |
+
| list[_ValidatorType[_T]]
|
| 57 |
+
| tuple[_ValidatorType[_T], ...]
|
| 58 |
+
),
|
| 59 |
+
) -> _ValidatorType[_T | None]: ...
|
| 60 |
+
def in_(options: Container[_T]) -> _ValidatorType[_T]: ...
|
| 61 |
+
def and_(*validators: _ValidatorType[_T]) -> _ValidatorType[_T]: ...
|
| 62 |
+
def matches_re(
|
| 63 |
+
regex: Pattern[AnyStr] | AnyStr,
|
| 64 |
+
flags: int = ...,
|
| 65 |
+
func: Callable[[AnyStr, AnyStr, int], Match[AnyStr] | None] | None = ...,
|
| 66 |
+
) -> _ValidatorType[AnyStr]: ...
|
| 67 |
+
def deep_iterable(
|
| 68 |
+
member_validator: _ValidatorArgType[_T],
|
| 69 |
+
iterable_validator: _ValidatorArgType[_I] | None = ...,
|
| 70 |
+
) -> _ValidatorType[_I]: ...
|
| 71 |
+
@overload
|
| 72 |
+
def deep_mapping(
|
| 73 |
+
key_validator: _ValidatorArgType[_K],
|
| 74 |
+
value_validator: _ValidatorArgType[_V] | None = ...,
|
| 75 |
+
mapping_validator: _ValidatorArgType[_M] | None = ...,
|
| 76 |
+
) -> _ValidatorType[_M]: ...
|
| 77 |
+
@overload
|
| 78 |
+
def deep_mapping(
|
| 79 |
+
key_validator: _ValidatorArgType[_K] | None = ...,
|
| 80 |
+
value_validator: _ValidatorArgType[_V] = ...,
|
| 81 |
+
mapping_validator: _ValidatorArgType[_M] | None = ...,
|
| 82 |
+
) -> _ValidatorType[_M]: ...
|
| 83 |
+
def is_callable() -> _ValidatorType[_T]: ...
|
| 84 |
+
def lt(val: _T) -> _ValidatorType[_T]: ...
|
| 85 |
+
def le(val: _T) -> _ValidatorType[_T]: ...
|
| 86 |
+
def ge(val: _T) -> _ValidatorType[_T]: ...
|
| 87 |
+
def gt(val: _T) -> _ValidatorType[_T]: ...
|
| 88 |
+
def max_len(length: int) -> _ValidatorType[_T]: ...
|
| 89 |
+
def min_len(length: int) -> _ValidatorType[_T]: ...
|
| 90 |
+
def not_(
|
| 91 |
+
validator: _ValidatorType[_T],
|
| 92 |
+
*,
|
| 93 |
+
msg: str | None = None,
|
| 94 |
+
exc_types: type[Exception] | Iterable[type[Exception]] = ...,
|
| 95 |
+
) -> _ValidatorType[_T]: ...
|
| 96 |
+
@overload
|
| 97 |
+
def or_(
|
| 98 |
+
__v1: _ValidatorType[_T1],
|
| 99 |
+
__v2: _ValidatorType[_T2],
|
| 100 |
+
) -> _ValidatorType[_T1 | _T2]: ...
|
| 101 |
+
@overload
|
| 102 |
+
def or_(
|
| 103 |
+
__v1: _ValidatorType[_T1],
|
| 104 |
+
__v2: _ValidatorType[_T2],
|
| 105 |
+
__v3: _ValidatorType[_T3],
|
| 106 |
+
) -> _ValidatorType[_T1 | _T2 | _T3]: ...
|
| 107 |
+
@overload
|
| 108 |
+
def or_(
|
| 109 |
+
__v1: _ValidatorType[_T1],
|
| 110 |
+
__v2: _ValidatorType[_T2],
|
| 111 |
+
__v3: _ValidatorType[_T3],
|
| 112 |
+
__v4: _ValidatorType[_T4],
|
| 113 |
+
) -> _ValidatorType[_T1 | _T2 | _T3 | _T4]: ...
|
| 114 |
+
@overload
|
| 115 |
+
def or_(
|
| 116 |
+
__v1: _ValidatorType[_T1],
|
| 117 |
+
__v2: _ValidatorType[_T2],
|
| 118 |
+
__v3: _ValidatorType[_T3],
|
| 119 |
+
__v4: _ValidatorType[_T4],
|
| 120 |
+
__v5: _ValidatorType[_T5],
|
| 121 |
+
) -> _ValidatorType[_T1 | _T2 | _T3 | _T4 | _T5]: ...
|
| 122 |
+
@overload
|
| 123 |
+
def or_(
|
| 124 |
+
__v1: _ValidatorType[_T1],
|
| 125 |
+
__v2: _ValidatorType[_T2],
|
| 126 |
+
__v3: _ValidatorType[_T3],
|
| 127 |
+
__v4: _ValidatorType[_T4],
|
| 128 |
+
__v5: _ValidatorType[_T5],
|
| 129 |
+
__v6: _ValidatorType[_T6],
|
| 130 |
+
) -> _ValidatorType[_T1 | _T2 | _T3 | _T4 | _T5 | _T6]: ...
|
| 131 |
+
@overload
|
| 132 |
+
def or_(
|
| 133 |
+
__v1: _ValidatorType[Any],
|
| 134 |
+
__v2: _ValidatorType[Any],
|
| 135 |
+
__v3: _ValidatorType[Any],
|
| 136 |
+
__v4: _ValidatorType[Any],
|
| 137 |
+
__v5: _ValidatorType[Any],
|
| 138 |
+
__v6: _ValidatorType[Any],
|
| 139 |
+
*validators: _ValidatorType[Any],
|
| 140 |
+
) -> _ValidatorType[Any]: ...
|
bioagent-bench/.venv/lib/python3.14/site-packages/attrs-26.1.0.dist-info/INSTALLER
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
uv
|
bioagent-bench/.venv/lib/python3.14/site-packages/attrs-26.1.0.dist-info/METADATA
ADDED
|
@@ -0,0 +1,199 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Metadata-Version: 2.4
|
| 2 |
+
Name: attrs
|
| 3 |
+
Version: 26.1.0
|
| 4 |
+
Summary: Classes Without Boilerplate
|
| 5 |
+
Project-URL: Documentation, https://www.attrs.org/
|
| 6 |
+
Project-URL: Changelog, https://www.attrs.org/en/stable/changelog.html
|
| 7 |
+
Project-URL: GitHub, https://github.com/python-attrs/attrs
|
| 8 |
+
Project-URL: Funding, https://github.com/sponsors/hynek
|
| 9 |
+
Project-URL: Tidelift, https://tidelift.com/subscription/pkg/pypi-attrs?utm_source=pypi-attrs&utm_medium=pypi
|
| 10 |
+
Author-email: Hynek Schlawack <hs@ox.cx>
|
| 11 |
+
License-Expression: MIT
|
| 12 |
+
License-File: LICENSE
|
| 13 |
+
Keywords: attribute,boilerplate,class
|
| 14 |
+
Classifier: Development Status :: 5 - Production/Stable
|
| 15 |
+
Classifier: Programming Language :: Python :: 3.9
|
| 16 |
+
Classifier: Programming Language :: Python :: 3.10
|
| 17 |
+
Classifier: Programming Language :: Python :: 3.11
|
| 18 |
+
Classifier: Programming Language :: Python :: 3.12
|
| 19 |
+
Classifier: Programming Language :: Python :: 3.13
|
| 20 |
+
Classifier: Programming Language :: Python :: 3.14
|
| 21 |
+
Classifier: Programming Language :: Python :: Implementation :: CPython
|
| 22 |
+
Classifier: Programming Language :: Python :: Implementation :: PyPy
|
| 23 |
+
Classifier: Typing :: Typed
|
| 24 |
+
Requires-Python: >=3.9
|
| 25 |
+
Description-Content-Type: text/markdown
|
| 26 |
+
|
| 27 |
+
<p align="center">
|
| 28 |
+
<a href="https://www.attrs.org/">
|
| 29 |
+
<img src="https://raw.githubusercontent.com/python-attrs/attrs/main/docs/_static/attrs_logo.svg" width="35%" alt="attrs" />
|
| 30 |
+
</a>
|
| 31 |
+
</p>
|
| 32 |
+
|
| 33 |
+
|
| 34 |
+
*attrs* is the Python package that will bring back the **joy** of **writing classes** by relieving you from the drudgery of implementing object protocols (aka [dunder methods](https://www.attrs.org/en/latest/glossary.html#term-dunder-methods)).
|
| 35 |
+
Trusted by NASA for [Mars missions since 2020](https://github.com/readme/featured/nasa-ingenuity-helicopter)!
|
| 36 |
+
|
| 37 |
+
Its main goal is to help you to write **concise** and **correct** software without slowing down your code.
|
| 38 |
+
|
| 39 |
+
|
| 40 |
+
## Sponsors
|
| 41 |
+
|
| 42 |
+
*attrs* would not be possible without our [amazing sponsors](https://github.com/sponsors/hynek).
|
| 43 |
+
Especially those generously supporting us at the *The Organization* tier and higher:
|
| 44 |
+
|
| 45 |
+
<!-- sponsor-break-begin -->
|
| 46 |
+
|
| 47 |
+
<p align="center">
|
| 48 |
+
|
| 49 |
+
<!-- [[[cog
|
| 50 |
+
import pathlib, tomllib
|
| 51 |
+
|
| 52 |
+
for sponsor in tomllib.loads(pathlib.Path("pyproject.toml").read_text())["tool"]["sponcon"]["sponsors"]:
|
| 53 |
+
print(f'<a href="{sponsor["url"]}"><img title="{sponsor["title"]}" src="https://www.attrs.org/en/26.1.0/_static/sponsors/{sponsor["img"]}" width="190" /></a>')
|
| 54 |
+
]]] -->
|
| 55 |
+
<a href="https://www.variomedia.de/"><img title="Variomedia AG" src="https://www.attrs.org/en/26.1.0/_static/sponsors/Variomedia.svg" width="190" /></a>
|
| 56 |
+
<a href="https://tidelift.com/?utm_source=lifter&utm_medium=referral&utm_campaign=hynek"><img title="Tidelift" src="https://www.attrs.org/en/26.1.0/_static/sponsors/Tidelift.svg" width="190" /></a>
|
| 57 |
+
<a href="https://kraken.tech/"><img title="Kraken Tech" src="https://www.attrs.org/en/26.1.0/_static/sponsors/Kraken.svg" width="190" /></a>
|
| 58 |
+
<a href="https://privacy-solutions.org/"><img title="Privacy Solutions" src="https://www.attrs.org/en/26.1.0/_static/sponsors/Privacy-Solutions.svg" width="190" /></a>
|
| 59 |
+
<a href="https://filepreviews.io/"><img title="FilePreviews" src="https://www.attrs.org/en/26.1.0/_static/sponsors/FilePreviews.svg" width="190" /></a>
|
| 60 |
+
<a href="https://www.testmuai.com/?utm_medium=sponsor&utm_source=structlog"><img title="TestMu AI" src="https://www.attrs.org/en/26.1.0/_static/sponsors/TestMu-AI.svg" width="190" /></a>
|
| 61 |
+
<a href="https://polar.sh/"><img title="Polar" src="https://www.attrs.org/en/26.1.0/_static/sponsors/Polar.svg" width="190" /></a>
|
| 62 |
+
<!-- [[[end]]] -->
|
| 63 |
+
|
| 64 |
+
</p>
|
| 65 |
+
|
| 66 |
+
<!-- sponsor-break-end -->
|
| 67 |
+
|
| 68 |
+
<p align="center">
|
| 69 |
+
<strong>Please consider <a href="https://github.com/sponsors/hynek">joining them</a> to help make <em>attrs</em>’s maintenance more sustainable!</strong>
|
| 70 |
+
</p>
|
| 71 |
+
|
| 72 |
+
<!-- teaser-end -->
|
| 73 |
+
|
| 74 |
+
## Example
|
| 75 |
+
|
| 76 |
+
*attrs* gives you a class decorator and a way to declaratively define the attributes on that class:
|
| 77 |
+
|
| 78 |
+
<!-- code-begin -->
|
| 79 |
+
|
| 80 |
+
```pycon
|
| 81 |
+
>>> from attrs import asdict, define, make_class, Factory
|
| 82 |
+
|
| 83 |
+
>>> @define
|
| 84 |
+
... class SomeClass:
|
| 85 |
+
... a_number: int = 42
|
| 86 |
+
... list_of_numbers: list[int] = Factory(list)
|
| 87 |
+
...
|
| 88 |
+
... def hard_math(self, another_number):
|
| 89 |
+
... return self.a_number + sum(self.list_of_numbers) * another_number
|
| 90 |
+
|
| 91 |
+
|
| 92 |
+
>>> sc = SomeClass(1, [1, 2, 3])
|
| 93 |
+
>>> sc
|
| 94 |
+
SomeClass(a_number=1, list_of_numbers=[1, 2, 3])
|
| 95 |
+
|
| 96 |
+
>>> sc.hard_math(3)
|
| 97 |
+
19
|
| 98 |
+
>>> sc == SomeClass(1, [1, 2, 3])
|
| 99 |
+
True
|
| 100 |
+
>>> sc != SomeClass(2, [3, 2, 1])
|
| 101 |
+
True
|
| 102 |
+
|
| 103 |
+
>>> asdict(sc)
|
| 104 |
+
{'a_number': 1, 'list_of_numbers': [1, 2, 3]}
|
| 105 |
+
|
| 106 |
+
>>> SomeClass()
|
| 107 |
+
SomeClass(a_number=42, list_of_numbers=[])
|
| 108 |
+
|
| 109 |
+
>>> C = make_class("C", ["a", "b"])
|
| 110 |
+
>>> C("foo", "bar")
|
| 111 |
+
C(a='foo', b='bar')
|
| 112 |
+
```
|
| 113 |
+
|
| 114 |
+
After *declaring* your attributes, *attrs* gives you:
|
| 115 |
+
|
| 116 |
+
- a concise and explicit overview of the class's attributes,
|
| 117 |
+
- a nice human-readable `__repr__`,
|
| 118 |
+
- equality-checking methods,
|
| 119 |
+
- an initializer,
|
| 120 |
+
- and much more,
|
| 121 |
+
|
| 122 |
+
*without* writing dull boilerplate code again and again and *without* runtime performance penalties.
|
| 123 |
+
|
| 124 |
+
---
|
| 125 |
+
|
| 126 |
+
This example uses *attrs*'s modern APIs that have been introduced in version 20.1.0, and the *attrs* package import name that has been added in version 21.3.0.
|
| 127 |
+
The classic APIs (`@attr.s`, `attr.ib`, plus their serious-business aliases) and the `attr` package import name will remain **indefinitely**.
|
| 128 |
+
|
| 129 |
+
Check out [*On The Core API Names*](https://www.attrs.org/en/latest/names.html) for an in-depth explanation!
|
| 130 |
+
|
| 131 |
+
|
| 132 |
+
### Hate Type Annotations!?
|
| 133 |
+
|
| 134 |
+
No problem!
|
| 135 |
+
Types are entirely **optional** with *attrs*.
|
| 136 |
+
Simply assign `attrs.field()` to the attributes instead of annotating them with types:
|
| 137 |
+
|
| 138 |
+
```python
|
| 139 |
+
from attrs import define, field
|
| 140 |
+
|
| 141 |
+
@define
|
| 142 |
+
class SomeClass:
|
| 143 |
+
a_number = field(default=42)
|
| 144 |
+
list_of_numbers = field(factory=list)
|
| 145 |
+
```
|
| 146 |
+
|
| 147 |
+
|
| 148 |
+
## Data Classes
|
| 149 |
+
|
| 150 |
+
On the tin, *attrs* might remind you of `dataclasses` (and indeed, `dataclasses` [are a descendant](https://hynek.me/articles/import-attrs/) of *attrs*).
|
| 151 |
+
In practice it does a lot more and is more flexible.
|
| 152 |
+
For instance, it allows you to define [special handling of NumPy arrays for equality checks](https://www.attrs.org/en/stable/comparison.html#customization), allows more ways to [plug into the initialization process](https://www.attrs.org/en/stable/init.html#hooking-yourself-into-initialization), has a replacement for `__init_subclass__`, and allows for stepping through the generated methods using a debugger.
|
| 153 |
+
|
| 154 |
+
For more details, please refer to our [comparison page](https://www.attrs.org/en/stable/why.html#data-classes), but generally speaking, we are more likely to commit crimes against nature to make things work that one would expect to work, but that are quite complicated in practice.
|
| 155 |
+
|
| 156 |
+
|
| 157 |
+
## Project Information
|
| 158 |
+
|
| 159 |
+
- [**Changelog**](https://www.attrs.org/en/stable/changelog.html)
|
| 160 |
+
- [**Documentation**](https://www.attrs.org/)
|
| 161 |
+
- [**PyPI**](https://pypi.org/project/attrs/)
|
| 162 |
+
- [**Source Code**](https://github.com/python-attrs/attrs)
|
| 163 |
+
- [**Contributing**](https://github.com/python-attrs/attrs/blob/main/.github/CONTRIBUTING.md)
|
| 164 |
+
- [**Third-party Extensions**](https://github.com/python-attrs/attrs/wiki/Extensions-to-attrs)
|
| 165 |
+
- **Get Help**: use the `python-attrs` tag on [Stack Overflow](https://stackoverflow.com/questions/tagged/python-attrs)
|
| 166 |
+
|
| 167 |
+
|
| 168 |
+
### *attrs* for Enterprise
|
| 169 |
+
|
| 170 |
+
Available as part of the [Tidelift Subscription](https://tidelift.com/?utm_source=lifter&utm_medium=referral&utm_campaign=hynek).
|
| 171 |
+
|
| 172 |
+
The maintainers of *attrs* and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source packages you use to build your applications.
|
| 173 |
+
Save time, reduce risk, and improve code health, while paying the maintainers of the exact packages you use.
|
| 174 |
+
|
| 175 |
+
## Release Information
|
| 176 |
+
|
| 177 |
+
### Backwards-incompatible Changes
|
| 178 |
+
|
| 179 |
+
- Field aliases are now resolved *before* calling `field_transformer`, so transformers receive fully populated `Attribute` objects with usable `alias` values instead of `None`.
|
| 180 |
+
The new `Attribute.alias_is_default` flag indicates whether the alias was auto-generated (`True`) or explicitly set by the user (`False`).
|
| 181 |
+
[#1509](https://github.com/python-attrs/attrs/issues/1509)
|
| 182 |
+
|
| 183 |
+
|
| 184 |
+
### Changes
|
| 185 |
+
|
| 186 |
+
- Fix type annotations for `attrs.validators.optional()`, so it no longer rejects tuples with more than one validator.
|
| 187 |
+
[#1496](https://github.com/python-attrs/attrs/issues/1496)
|
| 188 |
+
- The `attrs.validators.disabled()` contextmanager can now be nested.
|
| 189 |
+
[#1513](https://github.com/python-attrs/attrs/issues/1513)
|
| 190 |
+
- Frozen classes can set `on_setattr=attrs.setters.NO_OP` in addition to `None`.
|
| 191 |
+
[#1515](https://github.com/python-attrs/attrs/issues/1515)
|
| 192 |
+
- It's now possible to pass *attrs* **instances** in addition to *attrs* **classes** to `attrs.fields()`.
|
| 193 |
+
[#1529](https://github.com/python-attrs/attrs/issues/1529)
|
| 194 |
+
|
| 195 |
+
|
| 196 |
+
|
| 197 |
+
---
|
| 198 |
+
|
| 199 |
+
[Full changelog →](https://www.attrs.org/en/stable/changelog.html)
|
bioagent-bench/.venv/lib/python3.14/site-packages/attrs-26.1.0.dist-info/RECORD
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
attr/__init__.py,sha256=fOYIvt1eGSqQre4uCS3sJWKZ0mwAuC8UD6qba5OS9_U,2057
|
| 2 |
+
attr/__init__.pyi,sha256=pVGImAUVovq2_TYl_r_HIYnGlyOaoCuEhxo-EvsnnSc,11325
|
| 3 |
+
attr/_cmp.py,sha256=3Nn1TjxllUYiX_nJoVnEkXoDk0hM1DYKj5DE7GZe4i0,4117
|
| 4 |
+
attr/_cmp.pyi,sha256=U-_RU_UZOyPUEQzXE6RMYQQcjkZRY25wTH99sN0s7MM,368
|
| 5 |
+
attr/_compat.py,sha256=x0g7iEUOnBVJC72zyFCgb1eKqyxS-7f2LGnNyZ_r95s,2829
|
| 6 |
+
attr/_config.py,sha256=dGq3xR6fgZEF6UBt_L0T-eUHIB4i43kRmH0P28sJVw8,843
|
| 7 |
+
attr/_funcs.py,sha256=Ix5IETTfz5F01F-12MF_CSFomIn2h8b67EVVz2gCtBE,16479
|
| 8 |
+
attr/_make.py,sha256=H7OH2eWS5CnBzLUjNFE1WymfPrmF1r8fv2RPdt9MuYA,106129
|
| 9 |
+
attr/_next_gen.py,sha256=BQtCUlzwg2gWHTYXBQvrEYBnzBUrDvO57u0Py6UCPhc,26274
|
| 10 |
+
attr/_typing_compat.pyi,sha256=XDP54TUn-ZKhD62TOQebmzrwFyomhUCoGRpclb6alRA,469
|
| 11 |
+
attr/_version_info.py,sha256=w4R-FYC3NK_kMkGUWJlYP4cVAlH9HRaC-um3fcjYkHM,2222
|
| 12 |
+
attr/_version_info.pyi,sha256=x_M3L3WuB7r_ULXAWjx959udKQ4HLB8l-hsc1FDGNvk,209
|
| 13 |
+
attr/converters.py,sha256=GlDeOzPeTFgeBBLbj9G57Ez5lAk68uhSALRYJ_exe84,3861
|
| 14 |
+
attr/converters.pyi,sha256=orU2bff-VjQa2kMDyvnMQV73oJT2WRyQuw4ZR1ym1bE,643
|
| 15 |
+
attr/exceptions.py,sha256=b4vMbnoQ3VpwWZhqrYi_ssXVCK8o2c4HQSS09cSUM9o,1990
|
| 16 |
+
attr/exceptions.pyi,sha256=zZq8bCUnKAy9mDtBEw42ZhPhAUIHoTKedDQInJD883M,539
|
| 17 |
+
attr/filters.py,sha256=ZBiKWLp3R0LfCZsq7X11pn9WX8NslS2wXM4jsnLOGc8,1795
|
| 18 |
+
attr/filters.pyi,sha256=3J5BG-dTxltBk1_-RuNRUHrv2qu1v8v4aDNAQ7_mifA,208
|
| 19 |
+
attr/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
| 20 |
+
attr/setters.py,sha256=5-dcT63GQK35ONEzSgfXCkbB7pPkaR-qv15mm4PVSzQ,1617
|
| 21 |
+
attr/setters.pyi,sha256=NnVkaFU1BB4JB8E4JuXyrzTUgvtMpj8p3wBdJY7uix4,584
|
| 22 |
+
attr/validators.py,sha256=m3QRzZTANr4f2C4eVdUoFg11NgXWak8Wat4qQTGhvcs,21553
|
| 23 |
+
attr/validators.pyi,sha256=gM1ZmHaBckyYWI2EirpRNzqm3B19cw5Iq6B4Kno9YCM,4087
|
| 24 |
+
attrs-26.1.0.dist-info/INSTALLER,sha256=5hhM4Q4mYTT9z6QB6PGpUAW81PGNFrYrdXMj4oM_6ak,2
|
| 25 |
+
attrs-26.1.0.dist-info/METADATA,sha256=TNQOaQ8jvzfLytNO_WdY4GLfHfB8hoM_fjzpW_H6OMw,8754
|
| 26 |
+
attrs-26.1.0.dist-info/RECORD,,
|
| 27 |
+
attrs-26.1.0.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
| 28 |
+
attrs-26.1.0.dist-info/WHEEL,sha256=QccIxa26bgl1E6uMy58deGWi-0aeIkkangHcxk2kWfw,87
|
| 29 |
+
attrs-26.1.0.dist-info/licenses/LICENSE,sha256=iCEVyV38KvHutnFPjsbVy8q_Znyv-HKfQkINpj9xTp8,1109
|
| 30 |
+
attrs/__init__.py,sha256=RxaAZNwYiEh-fcvHLZNpQ_DWKni73M_jxEPEftiq1Zc,1183
|
| 31 |
+
attrs/__init__.pyi,sha256=2gV79g9UxJppGSM48hAZJ6h_MHb70dZoJL31ZNJeZYI,9416
|
| 32 |
+
attrs/converters.py,sha256=8kQljrVwfSTRu8INwEk8SI0eGrzmWftsT7rM0EqyohM,76
|
| 33 |
+
attrs/exceptions.py,sha256=ACCCmg19-vDFaDPY9vFl199SPXCQMN_bENs4DALjzms,76
|
| 34 |
+
attrs/filters.py,sha256=VOUMZug9uEU6dUuA0dF1jInUK0PL3fLgP0VBS5d-CDE,73
|
| 35 |
+
attrs/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
| 36 |
+
attrs/setters.py,sha256=eL1YidYQV3T2h9_SYIZSZR1FAcHGb1TuCTy0E0Lv2SU,73
|
| 37 |
+
attrs/validators.py,sha256=xcy6wD5TtTkdCG1f4XWbocPSO0faBjk5IfVJfP6SUj0,76
|
bioagent-bench/.venv/lib/python3.14/site-packages/attrs-26.1.0.dist-info/REQUESTED
ADDED
|
File without changes
|
bioagent-bench/.venv/lib/python3.14/site-packages/attrs-26.1.0.dist-info/WHEEL
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Wheel-Version: 1.0
|
| 2 |
+
Generator: hatchling 1.29.0
|
| 3 |
+
Root-Is-Purelib: true
|
| 4 |
+
Tag: py3-none-any
|
bioagent-bench/.venv/lib/python3.14/site-packages/attrs-26.1.0.dist-info/licenses/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
The MIT License (MIT)
|
| 2 |
+
|
| 3 |
+
Copyright (c) 2015 Hynek Schlawack and the attrs contributors
|
| 4 |
+
|
| 5 |
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
| 6 |
+
of this software and associated documentation files (the "Software"), to deal
|
| 7 |
+
in the Software without restriction, including without limitation the rights
|
| 8 |
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
| 9 |
+
copies of the Software, and to permit persons to whom the Software is
|
| 10 |
+
furnished to do so, subject to the following conditions:
|
| 11 |
+
|
| 12 |
+
The above copyright notice and this permission notice shall be included in all
|
| 13 |
+
copies or substantial portions of the Software.
|
| 14 |
+
|
| 15 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
| 16 |
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
| 17 |
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
| 18 |
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
| 19 |
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
| 20 |
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
| 21 |
+
SOFTWARE.
|
bioagent-bench/.venv/lib/python3.14/site-packages/attrs/__init__.py
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# SPDX-License-Identifier: MIT
|
| 2 |
+
|
| 3 |
+
from attr import (
|
| 4 |
+
NOTHING,
|
| 5 |
+
Attribute,
|
| 6 |
+
AttrsInstance,
|
| 7 |
+
Converter,
|
| 8 |
+
Factory,
|
| 9 |
+
NothingType,
|
| 10 |
+
_make_getattr,
|
| 11 |
+
assoc,
|
| 12 |
+
cmp_using,
|
| 13 |
+
define,
|
| 14 |
+
evolve,
|
| 15 |
+
field,
|
| 16 |
+
fields,
|
| 17 |
+
fields_dict,
|
| 18 |
+
frozen,
|
| 19 |
+
has,
|
| 20 |
+
make_class,
|
| 21 |
+
mutable,
|
| 22 |
+
resolve_types,
|
| 23 |
+
validate,
|
| 24 |
+
)
|
| 25 |
+
from attr._make import ClassProps
|
| 26 |
+
from attr._next_gen import asdict, astuple, inspect
|
| 27 |
+
|
| 28 |
+
from . import converters, exceptions, filters, setters, validators
|
| 29 |
+
|
| 30 |
+
|
| 31 |
+
__all__ = [
|
| 32 |
+
"NOTHING",
|
| 33 |
+
"Attribute",
|
| 34 |
+
"AttrsInstance",
|
| 35 |
+
"ClassProps",
|
| 36 |
+
"Converter",
|
| 37 |
+
"Factory",
|
| 38 |
+
"NothingType",
|
| 39 |
+
"__author__",
|
| 40 |
+
"__copyright__",
|
| 41 |
+
"__description__",
|
| 42 |
+
"__doc__",
|
| 43 |
+
"__email__",
|
| 44 |
+
"__license__",
|
| 45 |
+
"__title__",
|
| 46 |
+
"__url__",
|
| 47 |
+
"__version__",
|
| 48 |
+
"__version_info__",
|
| 49 |
+
"asdict",
|
| 50 |
+
"assoc",
|
| 51 |
+
"astuple",
|
| 52 |
+
"cmp_using",
|
| 53 |
+
"converters",
|
| 54 |
+
"define",
|
| 55 |
+
"evolve",
|
| 56 |
+
"exceptions",
|
| 57 |
+
"field",
|
| 58 |
+
"fields",
|
| 59 |
+
"fields_dict",
|
| 60 |
+
"filters",
|
| 61 |
+
"frozen",
|
| 62 |
+
"has",
|
| 63 |
+
"inspect",
|
| 64 |
+
"make_class",
|
| 65 |
+
"mutable",
|
| 66 |
+
"resolve_types",
|
| 67 |
+
"setters",
|
| 68 |
+
"validate",
|
| 69 |
+
"validators",
|
| 70 |
+
]
|
| 71 |
+
|
| 72 |
+
__getattr__ = _make_getattr(__name__)
|